vr.55390d87.js 786 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"dKqR":[function(require,module,exports) {
  2. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AmbientLight=af,exports.AmbientLightProbe=Cf,exports.AnimationClip=od,exports.AnimationLoader=fd,exports.AnimationMixer=lm,exports.AnimationObjectGroup=am,exports.ArcCurve=wd,exports.ArrayCamera=hh,exports.AudioLoader=Lf,exports.AxisHelper=ax,exports.BinaryTextureLoader=px,exports.Bone=Zh,exports.BooleanKeyframeTrack=Kp,exports.BoundingBoxHelper=cx,exports.BufferAttribute=wr,exports.BufferGeometry=Vr,exports.BufferGeometryLoader=mf,exports.Camera=vo,exports.CanvasRenderer=mx,exports.CanvasTexture=Su,exports.CatmullRomCurve3=Ld,exports.ClosedSplineCurve3=rx,exports.ColorKeyframeTrack=$p,exports.CompressedTexture=Mu,exports.CompressedTextureLoader=md,exports.CubeCamera=wo,exports.CubeTexture=Mo,exports.CubeTextureLoader=xd,exports.CubicBezierCurve=zd,exports.CubicBezierCurve3=Hd,exports.CubicInterpolant=Yp,exports.Curve=_d,exports.CurvePath=Xd,exports.DataTexture=To,exports.DataTexture2DArray=gc,exports.DataTexture3D=xc,exports.DataTextureLoader=vd,exports.DepthTexture=Tu,exports.DirectionalLight=sf,exports.DiscreteInterpolant=Jp,exports.DynamicBufferAttribute=Yg,exports.EdgesHelper=lx,exports.EllipseCurve=bd,exports.EventDispatcher=On,exports.Face4=Og,exports.FileLoader=dd,exports.Float16BufferAttribute=Cr,exports.Float32Attribute=nx,exports.Float32BufferAttribute=Pr,exports.Float64Attribute=ix,exports.Float64BufferAttribute=Dr,exports.FontLoader=Tf,exports.GLBufferAttribute=pm,exports.Group=uh,exports.HemisphereLight=Qd,exports.HemisphereLightProbe=Rf,exports.ImageBitmapLoader=_f,exports.ImageLoader=gd,exports.ImmediateRenderObject=Mm,exports.InstancedBufferAttribute=ff,exports.InstancedBufferGeometry=df,exports.InstancedInterleavedBuffer=um,exports.InstancedMesh=iu,exports.Int16Attribute=Kg,exports.Int16BufferAttribute=Er,exports.Int32Attribute=tx,exports.Int32BufferAttribute=Lr,exports.Int8Attribute=Zg,exports.Int8BufferAttribute=Mr,exports.InterleavedBuffer=bh,exports.InterleavedBufferAttribute=Mh,exports.Interpolant=Xp,exports.JSONLoader=gx,exports.KeyframeTrack=Qp,exports.LOD=kh,exports.LensFlare=vx,exports.Light=Jd,exports.LightProbe=hf,exports.Line=hu,exports.LineBasicMaterial=ru,exports.LineCurve=Ud,exports.LineCurve3=kd,exports.LineDashedMaterial=Wp,exports.LineLoop=fu,exports.LineSegments=du,exports.LinearInterpolant=Zp,exports.Loader=ud,exports.LoadingManager=ld,exports.Material=vr,exports.MaterialLoader=uf,exports.Mesh=ao,exports.MeshBasicMaterial=yr,exports.MeshDepthMaterial=nh,exports.MeshDistanceMaterial=ih,exports.MeshFaceMaterial=zg,exports.MeshLambertMaterial=kp,exports.MeshMatcapMaterial=Vp,exports.MeshNormalMaterial=Up,exports.MeshPhongMaterial=zp,exports.MeshPhysicalMaterial=Gp,exports.MeshStandardMaterial=Fp,exports.MeshToonMaterial=Hp,exports.MultiMaterial=Hg,exports.NumberKeyframeTrack=td,exports.Object3D=Xi,exports.OrthographicCamera=rf,exports.ParametricGeometry=exports.ParametricBufferGeometry=Mp,exports.Particle=kg,exports.ParticleBasicMaterial=jg,exports.ParticleSystem=Vg,exports.ParticleSystemMaterial=qg,exports.Path=Yd,exports.PerspectiveCamera=yo,exports.PointCloud=Ug,exports.PointCloudMaterial=Wg,exports.PointLight=nf,exports.Points=_u,exports.PointsMaterial=mu,exports.PropertyBinding=sm,exports.PropertyMixer=Yf,exports.QuadraticBezierCurve=Vd,exports.QuadraticBezierCurve3=Wd,exports.QuaternionKeyframeTrack=nd,exports.QuaternionLinearInterpolant=ed,exports.RawShaderMaterial=Np,exports.Raycaster=dm,exports.RectAreaLight=cf,exports.ShaderMaterial=xo,exports.ShadowMaterial=Bp,exports.Shape=Zd,exports.ShapePath=bf,exports.Skeleton=Kh,exports.SkinnedMesh=Yh,exports.Spline=sx,exports.SplineCurve=jd,exports.SplineCurve3=ox,exports.SpotLight=tf,exports.Sprite=Gh,exports.SpriteMaterial=Sh,exports.StereoCamera=Of,exports.StringKeyframeTrack=id,exports.Texture=kn,exports.TextureLoader=yd,exports.Uint16Attribute=$g,exports.Uint16BufferAttribute=Ar,exports.Uint32Attribute=ex,exports.Uint32BufferAttribute=Rr,exports.Uint8Attribute=Jg,exports.Uint8BufferAttribute=Sr,exports.Uint8ClampedAttribute=Qg,exports.Uint8ClampedBufferAttribute=Tr,exports.VectorKeyframeTrack=rd,exports.Vertex=Xg,exports.VideoTexture=wu,exports.WebGL1Renderer=xh,exports.WebGLRenderTargetCube=dx,exports.WebGLRenderer=gh,exports.WebGLUtils=lh,exports.WireframeHelper=hx,exports.XHRLoader=ux,exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightHelper=exports.HalfFloatType=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GeometryUtils=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.Font=exports.FogExp2=exports.Fog=exports.FloatType=exports.FlatShading=exports.FaceColors=exports.Face3=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.ConeGeometry=exports.ConeBufferGeometry=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.AnimationUtils=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.Quaternion=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointLightHelper=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=exports.ObjectLoader=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.Line3=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.KeepStencilOp=exports.InvertStencilOp=void 0,exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.VertexColors=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpotLightHelper=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.ShortType=exports.ShapeUtils=exports.ShapeGeometry=exports.ShapeBufferGeometry=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.Ray=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=void 0;const t="125";exports.REVISION="125";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const i=0;exports.CullFaceNone=i;const r=1;exports.CullFaceBack=r;const o=2;exports.CullFaceFront=o;const s=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const c=1;exports.PCFShadowMap=c;const l=2;exports.PCFSoftShadowMap=l;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const f=1;exports.FlatShading=1;const m=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const O=206;exports.DstAlphaFactor=O;const I=207;exports.OneMinusDstAlphaFactor=I;const B=208;exports.DstColorFactor=B;const N=209;exports.OneMinusDstColorFactor=N;const F=210;exports.SrcAlphaSaturateFactor=F;const G=0;exports.NeverDepth=G;const z=1;exports.AlwaysDepth=z;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=300;const nt=301;exports.CubeReflectionMapping=nt;const it=302;exports.CubeRefractionMapping=it;const rt=303;exports.EquirectangularReflectionMapping=rt;const ot=304;exports.EquirectangularRefractionMapping=ot;const st=306;exports.CubeUVReflectionMapping=st;const at=307;exports.CubeUVRefractionMapping=at;const ct=1e3;exports.RepeatWrapping=ct;const lt=1001;exports.ClampToEdgeWrapping=lt;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const ft=1005;exports.NearestMipmapLinearFilter=ft;const mt=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const Ot=1021;exports.AlphaFormat=Ot;const It=1022;exports.RGBFormat=It;const Bt=1023;exports.RGBAFormat=Bt;const Nt=1024;exports.LuminanceFormat=Nt;const Ft=1025;exports.LuminanceAlphaFormat=Ft;const Gt=Bt;exports.RGBEFormat=Gt;const zt=1026;exports.DepthFormat=zt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const ie=37496;exports.RGBA_ETC2_EAC_Format=ie;const re=37808;exports.RGBA_ASTC_4x4_Format=re;const oe=37809;exports.RGBA_ASTC_5x4_Format=oe;const se=37810;exports.RGBA_ASTC_5x5_Format=se;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const ce=37812;exports.RGBA_ASTC_6x6_Format=ce;const le=37813;exports.RGBA_ASTC_8x5_Format=le;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const fe=37818;exports.RGBA_ASTC_10x8_Format=fe;const me=37819;exports.RGBA_ASTC_10x10_Format=me;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Oe=2200;exports.LoopOnce=Oe;const Ie=2201;exports.LoopRepeat=Ie;const Be=2202;exports.LoopPingPong=Be;const Ne=2300;exports.InterpolateDiscrete=2300;const Fe=2301;exports.InterpolateLinear=2301;const Ge=2302;exports.InterpolateSmooth=2302;const ze=2400;exports.ZeroCurvatureEnding=ze;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const on=1;exports.ObjectSpaceNormalMap=on;const sn=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const cn=7681;exports.ReplaceStencilOp=7681;const ln=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const fn=512;exports.NeverStencilFunc=512;const mn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function On(){}exports.GLSL3=Dn,Object.assign(On.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t)}}});const In=[];for(let yx=0;yx<256;yx++)In[yx]=(yx<16?"0":"")+yx.toString(16);let Bn=1234567;const Nn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(In[255&t]+In[t>>8&255]+In[t>>16&255]+In[t>>24&255]+"-"+In[255&e]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[63&n|128]+In[n>>8&255]+"-"+In[n>>16&255]+In[n>>24&255]+In[255&i]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,i){return Nn.lerp(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(Nn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Bn=t%2147483647),((Bn=16807*Bn%2147483647)-1)/2147483646},degToRad:function(t){return t*Nn.DEG2RAD},radToDeg:function(t){return t*Nn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,s=Math.sin,a=o(n/2),c=s(n/2),l=o((e+i)/2),h=s((e+i)/2),u=o((e-i)/2),p=s((e-i)/2),d=o((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(a*h,c*u,c*p,a*l);break;case"YZY":t.set(c*p,a*h,c*u,a*l);break;case"ZXZ":t.set(c*u,c*p,a*h,a*l);break;case"XZX":t.set(a*h,c*f,c*d,a*l);break;case"YXY":t.set(c*d,a*h,c*f,a*l);break;case"ZYZ":t.set(c*f,c*d,a*h,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};exports.MathUtils=exports.Math=Nn;class Fn{constructor(t=0,e=0){Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=Fn;class Gn{constructor(){Object.defineProperty(this,"isMatrix3",{value:!0}),this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,c){const l=this.elements;return l[0]=t,l[1]=i,l[2]=s,l[3]=e,l[4]=r,l[5]=a,l[6]=n,l[7]=o,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}clone(){return(new this.constructor).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],c=n[1],l=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=i[0],m=i[3],g=i[6],x=i[1],v=i[4],y=i[7],_=i[2],b=i[5],w=i[8];return r[0]=o*f+s*x+a*_,r[3]=o*m+s*v+a*b,r[6]=o*g+s*y+a*w,r[1]=c*f+l*x+h*_,r[4]=c*m+l*v+h*b,r[7]=c*g+l*y+h*w,r[2]=u*f+p*x+d*_,r[5]=u*m+p*v+d*b,r[8]=u*g+p*y+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8];return e*o*l-e*s*c-n*r*l+n*s*a+i*r*c-i*o*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=l*o-s*c,u=s*a-l*r,p=c*r-o*a,d=e*h+n*u+i*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const f=1/d;return t[0]=h*f,t[1]=(i*c-l*n)*f,t[2]=(s*n-i*o)*f,t[3]=u*f,t[4]=(l*e-i*a)*f,t[5]=(i*r-s*e)*f,t[6]=p*f,t[7]=(n*a-c*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).copy(this).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),c=Math.sin(r);return this.set(n*a,n*c,-n*(a*o+c*s)+o+t,-i*c,i*a,-i*(-c*o+a*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],c=i[4],l=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*c,i[6]=e*s+n*l,i[1]=-n*r+e*a,i[4]=-n*o+e*c,i[7]=-n*s+e*l,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}let zn;exports.Matrix3=Gn;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===zn&&(zn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),zn.width=t.width,zn.height=t.height;const n=zn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=zn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;function kn(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=lt,i=lt,r=gt,o=yt,s=Bt,a=bt,c=1,l=Xe){Object.defineProperty(this,"id",{value:Un++}),this.uuid=Nn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=c,this.format=s,this.internalFormat=null,this.type=a,this.offset=new Fn(0,0),this.repeat=new Fn(1,1),this.center=new Fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.version=0,this.onUpdate=null}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=300,kn.prototype=Object.assign(Object.create(On.prototype),{constructor:kn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=Nn.generateUUID()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(Vn(i[t].image)):e.push(Vn(i[t]))}else e=Vn(i);t.images[i.uuid]={uuid:i.uuid,url:e}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ct:t.x=t.x-Math.floor(t.x);break;case lt:t.x=t.x<0?0:1;break;case ht:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ct:t.y=t.y-Math.floor(t.y);break;case lt:t.y=t.y<0?0:1;break;case ht:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(kn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});class Wn{constructor(t=0,e=0,n=0,i=1){Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=t.elements,s=o[0],a=o[4],c=o[8],l=o[1],h=o[5],u=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(a-l)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+l)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(s+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(h+1)/2,m=(f+1)/2,g=(a+l)/4,x=(c+p)/4,v=(u+d)/4;return t>o&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(t)),r=x/n):o>m?o<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(o)),r=v/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(m)),i=v/r),this.set(n,i,r,e),this}let m=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(l-a)*(l-a));return Math.abs(m)<.001&&(m=1),this.x=(d-u)/m,this.y=(c-p)/m,this.z=(l-a)/m,this.w=Math.acos((s+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn;class jn extends On{constructor(t,e,n){super(),Object.defineProperty(this,"isWebGLRenderTarget",{value:!0}),this.width=t,this.height=e,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setSize(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn;class qn extends jn{constructor(t,e,n){super(t,e,n),Object.defineProperty(this,"isWebGLMultisampleRenderTarget",{value:!0}),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn;class Xn{constructor(t=0,e=0,n=0,i=1){Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return n.copy(t).slerp(e,i)}static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],c=n[i+1],l=n[i+2],h=n[i+3];const u=r[o+0],p=r[o+1],d=r[o+2],f=r[o+3];if(h!==f||a!==u||c!==p||l!==d){let t=1-s;const e=a*u+c*p+l*d+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+u*r,c=c*t+p*r,l=l*t+d*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+c*c+l*l+h*h);a*=t,c*=t,l*=t,h*=t}}t[e]=a,t[e+1]=c,t[e+2]=l,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],c=n[i+2],l=n[i+3],h=r[o],u=r[o+1],p=r[o+2],d=r[o+3];return t[e]=s*d+l*h+a*p-c*u,t[e+1]=a*d+l*u+c*h-s*p,t[e+2]=c*d+l*p+s*u-a*h,t[e+3]=l*d-s*h-a*u-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,c=s(n/2),l=s(i/2),h=s(r/2),u=a(n/2),p=a(i/2),d=a(r/2);switch(o){case"XYZ":this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d;break;case"YXZ":this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d;break;case"ZXY":this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d;break;case"ZYX":this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d;break;case"YZX":this._x=u*l*h+c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h-u*p*d;break;case"XZY":this._x=u*l*h-c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],c=e[2],l=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-c)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(l-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+c)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-c)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+c)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Nn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,c=e._z,l=e._w;return this._x=n*l+o*s+i*c-r*a,this._y=i*l+o*a+r*s-n*c,this._z=r*l+o*c+n*a-i*s,this._w=o*l-n*s-i*a-r*c,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(a),l=Math.atan2(c,s),h=Math.sin((1-e)*l)/c,u=Math.sin(e*l)/c;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn;class Yn{constructor(t=0,e=0,n=0){Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,c=a*e+o*i-s*n,l=a*n+s*e-r*i,h=a*i+r*n-o*e,u=-r*e-o*n-s*i;return this.x=c*a+u*-r+l*-s-h*-o,this.y=l*a+u*-o+h*-r-c*-s,this.z=h*a+u*-s+c*-o-l*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Nn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new Yn(1/0,1/0,1/0),this.max=void 0!==e?e:new Yn(-1/0,-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,c=t.length;a<c;a+=3){const c=t[a],l=t[a+1],h=t[a+2];c<e&&(e=c),l<n&&(n=l),h<i&&(i=h),c>r&&(r=c),l>o&&(o=l),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,c=t.count;a<c;a++){const c=t.getX(a),l=t.getY(a),h=t.getZ(a);c<e&&(e=c),l<n&&(n=l),h<i&&(i=h),c>r&&(r=c),l>o&&(o=l),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=ti.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Yn),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Yn),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),ei.copy(e.boundingBox),ei.applyMatrix4(t.matrixWorld),this.union(ei));const n=t.children;for(let i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,ti),ti.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ci),li.subVectors(this.max,ci),ni.subVectors(t.a,ci),ii.subVectors(t.b,ci),ri.subVectors(t.c,ci),oi.subVectors(ii,ni),si.subVectors(ri,ii),ai.subVectors(ni,ri);let e=[0,-oi.z,oi.y,0,-si.z,si.y,0,-ai.z,ai.y,oi.z,0,-oi.x,si.z,0,-si.x,ai.z,0,-ai.x,-oi.y,oi.x,0,-si.y,si.x,0,-ai.y,ai.x,0];return!!Kn(e,ni,ii,ri,li)&&(!!Kn(e=[1,0,0,0,1,0,0,0,1],ni,ii,ri,li)&&(hi.crossVectors(oi,si),Kn(e=[hi.x,hi.y,hi.z],ni,ii,ri,li)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return ti.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(ti).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:($n[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),$n[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),$n[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),$n[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),$n[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),$n[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),$n[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),$n[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints($n),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}function Kn(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){ui.fromArray(t,o);const s=r.x*Math.abs(ui.x)+r.y*Math.abs(ui.y)+r.z*Math.abs(ui.z),a=e.dot(ui),c=n.dot(ui),l=i.dot(ui);if(Math.max(-Math.max(a,c,l),Math.min(a,c,l))>s)return!1}return!0}exports.Box3=Qn;const $n=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],ti=new Yn,ei=new Qn,ni=new Yn,ii=new Yn,ri=new Yn,oi=new Yn,si=new Yn,ai=new Yn,ci=new Yn,li=new Yn,hi=new Yn,ui=new Yn,pi=new Qn;class di{constructor(t,e){this.center=void 0!==t?t:new Yn,this.radius=void 0!==e?e:-1}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pi.setFromPoints(t).getCenter(n);let i=0;for(let r=0,o=t.length;r<o;r++)i=Math.max(i,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Yn),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}}exports.Sphere=di;const fi=new Yn,mi=new Yn,gi=new Yn,xi=new Yn,vi=new Yn,yi=new Yn,_i=new Yn;class bi{constructor(t,e){this.origin=void 0!==t?t:new Yn,this.direction=void 0!==e?e:new Yn(0,0,-1)}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,fi)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=fi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(fi.copy(this.direction).multiplyScalar(e).add(this.origin),fi.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){mi.copy(t).add(e).multiplyScalar(.5),gi.copy(e).sub(t).normalize(),xi.copy(this.origin).sub(mi);const r=.5*t.distanceTo(e),o=-this.direction.dot(gi),s=xi.dot(this.direction),a=-xi.dot(gi),c=xi.lengthSq(),l=Math.abs(1-o*o);let h,u,p,d;if(l>0)if(u=o*s-a,d=r*l,(h=o*a-s)>=0)if(u>=-d)if(u<=d){const t=1/l;p=(h*=t)*(h+o*(u*=t)+2*s)+u*(o*h+u+2*a)+c}else u=r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;else u=-r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;else u<=-d?p=-(h=Math.max(0,-(-o*r+s)))*h+(u=h>0?-r:Math.min(Math.max(-r,-a),r))*(u+2*a)+c:u<=d?(h=0,p=(u=Math.min(Math.max(-r,-a),r))*(u+2*a)+c):p=-(h=Math.max(0,-(o*r+s)))*h+(u=h>0?r:Math.min(Math.max(-r,-a),r))*(u+2*a)+c;else u=o>0?-r:r,p=-(h=Math.max(0,-(o*u+s)))*h+u*(u+2*a)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(gi).multiplyScalar(u).add(mi),p}intersectSphere(t,e){fi.subVectors(t.center,this.origin);const n=fi.dot(this.direction),i=fi.dot(fi)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,i=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,i=(t.min.x-u.x)*c),l>=0?(r=(t.min.y-u.y)*l,o=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,o=(t.min.y-u.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),h>=0?(s=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,fi)}intersectTriangle(t,e,n,i,r){vi.subVectors(e,t),yi.subVectors(n,t),_i.crossVectors(vi,yi);let o,s=this.direction.dot(_i);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}xi.subVectors(this.origin,t);const a=o*this.direction.dot(yi.crossVectors(xi,yi));if(a<0)return null;const c=o*this.direction.dot(vi.cross(xi));if(c<0)return null;if(a+c>s)return null;const l=-o*xi.dot(_i);return l<0?null:this.at(l/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}exports.Ray=bi;class wi{constructor(){Object.defineProperty(this,"isMatrix4",{value:!0}),this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,c,l,h,u,p,d,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wi).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Mi.setFromMatrixColumn(t,0).length(),r=1/Mi.setFromMatrixColumn(t,1).length(),o=1/Mi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*l,n=o*h,i=s*l,r=s*h;e[0]=a*l,e[4]=-a*h,e[8]=c,e[1]=n+i*c,e[5]=t-r*c,e[9]=-s*a,e[2]=r-t*c,e[6]=i+n*c,e[10]=o*a}else if("YXZ"===t.order){const t=a*l,n=a*h,i=c*l,r=c*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*c,e[1]=o*h,e[5]=o*l,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*l,n=a*h,i=c*l,r=c*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*l,e[9]=r-t*s,e[2]=-o*c,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*l,n=o*h,i=s*l,r=s*h;e[0]=a*l,e[4]=i*c-n,e[8]=t*c+r,e[1]=a*h,e[5]=r*c+t,e[9]=n*c-i,e[2]=-c,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*c,i=s*a,r=s*c;e[0]=a*l,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*l,e[9]=-s*l,e[2]=-c*l,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*c,i=s*a,r=s*c;e[0]=a*l,e[4]=-h,e[8]=c*l,e[1]=t*h+r,e[5]=o*l,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*l,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ti,t,Ei)}lookAt(t,e,n){const i=this.elements;return Ri.subVectors(t,e),0===Ri.lengthSq()&&(Ri.z=1),Ri.normalize(),Ai.crossVectors(n,Ri),0===Ai.lengthSq()&&(1===Math.abs(n.z)?Ri.x+=1e-4:Ri.z+=1e-4,Ri.normalize(),Ai.crossVectors(n,Ri)),Ai.normalize(),Li.crossVectors(Ri,Ai),i[0]=Ai.x,i[4]=Li.x,i[8]=Ri.x,i[1]=Ai.y,i[5]=Li.y,i[9]=Ri.y,i[2]=Ai.z,i[6]=Li.z,i[10]=Ri.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],c=n[12],l=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=i[0],w=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],D=i[14],O=i[3],I=i[7],B=i[11],N=i[15];return r[0]=o*b+s*T+a*R+c*O,r[4]=o*w+s*E+a*C+c*I,r[8]=o*M+s*A+a*P+c*B,r[12]=o*S+s*L+a*D+c*N,r[1]=l*b+h*T+u*R+p*O,r[5]=l*w+h*E+u*C+p*I,r[9]=l*M+h*A+u*P+p*B,r[13]=l*S+h*L+u*D+p*N,r[2]=d*b+f*T+m*R+g*O,r[6]=d*w+f*E+m*C+g*I,r[10]=d*M+f*A+m*P+g*B,r[14]=d*S+f*L+m*D+g*N,r[3]=x*b+v*T+y*R+_*O,r[7]=x*w+v*E+y*C+_*I,r[11]=x*M+v*A+y*P+_*B,r[15]=x*S+v*L+y*D+_*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],c=t[13],l=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+r*a*h-i*c*h-r*s*u+n*c*u+i*s*p-n*a*p)+t[7]*(+e*a*p-e*c*u+r*o*u-i*o*p+i*c*l-r*a*l)+t[11]*(+e*c*h-e*s*p-r*o*h+n*o*p+r*s*l-n*c*l)+t[15]*(-i*s*l-e*a*h+e*s*u+i*o*h-n*o*u+n*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],p=t[11],d=t[12],f=t[13],m=t[14],g=t[15],x=h*m*c-f*u*c+f*a*p-s*m*p-h*a*g+s*u*g,v=d*u*c-l*m*c-d*a*p+o*m*p+l*a*g-o*u*g,y=l*f*c-d*h*c+d*s*p-o*f*p-l*s*g+o*h*g,_=d*h*a-l*f*a-d*s*u+o*f*u+l*s*m-o*h*m,b=e*x+n*v+i*y+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(f*u*r-h*m*r-f*i*p+n*m*p+h*i*g-n*u*g)*w,t[2]=(s*m*r-f*a*r+f*i*c-n*m*c-s*i*g+n*a*g)*w,t[3]=(h*a*r-s*u*r-h*i*c+n*u*c+s*i*p-n*a*p)*w,t[4]=v*w,t[5]=(l*m*r-d*u*r+d*i*p-e*m*p-l*i*g+e*u*g)*w,t[6]=(d*a*r-o*m*r-d*i*c+e*m*c+o*i*g-e*a*g)*w,t[7]=(o*u*r-l*a*r+l*i*c-e*u*c-o*i*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*r-l*f*r-d*n*p+e*f*p+l*n*g-e*h*g)*w,t[10]=(o*f*r-d*s*r+d*n*c-e*f*c-o*n*g+e*s*g)*w,t[11]=(l*s*r-o*h*r-l*n*c+e*h*c+o*n*p-e*s*p)*w,t[12]=_*w,t[13]=(l*f*i-d*h*i+d*n*u-e*f*u-l*n*m+e*h*m)*w,t[14]=(d*s*i-o*f*i-d*n*a+e*f*a+o*n*m-e*s*m)*w,t[15]=(o*h*i-l*s*i+l*n*a-e*h*a-o*n*u+e*s*u)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,c=r*o,l=r*s;return this.set(c*o+n,c*s-i*a,c*a+i*s,0,c*s+i*a,l*s+n,l*a-i*o,0,c*a-i*s,l*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,c=r+r,l=o+o,h=s+s,u=r*c,p=r*l,d=r*h,f=o*l,m=o*h,g=s*h,x=a*c,v=a*l,y=a*h,_=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*_,i[1]=(p+y)*_,i[2]=(d-v)*_,i[3]=0,i[4]=(p-y)*b,i[5]=(1-(u+g))*b,i[6]=(m+x)*b,i[7]=0,i[8]=(d+v)*w,i[9]=(m-x)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Mi.set(i[0],i[1],i[2]).length();const o=Mi.set(i[4],i[5],i[6]).length(),s=Mi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Si.copy(this);const a=1/r,c=1/o,l=1/s;return Si.elements[0]*=a,Si.elements[1]*=a,Si.elements[2]*=a,Si.elements[4]*=c,Si.elements[5]*=c,Si.elements[6]*=c,Si.elements[8]*=l,Si.elements[9]*=l,Si.elements[10]*=l,e.setFromRotationMatrix(Si),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),c=2*r/(n-i),l=(e+t)/(e-t),h=(n+i)/(n-i),u=-(o+r)/(o-r),p=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=l,s[12]=0,s[1]=0,s[5]=c,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),c=1/(n-i),l=1/(o-r),h=(e+t)*a,u=(n+i)*c,p=(o+r)*l;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*l,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}exports.Matrix4=wi;const Mi=new Yn,Si=new wi,Ti=new Yn(0,0,0),Ei=new Yn(1,1,1),Ai=new Yn,Li=new Yn,Ri=new Yn;class Ci{constructor(t=0,e=0,n=0,i=Ci.DefaultOrder){Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const i=Nn.clamp,r=t.elements,o=r[0],s=r[4],a=r[8],c=r[1],l=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,l),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,o));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Pi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Pi,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Di.setFromEuler(this),this.setFromQuaternion(Di,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Ci,Ci.DefaultOrder="XYZ",Ci.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];const Pi=new wi,Di=new Xn;class Oi{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}exports.Layers=Oi;let Ii=0;const Bi=new Yn,Ni=new Xn,Fi=new wi,Gi=new Yn,zi=new Yn,Hi=new Yn,Ui=new Xn,ki=new Yn(1,0,0),Vi=new Yn(0,1,0),Wi=new Yn(0,0,1),ji={type:"added"},qi={type:"removed"};function Xi(){Object.defineProperty(this,"id",{value:Ii++}),this.uuid=Nn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Xi.DefaultUp.clone();const t=new Yn,e=new Ci,n=new Xn,i=new Yn(1,1,1);e._onChange(function(){n.setFromEuler(e,!1)}),n._onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new wi},normalMatrix:{value:new Gn}}),this.matrix=new wi,this.matrixWorld=new wi,this.matrixAutoUpdate=Xi.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Oi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}Xi.DefaultUp=new Yn(0,1,0),Xi.DefaultMatrixAutoUpdate=!0,Xi.prototype=Object.assign(Object.create(On.prototype),{constructor:Xi,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return Ni.setFromAxisAngle(t,e),this.quaternion.multiply(Ni),this},rotateOnWorldAxis:function(t,e){return Ni.setFromAxisAngle(t,e),this.quaternion.premultiply(Ni),this},rotateX:function(t){return this.rotateOnAxis(ki,t)},rotateY:function(t){return this.rotateOnAxis(Vi,t)},rotateZ:function(t){return this.rotateOnAxis(Wi,t)},translateOnAxis:function(t,e){return Bi.copy(t).applyQuaternion(this.quaternion),this.position.add(Bi.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(ki,t)},translateY:function(t){return this.translateOnAxis(Vi,t)},translateZ:function(t){return this.translateOnAxis(Wi,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Fi.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?Gi.copy(t):Gi.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),zi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fi.lookAt(zi,Gi,this.up):Fi.lookAt(Gi,zi,this.up),this.quaternion.setFromRotationMatrix(Fi),i&&(Fi.extractRotation(i.matrixWorld),Ni.setFromRotationMatrix(Fi),this.quaternion.premultiply(Ni.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(ji)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(qi)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(qi)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),Fi.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Fi.multiply(t.parent.matrixWorld)),t.applyMatrix4(Fi),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Xn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(zi,t,Hi),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(zi,Ui,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=o(t.geometries),i=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),c=o(t.skeletons),l=o(t.animations);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n<t.children.length;n++){const e=t.children[n];this.add(e.clone())}return this}});const Yi=new Yn,Zi=new Yn,Ji=new Gn;class Qi{constructor(t,e){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==t?t:new Yn(1,0,0),this.constant=void 0!==e?e:0}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Yi.subVectors(n,e).cross(Zi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Yn),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Yn);const n=t.delta(Yi),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ji.getNormalMatrix(t),i=this.coplanarPoint(Yi).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}exports.Plane=Qi;const Ki=new Yn,$i=new Yn,tr=new Yn,er=new Yn,nr=new Yn,ir=new Yn,rr=new Yn,or=new Yn,sr=new Yn,ar=new Yn;class cr{constructor(t,e,n){this.a=void 0!==t?t:new Yn,this.b=void 0!==e?e:new Yn,this.c=void 0!==n?n:new Yn}static getNormal(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Yn),i.subVectors(n,e),Ki.subVectors(t,e),i.cross(Ki);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Ki.subVectors(i,e),$i.subVectors(n,e),tr.subVectors(t,e);const o=Ki.dot(Ki),s=Ki.dot($i),a=Ki.dot(tr),c=$i.dot($i),l=$i.dot(tr),h=o*c-s*s;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Yn),0===h)return r.set(-2,-1,-1);const u=1/h,p=(c*a-s*l)*u,d=(o*l-s*a)*u;return r.set(1-p-d,d,p)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,er),er.x>=0&&er.y>=0&&er.x+er.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,er),a.set(0,0),a.addScaledVector(r,er.x),a.addScaledVector(o,er.y),a.addScaledVector(s,er.z),a}static isFrontFacing(t,e,n,i){return Ki.subVectors(n,e),$i.subVectors(t,e),Ki.cross($i).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ki.subVectors(this.c,this.b),$i.subVectors(this.a,this.b),.5*Ki.cross($i).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return cr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qi),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return cr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return cr.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return cr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return cr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,i=this.b,r=this.c;let o,s;nr.subVectors(i,n),ir.subVectors(r,n),or.subVectors(t,n);const a=nr.dot(or),c=ir.dot(or);if(a<=0&&c<=0)return e.copy(n);sr.subVectors(t,i);const l=nr.dot(sr),h=ir.dot(sr);if(l>=0&&h<=l)return e.copy(i);const u=a*h-l*c;if(u<=0&&a>=0&&l<=0)return o=a/(a-l),e.copy(n).addScaledVector(nr,o);ar.subVectors(t,r);const p=nr.dot(ar),d=ir.dot(ar);if(d>=0&&p<=d)return e.copy(r);const f=p*c-a*d;if(f<=0&&c>=0&&d<=0)return s=c/(c-d),e.copy(n).addScaledVector(ir,s);const m=l*d-p*h;if(m<=0&&h-l>=0&&p-d>=0)return rr.subVectors(r,i),s=(h-l)/(h-l+(p-d)),e.copy(i).addScaledVector(rr,s);const g=1/(m+f+u);return o=f*g,s=u*g,e.copy(n).addScaledVector(nr,o).addScaledVector(ir,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=cr;const lr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hr={h:0,s:0,l:0},ur={h:0,s:0,l:0};function pr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function dr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class mr{constructor(t,e,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Nn.euclideanModulo(t,1),e=Nn.clamp(e,0,1),n=Nn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=pr(r,i,t+1/3),this.g=pr(r,i,t),this.b=pr(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=lr[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=dr(t.r),this.g=dr(t.g),this.b=dr(t.b),this}copyLinearToSRGB(t){return this.r=fr(t.r),this.g=fr(t.g),this.b=fr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const c=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=c<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n<i?6:0);break;case n:s=(i-e)/t+2;break;case i:s=(e-n)/t+4}s/=6}return t.h=s,t.s=a,t.l=c,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(hr),hr.h+=t,hr.s+=e,hr.l+=n,this.setHSL(hr.h,hr.s,hr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(hr),t.getHSL(ur);const n=Nn.lerp(hr.h,ur.h,e),i=Nn.lerp(hr.s,ur.s,e),r=Nn.lerp(hr.l,ur.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}exports.Color=mr,mr.NAMES=lr,mr.prototype.r=1,mr.prototype.g=1,mr.prototype.b=1;class gr{constructor(t,e,n,i,r,o=0){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new Yn,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new mr,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=o}clone(){return(new this.constructor).copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}exports.Face3=gr;let xr=0;function vr(){Object.defineProperty(this,"id",{value:xr++}),this.uuid=Nn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function yr(t){vr.call(this),this.type="MeshBasicMaterial",this.color=new mr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}vr.prototype=Object.assign(Object.create(On.prototype),{constructor:vr,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(vr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),yr.prototype=Object.create(vr.prototype),yr.prototype.constructor=yr,yr.prototype.isMeshBasicMaterial=!0,yr.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};const _r=new Yn,br=new Fn;function wr(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0}function Mr(t,e,n){wr.call(this,new Int8Array(t),e,n)}function Sr(t,e,n){wr.call(this,new Uint8Array(t),e,n)}function Tr(t,e,n){wr.call(this,new Uint8ClampedArray(t),e,n)}function Er(t,e,n){wr.call(this,new Int16Array(t),e,n)}function Ar(t,e,n){wr.call(this,new Uint16Array(t),e,n)}function Lr(t,e,n){wr.call(this,new Int32Array(t),e,n)}function Rr(t,e,n){wr.call(this,new Uint32Array(t),e,n)}function Cr(t,e,n){wr.call(this,new Uint16Array(t),e,n)}function Pr(t,e,n){wr.call(this,new Float32Array(t),e,n)}function Dr(t,e,n){wr.call(this,new Float64Array(t),e,n)}function Or(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}Object.defineProperty(wr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(wr.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new mr),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this},copyVector2sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new Fn),e[n++]=r.x,e[n++]=r.y}return this},copyVector3sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new Yn),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this},copyVector4sArray:function(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new Wn),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)br.fromBufferAttribute(this,e),br.applyMatrix3(t),this.setXY(e,br.x,br.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)_r.fromBufferAttribute(this,e),_r.applyMatrix3(t),this.setXYZ(e,_r.x,_r.y,_r.z);return this},applyMatrix4:function(t){for(let e=0,n=this.count;e<n;e++)_r.x=this.getX(e),_r.y=this.getY(e),_r.z=this.getZ(e),_r.applyMatrix4(t),this.setXYZ(e,_r.x,_r.y,_r.z);return this},applyNormalMatrix:function(t){for(let e=0,n=this.count;e<n;e++)_r.x=this.getX(e),_r.y=this.getY(e),_r.z=this.getZ(e),_r.applyNormalMatrix(t),this.setXYZ(e,_r.x,_r.y,_r.z);return this},transformDirection:function(t){for(let e=0,n=this.count;e<n;e++)_r.x=this.getX(e),_r.y=this.getY(e),_r.z=this.getZ(e),_r.transformDirection(t),this.setXYZ(e,_r.x,_r.y,_r.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Mr.prototype=Object.create(wr.prototype),Mr.prototype.constructor=Mr,Sr.prototype=Object.create(wr.prototype),Sr.prototype.constructor=Sr,Tr.prototype=Object.create(wr.prototype),Tr.prototype.constructor=Tr,Er.prototype=Object.create(wr.prototype),Er.prototype.constructor=Er,Ar.prototype=Object.create(wr.prototype),Ar.prototype.constructor=Ar,Lr.prototype=Object.create(wr.prototype),Lr.prototype.constructor=Lr,Rr.prototype=Object.create(wr.prototype),Rr.prototype.constructor=Rr,Cr.prototype=Object.create(wr.prototype),Cr.prototype.constructor=Cr,Cr.prototype.isFloat16BufferAttribute=!0,Pr.prototype=Object.create(wr.prototype),Pr.prototype.constructor=Pr,Dr.prototype=Object.create(wr.prototype),Dr.prototype.constructor=Dr;const Ir={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Br(t,e){return new Ir[t](e)}let Nr=0;const Fr=new wi,Gr=new Xi,zr=new Yn,Hr=new Qn,Ur=new Qn,kr=new Yn;function Vr(){Object.defineProperty(this,"id",{value:Nr++}),this.uuid=Nn.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Vr.prototype=Object.assign(Object.create(On.prototype),{constructor:Vr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Or(t)>65535?Rr:Ar)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Gn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fr.makeRotationX(t),this.applyMatrix4(Fr),this},rotateY:function(t){return Fr.makeRotationY(t),this.applyMatrix4(Fr),this},rotateZ:function(t){return Fr.makeRotationZ(t),this.applyMatrix4(Fr),this},translate:function(t,e,n){return Fr.makeTranslation(t,e,n),this.applyMatrix4(Fr),this},scale:function(t,e,n){return Fr.makeScale(t,e,n),this.applyMatrix4(Fr),this},lookAt:function(t){return Gr.lookAt(t),Gr.updateMatrix(),this.applyMatrix4(Gr.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zr).negate(),this.translate(zr.x,zr.y,zr.z),this},setFromPoints:function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Pr(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Qn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Yn(-1/0,-1/0,-1/0),new Yn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){const t=e[n];Hr.setFromBufferAttribute(t),this.morphTargetsRelative?(kr.addVectors(this.boundingBox.min,Hr.min),this.boundingBox.expandByPoint(kr),kr.addVectors(this.boundingBox.max,Hr.max),this.boundingBox.expandByPoint(kr)):(this.boundingBox.expandByPoint(Hr.min),this.boundingBox.expandByPoint(Hr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new di);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Yn,1/0);if(t){const n=this.boundingSphere.center;if(Hr.setFromBufferAttribute(t),e)for(let t=0,r=e.length;t<r;t++){const n=e[t];Ur.setFromBufferAttribute(n),this.morphTargetsRelative?(kr.addVectors(Hr.min,Ur.min),Hr.expandByPoint(kr),kr.addVectors(Hr.max,Ur.max),Hr.expandByPoint(kr)):(Hr.expandByPoint(Ur.min),Hr.expandByPoint(Ur.max))}Hr.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)kr.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(kr));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)kr.fromBufferAttribute(o,e),s&&(zr.fromBufferAttribute(t,e),kr.add(zr)),i=Math.max(i,n.distanceToSquared(kr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,o=e.uv.array,s=i.length/3;void 0===e.tangent&&this.setAttribute("tangent",new wr(new Float32Array(4*s),4));const a=e.tangent.array,c=[],l=[];for(let T=0;T<s;T++)c[T]=new Yn,l[T]=new Yn;const h=new Yn,u=new Yn,p=new Yn,d=new Fn,f=new Fn,m=new Fn,g=new Yn,x=new Yn;function v(t,e,n){h.fromArray(i,3*t),u.fromArray(i,3*e),p.fromArray(i,3*n),d.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),u.sub(h),p.sub(h),f.sub(d),m.sub(d);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(g.copy(u).multiplyScalar(m.y).addScaledVector(p,-f.y).multiplyScalar(r),x.copy(p).multiplyScalar(f.x).addScaledVector(u,-m.x).multiplyScalar(r),c[t].add(g),c[e].add(g),c[n].add(g),l[t].add(x),l[e].add(x),l[n].add(x))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let T=0,E=y.length;T<E;++T){const t=y[T],e=t.start;for(let i=e,r=e+t.count;i<r;i+=3)v(n[i+0],n[i+1],n[i+2])}const _=new Yn,b=new Yn,w=new Yn,M=new Yn;function S(t){w.fromArray(r,3*t),M.copy(w);const e=c[t];_.copy(e),_.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(M,e);const n=b.dot(l[t])<0?-1:1;a[4*t]=_.x,a[4*t+1]=_.y,a[4*t+2]=_.z,a[4*t+3]=n}for(let T=0,E=y.length;T<E;++T){const t=y[T],e=t.start;for(let i=e,r=e+t.count;i<r;i+=3)S(n[i+0]),S(n[i+1]),S(n[i+2])}},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new wr(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new Yn,r=new Yn,o=new Yn,s=new Yn,a=new Yn,c=new Yn,l=new Yn,h=new Yn;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),o.fromBufferAttribute(e,f),l.subVectors(o,r),h.subVectors(i,r),l.cross(h),s.fromBufferAttribute(n,p),a.fromBufferAttribute(n,d),c.fromBufferAttribute(n,f),s.add(l),a.add(l),c.add(l),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(f,c.x,c.y,c.z)}else for(let t=0,u=e.count;t<u;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),l.subVectors(o,r),h.subVectors(i,r),l.cross(h),n.setXYZ(t+0,l.x,l.y,l.z),n.setXYZ(t+1,l.x,l.y,l.z),n.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,o=t.attributes[i],s=o.array,a=o.itemSize*e,c=Math.min(s.length,r.length-a);for(let t=0,e=a;t<c;t++,e++)r[e]=s[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)kr.fromBufferAttribute(t,e),kr.normalize(),t.setXYZ(e,kr.x,kr.y,kr.z)},toNonIndexed:function(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,o=new n.constructor(e.length*i);let s=0,a=0;for(let c=0,l=e.length;c<l;c++){s=e[c]*i;for(let t=0;t<i;t++)o[a++]=n[s++]}return new wr(o,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Vr,n=this.index.array,i=this.attributes;for(const s in i){const r=t(i[s],n);e.setAttribute(s,r)}const r=this.morphAttributes;for(const s in r){const i=[],o=r[s];for(let e=0,r=o.length;e<r;e++){const r=t(o[e],n);i.push(r)}e.morphAttributes[s]=i}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let s=0,a=o.length;s<a;s++){const t=o[s];e.addGroup(t.start,t.count,t.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],i=e.toJSON(t.data);""!==e.name&&(i.name=e.name),t.data.attributes[a]=i}const i={};let r=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let i=0,r=e.length;i<r;i++){const r=e[i],o=r.toJSON(t.data);""!==r.name&&(o.name=r.name),n.push(o)}n.length>0&&(i[a]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t},clone:function(){return(new Vr).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const c in i){const t=i[c];this.setAttribute(c,t.clone(e))}const r=t.morphAttributes;for(const c in r){const t=[],n=r[c];for(let i=0,r=n.length;i<r;i++)t.push(n[i].clone(e));this.morphAttributes[c]=t}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let c=0,l=o.length;c<l;c++){const t=o[c];this.addGroup(t.start,t.count,t.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const Wr=new wi,jr=new bi,qr=new di,Xr=new Yn,Yr=new Yn,Zr=new Yn,Jr=new Yn,Qr=new Yn,Kr=new Yn,$r=new Yn,to=new Yn,eo=new Yn,no=new Fn,io=new Fn,ro=new Fn,oo=new Yn,so=new Yn;function ao(t=new Vr,e=new yr){Xi.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function co(t,e,n,i,r,o,s,a){let c;if(null===(c=e.side===p?i.intersectTriangle(s,o,r,!0,a):i.intersectTriangle(r,o,s,e.side!==d,a)))return null;so.copy(a),so.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(so);return l<n.near||l>n.far?null:{distance:l,point:so.clone(),object:t}}function lo(t,e,n,i,r,o,s,a,c,l,h,u){Xr.fromBufferAttribute(r,l),Yr.fromBufferAttribute(r,h),Zr.fromBufferAttribute(r,u);const p=t.morphTargetInfluences;if(e.morphTargets&&o&&p){$r.set(0,0,0),to.set(0,0,0),eo.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=p[t],n=o[t];0!==e&&(Jr.fromBufferAttribute(n,l),Qr.fromBufferAttribute(n,h),Kr.fromBufferAttribute(n,u),s?($r.addScaledVector(Jr,e),to.addScaledVector(Qr,e),eo.addScaledVector(Kr,e)):($r.addScaledVector(Jr.sub(Xr),e),to.addScaledVector(Qr.sub(Yr),e),eo.addScaledVector(Kr.sub(Zr),e)))}Xr.add($r),Yr.add(to),Zr.add(eo)}t.isSkinnedMesh&&(t.boneTransform(l,Xr),t.boneTransform(h,Yr),t.boneTransform(u,Zr));const d=co(t,e,n,i,Xr,Yr,Zr,oo);if(d){a&&(no.fromBufferAttribute(a,l),io.fromBufferAttribute(a,h),ro.fromBufferAttribute(a,u),d.uv=cr.getUV(oo,Xr,Yr,Zr,no,io,ro,new Fn)),c&&(no.fromBufferAttribute(c,l),io.fromBufferAttribute(c,h),ro.fromBufferAttribute(c,u),d.uv2=cr.getUV(oo,Xr,Yr,Zr,no,io,ro,new Fn));const t=new gr(l,h,u);cr.getNormal(Xr,Yr,Zr,t.normal),d.face=t}return d}ao.prototype=Object.assign(Object.create(Xi.prototype),{constructor:ao,isMesh:!0,copy:function(t){return Xi.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(r),!1===t.ray.intersectsSphere(qr))return;if(Wr.copy(r).invert(),jr.copy(t.ray).applyMatrix4(Wr),null!==n.boundingBox&&!1===jr.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,a=n.morphAttributes.position,c=n.morphTargetsRelative,l=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,d=u.length;n<d;n++){const d=u[n],f=i[d.materialIndex];for(let n=Math.max(d.start,p.start),i=Math.min(d.start+d.count,p.start+p.count);n<i;n+=3){const i=r.getX(n),u=r.getX(n+1),p=r.getX(n+2);(o=lo(this,f,t,jr,s,a,c,l,h,i,u,p))&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=d.materialIndex,e.push(o))}}else{for(let n=Math.max(0,p.start),u=Math.min(r.count,p.start+p.count);n<u;n+=3){const u=r.getX(n),p=r.getX(n+1),d=r.getX(n+2);(o=lo(this,i,t,jr,s,a,c,l,h,u,p,d))&&(o.faceIndex=Math.floor(n/3),e.push(o))}}else if(void 0!==s)if(Array.isArray(i))for(let n=0,d=u.length;n<d;n++){const r=u[n],d=i[r.materialIndex];for(let n=Math.max(r.start,p.start),i=Math.min(r.start+r.count,p.start+p.count);n<i;n+=3){(o=lo(this,d,t,jr,s,a,c,l,h,n,n+1,n+2))&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=r.materialIndex,e.push(o))}}else{for(let n=Math.max(0,p.start),r=Math.min(s.count,p.start+p.count);n<r;n+=3){(o=lo(this,i,t,jr,s,a,c,l,h,n,n+1,n+2))&&(o.faceIndex=Math.floor(n/3),e.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});class ho extends Vr{constructor(t=1,e=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const s=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const a=[],c=[],l=[],h=[];let u=0,p=0;function d(t,e,n,i,r,o,d,f,m,g,x){const v=o/m,y=d/g,_=o/2,b=d/2,w=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new Yn;for(let s=0;s<S;s++){const o=s*y-b;for(let a=0;a<M;a++){const u=a*v-_;A[t]=u*i,A[e]=o*r,A[n]=w,c.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,l.push(A.x,A.y,A.z),h.push(a/m),h.push(1-s/g),T+=1}}for(let s=0;s<g;s++)for(let t=0;t<m;t++){const e=u+t+M*s,n=u+t+M*(s+1),i=u+(t+1)+M*(s+1),r=u+(t+1)+M*s;a.push(e,n,r),a.push(n,i,r),E+=6}s.addGroup(p,E,x),p+=E,u+=T}d("z","y","x",-1,-1,n,e,t,o,r,0),d("z","y","x",1,-1,n,e,-t,o,r,1),d("x","z","y",1,1,t,n,e,i,o,2),d("x","z","y",1,-1,t,n,-e,i,o,3),d("x","y","z",1,-1,t,e,n,i,r,4),d("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Pr(c,3)),this.setAttribute("normal",new Pr(l,3)),this.setAttribute("uv",new Pr(h,2))}}function uo(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function po(t){const e={};for(let n=0;n<t.length;n++){const i=uo(t[n]);for(const t in i)e[t]=i[t]}return e}exports.BoxGeometry=exports.BoxBufferGeometry=ho;const fo={clone:uo,merge:po};exports.UniformsUtils=fo;var mo="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",go="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function xo(t){vr.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=mo,this.fragmentShader=go,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function vo(){Xi.call(this),this.type="Camera",this.matrixWorldInverse=new wi,this.projectionMatrix=new wi,this.projectionMatrixInverse=new wi}function yo(t=50,e=1,n=.1,i=2e3){vo.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}xo.prototype=Object.create(vr.prototype),xo.prototype.constructor=xo,xo.prototype.isShaderMaterial=!0,xo.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=uo(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},xo.prototype.toJSON=function(t){const e=vr.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},vo.prototype=Object.assign(Object.create(Xi.prototype),{constructor:vo,isCamera:!0,copy:function(t,e){return Xi.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xi.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xi.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),yo.prototype=Object.assign(Object.create(vo.prototype),{constructor:yo,isPerspectiveCamera:!0,copy:function(t,e){return vo.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Nn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Nn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Nn.RAD2DEG*Math.atan(Math.tan(.5*Nn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Nn.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xi.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const _o=90,bo=1;function wo(t,e,n){if(Xi.call(this),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new yo(_o,bo,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(1,0,0)),this.add(i);const r=new yo(_o,bo,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(-1,0,0)),this.add(r);const o=new yo(_o,bo,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Yn(0,1,0)),this.add(o);const s=new yo(_o,bo,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new Yn(0,-1,0)),this.add(s);const a=new yo(_o,bo,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const c=new yo(_o,bo,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new Yn(0,0,-1)),this.add(c),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();const l=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(h),t.xr.enabled=l}}function Mo(t,e,n,i,r,o,s,a,c,l){t=void 0!==t?t:[],e=void 0!==e?e:nt,s=void 0!==s?s:It,kn.call(this,t,e,n,i,r,o,s,a,c,l),this.flipY=!1,this._needsFlipEnvMap=!0}wo.prototype=Object.create(Xi.prototype),wo.prototype.constructor=wo,Mo.prototype=Object.create(kn.prototype),Mo.prototype.constructor=Mo,Mo.prototype.isCubeTexture=!0,Object.defineProperty(Mo.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});class So extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),Object.defineProperty(this,"isWebGLCubeRenderTarget",{value:!0}),e=e||{},this.texture=new Mo(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Bt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new ho(5,5,5),r=new xo({name:"CubemapFromEquirect",uniforms:uo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});r.uniforms.tEquirect.value=e;const o=new ao(i,r),s=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new wo(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,n,i);t.setRenderTarget(r)}}function To(t,e,n,i,r,o,s,a,c,l,h,u){kn.call(this,null,o,s,a,c,l,i,r,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==c?c:ut,this.minFilter=void 0!==l?l:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}exports.WebGLCubeRenderTarget=So,To.prototype=Object.create(kn.prototype),To.prototype.constructor=To,To.prototype.isDataTexture=!0;const Eo=new di,Ao=new Yn;class Lo{constructor(t,e,n,i,r,o){this.planes=[void 0!==t?t:new Qi,void 0!==e?e:new Qi,void 0!==n?n:new Qi,void 0!==i?i:new Qi,void 0!==r?r:new Qi,void 0!==o?o:new Qi]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}clone(){return(new this.constructor).copy(this)}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],c=n[5],l=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(s-i,h-a,f-u,v-m).normalize(),e[1].setComponents(s+i,h+a,f+u,v+m).normalize(),e[2].setComponents(s+r,h+c,f+p,v+g).normalize(),e[3].setComponents(s-r,h-c,f-p,v-g).normalize(),e[4].setComponents(s-o,h-l,f-d,v-x).normalize(),e[5].setComponents(s+o,h+l,f+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Eo.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Eo)}intersectsSprite(t){return Eo.center.set(0,0,0),Eo.radius=.7071067811865476,Eo.applyMatrix4(t.matrixWorld),this.intersectsSphere(Eo)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++){if(e[r].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Ao.x=i.normal.x>0?t.max.x:t.min.x,Ao.y=i.normal.y>0?t.max.y:t.min.y,Ao.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Ao)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}function Ro(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Co(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=i.get(e);void 0===o?i.set(e,function(e,i){const r=e.array,o=e.usage,s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,r,o),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:r instanceof Uint8Array&&(a=5121),{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(function(e,i,r){const o=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(n?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}exports.Frustum=Lo;class Po extends Vr{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,o=e/2,s=Math.floor(n),a=Math.floor(i),c=s+1,l=a+1,h=t/s,u=e/a,p=[],d=[],f=[],m=[];for(let g=0;g<l;g++){const t=g*u-o;for(let e=0;e<c;e++){const n=e*h-r;d.push(n,-t,0),f.push(0,0,1),m.push(e/s),m.push(1-g/a)}}for(let g=0;g<a;g++)for(let t=0;t<s;t++){const e=t+c*g,n=t+c*(g+1),i=t+1+c*(g+1),r=t+1+c*g;p.push(e,n,r),p.push(n,i,r)}this.setIndex(p),this.setAttribute("position",new Pr(d,3)),this.setAttribute("normal",new Pr(f,3)),this.setAttribute("uv",new Pr(m,2))}}exports.PlaneGeometry=exports.PlaneBufferGeometry=Po;var Do="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Oo="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Io="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",Bo="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",No="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Fo="vec3 transformed = vec3( position );",Go="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",zo="vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 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 dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\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",Ho="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = 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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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",Uo="#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",ko="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Vo="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",Wo="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",jo="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",qo="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",Xo="#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",Yo="#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",Zo="#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}",Jo="#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",Qo="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",Ko="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",$o="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",ts="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",es="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",ns="gl_FragColor = linearToOutputTexel( gl_FragColor );",is="\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}",rs="#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",os="#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",ss="#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",as="#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",cs="#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",ls="#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",hs="#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",us="#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",ps="#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",ds="#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}",fs="#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",ms="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",gs="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",xs="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",vs="#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",ys="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",_s="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)",bs="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",ws="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)",Ms="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",Ss="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}",Ts="\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",Es="#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",As="#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",Ls="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Rs="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Cs="#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",Ps="#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",Ds="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",Os="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Is="#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",Bs="#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",Ns="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Fs="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Gs="#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",zs="#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",Hs="#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",Us="#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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;",ks="#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",Vs="#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 ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",Ws="#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",js="#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 );\n\t#endif\n#endif",qs="#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",Xs="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}",Ys="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Zs="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",Js="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Qs="#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",Ks="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",$s="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",ta="#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",ea="#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",na="#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",ia="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}",ra="#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",oa="#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",sa="#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",aa="#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",ca="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",la="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",ha="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",ua="#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; }",pa="#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",da="#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",fa="#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",ma="#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",ga="#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",xa="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",va="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",ya="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",_a="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\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",ba="uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",wa="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}",Ma="#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Sa="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",Ta="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",Ea="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",Aa="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",La="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",Ra="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Ca="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",Pa="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Da="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Oa="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\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 <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ia="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",Ba="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 <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\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 <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Na="#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Fa="#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 <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\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 <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ga="#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",za="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ha="#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ua="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",ka="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Va="#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\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 <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Wa="#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#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",ja="#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 <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",qa="#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 <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",Xa="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Ya="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",Za="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",Ja="#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Qa="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",Ka="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";const $a={alphamap_fragment:Do,alphamap_pars_fragment:Oo,alphatest_fragment:Io,aomap_fragment:Bo,aomap_pars_fragment:No,begin_vertex:Fo,beginnormal_vertex:Go,bsdfs:zo,bumpmap_pars_fragment:Ho,clipping_planes_fragment:Uo,clipping_planes_pars_fragment:ko,clipping_planes_pars_vertex:Vo,clipping_planes_vertex:Wo,color_fragment:jo,color_pars_fragment:qo,color_pars_vertex:Xo,color_vertex:Yo,common:Zo,cube_uv_reflection_fragment:Jo,defaultnormal_vertex:Qo,displacementmap_pars_vertex:Ko,displacementmap_vertex:$o,emissivemap_fragment:ts,emissivemap_pars_fragment:es,encodings_fragment:ns,encodings_pars_fragment:is,envmap_fragment:rs,envmap_common_pars_fragment:os,envmap_pars_fragment:ss,envmap_pars_vertex:as,envmap_physical_pars_fragment:vs,envmap_vertex:cs,fog_vertex:ls,fog_pars_vertex:hs,fog_fragment:us,fog_pars_fragment:ps,gradientmap_pars_fragment:ds,lightmap_fragment:fs,lightmap_pars_fragment:ms,lights_lambert_vertex:gs,lights_pars_begin:xs,lights_toon_fragment:ys,lights_toon_pars_fragment:_s,lights_phong_fragment:bs,lights_phong_pars_fragment:ws,lights_physical_fragment:Ms,lights_physical_pars_fragment:Ss,lights_fragment_begin:Ts,lights_fragment_maps:Es,lights_fragment_end:As,logdepthbuf_fragment:Ls,logdepthbuf_pars_fragment:Rs,logdepthbuf_pars_vertex:Cs,logdepthbuf_vertex:Ps,map_fragment:Ds,map_pars_fragment:Os,map_particle_fragment:Is,map_particle_pars_fragment:Bs,metalnessmap_fragment:Ns,metalnessmap_pars_fragment:Fs,morphnormal_vertex:Gs,morphtarget_pars_vertex:zs,morphtarget_vertex:Hs,normal_fragment_begin:Us,normal_fragment_maps:ks,normalmap_pars_fragment:Vs,clearcoat_normal_fragment_begin:Ws,clearcoat_normal_fragment_maps:js,clearcoat_pars_fragment:qs,packing:Xs,premultiplied_alpha_fragment:Ys,project_vertex:Zs,dithering_fragment:Js,dithering_pars_fragment:Qs,roughnessmap_fragment:Ks,roughnessmap_pars_fragment:$s,shadowmap_pars_fragment:ta,shadowmap_pars_vertex:ea,shadowmap_vertex:na,shadowmask_pars_fragment:ia,skinbase_vertex:ra,skinning_pars_vertex:oa,skinning_vertex:sa,skinnormal_vertex:aa,specularmap_fragment:ca,specularmap_pars_fragment:la,tonemapping_fragment:ha,tonemapping_pars_fragment:ua,transmissionmap_fragment:pa,transmissionmap_pars_fragment:da,uv_pars_fragment:fa,uv_pars_vertex:ma,uv_vertex:ga,uv2_pars_fragment:xa,uv2_pars_vertex:va,uv2_vertex:ya,worldpos_vertex:_a,background_frag:ba,background_vert:wa,cube_frag:Ma,cube_vert:Sa,depth_frag:Ta,depth_vert:Ea,distanceRGBA_frag:Aa,distanceRGBA_vert:La,equirect_frag:Ra,equirect_vert:Ca,linedashed_frag:Pa,linedashed_vert:Da,meshbasic_frag:Oa,meshbasic_vert:Ia,meshlambert_frag:Ba,meshlambert_vert:Na,meshmatcap_frag:Fa,meshmatcap_vert:Ga,meshtoon_frag:za,meshtoon_vert:Ha,meshphong_frag:Ua,meshphong_vert:ka,meshphysical_frag:Va,meshphysical_vert:Wa,normal_frag:ja,normal_vert:qa,points_frag:Xa,points_vert:Ya,shadow_frag:Za,shadow_vert:Ja,sprite_frag:Qa,sprite_vert:Ka};exports.ShaderChunk=$a;const tc={common:{diffuse:{value:new mr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Gn},uv2Transform:{value:new Gn},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 Fn(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 mr(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 mr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gn}},sprite:{diffuse:{value:new mr(15658734)},opacity:{value:1},center:{value:new Fn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Gn}}};exports.UniformsLib=tc;const ec={basic:{uniforms:po([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.fog]),vertexShader:$a.meshbasic_vert,fragmentShader:$a.meshbasic_frag},lambert:{uniforms:po([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.fog,tc.lights,{emissive:{value:new mr(0)}}]),vertexShader:$a.meshlambert_vert,fragmentShader:$a.meshlambert_frag},phong:{uniforms:po([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.fog,tc.lights,{emissive:{value:new mr(0)},specular:{value:new mr(1118481)},shininess:{value:30}}]),vertexShader:$a.meshphong_vert,fragmentShader:$a.meshphong_frag},standard:{uniforms:po([tc.common,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.roughnessmap,tc.metalnessmap,tc.fog,tc.lights,{emissive:{value:new mr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$a.meshphysical_vert,fragmentShader:$a.meshphysical_frag},toon:{uniforms:po([tc.common,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.gradientmap,tc.fog,tc.lights,{emissive:{value:new mr(0)}}]),vertexShader:$a.meshtoon_vert,fragmentShader:$a.meshtoon_frag},matcap:{uniforms:po([tc.common,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.fog,{matcap:{value:null}}]),vertexShader:$a.meshmatcap_vert,fragmentShader:$a.meshmatcap_frag},points:{uniforms:po([tc.points,tc.fog]),vertexShader:$a.points_vert,fragmentShader:$a.points_frag},dashed:{uniforms:po([tc.common,tc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$a.linedashed_vert,fragmentShader:$a.linedashed_frag},depth:{uniforms:po([tc.common,tc.displacementmap]),vertexShader:$a.depth_vert,fragmentShader:$a.depth_frag},normal:{uniforms:po([tc.common,tc.bumpmap,tc.normalmap,tc.displacementmap,{opacity:{value:1}}]),vertexShader:$a.normal_vert,fragmentShader:$a.normal_frag},sprite:{uniforms:po([tc.sprite,tc.fog]),vertexShader:$a.sprite_vert,fragmentShader:$a.sprite_frag},background:{uniforms:{uvTransform:{value:new Gn},t2D:{value:null}},vertexShader:$a.background_vert,fragmentShader:$a.background_frag},cube:{uniforms:po([tc.envmap,{opacity:{value:1}}]),vertexShader:$a.cube_vert,fragmentShader:$a.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$a.equirect_vert,fragmentShader:$a.equirect_frag},distanceRGBA:{uniforms:po([tc.common,tc.displacementmap,{referencePosition:{value:new Yn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$a.distanceRGBA_vert,fragmentShader:$a.distanceRGBA_frag},shadow:{uniforms:po([tc.lights,tc.fog,{color:{value:new mr(0)},opacity:{value:1}}]),vertexShader:$a.shadow_vert,fragmentShader:$a.shadow_frag}};function nc(t,e,n,i,r){const o=new mr(0);let s,a,c=0,l=null,h=0,d=null;function f(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),f(o,c=e)},getClearAlpha:function(){return c},setClearAlpha:function(t){f(o,c=t)},render:function(n,r,m,g){let x=!0===r.isScene?r.background:null;x&&x.isTexture&&(x=e.get(x));const v=t.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(x=null),null===x?f(o,c):x&&x.isColor&&(f(x,1),g=!0),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),x&&(x.isCubeTexture||x.isWebGLCubeRenderTarget||x.mapping===st)?(void 0===a&&((a=new ao(new ho(1,1,1),new xo({name:"BackgroundCubeMaterial",uniforms:uo(ec.cube.uniforms),vertexShader:ec.cube.vertexShader,fragmentShader:ec.cube.fragmentShader,side:p,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(a)),x.isWebGLCubeRenderTarget&&(x=x.texture),a.material.uniforms.envMap.value=x,a.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x._needsFlipEnvMap?-1:1,l===x&&h===x.version&&d===t.toneMapping||(a.material.needsUpdate=!0,l=x,h=x.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):x&&x.isTexture&&(void 0===s&&((s=new ao(new Po(2,2),new xo({name:"BackgroundMaterial",uniforms:uo(ec.background.uniforms),vertexShader:ec.background.vertexShader,fragmentShader:ec.background.fragmentShader,side:u,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=x,!0===x.matrixAutoUpdate&&x.updateMatrix(),s.material.uniforms.uvTransform.value.copy(x.matrix),l===x&&h===x.version&&d===t.toneMapping||(s.material.needsUpdate=!0,l=x,h=x.version,d=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function ic(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},c=p(null);let l=c;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let o=0;o<r;o++)e[o]=0,n[o]=0,i[o]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function d(){const t=l.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,r){const o=l.newAttributes,s=l.enabledAttributes,a=l.attributeDivisors;if(o[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),a[n]!==r){(i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),a[n]=r}}function g(){const e=l.newAttributes,n=l.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function x(e,n,r,o,s,a){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,o,s,a):t.vertexAttribIPointer(e,n,r,s,a)}function v(){y(),l!==c&&h((l=c).object)}function y(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:function(r,c,u,v,y){let _=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let c=a[e.id];void 0===c&&(c={},a[e.id]=c);let l=c[n.id];void 0===l&&(l={},c[n.id]=l);let h=l[s];return void 0===h&&(h=p(i.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),l[s]=h),h}(v,u,c);l!==e&&h((l=e).object),(_=function(t,e){const n=l.attributes,i=t.attributes;let r=0;for(const o in i){const t=n[o],e=i[o];if(void 0===t)return!0;if(t.attribute!==e)return!0;if(t.data!==e.data)return!0;r++}return l.attributesNum!==r||l.index!==e}(v,y))&&function(t,e){const n={},i=t.attributes;let r=0;for(const o in i){const t=i[o],e={};e.attribute=t,t.data&&(e.data=t.data),n[o]=e,r++}l.attributes=n,l.attributesNum=r,l.index=e}(v,y)}else{const t=!0===c.wireframe;l.geometry===v.id&&l.program===u.id&&l.wireframe===t||(l.geometry=v.id,l.program=u.id,l.wireframe=t,_=!0)}!0===r.isInstancedMesh&&(_=!0),null!==y&&n.update(y,34963),_&&(function(r,o,s,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const c=a.attributes,l=s.getAttributes(),h=o.defaultAttributeValues;for(const e in l){const i=l[e];if(i>=0){const o=c[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=n.get(o);if(void 0===s)continue;const c=s.buffer,l=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,u=o.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,c),x(i,r,l,e,s*h,u*h)}else o.isInstancedBufferAttribute?(m(i,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(i),t.bindBuffer(34962,c),x(i,r,l,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i+0,4,s,!1,64,0),t.vertexAttribPointer(i+1,4,s,!1,64,16),t.vertexAttribPointer(i+2,4,s,!1,64,32),t.vertexAttribPointer(i+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i,3,s,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,c,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:d,enableAttribute:f,disableUnusedAttributes:g}}function rc(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let c,l;if(r)c=t,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(c=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[l](o,i,s,a),n.update(s,o,a)}}function oc(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const c=!0===n.logarithmicDepthBuffer,l=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;const n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:o?t.getParameter(36183):0}}function sc(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new Qi,a=new Gn,c={value:null,needsUpdate:!1};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let l=null;if(0!==o){if(l=c.value,!0!==r||null===l){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===l||l.length<e)&&(l=new Float32Array(e));for(let n=0,c=i;n!==o;++n,c+=4)s.copy(t[n]).applyMatrix4(r,a),s.normal.toArray(l,c),l[c+3]=s.constant}c.value=l,c.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,l}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==i||r;return r=e,n=h(t,o,0),i=t.length,s},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1,l()},this.setState=function(e,s,a){const u=e.clippingPlanes,p=e.clipIntersection,d=e.clipShadows,f=t.get(e);if(!r||null===u||0===u.length||o&&!d)o?h(null):l();else{const t=o?0:i,e=4*t;let r=f.clippingState||null;c.value=r,r=h(u,s,e,a);for(let i=0;i!==e;++i)r[i]=n[i];f.clippingState=r,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=t}}}function ac(t){let e=new WeakMap;function n(t,e){return e===rt?t.mapping=nt:e===ot&&(t.mapping=it),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping;if(o===rt||o===ot){if(e.has(r))return n(e.get(r).texture,r.mapping);{const o=r.image;if(o&&o.height>0){const s=t.getRenderList(),a=t.getRenderTarget(),c=new So(o.height/2);return c.fromEquirectangularTexture(t,r),e.set(r,c),t.setRenderTarget(a),t.setRenderList(s),r.addEventListener("dispose",i),n(c.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function cc(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function lc(t,e,n,i){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",s),delete r[a.id];const c=o.get(a);c&&(e.remove(c),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],o=t[e+2];n.push(i,r,r,o,o,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const a=new(Or(n)>65535?Rr:Ar)(n,1);a.version=s;const c=o.get(t);c&&e.remove(c),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]?e:(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const r in n)e.update(n[r],34962);const i=t.morphAttributes;for(const r in i){const t=i[r];for(let n=0,i=t.length;n<i;n++)e.update(t[n],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return o.get(t)}}}function hc(t,e,n,i){const r=i.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(o,i,s,e*a),n.update(i,o,1)},this.renderInstances=function(i,c,l){if(0===l)return;let h,u;if(r)h=t,u="drawElementsInstanced";else if(u="drawElementsInstancedANGLE",null===(h=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](o,c,s,i*a,l),n.update(c,o,l)}}function uc(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function pc(t,e){return t[0]-e[0]}function dc(t,e){return Math.abs(e[1])-Math.abs(t[1])}function fc(t){const e={},n=new Float32Array(8),i=[];for(let r=0;r<8;r++)i[r]=[r,0];return{update:function(r,o,s,a){const c=r.morphTargetInfluences,l=void 0===c?0:c.length;let h=e[o.id];if(void 0===h){h=[];for(let t=0;t<l;t++)h[t]=[t,0];e[o.id]=h}for(let t=0;t<l;t++){const e=h[t];e[0]=t,e[1]=c[t]}h.sort(dc);for(let t=0;t<8;t++)t<l&&h[t][1]?(i[t][0]=h[t][0],i[t][1]=h[t][1]):(i[t][0]=Number.MAX_SAFE_INTEGER,i[t][1]=0);i.sort(pc);const u=s.morphTargets&&o.morphAttributes.position,p=s.morphNormals&&o.morphAttributes.normal;let d=0;for(let t=0;t<8;t++){const e=i[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(u&&o.getAttribute("morphTarget"+t)!==u[r]&&o.setAttribute("morphTarget"+t,u[r]),p&&o.getAttribute("morphNormal"+t)!==p[r]&&o.setAttribute("morphNormal"+t,p[r]),n[t]=s,d+=s):(u&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),p&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),n[t]=0)}const f=o.morphTargetsRelative?1:1-d;a.getUniforms().setValue(t,"morphTargetBaseInfluence",f),a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function mc(t,e,n,i){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const s=i.render.frame,a=t.geometry,c=e.get(t,a);return r.get(c)!==s&&(e.update(c),r.set(c,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),c},dispose:function(){r=new WeakMap}}}function gc(t=null,e=1,n=1,i=1){kn.call(this,null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=ut,this.minFilter=ut,this.wrapR=lt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function xc(t=null,e=1,n=1,i=1){kn.call(this,null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=ut,this.minFilter=ut,this.wrapR=lt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}exports.ShaderLib=ec,ec.physical={uniforms:po([ec.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Fn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new mr(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:$a.meshphysical_vert,fragmentShader:$a.meshphysical_frag},gc.prototype=Object.create(kn.prototype),gc.prototype.constructor=gc,gc.prototype.isDataTexture2DArray=!0,xc.prototype=Object.create(kn.prototype),xc.prototype.constructor=xc,xc.prototype.isDataTexture3D=!0;const vc=new kn,yc=new gc,_c=new xc,bc=new Mo,wc=[],Mc=[],Sc=new Float32Array(16),Tc=new Float32Array(9),Ec=new Float32Array(4);function Ac(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let o=wc[r];if(void 0===o&&(o=new Float32Array(r),wc[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function Lc(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Rc(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Cc(t,e){let n=Mc[e];void 0===n&&(n=new Int32Array(e),Mc[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Pc(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Dc(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Lc(n,e))return;t.uniform2fv(this.addr,e),Rc(n,e)}}function Oc(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Lc(n,e))return;t.uniform3fv(this.addr,e),Rc(n,e)}}function Ic(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Lc(n,e))return;t.uniform4fv(this.addr,e),Rc(n,e)}}function Bc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Lc(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Rc(n,e)}else{if(Lc(n,i))return;Ec.set(i),t.uniformMatrix2fv(this.addr,!1,Ec),Rc(n,i)}}function Nc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Lc(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Rc(n,e)}else{if(Lc(n,i))return;Tc.set(i),t.uniformMatrix3fv(this.addr,!1,Tc),Rc(n,i)}}function Fc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Lc(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Rc(n,e)}else{if(Lc(n,i))return;Sc.set(i),t.uniformMatrix4fv(this.addr,!1,Sc),Rc(n,i)}}function Gc(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||vc,r)}function zc(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||yc,r)}function Hc(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||_c,r)}function Uc(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||bc,r)}function kc(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Vc(t,e){const n=this.cache;Lc(n,e)||(t.uniform2iv(this.addr,e),Rc(n,e))}function Wc(t,e){const n=this.cache;Lc(n,e)||(t.uniform3iv(this.addr,e),Rc(n,e))}function jc(t,e){const n=this.cache;Lc(n,e)||(t.uniform4iv(this.addr,e),Rc(n,e))}function qc(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Xc(t){switch(t){case 5126:return Pc;case 35664:return Dc;case 35665:return Oc;case 35666:return Ic;case 35674:return Bc;case 35675:return Nc;case 35676:return Fc;case 5124:case 35670:return kc;case 35667:case 35671:return Vc;case 35668:case 35672:return Wc;case 35669:case 35673:return jc;case 5125:return qc;case 35678:case 36198:case 36298:case 36306:case 35682:return Gc;case 35679:case 36299:case 36307:return Hc;case 35680:case 36300:case 36308:case 36293:return Uc;case 36289:case 36303:case 36311:case 36292:return zc}}function Yc(t,e){t.uniform1fv(this.addr,e)}function Zc(t,e){t.uniform1iv(this.addr,e)}function Jc(t,e){t.uniform2iv(this.addr,e)}function Qc(t,e){t.uniform3iv(this.addr,e)}function Kc(t,e){t.uniform4iv(this.addr,e)}function $c(t,e){const n=Ac(e,this.size,2);t.uniform2fv(this.addr,n)}function tl(t,e){const n=Ac(e,this.size,3);t.uniform3fv(this.addr,n)}function el(t,e){const n=Ac(e,this.size,4);t.uniform4fv(this.addr,n)}function nl(t,e){const n=Ac(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function il(t,e){const n=Ac(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function rl(t,e){const n=Ac(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function ol(t,e,n){const i=e.length,r=Cc(n,i);t.uniform1iv(this.addr,r);for(let o=0;o!==i;++o)n.safeSetTexture2D(e[o]||vc,r[o])}function sl(t,e,n){const i=e.length,r=Cc(n,i);t.uniform1iv(this.addr,r);for(let o=0;o!==i;++o)n.safeSetTextureCube(e[o]||bc,r[o])}function al(t){switch(t){case 5126:return Yc;case 35664:return $c;case 35665:return tl;case 35666:return el;case 35674:return nl;case 35675:return il;case 35676:return rl;case 5124:case 35670:return Zc;case 35667:case 35671:return Jc;case 35668:case 35672:return Qc;case 35669:case 35673:return Kc;case 35678:case 36198:case 36298:case 36306:case 35682:return ol;case 35680:case 36300:case 36308:case 36293:return sl}}function cl(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=Xc(e.type)}function ll(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=al(e.type)}function hl(t){this.id=t,this.seq=[],this.map={}}ll.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Rc(e,t)},hl.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,o=i.length;r!==o;++r){const o=i[r];o.setValue(t,e[o.id],n)}};const ul=/(\w+)(\])?(\[|\.)?/g;function pl(t,e){t.seq.push(e),t.map[e.id]=e}function dl(t,e,n){const i=t.name,r=i.length;for(ul.lastIndex=0;;){const o=ul.exec(i),s=ul.lastIndex;let a=o[1];const c="]"===o[2],l=o[3];if(c&&(a|=0),void 0===l||"["===l&&s+2===r){pl(n,void 0===l?new cl(a,t,e):new ll(a,t,e));break}{let t=n.map[a];void 0===t&&pl(n,t=new hl(a)),n=t}}}function fl(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);dl(n,t.getUniformLocation(e,n.name),this)}}function ml(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}fl.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},fl.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},fl.upload=function(t,e,n,i){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}},fl.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let gl=0;function xl(t){const e=t.split("\n");for(let n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function vl(t){switch(t){case Xe:return["Linear","( value )"];case Ye:return["sRGB","( value )"];case Je:return["RGBE","( value )"];case Ke:return["RGBM","( value, 7.0 )"];case $e:return["RGBM","( value, 16.0 )"];case tn:return["RGBD","( value, 256.0 )"];case Ze:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Qe:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function yl(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+xl(t.getShaderSource(e))}function _l(t,e){const n=vl(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function bl(t,e){const n=vl(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function wl(t,e){let n;switch(e){case J:n="Linear";break;case Q:n="Reinhard";break;case K:n="OptimizedCineon";break;case $:n="ACESFilmic";break;case tt:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Ml(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(El).join("\n")}function Sl(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function Tl(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r).name;n[i]=t.getAttribLocation(e,i)}return n}function El(t){return""!==t}function Al(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ll(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Rl=/^[ \t]*#include +<([\w\d./]+)>/gm;function Cl(t){return t.replace(Rl,Pl)}function Pl(t,e){const n=$a[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Cl(n)}const Dl=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ol=/#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 Il(t){return t.replace(Ol,Nl).replace(Dl,Bl)}function Bl(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nl(t,e,n,i)}function Nl(t,e,n,i){let r="";for(let o=parseInt(e);o<parseInt(n);o++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function Fl(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Gl(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===c?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===l?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===h&&(e="SHADOWMAP_TYPE_VSM"),e}function zl(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case nt:case it:e="ENVMAP_TYPE_CUBE";break;case st:case at:e="ENVMAP_TYPE_CUBE_UV"}return e}function Hl(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case it:case at:e="ENVMAP_MODE_REFRACTION"}return e}function Ul(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case q:e="ENVMAP_BLENDING_MULTIPLY";break;case X:e="ENVMAP_BLENDING_MIX";break;case Y:e="ENVMAP_BLENDING_ADD"}return e}function kl(t,e,n,i){const r=t.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const c=Gl(n),l=zl(n),h=Hl(n),u=Ul(n),p=t.gammaFactor>0?t.gammaFactor:1,d=n.isWebGL2?"":Ml(n),f=Sl(o),m=r.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[f].filter(El).join("\n")).length>0&&(g+="\n"),(x=[d,f].filter(El).join("\n")).length>0&&(x+="\n")):(g=[Fl(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(El).join("\n"),x=[d,Fl(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?$a.tonemapping_pars_fragment:"",n.toneMapping!==Z?wl("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",$a.encodings_pars_fragment,n.map?_l("mapTexelToLinear",n.mapEncoding):"",n.matcap?_l("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?_l("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?_l("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?_l("lightMapTexelToLinear",n.lightMapEncoding):"",bl("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(El).join("\n")),s=Ll(s=Al(s=Cl(s),n),n),a=Ll(a=Al(a=Cl(a),n),n),s=Il(s),a=Il(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const y=v+x+a,_=ml(r,35633,v+g+s),b=ml(r,35632,y);if(r.attachShader(m,_),r.attachShader(m,b),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(_).trim(),n=r.getShaderInfoLog(b).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=yl(r,_,"vertex"),n=yl(r,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return r.deleteShader(_),r.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new fl(r,m)),w},this.getAttributes=function(){return void 0===M&&(M=Tl(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=gl++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=_,this.fragmentShader=b,this}function Vl(t,e,n,i,r,o){const s=[],a=i.isWebGL2,c=i.logarithmicDepthBuffer,l=i.floatVertexTextures,h=i.maxVertexUniforms,u=i.vertexTextures;let f=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(r,s,g,v,y){const _=v.fog,b=r.isMeshStandardMaterial?v.environment:null,w=e.get(r.envMap||b),M=m[r.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(l)return 1024;{const t=h,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(y):0;let T,E;if(null!==r.precision&&(f=i.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",f,"instead."),M){const t=ec[M];T=t.vertexShader,E=t.fragmentShader}else T=r.vertexShader,E=r.fragmentShader;const A=t.getRenderTarget();return{isWebGL2:a,shaderID:M,shaderName:r.type,vertexShader:T,fragmentShader:E,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:f,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:u,outputEncoding:null!==A?x(A.texture):t.outputEncoding,map:!!r.map,mapEncoding:x(r.map),matcap:!!r.matcap,matcapEncoding:x(r.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:x(w),envMapCubeUV:!!w&&(w.mapping===st||w.mapping===at),lightMap:!!r.lightMap,lightMapEncoding:x(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:x(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===on,tangentSpaceNormalMap:r.normalMapType===rn,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!_,useFog:r.fog,fogExp2:_&&_.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:c,skinning:r.skinning&&S>0,maxBones:S,useVertexTexture:l,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===d,flipSided:r.side===p,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<g.length;t++)n.push(e[g[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=m[t.type];let n;if(e){const t=ec[e];n=fo.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,r=s.length;t<r;t++){const e=s[t];if(e.cacheKey===n){++(i=e).usedTimes;break}}return void 0===i&&(i=new kl(t,n,e,r),s.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Wl(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function jl(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function ql(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Xl(t){const e=[];let n=0;const i=[],r=[],o={id:-1};function s(i,r,s,a,c,l){let h=e[n];const u=t.get(s);return void 0===h?(h={id:i.id,object:i,geometry:r,material:s,program:u.program||o,groupOrder:a,renderOrder:i.renderOrder,z:c,group:l},e[n]=h):(h.id=i.id,h.object=i,h.geometry=r,h.material=s,h.program=u.program||o,h.groupOrder=a,h.renderOrder=i.renderOrder,h.z=c,h.group=l),n++,h}return{opaque:i,transparent:r,init:function(){n=0,i.length=0,r.length=0},push:function(t,e,n,o,a,c){const l=s(t,e,n,o,a,c);(!0===n.transparent?r:i).push(l)},unshift:function(t,e,n,o,a,c){const l=s(t,e,n,o,a,c);(!0===n.transparent?r:i).unshift(l)},finish:function(){for(let t=n,i=e.length;t<i;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){i.length>1&&i.sort(t||jl),r.length>1&&r.sort(e||ql)}}}function Yl(t){let e=new WeakMap;return{get:function(n,i){const r=e.get(n);let o;return void 0===r?(o=new Xl(t),e.set(n,new WeakMap),e.get(n).set(i,o)):void 0===(o=r.get(i))&&(o=new Xl(t),r.set(i,o)),o},dispose:function(){e=new WeakMap}}}function Zl(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new mr};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new mr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new mr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new mr,groundColor:new mr};break;case"RectAreaLight":n={color:new mr,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Jl(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Ql=0;function Kl(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function $l(t,e){const n=new Zl,i=Jl(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let c=0;c<9;c++)r.probe.push(new Yn);const o=new Yn,s=new wi,a=new wi;return{setup:function(o){let s=0,a=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let l=0,h=0,u=0,p=0,d=0,f=0,m=0,g=0;o.sort(Kl);for(let t=0,e=o.length;t<e;t++){const e=o[t],x=e.color,v=e.intensity,y=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=x.r*v,a+=x.g*v,c+=x.b*v;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[l]=n,r.directionalShadowMap[l]=_,r.directionalShadowMatrix[l]=e.shadow.matrix,f++}r.directional[l]=t,l++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(x).multiplyScalar(v),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[u]=n,r.spotShadowMap[u]=_,r.spotShadowMatrix[u]=e.shadow.matrix,g++}r.spot[u]=t,u++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(x).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[h]=n,r.pointShadowMap[h]=_,r.pointShadowMatrix[h]=e.shadow.matrix,m++}r.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(v),t.groundColor.copy(e.groundColor).multiplyScalar(v),r.hemi[d]=t,d++}}p>0&&(e.isWebGL2?(r.rectAreaLTC1=tc.LTC_FLOAT_1,r.rectAreaLTC2=tc.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=tc.LTC_FLOAT_1,r.rectAreaLTC2=tc.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=tc.LTC_HALF_1,r.rectAreaLTC2=tc.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=c;const x=r.hash;x.directionalLength===l&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===f&&x.numPointShadows===m&&x.numSpotShadows===g||(r.directional.length=l,r.spot.length=u,r.rectArea.length=p,r.point.length=h,r.hemi.length=d,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,x.directionalLength=l,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=f,x.numPointShadows=m,x.numSpotShadows=g,r.version=Ql++)},setupView:function(t,e){let n=0,i=0,c=0,l=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p<d;p++){const e=t[p];if(e.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(e.matrixWorld),o.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),n++}else if(e.isSpotLight){const t=r.spot[c];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(e.matrixWorld),o.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),c++}else if(e.isRectAreaLight){const t=r.rectArea[l];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(e.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),l++}else if(e.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),i++}else if(e.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(e.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),h++}}},state:r}}function th(t,e){const n=new $l(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(){n.setup(i)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function eh(t,e){let n=new WeakMap;return{get:function(i,r=0){let o;return!1===n.has(i)?(o=new th(t,e),n.set(i,[]),n.get(i).push(o)):r>=n.get(i).length?(o=new th(t,e),n.get(i).push(o)):o=n.get(i)[r],o},dispose:function(){n=new WeakMap}}}function nh(t){vr.call(this),this.type="MeshDepthMaterial",this.depthPacking=en,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function ih(t){vr.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}nh.prototype=Object.create(vr.prototype),nh.prototype.constructor=nh,nh.prototype.isMeshDepthMaterial=!0,nh.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},ih.prototype=Object.create(vr.prototype),ih.prototype.constructor=ih,ih.prototype.isMeshDistanceMaterial=!0,ih.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\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}",oh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let i=new Lo;const r=new Fn,o=new Fn,s=new Wn,a=[],l=[],f={},m={0:p,1:u,2:d},x=new xo({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fn},radius:{value:4}},vertexShader:oh,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new Vr;y.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new ao(y,x),b=this;function w(n,i){const r=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,v,_,null)}function M(t,e,n){const i=t<<0|e<<1|n<<2;let r=a[i];return void 0===r&&(r=new nh({depthPacking:nn,morphTargets:t,skinning:e}),a[i]=r),r}function S(t,e,n){const i=t<<0|e<<1|n<<2;let r=l[i];return void 0===r&&(r=new ih({morphTargets:t,skinning:e}),l[i]=r),r}function T(e,n,i,r,o,s,a){let c=null,l=M,u=e.customDepthMaterial;if(!0===r.isPointLight&&(l=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===i.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),c=l(t,r,!0===e.isInstancedMesh)}else c=u;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=c.uuid,e=i.uuid;let n=f[t];void 0===n&&(n={},f[t]=n);let r=n[e];void 0===r&&(r=c.clone(),n[e]=r),c=r}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=a===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=o,c.farDistance=s),c}function E(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let c=0,l=e.length;c<l;c++){const l=e[c],h=r[l.materialIndex];if(h&&h.visible){const e=T(n,i,h,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,l)}}}else if(r.visible){const e=T(n,i,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,null)}}const c=n.children;for(let t=0,e=c.length;t<e;t++)E(c[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=c,this.render=function(e,a,c){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),u=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.state;d.setBlending(g),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let f=0,m=e.length;f<m;f++){const l=e[f],u=l.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),o.copy(u.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(o.x=Math.floor(n/p.x),r.x=o.x*p.x,u.mapSize.x=o.x),r.y>n&&(o.y=Math.floor(n/p.y),r.y=o.y*p.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Bt};u.map=new jn(r.x,r.y,t),u.map.texture.name=l.name+".shadowMap",u.mapPass=new jn(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Bt};u.map=new jn(r.x,r.y,t),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t<m;t++){const e=u.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),u.updateMatrices(l,t),i=u.getFrustum(),E(a,c,u.camera,l,this.type)}u.isPointLightShadow||this.type!==h||w(u,c),u.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(l,u,p)}}function ah(t,e,n){const s=n.isWebGL2;const a=new function(){let e=!1;const n=new Wn;let i=null;const r=new Wn(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,s,a){!0===a&&(e*=s,i*=s,o*=s),n.set(e,i,o,s),!1===r.equals(n)&&(t.clearColor(e,i,o,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},c=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?ft(2929):mt(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case G:t.depthFunc(512);break;case z:t.depthFunc(519);break;case H:t.depthFunc(513);break;case U:t.depthFunc(515);break;case k:t.depthFunc(514);break;case V:t.depthFunc(518);break;case W:t.depthFunc(516);break;case j:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},l=new function(){let e=!1,n=null,i=null,r=null,o=null,s=null,a=null,c=null,l=null;return{setTest:function(t){e||(t?ft(2960):mt(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&o===s||(t.stencilFunc(e,n,s),i=e,r=n,o=s)},setOp:function(e,n,i){s===e&&a===n&&c===i||(t.stencilOp(e,n,i),s=e,a=n,c=i)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,s=null,a=null,c=null,l=null}}};let h={},u=null,f=null,m=null,q=null,X=null,Y=null,Z=null,J=null,Q=null,K=!1,$=null,tt=null,et=null,nt=null,it=null;const rt=t.getParameter(35661);let ot=!1,st=0;const at=t.getParameter(7938);-1!==at.indexOf("WebGL")?(st=parseFloat(/^WebGL (\d)/.exec(at)[1]),ot=st>=1):-1!==at.indexOf("OpenGL ES")&&(st=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),ot=st>=2);let ct=null,lt={};const ht=new Wn,ut=new Wn;function pt(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let s=0;s<i;s++)t.texImage2D(n+s,0,6408,1,1,0,6408,5121,r);return o}const dt={};function ft(e){!0!==h[e]&&(t.enable(e),h[e]=!0)}function mt(e){!1!==h[e]&&(t.disable(e),h[e]=!1)}dt[3553]=pt(3553,3553,1),dt[34067]=pt(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),ft(2929),c.setFunc(U),yt(!1),_t(r),ft(2884),vt(g);const gt={[w]:32774,[M]:32778,[S]:32779};if(s)gt[T]=32775,gt[E]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(gt[T]=t.MIN_EXT,gt[E]=t.MAX_EXT)}const xt={[A]:0,[L]:1,[R]:768,[P]:770,[F]:776,[B]:774,[O]:772,[C]:769,[D]:771,[N]:775,[I]:773};function vt(e,n,i,r,o,s,a,c){if(e!==g){if(f||(ft(3042),f=!0),e===b)o=o||n,s=s||i,a=a||r,n===q&&o===Z||(t.blendEquationSeparate(gt[n],gt[o]),q=n,Z=o),i===X&&r===Y&&s===J&&a===Q||(t.blendFuncSeparate(xt[i],xt[r],xt[s],xt[a]),X=i,Y=r,J=s,Q=a),m=e,K=null;else if(e!==m||c!==K){if(q===w&&Z===w||(t.blendEquation(32774),q=w,Z=w),c)switch(e){case x:t.blendFuncSeparate(1,771,1,771);break;case v:t.blendFunc(1,1);break;case y:t.blendFuncSeparate(0,0,769,771);break;case _:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case x:t.blendFuncSeparate(770,771,1,771);break;case v:t.blendFunc(770,1);break;case y:t.blendFunc(0,769);break;case _:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}X=null,Y=null,J=null,Q=null,m=e,K=c}}else f&&(mt(3042),f=!1)}function yt(e){$!==e&&(e?t.frontFace(2304):t.frontFace(2305),$=e)}function _t(e){e!==i?(ft(2884),e!==tt&&(e===r?t.cullFace(1029):e===o?t.cullFace(1028):t.cullFace(1032))):mt(2884),tt=e}function bt(e,n,i){e?(ft(32823),nt===n&&it===i||(t.polygonOffset(n,i),nt=n,it=i)):mt(32823)}function wt(e){void 0===e&&(e=33984+rt-1),ct!==e&&(t.activeTexture(e),ct=e)}return{buffers:{color:a,depth:c,stencil:l},enable:ft,disable:mt,useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:vt,setMaterial:function(t,e){t.side===d?mt(2884):ft(2884);let n=t.side===p;e&&(n=!n),yt(n),t.blending===x&&!1===t.transparent?vt(g):vt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),c.setFunc(t.depthFunc),c.setTest(t.depthTest),c.setMask(t.depthWrite),a.setMask(t.colorWrite);const i=t.stencilWrite;l.setTest(i),i&&(l.setMask(t.stencilWriteMask),l.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),l.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),bt(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:yt,setCullFace:_t,setLineWidth:function(e){e!==et&&(ot&&t.lineWidth(e),et=e)},setPolygonOffset:bt,setScissorTest:function(t){t?ft(3089):mt(3089)},activeTexture:wt,bindTexture:function(e,n){null===ct&&wt();let i=lt[ct];void 0===i&&(i={type:void 0,texture:void 0},lt[ct]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||dt[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=lt[ct];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===ht.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ht.copy(e))},viewport:function(e){!1===ut.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),ut.copy(e))},reset:function(){h={},ct=null,lt={},u=null,f=null,m=null,q=null,X=null,Y=null,Z=null,J=null,Q=null,K=!1,$=null,tt=null,et=null,nt=null,it=null,a.reset(),c.reset(),l.reset()}}}function ch(t,e,n,i,r,o,s){const a=r.isWebGL2,c=r.maxTextures,l=r.maxCubemapSize,h=r.maxTextureSize,u=r.maxSamples,p=new WeakMap;let d,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(G){}function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Nn.floorPowerOfTwo:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===d&&(d=m(o,s));const a=n?m(o,s):d;return a.width=o,a.height=s,a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Nn.isPowerOfTwo(t.width)&&Nn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function _(n,i,r){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function b(t){return t===ut||t===pt||t===ft?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&p.delete(n),s.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e),r=i.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let i=0;i<6;i++)t.deleteFramebuffer(n.__webglFramebuffer[i]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[i]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&t.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(e.texture),i.remove(e)}(n),s.memory.textures--}let S=0;function T(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function E(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;C(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),c=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||c?c?i.image[t].image:i.image[t]:g(i.image[t],!1,!0,l);const u=h[0],p=x(u)||a,d=o.convert(i.format),f=o.convert(i.type),m=_(i.internalFormat,d,f);let b;if(R(34067,i,p),s){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e<b.length;e++){const r=b[e];i.format!==Bt&&i.format!==It?null!==d?n.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,r.width,r.height,0,d,f,r.data)}}e.__maxMipLevel=b.length-1}else{b=i.mipmaps;for(let t=0;t<6;t++)if(c){n.texImage2D(34069+t,0,m,h[t].width,h[t].height,0,d,f,h[t].data);for(let e=0;e<b.length;e++){const i=b[e],r=i.image[t].image;n.texImage2D(34069+t,e+1,m,r.width,r.height,0,d,f,r.data)}}else{n.texImage2D(34069+t,0,m,d,f,h[t]);for(let e=0;e<b.length;e++){const i=b[e];n.texImage2D(34069+t,e+1,m,d,f,i.image[t])}}e.__maxMipLevel=b.length}v(i,p)&&y(34067,i,u.width,u.height);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(s,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,s.__webglTexture))}const A={[ct]:10497,[lt]:33071,[ht]:33648},L={[ut]:9728,[pt]:9984,[ft]:9986,[gt]:9729,[xt]:9985,[yt]:9987};function R(n,o,s){s?(t.texParameteri(n,10242,A[o.wrapS]),t.texParameteri(n,10243,A[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,A[o.wrapR]),t.texParameteri(n,10240,L[o.magFilter]),t.texParameteri(n,10241,L[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===lt&&o.wrapT===lt||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,b(o.magFilter)),t.texParameteri(n,10241,b(o.minFilter)),o.minFilter!==ut&&o.minFilter!==gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));const c=e.get("EXT_texture_filter_anisotropic");if(c){if(o.type===At&&null===e.get("OES_texture_float_linear"))return;if(o.type===Lt&&null===(a||e.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function P(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),C(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment);const c=function(t){return!a&&(t.wrapS!==lt||t.wrapT!==lt||t.minFilter!==ut&&t.minFilter!==gt)}(i)&&!1===x(i.image),l=g(i.image,c,!1,h),u=x(l)||a,p=o.convert(i.format);let d,f=o.convert(i.type),m=_(i.internalFormat,p,f);R(s,i,u);const b=i.mipmaps;if(i.isDepthTexture)m=6402,a?m=i.type===At?36012:i.type===Et?33190:i.type===Dt?35056:33189:i.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===zt&&6402===m&&i.type!==St&&i.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=St,f=o.convert(i.type)),i.format===Ht&&6402===m&&(m=34041,i.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Dt,f=o.convert(i.type))),n.texImage2D(3553,0,m,l.width,l.height,0,p,f,null);else if(i.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t<e;t++)d=b[t],n.texImage2D(3553,t,m,d.width,d.height,0,p,f,d.data);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,l.width,l.height,0,p,f,l.data),e.__maxMipLevel=0;else if(i.isCompressedTexture){for(let t=0,e=b.length;t<e;t++)d=b[t],i.format!==Bt&&i.format!==It?null!==p?n.compressedTexImage2D(3553,t,m,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,d.width,d.height,0,p,f,d.data);e.__maxMipLevel=b.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,p,f,l.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,p,f,l.data),e.__maxMipLevel=0;else if(b.length>0&&u){for(let t=0,e=b.length;t<e;t++)d=b[t],n.texImage2D(3553,t,m,p,f,d);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,p,f,l),e.__maxMipLevel=0;v(i,u)&&y(s,i,l.width,l.height),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function D(e,r,s,a){const c=o.convert(r.texture.format),l=o.convert(r.texture.type),h=_(r.texture.internalFormat,c,l);n.texImage2D(a,0,h,r.width,r.height,0,c,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,s,a,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function O(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===At?r=36012:e.type===Et&&(r=33190));const i=B(n);t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(i){const e=B(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=o.convert(n.texture.format),r=o.convert(n.texture.type),s=_(n.texture.internalFormat,e,r);if(i){const e=B(n);t.renderbufferStorageMultisample(36161,e,s,n.width,n.height)}else t.renderbufferStorage(36161,s,n.width,n.height)}t.bindRenderbuffer(36161,null)}function I(e){const n=i.get(e),r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),T(n.depthTexture,0);const r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===zt)t.framebufferTexture2D(36160,36096,3553,r,0);else{if(n.depthTexture.format!==Ht)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)t.bindFramebuffer(36160,n.__webglFramebuffer[i]),n.__webglDepthbuffer[i]=t.createRenderbuffer(),O(n.__webglDepthbuffer[i],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),O(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function B(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(u,t.samples):0}let N=!1,F=!1;this.allocateTextureUnit=function(){const t=S;return t>=c&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+c),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?P(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const r=i.get(e),c=i.get(e.texture);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),s.memory.textures++;const l=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,u=x(e)||a;if(!a||e.texture.format!==It||e.texture.type!==At&&e.texture.type!==Lt||(e.texture.format=Bt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){r.__webglFramebuffer=[];for(let e=0;e<6;e++)r.__webglFramebuffer[e]=t.createFramebuffer()}else if(r.__webglFramebuffer=t.createFramebuffer(),h)if(a){r.__webglMultisampledFramebuffer=t.createFramebuffer(),r.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,r.__webglColorRenderbuffer);const n=o.convert(e.texture.format),i=o.convert(e.texture.type),s=_(e.texture.internalFormat,n,i),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),t.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(r.__webglDepthRenderbuffer=t.createRenderbuffer(),O(r.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){n.bindTexture(34067,c.__webglTexture),R(34067,e.texture,u);for(let t=0;t<6;t++)D(r.__webglFramebuffer[t],e,36064,34069+t);v(e.texture,u)&&y(34067,e.texture,e.width,e.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),R(3553,e.texture,u),D(r.__webglFramebuffer,e,36064,3553),v(e.texture,u)&&y(3553,e.texture,e.width,e.height),n.bindTexture(3553,null);e.depthBuffer&&I(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const r=t.isWebGLCubeRenderTarget?34067:3553,o=i.get(e).__webglTexture;n.bindTexture(r,o),y(r,e,t.width,t.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=i.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),N=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return i?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===Ot)return 6406;if(t===It)return 6407;if(t===Bt)return 6408;if(t===Nt)return 6409;if(t===Ft)return 6410;if(t===zt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===ie)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===ie)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===re||t===oe||t===se||t===ae||t===ce||t===le||t===he||t===ue||t===pe||t===de||t===fe||t===me||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?i?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function hh(t=[]){yo.call(this),this.cameras=t}function uh(){Xi.call(this),this.type="Group"}function ph(){this._targetRay=null,this._grip=null,this._hand=null}function dh(t,e){const n=this;let i=null,r=1,o=null,s="local-floor",a=null;const c=[],l=new Map,h=new yo;h.layers.enable(1),h.viewport=new Wn;const u=new yo;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new hh;d.layers.enable(1),d.layers.enable(2);let f=null,m=null;function g(t){const e=l.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){l.forEach(function(t,e){t.disconnect(e)}),l.clear(),f=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=i.inputSources;for(let n=0;n<c.length;n++)l.set(e[n],c[n]);for(let n=0;n<t.removed.length;n++){const e=t.removed[n],i=l.get(e);i&&(i.dispatchEvent({type:"disconnected",data:e}),l.delete(e))}for(let n=0;n<t.added.length;n++){const e=t.added[n],i=l.get(e);i&&i.dispatchEvent({type:"connected",data:e})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=c[t];return void 0===e&&(e=new ph,c[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=c[t];return void 0===e&&(e=new ph,c[t]=e),e.getGripSpace()},this.getHand=function(t){let e=c[t];return void 0===e&&(e=new ph,c[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return i},this.setSession=async function(t){if(null!==(i=t)){i.addEventListener("select",g),i.addEventListener("selectstart",g),i.addEventListener("selectend",g),i.addEventListener("squeeze",g),i.addEventListener("squeezestart",g),i.addEventListener("squeezeend",g),i.addEventListener("end",x),i.addEventListener("inputsourceschange",v);const t=e.getContextAttributes();!0!==t.xrCompatible&&await e.makeXRCompatible();const a={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:r},c=new XRWebGLLayer(i,e,a);i.updateRenderState({baseLayer:c}),o=await i.requestReferenceSpace(s),M.setContext(i),M.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const y=new Yn,_=new Yn;function b(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){d.near=u.near=h.near=t.near,d.far=u.far=h.far=t.far,f===d.near&&m===d.far||(i.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);const e=t.parent,n=d.cameras;b(d,e);for(let i=0;i<n.length;i++)b(n[i],e);t.matrixWorld.copy(d.matrixWorld),t.matrix.copy(d.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);const r=t.children;for(let i=0,o=r.length;i<o;i++)r[i].updateMatrixWorld(!0);return 2===n.length?function(t,e,n){y.setFromMatrixPosition(e.matrixWorld),_.setFromMatrixPosition(n.matrixWorld);const i=y.distanceTo(_),r=e.projectionMatrix.elements,o=n.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(o[8]+1)/o[0],p=s*h,d=s*u,f=i/(-h+u),m=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,x=a+f,v=p-m,b=d+(i-m),w=c*a/x*g,M=l*a/x*g;t.projectionMatrix.makePerspective(v,b,w,M,g,x)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};let w=null;const M=new Ro;M.setAnimationLoop(function(e,n){if(null!==(a=n.getViewerPose(o))){const e=a.views,n=i.renderState.baseLayer;t.setFramebuffer(n.framebuffer);let r=!1;e.length!==d.cameras.length&&(d.cameras.length=0,r=!0);for(let t=0;t<e.length;t++){const i=e[t],o=n.getViewport(i),s=p[t];s.matrix.fromArray(i.transform.matrix),s.projectionMatrix.fromArray(i.projectionMatrix),s.viewport.set(o.x,o.y,o.width,o.height),0===t&&d.matrix.copy(s.matrix),!0===r&&d.cameras.push(s)}}const r=i.inputSources;for(let t=0;t<c.length;t++){const e=c[t],i=r[t];e.update(i,n,o)}w&&w(e,n)}),this.setAnimationLoop=function(t){w=t},this.dispose=function(){}}function fh(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);const i=t.get(n).envMap;if(i){e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&i._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;const r=t.get(i).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(r=n.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===p&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===p&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,o){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e){n(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===p&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,i):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,o):i.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function mh(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}function gh(t){const e=void 0!==(t=t||{}).canvas?t.canvas:mh(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,p=null;const d=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Xe,this.physicallyCorrectLights=!1,this.toneMapping=Z,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const f=this;let m=!1,g=null,x=0,v=0,y=null,_=null,b=-1,w=null;const M=new Wn,S=new Wn;let T=null,E=e.width,A=e.height,L=1,R=null,C=null;const P=new Wn(0,0,E,A),D=new Wn(0,0,E,A);let O=!1;const I=new Lo;let B=!1,N=!1;const F=new wi,G=new Yn,z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function H(){return null===y?L:1}let U,k,V,W,j,q,X,Y,J,Q,K,$,tt,et,nt,it,rt,ot,st,at,ct,lt=n;function ht(t,n){for(let i=0;i<t.length;i++){const r=t[i],o=e.getContext(r,n);if(null!==o)return o}return null}try{const t={alpha:i,depth:r,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",ft,!1),e.addEventListener("webglcontextrestored",mt,!1),null===lt){const e=["webgl2","webgl","experimental-webgl"];if(!0===f.isWebGL1Renderer&&e.shift(),null===(lt=ht(e,t)))throw ht(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===lt.getShaderPrecisionFormat&&(lt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Tt){throw console.error("THREE.WebGLRenderer: "+Tt.message),Tt}function ut(){U=new cc(lt),k=new oc(lt,U,t),U.init(k),at=new lh(lt,U,k),(V=new ah(lt,U,k)).scissor(S.copy(D).multiplyScalar(L).floor()),V.viewport(M.copy(P).multiplyScalar(L).floor()),W=new uc(lt),j=new Wl,q=new ch(lt,U,V,j,k,at,W),X=new ac(f),Y=new Co(lt,k),ct=new ic(lt,U,Y,k),J=new lc(lt,Y,W,ct),Q=new mc(lt,J,Y,W),rt=new fc(lt),nt=new sc(j),K=new Vl(f,X,U,k,ct,nt),$=new fh(j),tt=new Yl(j),et=new eh(U,k),it=new nc(f,X,V,Q,a),ot=new rc(lt,U,W,k),st=new hc(lt,U,W,k),W.programs=K.programs,f.capabilities=k,f.extensions=U,f.properties=j,f.renderLists=tt,f.state=V,f.info=W}ut();const pt=new dh(f,lt);this.xr=pt;const dt=new sh(f,Q,k.maxTextureSize);function ft(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function mt(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1,ut()}function gt(t){const e=t.target;e.removeEventListener("dispose",gt),function(t){xt(t),j.remove(t)}(e)}function xt(t){const e=j.get(t).program;void 0!==e&&K.releaseProgram(e)}this.shadowMap=dt,this.getContext=function(){return lt},this.getContextAttributes=function(){return lt.getContextAttributes()},this.forceContextLoss=function(){const t=U.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=U.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(E,A,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new Fn),t.set(E,A)},this.setSize=function(t,n,i){pt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(E=t,A=n,e.width=Math.floor(t*L),e.height=Math.floor(n*L),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new Fn),t.set(E*L,A*L).floor()},this.setDrawingBufferSize=function(t,n,i){E=t,A=n,L=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new Wn),t.copy(M)},this.getViewport=function(t){return t.copy(P)},this.setViewport=function(t,e,n,i){t.isVector4?P.set(t.x,t.y,t.z,t.w):P.set(t,e,n,i),V.viewport(M.copy(P).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,n,i){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,i),V.scissor(S.copy(D).multiplyScalar(L).floor())},this.getScissorTest=function(){return O},this.setScissorTest=function(t){V.setScissorTest(O=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){C=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new mr),t.copy(it.getClearColor())},this.setClearColor=function(){it.setClearColor.apply(it,arguments)},this.getClearAlpha=function(){return it.getClearAlpha()},this.setClearAlpha=function(){it.setClearAlpha.apply(it,arguments)},this.clear=function(t,e,n){let i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),lt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ft,!1),e.removeEventListener("webglcontextrestored",mt,!1),tt.dispose(),et.dispose(),j.dispose(),X.dispose(),Q.dispose(),ct.dispose(),pt.dispose(),yt.stop()},this.renderBufferImmediate=function(t,e){ct.initAttributes();const n=j.get(t);t.hasPositions&&!n.position&&(n.position=lt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=lt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=lt.createBuffer()),t.hasColors&&!n.color&&(n.color=lt.createBuffer());const i=e.getAttributes();t.hasPositions&&(lt.bindBuffer(34962,n.position),lt.bufferData(34962,t.positionArray,35048),ct.enableAttribute(i.position),lt.vertexAttribPointer(i.position,3,5126,!1,0,0)),t.hasNormals&&(lt.bindBuffer(34962,n.normal),lt.bufferData(34962,t.normalArray,35048),ct.enableAttribute(i.normal),lt.vertexAttribPointer(i.normal,3,5126,!1,0,0)),t.hasUvs&&(lt.bindBuffer(34962,n.uv),lt.bufferData(34962,t.uvArray,35048),ct.enableAttribute(i.uv),lt.vertexAttribPointer(i.uv,2,5126,!1,0,0)),t.hasColors&&(lt.bindBuffer(34962,n.color),lt.bufferData(34962,t.colorArray,35048),ct.enableAttribute(i.color),lt.vertexAttribPointer(i.color,3,5126,!1,0,0)),ct.disableUnusedAttributes(),lt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,o){null===e&&(e=z);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=St(t,e,i,r);V.setMaterial(i,s);let c=n.index;const l=n.attributes.position;if(null===c){if(void 0===l||0===l.count)return}else if(0===c.count)return;let h,u=1;!0===i.wireframe&&(c=J.getWireframeAttribute(n),u=2),(i.morphTargets||i.morphNormals)&&rt.update(r,n,i,a),ct.setup(r,i,a,n,c);let p=ot;null!==c&&(h=Y.get(c),(p=st).setIndex(h));const d=null!==c?c.count:l.count,f=n.drawRange.start*u,m=n.drawRange.count*u,g=null!==o?o.start*u:0,x=null!==o?o.count*u:1/0,v=Math.max(f,g),y=Math.min(d,f+m,g+x)-1,_=Math.max(0,y-v+1);if(0!==_){if(r.isMesh)!0===i.wireframe?(V.setLineWidth(i.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),V.setLineWidth(t*H()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);if(r.isInstancedMesh)p.renderInstances(v,_,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(v,_,t)}else p.render(v,_)}},this.compile=function(t,e){(p=et.get(t)).init(),t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(p.pushLight(t),t.castShadow&&p.pushShadow(t))}),p.setupLights();const n=new WeakMap;t.traverse(function(e){const i=e.material;if(i)if(Array.isArray(i))for(let r=0;r<i.length;r++){const o=i[r];!1===n.has(o)&&(Mt(o,t,e),n.set(o))}else!1===n.has(i)&&(Mt(i,t,e),n.set(i))})};let vt=null;const yt=new Ro;function _t(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,c=null===i?o.material:i,l=o.group;if(n.isArrayCamera){const t=n.cameras;for(let n=0,i=t.length;n<i;n++){const i=t[n];s.layers.test(i.layers)&&(V.viewport(M.copy(i.viewport)),p.setupLightsView(i),wt(s,e,i,a,c,l))}}else wt(s,e,n,a,c,l)}}function wt(t,e,n,i,r,o){if(t.onBeforeRender(f,e,n,i,r,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const i=St(n,e,r,t);V.setMaterial(r),ct.reset(),function(t,e){t.render(function(t){f.renderBufferImmediate(t,e)})}(t,i)}else f.renderBufferDirect(n,e,i,r,t,o);t.onAfterRender(f,e,n,i,r,o)}function Mt(t,e,n){!0!==e.isScene&&(e=z);const i=j.get(t),r=p.state.lights,o=p.state.shadowsArray,s=r.state.version,a=K.getParameters(t,r.state,o,e,n),c=K.getProgramCacheKey(a);let l=i.program,h=!0;if(i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=X.get(t.envMap||i.environment),void 0===l)t.addEventListener("dispose",gt);else if(l.cacheKey!==c)xt(t);else if(i.lightsStateVersion!==s)h=!1;else{if(void 0!==a.shaderID)return;h=!1}h&&(a.uniforms=K.getUniforms(t),t.onBeforeCompile(a,f),l=K.acquireProgram(a,c),i.program=l,i.uniforms=a.uniforms,i.outputEncoding=a.outputEncoding);const u=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=nt.numPlanes,i.numIntersection=nt.numIntersection,u.clippingPlanes=nt.uniform),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const d=i.program.getUniforms(),m=fl.seqWithValue(d.seq,u);i.uniformsList=m}function St(t,e,n,i){!0!==e.isScene&&(e=z),q.resetTextureUnits();const r=e.fog,o=n.isMeshStandardMaterial?e.environment:null,s=null===y?f.outputEncoding:y.texture.encoding,a=X.get(n.envMap||o),c=j.get(n),l=p.state.lights;if(!0===B&&(!0===N||t!==w)){const e=t===w&&n.id===b;nt.setState(n,t,e)}n.version===c.__version?n.fog&&c.fog!==r?Mt(n,e,i):c.environment!==o?Mt(n,e,i):c.needsLights&&c.lightsStateVersion!==l.state.version?Mt(n,e,i):void 0===c.numClippingPlanes||c.numClippingPlanes===nt.numPlanes&&c.numIntersection===nt.numIntersection?c.outputEncoding!==s?Mt(n,e,i):c.envMap!==a&&Mt(n,e,i):Mt(n,e,i):(Mt(n,e,i),c.__version=n.version);let h=!1,u=!1,d=!1;const m=c.program,g=m.getUniforms(),x=c.uniforms;if(V.useProgram(m.program)&&(h=!0,u=!0,d=!0),n.id!==b&&(b=n.id,u=!0),h||w!==t){if(g.setValue(lt,"projectionMatrix",t.projectionMatrix),k.logarithmicDepthBuffer&&g.setValue(lt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),w!==t&&(w=t,u=!0,d=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=g.map.cameraPosition;void 0!==e&&e.setValue(lt,G.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(lt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(lt,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){g.setOptional(lt,i,"bindMatrix"),g.setOptional(lt,i,"bindMatrixInverse");const t=i.skeleton;if(t){const e=t.bones;if(k.floatVertexTextures){if(null===t.boneTexture){let n=Math.sqrt(4*e.length);n=Nn.ceilPowerOfTwo(n),n=Math.max(n,4);const i=new Float32Array(n*n*4);i.set(t.boneMatrices);const r=new To(i,n,n,Bt,At);t.boneMatrices=i,t.boneTexture=r,t.boneTextureSize=n}g.setValue(lt,"boneTexture",t.boneTexture,q),g.setValue(lt,"boneTextureSize",t.boneTextureSize)}else g.setOptional(lt,t,"boneMatrices")}}var v,_;return(u||c.receiveShadow!==i.receiveShadow)&&(c.receiveShadow=i.receiveShadow,g.setValue(lt,"receiveShadow",i.receiveShadow)),u&&(g.setValue(lt,"toneMappingExposure",f.toneMappingExposure),c.needsLights&&(_=d,(v=x).ambientLightColor.needsUpdate=_,v.lightProbe.needsUpdate=_,v.directionalLights.needsUpdate=_,v.directionalLightShadows.needsUpdate=_,v.pointLights.needsUpdate=_,v.pointLightShadows.needsUpdate=_,v.spotLights.needsUpdate=_,v.spotLightShadows.needsUpdate=_,v.rectAreaLights.needsUpdate=_,v.hemisphereLights.needsUpdate=_),r&&n.fog&&$.refreshFogUniforms(x,r),$.refreshMaterialUniforms(x,n,L,A),fl.upload(lt,c.uniformsList,x,q)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(fl.upload(lt,c.uniformsList,x,q),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(lt,"center",i.center),g.setValue(lt,"modelViewMatrix",i.modelViewMatrix),g.setValue(lt,"normalMatrix",i.normalMatrix),g.setValue(lt,"modelMatrix",i.matrixWorld),m}yt.setAnimationLoop(function(t){pt.isPresenting||vt&&vt(t)}),"undefined"!=typeof window&&yt.setContext(window),this.setAnimationLoop=function(t){vt=t,pt.setAnimationLoop(t),null===t?yt.stop():yt.start()},this.render=function(t,e){let n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===m)return;ct.resetDefaultState(),b=-1,w=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===pt.enabled&&!0===pt.isPresenting&&(e=pt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(f,t,e,n||y),(p=et.get(t,d.length)).init(),d.push(p),F.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),I.setFromProjectionMatrix(F),N=this.localClippingEnabled,B=nt.init(this.clippingPlanes,N,e),(u=tt.get(t,e)).init(),function t(e,n,i,r){if(!1===e.visible)return;const o=e.layers.test(n.layers);if(o)if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||I.intersectsSprite(e)){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);const t=Q.update(e),n=e.material;n.visible&&u.push(e,t,n,i,G.z,null)}}else if(e.isImmediateRenderObject)r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F),u.push(e,null,e.material,i,G.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==W.render.frame&&(e.skeleton.update(),e.skeleton.frame=W.render.frame),!e.frustumCulled||I.intersectsObject(e))){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);const t=Q.update(e),n=e.material;if(Array.isArray(n)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=n[s.materialIndex];a&&a.visible&&u.push(e,t,a,i,G.z,s)}}else n.visible&&u.push(e,t,n,i,G.z,null)}const s=e.children;for(let a=0,c=s.length;a<c;a++)t(s[a],n,i,r)}(t,e,0,f.sortObjects),u.finish(),!0===f.sortObjects&&u.sort(R,C),!0===B&&nt.beginShadows();const r=p.state.shadowsArray;dt.render(r,t,e),p.setupLights(),p.setupLightsView(e),!0===B&&nt.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),it.render(u,t,e,i);const o=u.opaque,s=u.transparent;o.length>0&&_t(o,t,e),s.length>0&&_t(s,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==y&&(q.updateRenderTargetMipmap(y),q.updateMultisampleRenderTarget(y)),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1),d.pop(),p=d.length>0?d[d.length-1]:null,u=null},this.setFramebuffer=function(t){g!==t&&null===y&&lt.bindFramebuffer(36160,t),g=t},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return v},this.getRenderList=function(){return u},this.setRenderList=function(t){u=t},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,n=0){y=t,x=e,v=n,t&&void 0===j.get(t).__webglFramebuffer&&q.setupRenderTarget(t);let i=g,r=!1;if(t){const n=j.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=n[e],r=!0):i=t.isWebGLMultisampleRenderTarget?j.get(t).__webglMultisampledFramebuffer:n,M.copy(t.viewport),S.copy(t.scissor),T=t.scissorTest}else M.copy(P).multiplyScalar(L).floor(),S.copy(D).multiplyScalar(L).floor(),T=O;if(_!==i&&(lt.bindFramebuffer(36160,i),_=i),V.viewport(M),V.scissor(S),V.setScissorTest(T),r){const i=j.get(t.texture);lt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=j.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){let s=!1;a!==_&&(lt.bindFramebuffer(36160,a),s=!0);try{const a=t.texture,c=a.format,l=a.type;if(c!==Bt&&at.convert(c)!==lt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=l===Lt&&(U.has("EXT_color_buffer_half_float")||k.isWebGL2&&U.has("EXT_color_buffer_float"));if(!(l===bt||at.convert(l)===lt.getParameter(35738)||l===At&&(k.isWebGL2||U.has("OES_texture_float")||U.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===lt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&lt.readPixels(e,n,i,r,at.convert(c),at.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&lt.bindFramebuffer(36160,_)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i),s=at.convert(e.format);q.setTexture2D(e,0),lt.copyTexImage2D(3553,n,s,t.x,t.y,r,o,0),V.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=at.convert(n.format),a=at.convert(n.type);q.setTexture2D(n,0),lt.pixelStorei(37440,n.flipY),lt.pixelStorei(37441,n.premultiplyAlpha),lt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?lt.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?lt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):lt.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&lt.generateMipmap(3553),V.unbindTexture()},this.initTexture=function(t){q.setTexture2D(t,0),V.unbindTexture()},this.resetState=function(){V.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function xh(t){gh.call(this,t)}hh.prototype=Object.assign(Object.create(yo.prototype),{constructor:hh,isArrayCamera:!0}),uh.prototype=Object.assign(Object.create(Xi.prototype),{constructor:uh,isGroup:!0}),Object.assign(ph.prototype,{constructor:ph,getHandSpace:function(){return null===this._hand&&(this._hand=new uh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new uh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new uh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,c=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(c&&t.hand){o=!0;for(const o of t.hand.values()){const t=e.getJointPose(o,n);if(void 0===c.joints[o.jointName]){const t=new uh;t.matrixAutoUpdate=!1,t.visible=!1,c.joints[o.jointName]=t,c.add(t)}const i=c.joints[o.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const i=c.joints["index-finger-tip"],r=c.joints["thumb-tip"],s=i.position.distanceTo(r.position),a=.02,l=.005;c.inputState.pinching&&s>a+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&s<=a-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&null!==(i=e.getPose(t.targetRaySpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale)),null!==a&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==c&&(c.visible=null!==o),this}}),Object.assign(dh.prototype,On.prototype),xh.prototype=Object.assign(Object.create(gh.prototype),{constructor:xh,isWebGL1Renderer:!0});class vh{constructor(t,e){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new mr(t),this.density=void 0!==e?e:25e-5}clone(){return new vh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=vh;class yh{constructor(t,e,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new mr(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new yh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=yh;class _h extends Xi{constructor(){super(),Object.defineProperty(this,"isScene",{value:!0}),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function bh(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Nn.generateUUID()}exports.Scene=_h,Object.defineProperty(bh.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bh.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e=0){return this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Nn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new bh(new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),this.stride);return e.setUsage(this.usage),e},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Nn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const wh=new Yn;function Mh(t,e,n,i){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function Sh(t){vr.call(this),this.type="SpriteMaterial",this.color=new mr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}let Th;Object.defineProperties(Mh.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(Mh.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(let e=0,n=this.data.count;e<n;e++)wh.x=this.getX(e),wh.y=this.getY(e),wh.z=this.getZ(e),wh.applyMatrix4(t),this.setXYZ(e,wh.x,wh.y,wh.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new wr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Mh(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}),Sh.prototype=Object.create(vr.prototype),Sh.prototype.constructor=Sh,Sh.prototype.isSpriteMaterial=!0,Sh.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};const Eh=new Yn,Ah=new Yn,Lh=new Yn,Rh=new Fn,Ch=new Fn,Ph=new wi,Dh=new Yn,Oh=new Yn,Ih=new Yn,Bh=new Fn,Nh=new Fn,Fh=new Fn;function Gh(t){if(Xi.call(this),this.type="Sprite",void 0===Th){Th=new Vr;const t=new bh(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Th.setIndex([0,1,2,0,2,3]),Th.setAttribute("position",new Mh(t,3,0,!1)),Th.setAttribute("uv",new Mh(t,2,3,!1))}this.geometry=Th,this.material=void 0!==t?t:new Sh,this.center=new Fn(.5,.5)}function zh(t,e,n,i,r,o){Rh.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Ch.x=o*Rh.x-r*Rh.y,Ch.y=r*Rh.x+o*Rh.y):Ch.copy(Rh),t.copy(e),t.x+=Ch.x,t.y+=Ch.y,t.applyMatrix4(Ph)}Gh.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Gh,isSprite:!0,raycast:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ah.setFromMatrixScale(this.matrixWorld),Ph.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Lh.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ah.multiplyScalar(-Lh.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;zh(Dh.set(-.5,-.5,0),Lh,o,Ah,i,r),zh(Oh.set(.5,-.5,0),Lh,o,Ah,i,r),zh(Ih.set(.5,.5,0),Lh,o,Ah,i,r),Bh.set(0,0),Nh.set(1,0),Fh.set(1,1);let s=t.ray.intersectTriangle(Dh,Oh,Ih,!1,Eh);if(null===s&&(zh(Oh.set(-.5,.5,0),Lh,o,Ah,i,r),Nh.set(0,1),null===(s=t.ray.intersectTriangle(Dh,Ih,Oh,!1,Eh))))return;const a=t.ray.origin.distanceTo(Eh);a<t.near||a>t.far||e.push({distance:a,point:Eh.clone(),uv:cr.getUV(Eh,Dh,Oh,Ih,Bh,Nh,Fh,new Fn),face:null,object:this})},copy:function(t){return Xi.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}});const Hh=new Yn,Uh=new Yn;function kh(){Xi.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}kh.prototype=Object.assign(Object.create(Xi.prototype),{constructor:kh,isLOD:!0,copy:function(t){Xi.prototype.copy.call(this,t,!1);const e=t.levels;for(let n=0,i=e.length;n<i;n++){const t=e[n];this.addLevel(t.object.clone(),t.distance)}return this.autoUpdate=t.autoUpdate,this},addLevel:function(t,e=0){e=Math.abs(e);const n=this.levels;let i;for(i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object}return null},raycast:function(t,e){if(this.levels.length>0){Hh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Hh);this.getObjectForDistance(n).raycast(t,e)}},update:function(t){const e=this.levels;if(e.length>1){Hh.setFromMatrixPosition(t.matrixWorld),Uh.setFromMatrixPosition(this.matrixWorld);const n=Hh.distanceTo(Uh)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r&&n>=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}},toJSON:function(t){const e=Xi.prototype.toJSON.call(this,t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const t=n[i];e.object.levels.push({object:t.object.uuid,distance:t.distance})}return e}});const Vh=new Yn,Wh=new Wn,jh=new Wn,qh=new Yn,Xh=new wi;function Yh(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ao.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new wi,this.bindMatrixInverse=new wi}function Zh(){Xi.call(this),this.type="Bone"}Yh.prototype=Object.assign(Object.create(ao.prototype),{constructor:Yh,isSkinnedMesh:!0,copy:function(t){return ao.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const t=new Wn,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){ao.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){const n=this.skeleton,i=this.geometry;Wh.fromBufferAttribute(i.attributes.skinIndex,t),jh.fromBufferAttribute(i.attributes.skinWeight,t),Vh.fromBufferAttribute(i.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){const t=jh.getComponent(r);if(0!==t){const i=Wh.getComponent(r);Xh.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),e.addScaledVector(qh.copy(Vh).applyMatrix4(Xh),t)}}return e.applyMatrix4(this.bindMatrixInverse)}}),Zh.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Zh,isBone:!0});const Jh=new wi,Qh=new wi;function Kh(t=[],e=[]){this.uuid=Nn.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}Object.assign(Kh.prototype,{init:function(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new wi)}},calculateInverses:function(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new wi;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}},pose:function(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}},update:function(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=t.length;r<o;r++){const i=t[r]?t[r].matrixWorld:Qh;Jh.multiplyMatrices(i,e[r]),Jh.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)},clone:function(){return new Kh(this.bones,this.boneInverses)},getBoneByName:function(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}},dispose:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},fromJSON:function(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Zh),this.bones.push(r),this.boneInverses.push((new wi).fromArray(t.boneInverses[n]))}return this.init(),this},toJSON:function(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}});const $h=new wi,tu=new wi,eu=[],nu=new ao;function iu(t,e,n){ao.call(this,t,e),this.instanceMatrix=new wr(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}function ru(t){vr.call(this),this.type="LineBasicMaterial",this.color=new mr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}iu.prototype=Object.assign(Object.create(ao.prototype),{constructor:iu,isInstancedMesh:!0,copy:function(t){return ao.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){const n=this.matrixWorld,i=this.count;if(nu.geometry=this.geometry,nu.material=this.material,void 0!==nu.material)for(let r=0;r<i;r++){this.getMatrixAt(r,$h),tu.multiplyMatrices(n,$h),nu.matrixWorld=tu,nu.raycast(t,eu);for(let t=0,n=eu.length;t<n;t++){const n=eu[t];n.instanceId=r,n.object=this,e.push(n)}eu.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new wr(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ru.prototype=Object.create(vr.prototype),ru.prototype.constructor=ru,ru.prototype.isLineBasicMaterial=!0,ru.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};const ou=new Yn,su=new Yn,au=new wi,cu=new bi,lu=new di;function hu(t=new Vr,e=new ru){Xi.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}hu.prototype=Object.assign(Object.create(Xi.prototype),{constructor:hu,isLine:!0,copy:function(t){return Xi.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)ou.fromBufferAttribute(e,t-1),su.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=ou.distanceTo(su);t.setAttribute("lineDistance",new Pr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),lu.copy(n.boundingSphere),lu.applyMatrix4(i),lu.radius+=r,!1===t.ray.intersectsSphere(lu))return;au.copy(i).invert(),cu.copy(t.ray).applyMatrix4(au);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,a=new Yn,c=new Yn,l=new Yn,h=new Yn,u=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,o=n.length-1;i<o;i+=u){const o=n[i],u=n[i+1];if(a.fromBufferAttribute(r,o),c.fromBufferAttribute(r,u),cu.distanceSqToSegment(a,c,h,l)>s)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);p<t.near||p>t.far||e.push({distance:p,point:l.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else for(let n=0,o=r.count-1;n<o;n+=u){if(a.fromBufferAttribute(r,n),c.fromBufferAttribute(r,n+1),cu.distanceSqToSegment(a,c,h,l)>s)continue;h.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(h);i<t.near||i>t.far||e.push({distance:i,point:l.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const uu=new Yn,pu=new Yn;function du(t,e){hu.call(this,t,e),this.type="LineSegments"}function fu(t,e){hu.call(this,t,e),this.type="LineLoop"}function mu(t){vr.call(this),this.type="PointsMaterial",this.color=new mr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}du.prototype=Object.assign(Object.create(hu.prototype),{constructor:du,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)uu.fromBufferAttribute(e,t),pu.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+uu.distanceTo(pu);t.setAttribute("lineDistance",new Pr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}),fu.prototype=Object.assign(Object.create(hu.prototype),{constructor:fu,isLineLoop:!0}),mu.prototype=Object.create(vr.prototype),mu.prototype.constructor=mu,mu.prototype.isPointsMaterial=!0,mu.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};const gu=new wi,xu=new bi,vu=new di,yu=new Yn;function _u(t=new Vr,e=new mu){Xi.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function bu(t,e,n,i,r,o,s){const a=xu.distanceSqToPoint(t);if(a<n){const n=new Yn;xu.closestPointToPoint(t,n),n.applyMatrix4(i);const c=r.ray.origin.distanceTo(n);if(c<r.near||c>r.far)return;o.push({distance:c,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}function wu(t,e,n,i,r,o,s,a,c){kn.call(this,t,e,n,i,r,o,s,a,c),this.format=void 0!==s?s:It,this.minFilter=void 0!==o?o:gt,this.magFilter=void 0!==r?r:gt,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,t.requestVideoFrameCallback(e)})}function Mu(t,e,n,i,r,o,s,a,c,l,h,u){kn.call(this,null,o,s,a,c,l,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Su(t,e,n,i,r,o,s,a,c){kn.call(this,t,e,n,i,r,o,s,a,c),this.needsUpdate=!0}function Tu(t,e,n,i,r,o,s,a,c,l){if((l=void 0!==l?l:zt)!==zt&&l!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===zt&&(n=St),void 0===n&&l===Ht&&(n=Dt),kn.call(this,null,i,r,o,s,a,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}_u.prototype=Object.assign(Object.create(Xi.prototype),{constructor:_u,isPoints:!0,copy:function(t){return Xi.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),vu.copy(n.boundingSphere),vu.applyMatrix4(i),vu.radius+=r,!1===t.ray.intersectsSphere(vu))return;gu.copy(i).invert(),xu.copy(t.ray).applyMatrix4(gu);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,a=n.length;r<a;r++){const a=n[r];yu.fromBufferAttribute(o,a),bu(yu,a,s,i,t,e,this)}}else for(let n=0,a=o.count;n<a;n++)yu.fromBufferAttribute(o,n),bu(yu,n,s,i,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),wu.prototype=Object.assign(Object.create(kn.prototype),{constructor:wu,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Mu.prototype=Object.create(kn.prototype),Mu.prototype.constructor=Mu,Mu.prototype.isCompressedTexture=!0,Su.prototype=Object.create(kn.prototype),Su.prototype.constructor=Su,Su.prototype.isCanvasTexture=!0,Tu.prototype=Object.create(kn.prototype),Tu.prototype.constructor=Tu,Tu.prototype.isDepthTexture=!0;class Eu extends Vr{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],o=[],s=[],a=[],c=new Yn,l=new Fn;o.push(0,0,0),s.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const r=n+h/e*i;c.x=t*Math.cos(r),c.y=t*Math.sin(r),o.push(c.x,c.y,c.z),s.push(0,0,1),l.x=(o[u]/t+1)/2,l.y=(o[u+1]/t+1)/2,a.push(l.x,l.y)}for(let h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Pr(o,3)),this.setAttribute("normal",new Pr(s,3)),this.setAttribute("uv",new Pr(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Eu;class Au extends Vr{constructor(t=1,e=1,n=1,i=8,r=1,o=!1,s=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a};const c=this;i=Math.floor(i),r=Math.floor(r);const l=[],h=[],u=[],p=[];let d=0;const f=[],m=n/2;let g=0;function x(n){const r=d,o=new Fn,f=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,m*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=i;t++){const e=t/i*a+s,n=Math.cos(e),r=Math.sin(e);f.x=v*r,f.y=m*y,f.z=v*n,h.push(f.x,f.y,f.z),u.push(0,y,0),o.x=.5*n+.5,o.y=.5*r*y+.5,p.push(o.x,o.y),d++}for(let t=0;t<i;t++){const e=r+t,i=_+t;!0===n?l.push(i,i+1,e):l.push(i+1,i,e),x+=3}c.addGroup(g,x,!0===n?1:2),g+=x}!function(){const o=new Yn,x=new Yn;let v=0;const y=(e-t)/n;for(let c=0;c<=r;c++){const l=[],g=c/r,v=g*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+s,c=Math.sin(r),f=Math.cos(r);x.x=v*c,x.y=-g*n+m,x.z=v*f,h.push(x.x,x.y,x.z),o.set(c,y,f).normalize(),u.push(o.x,o.y,o.z),p.push(e,1-g),l.push(d++)}f.push(l)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=f[e][t],i=f[e+1][t],r=f[e+1][t+1],o=f[e][t+1];l.push(n,i,o),l.push(i,r,o),v+=6}c.addGroup(g,v,0),g+=v}(),!1===o&&(t>0&&x(!0),e>0&&x(!1)),this.setIndex(l),this.setAttribute("position",new Pr(h,3)),this.setAttribute("normal",new Pr(u,3)),this.setAttribute("uv",new Pr(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Au;class Lu extends Au{constructor(t=1,e=1,n=8,i=1,r=!1,o=0,s=2*Math.PI){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}}exports.ConeGeometry=exports.ConeBufferGeometry=Lu;class Ru extends Vr{constructor(t,e,n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],o=[];function s(t,e,n,i){const r=i+1,o=[];for(let s=0;s<=r;s++){o[s]=[];const i=t.clone().lerp(n,s/r),a=e.clone().lerp(n,s/r),c=r-s;for(let t=0;t<=c;t++)o[s][t]=0===t&&s===r?i:i.clone().lerp(a,t/c)}for(let s=0;s<r;s++)for(let t=0;t<2*(r-s)-1;t++){const e=Math.floor(t/2);t%2==0?(a(o[s][e+1]),a(o[s+1][e]),a(o[s][e])):(a(o[s][e+1]),a(o[s+1][e+1]),a(o[s+1][e]))}}function a(t){r.push(t.x,t.y,t.z)}function c(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function l(t,e,n,i){i<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new Yn,i=new Yn,r=new Yn;for(let o=0;o<e.length;o+=3)c(e[o+0],n),c(e[o+1],i),c(e[o+2],r),s(n,i,r,t)}(i),function(t){const e=new Yn;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new Yn;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,s=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);o.push(i,1-s)}var e;(function(){const t=new Yn,e=new Yn,n=new Yn,i=new Yn,s=new Fn,a=new Fn,c=new Fn;for(let u=0,p=0;u<r.length;u+=9,p+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),s.set(o[p+0],o[p+1]),a.set(o[p+2],o[p+3]),c.set(o[p+4],o[p+5]),i.copy(t).add(e).add(n).divideScalar(3);const d=h(i);l(s,p+0,t,d),l(a,p+2,e,d),l(c,p+4,n,d)}})(),function(){for(let t=0;t<o.length;t+=6){const e=o[t+0],n=o[t+2],i=o[t+4],r=Math.max(e,n,i),s=Math.min(e,n,i);r>.9&&s<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Pr(r,3)),this.setAttribute("normal",new Pr(r.slice(),3)),this.setAttribute("uv",new Pr(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Ru;class Cu extends Ru{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Cu;const Pu=new Yn,Du=new Yn,Ou=new Yn,Iu=new cr;class Bu extends Vr{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),i=Math.cos(Nn.DEG2RAD*e),r=t.getIndex(),o=t.getAttribute("position"),s=r?r.count:o.count,a=[0,0,0],c=["a","b","c"],l=new Array(3),h={},u=[];for(let p=0;p<s;p+=3){r?(a[0]=r.getX(p),a[1]=r.getX(p+1),a[2]=r.getX(p+2)):(a[0]=p,a[1]=p+1,a[2]=p+2);const{a:t,b:e,c:s}=Iu;if(t.fromBufferAttribute(o,a[0]),e.fromBufferAttribute(o,a[1]),s.fromBufferAttribute(o,a[2]),Iu.getNormal(Ou),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,l[2]=`${Math.round(s.x*n)},${Math.round(s.y*n)},${Math.round(s.z*n)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let n=0;n<3;n++){const t=(n+1)%3,e=l[n],r=l[t],o=Iu[c[n]],s=Iu[c[t]],p=`${e}_${r}`,d=`${r}_${e}`;d in h&&h[d]?(Ou.dot(h[d].normal)<=i&&(u.push(o.x,o.y,o.z),u.push(s.x,s.y,s.z)),h[d]=null):p in h||(h[p]={index0:a[n],index1:a[t],normal:Ou.clone()})}}for(const p in h)if(h[p]){const{index0:t,index1:e}=h[p];Pu.fromBufferAttribute(o,t),Du.fromBufferAttribute(o,e),u.push(Pu.x,Pu.y,Pu.z),u.push(Du.x,Du.y,Du.z)}this.setAttribute("position",new Pr(u,3))}}exports.EdgesGeometry=Bu;const Nu={triangulate:function(t,e,n){n=n||2;const i=e&&e.length,r=i?e[0]*n:t.length;let o=Fu(t,0,r,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,c,l,h,u,p,d;if(i&&(o=Wu(t,e,o,n)),t.length>80*n){a=l=t[0],c=h=t[1];for(let e=n;e<r;e+=n)(u=t[e])<a&&(a=u),(p=t[e+1])<c&&(c=p),u>l&&(l=u),p>h&&(h=p);d=0!==(d=Math.max(l-a,h-c))?1/d:0}return zu(o,s,n,a,c,d),s}};function Fu(t,e,n,i,r){let o,s;if(r===dp(t,e,n,i)>0)for(o=e;o<n;o+=i)s=hp(o,t[o],t[o+1],s);else for(o=n-i;o>=e;o-=i)s=hp(o,t[o],t[o+1],s);return s&&np(s,s.next)&&(up(s),s=s.next),s}function Gu(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!np(i,i.next)&&0!==ep(i.prev,i,i.next))i=i.next;else{if(up(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function zu(t,e,n,i,r,o,s){if(!t)return;!s&&o&&Zu(t,i,r,o);let a,c,l=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,o?Uu(t,i,r,o):Hu(t))e.push(a.i/n),e.push(t.i/n),e.push(c.i/n),up(t),t=c.next,l=c.next;else if((t=c)===l){s?1===s?zu(t=ku(Gu(t),e,n),e,n,i,r,o,2):2===s&&Vu(t,e,n,i,r,o):zu(Gu(t),e,n,i,r,o,1);break}}function Hu(t){const e=t.prev,n=t,i=t.next;if(ep(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if($u(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ep(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Uu(t,e,n,i){const r=t.prev,o=t,s=t.next;if(ep(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,c=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,l=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,u=Qu(a,c,e,n,i),p=Qu(l,h,e,n,i);let d=t.prevZ,f=t.nextZ;for(;d&&d.z>=u&&f&&f.z<=p;){if(d!==t.prev&&d!==t.next&&$u(r.x,r.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ep(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&$u(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&ep(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&$u(r.x,r.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ep(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&$u(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&ep(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ku(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!np(r,o)&&ip(r,i,i.next,o)&&ap(r,o)&&ap(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),up(i),up(i.next),i=t=o),i=i.next}while(i!==t);return Gu(i)}function Vu(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&tp(s,t)){let a=lp(s,t);return s=Gu(s,s.next),a=Gu(a,a.next),zu(s,e,n,i,r,o),void zu(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function Wu(t,e,n,i){const r=[];let o,s,a,c,l;for(o=0,s=e.length;o<s;o++)(l=Fu(t,a=e[o]*i,c=o<s-1?e[o+1]*i:t.length,i,!1))===l.next&&(l.steiner=!0),r.push(Ku(l));for(r.sort(ju),o=0;o<r.length;o++)qu(r[o],n),n=Gu(n,n.next);return n}function ju(t,e){return t.x-e.x}function qu(t,e){if(e=Xu(t,e)){const n=lp(e,t);Gu(e,e.next),Gu(n,n.next)}}function Xu(t,e){let n=e;const i=t.x,r=t.y;let o,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(i===s)return o;const a=o,c=o.x,l=o.y;let h,u=1/0;n=o;do{i>=n.x&&n.x>=c&&i!==n.x&&$u(r<l?i:s,r,c,l,r<l?s:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),ap(n,t)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&Yu(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}function Yu(t,e){return ep(t.prev,t,e.prev)<0&&ep(e.next,t,t.next)<0}function Zu(t,e,n,i){let r=t;do{null===r.z&&(r.z=Qu(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Ju(r)}function Ju(t){let e,n,i,r,o,s,a,c,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e<l&&(a++,i=i.nextZ);e++);for(c=l;a>0||c>0&&i;)0!==a&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(s>1);return t}function Qu(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ku(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function $u(t,e,n,i,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function tp(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(ap(t,e)&&ap(e,t)&&cp(t,e)&&(ep(t.prev,t,e.prev)||ep(t,e.prev,e))||np(t,e)&&ep(t.prev,t,t.next)>0&&ep(e.prev,e,e.next)>0)}function ep(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function np(t,e){return t.x===e.x&&t.y===e.y}function ip(t,e,n,i){const r=op(ep(t,e,n)),o=op(ep(t,e,i)),s=op(ep(n,i,t)),a=op(ep(n,i,e));return r!==o&&s!==a||(!(0!==r||!rp(t,n,e))||(!(0!==o||!rp(t,i,e))||(!(0!==s||!rp(n,t,i))||!(0!==a||!rp(n,e,i)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function op(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&ip(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function ap(t,e){return ep(t.prev,t,t.next)<0?ep(t,e,t.next)>=0&&ep(t,t.prev,e)>=0:ep(t,e,t.prev)<0||ep(t,t.next,e)<0}function cp(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}function lp(t,e){const n=new pp(t.i,t.x,t.y),i=new pp(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function hp(t,e,n,i){const r=new pp(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function up(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function pp(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dp(t,e,n,i){let r=0;for(let o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}const fp={area:function(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},isClockWise:function(t){return fp.area(t)<0},triangulateShape:function(t,e){const n=[],i=[],r=[];mp(t),gp(n,t);let o=t.length;e.forEach(mp);for(let a=0;a<e.length;a++)i.push(o),o+=e[a].length,gp(n,e[a]);const s=Nu.triangulate(n,i);for(let a=0;a<s.length;a+=3)r.push(s.slice(a,a+3));return r}};function mp(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function gp(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}exports.ShapeUtils=fp;class xp extends Vr{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let s=0,a=t.length;s<a;s++){o(t[s])}function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let c=void 0!==e.depth?e.depth:100,l=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:h-2,p=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:vp;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.amount);let g,x,v,y,_,b=!1;f&&(g=f.getSpacedPoints(a),b=!0,l=!1,x=f.computeFrenetFrames(a,!1),v=new Yn,y=new Yn,_=new Yn),l||(d=0,h=0,u=0,p=0);const w=t.extractPoints(s);let M=w.shape;const S=w.holes;if(!fp.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];fp.isClockWise(e)&&(S[t]=e.reverse())}}const T=fp.triangulateShape(M,S),E=M;for(let e=0,n=S.length;e<n;e++){const t=S[e];M=M.concat(t)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const L=M.length,R=T.length;function C(t,e,n){let i,r,o;const s=t.x-e.x,a=t.y-e.y,c=n.x-t.x,l=n.y-t.y,h=s*s+a*a,u=s*l-a*c;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(c*c+l*l),d=e.x-a/u,f=e.y+s/u,m=((n.x-l/p-d)*l-(n.y+c/p-f)*c)/(s*l-a*c),g=(i=d+s*m-t.x)*i+(r=f+a*m-t.y)*r;if(g<=2)return new Fn(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?c>Number.EPSILON&&(t=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(l)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new Fn(i/o,r/o)}const P=[];for(let e=0,n=E.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),P[e]=C(E[e],E[i],E[r]);const D=[];let O,I=P.concat();for(let e=0,n=S.length;e<n;e++){const t=S[e];O=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),O[e]=C(t[e],t[i],t[r]);D.push(O),I=I.concat(O)}for(let e=0;e<d;e++){const t=e/d,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+p;for(let e=0,r=E.length;e<r;e++){const t=A(E[e],P[e],i);F(t.x,t.y,-n)}for(let e=0,r=S.length;e<r;e++){const t=S[e];O=D[e];for(let e=0,r=t.length;e<r;e++){const r=A(t[e],O[e],i);F(r.x,r.y,-n)}}}const B=u+p;for(let e=0;e<L;e++){const t=l?A(M[e],I[e],B):M[e];b?(y.copy(x.normals[0]).multiplyScalar(t.x),v.copy(x.binormals[0]).multiplyScalar(t.y),_.copy(g[0]).add(y).add(v),F(_.x,_.y,_.z)):F(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<L;t++){const n=l?A(M[t],I[t],B):M[t];b?(y.copy(x.normals[e]).multiplyScalar(n.x),v.copy(x.binormals[e]).multiplyScalar(n.y),_.copy(g[e]).add(y).add(v),F(_.x,_.y,_.z)):F(n.x,n.y,c/a*e)}for(let e=d-1;e>=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),i=u*Math.sin(t*Math.PI/2)+p;for(let e=0,r=E.length;e<r;e++){const t=A(E[e],P[e],i);F(t.x,t.y,c+n)}for(let e=0,r=S.length;e<r;e++){const t=S[e];O=D[e];for(let e=0,r=t.length;e<r;e++){const r=A(t[e],O[e],i);b?F(r.x,r.y+g[a-1].y,g[a-1].x+n):F(r.x,r.y,c+n)}}}function N(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*d;t<n;t++){const n=L*t,o=L*(t+1);z(e+i+n,e+r+n,e+r+o,e+i+o)}}}function F(t,e,n){o.push(t),o.push(e),o.push(n)}function G(t,e,r){H(t),H(e),H(r);const o=i.length/3,s=m.generateTopUV(n,i,o-3,o-2,o-1);U(s[0]),U(s[1]),U(s[2])}function z(t,e,r,o){H(t),H(e),H(o),H(e),H(r),H(o);const s=i.length/3,a=m.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);U(a[0]),U(a[1]),U(a[3]),U(a[1]),U(a[2]),U(a[3])}function H(t){i.push(o[3*t+0]),i.push(o[3*t+1]),i.push(o[3*t+2])}function U(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(l){let t=0,e=L*t;for(let n=0;n<R;n++){const t=T[n];G(t[2]+e,t[1]+e,t[0]+e)}e=L*(t=a+2*d);for(let n=0;n<R;n++){const t=T[n];G(t[0]+e,t[1]+e,t[2]+e)}}else{for(let t=0;t<R;t++){const e=T[t];G(e[2],e[1],e[0])}for(let t=0;t<R;t++){const e=T[t];G(e[0]+L*a,e[1]+L*a,e[2]+L*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;N(E,e),e+=E.length;for(let n=0,i=S.length;n<i;n++){const t=S[n];N(t,e),e+=t.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Pr(i,3)),this.setAttribute("uv",new Pr(r,2)),this.computeVertexNormals()}toJSON(){const t=Vr.prototype.toJSON.call(this);return yp(this.parameters.shapes,this.parameters.options,t)}}exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=xp;const vp={generateTopUV:function(t,e,n,i,r){const o=e[3*n],s=e[3*n+1],a=e[3*i],c=e[3*i+1],l=e[3*r],h=e[3*r+1];return[new Fn(o,s),new Fn(a,c),new Fn(l,h)]},generateSideWallUV:function(t,e,n,i,r,o){const s=e[3*n],a=e[3*n+1],c=e[3*n+2],l=e[3*i],h=e[3*i+1],u=e[3*i+2],p=e[3*r],d=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],x=e[3*o+2];return Math.abs(a-h)<.01?[new Fn(s,1-c),new Fn(l,1-u),new Fn(p,1-f),new Fn(m,1-x)]:[new Fn(a,1-c),new Fn(h,1-u),new Fn(d,1-f),new Fn(g,1-x)]}};function yp(t,e,n){if(n.shapes=[],Array.isArray(t))for(let i=0,r=t.length;i<r;i++){const e=t[i];n.shapes.push(e.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class _p extends Ru{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}}exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=_p;class bp extends Vr{constructor(t,e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Nn.clamp(i,0,2*Math.PI);const r=[],o=[],s=[],a=1/e,c=new Yn,l=new Fn;for(let h=0;h<=e;h++){const r=n+h*a*i,u=Math.sin(r),p=Math.cos(r);for(let n=0;n<=t.length-1;n++)c.x=t[n].x*u,c.y=t[n].y,c.z=t[n].x*p,o.push(c.x,c.y,c.z),l.x=h/e,l.y=n/(t.length-1),s.push(l.x,l.y)}for(let h=0;h<e;h++)for(let e=0;e<t.length-1;e++){const n=e+h*t.length,i=n,o=n+t.length,s=n+t.length+1,a=n+1;r.push(i,o,a),r.push(o,s,a)}if(this.setIndex(r),this.setAttribute("position",new Pr(o,3)),this.setAttribute("uv",new Pr(s,2)),this.computeVertexNormals(),i===2*Math.PI){const n=this.attributes.normal.array,i=new Yn,r=new Yn,o=new Yn,s=e*t.length*3;for(let e=0,a=0;e<t.length;e++,a+=3)i.x=n[a+0],i.y=n[a+1],i.z=n[a+2],r.x=n[s+a+0],r.y=n[s+a+1],r.z=n[s+a+2],o.addVectors(i,r).normalize(),n[a+0]=n[s+a+0]=o.x,n[a+1]=n[s+a+1]=o.y,n[a+2]=n[s+a+2]=o.z}}}exports.LatheGeometry=exports.LatheBufferGeometry=bp;class wp extends Ru{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}}function Mp(t,e,n){Vr.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const i=[],r=[],o=[],s=[],a=new Yn,c=new Yn,l=new Yn,h=new Yn,u=new Yn;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let d=0;d<=n;d++){const i=d/n;for(let n=0;n<=e;n++){const p=n/e;t(p,i,c),r.push(c.x,c.y,c.z),p-1e-5>=0?(t(p-1e-5,i,l),h.subVectors(c,l)):(t(p+1e-5,i,l),h.subVectors(l,c)),i-1e-5>=0?(t(p,i-1e-5,l),u.subVectors(c,l)):(t(p,i+1e-5,l),u.subVectors(l,c)),a.crossVectors(h,u).normalize(),o.push(a.x,a.y,a.z),s.push(p,i)}}for(let d=0;d<n;d++)for(let t=0;t<e;t++){const e=d*p+t,n=d*p+t+1,r=(d+1)*p+t+1,o=(d+1)*p+t;i.push(e,n,o),i.push(n,r,o)}this.setIndex(i),this.setAttribute("position",new Pr(r,3)),this.setAttribute("normal",new Pr(o,3)),this.setAttribute("uv",new Pr(s,2))}exports.OctahedronGeometry=exports.OctahedronBufferGeometry=wp,Mp.prototype=Object.create(Vr.prototype),Mp.prototype.constructor=Mp;class Sp extends Vr{constructor(t=.5,e=1,n=8,i=1,r=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n);const s=[],a=[],c=[],l=[];let h=t;const u=(e-t)/(i=Math.max(1,i)),p=new Yn,d=new Fn;for(let f=0;f<=i;f++){for(let t=0;t<=n;t++){const i=r+t/n*o;p.x=h*Math.cos(i),p.y=h*Math.sin(i),a.push(p.x,p.y,p.z),c.push(0,0,1),d.x=(p.x/e+1)/2,d.y=(p.y/e+1)/2,l.push(d.x,d.y)}h+=u}for(let f=0;f<i;f++){const t=f*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i,o=i+n+1,a=i+n+2,c=i+1;s.push(r,o,c),s.push(o,a,c)}}this.setIndex(s),this.setAttribute("position",new Pr(a,3)),this.setAttribute("normal",new Pr(c,3)),this.setAttribute("uv",new Pr(l,2))}}exports.RingGeometry=exports.RingBufferGeometry=Sp;class Tp extends Vr{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))c(t);else for(let l=0;l<t.length;l++)c(t[l]),this.addGroup(s,a,l),s+=a,a=0;function c(t){const s=i.length/3,c=t.extractPoints(e);let l=c.shape;const h=c.holes;!1===fp.isClockWise(l)&&(l=l.reverse());for(let e=0,n=h.length;e<n;e++){const t=h[e];!0===fp.isClockWise(t)&&(h[e]=t.reverse())}const u=fp.triangulateShape(l,h);for(let e=0,n=h.length;e<n;e++){const t=h[e];l=l.concat(t)}for(let e=0,n=l.length;e<n;e++){const t=l[e];i.push(t.x,t.y,0),r.push(0,0,1),o.push(t.x,t.y)}for(let e=0,i=u.length;e<i;e++){const t=u[e],i=t[0]+s,r=t[1]+s,o=t[2]+s;n.push(i,r,o),a+=3}}this.setIndex(n),this.setAttribute("position",new Pr(i,3)),this.setAttribute("normal",new Pr(r,3)),this.setAttribute("uv",new Pr(o,2))}toJSON(){const t=Vr.prototype.toJSON.call(this);return Ep(this.parameters.shapes,t)}}function Ep(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}exports.ShapeGeometry=exports.ShapeBufferGeometry=Tp;class Ap extends Vr{constructor(t=1,e=8,n=6,i=0,r=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:s},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let c=0;const l=[],h=new Yn,u=new Yn,p=[],d=[],f=[],m=[];for(let g=0;g<=n;g++){const p=[],x=g/n;let v=0;0==g&&0==o?v=.5/e:g==n&&a==Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(o+x*s),h.y=t*Math.cos(o+x*s),h.z=t*Math.sin(i+a*r)*Math.sin(o+x*s),d.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),m.push(a+v,1-x),p.push(c++)}l.push(p)}for(let g=0;g<n;g++)for(let t=0;t<e;t++){const e=l[g][t+1],i=l[g][t],r=l[g+1][t],s=l[g+1][t+1];(0!==g||o>0)&&p.push(e,i,s),(g!==n-1||a<Math.PI)&&p.push(i,r,s)}this.setIndex(p),this.setAttribute("position",new Pr(d,3)),this.setAttribute("normal",new Pr(f,3)),this.setAttribute("uv",new Pr(m,2))}}exports.SphereGeometry=exports.SphereBufferGeometry=Ap;class Lp extends Ru{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}}exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=Lp;class Rp extends xp{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Vr;const i=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(i,e),this.type="TextGeometry"}}exports.TextGeometry=exports.TextBufferGeometry=Rp;class Cp extends Vr{constructor(t=1,e=.4,n=8,i=6,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],s=[],a=[],c=[],l=new Yn,h=new Yn,u=new Yn;for(let p=0;p<=n;p++)for(let o=0;o<=i;o++){const d=o/i*r,f=p/n*Math.PI*2;h.x=(t+e*Math.cos(f))*Math.cos(d),h.y=(t+e*Math.cos(f))*Math.sin(d),h.z=e*Math.sin(f),s.push(h.x,h.y,h.z),l.x=t*Math.cos(d),l.y=t*Math.sin(d),u.subVectors(h,l).normalize(),a.push(u.x,u.y,u.z),c.push(o/i),c.push(p/n)}for(let p=1;p<=n;p++)for(let t=1;t<=i;t++){const e=(i+1)*p+t-1,n=(i+1)*(p-1)+t-1,r=(i+1)*(p-1)+t,s=(i+1)*p+t;o.push(e,n,s),o.push(n,r,s)}this.setIndex(o),this.setAttribute("position",new Pr(s,3)),this.setAttribute("normal",new Pr(a,3)),this.setAttribute("uv",new Pr(c,2))}}exports.TorusGeometry=exports.TorusBufferGeometry=Cp;class Pp extends Vr{constructor(t=1,e=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],c=[],l=[],h=new Yn,u=new Yn,p=new Yn,d=new Yn,f=new Yn,m=new Yn,g=new Yn;for(let v=0;v<=n;++v){const s=v/n*r*Math.PI*2;x(s,r,o,t,p),x(s+.01,r,o,t,d),m.subVectors(d,p),g.addVectors(d,p),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,o=-e*Math.cos(r),s=e*Math.sin(r);h.x=p.x+(o*g.x+s*f.x),h.y=p.y+(o*g.y+s*f.y),h.z=p.z+(o*g.z+s*f.z),a.push(h.x,h.y,h.z),u.subVectors(h,p).normalize(),c.push(u.x,u.y,u.z),l.push(v/n),l.push(t/i)}}for(let v=1;v<=n;v++)for(let t=1;t<=i;t++){const e=(i+1)*(v-1)+(t-1),n=(i+1)*v+(t-1),r=(i+1)*v+t,o=(i+1)*(v-1)+t;s.push(e,n,o),s.push(n,r,o)}function x(t,e,n,i,r){const o=Math.cos(t),s=Math.sin(t),a=n/e*t,c=Math.cos(a);r.x=i*(2+c)*.5*o,r.y=i*(2+c)*s*.5,r.z=i*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Pr(a,3)),this.setAttribute("normal",new Pr(c,3)),this.setAttribute("uv",new Pr(l,2))}}exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=Pp;class Dp extends Vr{constructor(t,e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const s=new Yn,a=new Yn,c=new Fn;let l=new Yn;const h=[],u=[],p=[],d=[];function f(r){l=t.getPointAt(r/e,l);const c=o.normals[r],p=o.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),o=-Math.cos(e);a.x=o*c.x+r*p.x,a.y=o*c.y+r*p.y,a.z=o*c.z+r*p.z,a.normalize(),u.push(a.x,a.y,a.z),s.x=l.x+n*a.x,s.y=l.y+n*a.y,s.z=l.z+n*a.z,h.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)c.x=t/e,c.y=n/i,p.push(c.x,c.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),o=(i+1)*t+e,s=(i+1)*(t-1)+e;d.push(n,r,s),d.push(r,o,s)}}()}(),this.setIndex(d),this.setAttribute("position",new Pr(h,3)),this.setAttribute("normal",new Pr(u,3)),this.setAttribute("uv",new Pr(p,2))}toJSON(){const t=Vr.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t}}exports.TubeGeometry=exports.TubeBufferGeometry=Dp;class Op extends Vr{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=[0,0],i={},r=new Yn;if(null!==t.index){const o=t.attributes.position,s=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let t=0,e=a.length;t<e;++t){const e=a[t],r=e.start;for(let t=r,o=r+e.count;t<o;t+=3)for(let e=0;e<3;e++){const r=s.getX(t+e),o=s.getX(t+(e+1)%3);n[0]=Math.min(r,o),n[1]=Math.max(r,o);const a=n[0]+","+n[1];void 0===i[a]&&(i[a]={index1:n[0],index2:n[1]})}}for(const t in i){const n=i[t];r.fromBufferAttribute(o,n.index1),e.push(r.x,r.y,r.z),r.fromBufferAttribute(o,n.index2),e.push(r.x,r.y,r.z)}}else{const n=t.attributes.position;for(let t=0,i=n.count/3;t<i;t++)for(let o=0;o<3;o++){const i=3*t+o;r.fromBufferAttribute(n,i),e.push(r.x,r.y,r.z);const s=3*t+(o+1)%3;r.fromBufferAttribute(n,s),e.push(r.x,r.y,r.z)}}this.setAttribute("position",new Pr(e,3))}}exports.WireframeGeometry=Op;var Ip=Object.freeze({__proto__:null,BoxGeometry:ho,BoxBufferGeometry:ho,CircleGeometry:Eu,CircleBufferGeometry:Eu,ConeGeometry:Lu,ConeBufferGeometry:Lu,CylinderGeometry:Au,CylinderBufferGeometry:Au,DodecahedronGeometry:Cu,DodecahedronBufferGeometry:Cu,EdgesGeometry:Bu,ExtrudeGeometry:xp,ExtrudeBufferGeometry:xp,IcosahedronGeometry:_p,IcosahedronBufferGeometry:_p,LatheGeometry:bp,LatheBufferGeometry:bp,OctahedronGeometry:wp,OctahedronBufferGeometry:wp,ParametricGeometry:Mp,ParametricBufferGeometry:Mp,PlaneGeometry:Po,PlaneBufferGeometry:Po,PolyhedronGeometry:Ru,PolyhedronBufferGeometry:Ru,RingGeometry:Sp,RingBufferGeometry:Sp,ShapeGeometry:Tp,ShapeBufferGeometry:Tp,SphereGeometry:Ap,SphereBufferGeometry:Ap,TetrahedronGeometry:Lp,TetrahedronBufferGeometry:Lp,TextGeometry:Rp,TextBufferGeometry:Rp,TorusGeometry:Cp,TorusBufferGeometry:Cp,TorusKnotGeometry:Pp,TorusKnotBufferGeometry:Pp,TubeGeometry:Dp,TubeBufferGeometry:Dp,WireframeGeometry:Op});function Bp(t){vr.call(this),this.type="ShadowMaterial",this.color=new mr(0),this.transparent=!0,this.setValues(t)}function Np(t){xo.call(this,t),this.type="RawShaderMaterial"}function Fp(t){vr.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new mr(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 mr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new Fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function Gp(t){Fp.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Fn(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(t){this.reflectivity=Nn.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}function zp(t){vr.call(this),this.type="MeshPhongMaterial",this.color=new mr(16777215),this.specular=new mr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new Fn(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Hp(t){vr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new mr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new Fn(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Up(t){vr.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new Fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function kp(t){vr.call(this),this.type="MeshLambertMaterial",this.color=new mr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new mr(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Vp(t){vr.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new mr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new Fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Wp(t){ru.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}Bp.prototype=Object.create(vr.prototype),Bp.prototype.constructor=Bp,Bp.prototype.isShadowMaterial=!0,Bp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this},Np.prototype=Object.create(xo.prototype),Np.prototype.constructor=Np,Np.prototype.isRawShaderMaterial=!0,Fp.prototype=Object.create(vr.prototype),Fp.prototype.constructor=Fp,Fp.prototype.isMeshStandardMaterial=!0,Fp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},Gp.prototype=Object.create(Fp.prototype),Gp.prototype.constructor=Gp,Gp.prototype.isMeshPhysicalMaterial=!0,Gp.prototype.copy=function(t){return Fp.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new mr).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this},zp.prototype=Object.create(vr.prototype),zp.prototype.constructor=zp,zp.prototype.isMeshPhongMaterial=!0,zp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Hp.prototype=Object.create(vr.prototype),Hp.prototype.constructor=Hp,Hp.prototype.isMeshToonMaterial=!0,Hp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Up.prototype=Object.create(vr.prototype),Up.prototype.constructor=Up,Up.prototype.isMeshNormalMaterial=!0,Up.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},kp.prototype=Object.create(vr.prototype),kp.prototype.constructor=kp,kp.prototype.isMeshLambertMaterial=!0,kp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Vp.prototype=Object.create(vr.prototype),Vp.prototype.constructor=Vp,Vp.prototype.isMeshMatcapMaterial=!0,Vp.prototype.copy=function(t){return vr.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Wp.prototype=Object.create(ru.prototype),Wp.prototype.constructor=Wp,Wp.prototype.isLineDashedMaterial=!0,Wp.prototype.copy=function(t){return ru.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var jp=Object.freeze({__proto__:null,ShadowMaterial:Bp,SpriteMaterial:Sh,RawShaderMaterial:Np,ShaderMaterial:xo,PointsMaterial:mu,MeshPhysicalMaterial:Gp,MeshStandardMaterial:Fp,MeshPhongMaterial:zp,MeshToonMaterial:Hp,MeshNormalMaterial:Up,MeshLambertMaterial:kp,MeshDepthMaterial:nh,MeshDistanceMaterial:ih,MeshBasicMaterial:yr,MeshMatcapMaterial:Vp,LineDashedMaterial:Wp,LineBasicMaterial:ru,Material:vr});const qp={arraySlice:function(t,e,n){return qp.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(function(e,n){return t[e]-t[n]}),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let o=0,s=0;s!==i;++o){const i=n[o]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,o=t[0];for(;void 0!==o&&void 0===o[i];)o=t[r++];if(void 0===o)return;let s=o[i];if(void 0!==s)if(Array.isArray(s))do{void 0!==(s=o[i])&&(e.push(o.time),n.push.apply(n,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{void 0!==(s=o[i])&&(e.push(o.time),s.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(s=o[i])&&(e.push(o.time),n.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,n,i,r=30){const o=t.clone();o.name=e;const s=[];for(let c=0;c<o.tracks.length;++c){const t=o.tracks[c],e=t.getValueSize(),a=[],l=[];for(let o=0;o<t.times.length;++o){const s=t.times[o]*r;if(!(s<n||s>=i)){a.push(t.times[o]);for(let n=0;n<e;++n)l.push(t.values[o*e+n])}}0!==a.length&&(t.times=qp.convertArray(a,t.times.constructor),t.values=qp.convertArray(l,t.values.constructor),s.push(t))}o.tracks=s;let a=1/0;for(let c=0;c<o.tracks.length;++c)a>o.tracks[c].times[0]&&(a=o.tracks[c].times[0]);for(let c=0;c<o.tracks.length;++c)o.tracks[c].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,o=e/i;for(let s=0;s<r;++s){const e=n.tracks[s],i=e.ValueTypeName;if("bool"===i||"string"===i)continue;const r=t.tracks.find(function(t){return t.name===e.name&&t.ValueTypeName===i});if(void 0===r)continue;let a=0;const c=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=c/3);let l=0;const h=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=h/3);const u=e.times.length-1;let p;if(o<=e.times[0]){const t=a,n=c-a;p=qp.arraySlice(e.values,t,n)}else if(o>=e.times[u]){const t=u*c+a,n=t+c-a;p=qp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,i=c-a;t.evaluate(o),p=qp.arraySlice(t.resultBuffer,n,i)}if("quaternion"===i){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=r.times.length;for(let t=0;t<d;++t){const e=t*h+l;if("quaternion"===i)Xn.multiplyQuaternionsFlat(r.values,e,p,0,r.values,e);else{const t=h-2*l;for(let n=0;n<t;++n)r.values[e+n]-=p[n]}}}return t.blendMode=Ve,t}};function Xp(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Yp(t,e,n,i){Xp.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zp(t,e,n,i){Xp.call(this,t,e,n,i)}function Jp(t,e,n,i){Xp.call(this,t,e,n,i)}function Qp(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=qp.convertArray(e,this.TimeBufferType),this.values=qp.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Kp(t,e,n){Qp.call(this,t,e,n)}function $p(t,e,n,i){Qp.call(this,t,e,n,i)}function td(t,e,n,i){Qp.call(this,t,e,n,i)}function ed(t,e,n,i){Xp.call(this,t,e,n,i)}function nd(t,e,n,i){Qp.call(this,t,e,n,i)}function id(t,e,n,i){Qp.call(this,t,e,n,i)}function rd(t,e,n,i){Qp.call(this,t,e,n,i)}function od(t,e=-1,n,i=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=Nn.generateUUID(),this.duration<0&&this.resetDuration()}function sd(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return td;case"vector":case"vector2":case"vector3":case"vector4":return rd;case"color":return $p;case"quaternion":return nd;case"bool":case"boolean":return Kp;case"string":return id}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function ad(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=sd(t.type);if(void 0===t.times){const e=[],n=[];qp.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}exports.AnimationUtils=qp,Object.assign(Xp.prototype,{evaluate:function(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t<i)){for(let o=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,t<(i=e[++n]))break e}o=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===o)break;if(i=r,t>=(r=e[--n-1]))break e}o=n,n=0}}for(;n<o;){const i=n+o>>>1;t<e[i]?o=i:n=i+1}if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let o=0;o!==i;++o)e[o]=n[r+o];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Xp.prototype,{beforeStart_:Xp.prototype.copySampleValue_,afterEnd_:Xp.prototype.copySampleValue_}),Yp.prototype=Object.assign(Object.create(Xp.prototype),{constructor:Yp,DefaultSettings_:{endingStart:ze,endingEnd:ze},intervalChanged_:function(t,e,n){const i=this.parameterPositions;let r=t-2,o=t+1,s=i[r],a=i[o];if(void 0===s)switch(this.getSettings_().endingStart){case He:r=t,s=2*e-n;break;case Ue:s=e+i[r=i.length-2]-i[r+1];break;default:r=t,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case He:o=t,a=2*n-e;break;case Ue:o=1,a=n+i[1]-i[0];break;default:o=t-1,a=e}const c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-s),this._weightNext=c/(a-n),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,c=a-s,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-e)/(i-e),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,x=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,v=(-1-p)*m+(1.5+p)*f+.5*d,y=p*m-p*f;for(let _=0;_!==s;++_)r[_]=g*o[l+_]+x*o[c+_]+v*o[a+_]+y*o[h+_];return r}}),Zp.prototype=Object.assign(Object.create(Xp.prototype),{constructor:Zp,interpolate_:function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,c=a-s,l=(n-e)/(i-e),h=1-l;for(let u=0;u!==s;++u)r[u]=o[c+u]*h+o[a+u]*l;return r}}),Jp.prototype=Object.assign(Object.create(Xp.prototype),{constructor:Jp,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Qp,{toJSON:function(t){const e=t.constructor;let n;if(void 0!==e.toJSON)n=e.toJSON(t);else{n={name:t.name,times:qp.convertArray(t.times,Array),values:qp.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}}),Object.assign(Qp.prototype,{constructor:Qp,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Jp(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Zp(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Yp(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this},scale:function(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this},trim:function(t,e){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);const t=this.getValueSize();this.times=qp.arraySlice(n,r,o),this.values=qp.arraySlice(this.values,r*t,o*t)}return this},validate:function(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let s=0;s!==r;s++){const e=n[s];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,e),t=!1;break}if(null!==o&&o>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,e,o),t=!1;break}o=e}if(void 0!==i&&qp.isTypedArray(i))for(let s=0,a=i.length;s!==a;++s){const e=i[s];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,e),t=!1;break}}return t},optimize:function(){const t=qp.arraySlice(this.times),e=qp.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,o=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const i=s*n,r=o*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=qp.arraySlice(t,0,o),this.values=qp.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this},clone:function(){const t=qp.arraySlice(this.times,0),e=qp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),Kp.prototype=Object.assign(Object.create(Qp.prototype),{constructor:Kp,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$p.prototype=Object.assign(Object.create(Qp.prototype),{constructor:$p,ValueTypeName:"color"}),td.prototype=Object.assign(Object.create(Qp.prototype),{constructor:td,ValueTypeName:"number"}),ed.prototype=Object.assign(Object.create(Xp.prototype),{constructor:ed,interpolate_:function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let c=t*s;for(let l=c+s;c!==l;c+=4)Xn.slerpFlat(r,0,o,c-s,o,c,a);return r}}),nd.prototype=Object.assign(Object.create(Qp.prototype),{constructor:nd,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new ed(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),id.prototype=Object.assign(Object.create(Qp.prototype),{constructor:id,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),rd.prototype=Object.assign(Object.create(Qp.prototype),{constructor:rd,ValueTypeName:"vector"}),Object.assign(od,{parse:function(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let o=0,s=n.length;o!==s;++o)e.push(ad(n[o]).scale(i));const r=new od(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r},toJSON:function(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,o=n.length;r!==o;++r)e.push(Qp.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){const r=e.length,o=[];for(let s=0;s<r;s++){let t=[],a=[];t.push((s+r-1)%r,s,(s+1)%r),a.push(0,1,0);const c=qp.getKeyframeOrder(t);t=qp.sortedArray(t,1,c),a=qp.sortedArray(a,1,c),i||0!==t[0]||(t.push(r),a.push(a[0])),o.push(new td(".morphTargetInfluences["+e[s].name+"]",t,a).scale(1/n))}return new od(t,-1,o)},findByName:function(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let s=0,a=t.length;s<a;s++){const e=t[s],n=e.name.match(r);if(n&&n.length>1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const o=[];for(const s in i)o.push(od.CreateFromMorphTargetSequence(s,i[s],e,n));return o},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];qp.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const c=t.hierarchy||[];for(let l=0;l<c.length;l++){const t=c[l].keys;if(t&&0!==t.length)if(t[0].morphTargets){const e={};let n;for(n=0;n<t.length;n++)if(t[n].morphTargets)for(let i=0;i<t[n].morphTargets.length;i++)e[t[n].morphTargets[i]]=-1;for(const r in e){const e=[],o=[];for(let i=0;i!==t[n].morphTargets.length;++i){const i=t[n];e.push(i.time),o.push(i.morphTarget===r?1:0)}i.push(new td(".morphTargetInfluence["+r+"]",e,o))}a=e.length*(o||1)}else{const r=".bones["+e[l].name+"]";n(rd,r+".position",t,"pos",i),n(nd,r+".quaternion",t,"rot",i),n(rd,r+".scale",t,"scl",i)}}return 0===i.length?null:new od(r,a,i,s)}}),Object.assign(od.prototype,{resetDuration:function(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this},trim:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new od(this.name,this.duration,t,this.blendMode)},toJSON:function(){return od.toJSON(this)}});const cd={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function ld(t,e,n){const i=this;let r=!1,o=0,s=0,a=void 0;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,s),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,s),o===s&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){const e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=c.length;e<n;e+=2){const n=c[e],i=c[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}exports.Cache=cd;const hd=new ld;function ud(t){this.manager=void 0!==t?t:hd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}exports.DefaultLoadingManager=hd,Object.assign(ud.prototype,{load:function(){},loadAsync:function(t,e){const n=this;return new Promise(function(i,r){n.load(t,i,e,r)})},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});const pd={};function dd(t){ud.call(this,t)}function fd(t){ud.call(this,t)}function md(t){ud.call(this,t)}function gd(t){ud.call(this,t)}function xd(t){ud.call(this,t)}function vd(t){ud.call(this,t)}function yd(t){ud.call(this,t)}function _d(){this.type="Curve",this.arcLengthDivisions=200}function bd(t,e,n,i,r,o,s,a){_d.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=s||!1,this.aRotation=a||0}function wd(t,e,n,i,r,o){bd.call(this,t,e,n,n,i,r,o),this.type="ArcCurve"}function Md(){let t=0,e=0,n=0,i=0;function r(r,o,s,a){t=r,e=s,n=-3*r+3*o-2*s-a,i=2*r-2*o+s+a}return{initCatmullRom:function(t,e,n,i,o){r(e,n,o*(n-t),o*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,o,s,a){let c=(e-t)/o-(n-t)/(o+s)+(n-e)/s,l=(n-e)/s-(i-e)/(s+a)+(i-n)/a;r(e,n,c*=s,l*=s)},calc:function(r){const o=r*r;return t+e*r+n*o+i*(o*r)}}}dd.prototype=Object.assign(Object.create(ud.prototype),{constructor:dd,load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=cd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;if(void 0!==pd[t])return void pd[t].push({onLoad:e,onProgress:n,onError:i});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const n=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let o;const s=(this.responseType||"").toLowerCase();switch(s){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let n=0;n<a.length;n++)t[n]=a.charCodeAt(n);o="blob"===s?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;o=e.parseFromString(a,n);break;case"json":o=JSON.parse(a);break;default:o=a}setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0)}catch(c){setTimeout(function(){i&&i(c),r.manager.itemError(t),r.manager.itemEnd(t)},0)}}else{pd[t]=[],pd[t].push({onLoad:e,onProgress:n,onError:i}),(a=new XMLHttpRequest).open("GET",t,!0),a.addEventListener("load",function(e){const n=this.response,i=pd[t];if(delete pd[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),cd.add(t,n);for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onLoad&&e.onLoad(n)}r.manager.itemEnd(t)}else{for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}},!1),a.addEventListener("progress",function(e){const n=pd[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onProgress&&i.onProgress(e)}},!1),a.addEventListener("error",function(e){const n=pd[t];delete pd[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),a.addEventListener("abort",function(e){const n=pd[t];delete pd[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}}),fd.prototype=Object.assign(Object.create(ud.prototype),{constructor:fd,load:function(t,e,n,i){const r=this,o=new dd(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(n){try{e(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(t)}},n,i)},parse:function(t){const e=[];for(let n=0;n<t.length;n++){const i=od.parse(t[n]);e.push(i)}return e}}),md.prototype=Object.assign(Object.create(ud.prototype),{constructor:md,load:function(t,e,n,i){const r=this,o=[],s=new Mu,a=new dd(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let c=0;function l(l){a.load(t[l],function(t){const n=r.parse(t,!0);o[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(s.minFilter=gt),s.image=o,s.format=n.format,s.needsUpdate=!0,e&&e(s))},n,i)}if(Array.isArray(t))for(let h=0,u=t.length;h<u;++h)l(h);else a.load(t,function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){o[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)o[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),o[e].format=n.format,o[e].width=n.width,o[e].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=gt),s.format=n.format,s.needsUpdate=!0,e&&e(s)},n,i);return s}}),gd.prototype=Object.assign(Object.create(ud.prototype),{constructor:gd,load:function(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=cd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",c,!1),cd.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(e){s.removeEventListener("load",a,!1),s.removeEventListener("error",c,!1),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",a,!1),s.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}),xd.prototype=Object.assign(Object.create(ud.prototype),{constructor:xd,load:function(t,e,n,i){const r=new Mo,o=new gd(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(t[n],function(t){r.images[n]=t,6===++s&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}for(let c=0;c<t.length;++c)a(c);return r}}),vd.prototype=Object.assign(Object.create(ud.prototype),{constructor:vd,load:function(t,e,n,i){const r=this,o=new To,s=new dd(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(t,function(t){const n=r.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:lt,o.wrapT=void 0!==n.wrapT?n.wrapT:lt,o.magFilter=void 0!==n.magFilter?n.magFilter:gt,o.minFilter=void 0!==n.minFilter?n.minFilter:gt,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=yt),1===n.mipmapCount&&(o.minFilter=gt),o.needsUpdate=!0,e&&e(o,n))},n,i),o}}),yd.prototype=Object.assign(Object.create(ud.prototype),{constructor:yd,load:function(t,e,n,i){const r=new kn,o=new gd(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(n){r.image=n;const i=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?It:Bt,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r}}),Object.assign(_d.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)r+=(n=this.getPoint(o/t)).distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,c=r-1;for(;a<=c;)if((s=n[i=Math.floor(a+(c-a)/2)]-o)<0)a=i+1;else{if(!(s>0)){c=i;break}c=i-1}if(n[i=c]===o)return i/(r-1);const l=n[i];return(i+(o-l)/(n[i+1]-l))/(r-1)},getTangent:function(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),o=this.getPoint(i),s=e||(r.isVector2?new Fn:new Yn);return s.copy(o).sub(r).normalize(),s},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,i=[],r=[],o=[],s=new Yn,a=new wi;for(let p=0;p<=t;p++){const e=p/t;i[p]=this.getTangentAt(e,new Yn),i[p].normalize()}r[0]=new Yn,o[0]=new Yn;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),u<=c&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=t;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),s.crossVectors(i[p-1],i[p]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Nn.clamp(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(a.makeRotationAxis(s,t))}o[p].crossVectors(i[p],r[p])}if(!0===e){let e=Math.acos(Nn.clamp(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),bd.prototype=Object.create(_d.prototype),bd.prototype.constructor=bd,bd.prototype.isEllipseCurve=!0,bd.prototype.getPoint=function(t,e){const n=e||new Fn,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r===i?r=-i:r-=i);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),c=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=c-this.aY;a=n*t-i*e+this.aX,c=n*e+i*t+this.aY}return n.set(a,c)},bd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},bd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},bd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},wd.prototype=Object.create(bd.prototype),wd.prototype.constructor=wd,wd.prototype.isArcCurve=!0;const Sd=new Yn,Td=new Md,Ed=new Md,Ad=new Md;function Ld(t=[],e=!1,n="centripetal",i=.5){_d.call(this),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}function Rd(t,e,n,i,r){const o=.5*(i-e),s=.5*(r-n),a=t*t;return(2*n-2*i+o+s)*(t*a)+(-3*n+3*i-2*o-s)*a+o*t+n}function Cd(t,e){const n=1-t;return n*n*e}function Pd(t,e){return 2*(1-t)*t*e}function Dd(t,e){return t*t*e}function Od(t,e,n,i){return Cd(t,e)+Pd(t,n)+Dd(t,i)}function Id(t,e){const n=1-t;return n*n*n*e}function Bd(t,e){const n=1-t;return 3*n*n*t*e}function Nd(t,e){return 3*(1-t)*t*t*e}function Fd(t,e){return t*t*t*e}function Gd(t,e,n,i,r){return Id(t,e)+Bd(t,n)+Nd(t,i)+Fd(t,r)}function zd(t=new Fn,e=new Fn,n=new Fn,i=new Fn){_d.call(this),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}function Hd(t=new Yn,e=new Yn,n=new Yn,i=new Yn){_d.call(this),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}function Ud(t=new Fn,e=new Fn){_d.call(this),this.type="LineCurve",this.v1=t,this.v2=e}function kd(t=new Yn,e=new Yn){_d.call(this),this.type="LineCurve3",this.v1=t,this.v2=e}function Vd(t=new Fn,e=new Fn,n=new Fn){_d.call(this),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}function Wd(t=new Yn,e=new Yn,n=new Yn){_d.call(this),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}function jd(t=[]){_d.call(this),this.type="SplineCurve",this.points=t}Ld.prototype=Object.create(_d.prototype),Ld.prototype.constructor=Ld,Ld.prototype.isCatmullRomCurve3=!0,Ld.prototype.getPoint=function(t,e=new Yn){const n=e,i=this.points,r=i.length,o=(r-(this.closed?0:1))*t;let s,a,c=Math.floor(o),l=o-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/r)+1)*r:0===l&&c===r-1&&(c=r-2,l=1),this.closed||c>0?s=i[(c-1)%r]:(Sd.subVectors(i[0],i[1]).add(i[0]),s=Sd);const h=i[c%r],u=i[(c+1)%r];if(this.closed||c+2<r?a=i[(c+2)%r]:(Sd.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Sd),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Td.initNonuniformCatmullRom(s.x,h.x,u.x,a.x,e,n,i),Ed.initNonuniformCatmullRom(s.y,h.y,u.y,a.y,e,n,i),Ad.initNonuniformCatmullRom(s.z,h.z,u.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Td.initCatmullRom(s.x,h.x,u.x,a.x,this.tension),Ed.initCatmullRom(s.y,h.y,u.y,a.y,this.tension),Ad.initCatmullRom(s.z,h.z,u.z,a.z,this.tension));return n.set(Td.calc(l),Ed.calc(l),Ad.calc(l)),n},Ld.prototype.copy=function(t){_d.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Ld.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Ld.prototype.fromJSON=function(t){_d.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Yn).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},zd.prototype=Object.create(_d.prototype),zd.prototype.constructor=zd,zd.prototype.isCubicBezierCurve=!0,zd.prototype.getPoint=function(t,e=new Fn){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Gd(t,i.x,r.x,o.x,s.x),Gd(t,i.y,r.y,o.y,s.y)),n},zd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},zd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},zd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Hd.prototype=Object.create(_d.prototype),Hd.prototype.constructor=Hd,Hd.prototype.isCubicBezierCurve3=!0,Hd.prototype.getPoint=function(t,e=new Yn){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Gd(t,i.x,r.x,o.x,s.x),Gd(t,i.y,r.y,o.y,s.y),Gd(t,i.z,r.z,o.z,s.z)),n},Hd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Hd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Hd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Ud.prototype=Object.create(_d.prototype),Ud.prototype.constructor=Ud,Ud.prototype.isLineCurve=!0,Ud.prototype.getPoint=function(t,e=new Fn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Ud.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Ud.prototype.getTangent=function(t,e){const n=e||new Fn;return n.copy(this.v2).sub(this.v1).normalize(),n},Ud.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ud.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Ud.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},kd.prototype=Object.create(_d.prototype),kd.prototype.constructor=kd,kd.prototype.isLineCurve3=!0,kd.prototype.getPoint=function(t,e=new Yn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},kd.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},kd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},kd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},kd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Vd.prototype=Object.create(_d.prototype),Vd.prototype.constructor=Vd,Vd.prototype.isQuadraticBezierCurve=!0,Vd.prototype.getPoint=function(t,e=new Fn){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Od(t,i.x,r.x,o.x),Od(t,i.y,r.y,o.y)),n},Vd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Vd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Vd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Wd.prototype=Object.create(_d.prototype),Wd.prototype.constructor=Wd,Wd.prototype.isQuadraticBezierCurve3=!0,Wd.prototype.getPoint=function(t,e=new Yn){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Od(t,i.x,r.x,o.x),Od(t,i.y,r.y,o.y),Od(t,i.z,r.z,o.z)),n},Wd.prototype.copy=function(t){return _d.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Wd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Wd.prototype.fromJSON=function(t){return _d.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},jd.prototype=Object.create(_d.prototype),jd.prototype.constructor=jd,jd.prototype.isSplineCurve=!0,jd.prototype.getPoint=function(t,e=new Fn){const n=e,i=this.points,r=(i.length-1)*t,o=Math.floor(r),s=r-o,a=i[0===o?o:o-1],c=i[o],l=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Rd(s,a.x,c.x,l.x,h.x),Rd(s,a.y,c.y,l.y,h.y)),n},jd.prototype.copy=function(t){_d.prototype.copy.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this},jd.prototype.toJSON=function(){const t=_d.prototype.toJSON.call(this);t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t},jd.prototype.fromJSON=function(t){_d.prototype.fromJSON.call(this,t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Fn).fromArray(n))}return this};var qd=Object.freeze({__proto__:null,ArcCurve:wd,CatmullRomCurve3:Ld,CubicBezierCurve:zd,CubicBezierCurve3:Hd,EllipseCurve:bd,LineCurve:Ud,LineCurve3:kd,QuadraticBezierCurve:Vd,QuadraticBezierCurve3:Wd,SplineCurve:jd});function Xd(){_d.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Yd(t){Xd.call(this),this.type="Path",this.currentPoint=new Fn,t&&this.setFromPoints(t)}function Zd(t){Yd.call(this,t),this.uuid=Nn.generateUUID(),this.type="Shape",this.holes=[]}function Jd(t,e=1){Xi.call(this),this.type="Light",this.color=new mr(t),this.intensity=e}function Qd(t,e,n){Jd.call(this,t,n),this.type="HemisphereLight",this.position.copy(Xi.DefaultUp),this.updateMatrix(),this.groundColor=new mr(e)}function Kd(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new Fn(512,512),this.map=null,this.mapPass=null,this.matrix=new wi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Lo,this._frameExtents=new Fn(1,1),this._viewportCount=1,this._viewports=[new Wn(0,0,1,1)]}function $d(){Kd.call(this,new yo(50,1,.5,500)),this.focus=1}function tf(t,e,n,i,r,o){Jd.call(this,t,e),this.type="SpotLight",this.position.copy(Xi.DefaultUp),this.updateMatrix(),this.target=new Xi,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new $d}function ef(){Kd.call(this,new yo(90,1,.5,500)),this._frameExtents=new Fn(4,2),this._viewportCount=6,this._viewports=[new Wn(2,1,1,1),new Wn(0,1,1,1),new Wn(3,1,1,1),new Wn(1,1,1,1),new Wn(3,0,1,1),new Wn(1,0,1,1)],this._cubeDirections=[new Yn(1,0,0),new Yn(-1,0,0),new Yn(0,0,1),new Yn(0,0,-1),new Yn(0,1,0),new Yn(0,-1,0)],this._cubeUps=[new Yn(0,1,0),new Yn(0,1,0),new Yn(0,1,0),new Yn(0,1,0),new Yn(0,0,1),new Yn(0,0,-1)]}function nf(t,e,n,i){Jd.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new ef}function rf(t=-1,e=1,n=1,i=-1,r=.1,o=2e3){vo.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}function of(){Kd.call(this,new rf(-5,5,5,-5,.5,500))}function sf(t,e){Jd.call(this,t,e),this.type="DirectionalLight",this.position.copy(Xi.DefaultUp),this.updateMatrix(),this.target=new Xi,this.shadow=new of}function af(t,e){Jd.call(this,t,e),this.type="AmbientLight"}function cf(t,e,n,i){Jd.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}Xd.prototype=Object.assign(Object.create(_d.prototype),{constructor:Xd,add:function(t){this.curves.push(t)},closePath:function(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ud(e,t))},getPoint:function(t){const e=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=e){const t=n[i]-e,r=this.curves[i],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}i++}return null},getLength:function(){const t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],s=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){_d.prototype.copy.call(this,t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){const t=_d.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t},fromJSON:function(t){_d.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new qd[n.type]).fromJSON(n))}return this}}),Yd.prototype=Object.assign(Object.create(Xd.prototype),{constructor:Yd,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){const n=new Ud(this.currentPoint.clone(),new Fn(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,n,i){const r=new Vd(this.currentPoint.clone(),new Fn(t,e),new Fn(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(t,e,n,i,r,o){const s=new zd(this.currentPoint.clone(),new Fn(t,e),new Fn(n,i),new Fn(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this},splineThru:function(t){const e=new jd([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,n,i,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,n,i,r,o),this},absarc:function(t,e,n,i,r,o){return this.absellipse(t,e,n,n,i,r,o),this},ellipse:function(t,e,n,i,r,o,s,a){const c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,i,r,o,s,a),this},absellipse:function(t,e,n,i,r,o,s,a){const c=new bd(t,e,n,i,r,o,s,a);if(this.curves.length>0){const t=c.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this},copy:function(t){return Xd.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){const t=Xd.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Xd.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Zd.prototype=Object.assign(Object.create(Yd.prototype),{constructor:Zd,getPointsHoles:function(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Yd.prototype.copy.call(this,t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this},toJSON:function(){const t=Yd.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t},fromJSON:function(t){Yd.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new Yd).fromJSON(n))}return this}}),Jd.prototype=Object.assign(Object.create(Xi.prototype),{constructor:Jd,isLight:!0,copy:function(t){return Xi.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){const e=Xi.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Qd.prototype=Object.assign(Object.create(Jd.prototype),{constructor:Qd,isHemisphereLight:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Kd.prototype,{_projScreenMatrix:new wi,_lightPositionWorld:new Yn,_lookTarget:new Yn,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){const e=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(t.matrixWorld),e.position.copy(o),r.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(r),e.updateMatrixWorld(),i.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),$d.prototype=Object.assign(Object.create(Kd.prototype),{constructor:$d,isSpotLightShadow:!0,updateMatrices:function(t){const e=this.camera,n=2*Nn.RAD2DEG*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),Kd.prototype.updateMatrices.call(this,t)}}),tf.prototype=Object.assign(Object.create(Jd.prototype),{constructor:tf,isSpotLight:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ef.prototype=Object.assign(Object.create(Kd.prototype),{constructor:ef,isPointLightShadow:!0,updateMatrices:function(t,e=0){const n=this.camera,i=this.matrix,r=this._lightPositionWorld,o=this._lookTarget,s=this._projScreenMatrix;r.setFromMatrixPosition(t.matrixWorld),n.position.copy(r),o.copy(n.position),o.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(o),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),s.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(s)}}),nf.prototype=Object.assign(Object.create(Jd.prototype),{constructor:nf,isPointLight:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),rf.prototype=Object.assign(Object.create(vo.prototype),{constructor:rf,isOrthographicCamera:!0,copy:function(t,e){return vo.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,s=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o=(r+=t*this.view.offsetX)+t*this.view.width,a=(s-=e*this.view.offsetY)-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xi.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),of.prototype=Object.assign(Object.create(Kd.prototype),{constructor:of,isDirectionalLightShadow:!0,updateMatrices:function(t){Kd.prototype.updateMatrices.call(this,t)}}),sf.prototype=Object.assign(Object.create(Jd.prototype),{constructor:sf,isDirectionalLight:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),af.prototype=Object.assign(Object.create(Jd.prototype),{constructor:af,isAmbientLight:!0}),cf.prototype=Object.assign(Object.create(Jd.prototype),{constructor:cf,isRectAreaLight:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){const e=Jd.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});class lf{constructor(){Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Yn)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*i),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*i*1.092548),e.addScaledVector(o[5],i*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],n*r*1.092548),e.addScaledVector(o[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*i),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*i),e.addScaledVector(o[5],.858086*i*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*n*r),e.addScaledVector(o[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}function hf(t,e){Jd.call(this,void 0,e),this.type="LightProbe",this.sh=void 0!==t?t:new lf}function uf(t){ud.call(this,t),this.textures={}}exports.SphericalHarmonics3=lf,hf.prototype=Object.assign(Object.create(Jd.prototype),{constructor:hf,isLightProbe:!0,copy:function(t){return Jd.prototype.copy.call(this,t),this.sh.copy(t.sh),this},fromJSON:function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},toJSON:function(t){const e=Jd.prototype.toJSON.call(this,t);return e.object.sh=this.sh.toArray(),e}}),uf.prototype=Object.assign(Object.create(ud.prototype),{constructor:uf,load:function(t,e,n,i){const r=this,o=new dd(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(n){try{e(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(t)}},n,i)},parse:function(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=new jp[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=(new mr).setHex(t.sheen)),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(i.morphNormals=t.morphNormals),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.vertexTangents&&(i.vertexTangents=t.vertexTangents),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const r in t.uniforms){const e=t.uniforms[r];switch(i.uniforms[r]={},e.type){case"t":i.uniforms[r].value=n(e.value);break;case"c":i.uniforms[r].value=(new mr).setHex(e.value);break;case"v2":i.uniforms[r].value=(new Fn).fromArray(e.value);break;case"v3":i.uniforms[r].value=(new Yn).fromArray(e.value);break;case"v4":i.uniforms[r].value=(new Wn).fromArray(e.value);break;case"m3":i.uniforms[r].value=(new Gn).fromArray(e.value);break;case"m4":i.uniforms[r].value=(new wi).fromArray(e.value);break;default:i.uniforms[r].value=e.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const r in t.extensions)i.extensions[r]=t.extensions[r];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Fn).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Fn).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),i},setTextures:function(t){return this.textures=t,this}});const pf={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i<r;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(n){return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function df(){Vr.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function ff(t,e,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),wr.call(this,t,e,n),this.meshPerAttribute=i||1}function mf(t){ud.call(this,t)}exports.LoaderUtils=pf,df.prototype=Object.assign(Object.create(Vr.prototype),{constructor:df,isInstancedBufferGeometry:!0,copy:function(t){return Vr.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t=Vr.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),ff.prototype=Object.assign(Object.create(wr.prototype),{constructor:ff,isInstancedBufferAttribute:!0,copy:function(t){return wr.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){const t=wr.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),mf.prototype=Object.assign(Object.create(ud.prototype),{constructor:mf,load:function(t,e,n,i){const r=this,o=new dd(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(n){try{e(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(t)}},n,i)},parse:function(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],o=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),s=new bh(Br(r.type,o),r.stride);return s.uuid=r.uuid,e[i]=s,s}const r=t.isInstancedBufferGeometry?new df:new Vr,o=t.data.index;if(void 0!==o){const t=Br(o.type,o.array);r.setIndex(new wr(t,1))}const s=t.data.attributes;for(const h in s){const e=s[h];let n;if(e.isInterleavedBufferAttribute){n=new Mh(i(t.data,e.data),e.itemSize,e.offset,e.normalized)}else{const t=Br(e.type,e.array);n=new(e.isInstancedBufferAttribute?ff:wr)(t,e.itemSize,e.normalized)}void 0!==e.name&&(n.name=e.name),r.setAttribute(h,n)}const a=t.data.morphAttributes;if(a)for(const h in a){const e=a[h],n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];let s;if(o.isInterleavedBufferAttribute){s=new Mh(i(t.data,o.data),o.itemSize,o.offset,o.normalized)}else{s=new wr(Br(o.type,o.array),o.itemSize,o.normalized)}void 0!==o.name&&(s.name=o.name),n.push(s)}r.morphAttributes[h]=n}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const c=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==c)for(let h=0,u=c.length;h!==u;++h){const t=c[h];r.addGroup(t.start,t.count,t.materialIndex)}const l=t.data.boundingSphere;if(void 0!==l){const t=new Yn;void 0!==l.center&&t.fromArray(l.center),r.boundingSphere=new di(t,l.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}});class gf extends ud{constructor(t){super(t)}load(t,e,n,i){const r=this,o=""===this.path?pf.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;const s=new dd(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(n){let o=null;try{o=JSON.parse(n)}catch(a){return void 0!==i&&i(a),void console.error("THREE:ObjectLoader: Can't parse "+t+".",a.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)},n,i)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),o=this.parseImages(t.images,function(){void 0!==e&&e(c)}),s=this.parseTextures(t.textures,o),a=this.parseMaterials(t.materials,s),c=this.parseObject(t.object,r,a,n),l=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,l),void 0!==e){let t=!1;for(const e in o)if(o[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(c)}return c}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new Zd).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse(function(t){t.isBone&&(i[t.uuid]=t)}),void 0!==t)for(let r=0,o=t.length;r<o;r++){const e=(new Kh).fromJSON(t[r],i);n[e.uuid]=e}return n}parseGeometries(t,e){const n={};let i;if(void 0!==t){const r=new mf;for(let o=0,s=t.length;o<s;o++){let s;const a=t[o];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Ip[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":s=new Ip[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Ip[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Ip[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Ip[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Ip[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Ip[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Ip[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Ip[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Ip[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new Ip[a.type]((new qd[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Ip[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Ip[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":i=[];for(let n=0,r=a.shapes.length;n<r;n++){const t=e[a.shapes[n]];i.push(t)}s=new Ip[a.type](i,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":i=[];for(let n=0,r=a.shapes.length;n<r;n++){const t=e[a.shapes[n]];i.push(t)}const t=a.options.extrudePath;void 0!==t&&(a.options.extrudePath=(new qd[t.type]).fromJSON(t)),s=new Ip[a.type](i,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=r.parse(a);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),!0===s.isBufferGeometry&&void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new uf;r.setTextures(e);for(let e=0,o=t.length;e<o;e++){const o=t[e];if("MultiMaterial"===o.type){const t=[];for(let e=0;e<o.materials.length;e++){const i=o.materials[e];void 0===n[i.uuid]&&(n[i.uuid]=r.parse(i)),t.push(n[i.uuid])}i[o.uuid]=t}else void 0===n[o.uuid]&&(n[o.uuid]=r.parse(o)),i[o.uuid]=n[o.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=od.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function o(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemError(t),n.manager.itemEnd(t)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:Br(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new ld(e);(r=new gd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e<r;e++){const n=t[e],r=n.url;if(Array.isArray(r)){i[n.uuid]=[];for(let t=0,e=r.length;t<e;t++){const e=o(r[t]);null!==e&&(e instanceof HTMLImageElement?i[n.uuid].push(e):i[n.uuid].push(new To(e.data,e.width,e.height)))}}else{const t=o(n.url);null!==t&&(i[n.uuid]=t)}}}return i}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,o=t.length;r<o;r++){const o=t[r];let s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const a=e[o.image];Array.isArray(a)?(s=new Mo(a),6===a.length&&(s.needsUpdate=!0)):(s=a&&a.data?new To(a.data,a.width,a.height):new kn(a),a&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,xf)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],vf),s.wrapT=n(o.wrap[1],vf)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,yf)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,yf)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),i[o.uuid]=s}return i}parseObject(t,e,n,i){let r,o,s;function a(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":r=new _h,void 0!==t.background&&Number.isInteger(t.background)&&(r.background=new mr(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new yh(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new vh(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":r=new yo(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new rf(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new af(t.color,t.intensity);break;case"DirectionalLight":r=new sf(t.color,t.intensity);break;case"PointLight":r=new nf(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new cf(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new tf(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new Qd(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new hf).fromJSON(t);break;case"SkinnedMesh":r=new Yh(o=a(t.geometry),s=c(t.material)),void 0!==t.bindMode&&(r.bindMode=t.bindMode),void 0!==t.bindMatrix&&r.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(r.skeleton=t.skeleton);break;case"Mesh":r=new ao(o=a(t.geometry),s=c(t.material));break;case"InstancedMesh":o=a(t.geometry),s=c(t.material);const e=t.count,n=t.instanceMatrix;(r=new iu(o,s,e)).instanceMatrix=new wr(new Float32Array(n.array),16);break;case"LOD":r=new kh;break;case"Line":r=new hu(a(t.geometry),c(t.material));break;case"LineLoop":r=new fu(a(t.geometry),c(t.material));break;case"LineSegments":r=new du(a(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new _u(a(t.geometry),c(t.material));break;case"Sprite":r=new Gh(c(t.material));break;case"Group":r=new uh;break;case"Bone":r=new Zh;break;default:r=new Xi}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)r.add(this.parseObject(o[t],e,n,i))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];r.animations.push(i[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=r.getObjectByProperty("uuid",n.object);void 0!==i&&r.addLevel(i,n.distance)}}return r}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse(function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}exports.ObjectLoader=gf;const xf={UVMapping:300,CubeReflectionMapping:nt,CubeRefractionMapping:it,EquirectangularReflectionMapping:rt,EquirectangularRefractionMapping:ot,CubeUVReflectionMapping:st,CubeUVRefractionMapping:at},vf={RepeatWrapping:ct,ClampToEdgeWrapping:lt,MirroredRepeatWrapping:ht},yf={NearestFilter:ut,NearestMipmapNearestFilter:pt,NearestMipmapLinearFilter:ft,LinearFilter:gt,LinearMipmapNearestFilter:xt,LinearMipmapLinearFilter:yt};function _f(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),ud.call(this,t),this.options={premultiplyAlpha:"none"}}function bf(){this.type="ShapePath",this.color=new mr,this.subPaths=[],this.currentPath=null}_f.prototype=Object.assign(Object.create(ud.prototype),{constructor:_f,isImageBitmapLoader:!0,setOptions:function(t){return this.options=t,this},load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=cd.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetch(t,s).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,r.options)}).then(function(n){cd.add(t,n),e&&e(n),r.manager.itemEnd(t)}).catch(function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),r.manager.itemStart(t)}}),Object.assign(bf.prototype,{moveTo:function(t,e){return this.currentPath=new Yd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this},bezierCurveTo:function(t,e,n,i,r,o){return this.currentPath.bezierCurveTo(t,e,n,i,r,o),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function n(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new Zd;r.curves=i.curves,e.push(r)}return e}function i(t,e){const n=e.length;let i=!1;for(let r=n-1,o=0;o<n;r=o++){let n=e[r],s=e[o],a=s.x-n.x,c=s.y-n.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(n=e[o],a=-a,s=e[r],c=-c),t.y<n.y||t.y>s.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=c*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=fp.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let s,a,c;const l=[];if(1===o.length)return a=o[0],(c=new Zd).curves=a.curves,l.push(c),l;let h=!r(o[0].getPoints());h=t?!h:h;const u=[],p=[];let d,f,m=[],g=0;p[g]=void 0,m[g]=[];for(let x=0,v=o.length;x<v;x++)s=r(d=(a=o[x]).getPoints()),(s=t?!s:s)?(!h&&p[g]&&g++,p[g]={s:new Zd,p:d},p[g].s.curves=a.curves,h&&g++,m[g]=[]):m[g].push({h:a,p:d[0]});if(!p[0])return n(o);if(p.length>1){let t=!1;const e=[];for(let n=0,i=p.length;n<i;n++)u[n]=[];for(let n=0,r=p.length;n<r;n++){const r=m[n];for(let o=0;o<r.length;o++){const s=r[o];let a=!0;for(let r=0;r<p.length;r++)i(s.p,p[r].p)&&(n!==r&&e.push({froms:n,tos:r,hole:o}),a?(a=!1,u[r].push(s)):t=!0);a&&u[n].push(s)}}e.length>0&&(t||(m=u))}for(let x=0,v=p.length;x<v;x++){c=p[x].s,l.push(c);for(let t=0,e=(f=m[x]).length;t<e;t++)c.holes.push(f[t].h)}return l}});class wf{constructor(t){Object.defineProperty(this,"isFont",{value:!0}),this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],i=Mf(t,e,this.data);for(let r=0,o=i.length;r<o;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}function Mf(t,e,n){const i=Array.from?Array.from(t):String(t).split(""),r=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,s=[];let a=0,c=0;for(let l=0;l<i.length;l++){const t=i[l];if("\n"===t)a=0,c-=o;else{const e=Sf(t,r,a,c,n);a+=e.offsetX,s.push(e.path)}}return s}function Sf(t,e,n,i,r){const o=r.glyphs[t]||r.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new bf;let a,c,l,h,u,p,d,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let r=0,o=t.length;r<o;){switch(t[r++]){case"m":a=t[r++]*e+n,c=t[r++]*e+i,s.moveTo(a,c);break;case"l":a=t[r++]*e+n,c=t[r++]*e+i,s.lineTo(a,c);break;case"q":l=t[r++]*e+n,h=t[r++]*e+i,u=t[r++]*e+n,p=t[r++]*e+i,s.quadraticCurveTo(u,p,l,h);break;case"b":l=t[r++]*e+n,h=t[r++]*e+i,u=t[r++]*e+n,p=t[r++]*e+i,d=t[r++]*e+n,f=t[r++]*e+i,s.bezierCurveTo(u,p,d,f,l,h)}}}return{offsetX:o.ha*e,path:s}}function Tf(t){ud.call(this,t)}let Ef;exports.Font=wf,Tf.prototype=Object.assign(Object.create(ud.prototype),{constructor:Tf,load:function(t,e,n,i){const r=this,o=new dd(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(t){let n;try{n=JSON.parse(t)}catch(o){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const i=r.parse(n);e&&e(i)},n,i)},parse:function(t){return new wf(t)}});const Af={getContext:function(){return void 0===Ef&&(Ef=new(window.AudioContext||window.webkitAudioContext)),Ef},setContext:function(t){Ef=t}};function Lf(t){ud.call(this,t)}function Rf(t,e,n){hf.call(this,void 0,n);const i=(new mr).set(t),r=(new mr).set(e),o=new Yn(i.r,i.g,i.b),s=new Yn(r.r,r.g,r.b),a=Math.sqrt(Math.PI),c=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(c)}function Cf(t,e){hf.call(this,void 0,e);const n=(new mr).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}exports.AudioContext=Af,Lf.prototype=Object.assign(Object.create(ud.prototype),{constructor:Lf,load:function(t,e,n,i){const r=this,o=new dd(r.manager);o.setResponseType("arraybuffer"),o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,function(n){try{const s=n.slice(0);Af.getContext().decodeAudioData(s,function(t){e(t)})}catch(o){i?i(o):console.error(o),r.manager.itemError(t)}},n,i)}}),Rf.prototype=Object.assign(Object.create(hf.prototype),{constructor:Rf,isHemisphereLightProbe:!0,copy:function(t){return hf.prototype.copy.call(this,t),this},toJSON:function(t){return hf.prototype.toJSON.call(this,t)}}),Cf.prototype=Object.assign(Object.create(hf.prototype),{constructor:Cf,isAmbientLightProbe:!0,copy:function(t){return hf.prototype.copy.call(this,t),this},toJSON:function(t){return hf.prototype.toJSON.call(this,t)}});const Pf=new wi,Df=new wi;function Of(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new yo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new yo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}Object.assign(Of.prototype,{update:function(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const n=t.projectionMatrix.clone(),i=e.eyeSep/2,r=i*e.near/e.focus,o=e.near*Math.tan(Nn.DEG2RAD*e.fov*.5)/e.zoom;let s,a;Df.elements[12]=-i,Pf.elements[12]=i,s=-o*e.aspect+r,a=o*e.aspect+r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(n),s=-o*e.aspect-r,a=o*e.aspect-r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Df),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Pf)}});class If{constructor(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Bf(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Bf();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Bf(){return("undefined"==typeof performance?Date:performance).now()}exports.Clock=If;const Nf=new Yn,Ff=new Xn,Gf=new Yn,zf=new Yn;class Hf extends Xi{constructor(){super(),this.type="AudioListener",this.context=Af.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new If}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Nf,Ff,Gf),zf.set(0,0,-1).applyQuaternion(Ff),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Nf.x,t),e.positionY.linearRampToValueAtTime(Nf.y,t),e.positionZ.linearRampToValueAtTime(Nf.z,t),e.forwardX.linearRampToValueAtTime(zf.x,t),e.forwardY.linearRampToValueAtTime(zf.y,t),e.forwardZ.linearRampToValueAtTime(zf.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Nf.x,Nf.y,Nf.z),e.setOrientation(zf.x,zf.y,zf.z,n.x,n.y,n.z)}}exports.AudioListener=Hf;class Uf extends Xi{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}exports.Audio=Uf;const kf=new Yn,Vf=new Xn,Wf=new Yn,jf=new Yn;class qf extends Uf{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(kf,Vf,Wf),jf.set(0,0,1).applyQuaternion(Vf);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(kf.x,t),e.positionY.linearRampToValueAtTime(kf.y,t),e.positionZ.linearRampToValueAtTime(kf.z,t),e.orientationX.linearRampToValueAtTime(jf.x,t),e.orientationY.linearRampToValueAtTime(jf.y,t),e.orientationZ.linearRampToValueAtTime(jf.z,t)}else e.setPosition(kf.x,kf.y,kf.z),e.setOrientation(jf.x,jf.y,jf.z)}}exports.PositionalAudio=qf;class Xf{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}function Yf(t,e,n){let i,r,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}exports.AudioAnalyser=Xf,Object.assign(Yf.prototype,{accumulate:function(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==i;++t)n[r+t]=n[t];o=e}else{const t=e/(o+=e);this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=o},accumulateAdditive:function(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t},apply:function(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let a=e,c=e+e;a!==c;++a)if(n[a]!==n[a+e]){s.setValue(n,i);break}},saveOriginalState:function(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,o=i;r!==o;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]},_select:function(t,e,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){Xn.slerpFlat(t,e,t,e,t,n,i)},_slerpAdditive:function(t,e,n,i,r){const o=this._workIndex*r;Xn.multiplyQuaternionsFlat(t,o,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,o,i)},_lerp:function(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}},_lerpAdditive:function(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}});const Zf="\\[\\]\\.:\\/",Jf=new RegExp("[\\[\\]\\.:\\/]","g"),Qf="[^\\[\\]\\.:\\/]",Kf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",$f=/((?:WC+[\/:])*)/.source.replace("WC",Qf),tm=/(WCOD+)?/.source.replace("WCOD",Kf),em=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qf),nm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qf),im=new RegExp("^"+$f+tm+em+nm+"$"),rm=["material","materials","bones"];function om(t,e,n){const i=n||sm.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function sm(t,e,n){this.path=e,this.parsedPath=n||sm.parseTrackName(e),this.node=sm.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function am(){this.uuid=Nn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}Object.assign(om.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(sm,{Composite:om,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new sm.Composite(t,e,n):new sm(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Jf,"")},parseTrackName:function(t){const e=im.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==rm.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const o=n(r.children);if(o)return o}return null},i=n(t.children);if(i)return i}return null}}),Object.assign(sm.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]},function(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=sm.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const o=t[i];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(sm.prototype,{_getValue_unbound:sm.prototype.getValue,_setValue_unbound:sm.prototype.setValue}),Object.assign(am.prototype,{isAnimationObjectGroup:!0,add:function(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let s=void 0,a=t.length,c=this.nCachedObjects_;for(let l=0,h=arguments.length;l!==h;++l){const h=arguments[l],u=h.uuid;let p=e[u];if(void 0===p){p=a++,e[u]=p,t.push(h);for(let t=0,e=o;t!==e;++t)r[t].push(new sm(h,n[t],i[t]))}else if(p<c){s=t[p];const a=--c,l=t[a];e[l.uuid]=p,t[p]=l,e[u]=a,t[a]=h;for(let t=0,e=o;t!==e;++t){const e=r[t],o=e[a];let s=e[p];e[p]=o,void 0===s&&(s=new sm(h,n[t],i[t])),e[a]=s}}else t[p]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c},remove:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,c=e[a];if(void 0!==c&&c>=r){const o=r++,l=t[o];e[l.uuid]=c,t[c]=l,e[a]=o,t[o]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[c];e[c]=i,e[o]=r}}}this.nCachedObjects_=r},uncache:function(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,c=e[a];if(void 0!==c)if(delete e[a],c<r){const s=--r,a=t[s],l=--o,h=t[l];e[a.uuid]=c,t[c]=a,e[h.uuid]=s,t[s]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[c]=i,e[s]=r,e.pop()}}else{const r=--o,s=t[r];r>0&&(e[s.uuid]=c),t[c]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[c]=e[r],e.pop()}}}this.nCachedObjects_=r},subscribe_:function(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const o=this._paths,s=this._parsedPaths,a=this._objects,c=a.length,l=this.nCachedObjects_,h=new Array(c);i=r.length,n[t]=i,o.push(t),s.push(e),r.push(h);for(let u=l,p=a.length;u!==p;++u){const n=a[u];h[u]=new sm(n,t,e)}return h},unsubscribe_:function(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=n,o[n]=a,o.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}});class cm{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:ze,endingEnd:ze};for(let c=0;c!==o;++c){const t=r[c].createInterpolant(null);s[c]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ie,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,c=s.sampleValues;return a[0]=r,a[1]=r+n,c[0]=t/o,c[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);break;case ke:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=n===Be;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(n===Oe){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=He,i.endingEnd=He):(i.endingStart=t?this.zeroSlopeAtStart?He:ze:Ue,i.endingEnd=e?this.zeroSlopeAtEnd?He:ze:Ue)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}function lm(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}lm.prototype=Object.assign(Object.create(On.prototype),{constructor:lm,_bindAction:function(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,c=this._bindingsByRootAndName;let l=c[a];void 0===l&&(l={},c[a]=l);for(let h=0;h!==r;++h){const t=i[h],r=t.name;let c=l[r];if(void 0!==c)o[h]=c;else{if(void 0!==(c=o[h])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,a,r));continue}const i=e&&e._propertyBindings[h].binding.parsedPath;++(c=new Yf(sm.create(n,r,i),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(c,a,r),o[h]=c}s[h].resultBuffer=c.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){const i=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,c=a[a.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),t._byClipCacheIndex=null,delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const t=e[n];0==--t.referenceCount&&this._removeInactiveBinding(t)}},_lendAction:function(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[e];void 0===o&&(o={},i[e]=o),o[n]=t,t._cacheIndex=r.length,r.push(t)},_removeInactiveBinding:function(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,s=o[i],a=e[e.length-1],c=t._cacheIndex;a._cacheIndex=c,e[c]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[i]},_lendBinding:function(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&((n=new Zp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e,n){const i=e||this._root,r=i.uuid;let o="string"==typeof t?od.findByName(i,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let c=null;if(void 0===n&&(n=null!==o?o.blendMode:ke),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;c=a.knownActions[0],null===o&&(o=c._clip)}if(null===o)return null;const l=new cm(this,o,e,n);return this._bindAction(l,c),this._addInactiveAction(l,s,r),l},existingAction:function(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?od.findByName(n,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[i]||null},stopAllAction:function(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this},update:function(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let c=0;c!==n;++c){e[c]._update(i,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)s[c].apply(o);return this},setTime:function(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,o=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}},uncacheRoot:function(t){const e=t.uuid,n=this._actionsByClip;for(const r in n){const t=n[r].actionByRoot[e];void 0!==t&&(this._deactivateAction(t),this._removeInactiveAction(t))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const r in i){const t=i[r];t.restoreOriginalState(),this._removeInactiveBinding(t)}},uncacheAction:function(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}});class hm{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new hm(void 0===this.value.clone?this.value:this.value.clone())}}function um(t,e,n){bh.call(this,t,e),this.meshPerAttribute=n||1}function pm(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}function dm(t,e,n,i){this.ray=new bi(t,e),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new Oi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function fm(t,e){return t.distance-e.distance}function mm(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)mm(i[t],e,n,!0)}}exports.Uniform=hm,um.prototype=Object.assign(Object.create(bh.prototype),{constructor:um,isInstancedInterleavedBuffer:!0,copy:function(t){return bh.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){const e=bh.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){const e=bh.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(pm.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(pm.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(dm.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e,n){const i=n||[];return mm(t,this,i,e),i.sort(fm),i},intersectObjects:function(t,e,n){const i=n||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(let r=0,o=t.length;r<o;r++)mm(t[r],this,i,e);return i.sort(fm),i}});class gm{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}clone(){return(new this.constructor).copy(this)}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Nn.clamp(e/this.radius,-1,1))),this}}exports.Spherical=gm;class xm{constructor(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}clone(){return(new this.constructor).copy(this)}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}}exports.Cylindrical=xm;const vm=new Fn;class ym{constructor(t,e){Object.defineProperty(this,"isBox2",{value:!0}),this.min=void 0!==t?t:new Fn(1/0,1/0),this.max=void 0!==e?e:new Fn(-1/0,-1/0)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=vm.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new Fn),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new Fn),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Fn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Fn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return vm.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=ym;const _m=new Yn,bm=new Yn;class wm{constructor(t,e){this.start=void 0!==t?t:new Yn,this.end=void 0!==e?e:new Yn}set(t,e){return this.start.copy(t),this.end.copy(e),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){_m.subVectors(t,this.start),bm.subVectors(this.end,this.start);const n=bm.dot(bm);let i=bm.dot(_m)/n;return e&&(i=Nn.clamp(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}function Mm(t){Xi.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=wm,Mm.prototype=Object.create(Xi.prototype),Mm.prototype.constructor=Mm,Mm.prototype.isImmediateRenderObject=!0;const Sm=new Yn;class Tm extends Xi{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new Vr,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,s=1,a=32;o<a;o++,s++){const t=o/a*Math.PI*2,e=s/a*Math.PI*2;i.push(Math.cos(t),Math.sin(t),1,Math.cos(e),Math.sin(e),1)}n.setAttribute("position",new Pr(i,3));const r=new ru({fog:!1,toneMapped:!1});this.cone=new du(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Sm.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Sm),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}exports.SpotLightHelper=Tm;const Em=new Yn,Am=new wi,Lm=new wi;class Rm extends du{constructor(t){const e=Cm(t),n=new Vr,i=[],r=[],o=new mr(0,0,1),s=new mr(0,1,0);for(let a=0;a<e.length;a++){const t=e[a];t.parent&&t.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}n.setAttribute("position",new Pr(i,3)),n.setAttribute("color",new Pr(r,3)),super(n,new ru({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");Lm.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<e.length;r++){const t=e[r];t.parent&&t.parent.isBone&&(Am.multiplyMatrices(Lm,t.matrixWorld),Em.setFromMatrixPosition(Am),i.setXYZ(o,Em.x,Em.y,Em.z),Am.multiplyMatrices(Lm,t.parent.matrixWorld),Em.setFromMatrixPosition(Am),i.setXYZ(o+1,Em.x,Em.y,Em.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}function Cm(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Cm(t.children[n]));return e}exports.SkeletonHelper=Rm;class Pm extends ao{constructor(t,e,n){super(new Ap(e,4,2),new yr({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}exports.PointLightHelper=Pm;const Dm=new Yn,Om=new mr,Im=new mr;class Bm extends Xi{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new wp(e);i.rotateY(.5*Math.PI),this.material=new yr({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(3*r.count);i.setAttribute("color",new wr(o,3)),this.add(new ao(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Om.copy(this.light.color),Im.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Om:Im;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(Dm.setFromMatrixPosition(this.light.matrixWorld).negate())}}exports.HemisphereLightHelper=Bm;class Nm extends du{constructor(t=10,e=10,n=4473924,i=8947848){n=new mr(n),i=new mr(i);const r=e/2,o=t/e,s=t/2,a=[],c=[];for(let h=0,u=0,p=-s;h<=e;h++,p+=o){a.push(-s,0,p,s,0,p),a.push(p,0,-s,p,0,s);const t=h===r?n:i;t.toArray(c,u),u+=3,t.toArray(c,u),u+=3,t.toArray(c,u),u+=3,t.toArray(c,u),u+=3}const l=new Vr;l.setAttribute("position",new Pr(a,3)),l.setAttribute("color",new Pr(c,3)),super(l,new ru({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}exports.GridHelper=Nm;class Fm extends du{constructor(t=10,e=16,n=8,i=64,r=4473924,o=8947848){r=new mr(r),o=new mr(o);const s=[],a=[];for(let l=0;l<=e;l++){const n=l/e*(2*Math.PI),i=Math.sin(n)*t,c=Math.cos(n)*t;s.push(0,0,0),s.push(i,0,c);const h=1&l?r:o;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let l=0;l<=n;l++){const e=1&l?r:o,c=t-t/n*l;for(let t=0;t<i;t++){let n=t/i*(2*Math.PI),r=Math.sin(n)*c,o=Math.cos(n)*c;s.push(r,0,o),a.push(e.r,e.g,e.b),n=(t+1)/i*(2*Math.PI),r=Math.sin(n)*c,o=Math.cos(n)*c,s.push(r,0,o),a.push(e.r,e.g,e.b)}}const c=new Vr;c.setAttribute("position",new Pr(s,3)),c.setAttribute("color",new Pr(a,3)),super(c,new ru({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}exports.PolarGridHelper=Fm;const Gm=new Yn,zm=new Yn,Hm=new Yn;class Um extends Xi{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new Vr;i.setAttribute("position",new Pr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ru({fog:!1,toneMapped:!1});this.lightPlane=new hu(i,r),this.add(this.lightPlane),(i=new Vr).setAttribute("position",new Pr([0,0,0,0,0,1],3)),this.targetLine=new hu(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Gm.setFromMatrixPosition(this.light.matrixWorld),zm.setFromMatrixPosition(this.light.target.matrixWorld),Hm.subVectors(zm,Gm),this.lightPlane.lookAt(zm),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(zm),this.targetLine.scale.z=Hm.length()}}exports.DirectionalLightHelper=Um;const km=new Yn,Vm=new vo;class Wm extends du{constructor(t){const e=new Vr,n=new ru({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={},s=new mr(16755200),a=new mr(16711680),c=new mr(43775),l=new mr(16777215),h=new mr(3355443);function u(t,e,n){p(t,n),p(e,n)}function p(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}u("n1","n2",s),u("n2","n4",s),u("n4","n3",s),u("n3","n1",s),u("f1","f2",s),u("f2","f4",s),u("f4","f3",s),u("f3","f1",s),u("n1","f1",s),u("n2","f2",s),u("n3","f3",s),u("n4","f4",s),u("p","n1",a),u("p","n2",a),u("p","n3",a),u("p","n4",a),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),e.setAttribute("position",new Pr(i,3)),e.setAttribute("color",new Pr(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const t=this.geometry,e=this.pointMap;Vm.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),jm("c",e,t,Vm,0,0,-1),jm("t",e,t,Vm,0,0,1),jm("n1",e,t,Vm,-1,-1,-1),jm("n2",e,t,Vm,1,-1,-1),jm("n3",e,t,Vm,-1,1,-1),jm("n4",e,t,Vm,1,1,-1),jm("f1",e,t,Vm,-1,-1,1),jm("f2",e,t,Vm,1,-1,1),jm("f3",e,t,Vm,-1,1,1),jm("f4",e,t,Vm,1,1,1),jm("u1",e,t,Vm,.7,1.1,-1),jm("u2",e,t,Vm,-.7,1.1,-1),jm("u3",e,t,Vm,0,2,-1),jm("cf1",e,t,Vm,-1,0,1),jm("cf2",e,t,Vm,1,0,1),jm("cf3",e,t,Vm,0,-1,1),jm("cf4",e,t,Vm,0,1,1),jm("cn1",e,t,Vm,-1,0,-1),jm("cn2",e,t,Vm,1,0,-1),jm("cn3",e,t,Vm,0,-1,-1),jm("cn4",e,t,Vm,0,1,-1),t.getAttribute("position").needsUpdate=!0}}function jm(t,e,n,i,r,o,s){km.set(r,o,s).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],km.x,km.y,km.z)}}exports.CameraHelper=Wm;const qm=new Qn;class Xm extends du{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Vr;r.setIndex(new wr(n,1)),r.setAttribute("position",new wr(i,3)),super(r,new ru({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&qm.setFromObject(this.object),qm.isEmpty())return;const e=qm.min,n=qm.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return du.prototype.copy.call(this,t),this.object=t.object,this}}exports.BoxHelper=Xm;class Ym extends du{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Vr;i.setIndex(new wr(n,1)),i.setAttribute("position",new Pr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ru({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}exports.Box3Helper=Ym;class Zm extends hu{constructor(t,e=1,n=16776960){const i=n,r=new Vr;r.setAttribute("position",new Pr([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),super(r,new ru({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=new Vr;o.setAttribute("position",new Pr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new ao(o,new yr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?p:u,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}exports.PlaneHelper=Zm;const Jm=new Yn;let Qm,Km;class $m extends Xi{constructor(t,e,n,i,r,o){super(),this.type="ArrowHelper",void 0===t&&(t=new Yn(0,0,1)),void 0===e&&(e=new Yn(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),void 0===Qm&&((Qm=new Vr).setAttribute("position",new Pr([0,0,0,0,1,0],3)),(Km=new Au(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new hu(Qm,new ru({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ao(Km,new yr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Jm.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Jm,e)}}setLength(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=$m;class tg extends du{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new Vr;n.setAttribute("position",new Pr(e,3)),n.setAttribute("color",new Pr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=tg;const eg=new Float32Array(1),ng=new Int32Array(eg.buffer),ig={toHalfFloat:function(t){eg[0]=t;const e=ng[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e):r<113?n|=((i|=2048)>>114-r)+(i>>113-r&1):(n|=r-112<<10|i>>1,n+=1&i)}};exports.DataUtils=ig;const rg=4,og=8,sg=Math.pow(2,og),ag=[.125,.215,.35,.446,.526,.582],cg=og-rg+1+ag.length,lg=20,hg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},ug=new yr({side:p,depthWrite:!1,depthTest:!1}),pg=new ao(new ho,ug),dg=new rf,{_lodPlanes:fg,_sizeLods:mg,_sigmas:gg}=Tg(),xg=new mr;let vg=null;const yg=(1+Math.sqrt(5))/2,_g=1/yg,bg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,yg,_g),new Yn(0,yg,-_g),new Yn(_g,0,yg),new Yn(-_g,0,yg),new Yn(yg,_g,0),new Yn(-yg,_g,0)];function wg(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Mg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Lg(lg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){vg=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Cg(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Rg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<fg.length;t++)fg[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(vg),t.scissorTest=!1,Ag(t,0,0,t.width,t.height)}_fromTexture(t){vg=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:ut,minFilter:ut,generateMipmaps:!1,type:bt,format:Gt,encoding:Sg(t)?t.encoding:Je,depthBuffer:!1},n=Eg(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Eg(e),n}_compileMaterial(t){const e=new ao(fg[0],t);this._renderer.compile(e,dg)}_sceneToCubeUV(t,e,n,i){const r=new yo(90,1,e,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,c=a.autoClear,l=a.outputEncoding,h=a.toneMapping;a.getClearColor(xg),a.toneMapping=Z,a.outputEncoding=Xe,a.autoClear=!1;let u=!1;const p=t.background;if(p){if(p.isColor){ug.color.copy(p).convertSRGBToLinear(),t.background=null;const e=wg(ug.color);ug.opacity=e,u=!0}}else{ug.color.copy(xg).convertSRGBToLinear();const t=wg(ug.color);ug.opacity=t,u=!0}for(let d=0;d<6;d++){const e=d%3;0==e?(r.up.set(0,o[d],0),r.lookAt(s[d],0,0)):1==e?(r.up.set(0,0,o[d]),r.lookAt(0,s[d],0)):(r.up.set(0,o[d],0),r.lookAt(0,0,s[d])),Ag(i,e*sg,d>2?sg:0,sg,sg),a.setRenderTarget(i),u&&a.render(pg,r),a.render(t,r)}a.toneMapping=h,a.outputEncoding=l,a.autoClear=c}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Cg()):null==this._equirectShader&&(this._equirectShader=Rg());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new ao(fg[0],i),o=i.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=hg[t.encoding],o.outputEncoding.value=hg[e.texture.encoding],Ag(e,0,0,3*sg,2*sg),n.setRenderTarget(e),n.render(r,dg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let i=1;i<cg;i++){const e=Math.sqrt(gg[i]*gg[i]-gg[i-1]*gg[i-1]),n=bg[(i-1)%bg.length];this._blur(t,i-1,i,e,n)}e.autoClear=n}_blur(t,e,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,i,"latitudinal",r),this._halfBlur(o,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,o,s){const a=this._renderer,c=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const l=new ao(fg[i],c),h=c.uniforms,u=mg[n]-1,p=isFinite(r)?Math.PI/(2*u):2*Math.PI/(2*lg-1),d=r/p,f=isFinite(r)?1+Math.floor(3*d):lg;f>lg&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${lg}`);const m=[];let g=0;for(let v=0;v<lg;++v){const t=v/d,e=Math.exp(-t*t/2);m.push(e),0==v?g+=e:v<f&&(g+=2*e)}for(let v=0;v<m.length;v++)m[v]=m[v]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s),h.dTheta.value=p,h.mipInt.value=og-n,h.inputEncoding.value=hg[t.texture.encoding],h.outputEncoding.value=hg[t.texture.encoding];const x=mg[i];Ag(e,3*Math.max(0,sg-2*x),(0===i?0:2*sg)+2*x*(i>og-rg?i-og+rg:0),3*x,2*x),a.setRenderTarget(e),a.render(l,dg)}}function Sg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Tg(){const t=[],e=[],n=[];let i=og;for(let r=0;r<cg;r++){const o=Math.pow(2,i);e.push(o);let s=1/o;r>og-rg?s=ag[r-og+rg-1]:0==r&&(s=0),n.push(s);const a=1/(o-1),c=-a/2,l=1+a/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=6,p=6,d=3,f=2,m=1,g=new Float32Array(d*p*u),x=new Float32Array(f*p*u),v=new Float32Array(m*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,d*p*t),x.set(h,f*p*t);const r=[t,t,t,t,t,t];v.set(r,m*p*t)}const y=new Vr;y.setAttribute("position",new wr(g,d)),y.setAttribute("uv",new wr(x,f)),y.setAttribute("faceIndex",new wr(v,m)),t.push(y),i>rg&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Eg(t){const e=new jn(3*sg,3*sg,t);return e.texture.mapping=st,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ag(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Lg(t){return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(t)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new Yn(0,1,0)},inputEncoding:{value:hg[Xe]},outputEncoding:{value:hg[Xe]}},vertexShader:Pg(),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${Dg()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Rg(){return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new Fn(1,1)},inputEncoding:{value:hg[Xe]},outputEncoding:{value:hg[Xe]}},vertexShader:Pg(),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${Dg()}\n\n\t\t\t#include <common>\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:g,depthTest:!1,depthWrite:!1})}function Cg(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:hg[Xe]},outputEncoding:{value:hg[Xe]}},vertexShader:Pg(),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${Dg()}\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:g,depthTest:!1,depthWrite:!1})}function Pg(){return"\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"}function Dg(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\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"}function Og(t,e,n,i,r,o,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new gr(t,e,n,r,o,s)}exports.PMREMGenerator=Mg;const Ig=0;exports.LineStrip=0;const Bg=1;exports.LinePieces=1;const Ng=0;exports.NoColors=0;const Fg=1;exports.FaceColors=1;const Gg=2;function zg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Hg(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Ug(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new _u(t,e)}function kg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Gh(t)}function Vg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new _u(t,e)}function Wg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function jg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function qg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Xg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Yg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new wr(t,e).setUsage(Mn)}function Zg(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Mr(t,e)}function Jg(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Sr(t,e)}function Qg(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Tr(t,e)}function Kg(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Er(t,e)}function $g(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ar(t,e)}function tx(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Lr(t,e)}function ex(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Rr(t,e)}function nx(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Pr(t,e)}function ix(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Dr(t,e)}function rx(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ld.call(this,t),this.type="catmullrom",this.closed=!0}function ox(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ld.call(this,t),this.type="catmullrom"}function sx(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Ld.call(this,t),this.type="catmullrom"}function ax(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new tg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Xm(t,e)}function lx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new du(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function hx(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new du(new Op(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new dd(t)}function px(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vd(t)}function dx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new So(t,n)}exports.VertexColors=2,_d.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(_d.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Yd.prototype,{fromPoints:function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),rx.prototype=Object.create(Ld.prototype),ox.prototype=Object.create(Ld.prototype),sx.prototype=Object.create(Ld.prototype),Object.assign(sx.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Nm.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Rm.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(ud.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),pf.extractUrlBase(t)}}),ud.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(ym.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Qn.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(di.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Lo.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},wm.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(Nn,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Nn.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Nn.ceilPowerOfTwo(t)}}),Object.assign(Gn.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}}),Object.assign(wi.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)},getInverse:function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}}),Qi.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Object.assign(Xn.prototype,{multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}}),Object.assign(bi.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(cr.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(cr,{barycoordFromPoint:function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),cr.getBarycoord(t,e,n,i,r)},normal:function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),cr.getNormal(t,e,n,i)}}),Object.assign(Zd.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new xp(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Tp(this,t)}}),Object.assign(Fn.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Yn.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Wn.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Xi.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(Xi.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(ao.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(ao.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(kh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Kh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Yh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(_d.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),yo.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Jd.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(wr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),Object.assign(wr.prototype,{setDynamic:function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Vr.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addAttribute:function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new wr(arguments[1],arguments[2])))},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},applyMatrix:function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(Vr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(df.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(dm.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(bh.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),Object.assign(bh.prototype,{setDynamic:function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(xp.prototype,{getArrays:function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")}}),Object.assign(_h.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(hm.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(vr.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new mr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(zp.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Gp.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(xo.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(gh.prototype,{clearTarget:function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(gh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Uf.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Lf).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Xf.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},wo.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},wo.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)};const fx={merge:function(t,e,n){let i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}};function mx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.GeometryUtils=fx,Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new yd;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},Hn.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new xd;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"125"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="125");
  3. },{}],"pBGv":[function(require,module,exports) {
  4. var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
  5. },{}],"UUq2":[function(require,module,exports) {
  6. var process = require("process");
  7. var r=require("process");function t(r,t){for(var e=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r){"string"!=typeof r&&(r+="");var t,e=0,n=-1,o=!0;for(t=r.length-1;t>=0;--t)if(47===r.charCodeAt(t)){if(!o){e=t+1;break}}else-1===n&&(o=!1,n=t+1);return-1===n?"":r.slice(e,n)}function n(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}exports.resolve=function(){for(var e="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i=s>=0?arguments[s]:r.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(e=i+"/"+e,o="/"===i.charAt(0))}return(o?"/":"")+(e=t(n(e.split("/"),function(r){return!!r}),!o).join("/"))||"."},exports.normalize=function(r){var e=exports.isAbsolute(r),s="/"===o(r,-1);return(r=t(n(r.split("/"),function(r){return!!r}),!e).join("/"))||e||(r="."),r&&s&&(r+="/"),(e?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(n(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),s=Math.min(n.length,o.length),i=s,u=0;u<s;u++)if(n[u]!==o[u]){i=u;break}var f=[];for(u=i;u<n.length;u++)f.push("..");return(f=f.concat(o.slice(i))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){if("string"!=typeof r&&(r+=""),0===r.length)return".";for(var t=r.charCodeAt(0),e=47===t,n=-1,o=!0,s=r.length-1;s>=1;--s)if(47===(t=r.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?e?"/":".":e&&1===n?"/":r.slice(0,n)},exports.basename=function(r,t){var n=e(r);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},exports.extname=function(r){"string"!=typeof r&&(r+="");for(var t=-1,e=0,n=-1,o=!0,s=0,i=r.length-1;i>=0;--i){var u=r.charCodeAt(i);if(47!==u)-1===n&&(o=!1,n=i+1),46===u?-1===t?t=i:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){e=i+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===e+1?"":r.slice(t,n)};var o="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return t<0&&(t=r.length+t),r.substr(t,e)};
  8. },{"process":"pBGv"}],"U1HP":[function(require,module,exports) {
  9. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.urlJoin=u;var r=e(require("path"));function e(r){return r&&r.__esModule?r:{default:r}}function t(r){return o(r)||a(r)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function a(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}function o(r){if(Array.isArray(r)){for(var e=0,t=new Array(r.length);e<r.length;e++)t[e]=r[e];return t}}function u(){for(var e=/^[a-zA-Z]+:\/\//,n=-1,a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];for(var i=0,l=o.length;i<l;i++)e.test(o[i])&&(n=i);if(-1===n)return r.default.join.apply(r.default,o).replace(/\\/g,"/");var f=n<=0?o:o.slice(n),c=f[0].match(e)[0];return f[0]=f[0].substring(c.length),(c+r.default.join.apply(r.default,t(f))).replace(/\\/g,"/")}
  10. },{"path":"UUq2"}],"upKt":[function(require,module,exports) {
  11. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function n(e){Promise.resolve().then(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.LRUCache=void 0;var s=function(){function t(){e(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var i=this.itemSet;this.defaultPriorityCallback=function(e){return i.get(e)}}return i(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(e,t){var i=this.itemSet;if(i.has(e))return!1;if(this.isFull())return!1;var n=this.usedSet,s=this.itemList,a=this.callbacks;return s.push(e),n.add(e),i.set(e,Date.now()),a.set(e,t),!0}},{key:"remove",value:function(e){var t=this.usedSet,i=this.itemSet,n=this.itemList,s=this.callbacks;if(i.has(e)){s.get(e)(e);var a=n.indexOf(e);return n.splice(a,1),t.delete(e),i.delete(e),s.delete(e),!0}return!1}},{key:"markUsed",value:function(e){var t=this.itemSet,i=this.usedSet;t.has(e)&&!i.has(e)&&(t.set(e,Date.now()),i.add(e))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var e=this.unloadPercent,t=this.minSize,i=this.itemList,n=this.itemSet,s=this.usedSet,a=this.callbacks,r=i.length-s.size,l=i.length-t,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(l>0&&r>0){i.sort(function(e,t){var i=s.has(e),n=s.has(t);return i&&n?0:i||n?i?1:-1:u(t)-u(e)});var h=Math.min(l,r),o=Math.max(t*e,h*e),c=Math.min(o,r);c=Math.ceil(c);for(var d=i.splice(0,c),f=0,v=d.length;f<v;f++){var m=d[f];a.get(m)(m),n.delete(m),a.delete(m)}}}},{key:"scheduleUnload",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,n(function(){e.scheduled=!1,e.unloadUnusedContent(),t&&e.markAllUnused()}))}}]),t}();exports.LRUCache=s;
  12. },{}],"MK9K":[function(require,module,exports) {
  13. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.PriorityQueue=void 0;var r=function(){function t(){e(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")}}return i(t,[{key:"sort",value:function(){var e=this.priorityCallback;this.items.sort(function(t,i){return e(t)-e(i)})}},{key:"add",value:function(e,t){var i=this;return new Promise(function(r,n){var o=i.items,s=i.callbacks;o.push(e),s.set(e,function(){return t.apply(void 0,arguments).then(r).catch(n)}),i.autoUpdate&&i.scheduleJobRun()})}},{key:"remove",value:function(e){var t=this.items,i=this.callbacks,r=t.indexOf(e);-1!==r&&(t.splice(r,1),i.delete(e))}},{key:"tryRunJobs",value:function(){var e=this;this.sort();for(var t=this.items,i=this.callbacks,r=this.maxJobs,n=this.currJobs;r>n&&t.length>0;){n++;var o=t.pop(),s=i.get(o);i.delete(o),s(o).then(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()}).catch(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()})}this.currJobs=n}},{key:"scheduleJobRun",value:function(){var e=this;this.scheduled||(requestAnimationFrame(function(){e.tryRunJobs(),e.scheduled=!1}),this.scheduled=!0)}}]),t}();exports.PriorityQueue=r;
  14. },{}],"ci3X":[function(require,module,exports) {
  15. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FAILED=exports.LOADED=exports.PARSING=exports.LOADING=exports.UNLOADED=void 0;var e=0;exports.UNLOADED=e;var r=1;exports.LOADING=r;var t=2;exports.PARSING=t;var o=3;exports.LOADED=o;var s=4;exports.FAILED=s;
  16. },{}],"oQJ2":[function(require,module,exports) {
  17. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.traverseSet=a,exports.determineFrustumSet=l,exports.markUsedSetLeaves=s,exports.skipTraversal=d,exports.toggleTiles=o;var e=require("./constants.js");function t(t){return t===e.LOADED||t===e.FAILED}function r(e,t){return e.__lastFrameVisited===t&&e.__used}function _(e,t){e.__lastFrameVisited!==t&&(e.__lastFrameVisited=t,e.__used=!1,e.__inFrustum=!1,e.__isLeaf=!1,e.__visible=!1,e.__active=!1,e.__error=0,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1)}function i(e,t,r){if(_(e,t),e.__used=!0,r.markUsed(e),e.__contentEmpty)for(var n=e.children,a=0,l=n.length;a<l;a++)i(n[a],t,r)}function n(e,r,_){if(e.__contentEmpty&&(!e.__externalTileSet||t(e.__loadingState)))for(var i=e.children,a=0,l=i.length;a<l;a++){var s=i[a];s.__depthFromRenderedParent=r,n(s,r,_)}else _.requestTileContents(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,_=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t&&t(e,_,i))r&&r(e,_,i);else{for(var n=e.children,l=0,s=n.length;l<s;l++)a(n[l],t,r,e,i+1);r&&r(e,_,i)}}function l(e,t){var r=t.stats,n=t.frameCount,a=t.errorTarget,s=t.maxDepth,d=t.loadSiblings,o=t.lruCache,u=t.stopAtEmptyTiles;if(_(e,n),!1===t.tileInView(e))return!1;if(e.__used=!0,o.markUsed(e),e.__inFrustum=!0,r.inFrustum++,(u||!e.__contentEmpty)&&!e.__externalTileSet){var v=t.calculateError(e);if(e.__error=v,v<=a)return!0;if(t.maxDepth>0&&e.__depth+1>=s)return!0}for(var c=!1,f=e.children,h=0,m=f.length;h<m;h++){var p=l(f[h],t);c=c||p}if(c&&d)for(var g=0,F=f.length;g<F;g++){i(f[g],n,o)}return!0}function s(_,i){var n=i.stats,a=i.frameCount;if(r(_,a)){n.used++;for(var l=_.children,d=!1,o=0,u=l.length;o<u;o++){var v=l[o];d=d||r(v,a)}if(d){for(var c=!1,f=!0,h=0,m=l.length;h<m;h++){var p=l[h];if(s(p,i),c=c||p.__wasSetVisible||p.__childrenWereVisible,r(p,a)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&t(p.__loadingState)||p.__externalTileSet&&p.__loadingState===e.FAILED;f=f&&g}}_.__childrenWereVisible=c,_.__allChildrenLoaded=f}else _.__isLeaf=!0}}function d(_,i){var a=i.stats,l=i.frameCount;if(r(_,l)){var s=_.parent,o=s?s.__depthFromRenderedParent:-1;_.__depthFromRenderedParent=o;var u=i.lruCache;if(_.__isLeaf)return _.__depthFromRenderedParent++,void(_.__loadingState===e.LOADED?(_.__inFrustum&&(_.__visible=!0,a.visible++),_.__active=!0,a.active++):u.isFull()||_.__contentEmpty&&!_.__externalTileSet||i.requestTileContents(_));var v=(i.errorTarget+1)*i.errorThreshold,c=_.__error<=v,f=c||"ADD"===_.refine,h=!_.__contentEmpty,m=h||_.__externalTileSet,p=t(_.__loadingState)&&m,g=_.__childrenWereVisible,F=_.children,S=_.__allChildrenLoaded;if(f&&h&&_.__depthFromRenderedParent++,f&&!p&&!u.isFull()&&m&&i.requestTileContents(_),(c&&!S&&!g&&p||"ADD"===_.refine&&p)&&(_.__inFrustum&&(_.__visible=!0,a.visible++),_.__active=!0,a.active++),"ADD"!==_.refine&&c&&!S&&p)for(var T=0,b=F.length;T<b;T++){var D=F[T];r(D,l)&&!u.isFull()&&(D.__depthFromRenderedParent=_.__depthFromRenderedParent+1,n(D,D.__depthFromRenderedParent,i))}else for(var L=0,E=F.length;L<E;L++){var x=F[L];r(x,l)&&d(x,i)}}}function o(t,_){var i=r(t,_.frameCount);if(i||t.__usedLastFrame){var n=!1,a=!1;i&&(n=t.__active,a=_.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==e.LOADED||(t.__wasSetActive!==n&&_.setTileActive(t,n),t.__wasSetVisible!==a&&_.setTileVisible(t,a)),t.__wasSetActive=n,t.__wasSetVisible=a,t.__usedLastFrame=i;for(var l=t.children,s=0,d=l.length;s<d;s++){o(l[s],_)}}}
  18. },{"./constants.js":"ci3X"}],"svb9":[function(require,module,exports) {
  19. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesRendererBase=void 0;var e=a(require("path")),t=require("../utilities/urlJoin.js"),n=require("../utilities/LRUCache.js"),r=require("../utilities/PriorityQueue.js"),i=require("./traverseFunctions.js"),o=require("./constants.js");function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),e}var c=function(e){return 1/(e.__depthFromRenderedParent+1)},d=function(){function a(e){s(this,a),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var t=new n.LRUCache;t.unloadPriorityCallback=c;var i=new r.PriorityQueue;i.maxJobs=4,i.priorityCallback=c;var o=new r.PriorityQueue;o.maxJobs=1,o.priorityCallback=c,this.lruCache=t,this.downloadQueue=i,this.parseQueue=o,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0}return u(a,[{key:"rootTileSet",get:function(){var e=this.tileSets[this.rootURL];return!e||e instanceof Promise?null:e}},{key:"root",get:function(){var e=this.rootTileSet;return e?e.root:null}}]),u(a,[{key:"traverse",value:function(e,t){var n=this.tileSets[this.rootURL];n&&n.root&&(0,i.traverseSet)(n.root,e,t)}},{key:"update",value:function(){var e=this.stats,t=this.lruCache,n=this.tileSets,r=n[this.rootURL];if(this.rootURL in n){if(r&&r.root){var o=r.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,(0,i.determineFrustumSet)(o,this),(0,i.markUsedSetLeaves)(o,this),(0,i.skipTraversal)(o,this),(0,i.toggleTiles)(o,this),t.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(e,t,n){return null}},{key:"disposeTile",value:function(e){}},{key:"preprocessNode",value:function(e,n,r){if(e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.uri&&(e.content.uri=(0,t.urlJoin)(r,e.content.uri)),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=n,e.children=e.children||[],e.content&&e.content.uri){var i=/\.json$/i.test(e.content.uri);e.__externalTileSet=i,e.__contentEmpty=i}else e.__externalTileSet=!1,e.__contentEmpty=!0;e.__error=0,e.__inFrustum=!1,e.__isLeaf=!1,e.__usedLastFrame=!1,e.__used=!1,e.__wasSetVisible=!1,e.__visible=!1,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1,e.__wasSetActive=!1,e.__active=!1,e.__loadingState=o.UNLOADED,e.__loadIndex=0,e.__loadAbort=null,e.__depthFromRenderedParent=-1,null===n?(e.__depth=0,e.refine=e.refine||"REPLACE"):(e.__depth=n.__depth+1,e.refine=e.refine||n.refine)}},{key:"setTileActive",value:function(e,t){}},{key:"setTileVisible",value:function(e,t){}},{key:"calculateError",value:function(e){return 0}},{key:"tileInView",value:function(e){return!0}},{key:"fetchTileSet",value:function(t,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,n).then(function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))}).then(function(n){var a=n.asset.version;console.assert("1.0"===a||"0.0"===a,'asset.version is expected to be a string of "1.0" or "0.0"');var s=e.default.dirname(t);return(0,i.traverseSet)(n.root,function(e,t){return r.preprocessNode(e,t,s)},null,o,o?o.__depth:0),n})}},{key:"loadRootTileSet",value:function(e){var t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);var n=this.fetchTileSet(e,this.fetchOptions).then(function(n){t[e]=n});return n.catch(function(n){console.error(n),t[e]=n}),t[e]=n,n}},{key:"requestTileContents",value:function(e){var t=this;if(e.__loadingState===o.UNLOADED){var n=this.stats,r=this.lruCache,i=this.downloadQueue,a=this.parseQueue,s=e.__externalTileSet;r.add(e,function(e){e.__loadingState===o.LOADING?(e.__loadAbort.abort(),e.__loadAbort=null):s?e.children.length=0:t.disposeTile(e),e.__loadingState===o.LOADING?n.downloading--:e.__loadingState===o.PARSING&&n.parsing--,e.__loadingState=o.UNLOADED,e.__loadIndex++,a.remove(e),i.remove(e)}),e.__loadIndex++;var l=e.__loadIndex,u=new AbortController,c=u.signal;n.downloading++,e.__loadAbort=u,e.__loadingState=o.LOADING;var d=function(t){e.__loadIndex===l&&("AbortError"!==t.name?(a.remove(e),i.remove(e),e.__loadingState===o.PARSING?n.parsing--:e.__loadingState===o.LOADING&&n.downloading--,n.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(e.content.uri,'".')),console.error(t),e.__loadingState=o.FAILED):r.remove(e))};s?i.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return t.fetchTileSet(n,Object.assign({signal:c},t.fetchOptions),e)}).then(function(t){e.__loadIndex===l&&(n.downloading--,e.__loadAbort=null,e.__loadingState=o.LOADED,e.children.push(t.root))}).catch(d):i.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return fetch(n,Object.assign({signal:c},t.fetchOptions))}).then(function(t){if(e.__loadIndex===l){if(t.ok)return t.arrayBuffer();throw new Error("Failed to load model with error code ".concat(t.status))}}).then(function(r){if(e.__loadIndex===l)return n.downloading--,n.parsing++,e.__loadAbort=null,e.__loadingState=o.PARSING,a.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=e.content.uri.split(/\./g).pop();return t.parseTile(r,e,n)})}).then(function(){e.__loadIndex===l&&(n.parsing--,e.__loadingState=o.LOADED,e.__wasSetVisible&&t.setTileVisible(e,!0),e.__wasSetActive&&t.setTileActive(e,!0))}).catch(d)}}},{key:"dispose",value:function(){var e=this.lruCache;this.traverse(function(t){e.remove(t)})}}]),a}();exports.TilesRendererBase=d;
  20. },{"path":"UUq2","../utilities/urlJoin.js":"U1HP","../utilities/LRUCache.js":"upKt","../utilities/PriorityQueue.js":"MK9K","./traverseFunctions.js":"oQJ2","./constants.js":"ci3X"}],"M3Ed":[function(require,module,exports) {
  21. "use strict";function r(r){for(var e="",t=0,o=r.length;t<o;t++)e+=String.fromCharCode(r[t]);return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToString=r;
  22. },{}],"ON7I":[function(require,module,exports) {
  23. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BatchTable=exports.FeatureTable=void 0;var e=require("./arrayToString.js");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?n(e):r}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=a(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function a(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),e}var y=function(){function t(r,n,o,a){f(this,t),this.buffer=r,this.binOffset=n+o,this.binLength=a;var i=null;if(0!==o){var u=new Uint8Array(r,n,o);i=JSON.parse((0,e.arrayToString)(u))}else i={};this.header=i}return s(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this.header;if(!(e in o))return null;var a=o[e];if(a instanceof Object){if(Array.isArray(a))return a;var i,u,c=this.buffer,f=this.binOffset,l=this.binLength,s=a.byteOffset||0,y=a.type||n,b=a.componentType||r;if("type"in a&&n&&a.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(y){case"SCALAR":i=1;break;case"VEC2":i=2;break;case"VEC3":i=3;break;case"VEC4":i=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(e,'".'))}var p=f+s,h=t*i;switch(b){case"BYTE":u=new Int8Array(c,p,h);break;case"UNSIGNED_BYTE":u=new Uint8Array(c,p,h);break;case"SHORT":u=new Int16Array(c,p,h);break;case"UNSIGNED_SHORT":u=new Uint16Array(c,p,h);break;case"INT":u=new Int32Array(c,p,h);break;case"UNSIGNED_INT":u=new Uint32Array(c,p,h);break;case"FLOAT":u=new Float32Array(c,p,h);break;case"DOUBLE":u=new Float64Array(c,p,h);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(e,'".'))}if(p+h*u.BYTES_PER_ELEMENT>f+l)throw new Error("FeatureTable: Feature data read outside binary body length.");return u}return a}}]),t}();exports.FeatureTable=y;var b=function(e){function t(e,n,o,a,u){var c;return f(this,t),(c=r(this,i(t).call(this,e,o,a,u))).batchSize=n,c}return u(t,y),s(t,[{key:"getData",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return o(i(t.prototype),"getData",this).call(this,e,this.batchSize,n,r)}}]),t}();exports.BatchTable=b;
  24. },{"./arrayToString.js":"M3Ed"}],"DNWc":[function(require,module,exports) {
  25. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.B3DMLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}var a=function(){function r(){t(this,r),this.fetchOptions={}}return n(r,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(e){return t.parse(e)})}},{key:"parse",value:function(t){var r=new DataView(t),n=String.fromCharCode(r.getUint8(0))+String.fromCharCode(r.getUint8(1))+String.fromCharCode(r.getUint8(2))+String.fromCharCode(r.getUint8(3));console.assert("b3dm"===n);var a=r.getUint32(4,!0);console.assert(1===a);var o=r.getUint32(8,!0);console.assert(o===t.byteLength);var i=r.getUint32(12,!0),s=r.getUint32(16,!0),u=r.getUint32(20,!0),c=r.getUint32(24,!0),l=t.slice(28,28+i+s),f=new e.FeatureTable(l,0,i,s),h=28+i+s,g=t.slice(h,h+u+c),b=new e.BatchTable(g,f.getData("BATCH_LENGTH"),0,u,c),v=h+u+c;return{version:a,featureTable:f,batchTable:b,glbBytes:new Uint8Array(t,v,o-v)}}}]),r}();exports.B3DMLoaderBase=a;
  26. },{"../utilities/FeatureTable.js":"ON7I"}],"O6i0":[function(require,module,exports) {
  27. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GLTFLoader=void 0;var e=require("../../../build/three.module.js"),t=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new o(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new c(e)}),this.register(function(e){return new l(e)}),this.register(function(e){return new a(e)}),this.register(function(e){return new p(e)})}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,s,n){var a,i=this;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var o=function(e){n?n(e):console.error(e),i.manager.itemError(t),i.manager.itemEnd(t)},l=new e.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(e){try{i.parse(e,a,function(e){r(e),i.manager.itemEnd(t)},o)}catch(s){o(s)}},s,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(t,r,a,o){var l,u={},c={};if("string"==typeof t)l=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===h){try{u[s.KHR_BINARY_GLTF]=new m(t)}catch(R){return void(o&&o(R))}l=u[s.KHR_BINARY_GLTF].content}else l=e.LoaderUtils.decodeText(new Uint8Array(t));var p=JSON.parse(l);if(void 0===p.asset||p.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var d=new V(p,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(var f=0;f<this.pluginCallbacks.length;f++){var T=this.pluginCallbacks[f](d);c[T.name]=T,u[T.name]=!0}if(p.extensionsUsed)for(f=0;f<p.extensionsUsed.length;++f){var M=p.extensionsUsed[f],S=p.extensionsRequired||[];switch(M){case s.KHR_MATERIALS_UNLIT:u[M]=new i;break;case s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:u[M]=new y;break;case s.KHR_DRACO_MESH_COMPRESSION:u[M]=new g(p,this.dracoLoader);break;case s.MSFT_TEXTURE_DDS:u[M]=new n(this.ddsLoader);break;case s.KHR_TEXTURE_TRANSFORM:u[M]=new v;break;case s.KHR_MESH_QUANTIZATION:u[M]=new x;break;default:S.indexOf(M)>=0&&void 0===c[M]&&console.warn('THREE.GLTFLoader: Unknown extension "'+M+'".')}}d.setExtensions(u),d.setPlugins(c),d.parse(a,o)}}});var s={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function n(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=s.MSFT_TEXTURE_DDS,this.ddsLoader=e}function a(e){this.parser=e,this.name=s.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function i(){this.name=s.KHR_MATERIALS_UNLIT}function o(e){this.parser=e,this.name=s.KHR_MATERIALS_CLEARCOAT}function l(e){this.parser=e,this.name=s.KHR_MATERIALS_TRANSMISSION}function u(e){this.parser=e,this.name=s.KHR_TEXTURE_BASISU}function c(e){this.parser=e,this.name=s.EXT_TEXTURE_WEBP,this.isSupported=null}function p(e){this.name=s.EXT_MESHOPT_COMPRESSION,this.parser=e}a.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,s=t.length;r<s;r++){var n=t[r];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}},a.prototype._loadLight=function(t){var r=this.parser,s="light:"+t,n=r.cache.get(s);if(n)return n;var a,i=r.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[t],l=new e.Color(16777215);void 0!==o.color&&l.fromArray(o.color);var u=void 0!==o.range?o.range:0;switch(o.type){case"directional":(a=new e.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new e.PointLight(l)).distance=u;break;case"spot":(a=new e.SpotLight(l)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,void 0!==o.intensity&&(a.intensity=o.intensity),a.name=r.createUniqueName(o.name||"light_"+t),n=Promise.resolve(a),r.cache.add(s,n),n},a.prototype.createNodeAttachment=function(e){var t=this,r=this.parser,s=r.json.nodes[e],n=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})},i.prototype.getMaterialType=function(){return e.MeshBasicMaterial},i.prototype.extendParams=function(t,r,s){var n=[];t.color=new e.Color(1,1,1),t.opacity=1;var a=r.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var i=a.baseColorFactor;t.color.fromArray(i),t.opacity=i[3]}void 0!==a.baseColorTexture&&n.push(s.assignTexture(t,"map",a.baseColorTexture))}return Promise.all(n)},o.prototype.getMaterialType=function(t){var r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null},o.prototype.extendMaterialParams=function(t,r){var s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],i=n.extensions[this.name];if(void 0!==i.clearcoatFactor&&(r.clearcoat=i.clearcoatFactor),void 0!==i.clearcoatTexture&&a.push(s.assignTexture(r,"clearcoatMap",i.clearcoatTexture)),void 0!==i.clearcoatRoughnessFactor&&(r.clearcoatRoughness=i.clearcoatRoughnessFactor),void 0!==i.clearcoatRoughnessTexture&&a.push(s.assignTexture(r,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),void 0!==i.clearcoatNormalTexture&&(a.push(s.assignTexture(r,"clearcoatNormalMap",i.clearcoatNormalTexture)),void 0!==i.clearcoatNormalTexture.scale)){var o=i.clearcoatNormalTexture.scale;r.clearcoatNormalScale=new e.Vector2(o,-o)}return Promise.all(a)},l.prototype.getMaterialType=function(t){var r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null},l.prototype.extendMaterialParams=function(e,t){var r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();var n=[],a=s.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)},u.prototype.loadTexture=function(e){var t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;var n=s.extensions[this.name],a=r.images[n.source],i=t.options.ktx2Loader;if(!i){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,i)},c.prototype.loadTexture=function(e){var t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],i=s.images[a.source],o=i.uri?r.options.manager.getHandler(i.uri):r.textureLoader;return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i,o);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})},c.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported},p.prototype.loadBufferView=function(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var s=r.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then(function(e){var t=s.byteOffset||0,r=s.byteLength||0,n=s.count,i=s.byteStride,o=new ArrayBuffer(n*i),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,i,l,s.mode,s.filter),o})}return null};var h="glTF",d=12,f={JSON:1313821514,BIN:5130562};function m(t){this.name=s.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,d);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==h)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-d,a=new DataView(t,d),i=0;i<n;){var o=a.getUint32(i,!0);i+=4;var l=a.getUint32(i,!0);if(i+=4,l===f.JSON){var u=new Uint8Array(t,d+i,o);this.content=e.LoaderUtils.decodeText(u)}else if(l===f.BIN){var c=d+i;this.body=t.slice(c,c+o)}i+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function g(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=s.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function v(){this.name=s.KHR_TEXTURE_TRANSFORM}function T(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),i=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),o={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var t in o)e.uniforms[t]=o[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",r).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",n).replace("#include <metalnessmap_fragment>",a).replace("#include <lights_physical_fragment>",i)},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(t)}function y(){return{name:s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,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:function(){return T},extendParams:function(t,r,s){var n=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var i=n.diffuseFactor;t.color.fromArray(i),t.opacity=i[3]}if(void 0!==n.diffuseTexture&&a.push(s.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(s.assignTexture(t,"glossinessMap",o)),a.push(s.assignTexture(t,"specularMap",o))}return Promise.all(a)},createMaterial:function(t){var r=new T(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function x(){this.name=s.KHR_MESH_QUANTIZATION}function M(t,r,s,n){e.Interpolant.call(this,t,r,s,n)}g.prototype.decodePrimitive=function(e,t){var r=this.json,s=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,i={},o={},l={};for(var u in a){var c=N[u]||u.toLowerCase();i[c]=a[u]}for(u in e.attributes){c=N[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],h=b[p.componentType];l[c]=h,o[c]=!0===p.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t){s.decodeDracoFile(e,function(e){for(var r in e.attributes){var s=e.attributes[r],n=o[r];void 0!==n&&(s.normalized=n)}t(e)},i,l)})})},v.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},T.prototype=Object.create(e.MeshStandardMaterial.prototype),T.prototype.constructor=T,T.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},M.prototype=Object.create(e.Interpolant.prototype),M.prototype.constructor=M,M.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,n=e*s*3+s,a=0;a!==s;a++)t[a]=r[n+a];return t},M.prototype.beforeStart_=M.prototype.copySampleValue_,M.prototype.afterEnd_=M.prototype.copySampleValue_,M.prototype.interpolate_=function(e,t,r,s){for(var n=this.resultBuffer,a=this.sampleValues,i=this.valueSize,o=2*i,l=3*i,u=s-t,c=(r-t)/u,p=c*c,h=p*c,d=e*l,f=d-l,m=-2*h+3*p,g=h-p,v=1-m,T=g-p+c,y=0;y!==i;y++){var x=a[f+y+i],M=a[f+y+o]*u,S=a[d+y+i],R=a[d+y]*u;n[y]=v*x+T*M+m*S+g*R}return n};var S=0,R=1,_=2,E=3,A=4,L=5,w=6,b={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},I={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},P={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},O={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},N={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},U="OPAQUE",D="MASK",H="BLEND";function k(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}function B(e,t,r){for(var s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function G(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 j(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(r=0,s=n.length;r<s;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function K(e){for(var t="",r=Object.keys(e).sort(),s=0,n=r.length;s<n;s++)t+=r[s]+":"+e[r[s]]+";";return t}function V(t,s){this.json=t||{},this.extensions={},this.plugins={},this.options=s||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new e.ImageBitmapLoader(this.options.manager):this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function X(t,r,s){var n=r.attributes,a=[];function i(e,r){return s.getDependency("accessor",e).then(function(e){t.setAttribute(r,e)})}for(var o in n){var l=N[o]||o.toLowerCase();l in t.attributes||a.push(i(n[o],l))}if(void 0!==r.indices&&!t.index){var u=s.getDependency("accessor",r.indices).then(function(e){t.setIndex(e)});a.push(u)}return G(t,r),function(t,r,s){var n=r.attributes,a=new e.Box3;if(void 0!==n.POSITION){var i=(d=s.json.accessors[n.POSITION]).min,o=d.max;if(void 0!==i&&void 0!==o){a.set(new e.Vector3(i[0],i[1],i[2]),new e.Vector3(o[0],o[1],o[2]));var l=r.targets;if(void 0!==l){for(var u=new e.Vector3,c=new e.Vector3,p=0,h=l.length;p<h;p++){var d,f=l[p];if(void 0!==f.POSITION)i=(d=s.json.accessors[f.POSITION]).min,o=d.max,void 0!==i&&void 0!==o?(c.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),c.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),c.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}a.expandByVector(u)}t.boundingBox=a;var m=new e.Sphere;a.getCenter(m.center),m.radius=a.min.distanceTo(a.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,r,s),Promise.all(a).then(function(){return void 0!==r.targets?function(e,t,r){for(var s=!1,n=!1,a=0,i=t.length;a<i&&(void 0!==(u=t[a]).POSITION&&(s=!0),void 0!==u.NORMAL&&(n=!0),!s||!n);a++);if(!s&&!n)return Promise.resolve(e);var o=[],l=[];for(a=0,i=t.length;a<i;a++){var u=t[a];if(s){var c=void 0!==u.POSITION?r.getDependency("accessor",u.POSITION):e.attributes.position;o.push(c)}n&&(c=void 0!==u.NORMAL?r.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(c))}return Promise.all([Promise.all(o),Promise.all(l)]).then(function(t){var r=t[0],a=t[1];return s&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e})}(t,r.targets,s):t})}function q(t,r){var s=t.getIndex();if(null===s){var n=[],a=t.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var i=0;i<a.count;i++)n.push(i);t.setIndex(n),s=t.getIndex()}var o=s.count-2,l=[];if(r===e.TriangleFanDrawMode)for(i=1;i<=o;i++)l.push(s.getX(0)),l.push(s.getX(i)),l.push(s.getX(i+1));else for(i=0;i<o;i++)i%2==0?(l.push(s.getX(i)),l.push(s.getX(i+1)),l.push(s.getX(i+2))):(l.push(s.getX(i+2)),l.push(s.getX(i+1)),l.push(s.getX(i)));l.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(l),u}return V.prototype.setExtensions=function(e){this.extensions=e},V.prototype.setPlugins=function(e){this.plugins=e},V.prototype.parse=function(e,t){var r=this,s=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(t){var a={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};B(n,a,s),G(a,s),e(a)}).catch(t)},V.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],s=0,n=t.length;s<n;s++)for(var a=t[s].joints,i=0,o=a.length;i<o;i++)e[a[i]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}},V.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},V.prototype._getNodeRef=function(e,t,r){if(e.refs[t]<=1)return r;var s=r.clone();return s.name+="_instance_"+e.uses[t]++,s},V.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var s=e(t[r]);if(s)return s}},V.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var r=[],s=0;s<t.length;s++){var n=e(t[s]);n&&r.push(n)}return r},V.prototype.getDependency=function(e,t){var r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s},V.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map(function(t,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t},V.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[s.KHR_BINARY_GLTF].body);var n=this.options;return new Promise(function(e,s){r.load(k(t.uri,n.path),e,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})},V.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){var r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)})},V.prototype.loadAccessor=function(t){var r=this,s=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var a=[];return void 0!==n.bufferView?a.push(this.getDependency("bufferView",n.bufferView)):a.push(null),void 0!==n.sparse&&(a.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(a).then(function(t){var a,i,o=t[0],l=O[n.type],u=b[n.componentType],c=u.BYTES_PER_ELEMENT,p=c*l,h=n.byteOffset||0,d=void 0!==n.bufferView?s.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(d&&d!==p){var m=Math.floor(h/d),g="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=r.cache.get(g);v||(a=new u(o,m*d,n.count*d/c),v=new e.InterleavedBuffer(a,d/c),r.cache.add(g,v)),i=new e.InterleavedBufferAttribute(v,l,h%d/c,f)}else a=null===o?new u(n.count*l):new u(o,h,n.count*l),i=new e.BufferAttribute(a,l,f);if(void 0!==n.sparse){var T=O.SCALAR,y=b[n.sparse.indices.componentType],x=n.sparse.indices.byteOffset||0,M=n.sparse.values.byteOffset||0,S=new y(t[1],x,n.sparse.count*T),R=new u(t[2],M,n.sparse.count*l);null!==o&&(i=new e.BufferAttribute(i.array.slice(),i.itemSize,i.normalized));for(var _=0,E=S.length;_<E;_++){var A=S[_];if(i.setX(A,R[_*l]),l>=2&&i.setY(A,R[_*l+1]),l>=3&&i.setZ(A,R[_*l+2]),l>=4&&i.setW(A,R[_*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})},V.prototype.loadTexture=function(e){var t,r,n=this.json,a=this.options,i=n.textures[e],o=i.extensions||{};return(t=o[s.MSFT_TEXTURE_DDS]?n.images[o[s.MSFT_TEXTURE_DDS].source]:n.images[i.source]).uri&&(r=a.manager.getHandler(t.uri)),r||(r=o[s.MSFT_TEXTURE_DDS]?this.extensions[s.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,r)},V.prototype.loadTextureImage=function(t,r,s){var n=this,a=this.json,i=this.options,o=a.textures[t],l=self.URL||self.webkitURL,u=r.uri,c=!1,p=!0;return"image/jpeg"===r.mimeType&&(p=!1),void 0!==r.bufferView&&(u=n.getDependency("bufferView",r.bufferView).then(function(e){if("image/png"===r.mimeType){var t=new DataView(e,25,1).getUint8(0,!1);p=6===t||4===t||3===t}c=!0;var s=new Blob([e],{type:r.mimeType});return u=l.createObjectURL(s)})),Promise.resolve(u).then(function(t){return new Promise(function(r,n){var a=r;!0===s.isImageBitmapLoader&&(a=function(t){r(new e.CanvasTexture(t))}),s.load(k(t,i.path),a,void 0,n)})}).then(function(r){!0===c&&l.revokeObjectURL(u),r.flipY=!1,o.name&&(r.name=o.name),p||(r.format=e.RGBFormat);var s=(a.samplers||{})[o.sampler]||{};return r.magFilter=I[s.magFilter]||e.LinearFilter,r.minFilter=I[s.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=P[s.wrapS]||e.RepeatWrapping,r.wrapT=P[s.wrapT]||e.RepeatWrapping,n.associations.set(r,{type:"textures",index:t}),r})},V.prototype.assignTexture=function(e,t,r){var n=this;return this.getDependency("texture",r.index).then(function(a){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[s.KHR_TEXTURE_TRANSFORM]){var i=void 0!==r.extensions?r.extensions[s.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var o=n.associations.get(a);a=n.extensions[s.KHR_TEXTURE_TRANSFORM].extendTexture(a,i),n.associations.set(a,o)}}e[t]=a})},V.prototype.assignFinalMaterial=function(t){var r=t.geometry,s=t.material,n=void 0!==r.attributes.tangent,a=void 0!==r.attributes.color,i=void 0===r.attributes.normal,o=!0===t.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,u=l&&void 0!==r.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+s.uuid,p=this.cache.get(c);p||(p=new e.PointsMaterial,e.Material.prototype.copy.call(p,s),p.color.copy(s.color),p.map=s.map,p.sizeAttenuation=!1,this.cache.add(c,p)),s=p}else if(t.isLine){c="LineBasicMaterial:"+s.uuid;var h=this.cache.get(c);h||(h=new e.LineBasicMaterial,e.Material.prototype.copy.call(h,s),h.color.copy(s.color),this.cache.add(c,h)),s=h}if(n||a||i||o||l){c="ClonedMaterial:"+s.uuid+":";s.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),o&&(c+="skinning:"),n&&(c+="vertex-tangents:"),a&&(c+="vertex-colors:"),i&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=s.clone(),o&&(d.skinning=!0),a&&(d.vertexColors=!0),i&&(d.flatShading=!0),l&&(d.morphTargets=!0),u&&(d.morphNormals=!0),n&&(d.vertexTangents=!0,d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(c,d),this.associations.set(d,this.associations.get(s))),s=d}s.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),t.material=s},V.prototype.getMaterialType=function(){return e.MeshStandardMaterial},V.prototype.loadMaterial=function(t){var r,n=this,a=this.json,i=this.extensions,o=a.materials[t],l={},u=o.extensions||{},c=[];if(u[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var p=i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=p.getMaterialType(),c.push(p.extendParams(l,o,n))}else if(u[s.KHR_MATERIALS_UNLIT]){var h=i[s.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),c.push(h.extendParams(l,o,n))}else{var d=o.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(d.baseColorFactor)){var f=d.baseColorFactor;l.color.fromArray(f),l.opacity=f[3]}void 0!==d.baseColorTexture&&c.push(n.assignTexture(l,"map",d.baseColorTexture)),l.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,l.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(n.assignTexture(l,"metalnessMap",d.metallicRoughnessTexture)),c.push(n.assignTexture(l,"roughnessMap",d.metallicRoughnessTexture))),r=this._invokeOne(function(e){return e.getMaterialType&&e.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,l)})))}!0===o.doubleSided&&(l.side=e.DoubleSide);var m=o.alphaMode||U;return m===H?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===D&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new e.Vector2(1,-1),void 0!==o.normalTexture.scale&&l.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&r!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&r!==e.MeshBasicMaterial&&c.push(n.assignTexture(l,"emissiveMap",o.emissiveTexture)),Promise.all(c).then(function(){var a;return a=r===T?i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),o.name&&(a.name=o.name),a.map&&(a.map.encoding=e.sRGBEncoding),a.emissiveMap&&(a.emissiveMap.encoding=e.sRGBEncoding),G(a,o),n.associations.set(a,{type:"materials",index:t}),o.extensions&&B(i,a,o),a})},V.prototype.createUniqueName=function(t){for(var r=e.PropertyBinding.sanitizeNodeName(t||""),s=r,n=1;this.nodeNamesUsed[s];++n)s=r+"_"+n;return this.nodeNamesUsed[s]=!0,s},V.prototype.loadGeometries=function(t){var r=this,n=this.extensions,a=this.primitiveCache;function i(e){return n[s.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then(function(t){return X(t,e,r)})}for(var o,l,u=[],c=0,p=t.length;c<p;c++){var h,d=t[c],f=(l=void 0,(l=(o=d).extensions&&o.extensions[s.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+K(l.attributes):o.indices+":"+K(o.attributes)+":"+o.mode),m=a[f];if(m)u.push(m.promise);else h=d.extensions&&d.extensions[s.KHR_DRACO_MESH_COMPRESSION]?i(d):X(new e.BufferGeometry,d,r),a[f]={primitive:d,promise:h},u.push(h)}return Promise.all(u)},V.prototype.loadMesh=function(t){for(var r,s=this,n=this.json,a=this.extensions,i=n.meshes[t],o=i.primitives,l=[],u=0,c=o.length;u<c;u++){var p=void 0===o[u].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),r.DefaultMaterial):this.getDependency("material",o[u].material);l.push(p)}return l.push(s.loadGeometries(o)),Promise.all(l).then(function(r){for(var n=r.slice(0,r.length-1),l=r[r.length-1],u=[],c=0,p=l.length;c<p;c++){var h,d=l[c],f=o[c],m=n[c];if(f.mode===A||f.mode===L||f.mode===w||void 0===f.mode)h=!0===i.isSkinnedMesh?new e.SkinnedMesh(d,m):new e.Mesh(d,m),!0===m.isMeshStandardMaterial&&m.side===e.DoubleSide&&null!==d.getIndex()&&!0===d.hasAttribute("position")&&!0===d.hasAttribute("normal")&&!0===d.hasAttribute("uv")&&!1===d.hasAttribute("tangent")&&(d.computeTangents(),m.vertexTangents=!0),!0!==h.isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),f.mode===L?h.geometry=q(h.geometry,e.TriangleStripDrawMode):f.mode===w&&(h.geometry=q(h.geometry,e.TriangleFanDrawMode));else if(f.mode===R)h=new e.LineSegments(d,m);else if(f.mode===E)h=new e.Line(d,m);else if(f.mode===_)h=new e.LineLoop(d,m);else{if(f.mode!==S)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);h=new e.Points(d,m)}Object.keys(h.geometry.morphAttributes).length>0&&j(h,i),h.name=s.createUniqueName(i.name||"mesh_"+t),G(h,i),f.extensions&&B(a,h,f),s.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var g=new e.Group;for(c=0,p=u.length;c<p;c++)g.add(u[c]);return g})},V.prototype.loadCamera=function(t){var r,s=this.json.cameras[t],n=s[s.type];if(n)return"perspective"===s.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===s.type&&(r=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(r.name=this.createUniqueName(s.name)),G(r,s),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},V.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return r.inverseBindMatrices=e,r})},V.prototype.loadAnimation=function(t){for(var r=this.json.animations[t],s=[],n=[],a=[],i=[],o=[],l=0,u=r.channels.length;l<u;l++){var c=r.channels[l],p=r.samplers[c.sampler],h=c.target,d=void 0!==h.node?h.node:h.id,f=void 0!==r.parameters?r.parameters[p.input]:p.input,m=void 0!==r.parameters?r.parameters[p.output]:p.output;s.push(this.getDependency("node",d)),n.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",m)),i.push(p),o.push(h)}return Promise.all([Promise.all(s),Promise.all(n),Promise.all(a),Promise.all(i),Promise.all(o)]).then(function(s){for(var n=s[0],a=s[1],i=s[2],o=s[3],l=s[4],u=[],c=0,p=n.length;c<p;c++){var h=n[c],d=a[c],f=i[c],m=o[c],g=l[c];if(void 0!==h){var v;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,C[g.path]){case C.weights:v=e.NumberKeyframeTrack;break;case C.rotation:v=e.QuaternionKeyframeTrack;break;case C.position:case C.scale:default:v=e.VectorKeyframeTrack}var T=h.name?h.name:h.uuid,y=void 0!==m.interpolation?F[m.interpolation]:e.InterpolateLinear,x=[];C[g.path]===C.weights?h.traverse(function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)}):x.push(T);var S=f.array;if(f.normalized){var R;if(S.constructor===Int8Array)R=1/127;else if(S.constructor===Uint8Array)R=1/255;else if(S.constructor==Int16Array)R=1/32767;else{if(S.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");R=1/65535}for(var _=new Float32Array(S.length),E=0,A=S.length;E<A;E++)_[E]=S[E]*R;S=_}for(E=0,A=x.length;E<A;E++){var L=new v(x[E]+"."+C[g.path],d.array,S,y);"CUBICSPLINE"===m.interpolation&&(L.createInterpolant=function(e){return new M(this.times,this.values,this.getValueSize()/3,e)},L.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(L)}}}var w=r.name?r.name:"animation_"+t;return new e.AnimationClip(w,void 0,u)})},V.prototype.loadNode=function(t){var r,s=this.json,n=this.extensions,a=this,i=s.nodes[t],o=i.name?a.createUniqueName(i.name):"";return(r=[],void 0!==i.mesh&&r.push(a.getDependency("mesh",i.mesh).then(function(e){var t=a._getNodeRef(a.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(var t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})),void 0!==i.camera&&r.push(a.getDependency("camera",i.camera).then(function(e){return a._getNodeRef(a.cameraCache,i.camera,e)})),a._invokeAll(function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)}).forEach(function(e){r.push(e)}),Promise.all(r)).then(function(r){var s;if((s=!0===i.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var l=0,u=r.length;l<u;l++)s.add(r[l]);if(i.name&&(s.userData.name=i.name,s.name=o),G(s,i),i.extensions&&B(n,s,i),void 0!==i.matrix){var c=new e.Matrix4;c.fromArray(i.matrix),s.applyMatrix4(c)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);return a.associations.set(s,{type:"nodes",index:t}),s})},V.prototype.loadScene=function(){function t(r,s,n,a){var i=n.nodes[r];return a.getDependency("node",r).then(function(t){return void 0===i.skin?t:a.getDependency("skin",i.skin).then(function(e){for(var t=[],s=0,n=(r=e).joints.length;s<n;s++)t.push(a.getDependency("node",r.joints[s]));return Promise.all(t)}).then(function(s){return t.traverse(function(t){if(t.isMesh){for(var n=[],a=[],i=0,o=s.length;i<o;i++){var l=s[i];if(l){n.push(l);var u=new e.Matrix4;void 0!==r.inverseBindMatrices&&u.fromArray(r.inverseBindMatrices.array,16*i),a.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[i])}t.bind(new e.Skeleton(n,a),t.matrixWorld)}}),t});var r}).then(function(e){s.add(e);var r=[];if(i.children)for(var o=i.children,l=0,u=o.length;l<u;l++){var c=o[l];r.push(t(c,e,n,a))}return Promise.all(r)})}return function(r){var s=this.json,n=this.extensions,a=this.json.scenes[r],i=new e.Group;a.name&&(i.name=this.createUniqueName(a.name)),G(i,a),a.extensions&&B(n,i,a);for(var o=a.nodes||[],l=[],u=0,c=o.length;u<c;u++)l.push(t(o[u],i,s,this));return Promise.all(l).then(function(){return i})}}(),t}();exports.GLTFLoader=t;
  28. },{"../../../build/three.module.js":"dKqR"}],"rU0W":[function(require,module,exports) {
  29. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.B3DMLoader=void 0;var e=require("../base/B3DMLoaderBase.js"),t=require("three"),r=require("three/examples/jsm/loaders/GLTFLoader.js");function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function i(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=l(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function l(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(n){function a(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return o(this,a),(e=i(this,s(a).call(this))).manager=r,e}return p(a,e.B3DMLoaderBase),u(a,[{key:"parse",value:function(e){var t=this,n=f(s(a.prototype),"parse",this).call(this,e),o=n.glbBytes.slice().buffer;return new Promise(function(e,a){var u=t.manager;(u.getHandler("path.gltf")||new r.GLTFLoader(u)).parse(o,null,function(t){var r=n.batchTable,o=n.featureTable,a=t.scene,u=o.getData("RTC_CENTER");u&&(a.position.x+=u[0],a.position.y+=u[1],a.position.z+=u[2]),t.batchTable=r,t.featureTable=o,a.batchTable=r,a.featureTable=o,e(t)},a)})}}]),a}();exports.B3DMLoader=y;
  30. },{"../base/B3DMLoaderBase.js":"DNWc","three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0"}],"RlAR":[function(require,module,exports) {
  31. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PNTSLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}var a=function(){function r(){t(this,r),this.fetchOptions={}}return n(r,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(e){return t.parse(e)})}},{key:"parse",value:function(t){var r=new DataView(t),n=String.fromCharCode(r.getUint8(0))+String.fromCharCode(r.getUint8(1))+String.fromCharCode(r.getUint8(2))+String.fromCharCode(r.getUint8(3));console.assert("pnts"===n);var a=r.getUint32(4,!0);console.assert(1===a);var o=r.getUint32(8,!0);console.assert(o===t.byteLength);var i=r.getUint32(12,!0),s=r.getUint32(16,!0),u=r.getUint32(20,!0),c=r.getUint32(24,!0),f=t.slice(28,28+i+s),l=new e.FeatureTable(f,0,i,s),h=28+i+s,g=t.slice(h,h+u+c),v=new e.BatchTable(g,l.getData("BATCH_LENGTH")||l.getData("POINTS_LENGTH"),0,u,c);return{version:a,featureTable:l,batchTable:v}}}]),r}();exports.PNTSLoaderBase=a;
  32. },{"../utilities/FeatureTable.js":"ON7I"}],"Pr3e":[function(require,module,exports) {
  33. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PNTSLoader=void 0;var e=require("../base/PNTSLoaderBase.js"),t=require("three");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,r){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=f(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(r){function o(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return n(this,o),(e=a(this,l(o).call(this))).manager=r,e}return s(o,e.PNTSLoaderBase),u(o,[{key:"parse",value:function(e){var r=c(l(o.prototype),"parse",this).call(this,e),n=r.featureTable,u=n.getData("POINTS_LENGTH"),a=n.getData("POSITION",u,"FLOAT","VEC3"),i=n.getData("RGB",u,"UNSIGNED_BYTE","VEC3");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach(function(e){e in n.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))});var f=new t.BufferGeometry;f.setAttribute("position",new t.BufferAttribute(a,3,!1));var s=new t.PointsMaterial;s.size=2,s.sizeAttenuation=!1,null!==i&&(f.setAttribute("color",new t.BufferAttribute(i,3,!0)),s.vertexColors=!0);var p=new t.Points(f,s);return r.scene=p,r.scene.featureTable=n,r}}]),o}();exports.PNTSLoader=b;
  34. },{"../base/PNTSLoaderBase.js":"RlAR","three":"dKqR"}],"qWWH":[function(require,module,exports) {
  35. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.I3DMLoaderBase=void 0;var t=require("../utilities/FeatureTable.js"),e=require("../utilities/arrayToString.js");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}var i=function(){function n(){r(this,n),this.fetchOptions={},this.workingPath=""}return a(n,[{key:"resolveExternalURL",value:function(t){return this.workingPath+"/"+t}},{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then(function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()}).then(function(r){if(""===e.workingPath){var n=t.split(/\\\//g);n.pop(),e.workingPath=n.join("/")}return e.parse(r)})}},{key:"parse",value:function(r){var n=new DataView(r),a=String.fromCharCode(n.getUint8(0))+String.fromCharCode(n.getUint8(1))+String.fromCharCode(n.getUint8(2))+String.fromCharCode(n.getUint8(3));console.assert("i3dm"===a);var i=n.getUint32(4,!0);console.assert(1===i);var o=n.getUint32(8,!0);console.assert(o===r.byteLength);var s=n.getUint32(12,!0),u=n.getUint32(16,!0),c=n.getUint32(20,!0),l=n.getUint32(24,!0),f=n.getUint32(28,!0),h=r.slice(32,32+s+u),g=new t.FeatureTable(h,0,s,u),v=32+s+u,w=r.slice(v,v+c+l),d=new t.BatchTable(w,g.getData("INSTANCES_LENGTH"),0,c,l),p=v+c+l,y=new Uint8Array(r,p,o-p),U=null,b=null;if(f)U=y,b=Promise.resolve();else{var T=this.resolveExternalURL((0,e.arrayToString)(y));b=fetch(T,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(T,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(t){U=new Uint8Array(t)})}return b.then(function(){return{version:i,featureTable:g,batchTable:d,glbBytes:U}})}}]),n}();exports.I3DMLoaderBase=i;
  36. },{"../utilities/FeatureTable.js":"ON7I","../utilities/arrayToString.js":"M3Ed"}],"iNV5":[function(require,module,exports) {
  37. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.I3DMLoader=void 0;var e=require("../base/I3DMLoaderBase.js"),t=require("three"),r=require("three/examples/jsm/loaders/GLTFLoader.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function c(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?u(e):t}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t,r){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=l(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function l(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=new t.Vector3,O=new t.Vector3,h=new t.Vector3,T=new t.Vector3,v=new t.Quaternion,d=new t.Vector3,L=new t.Matrix4,g=function(o){function a(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return n(this,a),(e=c(this,f(a).call(this))).manager=r,e}return p(a,e.I3DMLoaderBase),i(a,[{key:"resolveExternalURL",value:function(e){return this.manager.resolveURL(s(f(a.prototype),"resolveExternalURL",this).call(this,e))}},{key:"parse",value:function(e){var o=this;return s(f(a.prototype),"parse",this).call(this,e).then(function(e){var n=e.featureTable,a=e.batchTable,i=e.glbBytes.slice().buffer;return new Promise(function(e,c){var u=o.manager;(u.getHandler("path.gltf")||new r.GLTFLoader(u)).parse(i,null,function(r){var o=n.getData("INSTANCES_LENGTH"),i=n.getData("POSITION",o,"FLOAT","VEC3"),c=n.getData("NORMAL_UP",o,"FLOAT","VEC3"),u=n.getData("NORMAL_RIGHT",o,"FLOAT","VEC3"),s=n.getData("SCALE_NON_UNIFORM",o,"FLOAT","VEC3"),l=n.getData("SCALE",o,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach(function(e){e in n.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))});var f=new Map,p=[];r.scene.traverse(function(e){if(e.isMesh){var r=e.geometry,n=e.material,a=new t.InstancedMesh(r,n,o);a.position.copy(e.position),a.rotation.copy(e.rotation),a.scale.copy(e.scale),p.push(a),f.set(e,a)}});for(var y=new t.Vector3,g=0;g<o;g++)y.x+=i[3*g+0]/o,y.y+=i[3*g+1]/o,y.z+=i[3*g+2]/o;f.forEach(function(e,t){var r=t.parent;r&&(r.remove(t),r.add(e),e.updateMatrixWorld(),e.position.copy(y).applyMatrix4(e.matrixWorld))});for(var _=0;_<o;_++){T.set(i[3*_+0]-y.x,i[3*_+1]-y.y,i[3*_+2]-y.z),c?(O.set(c[3*_+0],c[3*_+1],c[3*_+2]),h.set(u[3*_+0],u[3*_+1],u[3*_+2]),b.crossVectors(h,O).normalize(),L.makeBasis(h,O,b),v.setFromRotationMatrix(L)):v.set(0,0,0,1),l?d.setScalar(l[_]):s?d.set(s[3*_+0],s[3*_+1],s[3*_+2]):d.set(1,1,1),L.compose(T,v,d);for(var E=0,m=p.length;E<m;E++){p[E].setMatrixAt(_,L)}}r.batchTable=a,r.featureTable=n,r.scene.batchTable=a,r.scene.featureTable=n,e(r)},c)})})}}]),a}();exports.I3DMLoader=g;
  38. },{"../base/I3DMLoaderBase.js":"qWWH","three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0"}],"c0Qu":[function(require,module,exports) {
  39. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.CMPTLoaderBase=void 0;var n=function(){function t(){e(this,t),this.fetchOptions={},this.workingPath=""}return r(t,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(r){if(""===t.workingPath){var n=e.split(/\\\//g);n.pop(),t.workingPath=n.join("/")}return t.parse(r)})}},{key:"parse",value:function(e){var t=new DataView(e),r=String.fromCharCode(t.getUint8(0))+String.fromCharCode(t.getUint8(1))+String.fromCharCode(t.getUint8(2))+String.fromCharCode(t.getUint8(3));console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=t.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var o=t.getUint32(8,!0);console.assert(o===e.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var i=t.getUint32(12,!0),a=[],s=16,f=0;f<i;f++){var h=new DataView(e,s,12),c=String.fromCharCode(h.getUint8(0))+String.fromCharCode(h.getUint8(1))+String.fromCharCode(h.getUint8(2))+String.fromCharCode(h.getUint8(3)),u=h.getUint32(4,!0),g=h.getUint32(8,!0),l=new Uint8Array(e,s,g);a.push({type:c,buffer:l,version:u}),s+=g}return{version:n,tiles:a}}}]),t}();exports.CMPTLoaderBase=n;
  40. },{}],"hwVX":[function(require,module,exports) {
  41. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CMPTLoader=void 0;var e=require("three"),r=require("../base/CMPTLoaderBase.js"),t=require("./B3DMLoader.js"),n=require("./PNTSLoader.js"),o=require("./I3DMLoader.js");function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&u(e.prototype,r),t&&u(e,t),e}function f(e,r){return!r||"object"!==i(r)&&"function"!=typeof r?s(e):r}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,r,t){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=p(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function p(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=b(e)););return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&h(e,r)}function h(e,r){return(h=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}var d=function(i){function u(){var r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DefaultLoadingManager;return a(this,u),(r=f(this,b(u).call(this))).manager=t,r}return y(u,r.CMPTLoaderBase),c(u,[{key:"parse",value:function(r){var i=l(b(u.prototype),"parse",this).call(this,r),a=this.manager,c=[];for(var f in i.tiles){var s=i.tiles[f],p=s.type,y=s.buffer;switch(p){case"b3dm":var h=y.slice(),d=new t.B3DMLoader(a).parse(h.buffer);c.push(d);break;case"pnts":var v=y.slice(),P=new n.PNTSLoader(a).parse(v.buffer),g=Promise.resolve(P);c.push(g);break;case"i3dm":var w=y.slice(),O=new o.I3DMLoader(a);O.workingPath=this.workingPath,O.fetchOptions=this.fetchOptions;var m=O.parse(w.buffer);c.push(m)}}return Promise.all(c).then(function(r){var t=new e.Group;return r.forEach(function(e){t.add(e.scene)}),{tiles:r,scene:t}})}}]),u}();exports.CMPTLoader=d;
  42. },{"three":"dKqR","../base/CMPTLoaderBase.js":"c0Qu","./B3DMLoader.js":"rU0W","./PNTSLoader.js":"Pr3e","./I3DMLoader.js":"iNV5"}],"tTab":[function(require,module,exports) {
  43. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesGroup=void 0;var t=require("three");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function n(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),t}function i(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?u(t):r}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var s=new t.Matrix4,f=function(e){function o(t){var e;return r(this,o),(e=i(this,a(o).call(this))).tilesRenderer=t,e}return c(o,t.Group),n(o,[{key:"raycast",value:function(t,e){this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?s.copy(this.matrix):s.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=s.elements,r=this.matrixWorld.elements,o=!1,n=0;n<16;n++){var i=e[n],u=r[n];if(Math.abs(i-u)>Number.EPSILON){o=!0;break}}if(o){this.matrixWorld.copy(s);for(var a=this.children,c=0,l=a.length;c<l;c++)a[c].updateMatrixWorld()}}}}]),o}();exports.TilesGroup=f;
  44. },{"three":"dKqR"}],"Hcez":[function(require,module,exports) {
  45. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.raycastTraverseFirstHit=l,exports.raycastTraverse=h;var e=require("three"),r=new e.Sphere,t=new e.Matrix4,a=new e.Vector3,n=new e.Vector3,i=new e.Ray,s=[];function c(e,r){return e.distance-r.distance}function o(e,r,t){e.traverse(function(e){Object.getPrototypeOf(e).raycast.call(e,r,t)})}function l(e,h,p,u){if(p.has(e)){if(o(e.cached.scene,u,s),s.length>0){s.length>1&&s.sort(c);var y=s[0];return s.length=0,y}return null}for(var f=[],v=e.children,d=0,x=v.length;d<x;d++){var g=v[d],m=g.cached,M=h.matrixWorld;t.copy(M);var b=m.sphere;if(!b||(r.copy(b),r.applyMatrix4(t),u.ray.intersectsSphere(r))){var w=m.box,T=m.boxTransform;if(w){if(t.multiply(T).invert(),i.copy(u.ray),i.applyMatrix4(t),!i.intersectBox(w,a))continue;var S;n.setFromMatrixScale(t),S=n.x,Math.abs(Math.max(n.x-n.y,n.x-n.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");var O={distance:1/0,tile:null};f.push(O),O.distance=a.distanceToSquared(i.origin)*S*S,O.tile=g}}}f.sort(c);for(var j=1/0,q=null,B=0,F=f.length;B<F;B++){var P=f[B];if(P.distance>j)break;var R=P.tile,V=R.cached.scene,W=null;if(p.has(R)?(o(V,u,s),s.length>0&&(s.length>1&&s.sort(c),W=s[0])):W=l(R,h,p,u),W){var _=W.distance*W.distance;_<j&&(j=_,q=W),s.length=0}}return q}function h(e,a,n,s,c){var l=e.cached,p=a.matrixWorld;t.copy(p);var u=l.sphere;if(!u||(r.copy(u),r.applyMatrix4(t),s.ray.intersectsSphere(r))){var y=l.box,f=l.boxTransform;if(!y||(t.multiply(f).invert(),i.copy(s.ray).applyMatrix4(t),i.intersectsBox(y))){var v=l.scene;if(n.has(e))o(v,s,c);else for(var d=e.children,x=0,g=d.length;x<g;x++)h(d[x],a,n,s,c)}}}
  46. },{"three":"dKqR"}],"wXIB":[function(require,module,exports) {
  47. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesRenderer=void 0;var e=require("../base/TilesRendererBase.js"),r=require("./B3DMLoader.js"),t=require("./PNTSLoader.js"),n=require("./I3DMLoader.js"),o=require("./CMPTLoader.js"),a=require("./TilesGroup.js"),i=require("three"),s=require("./raycastTraverse.js");function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function c(e,r){return!r||"object"!==l(r)&&"function"!=typeof r?p(e):r}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,r,t){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=x(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function h(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,r,t){return r&&h(e.prototype,r),t&&h(e,t),e}function m(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&v(e,r)}function v(e,r){return(v=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function y(e,r,t,n){return(y="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,n){var o,a=x(e,r);if(a){if((o=Object.getOwnPropertyDescriptor(a,r)).set)return o.set.call(n,t),!0;if(!o.writable)return!1}if(o=Object.getOwnPropertyDescriptor(n,r)){if(!o.writable)return!1;o.value=t,Object.defineProperty(n,r,o)}else b(n,r,t);return!0})(e,r,t,n)}function g(e,r,t,n,o){if(!y(e,r,t,n||e)&&o)throw new Error("failed to set property");return t}function b(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function x(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=w(e)););return e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var T=Symbol("INITIAL_FRUSTUM_CULLED"),M=i.Math.DEG2RAD,R=new i.Matrix4,S=new i.Matrix4,k=new i.Vector3,O=new i.Vector3,P=new i.Vector3,j=new i.Vector3,L=new i.Vector3(1,0,0),D=new i.Vector3(0,1,0);function I(){}function _(e,r){e.traverse(function(e){e.frustumCulled=e[T]&&r})}var C=function(l){function h(){var e,r;u(this,h);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(r=c(this,(e=w(h)).call.apply(e,[this].concat(n)))).group=new a.TilesGroup(p(r)),r.cameras=[],r.cameraMap=new Map,r.cameraInfo=[],r.activeTiles=new Set,r.visibleTiles=new Set,r._autoDisableRendererCulling=!0,r.onLoadTileSet=null,r.onLoadModel=null,r.onDisposeModel=null;var s=new i.LoadingManager;return s.setURLModifier(function(e){return r.preprocessURL?r.preprocessURL(e):e}),r.manager=s,r}return m(h,e.TilesRendererBase),d(h,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(e){this._autoDisableRendererCulling!==e&&(g(w(h.prototype),"_autoDisableRendererCulling",e,this,!0),this.traverse(function(r){r.scene&&_(r.scene,e)}))}}]),d(h,[{key:"getBounds",value:function(e){if(!this.root)return!1;var r=this.root.cached,t=r.box,n=r.boxTransform;return!!t&&(e.copy(t),e.applyMatrix4(n),!0)}},{key:"getOrientedBounds",value:function(e,r){if(!this.root)return!1;var t=this.root.cached,n=t.box,o=t.boxTransform;return!!e&&(e.copy(n),r.copy(o),!0)}},{key:"forEachLoadedModel",value:function(e){this.traverse(function(r){var t=r.cached.scene;t&&e(t,r)})}},{key:"raycast",value:function(e,r){if(this.root)if(e.firstHitOnly){var t=(0,s.raycastTraverseFirstHit)(this.root,this.group,this.activeTiles,e);t&&r.push(t)}else(0,s.raycastTraverse)(this.root,this.group,this.activeTiles,e,r)}},{key:"hasCamera",value:function(e){return this.cameraMap.has(e)}},{key:"setCamera",value:function(e){var r=this.cameras,t=this.cameraMap;return!t.has(e)&&(t.set(e,new i.Vector2),r.push(e),!0)}},{key:"setResolution",value:function(e,r,t){var n=this.cameraMap;return!!n.has(e)&&(r instanceof i.Vector2?n.get(e).copy(r):n.get(e).set(r,t),!0)}},{key:"setResolutionFromRenderer",value:function(e,r){var t=this.cameraMap;if(!t.has(e))return!1;var n=t.get(e);return r.getSize(n),n.multiplyScalar(r.getPixelRatio()),!0}},{key:"deleteCamera",value:function(e){var r=this.cameras,t=this.cameraMap;if(t.has(e)){var n=r.indexOf(e);return r.splice(n,1),t.delete(e),!0}return!1}},{key:"fetchTileSet",value:function(e){for(var r,t=this,n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];var i=(r=f(w(h.prototype),"fetchTileSet",this)).call.apply(r,[this,e].concat(o));return i.then(function(r){t.onLoadTileSet&&Promise.resolve().then(function(){t.onLoadTileSet(r,e)})}),i}},{key:"update",value:function(){var e=this.group,r=this.cameras,t=this.cameraMap,n=this.cameraInfo;if(0!==r.length){for(;n.length>r.length;)n.pop();for(;n.length<r.length;)n.push({frustum:new i.Frustum,sseDenominator:-1,position:new i.Vector3,invScale:-1,pixelSize:0});var o;S.copy(e.matrixWorld).invert(),k.setFromMatrixScale(S),o=k.x,Math.abs(Math.max(k.x-k.y,k.x-k.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var a=0,s=n.length;a<s;a++){var l=r[a],u=n[a],c=u.frustum,p=u.position,d=t.get(l);if(0!==d.width&&0!==d.height||console.warn("TilesRenderer: resolution for camera error calculation is not set."),l.isPerspectiveCamera&&(u.sseDenominator=2*Math.tan(.5*l.fov*M)/d.height),l.isOrthographicCamera){var m=l.right-l.left,v=l.top-l.bottom;u.pixelSize=Math.max(v/d.height,m/d.width)}u.invScale=o,R.copy(e.matrixWorld),R.premultiply(l.matrixWorldInverse),R.premultiply(l.projectionMatrix),c.setFromProjectionMatrix(R),p.set(0,0,0),p.applyMatrix4(l.matrixWorld),p.applyMatrix4(S)}f(w(h.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(e,r,t){f(w(h.prototype),"preprocessNode",this).call(this,e,r,t);var n=new i.Matrix4;if(e.transform)for(var o=e.transform,a=0;a<16;a++)n.elements[a]=o[a];else n.identity();r&&n.premultiply(r.cached.transform);var s=null,l=null,u=null;if("box"in e.boundingVolume){var c=e.boundingVolume.box;s=new i.Box3,l=new i.Matrix4,u=new i.Matrix4,O.set(c[3],c[4],c[5]),P.set(c[6],c[7],c[8]),j.set(c[9],c[10],c[11]);var p=O.length(),d=P.length(),m=j.length();O.normalize(),P.normalize(),j.normalize(),l.set(O.x,P.x,j.x,c[0],O.y,P.y,j.y,c[1],O.z,P.z,j.z,c[2],0,0,0,1),l.premultiply(n),u.copy(l).invert(),s.min.set(-p,-d,-m),s.max.set(p,d,m)}var v=null;if("sphere"in e.boundingVolume){var y=e.boundingVolume.sphere;(v=new i.Sphere).center.set(y[0],y[1],y[2]),v.radius=y[3],v.applyMatrix4(n)}else if("box"in e.boundingVolume){var g=e.boundingVolume.box;v=new i.Sphere,s.getBoundingSphere(v),v.center.set(g[0],g[1],g[2]),v.applyMatrix4(n)}"region"in e.boundingVolume&&console.warn("ThreeTilesRenderer: region bounding volume not supported."),e.cached={loadIndex:0,transform:n,active:!1,inFrustum:[],box:s,boxTransform:l,boxTransformInverse:u,sphere:v,region:null,scene:null,geometry:null,material:null,distance:1/0}}},{key:"parseTile",value:function(e,a,i){var s=this;a._loadIndex=a._loadIndex||0,a._loadIndex++;var l=a.content.uri.split(/[\\\/]/g);l.pop();var u=l.join("/"),c=this.fetchOptions,p=this.manager,f=a._loadIndex,h=null;switch(i){case"b3dm":h=new r.B3DMLoader(p).parse(e).then(function(e){return e.scene});break;case"pnts":h=Promise.resolve(new t.PNTSLoader(p).parse(e).scene);break;case"i3dm":var d=new n.I3DMLoader(p);d.workingPath=u,d.fetchOptions=c,h=d.parse(e).then(function(e){return e.scene});break;case"cmpt":var m=new o.CMPTLoader(p);m.workingPath=u,m.fetchOptions=c,h=m.parse(e).then(function(e){return e.scene});break;default:console.warn('TilesRenderer: Content type "'.concat(i,'" not supported.')),h=Promise.resolve(null)}return h.then(function(e){if(a._loadIndex===f){var r=s.rootTileSet.asset&&s.rootTileSet.asset.gltfUpAxis||"y",t=a.cached,n=t.transform;switch(r.toLowerCase()){case"x":e.matrix.makeRotationAxis(D,-Math.PI/2);break;case"y":e.matrix.makeRotationAxis(L,Math.PI/2)}e.matrix.premultiply(n),e.matrix.decompose(e.position,e.quaternion,e.scale),e.traverse(function(e){e[T]=e.frustumCulled}),_(e,s.autoDisableRendererCulling),t.scene=e,e.traverse(function(e){e.raycast=I});var o=[],i=[],l=[];e.traverse(function(e){if(e.geometry&&i.push(e.geometry),e.material){var r=e.material;for(var t in o.push(e.material),r){var n=r[t];n&&n.isTexture&&l.push(n)}}}),t.materials=o,t.geometry=i,t.textures=l,s.onLoadModel&&s.onLoadModel(e,a)}})}},{key:"disposeTile",value:function(e){var r=e.cached;if(r.scene){for(var t=r.materials,n=r.geometry,o=r.textures,a=0,i=n.length;a<i;a++)n[a].dispose();for(var s=0,l=t.length;s<l;s++)t[s].dispose();for(var u=0,c=o.length;u<c;u++){o[u].dispose()}this.onDisposeModel&&this.onDisposeModel(r.scene,e),r.scene=null,r.materials=null,r.textures=null,r.geometry=null}e._loadIndex++}},{key:"setTileVisible",value:function(e,r){var t=e.cached.scene,n=this.visibleTiles,o=this.group;r?(o.add(t),n.add(e),t.updateMatrixWorld(!0)):(o.remove(t),n.delete(e))}},{key:"setTileActive",value:function(e,r){var t=this.activeTiles;r?t.add(e):t.delete(e)}},{key:"calculateError",value:function(e){if(0===e.geometricError)return 0;var r=e.cached,t=r.inFrustum,n=this.cameras,o=this.cameraInfo,a=e.boundingVolume;if("box"in a){for(var i=r.box,s=r.boxTransformInverse,l=-1/0,u=1/0,c=0,p=n.length;c<p;c++)if(t[c]){var f=n[c],h=o[c],d=h.invScale;k.copy(h.position),k.applyMatrix4(s);var m=void 0;if(f.isOrthographicCamera){var v=h.pixelSize;m=e.geometricError/(v*d)}else{var y=i.distanceToPoint(k)*d,g=h.sseDenominator;m=e.geometricError/(y*g),u=Math.min(u,y)}l=Math.max(l,m)}return e.cached.distance=u,l}return"sphere"in a?console.warn("ThreeTilesRenderer : Sphere bounds not supported."):"region"in a&&console.warn("ThreeTilesRenderer : Region bounds not supported."),1/0}},{key:"tileInView",value:function(e){var r=e.cached,t=r.sphere,n=r.inFrustum;if(t){for(var o=this.cameraInfo,a=!1,i=0,s=o.length;i<s;i++){o[i].frustum.intersectsSphere(t)?(a=!0,n[i]=!0):n[i]=!1}return a}return!0}}]),h}();exports.TilesRenderer=C;
  48. },{"../base/TilesRendererBase.js":"svb9","./B3DMLoader.js":"rU0W","./PNTSLoader.js":"Pr3e","./I3DMLoader.js":"iNV5","./CMPTLoader.js":"hwVX","./TilesGroup.js":"tTab","three":"dKqR","./raycastTraverse.js":"Hcez"}],"Tf2v":[function(require,module,exports) {
  49. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SphereHelper=void 0;var e=require("three");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function i(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?u(e):r}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,r){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=a(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function a(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=new e.Vector3,y=["x","y","z"],h=function(t){function o(t){var n,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40;r(this,o);for(var a=new e.BufferGeometry,p=[],l=0;l<3;l++){var h=y[l],b=y[(l+1)%3];s.set(0,0,0);for(var v=0;v<c;v++){var d=void 0;d=2*Math.PI*v/(c-1),s[h]=Math.sin(d),s[b]=Math.cos(d),p.push(s.x,s.y,s.z),d=2*Math.PI*(v+1)/(c-1),s[h]=Math.sin(d),s[b]=Math.cos(d),p.push(s.x,s.y,s.z)}}return a.setAttribute("position",new e.BufferAttribute(new Float32Array(p),3)),a.computeBoundingSphere(),(n=i(this,f(o).call(this,a,new e.LineBasicMaterial({color:u,toneMapped:!1})))).sphere=t,n.type="SphereHelper",n}return p(o,e.LineSegments),n(o,[{key:"updateMatrixWorld",value:function(e){var t=this.sphere;this.position.copy(t.center),this.scale.setScalar(t.radius),c(f(o.prototype),"updateMatrixWorld",this).call(this,e)}}]),o}();exports.SphereHelper=h;
  50. },{"three":"dKqR"}],"v73V":[function(require,module,exports) {
  51. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DebugTilesRenderer=exports.RANDOM_COLOR=exports.IS_LEAF=exports.RELATIVE_DEPTH=exports.DEPTH=exports.DISTANCE=exports.GEOMETRIC_ERROR=exports.SCREEN_ERROR=exports.NONE=void 0;var e=require("three"),r=require("./TilesRenderer.js"),t=require("./SphereHelper.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}function s(e,r){return!r||"object"!==o(r)&&"function"!=typeof r?l(e):r}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,r,t){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var o=p(e,r);if(o){var a=Object.getOwnPropertyDescriptor(o,r);return a.get?a.get.call(t):a.value}})(e,r,t||e)}function p(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=u(e)););return e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&d(e,r)}function d(e,r){return(d=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}var f=Symbol("ORIGINAL_MATERIAL"),v=Symbol("HAS_RANDOM_COLOR");function b(){}var m=0;exports.NONE=m;var x=1;exports.SCREEN_ERROR=x;var y=2;exports.GEOMETRIC_ERROR=y;var E=3;exports.DISTANCE=E;var R=4;exports.DEPTH=R;var g=5;exports.RELATIVE_DEPTH=g;var _=6;exports.IS_LEAF=_;var D=7;exports.RANDOM_COLOR=D;var O=function(o){function i(){var r,t;a(this,i);for(var o=arguments.length,n=new Array(o),l=0;l<o;l++)n[l]=arguments[l];var c=(t=s(this,(r=u(i)).call.apply(r,[this].concat(n)))).group,p=new e.Group;c.add(p);var h=new e.Group;return c.add(h),t.displayBoxBounds=!1,t.displaySphereBounds=!1,t.colorMode=m,t.boxGroup=p,t.sphereGroup=h,t.maxDebugDepth=-1,t.maxDebugDistance=-1,t.maxDebugError=-1,t.extremeDebugDepth=-1,t.extremeDebugError=-1,t}return h(i,r.TilesRenderer),n(i,[{key:"initExtremes",value:function(){var e=-1;this.traverse(function(r){e=Math.max(e,r.__depth)});var r=-1;this.traverse(function(e){r=Math.max(r,e.geometricError)}),this.extremeDebugDepth=e,this.extremeDebugError=r}},{key:"loadTileSet",value:function(){for(var e,r=this,t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var n=(e=c(u(i.prototype),"loadTileSet",this)).call.apply(e,[this].concat(o));return n.then(function(){return r.initExtremes()}).catch(function(){}),n}},{key:"getTileInformationFromActiveObject",value:function(e){var r=null;return this.activeTiles.forEach(function(t){if(r)return!0;var o=t.cached.scene;o&&o.traverse(function(o){o===e&&(r=t)})}),r?{distanceToCamera:r.cached.distance,geometricError:r.geometricError,screenSpaceError:r.__error,depth:r.__depth,isLeaf:r.__isLeaf}:null}},{key:"update",value:function(){if(c(u(i.prototype),"update",this).call(this),this.root){this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds;var r=-1;r=-1===this.maxDebugDepth?this.extremeDebugDepth:this.maxDebugDepth;var t=-1;t=-1===this.maxDebugError?this.extremeDebugError:this.maxDebugError;var o=-1;o=-1===this.maxDebugDistance?this.root.cached.sphere.radius:this.maxDebugDistance;var a=this.errorTarget,n=this.colorMode;this.visibleTiles.forEach(function(i){var s,l,c,p=i.cached.scene;n===D&&(s=Math.random(),l=.5+.5*Math.random(),c=.375+.25*Math.random()),p.traverse(function(p){var u=p.material;if(u){var h=p[f];if(n===m&&u!==h)p.material.dispose(),p.material=p[f];else if(n!==m&&u===h)if(p.isPoints){var d=new e.PointsMaterial;d.size=h.size,d.sizeAttenuation=h.sizeAttenuation,p.material=d}else p.material=new e.MeshBasicMaterial;switch(n!==D&&delete p.material[v],n){case R:var b=i.__depth/r;p.material.color.setRGB(b,b,b);break;case g:var O=i.__depthFromRenderedParent/r;p.material.color.setRGB(O,O,O);break;case x:var T=i.__error/a;T>1?p.material.color.setRGB(1,0,0):p.material.color.setRGB(T,T,T);break;case y:var G=Math.min(i.geometricError/t,1);p.material.color.setRGB(G,G,G);break;case E:var S=Math.min(i.cached.distance/o,1);p.material.color.setRGB(S,S,S);break;case _:i.children&&0!==i.children.length?p.material.color.set(0):p.material.color.set(16777215);break;case D:p.material[v]||(p.material.color.setHSL(s,l,c),p.material[v]=!0)}}})})}}},{key:"setTileVisible",value:function(e,r){c(u(i.prototype),"setTileVisible",this).call(this,e,r);var t=e.cached,o=this.sphereGroup,a=this.boxGroup,n=t.boxHelperGroup,s=t.sphereHelper;r?(a.add(n),n.updateMatrixWorld(!0),o.add(s),s.updateMatrixWorld(!0)):(a.remove(n),o.remove(s))}},{key:"parseTile",value:function(r,o,a){var n=this;return c(u(i.prototype),"parseTile",this).call(this,r,o,a).then(function(){var r=o.cached,a=r.scene;if(a){var i=r.box,s=r.boxTransform,l=new e.Group;l.matrix.copy(s),l.matrix.decompose(l.position,l.quaternion,l.scale);var c=new e.Box3Helper(i);c.raycast=b,l.add(c),r.boxHelperGroup=l,n.visibleTiles.has(o)&&n.displayBoxBounds&&(n.boxGroup.add(l),l.updateMatrixWorld(!0));var p=r.sphere,u=new t.SphereHelper(p);u.raycast=b,r.sphereHelper=u,n.visibleTiles.has(o)&&n.displaySphereBounds&&(n.sphereGroup.add(u),u.updateMatrixWorld(!0)),a.traverse(function(e){var r=e.material;r&&(e[f]=r)})}})}},{key:"disposeTile",value:function(e){c(u(i.prototype),"disposeTile",this).call(this,e);var r=e.cached;r.boxHelperGroup&&(r.boxHelperGroup.children[0].geometry.dispose(),r.sphereHelper.geometry.dispose(),delete r.boxHelperGroup,delete r.sphereHelper)}}]),i}();exports.DebugTilesRenderer=O;
  52. },{"three":"dKqR","./TilesRenderer.js":"wXIB","./SphereHelper.js":"Tf2v"}],"uBxZ":[function(require,module,exports) {
  53. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DebugTilesRenderer",{enumerable:!0,get:function(){return e.DebugTilesRenderer}}),Object.defineProperty(exports,"NONE",{enumerable:!0,get:function(){return e.NONE}}),Object.defineProperty(exports,"SCREEN_ERROR",{enumerable:!0,get:function(){return e.SCREEN_ERROR}}),Object.defineProperty(exports,"GEOMETRIC_ERROR",{enumerable:!0,get:function(){return e.GEOMETRIC_ERROR}}),Object.defineProperty(exports,"DISTANCE",{enumerable:!0,get:function(){return e.DISTANCE}}),Object.defineProperty(exports,"DEPTH",{enumerable:!0,get:function(){return e.DEPTH}}),Object.defineProperty(exports,"RELATIVE_DEPTH",{enumerable:!0,get:function(){return e.RELATIVE_DEPTH}}),Object.defineProperty(exports,"IS_LEAF",{enumerable:!0,get:function(){return e.IS_LEAF}}),Object.defineProperty(exports,"RANDOM_COLOR",{enumerable:!0,get:function(){return e.RANDOM_COLOR}}),Object.defineProperty(exports,"TilesRenderer",{enumerable:!0,get:function(){return r.TilesRenderer}}),Object.defineProperty(exports,"B3DMLoader",{enumerable:!0,get:function(){return t.B3DMLoader}}),Object.defineProperty(exports,"PNTSLoader",{enumerable:!0,get:function(){return n.PNTSLoader}}),Object.defineProperty(exports,"I3DMLoader",{enumerable:!0,get:function(){return o.I3DMLoader}}),Object.defineProperty(exports,"CMPTLoader",{enumerable:!0,get:function(){return u.CMPTLoader}}),Object.defineProperty(exports,"TilesRendererBase",{enumerable:!0,get:function(){return i.TilesRendererBase}}),Object.defineProperty(exports,"B3DMLoaderBase",{enumerable:!0,get:function(){return a.B3DMLoaderBase}}),Object.defineProperty(exports,"I3DMLoaderBase",{enumerable:!0,get:function(){return s.I3DMLoaderBase}}),Object.defineProperty(exports,"PNTSLoaderBase",{enumerable:!0,get:function(){return d.PNTSLoaderBase}}),Object.defineProperty(exports,"CMPTLoaderBase",{enumerable:!0,get:function(){return b.CMPTLoaderBase}}),Object.defineProperty(exports,"LRUCache",{enumerable:!0,get:function(){return c.LRUCache}}),Object.defineProperty(exports,"PriorityQueue",{enumerable:!0,get:function(){return p.PriorityQueue}});var e=require("./three/DebugTilesRenderer.js"),r=require("./three/TilesRenderer.js"),t=require("./three/B3DMLoader.js"),n=require("./three/PNTSLoader.js"),o=require("./three/I3DMLoader.js"),u=require("./three/CMPTLoader.js"),i=require("./base/TilesRendererBase.js"),a=require("./base/B3DMLoaderBase.js"),s=require("./base/I3DMLoaderBase.js"),d=require("./base/PNTSLoaderBase.js"),b=require("./base/CMPTLoaderBase.js"),c=require("./utilities/LRUCache.js"),p=require("./utilities/PriorityQueue.js");
  54. },{"./three/DebugTilesRenderer.js":"v73V","./three/TilesRenderer.js":"wXIB","./three/B3DMLoader.js":"rU0W","./three/PNTSLoader.js":"Pr3e","./three/I3DMLoader.js":"iNV5","./three/CMPTLoader.js":"hwVX","./base/TilesRendererBase.js":"svb9","./base/B3DMLoaderBase.js":"DNWc","./base/I3DMLoaderBase.js":"qWWH","./base/PNTSLoaderBase.js":"RlAR","./base/CMPTLoaderBase.js":"c0Qu","./utilities/LRUCache.js":"upKt","./utilities/PriorityQueue.js":"MK9K"}],"irr3":[function(require,module,exports) {
  55. "use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r<i;r++)if(r in e&&t.call(o,e[r],r)===this.BREAK)return}else for(var s in e)if(t.call(o,e[s],s)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var o=void 0;return function(){var i=this,r=arguments;var s=n||!o;clearTimeout(o),o=setTimeout(function(){o=null,n||e.apply(i,r)},t),s&&e.apply(i,r)}},toArray:function(e){return e.toArray?e.toArray():o.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return e instanceof Function}},r=[{litmus:i.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:t},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:t},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:t},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:t}}},{litmus:i.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:i.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:i.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(i.isNumber(e.r)&&i.isNumber(e.g)&&i.isNumber(e.b)&&i.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(i.isNumber(e.r)&&i.isNumber(e.g)&&i.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(i.isNumber(e.h)&&i.isNumber(e.s)&&i.isNumber(e.v)&&i.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(i.isNumber(e.h)&&i.isNumber(e.s)&&i.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],s=void 0,a=void 0,l=function(){a=!1;var e=arguments.length>1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<<d)}},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=function e(t,n,o){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,o)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(o):void 0},f=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},g=function(){function e(){if(_(this,e),this.__state=l.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return h(e,[{key:"toString",value:function(){return t(this)}},{key:"toHexString",value:function(){return t(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function b(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(g.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(g.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function v(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(g.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(g.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}g.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=c.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");i.extend(e.__state,c.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},g.recalculateHSV=function(e){var t=c.rgb_to_hsv(e.r,e.g,e.b);i.extend(e.__state,{s:t.s,v:t.v}),i.isNaN(t.h)?i.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},g.COMPONENTS=["r","g","b","h","s","v","hex","a"],b(g.prototype,"r",2),b(g.prototype,"g",1),b(g.prototype,"b",0),v(g.prototype,"h"),v(g.prototype,"s"),v(g.prototype,"v"),Object.defineProperty(g.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(g.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=c.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var y=function(){function e(t,n){_(this,e),this.initialValue=t[n],this.domElement=document.createElement("div"),this.object=t,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return h(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),e}(),w={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},x={};i.each(w,function(e,t){i.each(e,function(e){x[e]=t})});var E=/(\d+(\.\d+)?)px/;function C(e){if("0"===e||i.isUndefined(e))return 0;var t=e.match(E);return i.isNull(t)?0:parseFloat(t[1])}var A={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var o=n,r=t;i.isUndefined(r)&&(r=!0),i.isUndefined(o)&&(o=!0),e.style.position="absolute",r&&(e.style.left=0,e.style.right=0),o&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,o){var r=n||{},s=x[t];if(!s)throw new Error("Event type "+t+" not supported.");var a=document.createEvent(s);switch(s){case"MouseEvents":var l=r.x||r.clientX||0,d=r.y||r.clientY||0;a.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,l,d,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=a.initKeyboardEvent||a.initKeyEvent;i.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:a.initEvent(t,r.bubbles||!1,r.cancelable||!0)}i.defaults(a,o),e.dispatchEvent(a)},bind:function(e,t,n,o){var i=o||!1;return e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),A},unbind:function(e,t,n,o){var i=o||!1;return e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),A},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return A},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),o=n.indexOf(t);-1!==o&&(n.splice(o,1),e.className=n.join(" "))}else e.className=void 0;return A},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return C(t["border-left-width"])+C(t["border-right-width"])+C(t["padding-left"])+C(t["padding-right"])+C(t.width)},getHeight:function(e){var t=getComputedStyle(e);return C(t["border-top-width"])+C(t["border-bottom-width"])+C(t["padding-top"])+C(t["padding-bottom"])+C(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do{n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent}while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},k=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;return o.__prev=o.getValue(),o.__checkbox=document.createElement("input"),o.__checkbox.setAttribute("type","checkbox"),A.bind(o.__checkbox,"change",function(){i.setValue(!i.__prev)},!1),o.domElement.appendChild(o.__checkbox),o.updateDisplay(),o}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),S=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o,a=r;if(r.__select=document.createElement("select"),i.isArray(s)){var l={};i.each(s,function(e){l[e]=e}),s=l}return i.each(s,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),a.__select.appendChild(n)}),r.updateDisplay(),A.bind(r.__select,"change",function(){var e=this.options[this.selectedIndex].value;a.setValue(e)}),r.domElement.appendChild(r.__select),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return A.isActive(this.__select)?this:(this.__select.value=this.getValue(),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(),O=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;function r(){i.setValue(i.__input.value)}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),A.bind(o.__input,"keyup",r),A.bind(o.__input,"change",r),A.bind(o.__input,"blur",function(){i.__onFinishChange&&i.__onFinishChange.call(i,i.getValue())}),A.bind(o.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){return A.isActive(this.__input)||(this.__input.value=this.getValue()),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function T(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(a),t.appendChild(n),t.appendChild(o),t.appendChild(r),t.appendChild(s),q){var l=document.getElementById("dg-local-explain"),d=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(ce(e,"isLocal"))&&d.setAttribute("checked","checked"),_e(e,l),A.bind(d,"change",function(){e.useLocalStorage=!e.useLocalStorage,_e(e,l)})}var c=document.getElementById("dg-new-constructor");A.bind(c,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||Z.hide()}),A.bind(n,"click",function(){c.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),Z.show(),c.focus(),c.select()}),A.bind(o,"click",function(){e.save()}),A.bind(r,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),A.bind(s,"click",function(){e.revert()})}function pe(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function o(){A.removeClass(e.__closeButton,oe.CLASS_DRAG),A.unbind(window,"mousemove",n),A.unbind(window,"mouseup",o)}function r(i){return i.preventDefault(),t=i.clientX,A.addClass(e.__closeButton,oe.CLASS_DRAG),A.bind(window,"mousemove",n),A.bind(window,"mouseup",o),!1}e.__resize_handle=document.createElement("div"),i.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),A.bind(e.__resize_handle,"mousedown",r),A.bind(e.__closeButton,"mousedown",r),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function fe(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function me(e,t){var n={};return i.each(e.__rememberedObjects,function(o,r){var s={},a=e.__rememberedObjectIndecesToControllers[r];i.each(a,function(e,n){s[n]=t?e.initialValue:e.getValue()}),n[r]=s}),n}function ge(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function be(e){0!==e.length&&U.call(window,function(){be(e)}),i.each(e,function(e){e.updateDisplay()})}oe.toggleHide=function(){te=!te,i.each(ne,function(e){e.domElement.style.display=te?"none":""})},oe.CLASS_AUTO_PLACE="a",oe.CLASS_AUTO_PLACE_CONTAINER="ac",oe.CLASS_MAIN="main",oe.CLASS_CONTROLLER_ROW="cr",oe.CLASS_TOO_TALL="taller-than-window",oe.CLASS_CLOSED="closed",oe.CLASS_CLOSE_BUTTON="close-button",oe.CLASS_CLOSE_TOP="close-top",oe.CLASS_CLOSE_BOTTOM="close-bottom",oe.CLASS_DRAG="drag",oe.DEFAULT_WIDTH=245,oe.TEXT_CLOSED="Close Controls",oe.TEXT_OPEN="Open Controls",oe._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==J&&e.keyCode!==J||oe.toggleHide()},A.bind(window,"keydown",oe._keydownHandler,!1),i.extend(oe.prototype,{add:function(e,t){return de(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return de(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;i.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&ee.removeChild(this.domElement);var e=this;i.each(this.__folders,function(t){e.removeFolder(t)}),A.unbind(window,"keydown",oe._keydownHandler,!1),re(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new oe(t);this.__folders[e]=n;var o=ie(this,n.domElement);return A.addClass(o,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],re(e);var t=this;i.each(e.__folders,function(t){e.removeFolder(t)}),i.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=A.getOffset(e.__ul).top,n=0;i.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=A.getHeight(t))}),window.innerHeight-t-W<n?(A.addClass(e.domElement,oe.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-W+"px"):(A.removeClass(e.domElement,oe.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&i.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:i.debounce(function(){this.onResize()},50),remember:function(){if(i.isUndefined(Z)&&((Z=new X).domElement.innerHTML=z),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;i.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&he(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&fe(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae;
  56. },{}],"P8yw":[function(require,module,exports) {
  57. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VRButton=void 0;class e{static createButton(e,t){t&&console.error('THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.');const n=document.createElement("button");function o(){n.style.display="",n.style.cursor="auto",n.style.left="calc(50% - 75px)",n.style.width="150px",n.onmouseenter=null,n.onmouseleave=null,n.onclick=null,n.textContent="VR NOT SUPPORTED"}function s(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return n.id="VRButton",n.style.display="none",s(n),navigator.xr.isSessionSupported("immersive-vr").then(function(t){t?function(){let t=null;async function o(o){o.addEventListener("end",s),await e.xr.setSession(o),n.textContent="EXIT VR",t=o}function s(){t.removeEventListener("end",s),n.textContent="ENTER VR",t=null}n.style.display="",n.style.cursor="pointer",n.style.left="calc(50% - 50px)",n.style.width="100px",n.textContent="ENTER VR",n.onmouseenter=function(){n.style.opacity="1.0"},n.onmouseleave=function(){n.style.opacity="0.5"},n.onclick=function(){if(null===t){const e={optionalFeatures:["local-floor","bounded-floor","hand-tracking"]};navigator.xr.requestSession("immersive-vr",e).then(o)}else t.end()}}():o()}),n;{const e=document.createElement("a");return!1===window.isSecureContext?(e.href=document.location.href.replace(/^http:/,"https:"),e.innerHTML="WEBXR NEEDS HTTPS"):(e.href="https://immersiveweb.dev/",e.innerHTML="WEBXR NOT AVAILABLE"),e.style.left="calc(50% - 90px)",e.style.width="180px",e.style.textDecoration="none",s(e),e}}}exports.VRButton=e;
  58. },{}],"DPZN":[function(require,module,exports) {
  59. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.fetchProfile=o,exports.fetchProfilesList=s,exports.MotionController=exports.Constants=void 0;const e={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function t(e){const t=await fetch(e);if(t.ok)return t.json();throw new Error(t.statusText)}async function s(e){if(!e)throw new Error("No basePath supplied");return await t(`${e}/profilesList.json`)}async function o(e,o,a=null,i=!0){if(!e)throw new Error("No xrInputSource supplied");if(!o)throw new Error("No basePath supplied");const n=await s(o);let r;if(e.profiles.some(e=>{const t=n[e];return t&&(r={profileId:e,profilePath:`${o}/${t.path}`,deprecated:!!t.deprecated}),!!r}),!r){if(!a)throw new Error("No matching profile name found");const e=n[a];if(!e)throw new Error(`No matching profile name found and default profile "${a}" missing.`);r={profileId:a,profilePath:`${o}/${e.path}`,deprecated:!!e.deprecated}}const h=await t(r.profilePath);let u;if(i){let t;if(!(t="any"===e.handedness?h.layouts[Object.keys(h.layouts)[0]]:h.layouts[e.handedness]))throw new Error(`No matching handedness, ${e.handedness}, in profile ${r.profileId}`);t.assetPath&&(u=r.profilePath.replace("profile.json",t.assetPath))}return{profile:h,assetPath:u}}exports.Constants=e;const a={xAxis:0,yAxis:0,button:0,state:e.ComponentState.DEFAULT};function i(e=0,t=0){let s=e,o=t;if(Math.sqrt(e*e+t*t)>1){const a=Math.atan2(t,e);s=Math.cos(a),o=Math.sin(a)}return{normalizedXAxis:.5*s+.5,normalizedYAxis:.5*o+.5}}class n{constructor(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===e.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(a)}updateFromComponent({xAxis:t,yAxis:s,button:o,state:a}){const{normalizedXAxis:n,normalizedYAxis:r}=i(t,s);switch(this.componentProperty){case e.ComponentProperty.X_AXIS:this.value=this.states.includes(a)?n:.5;break;case e.ComponentProperty.Y_AXIS:this.value=this.states.includes(a)?r:.5;break;case e.ComponentProperty.BUTTON:this.value=this.states.includes(a)?o:0;break;case e.ComponentProperty.STATE:this.valueNodeProperty===e.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(a):this.value=this.states.includes(a)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class r{constructor(t,s){if(!(t&&s&&s.visualResponses&&s.gamepadIndices&&0!==Object.keys(s.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=t,this.type=s.type,this.rootNodeName=s.rootNodeName,this.touchPointNodeName=s.touchPointNodeName,this.visualResponses={},Object.keys(s.visualResponses).forEach(e=>{const t=new n(s.visualResponses[e]);this.visualResponses[e]=t}),this.gamepadIndices=Object.assign({},s.gamepadIndices),this.values={state:e.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(t){if(this.values.state=e.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&t.buttons.length>this.gamepadIndices.button){const s=t.buttons[this.gamepadIndices.button];this.values.button=s.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,s.pressed||1===this.values.button?this.values.state=e.ComponentState.PRESSED:(s.touched||this.values.button>e.ButtonTouchThreshold)&&(this.values.state=e.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===e.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>e.AxisTouchThreshold&&(this.values.state=e.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===e.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>e.AxisTouchThreshold&&(this.values.state=e.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}}class h{constructor(e,t,s){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=s,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{const t=this.layoutDescription.components[e];this.components[e]=new r(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}exports.MotionController=h;
  60. },{}],"PyMJ":[function(require,module,exports) {
  61. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.XRControllerModelFactory=void 0;var e=require("../../../build/three.module.js"),o=require("../loaders/GLTFLoader.js"),t=require("../libs/motion-controllers.module.js");const n="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",r="generic-trigger";function s(){e.Object3D.call(this),this.motionController=null,this.envMap=null}function a(o,n){Object.values(o.components).forEach(o=>{const{type:r,touchPointNodeName:s,visualResponses:a}=o;if(r===t.Constants.ComponentType.TOUCHPAD)if(o.touchPointNode=n.getObjectByName(s),o.touchPointNode){const t=new e.SphereGeometry(.001),n=new e.MeshBasicMaterial({color:255}),r=new e.Mesh(t,n);o.touchPointNode.add(r)}else console.warn(`Could not find touch dot, ${o.touchPointNodeName}, in touchpad component ${o.id}`);Object.values(a).forEach(e=>{const{valueNodeName:o,minNodeName:r,maxNodeName:s,valueNodeProperty:a}=e;if(a===t.Constants.VisualResponseProperty.TRANSFORM){if(e.minNode=n.getObjectByName(r),e.maxNode=n.getObjectByName(s),!e.minNode)return void console.warn(`Could not find ${r} in the model`);if(!e.maxNode)return void console.warn(`Could not find ${s} in the model`)}e.valueNode=n.getObjectByName(o),e.valueNode||console.warn(`Could not find ${o} in the model`)})})}function i(e,o){a(e.motionController,o),e.envMap&&o.traverse(o=>{o.isMesh&&(o.material.envMap=e.envMap,o.material.needsUpdate=!0)}),e.add(o)}s.prototype=Object.assign(Object.create(e.Object3D.prototype),{constructor:s,setEnvironmentMap:function(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)},updateMatrixWorld:function(o){e.Object3D.prototype.updateMatrixWorld.call(this,o),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(o=>{Object.values(o.visualResponses).forEach(o=>{const{valueNode:n,minNode:r,maxNode:s,value:a,valueNodeProperty:i}=o;n&&(i===t.Constants.VisualResponseProperty.VISIBILITY?n.visible=a:i===t.Constants.VisualResponseProperty.TRANSFORM&&(e.Quaternion.slerp(r.quaternion,s.quaternion,n.quaternion,a),n.position.lerpVectors(r.position,s.position,a)))})}))}});var l=function(){function e(e=null){this.gltfLoader=e,this.path=n,this._assetCache={},this.gltfLoader||(this.gltfLoader=new o.GLTFLoader)}return e.prototype={constructor:e,createControllerModel:function(e){const o=new s;let n=null;return e.addEventListener("connected",e=>{const s=e.data;"tracked-pointer"===s.targetRayMode&&s.gamepad&&(0,t.fetchProfile)(s,this.path,r).then(({profile:e,assetPath:r})=>{o.motionController=new t.MotionController(s,e,r);const a=this._assetCache[o.motionController.assetUrl];if(a)n=a.scene.clone(),i(o,n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(o.motionController.assetUrl,e=>{this._assetCache[o.motionController.assetUrl]=e,n=e.scene.clone(),i(o,n)},null,()=>{throw new Error(`Asset ${o.motionController.assetUrl} missing or malformed.`)})}}).catch(e=>{console.warn(e)})}),e.addEventListener("disconnected",()=>{o.motionController=null,o.remove(n),n=null}),o}},e}();exports.XRControllerModelFactory=l;
  62. },{"../../../build/three.module.js":"dKqR","../loaders/GLTFLoader.js":"O6i0","../libs/motion-controllers.module.js":"DPZN"}],"i2mT":[function(require,module,exports) {
  63. "use strict";var e,t,r,i,n,o,a,d,s,l,c,u,p,w=require("../src/index.js"),f=require("three"),m=E(require("three/examples/jsm/libs/dat.gui.module.js")),v=require("three/examples/jsm/webxr/VRButton.js"),R=require("three/examples/jsm/webxr/XRControllerModelFactory.js");function y(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return y=function(){return e},e}function E(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=y();if(t&&t.has(e))return t.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=i?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}var h={displayBoxBounds:!1,colorMode:0,displayGrid:!0};function g(){t=new f.Scene,(r=new f.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),r.setSize(window.innerWidth,window.innerHeight),r.setClearColor(1383455),r.outputEncoding=f.sRGBEncoding,r.xr.enabled=!0,document.body.appendChild(r.domElement),r.domElement.tabIndex=1,n=new f.Group,t.add(n),(a=new f.GridHelper(10,10,16777215,16777215)).material.transparent=!0,a.material.opacity=.5,a.material.depthWrite=!1,n.add(a),(e=new f.PerspectiveCamera(60,window.innerWidth/window.innerHeight,.1,4e3)).position.set(0,1,0),n.add(e);var y=new f.DirectionalLight(16777215);y.position.set(1,2,3),t.add(y);var E=new f.AmbientLight(16777215,.2);t.add(E),o=new f.Box3,c=new f.Group,t.add(c),i=new w.DebugTilesRenderer("../data/tileset.json"),c.add(i.group),d=new f.Raycaster,s=new f.Vector3(0,0,1);var g=new f.MeshBasicMaterial({color:11722715});(l=new f.Mesh(new f.TorusBufferGeometry(1.5,.2,16,100),g)).visible=!1,t.add(l),document.body.appendChild(v.VRButton.createButton(r)),(u=r.xr.getController(0)).addEventListener("selectstart",function(){n.position.copy(l.position)}),u.addEventListener("connected",function(e){this.controllerActive=!0,this.add(b(e.data))}),u.addEventListener("disconnected",function(){this.controllerActive=!1,this.remove(this.children[0])}),n.add(u);var M=new R.XRControllerModelFactory;(p=r.xr.getControllerGrip(0)).add(M.createControllerModel(p)),n.add(p),x(),window.addEventListener("resize",x,!1);var C=new m.GUI;C.width=300,C.add(h,"displayGrid"),C.add(h,"displayBoxBounds"),C.add(h,"colorMode",{NONE:w.NONE,SCREEN_ERROR:w.SCREEN_ERROR,GEOMETRIC_ERROR:w.GEOMETRIC_ERROR,DISTANCE:w.DISTANCE,DEPTH:w.DEPTH,RELATIVE_DEPTH:w.RELATIVE_DEPTH,IS_LEAF:w.IS_LEAF,RANDOM_COLOR:w.RANDOM_COLOR}),C.open()}function b(e){var t,r;switch(e.targetRayMode){case"tracked-pointer":return(t=new f.BufferGeometry).setAttribute("position",new f.Float32BufferAttribute([0,0,0,0,0,-1],3)),t.setAttribute("color",new f.Float32BufferAttribute([.5,.5,.5,0,0,0],3)),r=new f.LineBasicMaterial({vertexColors:!0,blending:f.AdditiveBlending,depthWrite:!1,transparent:!0}),new f.Line(t,r);case"gaze":return t=new RingBufferGeometry(.02,.04,32).translate(0,0,-1),r=new f.MeshBasicMaterial({opacity:.5,transparent:!0}),new f.Mesh(t,r)}}function x(){e.updateProjectionMatrix(),r.setPixelRatio(window.devicePixelRatio),r.setSize(window.innerWidth,window.innerHeight),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()}function M(){r.setAnimationLoop(C)}function C(){if(requestAnimationFrame(M),a.visible=h.displayGrid,i.displayBoxBounds=h.displayBoxBounds,i.colorMode=parseFloat(h.colorMode),i.getBounds(o)&&(o.getCenter(i.group.position),i.group.position.multiplyScalar(-1)),i.cameras.forEach(function(t){return i.deleteCamera(e)}),r.xr.isPresenting){var c=r.xr.getCamera(e);i.setCamera(c);var p=c.cameras[0];p&&i.setResolution(c,p.viewport.z,p.viewport.w)}else i.setCamera(e),i.setResolutionFromRenderer(e,r);if(i.update(),u.controllerActive){var w=d.ray;d.firstHitOnly=!0,w.origin.copy(u.position).applyMatrix4(n.matrixWorld),u.getWorldDirection(w.direction).multiplyScalar(-1);var f=d.intersectObject(i.group,!0);if(f.length){var m=f[0];m.face.normal.transformDirection(i.group.matrixWorld),l.position.copy(m.point),l.quaternion.setFromUnitVectors(s,m.face.normal),l.visible=!0;var v=n.position.distanceTo(l.position)*e.fov/4e3;l.scale.setScalar(v)}else l.visible=!1}else l.visible=!1;r.render(t,e)}g(),M();
  64. },{"../src/index.js":"uBxZ","three":"dKqR","three/examples/jsm/libs/dat.gui.module.js":"irr3","three/examples/jsm/webxr/VRButton.js":"P8yw","three/examples/jsm/webxr/XRControllerModelFactory.js":"PyMJ"}]},{},["i2mT"], null)
  65. //# sourceMappingURL=vr.55390d87.js.map