@albi_scando/as-design-system-threejs-lib 1.0.2 → 1.0.4

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.
@@ -30439,17 +30439,17 @@ class ia extends HTMLElement {
30439
30439
  this._isInitializing = !0, this._setupScene(), this._setupUI(), this._setupFlags(t, e), this._setupLanguageDialog(), this._setupEventListeners(), this._isInitialized = !0, this._isInitializing = !1, this.isConnected && this._animationFrameId === 0 && (this._animationFrameId = requestAnimationFrame(this._animate));
30440
30440
  }
30441
30441
  }
30442
- attributeChangedCallback(t, e) {
30443
- if (!(this._isInitialized || this._isInitializing) && t === ia._languagesAttribute && e != null)
30442
+ attributeChangedCallback(t, e, i) {
30443
+ if (e !== i && !(this._isInitialized || this._isInitializing) && t === ia._languagesAttribute && i != null)
30444
30444
  try {
30445
- const i = JSON.parse(e), n = this.getAttribute(
30445
+ const n = JSON.parse(i), r = this.getAttribute(
30446
30446
  ia._selectedAttribute
30447
30447
  );
30448
- Array.isArray(i) && i.length > 0 && this._initializeComponent(i, n);
30449
- } catch (i) {
30448
+ Array.isArray(n) && n.length > 0 && this._initializeComponent(n, r);
30449
+ } catch (n) {
30450
30450
  console.error(
30451
30451
  "LanguagePickerComponent: Error parsing languages attribute",
30452
- i
30452
+ n
30453
30453
  );
30454
30454
  }
30455
30455
  }
@@ -3952,7 +3952,7 @@ void main() {
3952
3952
 
3953
3953
  }
3954
3954
 
3955
- }`;class l0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const i=new qc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,i=new on({vertexShader:a0,fragmentShader:o0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Si(new ir(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class h0 extends En{constructor(t,e){super();const i=this;let n=null,r=1,a=null,o="local-floor",h=1,l=null,c=null,u=null,d=null,f=null,g=null;const _=new l0,m={},p=e.getContextAttributes();let T=null,b=null;const y=[],R=[],w=new Dt;let C=null;const I=new We;I.viewport=new he;const S=new We;S.viewport=new he;const M=[I,S],A=new lp;let B=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getTargetRaySpace()},this.getControllerGrip=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getGripSpace()},this.getHand=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getHandSpace()};function z(j){const ot=R.indexOf(j.inputSource);if(ot===-1)return;const nt=y[ot];nt!==void 0&&(nt.update(j.inputSource,j.frame,l||a),nt.dispatchEvent({type:j.type,data:j.inputSource}))}function W(){n.removeEventListener("select",z),n.removeEventListener("selectstart",z),n.removeEventListener("selectend",z),n.removeEventListener("squeeze",z),n.removeEventListener("squeezestart",z),n.removeEventListener("squeezeend",z),n.removeEventListener("end",W),n.removeEventListener("inputsourceschange",X);for(let j=0;j<y.length;j++){const ot=R[j];ot!==null&&(R[j]=null,y[j].disconnect(ot))}B=null,F=null,_.reset();for(const j in m)delete m[j];t.setRenderTarget(T),f=null,d=null,u=null,n=null,b=null,Jt.stop(),i.isPresenting=!1,t.setPixelRatio(C),t.setSize(w.width,w.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){r=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){o=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(j){l=j},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return n},this.setSession=async function(j){if(n=j,n!==null){if(T=t.getRenderTarget(),n.addEventListener("select",z),n.addEventListener("selectstart",z),n.addEventListener("selectend",z),n.addEventListener("squeeze",z),n.addEventListener("squeezestart",z),n.addEventListener("squeezeend",z),n.addEventListener("end",W),n.addEventListener("inputsourceschange",X),p.xrCompatible!==!0&&await e.makeXRCompatible(),C=t.getPixelRatio(),t.getSize(w),typeof XRWebGLBinding<"u"&&(u=new XRWebGLBinding(n,e)),u!==null&&"createProjectionLayer"in XRWebGLBinding.prototype){let nt=null,At=null,wt=null;p.depth&&(wt=p.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,nt=p.stencil?Xs:Ws,At=p.stencil?Vs:bn);const It={colorFormat:e.RGBA8,depthFormat:wt,scaleFactor:r};d=u.createProjectionLayer(It),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),b=new An(d.textureWidth,d.textureHeight,{format:li,type:xi,depthTexture:new hc(d.textureWidth,d.textureHeight,At,void 0,void 0,void 0,void 0,void 0,void 0,nt),stencilBuffer:p.stencil,colorSpace:t.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const nt={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(n,e,nt),n.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),b=new An(f.framebufferWidth,f.framebufferHeight,{format:li,type:xi,colorSpace:t.outputColorSpace,stencilBuffer:p.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(h),l=null,a=await n.requestReferenceSpace(o),Jt.setContext(n),Jt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function X(j){for(let ot=0;ot<j.removed.length;ot++){const nt=j.removed[ot],At=R.indexOf(nt);At>=0&&(R[At]=null,y[At].disconnect(nt))}for(let ot=0;ot<j.added.length;ot++){const nt=j.added[ot];let At=R.indexOf(nt);if(At===-1){for(let It=0;It<y.length;It++)if(It>=R.length){R.push(nt),At=It;break}else if(R[It]===null){R[It]=nt,At=It;break}if(At===-1)break}const wt=y[At];wt&&wt.connect(nt)}}const Q=new N,H=new N;function rt(j,ot,nt){Q.setFromMatrixPosition(ot.matrixWorld),H.setFromMatrixPosition(nt.matrixWorld);const At=Q.distanceTo(H),wt=ot.projectionMatrix.elements,It=nt.projectionMatrix.elements,de=wt[14]/(wt[10]-1),Wt=wt[14]/(wt[10]+1),P=(wt[9]+1)/wt[5],te=(wt[9]-1)/wt[5],Et=(wt[8]-1)/wt[0],Yt=(It[8]+1)/It[0],St=de*Et,se=de*Yt,pt=At/(-Et+Yt),zt=pt*-Et;if(ot.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(zt),j.translateZ(pt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),wt[10]===-1)j.projectionMatrix.copy(ot.projectionMatrix),j.projectionMatrixInverse.copy(ot.projectionMatrixInverse);else{const Ee=de+pt,fe=Wt+pt,E=St-zt,x=se+(At-zt),O=P*Wt/fe*Ee,Y=te*Wt/fe*Ee;j.projectionMatrix.makePerspective(E,x,O,Y,Ee,fe),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function ht(j,ot){ot===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ot.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(n===null)return;let ot=j.near,nt=j.far;_.texture!==null&&(_.depthNear>0&&(ot=_.depthNear),_.depthFar>0&&(nt=_.depthFar)),A.near=S.near=I.near=ot,A.far=S.far=I.far=nt,(B!==A.near||F!==A.far)&&(n.updateRenderState({depthNear:A.near,depthFar:A.far}),B=A.near,F=A.far),A.layers.mask=j.layers.mask|6,I.layers.mask=A.layers.mask&3,S.layers.mask=A.layers.mask&5;const At=j.parent,wt=A.cameras;ht(A,At);for(let It=0;It<wt.length;It++)ht(wt[It],At);wt.length===2?rt(A,I,S):A.projectionMatrix.copy(I.projectionMatrix),_t(j,A,At)};function _t(j,ot,nt){nt===null?j.matrix.copy(ot.matrixWorld):(j.matrix.copy(nt.matrixWorld),j.matrix.invert(),j.matrix.multiply(ot.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(ot.projectionMatrix),j.projectionMatrixInverse.copy(ot.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Nr*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(d===null&&f===null))return h},this.setFoveation=function(j){h=j,d!==null&&(d.fixedFoveation=j),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=j)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(A)},this.getCameraTexture=function(j){return m[j]};let Ot=null;function ne(j,ot){if(c=ot.getViewerPose(l||a),g=ot,c!==null){const nt=c.views;f!==null&&(t.setRenderTargetFramebuffer(b,f.framebuffer),t.setRenderTarget(b));let At=!1;nt.length!==A.cameras.length&&(A.cameras.length=0,At=!0);for(let Wt=0;Wt<nt.length;Wt++){const P=nt[Wt];let te=null;if(f!==null)te=f.getViewport(P);else{const Yt=u.getViewSubImage(d,P);te=Yt.viewport,Wt===0&&(t.setRenderTargetTextures(b,Yt.colorTexture,Yt.depthStencilTexture),t.setRenderTarget(b))}let Et=M[Wt];Et===void 0&&(Et=new We,Et.layers.enable(Wt),Et.viewport=new he,M[Wt]=Et),Et.matrix.fromArray(P.transform.matrix),Et.matrix.decompose(Et.position,Et.quaternion,Et.scale),Et.projectionMatrix.fromArray(P.projectionMatrix),Et.projectionMatrixInverse.copy(Et.projectionMatrix).invert(),Et.viewport.set(te.x,te.y,te.width,te.height),Wt===0&&(A.matrix.copy(Et.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),At===!0&&A.cameras.push(Et)}const wt=n.enabledFeatures;if(wt&&wt.includes("depth-sensing")&&n.depthUsage=="gpu-optimized"&&u){const Wt=u.getDepthInformation(nt[0]);Wt&&Wt.isValid&&Wt.texture&&_.init(Wt,n.renderState)}if(wt&&wt.includes("camera-access")&&(t.state.unbindTexture(),u))for(let Wt=0;Wt<nt.length;Wt++){const P=nt[Wt].camera;if(P){let te=m[P];te||(te=new qc,m[P]=te);const Et=u.getCameraImage(P);te.sourceTexture=Et}}}for(let nt=0;nt<y.length;nt++){const At=R[nt],wt=y[nt];At!==null&&wt!==void 0&&wt.update(At,ot,l||a)}Ot&&Ot(j,ot),ot.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ot}),g=null}const Jt=new _c;Jt.setAnimationLoop(ne),this.setAnimationLoop=function(j){Ot=j},this.dispose=function(){}}}const Fn=new yi,c0=new ue;function u0(s,t){function e(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,sc(s)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function n(m,p,T,b,y){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(m,p):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),c(m,p)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,y)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),_(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?h(m,p,T,b):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,e(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Ue&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,e(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Ue&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,e(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,e(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const T=t.get(p),b=T.envMap,y=T.envMapRotation;b&&(m.envMap.value=b,Fn.copy(y),Fn.x*=-1,Fn.y*=-1,Fn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Fn.y*=-1,Fn.z*=-1),m.envMapRotation.value.setFromMatrix4(c0.makeRotationFromEuler(Fn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function h(m,p,T,b){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*T,m.scale.value=b*.5,p.map&&(m.map.value=p.map,e(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,T){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ue&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=T.texture,m.transmissionSamplerSize.value.set(T.width,T.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){const T=t.get(p).light;m.referencePosition.value.setFromMatrixPosition(T.matrixWorld),m.nearDistance.value=T.shadow.camera.near,m.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function d0(s,t,e,i){let n={},r={},a=[];const o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function h(T,b){const y=b.program;i.uniformBlockBinding(T,y)}function l(T,b){let y=n[T.id];y===void 0&&(g(T),y=c(T),n[T.id]=y,T.addEventListener("dispose",m));const R=b.program;i.updateUBOMapping(T,R);const w=t.render.frame;r[T.id]!==w&&(d(T),r[T.id]=w)}function c(T){const b=u();T.__bindingPointIndex=b;const y=s.createBuffer(),R=T.__size,w=T.usage;return s.bindBuffer(s.UNIFORM_BUFFER,y),s.bufferData(s.UNIFORM_BUFFER,R,w),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,b,y),y}function u(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(T){const b=n[T.id],y=T.uniforms,R=T.__cache;s.bindBuffer(s.UNIFORM_BUFFER,b);for(let w=0,C=y.length;w<C;w++){const I=Array.isArray(y[w])?y[w]:[y[w]];for(let S=0,M=I.length;S<M;S++){const A=I[S];if(f(A,w,S,R)===!0){const B=A.__offset,F=Array.isArray(A.value)?A.value:[A.value];let z=0;for(let W=0;W<F.length;W++){const X=F[W],Q=_(X);typeof X=="number"||typeof X=="boolean"?(A.__data[0]=X,s.bufferSubData(s.UNIFORM_BUFFER,B+z,A.__data)):X.isMatrix3?(A.__data[0]=X.elements[0],A.__data[1]=X.elements[1],A.__data[2]=X.elements[2],A.__data[3]=0,A.__data[4]=X.elements[3],A.__data[5]=X.elements[4],A.__data[6]=X.elements[5],A.__data[7]=0,A.__data[8]=X.elements[6],A.__data[9]=X.elements[7],A.__data[10]=X.elements[8],A.__data[11]=0):(X.toArray(A.__data,z),z+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,B,A.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(T,b,y,R){const w=T.value,C=b+"_"+y;if(R[C]===void 0)return typeof w=="number"||typeof w=="boolean"?R[C]=w:R[C]=w.clone(),!0;{const I=R[C];if(typeof w=="number"||typeof w=="boolean"){if(I!==w)return R[C]=w,!0}else if(I.equals(w)===!1)return I.copy(w),!0}return!1}function g(T){const b=T.uniforms;let y=0;const R=16;for(let C=0,I=b.length;C<I;C++){const S=Array.isArray(b[C])?b[C]:[b[C]];for(let M=0,A=S.length;M<A;M++){const B=S[M],F=Array.isArray(B.value)?B.value:[B.value];for(let z=0,W=F.length;z<W;z++){const X=F[z],Q=_(X),H=y%R,rt=H%Q.boundary,ht=H+rt;y+=rt,ht!==0&&R-ht<Q.storage&&(y+=R-ht),B.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=y,y+=Q.storage}}}const w=y%R;return w>0&&(y+=R-w),T.__size=y,T.__cache={},this}function _(T){const b={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(b.boundary=4,b.storage=4):T.isVector2?(b.boundary=8,b.storage=8):T.isVector3||T.isColor?(b.boundary=16,b.storage=12):T.isVector4?(b.boundary=16,b.storage=16):T.isMatrix3?(b.boundary=48,b.storage=48):T.isMatrix4?(b.boundary=64,b.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),b}function m(T){const b=T.target;b.removeEventListener("dispose",m);const y=a.indexOf(b.__bindingPointIndex);a.splice(y,1),s.deleteBuffer(n[b.id]),delete n[b.id],delete r[b.id]}function p(){for(const T in n)s.deleteBuffer(n[T]);a=[],n={},r={}}return{bind:h,update:l,dispose:p}}class f0{constructor(t={}){const{canvas:e=Mf(),context:i=null,depth:n=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=i.getContextAttributes().alpha}else f=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,p=null;const T=[],b=[];this.domElement=e,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.toneMapping=Qi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let R=!1;this._outputColorSpace=Ke;let w=0,C=0,I=null,S=-1,M=null;const A=new he,B=new he;let F=null;const z=new Vt(0);let W=0,X=e.width,Q=e.height,H=1,rt=null,ht=null;const _t=new he(0,0,X,Q),Ot=new he(0,0,X,Q);let ne=!1;const Jt=new il;let j=!1,ot=!1;const nt=new ue,At=new N,wt=new he,It={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let de=!1;function Wt(){return I===null?H:1}let P=i;function te(v,D){return e.getContext(v,D)}try{const v={alpha:!0,depth:n,stencil:r,antialias:o,premultipliedAlpha:h,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Fa}`),e.addEventListener("webglcontextlost",st,!1),e.addEventListener("webglcontextrestored",ft,!1),e.addEventListener("webglcontextcreationerror",$,!1),P===null){const D="webgl2";if(P=te(D,v),P===null)throw te(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw console.error("THREE.WebGLRenderer: "+v.message),v}let Et,Yt,St,se,pt,zt,Ee,fe,E,x,O,Y,K,q,Mt,it,xt,vt,tt,ut,Ct,yt,lt,Nt;function L(){Et=new bg(P),Et.init(),yt=new r0(P,Et),Yt=new gg(P,Et,t,yt),St=new n0(P,Et),Yt.reversedDepthBuffer&&d&&St.buffers.depth.setReversed(!0),se=new Ag(P),pt=new W_,zt=new s0(P,Et,St,pt,Yt,yt,se),Ee=new xg(y),fe=new Sg(y),E=new dp(P),lt=new pg(P,E),x=new Eg(P,E,se,lt),O=new Rg(P,x,E,se),tt=new wg(P,Yt,zt),it=new _g(pt),Y=new V_(y,Ee,fe,Et,Yt,lt,it),K=new u0(y,pt),q=new q_,Mt=new J_(Et),vt=new fg(y,Ee,fe,St,O,f,h),xt=new e0(y,O,Yt),Nt=new d0(P,se,Yt,St),ut=new mg(P,Et,se),Ct=new Tg(P,Et,se),se.programs=Y.programs,y.capabilities=Yt,y.extensions=Et,y.properties=pt,y.renderLists=q,y.shadowMap=xt,y.state=St,y.info=se}L();const et=new h0(y,P);this.xr=et,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const v=Et.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Et.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(v){v!==void 0&&(H=v,this.setSize(X,Q,!1))},this.getSize=function(v){return v.set(X,Q)},this.setSize=function(v,D,k=!0){if(et.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=v,Q=D,e.width=Math.floor(v*H),e.height=Math.floor(D*H),k===!0&&(e.style.width=v+"px",e.style.height=D+"px"),this.setViewport(0,0,v,D)},this.getDrawingBufferSize=function(v){return v.set(X*H,Q*H).floor()},this.setDrawingBufferSize=function(v,D,k){X=v,Q=D,H=k,e.width=Math.floor(v*k),e.height=Math.floor(D*k),this.setViewport(0,0,v,D)},this.getCurrentViewport=function(v){return v.copy(A)},this.getViewport=function(v){return v.copy(_t)},this.setViewport=function(v,D,k,G){v.isVector4?_t.set(v.x,v.y,v.z,v.w):_t.set(v,D,k,G),St.viewport(A.copy(_t).multiplyScalar(H).round())},this.getScissor=function(v){return v.copy(Ot)},this.setScissor=function(v,D,k,G){v.isVector4?Ot.set(v.x,v.y,v.z,v.w):Ot.set(v,D,k,G),St.scissor(B.copy(Ot).multiplyScalar(H).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(v){St.setScissorTest(ne=v)},this.setOpaqueSort=function(v){rt=v},this.setTransparentSort=function(v){ht=v},this.getClearColor=function(v){return v.copy(vt.getClearColor())},this.setClearColor=function(){vt.setClearColor(...arguments)},this.getClearAlpha=function(){return vt.getClearAlpha()},this.setClearAlpha=function(){vt.setClearAlpha(...arguments)},this.clear=function(v=!0,D=!0,k=!0){let G=0;if(v){let U=!1;if(I!==null){const J=I.texture.format;U=J===io||J===eo||J===to}if(U){const J=I.texture.type,ct=J===xi||J===bn||J===Gs||J===Vs||J===Ja||J===Qa,mt=vt.getClearColor(),dt=vt.getClearAlpha(),Rt=mt.r,Pt=mt.g,bt=mt.b;ct?(g[0]=Rt,g[1]=Pt,g[2]=bt,g[3]=dt,P.clearBufferuiv(P.COLOR,0,g)):(_[0]=Rt,_[1]=Pt,_[2]=bt,_[3]=dt,P.clearBufferiv(P.COLOR,0,_))}else G|=P.COLOR_BUFFER_BIT}D&&(G|=P.DEPTH_BUFFER_BIT),k&&(G|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",st,!1),e.removeEventListener("webglcontextrestored",ft,!1),e.removeEventListener("webglcontextcreationerror",$,!1),vt.dispose(),q.dispose(),Mt.dispose(),pt.dispose(),Ee.dispose(),fe.dispose(),O.dispose(),lt.dispose(),Nt.dispose(),Y.dispose(),et.dispose(),et.removeEventListener("sessionstart",Ei),et.removeEventListener("sessionend",$c),On.stop()};function st(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function ft(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;const v=se.autoReset,D=xt.enabled,k=xt.autoUpdate,G=xt.needsUpdate,U=xt.type;L(),se.autoReset=v,xt.enabled=D,xt.autoUpdate=k,xt.needsUpdate=G,xt.type=U}function $(v){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Z(v){const D=v.target;D.removeEventListener("dispose",Z),gt(D)}function gt(v){Lt(v),pt.remove(v)}function Lt(v){const D=pt.get(v).programs;D!==void 0&&(D.forEach(function(k){Y.releaseProgram(k)}),v.isShaderMaterial&&Y.releaseShaderCache(v))}this.renderBufferDirect=function(v,D,k,G,U,J){D===null&&(D=It);const ct=U.isMesh&&U.matrixWorld.determinant()<0,mt=P0(v,D,k,G,U);St.setMaterial(G,ct);let dt=k.index,Rt=1;if(G.wireframe===!0){if(dt=x.getWireframeAttribute(k),dt===void 0)return;Rt=2}const Pt=k.drawRange,bt=k.attributes.position;let kt=Pt.start*Rt,$t=(Pt.start+Pt.count)*Rt;J!==null&&(kt=Math.max(kt,J.start*Rt),$t=Math.min($t,(J.start+J.count)*Rt)),dt!==null?(kt=Math.max(kt,0),$t=Math.min($t,dt.count)):bt!=null&&(kt=Math.max(kt,0),$t=Math.min($t,bt.count));const ce=$t-kt;if(ce<0||ce===1/0)return;lt.setup(U,G,mt,k,dt);let ie,Qt=ut;if(dt!==null&&(ie=E.get(dt),Qt=Ct,Qt.setIndex(ie)),U.isMesh)G.wireframe===!0?(St.setLineWidth(G.wireframeLinewidth*Wt()),Qt.setMode(P.LINES)):Qt.setMode(P.TRIANGLES);else if(U.isLine){let Tt=G.linewidth;Tt===void 0&&(Tt=1),St.setLineWidth(Tt*Wt()),U.isLineSegments?Qt.setMode(P.LINES):U.isLineLoop?Qt.setMode(P.LINE_LOOP):Qt.setMode(P.LINE_STRIP)}else U.isPoints?Qt.setMode(P.POINTS):U.isSprite&&Qt.setMode(P.TRIANGLES);if(U.isBatchedMesh)if(U._multiDrawInstances!==null)os("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Qt.renderMultiDrawInstances(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount,U._multiDrawInstances);else if(Et.get("WEBGL_multi_draw"))Qt.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{const Tt=U._multiDrawStarts,re=U._multiDrawCounts,qt=U._multiDrawCount,Xe=dt?E.get(dt).bytesPerElement:1,ws=pt.get(G).currentProgram.getUniforms();for(let qe=0;qe<qt;qe++)ws.setValue(P,"_gl_DrawID",qe),Qt.render(Tt[qe]/Xe,re[qe])}else if(U.isInstancedMesh)Qt.renderInstances(kt,ce,U.count);else if(k.isInstancedBufferGeometry){const Tt=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,re=Math.min(k.instanceCount,Tt);Qt.renderInstances(kt,ce,re)}else Qt.render(kt,ce)};function ee(v,D,k){v.transparent===!0&&v.side===Ni&&v.forceSinglePass===!1?(v.side=Ue,v.needsUpdate=!0,oa(v,D,k),v.side=$i,v.needsUpdate=!0,oa(v,D,k),v.side=Ni):oa(v,D,k)}this.compile=function(v,D,k=null){k===null&&(k=v),p=Mt.get(k),p.init(D),b.push(p),k.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(p.pushLight(U),U.castShadow&&p.pushShadow(U))}),v!==k&&v.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(p.pushLight(U),U.castShadow&&p.pushShadow(U))}),p.setupLights();const G=new Set;return v.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;const J=U.material;if(J)if(Array.isArray(J))for(let ct=0;ct<J.length;ct++){const mt=J[ct];ee(mt,k,U),G.add(mt)}else ee(J,k,U),G.add(J)}),p=b.pop(),G},this.compileAsync=function(v,D,k=null){const G=this.compile(v,D,k);return new Promise(U=>{function J(){if(G.forEach(function(ct){pt.get(ct).currentProgram.isReady()&&G.delete(ct)}),G.size===0){U(v);return}setTimeout(J,10)}Et.get("KHR_parallel_shader_compile")!==null?J():setTimeout(J,10)})};let jt=null;function Vi(v){jt&&jt(v)}function Ei(){On.stop()}function $c(){On.start()}const On=new _c;On.setAnimationLoop(Vi),typeof self<"u"&&On.setContext(self),this.setAnimationLoop=function(v){jt=v,et.setAnimationLoop(v),v===null?On.stop():On.start()},et.addEventListener("sessionstart",Ei),et.addEventListener("sessionend",$c),this.render=function(v,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),et.enabled===!0&&et.isPresenting===!0&&(et.cameraAutoUpdate===!0&&et.updateCamera(D),D=et.getCamera()),v.isScene===!0&&v.onBeforeRender(y,v,D,I),p=Mt.get(v,b.length),p.init(D),b.push(p),nt.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Jt.setFromProjectionMatrix(nt,vi,D.reversedDepth),ot=this.localClippingEnabled,j=it.init(this.clippingPlanes,ot),m=q.get(v,T.length),m.init(),T.push(m),et.enabled===!0&&et.isPresenting===!0){const J=y.xr.getDepthSensingMesh();J!==null&&_l(J,D,-1/0,y.sortObjects)}_l(v,D,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(rt,ht),de=et.enabled===!1||et.isPresenting===!1||et.hasDepthSensing()===!1,de&&vt.addToRenderList(m,v),this.info.render.frame++,j===!0&&it.beginShadows();const k=p.state.shadowsArray;xt.render(k,v,D),j===!0&&it.endShadows(),this.info.autoReset===!0&&this.info.reset();const G=m.opaque,U=m.transmissive;if(p.setupLights(),D.isArrayCamera){const J=D.cameras;if(U.length>0)for(let ct=0,mt=J.length;ct<mt;ct++){const dt=J[ct];Qc(G,U,v,dt)}de&&vt.render(v);for(let ct=0,mt=J.length;ct<mt;ct++){const dt=J[ct];Jc(m,v,dt,dt.viewport)}}else U.length>0&&Qc(G,U,v,D),de&&vt.render(v),Jc(m,v,D);I!==null&&C===0&&(zt.updateMultisampleRenderTarget(I),zt.updateRenderTargetMipmap(I)),v.isScene===!0&&v.onAfterRender(y,v,D),lt.resetDefaultState(),S=-1,M=null,b.pop(),b.length>0?(p=b[b.length-1],j===!0&&it.setGlobalState(y.clippingPlanes,p.state.camera)):p=null,T.pop(),T.length>0?m=T[T.length-1]:m=null};function _l(v,D,k,G){if(v.visible===!1)return;if(v.layers.test(D.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(D);else if(v.isLight)p.pushLight(v),v.castShadow&&p.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Jt.intersectsSprite(v)){G&&wt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(nt);const ct=O.update(v),mt=v.material;mt.visible&&m.push(v,ct,mt,k,wt.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Jt.intersectsObject(v))){const ct=O.update(v),mt=v.material;if(G&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),wt.copy(v.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),wt.copy(ct.boundingSphere.center)),wt.applyMatrix4(v.matrixWorld).applyMatrix4(nt)),Array.isArray(mt)){const dt=ct.groups;for(let Rt=0,Pt=dt.length;Rt<Pt;Rt++){const bt=dt[Rt],kt=mt[bt.materialIndex];kt&&kt.visible&&m.push(v,ct,kt,k,wt.z,bt)}}else mt.visible&&m.push(v,ct,mt,k,wt.z,null)}}const J=v.children;for(let ct=0,mt=J.length;ct<mt;ct++)_l(J[ct],D,k,G)}function Jc(v,D,k,G){const U=v.opaque,J=v.transmissive,ct=v.transparent;p.setupLightsView(k),j===!0&&it.setGlobalState(y.clippingPlanes,k),G&&St.viewport(A.copy(G)),U.length>0&&aa(U,D,k),J.length>0&&aa(J,D,k),ct.length>0&&aa(ct,D,k),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function Qc(v,D,k,G){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[G.id]===void 0&&(p.state.transmissionRenderTarget[G.id]=new An(1,1,{generateMipmaps:!0,type:Et.has("EXT_color_buffer_half_float")||Et.has("EXT_color_buffer_float")?Hs:xi,minFilter:Sn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xt.workingColorSpace}));const J=p.state.transmissionRenderTarget[G.id],ct=G.viewport||A;J.setSize(ct.z*y.transmissionResolutionScale,ct.w*y.transmissionResolutionScale);const mt=y.getRenderTarget(),dt=y.getActiveCubeFace(),Rt=y.getActiveMipmapLevel();y.setRenderTarget(J),y.getClearColor(z),W=y.getClearAlpha(),W<1&&y.setClearColor(16777215,.5),y.clear(),de&&vt.render(k);const Pt=y.toneMapping;y.toneMapping=Qi;const bt=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),p.setupLightsView(G),j===!0&&it.setGlobalState(y.clippingPlanes,G),aa(v,k,G),zt.updateMultisampleRenderTarget(J),zt.updateRenderTargetMipmap(J),Et.has("WEBGL_multisampled_render_to_texture")===!1){let kt=!1;for(let $t=0,ce=D.length;$t<ce;$t++){const ie=D[$t],Qt=ie.object,Tt=ie.geometry,re=ie.material,qt=ie.group;if(re.side===Ni&&Qt.layers.test(G.layers)){const Xe=re.side;re.side=Ue,re.needsUpdate=!0,tu(Qt,k,G,Tt,re,qt),re.side=Xe,re.needsUpdate=!0,kt=!0}}kt===!0&&(zt.updateMultisampleRenderTarget(J),zt.updateRenderTargetMipmap(J))}y.setRenderTarget(mt,dt,Rt),y.setClearColor(z,W),bt!==void 0&&(G.viewport=bt),y.toneMapping=Pt}function aa(v,D,k){const G=D.isScene===!0?D.overrideMaterial:null;for(let U=0,J=v.length;U<J;U++){const ct=v[U],mt=ct.object,dt=ct.geometry,Rt=ct.group;let Pt=ct.material;Pt.allowOverride===!0&&G!==null&&(Pt=G),mt.layers.test(k.layers)&&tu(mt,D,k,dt,Pt,Rt)}}function tu(v,D,k,G,U,J){v.onBeforeRender(y,D,k,G,U,J),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),U.onBeforeRender(y,D,k,G,v,J),U.transparent===!0&&U.side===Ni&&U.forceSinglePass===!1?(U.side=Ue,U.needsUpdate=!0,y.renderBufferDirect(k,D,G,U,v,J),U.side=$i,U.needsUpdate=!0,y.renderBufferDirect(k,D,G,U,v,J),U.side=Ni):y.renderBufferDirect(k,D,G,U,v,J),v.onAfterRender(y,D,k,G,U,J)}function oa(v,D,k){D.isScene!==!0&&(D=It);const G=pt.get(v),U=p.state.lights,J=p.state.shadowsArray,ct=U.state.version,mt=Y.getParameters(v,U.state,J,D,k),dt=Y.getProgramCacheKey(mt);let Rt=G.programs;G.environment=v.isMeshStandardMaterial?D.environment:null,G.fog=D.fog,G.envMap=(v.isMeshStandardMaterial?fe:Ee).get(v.envMap||G.environment),G.envMapRotation=G.environment!==null&&v.envMap===null?D.environmentRotation:v.envMapRotation,Rt===void 0&&(v.addEventListener("dispose",Z),Rt=new Map,G.programs=Rt);let Pt=Rt.get(dt);if(Pt!==void 0){if(G.currentProgram===Pt&&G.lightsStateVersion===ct)return iu(v,mt),Pt}else mt.uniforms=Y.getUniforms(v),v.onBeforeCompile(mt,y),Pt=Y.acquireProgram(mt,dt),Rt.set(dt,Pt),G.uniforms=mt.uniforms;const bt=G.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(bt.clippingPlanes=it.uniform),iu(v,mt),G.needsLights=L0(v),G.lightsStateVersion=ct,G.needsLights&&(bt.ambientLightColor.value=U.state.ambient,bt.lightProbe.value=U.state.probe,bt.directionalLights.value=U.state.directional,bt.directionalLightShadows.value=U.state.directionalShadow,bt.spotLights.value=U.state.spot,bt.spotLightShadows.value=U.state.spotShadow,bt.rectAreaLights.value=U.state.rectArea,bt.ltc_1.value=U.state.rectAreaLTC1,bt.ltc_2.value=U.state.rectAreaLTC2,bt.pointLights.value=U.state.point,bt.pointLightShadows.value=U.state.pointShadow,bt.hemisphereLights.value=U.state.hemi,bt.directionalShadowMap.value=U.state.directionalShadowMap,bt.directionalShadowMatrix.value=U.state.directionalShadowMatrix,bt.spotShadowMap.value=U.state.spotShadowMap,bt.spotLightMatrix.value=U.state.spotLightMatrix,bt.spotLightMap.value=U.state.spotLightMap,bt.pointShadowMap.value=U.state.pointShadowMap,bt.pointShadowMatrix.value=U.state.pointShadowMatrix),G.currentProgram=Pt,G.uniformsList=null,Pt}function eu(v){if(v.uniformsList===null){const D=v.currentProgram.getUniforms();v.uniformsList=ia.seqWithValue(D.seq,v.uniforms)}return v.uniformsList}function iu(v,D){const k=pt.get(v);k.outputColorSpace=D.outputColorSpace,k.batching=D.batching,k.batchingColor=D.batchingColor,k.instancing=D.instancing,k.instancingColor=D.instancingColor,k.instancingMorph=D.instancingMorph,k.skinning=D.skinning,k.morphTargets=D.morphTargets,k.morphNormals=D.morphNormals,k.morphColors=D.morphColors,k.morphTargetsCount=D.morphTargetsCount,k.numClippingPlanes=D.numClippingPlanes,k.numIntersection=D.numClipIntersection,k.vertexAlphas=D.vertexAlphas,k.vertexTangents=D.vertexTangents,k.toneMapping=D.toneMapping}function P0(v,D,k,G,U){D.isScene!==!0&&(D=It),zt.resetTextureUnits();const J=D.fog,ct=G.isMeshStandardMaterial?D.environment:null,mt=I===null?y.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:rs,dt=(G.isMeshStandardMaterial?fe:Ee).get(G.envMap||ct),Rt=G.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Pt=!!k.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),bt=!!k.morphAttributes.position,kt=!!k.morphAttributes.normal,$t=!!k.morphAttributes.color;let ce=Qi;G.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(ce=y.toneMapping);const ie=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Qt=ie!==void 0?ie.length:0,Tt=pt.get(G),re=p.state.lights;if(j===!0&&(ot===!0||v!==M)){const Le=v===M&&G.id===S;it.setState(G,v,Le)}let qt=!1;G.version===Tt.__version?(Tt.needsLights&&Tt.lightsStateVersion!==re.state.version||Tt.outputColorSpace!==mt||U.isBatchedMesh&&Tt.batching===!1||!U.isBatchedMesh&&Tt.batching===!0||U.isBatchedMesh&&Tt.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&Tt.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&Tt.instancing===!1||!U.isInstancedMesh&&Tt.instancing===!0||U.isSkinnedMesh&&Tt.skinning===!1||!U.isSkinnedMesh&&Tt.skinning===!0||U.isInstancedMesh&&Tt.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Tt.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&Tt.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&Tt.instancingMorph===!1&&U.morphTexture!==null||Tt.envMap!==dt||G.fog===!0&&Tt.fog!==J||Tt.numClippingPlanes!==void 0&&(Tt.numClippingPlanes!==it.numPlanes||Tt.numIntersection!==it.numIntersection)||Tt.vertexAlphas!==Rt||Tt.vertexTangents!==Pt||Tt.morphTargets!==bt||Tt.morphNormals!==kt||Tt.morphColors!==$t||Tt.toneMapping!==ce||Tt.morphTargetsCount!==Qt)&&(qt=!0):(qt=!0,Tt.__version=G.version);let Xe=Tt.currentProgram;qt===!0&&(Xe=oa(G,D,U));let ws=!1,qe=!1,sr=!1;const ae=Xe.getUniforms(),Je=Tt.uniforms;if(St.useProgram(Xe.program)&&(ws=!0,qe=!0,sr=!0),G.id!==S&&(S=G.id,qe=!0),ws||M!==v){St.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),ae.setValue(P,"projectionMatrix",v.projectionMatrix),ae.setValue(P,"viewMatrix",v.matrixWorldInverse);const Oe=ae.map.cameraPosition;Oe!==void 0&&Oe.setValue(P,At.setFromMatrixPosition(v.matrixWorld)),Yt.logarithmicDepthBuffer&&ae.setValue(P,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&ae.setValue(P,"isOrthographic",v.isOrthographicCamera===!0),M!==v&&(M=v,qe=!0,sr=!0)}if(U.isSkinnedMesh){ae.setOptional(P,U,"bindMatrix"),ae.setOptional(P,U,"bindMatrixInverse");const Le=U.skeleton;Le&&(Le.boneTexture===null&&Le.computeBoneTexture(),ae.setValue(P,"boneTexture",Le.boneTexture,zt))}U.isBatchedMesh&&(ae.setOptional(P,U,"batchingTexture"),ae.setValue(P,"batchingTexture",U._matricesTexture,zt),ae.setOptional(P,U,"batchingIdTexture"),ae.setValue(P,"batchingIdTexture",U._indirectTexture,zt),ae.setOptional(P,U,"batchingColorTexture"),U._colorsTexture!==null&&ae.setValue(P,"batchingColorTexture",U._colorsTexture,zt));const Qe=k.morphAttributes;if((Qe.position!==void 0||Qe.normal!==void 0||Qe.color!==void 0)&&tt.update(U,k,Xe),(qe||Tt.receiveShadow!==U.receiveShadow)&&(Tt.receiveShadow=U.receiveShadow,ae.setValue(P,"receiveShadow",U.receiveShadow)),G.isMeshGouraudMaterial&&G.envMap!==null&&(Je.envMap.value=dt,Je.flipEnvMap.value=dt.isCubeTexture&&dt.isRenderTargetTexture===!1?-1:1),G.isMeshStandardMaterial&&G.envMap===null&&D.environment!==null&&(Je.envMapIntensity.value=D.environmentIntensity),qe&&(ae.setValue(P,"toneMappingExposure",y.toneMappingExposure),Tt.needsLights&&I0(Je,sr),J&&G.fog===!0&&K.refreshFogUniforms(Je,J),K.refreshMaterialUniforms(Je,G,H,Q,p.state.transmissionRenderTarget[v.id]),ia.upload(P,eu(Tt),Je,zt)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(ia.upload(P,eu(Tt),Je,zt),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&ae.setValue(P,"center",U.center),ae.setValue(P,"modelViewMatrix",U.modelViewMatrix),ae.setValue(P,"normalMatrix",U.normalMatrix),ae.setValue(P,"modelMatrix",U.matrixWorld),G.isShaderMaterial||G.isRawShaderMaterial){const Le=G.uniformsGroups;for(let Oe=0,xl=Le.length;Oe<xl;Oe++){const zn=Le[Oe];Nt.update(zn,Xe),Nt.bind(zn,Xe)}}return Xe}function I0(v,D){v.ambientLightColor.needsUpdate=D,v.lightProbe.needsUpdate=D,v.directionalLights.needsUpdate=D,v.directionalLightShadows.needsUpdate=D,v.pointLights.needsUpdate=D,v.pointLightShadows.needsUpdate=D,v.spotLights.needsUpdate=D,v.spotLightShadows.needsUpdate=D,v.rectAreaLights.needsUpdate=D,v.hemisphereLights.needsUpdate=D}function L0(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(v,D,k){const G=pt.get(v);G.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),pt.get(v.texture).__webglTexture=D,pt.get(v.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:k,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,D){const k=pt.get(v);k.__webglFramebuffer=D,k.__useDefaultFramebuffer=D===void 0};const D0=P.createFramebuffer();this.setRenderTarget=function(v,D=0,k=0){I=v,w=D,C=k;let G=!0,U=null,J=!1,ct=!1;if(v){const dt=pt.get(v);if(dt.__useDefaultFramebuffer!==void 0)St.bindFramebuffer(P.FRAMEBUFFER,null),G=!1;else if(dt.__webglFramebuffer===void 0)zt.setupRenderTarget(v);else if(dt.__hasExternalTextures)zt.rebindTextures(v,pt.get(v.texture).__webglTexture,pt.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const bt=v.depthTexture;if(dt.__boundDepthTexture!==bt){if(bt!==null&&pt.has(bt)&&(v.width!==bt.image.width||v.height!==bt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");zt.setupDepthRenderbuffer(v)}}const Rt=v.texture;(Rt.isData3DTexture||Rt.isDataArrayTexture||Rt.isCompressedArrayTexture)&&(ct=!0);const Pt=pt.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Pt[D])?U=Pt[D][k]:U=Pt[D],J=!0):v.samples>0&&zt.useMultisampledRTT(v)===!1?U=pt.get(v).__webglMultisampledFramebuffer:Array.isArray(Pt)?U=Pt[k]:U=Pt,A.copy(v.viewport),B.copy(v.scissor),F=v.scissorTest}else A.copy(_t).multiplyScalar(H).floor(),B.copy(Ot).multiplyScalar(H).floor(),F=ne;if(k!==0&&(U=D0),St.bindFramebuffer(P.FRAMEBUFFER,U)&&G&&St.drawBuffers(v,U),St.viewport(A),St.scissor(B),St.setScissorTest(F),J){const dt=pt.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+D,dt.__webglTexture,k)}else if(ct){const dt=D;for(let Rt=0;Rt<v.textures.length;Rt++){const Pt=pt.get(v.textures[Rt]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Rt,Pt.__webglTexture,k,dt)}}else if(v!==null&&k!==0){const dt=pt.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,dt.__webglTexture,k)}S=-1},this.readRenderTargetPixels=function(v,D,k,G,U,J,ct,mt=0){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=pt.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ct!==void 0&&(dt=dt[ct]),dt){St.bindFramebuffer(P.FRAMEBUFFER,dt);try{const Rt=v.textures[mt],Pt=Rt.format,bt=Rt.type;if(!Yt.textureFormatReadable(Pt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Yt.textureTypeReadable(bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=v.width-G&&k>=0&&k<=v.height-U&&(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+mt),P.readPixels(D,k,G,U,yt.convert(Pt),yt.convert(bt),J))}finally{const Rt=I!==null?pt.get(I).__webglFramebuffer:null;St.bindFramebuffer(P.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(v,D,k,G,U,J,ct,mt=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let dt=pt.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ct!==void 0&&(dt=dt[ct]),dt)if(D>=0&&D<=v.width-G&&k>=0&&k<=v.height-U){St.bindFramebuffer(P.FRAMEBUFFER,dt);const Rt=v.textures[mt],Pt=Rt.format,bt=Rt.type;if(!Yt.textureFormatReadable(Pt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Yt.textureTypeReadable(bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const kt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,kt),P.bufferData(P.PIXEL_PACK_BUFFER,J.byteLength,P.STREAM_READ),v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+mt),P.readPixels(D,k,G,U,yt.convert(Pt),yt.convert(bt),0);const $t=I!==null?pt.get(I).__webglFramebuffer:null;St.bindFramebuffer(P.FRAMEBUFFER,$t);const ce=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Sf(P,ce,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,kt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,J),P.deleteBuffer(kt),P.deleteSync(ce),J}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,D=null,k=0){const G=Math.pow(2,-k),U=Math.floor(v.image.width*G),J=Math.floor(v.image.height*G),ct=D!==null?D.x:0,mt=D!==null?D.y:0;zt.setTexture2D(v,0),P.copyTexSubImage2D(P.TEXTURE_2D,k,0,0,ct,mt,U,J),St.unbindTexture()};const U0=P.createFramebuffer(),N0=P.createFramebuffer();this.copyTextureToTexture=function(v,D,k=null,G=null,U=0,J=null){J===null&&(U!==0?(os("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),J=U,U=0):J=0);let ct,mt,dt,Rt,Pt,bt,kt,$t,ce;const ie=v.isCompressedTexture?v.mipmaps[J]:v.image;if(k!==null)ct=k.max.x-k.min.x,mt=k.max.y-k.min.y,dt=k.isBox3?k.max.z-k.min.z:1,Rt=k.min.x,Pt=k.min.y,bt=k.isBox3?k.min.z:0;else{const Qe=Math.pow(2,-U);ct=Math.floor(ie.width*Qe),mt=Math.floor(ie.height*Qe),v.isDataArrayTexture?dt=ie.depth:v.isData3DTexture?dt=Math.floor(ie.depth*Qe):dt=1,Rt=0,Pt=0,bt=0}G!==null?(kt=G.x,$t=G.y,ce=G.z):(kt=0,$t=0,ce=0);const Qt=yt.convert(D.format),Tt=yt.convert(D.type);let re;D.isData3DTexture?(zt.setTexture3D(D,0),re=P.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(zt.setTexture2DArray(D,0),re=P.TEXTURE_2D_ARRAY):(zt.setTexture2D(D,0),re=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,D.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,D.unpackAlignment);const qt=P.getParameter(P.UNPACK_ROW_LENGTH),Xe=P.getParameter(P.UNPACK_IMAGE_HEIGHT),ws=P.getParameter(P.UNPACK_SKIP_PIXELS),qe=P.getParameter(P.UNPACK_SKIP_ROWS),sr=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,ie.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ie.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Rt),P.pixelStorei(P.UNPACK_SKIP_ROWS,Pt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,bt);const ae=v.isDataArrayTexture||v.isData3DTexture,Je=D.isDataArrayTexture||D.isData3DTexture;if(v.isDepthTexture){const Qe=pt.get(v),Le=pt.get(D),Oe=pt.get(Qe.__renderTarget),xl=pt.get(Le.__renderTarget);St.bindFramebuffer(P.READ_FRAMEBUFFER,Oe.__webglFramebuffer),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,xl.__webglFramebuffer);for(let zn=0;zn<dt;zn++)ae&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,pt.get(v).__webglTexture,U,bt+zn),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,pt.get(D).__webglTexture,J,ce+zn)),P.blitFramebuffer(Rt,Pt,ct,mt,kt,$t,ct,mt,P.DEPTH_BUFFER_BIT,P.NEAREST);St.bindFramebuffer(P.READ_FRAMEBUFFER,null),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(U!==0||v.isRenderTargetTexture||pt.has(v)){const Qe=pt.get(v),Le=pt.get(D);St.bindFramebuffer(P.READ_FRAMEBUFFER,U0),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,N0);for(let Oe=0;Oe<dt;Oe++)ae?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,Qe.__webglTexture,U,bt+Oe):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,Qe.__webglTexture,U),Je?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,Le.__webglTexture,J,ce+Oe):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,Le.__webglTexture,J),U!==0?P.blitFramebuffer(Rt,Pt,ct,mt,kt,$t,ct,mt,P.COLOR_BUFFER_BIT,P.NEAREST):Je?P.copyTexSubImage3D(re,J,kt,$t,ce+Oe,Rt,Pt,ct,mt):P.copyTexSubImage2D(re,J,kt,$t,Rt,Pt,ct,mt);St.bindFramebuffer(P.READ_FRAMEBUFFER,null),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else Je?v.isDataTexture||v.isData3DTexture?P.texSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,Tt,ie.data):D.isCompressedArrayTexture?P.compressedTexSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,ie.data):P.texSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,Tt,ie):v.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,J,kt,$t,ct,mt,Qt,Tt,ie.data):v.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,J,kt,$t,ie.width,ie.height,Qt,ie.data):P.texSubImage2D(P.TEXTURE_2D,J,kt,$t,ct,mt,Qt,Tt,ie);P.pixelStorei(P.UNPACK_ROW_LENGTH,qt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xe),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ws),P.pixelStorei(P.UNPACK_SKIP_ROWS,qe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,sr),J===0&&D.generateMipmaps&&P.generateMipmap(re),St.unbindTexture()},this.copyTextureToTexture3D=function(v,D,k=null,G=null,U=0){return os('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(v,D,k,G,U)},this.initRenderTarget=function(v){pt.get(v).__webglFramebuffer===void 0&&zt.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?zt.setTextureCube(v,0):v.isData3DTexture?zt.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?zt.setTexture2DArray(v,0):zt.setTexture2D(v,0),St.unbindTexture()},this.resetState=function(){w=0,C=0,I=null,St.reset(),lt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Xt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Xt._getUnpackColorSpace()}}const Yc={type:"change"},ml={type:"start"},jc={type:"end"},sa=new Gh,Zc=new hn,p0=Math.cos(70*yf.DEG2RAD),ye=new N,Fe=2*Math.PI,Kt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},gl=1e-6;class m0 extends cp{constructor(t,e=null){super(t,e),this.state=Kt.NONE,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Qn.ROTATE,MIDDLE:Qn.DOLLY,RIGHT:Qn.PAN},this.touches={ONE:ts.ROTATE,TWO:ts.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Tn,this._lastTargetPosition=new N,this._quat=new Tn().setFromUnitVectors(t.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new mc,this._sphericalDelta=new mc,this._scale=1,this._panOffset=new N,this._rotateStart=new Dt,this._rotateEnd=new Dt,this._rotateDelta=new Dt,this._panStart=new Dt,this._panEnd=new Dt,this._panDelta=new Dt,this._dollyStart=new Dt,this._dollyEnd=new Dt,this._dollyDelta=new Dt,this._dollyDirection=new N,this._mouse=new Dt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=_0.bind(this),this._onPointerDown=g0.bind(this),this._onPointerUp=x0.bind(this),this._onContextMenu=T0.bind(this),this._onMouseWheel=M0.bind(this),this._onKeyDown=S0.bind(this),this._onTouchStart=b0.bind(this),this._onTouchMove=E0.bind(this),this._onMouseDown=v0.bind(this),this._onMouseMove=y0.bind(this),this._interceptControlDown=A0.bind(this),this._interceptControlUp=w0.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Yc),this.update(),this.state=Kt.NONE}update(t=null){const e=this.object.position;ye.copy(e).sub(this.target),ye.applyQuaternion(this._quat),this._spherical.setFromVector3(ye),this.autoRotate&&this.state===Kt.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(i)&&isFinite(n)&&(i<-Math.PI?i+=Fe:i>Math.PI&&(i-=Fe),n<-Math.PI?n+=Fe:n>Math.PI&&(n-=Fe),i<=n?this._spherical.theta=Math.max(i,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+n)/2?Math.max(i,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(ye.setFromSpherical(this._spherical),ye.applyQuaternion(this._quatInverse),e.copy(this.target).add(ye),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=ye.length();a=this._clampDistance(o*this._scale);const h=o-a;this.object.position.addScaledVector(this._dollyDirection,h),this.object.updateMatrixWorld(),r=!!h}else if(this.object.isOrthographicCamera){const o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const h=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=h!==this.object.zoom;const l=new N(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=ye.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(sa.origin.copy(this.object.position),sa.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(sa.direction))<p0?this.object.lookAt(this.target):(Zc.setFromNormalAndCoplanarPoint(this.object.up,this.target),sa.intersectPlane(Zc,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>gl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gl||this._lastTargetPosition.distanceToSquared(this.target)>gl?(this.dispatchEvent(Yc),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Fe/60*this.autoRotateSpeed*t:Fe/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){ye.setFromMatrixColumn(e,0),ye.multiplyScalar(-t),this._panOffset.add(ye)}_panUp(t,e){this.screenSpacePanning===!0?ye.setFromMatrixColumn(e,1):(ye.setFromMatrixColumn(e,0),ye.crossVectors(this.object.up,ye)),ye.multiplyScalar(t),this._panOffset.add(ye)}_pan(t,e){const i=this.domElement;if(this.object.isPerspectiveCamera){const n=this.object.position;ye.copy(n).sub(this.target);let r=ye.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*r/i.clientHeight,this.object.matrix),this._panUp(2*e*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),n=t-i.left,r=e-i.top,a=i.width,o=i.height;this._mouse.x=n/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Fe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Fe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._rotateStart.set(i,n)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._panStart.set(i,n)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,r=Math.sqrt(i*i+n*n);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),n=.5*(t.pageX+i.x),r=.5*(t.pageY+i.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Fe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Fe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._panEnd.set(i,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,r=Math.sqrt(i*i+n*n);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(t.pageX+e.x)*.5,o=(t.pageY+e.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new Dt,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,i={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function g0(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s)))}function _0(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function x0(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(jc),this.state=Kt.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function v0(s){let t;switch(s.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Qn.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=Kt.DOLLY;break;case Qn.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Kt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Kt.ROTATE}break;case Qn.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Kt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Kt.PAN}break;default:this.state=Kt.NONE}this.state!==Kt.NONE&&this.dispatchEvent(ml)}function y0(s){switch(this.state){case Kt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case Kt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case Kt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function M0(s){this.enabled===!1||this.enableZoom===!1||this.state!==Kt.NONE||(s.preventDefault(),this.dispatchEvent(ml),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(jc))}function S0(s){this.enabled!==!1&&this._handleKeyDown(s)}function b0(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case ts.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=Kt.TOUCH_ROTATE;break;case ts.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=Kt.TOUCH_PAN;break;default:this.state=Kt.NONE}break;case 2:switch(this.touches.TWO){case ts.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=Kt.TOUCH_DOLLY_PAN;break;case ts.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=Kt.TOUCH_DOLLY_ROTATE;break;default:this.state=Kt.NONE}break;default:this.state=Kt.NONE}this.state!==Kt.NONE&&this.dispatchEvent(ml)}function E0(s){switch(this._trackPointer(s),this.state){case Kt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case Kt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case Kt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case Kt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=Kt.NONE}}function T0(s){this.enabled!==!1&&s.preventDefault()}function A0(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function w0(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Kc={LANGUAGE_CHANGE_CONFIRMED:vl.LANGUAGE_CHANGE_CONFIRMED},R0={languages:[],selected:void 0};class ra extends HTMLElement{static _languagesAttribute="languages";static _selectedAttribute="selected";_shadowRoot;_container;_canvas;_camera;_renderer;_scene;_controls;_resizeObserver;_clock=new hp;_lastTime=0;_lights=[];_spotlight;_flagsGroup;_languages=[];_selectedLanguageIndex=0;_animationFrameId=0;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_introCameraStartPosition=new N(0,5,10);_introCameraEndPosition=new N(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;_cameraLookAtY=2;_circleRadius=5;_wind=null;_menuContainer;_menuIntroStartScale=.72;_barMenu;_languageButtons=[];_confirmationDialog;_currentVisibleButtonIndex=0;_isInitialized=!1;_isInitializing=!1;static get observedAttributes(){return["languages","selected"]}constructor(t){super(),this._shadowRoot=this.attachShadow({mode:"open"});const{languages:e,selected:i}={...R0,...t};e.length>0&&this._initializeComponent(e,i)}_initializeComponent(t,e){if(!(this._isInitialized||this._isInitializing)){if(t.length===0){console.warn("LanguagePickerComponent: No languages provided");return}this._isInitializing=!0,this._setupScene(),this._setupUI(),this._setupFlags(t,e),this._setupLanguageDialog(),this._setupEventListeners(),this._isInitialized=!0,this._isInitializing=!1,this.isConnected&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}}attributeChangedCallback(t,e){if(!(this._isInitialized||this._isInitializing)&&t===ra._languagesAttribute&&e!=null)try{const i=JSON.parse(e),n=this.getAttribute(ra._selectedAttribute);Array.isArray(i)&&i.length>0&&this._initializeComponent(i,n)}catch(i){console.error("LanguagePickerComponent: Error parsing languages attribute",i)}}_setupScene(){this._container=document.createElement("div"),this._container.style.width="100%",this._container.style.height="100%",this._container.style.position="relative",this._container.style.overflow="hidden",this._canvas=document.createElement("canvas"),this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._container.appendChild(this._canvas),this._scene=new Yf,this._scene.background=new Vt(1710618),this._scene.fog=new tl(1710618,8,50),this._camera=new We(45,1,.1,100),this._camera.position.set(0,5,10),this._camera.lookAt(0,2,0),this._scene.add(this._camera),this._renderer=new f0({antialias:!0,canvas:this._canvas,alpha:!0}),this._renderer.debug.checkShaderErrors=!0,this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.shadowMap.enabled=!1,this._controls=new m0(this._camera,this._canvas),this._controls.enableDamping=!0,this._controls.dampingFactor=.05,this._controls.autoRotate=!1,this._controls.enableRotate=!1,this._controls.enablePan=!1,this._controls.enableZoom=!1,this._controls.target.set(0,this._cameraLookAtY,0);const e=new op(16777215,.3);this._scene.add(e),this._lights.push(e);const i=new pc(14674943,3);i.position.set(10,20,10),this._scene.add(i),this._lights.push(i);const n=new pc(11329439,.15);n.position.set(0,-1,0),this._scene.add(n),this._lights.push(n),this._spotlight=new rp(16777215,150),this._spotlight.angle=Math.PI/6,this._spotlight.penumbra=.3,this._spotlight.decay=2,this._spotlight.distance=30,this._scene.add(this._spotlight),this._scene.add(this._spotlight.target),this._lights.push(this._spotlight);const r=new ir(100,100),a=new $f({color:1710618,roughness:.8,metalness:.2}),o=new Si(r,a);o.rotation.x=-Math.PI/2,o.position.y=0,o.receiveShadow=!0,this._scene.add(o);const h=()=>{const l=this._container.clientWidth,c=this._container.clientHeight;l===0||c===0||(this._camera.aspect=l/c,this._camera.updateProjectionMatrix(),this._renderer.setSize(l,c,!1))};this._resizeObserver=new ResizeObserver(h),this._resizeObserver.observe(this._container),h(),this._wind=new Di.Wind({speed:8,direction:new N(1,0,0)}),this._flagsGroup=new er,this._scene.add(this._flagsGroup),this._shadowRoot.appendChild(this._container)}_setupUI(){this._barMenu=document.createElement(yu.selector),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,this._menuContainer=document.createElement("div"),this._menuContainer.style.position="absolute",this._menuContainer.style.bottom="25%",this._menuContainer.style.left="50%",this._menuContainer.style.zIndex="9999",this._menuContainer.style.pointerEvents="auto",this._menuContainer.style.transformOrigin="center bottom",this._setMenuIntroScale(1),this._menuContainer.appendChild(this._barMenu),this._shadowRoot.appendChild(this._menuContainer);const t=document.createElement("style");t.textContent=`
3955
+ }`;class l0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const i=new qc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,i=new on({vertexShader:a0,fragmentShader:o0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Si(new ir(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class h0 extends En{constructor(t,e){super();const i=this;let n=null,r=1,a=null,o="local-floor",h=1,l=null,c=null,u=null,d=null,f=null,g=null;const _=new l0,m={},p=e.getContextAttributes();let T=null,b=null;const y=[],R=[],w=new Dt;let C=null;const I=new We;I.viewport=new he;const S=new We;S.viewport=new he;const M=[I,S],A=new lp;let B=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getTargetRaySpace()},this.getControllerGrip=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getGripSpace()},this.getHand=function(j){let ot=y[j];return ot===void 0&&(ot=new Qo,y[j]=ot),ot.getHandSpace()};function z(j){const ot=R.indexOf(j.inputSource);if(ot===-1)return;const nt=y[ot];nt!==void 0&&(nt.update(j.inputSource,j.frame,l||a),nt.dispatchEvent({type:j.type,data:j.inputSource}))}function W(){n.removeEventListener("select",z),n.removeEventListener("selectstart",z),n.removeEventListener("selectend",z),n.removeEventListener("squeeze",z),n.removeEventListener("squeezestart",z),n.removeEventListener("squeezeend",z),n.removeEventListener("end",W),n.removeEventListener("inputsourceschange",X);for(let j=0;j<y.length;j++){const ot=R[j];ot!==null&&(R[j]=null,y[j].disconnect(ot))}B=null,F=null,_.reset();for(const j in m)delete m[j];t.setRenderTarget(T),f=null,d=null,u=null,n=null,b=null,Jt.stop(),i.isPresenting=!1,t.setPixelRatio(C),t.setSize(w.width,w.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){r=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){o=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(j){l=j},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return n},this.setSession=async function(j){if(n=j,n!==null){if(T=t.getRenderTarget(),n.addEventListener("select",z),n.addEventListener("selectstart",z),n.addEventListener("selectend",z),n.addEventListener("squeeze",z),n.addEventListener("squeezestart",z),n.addEventListener("squeezeend",z),n.addEventListener("end",W),n.addEventListener("inputsourceschange",X),p.xrCompatible!==!0&&await e.makeXRCompatible(),C=t.getPixelRatio(),t.getSize(w),typeof XRWebGLBinding<"u"&&(u=new XRWebGLBinding(n,e)),u!==null&&"createProjectionLayer"in XRWebGLBinding.prototype){let nt=null,At=null,wt=null;p.depth&&(wt=p.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,nt=p.stencil?Xs:Ws,At=p.stencil?Vs:bn);const It={colorFormat:e.RGBA8,depthFormat:wt,scaleFactor:r};d=u.createProjectionLayer(It),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),b=new An(d.textureWidth,d.textureHeight,{format:li,type:xi,depthTexture:new hc(d.textureWidth,d.textureHeight,At,void 0,void 0,void 0,void 0,void 0,void 0,nt),stencilBuffer:p.stencil,colorSpace:t.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const nt={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(n,e,nt),n.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),b=new An(f.framebufferWidth,f.framebufferHeight,{format:li,type:xi,colorSpace:t.outputColorSpace,stencilBuffer:p.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(h),l=null,a=await n.requestReferenceSpace(o),Jt.setContext(n),Jt.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function X(j){for(let ot=0;ot<j.removed.length;ot++){const nt=j.removed[ot],At=R.indexOf(nt);At>=0&&(R[At]=null,y[At].disconnect(nt))}for(let ot=0;ot<j.added.length;ot++){const nt=j.added[ot];let At=R.indexOf(nt);if(At===-1){for(let It=0;It<y.length;It++)if(It>=R.length){R.push(nt),At=It;break}else if(R[It]===null){R[It]=nt,At=It;break}if(At===-1)break}const wt=y[At];wt&&wt.connect(nt)}}const Q=new N,H=new N;function rt(j,ot,nt){Q.setFromMatrixPosition(ot.matrixWorld),H.setFromMatrixPosition(nt.matrixWorld);const At=Q.distanceTo(H),wt=ot.projectionMatrix.elements,It=nt.projectionMatrix.elements,de=wt[14]/(wt[10]-1),Wt=wt[14]/(wt[10]+1),P=(wt[9]+1)/wt[5],te=(wt[9]-1)/wt[5],Et=(wt[8]-1)/wt[0],Yt=(It[8]+1)/It[0],St=de*Et,se=de*Yt,pt=At/(-Et+Yt),zt=pt*-Et;if(ot.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(zt),j.translateZ(pt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),wt[10]===-1)j.projectionMatrix.copy(ot.projectionMatrix),j.projectionMatrixInverse.copy(ot.projectionMatrixInverse);else{const Ee=de+pt,fe=Wt+pt,E=St-zt,x=se+(At-zt),O=P*Wt/fe*Ee,Y=te*Wt/fe*Ee;j.projectionMatrix.makePerspective(E,x,O,Y,Ee,fe),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function ht(j,ot){ot===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ot.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(n===null)return;let ot=j.near,nt=j.far;_.texture!==null&&(_.depthNear>0&&(ot=_.depthNear),_.depthFar>0&&(nt=_.depthFar)),A.near=S.near=I.near=ot,A.far=S.far=I.far=nt,(B!==A.near||F!==A.far)&&(n.updateRenderState({depthNear:A.near,depthFar:A.far}),B=A.near,F=A.far),A.layers.mask=j.layers.mask|6,I.layers.mask=A.layers.mask&3,S.layers.mask=A.layers.mask&5;const At=j.parent,wt=A.cameras;ht(A,At);for(let It=0;It<wt.length;It++)ht(wt[It],At);wt.length===2?rt(A,I,S):A.projectionMatrix.copy(I.projectionMatrix),_t(j,A,At)};function _t(j,ot,nt){nt===null?j.matrix.copy(ot.matrixWorld):(j.matrix.copy(nt.matrixWorld),j.matrix.invert(),j.matrix.multiply(ot.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(ot.projectionMatrix),j.projectionMatrixInverse.copy(ot.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Nr*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(d===null&&f===null))return h},this.setFoveation=function(j){h=j,d!==null&&(d.fixedFoveation=j),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=j)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(A)},this.getCameraTexture=function(j){return m[j]};let Ot=null;function ne(j,ot){if(c=ot.getViewerPose(l||a),g=ot,c!==null){const nt=c.views;f!==null&&(t.setRenderTargetFramebuffer(b,f.framebuffer),t.setRenderTarget(b));let At=!1;nt.length!==A.cameras.length&&(A.cameras.length=0,At=!0);for(let Wt=0;Wt<nt.length;Wt++){const P=nt[Wt];let te=null;if(f!==null)te=f.getViewport(P);else{const Yt=u.getViewSubImage(d,P);te=Yt.viewport,Wt===0&&(t.setRenderTargetTextures(b,Yt.colorTexture,Yt.depthStencilTexture),t.setRenderTarget(b))}let Et=M[Wt];Et===void 0&&(Et=new We,Et.layers.enable(Wt),Et.viewport=new he,M[Wt]=Et),Et.matrix.fromArray(P.transform.matrix),Et.matrix.decompose(Et.position,Et.quaternion,Et.scale),Et.projectionMatrix.fromArray(P.projectionMatrix),Et.projectionMatrixInverse.copy(Et.projectionMatrix).invert(),Et.viewport.set(te.x,te.y,te.width,te.height),Wt===0&&(A.matrix.copy(Et.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),At===!0&&A.cameras.push(Et)}const wt=n.enabledFeatures;if(wt&&wt.includes("depth-sensing")&&n.depthUsage=="gpu-optimized"&&u){const Wt=u.getDepthInformation(nt[0]);Wt&&Wt.isValid&&Wt.texture&&_.init(Wt,n.renderState)}if(wt&&wt.includes("camera-access")&&(t.state.unbindTexture(),u))for(let Wt=0;Wt<nt.length;Wt++){const P=nt[Wt].camera;if(P){let te=m[P];te||(te=new qc,m[P]=te);const Et=u.getCameraImage(P);te.sourceTexture=Et}}}for(let nt=0;nt<y.length;nt++){const At=R[nt],wt=y[nt];At!==null&&wt!==void 0&&wt.update(At,ot,l||a)}Ot&&Ot(j,ot),ot.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ot}),g=null}const Jt=new _c;Jt.setAnimationLoop(ne),this.setAnimationLoop=function(j){Ot=j},this.dispose=function(){}}}const Fn=new yi,c0=new ue;function u0(s,t){function e(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,sc(s)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function n(m,p,T,b,y){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(m,p):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),c(m,p)):p.isMeshStandardMaterial?(r(m,p),d(m,p),p.isMeshPhysicalMaterial&&f(m,p,y)):p.isMeshMatcapMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),_(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?h(m,p,T,b):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,e(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Ue&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,e(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Ue&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,e(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,e(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const T=t.get(p),b=T.envMap,y=T.envMapRotation;b&&(m.envMap.value=b,Fn.copy(y),Fn.x*=-1,Fn.y*=-1,Fn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Fn.y*=-1,Fn.z*=-1),m.envMapRotation.value.setFromMatrix4(c0.makeRotationFromEuler(Fn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function h(m,p,T,b){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*T,m.scale.value=b*.5,p.map&&(m.map.value=p.map,e(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,e(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,e(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,T){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ue&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=T.texture,m.transmissionSamplerSize.value.set(T.width,T.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){const T=t.get(p).light;m.referencePosition.value.setFromMatrixPosition(T.matrixWorld),m.nearDistance.value=T.shadow.camera.near,m.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function d0(s,t,e,i){let n={},r={},a=[];const o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function h(T,b){const y=b.program;i.uniformBlockBinding(T,y)}function l(T,b){let y=n[T.id];y===void 0&&(g(T),y=c(T),n[T.id]=y,T.addEventListener("dispose",m));const R=b.program;i.updateUBOMapping(T,R);const w=t.render.frame;r[T.id]!==w&&(d(T),r[T.id]=w)}function c(T){const b=u();T.__bindingPointIndex=b;const y=s.createBuffer(),R=T.__size,w=T.usage;return s.bindBuffer(s.UNIFORM_BUFFER,y),s.bufferData(s.UNIFORM_BUFFER,R,w),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,b,y),y}function u(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(T){const b=n[T.id],y=T.uniforms,R=T.__cache;s.bindBuffer(s.UNIFORM_BUFFER,b);for(let w=0,C=y.length;w<C;w++){const I=Array.isArray(y[w])?y[w]:[y[w]];for(let S=0,M=I.length;S<M;S++){const A=I[S];if(f(A,w,S,R)===!0){const B=A.__offset,F=Array.isArray(A.value)?A.value:[A.value];let z=0;for(let W=0;W<F.length;W++){const X=F[W],Q=_(X);typeof X=="number"||typeof X=="boolean"?(A.__data[0]=X,s.bufferSubData(s.UNIFORM_BUFFER,B+z,A.__data)):X.isMatrix3?(A.__data[0]=X.elements[0],A.__data[1]=X.elements[1],A.__data[2]=X.elements[2],A.__data[3]=0,A.__data[4]=X.elements[3],A.__data[5]=X.elements[4],A.__data[6]=X.elements[5],A.__data[7]=0,A.__data[8]=X.elements[6],A.__data[9]=X.elements[7],A.__data[10]=X.elements[8],A.__data[11]=0):(X.toArray(A.__data,z),z+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,B,A.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(T,b,y,R){const w=T.value,C=b+"_"+y;if(R[C]===void 0)return typeof w=="number"||typeof w=="boolean"?R[C]=w:R[C]=w.clone(),!0;{const I=R[C];if(typeof w=="number"||typeof w=="boolean"){if(I!==w)return R[C]=w,!0}else if(I.equals(w)===!1)return I.copy(w),!0}return!1}function g(T){const b=T.uniforms;let y=0;const R=16;for(let C=0,I=b.length;C<I;C++){const S=Array.isArray(b[C])?b[C]:[b[C]];for(let M=0,A=S.length;M<A;M++){const B=S[M],F=Array.isArray(B.value)?B.value:[B.value];for(let z=0,W=F.length;z<W;z++){const X=F[z],Q=_(X),H=y%R,rt=H%Q.boundary,ht=H+rt;y+=rt,ht!==0&&R-ht<Q.storage&&(y+=R-ht),B.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),B.__offset=y,y+=Q.storage}}}const w=y%R;return w>0&&(y+=R-w),T.__size=y,T.__cache={},this}function _(T){const b={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(b.boundary=4,b.storage=4):T.isVector2?(b.boundary=8,b.storage=8):T.isVector3||T.isColor?(b.boundary=16,b.storage=12):T.isVector4?(b.boundary=16,b.storage=16):T.isMatrix3?(b.boundary=48,b.storage=48):T.isMatrix4?(b.boundary=64,b.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),b}function m(T){const b=T.target;b.removeEventListener("dispose",m);const y=a.indexOf(b.__bindingPointIndex);a.splice(y,1),s.deleteBuffer(n[b.id]),delete n[b.id],delete r[b.id]}function p(){for(const T in n)s.deleteBuffer(n[T]);a=[],n={},r={}}return{bind:h,update:l,dispose:p}}class f0{constructor(t={}){const{canvas:e=Mf(),context:i=null,depth:n=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=i.getContextAttributes().alpha}else f=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,p=null;const T=[],b=[];this.domElement=e,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.toneMapping=Qi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let R=!1;this._outputColorSpace=Ke;let w=0,C=0,I=null,S=-1,M=null;const A=new he,B=new he;let F=null;const z=new Vt(0);let W=0,X=e.width,Q=e.height,H=1,rt=null,ht=null;const _t=new he(0,0,X,Q),Ot=new he(0,0,X,Q);let ne=!1;const Jt=new il;let j=!1,ot=!1;const nt=new ue,At=new N,wt=new he,It={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let de=!1;function Wt(){return I===null?H:1}let P=i;function te(v,D){return e.getContext(v,D)}try{const v={alpha:!0,depth:n,stencil:r,antialias:o,premultipliedAlpha:h,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Fa}`),e.addEventListener("webglcontextlost",st,!1),e.addEventListener("webglcontextrestored",ft,!1),e.addEventListener("webglcontextcreationerror",$,!1),P===null){const D="webgl2";if(P=te(D,v),P===null)throw te(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(v){throw console.error("THREE.WebGLRenderer: "+v.message),v}let Et,Yt,St,se,pt,zt,Ee,fe,E,x,O,Y,K,q,Mt,it,xt,vt,tt,ut,Ct,yt,lt,Nt;function L(){Et=new bg(P),Et.init(),yt=new r0(P,Et),Yt=new gg(P,Et,t,yt),St=new n0(P,Et),Yt.reversedDepthBuffer&&d&&St.buffers.depth.setReversed(!0),se=new Ag(P),pt=new W_,zt=new s0(P,Et,St,pt,Yt,yt,se),Ee=new xg(y),fe=new Sg(y),E=new dp(P),lt=new pg(P,E),x=new Eg(P,E,se,lt),O=new Rg(P,x,E,se),tt=new wg(P,Yt,zt),it=new _g(pt),Y=new V_(y,Ee,fe,Et,Yt,lt,it),K=new u0(y,pt),q=new q_,Mt=new J_(Et),vt=new fg(y,Ee,fe,St,O,f,h),xt=new e0(y,O,Yt),Nt=new d0(P,se,Yt,St),ut=new mg(P,Et,se),Ct=new Tg(P,Et,se),se.programs=Y.programs,y.capabilities=Yt,y.extensions=Et,y.properties=pt,y.renderLists=q,y.shadowMap=xt,y.state=St,y.info=se}L();const et=new h0(y,P);this.xr=et,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const v=Et.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Et.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(v){v!==void 0&&(H=v,this.setSize(X,Q,!1))},this.getSize=function(v){return v.set(X,Q)},this.setSize=function(v,D,k=!0){if(et.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=v,Q=D,e.width=Math.floor(v*H),e.height=Math.floor(D*H),k===!0&&(e.style.width=v+"px",e.style.height=D+"px"),this.setViewport(0,0,v,D)},this.getDrawingBufferSize=function(v){return v.set(X*H,Q*H).floor()},this.setDrawingBufferSize=function(v,D,k){X=v,Q=D,H=k,e.width=Math.floor(v*k),e.height=Math.floor(D*k),this.setViewport(0,0,v,D)},this.getCurrentViewport=function(v){return v.copy(A)},this.getViewport=function(v){return v.copy(_t)},this.setViewport=function(v,D,k,G){v.isVector4?_t.set(v.x,v.y,v.z,v.w):_t.set(v,D,k,G),St.viewport(A.copy(_t).multiplyScalar(H).round())},this.getScissor=function(v){return v.copy(Ot)},this.setScissor=function(v,D,k,G){v.isVector4?Ot.set(v.x,v.y,v.z,v.w):Ot.set(v,D,k,G),St.scissor(B.copy(Ot).multiplyScalar(H).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(v){St.setScissorTest(ne=v)},this.setOpaqueSort=function(v){rt=v},this.setTransparentSort=function(v){ht=v},this.getClearColor=function(v){return v.copy(vt.getClearColor())},this.setClearColor=function(){vt.setClearColor(...arguments)},this.getClearAlpha=function(){return vt.getClearAlpha()},this.setClearAlpha=function(){vt.setClearAlpha(...arguments)},this.clear=function(v=!0,D=!0,k=!0){let G=0;if(v){let U=!1;if(I!==null){const J=I.texture.format;U=J===io||J===eo||J===to}if(U){const J=I.texture.type,ct=J===xi||J===bn||J===Gs||J===Vs||J===Ja||J===Qa,mt=vt.getClearColor(),dt=vt.getClearAlpha(),Rt=mt.r,Pt=mt.g,bt=mt.b;ct?(g[0]=Rt,g[1]=Pt,g[2]=bt,g[3]=dt,P.clearBufferuiv(P.COLOR,0,g)):(_[0]=Rt,_[1]=Pt,_[2]=bt,_[3]=dt,P.clearBufferiv(P.COLOR,0,_))}else G|=P.COLOR_BUFFER_BIT}D&&(G|=P.DEPTH_BUFFER_BIT),k&&(G|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",st,!1),e.removeEventListener("webglcontextrestored",ft,!1),e.removeEventListener("webglcontextcreationerror",$,!1),vt.dispose(),q.dispose(),Mt.dispose(),pt.dispose(),Ee.dispose(),fe.dispose(),O.dispose(),lt.dispose(),Nt.dispose(),Y.dispose(),et.dispose(),et.removeEventListener("sessionstart",Ei),et.removeEventListener("sessionend",$c),On.stop()};function st(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),R=!0}function ft(){console.log("THREE.WebGLRenderer: Context Restored."),R=!1;const v=se.autoReset,D=xt.enabled,k=xt.autoUpdate,G=xt.needsUpdate,U=xt.type;L(),se.autoReset=v,xt.enabled=D,xt.autoUpdate=k,xt.needsUpdate=G,xt.type=U}function $(v){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Z(v){const D=v.target;D.removeEventListener("dispose",Z),gt(D)}function gt(v){Lt(v),pt.remove(v)}function Lt(v){const D=pt.get(v).programs;D!==void 0&&(D.forEach(function(k){Y.releaseProgram(k)}),v.isShaderMaterial&&Y.releaseShaderCache(v))}this.renderBufferDirect=function(v,D,k,G,U,J){D===null&&(D=It);const ct=U.isMesh&&U.matrixWorld.determinant()<0,mt=P0(v,D,k,G,U);St.setMaterial(G,ct);let dt=k.index,Rt=1;if(G.wireframe===!0){if(dt=x.getWireframeAttribute(k),dt===void 0)return;Rt=2}const Pt=k.drawRange,bt=k.attributes.position;let kt=Pt.start*Rt,$t=(Pt.start+Pt.count)*Rt;J!==null&&(kt=Math.max(kt,J.start*Rt),$t=Math.min($t,(J.start+J.count)*Rt)),dt!==null?(kt=Math.max(kt,0),$t=Math.min($t,dt.count)):bt!=null&&(kt=Math.max(kt,0),$t=Math.min($t,bt.count));const ce=$t-kt;if(ce<0||ce===1/0)return;lt.setup(U,G,mt,k,dt);let ie,Qt=ut;if(dt!==null&&(ie=E.get(dt),Qt=Ct,Qt.setIndex(ie)),U.isMesh)G.wireframe===!0?(St.setLineWidth(G.wireframeLinewidth*Wt()),Qt.setMode(P.LINES)):Qt.setMode(P.TRIANGLES);else if(U.isLine){let Tt=G.linewidth;Tt===void 0&&(Tt=1),St.setLineWidth(Tt*Wt()),U.isLineSegments?Qt.setMode(P.LINES):U.isLineLoop?Qt.setMode(P.LINE_LOOP):Qt.setMode(P.LINE_STRIP)}else U.isPoints?Qt.setMode(P.POINTS):U.isSprite&&Qt.setMode(P.TRIANGLES);if(U.isBatchedMesh)if(U._multiDrawInstances!==null)os("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Qt.renderMultiDrawInstances(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount,U._multiDrawInstances);else if(Et.get("WEBGL_multi_draw"))Qt.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{const Tt=U._multiDrawStarts,re=U._multiDrawCounts,qt=U._multiDrawCount,Xe=dt?E.get(dt).bytesPerElement:1,ws=pt.get(G).currentProgram.getUniforms();for(let qe=0;qe<qt;qe++)ws.setValue(P,"_gl_DrawID",qe),Qt.render(Tt[qe]/Xe,re[qe])}else if(U.isInstancedMesh)Qt.renderInstances(kt,ce,U.count);else if(k.isInstancedBufferGeometry){const Tt=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,re=Math.min(k.instanceCount,Tt);Qt.renderInstances(kt,ce,re)}else Qt.render(kt,ce)};function ee(v,D,k){v.transparent===!0&&v.side===Ni&&v.forceSinglePass===!1?(v.side=Ue,v.needsUpdate=!0,oa(v,D,k),v.side=$i,v.needsUpdate=!0,oa(v,D,k),v.side=Ni):oa(v,D,k)}this.compile=function(v,D,k=null){k===null&&(k=v),p=Mt.get(k),p.init(D),b.push(p),k.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(p.pushLight(U),U.castShadow&&p.pushShadow(U))}),v!==k&&v.traverseVisible(function(U){U.isLight&&U.layers.test(D.layers)&&(p.pushLight(U),U.castShadow&&p.pushShadow(U))}),p.setupLights();const G=new Set;return v.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;const J=U.material;if(J)if(Array.isArray(J))for(let ct=0;ct<J.length;ct++){const mt=J[ct];ee(mt,k,U),G.add(mt)}else ee(J,k,U),G.add(J)}),p=b.pop(),G},this.compileAsync=function(v,D,k=null){const G=this.compile(v,D,k);return new Promise(U=>{function J(){if(G.forEach(function(ct){pt.get(ct).currentProgram.isReady()&&G.delete(ct)}),G.size===0){U(v);return}setTimeout(J,10)}Et.get("KHR_parallel_shader_compile")!==null?J():setTimeout(J,10)})};let jt=null;function Vi(v){jt&&jt(v)}function Ei(){On.stop()}function $c(){On.start()}const On=new _c;On.setAnimationLoop(Vi),typeof self<"u"&&On.setContext(self),this.setAnimationLoop=function(v){jt=v,et.setAnimationLoop(v),v===null?On.stop():On.start()},et.addEventListener("sessionstart",Ei),et.addEventListener("sessionend",$c),this.render=function(v,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),et.enabled===!0&&et.isPresenting===!0&&(et.cameraAutoUpdate===!0&&et.updateCamera(D),D=et.getCamera()),v.isScene===!0&&v.onBeforeRender(y,v,D,I),p=Mt.get(v,b.length),p.init(D),b.push(p),nt.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Jt.setFromProjectionMatrix(nt,vi,D.reversedDepth),ot=this.localClippingEnabled,j=it.init(this.clippingPlanes,ot),m=q.get(v,T.length),m.init(),T.push(m),et.enabled===!0&&et.isPresenting===!0){const J=y.xr.getDepthSensingMesh();J!==null&&_l(J,D,-1/0,y.sortObjects)}_l(v,D,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(rt,ht),de=et.enabled===!1||et.isPresenting===!1||et.hasDepthSensing()===!1,de&&vt.addToRenderList(m,v),this.info.render.frame++,j===!0&&it.beginShadows();const k=p.state.shadowsArray;xt.render(k,v,D),j===!0&&it.endShadows(),this.info.autoReset===!0&&this.info.reset();const G=m.opaque,U=m.transmissive;if(p.setupLights(),D.isArrayCamera){const J=D.cameras;if(U.length>0)for(let ct=0,mt=J.length;ct<mt;ct++){const dt=J[ct];Qc(G,U,v,dt)}de&&vt.render(v);for(let ct=0,mt=J.length;ct<mt;ct++){const dt=J[ct];Jc(m,v,dt,dt.viewport)}}else U.length>0&&Qc(G,U,v,D),de&&vt.render(v),Jc(m,v,D);I!==null&&C===0&&(zt.updateMultisampleRenderTarget(I),zt.updateRenderTargetMipmap(I)),v.isScene===!0&&v.onAfterRender(y,v,D),lt.resetDefaultState(),S=-1,M=null,b.pop(),b.length>0?(p=b[b.length-1],j===!0&&it.setGlobalState(y.clippingPlanes,p.state.camera)):p=null,T.pop(),T.length>0?m=T[T.length-1]:m=null};function _l(v,D,k,G){if(v.visible===!1)return;if(v.layers.test(D.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(D);else if(v.isLight)p.pushLight(v),v.castShadow&&p.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Jt.intersectsSprite(v)){G&&wt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(nt);const ct=O.update(v),mt=v.material;mt.visible&&m.push(v,ct,mt,k,wt.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Jt.intersectsObject(v))){const ct=O.update(v),mt=v.material;if(G&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),wt.copy(v.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),wt.copy(ct.boundingSphere.center)),wt.applyMatrix4(v.matrixWorld).applyMatrix4(nt)),Array.isArray(mt)){const dt=ct.groups;for(let Rt=0,Pt=dt.length;Rt<Pt;Rt++){const bt=dt[Rt],kt=mt[bt.materialIndex];kt&&kt.visible&&m.push(v,ct,kt,k,wt.z,bt)}}else mt.visible&&m.push(v,ct,mt,k,wt.z,null)}}const J=v.children;for(let ct=0,mt=J.length;ct<mt;ct++)_l(J[ct],D,k,G)}function Jc(v,D,k,G){const U=v.opaque,J=v.transmissive,ct=v.transparent;p.setupLightsView(k),j===!0&&it.setGlobalState(y.clippingPlanes,k),G&&St.viewport(A.copy(G)),U.length>0&&aa(U,D,k),J.length>0&&aa(J,D,k),ct.length>0&&aa(ct,D,k),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function Qc(v,D,k,G){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[G.id]===void 0&&(p.state.transmissionRenderTarget[G.id]=new An(1,1,{generateMipmaps:!0,type:Et.has("EXT_color_buffer_half_float")||Et.has("EXT_color_buffer_float")?Hs:xi,minFilter:Sn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xt.workingColorSpace}));const J=p.state.transmissionRenderTarget[G.id],ct=G.viewport||A;J.setSize(ct.z*y.transmissionResolutionScale,ct.w*y.transmissionResolutionScale);const mt=y.getRenderTarget(),dt=y.getActiveCubeFace(),Rt=y.getActiveMipmapLevel();y.setRenderTarget(J),y.getClearColor(z),W=y.getClearAlpha(),W<1&&y.setClearColor(16777215,.5),y.clear(),de&&vt.render(k);const Pt=y.toneMapping;y.toneMapping=Qi;const bt=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),p.setupLightsView(G),j===!0&&it.setGlobalState(y.clippingPlanes,G),aa(v,k,G),zt.updateMultisampleRenderTarget(J),zt.updateRenderTargetMipmap(J),Et.has("WEBGL_multisampled_render_to_texture")===!1){let kt=!1;for(let $t=0,ce=D.length;$t<ce;$t++){const ie=D[$t],Qt=ie.object,Tt=ie.geometry,re=ie.material,qt=ie.group;if(re.side===Ni&&Qt.layers.test(G.layers)){const Xe=re.side;re.side=Ue,re.needsUpdate=!0,tu(Qt,k,G,Tt,re,qt),re.side=Xe,re.needsUpdate=!0,kt=!0}}kt===!0&&(zt.updateMultisampleRenderTarget(J),zt.updateRenderTargetMipmap(J))}y.setRenderTarget(mt,dt,Rt),y.setClearColor(z,W),bt!==void 0&&(G.viewport=bt),y.toneMapping=Pt}function aa(v,D,k){const G=D.isScene===!0?D.overrideMaterial:null;for(let U=0,J=v.length;U<J;U++){const ct=v[U],mt=ct.object,dt=ct.geometry,Rt=ct.group;let Pt=ct.material;Pt.allowOverride===!0&&G!==null&&(Pt=G),mt.layers.test(k.layers)&&tu(mt,D,k,dt,Pt,Rt)}}function tu(v,D,k,G,U,J){v.onBeforeRender(y,D,k,G,U,J),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),U.onBeforeRender(y,D,k,G,v,J),U.transparent===!0&&U.side===Ni&&U.forceSinglePass===!1?(U.side=Ue,U.needsUpdate=!0,y.renderBufferDirect(k,D,G,U,v,J),U.side=$i,U.needsUpdate=!0,y.renderBufferDirect(k,D,G,U,v,J),U.side=Ni):y.renderBufferDirect(k,D,G,U,v,J),v.onAfterRender(y,D,k,G,U,J)}function oa(v,D,k){D.isScene!==!0&&(D=It);const G=pt.get(v),U=p.state.lights,J=p.state.shadowsArray,ct=U.state.version,mt=Y.getParameters(v,U.state,J,D,k),dt=Y.getProgramCacheKey(mt);let Rt=G.programs;G.environment=v.isMeshStandardMaterial?D.environment:null,G.fog=D.fog,G.envMap=(v.isMeshStandardMaterial?fe:Ee).get(v.envMap||G.environment),G.envMapRotation=G.environment!==null&&v.envMap===null?D.environmentRotation:v.envMapRotation,Rt===void 0&&(v.addEventListener("dispose",Z),Rt=new Map,G.programs=Rt);let Pt=Rt.get(dt);if(Pt!==void 0){if(G.currentProgram===Pt&&G.lightsStateVersion===ct)return iu(v,mt),Pt}else mt.uniforms=Y.getUniforms(v),v.onBeforeCompile(mt,y),Pt=Y.acquireProgram(mt,dt),Rt.set(dt,Pt),G.uniforms=mt.uniforms;const bt=G.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(bt.clippingPlanes=it.uniform),iu(v,mt),G.needsLights=L0(v),G.lightsStateVersion=ct,G.needsLights&&(bt.ambientLightColor.value=U.state.ambient,bt.lightProbe.value=U.state.probe,bt.directionalLights.value=U.state.directional,bt.directionalLightShadows.value=U.state.directionalShadow,bt.spotLights.value=U.state.spot,bt.spotLightShadows.value=U.state.spotShadow,bt.rectAreaLights.value=U.state.rectArea,bt.ltc_1.value=U.state.rectAreaLTC1,bt.ltc_2.value=U.state.rectAreaLTC2,bt.pointLights.value=U.state.point,bt.pointLightShadows.value=U.state.pointShadow,bt.hemisphereLights.value=U.state.hemi,bt.directionalShadowMap.value=U.state.directionalShadowMap,bt.directionalShadowMatrix.value=U.state.directionalShadowMatrix,bt.spotShadowMap.value=U.state.spotShadowMap,bt.spotLightMatrix.value=U.state.spotLightMatrix,bt.spotLightMap.value=U.state.spotLightMap,bt.pointShadowMap.value=U.state.pointShadowMap,bt.pointShadowMatrix.value=U.state.pointShadowMatrix),G.currentProgram=Pt,G.uniformsList=null,Pt}function eu(v){if(v.uniformsList===null){const D=v.currentProgram.getUniforms();v.uniformsList=ia.seqWithValue(D.seq,v.uniforms)}return v.uniformsList}function iu(v,D){const k=pt.get(v);k.outputColorSpace=D.outputColorSpace,k.batching=D.batching,k.batchingColor=D.batchingColor,k.instancing=D.instancing,k.instancingColor=D.instancingColor,k.instancingMorph=D.instancingMorph,k.skinning=D.skinning,k.morphTargets=D.morphTargets,k.morphNormals=D.morphNormals,k.morphColors=D.morphColors,k.morphTargetsCount=D.morphTargetsCount,k.numClippingPlanes=D.numClippingPlanes,k.numIntersection=D.numClipIntersection,k.vertexAlphas=D.vertexAlphas,k.vertexTangents=D.vertexTangents,k.toneMapping=D.toneMapping}function P0(v,D,k,G,U){D.isScene!==!0&&(D=It),zt.resetTextureUnits();const J=D.fog,ct=G.isMeshStandardMaterial?D.environment:null,mt=I===null?y.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:rs,dt=(G.isMeshStandardMaterial?fe:Ee).get(G.envMap||ct),Rt=G.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Pt=!!k.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),bt=!!k.morphAttributes.position,kt=!!k.morphAttributes.normal,$t=!!k.morphAttributes.color;let ce=Qi;G.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(ce=y.toneMapping);const ie=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Qt=ie!==void 0?ie.length:0,Tt=pt.get(G),re=p.state.lights;if(j===!0&&(ot===!0||v!==M)){const Le=v===M&&G.id===S;it.setState(G,v,Le)}let qt=!1;G.version===Tt.__version?(Tt.needsLights&&Tt.lightsStateVersion!==re.state.version||Tt.outputColorSpace!==mt||U.isBatchedMesh&&Tt.batching===!1||!U.isBatchedMesh&&Tt.batching===!0||U.isBatchedMesh&&Tt.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&Tt.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&Tt.instancing===!1||!U.isInstancedMesh&&Tt.instancing===!0||U.isSkinnedMesh&&Tt.skinning===!1||!U.isSkinnedMesh&&Tt.skinning===!0||U.isInstancedMesh&&Tt.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Tt.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&Tt.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&Tt.instancingMorph===!1&&U.morphTexture!==null||Tt.envMap!==dt||G.fog===!0&&Tt.fog!==J||Tt.numClippingPlanes!==void 0&&(Tt.numClippingPlanes!==it.numPlanes||Tt.numIntersection!==it.numIntersection)||Tt.vertexAlphas!==Rt||Tt.vertexTangents!==Pt||Tt.morphTargets!==bt||Tt.morphNormals!==kt||Tt.morphColors!==$t||Tt.toneMapping!==ce||Tt.morphTargetsCount!==Qt)&&(qt=!0):(qt=!0,Tt.__version=G.version);let Xe=Tt.currentProgram;qt===!0&&(Xe=oa(G,D,U));let ws=!1,qe=!1,sr=!1;const ae=Xe.getUniforms(),Je=Tt.uniforms;if(St.useProgram(Xe.program)&&(ws=!0,qe=!0,sr=!0),G.id!==S&&(S=G.id,qe=!0),ws||M!==v){St.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),ae.setValue(P,"projectionMatrix",v.projectionMatrix),ae.setValue(P,"viewMatrix",v.matrixWorldInverse);const Oe=ae.map.cameraPosition;Oe!==void 0&&Oe.setValue(P,At.setFromMatrixPosition(v.matrixWorld)),Yt.logarithmicDepthBuffer&&ae.setValue(P,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&ae.setValue(P,"isOrthographic",v.isOrthographicCamera===!0),M!==v&&(M=v,qe=!0,sr=!0)}if(U.isSkinnedMesh){ae.setOptional(P,U,"bindMatrix"),ae.setOptional(P,U,"bindMatrixInverse");const Le=U.skeleton;Le&&(Le.boneTexture===null&&Le.computeBoneTexture(),ae.setValue(P,"boneTexture",Le.boneTexture,zt))}U.isBatchedMesh&&(ae.setOptional(P,U,"batchingTexture"),ae.setValue(P,"batchingTexture",U._matricesTexture,zt),ae.setOptional(P,U,"batchingIdTexture"),ae.setValue(P,"batchingIdTexture",U._indirectTexture,zt),ae.setOptional(P,U,"batchingColorTexture"),U._colorsTexture!==null&&ae.setValue(P,"batchingColorTexture",U._colorsTexture,zt));const Qe=k.morphAttributes;if((Qe.position!==void 0||Qe.normal!==void 0||Qe.color!==void 0)&&tt.update(U,k,Xe),(qe||Tt.receiveShadow!==U.receiveShadow)&&(Tt.receiveShadow=U.receiveShadow,ae.setValue(P,"receiveShadow",U.receiveShadow)),G.isMeshGouraudMaterial&&G.envMap!==null&&(Je.envMap.value=dt,Je.flipEnvMap.value=dt.isCubeTexture&&dt.isRenderTargetTexture===!1?-1:1),G.isMeshStandardMaterial&&G.envMap===null&&D.environment!==null&&(Je.envMapIntensity.value=D.environmentIntensity),qe&&(ae.setValue(P,"toneMappingExposure",y.toneMappingExposure),Tt.needsLights&&I0(Je,sr),J&&G.fog===!0&&K.refreshFogUniforms(Je,J),K.refreshMaterialUniforms(Je,G,H,Q,p.state.transmissionRenderTarget[v.id]),ia.upload(P,eu(Tt),Je,zt)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(ia.upload(P,eu(Tt),Je,zt),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&ae.setValue(P,"center",U.center),ae.setValue(P,"modelViewMatrix",U.modelViewMatrix),ae.setValue(P,"normalMatrix",U.normalMatrix),ae.setValue(P,"modelMatrix",U.matrixWorld),G.isShaderMaterial||G.isRawShaderMaterial){const Le=G.uniformsGroups;for(let Oe=0,xl=Le.length;Oe<xl;Oe++){const zn=Le[Oe];Nt.update(zn,Xe),Nt.bind(zn,Xe)}}return Xe}function I0(v,D){v.ambientLightColor.needsUpdate=D,v.lightProbe.needsUpdate=D,v.directionalLights.needsUpdate=D,v.directionalLightShadows.needsUpdate=D,v.pointLights.needsUpdate=D,v.pointLightShadows.needsUpdate=D,v.spotLights.needsUpdate=D,v.spotLightShadows.needsUpdate=D,v.rectAreaLights.needsUpdate=D,v.hemisphereLights.needsUpdate=D}function L0(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(v,D,k){const G=pt.get(v);G.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),pt.get(v.texture).__webglTexture=D,pt.get(v.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:k,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,D){const k=pt.get(v);k.__webglFramebuffer=D,k.__useDefaultFramebuffer=D===void 0};const D0=P.createFramebuffer();this.setRenderTarget=function(v,D=0,k=0){I=v,w=D,C=k;let G=!0,U=null,J=!1,ct=!1;if(v){const dt=pt.get(v);if(dt.__useDefaultFramebuffer!==void 0)St.bindFramebuffer(P.FRAMEBUFFER,null),G=!1;else if(dt.__webglFramebuffer===void 0)zt.setupRenderTarget(v);else if(dt.__hasExternalTextures)zt.rebindTextures(v,pt.get(v.texture).__webglTexture,pt.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const bt=v.depthTexture;if(dt.__boundDepthTexture!==bt){if(bt!==null&&pt.has(bt)&&(v.width!==bt.image.width||v.height!==bt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");zt.setupDepthRenderbuffer(v)}}const Rt=v.texture;(Rt.isData3DTexture||Rt.isDataArrayTexture||Rt.isCompressedArrayTexture)&&(ct=!0);const Pt=pt.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Pt[D])?U=Pt[D][k]:U=Pt[D],J=!0):v.samples>0&&zt.useMultisampledRTT(v)===!1?U=pt.get(v).__webglMultisampledFramebuffer:Array.isArray(Pt)?U=Pt[k]:U=Pt,A.copy(v.viewport),B.copy(v.scissor),F=v.scissorTest}else A.copy(_t).multiplyScalar(H).floor(),B.copy(Ot).multiplyScalar(H).floor(),F=ne;if(k!==0&&(U=D0),St.bindFramebuffer(P.FRAMEBUFFER,U)&&G&&St.drawBuffers(v,U),St.viewport(A),St.scissor(B),St.setScissorTest(F),J){const dt=pt.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+D,dt.__webglTexture,k)}else if(ct){const dt=D;for(let Rt=0;Rt<v.textures.length;Rt++){const Pt=pt.get(v.textures[Rt]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Rt,Pt.__webglTexture,k,dt)}}else if(v!==null&&k!==0){const dt=pt.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,dt.__webglTexture,k)}S=-1},this.readRenderTargetPixels=function(v,D,k,G,U,J,ct,mt=0){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=pt.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ct!==void 0&&(dt=dt[ct]),dt){St.bindFramebuffer(P.FRAMEBUFFER,dt);try{const Rt=v.textures[mt],Pt=Rt.format,bt=Rt.type;if(!Yt.textureFormatReadable(Pt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Yt.textureTypeReadable(bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=v.width-G&&k>=0&&k<=v.height-U&&(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+mt),P.readPixels(D,k,G,U,yt.convert(Pt),yt.convert(bt),J))}finally{const Rt=I!==null?pt.get(I).__webglFramebuffer:null;St.bindFramebuffer(P.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(v,D,k,G,U,J,ct,mt=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let dt=pt.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ct!==void 0&&(dt=dt[ct]),dt)if(D>=0&&D<=v.width-G&&k>=0&&k<=v.height-U){St.bindFramebuffer(P.FRAMEBUFFER,dt);const Rt=v.textures[mt],Pt=Rt.format,bt=Rt.type;if(!Yt.textureFormatReadable(Pt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Yt.textureTypeReadable(bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const kt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,kt),P.bufferData(P.PIXEL_PACK_BUFFER,J.byteLength,P.STREAM_READ),v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+mt),P.readPixels(D,k,G,U,yt.convert(Pt),yt.convert(bt),0);const $t=I!==null?pt.get(I).__webglFramebuffer:null;St.bindFramebuffer(P.FRAMEBUFFER,$t);const ce=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Sf(P,ce,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,kt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,J),P.deleteBuffer(kt),P.deleteSync(ce),J}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,D=null,k=0){const G=Math.pow(2,-k),U=Math.floor(v.image.width*G),J=Math.floor(v.image.height*G),ct=D!==null?D.x:0,mt=D!==null?D.y:0;zt.setTexture2D(v,0),P.copyTexSubImage2D(P.TEXTURE_2D,k,0,0,ct,mt,U,J),St.unbindTexture()};const U0=P.createFramebuffer(),N0=P.createFramebuffer();this.copyTextureToTexture=function(v,D,k=null,G=null,U=0,J=null){J===null&&(U!==0?(os("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),J=U,U=0):J=0);let ct,mt,dt,Rt,Pt,bt,kt,$t,ce;const ie=v.isCompressedTexture?v.mipmaps[J]:v.image;if(k!==null)ct=k.max.x-k.min.x,mt=k.max.y-k.min.y,dt=k.isBox3?k.max.z-k.min.z:1,Rt=k.min.x,Pt=k.min.y,bt=k.isBox3?k.min.z:0;else{const Qe=Math.pow(2,-U);ct=Math.floor(ie.width*Qe),mt=Math.floor(ie.height*Qe),v.isDataArrayTexture?dt=ie.depth:v.isData3DTexture?dt=Math.floor(ie.depth*Qe):dt=1,Rt=0,Pt=0,bt=0}G!==null?(kt=G.x,$t=G.y,ce=G.z):(kt=0,$t=0,ce=0);const Qt=yt.convert(D.format),Tt=yt.convert(D.type);let re;D.isData3DTexture?(zt.setTexture3D(D,0),re=P.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(zt.setTexture2DArray(D,0),re=P.TEXTURE_2D_ARRAY):(zt.setTexture2D(D,0),re=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,D.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,D.unpackAlignment);const qt=P.getParameter(P.UNPACK_ROW_LENGTH),Xe=P.getParameter(P.UNPACK_IMAGE_HEIGHT),ws=P.getParameter(P.UNPACK_SKIP_PIXELS),qe=P.getParameter(P.UNPACK_SKIP_ROWS),sr=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,ie.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ie.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Rt),P.pixelStorei(P.UNPACK_SKIP_ROWS,Pt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,bt);const ae=v.isDataArrayTexture||v.isData3DTexture,Je=D.isDataArrayTexture||D.isData3DTexture;if(v.isDepthTexture){const Qe=pt.get(v),Le=pt.get(D),Oe=pt.get(Qe.__renderTarget),xl=pt.get(Le.__renderTarget);St.bindFramebuffer(P.READ_FRAMEBUFFER,Oe.__webglFramebuffer),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,xl.__webglFramebuffer);for(let zn=0;zn<dt;zn++)ae&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,pt.get(v).__webglTexture,U,bt+zn),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,pt.get(D).__webglTexture,J,ce+zn)),P.blitFramebuffer(Rt,Pt,ct,mt,kt,$t,ct,mt,P.DEPTH_BUFFER_BIT,P.NEAREST);St.bindFramebuffer(P.READ_FRAMEBUFFER,null),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(U!==0||v.isRenderTargetTexture||pt.has(v)){const Qe=pt.get(v),Le=pt.get(D);St.bindFramebuffer(P.READ_FRAMEBUFFER,U0),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,N0);for(let Oe=0;Oe<dt;Oe++)ae?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,Qe.__webglTexture,U,bt+Oe):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,Qe.__webglTexture,U),Je?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,Le.__webglTexture,J,ce+Oe):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,Le.__webglTexture,J),U!==0?P.blitFramebuffer(Rt,Pt,ct,mt,kt,$t,ct,mt,P.COLOR_BUFFER_BIT,P.NEAREST):Je?P.copyTexSubImage3D(re,J,kt,$t,ce+Oe,Rt,Pt,ct,mt):P.copyTexSubImage2D(re,J,kt,$t,Rt,Pt,ct,mt);St.bindFramebuffer(P.READ_FRAMEBUFFER,null),St.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else Je?v.isDataTexture||v.isData3DTexture?P.texSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,Tt,ie.data):D.isCompressedArrayTexture?P.compressedTexSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,ie.data):P.texSubImage3D(re,J,kt,$t,ce,ct,mt,dt,Qt,Tt,ie):v.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,J,kt,$t,ct,mt,Qt,Tt,ie.data):v.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,J,kt,$t,ie.width,ie.height,Qt,ie.data):P.texSubImage2D(P.TEXTURE_2D,J,kt,$t,ct,mt,Qt,Tt,ie);P.pixelStorei(P.UNPACK_ROW_LENGTH,qt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Xe),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ws),P.pixelStorei(P.UNPACK_SKIP_ROWS,qe),P.pixelStorei(P.UNPACK_SKIP_IMAGES,sr),J===0&&D.generateMipmaps&&P.generateMipmap(re),St.unbindTexture()},this.copyTextureToTexture3D=function(v,D,k=null,G=null,U=0){return os('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(v,D,k,G,U)},this.initRenderTarget=function(v){pt.get(v).__webglFramebuffer===void 0&&zt.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?zt.setTextureCube(v,0):v.isData3DTexture?zt.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?zt.setTexture2DArray(v,0):zt.setTexture2D(v,0),St.unbindTexture()},this.resetState=function(){w=0,C=0,I=null,St.reset(),lt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Xt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Xt._getUnpackColorSpace()}}const Yc={type:"change"},ml={type:"start"},jc={type:"end"},sa=new Gh,Zc=new hn,p0=Math.cos(70*yf.DEG2RAD),ye=new N,Fe=2*Math.PI,Kt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},gl=1e-6;class m0 extends cp{constructor(t,e=null){super(t,e),this.state=Kt.NONE,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Qn.ROTATE,MIDDLE:Qn.DOLLY,RIGHT:Qn.PAN},this.touches={ONE:ts.ROTATE,TWO:ts.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new Tn,this._lastTargetPosition=new N,this._quat=new Tn().setFromUnitVectors(t.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new mc,this._sphericalDelta=new mc,this._scale=1,this._panOffset=new N,this._rotateStart=new Dt,this._rotateEnd=new Dt,this._rotateDelta=new Dt,this._panStart=new Dt,this._panEnd=new Dt,this._panDelta=new Dt,this._dollyStart=new Dt,this._dollyEnd=new Dt,this._dollyDelta=new Dt,this._dollyDirection=new N,this._mouse=new Dt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=_0.bind(this),this._onPointerDown=g0.bind(this),this._onPointerUp=x0.bind(this),this._onContextMenu=T0.bind(this),this._onMouseWheel=M0.bind(this),this._onKeyDown=S0.bind(this),this._onTouchStart=b0.bind(this),this._onTouchMove=E0.bind(this),this._onMouseDown=v0.bind(this),this._onMouseMove=y0.bind(this),this._interceptControlDown=A0.bind(this),this._interceptControlUp=w0.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Yc),this.update(),this.state=Kt.NONE}update(t=null){const e=this.object.position;ye.copy(e).sub(this.target),ye.applyQuaternion(this._quat),this._spherical.setFromVector3(ye),this.autoRotate&&this.state===Kt.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(i)&&isFinite(n)&&(i<-Math.PI?i+=Fe:i>Math.PI&&(i-=Fe),n<-Math.PI?n+=Fe:n>Math.PI&&(n-=Fe),i<=n?this._spherical.theta=Math.max(i,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+n)/2?Math.max(i,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(ye.setFromSpherical(this._spherical),ye.applyQuaternion(this._quatInverse),e.copy(this.target).add(ye),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=ye.length();a=this._clampDistance(o*this._scale);const h=o-a;this.object.position.addScaledVector(this._dollyDirection,h),this.object.updateMatrixWorld(),r=!!h}else if(this.object.isOrthographicCamera){const o=new N(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const h=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=h!==this.object.zoom;const l=new N(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=ye.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(sa.origin.copy(this.object.position),sa.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(sa.direction))<p0?this.object.lookAt(this.target):(Zc.setFromNormalAndCoplanarPoint(this.object.up,this.target),sa.intersectPlane(Zc,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>gl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gl||this._lastTargetPosition.distanceToSquared(this.target)>gl?(this.dispatchEvent(Yc),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Fe/60*this.autoRotateSpeed*t:Fe/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){ye.setFromMatrixColumn(e,0),ye.multiplyScalar(-t),this._panOffset.add(ye)}_panUp(t,e){this.screenSpacePanning===!0?ye.setFromMatrixColumn(e,1):(ye.setFromMatrixColumn(e,0),ye.crossVectors(this.object.up,ye)),ye.multiplyScalar(t),this._panOffset.add(ye)}_pan(t,e){const i=this.domElement;if(this.object.isPerspectiveCamera){const n=this.object.position;ye.copy(n).sub(this.target);let r=ye.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*r/i.clientHeight,this.object.matrix),this._panUp(2*e*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),n=t-i.left,r=e-i.top,a=i.width,o=i.height;this._mouse.x=n/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Fe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Fe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-Fe*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._rotateStart.set(i,n)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._panStart.set(i,n)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,r=Math.sqrt(i*i+n*n);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),n=.5*(t.pageX+i.x),r=.5*(t.pageY+i.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Fe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Fe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this._panEnd.set(i,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,r=Math.sqrt(i*i+n*n);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(t.pageX+e.x)*.5,o=(t.pageY+e.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new Dt,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,i={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function g0(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s)))}function _0(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function x0(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(jc),this.state=Kt.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function v0(s){let t;switch(s.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Qn.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=Kt.DOLLY;break;case Qn.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Kt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Kt.ROTATE}break;case Qn.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=Kt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=Kt.PAN}break;default:this.state=Kt.NONE}this.state!==Kt.NONE&&this.dispatchEvent(ml)}function y0(s){switch(this.state){case Kt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case Kt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case Kt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function M0(s){this.enabled===!1||this.enableZoom===!1||this.state!==Kt.NONE||(s.preventDefault(),this.dispatchEvent(ml),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent(jc))}function S0(s){this.enabled!==!1&&this._handleKeyDown(s)}function b0(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case ts.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=Kt.TOUCH_ROTATE;break;case ts.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=Kt.TOUCH_PAN;break;default:this.state=Kt.NONE}break;case 2:switch(this.touches.TWO){case ts.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=Kt.TOUCH_DOLLY_PAN;break;case ts.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=Kt.TOUCH_DOLLY_ROTATE;break;default:this.state=Kt.NONE}break;default:this.state=Kt.NONE}this.state!==Kt.NONE&&this.dispatchEvent(ml)}function E0(s){switch(this._trackPointer(s),this.state){case Kt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case Kt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case Kt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case Kt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=Kt.NONE}}function T0(s){this.enabled!==!1&&s.preventDefault()}function A0(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function w0(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Kc={LANGUAGE_CHANGE_CONFIRMED:vl.LANGUAGE_CHANGE_CONFIRMED},R0={languages:[],selected:void 0};class ra extends HTMLElement{static _languagesAttribute="languages";static _selectedAttribute="selected";_shadowRoot;_container;_canvas;_camera;_renderer;_scene;_controls;_resizeObserver;_clock=new hp;_lastTime=0;_lights=[];_spotlight;_flagsGroup;_languages=[];_selectedLanguageIndex=0;_animationFrameId=0;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_introCameraStartPosition=new N(0,5,10);_introCameraEndPosition=new N(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;_cameraLookAtY=2;_circleRadius=5;_wind=null;_menuContainer;_menuIntroStartScale=.72;_barMenu;_languageButtons=[];_confirmationDialog;_currentVisibleButtonIndex=0;_isInitialized=!1;_isInitializing=!1;static get observedAttributes(){return["languages","selected"]}constructor(t){super(),this._shadowRoot=this.attachShadow({mode:"open"});const{languages:e,selected:i}={...R0,...t};e.length>0&&this._initializeComponent(e,i)}_initializeComponent(t,e){if(!(this._isInitialized||this._isInitializing)){if(t.length===0){console.warn("LanguagePickerComponent: No languages provided");return}this._isInitializing=!0,this._setupScene(),this._setupUI(),this._setupFlags(t,e),this._setupLanguageDialog(),this._setupEventListeners(),this._isInitialized=!0,this._isInitializing=!1,this.isConnected&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}}attributeChangedCallback(t,e,i){if(e!==i&&!(this._isInitialized||this._isInitializing)&&t===ra._languagesAttribute&&i!=null)try{const n=JSON.parse(i),r=this.getAttribute(ra._selectedAttribute);Array.isArray(n)&&n.length>0&&this._initializeComponent(n,r)}catch(n){console.error("LanguagePickerComponent: Error parsing languages attribute",n)}}_setupScene(){this._container=document.createElement("div"),this._container.style.width="100%",this._container.style.height="100%",this._container.style.position="relative",this._container.style.overflow="hidden",this._canvas=document.createElement("canvas"),this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._container.appendChild(this._canvas),this._scene=new Yf,this._scene.background=new Vt(1710618),this._scene.fog=new tl(1710618,8,50),this._camera=new We(45,1,.1,100),this._camera.position.set(0,5,10),this._camera.lookAt(0,2,0),this._scene.add(this._camera),this._renderer=new f0({antialias:!0,canvas:this._canvas,alpha:!0}),this._renderer.debug.checkShaderErrors=!0,this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.shadowMap.enabled=!1,this._controls=new m0(this._camera,this._canvas),this._controls.enableDamping=!0,this._controls.dampingFactor=.05,this._controls.autoRotate=!1,this._controls.enableRotate=!1,this._controls.enablePan=!1,this._controls.enableZoom=!1,this._controls.target.set(0,this._cameraLookAtY,0);const e=new op(16777215,.3);this._scene.add(e),this._lights.push(e);const i=new pc(14674943,3);i.position.set(10,20,10),this._scene.add(i),this._lights.push(i);const n=new pc(11329439,.15);n.position.set(0,-1,0),this._scene.add(n),this._lights.push(n),this._spotlight=new rp(16777215,150),this._spotlight.angle=Math.PI/6,this._spotlight.penumbra=.3,this._spotlight.decay=2,this._spotlight.distance=30,this._scene.add(this._spotlight),this._scene.add(this._spotlight.target),this._lights.push(this._spotlight);const r=new ir(100,100),a=new $f({color:1710618,roughness:.8,metalness:.2}),o=new Si(r,a);o.rotation.x=-Math.PI/2,o.position.y=0,o.receiveShadow=!0,this._scene.add(o);const h=()=>{const l=this._container.clientWidth,c=this._container.clientHeight;l===0||c===0||(this._camera.aspect=l/c,this._camera.updateProjectionMatrix(),this._renderer.setSize(l,c,!1))};this._resizeObserver=new ResizeObserver(h),this._resizeObserver.observe(this._container),h(),this._wind=new Di.Wind({speed:8,direction:new N(1,0,0)}),this._flagsGroup=new er,this._scene.add(this._flagsGroup),this._shadowRoot.appendChild(this._container)}_setupUI(){this._barMenu=document.createElement(yu.selector),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,this._menuContainer=document.createElement("div"),this._menuContainer.style.position="absolute",this._menuContainer.style.bottom="25%",this._menuContainer.style.left="50%",this._menuContainer.style.zIndex="9999",this._menuContainer.style.pointerEvents="auto",this._menuContainer.style.transformOrigin="center bottom",this._setMenuIntroScale(1),this._menuContainer.appendChild(this._barMenu),this._shadowRoot.appendChild(this._menuContainer);const t=document.createElement("style");t.textContent=`
3956
3956
  :host {
3957
3957
  display: block;
3958
3958
  width: 100%;
@@ -46,7 +46,7 @@ export declare class LanguagePickerComponent extends HTMLElement {
46
46
  static get observedAttributes(): string[];
47
47
  constructor(options?: LanguagePickerComponentOptions);
48
48
  private _initializeComponent;
49
- attributeChangedCallback(name: string, newValue: string | null): void;
49
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
50
50
  private _setupScene;
51
51
  private _setupUI;
52
52
  private _setupFlags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albi_scando/as-design-system-threejs-lib",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A library of reusable, strongly typed threejs Web Components built with TypeScript, designed for creating consistent and maintainable user interfaces.",
5
5
  "type": "module",
6
6
  "files": [
@@ -88,6 +88,7 @@
88
88
  "@albi_scando/as-const-lib": "^1.9.0",
89
89
  "@albi_scando/as-design-system-lib": "^1.6.0",
90
90
  "@albi_scando/as-threejs-flags-lib": "^2.3.2",
91
+ "@fontsource/material-symbols-outlined": "^5.0.0",
91
92
  "@types/three": "^0.179.0",
92
93
  "three": "^0.179.1"
93
94
  },