minecraft-renderer 0.1.86 → 0.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/threeWorker.js
CHANGED
|
@@ -8637,7 +8637,7 @@ void main() {
|
|
|
8637
8637
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
8638
8638
|
}`;function Cje(i,e,t){let n=new _b,r=new yn,s=new yn,a=new ni,o=new $R({depthPacking:Lze}),l=new YR,c={},u=t.maxTextureSize,d={[Qa]:fs,[fs]:Qa,[Ns]:Ns},f=new s0({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yn},radius:{value:4}},vertexShader:Ije,fragmentShader:Rje}),v=f.clone();v.defines.HORIZONTAL_PASS=1;let g=new Ud;g.setAttribute("position",new ea(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let b=new Nn(g,f),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Xge;let _=this.type;this.render=function(A,T,P){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||A.length===0)return;let I=i.getRenderTarget(),k=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),B=i.state;B.setBlending(zc),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);let U=_!==e0&&this.type===e0,O=_===e0&&this.type!==e0;for(let V=0,F=A.length;V<F;V++){let J=A[V],$=J.shadow;if($===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if($.autoUpdate===!1&&$.needsUpdate===!1)continue;r.copy($.mapSize);let ne=$.getFrameExtents();if(r.multiply(ne),s.copy($.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ne.x),r.x=s.x*ne.x,$.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ne.y),r.y=s.y*ne.y,$.mapSize.y=s.y)),$.map===null||U===!0||O===!0){let j=this.type!==e0?{minFilter:Gi,magFilter:Gi}:{};$.map!==null&&$.map.dispose(),$.map=new i0(r.x,r.y,j),$.map.texture.name=J.name+".shadowMap",$.camera.updateProjectionMatrix()}i.setRenderTarget($.map),i.clear();let se=$.getViewportCount();for(let j=0;j<se;j++){let q=$.getViewport(j);a.set(s.x*q.x,s.y*q.y,s.x*q.z,s.y*q.w),B.viewport(a),$.updateMatrices(J,j),n=$.getFrustum(),S(T,P,$.camera,J,this.type)}$.isPointLightShadow!==!0&&this.type===e0&&x($,P),$.needsUpdate=!1}_=this.type,y.needsUpdate=!1,i.setRenderTarget(I,k,L)};function x(A,T){let P=e.update(b);f.defines.VSM_SAMPLES!==A.blurSamples&&(f.defines.VSM_SAMPLES=A.blurSamples,v.defines.VSM_SAMPLES=A.blurSamples,f.needsUpdate=!0,v.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new i0(r.x,r.y)),f.uniforms.shadow_pass.value=A.map.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,i.setRenderTarget(A.mapPass),i.clear(),i.renderBufferDirect(T,null,P,f,b,null),v.uniforms.shadow_pass.value=A.mapPass.texture,v.uniforms.resolution.value=A.mapSize,v.uniforms.radius.value=A.radius,i.setRenderTarget(A.map),i.clear(),i.renderBufferDirect(T,null,P,v,b,null)}function w(A,T,P,I){let k=null,L=P.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(L!==void 0)k=L;else if(k=P.isPointLight===!0?l:o,i.localClippingEnabled&&T.clipShadows===!0&&Array.isArray(T.clippingPlanes)&&T.clippingPlanes.length!==0||T.displacementMap&&T.displacementScale!==0||T.alphaMap&&T.alphaTest>0||T.map&&T.alphaTest>0){let B=k.uuid,U=T.uuid,O=c[B];O===void 0&&(O={},c[B]=O);let V=O[U];V===void 0&&(V=k.clone(),O[U]=V),k=V}if(k.visible=T.visible,k.wireframe=T.wireframe,I===e0?k.side=T.shadowSide!==null?T.shadowSide:T.side:k.side=T.shadowSide!==null?T.shadowSide:d[T.side],k.alphaMap=T.alphaMap,k.alphaTest=T.alphaTest,k.map=T.map,k.clipShadows=T.clipShadows,k.clippingPlanes=T.clippingPlanes,k.clipIntersection=T.clipIntersection,k.displacementMap=T.displacementMap,k.displacementScale=T.displacementScale,k.displacementBias=T.displacementBias,k.wireframeLinewidth=T.wireframeLinewidth,k.linewidth=T.linewidth,P.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let B=i.properties.get(k);B.light=P}return k}function S(A,T,P,I,k){if(A.visible===!1)return;if(A.layers.test(T.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&k===e0)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,A.matrixWorld);let U=e.update(A),O=A.material;if(Array.isArray(O)){let V=U.groups;for(let F=0,J=V.length;F<J;F++){let $=V[F],ne=O[$.materialIndex];if(ne&&ne.visible){let se=w(A,ne,I,k);i.renderBufferDirect(P,null,U,se,A,$)}}}else if(O.visible){let V=w(A,O,I,k);i.renderBufferDirect(P,null,U,V,A,null)}}let B=A.children;for(let U=0,O=B.length;U<O;U++)S(B[U],T,P,I,k)}}function Pje(i,e,t){let n=t.isWebGL2;function r(){let de=!1,Xe=new ni,Ce=null,le=new ni(0,0,0,0);return{setMask:function(Le){Ce!==Le&&!de&&(i.colorMask(Le,Le,Le,Le),Ce=Le)},setLocked:function(Le){de=Le},setClear:function(Le,Oe,et,Ze,Ye){Ye===!0&&(Le*=Ze,Oe*=Ze,et*=Ze),Xe.set(Le,Oe,et,Ze),le.equals(Xe)===!1&&(i.clearColor(Le,Oe,et,Ze),le.copy(Xe))},reset:function(){de=!1,Ce=null,le.set(-1,0,0,0)}}}function s(){let de=!1,Xe=null,Ce=null,le=null;return{setTest:function(Le){Le?Q(i.DEPTH_TEST):ue(i.DEPTH_TEST)},setMask:function(Le){Xe!==Le&&!de&&(i.depthMask(Le),Xe=Le)},setFunc:function(Le){if(Ce!==Le){switch(Le){case lze:i.depthFunc(i.NEVER);break;case cze:i.depthFunc(i.ALWAYS);break;case uze:i.depthFunc(i.LESS);break;case kR:i.depthFunc(i.LEQUAL);break;case dze:i.depthFunc(i.EQUAL);break;case fze:i.depthFunc(i.GEQUAL);break;case hze:i.depthFunc(i.GREATER);break;case mze:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Ce=Le}},setLocked:function(Le){de=Le},setClear:function(Le){le!==Le&&(i.clearDepth(Le),le=Le)},reset:function(){de=!1,Xe=null,Ce=null,le=null}}}function a(){let de=!1,Xe=null,Ce=null,le=null,Le=null,Oe=null,et=null,Ze=null,Ye=null;return{setTest:function(rt){de||(rt?Q(i.STENCIL_TEST):ue(i.STENCIL_TEST))},setMask:function(rt){Xe!==rt&&!de&&(i.stencilMask(rt),Xe=rt)},setFunc:function(rt,It,Kt){(Ce!==rt||le!==It||Le!==Kt)&&(i.stencilFunc(rt,It,Kt),Ce=rt,le=It,Le=Kt)},setOp:function(rt,It,Kt){(Oe!==rt||et!==It||Ze!==Kt)&&(i.stencilOp(rt,It,Kt),Oe=rt,et=It,Ze=Kt)},setLocked:function(rt){de=rt},setClear:function(rt){Ye!==rt&&(i.clearStencil(rt),Ye=rt)},reset:function(){de=!1,Xe=null,Ce=null,le=null,Le=null,Oe=null,et=null,Ze=null,Ye=null}}}let o=new r,l=new s,c=new a,u=new WeakMap,d=new WeakMap,f={},v={},g=new WeakMap,b=[],y=null,_=!1,x=null,w=null,S=null,A=null,T=null,P=null,I=null,k=!1,L=null,B=null,U=null,O=null,V=null,F=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,$=0,ne=i.getParameter(i.VERSION);ne.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(ne)[1]),J=$>=1):ne.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),J=$>=2);let se=null,j={},q=i.getParameter(i.SCISSOR_BOX),z=i.getParameter(i.VIEWPORT),K=new ni().fromArray(q),re=new ni().fromArray(z);function Z(de,Xe,Ce,le){let Le=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(de,Oe),i.texParameteri(de,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(de,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let et=0;et<Ce;et++)n&&(de===i.TEXTURE_3D||de===i.TEXTURE_2D_ARRAY)?i.texImage3D(Xe,0,i.RGBA,1,1,le,0,i.RGBA,i.UNSIGNED_BYTE,Le):i.texImage2D(Xe+et,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Le);return Oe}let Y={};Y[i.TEXTURE_2D]=Z(i.TEXTURE_2D,i.TEXTURE_2D,1),Y[i.TEXTURE_CUBE_MAP]=Z(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(Y[i.TEXTURE_2D_ARRAY]=Z(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Y[i.TEXTURE_3D]=Z(i.TEXTURE_3D,i.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Q(i.DEPTH_TEST),l.setFunc(kR),ke(!1),je(Tve),Q(i.CULL_FACE),ge(zc);function Q(de){f[de]!==!0&&(i.enable(de),f[de]=!0)}function ue(de){f[de]!==!1&&(i.disable(de),f[de]=!1)}function me(de,Xe){return v[de]!==Xe?(i.bindFramebuffer(de,Xe),v[de]=Xe,n&&(de===i.DRAW_FRAMEBUFFER&&(v[i.FRAMEBUFFER]=Xe),de===i.FRAMEBUFFER&&(v[i.DRAW_FRAMEBUFFER]=Xe)),!0):!1}function we(de,Xe){let Ce=b,le=!1;if(de)if(Ce=g.get(Xe),Ce===void 0&&(Ce=[],g.set(Xe,Ce)),de.isWebGLMultipleRenderTargets){let Le=de.texture;if(Ce.length!==Le.length||Ce[0]!==i.COLOR_ATTACHMENT0){for(let Oe=0,et=Le.length;Oe<et;Oe++)Ce[Oe]=i.COLOR_ATTACHMENT0+Oe;Ce.length=Le.length,le=!0}}else Ce[0]!==i.COLOR_ATTACHMENT0&&(Ce[0]=i.COLOR_ATTACHMENT0,le=!0);else Ce[0]!==i.BACK&&(Ce[0]=i.BACK,le=!0);le&&(t.isWebGL2?i.drawBuffers(Ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ce))}function ye(de){return y!==de?(i.useProgram(de),y=de,!0):!1}let pe={[x5]:i.FUNC_ADD,[KVe]:i.FUNC_SUBTRACT,[ZVe]:i.FUNC_REVERSE_SUBTRACT};if(n)pe[Pve]=i.MIN,pe[Lve]=i.MAX;else{let de=e.get("EXT_blend_minmax");de!==null&&(pe[Pve]=de.MIN_EXT,pe[Lve]=de.MAX_EXT)}let Ge={[QVe]:i.ZERO,[eze]:i.ONE,[tze]:i.SRC_COLOR,[$ge]:i.SRC_ALPHA,[oze]:i.SRC_ALPHA_SATURATE,[sze]:i.DST_COLOR,[rze]:i.DST_ALPHA,[nze]:i.ONE_MINUS_SRC_COLOR,[Yge]:i.ONE_MINUS_SRC_ALPHA,[aze]:i.ONE_MINUS_DST_COLOR,[ize]:i.ONE_MINUS_DST_ALPHA};function ge(de,Xe,Ce,le,Le,Oe,et,Ze){if(de===zc){_===!0&&(ue(i.BLEND),_=!1);return}if(_===!1&&(Q(i.BLEND),_=!0),de!==JVe){if(de!==x||Ze!==k){if((w!==x5||T!==x5)&&(i.blendEquation(i.FUNC_ADD),w=x5,T=x5),Ze)switch(de){case E5:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ive:i.blendFunc(i.ONE,i.ONE);break;case Rve:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Cve:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}else switch(de){case E5:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ive:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Rve:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Cve:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}S=null,A=null,P=null,I=null,x=de,k=Ze}return}Le=Le||Xe,Oe=Oe||Ce,et=et||le,(Xe!==w||Le!==T)&&(i.blendEquationSeparate(pe[Xe],pe[Le]),w=Xe,T=Le),(Ce!==S||le!==A||Oe!==P||et!==I)&&(i.blendFuncSeparate(Ge[Ce],Ge[le],Ge[Oe],Ge[et]),S=Ce,A=le,P=Oe,I=et),x=de,k=!1}function Ie(de,Xe){de.side===Ns?ue(i.CULL_FACE):Q(i.CULL_FACE);let Ce=de.side===fs;Xe&&(Ce=!Ce),ke(Ce),de.blending===E5&&de.transparent===!1?ge(zc):ge(de.blending,de.blendEquation,de.blendSrc,de.blendDst,de.blendEquationAlpha,de.blendSrcAlpha,de.blendDstAlpha,de.premultipliedAlpha),l.setFunc(de.depthFunc),l.setTest(de.depthTest),l.setMask(de.depthWrite),o.setMask(de.colorWrite);let le=de.stencilWrite;c.setTest(le),le&&(c.setMask(de.stencilWriteMask),c.setFunc(de.stencilFunc,de.stencilRef,de.stencilFuncMask),c.setOp(de.stencilFail,de.stencilZFail,de.stencilZPass)),He(de.polygonOffset,de.polygonOffsetFactor,de.polygonOffsetUnits),de.alphaToCoverage===!0?Q(i.SAMPLE_ALPHA_TO_COVERAGE):ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function ke(de){L!==de&&(de?i.frontFace(i.CW):i.frontFace(i.CCW),L=de)}function je(de){de!==XVe?(Q(i.CULL_FACE),de!==B&&(de===Tve?i.cullFace(i.BACK):de===$Ve?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ue(i.CULL_FACE),B=de}function he(de){de!==U&&(J&&i.lineWidth(de),U=de)}function He(de,Xe,Ce){de?(Q(i.POLYGON_OFFSET_FILL),(O!==Xe||V!==Ce)&&(i.polygonOffset(Xe,Ce),O=Xe,V=Ce)):ue(i.POLYGON_OFFSET_FILL)}function ae(de){de?Q(i.SCISSOR_TEST):ue(i.SCISSOR_TEST)}function Qe(de){de===void 0&&(de=i.TEXTURE0+F-1),se!==de&&(i.activeTexture(de),se=de)}function $e(de,Xe,Ce){Ce===void 0&&(se===null?Ce=i.TEXTURE0+F-1:Ce=se);let le=j[Ce];le===void 0&&(le={type:void 0,texture:void 0},j[Ce]=le),(le.type!==de||le.texture!==Xe)&&(se!==Ce&&(i.activeTexture(Ce),se=Ce),i.bindTexture(de,Xe||Y[de]),le.type=de,le.texture=Xe)}function te(){let de=j[se];de!==void 0&&de.type!==void 0&&(i.bindTexture(de.type,null),de.type=void 0,de.texture=void 0)}function D(){try{i.compressedTexImage2D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ee(){try{i.compressedTexImage3D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function C(){try{i.texSubImage2D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function E(){try{i.texSubImage3D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function R(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function N(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function H(){try{i.texStorage2D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function G(){try{i.texStorage3D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function oe(){try{i.texImage2D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function fe(){try{i.texImage3D.apply(i,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function _e(de){K.equals(de)===!1&&(i.scissor(de.x,de.y,de.z,de.w),K.copy(de))}function Re(de){re.equals(de)===!1&&(i.viewport(de.x,de.y,de.z,de.w),re.copy(de))}function Te(de,Xe){let Ce=d.get(Xe);Ce===void 0&&(Ce=new WeakMap,d.set(Xe,Ce));let le=Ce.get(de);le===void 0&&(le=i.getUniformBlockIndex(Xe,de.name),Ce.set(de,le))}function De(de,Xe){let le=d.get(Xe).get(de);u.get(Xe)!==le&&(i.uniformBlockBinding(Xe,le,de.__bindingPointIndex),u.set(Xe,le))}function qe(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),n===!0&&(i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),f={},se=null,j={},v={},g=new WeakMap,b=[],y=null,_=!1,x=null,w=null,S=null,A=null,T=null,P=null,I=null,k=!1,L=null,B=null,U=null,O=null,V=null,K.set(0,0,i.canvas.width,i.canvas.height),re.set(0,0,i.canvas.width,i.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Q,disable:ue,bindFramebuffer:me,drawBuffers:we,useProgram:ye,setBlending:ge,setMaterial:Ie,setFlipSided:ke,setCullFace:je,setLineWidth:he,setPolygonOffset:He,setScissorTest:ae,activeTexture:Qe,bindTexture:$e,unbindTexture:te,compressedTexImage2D:D,compressedTexImage3D:ee,texImage2D:oe,texImage3D:fe,updateUBOMapping:Te,uniformBlockBinding:De,texStorage2D:H,texStorage3D:G,texSubImage2D:C,texSubImage3D:E,compressedTexSubImage2D:R,compressedTexSubImage3D:N,scissor:_e,viewport:Re,reset:qe}}function Lje(i,e,t,n,r,s,a){let o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,u=r.maxTextureSize,d=r.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,v=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap,b,y=new WeakMap,_=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(te,D){return _?new OffscreenCanvas(te,D):ob("canvas")}function w(te,D,ee,C){let E=1;if((te.width>C||te.height>C)&&(E=C/Math.max(te.width,te.height)),E<1||D===!0)if(typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&te instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&te instanceof ImageBitmap){let R=D?BR:Math.floor,N=R(E*te.width),H=R(E*te.height);b===void 0&&(b=x(N,H));let G=ee?x(N,H):b;return G.width=N,G.height=H,G.getContext("2d").drawImage(te,0,0,N,H),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+N+"x"+H+")."),G}else return"data"in te&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),te;return te}function S(te){return dge(te.width)&&dge(te.height)}function A(te){return o?!1:te.wrapS!==Ka||te.wrapT!==Ka||te.minFilter!==Gi&&te.minFilter!==Qs}function T(te,D){return te.generateMipmaps&&D&&te.minFilter!==Gi&&te.minFilter!==Qs}function P(te){i.generateMipmap(te)}function I(te,D,ee,C,E=!1){if(o===!1)return D;if(te!==null){if(i[te]!==void 0)return i[te];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+te+"'")}let R=D;return D===i.RED&&(ee===i.FLOAT&&(R=i.R32F),ee===i.HALF_FLOAT&&(R=i.R16F),ee===i.UNSIGNED_BYTE&&(R=i.R8)),D===i.RED_INTEGER&&(ee===i.UNSIGNED_BYTE&&(R=i.R8UI),ee===i.UNSIGNED_SHORT&&(R=i.R16UI),ee===i.UNSIGNED_INT&&(R=i.R32UI),ee===i.BYTE&&(R=i.R8I),ee===i.SHORT&&(R=i.R16I),ee===i.INT&&(R=i.R32I)),D===i.RG&&(ee===i.FLOAT&&(R=i.RG32F),ee===i.HALF_FLOAT&&(R=i.RG16F),ee===i.UNSIGNED_BYTE&&(R=i.RG8)),D===i.RGBA&&(ee===i.FLOAT&&(R=i.RGBA32F),ee===i.HALF_FLOAT&&(R=i.RGBA16F),ee===i.UNSIGNED_BYTE&&(R=C===tr&&E===!1?i.SRGB8_ALPHA8:i.RGBA8),ee===i.UNSIGNED_SHORT_4_4_4_4&&(R=i.RGBA4),ee===i.UNSIGNED_SHORT_5_5_5_1&&(R=i.RGB5_A1)),(R===i.R16F||R===i.R32F||R===i.RG16F||R===i.RG32F||R===i.RGBA16F||R===i.RGBA32F)&&e.get("EXT_color_buffer_float"),R}function k(te,D,ee){return T(te,ee)===!0||te.isFramebufferTexture&&te.minFilter!==Gi&&te.minFilter!==Qs?Math.log2(Math.max(D.width,D.height))+1:te.mipmaps!==void 0&&te.mipmaps.length>0?te.mipmaps.length:te.isCompressedTexture&&Array.isArray(te.image)?D.mipmaps.length:1}function L(te){return te===Gi||te===Bve||te===KI?i.NEAREST:i.LINEAR}function B(te){let D=te.target;D.removeEventListener("dispose",B),O(D),D.isVideoTexture&&g.delete(D)}function U(te){let D=te.target;D.removeEventListener("dispose",U),F(D)}function O(te){let D=n.get(te);if(D.__webglInit===void 0)return;let ee=te.source,C=y.get(ee);if(C){let E=C[D.__cacheKey];E.usedTimes--,E.usedTimes===0&&V(te),Object.keys(C).length===0&&y.delete(ee)}n.remove(te)}function V(te){let D=n.get(te);i.deleteTexture(D.__webglTexture);let ee=te.source,C=y.get(ee);delete C[D.__cacheKey],a.memory.textures--}function F(te){let D=te.texture,ee=n.get(te),C=n.get(D);if(C.__webglTexture!==void 0&&(i.deleteTexture(C.__webglTexture),a.memory.textures--),te.depthTexture&&te.depthTexture.dispose(),te.isWebGLCubeRenderTarget)for(let E=0;E<6;E++){if(Array.isArray(ee.__webglFramebuffer[E]))for(let R=0;R<ee.__webglFramebuffer[E].length;R++)i.deleteFramebuffer(ee.__webglFramebuffer[E][R]);else i.deleteFramebuffer(ee.__webglFramebuffer[E]);ee.__webglDepthbuffer&&i.deleteRenderbuffer(ee.__webglDepthbuffer[E])}else{if(Array.isArray(ee.__webglFramebuffer))for(let E=0;E<ee.__webglFramebuffer.length;E++)i.deleteFramebuffer(ee.__webglFramebuffer[E]);else i.deleteFramebuffer(ee.__webglFramebuffer);if(ee.__webglDepthbuffer&&i.deleteRenderbuffer(ee.__webglDepthbuffer),ee.__webglMultisampledFramebuffer&&i.deleteFramebuffer(ee.__webglMultisampledFramebuffer),ee.__webglColorRenderbuffer)for(let E=0;E<ee.__webglColorRenderbuffer.length;E++)ee.__webglColorRenderbuffer[E]&&i.deleteRenderbuffer(ee.__webglColorRenderbuffer[E]);ee.__webglDepthRenderbuffer&&i.deleteRenderbuffer(ee.__webglDepthRenderbuffer)}if(te.isWebGLMultipleRenderTargets)for(let E=0,R=D.length;E<R;E++){let N=n.get(D[E]);N.__webglTexture&&(i.deleteTexture(N.__webglTexture),a.memory.textures--),n.remove(D[E])}n.remove(D),n.remove(te)}let J=0;function $(){J=0}function ne(){let te=J;return te>=l&&console.warn("THREE.WebGLTextures: Trying to use "+te+" texture units while this GPU supports only "+l),J+=1,te}function se(te){let D=[];return D.push(te.wrapS),D.push(te.wrapT),D.push(te.wrapR||0),D.push(te.magFilter),D.push(te.minFilter),D.push(te.anisotropy),D.push(te.internalFormat),D.push(te.format),D.push(te.type),D.push(te.generateMipmaps),D.push(te.premultiplyAlpha),D.push(te.flipY),D.push(te.unpackAlignment),D.push(te.colorSpace),D.join()}function j(te,D){let ee=n.get(te);if(te.isVideoTexture&&Qe(te),te.isRenderTargetTexture===!1&&te.version>0&&ee.__version!==te.version){let C=te.image;if(C===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(C.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{me(ee,te,D);return}}t.bindTexture(i.TEXTURE_2D,ee.__webglTexture,i.TEXTURE0+D)}function q(te,D){let ee=n.get(te);if(te.version>0&&ee.__version!==te.version){me(ee,te,D);return}t.bindTexture(i.TEXTURE_2D_ARRAY,ee.__webglTexture,i.TEXTURE0+D)}function z(te,D){let ee=n.get(te);if(te.version>0&&ee.__version!==te.version){me(ee,te,D);return}t.bindTexture(i.TEXTURE_3D,ee.__webglTexture,i.TEXTURE0+D)}function K(te,D){let ee=n.get(te);if(te.version>0&&ee.__version!==te.version){we(ee,te,D);return}t.bindTexture(i.TEXTURE_CUBE_MAP,ee.__webglTexture,i.TEXTURE0+D)}let re={[RR]:i.REPEAT,[Ka]:i.CLAMP_TO_EDGE,[CR]:i.MIRRORED_REPEAT},Z={[Gi]:i.NEAREST,[Bve]:i.NEAREST_MIPMAP_NEAREST,[KI]:i.NEAREST_MIPMAP_LINEAR,[Qs]:i.LINEAR,[wze]:i.LINEAR_MIPMAP_NEAREST,[Gv]:i.LINEAR_MIPMAP_LINEAR},Y={[Oze]:i.NEVER,[qze]:i.ALWAYS,[Nze]:i.LESS,[Fze]:i.LEQUAL,[Uze]:i.EQUAL,[Hze]:i.GEQUAL,[Vze]:i.GREATER,[zze]:i.NOTEQUAL};function Q(te,D,ee){if(ee?(i.texParameteri(te,i.TEXTURE_WRAP_S,re[D.wrapS]),i.texParameteri(te,i.TEXTURE_WRAP_T,re[D.wrapT]),(te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY)&&i.texParameteri(te,i.TEXTURE_WRAP_R,re[D.wrapR]),i.texParameteri(te,i.TEXTURE_MAG_FILTER,Z[D.magFilter]),i.texParameteri(te,i.TEXTURE_MIN_FILTER,Z[D.minFilter])):(i.texParameteri(te,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(te,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),(te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY)&&i.texParameteri(te,i.TEXTURE_WRAP_R,i.CLAMP_TO_EDGE),(D.wrapS!==Ka||D.wrapT!==Ka)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(te,i.TEXTURE_MAG_FILTER,L(D.magFilter)),i.texParameteri(te,i.TEXTURE_MIN_FILTER,L(D.minFilter)),D.minFilter!==Gi&&D.minFilter!==Qs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),D.compareFunction&&(i.texParameteri(te,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(te,i.TEXTURE_COMPARE_FUNC,Y[D.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");if(D.magFilter===Gi||D.minFilter!==KI&&D.minFilter!==Gv||D.type===Vc&&e.has("OES_texture_float_linear")===!1||o===!1&&D.type===Wv&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||n.get(D).__currentAnisotropy)&&(i.texParameterf(te,C.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,r.getMaxAnisotropy())),n.get(D).__currentAnisotropy=D.anisotropy)}}function ue(te,D){let ee=!1;te.__webglInit===void 0&&(te.__webglInit=!0,D.addEventListener("dispose",B));let C=D.source,E=y.get(C);E===void 0&&(E={},y.set(C,E));let R=se(D);if(R!==te.__cacheKey){E[R]===void 0&&(E[R]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,ee=!0),E[R].usedTimes++;let N=E[te.__cacheKey];N!==void 0&&(E[te.__cacheKey].usedTimes--,N.usedTimes===0&&V(D)),te.__cacheKey=R,te.__webglTexture=E[R].texture}return ee}function me(te,D,ee){let C=i.TEXTURE_2D;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(C=i.TEXTURE_2D_ARRAY),D.isData3DTexture&&(C=i.TEXTURE_3D);let E=ue(te,D),R=D.source;t.bindTexture(C,te.__webglTexture,i.TEXTURE0+ee);let N=n.get(R);if(R.version!==N.__version||E===!0){t.activeTexture(i.TEXTURE0+ee),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,D.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,D.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);let H=A(D)&&S(D.image)===!1,G=w(D.image,H,!1,u);G=$e(D,G);let oe=S(G)||o,fe=s.convert(D.format,D.colorSpace),_e=s.convert(D.type),Re=I(D.internalFormat,fe,_e,D.colorSpace,D.isVideoTexture);Q(C,D,oe);let Te,De=D.mipmaps,qe=o&&D.isVideoTexture!==!0,de=N.__version===void 0||E===!0,Xe=k(D,G,oe);if(D.isDepthTexture)Re=i.DEPTH_COMPONENT,o?D.type===Vc?Re=i.DEPTH_COMPONENT32F:D.type===Fc?Re=i.DEPTH_COMPONENT24:D.type===Pd?Re=i.DEPTH24_STENCIL8:Re=i.DEPTH_COMPONENT16:D.type===Vc&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===Ld&&Re===i.DEPTH_COMPONENT&&D.type!==fC&&D.type!==Fc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=Fc,_e=s.convert(D.type)),D.format===I5&&Re===i.DEPTH_COMPONENT&&(Re=i.DEPTH_STENCIL,D.type!==Pd&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Pd,_e=s.convert(D.type))),de&&(qe?t.texStorage2D(i.TEXTURE_2D,1,Re,G.width,G.height):t.texImage2D(i.TEXTURE_2D,0,Re,G.width,G.height,0,fe,_e,null));else if(D.isDataTexture)if(De.length>0&&oe){qe&&de&&t.texStorage2D(i.TEXTURE_2D,Xe,Re,De[0].width,De[0].height);for(let Ce=0,le=De.length;Ce<le;Ce++)Te=De[Ce],qe?t.texSubImage2D(i.TEXTURE_2D,Ce,0,0,Te.width,Te.height,fe,_e,Te.data):t.texImage2D(i.TEXTURE_2D,Ce,Re,Te.width,Te.height,0,fe,_e,Te.data);D.generateMipmaps=!1}else qe?(de&&t.texStorage2D(i.TEXTURE_2D,Xe,Re,G.width,G.height),t.texSubImage2D(i.TEXTURE_2D,0,0,0,G.width,G.height,fe,_e,G.data)):t.texImage2D(i.TEXTURE_2D,0,Re,G.width,G.height,0,fe,_e,G.data);else if(D.isCompressedTexture)if(D.isCompressedArrayTexture){qe&&de&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Xe,Re,De[0].width,De[0].height,G.depth);for(let Ce=0,le=De.length;Ce<le;Ce++)Te=De[Ce],D.format!==Za?fe!==null?qe?t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ce,0,0,0,Te.width,Te.height,G.depth,fe,Te.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ce,Re,Te.width,Te.height,G.depth,0,Te.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ce,0,0,0,Te.width,Te.height,G.depth,fe,_e,Te.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ce,Re,Te.width,Te.height,G.depth,0,fe,_e,Te.data)}else{qe&&de&&t.texStorage2D(i.TEXTURE_2D,Xe,Re,De[0].width,De[0].height);for(let Ce=0,le=De.length;Ce<le;Ce++)Te=De[Ce],D.format!==Za?fe!==null?qe?t.compressedTexSubImage2D(i.TEXTURE_2D,Ce,0,0,Te.width,Te.height,fe,Te.data):t.compressedTexImage2D(i.TEXTURE_2D,Ce,Re,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?t.texSubImage2D(i.TEXTURE_2D,Ce,0,0,Te.width,Te.height,fe,_e,Te.data):t.texImage2D(i.TEXTURE_2D,Ce,Re,Te.width,Te.height,0,fe,_e,Te.data)}else if(D.isDataArrayTexture)qe?(de&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Xe,Re,G.width,G.height,G.depth),t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,G.width,G.height,G.depth,fe,_e,G.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,Re,G.width,G.height,G.depth,0,fe,_e,G.data);else if(D.isData3DTexture)qe?(de&&t.texStorage3D(i.TEXTURE_3D,Xe,Re,G.width,G.height,G.depth),t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,G.width,G.height,G.depth,fe,_e,G.data)):t.texImage3D(i.TEXTURE_3D,0,Re,G.width,G.height,G.depth,0,fe,_e,G.data);else if(D.isFramebufferTexture){if(de)if(qe)t.texStorage2D(i.TEXTURE_2D,Xe,Re,G.width,G.height);else{let Ce=G.width,le=G.height;for(let Le=0;Le<Xe;Le++)t.texImage2D(i.TEXTURE_2D,Le,Re,Ce,le,0,fe,_e,null),Ce>>=1,le>>=1}}else if(De.length>0&&oe){qe&&de&&t.texStorage2D(i.TEXTURE_2D,Xe,Re,De[0].width,De[0].height);for(let Ce=0,le=De.length;Ce<le;Ce++)Te=De[Ce],qe?t.texSubImage2D(i.TEXTURE_2D,Ce,0,0,fe,_e,Te):t.texImage2D(i.TEXTURE_2D,Ce,Re,fe,_e,Te);D.generateMipmaps=!1}else qe?(de&&t.texStorage2D(i.TEXTURE_2D,Xe,Re,G.width,G.height),t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,_e,G)):t.texImage2D(i.TEXTURE_2D,0,Re,fe,_e,G);T(D,oe)&&P(C),N.__version=R.version,D.onUpdate&&D.onUpdate(D)}te.__version=D.version}function we(te,D,ee){if(D.image.length!==6)return;let C=ue(te,D),E=D.source;t.bindTexture(i.TEXTURE_CUBE_MAP,te.__webglTexture,i.TEXTURE0+ee);let R=n.get(E);if(E.version!==R.__version||C===!0){t.activeTexture(i.TEXTURE0+ee),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,D.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,D.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE);let N=D.isCompressedTexture||D.image[0].isCompressedTexture,H=D.image[0]&&D.image[0].isDataTexture,G=[];for(let Ce=0;Ce<6;Ce++)!N&&!H?G[Ce]=w(D.image[Ce],!1,!0,c):G[Ce]=H?D.image[Ce].image:D.image[Ce],G[Ce]=$e(D,G[Ce]);let oe=G[0],fe=S(oe)||o,_e=s.convert(D.format,D.colorSpace),Re=s.convert(D.type),Te=I(D.internalFormat,_e,Re,D.colorSpace),De=o&&D.isVideoTexture!==!0,qe=R.__version===void 0||C===!0,de=k(D,oe,fe);Q(i.TEXTURE_CUBE_MAP,D,fe);let Xe;if(N){De&&qe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,de,Te,oe.width,oe.height);for(let Ce=0;Ce<6;Ce++){Xe=G[Ce].mipmaps;for(let le=0;le<Xe.length;le++){let Le=Xe[le];D.format!==Za?_e!==null?De?t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le,0,0,Le.width,Le.height,_e,Le.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le,Te,Le.width,Le.height,0,Le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le,0,0,Le.width,Le.height,_e,Re,Le.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le,Te,Le.width,Le.height,0,_e,Re,Le.data)}}}else{Xe=D.mipmaps,De&&qe&&(Xe.length>0&&de++,t.texStorage2D(i.TEXTURE_CUBE_MAP,de,Te,G[0].width,G[0].height));for(let Ce=0;Ce<6;Ce++)if(H){De?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,G[Ce].width,G[Ce].height,_e,Re,G[Ce].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Te,G[Ce].width,G[Ce].height,0,_e,Re,G[Ce].data);for(let le=0;le<Xe.length;le++){let Oe=Xe[le].image[Ce].image;De?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le+1,0,0,Oe.width,Oe.height,_e,Re,Oe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le+1,Te,Oe.width,Oe.height,0,_e,Re,Oe.data)}}else{De?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,_e,Re,G[Ce]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Te,_e,Re,G[Ce]);for(let le=0;le<Xe.length;le++){let Le=Xe[le];De?t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le+1,0,0,_e,Re,Le.image[Ce]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,le+1,Te,_e,Re,Le.image[Ce])}}}T(D,fe)&&P(i.TEXTURE_CUBE_MAP),R.__version=E.version,D.onUpdate&&D.onUpdate(D)}te.__version=D.version}function ye(te,D,ee,C,E,R){let N=s.convert(ee.format,ee.colorSpace),H=s.convert(ee.type),G=I(ee.internalFormat,N,H,ee.colorSpace);if(!n.get(D).__hasExternalTextures){let fe=Math.max(1,D.width>>R),_e=Math.max(1,D.height>>R);E===i.TEXTURE_3D||E===i.TEXTURE_2D_ARRAY?t.texImage3D(E,R,G,fe,_e,D.depth,0,N,H,null):t.texImage2D(E,R,G,fe,_e,0,N,H,null)}t.bindFramebuffer(i.FRAMEBUFFER,te),ae(D)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,C,E,n.get(ee).__webglTexture,0,He(D)):(E===i.TEXTURE_2D||E>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&E<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,C,E,n.get(ee).__webglTexture,R),t.bindFramebuffer(i.FRAMEBUFFER,null)}function pe(te,D,ee){if(i.bindRenderbuffer(i.RENDERBUFFER,te),D.depthBuffer&&!D.stencilBuffer){let C=i.DEPTH_COMPONENT16;if(ee||ae(D)){let E=D.depthTexture;E&&E.isDepthTexture&&(E.type===Vc?C=i.DEPTH_COMPONENT32F:E.type===Fc&&(C=i.DEPTH_COMPONENT24));let R=He(D);ae(D)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R,C,D.width,D.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,R,C,D.width,D.height)}else i.renderbufferStorage(i.RENDERBUFFER,C,D.width,D.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,te)}else if(D.depthBuffer&&D.stencilBuffer){let C=He(D);ee&&ae(D)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,C,i.DEPTH24_STENCIL8,D.width,D.height):ae(D)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,C,i.DEPTH24_STENCIL8,D.width,D.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,D.width,D.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,te)}else{let C=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let E=0;E<C.length;E++){let R=C[E],N=s.convert(R.format,R.colorSpace),H=s.convert(R.type),G=I(R.internalFormat,N,H,R.colorSpace),oe=He(D);ee&&ae(D)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,G,D.width,D.height):ae(D)?f.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,G,D.width,D.height):i.renderbufferStorage(i.RENDERBUFFER,G,D.width,D.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ge(te,D){if(D&&D.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,te),!(D.depthTexture&&D.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(D.depthTexture).__webglTexture||D.depthTexture.image.width!==D.width||D.depthTexture.image.height!==D.height)&&(D.depthTexture.image.width=D.width,D.depthTexture.image.height=D.height,D.depthTexture.needsUpdate=!0),j(D.depthTexture,0);let C=n.get(D.depthTexture).__webglTexture,E=He(D);if(D.depthTexture.format===Ld)ae(D)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,C,0,E):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,C,0);else if(D.depthTexture.format===I5)ae(D)?f.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,C,0,E):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,C,0);else throw new Error("Unknown depthTexture format")}function ge(te){let D=n.get(te),ee=te.isWebGLCubeRenderTarget===!0;if(te.depthTexture&&!D.__autoAllocateDepthBuffer){if(ee)throw new Error("target.depthTexture not supported in Cube render targets");Ge(D.__webglFramebuffer,te)}else if(ee){D.__webglDepthbuffer=[];for(let C=0;C<6;C++)t.bindFramebuffer(i.FRAMEBUFFER,D.__webglFramebuffer[C]),D.__webglDepthbuffer[C]=i.createRenderbuffer(),pe(D.__webglDepthbuffer[C],te,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,D.__webglFramebuffer),D.__webglDepthbuffer=i.createRenderbuffer(),pe(D.__webglDepthbuffer,te,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ie(te,D,ee){let C=n.get(te);D!==void 0&&ye(C.__webglFramebuffer,te,te.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),ee!==void 0&&ge(te)}function ke(te){let D=te.texture,ee=n.get(te),C=n.get(D);te.addEventListener("dispose",U),te.isWebGLMultipleRenderTargets!==!0&&(C.__webglTexture===void 0&&(C.__webglTexture=i.createTexture()),C.__version=D.version,a.memory.textures++);let E=te.isWebGLCubeRenderTarget===!0,R=te.isWebGLMultipleRenderTargets===!0,N=S(te)||o;if(E){ee.__webglFramebuffer=[];for(let H=0;H<6;H++)if(o&&D.mipmaps&&D.mipmaps.length>0){ee.__webglFramebuffer[H]=[];for(let G=0;G<D.mipmaps.length;G++)ee.__webglFramebuffer[H][G]=i.createFramebuffer()}else ee.__webglFramebuffer[H]=i.createFramebuffer()}else{if(o&&D.mipmaps&&D.mipmaps.length>0){ee.__webglFramebuffer=[];for(let H=0;H<D.mipmaps.length;H++)ee.__webglFramebuffer[H]=i.createFramebuffer()}else ee.__webglFramebuffer=i.createFramebuffer();if(R)if(r.drawBuffers){let H=te.texture;for(let G=0,oe=H.length;G<oe;G++){let fe=n.get(H[G]);fe.__webglTexture===void 0&&(fe.__webglTexture=i.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&te.samples>0&&ae(te)===!1){let H=R?D:[D];ee.__webglMultisampledFramebuffer=i.createFramebuffer(),ee.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,ee.__webglMultisampledFramebuffer);for(let G=0;G<H.length;G++){let oe=H[G];ee.__webglColorRenderbuffer[G]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,ee.__webglColorRenderbuffer[G]);let fe=s.convert(oe.format,oe.colorSpace),_e=s.convert(oe.type),Re=I(oe.internalFormat,fe,_e,oe.colorSpace,te.isXRRenderTarget===!0),Te=He(te);i.renderbufferStorageMultisample(i.RENDERBUFFER,Te,Re,te.width,te.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+G,i.RENDERBUFFER,ee.__webglColorRenderbuffer[G])}i.bindRenderbuffer(i.RENDERBUFFER,null),te.depthBuffer&&(ee.__webglDepthRenderbuffer=i.createRenderbuffer(),pe(ee.__webglDepthRenderbuffer,te,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(E){t.bindTexture(i.TEXTURE_CUBE_MAP,C.__webglTexture),Q(i.TEXTURE_CUBE_MAP,D,N);for(let H=0;H<6;H++)if(o&&D.mipmaps&&D.mipmaps.length>0)for(let G=0;G<D.mipmaps.length;G++)ye(ee.__webglFramebuffer[H][G],te,D,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+H,G);else ye(ee.__webglFramebuffer[H],te,D,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+H,0);T(D,N)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(R){let H=te.texture;for(let G=0,oe=H.length;G<oe;G++){let fe=H[G],_e=n.get(fe);t.bindTexture(i.TEXTURE_2D,_e.__webglTexture),Q(i.TEXTURE_2D,fe,N),ye(ee.__webglFramebuffer,te,fe,i.COLOR_ATTACHMENT0+G,i.TEXTURE_2D,0),T(fe,N)&&P(i.TEXTURE_2D)}t.unbindTexture()}else{let H=i.TEXTURE_2D;if((te.isWebGL3DRenderTarget||te.isWebGLArrayRenderTarget)&&(o?H=te.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(H,C.__webglTexture),Q(H,D,N),o&&D.mipmaps&&D.mipmaps.length>0)for(let G=0;G<D.mipmaps.length;G++)ye(ee.__webglFramebuffer[G],te,D,i.COLOR_ATTACHMENT0,H,G);else ye(ee.__webglFramebuffer,te,D,i.COLOR_ATTACHMENT0,H,0);T(D,N)&&P(H),t.unbindTexture()}te.depthBuffer&&ge(te)}function je(te){let D=S(te)||o,ee=te.isWebGLMultipleRenderTargets===!0?te.texture:[te.texture];for(let C=0,E=ee.length;C<E;C++){let R=ee[C];if(T(R,D)){let N=te.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,H=n.get(R).__webglTexture;t.bindTexture(N,H),P(N),t.unbindTexture()}}}function he(te){if(o&&te.samples>0&&ae(te)===!1){let D=te.isWebGLMultipleRenderTargets?te.texture:[te.texture],ee=te.width,C=te.height,E=i.COLOR_BUFFER_BIT,R=[],N=te.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,H=n.get(te),G=te.isWebGLMultipleRenderTargets===!0;if(G)for(let oe=0;oe<D.length;oe++)t.bindFramebuffer(i.FRAMEBUFFER,H.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,H.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,H.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,H.__webglFramebuffer);for(let oe=0;oe<D.length;oe++){R.push(i.COLOR_ATTACHMENT0+oe),te.depthBuffer&&R.push(N);let fe=H.__ignoreDepthValues!==void 0?H.__ignoreDepthValues:!1;if(fe===!1&&(te.depthBuffer&&(E|=i.DEPTH_BUFFER_BIT),te.stencilBuffer&&(E|=i.STENCIL_BUFFER_BIT)),G&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,H.__webglColorRenderbuffer[oe]),fe===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[N]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[N])),G){let _e=n.get(D[oe]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,_e,0)}i.blitFramebuffer(0,0,ee,C,0,0,ee,C,E,i.NEAREST),v&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,R)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),G)for(let oe=0;oe<D.length;oe++){t.bindFramebuffer(i.FRAMEBUFFER,H.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.RENDERBUFFER,H.__webglColorRenderbuffer[oe]);let fe=n.get(D[oe]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,H.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.TEXTURE_2D,fe,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,H.__webglMultisampledFramebuffer)}}function He(te){return Math.min(d,te.samples)}function ae(te){let D=n.get(te);return o&&te.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function Qe(te){let D=a.render.frame;g.get(te)!==D&&(g.set(te,D),te.update())}function $e(te,D){let ee=te.colorSpace,C=te.format,E=te.type;return te.isCompressedTexture===!0||te.isVideoTexture===!0||te.format===PR||ee!==Wo&&ee!==Dd&&(ee===tr||ee===xb?o===!1?e.has("EXT_sRGB")===!0&&C===Za?(te.format=PR,te.minFilter=Qs,te.generateMipmaps=!1):D=lb.sRGBToLinear(D):(C!==Za||E!==qc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ee)),D}this.allocateTextureUnit=ne,this.resetTextureUnits=$,this.setTexture2D=j,this.setTexture2DArray=q,this.setTexture3D=z,this.setTextureCube=K,this.rebindTextures=Ie,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=je,this.updateMultisampleRenderTarget=he,this.setupDepthRenderbuffer=ge,this.setupFrameBufferTexture=ye,this.useMultisampledRTT=ae}var Bje=0,Ur=1;function Dje(i,e,t){let n=t.isWebGL2;function r(s,a=Dd){let o,l=a===tr||a===xb?Ur:Bje;if(s===qc)return i.UNSIGNED_BYTE;if(s===Qge)return i.UNSIGNED_SHORT_4_4_4_4;if(s===e6e)return i.UNSIGNED_SHORT_5_5_5_1;if(s===Sze)return i.BYTE;if(s===Eze)return i.SHORT;if(s===fC)return i.UNSIGNED_SHORT;if(s===Zge)return i.INT;if(s===Fc)return i.UNSIGNED_INT;if(s===Vc)return i.FLOAT;if(s===Wv)return n?i.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Mze)return i.ALPHA;if(s===Za)return i.RGBA;if(s===Aze)return i.LUMINANCE;if(s===kze)return i.LUMINANCE_ALPHA;if(s===Ld)return i.DEPTH_COMPONENT;if(s===I5)return i.DEPTH_STENCIL;if(s===PR)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===Tze)return i.RED;if(s===t6e)return i.RED_INTEGER;if(s===Ize)return i.RG;if(s===n6e)return i.RG_INTEGER;if(s===r6e)return i.RGBA_INTEGER;if(s===ZI||s===QI||s===eR||s===tR)if(l===Ur)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===ZI)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===QI)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===eR)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===tR)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===ZI)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===QI)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===eR)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===tR)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Dve||s===Ove||s===Nve||s===Uve)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Dve)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ove)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Nve)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Uve)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Rze)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Fve||s===Vve)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===Fve)return l===Ur?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===Vve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===zve||s===Hve||s===qve||s===Gve||s===Wve||s===jve||s===Xve||s===$ve||s===Yve||s===Jve||s===Kve||s===Zve||s===Qve||s===ege)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===zve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Hve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===qve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Gve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Wve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===jve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Xve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===$ve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Yve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Jve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Kve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Zve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Qve)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===ege)return l===Ur?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===nR||s===tge||s===nge)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===nR)return l===Ur?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===tge)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===nge)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Cze||s===rge||s===ige||s===sge)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===nR)return o.COMPRESSED_RED_RGTC1_EXT;if(s===rge)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===ige)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===sge)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Pd?n?i.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:r}}var JR=class extends Os{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Fr=class extends jo{constructor(){super(),this.isGroup=!0,this.type="Group"}},Oje={type:"move"},qv=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Fr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ve,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ve),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Fr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ve,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ve),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null,o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(let b of e.hand.values()){let y=t.getJointPose(b,n),_=this._getHandJoint(c,b);y!==null&&(_.matrix.fromArray(y.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=y.radius),_.visible=y!==null}let u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),v=.02,g=.005;c.inputState.pinching&&f>v+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=v-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Oje)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Fr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},KR=class extends eo{constructor(e,t,n,r,s,a,o,l,c,u){if(u=u!==void 0?u:Ld,u!==Ld&&u!==I5)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Ld&&(n=Fc),n===void 0&&u===I5&&(n=Pd),super(null,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Gi,this.minFilter=l!==void 0?l:Gi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},ZR=class extends Gc{constructor(e,t){super();let n=this,r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,f=null,v=null,g=null,b=t.getContextAttributes(),y=null,_=null,x=[],w=[],S=new Os;S.layers.enable(1),S.viewport=new ni;let A=new Os;A.layers.enable(2),A.viewport=new ni;let T=[S,A],P=new JR;P.layers.enable(1),P.layers.enable(2);let I=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let z=x[q];return z===void 0&&(z=new qv,x[q]=z),z.getTargetRaySpace()},this.getControllerGrip=function(q){let z=x[q];return z===void 0&&(z=new qv,x[q]=z),z.getGripSpace()},this.getHand=function(q){let z=x[q];return z===void 0&&(z=new qv,x[q]=z),z.getHandSpace()};function L(q){let z=w.indexOf(q.inputSource);if(z===-1)return;let K=x[z];K!==void 0&&(K.update(q.inputSource,q.frame,c||a),K.dispatchEvent({type:q.type,data:q.inputSource}))}function B(){r.removeEventListener("select",L),r.removeEventListener("selectstart",L),r.removeEventListener("selectend",L),r.removeEventListener("squeeze",L),r.removeEventListener("squeezestart",L),r.removeEventListener("squeezeend",L),r.removeEventListener("end",B),r.removeEventListener("inputsourceschange",U);for(let q=0;q<x.length;q++){let z=w[q];z!==null&&(w[q]=null,x[q].disconnect(z))}I=null,k=null,e.setRenderTarget(y),v=null,f=null,d=null,r=null,_=null,j.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(q){c=q},this.getBaseLayer=function(){return f!==null?f:v},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",L),r.addEventListener("selectstart",L),r.addEventListener("selectend",L),r.addEventListener("squeeze",L),r.addEventListener("squeezestart",L),r.addEventListener("squeezeend",L),r.addEventListener("end",B),r.addEventListener("inputsourceschange",U),b.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let z={antialias:r.renderState.layers===void 0?b.antialias:!0,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(r,t,z),r.updateRenderState({baseLayer:v}),_=new i0(v.framebufferWidth,v.framebufferHeight,{format:Za,type:qc,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})}else{let z=null,K=null,re=null;b.depth&&(re=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,z=b.stencil?I5:Ld,K=b.stencil?Pd:Fc);let Z={colorFormat:t.RGBA8,depthFormat:re,scaleFactor:s};d=new XRWebGLBinding(r,t),f=d.createProjectionLayer(Z),r.updateRenderState({layers:[f]}),_=new i0(f.textureWidth,f.textureHeight,{format:Za,type:qc,depthTexture:new KR(f.textureWidth,f.textureHeight,K,void 0,void 0,void 0,void 0,void 0,void 0,z),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0});let Y=e.properties.get(_);Y.__ignoreDepthValues=f.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),j.setContext(r),j.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function U(q){for(let z=0;z<q.removed.length;z++){let K=q.removed[z],re=w.indexOf(K);re>=0&&(w[re]=null,x[re].disconnect(K))}for(let z=0;z<q.added.length;z++){let K=q.added[z],re=w.indexOf(K);if(re===-1){for(let Y=0;Y<x.length;Y++)if(Y>=w.length){w.push(K),re=Y;break}else if(w[Y]===null){w[Y]=K,re=Y;break}if(re===-1)break}let Z=x[re];Z&&Z.connect(K)}}let O=new Ve,V=new Ve;function F(q,z,K){O.setFromMatrixPosition(z.matrixWorld),V.setFromMatrixPosition(K.matrixWorld);let re=O.distanceTo(V),Z=z.projectionMatrix.elements,Y=K.projectionMatrix.elements,Q=Z[14]/(Z[10]-1),ue=Z[14]/(Z[10]+1),me=(Z[9]+1)/Z[5],we=(Z[9]-1)/Z[5],ye=(Z[8]-1)/Z[0],pe=(Y[8]+1)/Y[0],Ge=Q*ye,ge=Q*pe,Ie=re/(-ye+pe),ke=Ie*-ye;z.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(ke),q.translateZ(Ie),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert();let je=Q+Ie,he=ue+Ie,He=Ge-ke,ae=ge+(re-ke),Qe=me*ue/he*je,$e=we*ue/he*je;q.projectionMatrix.makePerspective(He,ae,Qe,$e,je,he),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}function J(q,z){z===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(z.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;P.near=A.near=S.near=q.near,P.far=A.far=S.far=q.far,(I!==P.near||k!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),I=P.near,k=P.far);let z=q.parent,K=P.cameras;J(P,z);for(let re=0;re<K.length;re++)J(K[re],z);K.length===2?F(P,S,A):P.projectionMatrix.copy(S.projectionMatrix),$(q,P,z)};function $(q,z,K){K===null?q.matrix.copy(z.matrixWorld):(q.matrix.copy(K.matrixWorld),q.matrix.invert(),q.matrix.multiply(z.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(z.projectionMatrix),q.projectionMatrixInverse.copy(z.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=LR*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return P},this.getFoveation=function(){if(!(f===null&&v===null))return l},this.setFoveation=function(q){l=q,f!==null&&(f.fixedFoveation=q),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=q)};let ne=null;function se(q,z){if(u=z.getViewerPose(c||a),g=z,u!==null){let K=u.views;v!==null&&(e.setRenderTargetFramebuffer(_,v.framebuffer),e.setRenderTarget(_));let re=!1;K.length!==P.cameras.length&&(P.cameras.length=0,re=!0);for(let Z=0;Z<K.length;Z++){let Y=K[Z],Q=null;if(v!==null)Q=v.getViewport(Y);else{let me=d.getViewSubImage(f,Y);Q=me.viewport,Z===0&&(e.setRenderTargetTextures(_,me.colorTexture,f.ignoreDepthValues?void 0:me.depthStencilTexture),e.setRenderTarget(_))}let ue=T[Z];ue===void 0&&(ue=new Os,ue.layers.enable(Z),ue.viewport=new ni,T[Z]=ue),ue.matrix.fromArray(Y.transform.matrix),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.projectionMatrix.fromArray(Y.projectionMatrix),ue.projectionMatrixInverse.copy(ue.projectionMatrix).invert(),ue.viewport.set(Q.x,Q.y,Q.width,Q.height),Z===0&&(P.matrix.copy(ue.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale)),re===!0&&P.cameras.push(ue)}}for(let K=0;K<x.length;K++){let re=w[K],Z=x[K];re!==null&&Z!==void 0&&Z.update(re,z,c||a)}ne&&ne(q,z),z.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:z}),g=null}let j=new c6e;j.setAnimationLoop(se),this.setAnimationLoop=function(q){ne=q},this.dispose=function(){}}};function Nje(i,e){function t(y,_){y.matrixAutoUpdate===!0&&y.updateMatrix(),_.value.copy(y.matrix)}function n(y,_){_.color.getRGB(y.fogColor.value,l6e(i)),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)}function r(y,_,x,w,S){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(y,_):_.isMeshToonMaterial?(s(y,_),d(y,_)):_.isMeshPhongMaterial?(s(y,_),u(y,_)):_.isMeshStandardMaterial?(s(y,_),f(y,_),_.isMeshPhysicalMaterial&&v(y,_,S)):_.isMeshMatcapMaterial?(s(y,_),g(y,_)):_.isMeshDepthMaterial?s(y,_):_.isMeshDistanceMaterial?(s(y,_),b(y,_)):_.isMeshNormalMaterial?s(y,_):_.isLineBasicMaterial?(a(y,_),_.isLineDashedMaterial&&o(y,_)):_.isPointsMaterial?l(y,_,x,w):_.isSpriteMaterial?c(y,_):_.isShadowMaterial?(y.color.value.copy(_.color),y.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(y,_){y.opacity.value=_.opacity,_.color&&y.diffuse.value.copy(_.color),_.emissive&&y.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.bumpMap&&(y.bumpMap.value=_.bumpMap,t(_.bumpMap,y.bumpMapTransform),y.bumpScale.value=_.bumpScale,_.side===fs&&(y.bumpScale.value*=-1)),_.normalMap&&(y.normalMap.value=_.normalMap,t(_.normalMap,y.normalMapTransform),y.normalScale.value.copy(_.normalScale),_.side===fs&&y.normalScale.value.negate()),_.displacementMap&&(y.displacementMap.value=_.displacementMap,t(_.displacementMap,y.displacementMapTransform),y.displacementScale.value=_.displacementScale,y.displacementBias.value=_.displacementBias),_.emissiveMap&&(y.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,y.emissiveMapTransform)),_.specularMap&&(y.specularMap.value=_.specularMap,t(_.specularMap,y.specularMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest);let x=e.get(_).envMap;if(x&&(y.envMap.value=x,y.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=_.reflectivity,y.ior.value=_.ior,y.refractionRatio.value=_.refractionRatio),_.lightMap){y.lightMap.value=_.lightMap;let w=i._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=_.lightMapIntensity*w,t(_.lightMap,y.lightMapTransform)}_.aoMap&&(y.aoMap.value=_.aoMap,y.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,y.aoMapTransform))}function a(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform))}function o(y,_){y.dashSize.value=_.dashSize,y.totalSize.value=_.dashSize+_.gapSize,y.scale.value=_.scale}function l(y,_,x,w){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.size.value=_.size*x,y.scale.value=w*.5,_.map&&(y.map.value=_.map,t(_.map,y.uvTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function c(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.rotation.value=_.rotation,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function u(y,_){y.specular.value.copy(_.specular),y.shininess.value=Math.max(_.shininess,1e-4)}function d(y,_){_.gradientMap&&(y.gradientMap.value=_.gradientMap)}function f(y,_){y.metalness.value=_.metalness,_.metalnessMap&&(y.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,y.metalnessMapTransform)),y.roughness.value=_.roughness,_.roughnessMap&&(y.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,y.roughnessMapTransform)),e.get(_).envMap&&(y.envMapIntensity.value=_.envMapIntensity)}function v(y,_,x){y.ior.value=_.ior,_.sheen>0&&(y.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),y.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(y.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,y.sheenColorMapTransform)),_.sheenRoughnessMap&&(y.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,y.sheenRoughnessMapTransform))),_.clearcoat>0&&(y.clearcoat.value=_.clearcoat,y.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(y.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,y.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(y.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===fs&&y.clearcoatNormalScale.value.negate())),_.iridescence>0&&(y.iridescence.value=_.iridescence,y.iridescenceIOR.value=_.iridescenceIOR,y.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(y.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,y.iridescenceMapTransform)),_.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),_.transmission>0&&(y.transmission.value=_.transmission,y.transmissionSamplerMap.value=x.texture,y.transmissionSamplerSize.value.set(x.width,x.height),_.transmissionMap&&(y.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,y.transmissionMapTransform)),y.thickness.value=_.thickness,_.thicknessMap&&(y.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=_.attenuationDistance,y.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(y.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(y.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=_.specularIntensity,y.specularColor.value.copy(_.specularColor),_.specularColorMap&&(y.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,y.specularColorMapTransform)),_.specularIntensityMap&&(y.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,y.specularIntensityMapTransform))}function g(y,_){_.matcap&&(y.matcap.value=_.matcap)}function b(y,_){let x=e.get(_).light;y.referencePosition.value.setFromMatrixPosition(x.matrixWorld),y.nearDistance.value=x.shadow.camera.near,y.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Uje(i,e,t,n){let r={},s={},a=[],o=t.isWebGL2?i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(x,w){let S=w.program;n.uniformBlockBinding(x,S)}function c(x,w){let S=r[x.id];S===void 0&&(g(x),S=u(x),r[x.id]=S,x.addEventListener("dispose",y));let A=w.program;n.updateUBOMapping(x,A);let T=e.render.frame;s[x.id]!==T&&(f(x),s[x.id]=T)}function u(x){let w=d();x.__bindingPointIndex=w;let S=i.createBuffer(),A=x.__size,T=x.usage;return i.bindBuffer(i.UNIFORM_BUFFER,S),i.bufferData(i.UNIFORM_BUFFER,A,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,w,S),S}function d(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(x){let w=r[x.id],S=x.uniforms,A=x.__cache;i.bindBuffer(i.UNIFORM_BUFFER,w);for(let T=0,P=S.length;T<P;T++){let I=S[T];if(v(I,T,A)===!0){let k=I.__offset,L=Array.isArray(I.value)?I.value:[I.value],B=0;for(let U=0;U<L.length;U++){let O=L[U],V=b(O);typeof O=="number"?(I.__data[0]=O,i.bufferSubData(i.UNIFORM_BUFFER,k+B,I.__data)):O.isMatrix3?(I.__data[0]=O.elements[0],I.__data[1]=O.elements[1],I.__data[2]=O.elements[2],I.__data[3]=O.elements[0],I.__data[4]=O.elements[3],I.__data[5]=O.elements[4],I.__data[6]=O.elements[5],I.__data[7]=O.elements[0],I.__data[8]=O.elements[6],I.__data[9]=O.elements[7],I.__data[10]=O.elements[8],I.__data[11]=O.elements[0]):(O.toArray(I.__data,B),B+=V.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,k,I.__data)}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function v(x,w,S){let A=x.value;if(S[w]===void 0){if(typeof A=="number")S[w]=A;else{let T=Array.isArray(A)?A:[A],P=[];for(let I=0;I<T.length;I++)P.push(T[I].clone());S[w]=P}return!0}else if(typeof A=="number"){if(S[w]!==A)return S[w]=A,!0}else{let T=Array.isArray(S[w])?S[w]:[S[w]],P=Array.isArray(A)?A:[A];for(let I=0;I<T.length;I++){let k=T[I];if(k.equals(P[I])===!1)return k.copy(P[I]),!0}}return!1}function g(x){let w=x.uniforms,S=0,A=16,T=0;for(let P=0,I=w.length;P<I;P++){let k=w[P],L={boundary:0,storage:0},B=Array.isArray(k.value)?k.value:[k.value];for(let U=0,O=B.length;U<O;U++){let V=B[U],F=b(V);L.boundary+=F.boundary,L.storage+=F.storage}if(k.__data=new Float32Array(L.storage/Float32Array.BYTES_PER_ELEMENT),k.__offset=S,P>0){T=S%A;let U=A-T;T!==0&&U-L.boundary<0&&(S+=A-T,k.__offset=S)}S+=L.storage}return T=S%A,T>0&&(S+=A-T),x.__size=S,x.__cache={},this}function b(x){let w={boundary:0,storage:0};return typeof x=="number"?(w.boundary=4,w.storage=4):x.isVector2?(w.boundary=8,w.storage=8):x.isVector3||x.isColor?(w.boundary=16,w.storage=12):x.isVector4?(w.boundary=16,w.storage=16):x.isMatrix3?(w.boundary=48,w.storage=48):x.isMatrix4?(w.boundary=64,w.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),w}function y(x){let w=x.target;w.removeEventListener("dispose",y);let S=a.indexOf(w.__bindingPointIndex);a.splice(S,1),i.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function _(){for(let x in r)i.deleteBuffer(r[x]);a=[],r={},s={}}return{bind:l,update:c,dispose:_}}var QR=class{constructor(e={}){let{canvas:t=Wze(),context:n=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=a;let v=new Uint32Array(4),g=new Int32Array(4),b=null,y=null,_=[],x=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=tr,this._useLegacyLights=!1,this.toneMapping=Hc,this.toneMappingExposure=1;let w=this,S=!1,A=0,T=0,P=null,I=-1,k=null,L=new ni,B=new ni,U=null,O=new Bn(0),V=0,F=t.width,J=t.height,$=1,ne=null,se=null,j=new ni(0,0,F,J),q=new ni(0,0,F,J),z=!1,K=new _b,re=!1,Z=!1,Y=null,Q=new Ti,ue=new yn,me=new Ve,we={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ye(){return P===null?$:1}let pe=n;function Ge(ie,Me){for(let Be=0;Be<ie.length;Be++){let Ae=ie[Be],Ue=t.getContext(Ae,Me);if(Ue!==null)return Ue}return null}try{let ie={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${dC}`),t.addEventListener("webglcontextlost",Xe,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",le,!1),pe===null){let Me=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&Me.shift(),pe=Ge(Me,ie),pe===null)throw Ge(Me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&pe instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),pe.getShaderPrecisionFormat===void 0&&(pe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(ie){throw console.error("THREE.WebGLRenderer: "+ie.message),ie}let ge,Ie,ke,je,he,He,ae,Qe,$e,te,D,ee,C,E,R,N,H,G,oe,fe,_e,Re,Te,De;function qe(){ge=new iWe(pe),Ie=new ZGe(pe,ge,e),ge.init(Ie),Re=new Dje(pe,ge,Ie),ke=new Pje(pe,ge,Ie),je=new oWe(pe),he=new bje,He=new Lje(pe,ge,ke,he,Ie,Re,je),ae=new eWe(w),Qe=new rWe(w),$e=new gHe(pe,Ie),Te=new JGe(pe,ge,$e,Ie),te=new sWe(pe,$e,je,Te),D=new dWe(pe,te,$e,je),oe=new uWe(pe,Ie,He),N=new QGe(he),ee=new yje(w,ae,Qe,ge,Ie,Te,N),C=new Nje(w,he),E=new wje,R=new Tje(ge,Ie),G=new YGe(w,ae,Qe,ke,D,f,l),H=new Cje(w,D,Ie),De=new Uje(pe,je,Ie,ke),fe=new KGe(pe,ge,je,Ie),_e=new aWe(pe,ge,je,Ie),je.programs=ee.programs,w.capabilities=Ie,w.extensions=ge,w.properties=he,w.renderLists=E,w.shadowMap=H,w.state=ke,w.info=je}qe();let de=new ZR(w,pe);this.xr=de,this.getContext=function(){return pe},this.getContextAttributes=function(){return pe.getContextAttributes()},this.forceContextLoss=function(){let ie=ge.get("WEBGL_lose_context");ie&&ie.loseContext()},this.forceContextRestore=function(){let ie=ge.get("WEBGL_lose_context");ie&&ie.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(ie){ie!==void 0&&($=ie,this.setSize(F,J,!1))},this.getSize=function(ie){return ie.set(F,J)},this.setSize=function(ie,Me,Be=!0){if(de.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=ie,J=Me,t.width=Math.floor(ie*$),t.height=Math.floor(Me*$),Be===!0&&(t.style.width=ie+"px",t.style.height=Me+"px"),this.setViewport(0,0,ie,Me)},this.getDrawingBufferSize=function(ie){return ie.set(F*$,J*$).floor()},this.setDrawingBufferSize=function(ie,Me,Be){F=ie,J=Me,$=Be,t.width=Math.floor(ie*Be),t.height=Math.floor(Me*Be),this.setViewport(0,0,ie,Me)},this.getCurrentViewport=function(ie){return ie.copy(L)},this.getViewport=function(ie){return ie.copy(j)},this.setViewport=function(ie,Me,Be,Ae){ie.isVector4?j.set(ie.x,ie.y,ie.z,ie.w):j.set(ie,Me,Be,Ae),ke.viewport(L.copy(j).multiplyScalar($).floor())},this.getScissor=function(ie){return ie.copy(q)},this.setScissor=function(ie,Me,Be,Ae){ie.isVector4?q.set(ie.x,ie.y,ie.z,ie.w):q.set(ie,Me,Be,Ae),ke.scissor(B.copy(q).multiplyScalar($).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(ie){ke.setScissorTest(z=ie)},this.setOpaqueSort=function(ie){ne=ie},this.setTransparentSort=function(ie){se=ie},this.getClearColor=function(ie){return ie.copy(G.getClearColor())},this.setClearColor=function(){G.setClearColor.apply(G,arguments)},this.getClearAlpha=function(){return G.getClearAlpha()},this.setClearAlpha=function(){G.setClearAlpha.apply(G,arguments)},this.clear=function(ie=!0,Me=!0,Be=!0){let Ae=0;if(ie){let Ue=!1;if(P!==null){let nt=P.texture.format;Ue=nt===r6e||nt===n6e||nt===t6e}if(Ue){let nt=P.texture.type,st=nt===qc||nt===Fc||nt===fC||nt===Pd||nt===Qge||nt===e6e,pt=G.getClearColor(),ht=G.getClearAlpha(),Dt=pt.r,xt=pt.g,Rt=pt.b;st?(v[0]=Dt,v[1]=xt,v[2]=Rt,v[3]=ht,pe.clearBufferuiv(pe.COLOR,0,v)):(g[0]=Dt,g[1]=xt,g[2]=Rt,g[3]=ht,pe.clearBufferiv(pe.COLOR,0,g))}else Ae|=pe.COLOR_BUFFER_BIT}Me&&(Ae|=pe.DEPTH_BUFFER_BIT),Be&&(Ae|=pe.STENCIL_BUFFER_BIT),pe.clear(Ae)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Xe,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",le,!1),E.dispose(),R.dispose(),he.dispose(),ae.dispose(),Qe.dispose(),D.dispose(),Te.dispose(),De.dispose(),ee.dispose(),de.dispose(),de.removeEventListener("sessionstart",rt),de.removeEventListener("sessionend",It),Y&&(Y.dispose(),Y=null),Kt.stop()};function Xe(ie){ie.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;let ie=je.autoReset,Me=H.enabled,Be=H.autoUpdate,Ae=H.needsUpdate,Ue=H.type;qe(),je.autoReset=ie,H.enabled=Me,H.autoUpdate=Be,H.needsUpdate=Ae,H.type=Ue}function le(ie){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",ie.statusMessage)}function Le(ie){let Me=ie.target;Me.removeEventListener("dispose",Le),Oe(Me)}function Oe(ie){et(ie),he.remove(ie)}function et(ie){let Me=he.get(ie).programs;Me!==void 0&&(Me.forEach(function(Be){ee.releaseProgram(Be)}),ie.isShaderMaterial&&ee.releaseShaderCache(ie))}this.renderBufferDirect=function(ie,Me,Be,Ae,Ue,nt){Me===null&&(Me=we);let st=Ue.isMesh&&Ue.matrixWorld.determinant()<0,pt=ut(ie,Me,Be,Ae,Ue);ke.setMaterial(Ae,st);let ht=Be.index,Dt=1;if(Ae.wireframe===!0){if(ht=te.getWireframeAttribute(Be),ht===void 0)return;Dt=2}let xt=Be.drawRange,Rt=Be.attributes.position,Ct=xt.start*Dt,W=(xt.start+xt.count)*Dt;nt!==null&&(Ct=Math.max(Ct,nt.start*Dt),W=Math.min(W,(nt.start+nt.count)*Dt)),ht!==null?(Ct=Math.max(Ct,0),W=Math.min(W,ht.count)):Rt!=null&&(Ct=Math.max(Ct,0),W=Math.min(W,Rt.count));let be=W-Ct;if(be<0||be===1/0)return;Te.setup(Ue,Ae,pt,Be,ht);let Pe,Ee=fe;if(ht!==null&&(Pe=$e.get(ht),Ee=_e,Ee.setIndex(Pe)),Ue.isMesh)Ae.wireframe===!0?(ke.setLineWidth(Ae.wireframeLinewidth*ye()),Ee.setMode(pe.LINES)):Ee.setMode(pe.TRIANGLES);else if(Ue.isLine){let xe=Ae.linewidth;xe===void 0&&(xe=1),ke.setLineWidth(xe*ye()),Ue.isLineSegments?Ee.setMode(pe.LINES):Ue.isLineLoop?Ee.setMode(pe.LINE_LOOP):Ee.setMode(pe.LINE_STRIP)}else Ue.isPoints?Ee.setMode(pe.POINTS):Ue.isSprite&&Ee.setMode(pe.TRIANGLES);if(Ue.isInstancedMesh)Ee.renderInstances(Ct,be,Ue.count);else if(Be.isInstancedBufferGeometry){let xe=Be._maxInstanceCount!==void 0?Be._maxInstanceCount:1/0,ot=Math.min(Be.instanceCount,xe);Ee.renderInstances(Ct,be,ot)}else Ee.render(Ct,be)},this.compile=function(ie,Me){function Be(Ae,Ue,nt){Ae.transparent===!0&&Ae.side===Ns&&Ae.forceSinglePass===!1?(Ae.side=fs,Ae.needsUpdate=!0,Ne(Ae,Ue,nt),Ae.side=Qa,Ae.needsUpdate=!0,Ne(Ae,Ue,nt),Ae.side=Ns):Ne(Ae,Ue,nt)}y=R.get(ie),y.init(),x.push(y),ie.traverseVisible(function(Ae){Ae.isLight&&Ae.layers.test(Me.layers)&&(y.pushLight(Ae),Ae.castShadow&&y.pushShadow(Ae))}),y.setupLights(w._useLegacyLights),ie.traverse(function(Ae){let Ue=Ae.material;if(Ue)if(Array.isArray(Ue))for(let nt=0;nt<Ue.length;nt++){let st=Ue[nt];Be(st,ie,Ae)}else Be(Ue,ie,Ae)}),x.pop(),y=null};let Ze=null;function Ye(ie){Ze&&Ze(ie)}function rt(){Kt.stop()}function It(){Kt.start()}let Kt=new c6e;Kt.setAnimationLoop(Ye),typeof self<"u"&&Kt.setContext(self),this.setAnimationLoop=function(ie){Ze=ie,de.setAnimationLoop(ie),ie===null?Kt.stop():Kt.start()},de.addEventListener("sessionstart",rt),de.addEventListener("sessionend",It),this.render=function(ie,Me){if(Me!==void 0&&Me.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;ie.matrixWorldAutoUpdate===!0&&ie.updateMatrixWorld(),Me.parent===null&&Me.matrixWorldAutoUpdate===!0&&Me.updateMatrixWorld(),de.enabled===!0&&de.isPresenting===!0&&(de.cameraAutoUpdate===!0&&de.updateCamera(Me),Me=de.getCamera()),ie.isScene===!0&&ie.onBeforeRender(w,ie,Me,P),y=R.get(ie,x.length),y.init(),x.push(y),Q.multiplyMatrices(Me.projectionMatrix,Me.matrixWorldInverse),K.setFromProjectionMatrix(Q),Z=this.localClippingEnabled,re=N.init(this.clippingPlanes,Z),b=E.get(ie,_.length),b.init(),_.push(b),vn(ie,Me,0,w.sortObjects),b.finish(),w.sortObjects===!0&&b.sort(ne,se),this.info.render.frame++,re===!0&&N.beginShadows();let Be=y.state.shadowsArray;if(H.render(Be,ie,Me),re===!0&&N.endShadows(),this.info.autoReset===!0&&this.info.reset(),G.render(b,ie),y.setupLights(w._useLegacyLights),Me.isArrayCamera){let Ae=Me.cameras;for(let Ue=0,nt=Ae.length;Ue<nt;Ue++){let st=Ae[Ue];Pi(b,ie,st,st.viewport)}}else Pi(b,ie,Me);P!==null&&(He.updateMultisampleRenderTarget(P),He.updateRenderTargetMipmap(P)),ie.isScene===!0&&ie.onAfterRender(w,ie,Me),Te.resetDefaultState(),I=-1,k=null,x.pop(),x.length>0?y=x[x.length-1]:y=null,_.pop(),_.length>0?b=_[_.length-1]:b=null};function vn(ie,Me,Be,Ae){if(ie.visible===!1)return;if(ie.layers.test(Me.layers)){if(ie.isGroup)Be=ie.renderOrder;else if(ie.isLOD)ie.autoUpdate===!0&&ie.update(Me);else if(ie.isLight)y.pushLight(ie),ie.castShadow&&y.pushShadow(ie);else if(ie.isSprite){if(!ie.frustumCulled||K.intersectsSprite(ie)){Ae&&me.setFromMatrixPosition(ie.matrixWorld).applyMatrix4(Q);let st=D.update(ie),pt=ie.material;pt.visible&&b.push(ie,st,pt,Be,me.z,null)}}else if((ie.isMesh||ie.isLine||ie.isPoints)&&(!ie.frustumCulled||K.intersectsObject(ie))){let st=D.update(ie),pt=ie.material;if(Ae&&(ie.boundingSphere!==void 0?(ie.boundingSphere===null&&ie.computeBoundingSphere(),me.copy(ie.boundingSphere.center)):(st.boundingSphere===null&&st.computeBoundingSphere(),me.copy(st.boundingSphere.center)),me.applyMatrix4(ie.matrixWorld).applyMatrix4(Q)),Array.isArray(pt)){let ht=st.groups;for(let Dt=0,xt=ht.length;Dt<xt;Dt++){let Rt=ht[Dt],Ct=pt[Rt.materialIndex];Ct&&Ct.visible&&b.push(ie,st,Ct,Be,me.z,Rt)}}else pt.visible&&b.push(ie,st,pt,Be,me.z,null)}}let nt=ie.children;for(let st=0,pt=nt.length;st<pt;st++)vn(nt[st],Me,Be,Ae)}function Pi(ie,Me,Be,Ae){let Ue=ie.opaque,nt=ie.transmissive,st=ie.transparent;y.setupLightsView(Be),re===!0&&N.setGlobalState(w.clippingPlanes,Be),nt.length>0&&ve(Ue,nt,Me,Be),Ae&&ke.viewport(L.copy(Ae)),Ue.length>0&&ce(Ue,Me,Be),nt.length>0&&ce(nt,Me,Be),st.length>0&&ce(st,Me,Be),ke.buffers.depth.setTest(!0),ke.buffers.depth.setMask(!0),ke.buffers.color.setMask(!0),ke.setPolygonOffset(!1)}function ve(ie,Me,Be,Ae){let Ue=Ie.isWebGL2;Y===null&&(Y=new i0(1,1,{generateMipmaps:!0,type:ge.has("EXT_color_buffer_half_float")?Wv:qc,minFilter:Gv,samples:Ue?4:0})),w.getDrawingBufferSize(ue),Ue?Y.setSize(ue.x,ue.y):Y.setSize(BR(ue.x),BR(ue.y));let nt=w.getRenderTarget();w.setRenderTarget(Y),w.getClearColor(O),V=w.getClearAlpha(),V<1&&w.setClearColor(16777215,.5),w.clear();let st=w.toneMapping;w.toneMapping=Hc,ce(ie,Be,Ae),He.updateMultisampleRenderTarget(Y),He.updateRenderTargetMipmap(Y);let pt=!1;for(let ht=0,Dt=Me.length;ht<Dt;ht++){let xt=Me[ht],Rt=xt.object,Ct=xt.geometry,W=xt.material,be=xt.group;if(W.side===Ns&&Rt.layers.test(Ae.layers)){let Pe=W.side;W.side=fs,W.needsUpdate=!0,Se(Rt,Be,Ae,Ct,W,be),W.side=Pe,W.needsUpdate=!0,pt=!0}}pt===!0&&(He.updateMultisampleRenderTarget(Y),He.updateRenderTargetMipmap(Y)),w.setRenderTarget(nt),w.setClearColor(O,V),w.toneMapping=st}function ce(ie,Me,Be){let Ae=Me.isScene===!0?Me.overrideMaterial:null;for(let Ue=0,nt=ie.length;Ue<nt;Ue++){let st=ie[Ue],pt=st.object,ht=st.geometry,Dt=Ae===null?st.material:Ae,xt=st.group;pt.layers.test(Be.layers)&&Se(pt,Me,Be,ht,Dt,xt)}}function Se(ie,Me,Be,Ae,Ue,nt){ie.onBeforeRender(w,Me,Be,Ae,Ue,nt),ie.modelViewMatrix.multiplyMatrices(Be.matrixWorldInverse,ie.matrixWorld),ie.normalMatrix.getNormalMatrix(ie.modelViewMatrix),Ue.onBeforeRender(w,Me,Be,Ae,ie,nt),Ue.transparent===!0&&Ue.side===Ns&&Ue.forceSinglePass===!1?(Ue.side=fs,Ue.needsUpdate=!0,w.renderBufferDirect(Be,Me,Ae,Ue,ie,nt),Ue.side=Qa,Ue.needsUpdate=!0,w.renderBufferDirect(Be,Me,Ae,Ue,ie,nt),Ue.side=Ns):w.renderBufferDirect(Be,Me,Ae,Ue,ie,nt),ie.onAfterRender(w,Me,Be,Ae,Ue,nt)}function Ne(ie,Me,Be){Me.isScene!==!0&&(Me=we);let Ae=he.get(ie),Ue=y.state.lights,nt=y.state.shadowsArray,st=Ue.state.version,pt=ee.getParameters(ie,Ue.state,nt,Me,Be),ht=ee.getProgramCacheKey(pt),Dt=Ae.programs;Ae.environment=ie.isMeshStandardMaterial?Me.environment:null,Ae.fog=Me.fog,Ae.envMap=(ie.isMeshStandardMaterial?Qe:ae).get(ie.envMap||Ae.environment),Dt===void 0&&(ie.addEventListener("dispose",Le),Dt=new Map,Ae.programs=Dt);let xt=Dt.get(ht);if(xt!==void 0){if(Ae.currentProgram===xt&&Ae.lightsStateVersion===st)return Fe(ie,pt),xt}else pt.uniforms=ee.getUniforms(ie),ie.onBuild(Be,pt,w),ie.onBeforeCompile(pt,w),xt=ee.acquireProgram(pt,ht),Dt.set(ht,xt),Ae.uniforms=pt.uniforms;let Rt=Ae.uniforms;(!ie.isShaderMaterial&&!ie.isRawShaderMaterial||ie.clipping===!0)&&(Rt.clippingPlanes=N.uniform),Fe(ie,pt),Ae.needsLights=rn(ie),Ae.lightsStateVersion=st,Ae.needsLights&&(Rt.ambientLightColor.value=Ue.state.ambient,Rt.lightProbe.value=Ue.state.probe,Rt.directionalLights.value=Ue.state.directional,Rt.directionalLightShadows.value=Ue.state.directionalShadow,Rt.spotLights.value=Ue.state.spot,Rt.spotLightShadows.value=Ue.state.spotShadow,Rt.rectAreaLights.value=Ue.state.rectArea,Rt.ltc_1.value=Ue.state.rectAreaLTC1,Rt.ltc_2.value=Ue.state.rectAreaLTC2,Rt.pointLights.value=Ue.state.point,Rt.pointLightShadows.value=Ue.state.pointShadow,Rt.hemisphereLights.value=Ue.state.hemi,Rt.directionalShadowMap.value=Ue.state.directionalShadowMap,Rt.directionalShadowMatrix.value=Ue.state.directionalShadowMatrix,Rt.spotShadowMap.value=Ue.state.spotShadowMap,Rt.spotLightMatrix.value=Ue.state.spotLightMatrix,Rt.spotLightMap.value=Ue.state.spotLightMap,Rt.pointShadowMap.value=Ue.state.pointShadowMap,Rt.pointShadowMatrix.value=Ue.state.pointShadowMatrix);let Ct=xt.getUniforms(),W=A5.seqWithValue(Ct.seq,Rt);return Ae.currentProgram=xt,Ae.uniformsList=W,xt}function Fe(ie,Me){let Be=he.get(ie);Be.outputColorSpace=Me.outputColorSpace,Be.instancing=Me.instancing,Be.instancingColor=Me.instancingColor,Be.skinning=Me.skinning,Be.morphTargets=Me.morphTargets,Be.morphNormals=Me.morphNormals,Be.morphColors=Me.morphColors,Be.morphTargetsCount=Me.morphTargetsCount,Be.numClippingPlanes=Me.numClippingPlanes,Be.numIntersection=Me.numClipIntersection,Be.vertexAlphas=Me.vertexAlphas,Be.vertexTangents=Me.vertexTangents,Be.toneMapping=Me.toneMapping}function ut(ie,Me,Be,Ae,Ue){Me.isScene!==!0&&(Me=we),He.resetTextureUnits();let nt=Me.fog,st=Ae.isMeshStandardMaterial?Me.environment:null,pt=P===null?w.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:Wo,ht=(Ae.isMeshStandardMaterial?Qe:ae).get(Ae.envMap||st),Dt=Ae.vertexColors===!0&&!!Be.attributes.color&&Be.attributes.color.itemSize===4,xt=!!Be.attributes.tangent&&(!!Ae.normalMap||Ae.anisotropy>0),Rt=!!Be.morphAttributes.position,Ct=!!Be.morphAttributes.normal,W=!!Be.morphAttributes.color,be=Hc;Ae.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(be=w.toneMapping);let Pe=Be.morphAttributes.position||Be.morphAttributes.normal||Be.morphAttributes.color,Ee=Pe!==void 0?Pe.length:0,xe=he.get(Ae),ot=y.state.lights;if(re===!0&&(Z===!0||ie!==k)){let un=ie===k&&Ae.id===I;N.setState(Ae,ie,un)}let tt=!1;Ae.version===xe.__version?(xe.needsLights&&xe.lightsStateVersion!==ot.state.version||xe.outputColorSpace!==pt||Ue.isInstancedMesh&&xe.instancing===!1||!Ue.isInstancedMesh&&xe.instancing===!0||Ue.isSkinnedMesh&&xe.skinning===!1||!Ue.isSkinnedMesh&&xe.skinning===!0||Ue.isInstancedMesh&&xe.instancingColor===!0&&Ue.instanceColor===null||Ue.isInstancedMesh&&xe.instancingColor===!1&&Ue.instanceColor!==null||xe.envMap!==ht||Ae.fog===!0&&xe.fog!==nt||xe.numClippingPlanes!==void 0&&(xe.numClippingPlanes!==N.numPlanes||xe.numIntersection!==N.numIntersection)||xe.vertexAlphas!==Dt||xe.vertexTangents!==xt||xe.morphTargets!==Rt||xe.morphNormals!==Ct||xe.morphColors!==W||xe.toneMapping!==be||Ie.isWebGL2===!0&&xe.morphTargetsCount!==Ee)&&(tt=!0):(tt=!0,xe.__version=Ae.version);let it=xe.currentProgram;tt===!0&&(it=Ne(Ae,Me,Ue));let vt=!1,gt=!1,Tt=!1,wt=it.getUniforms(),yt=xe.uniforms;if(ke.useProgram(it.program)&&(vt=!0,gt=!0,Tt=!0),Ae.id!==I&&(I=Ae.id,gt=!0),vt||k!==ie){wt.setValue(pe,"projectionMatrix",ie.projectionMatrix),wt.setValue(pe,"viewMatrix",ie.matrixWorldInverse);let un=wt.map.cameraPosition;un!==void 0&&un.setValue(pe,me.setFromMatrixPosition(ie.matrixWorld)),Ie.logarithmicDepthBuffer&&wt.setValue(pe,"logDepthBufFC",2/(Math.log(ie.far+1)/Math.LN2)),(Ae.isMeshPhongMaterial||Ae.isMeshToonMaterial||Ae.isMeshLambertMaterial||Ae.isMeshBasicMaterial||Ae.isMeshStandardMaterial||Ae.isShaderMaterial)&&wt.setValue(pe,"isOrthographic",ie.isOrthographicCamera===!0),k!==ie&&(k=ie,gt=!0,Tt=!0)}if(Ue.isSkinnedMesh){wt.setOptional(pe,Ue,"bindMatrix"),wt.setOptional(pe,Ue,"bindMatrixInverse");let un=Ue.skeleton;un&&(Ie.floatVertexTextures?(un.boneTexture===null&&un.computeBoneTexture(),wt.setValue(pe,"boneTexture",un.boneTexture,He),wt.setValue(pe,"boneTextureSize",un.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let Zt=Be.morphAttributes;if((Zt.position!==void 0||Zt.normal!==void 0||Zt.color!==void 0&&Ie.isWebGL2===!0)&&oe.update(Ue,Be,it),(gt||xe.receiveShadow!==Ue.receiveShadow)&&(xe.receiveShadow=Ue.receiveShadow,wt.setValue(pe,"receiveShadow",Ue.receiveShadow)),Ae.isMeshGouraudMaterial&&Ae.envMap!==null&&(yt.envMap.value=ht,yt.flipEnvMap.value=ht.isCubeTexture&&ht.isRenderTargetTexture===!1?-1:1),gt&&(wt.setValue(pe,"toneMappingExposure",w.toneMappingExposure),xe.needsLights&&Bt(yt,Tt),nt&&Ae.fog===!0&&C.refreshFogUniforms(yt,nt),C.refreshMaterialUniforms(yt,Ae,$,J,Y),A5.upload(pe,xe.uniformsList,yt,He)),Ae.isShaderMaterial&&Ae.uniformsNeedUpdate===!0&&(A5.upload(pe,xe.uniformsList,yt,He),Ae.uniformsNeedUpdate=!1),Ae.isSpriteMaterial&&wt.setValue(pe,"center",Ue.center),wt.setValue(pe,"modelViewMatrix",Ue.modelViewMatrix),wt.setValue(pe,"normalMatrix",Ue.normalMatrix),wt.setValue(pe,"modelMatrix",Ue.matrixWorld),Ae.isShaderMaterial||Ae.isRawShaderMaterial){let un=Ae.uniformsGroups;for(let Dn=0,bn=un.length;Dn<bn;Dn++)if(Ie.isWebGL2){let qn=un[Dn];De.update(qn,it),De.bind(qn,it)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return it}function Bt(ie,Me){ie.ambientLightColor.needsUpdate=Me,ie.lightProbe.needsUpdate=Me,ie.directionalLights.needsUpdate=Me,ie.directionalLightShadows.needsUpdate=Me,ie.pointLights.needsUpdate=Me,ie.pointLightShadows.needsUpdate=Me,ie.spotLights.needsUpdate=Me,ie.spotLightShadows.needsUpdate=Me,ie.rectAreaLights.needsUpdate=Me,ie.hemisphereLights.needsUpdate=Me}function rn(ie){return ie.isMeshLambertMaterial||ie.isMeshToonMaterial||ie.isMeshPhongMaterial||ie.isMeshStandardMaterial||ie.isShadowMaterial||ie.isShaderMaterial&&ie.lights===!0}this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(ie,Me,Be){he.get(ie.texture).__webglTexture=Me,he.get(ie.depthTexture).__webglTexture=Be;let Ae=he.get(ie);Ae.__hasExternalTextures=!0,Ae.__hasExternalTextures&&(Ae.__autoAllocateDepthBuffer=Be===void 0,Ae.__autoAllocateDepthBuffer||ge.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Ae.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(ie,Me){let Be=he.get(ie);Be.__webglFramebuffer=Me,Be.__useDefaultFramebuffer=Me===void 0},this.setRenderTarget=function(ie,Me=0,Be=0){P=ie,A=Me,T=Be;let Ae=!0,Ue=null,nt=!1,st=!1;if(ie){let ht=he.get(ie);ht.__useDefaultFramebuffer!==void 0?(ke.bindFramebuffer(pe.FRAMEBUFFER,null),Ae=!1):ht.__webglFramebuffer===void 0?He.setupRenderTarget(ie):ht.__hasExternalTextures&&He.rebindTextures(ie,he.get(ie.texture).__webglTexture,he.get(ie.depthTexture).__webglTexture);let Dt=ie.texture;(Dt.isData3DTexture||Dt.isDataArrayTexture||Dt.isCompressedArrayTexture)&&(st=!0);let xt=he.get(ie).__webglFramebuffer;ie.isWebGLCubeRenderTarget?(Array.isArray(xt[Me])?Ue=xt[Me][Be]:Ue=xt[Me],nt=!0):Ie.isWebGL2&&ie.samples>0&&He.useMultisampledRTT(ie)===!1?Ue=he.get(ie).__webglMultisampledFramebuffer:Array.isArray(xt)?Ue=xt[Be]:Ue=xt,L.copy(ie.viewport),B.copy(ie.scissor),U=ie.scissorTest}else L.copy(j).multiplyScalar($).floor(),B.copy(q).multiplyScalar($).floor(),U=z;if(ke.bindFramebuffer(pe.FRAMEBUFFER,Ue)&&Ie.drawBuffers&&Ae&&ke.drawBuffers(ie,Ue),ke.viewport(L),ke.scissor(B),ke.setScissorTest(U),nt){let ht=he.get(ie.texture);pe.framebufferTexture2D(pe.FRAMEBUFFER,pe.COLOR_ATTACHMENT0,pe.TEXTURE_CUBE_MAP_POSITIVE_X+Me,ht.__webglTexture,Be)}else if(st){let ht=he.get(ie.texture),Dt=Me||0;pe.framebufferTextureLayer(pe.FRAMEBUFFER,pe.COLOR_ATTACHMENT0,ht.__webglTexture,Be||0,Dt)}I=-1},this.readRenderTargetPixels=function(ie,Me,Be,Ae,Ue,nt,st){if(!(ie&&ie.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=he.get(ie).__webglFramebuffer;if(ie.isWebGLCubeRenderTarget&&st!==void 0&&(pt=pt[st]),pt){ke.bindFramebuffer(pe.FRAMEBUFFER,pt);try{let ht=ie.texture,Dt=ht.format,xt=ht.type;if(Dt!==Za&&Re.convert(Dt)!==pe.getParameter(pe.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Rt=xt===Wv&&(ge.has("EXT_color_buffer_half_float")||Ie.isWebGL2&&ge.has("EXT_color_buffer_float"));if(xt!==qc&&Re.convert(xt)!==pe.getParameter(pe.IMPLEMENTATION_COLOR_READ_TYPE)&&!(xt===Vc&&(Ie.isWebGL2||ge.has("OES_texture_float")||ge.has("WEBGL_color_buffer_float")))&&!Rt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Me>=0&&Me<=ie.width-Ae&&Be>=0&&Be<=ie.height-Ue&&pe.readPixels(Me,Be,Ae,Ue,Re.convert(Dt),Re.convert(xt),nt)}finally{let ht=P!==null?he.get(P).__webglFramebuffer:null;ke.bindFramebuffer(pe.FRAMEBUFFER,ht)}}},this.copyFramebufferToTexture=function(ie,Me,Be=0){let Ae=Math.pow(2,-Be),Ue=Math.floor(Me.image.width*Ae),nt=Math.floor(Me.image.height*Ae);He.setTexture2D(Me,0),pe.copyTexSubImage2D(pe.TEXTURE_2D,Be,0,0,ie.x,ie.y,Ue,nt),ke.unbindTexture()},this.copyTextureToTexture=function(ie,Me,Be,Ae=0){let Ue=Me.image.width,nt=Me.image.height,st=Re.convert(Be.format),pt=Re.convert(Be.type);He.setTexture2D(Be,0),pe.pixelStorei(pe.UNPACK_FLIP_Y_WEBGL,Be.flipY),pe.pixelStorei(pe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Be.premultiplyAlpha),pe.pixelStorei(pe.UNPACK_ALIGNMENT,Be.unpackAlignment),Me.isDataTexture?pe.texSubImage2D(pe.TEXTURE_2D,Ae,ie.x,ie.y,Ue,nt,st,pt,Me.image.data):Me.isCompressedTexture?pe.compressedTexSubImage2D(pe.TEXTURE_2D,Ae,ie.x,ie.y,Me.mipmaps[0].width,Me.mipmaps[0].height,st,Me.mipmaps[0].data):pe.texSubImage2D(pe.TEXTURE_2D,Ae,ie.x,ie.y,st,pt,Me.image),Ae===0&&Be.generateMipmaps&&pe.generateMipmap(pe.TEXTURE_2D),ke.unbindTexture()},this.copyTextureToTexture3D=function(ie,Me,Be,Ae,Ue=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let nt=ie.max.x-ie.min.x+1,st=ie.max.y-ie.min.y+1,pt=ie.max.z-ie.min.z+1,ht=Re.convert(Ae.format),Dt=Re.convert(Ae.type),xt;if(Ae.isData3DTexture)He.setTexture3D(Ae,0),xt=pe.TEXTURE_3D;else if(Ae.isDataArrayTexture)He.setTexture2DArray(Ae,0),xt=pe.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}pe.pixelStorei(pe.UNPACK_FLIP_Y_WEBGL,Ae.flipY),pe.pixelStorei(pe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ae.premultiplyAlpha),pe.pixelStorei(pe.UNPACK_ALIGNMENT,Ae.unpackAlignment);let Rt=pe.getParameter(pe.UNPACK_ROW_LENGTH),Ct=pe.getParameter(pe.UNPACK_IMAGE_HEIGHT),W=pe.getParameter(pe.UNPACK_SKIP_PIXELS),be=pe.getParameter(pe.UNPACK_SKIP_ROWS),Pe=pe.getParameter(pe.UNPACK_SKIP_IMAGES),Ee=Be.isCompressedTexture?Be.mipmaps[0]:Be.image;pe.pixelStorei(pe.UNPACK_ROW_LENGTH,Ee.width),pe.pixelStorei(pe.UNPACK_IMAGE_HEIGHT,Ee.height),pe.pixelStorei(pe.UNPACK_SKIP_PIXELS,ie.min.x),pe.pixelStorei(pe.UNPACK_SKIP_ROWS,ie.min.y),pe.pixelStorei(pe.UNPACK_SKIP_IMAGES,ie.min.z),Be.isDataTexture||Be.isData3DTexture?pe.texSubImage3D(xt,Ue,Me.x,Me.y,Me.z,nt,st,pt,ht,Dt,Ee.data):Be.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),pe.compressedTexSubImage3D(xt,Ue,Me.x,Me.y,Me.z,nt,st,pt,ht,Ee.data)):pe.texSubImage3D(xt,Ue,Me.x,Me.y,Me.z,nt,st,pt,ht,Dt,Ee),pe.pixelStorei(pe.UNPACK_ROW_LENGTH,Rt),pe.pixelStorei(pe.UNPACK_IMAGE_HEIGHT,Ct),pe.pixelStorei(pe.UNPACK_SKIP_PIXELS,W),pe.pixelStorei(pe.UNPACK_SKIP_ROWS,be),pe.pixelStorei(pe.UNPACK_SKIP_IMAGES,Pe),Ue===0&&Ae.generateMipmaps&&pe.generateMipmap(xt),ke.unbindTexture()},this.initTexture=function(ie){ie.isCubeTexture?He.setTextureCube(ie,0):ie.isData3DTexture?He.setTexture3D(ie,0):ie.isDataArrayTexture||ie.isCompressedArrayTexture?He.setTexture2DArray(ie,0):He.setTexture2D(ie,0),ke.unbindTexture()},this.resetState=function(){A=0,T=0,P=null,ke.reset(),Te.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return n0}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===tr?Bd:i6e}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Bd?tr:Wo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},eC=class extends QR{};eC.prototype.isWebGL1Renderer=!0;var jc=class extends Nd{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Bn(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 Bn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=s6e,this.normalScale=new yn(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};function Uc(i,e,t){return m6e(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)}function rb(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function m6e(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}var C5=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let a;t:{r:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break e}a=t.length;break t}if(!(e>=s)){let o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){let o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},tC=class extends C5{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:age,endingEnd:age}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case oge:s=e,o=2*t-n;break;case lge:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case oge:a=e,l=2*n-t;break;case lge:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,d=this._offsetNext,f=this._weightPrev,v=this._weightNext,g=(n-t)/(r-t),b=g*g,y=b*g,_=-f*y+2*f*b-f*g,x=(1+f)*y+(-1.5-2*f)*b+(-.5+f)*g+1,w=(-1-v)*y+(1.5+v)*b+.5*g,S=v*y-v*b;for(let A=0;A!==o;++A)s[A]=_*a[u+A]+x*a[c+A]+w*a[l+A]+S*a[d+A];return s}},nC=class extends C5{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(r-t),d=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*d+a[l+f]*u;return s}},rC=class extends C5{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},to=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=rb(t,this.TimeBufferType),this.values=rb(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:rb(e.times,Array),values:rb(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new rC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new nC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new tC(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ib:t=this.InterpolantFactoryMethodDiscrete;break;case sb:t=this.InterpolantFactoryMethodLinear;break;case rR:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ib;case this.InterpolantFactoryMethodLinear:return sb;case this.InterpolantFactoryMethodSmooth:return rR}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let o=this.getValueSize();this.times=Uc(n,s,a),this.values=Uc(this.values,s*o,a*o)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){let l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&m6e(r))for(let o=0,l=r.length;o!==l;++o){let c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){let e=Uc(this.times),t=Uc(this.values),n=this.getValueSize(),r=this.getInterpolation()===rR,s=e.length-1,a=1;for(let o=1;o<s;++o){let l=!1,c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(r)l=!0;else{let d=o*n,f=d-n,v=d+n;for(let g=0;g!==n;++g){let b=t[d+g];if(b!==t[f+g]||b!==t[v+g]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];let d=o*n,f=a*n;for(let v=0;v!==n;++v)t[f+v]=t[d+v]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=Uc(e,0,a),this.values=Uc(t,0,a*n)):(this.times=e,this.values=t),this}clone(){let e=Uc(this.times,0),t=Uc(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};to.prototype.TimeBufferType=Float32Array;to.prototype.ValueBufferType=Float32Array;to.prototype.DefaultInterpolation=sb;var Fd=class extends to{};Fd.prototype.ValueTypeName="bool";Fd.prototype.ValueBufferType=Array;Fd.prototype.DefaultInterpolation=ib;Fd.prototype.InterpolantFactoryMethodLinear=void 0;Fd.prototype.InterpolantFactoryMethodSmooth=void 0;var iC=class extends to{};iC.prototype.ValueTypeName="color";var sC=class extends to{};sC.prototype.ValueTypeName="number";var aC=class extends C5{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t),c=e*o;for(let u=c+o;c!==u;c+=4)Wc.slerpFlat(s,0,a,c-o,a,c,l);return s}},Xv=class extends to{InterpolantFactoryMethodLinear(e){return new aC(this.times,this.values,this.getValueSize(),e)}};Xv.prototype.ValueTypeName="quaternion";Xv.prototype.DefaultInterpolation=sb;Xv.prototype.InterpolantFactoryMethodSmooth=void 0;var Vd=class extends to{};Vd.prototype.ValueTypeName="string";Vd.prototype.ValueBufferType=Array;Vd.prototype.DefaultInterpolation=ib;Vd.prototype.InterpolantFactoryMethodLinear=void 0;Vd.prototype.InterpolantFactoryMethodSmooth=void 0;var oC=class extends to{};oC.prototype.ValueTypeName="vector";var lC=class{constructor(e,t,n){let r=this,s=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){let d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,f=c.length;d<f;d+=2){let v=c[d],g=c[d+1];if(v.global&&(v.lastIndex=0),v.test(u))return g}return null}}},Fje=new lC,cC=class{constructor(e){this.manager=e!==void 0?e:Fje,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};cC.DEFAULT_MATERIAL_NAME="__DEFAULT";var mC="\\[\\]\\.:\\/",Vje=new RegExp("["+mC+"]","g"),pC="[^"+mC+"]",zje="[^"+mC.replace("\\.","")+"]",Hje=/((?:WC+[\/:])*)/.source.replace("WC",pC),qje=/(WCOD+)?/.source.replace("WCOD",zje),Gje=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",pC),Wje=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",pC),jje=new RegExp("^"+Hje+qje+Gje+Wje+"$"),Xje=["material","materials","bones","map"],uC=class{constructor(e,t,n){let r=n||er.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},er=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Vje,"")}static parseTrackName(e){let t=jje.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);Xje.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let a=0;a<s.length;a++){let o=s[a];if(o.name===t||o.uuid===t)return o;let l=n(o.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let a=e[r];if(a===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};er.Composite=uC;er.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};er.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};er.prototype.GetterByBindingType=[er.prototype._getValue_direct,er.prototype._getValue_array,er.prototype._getValue_arrayElement,er.prototype._getValue_toArray];er.prototype.SetterByBindingTypeAndVersioning=[[er.prototype._setValue_direct,er.prototype._setValue_direct_setNeedsUpdate,er.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[er.prototype._setValue_array,er.prototype._setValue_array_setNeedsUpdate,er.prototype._setValue_array_setMatrixWorldNeedsUpdate],[er.prototype._setValue_arrayElement,er.prototype._setValue_arrayElement_setNeedsUpdate,er.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[er.prototype._setValue_fromArray,er.prototype._setValue_fromArray_setNeedsUpdate,er.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Jhn=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:dC}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=dC);function xC(i,e,t,n,r,s,a,o){let l=(P,I,k,L)=>[new yn(P/a,1-L/o),new yn(k/a,1-L/o),new yn(k/a,1-I/o),new yn(P/a,1-I/o)],c=l(e+s,t,e+n+s,t+s),u=l(e+n+s,t,e+n*2+s,t+s),d=l(e,t+s,e+s,t+s+r),f=l(e+s,t+s,e+n+s,t+s+r),v=l(e+n+s,t+s,e+n+s*2,t+r+s),g=l(e+n+s*2,t+s,e+n*2+s*2,t+r+s),b=i.attributes.uv,y=[v[3],v[2],v[0],v[1]],_=[d[3],d[2],d[0],d[1]],x=[c[3],c[2],c[0],c[1]],w=[u[0],u[1],u[3],u[2]],S=[f[3],f[2],f[0],f[1]],A=[g[3],g[2],g[0],g[1]],T=[];for(let P of[y,_,x,w,S,A])for(let I of P)T.push(I.x,I.y);b.set(new Float32Array(T)),b.needsUpdate=!0}function ta(i,e,t,n,r,s){xC(i,e,t,n,r,s,64,64)}function vC(i,e,t,n,r,s){xC(i,e,t,n,r,s,64,32)}var a0=class extends Fr{constructor(e,t){super(),Object.defineProperty(this,"innerLayer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"outerLayer",{enumerable:!0,configurable:!0,writable:!0,value:t}),e.name="inner",t.name="outer"}},gC=class extends Fr{constructor(){super(),Object.defineProperty(this,"head",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightArm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftArm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightLeg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftLeg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelListeners",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slim",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layer1Material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer1MaterialBiased",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer2Material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer2MaterialBiased",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.layer1Material=new jc({side:Qa}),this.layer2Material=new jc({side:Ns,transparent:!0,alphaTest:1e-5}),this.layer1MaterialBiased=this.layer1Material.clone(),this.layer1MaterialBiased.polygonOffset=!0,this.layer1MaterialBiased.polygonOffsetFactor=1,this.layer1MaterialBiased.polygonOffsetUnits=1,this.layer2MaterialBiased=this.layer2Material.clone(),this.layer2MaterialBiased.polygonOffset=!0,this.layer2MaterialBiased.polygonOffsetFactor=1,this.layer2MaterialBiased.polygonOffsetUnits=1;let e=new mr(8,8,8);ta(e,0,0,8,8,8);let t=new Nn(e,this.layer1Material),n=new mr(9,9,9);ta(n,32,0,8,8,8);let r=new Nn(n,this.layer2Material);this.head=new a0(t,r),this.head.name="head",this.head.add(t,r),t.position.y=4,r.position.y=4,this.add(this.head);let s=new mr(8,12,4);ta(s,16,16,8,12,4);let a=new Nn(s,this.layer1Material),o=new mr(8.5,12.5,4.5);ta(o,16,32,8,12,4);let l=new Nn(o,this.layer2Material);this.body=new a0(a,l),this.body.name="body",this.body.add(a,l),this.body.position.y=-6,this.add(this.body);let c=new mr,u=new Nn(c,this.layer1MaterialBiased);this.modelListeners.push(()=>{u.scale.x=this.slim?3:4,u.scale.y=12,u.scale.z=4,ta(c,40,16,this.slim?3:4,12,4)});let d=new mr,f=new Nn(d,this.layer2MaterialBiased);this.modelListeners.push(()=>{f.scale.x=this.slim?3.5:4.5,f.scale.y=12.5,f.scale.z=4.5,ta(d,40,32,this.slim?3:4,12,4)});let v=new Fr;v.add(u,f),this.modelListeners.push(()=>{v.position.x=this.slim?-.5:-1}),v.position.y=-4,this.rightArm=new a0(u,f),this.rightArm.name="rightArm",this.rightArm.add(v),this.rightArm.position.x=-5,this.rightArm.position.y=-2,this.add(this.rightArm);let g=new mr,b=new Nn(g,this.layer1MaterialBiased);this.modelListeners.push(()=>{b.scale.x=this.slim?3:4,b.scale.y=12,b.scale.z=4,ta(g,32,48,this.slim?3:4,12,4)});let y=new mr,_=new Nn(y,this.layer2MaterialBiased);this.modelListeners.push(()=>{_.scale.x=this.slim?3.5:4.5,_.scale.y=12.5,_.scale.z=4.5,ta(y,48,48,this.slim?3:4,12,4)});let x=new Fr;x.add(b,_),this.modelListeners.push(()=>{x.position.x=this.slim?.5:1}),x.position.y=-4,this.leftArm=new a0(b,_),this.leftArm.name="leftArm",this.leftArm.add(x),this.leftArm.position.x=5,this.leftArm.position.y=-2,this.add(this.leftArm);let w=new mr(4,12,4);ta(w,0,16,4,12,4);let S=new Nn(w,this.layer1MaterialBiased),A=new mr(4.5,12.5,4.5);ta(A,0,32,4,12,4);let T=new Nn(A,this.layer2MaterialBiased),P=new Fr;P.add(S,T),P.position.y=-6,this.rightLeg=new a0(S,T),this.rightLeg.name="rightLeg",this.rightLeg.add(P),this.rightLeg.position.x=-1.9,this.rightLeg.position.y=-12,this.rightLeg.position.z=-.1,this.add(this.rightLeg);let I=new mr(4,12,4);ta(I,16,48,4,12,4);let k=new Nn(I,this.layer1MaterialBiased),L=new mr(4.5,12.5,4.5);ta(L,0,48,4,12,4);let B=new Nn(L,this.layer2MaterialBiased),U=new Fr;U.add(k,B),U.position.y=-6,this.leftLeg=new a0(k,B),this.leftLeg.name="leftLeg",this.leftLeg.add(U),this.leftLeg.position.x=1.9,this.leftLeg.position.y=-12,this.leftLeg.position.z=-.1,this.add(this.leftLeg),this.modelType="default"}get map(){return this._map}set map(e){this._map=e,this.layer1Material.map=e,this.layer1Material.needsUpdate=!0,this.layer1MaterialBiased.map=e,this.layer1MaterialBiased.needsUpdate=!0,this.layer2Material.map=e,this.layer2Material.needsUpdate=!0,this.layer2MaterialBiased.map=e,this.layer2MaterialBiased.needsUpdate=!0}get modelType(){return this.slim?"slim":"default"}set modelType(e){this.slim=e==="slim",this.modelListeners.forEach(t=>t())}getBodyParts(){return this.children.filter(e=>e instanceof a0)}setInnerLayerVisible(e){this.getBodyParts().forEach(t=>t.innerLayer.visible=e)}setOuterLayerVisible(e){this.getBodyParts().forEach(t=>t.outerLayer.visible=e)}resetJoints(){this.head.rotation.set(0,0,0),this.leftArm.rotation.set(0,0,0),this.rightArm.rotation.set(0,0,0),this.leftLeg.rotation.set(0,0,0),this.rightLeg.rotation.set(0,0,0),this.body.rotation.set(0,0,0),this.head.position.y=0,this.body.position.y=-6,this.body.position.z=0,this.rightArm.position.x=-5,this.rightArm.position.y=-2,this.rightArm.position.z=0,this.leftArm.position.x=5,this.leftArm.position.y=-2,this.leftArm.position.z=0,this.rightLeg.position.x=-1.9,this.rightLeg.position.y=-12,this.rightLeg.position.z=-.1,this.leftLeg.position.x=1.9,this.leftLeg.position.y=-12,this.leftLeg.position.z=-.1}},_C=class extends Fr{constructor(){super(),Object.defineProperty(this,"cape",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new jc({side:Ns,transparent:!0,alphaTest:1e-5});let e=new mr(10,16,1);vC(e,0,0,10,16,1),this.cape=new Nn(e,this.material),this.cape.position.y=-8,this.cape.position.z=.5,this.add(this.cape)}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},yC=class extends Fr{constructor(){super(),Object.defineProperty(this,"leftWing",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightWing",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new jc({side:Ns,transparent:!0,alphaTest:1e-5});let e=new mr(12,22,4);vC(e,22,0,10,20,2);let t=new Nn(e,this.material);t.position.x=-5,t.position.y=-10,t.position.z=-1,this.leftWing=new Fr,this.leftWing.add(t),this.add(this.leftWing);let n=new mr(12,22,4);vC(n,22,0,10,20,2);let r=new Nn(n,this.material);r.scale.x=-1,r.position.x=5,r.position.y=-10,r.position.z=-1,this.rightWing=new Fr,this.rightWing.add(r),this.add(this.rightWing),this.leftWing.position.x=5,this.leftWing.rotation.x=.2617994,this.resetJoints()}resetJoints(){this.leftWing.rotation.y=.01,this.leftWing.rotation.z=.2617994,this.updateRightWing()}updateRightWing(){this.rightWing.position.x=-this.leftWing.position.x,this.rightWing.position.y=this.leftWing.position.y,this.rightWing.rotation.x=this.leftWing.rotation.x,this.rightWing.rotation.y=-this.leftWing.rotation.y,this.rightWing.rotation.z=-this.leftWing.rotation.z}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},bC=class extends Fr{constructor(){super(),Object.defineProperty(this,"rightEar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftEar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new jc({side:Qa});let e=new mr(8,8,4/3);xC(e,0,0,6,6,1,14,7),this.rightEar=new Nn(e,this.material),this.rightEar.name="rightEar",this.rightEar.position.x=-6,this.add(this.rightEar),this.leftEar=new Nn(e,this.material),this.leftEar.name="leftEar",this.leftEar.position.x=6,this.add(this.leftEar)}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},p6e=10.8*Math.PI/180,L5=class extends Fr{constructor(){super(),Object.defineProperty(this,"skin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cape",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"elytra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ears",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.skin=new gC,this.skin.name="skin",this.skin.position.y=8,this.add(this.skin),this.cape=new _C,this.cape.name="cape",this.cape.position.y=8,this.cape.position.z=-2,this.cape.rotation.x=p6e,this.cape.rotation.y=Math.PI,this.add(this.cape),this.elytra=new yC,this.elytra.name="elytra",this.elytra.position.y=8,this.elytra.position.z=-2,this.elytra.visible=!1,this.add(this.elytra),this.ears=new bC,this.ears.name="ears",this.ears.position.y=10,this.ears.position.z=2/3,this.ears.visible=!1,this.skin.head.add(this.ears)}get backEquipment(){return this.cape.visible?"cape":this.elytra.visible?"elytra":null}set backEquipment(e){this.cape.visible=e==="cape",this.elytra.visible=e==="elytra"}resetJoints(){this.skin.resetJoints(),this.cape.rotation.x=p6e,this.cape.position.y=8,this.cape.position.z=-2,this.elytra.position.y=8,this.elytra.position.z=-2,this.elytra.rotation.x=0,this.elytra.resetJoints()}};h();p();m();h();p();m();var Sb=class{constructor(){Object.defineProperty(this,"speed",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"paused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"progress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"currentId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progress0",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"animationObjects",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}update(e,t){if(this.paused)return;let n=t*this.speed;this.animate(e,n),this.animationObjects.forEach((r,s)=>{let a=this.progress0.get(s);r(e,this.progress-a,s)}),this.progress+=n}addAnimation(e){let t=this.currentId++;return this.progress0.set(t,this.progress),this.animationObjects.set(t,e),t}removeAnimation(e){e!=null&&(this.animationObjects.delete(e),this.progress0.delete(e))}};h();p();m();h();p();m();var $je=Object.defineProperty,Yje=(i,e,t)=>e in i?$je(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,nr=(i,e,t)=>(Yje(i,typeof e!="symbol"?e+"":e,t),t);function wC(i){let e=[i];if(i.extra&&i.extra.length!==0)for(let t of i.extra)e.push(...wC(t));return e}var Vt=class{constructor(i,e,t,n,r,s){this.key=i,this.value=e,this.name=t,this.code=n,this.cssForeground=r,this.cssBackground=s}applyToStyle(i){i[this.key]=this.value}matchStyle(i){return i[this.key]===this.value}static fromCode(i){let t="0123456789abcdefklmnor".indexOf(i);if(t)return this.list[t]}toString(){return`${Vt.CONTROL_STRING}${this.code}`}},rr=Vt;nr(rr,"CONTROL_STRING","\xA7");nr(rr,"BLACK",new Vt("color","black","BLACK","0",{color:"#000000"},{color:"#000000"}));nr(rr,"DARK_BLUE",new Vt("color","dark_blue","DARK_BLUE","1",{color:"#0000AA"},{color:"#00002A"}));nr(rr,"DARK_GREEN",new Vt("color","dark_green","DARK_GREEN","2",{color:"#00AA00"},{color:"#002A00"}));nr(rr,"DARK_AQUA",new Vt("color","dark_aqua","DARK_AQUA","3",{color:"#00AAAA"},{color:"#002A2A"}));nr(rr,"DARK_RED",new Vt("color","dark_red","DARK_RED","4",{color:"#AA0000"},{color:"#2A0000"}));nr(rr,"DARK_PURPLE",new Vt("color","dark_purple","DARK_PURPLE","5",{color:"#AA00AA"},{color:"#2A002A"}));nr(rr,"GOLD",new Vt("color","gold","GOLD","6",{color:"#FFAA00"},{color:"#2A2A00"}));nr(rr,"GRAY",new Vt("color","gray","GRAY","7",{color:"#AAAAAA"},{color:"#2A2A2A"}));nr(rr,"DARK_GRAY",new Vt("color","dark_gray","DARK_GRAY","8",{color:"#555555"},{color:"#151515"}));nr(rr,"BLUE",new Vt("color","blue","BLUE","9",{color:"#5555FF"},{color:"#15153F"}));nr(rr,"GREEN",new Vt("color","green","GREEN","a",{color:"#55FF55"},{color:"#153F15"}));nr(rr,"AQUA",new Vt("color","aqua","AQUA","b",{color:"#55FFFF"},{color:"#153F3F"}));nr(rr,"RED",new Vt("color","red","RED","c",{color:"#FF5555"},{color:"#3F1515"}));nr(rr,"LIGHT_PURPLE",new Vt("color","light_purple","LIGHT_PURPLE","d",{color:"#FF55FF"},{color:"#3F153F"}));nr(rr,"YELLOW",new Vt("color","yellow","YELLOW","e",{color:"#FFFF55"},{color:"#3F3F15"}));nr(rr,"WHITE",new Vt("color","white","WHITE","f",{color:"#FFFFFF"},{color:"#3F3F3F"}));nr(rr,"OBFUSCATED",new Vt("obfuscated",!0,"OBFUSCATED","k",{}));nr(rr,"BOLD",new Vt("bold",!0,"BOLD","l",{"font-weight":"bold"}));nr(rr,"STRIKETHROUGH",new Vt("strikethrough",!0,"STRIKETHROUGH","m",{"text-decoration":"line-through"}));nr(rr,"UNDERLINE",new Vt("underlined",!0,"UNDERLINE","n",{"text-decoration":"underline"}));nr(rr,"ITALIC",new Vt("italic",!0,"ITALIC","o",{"font-style":"italic"}));nr(rr,"RESET",{name:"RESET",code:"r",applyToStyle(i){i.bold=!1,i.strikethrough=!1,i.underlined=!1,i.italic=!1,i.obfuscated=!1,i.color=void 0},matchStyle(i){return!1},cssBackground:{},cssForeground:{},toString(){return`${Vt.CONTROL_STRING}r`}});nr(rr,"list",[Vt.BLACK,Vt.DARK_BLUE,Vt.DARK_GREEN,Vt.DARK_AQUA,Vt.DARK_RED,Vt.DARK_PURPLE,Vt.GOLD,Vt.GRAY,Vt.DARK_GRAY,Vt.BLUE,Vt.GREEN,Vt.AQUA,Vt.RED,Vt.LIGHT_PURPLE,Vt.YELLOW,Vt.WHITE,Vt.OBFUSCATED,Vt.BOLD,Vt.STRIKETHROUGH,Vt.UNDERLINE,Vt.ITALIC,Vt.RESET]);var ng=Yr(sv(),1);AC();var r_e=Yr(A6e(),1),dP=Yr(V8(),1);h();p();m();var gXe=(i,e)=>{try{return JSON.parse(i)}catch(t){return console.warn(`Failed to parse ${e}`,t),null}},_Xe={black:"#000000",dark_blue:"#0000AA",dark_green:"#00AA00",dark_aqua:"#00AAAA",dark_red:"#AA0000",dark_purple:"#AA00AA",gold:"#FFAA00",gray:"#AAAAAA",dark_gray:"#555555",blue:"#5555FF",green:"#55FF55",aqua:"#55FFFF",red:"#FF5555",light_purple:"#FF55FF",yellow:"#FFFF55",white:"#FFFFFF"},k6e=(i,e,t,n=s=>{},r=(s,a)=>yi(s,a))=>{let o=[16,9],l=o[0]-o[1],c=l/16,u="front_text"in i?i.front_text.messages:[i.Text1,i.Text2,i.Text3,i.Text4];if(!u.some(g=>g!=="null"))return;let d=r(16*40,l*40),f=d.getContext("2d");n(f);let v=("front_text"in i?i.front_text.color:i.Color)||"black";for(let[g,b]of u.slice(0,4).entries())b!=="null"&&kC(b,t,d,64,v,64*(g+1)+(e?0:-8));return d},kC=(i,e,t,n,r,s=0)=>{let a=!1,o=typeof i=="string"&&(i?.startsWith("{")||i?.startsWith('"'))?gXe(i??'""',"sign text"):i;if(!o||typeof o!="object"&&typeof o!="string")return;let l=t.getContext("2d");if(!l)throw new Error("Could not get 2d context");l.imageSmoothingEnabled=!1,l.font=`${n}px mojangles`;let c=new e(o),u=[],d=!1,f="",v=s,g=[],b=(w,S)=>{w.text!==null&&w.text!==void 0&&typeof w.text!="string"&&console.warn("renderText received non-string text value:",typeof w.text,w.text);let A=w.text===null||w.text===void 0?void 0:String(w.text),T={color:w.color??S?.color,underlined:w.underlined??S?.underlined,strikethrough:w.strikethrough??S?.strikethrough,bold:w.bold??S?.bold,italic:w.italic??S?.italic};if(d=d||T.underlined||T.strikethrough||!1,A?.includes(`
|
|
8639
8639
|
`))for(let P of A.split(`
|
|
8640
|
-
`))y(P,T),v+=n,f="";else A&&y(A,T);if(w.extra)for(let P of w.extra)b(P,T)},y=(w,S)=>{a||(a=w.trim()!==""),f+=w,g[v]=l.measureText(f).width;let A=S.color??r;A.startsWith("#")||(A=_Xe[A.toLowerCase()]||A),u.push({fontStyle:`${S.bold?"bold":""} ${S.italic?"italic":""}`,fillStyle:A,underlineStyle:S.underlined??!1,strikeStyle:S.strikethrough??!1,offset:v,text:w})};if(b(c),!d&&!c.toString().trim())return;let _=0,x=0;for(let{fillStyle:w,fontStyle:S,underlineStyle:A,strikeStyle:T,offset:P,text:I}of u){x!==P&&(_=0),x=P,l.fillStyle=w,l.textRendering="optimizeLegibility",l.font=`${S} ${n}px mojangles`;let k=g[P]??l.measureText(I).width,L=(t.width-k)/2+_;l.fillText(I,L,P),T&&(l.lineWidth=n/8,l.strokeStyle=w,l.beginPath(),l.moveTo(L,P-l.lineWidth*2.5),l.lineTo(L+l.measureText(I).width,P-l.lineWidth*2.5),l.stroke()),A&&(l.lineWidth=n/8,l.strokeStyle=w,l.beginPath(),l.moveTo(L,P+l.lineWidth),l.lineTo(L+l.measureText(I).width,P+l.lineWidth),l.stroke()),_+=l.measureText(I).width}return a};h();p();m();h();p();m();var yXe=i=>Math.max(0,Math.min(1,i)),bXe=(i,e,t)=>i+(e-i)*t;function xXe(i){let e=i?.elytra;if(!e)return;if(typeof e.updateRightWing=="function"){e.updateRightWing();return}if(typeof e.updateRightWingRotation=="function"){e.updateRightWingRotation();return}let t=e.leftWing,n=e.rightWing;!t?.rotation||!n?.rotation||typeof n.rotation.copy=="function"&&(n.rotation.copy(t.rotation),n.rotation.z*=-1)}var Qv=class extends Sb{switchAnimationCallback;isRunning=!1;isMoving=!0;isCrouched=!1;_dt=0;_phase=0;_moveBlend=0;_swingTime=null;_swingDuration=.25;_defaults=null;update(e,t){this._dt=t,super.update(e,t)}swingArm(){(this._swingTime===null||this._swingTime>=this._swingDuration/2)&&(this._swingTime=0)}_captureDefaults(e){this._defaults={bodyPos:e.skin.body.position.clone(),bodyRot:e.skin.body.rotation.clone(),leftArmPos:e.skin.leftArm.position.clone(),leftArmRot:e.skin.leftArm.rotation.clone(),rightArmPos:e.skin.rightArm.position.clone(),rightArmRot:e.skin.rightArm.rotation.clone(),leftLegPos:e.skin.leftLeg.position.clone(),leftLegRot:e.skin.leftLeg.rotation.clone(),rightLegPos:e.skin.rightLeg.position.clone(),rightLegRot:e.skin.rightLeg.rotation.clone(),headPos:e.skin.head.position.clone(),headRot:e.skin.head.rotation.clone(),capePos:e.cape.position.clone(),capeRot:e.cape.rotation.clone(),elytraPos:e.elytra.position.clone(),elytraRot:e.elytra.rotation.clone()}}_applyDefaults(e){let t=this._defaults;t&&(e.skin.body.position.copy(t.bodyPos),e.skin.body.rotation.copy(t.bodyRot),e.skin.leftArm.position.copy(t.leftArmPos),e.skin.leftArm.rotation.copy(t.leftArmRot),e.skin.rightArm.position.copy(t.rightArmPos),e.skin.rightArm.rotation.copy(t.rightArmRot),e.skin.leftLeg.position.copy(t.leftLegPos),e.skin.leftLeg.rotation.copy(t.leftLegRot),e.skin.rightLeg.position.copy(t.rightLegPos),e.skin.rightLeg.rotation.copy(t.rightLegRot),e.skin.head.position.copy(t.headPos),e.skin.head.rotation.copy(t.headRot),e.cape.position.copy(t.capePos),e.cape.rotation.copy(t.capeRot),e.elytra.position.copy(t.elytraPos),e.elytra.rotation.copy(t.elytraRot))}animate(e){let t=this._dt||0;this._defaults||this._captureDefaults(e),this._applyDefaults(e);let n=this.isMoving?1:0,r=Math.min(1,t*20);this._moveBlend+=(n-this._moveBlend)*r;let s=this.isRunning?10:8;this._phase+=t*s*this._moveBlend;let a=this._phase+(this.isRunning?Math.PI*.5:0),o=!1;SXe(e,this.isCrouched?1:0);let l=this.isRunning?Math.cos(a):Math.sin(a);if(Math.abs(l)<.02&&this.switchAnimationCallback&&(o=!0),this.isRunning?(e.skin.leftLeg.rotation.x
|
|
8640
|
+
`))y(P,T),v+=n,f="";else A&&y(A,T);if(w.extra)for(let P of w.extra)b(P,T)},y=(w,S)=>{a||(a=w.trim()!==""),f+=w,g[v]=l.measureText(f).width;let A=S.color??r;A.startsWith("#")||(A=_Xe[A.toLowerCase()]||A),u.push({fontStyle:`${S.bold?"bold":""} ${S.italic?"italic":""}`,fillStyle:A,underlineStyle:S.underlined??!1,strikeStyle:S.strikethrough??!1,offset:v,text:w})};if(b(c),!d&&!c.toString().trim())return;let _=0,x=0;for(let{fillStyle:w,fontStyle:S,underlineStyle:A,strikeStyle:T,offset:P,text:I}of u){x!==P&&(_=0),x=P,l.fillStyle=w,l.textRendering="optimizeLegibility",l.font=`${S} ${n}px mojangles`;let k=g[P]??l.measureText(I).width,L=(t.width-k)/2+_;l.fillText(I,L,P),T&&(l.lineWidth=n/8,l.strokeStyle=w,l.beginPath(),l.moveTo(L,P-l.lineWidth*2.5),l.lineTo(L+l.measureText(I).width,P-l.lineWidth*2.5),l.stroke()),A&&(l.lineWidth=n/8,l.strokeStyle=w,l.beginPath(),l.moveTo(L,P+l.lineWidth),l.lineTo(L+l.measureText(I).width,P+l.lineWidth),l.stroke()),_+=l.measureText(I).width}return a};h();p();m();h();p();m();var yXe=i=>Math.max(0,Math.min(1,i)),bXe=(i,e,t)=>i+(e-i)*t;function xXe(i){let e=i?.elytra;if(!e)return;if(typeof e.updateRightWing=="function"){e.updateRightWing();return}if(typeof e.updateRightWingRotation=="function"){e.updateRightWingRotation();return}let t=e.leftWing,n=e.rightWing;!t?.rotation||!n?.rotation||typeof n.rotation.copy=="function"&&(n.rotation.copy(t.rotation),n.rotation.z*=-1)}var Qv=class extends Sb{switchAnimationCallback;isRunning=!1;isMoving=!0;isCrouched=!1;_dt=0;_phase=0;_moveBlend=0;_swingTime=null;_swingDuration=.25;_defaults=null;update(e,t){this._dt=t,super.update(e,t)}swingArm(){(this._swingTime===null||this._swingTime>=this._swingDuration/2)&&(this._swingTime=0)}_captureDefaults(e){this._defaults={bodyPos:e.skin.body.position.clone(),bodyRot:e.skin.body.rotation.clone(),leftArmPos:e.skin.leftArm.position.clone(),leftArmRot:e.skin.leftArm.rotation.clone(),rightArmPos:e.skin.rightArm.position.clone(),rightArmRot:e.skin.rightArm.rotation.clone(),leftLegPos:e.skin.leftLeg.position.clone(),leftLegRot:e.skin.leftLeg.rotation.clone(),rightLegPos:e.skin.rightLeg.position.clone(),rightLegRot:e.skin.rightLeg.rotation.clone(),headPos:e.skin.head.position.clone(),headRot:e.skin.head.rotation.clone(),capePos:e.cape.position.clone(),capeRot:e.cape.rotation.clone(),elytraPos:e.elytra.position.clone(),elytraRot:e.elytra.rotation.clone()}}_applyDefaults(e){let t=this._defaults;t&&(e.skin.body.position.copy(t.bodyPos),e.skin.body.rotation.copy(t.bodyRot),e.skin.leftArm.position.copy(t.leftArmPos),e.skin.leftArm.rotation.copy(t.leftArmRot),e.skin.rightArm.position.copy(t.rightArmPos),e.skin.rightArm.rotation.copy(t.rightArmRot),e.skin.leftLeg.position.copy(t.leftLegPos),e.skin.leftLeg.rotation.copy(t.leftLegRot),e.skin.rightLeg.position.copy(t.rightLegPos),e.skin.rightLeg.rotation.copy(t.rightLegRot),e.skin.head.position.copy(t.headPos),e.skin.head.rotation.copy(t.headRot),e.cape.position.copy(t.capePos),e.cape.rotation.copy(t.capeRot),e.elytra.position.copy(t.elytraPos),e.elytra.rotation.copy(t.elytraRot))}animate(e){let t=this._dt||0;this._defaults||this._captureDefaults(e),this._applyDefaults(e);let n=this.isMoving?1:0,r=Math.min(1,t*20);this._moveBlend+=(n-this._moveBlend)*r;let s=this.isRunning?10:8;this._phase+=t*s*this._moveBlend;let a=this._phase+(this.isRunning?Math.PI*.5:0),o=!1;SXe(e,this.isCrouched?1:0);let l=this.isRunning?Math.cos(a):Math.sin(a);if(Math.abs(l)<.02&&this.switchAnimationCallback&&(o=!0),this.isRunning?(e.skin.leftLeg.rotation.x+=Math.cos(a+Math.PI)*1.3*this._moveBlend,e.skin.rightLeg.rotation.x+=Math.cos(a)*1.3*this._moveBlend):(e.skin.leftLeg.rotation.x+=Math.sin(a)*.5*this._moveBlend,e.skin.rightLeg.rotation.x+=Math.sin(a+Math.PI)*.5*this._moveBlend),this.isRunning){e.skin.leftArm.rotation.x+=Math.cos(a)*1.5*this._moveBlend,e.skin.rightArm.rotation.x+=Math.cos(a+Math.PI)*1.5*this._moveBlend;let c=Math.PI*.1;e.skin.leftArm.rotation.z+=(Math.cos(a)*.1+c)*this._moveBlend,e.skin.rightArm.rotation.z+=(Math.cos(a+Math.PI)*.1-c)*this._moveBlend}else{e.skin.leftArm.rotation.x+=Math.sin(a+Math.PI)*.5*this._moveBlend,e.skin.rightArm.rotation.x+=Math.sin(a)*.5*this._moveBlend;let c=Math.PI*.02;e.skin.leftArm.rotation.z+=(Math.cos(a)*.03+c)*this._moveBlend,e.skin.rightArm.rotation.z+=(Math.cos(a+Math.PI)*.03-c)*this._moveBlend}if(this._swingTime!==null){this._swingTime+=t;let c=Math.min(this._swingTime/this._swingDuration,1);wXe.animate(c,e,this.isMoving),c>=1&&(this._swingTime=null)}if(this.isRunning&&(e.rotation.z=Math.cos(a+Math.PI)*.01*this._moveBlend),this.isRunning){let c=Math.PI*.3;e.cape.rotation.x+=(Math.sin(a*2)*.1+c)*this._moveBlend}else{let c=Math.PI*.06;e.cape.rotation.x+=(Math.sin(a/1.5)*.06+c)*this._moveBlend}if(o){let c=this.switchAnimationCallback;this.switchAnimationCallback=null,c?.()}}},wXe={animate(i,e,t){if(!e?.skin?.rightArm?.rotation)return;let n=Math.sin(i*Math.PI);if(e.skin.rightArm.rotation.x=-.4537860552*2-2*n*.3,!t){let r=.01*Math.PI+.06;e.skin.rightArm.rotation.z=-n*.403+r,e.skin.body.rotation.y=-n*.06,e.skin.leftArm.rotation.x=-n*.077,e.skin.leftArm.rotation.z=-n*.015+.13-.05,e.skin.leftArm.position.z=n*.3,e.skin.leftArm.position.x=5-n*.05}}};function SXe(i,e){let t=i?.skin,n=i?.cape,r=i?.elytra;if(!t||!n)return;let s=yXe(e),a=Math.abs(Math.sin(s*Math.PI/2));if(a<=1e-6)return;t.body.rotation.x+=.4537860552*a,t.body.position.z+=(1.3256181-3.4500310377)*a,t.body.position.y+=-2.103677462*a,n.position.y+=-1.851236166577372*a,n.rotation.x+=.294220265771*a,n.position.z+=(3.786619432-3.4500310377)*a,r?.position&&r.position.copy(n.position),r?.rotation&&r.rotation.copy(n.rotation),r?.rotation&&(r.rotation.x-=10.8*Math.PI/180),r?.leftWing?.rotation&&(r.leftWing.rotation.z=bXe(.72,.26179944+.4582006,a)),xXe(i),t.head.position.y+=-3.618325234674*a;let o=.1*a,l=(3.618325234674-3.4500310377)*a,c=-2.53943318*a;t.leftArm.position.z+=l,t.rightArm.position.z+=l,t.leftArm.rotation.x+=.410367746202*a,t.rightArm.rotation.x+=.410367746202*a,t.leftArm.rotation.z+=o,t.rightArm.rotation.z+=-o,t.leftArm.position.y+=c,t.rightArm.position.y+=c,t.rightLeg.position.z+=-3.4500310377*a,t.leftLeg.position.z+=-3.4500310377*a}var EXe=-2e-4;function MXe(i){i.uniforms.uLogDepthBias={value:EXe},i.fragmentShader=i.fragmentShader.replace("#include <logdepthbuf_pars_fragment>",`#include <logdepthbuf_pars_fragment>
|
|
8641
8641
|
uniform float uLogDepthBias;`),i.fragmentShader=i.fragmentShader.replace("#include <logdepthbuf_fragment>",`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
8642
8642
|
gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5 + uLogDepthBias;
|
|
8643
8643
|
#endif`)}function T6e(i){i.userData.logDepthBiasApplied||(i.userData.logDepthBiasApplied=!0,i.onBeforeCompile=MXe,i.needsUpdate=!0)}function TC(i){let e=i.skin,t=[e.layer1Material,e.layer1MaterialBiased,e.layer2Material,e.layer2MaterialBiased];for(let n of t)n.transparent=!1,n.alphaTest=.1,n.depthWrite=!0;T6e(e.layer1MaterialBiased),T6e(e.layer2MaterialBiased)}h();p();m();Lt();function AXe(i,e){if(typeof document<"u"){let t=document.createElement("canvas");return t.width=i,t.height=e,t}return new OffscreenCanvas(i,e)}function kXe(i,e){let{depth:t,pixelSize:n}=e;if(i.width<=0||i.height<=0)throw new Error(`Invalid canvas dimensions: ${i.width}x${i.height}`);let s=i.getContext("2d").getImageData(0,0,i.width,i.height),{data:a}=s,o=i.width,l=i.height,c=t/2,u=n??1/Math.max(o,l),d=(P,I)=>{if(P<0||I<0||P>=o||I>=l)return!1;let k=(I*o+P)*4;return a[k+3]>128},f=[],v=[],g=[],b=[],y=0,_=(P,I,k,L,B,U,O,V)=>(f.push(P,I,k),g.push(L,B),b.push(U,O,V),y++),x=(P,I,k,L)=>{v.push(P,I,k,P,k,L)},w=(P,I)=>{let k=(P/o-.5)*u*o,L=-(I/l-.5)*u*l;return{x:k,y:L}},S=Array.from({length:l+1},()=>Array.from({length:o+1},()=>null)),A=Array.from({length:l+1},()=>Array.from({length:o+1},()=>null));for(let P=0;P<=l;P++)for(let I=0;I<=o;I++){let{x:k,y:L}=w(I-.5,P-.5),B=I/o,U=P/l,O=!1,V=[[I-1,P-1],[I,P-1],[I-1,P],[I,P]];for(let[F,J]of V)if(d(F,J)){O=!0;break}O&&(S[P][I]=_(k,L,c,B,U,0,0,1),A[P][I]=_(k,L,-c,B,U,0,0,-1))}for(let P=0;P<l;P++)for(let I=0;I<o;I++){if(!d(I,P))continue;let k=S[P][I],L=S[P][I+1],B=S[P+1][I+1],U=S[P+1][I],O=A[P][I],V=A[P][I+1],F=A[P+1][I+1],J=A[P+1][I];k!==null&&L!==null&&B!==null&&U!==null&&x(k,L,B,U),O!==null&&V!==null&&F!==null&&J!==null&&x(V,O,J,F)}for(let P=0;P<l;P++)for(let I=0;I<o;I++){if(!d(I,P))continue;let k=(I+.5)/o,L=(P+.5)/l;if(!d(I-1,P)){let B=S[P][I],U=S[P+1][I],O=A[P][I],V=A[P+1][I];if(B!==null&&U!==null&&O!==null&&V!==null){let F=_(f[B*3],f[B*3+1],f[B*3+2],k,L,-1,0,0),J=_(f[U*3],f[U*3+1],f[U*3+2],k,L,-1,0,0),$=_(f[V*3],f[V*3+1],f[V*3+2],k,L,-1,0,0),ne=_(f[O*3],f[O*3+1],f[O*3+2],k,L,-1,0,0);x(F,J,$,ne)}}if(!d(I+1,P)){let B=S[P+1][I+1],U=S[P][I+1],O=A[P+1][I+1],V=A[P][I+1];if(B!==null&&U!==null&&O!==null&&V!==null){let F=_(f[B*3],f[B*3+1],f[B*3+2],k,L,1,0,0),J=_(f[U*3],f[U*3+1],f[U*3+2],k,L,1,0,0),$=_(f[V*3],f[V*3+1],f[V*3+2],k,L,1,0,0),ne=_(f[O*3],f[O*3+1],f[O*3+2],k,L,1,0,0);x(F,J,$,ne)}}if(!d(I,P-1)){let B=S[P][I],U=S[P][I+1],O=A[P][I],V=A[P][I+1];if(B!==null&&U!==null&&O!==null&&V!==null){let F=_(f[B*3],f[B*3+1],f[B*3+2],k,L,0,-1,0),J=_(f[U*3],f[U*3+1],f[U*3+2],k,L,0,-1,0),$=_(f[V*3],f[V*3+1],f[V*3+2],k,L,0,-1,0),ne=_(f[O*3],f[O*3+1],f[O*3+2],k,L,0,-1,0);x(F,J,$,ne)}}if(!d(I,P+1)){let B=S[P+1][I+1],U=S[P+1][I],O=A[P+1][I+1],V=A[P+1][I];if(B!==null&&U!==null&&O!==null&&V!==null){let F=_(f[B*3],f[B*3+1],f[B*3+2],k,L,0,1,0),J=_(f[U*3],f[U*3+1],f[U*3+2],k,L,0,1,0),$=_(f[V*3],f[V*3+1],f[V*3+2],k,L,0,1,0),ne=_(f[O*3],f[O*3+1],f[O*3+2],k,L,0,1,0);x(F,J,$,ne)}}}let T=new dt;return T.setAttribute("position",new Je(f,3)),T.setAttribute("uv",new Je(g,2)),T.setAttribute("normal",new Je(b,3)),T.setIndex(v),T.computeVertexNormals(),{geometry:T,totalVertices:y,totalTriangles:v.length/3}}function TXe(i,e){let{u:t,v:n,sizeX:r,sizeY:s}=e,a=Math.max(1,Math.floor(r*i.image.width)),o=Math.max(1,Math.floor(s*i.image.height)),l=AXe(a,o),c=l.getContext("2d");if(!c)throw new Error("Failed to get 2d context for item texture canvas");return c.imageSmoothingEnabled=!1,c.drawImage(i.image,t*i.image.width,n*i.image.height,r*i.image.width,s*i.image.height,0,0,l.width,l.height),l}function I6e(i,e,t={}){let{faceCamera:n=!1,use3D:r=!0,depth:s=.04}=t,{u:a,v:o,sizeX:l,sizeY:c}=e;if(n){let b=i.clone();b.flipY=!0,b.offset.set(a,1-o-c),b.repeat.set(l,c),b.needsUpdate=!0,b.magFilter=ct,b.minFilter=ct;let y=new bs({map:b,transparent:!0,alphaTest:.1});return{mesh:new Zi(y),itemsTexture:b,cleanup(){b.dispose()}}}if(r)try{let b=TXe(i,e),{geometry:y}=kXe(b,{depth:s}),_=new On(b);_.magFilter=ct,_.minFilter=ct,_.wrapS=_.wrapT=jn,_.flipY=!1,_.needsUpdate=!0;let x=new Kr({map:_,side:In,transparent:!0,alphaTest:.1});return{mesh:new Ke(y,x),itemsTexture:_,cleanup(){_.dispose(),y.dispose(),x.map&&x.map.dispose(),x.dispose()}}}catch(b){console.warn("Failed to create 3D item mesh, falling back to 2D:",b)}let u=i.clone();u.flipY=!0,u.offset.set(a,1-o-c),u.repeat.set(l,c),u.needsUpdate=!0,u.magFilter=ct,u.minFilter=ct;let d=u.clone();d.repeat.x*=-1,d.needsUpdate=!0,d.offset.set(a+l,1-o-c);let f=new Kr({map:u,transparent:!0,alphaTest:.1}),v=new Kr({map:d,transparent:!0,alphaTest:.1});return{mesh:new Ke(new Sn(1,1,0),[new _t({color:0}),new _t({color:0}),new _t({color:0}),new _t({color:0}),f,v]),itemsTexture:u,itemsTextureFlipped:d,cleanup(){u.dispose(),d.dispose(),f.dispose(),v.dispose()}}}h();p();m();Lt();h();p();m();h();p();m();Lt();var R6e=parseInt(Ma.replace(/\D+/g,""));h();p();m();Lt();var IXe=/^[og]\s*(.+)?/,RXe=/^mtllib /,CXe=/^usemtl /,PXe=/^usemap /,C6e=new X,IC=new X,P6e=new X,L6e=new X,na=new X;function LXe(){let i={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(r,s){let a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);let o={index:this.materials.length,name:r||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){let c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(o),o},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){let s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),r&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){let r=n.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,s=this.object.geometry.vertices;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,s=this.object.geometry.normals;s.push(r[e+0],r[e+1],r[e+2]),s.push(r[t+0],r[t+1],r[t+2]),s.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,s=this.object.geometry.normals;C6e.fromArray(r,e),IC.fromArray(r,t),P6e.fromArray(r,n),na.subVectors(P6e,IC),L6e.subVectors(C6e,IC),na.cross(L6e),na.normalize(),s.push(na.x,na.y,na.z),s.push(na.x,na.y,na.z),s.push(na.x,na.y,na.z)},addColor:function(e,t,n){let r=this.colors,s=this.object.geometry.colors;r[e]!==void 0&&s.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&s.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&s.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,s=this.object.geometry.uvs;s.push(r[e+0],r[e+1]),s.push(r[t+0],r[t+1]),s.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,s,a,o,l,c){let u=this.vertices.length,d=this.parseVertexIndex(e,u),f=this.parseVertexIndex(t,u),v=this.parseVertexIndex(n,u);if(this.addVertex(d,f,v),this.addColor(d,f,v),o!==void 0&&o!==""){let g=this.normals.length;d=this.parseNormalIndex(o,g),f=this.parseNormalIndex(l,g),v=this.parseNormalIndex(c,g),this.addNormal(d,f,v)}else this.addFaceNormal(d,f,v);if(r!==void 0&&r!==""){let g=this.uvs.length;d=this.parseUVIndex(r,g),f=this.parseUVIndex(s,g),v=this.parseUVIndex(a,g),this.addUV(d,f,v),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){let s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";let n=this.vertices.length,r=this.uvs.length;for(let s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,a=t.length;s<a;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return i.startObject("",!1),i}var O5=class extends _r{constructor(e){super(e),this.materials=null}load(e,t,n,r){let s=this,a=new Zr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(o))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}setMaterials(e){return this.materials=e,this}parse(e){let t=new LXe;e.indexOf(`\r
|
package/package.json
CHANGED
|
@@ -147,27 +147,27 @@ export class WalkingGeneralSwing extends PlayerAnimation {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if (this.isRunning) {
|
|
150
|
-
player.skin.leftLeg.rotation.x
|
|
151
|
-
player.skin.rightLeg.rotation.x
|
|
150
|
+
player.skin.leftLeg.rotation.x += Math.cos(t + Math.PI) * 1.3 * this._moveBlend
|
|
151
|
+
player.skin.rightLeg.rotation.x += Math.cos(t) * 1.3 * this._moveBlend
|
|
152
152
|
} else {
|
|
153
|
-
player.skin.leftLeg.rotation.x
|
|
154
|
-
player.skin.rightLeg.rotation.x
|
|
153
|
+
player.skin.leftLeg.rotation.x += Math.sin(t) * 0.5 * this._moveBlend
|
|
154
|
+
player.skin.rightLeg.rotation.x += Math.sin(t + Math.PI) * 0.5 * this._moveBlend
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
if (this.isRunning) {
|
|
158
|
-
player.skin.leftArm.rotation.x
|
|
159
|
-
player.skin.rightArm.rotation.x
|
|
158
|
+
player.skin.leftArm.rotation.x += Math.cos(t) * 1.5 * this._moveBlend
|
|
159
|
+
player.skin.rightArm.rotation.x += Math.cos(t + Math.PI) * 1.5 * this._moveBlend
|
|
160
160
|
|
|
161
161
|
const basicArmRotationZ = Math.PI * 0.1
|
|
162
|
-
player.skin.leftArm.rotation.z
|
|
163
|
-
player.skin.rightArm.rotation.z
|
|
162
|
+
player.skin.leftArm.rotation.z += (Math.cos(t) * 0.1 + basicArmRotationZ) * this._moveBlend
|
|
163
|
+
player.skin.rightArm.rotation.z += (Math.cos(t + Math.PI) * 0.1 - basicArmRotationZ) * this._moveBlend
|
|
164
164
|
} else {
|
|
165
|
-
player.skin.leftArm.rotation.x
|
|
166
|
-
player.skin.rightArm.rotation.x
|
|
165
|
+
player.skin.leftArm.rotation.x += Math.sin(t + Math.PI) * 0.5 * this._moveBlend
|
|
166
|
+
player.skin.rightArm.rotation.x += Math.sin(t) * 0.5 * this._moveBlend
|
|
167
167
|
|
|
168
168
|
const basicArmRotationZ = Math.PI * 0.02
|
|
169
|
-
player.skin.leftArm.rotation.z
|
|
170
|
-
player.skin.rightArm.rotation.z
|
|
169
|
+
player.skin.leftArm.rotation.z += (Math.cos(t) * 0.03 + basicArmRotationZ) * this._moveBlend
|
|
170
|
+
player.skin.rightArm.rotation.z += (Math.cos(t + Math.PI) * 0.03 - basicArmRotationZ) * this._moveBlend
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
if (this._swingTime !== null) {
|
|
@@ -178,15 +178,15 @@ export class WalkingGeneralSwing extends PlayerAnimation {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
if (this.isRunning) {
|
|
181
|
-
player.rotation.z = Math.cos(t + Math.PI) * 0.01
|
|
181
|
+
player.rotation.z = Math.cos(t + Math.PI) * 0.01 * this._moveBlend
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
if (this.isRunning) {
|
|
185
185
|
const basicCapeRotationX = Math.PI * 0.3
|
|
186
|
-
player.cape.rotation.x
|
|
186
|
+
player.cape.rotation.x += (Math.sin(t * 2) * 0.1 + basicCapeRotationX) * this._moveBlend
|
|
187
187
|
} else {
|
|
188
188
|
const basicCapeRotationX = Math.PI * 0.06
|
|
189
|
-
player.cape.rotation.x
|
|
189
|
+
player.cape.rotation.x += (Math.sin(t / 1.5) * 0.06 + basicCapeRotationX) * this._moveBlend
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
if (reset) {
|