@abi-software/scaffoldvuer 1.20.1-beta.0 → 1.21.0

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.
@@ -4112,13 +4112,13 @@ void main() {
4112
4112
 
4113
4113
  }
4114
4114
 
4115
- }`,y_=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Pc(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Pu({vertexShader:__,fragmentShader:v_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ts(new pu(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},b_=class extends xr{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new y_,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new q,C=null,w=new Ud;w.viewport=new mi;let T=new Ud;T.viewport=new mi;let E=[w,T],D=new wf,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,M);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}O=null,k=null,h.reset();for(let e in g)delete g[e];e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,I.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,A),r.addEventListener(`selectstart`,A),r.addEventListener(`selectend`,A),r.addEventListener(`squeeze`,A),r.addEventListener(`squeezestart`,A),r.addEventListener(`squeezeend`,A),r.addEventListener(`end`,j),r.addEventListener(`inputsourceschange`,M),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?et:$e,a=_.stencil?qe:He);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new gi(d.textureWidth,d.textureHeight,{format:Qe,type:Le,depthTexture:new Mc(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new gi(f.framebufferWidth,f.framebufferHeight,{format:Qe,type:Le,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),I.setContext(r),I.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function M(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let N=new J,P=new J;function F(e,t,n){N.setFromMatrixPosition(t.matrixWorld),P.setFromMatrixPosition(n.matrixWorld);let r=N.distanceTo(P),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ee(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;ee(D,i);for(let e=0;e<a.length;e++)ee(a[e],i);a.length===2?F(D,w,T):D.projectionMatrix.copy(w.projectionMatrix),te(e,D,i)};function te(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=Tr*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(d!==null||f!==null)return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(D)},this.getCameraTexture=function(e){return g[e]};let ne=null;function re(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==D.cameras.length&&(D.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=E[n];o===void 0&&(o=new Ud,o.layers.enable(n),o.viewport=new mi,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(D.matrix.copy(o.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),i===!0&&D.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new Pc,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}ne&&ne(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let I=new fm;I.setAnimationLoop(re),this.setAnimationLoop=function(e){ne=e},this.dispose=function(){}}},x_=new xi,S_=new Qr;S_.set(-1,0,0,0,1,0,0,0,1);function C_(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,Au(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isNodeMaterial?t.uniformsNeedUpdate=!1:t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&m(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),h(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),g(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===p&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===p&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(x_.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(S_),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function m(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===p&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function h(e,t){t.matcap&&(e.matcap.value=t.matcap)}function g(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function w_(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(g(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,v));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return _r(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)p(t[n],e,n,a);else p(t,e,0,a)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(t,n,r,i){if(h(t,n,r,i)===!0){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let i=r[n],a=_(i);m(i,t.__data,e),typeof i!=`number`&&typeof i!=`boolean`&&!i.isMatrix3&&!ArrayBuffer.isView(i)&&(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else m(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function m(e,t,n){typeof e==`number`||typeof e==`boolean`?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function h(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return r[a]=typeof i==`number`||typeof i==`boolean`?i:ArrayBuffer.isView(i)?i.slice():i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function g(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=_(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function _(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?K(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):K(`WebGLRenderer: Unsupported uniform value type.`,e),t}function v(t){let n=t.target;n.removeEventListener(`dispose`,v);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function y(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:y}}var T_=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),E_=null;function D_(){return E_===null&&(E_=new hs(T_,16,16,rt,We),E_.name=`DFG_LUT`,E_.minFilter=Me,E_.magFilter=Me,E_.wrapS=W,E_.wrapT=W,E_.generateMipmaps=!1,E_.needsUpdate=!0),E_}var O_=class{constructor(e={}){let{canvas:n=ur(),context:r=null,depth:i=!0,stencil:a=!1,alpha:o=!1,antialias:s=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u=`default`,failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:h=!1,outputBufferType:g=Le}=e;this.isWebGLRenderer=!0;let _;if(r!==null){if(typeof WebGLRenderingContext<`u`&&r instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);_=r.getContextAttributes().alpha}else _=o;let v=g,y=new Set([ot,it,nt]),b=new Set([Le,He,Be,qe,Ge,Ke]),x=new Uint32Array(4),S=new Int32Array(4),C=new J,w=null,T=null,E=[],D=[],O=null;this.domElement=n,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=he,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,A=!1,j=null,M=null,N=null,P=null;this._outputColorSpace=fn;let F=0,ee=0,te=null,ne=-1,re=null,I=new mi,ie=new mi,ae=null,oe=new Y(0),se=0,L=n.width,ce=n.height,le=1,ue=null,de=null,fe=new mi(0,0,L,ce),pe=new mi(0,0,L,ce),me=!1,ge=new Fs,R=!1,_e=!1,ve=new xi,z=new J,ye=new mi,be={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},xe=!1;function Se(){return te===null?le:1}let B=r;function V(e,t){return n.getContext(e,t)}try{let e={alpha:!0,depth:i,stencil:a,antialias:s,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:d};if(`setAttribute`in n&&n.setAttribute(`data-engine`,`three.js r${t}`),n.addEventListener(`webglcontextlost`,$e,!1),n.addEventListener(`webglcontextrestored`,et,!1),n.addEventListener(`webglcontextcreationerror`,tt,!1),B===null){let t=`webgl2`;if(B=V(t,e),B===null)throw V(t)?Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}}catch(e){throw _r(`WebGLRenderer: `+e.message),e}let Ce,we,H,Te,U,W,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Ie,Re,ze,Ve,Ue,Je,Ye,Xe;function Ze(){Ce=new Km(B),Ce.init(),Je=new g_(B,Ce),we=new Sm(B,Ce,e,Je),H=new m_(B,Ce),we.reversedDepthBuffer&&h&&H.buffers.depth.setReversed(!0),M=B.createFramebuffer(),N=B.createFramebuffer(),P=B.createFramebuffer(),Te=new Ym(B),U=new Jg,W=new h_(B,Ce,H,U,we,Je,Te),Ee=new Gm(k),De=new pm(B),Ye=new bm(B,De),Oe=new qm(B,De,Te,Ye),ke=new Zm(B,Oe,De,Ye,Te),ze=new Xm(B,we,W),Pe=new Cm(U),Ae=new qg(k,Ee,Ce,we,Ye,Pe),je=new C_(k,U),Me=new Qg,Ne=new a_(Ce),Re=new ym(k,Ee,H,ke,_,c),Ie=new p_(k,ke,we),Xe=new w_(B,Te,we,H),Ve=new xm(B,Ce,Te),Ue=new Jm(B,Ce,Te),Te.programs=Ae.programs,k.capabilities=we,k.extensions=Ce,k.properties=U,k.renderLists=Me,k.shadowMap=Ie,k.state=H,k.info=Te}Ze(),v!==Le&&(O=new $m(v,n.width,n.height,s,i,a));let Qe=new b_(k,B);this.xr=Qe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let e=Ce.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=Ce.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(e){e!==void 0&&(le=e,this.setSize(L,ce,!1))},this.getSize=function(e){return e.set(L,ce)},this.setSize=function(e,t,r=!0){if(Qe.isPresenting){K(`WebGLRenderer: Can't change size while VR device is presenting.`);return}L=e,ce=t,n.width=Math.floor(e*le),n.height=Math.floor(t*le),r===!0&&(n.style.width=e+`px`,n.style.height=t+`px`),O!==null&&O.setSize(n.width,n.height),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(L*le,ce*le).floor()},this.setDrawingBufferSize=function(e,t,r){L=e,ce=t,le=r,n.width=Math.floor(e*r),n.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(v===Le){_r(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){K(`WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}O.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(I)},this.getViewport=function(e){return e.copy(fe)},this.setViewport=function(e,t,n,r){e.isVector4?fe.set(e.x,e.y,e.z,e.w):fe.set(e,t,n,r),H.viewport(I.copy(fe).multiplyScalar(le).round())},this.getScissor=function(e){return e.copy(pe)},this.setScissor=function(e,t,n,r){e.isVector4?pe.set(e.x,e.y,e.z,e.w):pe.set(e,t,n,r),H.scissor(ie.copy(pe).multiplyScalar(le).round())},this.getScissorTest=function(){return me},this.setScissorTest=function(e){H.setScissorTest(me=e)},this.setOpaqueSort=function(e){ue=e},this.setTransparentSort=function(e){de=e},this.getClearColor=function(e){return e.copy(Re.getClearColor())},this.setClearColor=function(){Re.setClearColor(...arguments)},this.getClearAlpha=function(){return Re.getClearAlpha()},this.setClearAlpha=function(){Re.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(te!==null){let t=te.texture.format;e=y.has(t)}if(e){let e=te.texture.type,t=b.has(e),n=Re.getClearColor(),r=Re.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(x[0]=i,x[1]=a,x[2]=o,x[3]=r,B.clearBufferuiv(B.COLOR,0,x)):(S[0]=i,S[1]=a,S[2]=o,S[3]=r,B.clearBufferiv(B.COLOR,0,S))}else r|=B.COLOR_BUFFER_BIT}t&&(r|=B.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&B.clear(r)},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.setNodesHandler=function(e){e.setRenderer(this),j=e},this.dispose=function(){n.removeEventListener(`webglcontextlost`,$e,!1),n.removeEventListener(`webglcontextrestored`,et,!1),n.removeEventListener(`webglcontextcreationerror`,tt,!1),Re.dispose(),Me.dispose(),Ne.dispose(),U.dispose(),Ee.dispose(),ke.dispose(),Ye.dispose(),Xe.dispose(),Ae.dispose(),Qe.dispose(),Qe.removeEventListener(`sessionstart`,dt),Qe.removeEventListener(`sessionend`,ft),pt.stop()};function $e(e){e.preventDefault(),hr(`WebGLRenderer: Context Lost.`),A=!0}function et(){hr(`WebGLRenderer: Context Restored.`),A=!1;let e=Te.autoReset,t=Ie.enabled,n=Ie.autoUpdate,r=Ie.needsUpdate,i=Ie.type;Ze(),Te.autoReset=e,Ie.enabled=t,Ie.autoUpdate=n,Ie.needsUpdate=r,Ie.type=i}function tt(e){_r(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function rt(e){let t=e.target;t.removeEventListener(`dispose`,rt),at(t)}function at(e){st(e),U.remove(e)}function st(e){let t=U.get(e).programs;t!==void 0&&(t.forEach(function(e){Ae.releaseProgram(e)}),e.isShaderMaterial&&Ae.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=be);let o=i.isMesh&&i.matrixWorld.determinantAffine()<0,s=Ct(e,t,n,r,i);H.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Oe.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ye.setup(i,r,s,n,c);let h,g=Ve;if(c!==null&&(h=De.get(c),g=Ue,g.setIndex(h)),i.isMesh)r.wireframe===!0?(H.setLineWidth(r.wireframeLinewidth*Se()),g.setMode(B.LINES)):g.setMode(B.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),H.setLineWidth(e*Se()),i.isLineSegments?g.setMode(B.LINES):i.isLineLoop?g.setMode(B.LINE_LOOP):g.setMode(B.LINE_STRIP)}else i.isPoints?g.setMode(B.POINTS):i.isSprite&&g.setMode(B.TRIANGLES);if(i.isBatchedMesh){if(Ce.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?De.get(c).bytesPerElement:1,o=U.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(B,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function ct(e,t,n){e.transparent===!0&&e.side===m&&e.forceSinglePass===!1?(e.side=p,e.needsUpdate=!0,yt(e,t,n),e.side=f,e.needsUpdate=!0,yt(e,t,n),e.side=m):yt(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),T=Ne.get(n),T.init(t),D.push(T),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(T.pushLight(e),e.castShadow&&T.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(T.pushLight(e),e.castShadow&&T.pushShadow(e))}),T.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t){if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];ct(a,n,e),r.add(a)}else ct(t,n,e),r.add(t)}}),T=D.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){U.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}Ce.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let lt=null;function ut(e){lt&&lt(e)}function dt(){pt.stop()}function ft(){pt.start()}let pt=new fm;pt.setAnimationLoop(ut),typeof self<`u`&&pt.setContext(self),this.setAnimationLoop=function(e){lt=e,Qe.setAnimationLoop(e),e===null?pt.stop():pt.start()},Qe.addEventListener(`sessionstart`,dt),Qe.addEventListener(`sessionend`,ft),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){_r(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(A===!0)return;j!==null&&j.renderStart(e,t);let n=Qe.enabled===!0&&Qe.isPresenting===!0,r=O!==null&&(te===null||n)&&O.begin(k,te);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Qe.enabled===!0&&Qe.isPresenting===!0&&(O===null||O.isCompositing()===!1)&&(Qe.cameraAutoUpdate===!0&&Qe.updateCamera(t),t=Qe.getCamera()),e.isScene===!0&&e.onBeforeRender(k,e,t,te),T=Ne.get(e,D.length),T.init(t),T.state.textureUnits=W.getTextureUnits(),D.push(T),ve.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ge.setFromProjectionMatrix(ve,$n,t.reversedDepth),_e=this.localClippingEnabled,R=Pe.init(this.clippingPlanes,_e),w=Me.get(e,E.length),w.init(),E.push(w),Qe.enabled===!0&&Qe.isPresenting===!0){let e=k.xr.getDepthSensingMesh();e!==null&&mt(e,t,-1/0,k.sortObjects)}mt(e,t,0,k.sortObjects),w.finish(),k.sortObjects===!0&&w.sort(ue,de,t.reversedDepth),xe=Qe.enabled===!1||Qe.isPresenting===!1||Qe.hasDepthSensing()===!1,xe&&Re.addToRenderList(w,e),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),R===!0&&Pe.beginShadows();let i=T.state.shadowsArray;if(Ie.render(i,e,t),R===!0&&Pe.endShadows(),(r&&O.hasRenderPass())===!1){let n=w.opaque,r=w.transmissive;if(T.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];gt(n,r,e,a)}xe&&Re.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];ht(w,e,n,n.viewport)}}else r.length>0&&gt(n,r,e,t),xe&&Re.render(e),ht(w,e,t)}te!==null&&ee===0&&(W.updateMultisampleRenderTarget(te),W.updateRenderTargetMipmap(te)),r&&O.end(k),e.isScene===!0&&e.onAfterRender(k,e,t),Ye.resetDefaultState(),ne=-1,re=null,D.pop(),D.length>0?(T=D[D.length-1],W.setTextureUnits(T.state.textureUnits),R===!0&&Pe.setGlobalState(k.clippingPlanes,T.state.camera)):T=null,E.pop(),w=E.length>0?E[E.length-1]:null,j!==null&&j.renderEnd()};function mt(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)T.pushLightProbeGrid(e);else if(e.isLight)T.pushLight(e),e.castShadow&&T.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ge.intersectsSprite(e)){r&&ye.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ve);let t=ke.update(e),i=e.material;i.visible&&w.push(e,t,i,n,ye.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ge.intersectsObject(e))){let t=ke.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ye.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ye.copy(e.boundingSphere.center)),ye.applyMatrix4(e.matrixWorld).applyMatrix4(ve)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&w.push(e,t,s,n,ye.z,o)}}else i.visible&&w.push(e,t,i,n,ye.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)mt(i[e],t,n,r)}function ht(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;T.setupLightsView(n),R===!0&&Pe.setGlobalState(k.clippingPlanes,n),r&&H.viewport(I.copy(r)),i.length>0&&_t(i,t,n),a.length>0&&_t(a,t,n),o.length>0&&_t(o,t,n),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function gt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[r.id]===void 0){let e=Ce.has(`EXT_color_buffer_half_float`)||Ce.has(`EXT_color_buffer_float`);T.state.transmissionRenderTarget[r.id]=new gi(1,1,{generateMipmaps:!0,type:e?We:Le,minFilter:Fe,samples:Math.max(4,we.samples),stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ri.workingColorSpace})}let i=T.state.transmissionRenderTarget[r.id],o=r.viewport||I;i.setSize(o.z*k.transmissionResolutionScale,o.w*k.transmissionResolutionScale);let s=k.getRenderTarget(),c=k.getActiveCubeFace(),l=k.getActiveMipmapLevel();k.setRenderTarget(i),k.getClearColor(oe),se=k.getClearAlpha(),se<1&&k.setClearColor(16777215,.5),k.clear(),xe&&Re.render(n);let u=k.toneMapping;k.toneMapping=he;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),T.setupLightsView(r),R===!0&&Pe.setGlobalState(k.clippingPlanes,r),_t(e,n,r),W.updateMultisampleRenderTarget(i),W.updateRenderTargetMipmap(i),Ce.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===m&&a.layers.test(r.layers)){let t=s.side;s.side=p,s.needsUpdate=!0,vt(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(W.updateMultisampleRenderTarget(i),W.updateRenderTargetMipmap(i))}k.setRenderTarget(s,c,l),k.setClearColor(oe,se),d!==void 0&&(r.viewport=d),k.toneMapping=u}function _t(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&vt(o,t,n,s,l,c)}}function vt(e,t,n,r,i,a){e.onBeforeRender(k,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(k,t,n,r,e,a),i.transparent===!0&&i.side===m&&i.forceSinglePass===!1?(i.side=p,i.needsUpdate=!0,k.renderBufferDirect(n,t,r,i,e,a),i.side=f,i.needsUpdate=!0,k.renderBufferDirect(n,t,r,i,e,a),i.side=m):k.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(k,t,n,r,i,a)}function yt(e,t,n){t.isScene!==!0&&(t=be);let r=U.get(e),i=T.state.lights,a=T.state.shadowsArray,o=i.state.version,s=Ae.getParameters(e,i.state,a,t,n,T.state.lightProbeGridArray),c=Ae.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=Ee.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,rt),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return xt(e,s),d}else s.uniforms=Ae.getUniforms(e),j!==null&&e.isNodeMaterial&&j.build(e,n,s),e.onBeforeCompile(s,k),d=Ae.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=Pe.uniform),xt(e,s),r.needsLights=Tt(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.lightProbeGrid=T.state.lightProbeGridArray.length>0,r.currentProgram=d,r.uniformsList=null,d}function bt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=og.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function xt(e,t){let n=U.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function St(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];C.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.texture!==null&&n.boundingBox.containsPoint(C))return n}return null}function Ct(e,t,n,r,i){t.isScene!==!0&&(t=be),W.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ri.workingColorSpace,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=Ee.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=he;r.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(h=k.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=U.get(r),y=T.state.lights;if(R===!0&&(_e===!0||e!==re)){let t=e===re&&r.id===ne;Pe.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Pe.numPlanes||v.numIntersection!==Pe.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=T.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let x=v.currentProgram;b===!0&&(x=yt(r,t,i),j&&r.isNodeMaterial&&j.onUpdateProgram(r,x,v));let S=!1,C=!1,w=!1,E=x.getUniforms(),D=v.uniforms;if(H.useProgram(x.program)&&(S=!0,C=!0,w=!0),r.id!==ne&&(ne=r.id,C=!0),v.needsLights){let e=St(T.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,C=!0)}if(S||re!==e){H.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),E.setValue(B,`projectionMatrix`,e.projectionMatrix),E.setValue(B,`viewMatrix`,e.matrixWorldInverse);let t=E.map.cameraPosition;t!==void 0&&t.setValue(B,z.setFromMatrixPosition(e.matrixWorld)),we.logarithmicDepthBuffer&&E.setValue(B,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&E.setValue(B,`isOrthographic`,e.isOrthographicCamera===!0),re!==e&&(re=e,C=!0,w=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&E.setValue(B,`directionalShadowMap`,y.state.directionalShadowMap,W),y.state.spotShadowMap.length>0&&E.setValue(B,`spotShadowMap`,y.state.spotShadowMap,W),y.state.pointShadowMap.length>0&&E.setValue(B,`pointShadowMap`,y.state.pointShadowMap,W)),i.isSkinnedMesh){E.setOptional(B,i,`bindMatrix`),E.setOptional(B,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),E.setValue(B,`boneTexture`,e.boneTexture,W))}i.isBatchedMesh&&(E.setOptional(B,i,`batchingTexture`),E.setValue(B,`batchingTexture`,i._matricesTexture,W),E.setOptional(B,i,`batchingIdTexture`),E.setValue(B,`batchingIdTexture`,i._indirectTexture,W),E.setOptional(B,i,`batchingColorTexture`),i._colorsTexture!==null&&E.setValue(B,`batchingColorTexture`,i._colorsTexture,W));let O=n.morphAttributes;if((O.position!==void 0||O.normal!==void 0||O.color!==void 0)&&ze.update(i,n,x),(C||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,E.setValue(B,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(D.envMapIntensity.value=t.environmentIntensity),D.dfgLUT!==void 0&&(D.dfgLUT.value=D_()),C){if(E.setValue(B,`toneMappingExposure`,k.toneMappingExposure),v.needsLights&&wt(D,w),a&&r.fog===!0&&je.refreshFogUniforms(D,a),je.refreshMaterialUniforms(D,r,le,ce,T.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;D.probesSH.value=e.texture,D.probesMin.value.copy(e.boundingBox.min),D.probesMax.value.copy(e.boundingBox.max),D.probesResolution.value.copy(e.resolution)}og.upload(B,bt(v),D,W)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(og.upload(B,bt(v),D,W),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&E.setValue(B,`center`,i.center),E.setValue(B,`modelViewMatrix`,i.modelViewMatrix),E.setValue(B,`normalMatrix`,i.normalMatrix),E.setValue(B,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Xe.update(n,x),Xe.bind(n,x)}}return x}function wt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Tt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(e,t,n){let r=U.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),U.get(e.texture).__webglTexture=t,U.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=U.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0},this.setRenderTarget=function(e,t=0,n=0){te=e,F=t,ee=n;let r=null,i=!1,a=!1;if(e){let o=U.get(e);if(o.__useDefaultFramebuffer!==void 0){H.bindFramebuffer(B.FRAMEBUFFER,o.__webglFramebuffer),I.copy(e.viewport),ie.copy(e.scissor),ae=e.scissorTest,H.viewport(I),H.scissor(ie),H.setScissorTest(ae),ne=-1;return}if(o.__webglFramebuffer===void 0)W.setupRenderTarget(e);else if(o.__hasExternalTextures)W.rebindTextures(e,U.get(e.texture).__webglTexture,U.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&U.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.`);W.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=U.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&W.useMultisampledRTT(e)===!1?U.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,I.copy(e.viewport),ie.copy(e.scissor),ae=e.scissorTest}else I.copy(fe).multiplyScalar(le).floor(),ie.copy(pe).multiplyScalar(le).floor(),ae=me;if(n!==0&&(r=M),H.bindFramebuffer(B.FRAMEBUFFER,r)&&H.drawBuffers(e,r),H.viewport(I),H.scissor(ie),H.setScissorTest(ae),i){let r=U.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=U.get(e.textures[t]);B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=U.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,t.__webglTexture,n)}ne=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){H.bindFramebuffer(B.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),!we.textureFormatReadable(c)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!we.textureTypeReadable(l)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&B.readPixels(t,n,r,i,Je.convert(c),Je.convert(l),a)}finally{let e=te===null?null:U.get(te).__webglFramebuffer;H.bindFramebuffer(B.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){H.bindFramebuffer(B.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),!we.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!we.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.bufferData(B.PIXEL_PACK_BUFFER,a.byteLength,B.STREAM_READ),B.readPixels(t,n,r,i,Je.convert(l),Je.convert(u),0);let f=te===null?null:U.get(te).__webglFramebuffer;H.bindFramebuffer(B.FRAMEBUFFER,f);let p=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await yr(B,p,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,a),B.deleteBuffer(d),B.deleteSync(p),a}throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)}},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;W.setTexture2D(e,0),B.copyTexSubImage2D(B.TEXTURE_2D,n,0,0,o,s,i,a),H.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Je.convert(t.format),_=Je.convert(t.type),v;t.isData3DTexture?(W.setTexture3D(t,0),v=B.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(W.setTexture2DArray(t,0),v=B.TEXTURE_2D_ARRAY):(W.setTexture2D(t,0),v=B.TEXTURE_2D),H.activeTexture(B.TEXTURE0),H.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,t.flipY),H.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),H.pixelStorei(B.UNPACK_ALIGNMENT,t.unpackAlignment);let y=H.getParameter(B.UNPACK_ROW_LENGTH),b=H.getParameter(B.UNPACK_IMAGE_HEIGHT),x=H.getParameter(B.UNPACK_SKIP_PIXELS),S=H.getParameter(B.UNPACK_SKIP_ROWS),C=H.getParameter(B.UNPACK_SKIP_IMAGES);H.pixelStorei(B.UNPACK_ROW_LENGTH,h.width),H.pixelStorei(B.UNPACK_IMAGE_HEIGHT,h.height),H.pixelStorei(B.UNPACK_SKIP_PIXELS,l),H.pixelStorei(B.UNPACK_SKIP_ROWS,u),H.pixelStorei(B.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=U.get(e),r=U.get(t),h=U.get(n.__renderTarget),g=U.get(r.__renderTarget);H.bindFramebuffer(B.READ_FRAMEBUFFER,h.__webglFramebuffer),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,U.get(e).__webglTexture,i,d+n),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,U.get(t).__webglTexture,a,m+n)),B.blitFramebuffer(l,u,o,s,f,p,o,s,B.DEPTH_BUFFER_BIT,B.NEAREST);H.bindFramebuffer(B.READ_FRAMEBUFFER,null),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||U.has(e)){let n=U.get(e),r=U.get(t);H.bindFramebuffer(B.READ_FRAMEBUFFER,N),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,P);for(let e=0;e<c;e++)w?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,n.__webglTexture,i),T?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,r.__webglTexture,a),i===0?T?B.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):B.copyTexSubImage2D(v,a,f,p,l,u,o,s):B.blitFramebuffer(l,u,o,s,f,p,o,s,B.COLOR_BUFFER_BIT,B.NEAREST);H.bindFramebuffer(B.READ_FRAMEBUFFER,null),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?B.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h);H.pixelStorei(B.UNPACK_ROW_LENGTH,y),H.pixelStorei(B.UNPACK_IMAGE_HEIGHT,b),H.pixelStorei(B.UNPACK_SKIP_PIXELS,x),H.pixelStorei(B.UNPACK_SKIP_ROWS,S),H.pixelStorei(B.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&B.generateMipmap(v),H.unbindTexture()},this.initRenderTarget=function(e){U.get(e).__webglFramebuffer===void 0&&W.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?W.setTextureCube(e,0):e.isData3DTexture?W.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?W.setTexture2DArray(e,0):W.setTexture2D(e,0),H.unbindTexture()},this.resetState=function(){F=0,ee=0,te=null,H.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return $n}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ri._getDrawingBufferColorSpace(e),t.unpackColorSpace=ri._getUnpackColorSpace()}};e.ACESFilmicToneMapping=ve,e.AddEquation=S,e.AddOperation=me,e.AdditiveAnimationBlendMode=en,e.AdditiveBlending=_,e.AgXToneMapping=ye,e.AlphaFormat=Xe,e.AlwaysCompare=Vn,e.AlwaysDepth=oe,e.AlwaysStencilFunc=Pn,e.AmbientLight=Zd,e.AnimationAction=ep,e.AnimationClip=fd,e.AnimationLoader=Cd,e.AnimationMixer=np,e.AnimationObjectGroup=$f,e.AnimationUtils=Qu,e.ArcCurve=Yc,e.ArrayCamera=wf,e.ArrowHelper=nm,e.AttachedBindMode=xe,e.Audio=Nf,e.AudioAnalyser=zf,e.AudioContext=hf,e.AudioListener=Mf,e.AudioLoader=gf,e.AxesHelper=rm,e.BackSide=p,e.BasicDepthPacking=an,e.BasicShadowMap=c,e.BatchedMesh=nc,e.BezierInterpolant=rd,e.Bone=ms,e.BooleanKeyframeTrack=ad,e.Box2=vp,e.Box3=ba,e.Box3Helper=Zp,e.BoxGeometry=Fc,e.BoxHelper=Xp,e.BufferAttribute=Ua,e.BufferGeometry=lo,e.BufferGeometryLoader=of,e.ByteType=Re,e.Cache=hd,e.Camera=zd,e.CameraHelper=qp,e.CanvasTexture=Ac,e.CapsuleGeometry=Ic,e.CatmullRomCurve3=nl,e.CineonToneMapping=_e,e.CircleGeometry=Lc,e.ClampToEdgeWrapping=W,e.Clock=pp,e.Color=Y,e.ColorKeyframeTrack=od,e.ColorManagement=ri,e.Compatibility=ir,e.CompressedArrayTexture=Dc,e.CompressedCubeTexture=Oc,e.CompressedTexture=Ec,e.CompressedTextureLoader=wd,e.ConeGeometry=zc,e.ConstantAlphaFactor=I,e.ConstantColorFactor=ne,e.Controls=am,e.CubeCamera=Cf,e.CubeDepthTexture=Nc,e.CubeReflectionMapping=V,e.CubeRefractionMapping=Ce,e.CubeTexture=kc,e.CubeTextureLoader=Dd,e.CubeUVReflectionMapping=Te,e.CubicBezierCurve=pl,e.CubicBezierCurve3=ml,e.CubicInterpolant=ed,e.CullFaceBack=a,e.CullFaceFront=o,e.CullFaceFrontBack=s,e.CullFaceNone=i,e.Curve=qc,e.CurvePath=xl,e.CustomBlending=b,e.CustomToneMapping=z,e.CylinderGeometry=Rc,e.Cylindrical=hp,e.Data3DTexture=yi,e.DataArrayTexture=_i,e.DataTexture=hs,e.DataTextureLoader=Od,e.DataUtils=za,e.DecrementStencilOp=Cn,e.DecrementWrapStencilOp=Tn,e.DefaultLoadingManager=vd,e.DepthFormat=$e,e.DepthStencilFormat=et,e.DepthTexture=Mc,e.DetachedBindMode=Se,e.DirectionalLight=Xd,e.DirectionalLightHelper=Wp,e.DiscreteInterpolant=nd,e.DodecahedronGeometry=Vc,e.DoubleSide=m,e.DstAlphaFactor=N,e.DstColorFactor=F,e.DynamicCopyUsage=Yn,e.DynamicDrawUsage=Un,e.DynamicReadUsage=Kn,e.EdgesGeometry=Kc,e.EllipseCurve=Jc,e.EqualCompare=Ln,e.EqualDepth=ce,e.EqualStencilFunc=kn,e.EquirectangularReflectionMapping=we,e.EquirectangularRefractionMapping=H,e.Euler=ji,e.EventDispatcher=xr,e.ExternalTexture=Pc,e.ExtrudeGeometry=su,e.FileLoader=Sd,e.Float16BufferAttribute=Za,e.Float32BufferAttribute=X,e.FloatType=Ue,e.Fog=ia,e.FogExp2=ra,e.FramebufferTexture=Tc,e.FrontSide=f,e.Frustum=Fs,e.FrustumArray=Ls,e.GLBufferAttribute=cp,e.GLSL1=Zn,e.GLSL3=Qn,e.GreaterCompare=zn,e.GreaterDepth=ue,e.GreaterEqualCompare=G,e.GreaterEqualDepth=le,e.GreaterEqualStencilFunc=Nn,e.GreaterStencilFunc=jn,e.GridHelper=zp,e.Group=Yi,e.HTMLTexture=jc,e.HalfFloatType=We,e.HemisphereLight=jd,e.HemisphereLightHelper=Rp,e.IcosahedronGeometry=uu,e.ImageBitmapLoader=pf,e.ImageLoader=Ed,e.ImageUtils=si,e.IncrementStencilOp=Sn,e.IncrementWrapStencilOp=wn,e.InstancedBufferAttribute=ys,e.InstancedBufferGeometry=af,e.InstancedInterleavedBuffer=sp,e.InstancedMesh=Ds,e.Int16BufferAttribute=qa,e.Int32BufferAttribute=Ya,e.Int8BufferAttribute=Wa,e.IntType=Ve,e.InterleavedBuffer=uo,e.InterleavedBufferAttribute=po,e.Interpolant=$u,e.InterpolateBezier=Yt,e.InterpolateDiscrete=Kt,e.InterpolateLinear=qt,e.InterpolateSmooth=Jt,e.InterpolationSamplingMode=rr,e.InterpolationSamplingType=nr,e.InvertStencilOp=En,e.KeepStencilOp=bn,e.KeyframeTrack=id,e.LOD=Po,e.LatheGeometry=du,e.Layers=Mi,e.LessCompare=In,e.LessDepth=se,e.LessEqualCompare=Rn,e.LessEqualDepth=L,e.LessEqualStencilFunc=An,e.LessStencilFunc=On,e.Light=Ad,e.LightProbe=ef,e.Line=uc,e.Line3=Ep,e.LineBasicMaterial=rc,e.LineCurve=hl,e.LineCurve3=gl,e.LineDashedMaterial=Gu,e.LineLoop=hc,e.LineSegments=mc,e.LinearFilter=Me,e.LinearInterpolant=td,e.LinearMipMapLinearFilter=Ie,e.LinearMipMapNearestFilter=Pe,e.LinearMipmapLinearFilter=Fe,e.LinearMipmapNearestFilter=Ne,e.LinearSRGBColorSpace=pn,e.LinearToneMapping=ge,e.LinearTransfer=mn,e.Loader=yd,e.LoaderUtils=rf,e.LoadingManager=_d,e.LoopOnce=Ut,e.LoopPingPong=Gt,e.LoopRepeat=Wt,e.MOUSE=n,e.Material=ho,e.MaterialBlending=x,e.MaterialLoader=nf,e.MathUtils=Jr,e.Matrix2=gp,e.Matrix3=Qr,e.Matrix4=xi,e.MaxEquation=E,e.Mesh=ts,e.MeshBasicMaterial=Uo,e.MeshDepthMaterial=Hu,e.MeshDistanceMaterial=Uu,e.MeshLambertMaterial=Vu,e.MeshMatcapMaterial=Wu,e.MeshNormalMaterial=Bu,e.MeshPhongMaterial=Ru,e.MeshPhysicalMaterial=Lu,e.MeshStandardMaterial=Iu,e.MeshToonMaterial=zu,e.MinEquation=T,e.MirroredRepeatWrapping=Ee,e.MixOperation=pe,e.MultiplyBlending=y,e.MultiplyOperation=fe,e.NearestFilter=De,e.NearestMipMapLinearFilter=je,e.NearestMipMapNearestFilter=ke,e.NearestMipmapLinearFilter=Ae,e.NearestMipmapNearestFilter=Oe,e.NeutralToneMapping=be,e.NeverCompare=Fn,e.NeverDepth=ae,e.NeverStencilFunc=Dn,e.NoBlending=h,e.NoColorSpace=dn,e.NoNormalPacking=gn,e.NoToneMapping=he,e.NormalAnimationBlendMode=$t,e.NormalBlending=g,e.NormalGAPacking=vn,e.NormalRGPacking=_n,e.NotEqualCompare=Bn,e.NotEqualDepth=de,e.NotEqualStencilFunc=Mn,e.NumberKeyframeTrack=sd,e.Object3D=Ji,e.ObjectLoader=cf,e.ObjectSpaceNormalMap=un,e.OctahedronGeometry=fu,e.OneFactor=O,e.OneMinusConstantAlphaFactor=ie,e.OneMinusConstantColorFactor=re,e.OneMinusDstAlphaFactor=P,e.OneMinusDstColorFactor=ee,e.OneMinusSrcAlphaFactor=M,e.OneMinusSrcColorFactor=A,e.OrthographicCamera=Jd,e.PCFShadowMap=l,e.PCFSoftShadowMap=u,e.PMREMGenerator=Fm,e.Path=Sl,e.PerspectiveCamera=Ud,e.Plane=js,e.PlaneGeometry=pu,e.PlaneHelper=Qp,e.PointLight=qd,e.PointLightHelper=Pp,e.Points=xc,e.PointsMaterial=gc,e.PolarGridHelper=Bp,e.PolyhedronGeometry=Bc,e.PositionalAudio=Rf,e.PropertyBinding=Qf,e.PropertyMixer=Bf,e.QuadraticBezierCurve=_l,e.QuadraticBezierCurve3=vl,e.Quaternion=Yr,e.QuaternionKeyframeTrack=ld,e.QuaternionLinearInterpolant=cd,e.R11_EAC_Format=vt,e.RED_GREEN_RGTC2_Format=Vt,e.RED_RGTC1_Format=zt,e.REVISION=t,e.RG11_EAC_Format=bt,e.RGBADepthPacking=on,e.RGBAFormat=Qe,e.RGBAIntegerFormat=ot,e.RGBA_ASTC_10x10_Format=Nt,e.RGBA_ASTC_10x5_Format=At,e.RGBA_ASTC_10x6_Format=jt,e.RGBA_ASTC_10x8_Format=Mt,e.RGBA_ASTC_12x10_Format=Pt,e.RGBA_ASTC_12x12_Format=Ft,e.RGBA_ASTC_4x4_Format=St,e.RGBA_ASTC_5x4_Format=Ct,e.RGBA_ASTC_5x5_Format=wt,e.RGBA_ASTC_6x5_Format=Tt,e.RGBA_ASTC_6x6_Format=Et,e.RGBA_ASTC_8x5_Format=Dt,e.RGBA_ASTC_8x6_Format=Ot,e.RGBA_ASTC_8x8_Format=kt,e.RGBA_BPTC_Format=It,e.RGBA_ETC2_EAC_Format=_t,e.RGBA_PVRTC_2BPPV1_Format=mt,e.RGBA_PVRTC_4BPPV1_Format=pt,e.RGBA_S3TC_DXT1_Format=ct,e.RGBA_S3TC_DXT3_Format=lt,e.RGBA_S3TC_DXT5_Format=ut,e.RGBDepthPacking=sn,e.RGBFormat=Ze,e.RGBIntegerFormat=at,e.RGB_BPTC_SIGNED_Format=Lt,e.RGB_BPTC_UNSIGNED_Format=Rt,e.RGB_ETC1_Format=ht,e.RGB_ETC2_Format=gt,e.RGB_PVRTC_2BPPV1_Format=ft,e.RGB_PVRTC_4BPPV1_Format=dt,e.RGB_S3TC_DXT1_Format=st,e.RGDepthPacking=cn,e.RGFormat=rt,e.RGIntegerFormat=it,e.RawShaderMaterial=Fu,e.Ray=Ho,e.Raycaster=up,e.RectAreaLight=Qd,e.RedFormat=tt,e.RedIntegerFormat=nt,e.ReinhardToneMapping=R,e.RenderTarget=hi,e.RenderTarget3D=rp,e.RepeatWrapping=U,e.ReplaceStencilOp=xn,e.ReverseSubtractEquation=w,e.RingGeometry=mu,e.SIGNED_R11_EAC_Format=yt,e.SIGNED_RED_GREEN_RGTC2_Format=Ht,e.SIGNED_RED_RGTC1_Format=Bt,e.SIGNED_RG11_EAC_Format=xt,e.SRGBColorSpace=fn,e.SRGBTransfer=hn,e.Scene=aa,e.ShaderChunk=mm,e.ShaderLib=hm,e.ShaderMaterial=Pu,e.ShadowMaterial=Tu,e.Shape=Cl,e.ShapeGeometry=hu,e.ShapePath=im,e.ShapeUtils=iu,e.ShortType=ze,e.Skeleton=vs,e.SkeletonHelper=Mp,e.SkinnedMesh=ps,e.Source=li,e.Sphere=to,e.SphereGeometry=_u,e.Spherical=mp,e.SphericalHarmonics3=$d,e.SplineCurve=yl,e.SpotLight=Gd,e.SpotLightHelper=Op,e.Sprite=Ao,e.SpriteMaterial=go,e.SrcAlphaFactor=j,e.SrcAlphaSaturateFactor=te,e.SrcColorFactor=k,e.StaticCopyUsage=Jn,e.StaticDrawUsage=Hn,e.StaticReadUsage=Gn,e.StereoCamera=bf,e.StreamCopyUsage=Xn,e.StreamDrawUsage=Wn,e.StreamReadUsage=qn,e.StringKeyframeTrack=ud,e.SubtractEquation=C,e.SubtractiveBlending=v,e.TOUCH=r,e.TangentSpaceNormalMap=ln,e.TetrahedronGeometry=vu,e.Texture=pi,e.TextureLoader=kd,e.TextureUtils=dm,e.Timer=Tf,e.TimestampQuery=tr,e.TorusGeometry=yu,e.TorusKnotGeometry=bu,e.Triangle=ya,e.TriangleFanDrawMode=rn,e.TriangleStripDrawMode=nn,e.TrianglesDrawMode=tn,e.TubeGeometry=xu,e.UVMapping=B,e.Uint16BufferAttribute=Ja,e.Uint32BufferAttribute=Xa,e.Uint8BufferAttribute=Ga,e.Uint8ClampedBufferAttribute=Ka,e.Uniform=ip,e.UniformsGroup=op,e.UniformsLib=Q,e.UniformsUtils=ju,e.UnsignedByteType=Le,e.UnsignedInt101111Type=Ye,e.UnsignedInt248Type=qe,e.UnsignedInt5999Type=Je,e.UnsignedIntType=He,e.UnsignedShort4444Type=Ge,e.UnsignedShort5551Type=Ke,e.UnsignedShortType=Be,e.VSMShadowMap=d,e.Vector2=q,e.Vector3=J,e.Vector4=mi,e.VectorKeyframeTrack=dd,e.VideoFrameTexture=wc,e.VideoTexture=Cc,e.WebGL3DRenderTarget=bi,e.WebGLArrayRenderTarget=vi,e.WebGLCoordinateSystem=$n,e.WebGLCubeRenderTarget=Wm,e.WebGLRenderTarget=gi,e.WebGLRenderer=O_,e.WebGLUtils=g_,e.WebGPUCoordinateSystem=er,e.WebXRController=Zi,e.WireframeGeometry=Su,e.WrapAroundEnding=Qt,e.ZeroCurvatureEnding=Xt,e.ZeroFactor=D,e.ZeroSlopeEnding=Zt,e.ZeroStencilOp=yn,e.createCanvasElement=ur,e.error=_r,e.getConsoleFunction=mr,e.log=hr,e.setConsoleFunction=pr,e.warn=K,e.warnOnce=vr}));function uv(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function dv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fv(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function pv(...e){let t=`THREE.`+e.shift();Py?Py(`log`,t,...e):console.log(t,...e)}function mv(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function hv(...e){e=mv(e);let t=`THREE.`+e.shift();if(Py)Py(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function gv(...e){e=mv(e);let t=`THREE.`+e.shift();if(Py)Py(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function _v(...e){let t=e.join(` `);t in Ny||(Ny[t]=!0,hv(...e))}function vv(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Iy[e&255]+Iy[e>>8&255]+Iy[e>>16&255]+Iy[e>>24&255]+`-`+Iy[t&255]+Iy[t>>8&255]+`-`+Iy[t>>16&15|64]+Iy[t>>24&255]+`-`+Iy[n&63|128]+Iy[n>>8&255]+`-`+Iy[n>>16&255]+Iy[n>>24&255]+Iy[r&255]+Iy[r>>8&255]+Iy[r>>16&255]+Iy[r>>24&255]).toLowerCase()}function yv(e,t,n){return Math.max(t,Math.min(n,e))}function bv(e,t){return(e%t+t)%t}function xv(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Sv(e,t,n){return e===t?0:(n-e)/(t-e)}function Cv(e,t,n){return(1-n)*e+n*t}function wv(e,t,n,r){return Cv(e,t,1-Math.exp(-n*r))}function Tv(e,t=1){return t-Math.abs(bv(e,t*2)-t)}function Ev(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Dv(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Ov(e,t){return e+Math.floor(Math.random()*(t-e+1))}function kv(e,t){return e+Math.random()*(t-e)}function Av(e){return e*(.5-Math.random())}function jv(e){e!==void 0&&(Ly=e);let t=Ly+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Mv(e){return e*Ry}function Nv(e){return e*zy}function Pv(e){return!(e&e-1)&&e!==0}function Fv(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Iv(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Lv(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:hv(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Rv(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function zv(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function Bv(){let e={enabled:!0,workingColorSpace:Dy,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=Vv(e.r),e.g=Vv(e.g),e.b=Vv(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Hv(e.r),e.g=Hv(e.g),e.b=Hv(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Oy:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return _v(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return _v(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Dy]:{primaries:t,whitePoint:r,transfer:Oy,toXYZ:qy,fromXYZ:Jy,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ey},outputColorSpaceConfig:{drawingBufferColorSpace:Ey}},[Ey]:{primaries:t,whitePoint:r,transfer:ky,toXYZ:qy,fromXYZ:Jy,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ey}}}),e}function Vv(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Hv(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function Uv(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Zy.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(hv(`Texture: Unable to serialize Texture.`),{})}function Wv(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function Gv(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){dx.fromArray(e,a);let o=i.x*Math.abs(dx.x)+i.y*Math.abs(dx.y)+i.z*Math.abs(dx.z),s=t.dot(dx),c=n.dot(dx),l=r.dot(dx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function Kv(e,t,n,r,i,a){Vx.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Hx.copy(Vx):(Hx.x=a*Vx.x-i*Vx.y,Hx.y=i*Vx.x+a*Vx.y),e.copy(t),e.x+=Hx.x,e.y+=Hx.y,e.applyMatrix4(Ux)}function qv(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;gS.copy(s),gS.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(gS);return l<n.near||l>n.far?null:{distance:l,point:gS.clone(),object:e}}function Jv(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,uS),e.getVertexPosition(c,dS),e.getVertexPosition(l,fS);let u=qv(e,t,n,r,uS,dS,fS,hS);if(u){let e=new $;Zb.getBarycoord(hS,uS,dS,fS,e),i&&(u.uv=Zb.getInterpolatedAttribute(i,s,c,l,e,new Vy)),a&&(u.uv1=Zb.getInterpolatedAttribute(a,s,c,l,e,new Vy)),o&&(u.normal=Zb.getInterpolatedAttribute(o,s,c,l,e,new $),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new $,materialIndex:0};Zb.getNormal(uS,dS,fS,t.normal),u.face=t,u.barycoord=e}return u}function Yv(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(ZS.fromBufferAttribute(s,i),QS.fromBufferAttribute(s,a),n.distanceSqToSegment(ZS,QS,nC,rC)>r)return;nC.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(nC);if(!(c<t.near||c>t.far))return{distance:c,point:rC.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}function Xv(e,t,n,r,i,a,o){let s=dC.distanceSqToPoint(e);if(s<n){let n=new $;dC.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}function Zv(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function Qv(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function $v(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function ey(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0){if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}}function ty(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return TC;case`vector`:case`vector2`:case`vector3`:case`vector4`:return kC;case`color`:return wC;case`quaternion`:return DC;case`bool`:case`boolean`:return CC;case`string`:return OC}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function ny(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let t=ty(e.type);if(e.times===void 0){let t=[],n=[];ey(e.keys,t,n,`value`),e.times=t,e.values=n}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function ry(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}var iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy,By,Vy,Hy,$,Uy,Wy,Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb,ub,db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw=p((()=>{iy=`attached`,ay=1e3,oy=1001,sy=1002,cy=1003,ly=1004,uy=1005,dy=1006,fy=1007,py=1008,my=1009,hy=1015,gy=1023,_y=1028,vy=2300,yy=2301,by=2302,xy=2303,Sy=2400,Cy=2401,wy=2402,Ty=2500,Ey=`srgb`,Dy=`srgb-linear`,Oy=`linear`,ky=`srgb`,Ay=7680,jy=35044,My=2e3,Ny={},Py=null,Fy=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Iy=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),Ly=1234567,Ry=Math.PI/180,zy=180/Math.PI,By={DEG2RAD:Ry,RAD2DEG:zy,generateUUID:vv,clamp:yv,euclideanModulo:bv,mapLinear:xv,inverseLerp:Sv,lerp:Cv,damp:wv,pingpong:Tv,smoothstep:Ev,smootherstep:Dv,randInt:Ov,randFloat:kv,randFloatSpread:Av,seededRandom:jv,degToRad:Mv,radToDeg:Nv,isPowerOfTwo:Pv,ceilPowerOfTwo:Fv,floorPowerOfTwo:Iv,setQuaternionFromProperEuler:Lv,normalize:zv,denormalize:Rv},Vy=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(yv(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Hy=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:hv(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yv(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},$=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Wy.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wy.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this.z=yv(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this.z=yv(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Uy.copy(this).projectOnVector(e),this.sub(Uy)}reflect(e){return this.sub(Uy.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(yv(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Uy=new $,Wy=new Hy,Gy=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return _v(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Ky.makeScale(e,t)),this}rotate(e){return _v(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Ky.makeRotation(-e)),this}translate(e,t){return _v(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Ky.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Ky=new Gy,qy=new Gy().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Jy=new Gy().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Yy=Bv(),Zy=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xy===void 0&&(Xy=fv(`canvas`)),Xy.width=e.width,Xy.height=e.height;let t=Xy.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Xy}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=fv(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Vv(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Vv(t[e]/255)*255):t[e]=Vv(t[e]);return{data:t,width:e.width,height:e.height}}return hv(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Qy=0,$y=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Qy++}),this.uuid=vv(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Uv(r[t].image)):e.push(Uv(r[t]))}else e=Uv(r);n.url=e}return t||(e.images[this.uuid]=n),n}},eb=0,tb=new $,nb=class e extends Fy{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=oy,i=oy,a=dy,o=py,s=gy,c=my,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eb++}),this.uuid=vv(),this.name=``,this.source=new $y(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new Vy(0,0),this.repeat=new Vy(1,1),this.center=new Vy(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gy,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(tb).x}get height(){return this.source.getSize(tb).y}get depth(){return this.source.getSize(tb).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){hv(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){hv(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ay:e.x-=Math.floor(e.x);break;case oy:e.x=e.x<0?0:1;break;case sy:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ay:e.y-=Math.floor(e.y);break;case oy:e.y=e.y<0?0:1;break;case sy:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},nb.DEFAULT_IMAGE=null,nb.DEFAULT_MAPPING=300,nb.DEFAULT_ANISOTROPY=1,rb=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this.z=yv(this.z,e.z,t.z),this.w=yv(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this.z=yv(this.z,e,t),this.w=yv(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},ib=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/ab.setFromMatrixColumn(e,0).length(),i=1/ab.setFromMatrixColumn(e,1).length(),a=1/ab.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sb,e,cb)}lookAt(e,t,n){let r=this.elements;return db.subVectors(e,t),db.lengthSq()===0&&(db.z=1),db.normalize(),lb.crossVectors(n,db),lb.lengthSq()===0&&(Math.abs(n.z)===1?db.x+=1e-4:db.z+=1e-4,db.normalize(),lb.crossVectors(n,db)),lb.normalize(),ub.crossVectors(db,lb),r[0]=lb.x,r[4]=ub.x,r[8]=db.x,r[1]=lb.y,r[5]=ub.y,r[9]=db.y,r[2]=lb.z,r[6]=ub.z,r[10]=db.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=ab.set(r[0],r[1],r[2]).length(),o=ab.set(r[4],r[5],r[6]).length(),s=ab.set(r[8],r[9],r[10]).length();i<0&&(a=-a),ob.copy(this);let c=1/a,l=1/o,u=1/s;return ob.elements[0]*=c,ob.elements[1]*=c,ob.elements[2]*=c,ob.elements[4]*=l,ob.elements[5]*=l,ob.elements[6]*=l,ob.elements[8]*=u,ob.elements[9]*=u,ob.elements[10]*=u,t.setFromRotationMatrix(ob),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=My,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=My,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},ab=new $,ob=new ib,sb=new $(0,0,0),cb=new $(1,1,1),lb=new $,ub=new $,db=new $,fb=new ib,pb=new Hy,mb=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(yv(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-yv(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(yv(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-yv(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(yv(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-yv(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:hv(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fb,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pb.setFromEuler(this),this.setFromQuaternion(pb,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},mb.DEFAULT_ORDER=`XYZ`,hb=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&(1<<e|0))}},gb=0,_b=new $,vb=new Hy,yb=new ib,bb=new $,xb=new $,Sb=new $,Cb=new Hy,wb=new $(1,0,0),Tb=new $(0,1,0),Eb=new $(0,0,1),Db={type:`added`},Ob={type:`removed`},kb={type:`childadded`,child:null},Ab={type:`childremoved`,child:null},jb=class e extends Fy{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gb++}),this.uuid=vv(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new $,n=new mb,r=new Hy,i=new $(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ib},normalMatrix:{value:new Gy}}),this.matrix=new ib,this.matrixWorld=new ib,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hb,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return vb.setFromAxisAngle(e,t),this.quaternion.multiply(vb),this}rotateOnWorldAxis(e,t){return vb.setFromAxisAngle(e,t),this.quaternion.premultiply(vb),this}rotateX(e){return this.rotateOnAxis(wb,e)}rotateY(e){return this.rotateOnAxis(Tb,e)}rotateZ(e){return this.rotateOnAxis(Eb,e)}translateOnAxis(e,t){return _b.copy(e).applyQuaternion(this.quaternion),this.position.add(_b.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wb,e)}translateY(e){return this.translateOnAxis(Tb,e)}translateZ(e){return this.translateOnAxis(Eb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(yb.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?bb.copy(e):bb.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),xb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yb.lookAt(xb,bb,this.up):yb.lookAt(bb,xb,this.up),this.quaternion.setFromRotationMatrix(yb),r&&(yb.extractRotation(r.matrixWorld),vb.setFromRotationMatrix(yb),this.quaternion.premultiply(vb.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(gv(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Db),kb.child=e,this.dispatchEvent(kb),kb.child=null):gv(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ob),Ab.child=e,this.dispatchEvent(Ab),Ab.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),yb.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),yb.multiply(e.parent.matrixWorld)),e.applyMatrix4(yb),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Db),kb.child=e,this.dispatchEvent(kb),kb.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xb,e,Sb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xb,Cb,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}},jb.DEFAULT_UP=new $(0,1,0),jb.DEFAULT_MATRIX_AUTO_UPDATE=!0,jb.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Mb=class extends jb{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Nb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pb={h:0,s:0,l:0},Fb={h:0,s:0,l:0},Ib=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ey){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yy.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Yy.workingColorSpace){return this.r=e,this.g=t,this.b=n,Yy.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Yy.workingColorSpace){if(e=bv(e,1),t=yv(t,0,1),n=yv(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Wv(i,r,e+1/3),this.g=Wv(i,r,e),this.b=Wv(i,r,e-1/3)}return Yy.colorSpaceToWorking(this,r),this}setStyle(e,t=Ey){function n(t){t!==void 0&&parseFloat(t)<1&&hv(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:hv(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);hv(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ey){let n=Nb[e.toLowerCase()];return n===void 0?hv(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Vv(e.r),this.g=Vv(e.g),this.b=Vv(e.b),this}copyLinearToSRGB(e){return this.r=Hv(e.r),this.g=Hv(e.g),this.b=Hv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ey){return Yy.workingToColorSpace(Lb.copy(this),e),Math.round(yv(Lb.r*255,0,255))*65536+Math.round(yv(Lb.g*255,0,255))*256+Math.round(yv(Lb.b*255,0,255))}getHexString(e=Ey){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yy.workingColorSpace){Yy.workingToColorSpace(Lb.copy(this),t);let n=Lb.r,r=Lb.g,i=Lb.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=Yy.workingColorSpace){return Yy.workingToColorSpace(Lb.copy(this),t),e.r=Lb.r,e.g=Lb.g,e.b=Lb.b,e}getStyle(e=Ey){Yy.workingToColorSpace(Lb.copy(this),e);let t=Lb.r,n=Lb.g,r=Lb.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Pb),this.setHSL(Pb.h+e,Pb.s+t,Pb.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Pb),e.getHSL(Fb);let n=Cv(Pb.h,Fb.h,t),r=Cv(Pb.s,Fb.s,t),i=Cv(Pb.l,Fb.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Lb=new Ib,Ib.NAMES=Nb,Rb=new $,zb=new $,Bb=new $,Vb=new $,Hb=new $,Ub=new $,Wb=new $,Gb=new $,Kb=new $,qb=new $,Jb=new rb,Yb=new rb,Xb=new rb,Zb=class e{constructor(e=new $,t=new $,n=new $){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Rb.subVectors(e,t),r.cross(Rb);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Rb.subVectors(r,t),zb.subVectors(n,t),Bb.subVectors(e,t);let a=Rb.dot(Rb),o=Rb.dot(zb),s=Rb.dot(Bb),c=zb.dot(zb),l=zb.dot(Bb),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Vb)!==null&&Vb.x>=0&&Vb.y>=0&&Vb.x+Vb.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Vb)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Vb.x),s.addScaledVector(a,Vb.y),s.addScaledVector(o,Vb.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Jb.setScalar(0),Yb.setScalar(0),Xb.setScalar(0),Jb.fromBufferAttribute(e,t),Yb.fromBufferAttribute(e,n),Xb.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Jb,i.x),a.addScaledVector(Yb,i.y),a.addScaledVector(Xb,i.z),a}static isFrontFacing(e,t,n,r){return Rb.subVectors(n,t),zb.subVectors(e,t),Rb.cross(zb).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Rb.subVectors(this.c,this.b),zb.subVectors(this.a,this.b),Rb.cross(zb).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Hb.subVectors(r,n),Ub.subVectors(i,n),Gb.subVectors(e,n);let s=Hb.dot(Gb),c=Ub.dot(Gb);if(s<=0&&c<=0)return t.copy(n);Kb.subVectors(e,r);let l=Hb.dot(Kb),u=Ub.dot(Kb);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Hb,a);qb.subVectors(e,i);let f=Hb.dot(qb),p=Ub.dot(qb);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Ub,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Wb.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Wb,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Hb,a).addScaledVector(Ub,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Qb=class{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(ex.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ex.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=ex.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,ex):ex.fromBufferAttribute(r,t),ex.applyMatrix4(e.matrixWorld),this.expandByPoint(ex);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),tx.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),tx.copy(e.boundingBox)),tx.applyMatrix4(e.matrixWorld),this.union(tx)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ex),ex.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(cx),lx.subVectors(this.max,cx),nx.subVectors(e.a,cx),rx.subVectors(e.b,cx),ix.subVectors(e.c,cx),ax.subVectors(rx,nx),ox.subVectors(ix,rx),sx.subVectors(nx,ix);let t=[0,-ax.z,ax.y,0,-ox.z,ox.y,0,-sx.z,sx.y,ax.z,0,-ax.x,ox.z,0,-ox.x,sx.z,0,-sx.x,-ax.y,ax.x,0,-ox.y,ox.x,0,-sx.y,sx.x,0];return!Gv(t,nx,rx,ix,lx)||(t=[1,0,0,0,1,0,0,0,1],!Gv(t,nx,rx,ix,lx))?!1:(ux.crossVectors(ax,ox),t=[ux.x,ux.y,ux.z],Gv(t,nx,rx,ix,lx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ex).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ex).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($b[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$b[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$b[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$b[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$b[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$b[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$b[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$b[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($b),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},$b=[new $,new $,new $,new $,new $,new $,new $,new $],ex=new $,tx=new Qb,nx=new $,rx=new $,ix=new $,ax=new $,ox=new $,sx=new $,cx=new $,lx=new $,ux=new $,dx=new $,fx=new $,px=new Vy,mx=0,hx=class extends Fy{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:mx++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=jy,this.updateRanges=[],this.gpuType=hy,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)px.fromBufferAttribute(this,t),px.applyMatrix3(e),this.setXY(t,px.x,px.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyMatrix3(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyMatrix4(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyNormalMatrix(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.transformDirection(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Rv(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=zv(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Rv(t,this.array)),t}setX(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Rv(t,this.array)),t}setY(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Rv(t,this.array)),t}setZ(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Rv(t,this.array)),t}setW(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array),i=zv(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},gx=class extends hx{constructor(e,t,n){super(new Uint16Array(e),t,n)}},_x=class extends hx{constructor(e,t,n){super(new Uint32Array(e),t,n)}},vx=class extends hx{constructor(e,t,n){super(new Float32Array(e),t,n)}},yx=new Qb,bx=new $,xx=new $,Sx=class{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?yx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;bx.subVectors(e,this.center);let t=bx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(bx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(xx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(bx.copy(e.center).add(xx)),this.expandByPoint(bx.copy(e.center).sub(xx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Cx=0,wx=new ib,Tx=new jb,Ex=new $,Dx=new Qb,Ox=new Qb,kx=new $,Ax=class e extends Fy{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Cx++}),this.uuid=vv(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(uv(e)?_x:gx)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Gy().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return wx.makeRotationFromQuaternion(e),this.applyMatrix4(wx),this}rotateX(e){return wx.makeRotationX(e),this.applyMatrix4(wx),this}rotateY(e){return wx.makeRotationY(e),this.applyMatrix4(wx),this}rotateZ(e){return wx.makeRotationZ(e),this.applyMatrix4(wx),this}translate(e,t,n){return wx.makeTranslation(e,t,n),this.applyMatrix4(wx),this}scale(e,t,n){return wx.makeScale(e,t,n),this.applyMatrix4(wx),this}lookAt(e){return Tx.lookAt(e),Tx.updateMatrix(),this.applyMatrix4(Tx.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ex).negate(),this.translate(Ex.x,Ex.y,Ex.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new vx(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&hv(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qb);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gv(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Dx.setFromBufferAttribute(n),this.morphTargetsRelative?(kx.addVectors(this.boundingBox.min,Dx.min),this.boundingBox.expandByPoint(kx),kx.addVectors(this.boundingBox.max,Dx.max),this.boundingBox.expandByPoint(kx)):(this.boundingBox.expandByPoint(Dx.min),this.boundingBox.expandByPoint(Dx.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&gv(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sx);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gv(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new $,1/0);return}if(e){let n=this.boundingSphere.center;if(Dx.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ox.setFromBufferAttribute(n),this.morphTargetsRelative?(kx.addVectors(Dx.min,Ox.min),Dx.expandByPoint(kx),kx.addVectors(Dx.max,Ox.max),Dx.expandByPoint(kx)):(Dx.expandByPoint(Ox.min),Dx.expandByPoint(Ox.max))}Dx.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)kx.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(kx));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)kx.fromBufferAttribute(a,t),o&&(Ex.fromBufferAttribute(e,t),kx.add(Ex)),r=Math.max(r,n.distanceToSquared(kx))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&gv(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){gv(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new hx(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new $,s[e]=new $;let c=new $,l=new $,u=new $,d=new Vy,f=new Vy,p=new Vy,m=new $,h=new $;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new $,y=new $,b=new $,x=new $;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new hx(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new $,i=new $,a=new $,o=new $,s=new $,c=new $,l=new $,u=new $;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)kx.fromBufferAttribute(e,t),kx.normalize(),e.setXYZ(t,kx.x,kx.y,kx.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new hx(a,r,i)}if(this.index===null)return hv(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},jx=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=jy,this.updateRanges=[],this.version=0,this.uuid=vv()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=vv()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=vv()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Mx=new $,Nx=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.applyMatrix4(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.applyNormalMatrix(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.transformDirection(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Rv(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=zv(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Rv(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Rv(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Rv(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Rv(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array),i=zv(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){pv(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new hx(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){pv(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Px=0,Fx=class extends Fy{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Px++}),this.uuid=vv(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ib(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ay,this.stencilZFail=Ay,this.stencilZPass=Ay,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){hv(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){hv(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ib().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new Vy().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Vy().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Ix=class extends Fx{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new Ib(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Rx=new $,zx=new $,Bx=new $,Vx=new Vy,Hx=new Vy,Ux=new ib,Wx=new $,Gx=new $,Kx=new $,qx=new Vy,Jx=new Vy,Yx=new Vy,Xx=class extends jb{constructor(e=new Ix){if(super(),this.isSprite=!0,this.type=`Sprite`,Lx===void 0){Lx=new Ax;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new jx(e,5);Lx.setIndex([0,1,2,0,2,3]),Lx.setAttribute(`position`,new Nx(t,3,0,!1)),Lx.setAttribute(`uv`,new Nx(t,2,3,!1))}this.geometry=Lx,this.material=e,this.center=new Vy(.5,.5),this.count=1}raycast(e,t){e.camera===null&&gv(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),zx.setFromMatrixScale(this.matrixWorld),Ux.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Bx.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&zx.multiplyScalar(-Bx.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;Kv(Wx.set(-.5,-.5,0),Bx,a,zx,r,i),Kv(Gx.set(.5,-.5,0),Bx,a,zx,r,i),Kv(Kx.set(.5,.5,0),Bx,a,zx,r,i),qx.set(0,0),Jx.set(1,0),Yx.set(1,1);let o=e.ray.intersectTriangle(Wx,Gx,Kx,!1,Rx);if(o===null&&(Kv(Gx.set(-.5,.5,0),Bx,a,zx,r,i),Jx.set(0,1),o=e.ray.intersectTriangle(Wx,Kx,Gx,!1,Rx),o===null))return;let s=e.ray.origin.distanceTo(Rx);s<e.near||s>e.far||t.push({distance:s,point:Rx.clone(),uv:Zb.getInterpolation(Rx,Wx,Gx,Kx,qx,Jx,Yx,new Vy),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}},Zx=new $,Qx=new $,$x=new $,eS=new $,tS=new $,nS=new $,rS=new $,iS=class{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zx)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Zx.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zx.copy(this.origin).addScaledVector(this.direction,t),Zx.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Qx.copy(e).add(t).multiplyScalar(.5),$x.copy(t).sub(e).normalize(),eS.copy(this.origin).sub(Qx);let i=e.distanceTo(t)*.5,a=-this.direction.dot($x),o=eS.dot(this.direction),s=-eS.dot($x),c=eS.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Qx).addScaledVector($x,d),f}intersectSphere(e,t){Zx.subVectors(e.center,this.origin);let n=Zx.dot(this.direction),r=Zx.dot(Zx)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Zx)!==null}intersectTriangle(e,t,n,r,i){tS.subVectors(t,e),nS.subVectors(n,e),rS.crossVectors(tS,nS);let a=this.direction.dot(rS),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;eS.subVectors(this.origin,e);let s=o*this.direction.dot(nS.crossVectors(eS,nS));if(s<0)return null;let c=o*this.direction.dot(tS.cross(eS));if(c<0||s+c>a)return null;let l=-o*eS.dot(rS);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},aS=class extends Fx{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Ib(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mb,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},oS=new ib,sS=new iS,cS=new Sx,lS=new $,uS=new $,dS=new $,fS=new $,pS=new $,mS=new $,hS=new $,gS=new $,_S=class extends jb{constructor(e=new Ax,t=new aS){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){mS.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(pS.fromBufferAttribute(s,e),a?mS.addScaledVector(pS,r):mS.addScaledVector(pS.sub(t),r))}t.add(mS)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),cS.copy(n.boundingSphere),cS.applyMatrix4(i),sS.copy(e.ray).recast(e.near),!(cS.containsPoint(sS.origin)===!1&&(sS.intersectSphere(cS,lS)===null||sS.origin.distanceToSquared(lS)>(e.far-e.near)**2))&&(oS.copy(i).invert(),sS.copy(e.ray).applyMatrix4(oS),(n.boundingBox===null||sS.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,sS)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Jv(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Jv(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Jv(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Jv(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},vS=new rb,yS=new rb,bS=new rb,xS=new rb,SS=new ib,CS=new $,wS=new Sx,TS=new ib,ES=new iS,DS=class extends _S{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=iy,this.bindMatrix=new ib,this.bindMatrixInverse=new ib,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qb),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,CS),this.boundingBox.expandByPoint(CS)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sx),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,CS),this.boundingSphere.expandByPoint(CS)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wS.copy(this.boundingSphere),wS.applyMatrix4(r),e.ray.intersectsSphere(wS)!==!1&&(TS.copy(r).invert(),ES.copy(e.ray).applyMatrix4(TS),(this.boundingBox===null||ES.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,ES)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new rb,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():hv(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;yS.fromBufferAttribute(r.attributes.skinIndex,e),bS.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(vS.copy(t),t.set(0,0,0,0)):(vS.set(...t,1),t.set(0,0,0)),vS.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=bS.getComponent(e);if(r!==0){let i=yS.getComponent(e);SS.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(xS.copy(vS).applyMatrix4(SS),r)}}return t.isVector4&&(t.w=vS.w),t.applyMatrix4(this.bindMatrixInverse)}},OS=class extends jb{constructor(){super(),this.isBone=!0,this.type=`Bone`}},kS=class extends nb{constructor(e=null,t=1,n=1,r,i,a,o,s,c=cy,l=cy,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},AS=new ib,jS=new ib,MS=class e{constructor(e=[],t=[]){this.uuid=vv(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){hv(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new ib)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new ib;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:jS;AS.multiplyMatrices(i,t[r]),AS.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new kS(t,e,e,gy,hy);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(hv(`Skeleton: No bone found with UUID:`,r),i=new OS),this.bones.push(i),this.boneInverses.push(new ib().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},NS=class extends hx{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},PS=new ib,FS=new ib,IS=[],LS=new Qb,RS=new ib,zS=new _S,BS=new Sx,VS=class extends _S{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new NS(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,RS)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qb),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,PS),LS.copy(e.boundingBox).applyMatrix4(PS),this.boundingBox.union(LS)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sx),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,PS),BS.copy(e.boundingSphere).applyMatrix4(PS),this.boundingSphere.union(BS)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(zS.geometry=this.geometry,zS.material=this.material,zS.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),BS.copy(this.boundingSphere),BS.applyMatrix4(n),e.ray.intersectsSphere(BS)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,PS),FS.multiplyMatrices(n,PS),zS.matrixWorld=FS,zS.raycast(e,IS);for(let e=0,n=IS.length;e<n;e++){let n=IS[e];n.instanceId=i,n.object=this,t.push(n)}IS.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new NS(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new kS(new Float32Array(r*this.count),r,this.count,_y,hy));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:`dispose`}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},HS=new $,US=new $,WS=new Gy,GS=class{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=HS.subVectors(n,t).cross(US.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(HS),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||WS.getNormalMatrix(e),r=this.coplanarPoint(HS).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},KS=new Sx,qS=new Vy(.5,.5),JS=new $,YS=class{constructor(e=new GS,t=new GS,n=new GS,r=new GS,i=new GS,a=new GS){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=My,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),KS.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),KS.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(KS)}intersectsSprite(e){KS.center.set(0,0,0);let t=qS.distanceTo(e.center);return KS.radius=.7071067811865476+t,KS.applyMatrix4(e.matrixWorld),this.intersectsSphere(KS)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(JS.x=r.normal.x>0?e.max.x:e.min.x,JS.y=r.normal.y>0?e.max.y:e.min.y,JS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(JS)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},XS=class extends Fx{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Ib(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},ZS=new $,QS=new $,$S=new ib,eC=new iS,tC=new Sx,nC=new $,rC=new $,iC=class extends jb{constructor(e=new Ax,t=new XS){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)ZS.fromBufferAttribute(t,e-1),QS.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=ZS.distanceTo(QS);e.setAttribute(`lineDistance`,new vx(n,1))}else hv(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),tC.copy(n.boundingSphere),tC.applyMatrix4(r),tC.radius+=i,e.ray.intersectsSphere(tC)===!1)return;$S.copy(r).invert(),eC.copy(e.ray).applyMatrix4($S);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=Yv(this,e,eC,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=Yv(this,e,eC,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=Yv(this,e,eC,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=Yv(this,e,eC,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},aC=new $,oC=new $,sC=class extends iC{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)aC.fromBufferAttribute(t,e),oC.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+aC.distanceTo(oC);e.setAttribute(`lineDistance`,new vx(n,1))}else hv(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},cC=class extends iC{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},lC=class extends Fx{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new Ib(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},uC=new ib,dC=new iS,fC=new Sx,pC=new $,mC=class extends jb{constructor(e=new Ax,t=new lC){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fC.copy(n.boundingSphere),fC.applyMatrix4(r),fC.radius+=i,e.ray.intersectsSphere(fC)===!1)return;uC.copy(r).invert(),dC.copy(e.ray).applyMatrix4(uC);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);pC.fromBufferAttribute(l,n),Xv(pC,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)pC.fromBufferAttribute(l,a),Xv(pC,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},hC=class extends Fx{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new Ib(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ib(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Vy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mb,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},gC=class extends hC{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vy(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yv(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ib(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ib(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ib(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},_C=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}},vC=class extends _C{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Sy,endingEnd:Sy}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Cy:i=e,o=2*t-n;break;case wy:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Cy:a=e,s=2*n-t;break;case wy:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},yC=class extends _C{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},bC=class extends _C{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},xC=class extends _C{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let d=o*2,f=e-1;for(let p=0;p!==o;++p){let o=a[c+p],m=a[s+p],h=f*d+p*2,g=u[h],_=u[h+1],v=e*d+p*2,y=l[v],b=l[v+1],x=(n-t)/(r-t),S,C,w,T,E;for(let e=0;e<8;e++){S=x*x,C=S*x,w=1-x,T=w*w,E=T*w;let e=E*t+3*T*x*g+3*w*S*y+C*r-n;if(Math.abs(e)<1e-10)break;let i=3*T*(g-t)+6*w*x*(y-g)+3*S*(r-y);if(Math.abs(i)<1e-10)break;x-=e/i,x=Math.max(0,Math.min(1,x))}i[p]=E*o+3*T*x*_+3*w*S*b+C*m}return i}},SC=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Zv(t,this.TimeBufferType),this.values=Zv(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Zv(e.times,Array),values:Zv(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new bC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new yC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new xC(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case vy:t=this.InterpolantFactoryMethodDiscrete;break;case yy:t=this.InterpolantFactoryMethodLinear;break;case by:t=this.InterpolantFactoryMethodSmooth;break;case xy:t=this.InterpolantFactoryMethodBezier}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return hv(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vy;case this.InterpolantFactoryMethodLinear:return yy;case this.InterpolantFactoryMethodSmooth:return by;case this.InterpolantFactoryMethodBezier:return xy}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(gv(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(gv(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){gv(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){gv(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&dv(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){gv(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===by,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0])){if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}},SC.prototype.ValueTypeName=``,SC.prototype.TimeBufferType=Float32Array,SC.prototype.ValueBufferType=Float32Array,SC.prototype.DefaultInterpolation=yy,CC=class extends SC{constructor(e,t,n){super(e,t,n)}},CC.prototype.ValueTypeName=`bool`,CC.prototype.ValueBufferType=Array,CC.prototype.DefaultInterpolation=vy,CC.prototype.InterpolantFactoryMethodLinear=void 0,CC.prototype.InterpolantFactoryMethodSmooth=void 0,wC=class extends SC{constructor(e,t,n,r){super(e,t,n,r)}},wC.prototype.ValueTypeName=`color`,TC=class extends SC{constructor(e,t,n,r){super(e,t,n,r)}},TC.prototype.ValueTypeName=`number`,EC=class extends _C{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Hy.slerpFlat(i,0,a,c-o,a,c,s);return i}},DC=class extends SC{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new EC(this.times,this.values,this.getValueSize(),e)}},DC.prototype.ValueTypeName=`quaternion`,DC.prototype.InterpolantFactoryMethodSmooth=void 0,OC=class extends SC{constructor(e,t,n){super(e,t,n)}},OC.prototype.ValueTypeName=`string`,OC.prototype.ValueBufferType=Array,OC.prototype.DefaultInterpolation=vy,OC.prototype.InterpolantFactoryMethodLinear=void 0,OC.prototype.InterpolantFactoryMethodSmooth=void 0,kC=class extends SC{constructor(e,t,n,r){super(e,t,n,r)}},kC.prototype.ValueTypeName=`vector`,AC=class{constructor(e=``,t=-1,n=[],r=Ty){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=vv(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(ny(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||`{}`),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(SC.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e<i;e++){let o=[],s=[];o.push((e+i-1)%i,e,(e+1)%i),s.push(0,1,0);let c=Qv(o);o=$v(o,1,c),s=$v(s,1,c),!r&&o[0]===0&&(o.push(i),s.push(s[0])),a.push(new TC(`.morphTargetInfluences[`+t[e].name+`]`,o,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.name.match(i);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let e=this.tracks[n];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e&&=this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}},jC={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(ry(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!ry(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},MC=class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return e=e.normalize(`NFC`),s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||=new AbortController,this._abortController}},NC=new MC,PC=class{constructor(e){this.manager=e===void 0?NC:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}},PC.DEFAULT_MATERIAL_NAME=`__DEFAULT`,FC={},IC=class extends Error{constructor(e,t){super(e),this.response=t}},LC=class extends PC{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=jC.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(FC[e]!==void 0){FC[e].push({onLoad:t,onProgress:n,onError:r});return}FC[e]=[],FC[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&hv(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=FC[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}throw new IC(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{jC.add(`file:${e}`,t);let n=FC[e];delete FC[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=FC[e];if(n===void 0)throw this.manager.itemError(e),t;delete FC[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},RC=new WeakMap,zC=class extends PC{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=jC.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);else{let e=RC.get(a);e===void 0&&(e=[],RC.set(a,e)),e.push({onLoad:t,onError:r})}return a}let o=fv(`img`);function s(){l(),t&&t(this);let n=RC.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}RC.delete(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),jC.remove(`image:${e}`);let n=RC.get(this)||[];for(let e=0;e<n.length;e++){let r=n[e];r.onError&&r.onError(t)}RC.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),jC.add(`image:${e}`,o),i.manager.itemStart(e),o.src=e,o}},BC=class extends PC{constructor(e){super(e)}load(e,t,n,r){let i=new nb,a=new zC(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},VC=class extends jb{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Ib(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},HC=new ib,UC=new $,WC=new $,GC=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vy(512,512),this.mapType=my,this.map=null,this.mapPass=null,this.matrix=new ib,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new YS,this._frameExtents=new Vy(1,1),this._viewportCount=1,this._viewports=[new rb(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;UC.setFromMatrixPosition(e.matrixWorld),t.position.copy(UC),WC.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(WC),t.updateMatrixWorld(),HC.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(HC,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(HC)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},KC=new $,qC=new Hy,JC=new $,YC=class extends jb{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new ib,this.projectionMatrix=new ib,this.projectionMatrixInverse=new ib,this.coordinateSystem=My,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(KC,qC,JC),JC.x===1&&JC.y===1&&JC.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(KC,qC,JC.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(KC,qC,JC),JC.x===1&&JC.y===1&&JC.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(KC,qC,JC.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},XC=new $,ZC=new Vy,QC=new Vy,$C=class extends YC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=zy*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ry*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return zy*2*Math.atan(Math.tan(Ry*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){XC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(XC.x,XC.y).multiplyScalar(-e/XC.z),XC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(XC.x,XC.y).multiplyScalar(-e/XC.z)}getViewSize(e,t){return this.getViewBounds(e,ZC,QC),t.subVectors(QC,ZC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ry*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},ew=class extends GC{constructor(){super(new $C(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=zy*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},tw=class extends VC{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(jb.DEFAULT_UP),this.updateMatrix(),this.target=new jb,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new ew}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},nw=class extends GC{constructor(){super(new $C(90,1,.5,500)),this.isPointLightShadow=!0}},rw=class extends VC{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new nw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},iw=class extends YC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},aw=class extends GC{constructor(){super(new iw(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ow=class extends VC{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(jb.DEFAULT_UP),this.updateMatrix(),this.target=new jb,this.shadow=new aw}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},sw=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},cw=new WeakMap,lw=class extends PC{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&hv(`ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&hv(`ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=jC.get(`image-bitmap:${e}`);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{cw.has(a)===!0?(r&&r(cw.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)):(t&&t(n),i.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){jC.add(`image-bitmap:${e}`,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),cw.set(s,t),jC.remove(`image-bitmap:${e}`),i.manager.itemError(e),i.manager.itemEnd(e)});jC.add(`image-bitmap:${e}`,s),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},uw=`\\[\\]\\.:\\/`,dw=RegExp(`[\\[\\]\\.:\\/]`,`g`),fw=`[^\\[\\]\\.:\\/]`,pw=`[^`+uw.replace(`\\.`,``)+`]`,mw=`((?:WC+[\\/:])*)`.replace(`WC`,fw),hw=`(WCOD+)?`.replace(`WCOD`,pw),gw=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,fw),_w=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,fw),vw=RegExp(`^`+mw+hw+gw+_w+`$`),yw=[`material`,`materials`,`bones`,`map`],bw=class{constructor(e,t,n){let r=n||xw.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},xw=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(dw,``)}static parseTrackName(e){let t=vw.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);yw.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){hv(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){gv(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){gv(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){gv(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){gv(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){gv(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){gv(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){gv(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;gv(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){gv(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){gv(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},xw.Composite=bw,xw.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},xw.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},xw.prototype.GetterByBindingType=[xw.prototype._getValue_direct,xw.prototype._getValue_array,xw.prototype._getValue_arrayElement,xw.prototype._getValue_toArray],xw.prototype.SetterByBindingTypeAndVersioning=[[xw.prototype._setValue_direct,xw.prototype._setValue_direct_setNeedsUpdate,xw.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_array,xw.prototype._setValue_array_setNeedsUpdate,xw.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_arrayElement,xw.prototype._setValue_arrayElement_setNeedsUpdate,xw.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_fromArray,xw.prototype._setValue_fromArray_setNeedsUpdate,xw.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`185`}})),typeof window<`u`&&(window.__THREE__?hv(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`185`)})),Cw=p((()=>{Sw(),new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183])})),ww=h({default:()=>Kw});function Tw(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ew(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dw(e,t,n){return t&&Ew(e.prototype,t),n&&Ew(e,n),e}function Ow(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Aw(e,t)}function kw(e){return kw=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},kw(e)}function Aw(e,t){return Aw=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Aw(e,t)}function jw(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Mw(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Nw(e,t){return t&&(typeof t==`object`||typeof t==`function`)?t:Mw(e)}function Pw(e){var t=jw();return function(){var n=kw(e),r;if(t){var i=kw(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Nw(this,r)}}function Fw(e,t){return Rw(e)||Bw(e,t)||Vw(e,t)||Ww()}function Iw(e){return Lw(e)||zw(e)||Vw(e)||Uw()}function Lw(e){if(Array.isArray(e))return Hw(e)}function Rw(e){if(Array.isArray(e))return e}function zw(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Bw(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Vw(e,t){if(e){if(typeof e==`string`)return Hw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hw(e,t)}}function Hw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Uw(){throw TypeError(`Invalid attempt to spread non-iterable instance.
4116
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ww(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
4117
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Gw,Kw,qw=p((()=>{Cw(),Gw=typeof window<`u`&&window.THREE?window.THREE:{LinearFilter:dy,Sprite:Xx,SpriteMaterial:Ix,Texture:nb},Kw=function(e){Ow(n,e);var t=Pw(n);function n(){var e,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`rgba(255, 255, 255, 1)`;return Tw(this,n),e=t.call(this,new Gw.SpriteMaterial({map:new Gw.Texture})),e._text=`${r}`,e._textHeight=i,e._color=a,e._backgroundColor=!1,e._padding=0,e._borderWidth=0,e._borderRadius=0,e._borderColor=`white`,e._strokeWidth=0,e._strokeColor=`white`,e._fontFace=`Arial`,e._fontSize=90,e._fontWeight=`normal`,e._canvas=document.createElement(`canvas`),e._texture=e.material.map,e._texture.minFilter=Gw.LinearFilter,e._genCanvas(),e}return Dw(n,[{key:`text`,get:function(){return this._text},set:function(e){this._text=e,this._genCanvas()}},{key:`textHeight`,get:function(){return this._textHeight},set:function(e){this._textHeight=e,this._genCanvas()}},{key:`color`,get:function(){return this._color},set:function(e){this._color=e,this._genCanvas()}},{key:`backgroundColor`,get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._genCanvas()}},{key:`padding`,get:function(){return this._padding},set:function(e){this._padding=e,this._genCanvas()}},{key:`borderWidth`,get:function(){return this._borderWidth},set:function(e){this._borderWidth=e,this._genCanvas()}},{key:`borderRadius`,get:function(){return this._borderRadius},set:function(e){this._borderRadius=e,this._genCanvas()}},{key:`borderColor`,get:function(){return this._borderColor},set:function(e){this._borderColor=e,this._genCanvas()}},{key:`fontFace`,get:function(){return this._fontFace},set:function(e){this._fontFace=e,this._genCanvas()}},{key:`fontSize`,get:function(){return this._fontSize},set:function(e){this._fontSize=e,this._genCanvas()}},{key:`fontWeight`,get:function(){return this._fontWeight},set:function(e){this._fontWeight=e,this._genCanvas()}},{key:`strokeWidth`,get:function(){return this._strokeWidth},set:function(e){this._strokeWidth=e,this._genCanvas()}},{key:`strokeColor`,get:function(){return this._strokeColor},set:function(e){this._strokeColor=e,this._genCanvas()}},{key:`_genCanvas`,value:function(){var e=this,t=this._canvas,n=t.getContext(`2d`),r=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],i=r.map(function(t){return t*e.fontSize*.1}),a=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map(function(t){return t*e.fontSize*.1}),o=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],s=o.map(function(t){return t*e.fontSize*.1}),c=this.text.split(`
4118
- `),l=`${this.fontWeight} ${this.fontSize}px ${this.fontFace}`;n.font=l;var u=Math.max.apply(Math,Iw(c.map(function(e){return n.measureText(e).width}))),d=this.fontSize*c.length;if(t.width=u+i[0]*2+s[0]*2,t.height=d+i[1]*2+s[1]*2,this.borderWidth){if(n.strokeStyle=this.borderColor,i[0]){var f=i[0]/2;n.lineWidth=i[0],n.beginPath(),n.moveTo(f,a[0]),n.lineTo(f,t.height-a[3]),n.moveTo(t.width-f,a[1]),n.lineTo(t.width-f,t.height-a[2]),n.stroke()}if(i[1]){var p=i[1]/2;n.lineWidth=i[1],n.beginPath(),n.moveTo(Math.max(i[0],a[0]),p),n.lineTo(t.width-Math.max(i[0],a[1]),p),n.moveTo(Math.max(i[0],a[3]),t.height-p),n.lineTo(t.width-Math.max(i[0],a[2]),t.height-p),n.stroke()}if(this.borderRadius){var m=Math.max.apply(Math,Iw(i)),h=m/2;n.lineWidth=m,n.beginPath(),[!!a[0]&&[a[0],h,h,a[0]],!!a[1]&&[t.width-a[1],t.width-h,h,a[1]],!!a[2]&&[t.width-a[2],t.width-h,t.height-h,t.height-a[2]],!!a[3]&&[a[3],h,t.height-h,t.height-a[3]]].filter(function(e){return e}).forEach(function(e){var t=Fw(e,4),r=t[0],i=t[1],a=t[2],o=t[3];n.moveTo(r,a),n.quadraticCurveTo(i,a,i,o)}),n.stroke()}}this.backgroundColor&&(n.fillStyle=this.backgroundColor,this.borderRadius?(n.beginPath(),n.moveTo(i[0],a[0]),[[i[0],a[0],t.width-a[1],i[1],i[1],i[1]],[t.width-i[0],t.width-i[0],t.width-i[0],i[1],a[1],t.height-a[2]],[t.width-i[0],t.width-a[2],a[3],t.height-i[1],t.height-i[1],t.height-i[1]],[i[0],i[0],i[0],t.height-i[1],t.height-a[3],a[0]]].forEach(function(e){var t=Fw(e,6),r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];n.quadraticCurveTo(r,o,i,s),n.lineTo(a,c)}),n.closePath(),n.fill()):n.fillRect(i[0],i[1],t.width-i[0]*2,t.height-i[1]*2)),n.translate.apply(n,Iw(i)),n.translate.apply(n,Iw(s)),n.font=l,n.fillStyle=this.color,n.textBaseline=`bottom`;var g=this.strokeWidth>0;g&&(n.lineWidth=this.strokeWidth*this.fontSize/10,n.strokeStyle=this.strokeColor),c.forEach(function(t,r){var i=(u-n.measureText(t).width)/2,a=(r+1)*e.fontSize;g&&n.strokeText(t,i,a),n.fillText(t,i,a)}),this._texture.image=t,this._texture.needsUpdate=!0;var _=this.textHeight*c.length+r[1]*2+o[1]*2;this.scale.set(_*t.width/t.height,_,0)}},{key:`clone`,value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:`copy`,value:function(e){return Gw.Sprite.prototype.copy.call(this,e),this.color=e.color,this.backgroundColor=e.backgroundColor,this.padding=e.padding,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.fontFace=e.fontFace,this.fontSize=e.fontSize,this.fontWeight=e.fontWeight,this.strokeWidth=e.strokeWidth,this.strokeColor=e.strokeColor,this}}]),n}(Gw.Sprite)})),Jw=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define(r):typeof e==`object`?t.exports=r():n.ResizeSensor=r()})(typeof window<`u`?window:e,function(){if(typeof window>`u`)return null;var e=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)(),t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)},n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||function(t){e.clearTimeout(t)};function r(e,t){var n=Object.prototype.toString.call(e),r=n===`[object Array]`||n===`[object NodeList]`||n===`[object HTMLCollection]`||n===`[object Object]`||typeof jQuery<`u`&&e instanceof jQuery||typeof Elements<`u`&&e instanceof Elements,i=0,a=e.length;if(r)for(;i<a;i++)t(e[i]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function a(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}var o=function(e,s){var c=0;function l(){var e=[];this.add=function(t){e.push(t)};var t,n;this.call=function(r){for(t=0,n=e.length;t<n;t++)e[t].call(this,r)},this.remove=function(r){var i=[];for(t=0,n=e.length;t<n;t++)e[t]!==r&&i.push(e[t]);e=i},this.length=function(){return e.length}}function u(e,n){if(e){if(e.resizedAttached){e.resizedAttached.add(n);return}e.resizedAttached=new l,e.resizedAttached.add(n),e.resizeSensor=document.createElement(`div`),e.resizeSensor.dir=`ltr`,e.resizeSensor.className=`resize-sensor`;var r={pointerEvents:`none`,position:`absolute`,left:`0px`,top:`0px`,right:`0px`,bottom:`0px`,overflow:`hidden`,zIndex:`-1`,visibility:`hidden`,maxWidth:`100%`},o={position:`absolute`,left:`0px`,top:`0px`,transition:`0s`};a(e.resizeSensor,r);var s=document.createElement(`div`);s.className=`resize-sensor-expand`,a(s,r);var u=document.createElement(`div`);a(u,o),s.appendChild(u);var d=document.createElement(`div`);d.className=`resize-sensor-shrink`,a(d,r);var f=document.createElement(`div`);a(f,o),a(f,{width:`200%`,height:`200%`}),d.appendChild(f),e.resizeSensor.appendChild(s),e.resizeSensor.appendChild(d),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue(`position`):null;m!==`absolute`&&m!==`relative`&&m!==`fixed`&&m!==`sticky`&&(e.style.position=`relative`);var h=!1,g=0,_=i(e),v=0,y=0,b=!0;c=0;var x=function(){var t=e.offsetWidth,n=e.offsetHeight;u.style.width=t+10+`px`,u.style.height=n+10+`px`,s.scrollLeft=t+10,s.scrollTop=n+10,d.scrollLeft=t+10,d.scrollTop=n+10},S=function(){if(b){if(e.offsetWidth===0&&e.offsetHeight===0){c||=t(function(){c=0,S()});return}b=!1}x()};e.resizeSensor.resetSensor=S;var C=function(){g=0,h&&(v=_.width,y=_.height,e.resizedAttached&&e.resizedAttached.call(_))},w=function(){_=i(e),h=_.width!==v||_.height!==y,h&&!g&&(g=t(C)),S()},T=function(e,t,n){e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener(t,n)};T(s,`scroll`,w),T(d,`scroll`,w),c=t(function(){c=0,S()})}}r(e,function(e){u(e,s)}),this.detach=function(t){c||=(n(c),0),o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};if(o.reset=function(e){r(e,function(e){e.resizeSensor.resetSensor()})},o.detach=function(e,t){r(e,function(e){e&&(e.resizedAttached&&typeof t==`function`&&(e.resizedAttached.remove(t),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},typeof MutationObserver<`u`){var s=new MutationObserver(function(e){for(var t in e)if(e.hasOwnProperty(t))for(var n=e[t].addedNodes,r=0;r<n.length;r++)n[r].resizeSensor&&o.reset(n[r])});document.addEventListener(`DOMContentLoaded`,function(e){s.observe(document.body,{childList:!0,subtree:!0})})}return o})})),Yw=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define([`./ResizeSensor.js`],r):typeof e==`object`?t.exports=r(Jw()):(n.ElementQueries=r(n.ResizeSensor),n.ElementQueries.listen())})(typeof window<`u`?window:e,function(e){var t=function(){var t,n={},r=[];function i(e){e||=document.documentElement;var t=window.getComputedStyle(e,null).fontSize;return parseFloat(t)||16}function a(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function o(e,t){var n=t.split(/\d/),r=n[n.length-1];switch(t=parseFloat(t),r){case`px`:return t;case`em`:return t*i(e);case`rem`:return t*i();case`vw`:return t*document.documentElement.clientWidth/100;case`vh`:return t*document.documentElement.clientHeight/100;case`vmin`:case`vmax`:var a=document.documentElement.clientWidth/100,o=document.documentElement.clientHeight/100,s=Math[r===`vmin`?`min`:`max`];return t*s(a,o);default:return t}}function s(e,t){this.element=e;var r,i,s,c,l,u,d,f,p=[`min-width`,`min-height`,`max-width`,`max-height`];this.call=function(){for(r in s=a(this.element),u={},n[t])n[t].hasOwnProperty(r)&&(i=n[t][r],c=o(this.element,i.value),l=i.property===`width`?s.width:s.height,f=i.mode+`-`+i.property,d=``,i.mode===`min`&&l>=c&&(d+=i.value),i.mode===`max`&&l<=c&&(d+=i.value),u[f]||(u[f]=``),d&&(` `+u[f]+` `).indexOf(` `+d+` `)===-1&&(u[f]+=` `+d));for(var e in p)p.hasOwnProperty(e)&&(u[p[e]]?this.element.setAttribute(p[e],u[p[e]].substr(1)):this.element.removeAttribute(p[e]))}}function c(t,n){t.elementQueriesSetupInformation||=new s(t,n),t.elementQueriesSensor||=new e(t,function(){t.elementQueriesSetupInformation.call()})}function l(e,i,a,o){if(n[e]===void 0){n[e]=[];var s=r.length;t.innerHTML+=`
4115
+ }`,y_=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Pc(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Pu({vertexShader:__,fragmentShader:v_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ts(new pu(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},b_=class extends xr{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new y_,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new q,C=null,w=new Ud;w.viewport=new mi;let T=new Ud;T.viewport=new mi;let E=[w,T],D=new wf,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Zi,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,M);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}O=null,k=null,h.reset();for(let e in g)delete g[e];e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,I.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,A),r.addEventListener(`selectstart`,A),r.addEventListener(`selectend`,A),r.addEventListener(`squeeze`,A),r.addEventListener(`squeezestart`,A),r.addEventListener(`squeezeend`,A),r.addEventListener(`end`,j),r.addEventListener(`inputsourceschange`,M),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?et:$e,a=_.stencil?qe:He);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new gi(d.textureWidth,d.textureHeight,{format:Qe,type:Le,depthTexture:new Mc(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new gi(f.framebufferWidth,f.framebufferHeight,{format:Qe,type:Le,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),I.setContext(r),I.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function M(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let N=new J,P=new J;function F(e,t,n){N.setFromMatrixPosition(t.matrixWorld),P.setFromMatrixPosition(n.matrixWorld);let r=N.distanceTo(P),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ee(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;ee(D,i);for(let e=0;e<a.length;e++)ee(a[e],i);a.length===2?F(D,w,T):D.projectionMatrix.copy(w.projectionMatrix),te(e,D,i)};function te(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=Tr*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(d!==null||f!==null)return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(D)},this.getCameraTexture=function(e){return g[e]};let ne=null;function re(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==D.cameras.length&&(D.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=E[n];o===void 0&&(o=new Ud,o.layers.enable(n),o.viewport=new mi,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(D.matrix.copy(o.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),i===!0&&D.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new Pc,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}ne&&ne(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let I=new fm;I.setAnimationLoop(re),this.setAnimationLoop=function(e){ne=e},this.dispose=function(){}}},x_=new xi,S_=new Qr;S_.set(-1,0,0,0,1,0,0,0,1);function C_(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,Au(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isNodeMaterial?t.uniformsNeedUpdate=!1:t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&m(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),h(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),g(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===p&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===p&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(x_.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(S_),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function m(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===p&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function h(e,t){t.matcap&&(e.matcap.value=t.matcap)}function g(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function w_(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(g(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,v));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return _r(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)p(t[n],e,n,a);else p(t,e,0,a)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(t,n,r,i){if(h(t,n,r,i)===!0){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let i=r[n],a=_(i);m(i,t.__data,e),typeof i!=`number`&&typeof i!=`boolean`&&!i.isMatrix3&&!ArrayBuffer.isView(i)&&(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else m(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function m(e,t,n){typeof e==`number`||typeof e==`boolean`?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function h(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return r[a]=typeof i==`number`||typeof i==`boolean`?i:ArrayBuffer.isView(i)?i.slice():i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function g(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=_(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function _(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?K(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):K(`WebGLRenderer: Unsupported uniform value type.`,e),t}function v(t){let n=t.target;n.removeEventListener(`dispose`,v);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function y(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:y}}var T_=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),E_=null;function D_(){return E_===null&&(E_=new hs(T_,16,16,rt,We),E_.name=`DFG_LUT`,E_.minFilter=Me,E_.magFilter=Me,E_.wrapS=W,E_.wrapT=W,E_.generateMipmaps=!1,E_.needsUpdate=!0),E_}var O_=class{constructor(e={}){let{canvas:n=ur(),context:r=null,depth:i=!0,stencil:a=!1,alpha:o=!1,antialias:s=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u=`default`,failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:h=!1,outputBufferType:g=Le}=e;this.isWebGLRenderer=!0;let _;if(r!==null){if(typeof WebGLRenderingContext<`u`&&r instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);_=r.getContextAttributes().alpha}else _=o;let v=g,y=new Set([ot,it,nt]),b=new Set([Le,He,Be,qe,Ge,Ke]),x=new Uint32Array(4),S=new Int32Array(4),C=new J,w=null,T=null,E=[],D=[],O=null;this.domElement=n,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=he,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,A=!1,j=null,M=null,N=null,P=null;this._outputColorSpace=fn;let F=0,ee=0,te=null,ne=-1,re=null,I=new mi,ie=new mi,ae=null,oe=new Y(0),se=0,L=n.width,ce=n.height,le=1,ue=null,de=null,fe=new mi(0,0,L,ce),pe=new mi(0,0,L,ce),me=!1,ge=new Fs,R=!1,_e=!1,ve=new xi,z=new J,ye=new mi,be={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},xe=!1;function Se(){return te===null?le:1}let B=r;function V(e,t){return n.getContext(e,t)}try{let e={alpha:!0,depth:i,stencil:a,antialias:s,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:d};if(`setAttribute`in n&&n.setAttribute(`data-engine`,`three.js r${t}`),n.addEventListener(`webglcontextlost`,$e,!1),n.addEventListener(`webglcontextrestored`,et,!1),n.addEventListener(`webglcontextcreationerror`,tt,!1),B===null){let t=`webgl2`;if(B=V(t,e),B===null)throw V(t)?Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}}catch(e){throw _r(`WebGLRenderer: `+e.message),e}let Ce,we,H,Te,U,W,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Ie,Re,ze,Ve,Ue,Je,Ye,Xe;function Ze(){Ce=new Km(B),Ce.init(),Je=new g_(B,Ce),we=new Sm(B,Ce,e,Je),H=new m_(B,Ce),we.reversedDepthBuffer&&h&&H.buffers.depth.setReversed(!0),M=B.createFramebuffer(),N=B.createFramebuffer(),P=B.createFramebuffer(),Te=new Ym(B),U=new Jg,W=new h_(B,Ce,H,U,we,Je,Te),Ee=new Gm(k),De=new pm(B),Ye=new bm(B,De),Oe=new qm(B,De,Te,Ye),ke=new Zm(B,Oe,De,Ye,Te),ze=new Xm(B,we,W),Pe=new Cm(U),Ae=new qg(k,Ee,Ce,we,Ye,Pe),je=new C_(k,U),Me=new Qg,Ne=new a_(Ce),Re=new ym(k,Ee,H,ke,_,c),Ie=new p_(k,ke,we),Xe=new w_(B,Te,we,H),Ve=new xm(B,Ce,Te),Ue=new Jm(B,Ce,Te),Te.programs=Ae.programs,k.capabilities=we,k.extensions=Ce,k.properties=U,k.renderLists=Me,k.shadowMap=Ie,k.state=H,k.info=Te}Ze(),v!==Le&&(O=new $m(v,n.width,n.height,s,i,a));let Qe=new b_(k,B);this.xr=Qe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let e=Ce.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=Ce.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(e){e!==void 0&&(le=e,this.setSize(L,ce,!1))},this.getSize=function(e){return e.set(L,ce)},this.setSize=function(e,t,r=!0){if(Qe.isPresenting){K(`WebGLRenderer: Can't change size while VR device is presenting.`);return}L=e,ce=t,n.width=Math.floor(e*le),n.height=Math.floor(t*le),r===!0&&(n.style.width=e+`px`,n.style.height=t+`px`),O!==null&&O.setSize(n.width,n.height),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(L*le,ce*le).floor()},this.setDrawingBufferSize=function(e,t,r){L=e,ce=t,le=r,n.width=Math.floor(e*r),n.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(v===Le){_r(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){K(`WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}O.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(I)},this.getViewport=function(e){return e.copy(fe)},this.setViewport=function(e,t,n,r){e.isVector4?fe.set(e.x,e.y,e.z,e.w):fe.set(e,t,n,r),H.viewport(I.copy(fe).multiplyScalar(le).round())},this.getScissor=function(e){return e.copy(pe)},this.setScissor=function(e,t,n,r){e.isVector4?pe.set(e.x,e.y,e.z,e.w):pe.set(e,t,n,r),H.scissor(ie.copy(pe).multiplyScalar(le).round())},this.getScissorTest=function(){return me},this.setScissorTest=function(e){H.setScissorTest(me=e)},this.setOpaqueSort=function(e){ue=e},this.setTransparentSort=function(e){de=e},this.getClearColor=function(e){return e.copy(Re.getClearColor())},this.setClearColor=function(){Re.setClearColor(...arguments)},this.getClearAlpha=function(){return Re.getClearAlpha()},this.setClearAlpha=function(){Re.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(te!==null){let t=te.texture.format;e=y.has(t)}if(e){let e=te.texture.type,t=b.has(e),n=Re.getClearColor(),r=Re.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(x[0]=i,x[1]=a,x[2]=o,x[3]=r,B.clearBufferuiv(B.COLOR,0,x)):(S[0]=i,S[1]=a,S[2]=o,S[3]=r,B.clearBufferiv(B.COLOR,0,S))}else r|=B.COLOR_BUFFER_BIT}t&&(r|=B.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&B.clear(r)},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.setNodesHandler=function(e){e.setRenderer(this),j=e},this.dispose=function(){n.removeEventListener(`webglcontextlost`,$e,!1),n.removeEventListener(`webglcontextrestored`,et,!1),n.removeEventListener(`webglcontextcreationerror`,tt,!1),Re.dispose(),Me.dispose(),Ne.dispose(),U.dispose(),Ee.dispose(),ke.dispose(),Ye.dispose(),Xe.dispose(),Ae.dispose(),Qe.dispose(),Qe.removeEventListener(`sessionstart`,dt),Qe.removeEventListener(`sessionend`,ft),pt.stop()};function $e(e){e.preventDefault(),hr(`WebGLRenderer: Context Lost.`),A=!0}function et(){hr(`WebGLRenderer: Context Restored.`),A=!1;let e=Te.autoReset,t=Ie.enabled,n=Ie.autoUpdate,r=Ie.needsUpdate,i=Ie.type;Ze(),Te.autoReset=e,Ie.enabled=t,Ie.autoUpdate=n,Ie.needsUpdate=r,Ie.type=i}function tt(e){_r(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function rt(e){let t=e.target;t.removeEventListener(`dispose`,rt),at(t)}function at(e){st(e),U.remove(e)}function st(e){let t=U.get(e).programs;t!==void 0&&(t.forEach(function(e){Ae.releaseProgram(e)}),e.isShaderMaterial&&Ae.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=be);let o=i.isMesh&&i.matrixWorld.determinantAffine()<0,s=Ct(e,t,n,r,i);H.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Oe.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ye.setup(i,r,s,n,c);let h,g=Ve;if(c!==null&&(h=De.get(c),g=Ue,g.setIndex(h)),i.isMesh)r.wireframe===!0?(H.setLineWidth(r.wireframeLinewidth*Se()),g.setMode(B.LINES)):g.setMode(B.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),H.setLineWidth(e*Se()),i.isLineSegments?g.setMode(B.LINES):i.isLineLoop?g.setMode(B.LINE_LOOP):g.setMode(B.LINE_STRIP)}else i.isPoints?g.setMode(B.POINTS):i.isSprite&&g.setMode(B.TRIANGLES);if(i.isBatchedMesh){if(Ce.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?De.get(c).bytesPerElement:1,o=U.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(B,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function ct(e,t,n){e.transparent===!0&&e.side===m&&e.forceSinglePass===!1?(e.side=p,e.needsUpdate=!0,yt(e,t,n),e.side=f,e.needsUpdate=!0,yt(e,t,n),e.side=m):yt(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),T=Ne.get(n),T.init(t),D.push(T),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(T.pushLight(e),e.castShadow&&T.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(T.pushLight(e),e.castShadow&&T.pushShadow(e))}),T.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t){if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];ct(a,n,e),r.add(a)}else ct(t,n,e),r.add(t)}}),T=D.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){U.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}Ce.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let lt=null;function ut(e){lt&&lt(e)}function dt(){pt.stop()}function ft(){pt.start()}let pt=new fm;pt.setAnimationLoop(ut),typeof self<`u`&&pt.setContext(self),this.setAnimationLoop=function(e){lt=e,Qe.setAnimationLoop(e),e===null?pt.stop():pt.start()},Qe.addEventListener(`sessionstart`,dt),Qe.addEventListener(`sessionend`,ft),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){_r(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(A===!0)return;j!==null&&j.renderStart(e,t);let n=Qe.enabled===!0&&Qe.isPresenting===!0,r=O!==null&&(te===null||n)&&O.begin(k,te);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Qe.enabled===!0&&Qe.isPresenting===!0&&(O===null||O.isCompositing()===!1)&&(Qe.cameraAutoUpdate===!0&&Qe.updateCamera(t),t=Qe.getCamera()),e.isScene===!0&&e.onBeforeRender(k,e,t,te),T=Ne.get(e,D.length),T.init(t),T.state.textureUnits=W.getTextureUnits(),D.push(T),ve.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ge.setFromProjectionMatrix(ve,$n,t.reversedDepth),_e=this.localClippingEnabled,R=Pe.init(this.clippingPlanes,_e),w=Me.get(e,E.length),w.init(),E.push(w),Qe.enabled===!0&&Qe.isPresenting===!0){let e=k.xr.getDepthSensingMesh();e!==null&&mt(e,t,-1/0,k.sortObjects)}mt(e,t,0,k.sortObjects),w.finish(),k.sortObjects===!0&&w.sort(ue,de,t.reversedDepth),xe=Qe.enabled===!1||Qe.isPresenting===!1||Qe.hasDepthSensing()===!1,xe&&Re.addToRenderList(w,e),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),R===!0&&Pe.beginShadows();let i=T.state.shadowsArray;if(Ie.render(i,e,t),R===!0&&Pe.endShadows(),(r&&O.hasRenderPass())===!1){let n=w.opaque,r=w.transmissive;if(T.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];gt(n,r,e,a)}xe&&Re.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];ht(w,e,n,n.viewport)}}else r.length>0&&gt(n,r,e,t),xe&&Re.render(e),ht(w,e,t)}te!==null&&ee===0&&(W.updateMultisampleRenderTarget(te),W.updateRenderTargetMipmap(te)),r&&O.end(k),e.isScene===!0&&e.onAfterRender(k,e,t),Ye.resetDefaultState(),ne=-1,re=null,D.pop(),D.length>0?(T=D[D.length-1],W.setTextureUnits(T.state.textureUnits),R===!0&&Pe.setGlobalState(k.clippingPlanes,T.state.camera)):T=null,E.pop(),w=E.length>0?E[E.length-1]:null,j!==null&&j.renderEnd()};function mt(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)T.pushLightProbeGrid(e);else if(e.isLight)T.pushLight(e),e.castShadow&&T.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ge.intersectsSprite(e)){r&&ye.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ve);let t=ke.update(e),i=e.material;i.visible&&w.push(e,t,i,n,ye.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ge.intersectsObject(e))){let t=ke.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ye.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ye.copy(e.boundingSphere.center)),ye.applyMatrix4(e.matrixWorld).applyMatrix4(ve)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&w.push(e,t,s,n,ye.z,o)}}else i.visible&&w.push(e,t,i,n,ye.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)mt(i[e],t,n,r)}function ht(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;T.setupLightsView(n),R===!0&&Pe.setGlobalState(k.clippingPlanes,n),r&&H.viewport(I.copy(r)),i.length>0&&_t(i,t,n),a.length>0&&_t(a,t,n),o.length>0&&_t(o,t,n),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function gt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[r.id]===void 0){let e=Ce.has(`EXT_color_buffer_half_float`)||Ce.has(`EXT_color_buffer_float`);T.state.transmissionRenderTarget[r.id]=new gi(1,1,{generateMipmaps:!0,type:e?We:Le,minFilter:Fe,samples:Math.max(4,we.samples),stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ri.workingColorSpace})}let i=T.state.transmissionRenderTarget[r.id],o=r.viewport||I;i.setSize(o.z*k.transmissionResolutionScale,o.w*k.transmissionResolutionScale);let s=k.getRenderTarget(),c=k.getActiveCubeFace(),l=k.getActiveMipmapLevel();k.setRenderTarget(i),k.getClearColor(oe),se=k.getClearAlpha(),se<1&&k.setClearColor(16777215,.5),k.clear(),xe&&Re.render(n);let u=k.toneMapping;k.toneMapping=he;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),T.setupLightsView(r),R===!0&&Pe.setGlobalState(k.clippingPlanes,r),_t(e,n,r),W.updateMultisampleRenderTarget(i),W.updateRenderTargetMipmap(i),Ce.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===m&&a.layers.test(r.layers)){let t=s.side;s.side=p,s.needsUpdate=!0,vt(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(W.updateMultisampleRenderTarget(i),W.updateRenderTargetMipmap(i))}k.setRenderTarget(s,c,l),k.setClearColor(oe,se),d!==void 0&&(r.viewport=d),k.toneMapping=u}function _t(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&vt(o,t,n,s,l,c)}}function vt(e,t,n,r,i,a){e.onBeforeRender(k,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(k,t,n,r,e,a),i.transparent===!0&&i.side===m&&i.forceSinglePass===!1?(i.side=p,i.needsUpdate=!0,k.renderBufferDirect(n,t,r,i,e,a),i.side=f,i.needsUpdate=!0,k.renderBufferDirect(n,t,r,i,e,a),i.side=m):k.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(k,t,n,r,i,a)}function yt(e,t,n){t.isScene!==!0&&(t=be);let r=U.get(e),i=T.state.lights,a=T.state.shadowsArray,o=i.state.version,s=Ae.getParameters(e,i.state,a,t,n,T.state.lightProbeGridArray),c=Ae.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=Ee.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,rt),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return xt(e,s),d}else s.uniforms=Ae.getUniforms(e),j!==null&&e.isNodeMaterial&&j.build(e,n,s),e.onBeforeCompile(s,k),d=Ae.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=Pe.uniform),xt(e,s),r.needsLights=Tt(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.lightProbeGrid=T.state.lightProbeGridArray.length>0,r.currentProgram=d,r.uniformsList=null,d}function bt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=og.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function xt(e,t){let n=U.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function St(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];C.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.texture!==null&&n.boundingBox.containsPoint(C))return n}return null}function Ct(e,t,n,r,i){t.isScene!==!0&&(t=be),W.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ri.workingColorSpace,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=Ee.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=he;r.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(h=k.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=U.get(r),y=T.state.lights;if(R===!0&&(_e===!0||e!==re)){let t=e===re&&r.id===ne;Pe.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Pe.numPlanes||v.numIntersection!==Pe.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=T.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let x=v.currentProgram;b===!0&&(x=yt(r,t,i),j&&r.isNodeMaterial&&j.onUpdateProgram(r,x,v));let S=!1,C=!1,w=!1,E=x.getUniforms(),D=v.uniforms;if(H.useProgram(x.program)&&(S=!0,C=!0,w=!0),r.id!==ne&&(ne=r.id,C=!0),v.needsLights){let e=St(T.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,C=!0)}if(S||re!==e){H.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),E.setValue(B,`projectionMatrix`,e.projectionMatrix),E.setValue(B,`viewMatrix`,e.matrixWorldInverse);let t=E.map.cameraPosition;t!==void 0&&t.setValue(B,z.setFromMatrixPosition(e.matrixWorld)),we.logarithmicDepthBuffer&&E.setValue(B,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&E.setValue(B,`isOrthographic`,e.isOrthographicCamera===!0),re!==e&&(re=e,C=!0,w=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&E.setValue(B,`directionalShadowMap`,y.state.directionalShadowMap,W),y.state.spotShadowMap.length>0&&E.setValue(B,`spotShadowMap`,y.state.spotShadowMap,W),y.state.pointShadowMap.length>0&&E.setValue(B,`pointShadowMap`,y.state.pointShadowMap,W)),i.isSkinnedMesh){E.setOptional(B,i,`bindMatrix`),E.setOptional(B,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),E.setValue(B,`boneTexture`,e.boneTexture,W))}i.isBatchedMesh&&(E.setOptional(B,i,`batchingTexture`),E.setValue(B,`batchingTexture`,i._matricesTexture,W),E.setOptional(B,i,`batchingIdTexture`),E.setValue(B,`batchingIdTexture`,i._indirectTexture,W),E.setOptional(B,i,`batchingColorTexture`),i._colorsTexture!==null&&E.setValue(B,`batchingColorTexture`,i._colorsTexture,W));let O=n.morphAttributes;if((O.position!==void 0||O.normal!==void 0||O.color!==void 0)&&ze.update(i,n,x),(C||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,E.setValue(B,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(D.envMapIntensity.value=t.environmentIntensity),D.dfgLUT!==void 0&&(D.dfgLUT.value=D_()),C){if(E.setValue(B,`toneMappingExposure`,k.toneMappingExposure),v.needsLights&&wt(D,w),a&&r.fog===!0&&je.refreshFogUniforms(D,a),je.refreshMaterialUniforms(D,r,le,ce,T.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;D.probesSH.value=e.texture,D.probesMin.value.copy(e.boundingBox.min),D.probesMax.value.copy(e.boundingBox.max),D.probesResolution.value.copy(e.resolution)}og.upload(B,bt(v),D,W)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(og.upload(B,bt(v),D,W),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&E.setValue(B,`center`,i.center),E.setValue(B,`modelViewMatrix`,i.modelViewMatrix),E.setValue(B,`normalMatrix`,i.normalMatrix),E.setValue(B,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Xe.update(n,x),Xe.bind(n,x)}}return x}function wt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Tt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(e,t,n){let r=U.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),U.get(e.texture).__webglTexture=t,U.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=U.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0},this.setRenderTarget=function(e,t=0,n=0){te=e,F=t,ee=n;let r=null,i=!1,a=!1;if(e){let o=U.get(e);if(o.__useDefaultFramebuffer!==void 0){H.bindFramebuffer(B.FRAMEBUFFER,o.__webglFramebuffer),I.copy(e.viewport),ie.copy(e.scissor),ae=e.scissorTest,H.viewport(I),H.scissor(ie),H.setScissorTest(ae),ne=-1;return}if(o.__webglFramebuffer===void 0)W.setupRenderTarget(e);else if(o.__hasExternalTextures)W.rebindTextures(e,U.get(e.texture).__webglTexture,U.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&U.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.`);W.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=U.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&W.useMultisampledRTT(e)===!1?U.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,I.copy(e.viewport),ie.copy(e.scissor),ae=e.scissorTest}else I.copy(fe).multiplyScalar(le).floor(),ie.copy(pe).multiplyScalar(le).floor(),ae=me;if(n!==0&&(r=M),H.bindFramebuffer(B.FRAMEBUFFER,r)&&H.drawBuffers(e,r),H.viewport(I),H.scissor(ie),H.setScissorTest(ae),i){let r=U.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=U.get(e.textures[t]);B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=U.get(e.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,t.__webglTexture,n)}ne=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){H.bindFramebuffer(B.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),!we.textureFormatReadable(c)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!we.textureTypeReadable(l)){_r(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&B.readPixels(t,n,r,i,Je.convert(c),Je.convert(l),a)}finally{let e=te===null?null:U.get(te).__webglFramebuffer;H.bindFramebuffer(B.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){H.bindFramebuffer(B.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+s),!we.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!we.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.bufferData(B.PIXEL_PACK_BUFFER,a.byteLength,B.STREAM_READ),B.readPixels(t,n,r,i,Je.convert(l),Je.convert(u),0);let f=te===null?null:U.get(te).__webglFramebuffer;H.bindFramebuffer(B.FRAMEBUFFER,f);let p=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await yr(B,p,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,d),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,a),B.deleteBuffer(d),B.deleteSync(p),a}throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)}},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;W.setTexture2D(e,0),B.copyTexSubImage2D(B.TEXTURE_2D,n,0,0,o,s,i,a),H.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Je.convert(t.format),_=Je.convert(t.type),v;t.isData3DTexture?(W.setTexture3D(t,0),v=B.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(W.setTexture2DArray(t,0),v=B.TEXTURE_2D_ARRAY):(W.setTexture2D(t,0),v=B.TEXTURE_2D),H.activeTexture(B.TEXTURE0),H.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,t.flipY),H.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),H.pixelStorei(B.UNPACK_ALIGNMENT,t.unpackAlignment);let y=H.getParameter(B.UNPACK_ROW_LENGTH),b=H.getParameter(B.UNPACK_IMAGE_HEIGHT),x=H.getParameter(B.UNPACK_SKIP_PIXELS),S=H.getParameter(B.UNPACK_SKIP_ROWS),C=H.getParameter(B.UNPACK_SKIP_IMAGES);H.pixelStorei(B.UNPACK_ROW_LENGTH,h.width),H.pixelStorei(B.UNPACK_IMAGE_HEIGHT,h.height),H.pixelStorei(B.UNPACK_SKIP_PIXELS,l),H.pixelStorei(B.UNPACK_SKIP_ROWS,u),H.pixelStorei(B.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=U.get(e),r=U.get(t),h=U.get(n.__renderTarget),g=U.get(r.__renderTarget);H.bindFramebuffer(B.READ_FRAMEBUFFER,h.__webglFramebuffer),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,U.get(e).__webglTexture,i,d+n),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,U.get(t).__webglTexture,a,m+n)),B.blitFramebuffer(l,u,o,s,f,p,o,s,B.DEPTH_BUFFER_BIT,B.NEAREST);H.bindFramebuffer(B.READ_FRAMEBUFFER,null),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||U.has(e)){let n=U.get(e),r=U.get(t);H.bindFramebuffer(B.READ_FRAMEBUFFER,N),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,P);for(let e=0;e<c;e++)w?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,n.__webglTexture,i),T?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,r.__webglTexture,a),i===0?T?B.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):B.copyTexSubImage2D(v,a,f,p,l,u,o,s):B.blitFramebuffer(l,u,o,s,f,p,o,s,B.COLOR_BUFFER_BIT,B.NEAREST);H.bindFramebuffer(B.READ_FRAMEBUFFER,null),H.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?B.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):B.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):B.texSubImage2D(B.TEXTURE_2D,a,f,p,o,s,g,_,h);H.pixelStorei(B.UNPACK_ROW_LENGTH,y),H.pixelStorei(B.UNPACK_IMAGE_HEIGHT,b),H.pixelStorei(B.UNPACK_SKIP_PIXELS,x),H.pixelStorei(B.UNPACK_SKIP_ROWS,S),H.pixelStorei(B.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&B.generateMipmap(v),H.unbindTexture()},this.initRenderTarget=function(e){U.get(e).__webglFramebuffer===void 0&&W.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?W.setTextureCube(e,0):e.isData3DTexture?W.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?W.setTexture2DArray(e,0):W.setTexture2D(e,0),H.unbindTexture()},this.resetState=function(){F=0,ee=0,te=null,H.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return $n}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ri._getDrawingBufferColorSpace(e),t.unpackColorSpace=ri._getUnpackColorSpace()}};e.ACESFilmicToneMapping=ve,e.AddEquation=S,e.AddOperation=me,e.AdditiveAnimationBlendMode=en,e.AdditiveBlending=_,e.AgXToneMapping=ye,e.AlphaFormat=Xe,e.AlwaysCompare=Vn,e.AlwaysDepth=oe,e.AlwaysStencilFunc=Pn,e.AmbientLight=Zd,e.AnimationAction=ep,e.AnimationClip=fd,e.AnimationLoader=Cd,e.AnimationMixer=np,e.AnimationObjectGroup=$f,e.AnimationUtils=Qu,e.ArcCurve=Yc,e.ArrayCamera=wf,e.ArrowHelper=nm,e.AttachedBindMode=xe,e.Audio=Nf,e.AudioAnalyser=zf,e.AudioContext=hf,e.AudioListener=Mf,e.AudioLoader=gf,e.AxesHelper=rm,e.BackSide=p,e.BasicDepthPacking=an,e.BasicShadowMap=c,e.BatchedMesh=nc,e.BezierInterpolant=rd,e.Bone=ms,e.BooleanKeyframeTrack=ad,e.Box2=vp,e.Box3=ba,e.Box3Helper=Zp,e.BoxGeometry=Fc,e.BoxHelper=Xp,e.BufferAttribute=Ua,e.BufferGeometry=lo,e.BufferGeometryLoader=of,e.ByteType=Re,e.Cache=hd,e.Camera=zd,e.CameraHelper=qp,e.CanvasTexture=Ac,e.CapsuleGeometry=Ic,e.CatmullRomCurve3=nl,e.CineonToneMapping=_e,e.CircleGeometry=Lc,e.ClampToEdgeWrapping=W,e.Clock=pp,e.Color=Y,e.ColorKeyframeTrack=od,e.ColorManagement=ri,e.Compatibility=ir,e.CompressedArrayTexture=Dc,e.CompressedCubeTexture=Oc,e.CompressedTexture=Ec,e.CompressedTextureLoader=wd,e.ConeGeometry=zc,e.ConstantAlphaFactor=I,e.ConstantColorFactor=ne,e.Controls=am,e.CubeCamera=Cf,e.CubeDepthTexture=Nc,e.CubeReflectionMapping=V,e.CubeRefractionMapping=Ce,e.CubeTexture=kc,e.CubeTextureLoader=Dd,e.CubeUVReflectionMapping=Te,e.CubicBezierCurve=pl,e.CubicBezierCurve3=ml,e.CubicInterpolant=ed,e.CullFaceBack=a,e.CullFaceFront=o,e.CullFaceFrontBack=s,e.CullFaceNone=i,e.Curve=qc,e.CurvePath=xl,e.CustomBlending=b,e.CustomToneMapping=z,e.CylinderGeometry=Rc,e.Cylindrical=hp,e.Data3DTexture=yi,e.DataArrayTexture=_i,e.DataTexture=hs,e.DataTextureLoader=Od,e.DataUtils=za,e.DecrementStencilOp=Cn,e.DecrementWrapStencilOp=Tn,e.DefaultLoadingManager=vd,e.DepthFormat=$e,e.DepthStencilFormat=et,e.DepthTexture=Mc,e.DetachedBindMode=Se,e.DirectionalLight=Xd,e.DirectionalLightHelper=Wp,e.DiscreteInterpolant=nd,e.DodecahedronGeometry=Vc,e.DoubleSide=m,e.DstAlphaFactor=N,e.DstColorFactor=F,e.DynamicCopyUsage=Yn,e.DynamicDrawUsage=Un,e.DynamicReadUsage=Kn,e.EdgesGeometry=Kc,e.EllipseCurve=Jc,e.EqualCompare=Ln,e.EqualDepth=ce,e.EqualStencilFunc=kn,e.EquirectangularReflectionMapping=we,e.EquirectangularRefractionMapping=H,e.Euler=ji,e.EventDispatcher=xr,e.ExternalTexture=Pc,e.ExtrudeGeometry=su,e.FileLoader=Sd,e.Float16BufferAttribute=Za,e.Float32BufferAttribute=X,e.FloatType=Ue,e.Fog=ia,e.FogExp2=ra,e.FramebufferTexture=Tc,e.FrontSide=f,e.Frustum=Fs,e.FrustumArray=Ls,e.GLBufferAttribute=cp,e.GLSL1=Zn,e.GLSL3=Qn,e.GreaterCompare=zn,e.GreaterDepth=ue,e.GreaterEqualCompare=G,e.GreaterEqualDepth=le,e.GreaterEqualStencilFunc=Nn,e.GreaterStencilFunc=jn,e.GridHelper=zp,e.Group=Yi,e.HTMLTexture=jc,e.HalfFloatType=We,e.HemisphereLight=jd,e.HemisphereLightHelper=Rp,e.IcosahedronGeometry=uu,e.ImageBitmapLoader=pf,e.ImageLoader=Ed,e.ImageUtils=si,e.IncrementStencilOp=Sn,e.IncrementWrapStencilOp=wn,e.InstancedBufferAttribute=ys,e.InstancedBufferGeometry=af,e.InstancedInterleavedBuffer=sp,e.InstancedMesh=Ds,e.Int16BufferAttribute=qa,e.Int32BufferAttribute=Ya,e.Int8BufferAttribute=Wa,e.IntType=Ve,e.InterleavedBuffer=uo,e.InterleavedBufferAttribute=po,e.Interpolant=$u,e.InterpolateBezier=Yt,e.InterpolateDiscrete=Kt,e.InterpolateLinear=qt,e.InterpolateSmooth=Jt,e.InterpolationSamplingMode=rr,e.InterpolationSamplingType=nr,e.InvertStencilOp=En,e.KeepStencilOp=bn,e.KeyframeTrack=id,e.LOD=Po,e.LatheGeometry=du,e.Layers=Mi,e.LessCompare=In,e.LessDepth=se,e.LessEqualCompare=Rn,e.LessEqualDepth=L,e.LessEqualStencilFunc=An,e.LessStencilFunc=On,e.Light=Ad,e.LightProbe=ef,e.Line=uc,e.Line3=Ep,e.LineBasicMaterial=rc,e.LineCurve=hl,e.LineCurve3=gl,e.LineDashedMaterial=Gu,e.LineLoop=hc,e.LineSegments=mc,e.LinearFilter=Me,e.LinearInterpolant=td,e.LinearMipMapLinearFilter=Ie,e.LinearMipMapNearestFilter=Pe,e.LinearMipmapLinearFilter=Fe,e.LinearMipmapNearestFilter=Ne,e.LinearSRGBColorSpace=pn,e.LinearToneMapping=ge,e.LinearTransfer=mn,e.Loader=yd,e.LoaderUtils=rf,e.LoadingManager=_d,e.LoopOnce=Ut,e.LoopPingPong=Gt,e.LoopRepeat=Wt,e.MOUSE=n,e.Material=ho,e.MaterialBlending=x,e.MaterialLoader=nf,e.MathUtils=Jr,e.Matrix2=gp,e.Matrix3=Qr,e.Matrix4=xi,e.MaxEquation=E,e.Mesh=ts,e.MeshBasicMaterial=Uo,e.MeshDepthMaterial=Hu,e.MeshDistanceMaterial=Uu,e.MeshLambertMaterial=Vu,e.MeshMatcapMaterial=Wu,e.MeshNormalMaterial=Bu,e.MeshPhongMaterial=Ru,e.MeshPhysicalMaterial=Lu,e.MeshStandardMaterial=Iu,e.MeshToonMaterial=zu,e.MinEquation=T,e.MirroredRepeatWrapping=Ee,e.MixOperation=pe,e.MultiplyBlending=y,e.MultiplyOperation=fe,e.NearestFilter=De,e.NearestMipMapLinearFilter=je,e.NearestMipMapNearestFilter=ke,e.NearestMipmapLinearFilter=Ae,e.NearestMipmapNearestFilter=Oe,e.NeutralToneMapping=be,e.NeverCompare=Fn,e.NeverDepth=ae,e.NeverStencilFunc=Dn,e.NoBlending=h,e.NoColorSpace=dn,e.NoNormalPacking=gn,e.NoToneMapping=he,e.NormalAnimationBlendMode=$t,e.NormalBlending=g,e.NormalGAPacking=vn,e.NormalRGPacking=_n,e.NotEqualCompare=Bn,e.NotEqualDepth=de,e.NotEqualStencilFunc=Mn,e.NumberKeyframeTrack=sd,e.Object3D=Ji,e.ObjectLoader=cf,e.ObjectSpaceNormalMap=un,e.OctahedronGeometry=fu,e.OneFactor=O,e.OneMinusConstantAlphaFactor=ie,e.OneMinusConstantColorFactor=re,e.OneMinusDstAlphaFactor=P,e.OneMinusDstColorFactor=ee,e.OneMinusSrcAlphaFactor=M,e.OneMinusSrcColorFactor=A,e.OrthographicCamera=Jd,e.PCFShadowMap=l,e.PCFSoftShadowMap=u,e.PMREMGenerator=Fm,e.Path=Sl,e.PerspectiveCamera=Ud,e.Plane=js,e.PlaneGeometry=pu,e.PlaneHelper=Qp,e.PointLight=qd,e.PointLightHelper=Pp,e.Points=xc,e.PointsMaterial=gc,e.PolarGridHelper=Bp,e.PolyhedronGeometry=Bc,e.PositionalAudio=Rf,e.PropertyBinding=Qf,e.PropertyMixer=Bf,e.QuadraticBezierCurve=_l,e.QuadraticBezierCurve3=vl,e.Quaternion=Yr,e.QuaternionKeyframeTrack=ld,e.QuaternionLinearInterpolant=cd,e.R11_EAC_Format=vt,e.RED_GREEN_RGTC2_Format=Vt,e.RED_RGTC1_Format=zt,e.REVISION=t,e.RG11_EAC_Format=bt,e.RGBADepthPacking=on,e.RGBAFormat=Qe,e.RGBAIntegerFormat=ot,e.RGBA_ASTC_10x10_Format=Nt,e.RGBA_ASTC_10x5_Format=At,e.RGBA_ASTC_10x6_Format=jt,e.RGBA_ASTC_10x8_Format=Mt,e.RGBA_ASTC_12x10_Format=Pt,e.RGBA_ASTC_12x12_Format=Ft,e.RGBA_ASTC_4x4_Format=St,e.RGBA_ASTC_5x4_Format=Ct,e.RGBA_ASTC_5x5_Format=wt,e.RGBA_ASTC_6x5_Format=Tt,e.RGBA_ASTC_6x6_Format=Et,e.RGBA_ASTC_8x5_Format=Dt,e.RGBA_ASTC_8x6_Format=Ot,e.RGBA_ASTC_8x8_Format=kt,e.RGBA_BPTC_Format=It,e.RGBA_ETC2_EAC_Format=_t,e.RGBA_PVRTC_2BPPV1_Format=mt,e.RGBA_PVRTC_4BPPV1_Format=pt,e.RGBA_S3TC_DXT1_Format=ct,e.RGBA_S3TC_DXT3_Format=lt,e.RGBA_S3TC_DXT5_Format=ut,e.RGBDepthPacking=sn,e.RGBFormat=Ze,e.RGBIntegerFormat=at,e.RGB_BPTC_SIGNED_Format=Lt,e.RGB_BPTC_UNSIGNED_Format=Rt,e.RGB_ETC1_Format=ht,e.RGB_ETC2_Format=gt,e.RGB_PVRTC_2BPPV1_Format=ft,e.RGB_PVRTC_4BPPV1_Format=dt,e.RGB_S3TC_DXT1_Format=st,e.RGDepthPacking=cn,e.RGFormat=rt,e.RGIntegerFormat=it,e.RawShaderMaterial=Fu,e.Ray=Ho,e.Raycaster=up,e.RectAreaLight=Qd,e.RedFormat=tt,e.RedIntegerFormat=nt,e.ReinhardToneMapping=R,e.RenderTarget=hi,e.RenderTarget3D=rp,e.RepeatWrapping=U,e.ReplaceStencilOp=xn,e.ReverseSubtractEquation=w,e.RingGeometry=mu,e.SIGNED_R11_EAC_Format=yt,e.SIGNED_RED_GREEN_RGTC2_Format=Ht,e.SIGNED_RED_RGTC1_Format=Bt,e.SIGNED_RG11_EAC_Format=xt,e.SRGBColorSpace=fn,e.SRGBTransfer=hn,e.Scene=aa,e.ShaderChunk=mm,e.ShaderLib=hm,e.ShaderMaterial=Pu,e.ShadowMaterial=Tu,e.Shape=Cl,e.ShapeGeometry=hu,e.ShapePath=im,e.ShapeUtils=iu,e.ShortType=ze,e.Skeleton=vs,e.SkeletonHelper=Mp,e.SkinnedMesh=ps,e.Source=li,e.Sphere=to,e.SphereGeometry=_u,e.Spherical=mp,e.SphericalHarmonics3=$d,e.SplineCurve=yl,e.SpotLight=Gd,e.SpotLightHelper=Op,e.Sprite=Ao,e.SpriteMaterial=go,e.SrcAlphaFactor=j,e.SrcAlphaSaturateFactor=te,e.SrcColorFactor=k,e.StaticCopyUsage=Jn,e.StaticDrawUsage=Hn,e.StaticReadUsage=Gn,e.StereoCamera=bf,e.StreamCopyUsage=Xn,e.StreamDrawUsage=Wn,e.StreamReadUsage=qn,e.StringKeyframeTrack=ud,e.SubtractEquation=C,e.SubtractiveBlending=v,e.TOUCH=r,e.TangentSpaceNormalMap=ln,e.TetrahedronGeometry=vu,e.Texture=pi,e.TextureLoader=kd,e.TextureUtils=dm,e.Timer=Tf,e.TimestampQuery=tr,e.TorusGeometry=yu,e.TorusKnotGeometry=bu,e.Triangle=ya,e.TriangleFanDrawMode=rn,e.TriangleStripDrawMode=nn,e.TrianglesDrawMode=tn,e.TubeGeometry=xu,e.UVMapping=B,e.Uint16BufferAttribute=Ja,e.Uint32BufferAttribute=Xa,e.Uint8BufferAttribute=Ga,e.Uint8ClampedBufferAttribute=Ka,e.Uniform=ip,e.UniformsGroup=op,e.UniformsLib=Q,e.UniformsUtils=ju,e.UnsignedByteType=Le,e.UnsignedInt101111Type=Ye,e.UnsignedInt248Type=qe,e.UnsignedInt5999Type=Je,e.UnsignedIntType=He,e.UnsignedShort4444Type=Ge,e.UnsignedShort5551Type=Ke,e.UnsignedShortType=Be,e.VSMShadowMap=d,e.Vector2=q,e.Vector3=J,e.Vector4=mi,e.VectorKeyframeTrack=dd,e.VideoFrameTexture=wc,e.VideoTexture=Cc,e.WebGL3DRenderTarget=bi,e.WebGLArrayRenderTarget=vi,e.WebGLCoordinateSystem=$n,e.WebGLCubeRenderTarget=Wm,e.WebGLRenderTarget=gi,e.WebGLRenderer=O_,e.WebGLUtils=g_,e.WebGPUCoordinateSystem=er,e.WebXRController=Zi,e.WireframeGeometry=Su,e.WrapAroundEnding=Qt,e.ZeroCurvatureEnding=Xt,e.ZeroFactor=D,e.ZeroSlopeEnding=Zt,e.ZeroStencilOp=yn,e.createCanvasElement=ur,e.error=_r,e.getConsoleFunction=mr,e.log=hr,e.setConsoleFunction=pr,e.warn=K,e.warnOnce=vr}));function uv(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function dv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fv(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function pv(...e){let t=`THREE.`+e.shift();Py?Py(`log`,t,...e):console.log(t,...e)}function mv(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function hv(...e){e=mv(e);let t=`THREE.`+e.shift();if(Py)Py(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function gv(...e){e=mv(e);let t=`THREE.`+e.shift();if(Py)Py(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function _v(...e){let t=e.join(` `);t in Ny||(Ny[t]=!0,hv(...e))}function vv(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Iy[e&255]+Iy[e>>8&255]+Iy[e>>16&255]+Iy[e>>24&255]+`-`+Iy[t&255]+Iy[t>>8&255]+`-`+Iy[t>>16&15|64]+Iy[t>>24&255]+`-`+Iy[n&63|128]+Iy[n>>8&255]+`-`+Iy[n>>16&255]+Iy[n>>24&255]+Iy[r&255]+Iy[r>>8&255]+Iy[r>>16&255]+Iy[r>>24&255]).toLowerCase()}function yv(e,t,n){return Math.max(t,Math.min(n,e))}function bv(e,t){return(e%t+t)%t}function xv(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Sv(e,t,n){return e===t?0:(n-e)/(t-e)}function Cv(e,t,n){return(1-n)*e+n*t}function wv(e,t,n,r){return Cv(e,t,1-Math.exp(-n*r))}function Tv(e,t=1){return t-Math.abs(bv(e,t*2)-t)}function Ev(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Dv(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Ov(e,t){return e+Math.floor(Math.random()*(t-e+1))}function kv(e,t){return e+Math.random()*(t-e)}function Av(e){return e*(.5-Math.random())}function jv(e){e!==void 0&&(Ly=e);let t=Ly+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Mv(e){return e*Ry}function Nv(e){return e*zy}function Pv(e){return!(e&e-1)&&e!==0}function Fv(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Iv(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Lv(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:hv(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Rv(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function zv(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function Bv(){let e={enabled:!0,workingColorSpace:Dy,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=Vv(e.r),e.g=Vv(e.g),e.b=Vv(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Hv(e.r),e.g=Hv(e.g),e.b=Hv(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Oy:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return _v(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return _v(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Dy]:{primaries:t,whitePoint:r,transfer:Oy,toXYZ:qy,fromXYZ:Jy,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ey},outputColorSpaceConfig:{drawingBufferColorSpace:Ey}},[Ey]:{primaries:t,whitePoint:r,transfer:ky,toXYZ:qy,fromXYZ:Jy,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ey}}}),e}function Vv(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Hv(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function Uv(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Zy.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(hv(`Texture: Unable to serialize Texture.`),{})}function Wv(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function Gv(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){dx.fromArray(e,a);let o=i.x*Math.abs(dx.x)+i.y*Math.abs(dx.y)+i.z*Math.abs(dx.z),s=t.dot(dx),c=n.dot(dx),l=r.dot(dx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function Kv(e,t,n,r,i,a){Vx.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Hx.copy(Vx):(Hx.x=a*Vx.x-i*Vx.y,Hx.y=i*Vx.x+a*Vx.y),e.copy(t),e.x+=Hx.x,e.y+=Hx.y,e.applyMatrix4(Ux)}function qv(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;gS.copy(s),gS.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(gS);return l<n.near||l>n.far?null:{distance:l,point:gS.clone(),object:e}}function Jv(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,uS),e.getVertexPosition(c,dS),e.getVertexPosition(l,fS);let u=qv(e,t,n,r,uS,dS,fS,hS);if(u){let e=new $;Zb.getBarycoord(hS,uS,dS,fS,e),i&&(u.uv=Zb.getInterpolatedAttribute(i,s,c,l,e,new Vy)),a&&(u.uv1=Zb.getInterpolatedAttribute(a,s,c,l,e,new Vy)),o&&(u.normal=Zb.getInterpolatedAttribute(o,s,c,l,e,new $),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new $,materialIndex:0};Zb.getNormal(uS,dS,fS,t.normal),u.face=t,u.barycoord=e}return u}function Yv(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(ZS.fromBufferAttribute(s,i),QS.fromBufferAttribute(s,a),n.distanceSqToSegment(ZS,QS,nC,rC)>r)return;nC.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(nC);if(!(c<t.near||c>t.far))return{distance:c,point:rC.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}function Xv(e,t,n,r,i,a,o){let s=dC.distanceSqToPoint(e);if(s<n){let n=new $;dC.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}function Zv(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function Qv(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function $v(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function ey(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0){if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}}function ty(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return EC;case`vector`:case`vector2`:case`vector3`:case`vector4`:return AC;case`color`:return TC;case`quaternion`:return OC;case`bool`:case`boolean`:return wC;case`string`:return kC}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function ny(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let t=ty(e.type);if(e.times===void 0){let t=[],n=[];ey(e.keys,t,n,`value`),e.times=t,e.values=n}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function ry(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}var iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy,By,Vy,Hy,$,Uy,Wy,Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb,ub,db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw=p((()=>{iy=`attached`,ay=1e3,oy=1001,sy=1002,cy=1003,ly=1004,uy=1005,dy=1006,fy=1007,py=1008,my=1009,hy=1015,gy=1023,_y=1028,vy=2300,yy=2301,by=2302,xy=2303,Sy=2400,Cy=2401,wy=2402,Ty=2500,Ey=`srgb`,Dy=`srgb-linear`,Oy=`linear`,ky=`srgb`,Ay=7680,jy=35044,My=2e3,Ny={},Py=null,Fy=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Iy=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),Ly=1234567,Ry=Math.PI/180,zy=180/Math.PI,By={DEG2RAD:Ry,RAD2DEG:zy,generateUUID:vv,clamp:yv,euclideanModulo:bv,mapLinear:xv,inverseLerp:Sv,lerp:Cv,damp:wv,pingpong:Tv,smoothstep:Ev,smootherstep:Dv,randInt:Ov,randFloat:kv,randFloatSpread:Av,seededRandom:jv,degToRad:Mv,radToDeg:Nv,isPowerOfTwo:Pv,ceilPowerOfTwo:Fv,floorPowerOfTwo:Iv,setQuaternionFromProperEuler:Lv,normalize:zv,denormalize:Rv},Vy=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(yv(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Hy=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:hv(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yv(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},$=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Wy.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Wy.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this.z=yv(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this.z=yv(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Uy.copy(this).projectOnVector(e),this.sub(Uy)}reflect(e){return this.sub(Uy.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(yv(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Uy=new $,Wy=new Hy,Gy=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return _v(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Ky.makeScale(e,t)),this}rotate(e){return _v(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Ky.makeRotation(-e)),this}translate(e,t){return _v(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Ky.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Ky=new Gy,qy=new Gy().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Jy=new Gy().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Yy=Bv(),Zy=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Xy===void 0&&(Xy=fv(`canvas`)),Xy.width=e.width,Xy.height=e.height;let t=Xy.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Xy}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=fv(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Vv(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Vv(t[e]/255)*255):t[e]=Vv(t[e]);return{data:t,width:e.width,height:e.height}}return hv(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Qy=0,$y=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Qy++}),this.uuid=vv(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Uv(r[t].image)):e.push(Uv(r[t]))}else e=Uv(r);n.url=e}return t||(e.images[this.uuid]=n),n}},eb=0,tb=new $,nb=class e extends Fy{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=oy,i=oy,a=dy,o=py,s=gy,c=my,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eb++}),this.uuid=vv(),this.name=``,this.source=new $y(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new Vy(0,0),this.repeat=new Vy(1,1),this.center=new Vy(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gy,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(tb).x}get height(){return this.source.getSize(tb).y}get depth(){return this.source.getSize(tb).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){hv(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){hv(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ay:e.x-=Math.floor(e.x);break;case oy:e.x=e.x<0?0:1;break;case sy:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ay:e.y-=Math.floor(e.y);break;case oy:e.y=e.y<0?0:1;break;case sy:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},nb.DEFAULT_IMAGE=null,nb.DEFAULT_MAPPING=300,nb.DEFAULT_ANISOTROPY=1,rb=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=yv(this.x,e.x,t.x),this.y=yv(this.y,e.y,t.y),this.z=yv(this.z,e.z,t.z),this.w=yv(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=yv(this.x,e,t),this.y=yv(this.y,e,t),this.z=yv(this.z,e,t),this.w=yv(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(yv(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},ib=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/ab.setFromMatrixColumn(e,0).length(),i=1/ab.setFromMatrixColumn(e,1).length(),a=1/ab.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sb,e,cb)}lookAt(e,t,n){let r=this.elements;return db.subVectors(e,t),db.lengthSq()===0&&(db.z=1),db.normalize(),lb.crossVectors(n,db),lb.lengthSq()===0&&(Math.abs(n.z)===1?db.x+=1e-4:db.z+=1e-4,db.normalize(),lb.crossVectors(n,db)),lb.normalize(),ub.crossVectors(db,lb),r[0]=lb.x,r[4]=ub.x,r[8]=db.x,r[1]=lb.y,r[5]=ub.y,r[9]=db.y,r[2]=lb.z,r[6]=ub.z,r[10]=db.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=ab.set(r[0],r[1],r[2]).length(),o=ab.set(r[4],r[5],r[6]).length(),s=ab.set(r[8],r[9],r[10]).length();i<0&&(a=-a),ob.copy(this);let c=1/a,l=1/o,u=1/s;return ob.elements[0]*=c,ob.elements[1]*=c,ob.elements[2]*=c,ob.elements[4]*=l,ob.elements[5]*=l,ob.elements[6]*=l,ob.elements[8]*=u,ob.elements[9]*=u,ob.elements[10]*=u,t.setFromRotationMatrix(ob),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=My,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=My,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},ab=new $,ob=new ib,sb=new $(0,0,0),cb=new $(1,1,1),lb=new $,ub=new $,db=new $,fb=new ib,pb=new Hy,mb=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(yv(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-yv(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(yv(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-yv(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(yv(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-yv(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:hv(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fb,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return pb.setFromEuler(this),this.setFromQuaternion(pb,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},mb.DEFAULT_ORDER=`XYZ`,hb=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&(1<<e|0))}},gb=0,_b=new $,vb=new Hy,yb=new ib,bb=new $,xb=new $,Sb=new $,Cb=new Hy,wb=new $(1,0,0),Tb=new $(0,1,0),Eb=new $(0,0,1),Db={type:`added`},Ob={type:`removed`},kb={type:`childadded`,child:null},Ab={type:`childremoved`,child:null},jb=class e extends Fy{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gb++}),this.uuid=vv(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new $,n=new mb,r=new Hy,i=new $(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ib},normalMatrix:{value:new Gy}}),this.matrix=new ib,this.matrixWorld=new ib,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hb,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return vb.setFromAxisAngle(e,t),this.quaternion.multiply(vb),this}rotateOnWorldAxis(e,t){return vb.setFromAxisAngle(e,t),this.quaternion.premultiply(vb),this}rotateX(e){return this.rotateOnAxis(wb,e)}rotateY(e){return this.rotateOnAxis(Tb,e)}rotateZ(e){return this.rotateOnAxis(Eb,e)}translateOnAxis(e,t){return _b.copy(e).applyQuaternion(this.quaternion),this.position.add(_b.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wb,e)}translateY(e){return this.translateOnAxis(Tb,e)}translateZ(e){return this.translateOnAxis(Eb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(yb.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?bb.copy(e):bb.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),xb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yb.lookAt(xb,bb,this.up):yb.lookAt(bb,xb,this.up),this.quaternion.setFromRotationMatrix(yb),r&&(yb.extractRotation(r.matrixWorld),vb.setFromRotationMatrix(yb),this.quaternion.premultiply(vb.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(gv(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Db),kb.child=e,this.dispatchEvent(kb),kb.child=null):gv(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ob),Ab.child=e,this.dispatchEvent(Ab),Ab.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),yb.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),yb.multiply(e.parent.matrixWorld)),e.applyMatrix4(yb),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Db),kb.child=e,this.dispatchEvent(kb),kb.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xb,e,Sb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xb,Cb,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}},jb.DEFAULT_UP=new $(0,1,0),jb.DEFAULT_MATRIX_AUTO_UPDATE=!0,jb.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Mb=class extends jb{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Nb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pb={h:0,s:0,l:0},Fb={h:0,s:0,l:0},Ib=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ey){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yy.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Yy.workingColorSpace){return this.r=e,this.g=t,this.b=n,Yy.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Yy.workingColorSpace){if(e=bv(e,1),t=yv(t,0,1),n=yv(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Wv(i,r,e+1/3),this.g=Wv(i,r,e),this.b=Wv(i,r,e-1/3)}return Yy.colorSpaceToWorking(this,r),this}setStyle(e,t=Ey){function n(t){t!==void 0&&parseFloat(t)<1&&hv(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:hv(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);hv(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ey){let n=Nb[e.toLowerCase()];return n===void 0?hv(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Vv(e.r),this.g=Vv(e.g),this.b=Vv(e.b),this}copyLinearToSRGB(e){return this.r=Hv(e.r),this.g=Hv(e.g),this.b=Hv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ey){return Yy.workingToColorSpace(Lb.copy(this),e),Math.round(yv(Lb.r*255,0,255))*65536+Math.round(yv(Lb.g*255,0,255))*256+Math.round(yv(Lb.b*255,0,255))}getHexString(e=Ey){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yy.workingColorSpace){Yy.workingToColorSpace(Lb.copy(this),t);let n=Lb.r,r=Lb.g,i=Lb.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=Yy.workingColorSpace){return Yy.workingToColorSpace(Lb.copy(this),t),e.r=Lb.r,e.g=Lb.g,e.b=Lb.b,e}getStyle(e=Ey){Yy.workingToColorSpace(Lb.copy(this),e);let t=Lb.r,n=Lb.g,r=Lb.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Pb),this.setHSL(Pb.h+e,Pb.s+t,Pb.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Pb),e.getHSL(Fb);let n=Cv(Pb.h,Fb.h,t),r=Cv(Pb.s,Fb.s,t),i=Cv(Pb.l,Fb.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Lb=new Ib,Ib.NAMES=Nb,Rb=new $,zb=new $,Bb=new $,Vb=new $,Hb=new $,Ub=new $,Wb=new $,Gb=new $,Kb=new $,qb=new $,Jb=new rb,Yb=new rb,Xb=new rb,Zb=class e{constructor(e=new $,t=new $,n=new $){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Rb.subVectors(e,t),r.cross(Rb);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Rb.subVectors(r,t),zb.subVectors(n,t),Bb.subVectors(e,t);let a=Rb.dot(Rb),o=Rb.dot(zb),s=Rb.dot(Bb),c=zb.dot(zb),l=zb.dot(Bb),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Vb)!==null&&Vb.x>=0&&Vb.y>=0&&Vb.x+Vb.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Vb)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Vb.x),s.addScaledVector(a,Vb.y),s.addScaledVector(o,Vb.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Jb.setScalar(0),Yb.setScalar(0),Xb.setScalar(0),Jb.fromBufferAttribute(e,t),Yb.fromBufferAttribute(e,n),Xb.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Jb,i.x),a.addScaledVector(Yb,i.y),a.addScaledVector(Xb,i.z),a}static isFrontFacing(e,t,n,r){return Rb.subVectors(n,t),zb.subVectors(e,t),Rb.cross(zb).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Rb.subVectors(this.c,this.b),zb.subVectors(this.a,this.b),Rb.cross(zb).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Hb.subVectors(r,n),Ub.subVectors(i,n),Gb.subVectors(e,n);let s=Hb.dot(Gb),c=Ub.dot(Gb);if(s<=0&&c<=0)return t.copy(n);Kb.subVectors(e,r);let l=Hb.dot(Kb),u=Ub.dot(Kb);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Hb,a);qb.subVectors(e,i);let f=Hb.dot(qb),p=Ub.dot(qb);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Ub,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Wb.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Wb,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Hb,a).addScaledVector(Ub,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Qb=class{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(ex.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ex.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=ex.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,ex):ex.fromBufferAttribute(r,t),ex.applyMatrix4(e.matrixWorld),this.expandByPoint(ex);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),tx.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),tx.copy(e.boundingBox)),tx.applyMatrix4(e.matrixWorld),this.union(tx)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ex),ex.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(cx),lx.subVectors(this.max,cx),nx.subVectors(e.a,cx),rx.subVectors(e.b,cx),ix.subVectors(e.c,cx),ax.subVectors(rx,nx),ox.subVectors(ix,rx),sx.subVectors(nx,ix);let t=[0,-ax.z,ax.y,0,-ox.z,ox.y,0,-sx.z,sx.y,ax.z,0,-ax.x,ox.z,0,-ox.x,sx.z,0,-sx.x,-ax.y,ax.x,0,-ox.y,ox.x,0,-sx.y,sx.x,0];return!Gv(t,nx,rx,ix,lx)||(t=[1,0,0,0,1,0,0,0,1],!Gv(t,nx,rx,ix,lx))?!1:(ux.crossVectors(ax,ox),t=[ux.x,ux.y,ux.z],Gv(t,nx,rx,ix,lx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ex).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ex).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($b[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$b[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$b[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$b[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$b[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$b[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$b[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$b[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($b),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},$b=[new $,new $,new $,new $,new $,new $,new $,new $],ex=new $,tx=new Qb,nx=new $,rx=new $,ix=new $,ax=new $,ox=new $,sx=new $,cx=new $,lx=new $,ux=new $,dx=new $,fx=new $,px=new Vy,mx=0,hx=class extends Fy{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:mx++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=jy,this.updateRanges=[],this.gpuType=hy,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)px.fromBufferAttribute(this,t),px.applyMatrix3(e),this.setXY(t,px.x,px.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyMatrix3(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyMatrix4(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.applyNormalMatrix(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fx.fromBufferAttribute(this,t),fx.transformDirection(e),this.setXYZ(t,fx.x,fx.y,fx.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Rv(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=zv(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Rv(t,this.array)),t}setX(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Rv(t,this.array)),t}setY(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Rv(t,this.array)),t}setZ(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Rv(t,this.array)),t}setW(e,t){return this.normalized&&(t=zv(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array),i=zv(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},gx=class extends hx{constructor(e,t,n){super(new Uint16Array(e),t,n)}},_x=class extends hx{constructor(e,t,n){super(new Uint32Array(e),t,n)}},vx=class extends hx{constructor(e,t,n){super(new Float32Array(e),t,n)}},yx=new Qb,bx=new $,xx=new $,Sx=class{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?yx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;bx.subVectors(e,this.center);let t=bx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(bx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(xx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(bx.copy(e.center).add(xx)),this.expandByPoint(bx.copy(e.center).sub(xx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Cx=0,wx=new ib,Tx=new jb,Ex=new $,Dx=new Qb,Ox=new Qb,kx=new $,Ax=class e extends Fy{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Cx++}),this.uuid=vv(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(uv(e)?_x:gx)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Gy().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return wx.makeRotationFromQuaternion(e),this.applyMatrix4(wx),this}rotateX(e){return wx.makeRotationX(e),this.applyMatrix4(wx),this}rotateY(e){return wx.makeRotationY(e),this.applyMatrix4(wx),this}rotateZ(e){return wx.makeRotationZ(e),this.applyMatrix4(wx),this}translate(e,t,n){return wx.makeTranslation(e,t,n),this.applyMatrix4(wx),this}scale(e,t,n){return wx.makeScale(e,t,n),this.applyMatrix4(wx),this}lookAt(e){return Tx.lookAt(e),Tx.updateMatrix(),this.applyMatrix4(Tx.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ex).negate(),this.translate(Ex.x,Ex.y,Ex.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new vx(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&hv(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qb);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gv(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Dx.setFromBufferAttribute(n),this.morphTargetsRelative?(kx.addVectors(this.boundingBox.min,Dx.min),this.boundingBox.expandByPoint(kx),kx.addVectors(this.boundingBox.max,Dx.max),this.boundingBox.expandByPoint(kx)):(this.boundingBox.expandByPoint(Dx.min),this.boundingBox.expandByPoint(Dx.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&gv(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sx);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gv(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new $,1/0);return}if(e){let n=this.boundingSphere.center;if(Dx.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ox.setFromBufferAttribute(n),this.morphTargetsRelative?(kx.addVectors(Dx.min,Ox.min),Dx.expandByPoint(kx),kx.addVectors(Dx.max,Ox.max),Dx.expandByPoint(kx)):(Dx.expandByPoint(Ox.min),Dx.expandByPoint(Ox.max))}Dx.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)kx.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(kx));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)kx.fromBufferAttribute(a,t),o&&(Ex.fromBufferAttribute(e,t),kx.add(Ex)),r=Math.max(r,n.distanceToSquared(kx))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&gv(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){gv(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new hx(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new $,s[e]=new $;let c=new $,l=new $,u=new $,d=new Vy,f=new Vy,p=new Vy,m=new $,h=new $;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new $,y=new $,b=new $,x=new $;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new hx(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new $,i=new $,a=new $,o=new $,s=new $,c=new $,l=new $,u=new $;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)kx.fromBufferAttribute(e,t),kx.normalize(),e.setXYZ(t,kx.x,kx.y,kx.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new hx(a,r,i)}if(this.index===null)return hv(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},jx=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=jy,this.updateRanges=[],this.version=0,this.uuid=vv()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=vv()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=vv()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Mx=new $,Nx=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.applyMatrix4(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.applyNormalMatrix(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mx.fromBufferAttribute(this,t),Mx.transformDirection(e),this.setXYZ(t,Mx.x,Mx.y,Mx.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Rv(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=zv(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=zv(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Rv(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Rv(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Rv(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Rv(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=zv(t,this.array),n=zv(n,this.array),r=zv(r,this.array),i=zv(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){pv(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new hx(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){pv(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Px=0,Fx=class extends Fy{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Px++}),this.uuid=vv(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ib(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ay,this.stencilZFail=Ay,this.stencilZPass=Ay,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){hv(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){hv(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ib().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new Vy().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Vy().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Ix=class extends Fx{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new Ib(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Rx=new $,zx=new $,Bx=new $,Vx=new Vy,Hx=new Vy,Ux=new ib,Wx=new $,Gx=new $,Kx=new $,qx=new Vy,Jx=new Vy,Yx=new Vy,Xx=class extends jb{constructor(e=new Ix){if(super(),this.isSprite=!0,this.type=`Sprite`,Lx===void 0){Lx=new Ax;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new jx(e,5);Lx.setIndex([0,1,2,0,2,3]),Lx.setAttribute(`position`,new Nx(t,3,0,!1)),Lx.setAttribute(`uv`,new Nx(t,2,3,!1))}this.geometry=Lx,this.material=e,this.center=new Vy(.5,.5),this.count=1}raycast(e,t){e.camera===null&&gv(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),zx.setFromMatrixScale(this.matrixWorld),Ux.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Bx.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&zx.multiplyScalar(-Bx.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;Kv(Wx.set(-.5,-.5,0),Bx,a,zx,r,i),Kv(Gx.set(.5,-.5,0),Bx,a,zx,r,i),Kv(Kx.set(.5,.5,0),Bx,a,zx,r,i),qx.set(0,0),Jx.set(1,0),Yx.set(1,1);let o=e.ray.intersectTriangle(Wx,Gx,Kx,!1,Rx);if(o===null&&(Kv(Gx.set(-.5,.5,0),Bx,a,zx,r,i),Jx.set(0,1),o=e.ray.intersectTriangle(Wx,Kx,Gx,!1,Rx),o===null))return;let s=e.ray.origin.distanceTo(Rx);s<e.near||s>e.far||t.push({distance:s,point:Rx.clone(),uv:Zb.getInterpolation(Rx,Wx,Gx,Kx,qx,Jx,Yx,new Vy),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}},Zx=new $,Qx=new $,$x=new $,eS=new $,tS=new $,nS=new $,rS=new $,iS=class{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zx)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Zx.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zx.copy(this.origin).addScaledVector(this.direction,t),Zx.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Qx.copy(e).add(t).multiplyScalar(.5),$x.copy(t).sub(e).normalize(),eS.copy(this.origin).sub(Qx);let i=e.distanceTo(t)*.5,a=-this.direction.dot($x),o=eS.dot(this.direction),s=-eS.dot($x),c=eS.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Qx).addScaledVector($x,d),f}intersectSphere(e,t){Zx.subVectors(e.center,this.origin);let n=Zx.dot(this.direction),r=Zx.dot(Zx)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Zx)!==null}intersectTriangle(e,t,n,r,i){tS.subVectors(t,e),nS.subVectors(n,e),rS.crossVectors(tS,nS);let a=this.direction.dot(rS),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;eS.subVectors(this.origin,e);let s=o*this.direction.dot(nS.crossVectors(eS,nS));if(s<0)return null;let c=o*this.direction.dot(tS.cross(eS));if(c<0||s+c>a)return null;let l=-o*eS.dot(rS);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},aS=class extends Fx{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Ib(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mb,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},oS=new ib,sS=new iS,cS=new Sx,lS=new $,uS=new $,dS=new $,fS=new $,pS=new $,mS=new $,hS=new $,gS=new $,_S=class extends jb{constructor(e=new Ax,t=new aS){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){mS.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(pS.fromBufferAttribute(s,e),a?mS.addScaledVector(pS,r):mS.addScaledVector(pS.sub(t),r))}t.add(mS)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),cS.copy(n.boundingSphere),cS.applyMatrix4(i),sS.copy(e.ray).recast(e.near),!(cS.containsPoint(sS.origin)===!1&&(sS.intersectSphere(cS,lS)===null||sS.origin.distanceToSquared(lS)>(e.far-e.near)**2))&&(oS.copy(i).invert(),sS.copy(e.ray).applyMatrix4(oS),(n.boundingBox===null||sS.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,sS)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Jv(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Jv(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Jv(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Jv(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},vS=new rb,yS=new rb,bS=new rb,xS=new rb,SS=new ib,CS=new $,wS=new Sx,TS=new ib,ES=new iS,DS=class extends _S{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=iy,this.bindMatrix=new ib,this.bindMatrixInverse=new ib,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Qb),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,CS),this.boundingBox.expandByPoint(CS)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sx),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,CS),this.boundingSphere.expandByPoint(CS)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wS.copy(this.boundingSphere),wS.applyMatrix4(r),e.ray.intersectsSphere(wS)!==!1&&(TS.copy(r).invert(),ES.copy(e.ray).applyMatrix4(TS),(this.boundingBox===null||ES.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,ES)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new rb,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():hv(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;yS.fromBufferAttribute(r.attributes.skinIndex,e),bS.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(vS.copy(t),t.set(0,0,0,0)):(vS.set(...t,1),t.set(0,0,0)),vS.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=bS.getComponent(e);if(r!==0){let i=yS.getComponent(e);SS.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(xS.copy(vS).applyMatrix4(SS),r)}}return t.isVector4&&(t.w=vS.w),t.applyMatrix4(this.bindMatrixInverse)}},OS=class extends jb{constructor(){super(),this.isBone=!0,this.type=`Bone`}},kS=class extends nb{constructor(e=null,t=1,n=1,r,i,a,o,s,c=cy,l=cy,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},AS=new ib,jS=new ib,MS=class e{constructor(e=[],t=[]){this.uuid=vv(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){hv(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new ib)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new ib;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:jS;AS.multiplyMatrices(i,t[r]),AS.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new kS(t,e,e,gy,hy);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(hv(`Skeleton: No bone found with UUID:`,r),i=new OS),this.bones.push(i),this.boneInverses.push(new ib().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},NS=class extends hx{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},PS=new ib,FS=new ib,IS=[],LS=new Qb,RS=new ib,zS=new _S,BS=new Sx,VS=class extends _S{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new NS(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,RS)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Qb),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,PS),LS.copy(e.boundingBox).applyMatrix4(PS),this.boundingBox.union(LS)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sx),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,PS),BS.copy(e.boundingSphere).applyMatrix4(PS),this.boundingSphere.union(BS)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(zS.geometry=this.geometry,zS.material=this.material,zS.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),BS.copy(this.boundingSphere),BS.applyMatrix4(n),e.ray.intersectsSphere(BS)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,PS),FS.multiplyMatrices(n,PS),zS.matrixWorld=FS,zS.raycast(e,IS);for(let e=0,n=IS.length;e<n;e++){let n=IS[e];n.instanceId=i,n.object=this,t.push(n)}IS.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new NS(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new kS(new Float32Array(r*this.count),r,this.count,_y,hy));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:`dispose`}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},HS=new $,US=new $,WS=new Gy,GS=class{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=HS.subVectors(n,t).cross(US.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(HS),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||WS.getNormalMatrix(e),r=this.coplanarPoint(HS).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},KS=new Sx,qS=new Vy(.5,.5),JS=new $,YS=class{constructor(e=new GS,t=new GS,n=new GS,r=new GS,i=new GS,a=new GS){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=My,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),KS.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),KS.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(KS)}intersectsSprite(e){KS.center.set(0,0,0);let t=qS.distanceTo(e.center);return KS.radius=.7071067811865476+t,KS.applyMatrix4(e.matrixWorld),this.intersectsSphere(KS)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(JS.x=r.normal.x>0?e.max.x:e.min.x,JS.y=r.normal.y>0?e.max.y:e.min.y,JS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(JS)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},XS=class extends Fx{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Ib(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},ZS=new $,QS=new $,$S=new ib,eC=new iS,tC=new Sx,nC=new $,rC=new $,iC=class extends jb{constructor(e=new Ax,t=new XS){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)ZS.fromBufferAttribute(t,e-1),QS.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=ZS.distanceTo(QS);e.setAttribute(`lineDistance`,new vx(n,1))}else hv(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),tC.copy(n.boundingSphere),tC.applyMatrix4(r),tC.radius+=i,e.ray.intersectsSphere(tC)===!1)return;$S.copy(r).invert(),eC.copy(e.ray).applyMatrix4($S);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=Yv(this,e,eC,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=Yv(this,e,eC,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=Yv(this,e,eC,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=Yv(this,e,eC,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},aC=new $,oC=new $,sC=class extends iC{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)aC.fromBufferAttribute(t,e),oC.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+aC.distanceTo(oC);e.setAttribute(`lineDistance`,new vx(n,1))}else hv(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},cC=class extends iC{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},lC=class extends Fx{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new Ib(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},uC=new ib,dC=new iS,fC=new Sx,pC=new $,mC=class extends jb{constructor(e=new Ax,t=new lC){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fC.copy(n.boundingSphere),fC.applyMatrix4(r),fC.radius+=i,e.ray.intersectsSphere(fC)===!1)return;uC.copy(r).invert(),dC.copy(e.ray).applyMatrix4(uC);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);pC.fromBufferAttribute(l,n),Xv(pC,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)pC.fromBufferAttribute(l,a),Xv(pC,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},hC=class extends nb{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},gC=class extends Fx{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new Ib(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ib(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Vy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mb,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},_C=class extends gC{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vy(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yv(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ib(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ib(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ib(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},vC=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}},yC=class extends vC{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Sy,endingEnd:Sy}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Cy:i=e,o=2*t-n;break;case wy:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Cy:a=e,s=2*n-t;break;case wy:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},bC=class extends vC{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},xC=class extends vC{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},SC=class extends vC{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let d=o*2,f=e-1;for(let p=0;p!==o;++p){let o=a[c+p],m=a[s+p],h=f*d+p*2,g=u[h],_=u[h+1],v=e*d+p*2,y=l[v],b=l[v+1],x=(n-t)/(r-t),S,C,w,T,E;for(let e=0;e<8;e++){S=x*x,C=S*x,w=1-x,T=w*w,E=T*w;let e=E*t+3*T*x*g+3*w*S*y+C*r-n;if(Math.abs(e)<1e-10)break;let i=3*T*(g-t)+6*w*x*(y-g)+3*S*(r-y);if(Math.abs(i)<1e-10)break;x-=e/i,x=Math.max(0,Math.min(1,x))}i[p]=E*o+3*T*x*_+3*w*S*b+C*m}return i}},CC=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Zv(t,this.TimeBufferType),this.values=Zv(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Zv(e.times,Array),values:Zv(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new xC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new bC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new yC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new SC(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case vy:t=this.InterpolantFactoryMethodDiscrete;break;case yy:t=this.InterpolantFactoryMethodLinear;break;case by:t=this.InterpolantFactoryMethodSmooth;break;case xy:t=this.InterpolantFactoryMethodBezier}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return hv(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vy;case this.InterpolantFactoryMethodLinear:return yy;case this.InterpolantFactoryMethodSmooth:return by;case this.InterpolantFactoryMethodBezier:return xy}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(gv(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(gv(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){gv(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){gv(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&dv(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){gv(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===by,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0])){if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}},CC.prototype.ValueTypeName=``,CC.prototype.TimeBufferType=Float32Array,CC.prototype.ValueBufferType=Float32Array,CC.prototype.DefaultInterpolation=yy,wC=class extends CC{constructor(e,t,n){super(e,t,n)}},wC.prototype.ValueTypeName=`bool`,wC.prototype.ValueBufferType=Array,wC.prototype.DefaultInterpolation=vy,wC.prototype.InterpolantFactoryMethodLinear=void 0,wC.prototype.InterpolantFactoryMethodSmooth=void 0,TC=class extends CC{constructor(e,t,n,r){super(e,t,n,r)}},TC.prototype.ValueTypeName=`color`,EC=class extends CC{constructor(e,t,n,r){super(e,t,n,r)}},EC.prototype.ValueTypeName=`number`,DC=class extends vC{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Hy.slerpFlat(i,0,a,c-o,a,c,s);return i}},OC=class extends CC{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new DC(this.times,this.values,this.getValueSize(),e)}},OC.prototype.ValueTypeName=`quaternion`,OC.prototype.InterpolantFactoryMethodSmooth=void 0,kC=class extends CC{constructor(e,t,n){super(e,t,n)}},kC.prototype.ValueTypeName=`string`,kC.prototype.ValueBufferType=Array,kC.prototype.DefaultInterpolation=vy,kC.prototype.InterpolantFactoryMethodLinear=void 0,kC.prototype.InterpolantFactoryMethodSmooth=void 0,AC=class extends CC{constructor(e,t,n,r){super(e,t,n,r)}},AC.prototype.ValueTypeName=`vector`,jC=class{constructor(e=``,t=-1,n=[],r=Ty){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=vv(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(ny(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||`{}`),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(CC.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e<i;e++){let o=[],s=[];o.push((e+i-1)%i,e,(e+1)%i),s.push(0,1,0);let c=Qv(o);o=$v(o,1,c),s=$v(s,1,c),!r&&o[0]===0&&(o.push(i),s.push(s[0])),a.push(new EC(`.morphTargetInfluences[`+t[e].name+`]`,o,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.name.match(i);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let e=this.tracks[n];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e&&=this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}},MC={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(ry(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!ry(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},NC=class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return e=e.normalize(`NFC`),s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||=new AbortController,this._abortController}},PC=new NC,FC=class{constructor(e){this.manager=e===void 0?PC:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}},FC.DEFAULT_MATERIAL_NAME=`__DEFAULT`,IC={},LC=class extends Error{constructor(e,t){super(e),this.response=t}},RC=class extends FC{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=MC.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(IC[e]!==void 0){IC[e].push({onLoad:t,onProgress:n,onError:r});return}IC[e]=[],IC[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&hv(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=IC[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}throw new LC(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{MC.add(`file:${e}`,t);let n=IC[e];delete IC[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=IC[e];if(n===void 0)throw this.manager.itemError(e),t;delete IC[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},zC=new WeakMap,BC=class extends FC{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=MC.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);else{let e=zC.get(a);e===void 0&&(e=[],zC.set(a,e)),e.push({onLoad:t,onError:r})}return a}let o=fv(`img`);function s(){l(),t&&t(this);let n=zC.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}zC.delete(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),MC.remove(`image:${e}`);let n=zC.get(this)||[];for(let e=0;e<n.length;e++){let r=n[e];r.onError&&r.onError(t)}zC.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),MC.add(`image:${e}`,o),i.manager.itemStart(e),o.src=e,o}},VC=class extends FC{constructor(e){super(e)}load(e,t,n,r){let i=new nb,a=new BC(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},HC=class extends jb{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Ib(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},UC=new ib,WC=new $,GC=new $,KC=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vy(512,512),this.mapType=my,this.map=null,this.mapPass=null,this.matrix=new ib,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new YS,this._frameExtents=new Vy(1,1),this._viewportCount=1,this._viewports=[new rb(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;WC.setFromMatrixPosition(e.matrixWorld),t.position.copy(WC),GC.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(GC),t.updateMatrixWorld(),UC.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(UC,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(UC)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},qC=new $,JC=new Hy,YC=new $,XC=class extends jb{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new ib,this.projectionMatrix=new ib,this.projectionMatrixInverse=new ib,this.coordinateSystem=My,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(qC,JC,YC),YC.x===1&&YC.y===1&&YC.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(qC,JC,YC.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(qC,JC,YC),YC.x===1&&YC.y===1&&YC.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(qC,JC,YC.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ZC=new $,QC=new Vy,$C=new Vy,ew=class extends XC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=zy*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ry*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return zy*2*Math.atan(Math.tan(Ry*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ZC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ZC.x,ZC.y).multiplyScalar(-e/ZC.z),ZC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ZC.x,ZC.y).multiplyScalar(-e/ZC.z)}getViewSize(e,t){return this.getViewBounds(e,QC,$C),t.subVectors($C,QC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ry*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},tw=class extends KC{constructor(){super(new ew(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=zy*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},nw=class extends HC{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(jb.DEFAULT_UP),this.updateMatrix(),this.target=new jb,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new tw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},rw=class extends KC{constructor(){super(new ew(90,1,.5,500)),this.isPointLightShadow=!0}},iw=class extends HC{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new rw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},aw=class extends XC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},ow=class extends KC{constructor(){super(new aw(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},sw=class extends HC{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(jb.DEFAULT_UP),this.updateMatrix(),this.target=new jb,this.shadow=new ow}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},cw=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},lw=new WeakMap,uw=class extends FC{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&hv(`ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&hv(`ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=MC.get(`image-bitmap:${e}`);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{lw.has(a)===!0?(r&&r(lw.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)):(t&&t(n),i.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);return}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){MC.add(`image-bitmap:${e}`,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),lw.set(s,t),MC.remove(`image-bitmap:${e}`),i.manager.itemError(e),i.manager.itemEnd(e)});MC.add(`image-bitmap:${e}`,s),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},dw=`\\[\\]\\.:\\/`,fw=RegExp(`[\\[\\]\\.:\\/]`,`g`),pw=`[^\\[\\]\\.:\\/]`,mw=`[^`+dw.replace(`\\.`,``)+`]`,hw=`((?:WC+[\\/:])*)`.replace(`WC`,pw),gw=`(WCOD+)?`.replace(`WCOD`,mw),_w=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,pw),vw=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,pw),yw=RegExp(`^`+hw+gw+_w+vw+`$`),bw=[`material`,`materials`,`bones`,`map`],xw=class{constructor(e,t,n){let r=n||Sw.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Sw=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(fw,``)}static parseTrackName(e){let t=yw.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);bw.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){hv(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){gv(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){gv(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){gv(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){gv(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){gv(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){gv(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){gv(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;gv(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){gv(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){gv(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Sw.Composite=xw,Sw.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Sw.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Sw.prototype.GetterByBindingType=[Sw.prototype._getValue_direct,Sw.prototype._getValue_array,Sw.prototype._getValue_arrayElement,Sw.prototype._getValue_toArray],Sw.prototype.SetterByBindingTypeAndVersioning=[[Sw.prototype._setValue_direct,Sw.prototype._setValue_direct_setNeedsUpdate,Sw.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Sw.prototype._setValue_array,Sw.prototype._setValue_array_setNeedsUpdate,Sw.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Sw.prototype._setValue_arrayElement,Sw.prototype._setValue_arrayElement_setNeedsUpdate,Sw.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Sw.prototype._setValue_fromArray,Sw.prototype._setValue_fromArray_setNeedsUpdate,Sw.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`185`}})),typeof window<`u`&&(window.__THREE__?hv(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`185`)})),ww=p((()=>{Cw(),new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183])})),Tw=h({default:()=>Yw});function Ew(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Dw(e){if(Array.isArray(e))return e}function Ow(e){if(Array.isArray(e))return Ew(e)}function kw(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Aw(e,t,n){return t=Pw(t),Vw(e,Iw()?Reflect.construct(t,n||[],Pw(e).constructor):t.apply(e,n))}function jw(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Mw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Kw(r.key),r)}}function Nw(e,t,n){return t&&Mw(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pw(e){return Pw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pw(e)}function Fw(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hw(e,t)}function Iw(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Iw=function(){return!!e})()}function Lw(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Rw(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function zw(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
4116
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bw(){throw TypeError(`Invalid attempt to spread non-iterable instance.
4117
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vw(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return kw(e)}function Hw(e,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hw(e,t)}function Uw(e,t){return Dw(e)||Rw(e,t)||qw(e,t)||zw()}function Ww(e){return Ow(e)||Lw(e)||qw(e)||Bw()}function Gw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function Kw(e){var t=Gw(e,`string`);return typeof t==`symbol`?t:t+``}function qw(e,t){if(e){if(typeof e==`string`)return Ew(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ew(e,t):void 0}}var Jw,Yw,Xw=p((()=>{ww(),Jw=typeof window<`u`&&window.THREE?window.THREE:{CanvasTexture:hC,Sprite:Xx,SpriteMaterial:Ix,SRGBColorSpace:Ey},Yw=function(e){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`rgba(255, 255, 255, 1)`;return jw(this,t),e=Aw(this,t,[new Jw.SpriteMaterial]),e._text=`${n}`,e._textHeight=r,e._color=i,e._backgroundColor=!1,e._padding=0,e._borderWidth=0,e._borderRadius=0,e._borderColor=`white`,e._offsetX=0,e._offsetY=0,e._strokeWidth=0,e._strokeColor=`white`,e._fontFace=`system-ui`,e._fontSize=90,e._fontWeight=`normal`,e._canvas=document.createElement(`canvas`),e._genCanvas(),e}return Fw(t,e),Nw(t,[{key:`text`,get:function(){return this._text},set:function(e){this._text=e,this._genCanvas()}},{key:`textHeight`,get:function(){return this._textHeight},set:function(e){this._textHeight=e,this._genCanvas()}},{key:`color`,get:function(){return this._color},set:function(e){this._color=e,this._genCanvas()}},{key:`backgroundColor`,get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._genCanvas()}},{key:`padding`,get:function(){return this._padding},set:function(e){this._padding=e,this._genCanvas()}},{key:`borderWidth`,get:function(){return this._borderWidth},set:function(e){this._borderWidth=e,this._genCanvas()}},{key:`borderRadius`,get:function(){return this._borderRadius},set:function(e){this._borderRadius=e,this._genCanvas()}},{key:`borderColor`,get:function(){return this._borderColor},set:function(e){this._borderColor=e,this._genCanvas()}},{key:`offsetX`,get:function(){return this._offsetX},set:function(e){this._offsetX=e,this._genCanvas()}},{key:`offsetY`,get:function(){return this._offsetY},set:function(e){this._offsetY=e,this._genCanvas()}},{key:`fontFace`,get:function(){return this._fontFace},set:function(e){this._fontFace=e,this._genCanvas()}},{key:`fontSize`,get:function(){return this._fontSize},set:function(e){this._fontSize=e,this._genCanvas()}},{key:`fontWeight`,get:function(){return this._fontWeight},set:function(e){this._fontWeight=e,this._genCanvas()}},{key:`strokeWidth`,get:function(){return this._strokeWidth},set:function(e){this._strokeWidth=e,this._genCanvas()}},{key:`strokeColor`,get:function(){return this._strokeColor},set:function(e){this._strokeColor=e,this._genCanvas()}},{key:`_genCanvas`,value:function(){var e=this,t=this._canvas,n=t.getContext(`2d`),r=1/this.textHeight,i=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],a=i.map(function(t){return t*e.fontSize*r}),o=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map(function(t){return t*e.fontSize*r}),s=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],c=s.map(function(t){return t*e.fontSize*r}),l=[this.offsetX,this.offsetY].map(function(t){return t*e.fontSize*r}),u=this.text.split(`
4118
+ `),d=`${this.fontWeight} ${this.fontSize}px ${this.fontFace}`;n.font=d;var f=Math.max.apply(Math,Ww(u.map(function(e){return n.measureText(e).width}))),p=this.fontSize*u.length,m=f+a[0]*2+c[0]*2,h=p+a[1]*2+c[1]*2;if(t.width=m+Math.abs(l[0]),t.height=h+Math.abs(l[1]),n.translate.apply(n,Ww(l.map(function(e){return Math.max(0,e)}))),this.borderWidth){if(n.strokeStyle=this.borderColor,a[0]){var g=a[0]/2;n.lineWidth=a[0],n.beginPath(),n.moveTo(g,o[0]),n.lineTo(g,h-o[3]),n.moveTo(m-g,o[1]),n.lineTo(m-g,h-o[2]),n.stroke()}if(a[1]){var _=a[1]/2;n.lineWidth=a[1],n.beginPath(),n.moveTo(Math.max(a[0],o[0]),_),n.lineTo(m-Math.max(a[0],o[1]),_),n.moveTo(Math.max(a[0],o[3]),h-_),n.lineTo(m-Math.max(a[0],o[2]),h-_),n.stroke()}if(this.borderRadius){var v=Math.max.apply(Math,Ww(a)),y=v/2;n.lineWidth=v,n.beginPath(),[!!o[0]&&[o[0],y,y,o[0]],!!o[1]&&[m-o[1],m-y,y,o[1]],!!o[2]&&[m-o[2],m-y,h-y,h-o[2]],!!o[3]&&[o[3],y,h-y,h-o[3]]].filter(function(e){return e}).forEach(function(e){var t=Uw(e,4),r=t[0],i=t[1],a=t[2],o=t[3];n.moveTo(r,a),n.quadraticCurveTo(i,a,i,o)}),n.stroke()}}this.backgroundColor&&(n.fillStyle=this.backgroundColor,this.borderRadius?(n.beginPath(),n.moveTo(a[0],o[0]),[[a[0],o[0],m-o[1],a[1],a[1],a[1]],[m-a[0],m-a[0],m-a[0],a[1],o[1],h-o[2]],[m-a[0],m-o[2],o[3],h-a[1],h-a[1],h-a[1]],[a[0],a[0],a[0],h-a[1],h-o[3],o[0]]].forEach(function(e){var t=Uw(e,6),r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];n.quadraticCurveTo(r,o,i,s),n.lineTo(a,c)}),n.closePath(),n.fill()):n.fillRect(a[0],a[1],m-a[0]*2,h-a[1]*2)),n.translate.apply(n,Ww(a)),n.translate.apply(n,Ww(c)),n.font=d,n.fillStyle=this.color,n.textBaseline=`bottom`;var b=this.strokeWidth>0;b&&(n.lineWidth=this.strokeWidth*this.fontSize/10,n.strokeStyle=this.strokeColor),u.forEach(function(t,r){var i=(f-n.measureText(t).width)/2,a=(r+1)*e.fontSize;b&&n.strokeText(t,i,a),n.fillText(t,i,a)}),this.material.map&&this.material.map.dispose();var x=this.material.map=new Jw.CanvasTexture(t);x.colorSpace=Jw.SRGBColorSpace;var S=this.textHeight*u.length+i[1]*2+s[1]*2+Math.abs(this.offsetY);this.scale.set(S*t.width/t.height,S,0)}},{key:`clone`,value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:`copy`,value:function(e){return Jw.Sprite.prototype.copy.call(this,e),this.color=e.color,this.backgroundColor=e.backgroundColor,this.padding=e.padding,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.offsetX=e.offsetX,this.offsetY=e.offsetY,this.fontFace=e.fontFace,this.fontSize=e.fontSize,this.fontWeight=e.fontWeight,this.strokeWidth=e.strokeWidth,this.strokeColor=e.strokeColor,this}}])}(Jw.Sprite)})),Zw=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define(r):typeof e==`object`?t.exports=r():n.ResizeSensor=r()})(typeof window<`u`?window:e,function(){if(typeof window>`u`)return null;var e=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)(),t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)},n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||function(t){e.clearTimeout(t)};function r(e,t){var n=Object.prototype.toString.call(e),r=n===`[object Array]`||n===`[object NodeList]`||n===`[object HTMLCollection]`||n===`[object Object]`||typeof jQuery<`u`&&e instanceof jQuery||typeof Elements<`u`&&e instanceof Elements,i=0,a=e.length;if(r)for(;i<a;i++)t(e[i]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function a(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}var o=function(e,s){var c=0;function l(){var e=[];this.add=function(t){e.push(t)};var t,n;this.call=function(r){for(t=0,n=e.length;t<n;t++)e[t].call(this,r)},this.remove=function(r){var i=[];for(t=0,n=e.length;t<n;t++)e[t]!==r&&i.push(e[t]);e=i},this.length=function(){return e.length}}function u(e,n){if(e){if(e.resizedAttached){e.resizedAttached.add(n);return}e.resizedAttached=new l,e.resizedAttached.add(n),e.resizeSensor=document.createElement(`div`),e.resizeSensor.dir=`ltr`,e.resizeSensor.className=`resize-sensor`;var r={pointerEvents:`none`,position:`absolute`,left:`0px`,top:`0px`,right:`0px`,bottom:`0px`,overflow:`hidden`,zIndex:`-1`,visibility:`hidden`,maxWidth:`100%`},o={position:`absolute`,left:`0px`,top:`0px`,transition:`0s`};a(e.resizeSensor,r);var s=document.createElement(`div`);s.className=`resize-sensor-expand`,a(s,r);var u=document.createElement(`div`);a(u,o),s.appendChild(u);var d=document.createElement(`div`);d.className=`resize-sensor-shrink`,a(d,r);var f=document.createElement(`div`);a(f,o),a(f,{width:`200%`,height:`200%`}),d.appendChild(f),e.resizeSensor.appendChild(s),e.resizeSensor.appendChild(d),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue(`position`):null;m!==`absolute`&&m!==`relative`&&m!==`fixed`&&m!==`sticky`&&(e.style.position=`relative`);var h=!1,g=0,_=i(e),v=0,y=0,b=!0;c=0;var x=function(){var t=e.offsetWidth,n=e.offsetHeight;u.style.width=t+10+`px`,u.style.height=n+10+`px`,s.scrollLeft=t+10,s.scrollTop=n+10,d.scrollLeft=t+10,d.scrollTop=n+10},S=function(){if(b){if(e.offsetWidth===0&&e.offsetHeight===0){c||=t(function(){c=0,S()});return}b=!1}x()};e.resizeSensor.resetSensor=S;var C=function(){g=0,h&&(v=_.width,y=_.height,e.resizedAttached&&e.resizedAttached.call(_))},w=function(){_=i(e),h=_.width!==v||_.height!==y,h&&!g&&(g=t(C)),S()},T=function(e,t,n){e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener(t,n)};T(s,`scroll`,w),T(d,`scroll`,w),c=t(function(){c=0,S()})}}r(e,function(e){u(e,s)}),this.detach=function(t){c||=(n(c),0),o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};if(o.reset=function(e){r(e,function(e){e.resizeSensor.resetSensor()})},o.detach=function(e,t){r(e,function(e){e&&(e.resizedAttached&&typeof t==`function`&&(e.resizedAttached.remove(t),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},typeof MutationObserver<`u`){var s=new MutationObserver(function(e){for(var t in e)if(e.hasOwnProperty(t))for(var n=e[t].addedNodes,r=0;r<n.length;r++)n[r].resizeSensor&&o.reset(n[r])});document.addEventListener(`DOMContentLoaded`,function(e){s.observe(document.body,{childList:!0,subtree:!0})})}return o})})),Qw=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define([`./ResizeSensor.js`],r):typeof e==`object`?t.exports=r(Zw()):(n.ElementQueries=r(n.ResizeSensor),n.ElementQueries.listen())})(typeof window<`u`?window:e,function(e){var t=function(){var t,n={},r=[];function i(e){e||=document.documentElement;var t=window.getComputedStyle(e,null).fontSize;return parseFloat(t)||16}function a(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function o(e,t){var n=t.split(/\d/),r=n[n.length-1];switch(t=parseFloat(t),r){case`px`:return t;case`em`:return t*i(e);case`rem`:return t*i();case`vw`:return t*document.documentElement.clientWidth/100;case`vh`:return t*document.documentElement.clientHeight/100;case`vmin`:case`vmax`:var a=document.documentElement.clientWidth/100,o=document.documentElement.clientHeight/100,s=Math[r===`vmin`?`min`:`max`];return t*s(a,o);default:return t}}function s(e,t){this.element=e;var r,i,s,c,l,u,d,f,p=[`min-width`,`min-height`,`max-width`,`max-height`];this.call=function(){for(r in s=a(this.element),u={},n[t])n[t].hasOwnProperty(r)&&(i=n[t][r],c=o(this.element,i.value),l=i.property===`width`?s.width:s.height,f=i.mode+`-`+i.property,d=``,i.mode===`min`&&l>=c&&(d+=i.value),i.mode===`max`&&l<=c&&(d+=i.value),u[f]||(u[f]=``),d&&(` `+u[f]+` `).indexOf(` `+d+` `)===-1&&(u[f]+=` `+d));for(var e in p)p.hasOwnProperty(e)&&(u[p[e]]?this.element.setAttribute(p[e],u[p[e]].substr(1)):this.element.removeAttribute(p[e]))}}function c(t,n){t.elementQueriesSetupInformation||=new s(t,n),t.elementQueriesSensor||=new e(t,function(){t.elementQueriesSetupInformation.call()})}function l(e,i,a,o){if(n[e]===void 0){n[e]=[];var s=r.length;t.innerHTML+=`
4119
4119
  `+e+` {animation: 0.1s element-queries;}`,t.innerHTML+=`
4120
4120
  `+e+` > .resize-sensor {min-width: `+s+`px;}`,r.push(e)}n[e].push({mode:i,property:a,value:o})}function u(e){var t;if(document.querySelectorAll&&(t=e?e.querySelectorAll.bind(e):document.querySelectorAll.bind(document)),!t&&typeof $$<`u`&&(t=$$),!t&&typeof jQuery<`u`&&(t=jQuery),!t)throw`No document.querySelectorAll, jQuery or Mootools's $$ found.`;return t}function d(e){var t=u(e);for(var r in n)if(n.hasOwnProperty(r))for(var i=t(r,e),a=0,o=i.length;a<o;a++)c(i[a],r)}function f(t){var n=[],r=[],i=[],a=0,o=-1,s=[];for(var c in t.children)if(t.children.hasOwnProperty(c)&&t.children[c].tagName&&t.children[c].tagName.toLowerCase()===`img`){n.push(t.children[c]);var l=t.children[c].getAttribute(`min-width`)||t.children[c].getAttribute(`data-min-width`),u=t.children[c].getAttribute(`data-src`)||t.children[c].getAttribute(`url`);i.push(u);var d={minWidth:l};r.push(d),l?t.children[c].style.display=`none`:(a=n.length-1,t.children[c].style.display=`block`)}o=a;function f(){var e=!1,c;for(c in n)n.hasOwnProperty(c)&&r[c].minWidth&&t.offsetWidth>r[c].minWidth&&(e=c);if(e||=a,o!==e){if(s[e])n[o].style.display=`none`,n[e].style.display=`block`,o=e;else{var l=new Image;l.onload=function(){n[e].src=i[e],n[o].style.display=`none`,n[e].style.display=`block`,s[e]=!0,o=e},l.src=i[e]}}else n[e].src=i[e]}t.resizeSensorInstance=new e(t,f),f()}function p(){for(var e=u()(`[data-responsive-image],[responsive-image]`),t=0,n=e.length;t<n;t++)f(e[t])}var m=/,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/gim,h=/\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/gim;function g(e){var t,n,r,i;for(e=e.replace(/'/g,`"`);(t=m.exec(e))!==null;)for(n=t[1]+t[3],r=t[2];(i=h.exec(r))!==null;)l(n,i[1],i[2],i[3])}function _(e){var t=``;if(e){if(typeof e==`string`)e=e.toLowerCase(),(e.indexOf(`min-width`)!==-1||e.indexOf(`max-width`)!==-1)&&g(e);else for(var n=0,r=e.length;n<r;n++)e[n].type===1?(t=e[n].selectorText||e[n].cssText,(t.indexOf(`min-height`)!==-1||t.indexOf(`max-height`)!==-1||t.indexOf(`min-width`)!==-1||t.indexOf(`max-width`)!==-1)&&g(t)):e[n].type===4?_(e[n].cssRules||e[n].rules):e[n].type===3&&e[n].styleSheet.hasOwnProperty(`cssRules`)&&_(e[n].styleSheet.cssRules)}}var v=!1;this.init=function(){var n=`animationstart`;document.documentElement.style.webkitAnimationName===void 0?document.documentElement.style.MozAnimationName===void 0?document.documentElement.style.OAnimationName!==void 0&&(n=`oanimationstart`):n=`mozanimationstart`:n=`webkitAnimationStart`,document.body.addEventListener(n,function(t){var n=t.target,i=n&&window.getComputedStyle(n,null),a=i&&i.getPropertyValue(`animation-name`);if(a&&a.indexOf(`element-queries`)!==-1){n.elementQueriesSensor=new e(n,function(){n.elementQueriesSetupInformation&&n.elementQueriesSetupInformation.call()});var o=window.getComputedStyle(n.resizeSensor,null).getPropertyValue(`min-width`);o=parseInt(o.replace(`px`,``)),c(t.target,r[o])}}),v||=(t=document.createElement(`style`),t.type=`text/css`,t.innerHTML=`[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}`,t.innerHTML+=`
4121
- @keyframes element-queries { 0% { visibility: inherit; } }`,document.getElementsByTagName(`head`)[0].appendChild(t),!0);for(var i=0,a=document.styleSheets.length;i<a;i++)try{document.styleSheets[i].href&&document.styleSheets[i].href.indexOf(`file://`)===0&&console.warn(`CssElementQueries: unable to parse local css files, `+document.styleSheets[i].href),_(document.styleSheets[i].cssRules||document.styleSheets[i].rules||document.styleSheets[i].cssText)}catch{}p()},this.findElementQueriesElements=function(e){d(e)},this.update=function(){this.init()}};t.update=function(){t.instance.update()},t.detach=function(e){e.elementQueriesSetupInformation?(e.elementQueriesSensor.detach(),delete e.elementQueriesSetupInformation,delete e.elementQueriesSensor):e.resizeSensorInstance&&(e.resizeSensorInstance.detach(),delete e.resizeSensorInstance)},t.init=function(){t.instance||=new t,t.instance.init()};var n=function(e){if(document.addEventListener)document.addEventListener(`DOMContentLoaded`,e,!1);else if(/KHTML|WebKit|iCab/i.test(navigator.userAgent))var t=setInterval(function(){/loaded|complete/i.test(document.readyState)&&(e(),clearInterval(t))},10);else window.onload=e};return t.findElementQueriesElements=function(e){t.instance.findElementQueriesElements(e)},t.listen=function(){n(t.init)},t})})),Xw=m(((e,t)=>{t.exports={ResizeSensor:Jw(),ElementQueries:Yw()}}));function Zw(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}let r=n.count-2,i=[];if(t===2)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),a.clearGroups(),a}return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,t),e}var Qw=p((()=>{Cw()}));function $w(e){let t=new Map,n=new Map,r=e.clone();return eT(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function eT(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)eT(e.children[r],t.children[r],n)}var tT=p((()=>{})),nT=h({GLTFLoader:()=>gT});function rT(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function iT(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function aT(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new hC({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function oT(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function sT(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function cT(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function lT(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function uT(e){let t,n=e.extensions&&e.extensions[_T.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+dT(n.attributes):e.indices+`:`+dT(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+dT(e.targets[n]);return t}function dT(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function fT(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function pT(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function mT(e,t,n){let r=t.attributes,i=new Qb;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new $(t[0],t[1],t[2]),new $(a[0],a[1],a[2])),e.normalized){let t=fT(qT[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new $,t=new $;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=fT(qT[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new Sx;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function hT(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=ZT[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return Yy.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Yy.workingColorSpace}" not supported.`),sT(e,t),mT(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:cT(e,t.targets,n)})}var gT,_T,vT,yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE=p((()=>{Cw(),Qw(),tT(),gT=class extends PC{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new xT(e)}),this.register(function(e){return new ST(e)}),this.register(function(e){return new jT(e)}),this.register(function(e){return new MT(e)}),this.register(function(e){return new NT(e)}),this.register(function(e){return new wT(e)}),this.register(function(e){return new TT(e)}),this.register(function(e){return new ET(e)}),this.register(function(e){return new DT(e)}),this.register(function(e){return new bT(e)}),this.register(function(e){return new OT(e)}),this.register(function(e){return new CT(e)}),this.register(function(e){return new AT(e)}),this.register(function(e){return new kT(e)}),this.register(function(e){return new vT(e)}),this.register(function(e){return new PT(e,_T.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new PT(e,_T.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new FT(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=sw.extractUrlBase(e);a=sw.resolveURL(t,this.path)}else a=sw.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new LC(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===IT){try{a[_T.KHR_BINARY_GLTF]=new zT(e)}catch(e){r&&r(e);return}i=JSON.parse(a[_T.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new nE(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case _T.KHR_MATERIALS_UNLIT:a[t]=new yT;break;case _T.KHR_DRACO_MESH_COMPRESSION:a[t]=new BT(i,this.dracoLoader);break;case _T.KHR_TEXTURE_TRANSFORM:a[t]=new VT;break;case _T.KHR_MESH_QUANTIZATION:a[t]=new HT;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},_T={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},vT=class{constructor(e){this.parser=e,this.name=_T.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new Ib(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],Dy);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new ow(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new rw(s),o.distance=c;break;case`spot`:o=new tw(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),sT(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},yT=class{constructor(){this.name=_T.KHR_MATERIALS_UNLIT}getMaterialType(){return aS}extendParams(e,t,n){let r=[];e.color=new Ib(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Dy),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,Ey))}return Promise.all(r)}},bT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},xT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vy(e,e)}return Promise.all(r)}},ST=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_DISPERSION}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},CT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},wT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_SHEEN}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new Ib(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Dy)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,Ey)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},TT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},ET=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_VOLUME}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ib().setRGB(i[0],i[1],i[2],Dy),Promise.all(r)}},DT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_IOR}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);return n===null?Promise.resolve():(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3),Promise.resolve())}},OT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_SPECULAR}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new Ib().setRGB(i[0],i[1],i[2],Dy),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,Ey)),Promise.all(r)}},kT=class{constructor(e){this.parser=e,this.name=_T.EXT_MATERIALS_BUMP}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},AT=class{constructor(e){this.parser=e,this.name=_T.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return iT(this.parser,e,this.name)===null?null:gC}extendMaterialParams(e,t){let n=iT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},jT=class{constructor(e){this.parser=e,this.name=_T.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},MT=class{constructor(e){this.parser=e,this.name=_T.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},NT=class{constructor(e){this.parser=e,this.name=_T.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},PT=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},FT=class{constructor(e){this.name=_T.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==KT.TRIANGLES&&e.mode!==KT.TRIANGLE_STRIP&&e.mode!==KT.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new ib,n=new $,a=new Hy,s=new $(1,1,1),c=new VS(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));for(let t in o)if(t===`_COLOR_0`){let e=o[t];c.instanceColor=new NS(e.array,e.itemSize,e.normalized)}else t!==`TRANSLATION`&&t!==`ROTATION`&&t!==`SCALE`&&e.geometry.setAttribute(t,o[t]);jb.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},IT=`glTF`,LT=12,RT={JSON:1313821514,BIN:5130562},zT=class{constructor(e){this.name=_T.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,LT),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==IT)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-LT,i=new DataView(e,LT),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===RT.JSON){let r=new Uint8Array(e,LT+a,t);this.content=n.decode(r)}else if(r===RT.BIN){let n=LT+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},BT=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=_T.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=ZT[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=ZT[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=qT[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,Dy,n)})})}},VT=class{constructor(){this.name=_T.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0?e:(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e)}},HT=class{constructor(){this.name=_T.KHR_MESH_QUANTIZATION}},UT=class extends _C{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},WT=new Hy,GT=class extends UT{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return WT.fromArray(i).normalize().toArray(i),i}},KT={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},qT={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},JT={9728:cy,9729:dy,9984:ly,9985:fy,9986:uy,9987:py},YT={33071:oy,33648:sy,10497:ay},XT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ZT={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},QT={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},$T={CUBICSPLINE:void 0,LINEAR:yy,STEP:vy},eE={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},tE=new ib,nE=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new rT,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}this.textureLoader=typeof createImageBitmap>`u`||n&&r<17||i&&a<98?new BC(this.options.manager):new lw(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new LC(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return oT(i,a,r),sT(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[_T.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(sw.resolveURL(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=XT[r.type],t=qT[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new hx(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=XT[r.type],o=qT[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new jx(f,u/s),t.cache.add(n,c)),p=new Nx(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new hx(f,a,d);if(r.sparse!==void 0){let t=XT.SCALAR,n=qT[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new hx(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=JT[n.magFilter]||1006,t.minFilter=JT[n.minFilter]||1008,t.wrapS=YT[n.wrapS]||1e3,t.wrapT=YT[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new nb(e);t.needsUpdate=!0,n(t)}),t.load(sw.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),sT(e,a),e.userData.mimeType=a.mimeType||pT(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[_T.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[_T.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[_T.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new lC,Fx.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new XS,Fx.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return hC}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[_T.KHR_MATERIALS_UNLIT]){let e=r[_T.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Ib(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Dy),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Ey)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||eE.OPAQUE;if(l===eE.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===eE.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==aS&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new Vy(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==aS&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==aS){let e=i.emissiveFactor;o.emissive=new Ib().setRGB(e[0],e[1],e[2],Dy)}return i.emissiveTexture!==void 0&&a!==aS&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Ey)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),sT(n,i),t.associations.set(n,{materials:e}),i.extensions&&oT(r,n,i),n})}createUniqueName(e){let t=xw.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[_T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return hT(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=uT(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[_T.KHR_DRACO_MESH_COMPRESSION]?i(o):hT(new Ax,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?aT(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===KT.TRIANGLES||u.mode===KT.TRIANGLE_STRIP||u.mode===KT.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new DS(l,f):new _S(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),u.mode===KT.TRIANGLE_STRIP?d.geometry=Zw(d.geometry,1):u.mode===KT.TRIANGLE_FAN&&(d.geometry=Zw(d.geometry,2));else if(u.mode===KT.LINES)d=new sC(l,f);else if(u.mode===KT.LINE_STRIP)d=new iC(l,f);else if(u.mode===KT.LINE_LOOP)d=new cC(l,f);else if(u.mode===KT.POINTS)d=new mC(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&lT(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),sT(d,i),u.extensions&&oT(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&oT(r,c[0],i),c[0];let l=new Mb;i.extensions&&oT(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new $C(By.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new iw(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),sT(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new ib;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new MS(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new AC(i,void 0,l);return sT(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,tE)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new $().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new OS:t.length>1?new Mb:t.length===1?t[0]:new jb,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),sT(o,i),i.extensions&&oT(n,o,i),i.matrix!==void 0){let e=new ib;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new Mb;n.name&&(i.name=r.createUniqueName(n.name)),sT(i,n),n.extensions&&oT(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add($w(n))}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof Fx||e instanceof nb)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}QT[i.path]===QT.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(QT[i.path]){case QT.weights:l=TC;break;case QT.rotation:l=DC;break;case QT.translation:case QT.scale:l=kC;break;default:switch(n.itemSize){case 1:l=TC;break;default:l=kC}}let u=r.interpolation===void 0?yy:$T[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+QT[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=fT(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof DC?GT:UT)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),iE=m((e=>{e.deflate=Ne,e.deflateSync=Pe,e.inflate=Le,e.inflateSync=Re,e.gzip=Ve,e.compress=Ve,e.gzipSync=He,e.compressSync=He,e.gunzip=Ge,e.gunzipSync=Ke,e.zlib=Je,e.zlibSync=Ye,e.unzlib=Qe,e.unzlibSync=$e,e.gzip=Ve,e.compress=Ve,e.decompress=tt,e.decompressSync=nt,e.strToU8=ct,e.strFromU8=lt,e.zip=vt,e.zipSync=yt,e.unzip=St,e.unzipSync=Ct;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,j=a*8;do{if(!b){g=D(e,_,1);var N=D(e,_+1,3);if(_+=3,!N){var P=k(_)+4,F=e[P-4]|e[P-3]<<8,ee=P+F;if(ee>a){p&&M(0);break}f&&h(v+F),n.set(e.subarray(P,ee),v),t.b=v+=F,t.p=_=ee*8,t.f=g;continue}if(N==1)b=C,x=T,S=9,w=5;else if(N==2){var te=D(e,_,31)+257,ne=D(e,_+10,15)+4,re=te+D(e,_+5,31)+1;_+=14;for(var I=new r(re),ie=new r(19),ae=0;ae<ne;++ae)ie[c[ae]]=D(e,_+ae*3,7);_+=ne*3;for(var oe=E(ie),se=(1<<oe)-1,L=y(ie,oe,1),ae=0;ae<re;){var ce=L[D(e,_,se)];_+=ce&15;var P=ce>>4;if(P<16)I[ae++]=P;else{var le=0,ue=0;for(P==16?(ue=3+D(e,_,3),_+=2,le=I[ae-1]):P==17?(ue=3+D(e,_,7),_+=3):P==18&&(ue=11+D(e,_,127),_+=7);ue--;)I[ae++]=le}}var de=I.subarray(0,te),fe=I.subarray(te);S=E(de),w=E(fe),b=y(de,S,1),x=y(fe,w,1)}else M(1);if(_>j){p&&M(0);break}}f&&h(v+131072);for(var pe=(1<<S)-1,me=(1<<w)-1,he=_;;he=_){var le=b[O(e,_)&pe],ge=le>>4;if(_+=le&15,_>j){p&&M(0);break}if(le||M(2),ge<256)n[v++]=ge;else if(ge==256){he=_,b=null;break}else{var R=ge-254;if(ge>264){var ae=ge-257,_e=o[ae];R=D(e,_,(1<<_e)-1)+d[ae],_+=_e}var ve=x[O(e,_)&me],z=ve>>4;ve||M(3),_+=ve&15;var fe=m[z];if(z>3){var _e=s[z];fe+=O(e,_)&(1<<_e)-1,_+=_e}if(_>j){p&&M(0);break}f&&h(v+131072);var ye=v+R;if(v<fe){var be=l-fe,xe=Math.min(fe,ye);for(be+v<0&&M(3);v<xe;++v)n[v]=i[be+v]}for(;v<ye;++v)n[v]=n[v-fe]}}t.l=b,t.p=he,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},F=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ee=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:oe,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=te(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},te=function(e,t,n){return e.s==-1?Math.max(te(e.l,t,n+1),te(e.r,t,n+1)):t[e.s]=n},ne=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},re=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},I=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},ie=function(e,t,n,r,a,l,u,d,f,p,m){P(t,m++,n),++a[256];for(var h=ee(a,15),g=h.t,_=h.l,v=ee(l,15),C=v.t,T=v.l,E=ne(g),D=E.c,O=E.n,k=ne(C),A=k.c,j=k.n,M=new i(19),N=0;N<D.length;++N)++M[D[N]&31];for(var N=0;N<A.length;++N)++M[A[N]&31];for(var te=ee(M,7),ie=te.t,ae=te.l,oe=19;oe>4&&!ie[c[oe-1]];--oe);var se=p+5<<3,L=re(a,b)+re(l,x)+u,ce=re(a,g)+re(l,C)+u+14+3*oe+re(M,ie)+2*M[16]+3*M[17]+7*M[18];if(f>=0&&se<=L&&se<=ce)return I(t,m,e.subarray(f,f+p));var le,ue,de,fe;if(P(t,m,1+(ce<L)),m+=2,ce<L){le=y(g,_,0),ue=g,de=y(C,T,0),fe=C;var pe=y(ie,ae,0);P(t,m,O-257),P(t,m+5,j-1),P(t,m+10,oe-4),m+=14;for(var N=0;N<oe;++N)P(t,m+3*N,ie[c[N]]);m+=3*oe;for(var me=[D,A],he=0;he<2;++he)for(var ge=me[he],N=0;N<ge.length;++N){var R=ge[N]&31;P(t,m,pe[R]),m+=ie[R],R>15&&(P(t,m,ge[N]>>5&127),m+=ge[N]>>12)}}else le=S,ue=b,de=w,fe=x;for(var N=0;N<d;++N){var _e=r[N];if(_e>255){var R=_e>>18&31;F(t,m,le[R+257]),m+=ue[R+257],R>7&&(P(t,m,_e>>23&31),m+=o[R]);var ve=_e&31;F(t,m,de[ve]),m+=fe[ve],ve>3&&(F(t,m,_e>>5&8191),m+=s[ve])}else F(t,m,le[_e]),m+=ue[_e]}return F(t,m,le[256]),m+ue[256]},ae=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oe=new r(0),se=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=ae[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),j=new i(32),M=0,N=0,P=u.i||0,F=0,ee=u.w||0,te=0;P+2<d;++P){var ne=E(P),re=P&32767,oe=C[ne];if(S[re]=oe,C[ne]=re,ee<=P){var se=d-P;if((M>7e3||F>24576)&&(se>423||!g)){_=ie(e,m,0,D,O,j,N,F,te,P-te,_),F=M=N=0,te=P;for(var L=0;L<286;++L)O[L]=0;for(var L=0;L<30;++L)j[L]=0}var ce=2,le=0,ue=b,de=re-oe&32767;if(se>2&&ne==E(P-de))for(var fe=Math.min(y,se)-1,pe=Math.min(32767,P),me=Math.min(258,se);de<=pe&&--ue&&re!=oe;){if(e[P+ce]==e[P+ce-de]){for(var he=0;he<me&&e[P+he]==e[P+he-de];++he);if(he>ce){if(ce=he,le=de,he>fe)break;for(var ge=Math.min(de,he-2),R=0,L=0;L<ge;++L){var _e=P-de+L&32767,ve=_e-S[_e]&32767;ve>R&&(R=ve,oe=_e)}}}re=oe,oe=S[re],de+=re-oe&32767}if(le){D[F++]=268435456|f[ce]<<18|h[le];var z=f[ce]&31,ye=h[le]&31;N+=o[z]+s[ye],++O[257+z],++j[ye],ee=P+ce,++M}else D[F++]=e[P],++O[e[P]]}}for(P=Math.max(P,ee);P<d;++P)D[F++]=e[P],++O[e[P]];_=ie(e,m,g,D,O,j,N,F,te,P-te,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=P,u.w=ee)}else{for(var P=u.w||0;P<d+g;P+=65535){var be=P+65535;be>=d&&(m[_/8|0]=g,be=d),_=I(m,_+1,e.subarray(P,be))}u.i=d}return A(p,0,c+k(_)+l)},L=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),ce=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=L[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},le=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},ue=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return se(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},de=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},fe=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},pe=[],me=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},he=function(e,t,r,i){if(!pe[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=fe(e[c],a,o);pe[r]={c:fe(e[s],a,o),e:o}}var l=de({},pe[r].e);return(0,n.default)(pe[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,me(l),i)},ge=function(){return[r,i,a,o,s,c,d,m,C,T,g,j,y,E,D,O,k,A,M,N,Re,be,xe]},R=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,ae,oe,y,P,F,ee,te,ne,re,I,ie,k,A,se,ue,Pe,be]},_e=function(){return[U,De,Te,ce,L]},ve=function(){return[W,Ee]},z=function(){return[Oe,Te,le]},ye=function(){return[ke]},be=function(e){return postMessage(e,[e.buffer])},xe=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},Se=function(e,t,n,r,i,a){var o=he(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},B=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},V=function(e,t,n,r,i,a,o){var s,c=he(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||M(5),s&&t.ondata(M(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},Ce=function(e,t){return e[t]|e[t+1]<<8},we=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},H=function(e,t){return we(e,t)+we(e,t+4)*4294967296},Te=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},U=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Te(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},W=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&M(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ee=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},De=function(e){return 10+(e.filename?e.filename.length+1:0)},Oe=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=le();i.p(t.dictionary),Te(e,2,i.d())}},ke=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&M(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&M(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Ae(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var je=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(ue(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||M(5),this.s.l&&M(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=oe)},e.prototype.flush=function(e){if(this.ondata||M(5),this.s.l&&M(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=I(t,this.s.r,oe);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=je;var Me=function(){function e(e,t){V([R,function(){return[B,je]}],this,Ae.call(this,e,t),function(e){onmessage=B(new je(e.data))},6,1)}return e}();e.AsyncDeflate=Me;function Ne(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R],function(e){return be(Pe(e.data[0],e.data[1]))},0,n)}function Pe(e,t){return ue(e,t||{},0,0)}var Fe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||M(5),this.d&&M(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=N(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Fe;var Ie=function(){function e(e,t){V([ge,function(){return[B,Fe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new Fe(e.data))},7,0)}return e}();e.AsyncInflate=Ie;function Le(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge],function(e){return be(Re(e.data[0],xe(e.data[1])))},1,n)}function Re(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}var ze=function(){function e(e,t){this.c=ce(),this.l=0,this.v=1,je.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,je.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ue(e,this.o,this.v&&De(this.o),t&&8,this.s);this.v&&=(U(n,this.o),0),t&&(Te(n,n.length-8,this.c.d()),Te(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){je.prototype.flush.call(this,e)},e}();e.Gzip=ze,e.Compress=ze;var Be=function(){function e(e,t){V([R,_e,function(){return[B,je,ze]}],this,Ae.call(this,e,t),function(e){onmessage=B(new ze(e.data))},8,1)}return e}();e.AsyncGzip=Be,e.AsyncCompress=Be;function Ve(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R,_e,function(){return[He]}],function(e){return be(He(e.data[0],e.data[1]))},2,n)}function He(e,t){t||={};var n=ce(),r=e.length;n.p(e);var i=ue(e,t,De(t),8),a=i.length;return U(i,t),Te(i,a-8,n.d()),Te(i,a-4,r),i}var Ue=function(){function e(e,t){this.v=1,this.r=0,Fe.call(this,e,t)}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?W(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Fe.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Fe.prototype.c.call(this,t)},e}();e.Gunzip=Ue;var We=function(){function e(e,t){var n=this;V([ge,ve,function(){return[B,Fe,Ue]}],this,Ae.call(this,e,t),function(e){var t=new Ue(e.data);t.onmember=function(e){return postMessage(e)},onmessage=B(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=We;function Ge(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge,ve,function(){return[Ke]}],function(e){return be(Ke(e.data[0],e.data[1]))},3,n)}function Ke(e,t){var n=W(e);return n+8>e.length&&M(6,`invalid gzip data`),N(e.subarray(n,-8),{i:2},t&&t.out||new r(Ee(e)),t&&t.dictionary)}var qe=function(){function e(e,t){this.c=le(),this.v=1,je.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),je.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ue(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(Oe(n,this.o),0),t&&Te(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){je.prototype.flush.call(this,e)},e}();e.Zlib=qe,e.AsyncZlib=function(){function e(e,t){V([R,z,function(){return[B,je,qe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new qe(e.data))},10,1)}return e}();function Je(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R,z,function(){return[Ye]}],function(e){return be(Ye(e.data[0],e.data[1]))},4,n)}function Ye(e,t){t||={};var n=le();n.p(e);var r=ue(e,t,t.dictionary?6:2,4);return Oe(r,t),Te(r,r.length-4,n.d()),r}var Xe=function(){function e(e,t){Fe.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ke(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&M(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Fe.prototype.c.call(this,t)},e}();e.Unzlib=Xe;var Ze=function(){function e(e,t){V([ge,ye,function(){return[B,Fe,Xe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new Xe(e.data))},11,0)}return e}();e.AsyncUnzlib=Ze;function Qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge,ye,function(){return[$e]}],function(e){return be($e(e.data[0],xe(e.data[1])))},5,n)}function $e(e,t){return N(e.subarray(ke(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var et=function(){function e(e,t){this.o=Ae.call(this,e,t)||{},this.G=Ue,this.I=Fe,this.Z=Xe}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||M(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=et,e.AsyncDecompress=function(){function e(e,t){et.call(this,e,t),this.queuedSize=0,this.G=We,this.I=Ie,this.Z=Ze}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,et.prototype.push.call(this,e,t)},e}();function tt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),e[0]==31&&e[1]==139&&e[2]==8?Ge(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Le(e,t,n):Qe(e,t,n)}function nt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Ke(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Re(e,t):$e(e,t)}var rt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=de(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],rt(o,s,n,i))}},it=typeof TextEncoder<`u`&&new TextEncoder,at=typeof TextDecoder<`u`&&new TextDecoder,ot=0;try{at.decode(oe,{stream:!0}),ot=1}catch{}var st=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,ot?this.t=new TextDecoder:this.p=oe}return e.prototype.push=function(e,t){if(this.ondata||M(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&M(8),this.t=null);return}this.p||M(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=st(n),a=i.s,o=i.r;t?(o.length&&M(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||M(5),this.d&&M(4),this.ondata(ct(e),this.d=t||!1)},e}();function ct(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(it)return it.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function lt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(at)return at.decode(e);var i=st(e),a=i.s,n=i.r;return n.length&&M(8),a}var ut=function(e){return e==1?3:e<6?2:+(e==9)},dt=function(e,t){return t+30+Ce(e,t+26)+Ce(e,t+28)},ft=function(e,t,n){var r=Ce(e,t+28),i=Ce(e,t+30),a=lt(e.subarray(t+46,t+46+r),!(Ce(e,t+8)&2048)),o=t+46+r,s=pt(e,o,i,n,we(e,t+20),we(e,t+24),we(e,t+42)),c=s[0],l=s[1],u=s[2];return[Ce(e,t+10),c,l,a,o+i+Ce(e,t+32),u]},pt=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+Ce(e,t+2))if(Ce(e,t)==1)return[s?H(e,t+4+8*c):i,c?H(e,t+4):a,l?H(e,t+4+8*(c+s)):o,1];r<2&&M(13)}return[i,a,o,0]},mt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},ht=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=mt(l);Te(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),Te(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Te(e,t,n.crc),Te(e,t+4,a<0?-a-2:a),Te(e,t+8,n.size)),Te(e,t+12,c),Te(e,t+14,d),t+=16,o!=null&&(Te(e,t,u),Te(e,t+6,n.attrs),Te(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Te(e,t,+m),Te(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},gt=function(e,t,n,r,i){Te(e,t,101010256),Te(e,t+8,n),Te(e,t+10,n),Te(e,t+12,r),Te(e,t+16,i)},_t=function(){function e(e){this.filename=e,this.c=ce(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||M(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=_t,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},_t.call(this,e),this.d=new je(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=ut(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){_t.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},_t.call(this,e),this.d=new Me(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=ut(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){_t.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||M(5),this.d&2)this.ondata(M(4+(this.d&1)*8,0,1),null,!1);else{var n=ct(e.filename),i=n.length,a=e.comment,o=a&&ct(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+mt(e.extra)+30;i>65535&&this.ondata(M(11,0,1),null,!1);var l=new r(c);ht(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=de(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Te(o,0,134695760),Te(o,4,e.crc),Te(o,8,h),Te(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(M(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+mt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];ht(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+mt(o.extra)+(o.o?o.o.length:0),t+=o.b}gt(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function vt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i={};rt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){xt(function(){n(e,t)})};xt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;ht(e,c,a,a.f,a.u,o);var d=30+a.f.length+mt(a.extra),f=c+d;e.set(a.c,f),ht(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}gt(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=ce(),g=r.length;h.p(r);var _=ct(t),v=_.length,y=l.comment,b=y&&ct(y),x=b&&b.length,S=mt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=de(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(M(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,Pe(r,l))}catch(e){w(e,null)}else d.push(Ne(r,l,w))},g=0;g<l;++g)h(g);return f}function yt(e,t){t||={};var n={},i=[];rt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=ct(s),p=f.length,m=u.comment,h=m&&ct(m),g=h&&h.length,_=mt(u.extra);p>65535&&M(11);var v=d?Pe(l,u):l,y=v.length,b=ce();b.p(l),i.push(de(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];ht(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+mt(f.extra);x.set(f.c,f.o+T),ht(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return gt(x,a,i.length,C,S),x}var bt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=bt,e.UnzipInflate=function(){function e(){var e=this;this.i=new Fe(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Fe(function(e,t){n.ondata(null,e,t)}):(this.i=new Ie(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:bt},this.p=oe}return e.prototype.push=function(e,t){var n=this;if(this.onfile||M(5),this.p||M(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=we(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=Ce(l,s+6),r=Ce(l,s+8),i=t&2048,a=t&8,f=Ce(l,s+26),p=Ce(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=we(l,s+18),_=we(l,s+22),v=lt(l.subarray(s+30,s+=30+f),!i),y=pt(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||M(5),!b)w.ondata(null,oe,!0);else{var e=n.o[r];e||w.ondata(M(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(oe,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=oe,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(we(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&M(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var xt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function St(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){xt(function(){n(e,t)})};xt(function(){s=n});for(var c=e.length-22;we(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(M(13,0,1),null),a;var l=Ce(e,c+8);if(l){var u=l,d=we(e,c+16),f=we(e,c-20)==117853008;if(f){var p=we(e,c-12);f=we(e,p)==101075792,f&&(u=l=we(e,p+32),d=we(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=ft(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=dt(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Re(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(Le(b,{size:p},y))}else y(M(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function Ct(e,t){for(var n={},i=e.length-22;we(e,i)!=101010256;--i)(!i||e.length-i>65558)&&M(13);var a=Ce(e,i+8);if(!a)return{};var o=we(e,i+16),s=we(e,i-20)==117853008;if(s){var c=we(e,i-12);s=we(e,c)==101075792,s&&(a=we(e,c+32),o=we(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=ft(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=dt(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Re(e.subarray(v,v+p),{out:new r(m)}):M(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),aE=_(m(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r(lv(),(qw(),v(ww)),Xw(),(rE(),v(nT)),iE()):typeof define==`function`&&define.amd?define([`three`,`three-spritetext`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i){var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:a(l(e)),d(t||!e||!e.__esModule||!u.call(e,`default`)?o(n,`default`,{value:e,enumerable:!0}):n,e));e=f(e,1),t=f(t,1);var p={name:`zincjs`,version:`2.3.1-beta.1`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,engines:{node:`24.20.0`},allowScripts:{"gl@8.1.6":!0,"msw@2.14.6":!0},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,gl:`^8.1.6`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.185.1`,"three-spritetext":`1.6.2`}},m=new e.Matrix4,h=new e.Object3D,g=new e.Vector3,_=new e.Vector3;function v(){this.uuid=e.MathUtils.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}v.prototype=Object.assign(Object.create(e.EventDispatcher.prototype),{constructor:v,isGeometry:!0,applyMatrix4:function(t){let n=new e.Matrix3().getNormalMatrix(t);for(let e=0,n=this.vertices.length;e<n;e++)this.vertices[e].applyMatrix4(t);for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal.applyMatrix3(n).normalize();for(let e=0,r=t.vertexNormals.length;e<r;e++)t.vertexNormals[e].applyMatrix3(n).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return m.makeRotationX(e),this.applyMatrix4(m),this},rotateY:function(e){return m.makeRotationY(e),this.applyMatrix4(m),this},rotateZ:function(e){return m.makeRotationZ(e),this.applyMatrix4(m),this},translate:function(e,t,n){return m.makeTranslation(e,t,n),this.applyMatrix4(m),this},scale:function(e,t,n){return m.makeScale(e,t,n),this.applyMatrix4(m),this},lookAt:function(e){return h.lookAt(e),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(t){let n=this,r=t.index===null?void 0:t.index,i=t.attributes;if(i.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;let a=i.position,o=i.normal,s=i.color,c=i.uv,l=i.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let t=0;t<a.count;t++)n.vertices.push(new e.Vector3().fromBufferAttribute(a,t)),s!==void 0&&n.colors.push(new e.Color().fromBufferAttribute(s,t));function u(t,r,i,a){let u=s===void 0?[]:[n.colors[t].clone(),n.colors[r].clone(),n.colors[i].clone()],d=new b(t,r,i,o===void 0?[]:[new e.Vector3().fromBufferAttribute(o,t),new e.Vector3().fromBufferAttribute(o,r),new e.Vector3().fromBufferAttribute(o,i)],u,a);n.faces.push(d),c!==void 0&&n.faceVertexUvs[0].push([new e.Vector2().fromBufferAttribute(c,t),new e.Vector2().fromBufferAttribute(c,r),new e.Vector2().fromBufferAttribute(c,i)]),l!==void 0&&n.faceVertexUvs[1].push([new e.Vector2().fromBufferAttribute(l,t),new e.Vector2().fromBufferAttribute(l,r),new e.Vector2().fromBufferAttribute(l,i)])}let d=t.groups;if(d.length>0)for(let e=0;e<d.length;e++){let t=d[e],n=t.start,i=t.count;for(let e=n,a=n+i;e<a;e+=3)r===void 0?u(e,e+1,e+2,t.materialIndex):u(r.getX(e),r.getX(e+1),r.getX(e+2),t.materialIndex)}else if(r!==void 0)for(let e=0;e<r.count;e+=3)u(r.getX(e),r.getX(e+1),r.getX(e+2));else for(let e=0;e<a.count;e+=3)u(e,e+1,e+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(g).negate(),this.translate(g.x,g.y,g.z),this},normalize:function(){this.computeBoundingSphere();let t=this.boundingSphere.center,n=this.boundingSphere.radius,r=n===0?1:1/n,i=new e.Matrix4;return i.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){let t=new e.Vector3,n=new e.Vector3;for(let e=0,r=this.faces.length;e<r;e++){let r=this.faces[e],i=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];t.subVectors(o,a),n.subVectors(i,a),t.cross(n),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t=!0){let n=Array(this.vertices.length);for(let t=0,r=this.vertices.length;t<r;t++)n[t]=new e.Vector3;if(t){let t=new e.Vector3,r=new e.Vector3;for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),r.subVectors(a,o),t.cross(r),n[i.a].add(t),n[i.b].add(t),n[i.c].add(t)}}else{this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];n[t.a].add(t.normal),n[t.b].add(t.normal),n[t.c].add(t.normal)}}for(let e=0,t=this.vertices.length;e<t;e++)n[e].normalize();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=t.vertexNormals;r.length===3?(r[0].copy(n[t.a]),r[1].copy(n[t.b]),r[2].copy(n[t.c])):(r[0]=n[t.a].clone(),r[1]=n[t.b].clone(),r[2]=n[t.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),n},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=t.vertexNormals;n.length===3?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||=[];for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let t=new v;t.faces=this.faces;for(let n=0,r=this.morphTargets.length;n<r;n++){if(!this.morphNormals[n]){this.morphNormals[n]={},this.morphNormals[n].faceNormals=[],this.morphNormals[n].vertexNormals=[];let t=this.morphNormals[n].faceNormals,r=this.morphNormals[n].vertexNormals;for(let n=0,i=this.faces.length;n<i;n++){let n=new e.Vector3,i={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};t.push(n),r.push(i)}}let r=this.morphNormals[n];t.vertices=this.morphTargets[n].vertices,t.computeFaceNormals();let i=t.computeVertexNormals();if(i&&i.length>0){this.morphTargets[n].normals=Array(this.vertices.length);for(let e=0;e<i.length;e++)this.morphTargets[n].normals[e]=i[e].clone()}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=r.faceNormals[e],i=r.vertexNormals[e];n.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){let n=this.morphTargets.length,r=this.morphTargets,i=e.morphTargets,a=this.morphColors.length,o=this.morphColors,s=e.morphColors;if(n>0&&n==i.length)for(let e=0,n=r.length;e<n;e++){let n=r[e],a=i[e];for(let e=0,r=a.vertices.length;e<r;e++){let r=a.vertices[e].clone();t!==void 0&&r.applyMatrix4(t),n.vertices.push(r)}if(n.normals&&a.normals)for(let e=0;e<a.normals.length;e+=3)_.set(a.normals2[e],a.normals2[e+1],a.normals2[e+2]),t!==void 0&&_.applyMatrix4(t),n.normals.push(_.x,_.y,_.z)}if(a>0&&a==s.length)for(let e=0,t=o.length;e<t;e++){let t=o[e],n=s[e];for(let e=0,r=n.colors;e<r;e++)t.colors.push(n.colors[e].clone())}},merge:function(t,n,r=0){if(!(t&&t.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,t);return}let i,a=this.vertices.length,o=this.vertices,s=t.vertices,c=t.normals,l=this.faces,u=t.faces,d=this.colors,f=t.colors;n!==void 0&&(i=new e.Matrix3().getNormalMatrix(n));for(let e=0,t=s.length;e<t;e++){let t=s[e].clone();n!==void 0&&t.applyMatrix4(n),o.push(t)}for(let e=0;e<c.length;e+=3)_.set(c[e],c[e+1],c[e+2]),n!==void 0&&_.applyMatrix4(n),this.normals.push(_.x,_.y,_.z);for(let e=0,t=f.length;e<t;e++)typeof f[e]==`number`?d.push(f[e]):d.push(f[e].clone());for(let e=0,t=u.length;e<t;e++){let t=u[e],n,o,s=t.vertexNormals,c=t.vertexColors,d=new b(t.a+a,t.b+a,t.c+a);d.normal.copy(t.normal),i!==void 0&&d.normal.applyMatrix3(i).normalize();for(let e=0,t=s.length;e<t;e++)n=s[e].clone(),i!==void 0&&n.applyMatrix3(i).normalize(),d.vertexNormals.push(n);d.color.copy(t.color);for(let e=0,t=c.length;e<t;e++)o=c[e],d.vertexColors.push(o.clone());d.materialIndex=t.materialIndex+r,l.push(d)}for(let e=0,n=t.faceVertexUvs.length;e<n;e++){let n=t.faceVertexUvs[e];this.faceVertexUvs[e]===void 0&&(this.faceVertexUvs[e]=[]);for(let t=0,r=n.length;t<r;t++){let r=n[t],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[e].push(i)}}this.mergeMorph(t,n)},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(e=4){let t={},n=[],r=[],i=10**e;for(let e=0,a=this.vertices.length;e<a;e++){let a=this.vertices[e],o=Math.round(a.x*i)+`_`+Math.round(a.y*i)+`_`+Math.round(a.z*i);t[o]===void 0?(t[o]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[o]]}let a=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){a.push(e);break}}for(let e=a.length-1;e>=0;e--){let t=a[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}let o=this.vertices.length-n.length;return this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(let n=0,r=t.length;n<r;n++){let r=t[n];this.vertices.push(new e.Vector3(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){let e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;function n(e,t){return e.materialIndex-t.materialIndex}e.sort(n);let r=this.faceVertexUvs[0],i=this.faceVertexUvs[1],a,o;r&&r.length===t&&(a=[]),i&&i.length===t&&(o=[]);for(let n=0;n<t;n++){let t=e[n]._id;a&&a.push(r[t]),o&&o.push(i[t])}a&&(this.faceVertexUvs[0]=a),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){let e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let n=this.vertices[e];t.push(n.x,n.y,n.z)}let n=[],r=[],i={},a=[],o={},s=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=this.faceVertexUvs[0][e]!==void 0,i=t.normal.length()>0,a=t.vertexNormals.length>0,o=t.color.r!==1||t.color.g!==1||t.color.b!==1,s=t.vertexColors.length>0,c=0;if(c=l(c,0,0),c=l(c,1,!0),c=l(c,2,!1),c=l(c,3,r),c=l(c,4,i),c=l(c,5,a),c=l(c,6,o),c=l(c,7,s),n.push(c),n.push(t.a,t.b,t.c),n.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];n.push(f(t[0]),f(t[1]),f(t[2]))}if(i&&n.push(u(t.normal)),a){let e=t.vertexNormals;n.push(u(e[0]),u(e[1]),u(e[2]))}if(o&&n.push(d(t.color)),s){let e=t.vertexColors;n.push(d(e[0]),d(e[1]),d(e[2]))}}function l(e,t,n){return n?e|1<<t:e&~(1<<t)}function u(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return i[t]===void 0?(i[t]=r.length/3,r.push(e.x,e.y,e.z),i[t]):i[t]}function d(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return o[t]===void 0?(o[t]=a.length,a.push(e.getHex()),o[t]):o[t]}function f(e){let t=e.x.toString()+e.y.toString();return c[t]===void 0?(c[t]=s.length/2,s.push(e.x,e.y),c[t]):c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),s.length>0&&(e.data.uvs=[s]),e.data.faces=n,e},clone:function(){return new v().copy(this)},copy:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());let n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){let n=e.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}let i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){let t={};if(t.name=i[e].name,i[e].vertices!==void 0){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(i[e].normals!==void 0){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}let a=e.morphNormals;for(let e=0,t=a.length;e<t;e++){let t={};if(a[e].vertexNormals!==void 0){t.vertexNormals=[];for(let n=0,r=a[e].vertexNormals.length;n<r;n++){let r=a[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(a[e].faceNormals!==void 0){t.faceNormals=[];for(let n=0,r=a[e].faceNormals.length;n<r;n++)t.faceNormals.push(a[e].faceNormals[n].clone())}this.morphNormals.push(t)}let o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());let s=e.skinIndices;for(let e=0,t=s.length;e<t;e++)this.skinIndices.push(s[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},computeGroups(){let e=[],t,n,r,i=this.faces;for(n=0;n<i.length;n++){let a=i[n];a.materialIndex!==r&&(r=a.materialIndex,t!==void 0&&(t.count=n*3-t.start,e.push(t)),t={start:n*3,materialIndex:r})}return t!==void 0&&(t.count=n*3-t.start,e.push(t)),e},toBufferGeometry:function(){let t=new y().fromGeometry(this),n=new e.BufferGeometry,r=new Float32Array(t.vertices.length*3);if(n.setAttribute(`position`,re(new e.BufferAttribute(r,3),t.vertices)),t.normals.length>0){let r=new Float32Array(t.normals.length*3);n.setAttribute(`normal`,re(new e.BufferAttribute(r,3),t.normals))}if(t.colors.length>0){let r=new Float32Array(t.colors.length*3);n.setAttribute(`color`,re(new e.BufferAttribute(r,3),t.colors))}if(t.uvs.length>0){let r=new Float32Array(t.uvs.length*2);n.setAttribute(`uv`,ne(new e.BufferAttribute(r,2),t.uvs))}if(t.uvs2.length>0){let r=new Float32Array(t.uvs2.length*2);n.setAttribute(`uv2`,ne(new e.BufferAttribute(r,2),t.uvs2))}n.groups=t.groups;for(let r in t.morphTargets){let i=[],a=t.morphTargets[r];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=new e.Float32BufferAttribute(n.data.length*3,3);r.name=n.name,i.push(re(r,n.data))}n.morphAttributes[r]=i}if(t.skinIndices.length>0){let r=new e.Float32BufferAttribute(t.skinIndices.length*4,4);I(r,t.skinIndices),n.setAttribute(`skinIndex`,r)}if(t.skinWeights.length>0){let r=new e.Float32BufferAttribute(t.skinWeights.length*4,4);I(r,t.skinWeights),n.setAttribute(`skinWeight`,r)}return t.boundingSphere!==null&&(n.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(n.boundingBox=t.boundingBox.clone()),n},toIndexedBufferGeometry:function(){let t=new e.BufferGeometry,n=new Float32Array(this.vertices.length*3);if(t.setAttribute(`position`,re(new e.BufferAttribute(n,3),this.vertices)),this.normals.length>0){let n=new Float32Array(this.normals.length),r=new e.BufferAttribute(n,3).copyArray(this.normals);t.setAttribute(`normal`,r)}if(this.uvs.length>0&&this.uvs[0].length>0){let n=new Float32Array(this.uvs[0].length*2);t.setAttribute(`uv`,new e.BufferAttribute(n,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){let n=new Float32Array(this.uvs[1].length*2);t.setAttribute(`uv2`,new e.BufferAttribute(n,2).copyArray(this.uvs[1]))}if(this.colors.length>0){let n=[];for(let t=0;t<this.colors.length;t++)n.push(new e.Color(this.colors[t]));let r=new Float32Array(n.length*3);t.setAttribute(`color`,ie(new e.BufferAttribute(r,3),n))}else{let n=new Float32Array(this.vertices.length*3);for(let e=0;e<this.vertices.length*3;e++)n[e]=1;t.setAttribute(`color`,new e.BufferAttribute(n,3))}if(this.faces.length>0){let e=[],n=[];for(let t=0;t<this.faces.length;t++){n.push(this.faces[t].a,this.faces[t].b,this.faces[t].c);let r=this.faces[t].vertexColors;if(r.length===3)e.push(r[0],r[1],r[2]);else{let n=this.faces[t].color;e.push(n,n,n)}}t.setIndex(n),t.groups=this.computeGroups()}if(this.morphTargets.length>0){let n=[],r=[];for(let t=0,i=this.morphTargets.length;t<i;t++){let i=this.morphTargets[t],a=new e.Float32BufferAttribute(i.vertices.length*3,3);if(a.name=i.name,n.push(re(a,i.vertices)),i.normals){let t=new e.Float32BufferAttribute(i.normals.length*3,3);t.name=i.name,r.push(re(t,i.normals))}}t.morphAttributes.position=n,t.morphAttributes.normal=r}if(this.skinIndices.length>0){let n=new e.Float32BufferAttribute(this.skinIndices.length*4,4);t.setAttribute(`skinIndex`,n.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){let n=new e.Float32BufferAttribute(this.skinWeights.length*4,4);t.setAttribute(`skinWeight`,n.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(t.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(t.boundingBox=this.boundingBox.clone()),t},computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)},dispose:function(){this.dispatchEvent({type:`dispose`})}}),v.createBufferGeometryFromObject=function(t){let n=new e.BufferGeometry,r=t.geometry;if(t.isPoints||t.isLine){let t=new e.Float32BufferAttribute(r.vertices.length*3,3);re(t,r.vertices);let i=new e.Float32BufferAttribute(r.colors.length*3,3);if(ie(i,r.colors),n.setAttribute(`position`,t),n.setAttribute(`color`,i),r.lineDistances&&r.lineDistances.length===r.vertices.length){let t=new e.Float32BufferAttribute(r.lineDistances.length,1);n.setAttribute(`lineDistance`,t.copyArray(r.lineDistances))}r.boundingSphere!==null&&(n.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(n.boundingBox=r.boundingBox.clone())}else t.isMesh&&(n=r.toBufferGeometry());return n};var y=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],n,r,i,a=e.faces;for(r=0;r<a.length;r++){let e=a[r];e.materialIndex!==i&&(i=e.materialIndex,n!==void 0&&(n.count=r*3-n.start,t.push(n)),n={start:r*3,materialIndex:i})}n!==void 0&&(n.count=r*3-n.start,t.push(n)),this.groups=t}fromGeometry(t){let n=t.faces,r=t.vertices,i=t.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length,l;if(c>0){l=[];for(let e=0;e<c;e++)l[e]={name:s[e].name,data:[]};this.morphTargets.position=l}let u=t.morphNormals,d=u.length,f;if(d>0){f=[];for(let e=0;e<d;e++)f[e]={name:u[e].name,data:[]};this.morphTargets.normal=f}let p=t.skinIndices,m=t.skinWeights,h=p.length===r.length,g=m.length===r.length;r.length>0&&n.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(let t=0;t<n.length;t++){let _=n[t];this.vertices.push(r[_.a],r[_.b],r[_.c]);let v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{let e=_.normal;this.normals.push(e,e,e)}let y=_.vertexColors;if(y.length===3)this.colors.push(y[0],y[1],y[2]);else{let e=_.color;this.colors.push(e,e,e)}if(a===!0){let n=i[0][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,t),this.uvs.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs.push(n[0],n[1],n[2])}if(o===!0){let n=i[1][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,t),this.uvs2.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs2.push(n[0],n[1],n[2])}for(let e=0;e<c;e++){let t=s[e].vertices;l[e].data.push(t[_.a],t[_.b],t[_.c])}for(let e=0;e<d;e++){let n=u[e].vertexNormals[t];f[e].data.push(n.a,n.b,n.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},b=class{constructor(t,n,r,i,a,o=0){this.a=t,this.b=n,this.c=r,this.normal=i&&i.isVector3?i:new e.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=a&&a.isColor?a:new e.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},x=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,S=t.default.default||t.default;function C(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function w(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function T(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function E(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)T(e[t],t,o,n)}var D=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},O=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){let n=e.morphAttributes.color,r=t.morphTargetInfluences,i=r.length;e.deleteAttribute(`morphColor0`),e.deleteAttribute(`morphColor1`);let a=0,o=[];for(let e=0;1>a||e<i;e++)r[e]>0&&(a++,o.push([e,r[e]]));o.length==2?(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[1][0]])):o.length==1&&(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[0][0]]))}},k=(t,n)=>{let r;return t instanceof v?(n.localTimeEnabled&&!t.morphNormalsReady&&(t.morphNormals==null||t.morphNormals.length==0)&&t.computeMorphNormals(),r=t.toIndexedBufferGeometry(),n.localMorphColour&&A(t,r)):t instanceof e.BufferGeometry&&(r=t.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),t._video&&(r._video=t._video),r},A=(t,n)=>{if(t&&t.morphColors&&t.morphColors.length>0){let r=[],i=t.morphColors;for(let t=0,n=i.length;t<n;t++){let n=i[t],a=[];for(let e=0;e<n.colors.length*3;e++){let t=D(n.colors,e);a.push(t[0],t[1],t[2])}let o=new e.Float32BufferAttribute(a,3);o.name=n.name,r.push(o)}n.morphAttributes.color=r}};function j(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var M=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=j(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=j(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function N(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function P(){let t=new Image;t.src=x;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function F(e,t,n,r,i,a){let o=new S(e,t,n,r,i,a);return o.canvasScale=4,o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!0,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=10001,o}function ee(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function te(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}function ne(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y}return e.needsUpdate=!0,e}function re(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z}return e.needsUpdate=!0,e}function I(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z,n[r++]=i.w}return e.needsUpdate=!0,e}function ie(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.r,n[r++]=i.g,n[r++]=i.b}return e.needsUpdate=!0,e}var ae=function(e){e.vertexShader=e.vertexShader.replace(`#include <morphcolor_vertex>`,`
4121
+ @keyframes element-queries { 0% { visibility: inherit; } }`,document.getElementsByTagName(`head`)[0].appendChild(t),!0);for(var i=0,a=document.styleSheets.length;i<a;i++)try{document.styleSheets[i].href&&document.styleSheets[i].href.indexOf(`file://`)===0&&console.warn(`CssElementQueries: unable to parse local css files, `+document.styleSheets[i].href),_(document.styleSheets[i].cssRules||document.styleSheets[i].rules||document.styleSheets[i].cssText)}catch{}p()},this.findElementQueriesElements=function(e){d(e)},this.update=function(){this.init()}};t.update=function(){t.instance.update()},t.detach=function(e){e.elementQueriesSetupInformation?(e.elementQueriesSensor.detach(),delete e.elementQueriesSetupInformation,delete e.elementQueriesSensor):e.resizeSensorInstance&&(e.resizeSensorInstance.detach(),delete e.resizeSensorInstance)},t.init=function(){t.instance||=new t,t.instance.init()};var n=function(e){if(document.addEventListener)document.addEventListener(`DOMContentLoaded`,e,!1);else if(/KHTML|WebKit|iCab/i.test(navigator.userAgent))var t=setInterval(function(){/loaded|complete/i.test(document.readyState)&&(e(),clearInterval(t))},10);else window.onload=e};return t.findElementQueriesElements=function(e){t.instance.findElementQueriesElements(e)},t.listen=function(){n(t.init)},t})})),$w=m(((e,t)=>{t.exports={ResizeSensor:Zw(),ElementQueries:Qw()}}));function eT(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}let r=n.count-2,i=[];if(t===2)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),a.clearGroups(),a}return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,t),e}var tT=p((()=>{ww()}));function nT(e){let t=new Map,n=new Map,r=e.clone();return rT(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function rT(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)rT(e.children[r],t.children[r],n)}var iT=p((()=>{})),aT=h({GLTFLoader:()=>yT});function oT(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function sT(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function cT(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new gC({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function lT(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function uT(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function dT(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function fT(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function pT(e){let t,n=e.extensions&&e.extensions[bT.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+mT(n.attributes):e.indices+`:`+mT(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+mT(e.targets[n]);return t}function mT(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function hT(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function gT(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function _T(e,t,n){let r=t.attributes,i=new Qb;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new $(t[0],t[1],t[2]),new $(a[0],a[1],a[2])),e.normalized){let t=hT(XT[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new $,t=new $;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=hT(XT[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new Sx;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function vT(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=eE[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return Yy.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Yy.workingColorSpace}" not supported.`),uT(e,t),_T(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:dT(e,t.targets,n)})}var yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE=p((()=>{ww(),tT(),iT(),yT=class extends FC{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new wT(e)}),this.register(function(e){return new TT(e)}),this.register(function(e){return new PT(e)}),this.register(function(e){return new FT(e)}),this.register(function(e){return new IT(e)}),this.register(function(e){return new DT(e)}),this.register(function(e){return new OT(e)}),this.register(function(e){return new kT(e)}),this.register(function(e){return new AT(e)}),this.register(function(e){return new CT(e)}),this.register(function(e){return new jT(e)}),this.register(function(e){return new ET(e)}),this.register(function(e){return new NT(e)}),this.register(function(e){return new MT(e)}),this.register(function(e){return new xT(e)}),this.register(function(e){return new LT(e,bT.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new LT(e,bT.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new RT(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=cw.extractUrlBase(e);a=cw.resolveURL(t,this.path)}else a=cw.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new RC(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===zT){try{a[bT.KHR_BINARY_GLTF]=new HT(e)}catch(e){r&&r(e);return}i=JSON.parse(a[bT.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new aE(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case bT.KHR_MATERIALS_UNLIT:a[t]=new ST;break;case bT.KHR_DRACO_MESH_COMPRESSION:a[t]=new UT(i,this.dracoLoader);break;case bT.KHR_TEXTURE_TRANSFORM:a[t]=new WT;break;case bT.KHR_MESH_QUANTIZATION:a[t]=new GT;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},bT={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},xT=class{constructor(e){this.parser=e,this.name=bT.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new Ib(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],Dy);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new sw(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new iw(s),o.distance=c;break;case`spot`:o=new nw(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),uT(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},ST=class{constructor(){this.name=bT.KHR_MATERIALS_UNLIT}getMaterialType(){return aS}extendParams(e,t,n){let r=[];e.color=new Ib(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Dy),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,Ey))}return Promise.all(r)}},CT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},wT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vy(e,e)}return Promise.all(r)}},TT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_DISPERSION}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},ET=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},DT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_SHEEN}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new Ib(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Dy)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,Ey)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},OT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},kT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_VOLUME}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ib().setRGB(i[0],i[1],i[2],Dy),Promise.all(r)}},AT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_IOR}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);return n===null?Promise.resolve():(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3),Promise.resolve())}},jT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_SPECULAR}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new Ib().setRGB(i[0],i[1],i[2],Dy),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,Ey)),Promise.all(r)}},MT=class{constructor(e){this.parser=e,this.name=bT.EXT_MATERIALS_BUMP}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},NT=class{constructor(e){this.parser=e,this.name=bT.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return sT(this.parser,e,this.name)===null?null:_C}extendMaterialParams(e,t){let n=sT(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},PT=class{constructor(e){this.parser=e,this.name=bT.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},FT=class{constructor(e){this.parser=e,this.name=bT.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},IT=class{constructor(e){this.parser=e,this.name=bT.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},LT=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},RT=class{constructor(e){this.name=bT.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==YT.TRIANGLES&&e.mode!==YT.TRIANGLE_STRIP&&e.mode!==YT.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new ib,n=new $,a=new Hy,s=new $(1,1,1),c=new VS(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));for(let t in o)if(t===`_COLOR_0`){let e=o[t];c.instanceColor=new NS(e.array,e.itemSize,e.normalized)}else t!==`TRANSLATION`&&t!==`ROTATION`&&t!==`SCALE`&&e.geometry.setAttribute(t,o[t]);jb.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},zT=`glTF`,BT=12,VT={JSON:1313821514,BIN:5130562},HT=class{constructor(e){this.name=bT.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,BT),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==zT)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-BT,i=new DataView(e,BT),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===VT.JSON){let r=new Uint8Array(e,BT+a,t);this.content=n.decode(r)}else if(r===VT.BIN){let n=BT+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},UT=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=bT.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=eE[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=eE[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=XT[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,Dy,n)})})}},WT=class{constructor(){this.name=bT.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0?e:(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e)}},GT=class{constructor(){this.name=bT.KHR_MESH_QUANTIZATION}},KT=class extends vC{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},qT=new Hy,JT=class extends KT{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return qT.fromArray(i).normalize().toArray(i),i}},YT={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},XT={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ZT={9728:cy,9729:dy,9984:ly,9985:fy,9986:uy,9987:py},QT={33071:oy,33648:sy,10497:ay},$T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},eE={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},tE={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},nE={CUBICSPLINE:void 0,LINEAR:yy,STEP:vy},rE={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},iE=new ib,aE=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new oT,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}this.textureLoader=typeof createImageBitmap>`u`||n&&r<17||i&&a<98?new VC(this.options.manager):new uw(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new RC(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return lT(i,a,r),uT(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[bT.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(cw.resolveURL(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=$T[r.type],t=XT[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new hx(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=$T[r.type],o=XT[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new jx(f,u/s),t.cache.add(n,c)),p=new Nx(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new hx(f,a,d);if(r.sparse!==void 0){let t=$T.SCALAR,n=XT[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new hx(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=ZT[n.magFilter]||1006,t.minFilter=ZT[n.minFilter]||1008,t.wrapS=QT[n.wrapS]||1e3,t.wrapT=QT[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new nb(e);t.needsUpdate=!0,n(t)}),t.load(cw.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),uT(e,a),e.userData.mimeType=a.mimeType||gT(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[bT.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[bT.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[bT.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new lC,Fx.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new XS,Fx.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return gC}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[bT.KHR_MATERIALS_UNLIT]){let e=r[bT.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Ib(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Dy),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Ey)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||rE.OPAQUE;if(l===rE.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===rE.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==aS&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new Vy(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==aS&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==aS){let e=i.emissiveFactor;o.emissive=new Ib().setRGB(e[0],e[1],e[2],Dy)}return i.emissiveTexture!==void 0&&a!==aS&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Ey)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),uT(n,i),t.associations.set(n,{materials:e}),i.extensions&&lT(r,n,i),n})}createUniqueName(e){let t=Sw.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[bT.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return vT(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=pT(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[bT.KHR_DRACO_MESH_COMPRESSION]?i(o):vT(new Ax,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?cT(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===YT.TRIANGLES||u.mode===YT.TRIANGLE_STRIP||u.mode===YT.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new DS(l,f):new _S(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),u.mode===YT.TRIANGLE_STRIP?d.geometry=eT(d.geometry,1):u.mode===YT.TRIANGLE_FAN&&(d.geometry=eT(d.geometry,2));else if(u.mode===YT.LINES)d=new sC(l,f);else if(u.mode===YT.LINE_STRIP)d=new iC(l,f);else if(u.mode===YT.LINE_LOOP)d=new cC(l,f);else if(u.mode===YT.POINTS)d=new mC(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&fT(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),uT(d,i),u.extensions&&lT(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&lT(r,c[0],i),c[0];let l=new Mb;i.extensions&&lT(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new ew(By.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new aw(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),uT(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new ib;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new MS(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new jC(i,void 0,l);return uT(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,iE)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new $().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new OS:t.length>1?new Mb:t.length===1?t[0]:new jb,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),uT(o,i),i.extensions&&lT(n,o,i),i.matrix!==void 0){let e=new ib;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new Mb;n.name&&(i.name=r.createUniqueName(n.name)),uT(i,n),n.extensions&&lT(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(nT(n))}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof Fx||e instanceof nb)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}tE[i.path]===tE.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(tE[i.path]){case tE.weights:l=EC;break;case tE.rotation:l=OC;break;case tE.translation:case tE.scale:l=AC;break;default:switch(n.itemSize){case 1:l=EC;break;default:l=AC}}let u=r.interpolation===void 0?yy:nE[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+tE[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=hT(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof OC?JT:KT)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),sE=m((e=>{e.deflate=Ne,e.deflateSync=Pe,e.inflate=Le,e.inflateSync=Re,e.gzip=Ve,e.compress=Ve,e.gzipSync=He,e.compressSync=He,e.gunzip=Ge,e.gunzipSync=Ke,e.zlib=Je,e.zlibSync=Ye,e.unzlib=Qe,e.unzlibSync=$e,e.gzip=Ve,e.compress=Ve,e.decompress=tt,e.decompressSync=nt,e.strToU8=ct,e.strFromU8=lt,e.zip=vt,e.zipSync=yt,e.unzip=St,e.unzipSync=Ct;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,j=a*8;do{if(!b){g=D(e,_,1);var N=D(e,_+1,3);if(_+=3,!N){var P=k(_)+4,F=e[P-4]|e[P-3]<<8,ee=P+F;if(ee>a){p&&M(0);break}f&&h(v+F),n.set(e.subarray(P,ee),v),t.b=v+=F,t.p=_=ee*8,t.f=g;continue}if(N==1)b=C,x=T,S=9,w=5;else if(N==2){var te=D(e,_,31)+257,ne=D(e,_+10,15)+4,re=te+D(e,_+5,31)+1;_+=14;for(var I=new r(re),ie=new r(19),ae=0;ae<ne;++ae)ie[c[ae]]=D(e,_+ae*3,7);_+=ne*3;for(var oe=E(ie),se=(1<<oe)-1,L=y(ie,oe,1),ae=0;ae<re;){var ce=L[D(e,_,se)];_+=ce&15;var P=ce>>4;if(P<16)I[ae++]=P;else{var le=0,ue=0;for(P==16?(ue=3+D(e,_,3),_+=2,le=I[ae-1]):P==17?(ue=3+D(e,_,7),_+=3):P==18&&(ue=11+D(e,_,127),_+=7);ue--;)I[ae++]=le}}var de=I.subarray(0,te),fe=I.subarray(te);S=E(de),w=E(fe),b=y(de,S,1),x=y(fe,w,1)}else M(1);if(_>j){p&&M(0);break}}f&&h(v+131072);for(var pe=(1<<S)-1,me=(1<<w)-1,he=_;;he=_){var le=b[O(e,_)&pe],ge=le>>4;if(_+=le&15,_>j){p&&M(0);break}if(le||M(2),ge<256)n[v++]=ge;else if(ge==256){he=_,b=null;break}else{var R=ge-254;if(ge>264){var ae=ge-257,_e=o[ae];R=D(e,_,(1<<_e)-1)+d[ae],_+=_e}var ve=x[O(e,_)&me],z=ve>>4;ve||M(3),_+=ve&15;var fe=m[z];if(z>3){var _e=s[z];fe+=O(e,_)&(1<<_e)-1,_+=_e}if(_>j){p&&M(0);break}f&&h(v+131072);var ye=v+R;if(v<fe){var be=l-fe,xe=Math.min(fe,ye);for(be+v<0&&M(3);v<xe;++v)n[v]=i[be+v]}for(;v<ye;++v)n[v]=n[v-fe]}}t.l=b,t.p=he,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},F=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ee=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:oe,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=te(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},te=function(e,t,n){return e.s==-1?Math.max(te(e.l,t,n+1),te(e.r,t,n+1)):t[e.s]=n},ne=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},re=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},I=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},ie=function(e,t,n,r,a,l,u,d,f,p,m){P(t,m++,n),++a[256];for(var h=ee(a,15),g=h.t,_=h.l,v=ee(l,15),C=v.t,T=v.l,E=ne(g),D=E.c,O=E.n,k=ne(C),A=k.c,j=k.n,M=new i(19),N=0;N<D.length;++N)++M[D[N]&31];for(var N=0;N<A.length;++N)++M[A[N]&31];for(var te=ee(M,7),ie=te.t,ae=te.l,oe=19;oe>4&&!ie[c[oe-1]];--oe);var se=p+5<<3,L=re(a,b)+re(l,x)+u,ce=re(a,g)+re(l,C)+u+14+3*oe+re(M,ie)+2*M[16]+3*M[17]+7*M[18];if(f>=0&&se<=L&&se<=ce)return I(t,m,e.subarray(f,f+p));var le,ue,de,fe;if(P(t,m,1+(ce<L)),m+=2,ce<L){le=y(g,_,0),ue=g,de=y(C,T,0),fe=C;var pe=y(ie,ae,0);P(t,m,O-257),P(t,m+5,j-1),P(t,m+10,oe-4),m+=14;for(var N=0;N<oe;++N)P(t,m+3*N,ie[c[N]]);m+=3*oe;for(var me=[D,A],he=0;he<2;++he)for(var ge=me[he],N=0;N<ge.length;++N){var R=ge[N]&31;P(t,m,pe[R]),m+=ie[R],R>15&&(P(t,m,ge[N]>>5&127),m+=ge[N]>>12)}}else le=S,ue=b,de=w,fe=x;for(var N=0;N<d;++N){var _e=r[N];if(_e>255){var R=_e>>18&31;F(t,m,le[R+257]),m+=ue[R+257],R>7&&(P(t,m,_e>>23&31),m+=o[R]);var ve=_e&31;F(t,m,de[ve]),m+=fe[ve],ve>3&&(F(t,m,_e>>5&8191),m+=s[ve])}else F(t,m,le[_e]),m+=ue[_e]}return F(t,m,le[256]),m+ue[256]},ae=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oe=new r(0),se=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=ae[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),j=new i(32),M=0,N=0,P=u.i||0,F=0,ee=u.w||0,te=0;P+2<d;++P){var ne=E(P),re=P&32767,oe=C[ne];if(S[re]=oe,C[ne]=re,ee<=P){var se=d-P;if((M>7e3||F>24576)&&(se>423||!g)){_=ie(e,m,0,D,O,j,N,F,te,P-te,_),F=M=N=0,te=P;for(var L=0;L<286;++L)O[L]=0;for(var L=0;L<30;++L)j[L]=0}var ce=2,le=0,ue=b,de=re-oe&32767;if(se>2&&ne==E(P-de))for(var fe=Math.min(y,se)-1,pe=Math.min(32767,P),me=Math.min(258,se);de<=pe&&--ue&&re!=oe;){if(e[P+ce]==e[P+ce-de]){for(var he=0;he<me&&e[P+he]==e[P+he-de];++he);if(he>ce){if(ce=he,le=de,he>fe)break;for(var ge=Math.min(de,he-2),R=0,L=0;L<ge;++L){var _e=P-de+L&32767,ve=_e-S[_e]&32767;ve>R&&(R=ve,oe=_e)}}}re=oe,oe=S[re],de+=re-oe&32767}if(le){D[F++]=268435456|f[ce]<<18|h[le];var z=f[ce]&31,ye=h[le]&31;N+=o[z]+s[ye],++O[257+z],++j[ye],ee=P+ce,++M}else D[F++]=e[P],++O[e[P]]}}for(P=Math.max(P,ee);P<d;++P)D[F++]=e[P],++O[e[P]];_=ie(e,m,g,D,O,j,N,F,te,P-te,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=P,u.w=ee)}else{for(var P=u.w||0;P<d+g;P+=65535){var be=P+65535;be>=d&&(m[_/8|0]=g,be=d),_=I(m,_+1,e.subarray(P,be))}u.i=d}return A(p,0,c+k(_)+l)},L=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),ce=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=L[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},le=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},ue=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return se(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},de=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},fe=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},pe=[],me=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},he=function(e,t,r,i){if(!pe[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=fe(e[c],a,o);pe[r]={c:fe(e[s],a,o),e:o}}var l=de({},pe[r].e);return(0,n.default)(pe[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,me(l),i)},ge=function(){return[r,i,a,o,s,c,d,m,C,T,g,j,y,E,D,O,k,A,M,N,Re,be,xe]},R=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,ae,oe,y,P,F,ee,te,ne,re,I,ie,k,A,se,ue,Pe,be]},_e=function(){return[U,De,Te,ce,L]},ve=function(){return[W,Ee]},z=function(){return[Oe,Te,le]},ye=function(){return[ke]},be=function(e){return postMessage(e,[e.buffer])},xe=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},Se=function(e,t,n,r,i,a){var o=he(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},B=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},V=function(e,t,n,r,i,a,o){var s,c=he(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||M(5),s&&t.ondata(M(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},Ce=function(e,t){return e[t]|e[t+1]<<8},we=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},H=function(e,t){return we(e,t)+we(e,t+4)*4294967296},Te=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},U=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Te(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},W=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&M(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ee=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},De=function(e){return 10+(e.filename?e.filename.length+1:0)},Oe=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=le();i.p(t.dictionary),Te(e,2,i.d())}},ke=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&M(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&M(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Ae(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var je=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(ue(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||M(5),this.s.l&&M(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=oe)},e.prototype.flush=function(e){if(this.ondata||M(5),this.s.l&&M(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=I(t,this.s.r,oe);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=je;var Me=function(){function e(e,t){V([R,function(){return[B,je]}],this,Ae.call(this,e,t),function(e){onmessage=B(new je(e.data))},6,1)}return e}();e.AsyncDeflate=Me;function Ne(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R],function(e){return be(Pe(e.data[0],e.data[1]))},0,n)}function Pe(e,t){return ue(e,t||{},0,0)}var Fe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||M(5),this.d&&M(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=N(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Fe;var Ie=function(){function e(e,t){V([ge,function(){return[B,Fe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new Fe(e.data))},7,0)}return e}();e.AsyncInflate=Ie;function Le(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge],function(e){return be(Re(e.data[0],xe(e.data[1])))},1,n)}function Re(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}var ze=function(){function e(e,t){this.c=ce(),this.l=0,this.v=1,je.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,je.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ue(e,this.o,this.v&&De(this.o),t&&8,this.s);this.v&&=(U(n,this.o),0),t&&(Te(n,n.length-8,this.c.d()),Te(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){je.prototype.flush.call(this,e)},e}();e.Gzip=ze,e.Compress=ze;var Be=function(){function e(e,t){V([R,_e,function(){return[B,je,ze]}],this,Ae.call(this,e,t),function(e){onmessage=B(new ze(e.data))},8,1)}return e}();e.AsyncGzip=Be,e.AsyncCompress=Be;function Ve(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R,_e,function(){return[He]}],function(e){return be(He(e.data[0],e.data[1]))},2,n)}function He(e,t){t||={};var n=ce(),r=e.length;n.p(e);var i=ue(e,t,De(t),8),a=i.length;return U(i,t),Te(i,a-8,n.d()),Te(i,a-4,r),i}var Ue=function(){function e(e,t){this.v=1,this.r=0,Fe.call(this,e,t)}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?W(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Fe.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Fe.prototype.c.call(this,t)},e}();e.Gunzip=Ue;var We=function(){function e(e,t){var n=this;V([ge,ve,function(){return[B,Fe,Ue]}],this,Ae.call(this,e,t),function(e){var t=new Ue(e.data);t.onmember=function(e){return postMessage(e)},onmessage=B(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=We;function Ge(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge,ve,function(){return[Ke]}],function(e){return be(Ke(e.data[0],e.data[1]))},3,n)}function Ke(e,t){var n=W(e);return n+8>e.length&&M(6,`invalid gzip data`),N(e.subarray(n,-8),{i:2},t&&t.out||new r(Ee(e)),t&&t.dictionary)}var qe=function(){function e(e,t){this.c=le(),this.v=1,je.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),je.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ue(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(Oe(n,this.o),0),t&&Te(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){je.prototype.flush.call(this,e)},e}();e.Zlib=qe,e.AsyncZlib=function(){function e(e,t){V([R,z,function(){return[B,je,qe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new qe(e.data))},10,1)}return e}();function Je(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[R,z,function(){return[Ye]}],function(e){return be(Ye(e.data[0],e.data[1]))},4,n)}function Ye(e,t){t||={};var n=le();n.p(e);var r=ue(e,t,t.dictionary?6:2,4);return Oe(r,t),Te(r,r.length-4,n.d()),r}var Xe=function(){function e(e,t){Fe.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ke(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&M(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Fe.prototype.c.call(this,t)},e}();e.Unzlib=Xe;var Ze=function(){function e(e,t){V([ge,ye,function(){return[B,Fe,Xe]}],this,Ae.call(this,e,t),function(e){onmessage=B(new Xe(e.data))},11,0)}return e}();e.AsyncUnzlib=Ze;function Qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),Se(e,t,[ge,ye,function(){return[$e]}],function(e){return be($e(e.data[0],xe(e.data[1])))},5,n)}function $e(e,t){return N(e.subarray(ke(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var et=function(){function e(e,t){this.o=Ae.call(this,e,t)||{},this.G=Ue,this.I=Fe,this.Z=Xe}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||M(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=et,e.AsyncDecompress=function(){function e(e,t){et.call(this,e,t),this.queuedSize=0,this.G=We,this.I=Ie,this.Z=Ze}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,et.prototype.push.call(this,e,t)},e}();function tt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),e[0]==31&&e[1]==139&&e[2]==8?Ge(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Le(e,t,n):Qe(e,t,n)}function nt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Ke(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Re(e,t):$e(e,t)}var rt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=de(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],rt(o,s,n,i))}},it=typeof TextEncoder<`u`&&new TextEncoder,at=typeof TextDecoder<`u`&&new TextDecoder,ot=0;try{at.decode(oe,{stream:!0}),ot=1}catch{}var st=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,ot?this.t=new TextDecoder:this.p=oe}return e.prototype.push=function(e,t){if(this.ondata||M(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&M(8),this.t=null);return}this.p||M(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=st(n),a=i.s,o=i.r;t?(o.length&&M(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||M(5),this.d&&M(4),this.ondata(ct(e),this.d=t||!1)},e}();function ct(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(it)return it.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function lt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(at)return at.decode(e);var i=st(e),a=i.s,n=i.r;return n.length&&M(8),a}var ut=function(e){return e==1?3:e<6?2:+(e==9)},dt=function(e,t){return t+30+Ce(e,t+26)+Ce(e,t+28)},ft=function(e,t,n){var r=Ce(e,t+28),i=Ce(e,t+30),a=lt(e.subarray(t+46,t+46+r),!(Ce(e,t+8)&2048)),o=t+46+r,s=pt(e,o,i,n,we(e,t+20),we(e,t+24),we(e,t+42)),c=s[0],l=s[1],u=s[2];return[Ce(e,t+10),c,l,a,o+i+Ce(e,t+32),u]},pt=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+Ce(e,t+2))if(Ce(e,t)==1)return[s?H(e,t+4+8*c):i,c?H(e,t+4):a,l?H(e,t+4+8*(c+s)):o,1];r<2&&M(13)}return[i,a,o,0]},mt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},ht=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=mt(l);Te(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),Te(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Te(e,t,n.crc),Te(e,t+4,a<0?-a-2:a),Te(e,t+8,n.size)),Te(e,t+12,c),Te(e,t+14,d),t+=16,o!=null&&(Te(e,t,u),Te(e,t+6,n.attrs),Te(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Te(e,t,+m),Te(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},gt=function(e,t,n,r,i){Te(e,t,101010256),Te(e,t+8,n),Te(e,t+10,n),Te(e,t+12,r),Te(e,t+16,i)},_t=function(){function e(e){this.filename=e,this.c=ce(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||M(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=_t,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},_t.call(this,e),this.d=new je(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=ut(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){_t.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},_t.call(this,e),this.d=new Me(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=ut(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){_t.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||M(5),this.d&2)this.ondata(M(4+(this.d&1)*8,0,1),null,!1);else{var n=ct(e.filename),i=n.length,a=e.comment,o=a&&ct(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+mt(e.extra)+30;i>65535&&this.ondata(M(11,0,1),null,!1);var l=new r(c);ht(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=de(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Te(o,0,134695760),Te(o,4,e.crc),Te(o,8,h),Te(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(M(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+mt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];ht(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+mt(o.extra)+(o.o?o.o.length:0),t+=o.b}gt(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function vt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i={};rt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){xt(function(){n(e,t)})};xt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;ht(e,c,a,a.f,a.u,o);var d=30+a.f.length+mt(a.extra),f=c+d;e.set(a.c,f),ht(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}gt(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=ce(),g=r.length;h.p(r);var _=ct(t),v=_.length,y=l.comment,b=y&&ct(y),x=b&&b.length,S=mt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=de(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(M(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,Pe(r,l))}catch(e){w(e,null)}else d.push(Ne(r,l,w))},g=0;g<l;++g)h(g);return f}function yt(e,t){t||={};var n={},i=[];rt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=ct(s),p=f.length,m=u.comment,h=m&&ct(m),g=h&&h.length,_=mt(u.extra);p>65535&&M(11);var v=d?Pe(l,u):l,y=v.length,b=ce();b.p(l),i.push(de(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];ht(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+mt(f.extra);x.set(f.c,f.o+T),ht(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return gt(x,a,i.length,C,S),x}var bt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=bt,e.UnzipInflate=function(){function e(){var e=this;this.i=new Fe(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Fe(function(e,t){n.ondata(null,e,t)}):(this.i=new Ie(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:bt},this.p=oe}return e.prototype.push=function(e,t){var n=this;if(this.onfile||M(5),this.p||M(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=we(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=Ce(l,s+6),r=Ce(l,s+8),i=t&2048,a=t&8,f=Ce(l,s+26),p=Ce(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=we(l,s+18),_=we(l,s+22),v=lt(l.subarray(s+30,s+=30+f),!i),y=pt(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||M(5),!b)w.ondata(null,oe,!0);else{var e=n.o[r];e||w.ondata(M(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(oe,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=oe,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(we(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&M(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var xt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function St(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){xt(function(){n(e,t)})};xt(function(){s=n});for(var c=e.length-22;we(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(M(13,0,1),null),a;var l=Ce(e,c+8);if(l){var u=l,d=we(e,c+16),f=we(e,c-20)==117853008;if(f){var p=we(e,c-12);f=we(e,p)==101075792,f&&(u=l=we(e,p+32),d=we(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=ft(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=dt(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Re(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(Le(b,{size:p},y))}else y(M(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function Ct(e,t){for(var n={},i=e.length-22;we(e,i)!=101010256;--i)(!i||e.length-i>65558)&&M(13);var a=Ce(e,i+8);if(!a)return{};var o=we(e,i+16),s=we(e,i-20)==117853008;if(s){var c=we(e,i-12);s=we(e,c)==101075792,s&&(a=we(e,c+32),o=we(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=ft(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=dt(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Re(e.subarray(v,v+p),{out:new r(m)}):M(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),cE=_(m(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r(lv(),(Xw(),v(Tw)),$w(),(oE(),v(aT)),sE()):typeof define==`function`&&define.amd?define([`three`,`three-spritetext`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i){var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:a(l(e)),d(t||!e||!e.__esModule||!u.call(e,`default`)?o(n,`default`,{value:e,enumerable:!0}):n,e));e=f(e,1),t=f(t,1);var p={name:`zincjs`,version:`2.4.0`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,engines:{node:`24.20.0`},allowScripts:{"gl@8.1.6":!0,"msw@2.14.6":!0},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,gl:`^8.1.6`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.185.1`,"three-spritetext":`1.10.0`}},m=new e.Matrix4,h=new e.Object3D,g=new e.Vector3,_=new e.Vector3;function v(){this.uuid=e.MathUtils.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}v.prototype=Object.assign(Object.create(e.EventDispatcher.prototype),{constructor:v,isGeometry:!0,applyMatrix4:function(t){let n=new e.Matrix3().getNormalMatrix(t);for(let e=0,n=this.vertices.length;e<n;e++)this.vertices[e].applyMatrix4(t);for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal.applyMatrix3(n).normalize();for(let e=0,r=t.vertexNormals.length;e<r;e++)t.vertexNormals[e].applyMatrix3(n).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return m.makeRotationX(e),this.applyMatrix4(m),this},rotateY:function(e){return m.makeRotationY(e),this.applyMatrix4(m),this},rotateZ:function(e){return m.makeRotationZ(e),this.applyMatrix4(m),this},translate:function(e,t,n){return m.makeTranslation(e,t,n),this.applyMatrix4(m),this},scale:function(e,t,n){return m.makeScale(e,t,n),this.applyMatrix4(m),this},lookAt:function(e){return h.lookAt(e),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(t){let n=this,r=t.index===null?void 0:t.index,i=t.attributes;if(i.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;let a=i.position,o=i.normal,s=i.color,c=i.uv,l=i.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let t=0;t<a.count;t++)n.vertices.push(new e.Vector3().fromBufferAttribute(a,t)),s!==void 0&&n.colors.push(new e.Color().fromBufferAttribute(s,t));function u(t,r,i,a){let u=s===void 0?[]:[n.colors[t].clone(),n.colors[r].clone(),n.colors[i].clone()],d=new b(t,r,i,o===void 0?[]:[new e.Vector3().fromBufferAttribute(o,t),new e.Vector3().fromBufferAttribute(o,r),new e.Vector3().fromBufferAttribute(o,i)],u,a);n.faces.push(d),c!==void 0&&n.faceVertexUvs[0].push([new e.Vector2().fromBufferAttribute(c,t),new e.Vector2().fromBufferAttribute(c,r),new e.Vector2().fromBufferAttribute(c,i)]),l!==void 0&&n.faceVertexUvs[1].push([new e.Vector2().fromBufferAttribute(l,t),new e.Vector2().fromBufferAttribute(l,r),new e.Vector2().fromBufferAttribute(l,i)])}let d=t.groups;if(d.length>0)for(let e=0;e<d.length;e++){let t=d[e],n=t.start,i=t.count;for(let e=n,a=n+i;e<a;e+=3)r===void 0?u(e,e+1,e+2,t.materialIndex):u(r.getX(e),r.getX(e+1),r.getX(e+2),t.materialIndex)}else if(r!==void 0)for(let e=0;e<r.count;e+=3)u(r.getX(e),r.getX(e+1),r.getX(e+2));else for(let e=0;e<a.count;e+=3)u(e,e+1,e+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(g).negate(),this.translate(g.x,g.y,g.z),this},normalize:function(){this.computeBoundingSphere();let t=this.boundingSphere.center,n=this.boundingSphere.radius,r=n===0?1:1/n,i=new e.Matrix4;return i.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){let t=new e.Vector3,n=new e.Vector3;for(let e=0,r=this.faces.length;e<r;e++){let r=this.faces[e],i=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];t.subVectors(o,a),n.subVectors(i,a),t.cross(n),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t=!0){let n=Array(this.vertices.length);for(let t=0,r=this.vertices.length;t<r;t++)n[t]=new e.Vector3;if(t){let t=new e.Vector3,r=new e.Vector3;for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),r.subVectors(a,o),t.cross(r),n[i.a].add(t),n[i.b].add(t),n[i.c].add(t)}}else{this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];n[t.a].add(t.normal),n[t.b].add(t.normal),n[t.c].add(t.normal)}}for(let e=0,t=this.vertices.length;e<t;e++)n[e].normalize();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=t.vertexNormals;r.length===3?(r[0].copy(n[t.a]),r[1].copy(n[t.b]),r[2].copy(n[t.c])):(r[0]=n[t.a].clone(),r[1]=n[t.b].clone(),r[2]=n[t.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),n},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=t.vertexNormals;n.length===3?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||=[];for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let t=new v;t.faces=this.faces;for(let n=0,r=this.morphTargets.length;n<r;n++){if(!this.morphNormals[n]){this.morphNormals[n]={},this.morphNormals[n].faceNormals=[],this.morphNormals[n].vertexNormals=[];let t=this.morphNormals[n].faceNormals,r=this.morphNormals[n].vertexNormals;for(let n=0,i=this.faces.length;n<i;n++){let n=new e.Vector3,i={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};t.push(n),r.push(i)}}let r=this.morphNormals[n];t.vertices=this.morphTargets[n].vertices,t.computeFaceNormals();let i=t.computeVertexNormals();if(i&&i.length>0){this.morphTargets[n].normals=Array(this.vertices.length);for(let e=0;e<i.length;e++)this.morphTargets[n].normals[e]=i[e].clone()}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=r.faceNormals[e],i=r.vertexNormals[e];n.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){let n=this.morphTargets.length,r=this.morphTargets,i=e.morphTargets,a=this.morphColors.length,o=this.morphColors,s=e.morphColors;if(n>0&&n==i.length)for(let e=0,n=r.length;e<n;e++){let n=r[e],a=i[e];for(let e=0,r=a.vertices.length;e<r;e++){let r=a.vertices[e].clone();t!==void 0&&r.applyMatrix4(t),n.vertices.push(r)}if(n.normals&&a.normals)for(let e=0;e<a.normals.length;e+=3)_.set(a.normals2[e],a.normals2[e+1],a.normals2[e+2]),t!==void 0&&_.applyMatrix4(t),n.normals.push(_.x,_.y,_.z)}if(a>0&&a==s.length)for(let e=0,t=o.length;e<t;e++){let t=o[e],n=s[e];for(let e=0,r=n.colors;e<r;e++)t.colors.push(n.colors[e].clone())}},merge:function(t,n,r=0){if(!(t&&t.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,t);return}let i,a=this.vertices.length,o=this.vertices,s=t.vertices,c=t.normals,l=this.faces,u=t.faces,d=this.colors,f=t.colors;n!==void 0&&(i=new e.Matrix3().getNormalMatrix(n));for(let e=0,t=s.length;e<t;e++){let t=s[e].clone();n!==void 0&&t.applyMatrix4(n),o.push(t)}for(let e=0;e<c.length;e+=3)_.set(c[e],c[e+1],c[e+2]),n!==void 0&&_.applyMatrix4(n),this.normals.push(_.x,_.y,_.z);for(let e=0,t=f.length;e<t;e++)typeof f[e]==`number`?d.push(f[e]):d.push(f[e].clone());for(let e=0,t=u.length;e<t;e++){let t=u[e],n,o,s=t.vertexNormals,c=t.vertexColors,d=new b(t.a+a,t.b+a,t.c+a);d.normal.copy(t.normal),i!==void 0&&d.normal.applyMatrix3(i).normalize();for(let e=0,t=s.length;e<t;e++)n=s[e].clone(),i!==void 0&&n.applyMatrix3(i).normalize(),d.vertexNormals.push(n);d.color.copy(t.color);for(let e=0,t=c.length;e<t;e++)o=c[e],d.vertexColors.push(o.clone());d.materialIndex=t.materialIndex+r,l.push(d)}for(let e=0,n=t.faceVertexUvs.length;e<n;e++){let n=t.faceVertexUvs[e];this.faceVertexUvs[e]===void 0&&(this.faceVertexUvs[e]=[]);for(let t=0,r=n.length;t<r;t++){let r=n[t],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[e].push(i)}}this.mergeMorph(t,n)},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(e=4){let t={},n=[],r=[],i=10**e;for(let e=0,a=this.vertices.length;e<a;e++){let a=this.vertices[e],o=Math.round(a.x*i)+`_`+Math.round(a.y*i)+`_`+Math.round(a.z*i);t[o]===void 0?(t[o]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[o]]}let a=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){a.push(e);break}}for(let e=a.length-1;e>=0;e--){let t=a[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}let o=this.vertices.length-n.length;return this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(let n=0,r=t.length;n<r;n++){let r=t[n];this.vertices.push(new e.Vector3(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){let e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;function n(e,t){return e.materialIndex-t.materialIndex}e.sort(n);let r=this.faceVertexUvs[0],i=this.faceVertexUvs[1],a,o;r&&r.length===t&&(a=[]),i&&i.length===t&&(o=[]);for(let n=0;n<t;n++){let t=e[n]._id;a&&a.push(r[t]),o&&o.push(i[t])}a&&(this.faceVertexUvs[0]=a),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){let e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let n=this.vertices[e];t.push(n.x,n.y,n.z)}let n=[],r=[],i={},a=[],o={},s=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=this.faceVertexUvs[0][e]!==void 0,i=t.normal.length()>0,a=t.vertexNormals.length>0,o=t.color.r!==1||t.color.g!==1||t.color.b!==1,s=t.vertexColors.length>0,c=0;if(c=l(c,0,0),c=l(c,1,!0),c=l(c,2,!1),c=l(c,3,r),c=l(c,4,i),c=l(c,5,a),c=l(c,6,o),c=l(c,7,s),n.push(c),n.push(t.a,t.b,t.c),n.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];n.push(f(t[0]),f(t[1]),f(t[2]))}if(i&&n.push(u(t.normal)),a){let e=t.vertexNormals;n.push(u(e[0]),u(e[1]),u(e[2]))}if(o&&n.push(d(t.color)),s){let e=t.vertexColors;n.push(d(e[0]),d(e[1]),d(e[2]))}}function l(e,t,n){return n?e|1<<t:e&~(1<<t)}function u(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return i[t]===void 0?(i[t]=r.length/3,r.push(e.x,e.y,e.z),i[t]):i[t]}function d(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return o[t]===void 0?(o[t]=a.length,a.push(e.getHex()),o[t]):o[t]}function f(e){let t=e.x.toString()+e.y.toString();return c[t]===void 0?(c[t]=s.length/2,s.push(e.x,e.y),c[t]):c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),s.length>0&&(e.data.uvs=[s]),e.data.faces=n,e},clone:function(){return new v().copy(this)},copy:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());let n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){let n=e.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}let i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){let t={};if(t.name=i[e].name,i[e].vertices!==void 0){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(i[e].normals!==void 0){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}let a=e.morphNormals;for(let e=0,t=a.length;e<t;e++){let t={};if(a[e].vertexNormals!==void 0){t.vertexNormals=[];for(let n=0,r=a[e].vertexNormals.length;n<r;n++){let r=a[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(a[e].faceNormals!==void 0){t.faceNormals=[];for(let n=0,r=a[e].faceNormals.length;n<r;n++)t.faceNormals.push(a[e].faceNormals[n].clone())}this.morphNormals.push(t)}let o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());let s=e.skinIndices;for(let e=0,t=s.length;e<t;e++)this.skinIndices.push(s[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},computeGroups(){let e=[],t,n,r,i=this.faces;for(n=0;n<i.length;n++){let a=i[n];a.materialIndex!==r&&(r=a.materialIndex,t!==void 0&&(t.count=n*3-t.start,e.push(t)),t={start:n*3,materialIndex:r})}return t!==void 0&&(t.count=n*3-t.start,e.push(t)),e},toBufferGeometry:function(){let t=new y().fromGeometry(this),n=new e.BufferGeometry,r=new Float32Array(t.vertices.length*3);if(n.setAttribute(`position`,re(new e.BufferAttribute(r,3),t.vertices)),t.normals.length>0){let r=new Float32Array(t.normals.length*3);n.setAttribute(`normal`,re(new e.BufferAttribute(r,3),t.normals))}if(t.colors.length>0){let r=new Float32Array(t.colors.length*3);n.setAttribute(`color`,re(new e.BufferAttribute(r,3),t.colors))}if(t.uvs.length>0){let r=new Float32Array(t.uvs.length*2);n.setAttribute(`uv`,ne(new e.BufferAttribute(r,2),t.uvs))}if(t.uvs2.length>0){let r=new Float32Array(t.uvs2.length*2);n.setAttribute(`uv2`,ne(new e.BufferAttribute(r,2),t.uvs2))}n.groups=t.groups;for(let r in t.morphTargets){let i=[],a=t.morphTargets[r];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=new e.Float32BufferAttribute(n.data.length*3,3);r.name=n.name,i.push(re(r,n.data))}n.morphAttributes[r]=i}if(t.skinIndices.length>0){let r=new e.Float32BufferAttribute(t.skinIndices.length*4,4);I(r,t.skinIndices),n.setAttribute(`skinIndex`,r)}if(t.skinWeights.length>0){let r=new e.Float32BufferAttribute(t.skinWeights.length*4,4);I(r,t.skinWeights),n.setAttribute(`skinWeight`,r)}return t.boundingSphere!==null&&(n.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(n.boundingBox=t.boundingBox.clone()),n},toIndexedBufferGeometry:function(){let t=new e.BufferGeometry,n=new Float32Array(this.vertices.length*3);if(t.setAttribute(`position`,re(new e.BufferAttribute(n,3),this.vertices)),this.normals.length>0){let n=new Float32Array(this.normals.length),r=new e.BufferAttribute(n,3).copyArray(this.normals);t.setAttribute(`normal`,r)}if(this.uvs.length>0&&this.uvs[0].length>0){let n=new Float32Array(this.uvs[0].length*2);t.setAttribute(`uv`,new e.BufferAttribute(n,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){let n=new Float32Array(this.uvs[1].length*2);t.setAttribute(`uv2`,new e.BufferAttribute(n,2).copyArray(this.uvs[1]))}if(this.colors.length>0){let n=[];for(let t=0;t<this.colors.length;t++)n.push(new e.Color(this.colors[t]));let r=new Float32Array(n.length*3);t.setAttribute(`color`,ie(new e.BufferAttribute(r,3),n))}else{let n=new Float32Array(this.vertices.length*3);for(let e=0;e<this.vertices.length*3;e++)n[e]=1;t.setAttribute(`color`,new e.BufferAttribute(n,3))}if(this.faces.length>0){let e=[],n=[];for(let t=0;t<this.faces.length;t++){n.push(this.faces[t].a,this.faces[t].b,this.faces[t].c);let r=this.faces[t].vertexColors;if(r.length===3)e.push(r[0],r[1],r[2]);else{let n=this.faces[t].color;e.push(n,n,n)}}t.setIndex(n),t.groups=this.computeGroups()}if(this.morphTargets.length>0){let n=[],r=[];for(let t=0,i=this.morphTargets.length;t<i;t++){let i=this.morphTargets[t],a=new e.Float32BufferAttribute(i.vertices.length*3,3);if(a.name=i.name,n.push(re(a,i.vertices)),i.normals){let t=new e.Float32BufferAttribute(i.normals.length*3,3);t.name=i.name,r.push(re(t,i.normals))}}t.morphAttributes.position=n,t.morphAttributes.normal=r}if(this.skinIndices.length>0){let n=new e.Float32BufferAttribute(this.skinIndices.length*4,4);t.setAttribute(`skinIndex`,n.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){let n=new e.Float32BufferAttribute(this.skinWeights.length*4,4);t.setAttribute(`skinWeight`,n.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(t.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(t.boundingBox=this.boundingBox.clone()),t},computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)},dispose:function(){this.dispatchEvent({type:`dispose`})}}),v.createBufferGeometryFromObject=function(t){let n=new e.BufferGeometry,r=t.geometry;if(t.isPoints||t.isLine){let t=new e.Float32BufferAttribute(r.vertices.length*3,3);re(t,r.vertices);let i=new e.Float32BufferAttribute(r.colors.length*3,3);if(ie(i,r.colors),n.setAttribute(`position`,t),n.setAttribute(`color`,i),r.lineDistances&&r.lineDistances.length===r.vertices.length){let t=new e.Float32BufferAttribute(r.lineDistances.length,1);n.setAttribute(`lineDistance`,t.copyArray(r.lineDistances))}r.boundingSphere!==null&&(n.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(n.boundingBox=r.boundingBox.clone())}else t.isMesh&&(n=r.toBufferGeometry());return n};var y=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],n,r,i,a=e.faces;for(r=0;r<a.length;r++){let e=a[r];e.materialIndex!==i&&(i=e.materialIndex,n!==void 0&&(n.count=r*3-n.start,t.push(n)),n={start:r*3,materialIndex:i})}n!==void 0&&(n.count=r*3-n.start,t.push(n)),this.groups=t}fromGeometry(t){let n=t.faces,r=t.vertices,i=t.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length,l;if(c>0){l=[];for(let e=0;e<c;e++)l[e]={name:s[e].name,data:[]};this.morphTargets.position=l}let u=t.morphNormals,d=u.length,f;if(d>0){f=[];for(let e=0;e<d;e++)f[e]={name:u[e].name,data:[]};this.morphTargets.normal=f}let p=t.skinIndices,m=t.skinWeights,h=p.length===r.length,g=m.length===r.length;r.length>0&&n.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(let t=0;t<n.length;t++){let _=n[t];this.vertices.push(r[_.a],r[_.b],r[_.c]);let v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{let e=_.normal;this.normals.push(e,e,e)}let y=_.vertexColors;if(y.length===3)this.colors.push(y[0],y[1],y[2]);else{let e=_.color;this.colors.push(e,e,e)}if(a===!0){let n=i[0][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,t),this.uvs.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs.push(n[0],n[1],n[2])}if(o===!0){let n=i[1][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,t),this.uvs2.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs2.push(n[0],n[1],n[2])}for(let e=0;e<c;e++){let t=s[e].vertices;l[e].data.push(t[_.a],t[_.b],t[_.c])}for(let e=0;e<d;e++){let n=u[e].vertexNormals[t];f[e].data.push(n.a,n.b,n.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},b=class{constructor(t,n,r,i,a,o=0){this.a=t,this.b=n,this.c=r,this.normal=i&&i.isVector3?i:new e.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=a&&a.isColor?a:new e.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},x=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,S=t.default.default||t.default;function C(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function w(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function T(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function E(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)T(e[t],t,o,n)}var D=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},O=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){let n=e.morphAttributes.color,r=t.morphTargetInfluences,i=r.length;e.deleteAttribute(`morphColor0`),e.deleteAttribute(`morphColor1`);let a=0,o=[];for(let e=0;1>a||e<i;e++)r[e]>0&&(a++,o.push([e,r[e]]));o.length==2?(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[1][0]])):o.length==1&&(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[0][0]]))}},k=(t,n)=>{let r;return t instanceof v?(n.localTimeEnabled&&!t.morphNormalsReady&&(t.morphNormals==null||t.morphNormals.length==0)&&t.computeMorphNormals(),r=t.toIndexedBufferGeometry(),n.localMorphColour&&A(t,r)):t instanceof e.BufferGeometry&&(r=t.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),t._video&&(r._video=t._video),r},A=(t,n)=>{if(t&&t.morphColors&&t.morphColors.length>0){let r=[],i=t.morphColors;for(let t=0,n=i.length;t<n;t++){let n=i[t],a=[];for(let e=0;e<n.colors.length*3;e++){let t=D(n.colors,e);a.push(t[0],t[1],t[2])}let o=new e.Float32BufferAttribute(a,3);o.name=n.name,r.push(o)}n.morphAttributes.color=r}};function j(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var M=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=j(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=j(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function N(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function P(){let t=new Image;t.src=x;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function F(e,t,n,r,i,a){let o=new S(e,t,n,r,i,a);return o.canvasScale=4,o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!0,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=10001,o}function ee(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function te(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}function ne(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y}return e.needsUpdate=!0,e}function re(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z}return e.needsUpdate=!0,e}function I(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z,n[r++]=i.w}return e.needsUpdate=!0,e}function ie(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.r,n[r++]=i.g,n[r++]=i.b}return e.needsUpdate=!0,e}var ae=function(e){e.vertexShader=e.vertexShader.replace(`#include <morphcolor_vertex>`,`
4122
4122
  #if defined( USE_MORPHCOLORS )
4123
4123
 
4124
4124
  // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
@@ -4144,7 +4144,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4144
4144
  }
4145
4145
 
4146
4146
  #endif
4147
- `)},oe=new e.Vector3,se=new e.Vector3,L=new e.Matrix4,ce=new e.Ray,le=new e.Sphere,ue=new e.Vector3,de=new e.Vector3,fe=new e.Vector3,pe=new e.Vector3,me=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)oe.fromBufferAttribute(n,e-1),se.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=oe.distanceTo(se);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),le.copy(r.boundingSphere),le.applyMatrix4(i),le.radius+=a,t.ray.intersectsSphere(le)===!1)return;L.copy(i).invert(),ce.copy(t.ray).applyMatrix4(L);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(he(u,d,this,i,s,r,a),ce.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(he(u,d,this,i,s,a,a+1),ce.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function he(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(i&&s){ue.set(0,0,0),de.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(fe.fromBufferAttribute(d,a),pe.fromBufferAttribute(d,o),ue.addScaledVector(fe.sub(e),u),de.addScaledVector(pe.sub(t),u))}e.add(ue),t.add(de)}}me.prototype.isLine=!0;var ge=new e.Vector3,R=new e.Vector3,_e=class extends me{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)ge.fromBufferAttribute(n,e),R.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+ge.distanceTo(R);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};_e.prototype.isLineSegments=!0;var ve=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=k(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new _e(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==e.VertexColors||this._material.vertexColors==1)){if(t){let e=this.getCurrentMorph();O(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&O(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},z=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);z.colorSpace=e.SRGBColorSpace;var ye=[.02,.03,1],be=new e.SpriteMaterial({map:z,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),xe=function(t){Object.getPrototypeOf(this)!==V.prototype&&Object.setPrototypeOf(xe.prototype,V.prototype),V.call(this),this.texture=z;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(be),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(ye[0],ye[1],ye[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=F(e,.012,`black`,`Asap`,120,700),u.renderOrder=10001,this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},Se=0,B=function(){return`pr`+Se++},V=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new ve(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=B(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};V.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},V.prototype.getDuration=function(){return this.duration},V.prototype.setRegion=function(e){this.region=e},V.prototype.getRegion=function(){return this.region},V.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},V.prototype.getGroup=function(){return this.group},V.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},V.prototype.checkTransparentMesh=function(){},V.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.boundingBoxUpdateRequired=!0},V.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},V.prototype.setAnatomicalId=function(e){this.anatomicalId=e},V.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},V.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},V.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},V.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},V.prototype.getVisibility=function(){return this.visible},V.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},V.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},V.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},V.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},V.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},V.prototype.setColour=function(e){this._lod.setColour(e)},V.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},V.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},V.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},V.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},V.prototype.setMaterial=function(e){this._lod.setMaterial(e)},V.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},V.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},V.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(w(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},V.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},V.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},V.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new xe(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},V.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},V.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},V.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},V.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},V.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},V.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},V.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},V.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=N(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},V.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&te(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},V.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},V.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},V.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var Ce=(t,n,r)=>{let i=k(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0)o=n||new e.MeshPhongMaterial({color:r.colour,vertexColors:!1,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.vertexColors=!0,o.onBeforeCompile=ae);else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide})}return new e.Mesh(i,o)},we=function(){V.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=Ce(e,t,n);this.videoHandler=r.geometry._video,this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();let t=this.geometry.boundingBox.max,n=this.geometry.boundingBox.min,r=new e.Vector2(0-n.x,0-n.y),i=new e.Vector2(t.x-n.x,t.y-n.y);this.geometry.faceVertexUvs[0]=[];for(let t=0;t<this.geometry.faces.length;t++){let n=this.geometry.vertices[this.geometry.faces[t].a],a=this.geometry.vertices[this.geometry.faces[t].b],o=this.geometry.vertices[this.geometry.faces[t].c];geometry.faceVertexUvs[0].push([new e.Vector2((n.x+r.x)/i.x,(n.y+r.y)/i.y),new e.Vector2((a.x+r.x)/i.x,(a.y+r.y)/i.y),new e.Vector2((o.x+r.x)/i.x,(o.y+r.y)/i.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour||this.videoHandler)}};we.prototype=Object.create(V.prototype);var H=t.default.default||t.default,Te=function(t,n){let r=t,i,a=500;i=n?new H(r,.012,n.getStyle()):new H(r,.012),i.fontFace=`Asap`,i.fontSize=90,i.fontWeight=a,i.material.map.generateMipmaps=!0,i.material.map.anisotropy=4,i.material.minFilter=e.LinearMipmapLinearFilter,i.material.magFilter=e.LinearFilter,i.material.sizeAttenuation=!1,i.center.x=-.05,i.center.y=0;let o=[i.scale.x,i.scale.y];this.getPosition=()=>i?[i.position.x,i.position.y,i.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{i&&i.position.set(e,t,n)},this.setColour=e=>{e&&(i.color=e.getStyle())},this.setScale=e=>{i&&e>0&&i.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==i.material.depthTest&&(i.material.depthTest=e)},this.setSize=e=>{e>0&&(i.scale.x=o[0]*e,i.scale.y=o[1]*e)},this.setFontWeight=e=>{e&&e!==a&&(i.fontWeight=e,a=e)},this.setText=e=>{e&&e!==i.text&&(i.text=e,r=e)},this.setVisibility=e=>{i.visible=e},this.dispose=()=>{},this.getSprite=()=>i,this.getString=()=>r},U=function(t,n,r,i){V.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new Te(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};U.prototype=Object.create(V.prototype);function W(){}W.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(W.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=W.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`video`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var Ee=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){let r=e/t*n.video.duration;Number.isFinite(r)||(r=0),n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.videoTexture.format=e.RGBFormat,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},De=e.AnimationClip,Oe=e.Color,ke=e.DefaultLoadingManager,Ae=e.FileLoader,je=e.LoaderUtils,Me=e.Vector2,Ne=e.Vector3,Pe=e.Vector4;function Fe(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?ke:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Fe.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:je.extractUrlBase(e),o=new Ae(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){function n(e,t){return e&1<<t}var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A,j=e.faces,M=e.vertices,N=e.normals,P=e.colors,F=e.scale,ee=0;if(e.uvs!==void 0){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&ee++;for(r=0;r<ee;r++)t.faceVertexUvs[r]=[]}for(o=0,s=M.length;o<s;)x=new Ne,x.x=M[o++]*F,x.y=M[o++]*F,x.z=M[o++]*F,t.vertices.push(x);if(o=0,s=j.length,e.uvs)for(r=0;r<e.uvs.length;r++){t.uvs[r]=[];for(let n=0;n<e.uvs[r].length;n++)t.uvs[r][n]=e.uvs[r][n]}if(N)for(r=0;r<N.length;r++)t.normals[r]=N[r];if(P)for(r=0;r<P.length;r++)t.colors[r]=P[r];for(;o<s;)if(f=j[o++],p=n(f,0),m=n(f,1),h=n(f,3),g=n(f,4),_=n(f,5),v=n(f,6),y=n(f,7),p){if(C=new b,C.a=j[o],C.b=j[o+1],C.c=j[o+3],w=new b,w.a=j[o+1],w.b=j[o+2],w.c=j[o+3],o+=4,m&&(d=j[o++],C.materialIndex=d,w.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],i=0;i<4;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new Me(k,A),i!==2&&t.faceVertexUvs[r][a].push(O),i!==0&&t.faceVertexUvs[r][a+1].push(O);if(g&&(l=j[o++]*3,C.normal.set(N[l++],N[l++],N[l]),w.normal.copy(C.normal)),_)for(r=0;r<4;r++)l=j[o++]*3,E=new Ne(N[l++],N[l++],N[l]),r!==2&&C.vertexNormals.push(E),r!==0&&w.vertexNormals.push(E);if(v&&(c=j[o++],T=P[c],C.color.setHex(T),w.color.setHex(T)),y)for(r=0;r<4;r++)c=j[o++],T=P[c],r!==2&&C.vertexColors.push(new Oe(T)),r!==0&&w.vertexColors.push(new Oe(T));t.faces.push(C),t.faces.push(w)}else{if(S=new b,S.a=j[o++],S.b=j[o++],S.c=j[o++],S.b||(S.b=S.a),S.c||(S.c=S.b),m&&(d=j[o++],S.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],i=0;i<3;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new Me(k,A),t.faceVertexUvs[r][a].push(O);if(g&&(l=j[o++]*3,S.normal.set(N[l++],N[l++],N[l])),_)for(r=0;r<3;r++)l=j[o++]*3,E=new Ne(N[l++],N[l++],N[l]),S.vertexNormals.push(E);if(v&&(c=j[o++],S.color.setHex(P[c])),y)for(r=0;r<3;r++)c=j[o++],S.vertexColors.push(new Oe(P[c]));t.faces.push(S)}}function n(e,t){var n=e.influencesPerVertex===void 0?2:e.influencesPerVertex;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=n){var a=e.skinWeights[r],o=n>1?e.skinWeights[r+1]:0,s=n>2?e.skinWeights[r+2]:0,c=n>3?e.skinWeights[r+3]:0;t.skinWeights.push(new Pe(a,o,s,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r<i;r+=n){var l=e.skinIndices[r],u=n>1?e.skinIndices[r+1]:0,d=n>2?e.skinIndices[r+2]:0,f=n>3?e.skinIndices[r+3]:0;t.skinIndices.push(new Pe(l,u,d,f))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn(`When skinning, number of vertices (`+t.vertices.length+`), skinIndices (`+t.skinIndices.length+`), and skinWeights (`+t.skinWeights.length+`) should match.`)}function r(t,n){var r=t.scale;if(t.morphTargets!==void 0)for(var i=0,a=t.morphTargets.length;i<a;i++){n.morphTargets[i]={},n.morphTargets[i].name=t.morphTargets[i].name,n.morphTargets[i].vertices=[];for(var o=n.morphTargets[i].vertices,s=t.morphTargets[i].vertices,c=0,l=s.length;c<l;c+=3){var u=new Ne;u.x=s[c]*r,u.y=s[c+1]*r,u.z=s[c+2]*r,o.push(u)}}if(t.morphNormals!==void 0){for(var i=0,a=t.morphNormals.length;i<a;i++)if(n.morphTargets[i]){n.morphTargets[i].normals=[];for(var d=n.morphTargets[i].normals,f=t.morphNormals[i].normals,c=0,l=f.length;c<l;c+=3){var p=new Ne;p.x=f[c],p.y=f[c+1],p.z=f[c+2],d.push(p)}n.morphNormalsReady=!0}}if(t.morphColors!==void 0){var i,a,m,h,g,_,v;for(i=0,a=t.morphColors.length;i<a;i++)for(n.morphColors[i]={},n.morphColors[i].name=t.morphColors[i].name,n.morphColors[i].colors=[],g=n.morphColors[i].colors,_=t.morphColors[i].colors,m=0,h=_.length;m<h;m+=3)v=new e.Color(16755200),v.setRGB(_[m],_[m+1],_[m+2]),g.push(v)}}function i(e,t){var n=[],r=[];e.animation!==void 0&&r.push(e.animation),e.animations!==void 0&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var a=De.parseAnimation(r[i],t.bones);a&&n.push(a)}if(t.morphTargets){var o=De.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}n.length>0&&(t.animations=n)}return function(a,o){a.data!==void 0&&(a=a.data),a.scale===void 0?a.scale=1:a.scale=1/a.scale;var s=new v;if(s.morphColors=[],t(a,s),n(a,s),r(a,s),i(a,s),s.computeFaceNormals(),s.computeBoundingSphere(),a.materials===void 0||a.materials.length===0)return{geometry:s};var c=W.prototype.initMaterials(a.materials,o,`Anonymous`);if(a.materials[0].video){var l=o+a.materials[0].video;this.paramsString&&(l+=`?${this.paramsString}`),s._video=new Ee(l)}return c&&c.length>0&&(a.materials[0].singleSided?c[0].side=e.FrontSide:a.materials[0].flipSided?c[0].side=e.BackSide:c[0].side=e.DoubleSide,a.materials[0].specularCoef&&(c[0].shininess=Math.floor(a.materials[0].specularCoef/3))),{geometry:s,materials:c}}})()});var Ie=function(){V.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],j=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Fe;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);te(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,te(v,b))};let M=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},N=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;j.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=M(u,d,f,p,m,j);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0,this.boundingBoxUpdateRequired=!0,this.morph.computeBoundingSphere()},P=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},F=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(N(e,t,c,u,d),s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];P(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ee=e=>{for(let e=0;e<u;e++){let n=new U(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&c.length>0&&e&&this.showLabel(),N(a[0],n[0],r[0],i[0],o[0]),s!=null&&P(s[0]),this.ready=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new U(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var te=(e,t)=>(n,r)=>{let i=n.toBufferGeometry();this.geometry.copy(i),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),i.dispose(),r&&r[0]&&(this.morph.material=r[0]),ee(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(F(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,F()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&F()}this.updateMarker(t,n)}};Ie.prototype=Object.create(V.prototype);var Le=new e.Matrix4,Re=new e.Ray,ze=new e.Sphere,Be=new e.Vector3,Ve=new e.Vector3,He=new e.Vector3,Ue=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.PointsMaterial){super(),this.type=`Points`,this.geometry=t,this.material=n,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ze.copy(n.boundingSphere),ze.applyMatrix4(r),ze.radius+=i,e.ray.intersectsSphere(ze)===!1)return;Le.copy(r).invert(),Re.copy(e.ray).applyMatrix4(Le);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,s=o*o;if(n.isBufferGeometry){let i=n.index,o=n.attributes.position,c=n.morphAttributes.position;if(i!==null){let n=Math.max(0,a.start),l=Math.min(i.count,a.start+a.count);for(let a=n,u=l;a<u;a++){let n=i.getX(a);Ge(this,o,c,n),We(Be,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(o.count,a.start+a.count);for(let a=n,l=i;a<l;a++)Ge(this,o,c,a),We(Be,a,s,r,e,t,this)}}else console.error(`THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};Ue.prototype.isPoints=!0;function We(t,n,r,i,a,o,s){let c=Re.distanceSqToPoint(t);if(c<r){let r=new e.Vector3;Re.closestPointToPoint(t,r),r.applyMatrix4(i);let l=a.ray.origin.distanceTo(r);if(l<a.near||l>a.far)return;o.push({distance:l,distanceToRay:Math.sqrt(c),point:r,index:n,face:null,object:s})}}function Ge(e,t,n,r){Be.fromBufferAttribute(t,r);let i=e.morphTargetInfluences;if(e.material.morphTargets&&n&&i){Ve.set(0,0,0);for(var a=0,o=n.length;a<o;a++){let e=i[a],t=n[a];e!==0&&(He.fromBufferAttribute(t,r),Ve.addScaledVector(He.sub(Be),e))}Be.add(Ve)}}var Ke=function(){V.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0;this.createMesh=(e,t,n)=>{if(e&&t){let r=k(e,n);console.log(r,n),n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!0,t.onBeforeCompile=ae),t.map=P();let i=new Ue(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}};let o=(o,s,c,l)=>{if(c){let u=new Te(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},s=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(n,r,i)=>{if(n&&n.length>0){let a=this.drawRange;a===-1&&(a=0);let s=this.addVertices(n);if(!this.getMorph()){let t=new e.PointsMaterial({alphaTest:.5,size:10,color:i,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,t,{localTimeEnabled:!1,localMorphColour:!1})}let c=a+n.length,l=0;if(Array.isArray(r)&&r.length===n.length||typeof r==`string`)for(t.length;a+l<c;){let e=typeof r==`string`?r:r[l];o(a+l,n[l],e,this._lod._material.color),l++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(e>=0&&this.drawRange>e){let t=this.getMorph().geometry.getAttribute(`position`);return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`position`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a++,e[0],e[1],e[2])}),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){return Ke.prototype.deleteVertices.call(this,e)&&s(e),this.drawRange},this.setName=function(e){let n=this.groupName;Ke.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.render=(e,t,n,r)=>{this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),Ke.prototype.render.call(this,e,t,n,r)}};Ke.prototype=Object.create(V.prototype);var qe=function(){V.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=k(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!0,t.onBeforeCompile=ae);let i=new _e(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};qe.prototype=Object.create(V.prototype);var Je=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Je.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Je.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Je.prototype.loadFromImages=async function(e){},Je.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Je.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ye=function(){Je.call(this),this.isTextureArray=!0,this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.DataArrayTexture(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ye.prototype=Object.create(Je.prototype);var Xe=e.GLSL3,Ze=`
4147
+ `)},oe=new e.Vector3,se=new e.Vector3,L=new e.Matrix4,ce=new e.Ray,le=new e.Sphere,ue=new e.Vector3,de=new e.Vector3,fe=new e.Vector3,pe=new e.Vector3,me=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)oe.fromBufferAttribute(n,e-1),se.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=oe.distanceTo(se);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),le.copy(r.boundingSphere),le.applyMatrix4(i),le.radius+=a,t.ray.intersectsSphere(le)===!1)return;L.copy(i).invert(),ce.copy(t.ray).applyMatrix4(L);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(he(u,d,this,i,s,r,a),ce.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(he(u,d,this,i,s,a,a+1),ce.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function he(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(i&&s){ue.set(0,0,0),de.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(fe.fromBufferAttribute(d,a),pe.fromBufferAttribute(d,o),ue.addScaledVector(fe.sub(e),u),de.addScaledVector(pe.sub(t),u))}e.add(ue),t.add(de)}}me.prototype.isLine=!0;var ge=new e.Vector3,R=new e.Vector3,_e=class extends me{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)ge.fromBufferAttribute(n,e),R.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+ge.distanceTo(R);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};_e.prototype.isLineSegments=!0;var ve=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=k(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new _e(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==e.VertexColors||this._material.vertexColors==1)){if(t){let e=this.getCurrentMorph();O(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&O(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},z=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);z.colorSpace=e.SRGBColorSpace;var ye=[.02,.03,1],be=new e.SpriteMaterial({map:z,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),xe=function(t){Object.getPrototypeOf(this)!==V.prototype&&Object.setPrototypeOf(xe.prototype,V.prototype),V.call(this),this.texture=z;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(be),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(ye[0],ye[1],ye[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=F(e,.012,`black`,`Asap`,120,700),u.renderOrder=10001,this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},Se=0,B=function(){return`pr`+Se++},V=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new ve(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=B(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};V.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},V.prototype.getDuration=function(){return this.duration},V.prototype.setRegion=function(e){this.region=e},V.prototype.getRegion=function(){return this.region},V.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},V.prototype.getGroup=function(){return this.group},V.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},V.prototype.checkTransparentMesh=function(){},V.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.boundingBoxUpdateRequired=!0},V.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},V.prototype.setAnatomicalId=function(e){this.anatomicalId=e},V.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},V.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},V.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},V.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},V.prototype.getVisibility=function(){return this.visible},V.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},V.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},V.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},V.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},V.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},V.prototype.setColour=function(e){this._lod.setColour(e)},V.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},V.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},V.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},V.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},V.prototype.setMaterial=function(e){this._lod.setMaterial(e)},V.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},V.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},V.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(w(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},V.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},V.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},V.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new xe(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},V.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},V.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},V.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},V.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},V.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},V.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},V.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},V.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=N(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},V.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&te(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},V.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},V.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},V.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var Ce=(t,n,r)=>{let i=k(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0)o=n||new e.MeshPhongMaterial({color:r.colour,vertexColors:!1,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.vertexColors=!0,o.onBeforeCompile=ae);else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide})}return new e.Mesh(i,o)},we=function(){V.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=Ce(e,t,n);this.videoHandler=r.geometry._video,this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();let t=this.geometry.boundingBox.max,n=this.geometry.boundingBox.min,r=new e.Vector2(0-n.x,0-n.y),i=new e.Vector2(t.x-n.x,t.y-n.y);this.geometry.faceVertexUvs[0]=[];for(let t=0;t<this.geometry.faces.length;t++){let n=this.geometry.vertices[this.geometry.faces[t].a],a=this.geometry.vertices[this.geometry.faces[t].b],o=this.geometry.vertices[this.geometry.faces[t].c];geometry.faceVertexUvs[0].push([new e.Vector2((n.x+r.x)/i.x,(n.y+r.y)/i.y),new e.Vector2((a.x+r.x)/i.x,(a.y+r.y)/i.y),new e.Vector2((o.x+r.x)/i.x,(o.y+r.y)/i.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour||this.videoHandler)}};we.prototype=Object.create(V.prototype);var H=t.default.default||t.default,Te=function(t,n){let r=t,i,a=1,o=500,s=.012;i=n?new H(r,s,n.getStyle()):new H(r,s),i.fontFace=`Asap`,i.fontSize=90,i.fontWeight=o,i.material.map.generateMipmaps=!0,i.material.map.anisotropy=4,i.material.minFilter=e.LinearMipmapLinearFilter,i.material.magFilter=e.LinearFilter,i.material.sizeAttenuation=!1,i.center.x=-.05,i.center.y=0,this.getPosition=()=>i?[i.position.x,i.position.y,i.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{i&&i.position.set(e,t,n)},this.setColour=e=>{e&&(i.color=e.getStyle())},this.setScale=e=>{i&&e>0&&i.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==i.material.depthTest&&(i.material.depthTest=e)},this.setSize=e=>{e>0&&(i.textHeight=s*e,a=e)},this.setFontWeight=e=>{e&&e!==o&&(i.fontWeight=e,o=e)},this.setText=e=>{if(e&&e!==i.text){if(i._canvas,i.material&&i.material.map&&i.material.map.dispose(),i._canvas){let e=i._canvas.getContext(`2d`);e&&e.clearRect(0,0,i._canvas.width,i._canvas.height),i._canvas.width=1,i._canvas.height=1}i.text=e,i.textHeight=s*a,r=e,i.material&&i.material.map&&(i.material.map.needsUpdate=!0)}},this.setVisibility=e=>{i.visible=e},this.dispose=()=>{},this.getSprite=()=>i,this.getString=()=>r},U=function(t,n,r,i){V.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new Te(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};U.prototype=Object.create(V.prototype);function W(){}W.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(W.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=W.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`video`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var Ee=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){let r=e/t*n.video.duration;Number.isFinite(r)||(r=0),n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.videoTexture.format=e.RGBFormat,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},De=e.AnimationClip,Oe=e.Color,ke=e.DefaultLoadingManager,Ae=e.FileLoader,je=e.LoaderUtils,Me=e.Vector2,Ne=e.Vector3,Pe=e.Vector4;function Fe(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?ke:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Fe.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:je.extractUrlBase(e),o=new Ae(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){function n(e,t){return e&1<<t}var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A,j=e.faces,M=e.vertices,N=e.normals,P=e.colors,F=e.scale,ee=0;if(e.uvs!==void 0){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&ee++;for(r=0;r<ee;r++)t.faceVertexUvs[r]=[]}for(o=0,s=M.length;o<s;)x=new Ne,x.x=M[o++]*F,x.y=M[o++]*F,x.z=M[o++]*F,t.vertices.push(x);if(o=0,s=j.length,e.uvs)for(r=0;r<e.uvs.length;r++){t.uvs[r]=[];for(let n=0;n<e.uvs[r].length;n++)t.uvs[r][n]=e.uvs[r][n]}if(N)for(r=0;r<N.length;r++)t.normals[r]=N[r];if(P)for(r=0;r<P.length;r++)t.colors[r]=P[r];for(;o<s;)if(f=j[o++],p=n(f,0),m=n(f,1),h=n(f,3),g=n(f,4),_=n(f,5),v=n(f,6),y=n(f,7),p){if(C=new b,C.a=j[o],C.b=j[o+1],C.c=j[o+3],w=new b,w.a=j[o+1],w.b=j[o+2],w.c=j[o+3],o+=4,m&&(d=j[o++],C.materialIndex=d,w.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],i=0;i<4;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new Me(k,A),i!==2&&t.faceVertexUvs[r][a].push(O),i!==0&&t.faceVertexUvs[r][a+1].push(O);if(g&&(l=j[o++]*3,C.normal.set(N[l++],N[l++],N[l]),w.normal.copy(C.normal)),_)for(r=0;r<4;r++)l=j[o++]*3,E=new Ne(N[l++],N[l++],N[l]),r!==2&&C.vertexNormals.push(E),r!==0&&w.vertexNormals.push(E);if(v&&(c=j[o++],T=P[c],C.color.setHex(T),w.color.setHex(T)),y)for(r=0;r<4;r++)c=j[o++],T=P[c],r!==2&&C.vertexColors.push(new Oe(T)),r!==0&&w.vertexColors.push(new Oe(T));t.faces.push(C),t.faces.push(w)}else{if(S=new b,S.a=j[o++],S.b=j[o++],S.c=j[o++],S.b||(S.b=S.a),S.c||(S.c=S.b),m&&(d=j[o++],S.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],i=0;i<3;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new Me(k,A),t.faceVertexUvs[r][a].push(O);if(g&&(l=j[o++]*3,S.normal.set(N[l++],N[l++],N[l])),_)for(r=0;r<3;r++)l=j[o++]*3,E=new Ne(N[l++],N[l++],N[l]),S.vertexNormals.push(E);if(v&&(c=j[o++],S.color.setHex(P[c])),y)for(r=0;r<3;r++)c=j[o++],S.vertexColors.push(new Oe(P[c]));t.faces.push(S)}}function n(e,t){var n=e.influencesPerVertex===void 0?2:e.influencesPerVertex;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=n){var a=e.skinWeights[r],o=n>1?e.skinWeights[r+1]:0,s=n>2?e.skinWeights[r+2]:0,c=n>3?e.skinWeights[r+3]:0;t.skinWeights.push(new Pe(a,o,s,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r<i;r+=n){var l=e.skinIndices[r],u=n>1?e.skinIndices[r+1]:0,d=n>2?e.skinIndices[r+2]:0,f=n>3?e.skinIndices[r+3]:0;t.skinIndices.push(new Pe(l,u,d,f))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn(`When skinning, number of vertices (`+t.vertices.length+`), skinIndices (`+t.skinIndices.length+`), and skinWeights (`+t.skinWeights.length+`) should match.`)}function r(t,n){var r=t.scale;if(t.morphTargets!==void 0)for(var i=0,a=t.morphTargets.length;i<a;i++){n.morphTargets[i]={},n.morphTargets[i].name=t.morphTargets[i].name,n.morphTargets[i].vertices=[];for(var o=n.morphTargets[i].vertices,s=t.morphTargets[i].vertices,c=0,l=s.length;c<l;c+=3){var u=new Ne;u.x=s[c]*r,u.y=s[c+1]*r,u.z=s[c+2]*r,o.push(u)}}if(t.morphNormals!==void 0){for(var i=0,a=t.morphNormals.length;i<a;i++)if(n.morphTargets[i]){n.morphTargets[i].normals=[];for(var d=n.morphTargets[i].normals,f=t.morphNormals[i].normals,c=0,l=f.length;c<l;c+=3){var p=new Ne;p.x=f[c],p.y=f[c+1],p.z=f[c+2],d.push(p)}n.morphNormalsReady=!0}}if(t.morphColors!==void 0){var i,a,m,h,g,_,v;for(i=0,a=t.morphColors.length;i<a;i++)for(n.morphColors[i]={},n.morphColors[i].name=t.morphColors[i].name,n.morphColors[i].colors=[],g=n.morphColors[i].colors,_=t.morphColors[i].colors,m=0,h=_.length;m<h;m+=3)v=new e.Color(16755200),v.setRGB(_[m],_[m+1],_[m+2]),g.push(v)}}function i(e,t){var n=[],r=[];e.animation!==void 0&&r.push(e.animation),e.animations!==void 0&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var a=De.parseAnimation(r[i],t.bones);a&&n.push(a)}if(t.morphTargets){var o=De.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}n.length>0&&(t.animations=n)}return function(a,o){a.data!==void 0&&(a=a.data),a.scale===void 0?a.scale=1:a.scale=1/a.scale;var s=new v;if(s.morphColors=[],t(a,s),n(a,s),r(a,s),i(a,s),s.computeFaceNormals(),s.computeBoundingSphere(),a.materials===void 0||a.materials.length===0)return{geometry:s};var c=W.prototype.initMaterials(a.materials,o,`Anonymous`);if(a.materials[0].video){var l=o+a.materials[0].video;this.paramsString&&(l+=`?${this.paramsString}`),s._video=new Ee(l)}return c&&c.length>0&&(a.materials[0].singleSided?c[0].side=e.FrontSide:a.materials[0].flipSided?c[0].side=e.BackSide:c[0].side=e.DoubleSide,a.materials[0].specularCoef&&(c[0].shininess=Math.floor(a.materials[0].specularCoef/3))),{geometry:s,materials:c}}})()});var Ie=function(){V.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],j=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Fe;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);te(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,te(v,b))};let M=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},N=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;j.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=M(u,d,f,p,m,j);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0,this.boundingBoxUpdateRequired=!0,this.morph.computeBoundingSphere()},P=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},F=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(N(e,t,c,u,d),s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];P(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ee=e=>{for(let e=0;e<u;e++){let n=new U(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&c.length>0&&e&&this.showLabel(),N(a[0],n[0],r[0],i[0],o[0]),s!=null&&P(s[0]),this.ready=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new U(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var te=(e,t)=>(n,r)=>{let i=n.toBufferGeometry();this.geometry.copy(i),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),i.dispose(),r&&r[0]&&(this.morph.material=r[0]),ee(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(F(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,F()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&F()}this.updateMarker(t,n)}};Ie.prototype=Object.create(V.prototype);var Le=new e.Matrix4,Re=new e.Ray,ze=new e.Sphere,Be=new e.Vector3,Ve=new e.Vector3,He=new e.Vector3,Ue=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.PointsMaterial){super(),this.type=`Points`,this.geometry=t,this.material=n,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ze.copy(n.boundingSphere),ze.applyMatrix4(r),ze.radius+=i,e.ray.intersectsSphere(ze)===!1)return;Le.copy(r).invert(),Re.copy(e.ray).applyMatrix4(Le);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,s=o*o;if(n.isBufferGeometry){let i=n.index,o=n.attributes.position,c=n.morphAttributes.position;if(i!==null){let n=Math.max(0,a.start),l=Math.min(i.count,a.start+a.count);for(let a=n,u=l;a<u;a++){let n=i.getX(a);Ge(this,o,c,n),We(Be,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(o.count,a.start+a.count);for(let a=n,l=i;a<l;a++)Ge(this,o,c,a),We(Be,a,s,r,e,t,this)}}else console.error(`THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};Ue.prototype.isPoints=!0;function We(t,n,r,i,a,o,s){let c=Re.distanceSqToPoint(t);if(c<r){let r=new e.Vector3;Re.closestPointToPoint(t,r),r.applyMatrix4(i);let l=a.ray.origin.distanceTo(r);if(l<a.near||l>a.far)return;o.push({distance:l,distanceToRay:Math.sqrt(c),point:r,index:n,face:null,object:s})}}function Ge(e,t,n,r){Be.fromBufferAttribute(t,r);let i=e.morphTargetInfluences;if(e.material.morphTargets&&n&&i){Ve.set(0,0,0);for(var a=0,o=n.length;a<o;a++){let e=i[a],t=n[a];e!==0&&(He.fromBufferAttribute(t,r),Ve.addScaledVector(He.sub(Be),e))}Be.add(Ve)}}var Ke=function(){V.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0;this.createMesh=(e,t,n)=>{if(e&&t){let r=k(e,n);console.log(r,n),n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!0,t.onBeforeCompile=ae),t.map=P();let i=new Ue(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}};let o=(o,s,c,l)=>{if(c){let u=new Te(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},s=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(n,r,i)=>{if(n&&n.length>0){let a=this.drawRange;a===-1&&(a=0);let s=this.addVertices(n);if(!this.getMorph()){let t=new e.PointsMaterial({alphaTest:.5,size:10,color:i,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,t,{localTimeEnabled:!1,localMorphColour:!1})}let c=a+n.length,l=0;if(Array.isArray(r)&&r.length===n.length||typeof r==`string`)for(t.length;a+l<c;){let e=typeof r==`string`?r:r[l];o(a+l,n[l],e,this._lod._material.color),l++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(e>=0&&this.drawRange>e){let t=this.getMorph().geometry.getAttribute(`position`);return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`position`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a++,e[0],e[1],e[2])}),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){return Ke.prototype.deleteVertices.call(this,e)&&s(e),this.drawRange},this.setName=function(e){let n=this.groupName;Ke.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.render=(e,t,n,r)=>{this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),Ke.prototype.render.call(this,e,t,n,r)}};Ke.prototype=Object.create(V.prototype);var qe=function(){V.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=k(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!0,t.onBeforeCompile=ae);let i=new _e(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};qe.prototype=Object.create(V.prototype);var Je=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Je.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Je.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Je.prototype.loadFromImages=async function(e){},Je.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Je.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ye=function(){Je.call(this),this.isTextureArray=!0,this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.DataArrayTexture(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ye.prototype=Object.create(Je.prototype);var Xe=e.GLSL3,Ze=`
4148
4148
  precision highp float;
4149
4149
  precision highp int;
4150
4150
  precision highp sampler2DArray;
@@ -4658,4 +4658,4 @@ void main() {
4658
4658
  `,t+=`Intent Code = `+this.intent_code+`
4659
4659
  `,t+=`Intent Name: "`+this.intent_name+`"
4660
4660
  `,t+=`Dim Info = `+this.dim_info+`
4661
- `,t}getExtensionLocation=function(){return e.MAGIC_COOKIE+4};getExtensionSize=Vn.prototype.getExtensionSize;getExtensionCode=Vn.prototype.getExtensionCode;addExtension=Vn.prototype.addExtension;removeExtension=Vn.prototype.removeExtension;getDatatypeCodeString=Vn.prototype.getDatatypeCodeString;getTransformCodeString=Vn.prototype.getTransformCodeString;getUnitsCodeString=Vn.prototype.getUnitsCodeString;getQformMat=Vn.prototype.getQformMat;convertNiftiQFormToNiftiSForm=Vn.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=Vn.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=Vn.prototype.nifti_mat33_mul;nifti_mat33_determ=Vn.prototype.nifti_mat33_determ;toArrayBuffer(e=!1){let t=544;if(e)for(let e of this.extensions)t+=e.esize;let n=new Uint8Array(t),r=new DataView(n.buffer);r.setInt32(0,540,this.littleEndian),n.set(new TextEncoder().encode(this.magic),4),r.setInt16(12,this.datatypeCode,this.littleEndian),r.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let e=0;e<8;e++)r.setBigInt64(16+8*e,BigInt(this.dims[e]),this.littleEndian);r.setFloat64(80,this.intent_p1,this.littleEndian),r.setFloat64(88,this.intent_p2,this.littleEndian),r.setFloat64(96,this.intent_p3,this.littleEndian);for(let e=0;e<8;e++)r.setFloat64(104+8*e,this.pixDims[e],this.littleEndian);r.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),r.setFloat64(176,this.scl_slope,this.littleEndian),r.setFloat64(184,this.scl_inter,this.littleEndian),r.setFloat64(192,this.cal_max,this.littleEndian),r.setFloat64(200,this.cal_min,this.littleEndian),r.setFloat64(208,this.slice_duration,this.littleEndian),r.setFloat64(216,this.toffset,this.littleEndian),r.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),r.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),n.set(new TextEncoder().encode(this.description),240),n.set(new TextEncoder().encode(this.aux_file),320),r.setInt32(344,this.qform_code,this.littleEndian),r.setInt32(348,this.sform_code,this.littleEndian),r.setFloat64(352,this.quatern_b,this.littleEndian),r.setFloat64(360,this.quatern_c,this.littleEndian),r.setFloat64(368,this.quatern_d,this.littleEndian),r.setFloat64(376,this.qoffset_x,this.littleEndian),r.setFloat64(384,this.qoffset_y,this.littleEndian),r.setFloat64(392,this.qoffset_z,this.littleEndian);let i=this.affine.flat();for(let e=0;e<12;e++)r.setFloat64(400+8*e,i[e],this.littleEndian);if(r.setInt32(496,this.slice_code,this.littleEndian),r.setInt32(500,this.xyzt_units,this.littleEndian),r.setInt32(504,this.intent_code,this.littleEndian),n.set(new TextEncoder().encode(this.intent_name),508),r.setUint8(524,this.dim_info),e){n.set(Uint8Array.from([1,0,0,0]),540);let e=this.getExtensionLocation();for(let t of this.extensions)r.setInt32(e,t.esize,t.littleEndian),r.setInt32(e+4,t.ecode,t.littleEndian),n.set(new Uint8Array(t.edata),e+8),e+=t.esize}else n.set(new Uint8Array(4).fill(0),540);return n.buffer}};function Un(e,t=!1){var n,r,i,a;return e.byteLength<Vn.STANDARD_HEADER_SIZE?!1:(n=new DataView(e),n&&(r=n.getUint8(Vn.MAGIC_NUMBER_LOCATION)),i=n.getUint8(Vn.MAGIC_NUMBER_LOCATION+1),a=n.getUint8(Vn.MAGIC_NUMBER_LOCATION+2),t&&r===Vn.MAGIC_NUMBER2[0]&&i===Vn.MAGIC_NUMBER2[1]&&a===Vn.MAGIC_NUMBER2[2]?!0:r===Vn.MAGIC_NUMBER[0]&&i===Vn.MAGIC_NUMBER[1]&&a===Vn.MAGIC_NUMBER[2])}function Wn(e,t=!1){var n,r,i,a;return e.byteLength<Vn.STANDARD_HEADER_SIZE?!1:(n=new DataView(e),r=n.getUint8(Hn.MAGIC_NUMBER_LOCATION),i=n.getUint8(Hn.MAGIC_NUMBER_LOCATION+1),a=n.getUint8(Hn.MAGIC_NUMBER_LOCATION+2),t&&r===Hn.MAGIC_NUMBER2[0]&&i===Hn.MAGIC_NUMBER2[1]&&a===Hn.MAGIC_NUMBER2[2]?!0:r===Hn.MAGIC_NUMBER[0]&&i===Hn.MAGIC_NUMBER[1]&&a===Hn.MAGIC_NUMBER[2])}function Gn(e,t=!1){return Un(e,t)||Wn(e,t)}function Kn(e){var t,n,r;return!!(e&&(t=new DataView(e),n=t.getUint8(0),r=t.getUint8(1),n===G.GUNZIP_MAGIC_COOKIE1||r===G.GUNZIP_MAGIC_COOKIE2))}function qn(e){return(0,i.decompressSync)(new Uint8Array(e)).buffer}function Jn(e,t=!1){let n=null;if(Kn(e)&&(e=qn(e)),Un(e,t)?n=new Vn:Wn(e,t)&&(n=new Hn),n)n.readHeader(e);else throw Error(`That file does not appear to be NIFTI!`);return n}function Yn(e,t){var n=e.vox_offset,r=1,i=1;e.dims[4]&&(r=e.dims[4]),e.dims[5]&&(i=e.dims[5]);var a=e.dims[1]*e.dims[2]*e.dims[3]*r*i*(e.numBitsPerVoxel/8);return t.slice(n,n+a)}var Xn={id:`mesh-location-orientation`,locations:[{identifier:1,label:`original`,orientation:[1,0,0,0,1,0,0,0,1],position:[0,0,0],scale:[1,1,1],flipY:!1,flipZ:!1,reference_point:`corner`}],settings:{slides:[{direction:`x`,value:.5},{direction:`y`,value:.5},{direction:`z`,value:.5}]},type:`slides`},Zn={hideBlackPixel:!0,keepScalePosition:!0,filterByValue:!0,timeEnabled:!1};function Qn(e){let t=Kn(e)?qn(e):e;if(Gn(t)){let e=Jn(t);return{niftiHeader:e,niftiImage:Yn(e,t)}}return t=void 0,{niftiHeader:void 0,niftiImage:void 0}}function $n(e,t){let n;switch(e.datatypeCode){case Vn.TYPE_UINT8:n=new Uint8Array(t);break;case Vn.TYPE_INT8:n=new Int8Array(t);break;case Vn.TYPE_UINT16:n=new Uint16Array(t);break;case Vn.TYPE_INT16:n=new Int16Array(t);break;case Vn.TYPE_UINT32:n=new Uint32Array(t);break;case Vn.TYPE_INT32:n=new Int32Array(t);break;case Vn.TYPE_FLOAT32:n=new Float32Array(t);break;case Vn.TYPE_FLOAT64:n=new Float64Array(t);break;default:throw Error(`Unsupported NIfTI data type`)}let r=1/0,i=-1/0,a=n.length;for(let e=0;e<a;e++){let t=n[e];t<r&&(r=t),t>i&&(i=t)}let o=new Uint8Array(a),s=i-r;for(let e=0;e<a;e++){let t=(n[e]-r)/s;t=Math.max(0,Math.min(1,t)),o[e]=Math.round(t*255)}return o}function er(e,t,n,r){if(e?.dims&&e.dims[0]===3){let i=e.dims[1],a=e.dims[2],o=e.dims[3],s=!1;(e.intent_code===1007||e.intent_code===1008||e.datatypeCode===128||e.datatypeCode===2304)&&(s=!0);let c=$n(e,t),l;if(n&&r){let e=n.dims[1],t=n.dims[2],s=n.dims[3];e===i&&t===a&&s===o&&(l=$n(n,r))}return{data:c,maskData:l,width:i,height:a,depth:o,isRGB:s}}}function tr(e,t){if(e?.affine&&e.dims){let n=e.affine,r=[0,0,0],i=[0,0,0];return r[0]=n[0][3],r[1]=n[1][3],r[2]=n[2][3],i[0]=n[0][0]*e.dims[1],i[1]=n[1][1]*e.dims[2],i[2]=n[2][2]*e.dims[3],t.keepScalePosition&&(i[0]=Math.abs(i[0]),i[1]=Math.abs(i[1]),i[2]=Math.abs(i[2])),{position:r,scale:i}}return{position:void 0,scale:void 0}}function nr(e,t){return e&&e.sform_code?tr(e,t):{position:void 0,scale:void 0}}function rr(t,n,r,i,a){let o=new e.DataArrayTexture(t,n,r,i);return o.anisotropy=4,a||(o.format=e.RedFormat),o.minFilter=e.NearestFilter,o.magFilter=e.NearestFilter,o.needsUpdate=!0,o}function ir(e){if(e?.data){let t=new Ye;return t.impl=new rr(e.data,e.width,e.height,e.depth),t.size={width:e.width,height:e.height,depth:e.depth},t.isLoading=!1,t}}function ar(e,t,n,r,i){if(t?.data){let a={...Zn};i&&Object.assign(a,i);let o=new tt,s=ir(t);if(s){o.groupName=`Images`,o.morph.renderOrder=1,o.texture=s;let i=structuredClone(Xn);if(Object.assign(i,r),n&&e){let{position:t,scale:n}=nr(e,a);t&&n&&(i.locations[0].scale=n,i.locations[0].position=t)}if(o.initialise(i,void 0),o.showEdges(10066329),t.maskData&&!a.timeEnabled){let e=rr(t.maskData,t.width,t.height,t.depth,!1);o.setMask(e)}return o.setNumberOfChannels(t.isRGB?3:1),o}}}async function or(e,t){let n,r;if(t){let e=Qn(await(await fetch(t)).arrayBuffer());n=e.niftiHeader,r=e.niftiImage}let{niftiHeader:i,niftiImage:a}=Qn(await(await fetch(e)).arrayBuffer());return{sources:er(i,a,n,r),niftiHeader:i}}async function sr(e,t,n,r,i){let a=!1,o,s=e;if(Array.isArray(e)&&(s=e[0],e.length>1&&i?.timeEnabled&&(a=!0)),typeof s==`string`){let{sources:e,niftiHeader:a}=await or(s,n,i);o=ar(a,e,t,r,i)}if(a&&o){for(let t=1;t<e.length;t++){let r=await cr(e[t],n,i);o.addTextureArray(r)}o.timeEnabled=!0}return o}async function cr(e,t,n){let{sources:r}=await or(e,t,n);return ir(r)}var lr=p.version,ur=new function(){this.Revision=lr,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.Geometry=we,this.Glyph=U,this.Glyphset=Ie,this.Pointset=Ke,this.Label=Te,this.Lines=qe,this.TextureSlides=tt,this.TextureArray=Ye,this.Renderer=zn,this.Scene=Rn,this.Viewport=nt,this.CameraControls=rt,this.SmoothCameraTransition=it,this.RayCaster=ot,this.CameraAutoTumble=st,this.StereoEffect=lt,this.loadExternalFile=T,this.loadExternalFiles=E,this.createPrimitivesFromNIFTI=sr,this.createTextureFromNIFTI=cr,this.THREE=e};return ur})}))(),1),oE={SELECTED_COLOUR:`#00ff00`,HIGHLIGHTED_COLOUR:`#ff0000`,DEFAULT_RADIUS:1,DEFAULT_RADIAL_SEGMENTS:8,ZOOM_RADIUS:5,ZOOM_RADIAL_SEGMENTS:12},sE=(e,t)=>{if(e){let n=``;e.forEach(e=>{n=e.uuid,e.region&&(n=e.region.uuid+`/`+n),e&&e.getVisibility()&&t.push(n)})}return t},cE=(e,t)=>{let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},lE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable&&t.isPointset){let n=e[0].extraData.intersected;if(n&&n.index>-1){let e=t.getVerticesByIndex(n.index);if(e)return{zincObject:t,index:n.index,point:e}}}},uE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable)return t},dE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable&&t.isLines2){let n=e[0].extraData.intersected;if(n&&n.faceIndex>-1){let r=t.getVerticesByFaceIndex(n.faceIndex),i=e[0].extraData.intersected.pointOnLine;if(r.length>1)return cE(r[0],[i.x,i.y,i.z])>cE(r[1],[i.x,i.y,i.z])?{zincObject:t,faceIndex:n.faceIndex,vertexIndex:n.faceIndex*2+1,point:r[0]}:{zincObject:t,faceIndex:n.faceIndex,vertexIndex:n.faceIndex*2,point:r[1]}}}},fE=e=>{let t=e.zincObjects;if(t.length>0&&t[0])return t[0]},pE=(e,t,n)=>{if(e?.isEditable&&e?.isPointset){let r=!1;for(let e=0;e<3&&!r;e++)n[e]!==0&&(r=!0);if(r&&t>-1){let r=e.getVerticesByIndex(t);return r&&(r[0]+=n[0],r[1]+=n[1],r[2]+=n[2]),e.editVertices([r],t),e.boundingBoxUpdateRequired=!0,!0}}return!1},mE=(e,t)=>{if(e?.isEditable&&e?.isLines2&&t>-1){let n=e.getVerticesByFaceIndex(t);if(n&&n.length>1)return cE(n[1],n[0])}return 0},hE=(e,t,n,r)=>{if(e&&n!==0&&e.isEditable&&e.isLines2&&t>-1){let i=e.getVerticesByFaceIndex(t),a=[i[1][0]-i[0][0],i[1][1]-i[0][1],i[1][2]-i[0][2]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);for(let e=0;e<3;e++)a[e]=a[e]/o*n,r?i[1][e]=i[0][e]+a[e]:(i[0][e]=i[0][e]+a[e],i[1][e]=i[1][e]+a[e]);return e.editVertices(i,t*2),e.boundingBoxUpdateRequired=!0,!0}return!1},gE=(e,t)=>{let n=t.getBoundingBox(),r=new aE.THREE.Vector3().subVectors(n.max,n.min),i=new aE.THREE.BoxGeometry(r.x,r.y,r.z);r.addVectors(n.min,n.max).multiplyScalar(.5);let a=i.getAttribute(`position`),o=a.count,s=[];for(let e=0;e<o;e++)s[e]=[a.array[e*3],a.array[e*3+1],a.array[e*3+2]];e.editVertices(s,0),e.setPosition(r.x,r.y,r.z),i.dispose()},_E=(e,t)=>{let n=``;e.isRegion&&(n=`__r${e.regionPath}`),e.isPrimitives&&(n=`${e.regionPath}/${e.label}`),t.push(n),e.children&&e.children.forEach(e=>_E(e,t))},vE=(e,t,n,r)=>{let i=e,a=[];if(n&&(i=e.findChildFromPath(n)),i){let e=Array.isArray(t),n=t;e||(n=[n]),n.forEach(e=>{let t=i.findObjectsWithGroupName(e,r);a.push(...t)})}return a},yE=(e,t,n)=>{let r=e.findIndex(e=>e.uuid===t),i;return r>-1&&(i=e[r],n&&e.splice(r,1)),i},bE=(e,t)=>{let n=[];if(e&&t&&t.length>0){let r={},i={},a=[e,...e.getChildRegions(!0)],o,s,c;t.forEach(e=>{let t=e.split(`/`);c=t[0],o=yE(a,c,!1),o&&(i[c]||(i[c]=o.getFullPath()),t[1]?(r[c]||(r[c]=o.getAllObjects(!1)),s=yE(r[c],t[1],!0),s&&n.push(`${i[c]}/${s.groupName}`)):n.push(`__r/${i[c]}`))})}return n},xE=e=>{if(e){let t=[];return e.forEach(e=>{e.isZincObject?t.push(e):e.isRegion&&t.push(...e.getAllObjects(!0))}),Object.values(t.reduce((e,t)=>({...e,[t.uuid]:t}),{}))}return[]},SE=(e,t)=>{let n={label:`Multiple selections`,regionPath:``,objects:[]};if(t&&e){let r={},i=e.getRootRegion();t.length>0&&(n.regionPath=t[0].data.region,n.label=t[0].data.group),t.forEach(e=>{e.data.region.includes(n.regionPath)||(n.regionPath=``),n.label!==e.data.group&&(n.label=`Multiple selections`);let t=i.findChildFromPath(e.data.region);r[t.uuid]||(r[t.uuid]=t.getAllObjects(!1));let a=yE(r[t.uuid],e.data.uuid);a&&n.objects.push(a)})}return n},CE=e=>{let t=e.getMorph(),n=`position`;e.isLines2&&(n=`instanceStart`);let r=[],i=0,a=t.geometry.getAttribute(n);for(let t=0;t<e.drawRange;t++)r.push([a.array[i++],a.array[i++],a.array[i++]]);return r},wE=(e,t,n,r,i)=>{let a;a=e.isPointset?`MultiPoint`:e.isLines2?`MultiLineString`:`Feature`;let o=a!==`Feature`,s=a===`Feature`?`Feature annotation`:`Drawn annotation`;if(a){let c=CE(e),l=t.slice(-1)===`/`?t:t+`/`;l+=n;let u=l,d={resource:r,item:{id:u},body:{evidence:[],comment:i},feature:{id:u,properties:{drawn:o,label:s},geometry:{coordinates:c,type:a}}};return i===`Deleted`&&(d.feature=void 0),d}},TE=(e,t,n,r,i,a,o)=>{let s=wE(n,r,i,a,o);if(s)return e&&e.currentUser&&(s.creator={...e.currentUser},s.creator.orcid||(s.creator.orcid=`0000-0000-0000-0000`),e.addAnnotation(t,s).then(e=>{e.annotationId||console.log(`There is a problem with the submission, please try again later`)}).catch(()=>{console.log(`There is a problem with the submission, please try again later`)})),s},EE=async(e,t,n)=>{let r=n;return await e.drawnFeatures(t,r)},DE=(e,t)=>{e&&t.forEach(t=>{let n=t.geometry,r=decodeURIComponent(t.id),i=r.lastIndexOf(`/`),a=r.substring(0,i),o=r.substring(i+1),s;n.type===`MultiPoint`?s=e.createPoints(a,o,n.coordinates,o,8942):n.type===`MultiLineString`&&(s=e.createLines(a,o,n.coordinates,60962)),s&&(s.zincObject.isEditable=!0)})},OE=function(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].userData;if(r){if(r.isGlyph||r.isGlyphset){let e=r;r.isGlyph&&(e=r.getGlyphset()),t.push(e)}else t.push(r)}}return t},kE=(e,t)=>{let n=e.label.toUpperCase(),r=t.label.toUpperCase();return n<r?-1:+(n>r)},AE={name:`ScaffoldTreeControls`,components:{ElIconArrowLeft:Id,TreeControls:n.TreeControls},props:{containerHeight:Number,isReady:Boolean,showColourPicker:Boolean},data:function(){return{treeData:[{label:`Root`,regionPath:``,id:void 0,children:[]}],active:[],hover:[],drawerOpen:!0,nodeNumbers:0,module:void 0}},computed:{drawerBottom:function(){return 100>this.maxHeight?this.maxHeight:100},maxHeight:function(){let e=this.containerHeight-114;return 0>e&&(e=0),e},treeDataEntry:function(){return this.treeData[0].children}},watch:{treeDataEntry:{deep:!0,handler:function(e){this.isReady&&this.setColourField(e)}}},methods:{setCheckboxDisabled:function(e,t,n){e&&(n||(e.disabled=t),e.children&&e.children.forEach(e=>this.setCheckboxDisabled(e,t,!1)))},setRegionCheckboxDisabled:function(e,t,n){if(this.treeData[0]&&e?.uuid){let r=this.findDataWithId(this.treeData[0],e?.uuid);r&&this.setCheckboxDisabled(r,t,n)}},findDataWithId:function(e,t){if(e){if(e.id===t)return e;if(e.children)for(let n=0;n<e.children.length;n++){let r=this.findDataWithId(e.children[n],t);if(r)return r}}},addTreeItem:function(e,t,n){e.some(e=>e.label===t.label)||(Object.assign(t,{activeColour:this.getColour(t)}),e.push(t),e.sort((e,t)=>kE(e,t)),this.nodeNumbers++,this.$nextTick(()=>{!this.$refs.treeControls.$refs.regionTree.getCheckedKeys().includes(t.id)&&n.getVisibility()&&this.$refs.treeControls.$refs.regionTree.setChecked(t.id,!0)}))},findOrCreateRegion:function(e,t,n){if(this.module&&this.module.scene&&(this.treeData[0].id=this.module.scene.getRootRegion().uuid,this.treeData[0].isRegion=!0),t.length>0){let r=[...t],i=e.children.find(e=>e.label==r[0]),a=n+`/`+t[0],o=this.module.scene.getRootRegion().findChildFromPath(a);return i||(i={label:r[0],id:o.uuid,children:[],regionPath:a,isRegion:!0},this.addTreeItem(e.children,i,o),a===`/_helper`&&this.$nextTick(()=>{this.$refs.treeControls.$refs.regionTree.setChecked(i.id,!1)})),r.shift(),this.findOrCreateRegion(i,r,a)}return e},removeRegion:function(e){if(this.treeData[0].children){for(let t=0;t<this.treeData[0].children.length;t++)if(this.treeData[0].children[t].label===e){this.treeData[0].children.splice(t,1),this.nodeNumbers--;return}}},zincObjectAdded:function(e){let t=e.region;if(t){let n=t.getFullSeparatedPath(),r=this.findOrCreateRegion(this.treeData[0],n,``);if(e.groupName&&r){r.children||=[];let n={disabled:!1,label:e.groupName,id:t.uuid+`/`+e.uuid,isPrimitives:!0,regionPath:e.region.getFullPath(),isTextureSlides:!!e.isTextureSlides};this.addTreeItem(r.children,n,e)}}},removeGroupFromRegionTreeData:function(e,t){let n=e.getFullSeparatedPath(),r=this.findOrCreateRegion(this.treeData[0],n,``);for(let e=0;e<r.children.length;e++)if(r.children[e].label===t){r.children.splice(e,1),this.nodeNumbers--;return}},zincObjectRenamed:function(e,t){e.region.findObjectsWithGroupName(t,!1).length<1&&this.removeGroupFromRegionTreeData(e.region,t),this.zincObjectAdded(e)},zincObjectRemoved:function(e){let t=e.groupName;e.region.findObjectsWithGroupName(t,!1).length===0&&this.removeGroupFromRegionTreeData(e.region,t)},checkChanged:function(e,t){let n=e.isRegion,r=e.isPrimitives,i=t.checkedKeys.includes(e.id),a=this.module.scene.getRootRegion().findChildFromPath(e.regionPath);if(n&&(i?a.showAllPrimitives():a.hideAllPrimitives(),this.$emit(`check-changed`,{region:a,isChecked:i})),r){let t=a.findObjectsWithGroupName(e.label);t.forEach(t=>{let n=i&&!e.disabled;t.setVisibility(n)}),this.$emit(`check-changed`,{zincObjects:t,isChecked:i})}},updateActiveUI:function(e){this.active.length=0,sE(e,this.active)},changeActiveByPrimitives:function(e,t){e&&e.length>0?(this.updateActiveUI(e),this.$emit(`object-selected`,e,t)):this.removeActive(t),this.removeHover(t)},updateHoverUI:function(e){this.hover.length=0,sE(e,this.hover)},changeHoverByPrimitives:function(e,t){e&&e.length>0?(this.updateHoverUI(e),this.$emit(`object-hovered`,e,t)):this.removeHover(t)},changeActiveByNames:function(e,t,n){let r=vE(this.module.scene.getRootRegion(),e,t,!0);this.changeActiveByPrimitives(r,n)},changeHoverByNames:function(e,t,n){let r=vE(this.module.scene.getRootRegion(),e,t,!0);this.changeHoverByPrimitives(r,n)},changeActiveByNode:function(e,t){if(e.isPrimitives||e.isRegion){let n=!!e.isRegion,r=this.getZincObjectsFromNode(e,n);this.changeActiveByPrimitives(r,t)}},changeHoverByNode:function(e,t){if(e.isPrimitives){let n=this.getZincObjectsFromNode(e,!1);this.changeHoverByPrimitives(n,t)}},removeActive:function(e){this.active=[],this.$emit(`object-selected`,[],e)},removeHover:function(e){this.hover=[],this.$emit(`object-hovered`,[],e)},clear:function(){this.active.length=0,this.hover.length=0,this.nodeNumbers=0,this.$refs.treeControls.$refs.regionTree.updateKeyChildren(this.treeData[0].id,[]),this.treeData[0].children.length=0,this.treeData[0].id=void 0,this.$emit(`object-selected`,[])},forEachChildInNode:function(e,t,n,r,i){if(e.isRegion){if(e.children){let a=n===``||t.includes(e.id);e.children.forEach(n=>this.forEachChildInNode(n,t,e.regionPath,r&&a,i))}}else e.isPrimitives&&i(e,n,r)},getColour:function(e){if(e){let t=this.getZincObjectsFromNode(e,!1)[0];if(t){let e=t.getColourHex();if(e)return`#`+e}}return`#FFFFFF`},getNodeDataByRegionAndGroup:function(e,t){for(let n of this.treeDataEntry)if(n.isRegion&&n.label===e){let e=n.children;for(let n of e)if(n.isPrimitives&&n.label===t)return n}},getZincObjectsFromNode:function(e,t){let n=this.module.scene.getRootRegion();if(e.isPrimitives)return vE(n,e.label,e.regionPath,t);if(e.isRegion&&e.regionPath){let r=n.findChildFromPath(e.regionPath);if(r)return r.getAllObjects(t)}return[]},setModule:function(e){this.module=(0,t.markRaw)(e),this.nodeNumbers=0,this.module.scene.getRootRegion().getAllObjects(!0).forEach(e=>{this.zincObjectAdded(e)}),this.module.addOrganPartAddedCallback(this.zincObjectAdded),this.module.addOrganPartRemovedCallback(this.zincObjectRemoved)},setColourField:function(e,t=void 0){e.filter(e=>t&&!e.children?e.id===t.id:!0).map(e=>{if(e.children)this.setColourField(e.children,t);else{let t=this.getColour(e);e.defaultColour||=t,e.activeColour=t}})},setColour:function(e,t){e&&e.isPrimitives&&this.getZincObjectsFromNode(e,!1).forEach(n=>{let r=(t||e.defaultColour).replace(`#`,`0x`);n.setColourHex(r),this.setColourField(this.treeData[0].children,e)})},updateAllNodeColours:function(){let e=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();this.forEachChildInNode(this.treeData[0],e,``,!0,(e,t,n)=>{e.isPrimitives&&(e.activeColour=this.getColour(e))})},setOutlines:function(e){let t=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();this.forEachChildInNode(this.treeData[0],t,``,!0,(n,r,i)=>{let a=this.module.scene.getRootRegion().findChildFromPath(r).findObjectsWithGroupName(n.label);e?a.forEach(e=>{e.isLines&&(t.includes(n.id)&&i&&e.setVisibility(!0),n.disabled=!1)}):n.isPrimitives&&a.forEach(e=>{e.isLines&&(e.setVisibility(!1),n.disabled=!0)})})},visibilityToggle:function(e,t){this.module.changeOrganPartsVisibility(e,t),t==0&&(this.activeRegion===e&&this.removeActive(!0),this.hoverRegion===e&&this.removeHover(!0))},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen,this.$emit(`drawer-toggled`,this.drawerOpen)},setTreeVisibilityWithFullPaths:function(e,t,n,r){let i=!1,a=``;e.isRegion&&(a=`__r${e.regionPath}`),e.isPrimitives&&(a=`${e.regionPath}/${e.label}`);let o=t.indexOf(a);o>-1&&(i=!0,t.splice(o,1),n.push(e.id));let s=this.module.scene.getRootRegion().findChildFromPath(e.regionPath);a&&a!==`__r`&&e.isPrimitives&&s.findObjectsWithGroupName(e.label).forEach(e=>e.setVisibility(i)),e.children&&e.children.forEach(e=>{this.setTreeVisibilityWithFullPaths(e,t,n,!0)})},setCheckedKeys:function(e,t){this.$nextTick(()=>{t&&this.$refs.treeControls.$refs.regionTree.setCheckedKeys([]),e.forEach(e=>{this.$refs.treeControls.$refs.regionTree.setChecked(e,!0,!0)})})},checkAllKeys:function(e=[]){let t=[],n=[];_E(this.treeData[0],t);let r=t.filter(t=>!e.some(e=>t.includes(e)));this.setTreeVisibilityWithFullPaths(this.treeData[0],r,n,!0),this.$refs.treeControls.$refs.regionTree.setCheckedKeys(n)},getState:function(){let e=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();return e.length===this.nodeNumbers?{checkAll:!0,version:`2.0`}:{checkedItems:bE(this.module.scene.getRootRegion(),e),version:`2.0`}},setState:function(e){if(e){if(e.checkAll)this.checkAllKeys();else if(e.checkedItems){let t=[];e.version===`2.0`?t.push(...e.checkedItems):(t=e.checkedItems.map(e=>`/`+e),t.shift(`__r/`));let n=[];this.setTreeVisibilityWithFullPaths(this.treeData[0],t,n,!0),this.$refs.treeControls.$refs.regionTree.setCheckedKeys(n)}}}}},jE={class:`tree-controls-scroll`};function ME(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`TreeControls`),c=Id,l=Qd;return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`tree-controls`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createElementVNode)(`div`,jE,[(0,t.createElementVNode)(`div`,{class:`tree-controls-container`,style:(0,t.normalizeStyle)({"max-height":`${o.maxHeight}px`})},[(0,t.renderSlot)(e.$slots,`treeSlot`,{},void 0,!0),(0,t.createVNode)(s,{mapType:`scaffold`,title:`Regions`,isReady:r.isReady,treeData:o.treeDataEntry,active:e.active,hover:e.hover,showColourPicker:r.showColourPicker,onSetColour:o.setColour,onCheckChanged:o.checkChanged,onChangeActive:o.changeActiveByNode,onChangeHover:o.changeHoverByNode,ref:`treeControls`,onMouseleave:n[0]||=e=>o.removeHover(!0)},null,8,[`isReady`,`treeData`,`active`,`hover`,`showColourPicker`,`onSetColour`,`onCheckChanged`,`onChangeActive`,`onChangeHover`])],4)]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({bottom:`${o.drawerBottom}px`}),onClick:n[1]||=(...e)=>o.toggleDrawer&&o.toggleDrawer(...e)},[(0,t.createVNode)(l,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c)]),_:1})],6)],2)}var NE=nv(AE,[[`render`,ME],[`__scopeId`,`data-v-1ea383cd`]]),PE={name:`LinesControls`,components:{Button:Km,Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Slider:C_,ElIconArrowLeft:Id,ElIconArrowRight:Ld},props:{createData:{type:Object},usageConfig:{type:Object}},data:function(){return{adjust:0,pAdjust:0,lengthScale:0,distance:0,newDistance:0,width:1,radius:oE.DEFAULT_RADIUS,radialSegments:oE.DEFAULT_RADIAL_SEGMENTS,currentIndex:0,ElIconArrowLeft:(0,t.shallowRef)(Id),ElIconArrowRight:(0,t.shallowRef)(Ld),edited:!1,zincObject:void 0,isTubeLines:!1}},computed:{showTubeLinesControls(){return this.usageConfig.showTubeLinesControls}},watch:{"createData.faceIndex":{handler:function(e){this.zincObject?.isLines2&&(this.currentIndex=e,this.distance=mE(this.zincObject,this.currentIndex))},immediate:!0}},methods:{changeIndex:function(e){e?mE(this.zincObject,this.currentIndex+1)>0&&(this.currentIndex++,this.reset()):(this.currentIndex--,this.reset())},onLengthInput:function(){this.newDistance===0?this.newDistance=this.distance:(this.distance=this.newDistance,this.edited=hE(this.zincObject,this.currentIndex,this.newDistance,!0)||this.edited)},onLengthSliding:function(){this.newDistance=10**this.lengthScale*this.distance,this.edited=hE(this.zincObject,this.currentIndex,this.newDistance,!0)||this.edited},onMoveSliding:function(){let e=(this.adjust-this.pAdjust)*this.distance;this.edited=hE(this.zincObject,this.currentIndex,e,!1)||this.edited,this.pAdjust=this.adjust},reset:function(){this.adjust=0,this.pAdjust=0,this.lengthScale=0,this.distance=mE(this.zincObject,this.currentIndex),this.newDistance=this.distance,this.edited&&=(this.$emit(`primitivesUpdated`,this.zincObject),!1)},setObject:function(e){this.currentIndex=-1,this.distance=0,e.isLines2||e.isTubeLines?(this.zincObject=(0,t.markRaw)(e),this.width=this.zincObject.getMorph().material.linewidth,this.isTubeLines=e.isTubeLines,e.isEditable?(this.currentIndex=0,this.distance=mE(e,this.currentIndex)):e.userData?.isNerves&&(this.radius=oE.ZOOM_RADIUS,this.radialSegments=oE.ZOOM_RADIAL_SEGMENTS)):(this.zincObject=void 0,this.width=10)},modifyWidth:function(){this.zincObject.setWidth(this.width)},modifyTubeLines:function(){this.zincObject.setTubeLines(this.radius,this.radius*this.radialSegments)}}};function FE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=Km,f=Hg,p=zg;return(0,t.openBlock)(),(0,t.createBlock)(p,{class:`lines-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{class:`slides-block`},{default:(0,t.withCtx)(()=>[e.isTubeLines&&o.showTubeLinesControls?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[15]||=[(0,t.createTextVNode)(` Radius: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.radius,"onUpdate:modelValue":n[0]||=t=>e.radius=t,class:`my-slider`,step:1,min:1,max:32,"show-tooltip":!1,onInput:o.modifyTubeLines},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.radius,"onUpdate:modelValue":n[1]||=t=>e.radius=t,step:1,min:1,max:32,controls:!1,onChange:o.modifyTubeLines,class:`input-box number-input`},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` Radial Segments: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.radialSegments,"onUpdate:modelValue":n[2]||=t=>e.radialSegments=t,class:`my-slider`,step:1,min:8,max:32,"show-tooltip":!1,onInput:o.modifyTubeLines},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.radialSegments,"onUpdate:modelValue":n[3]||=t=>e.radialSegments=t,step:1,min:8,max:32,controls:!1,onChange:o.modifyTubeLines,class:`input-box number-input`},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1})],64)):e.isTubeLines?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(u,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` Width: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.width,"onUpdate:modelValue":n[4]||=t=>e.width=t,class:`my-slider`,step:1,min:1,max:100,"show-tooltip":!1,onInput:o.modifyWidth},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.width,"onUpdate:modelValue":n[5]||=t=>e.width=t,step:1,min:1,max:100,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1})),e.currentIndex>-1&&e.distance>0?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:2},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{size:`small`,disabled:e.currentIndex===0,icon:e.ElIconArrowLeft,onClick:n[6]||=e=>o.changeIndex(!1)},null,8,[`disabled`,`icon`])]),_:1}),(0,t.createVNode)(s,{offset:4,span:9},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` Editing Line `+(0,t.toDisplayString)(e.currentIndex+1),1)]),_:1}),(0,t.createVNode)(s,{offset:2,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{size:`small`,icon:e.ElIconArrowRight,onClick:n[7]||=e=>o.changeIndex(!0)},null,8,[`icon`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` Move: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.adjust,"onUpdate:modelValue":n[8]||=t=>e.adjust=t,step:.01,min:-3,max:3,"show-tooltip":!1,onInput:n[9]||=e=>o.onMoveSliding(),onChange:n[10]||=e=>o.reset()},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` Length: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.lengthScale,"onUpdate:modelValue":n[11]||=t=>e.lengthScale=t,step:.01,min:-1,max:1,"show-tooltip":!1,onInput:n[12]||=e=>o.onLengthSliding(),onChange:n[13]||=e=>o.reset()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.newDistance,"onUpdate:modelValue":n[14]||=t=>e.newDistance=t,controls:!1,class:`input-box number-input`,onChange:o.onLengthInput},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1})],64)):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var IE=nv(PE,[[`render`,FE],[`__scopeId`,`data-v-0deb177d`]]),LE={name:`GlyphsControls`,components:{Checkbox:qh,Container:zg,Main:Hg},data:function(){return{displayLabels:!0}},watch:{displayLabels:{handler:function(e){e?this.zincObject.showLabel():this.zincObject.hideLabel()}}},methods:{reset:function(){this.displayLabels=!0},setObject:function(e){e.isGlyphset?(this.zincObject=(0,t.markRaw)(e),this.displayLabels=this.zincObject.isLabelDisplayed()):this.zincObject=void 0}}};function RE(e,n,r,i,a,o){let s=qh,c=zg;return(0,t.openBlock)(),(0,t.createBlock)(c,{class:`glyph-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{modelValue:e.displayLabels,"onUpdate:modelValue":n[0]||=t=>e.displayLabels=t,class:`block`},{default:(0,t.withCtx)(()=>[...n[1]||=[(0,t.createTextVNode)(` Display labels `,-1)]]),_:1},8,[`modelValue`])]),_:1})}var zE=nv(LE,[[`render`,RE],[`__scopeId`,`data-v-fce6c6da`]]),BE={name:`PointsControls`,components:{Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Select:Oh,Slider:C_,Row:mg,Option:kh,ElIconArrowLeft:Id,ElIconArrowRight:Ld},inject:[`boundingDims`],data:function(){return{attenuation:!1,size:10,choices:[{value:!0,label:`On`},{value:!1,label:`off`}],min:[0,0,0],max:[1,1,1],translation:[0,0,0],pTranslation:[0,0,0],currentIndex:-1,ElIconArrowLeft:(0,t.shallowRef)(Id),ElIconArrowRight:(0,t.shallowRef)(Ld),edited:!1,zincObject:void 0}},watch:{boundingDims:{handler:function(e){let t=e.size;this.min=[-t[0]/2,-t[1]/2,-t[2]/2],this.max=[t[0]/2,t[1]/2,t[2]/2]},immediate:!0,deep:!0}},methods:{changeIndex:function(e){e?this.zincObject.drawRange>this.currentIndex+1&&(this.currentIndex++,this.reset()):(this.currentIndex--,this.reset())},onMoveSliding:function(){let e=[this.translation[0]-this.pTranslation[0],this.translation[1]-this.pTranslation[1],this.translation[2]-this.pTranslation[2]];this.edited=pE(this.zincObject,this.currentIndex,e)||this.edited;for(let e=0;e<3;e++)this.pTranslation[e]=this.translation[e]},reset:function(){this.translation=[0,0,0],this.pTranslation=[0,0,0],this.edited&&=(this.$emit(`primitivesUpdated`,this.zincObject),!1)},setObject:function(e){this.currentIndex=-1,e.isPointset?(this.zincObject=(0,t.markRaw)(e),this.size=this.zincObject.morph.material.size,this.attenuation=this.zincObject.morph.material.sizeAttenuation,e.isEditable&&this.zincObject.drawRange>0&&(this.currentIndex=0)):(this.zincObject=void 0,this.size=10,this.attenuation=!1)},modifyAttenuation:function(e){this.attenuation=e,this.zincObject.setSizeAttenuation(e)},modifySize:function(){this.zincObject.setSize(this.size)}}};function VE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=kh,f=Oh,p=Km,m=Hg,h=zg;return(0,t.openBlock)(),(0,t.createBlock)(h,{class:`pointset-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[15]||=[(0,t.createTextVNode)(` Size: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.size,"onUpdate:modelValue":n[0]||=t=>e.size=t,class:`my-slider`,step:1,min:0,max:100,"show-tooltip":!1,onInput:n[1]||=e=>o.modifySize()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.size,"onUpdate:modelValue":n[2]||=t=>e.size=t,step:1,min:0,max:100,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` Size attenuation: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:5},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{teleported:!1,"model-value":e.attenuation,placeholder:`Select`,class:`input-box`,"popper-class":`viewer_dropdown`,onChange:n[3]||=t=>o.modifyAttenuation(t,e.slide)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.choices,e=>((0,t.openBlock)(),(0,t.createBlock)(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`])]),_:1})]),_:1}),e.currentIndex>-1?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{size:`small`,disabled:e.currentIndex===0,icon:e.ElIconArrowLeft,onClick:n[4]||=e=>o.changeIndex(!1)},null,8,[`disabled`,`icon`])]),_:1}),(0,t.createVNode)(s,{offset:4,span:9},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` Editing Point `+(0,t.toDisplayString)(e.currentIndex+1),1)]),_:1}),(0,t.createVNode)(s,{offset:2,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{size:`small`,icon:e.ElIconArrowRight,onClick:n[5]||=e=>o.changeIndex(!0)},null,8,[`icon`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` x: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[0],"onUpdate:modelValue":n[6]||=t=>e.translation[0]=t,step:.01,min:e.min[0],max:e.max[0],"show-tooltip":!1,onInput:n[7]||=e=>o.onMoveSliding(),onChange:n[8]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` y: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[1],"onUpdate:modelValue":n[9]||=t=>e.translation[1]=t,step:.01,min:e.min[1],max:e.max[1],"show-tooltip":!1,onInput:n[10]||=e=>o.onMoveSliding(),onChange:n[11]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` z: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[2],"onUpdate:modelValue":n[12]||=t=>e.translation[2]=t,step:.01,min:e.min[2],max:e.max[2],"show-tooltip":!1,onInput:n[13]||=e=>o.onMoveSliding(),onChange:n[14]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1})],64)):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var HE=nv(BE,[[`render`,VE],[`__scopeId`,`data-v-d1de9c65`]]),UE={name:`TextureSlidesControls`,components:{Checkbox:qh,Col:hg,Container:zg,Divider:Wg,Footer:Bg,Icon:Qd,InputNumber:Qg,Main:Hg,Row:mg,Select:Oh,Slider:C_,Option:kh,ElIconDelete:Hd,ElIconPlus:Kd},data:function(){return{brightness:0,contrast:1,discardAlpha:!0,settings:[],directions:[{value:`x`,label:`x`},{value:`y`,label:`y`},{value:`z`,label:`z`}],zincObject:void 0}},watch:{brightness:{handler:function(e){this.zincObject&&this.zincObject.setBrightness(e)},immediate:!1},contrast:{handler:function(e){this.zincObject&&this.zincObject.setContrast(e)},immediate:!1},discardAlpha:{handler:function(e){this.zincObject&&this.zincObject.discardAlphaPixel(e)},immediate:!1}},methods:{setObject:function(e){e.isTextureSlides?(this.zincObject=(0,t.markRaw)(e),this.settings=this.zincObject.getTextureSettings(),this.brightness=this.zincObject.getBrightness(),this.contrast=this.zincObject.getContrast(),this.discardAlpha=this.zincObject.isAlphaPixelDiscarded()):(this.zincObject=void 0,this.settings=[],this.brightness=0,this.contrast=1,this.discardAlpha=!0)},addNewSlide:function(){let e=this.zincObject.createSlide({direction:`x`,value:0});this.settings.push(e)},modifyDirection:function(e,t){t&&(t.direction=e,this.zincObject.modifySlideSettings(t))},modifySlide:function(e){e&&this.zincObject.modifySlideSettings(e)},removeSlide:function(e,t){this.zincObject.removeSlideWithId(t.id),this.settings.splice(e,1)}}};function WE(e,n,r,i,a,o){let s=qh,c=mg,l=hg,u=C_,d=Qg,f=Wg,p=kh,m=Oh,h=Hd,g=Qd,_=Hg,v=Kd,y=Bg,b=zg;return(0,t.openBlock)(),(0,t.createBlock)(b,{class:`t-slides-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{modelValue:e.discardAlpha,"onUpdate:modelValue":n[0]||=t=>e.discardAlpha=t},{default:(0,t.withCtx)(()=>[...n[5]||=[(0,t.createTextVNode)(` Discard Translucent Pixel `,-1)]]),_:1},8,[`modelValue`])]),_:1}),(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:8},{default:(0,t.withCtx)(()=>[...n[6]||=[(0,t.createTextVNode)(` Brightness `,-1)]]),_:1}),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:e.brightness,"onUpdate:modelValue":n[1]||=t=>e.brightness=t,class:`my-slider`,step:.01,min:-1,max:1,"show-tooltip":!1},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:e.brightness,"onUpdate:modelValue":n[2]||=t=>e.brightness=t,step:.01,min:-1,max:1,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:8},{default:(0,t.withCtx)(()=>[...n[7]||=[(0,t.createTextVNode)(` Contrast `,-1)]]),_:1}),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:e.contrast,"onUpdate:modelValue":n[3]||=t=>e.contrast=t,class:`my-slider`,step:.01,min:0,max:10,"show-tooltip":!1},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:e.contrast,"onUpdate:modelValue":n[4]||=t=>e.contrast=t,step:.01,min:0,max:10,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(f),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.settings,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:n.id,class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{teleported:!1,"model-value":n.direction,placeholder:`Select`,class:`input-box`,"popper-class":`viewer_dropdown`,onChange:e=>o.modifyDirection(e,n)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.directions,e=>((0,t.openBlock)(),(0,t.createBlock)(p,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`onChange`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,class:`my-slider`,step:.001,min:0,max:1,"show-tooltip":!1,onInput:e=>o.modifySlide(n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onInput`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,onChange:e=>o.modifySlide(n),step:.001,min:0,max:1,controls:!1,class:`input-box number-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(g,{class:`delete-icon`,onClick:e=>o.removeSlide(r,n)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(h)]),_:1},8,[`onClick`])]),_:2},1024)]),_:2},1024))),128))]),_:1}),(0,t.createVNode)(y,{height:`30px`,class:`add-slides-text`,onClick:o.addNewSlide},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(g,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(v)]),_:1})]),_:1}),(0,t.createVNode)(l,{span:20},{default:(0,t.withCtx)(()=>[...n[8]||=[(0,t.createTextVNode)(` Add a new slide `,-1)]]),_:1})]),_:1})]),_:1},8,[`onClick`])]),_:1})}var GE=nv(UE,[[`render`,WE],[`__scopeId`,`data-v-687baffd`]]),KE={name:`TransformationControls`,components:{Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Slider:C_},inject:[`boundingDims`],data:function(){return{x:0,y:0,z:0,scale:1,min:[0,0,0],max:[1,1,1],zincObject:void 0,enableScaling:!0}},watch:{boundingDims:{handler:function(e){this.calculateMinAndMax()},immediate:!0,deep:!0}},methods:{calculateMinAndMax:function(){if(this.zincObject){let e=this.zincObject?.userData?.originalPos;this.zincObject.getGroup(),e&&this.boundingDims&&(this.min=[e[0]-this.boundingDims.size[0],e[1]-this.boundingDims.size[1],e[2]-this.boundingDims.size[2]],this.max=[e[0]+this.boundingDims.size[0],e[1]+this.boundingDims.size[1],e[2]+this.boundingDims.size[2]])}},setObject:function(e){if(e.isZincObject){this.zincObject=(0,t.markRaw)(e);let n=this.zincObject.getGroup();this.zincObject.userData.originalPos,n&&n.position&&(this.x=n.position.x,this.y=n.position.y,this.z=n.position.z,this.scale=this.zincObject.isGlyphset?this.zincObject.globalScale:n.scale.x,this.enableScaling=!this.zincObject.isTextureSlides,this.calculateMinAndMax())}else this.zincObject=void 0,this.x=0,this.y=0,this.z=0,this.scale=1},modifyPosition:function(){this.zincObject&&this.zincObject.setPosition(this.x,this.y,this.z)},modifyScale:function(){this.zincObject.setScaleAll(this.scale)}}};function qE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=Hg,f=zg;return(0,t.openBlock)(),(0,t.createBlock)(f,{class:`transformation-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` x: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.x,"onUpdate:modelValue":n[0]||=t=>e.x=t,step:.01,min:e.min[0],max:e.max[0],"show-tooltip":!1,onInput:n[1]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.x,"onUpdate:modelValue":n[2]||=t=>e.x=t,step:.01,min:e.min[0],max:e.max[0],controls:!1,class:`input-box number-input`,onChange:n[3]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` y: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.y,"onUpdate:modelValue":n[4]||=t=>e.y=t,step:.01,min:e.min[1],max:e.max[1],"show-tooltip":!1,onInput:n[5]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.y,"onUpdate:modelValue":n[6]||=t=>e.y=t,step:.01,min:e.min[1],max:e.max[1],controls:!1,class:`input-box number-input`,onChange:n[7]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` z: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.z,"onUpdate:modelValue":n[8]||=t=>e.z=t,step:.01,min:e.min[2],max:e.max[2],"show-tooltip":!1,onInput:n[9]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.z,"onUpdate:modelValue":n[10]||=t=>e.z=t,step:.01,min:e.min[2],max:e.max[2],controls:!1,class:`input-box number-input`,onChange:n[11]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),e.enableScaling?((0,t.openBlock)(),(0,t.createBlock)(u,{key:0,class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` Scale: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.scale,"onUpdate:modelValue":n[12]||=t=>e.scale=t,step:.01,min:0,max:5,"show-tooltip":!1,onInput:n[13]||=e=>o.modifyScale()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.scale,"onUpdate:modelValue":n[14]||=t=>e.scale=t,step:.01,min:0,max:5,controls:!1,class:`input-box number-input`,onChange:n[15]||=e=>o.modifyScale()},null,8,[`modelValue`])]),_:1})]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var JE=nv(KE,[[`render`,qE],[`__scopeId`,`data-v-962c6314`]]),YE={name:`OpacityControls`,components:{Container:zg,Header:Vg,Main:Hg,Slider:C_},props:{material:void 0,zincObject:void 0},data:function(){return{displayString:`100%`}},watch:{"material.opacity":function(){this.material&&this.zincObject&&this.zincObject.setAlpha(this.material.opacity)}},methods:{formatTooltip(e){return this.displayString=Math.floor(100*e+.5)+`%`,this.displayString}}},XE={class:`block`},ZE={class:`display`};function QE(e,n,r,i,a,o){let s=C_,c=zg;return r.material?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,class:`opacity-container`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,XE,[(0,t.createElementVNode)(`span`,ZE,(0,t.toDisplayString)(e.displayString),1),(0,t.createVNode)(s,{modelValue:r.material.opacity,"onUpdate:modelValue":n[0]||=e=>r.material.opacity=e,class:`my-slider`,step:.01,min:0,max:1,"format-tooltip":o.formatTooltip,"show-tooltip":!1},null,8,[`modelValue`,`format-tooltip`])])]),_:1})):(0,t.createCommentVNode)(``,!0)}var $E=nv(YE,[[`render`,QE],[`__scopeId`,`data-v-7e39127d`]]),eD={name:`PrimitiveControls`,components:{Collapse:jg,CollapseItem:Mg,GlyphsControls:zE,LinesControls:IE,OpacityControls:$E,PointsControls:HE,TextureSlidesControls:GE,TransformationControls:JE,ElIconArrowRight:Ld},props:{createData:{type:Object},viewingMode:{type:String,default:`Exploration`},usageConfig:{type:Object}},data:function(){return{activeName:`oControls`,material:void 0,isTextureSlides:!1,isPointset:!1,isLines:!1,isGlyph:!1,zincObject:void 0,isEditable:!1,displayString:`100%`}},computed:{hasValidPrimitive:function(){return this.viewingMode===`Exploration`||this.viewingMode===`Annotation`?this.material!==void 0||this.isTextureSlides===!0:!1}},methods:{formatTooltip:function(e){return this.displayString=Math.floor(100*e+.5)+`%`,this.displayString},setObject:function(e){this.zincObject=e?(0,t.markRaw)(e):void 0,this.isEditable=!!this.zincObject?.isEditable,this.isPointset=!1,this.isTextureSlides=!1,this.isLines=!1,this.isGlyph=!1,this.activeName=`trControls`,e&&(e.isTextureSlides?(this.isTextureSlides=!0,this.$refs.tSlidesControls.setObject(e),this.activeName=`tsControls`):e.isPointset?(this.isPointset=!0,this.$refs.pointsetControls.setObject(e),this.activeName=`pControls`):e.isLines2||e.isTubeLines&&this.usageConfig?.showTubeLinesControls?(this.isLines=!0,this.$refs.linesControls.setObject(e),this.activeName=`lControls`):e.isGlyphset&&e.canShowLabel()&&(this.isGlyph=!0,this.$refs.glyphControls.setObject(e),this.activeName=`gControls`),this.$refs.transformationControls.setObject(e)),this.material=e&&e.getMorph()?e.getMorph().material:void 0}}},tD={class:`my-drawer`};function nD(e,n,r,i,a,o){let s=$E,c=Mg,l=JE,u=GE,d=HE,f=zE,p=IE,m=jg;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,tD,[(0,t.createVNode)(m,{class:`collapse`,modelValue:e.activeName,"onUpdate:modelValue":n[3]||=t=>e.activeName=t,accordion:``},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createVNode)(c,{title:`Opacity`,name:`oControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{material:e.material,zincObject:e.zincObject,ref:`opacityControls`},null,8,[`material`,`zincObject`])]),_:1},512),[[t.vShow,!e.isTextureSlides]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Transformation`,name:`trControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{class:`transformation-controls`,ref:`transformationControls`},null,512)]),_:1},512),[[t.vShow,!e.isEditable]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Texture Slides`,name:`tsControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{class:`texture-controls`,ref:`tSlidesControls`},null,512)]),_:1},512),[[t.vShow,e.isTextureSlides]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Points`,name:`pControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{class:`pointset-controls`,ref:`pointsetControls`,onPrimitivesUpdated:n[0]||=t=>e.$emit(`primitivesUpdated`,t)},null,512)]),_:1},512),[[t.vShow,e.isPointset]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Glyphset`,name:`gControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{class:`glyph-controls`,ref:`glyphControls`,onPrimitivesUpdated:n[1]||=t=>e.$emit(`primitivesUpdated`,t)},null,512)]),_:1},512),[[t.vShow,e.isGlyph]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Lines`,name:`lControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{class:`lines-controls`,ref:`linesControls`,createData:r.createData,usageConfig:r.usageConfig,onPrimitivesUpdated:n[2]||=t=>e.$emit(`primitivesUpdated`,t)},null,8,[`createData`,`usageConfig`])]),_:1},512),[[t.vShow,e.isLines]])]),_:1},8,[`modelValue`])],512)),[[t.vShow,o.hasValidPrimitive]])}var rD=nv(eD,[[`render`,nD],[`__scopeId`,`data-v-4b7eafcb`]]),iD=(0,i.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}}),aD={name:`ScaffoldTooltip`,components:{Col:hg,CreateTooltipContent:n.CreateTooltipContent,Icon:Qd,Popover:r_,Row:mg,Tooltip:n.Tooltip},props:{createData:{type:Object,default:{drawingBox:!1,renaming:!1,toBeConfirmed:!1,points:[],tempGroupName:void 0,shape:``,x:0,y:0,editingIndex:-1,faceIndex:-1,toBeDeleted:!1,regionPrefix:`__annotation`}},label:{type:String,default:``},annotationDisplay:{type:Boolean,default:!1},annotationFeature:{type:Object,default:{}},offlineAnnotationEnabled:{type:Boolean,default:!1},region:{type:String,default:``},visible:{type:Boolean,default:!1},x:{type:Number,default:200},y:{type:Number,default:200}},inject:[`scaffoldUrl`],provide(){return{userApiKey:this.userToken}},data:function(){return{display:!1,annotationEntry:[]}},computed:{...(0,i.mapState)(iD,[`userToken`]),position:function(){let e=40;return this.region&&(e=55),{left:this.x-40+`px`,top:this.y-e+`px`}}},methods:{checkForDisplay:function(){if(this.visible&&this.label&&this.label!==``){if(this.display=!0,this.annotationDisplay){let e=this.region?this.region+`/`:``;this.annotationEntry=[{featureId:e+this.label,resourceId:this.scaffoldUrl,resource:this.scaffoldUrl,feature:this.annotationFeature,offline:this.offlineAnnotationEnabled}]}}else this.display=!1,this.annotationEntry=[]},hideTriggered:function(){this.$emit(`tooltip-hide`)}},watch:{label:{handler:function(){this.checkForDisplay()},immediate:!0},visible:{handler:function(){this.checkForDisplay()},immediate:!0},annotationDisplay:{handler:function(){this.checkForDisplay()},immediate:!0}}},oD={class:`tooltip-text`},sD={key:0,class:`tooltip-text`};function cD(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`CreateTooltipContent`),c=(0,t.resolveComponent)(`Tooltip`),l=r_;return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{style:(0,t.normalizeStyle)(o.position),class:`region-tooltip`},[(0,t.createVNode)(l,{ref:`tooltip`,visible:r.visible,placement:`top`,"show-arrow":!1,teleported:!1,trigger:`manual`,"popper-class":`tooltip-popper non-selectable`,"virtual-triggering":``,onHide:o.hideTriggered},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,oD,(0,t.toDisplayString)(r.label),1),r.region&&r.region!=`/`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,sD,` Region: `+(0,t.toDisplayString)(r.region),1)):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createVNode)(s,{createData:r.createData,onConfirmCreate:n[0]||=t=>e.$emit(`confirm-create`,t),onCancelCreate:n[1]||=t=>e.$emit(`cancel-create`),onCreateRegionSuggestions:n[2]||=t=>e.$emit(`create-region-suggestions`,t),onCreateGroupSuggestions:n[3]||=t=>e.$emit(`create-group-suggestions`,t)},null,8,[`createData`]),[[t.vShow,r.createData.toBeConfirmed]]),(0,t.withDirectives)((0,t.createVNode)(c,{class:`p-tooltip`,ref:`annotationTooltip`,annotationDisplay:!0,annotationEntry:e.annotationEntry,onAnnotation:n[4]||=t=>e.$emit(`confirm-comment`,t)},null,8,[`annotationEntry`]),[[t.vShow,r.annotationDisplay&&!r.createData.toBeConfirmed]])]),_:1},8,[`visible`,`onHide`])],4)}var lD=nv(aD,[[`render`,cD],[`__scopeId`,`data-v-0b62fe75`]]),uD=async(e,t,n,r,i)=>await(0,aE.createPrimitivesFromNIFTI)(e,t,n,r,i),dD={ALL:0,SELECTED:1,HIGHLIGHTED:2,MOVE:3},fD=function(e,t,n){this.eventType=e,this.identifiers=t,this.zincObjects=n},pD=function(e,t,n){this.targetedID=[];let r=e,i=t;this.targetEventType=n;let a=this;n===void 0&&(this.targetEventType=dD.ALL),this.getEventType=function(){return n},this.notify=function(e,t,n,o){if(e!==r&&(a.targetEventType===dD.ALL||a.targetEventType===t)){let e=new fD(t,n,o);i(e)}}},mD=function(){let e=[];this.publish=function(t,n,r,i){for(let a=0;a<e.length;a++)e[a].notify(t,n,r,i)},this.subscribe=function(t,n,r){if(typeof n==`function`){let i=new pD(t,n,r);return e.push(i),i}},this.unsubscribe=function(t){for(let n=0;n<e.length;n++)if(t===e[n]){e.splice(n,1);return}}},hD={isWebGLAvailable:function(){try{var e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch{return!1}},isWebGL2Available:function(){try{var e=document.createElement(`canvas`);return!!(window.WebGL2RenderingContext&&e.getContext(`webgl2`))}catch{return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(e){var t={1:`WebGL`,2:`WebGL 2`},n={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},r=`This module requires <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#008">$1</a> support but your $0 does not seem to support it.`,i=document.createElement(`div`);return i.id=`webglmessage`,i.style.fontFamily=`monospace`,i.style.fontSize=`20px`,i.style.fontWeight=`normal`,i.style.textAlign=`center`,i.style.background=`#fff`,i.style.color=`#000`,i.style.padding=`1.5em`,i.style.width=`400px`,i.style.margin=`5em auto 0`,r=n[e]?r.replace(`$0`,`graphics card`):r.replace(`$0`,`browser`),r=r.replace(`$1`,t[e]),i.innerHTML=r,i}},gD={ALL:0,DESTROYED:1,NAME_CHANGED:2,SETTINGS_CHANGED:3},_D=function(){this.typeName=`Base Module`,this.instanceName=`default`,this.onChangedCallbacks=[],this.eventNotifiers=[]};_D.prototype.setName=function(e){if(e&&this.instanceName!==e){this.instanceName=e;let t=this.onChangedCallbacks.slice();for(let e=0;e<t.length;e++)t[e](this,gD.NAME_CHANGED)}},_D.prototype.settingsChanged=function(){let e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,gD.SETTINGS_CHANGED)},_D.prototype.exportSettings=function(){let e={};return e.dialog=this.typeName,e.name=this.instanceName,e},_D.prototype.importSettings=function(e){return e.dialog==this.typeName&&(this.setName(e.name),!0)},_D.prototype.publishChanges=function(e,t,n){for(let r=0;r<this.eventNotifiers.length;r++)this.eventNotifiers[r].publish(this,t,e,n)},_D.prototype.getName=function(){return this.instanceName},_D.prototype.destroy=function(){let e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,gD.DESTROYED);delete this},_D.prototype.addChangedCallback=function(e){this.onChangedCallbacks.includes(e)==0&&this.onChangedCallbacks.push(e)},_D.prototype.removeChangedCallback=function(e){let t=this.onChangedCallbacks.indexOf(e);t>-1&&this.onChangedCallbacks.splice(t,1)},_D.prototype.addNotifier=function(e){this.eventNotifiers.push(e)};var vD=(e,t,n,r)=>{for(let i=0;i<e.length;i++)if(e[i]&&e[i].material&&e[i].material.emissive){let a=e[i].userData;if(a&&a.isZincObject){let e=t;r===`highlight`&&`highlightColour`in a.userData&&(e=a.userData.highlightColour),r===`select`&&`selectedColour`in a.userData&&(e=a.userData.selectedColour),e&&a.setEmissiveRGB(e)}else e[i].material&&e[i].material.emissive&&e[i].material.emissive.setRGB(...t);n&&e[i].material.depthFunc&&(e[i].material.depthFunc=aE.THREE.LessEqualDepth),e[i].children.forEach(e=>{let n=e.userData;n&&n.isZincObject&&e.material&&e.material.emissive&&e.material.emissive.setRGB(...t)})}},yD=function(){let e=[],t=[];this.highlightColour=[.5,0,0],this.selectColour=[0,.5,0],this.originalColour=[0,0,0];let n=[],r=[],i=this,a=function(e,t){if(e.length==0&&t.length==0)return!1;for(let n=0;n<e.length;n++){let r=!1;for(let i=0;i<t.length;i++)e[n]===t[i]&&(r=!0);if(!r)return!0}for(let n=0;n<t.length;n++){let r=!1;for(let i=0;i<e.length;i++)t[n]===e[i]&&(r=!0);if(!r)return!0}return!1},o=function(e,t){if(n.length=0,t.length==0)return e;for(let r=0;r<e.length;r++){let i=!1;for(let n=0;n<t.length;n++)e[r]===t[n]&&(i=!0);i||n.push(e[r])}return n};this.setHighlighted=function(n){let r=[...e];this.setNervesStyle(r),i.resetHighlighted();let c=o(n,t),l=s(c);return this.setNervesStyle(c,oE.HIGHLIGHTED_COLOUR),vD(l,i.highlightColour,!1,`highlight`),e=c,a(e,r)},this.setSelected=function(e){let n=[...t];this.setNervesStyle(n),i.resetHighlighted(),i.resetSelected();let r=s(e);return this.setNervesStyle(e,oE.SELECTED_COLOUR),vD(r,i.selectColour,!1,`select`),t=e,a(t,n)};let s=function(e){r.length=0;for(let t=0;t<e.length;t++)e[t].material&&r.push(e[t]);return r};this.setNervesStyle=function(e,t){let n=OE(e);if(n&&n.length){let e=t?oE.ZOOM_RADIUS:oE.DEFAULT_RADIUS,r=t?oE.ZOOM_RADIAL_SEGMENTS:oE.DEFAULT_RADIAL_SEGMENTS;n.forEach(n=>{if(n.isTubeLines&&n.userData?.isNerves&&!n.userData?.isGreyScale){n.setTubeLines(e,r);let i=t||n.userData?.defaultColour;i=i.replace(`#`,`0x`),n.setColourHex(i)}})}},this.resetHighlighted=function(){let t=s(e);this.setNervesStyle(e),vD(t,i.originalColour,!0,`reset`),e=[]},this.resetSelected=function(){let n=s(t);this.setNervesStyle(e),vD(n,i.originalColour,!0,`reset`),t=[]},this.getSelected=function(){return t},this.reset=function(){i.resetSelected(),i.resetHighlighted()}},bD=aE.default.THREE,xD=function(){let e=document.createElement(`div`),t;if(e.style.height=`100%`,hD.isWebGLAvailable())t=new aE.default.Renderer(e,window),aE.default.defaultMaterialColor=16777116,t.initialiseVisualisation(),t.playAnimation=!1;else{let t=hD.getWebGLErrorMessage();e.appendChild(t)}return{Zinc:aE.default,renderer:t,container:e}},SD=function(){_D.call(this),this.scene=void 0,this.rendererContainer=void 0,this.displayArea=void 0,this.graphicsHighlight=new yD,this.selectObjectOnPick=!0,this.zincRenderer=null,this.selectedScreenCoordinates=new bD.Vector3,this.selectedCenter=void 0,this.liveUpdatesObjects=void 0,this.ignorePreviousSelected=!1};SD.prototype=Object.create(_D.prototype),SD.prototype.getIntersectedObject=function(e){if(e){let t=e.map(e=>{if(e&&e.object&&e.object.userData){if(e.object.userData.isMarker)return 1;if(e.object.name&&e.object.userData.isZincObject)return e.object.name===`_Unnamed`?3:2}return 0}),n=t.indexOf(1);return n>-1?e[n]:(n=t.indexOf(2),n=n>-1?n:t.indexOf(3),e[n])}},SD.prototype.getAnnotationsFromObjects=function(e,t){let n=[];for(var r=0;r<e.length;r++){let i=e[r].userData,a;if(i){if(i.isGlyph||i.isGlyphset){let n=i;i.isGlyph&&(n=i.getGlyphset()),a=n.userData?n.userData.annotation:void 0,a&&a.data&&(t&&`instanceId`in t?a.data.id=n.getLabel(t.instanceId):e[r].name&&e[r].name!=``?a.data.id=e[r].name:a.data.id=n.groupName)}else a=i.userData?i.userData.annotation:void 0,a&&a.data&&(a.data.id=e[r].name);a&&(a.data.anatomicalId=i.anatomicalId,a.data.isNerves=i.userData.isNerves,a.data.zincObject=i)}a&&n.push(a)}return n},SD.prototype.setHighlightedByObjects=function(e,t,n,r){let i=OE(e),a=this.graphicsHighlight.setHighlighted(e);if(r){let r=dD.MOVE;a&&(r=dD.HIGHLIGHTED);let o=this.getAnnotationsFromObjects(e,n);o.length>0&&(o[0].coords=t,o[0].extraData=n),this.publishChanges(o,r,i)}return a},SD.prototype.setHighlightedByZincObjects=function(e,t,n,r){let i=[];return e&&e.forEach(e=>{e&&e.getMorph()&&i.push(e.getMorph())}),this.setHighlightedByObjects(i,t,n,r)},SD.prototype.setupLiveCoordinates=function(e){if(this.liveUpdatesObjects=e,e&&e.length>0){let t=this.scene.getBoundingBoxOfZincObjects(e),n=new bD.Vector3;t?(t.getCenter(n),this.selectedCenter==null?this.selectedCenter=n:this.selectedCenter.copy(n)):this.selectedCenter=void 0}else this.selectedCenter=void 0},SD.prototype.setSelectedByObjects=function(e,t,n,r){let i=!1;if(i=!this.selectObjectOnPick||this.graphicsHighlight.setSelected(e),i||this.ignorePreviousSelected){let i=OE(e);if(this.selectObjectOnPick&&this.setupLiveCoordinates(i),r){let r=dD.SELECTED,a=this.getAnnotationsFromObjects(e,n);a.length>0&&(a[0].coords=t,a[0].extraData=n),this.publishChanges(a,r,i)}}return i},SD.prototype.setSelectedByZincObjects=function(e,t,n,r){let i=[];return e&&e.forEach(e=>{if(e){let t=e.getMorph();t&&i.push(t)}}),this.setSelectedByObjects(i,t,n,r)},SD.prototype.findObjectsByGroupName=function(e){return this.scene.findObjectsWithGroupName(e)},SD.prototype.setHighlightedByGroupName=function(e,t){let n=this.findObjectsByGroupName(e);return this.setHighlightedByObjects(n,void 0,{},t)},SD.prototype.setSelectedByGroupName=function(e,t){let n=this.findObjectsByGroupName(e);return this.setSelectedByObjects(n,void 0,{},t)},SD.prototype.changeBackgroundColour=function(e){let t=new bD.Color(e);this.zincRenderer&&this.zincRenderer.getThreeJSRenderer().setClearColor(t,1)},SD.prototype.resetView=function(){this.zincRenderer&&this.zincRenderer.resetView()},SD.prototype.viewAll=function(){this.zincRenderer&&this.zincRenderer.viewAll()},SD.prototype.playAnimation=function(e){this.zincRenderer&&(this.zincRenderer.playAnimation=e)},SD.prototype.setPlayRate=function(e){this.zincRenderer&&this.zincRenderer.setPlayRate(e)},SD.prototype.getPlayRate=function(e){return this.zincRenderer?this.zincRenderer.getPlayRate():0},SD.prototype.initialiseRenderer=function(e){if(this.zincRenderer===void 0||this.rendererContainer===void 0){let e=xD();this.Zinc=e.Zinc,this.zincRenderer=e.renderer,this.rendererContainer=e.container}e&&(this.displayArea=e,this.displayArea.appendChild(this.rendererContainer),this.zincRenderer&&this.zincRenderer.animate())},SD.prototype.destroy=function(){this.zincRenderer&&=(this.zincRenderer.dispose(),this.zincRenderer.getThreeJSRenderer().dispose(),void 0),_D.prototype.destroy.call(this)};var CD=function(){this.type=`anatomical`,this.data=void 0,this.isAnnotation=!0},wD=function(){this.currentName=``,this.currentSystem=``,this.currentPart=``,this.currentSpecies=``,this.metaURL=``,this.viewURL=``,this.timeVarying=!1,this.currentTime=0},TD=function(e){SD.call(this);let t=this;this.sceneData=new wD;let n=[],r=[],i=[],a=[],o,s,c=e;this.NDCCameraControl=void 0,t.typeName=`Organ Viewer`;let l=!1;this.isIgnorePicking=function(){return l},this.setIgnorePicking=function(e){l=e},this.getSceneData=function(){return t.sceneData},this.updateTime=function(e){let n=6e3;t.scene&&(n=t.scene.getDuration());let r=e/100*n;t.sceneData.nerveMapIsActive||t.scene&&t.scene.setMorphsTime(r),t.sceneData.currentTime=e};let u=function(){let e=3e3;t.scene&&(e=t.scene.getDuration());let r=t.zincRenderer.getCurrentTime();for(let e=0;e<n.length;e++)n[e](r);t.sceneData.nerveMapIsActive,t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setTime(r/e),t.sceneData.currentTime=r/e*100};this.getCurrentTime=function(){return t.sceneData.currentTime},this.toggleSyncControl=(e,t)=>{let n=this.scene.getZincCameraControls();e?(n.resetView(),this.NDCCameraControl=n.enableSyncControl(),n.setRotationMode(t)):(n.disableSyncControl(),this.NDCCameraControl=void 0,n.setRotationMode(`free`))},this.isSyncControl=()=>this.NDCCameraControl!==void 0,this.setSyncControlZoomToBox=e=>{this.NDCCameraControl&&this.NDCCameraControl.zoomToBox(e,2)},this.setSyncControlCallback=e=>{this.NDCCameraControl&&this.NDCCameraControl.setEventCallback(e)},this.setSyncControlCenterZoom=(e,t)=>{this.NDCCameraControl&&this.NDCCameraControl.setCenterZoom(e,t)};let d=function(){if(t.zincRenderer.playAnimation&&t.liveUpdatesObjects&&t.setupLiveCoordinates(t.liveUpdatesObjects),t.selectedCenter){let e=new aE.THREE.Vector3;e.copy(t.selectedCenter);let n=t.scene.vectorToScreenXY(e);t.selectedScreenCoordinates.x=n.x,t.selectedScreenCoordinates.y=n.y}},f=function(){return function(){u()}},p=function(){return function(){d()}};this.addTimeChangedCallback=function(e){n.push(e)},this.setTexturePos=function(e){t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setSliderPos(e)},this.addSceneChangedCallback=function(e){r.push(e)},this.addOrganPartAddedCallback=function(e){i.push(e)},this.addOrganPartRemovedCallback=function(e){a.push(e)},this.setFinishDownloadCallback=function(e){o=e},this.unsetFinishDownloadCallback=function(){o=void 0},this.setDownloadErrorCallback=function(e){s=e},this.unsetDownloadErrorCallback=function(){s=void 0},this.getNamedObjectsToScreenCoordinates=function(e,t){let n=new aE.THREE.Vector3;n.setFromMatrixPosition(obj.matrixWorld);let r=width/2,i=height/2;return n.project(t),n.x=n.x*r+r,n.y=-(n.y*i)+i,n};let m=function(e){let n,r;if(e!==void 0){let i=!1;e.object.userData&&e.object.userData.isMarker?(i=!0,r=e.object.userData.parent.getMorph()):r=e.object;try{r.userData.userData.annotation.data.lastActionOnMarker=i}finally{}if(r){if(r.name)n=r.name;else{let e=t.getAnnotationsFromObjects([r],void 0);e&&e[0]&&(n=e[0].data.group)}}}return{id:n,object:r}},h=function(){return function(e,n,r){let i=t.getIntersectedObject(e),a=m(i),o={worldCoords:[i?i.point.x:0,i?i.point.y:0,i?i.point.z:0],intersected:i,intersects:e,instanceId:i?.instanceId?i.instanceId:-1},s={x:n,y:r};if(a.id){o.threeID=a.object?.id,a.object.userData.isGlyph?a.object.name?t.setSelectedByObjects([a.object],s,o,!0):t.setSelectedByZincObjects(a.object.userData.getGlyphset(),s,o,!0):t.setSelectedByObjects([a.object],s,o,!0);return}l||t.setSelectedByObjects([],s,o,!0)}},g=function(){return function(e,n,r){let i=t.getIntersectedObject(e),a=m(i),o={worldCoords:[i?i.point.x:0,i?i.point.y:0,i?i.point.z:0],instanceId:i?.instanceId?i.instanceId:-1},s={x:n,y:r};if(a.id){o.threeID=a.object?.id,t.displayArea.style.cursor=`pointer`,t.setHighlightedByObjects([a.object],s,o,!0);return}t.displayArea.style.cursor=`auto`,t.setHighlightedByObjects([],s,o,!0)}},_=function(e,t,n,r){if(r==`all`||r==`geometries`){let r=e.findGeometriesWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`glyphsets`){let r=e.findGlyphsetsWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`pointsets`){let r=e.findPointsetsWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`lines`){let r=e.findLinesWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}};this.changeGeometriesVisibility=function(e,n){_(t.scene,e,n,`geometries`)},this.changeGlyphsetsVisibility=function(e,n){_(t.scene,e,n,`glyphsets`)},this.changeLinesVisibility=function(e,n){_(t.scene,e,n,`lines`)},this.changePointsetsVisibility=function(e,n){_(t.scene,e,n,`pointsets`)},this.changeOrganPartsVisibility=function(e,n,r){let i=`all`;r!==void 0&&(i=r),_(t.scene,e,n,i)},this.changeOrganPartsVisibilityCallback=function(e){return function(n){t.changeOrganPartsVisibility(e,n)}},this.changeBackgroundColour=function(e){let n=new aE.THREE.Color(e);t.zincRenderer&&t.zincRenderer.getThreeJSRenderer().setClearColor(n,1)};let v=function(e,n,r,a){for(let e=0;e<i.length;e++)i[e](a,t.scene.isTimeVarying());r&&c.setGeometryColour(a,e,n);let o=new CD,s=a.region.getFullPath();o.data={species:t.sceneData.currentSpecies,system:e,part:n,group:a.groupName,region:s,uuid:a.uuid,lastActionOnMarker:!1},a.userData.annotation=o},y=function(e,t,n,r){for(let e=0;e<a.length;e++)a[e](r)},b=function(e,t,n){return function(r){v(e,t,n,r)}},x=function(e,t,n){return function(r){y(e,t,n,r)}},S=function(){return function(){t.settingsChanged(),t.sceneData.timeVarying=t.scene.isTimeVarying(),o&&o()}},C=function(){return function(e){if(e?.type===`Error`&&s){let t={xhr:e.xhr,type:`download-error`};s(t)}}};this.updateFieldvisibility=function(e,n){for(let r=0;r<e.length;r++)if(n!=r){let n=e[r].PartName;t.changeOrganPartsVisibility(n,!1)}if(n>-1){let r=e[n].PartName;if(t.scene.findGeometriesWithGroupName(r).length>0||t.scene.findGlyphsetsWithGroupName(r).length>0)t.changeOrganPartsVisibility(r,!0);else{let i=getOrganDetails(e[n].SystemName,r);i!=null&&t.scene.loadMetadataURL(c.getOrgansDirectoryPrefix()+`/`+i.meta)}}},this.getAvailableSpecies=function(e,t,n){let r=[];r.push(`none`);let i=Object.keys(organsFileMap);for(index in i){let a=i[index];a!=e&&organsFileMap[a].hasOwnProperty(t)&&organsFileMap[a][t].hasOwnProperty(n)&&r.push(a)}return r},this.getCentreAndSize=function(){let e=new aE.THREE.Vector3,t=this.scene.getBoundingBox();t.getCenter(e);let n=[e.x,e.y,e.z];return t.getSize(e),{centre:n,size:[e.x,e.y,e.z]}};let w=function(e,n,r,i){t.sceneData.nerveMapIsActive=!1,t.sceneData.nerveMap=void 0,t.sceneData.metaURL=``,t.sceneData.viewURL=``,t.sceneData.currentSpecies=e,t.sceneData.currentSystem=n,t.sceneData.currentPart=r,t.sceneData.currentTime=0,t.sceneData.timeVarying=!1;let a=``;e&&(a=e+`/`),n&&(a=n+`/`),r&&(a=r),t.sceneData.currentName=a};this.loadOrgansFromURL=function(e,n,i,a,o,s,c){if(t.zincRenderer&&a&&t.sceneData.metaURL!==e){w(n,i,a,void 0);let l=t.sceneData.currentName,u=t.zincRenderer.getSceneByName(l);u?s&&u.clearAll():u=t.zincRenderer.createScene(l),t.selectObjectOnPick=!0;for(let e=0;e<r.length;e++)r[e](t.sceneData);o&&o!=``?(t.sceneData.viewURL=o,u.loadViewURL(t.sceneData.viewURL)):t.sceneData.viewURL=void 0,t.sceneData.metaURL=e,u.addZincObjectAddedCallbacks(b(i,a,!1)),u.addZincObjectRemovedCallbacks(x(void 0,a,!1)),u.loadMetadataURL(e,C(),S(),c),t.scene=u,t.zincRenderer.setCurrentScene(u),t.graphicsHighlight.reset();let d=u.getZincCameraControls();d.enableRaycaster(u,h(),g()),d.setMouseButtonAction(`AUXILIARY`,`ZOOM`),d.setMouseButtonAction(`SECONDARY`,`PAN`)}},this.loadGLTFFromURL=function(e,n,i){if(t.zincRenderer&&n&&t.sceneData.metaURL!==e){w(void 0,void 0,n,void 0);let a=t.sceneData.currentName,o=t.zincRenderer.getSceneByName(a);o?i&&o.clearAll():o=t.zincRenderer.createScene(a);for(let e=0;e<r.length;e++)r[e](t.sceneData);t.sceneData.viewURL=void 0,t.sceneData.metaURL=e,o.addZincObjectAddedCallbacks(b(void 0,n,!1)),o.addZincObjectRemovedCallbacks(x(void 0,n,!1)),o.loadGLTF(e,void 0,S()),t.scene=o,t.zincRenderer.setCurrentScene(o),t.graphicsHighlight.reset();let s=o.getZincCameraControls();s.enableRaycaster(o,h(),g()),s.setMouseButtonAction(`AUXILIARY`,`ZOOM`),s.setMouseButtonAction(`SECONDARY`,`PAN`)}},this.alignCameraWithSelectedObject=function(e){let n=t.graphicsHighlight.getSelected();n&&n[0]&&n[0].userData&&t.scene.alignObjectToCameraView(n[0].userData,e)},this.exportSettings=function(){let e={};return e.name=t.instanceName,t.sceneData.currentSystem&&(e.system=t.sceneData.currentSystem),t.sceneData.currentSpecies&&(e.species=t.sceneData.currentSpecies),t.sceneData.currentPart&&(e.part=t.sceneData.currentPart),e.metaURL=t.sceneData.metaURL,t.sceneData.viewURL&&(e.viewURL=t.sceneData.viewURL),e.dialog=`Organ Viewer`,e},this.importSettings=function(e){return e&&e.dialog==this.typeName?(t.setName(e.name),e.metaURL!==void 0&&e.metaURL!=``?t.loadOrgansFromURL(e.metaURL,e.species,e.system,e.part,e.viewURL,!0):t.loadOrgans(e.species,e.system,e.part),!0):!1},function(){t.initialiseRenderer(void 0),t.zincRenderer&&(t.zincRenderer.addPreRenderCallbackFunction(f()),t.zincRenderer.addPostRenderCallbackFunction(p()))}()};TD.prototype=Object.create(SD.prototype);var ED=`ENTRIES`,DD=`KEYS`,OD=`VALUES`,kD=``,AD=class{constructor(e,t){let n=e._tree,r=Array.from(n.keys());this.set=e,this._type=t,this._path=r.length>0?[{node:n,keys:r}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:t}=jD(this._path);if(jD(t)===kD)return{done:!1,value:this.result()};let n=e.get(jD(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=jD(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>jD(e)).filter(e=>e!==kD).join(``)}value(){return jD(this._path).node.get(kD)}result(){switch(this._type){case OD:return this.value();case DD:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},jD=e=>e[e.length-1],MD=(e,t,n)=>{let r=new Map;if(t===void 0)return r;let i=t.length+1,a=i+n,o=new Uint8Array(a*i).fill(n+1);for(let e=0;e<i;++e)o[e]=e;for(let e=1;e<a;++e)o[e*i]=e;return ND(e,t,n,r,o,1,i,``),r},ND=(e,t,n,r,i,a,o,s)=>{let c=a*o;key:for(let l of e.keys())if(l===kD){let t=i[c-1];t<=n&&r.set(s,[e.get(l),t])}else{let c=a;for(let e=0;e<l.length;++e,++c){let r=l[e],a=o*c,s=a-o,u=i[a],d=Math.max(0,c-n-1),f=Math.min(o-1,c+n);for(let e=d;e<f;++e){let n=r!==t[e],o=i[s+e]+ +n,c=i[s+e+1]+1,l=i[a+e]+1,d=i[a+e+1]=Math.min(o,c,l);d<u&&(u=d)}if(u>n)continue key}ND(e.get(l),t,n,r,i,c,o,s+l)}},PD=class e{constructor(e=new Map,t=``){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(t){if(!t.startsWith(this._prefix))throw Error(`Mismatched prefix`);let[n,r]=FD(this._tree,t.slice(this._prefix.length));if(n===void 0){let[n,i]=VD(r);for(let r of n.keys())if(r!==kD&&r.startsWith(i)){let a=new Map;return a.set(r.slice(i.length),n.get(r)),new e(a,t)}}return new e(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,RD(this._tree,e)}entries(){return new AD(this,ED)}forEach(e){for(let[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return MD(this._tree,e,t)}get(e){let t=ID(this._tree,e);return t===void 0?void 0:t.get(kD)}has(e){let t=ID(this._tree,e);return t!==void 0&&t.has(kD)}keys(){return new AD(this,DD)}set(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);return this._size=void 0,LD(this._tree,e).set(kD,t),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=LD(this._tree,e);return n.set(kD,t(n.get(kD))),this}fetch(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=LD(this._tree,e),r=n.get(kD);return r===void 0&&n.set(kD,r=t()),r}values(){return new AD(this,OD)}[Symbol.iterator](){return this.entries()}static from(t){let n=new e;for(let[e,r]of t)n.set(e,r);return n}static fromObject(t){return e.from(Object.entries(t))}},FD=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(let r of e.keys())if(r!==kD&&t.startsWith(r))return n.push([e,r]),FD(e.get(r),t.slice(r.length),n);return n.push([e,t]),FD(void 0,``,n)},ID=(e,t)=>{if(t.length===0||e==null)return e;for(let n of e.keys())if(n!==kD&&t.startsWith(n))return ID(e.get(n),t.slice(n.length))},LD=(e,t)=>{let n=t.length;outer:for(let r=0;e&&r<n;){for(let i of e.keys())if(i!==kD&&t[r]===i[0]){let a=Math.min(n-r,i.length),o=1;for(;o<a&&t[r+o]===i[o];)++o;let s=e.get(i);if(o===i.length)e=s;else{let n=new Map;n.set(i.slice(o),s),e.set(t.slice(r,r+o),n),e.delete(i),e=n}r+=o;continue outer}let i=new Map;return e.set(t.slice(r),i),i}return e},RD=(e,t)=>{let[n,r]=FD(e,t);if(n!==void 0){if(n.delete(kD),n.size===0)zD(r);else if(n.size===1){let[e,t]=n.entries().next().value;BD(r,e,t)}}},zD=e=>{if(e.length===0)return;let[t,n]=VD(e);if(t.delete(n),t.size===0)zD(e.slice(0,-1));else if(t.size===1){let[n,r]=t.entries().next().value;n!==kD&&BD(e.slice(0,-1),n,r)}},BD=(e,t,n)=>{if(e.length===0)return;let[r,i]=VD(e);r.set(i+t,n),r.delete(i)},VD=e=>e[e.length-1],HD=`or`,UD=`and`,WD=`and_not`,GD=class e{constructor(e){if(e?.fields==null)throw Error(`MiniSearch: option "fields" must be provided`);let t=e.autoVacuum==null||e.autoVacuum===!0?nO:e.autoVacuum;this._options={...ZD,...e,autoVacuum:t,searchOptions:{...QD,...e.searchOptions||{}},autoSuggestOptions:{...$D,...e.autoSuggestOptions||{}}},this._index=new PD,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=tO,this.addFields(this._options.fields)}add(e){let{extractField:t,stringifyField:n,tokenize:r,processTerm:i,fields:a,idField:o}=this._options,s=t(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(s))throw Error(`MiniSearch: duplicate ID ${s}`);let c=this.addDocumentId(s);this.saveStoredFields(c,e);for(let o of a){let a=t(e,o);if(a==null)continue;let s=r(n(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.addFieldLength(c,l,this._documentCount-1,u);for(let e of s){let t=i(e,o);if(Array.isArray(t))for(let e of t)this.addTerm(l,c,e);else t&&this.addTerm(l,c,t)}}}addAll(e){for(let t of e)this.add(t)}addAllAsync(e,t={}){let{chunkSize:n=10}=t,r={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:e,promise:t},r,i)=>(e.push(r),(i+1)%n===0?{chunk:[],promise:t.then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.addAll(e))}:{chunk:e,promise:t}),r);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:t,processTerm:n,extractField:r,stringifyField:i,fields:a,idField:o}=this._options,s=r(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);let c=this._idToShortId.get(s);if(c==null)throw Error(`MiniSearch: cannot remove document with ID ${s}: it is not in the index`);for(let o of a){let a=r(e,o);if(a==null)continue;let s=t(i(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.removeFieldLength(c,l,this._documentCount,u);for(let e of s){let t=n(e,o);if(Array.isArray(t))for(let e of t)this.removeTerm(l,c,e);else t&&this.removeTerm(l,c,t)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(s),this._fieldLength.delete(c),--this._documentCount}removeAll(e){if(e)for(let t of e)this.remove(t);else if(arguments.length>0)throw Error(`Expected documents to be present. Omit the argument to remove all documents.`);else this._index=new PD,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}discard(e){let t=this._idToShortId.get(e);if(t==null)throw Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((e,n)=>{this.removeFieldLength(t,n,this._documentCount,e)}),this._fieldLength.delete(t),--this._documentCount,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:r}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:r},{minDirtCount:t,minDirtFactor:e})}discardAll(e){let t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let t of e)this.discard(t)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){let{idField:t,extractField:n}=this._options,r=n(e,t);this.discard(r),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum??=this._currentVacuum.then(()=>{let t=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=tO,this.performVacuuming(e,t)}),this._enqueuedVacuum):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){let n=this._dirtCount;if(this.vacuumConditionsMet(t)){let t=e.batchSize||eO.batchSize,r=e.batchWait||eO.batchWait,i=1;for(let[e,n]of this._index){for(let[e,t]of n)for(let[r]of t)this._documentIds.has(r)||(t.size<=1?n.delete(e):t.delete(r));this._index.get(e).size===0&&this._index.delete(e),i%t===0&&await new Promise(e=>setTimeout(e,r)),i+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t||=nO.minDirtCount,n||=nO.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(t,n={}){let{searchOptions:r}=this._options,i={...r,...n},a=this.executeQuery(t,n),o=[];for(let[e,{score:t,terms:n,match:r}]of a){let a=n.length||1,s={id:this._documentIds.get(e),score:t*a,terms:Object.keys(r),queryTerms:n,match:r};Object.assign(s,this._storedFields.get(e)),(i.filter==null||i.filter(s))&&o.push(s)}return t===e.wildcard&&i.boostDocument==null||o.sort(aO),o}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};let n=new Map;for(let{score:r,terms:i}of this.search(e,t)){let e=i.join(` `),t=n.get(e);t==null?n.set(e,{score:r,terms:i,count:1}):(t.score+=r,t.count+=1)}let r=[];for(let[e,{score:t,terms:i,count:a}]of n)r.push({suggestion:e,terms:i,score:t/a});return r.sort(aO),r}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJS(JSON.parse(e),t)}static async loadJSONAsync(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(ZD.hasOwnProperty(e))return KD(ZD,e);throw Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=sO(r),s._fieldLength=sO(i),s._storedFields=sO(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);for(let[e,t]of n){let n=new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),sO(r))}s._index.set(e,n)}return s}static async loadJSAsync(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=await cO(r),s._fieldLength=await cO(i),s._storedFields=await cO(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);let c=0;for(let[e,t]of n){let n=new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),await cO(r))}++c%1e3==0&&await lO(0),s._index.set(e,n)}return s}static instantiateMiniSearch(t,n){let{documentCount:r,nextId:i,fieldIds:a,averageFieldLength:o,dirtCount:s,serializationVersion:c}=t;if(c!==1&&c!==2)throw Error(`MiniSearch: cannot deserialize an index created with an incompatible version`);let l=new e(n);return l._documentCount=r,l._nextId=i,l._idToShortId=new Map,l._fieldIds=a,l._avgFieldLength=o,l._dirtCount=s||0,l._index=new PD,l}executeQuery(t,n={}){if(t===e.wildcard)return this.executeWildcardQuery(n);if(typeof t!=`string`){let e={...n,...t,queries:void 0},r=t.queries.map(t=>this.executeQuery(t,e));return this.combineResults(r,e.combineWith)}let{tokenize:r,processTerm:i,searchOptions:a}=this._options,o={tokenize:r,processTerm:i,...a,...n},{tokenize:s,processTerm:c}=o,l=s(t).flatMap(e=>c(e)).filter(e=>!!e).map(XD(o)).map(e=>this.executeQuerySpec(e,o));return this.combineResults(l,o.combineWith)}executeQuerySpec(e,t){let n={...this._options.searchOptions,...t},r=(n.fields||this._options.fields).reduce((e,t)=>({...e,[t]:KD(n.boost,t)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:o,bm25:s}=n,{fuzzy:c,prefix:l}={...QD.weights,...a},u=this._index.get(e.term),d=this.termResults(e.term,e.term,1,e.termBoost,u,r,i,s),f,p;if(e.prefix&&(f=this._index.atPrefix(e.term)),e.fuzzy){let t=e.fuzzy===!0?.2:e.fuzzy,n=t<1?Math.min(o,Math.round(e.term.length*t)):t;n&&(p=this._index.fuzzyGet(e.term,n))}if(f)for(let[t,n]of f){let a=t.length-e.term.length;if(!a)continue;p?.delete(t);let o=l*t.length/(t.length+.3*a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}if(p)for(let t of p.keys()){let[n,a]=p.get(t);if(!a)continue;let o=c*t.length/(t.length+a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}return d}executeWildcardQuery(e){let t=new Map,n={...this._options.searchOptions,...e};for(let[e,r]of this._documentIds){let i=n.boostDocument?n.boostDocument(r,``,this._storedFields.get(e)):1;t.set(e,{score:i,terms:[],match:{}})}return t}combineResults(e,t=HD){if(e.length===0)return new Map;let n=qD[t.toLowerCase()];if(!n)throw Error(`Invalid combination operator: ${t}`);return e.reduce(n)||new Map}toJSON(){let e=[];for(let[t,n]of this._index){let r={};for(let[e,t]of n)r[e]=Object.fromEntries(t);e.push([t,r])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,t,n,r,i,a,o,s,c=new Map){if(i==null)return c;for(let l of Object.keys(a)){let u=a[l],d=this._fieldIds[l],f=i.get(d);if(f==null)continue;let p=f.size,m=this._avgFieldLength[d];for(let i of f.keys()){if(!this._documentIds.has(i)){this.removeTerm(d,i,t),--p;continue}let a=o?o(this._documentIds.get(i),t,this._storedFields.get(i)):1;if(!a)continue;let h=f.get(i),g=this._fieldLength.get(i)[d],_=YD(h,p,this._documentCount,g,m,s),v=n*r*u*a*_,y=c.get(i);if(y){y.score+=v,rO(y.terms,e);let n=KD(y.match,t);n?n.push(l):y.match[t]=[l]}else c.set(i,{score:v,terms:[e],match:{[t]:[l]}})}}return c}addTerm(e,t,n){let r=this._index.fetch(n,oO),i=r.get(e);if(i==null)i=new Map,i.set(t,1),r.set(e,i);else{let e=i.get(t);i.set(t,(e||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}let r=this._index.fetch(n,oO),i=r.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,n):i.get(t)<=1?i.size<=1?r.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(let r of Object.keys(this._fieldIds))if(this._fieldIds[r]===t){this._options.logger(`warn`,`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${r}". Removing a document after it has changed can corrupt the index!`,`version_conflict`);return}}addDocumentId(e){let t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,r){let i=this._fieldLength.get(e);i??this._fieldLength.set(e,i=[]),i[t]=r;let a=(this._avgFieldLength[t]||0)*n+r;this._avgFieldLength[t]=a/(n+1)}removeFieldLength(e,t,n,r){if(n===1){this._avgFieldLength[t]=0;return}let i=this._avgFieldLength[t]*n-r;this._avgFieldLength[t]=i/(n-1)}saveStoredFields(e,t){let{storeFields:n,extractField:r}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i??this._storedFields.set(e,i={});for(let e of n){let n=r(t,e);n!==void 0&&(i[e]=n)}}};GD.wildcard=Symbol(`*`);var KD=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,qD={[HD]:(e,t)=>{for(let n of t.keys()){let r=e.get(n);if(r==null)e.set(n,t.get(n));else{let{score:e,terms:i,match:a}=t.get(n);r.score+=e,r.match=Object.assign(r.match,a),iO(r.terms,i)}}return e},[UD]:(e,t)=>{let n=new Map;for(let r of t.keys()){let i=e.get(r);if(i==null)continue;let{score:a,terms:o,match:s}=t.get(r);iO(i.terms,o),n.set(r,{score:i.score+a,terms:i.terms,match:Object.assign(i.match,s)})}return n},[WD]:(e,t)=>{for(let n of t.keys())e.delete(n);return e}},JD={k:1.2,b:.7,d:.5},YD=(e,t,n,r,i,a)=>{let{k:o,b:s,d:c}=a;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(o+1)/(e+o*(1-s+s*r/i)))},XD=e=>(t,n,r)=>({term:t,fuzzy:typeof e.fuzzy==`function`?e.fuzzy(t,n,r):e.fuzzy||!1,prefix:typeof e.prefix==`function`?e.prefix(t,n,r):e.prefix===!0,termBoost:typeof e.boostTerm==`function`?e.boostTerm(t,n,r):1}),ZD={idField:`id`,extractField:(e,t)=>e[t],stringifyField:(e,t)=>e.toString(),tokenize:e=>e.split(uO),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])==`function`&&console[e](t)},autoVacuum:!0},QD={combineWith:HD,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:JD},$D={combineWith:UD,prefix:(e,t,n)=>t===n.length-1},eO={batchSize:1e3,batchWait:10},tO={minDirtFactor:.1,minDirtCount:20},nO={...eO,...tO},rO=(e,t)=>{e.includes(t)||e.push(t)},iO=(e,t)=>{for(let n of t)e.includes(n)||e.push(n)},aO=({score:e},{score:t})=>t-e,oO=()=>new Map,sO=e=>{let t=new Map;for(let n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},cO=async e=>{let t=new Map,n=0;for(let r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3==0&&await lO(0);return t},lO=e=>new Promise(t=>setTimeout(t,e)),uO=/[\n\r\p{Z}\p{P}]+/u,dO=class{constructor(){this._searchEngine=new GD({fields:[`path`,`name`],storeFields:[`path`],tokenize:(e,t)=>e.split(/[\s/]+/)}),this.idMaps={}}updateZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.replace(a),this.idMaps[t]={path:i,zincObject:e}}addZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.add(a),this.idMaps[t]={path:i,zincObject:e}}removeZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.remove(a),delete this.idMaps[t]}addRegion(e,t){let n=e.getFullPath(),r=e.getName();n=n.replaceAll(`"`,``),r=r.replaceAll(`"`,``);let i={path:n,name:r,id:t};this._searchEngine.add(i),this.idMaps[t]={path:n,zincObject:e}}clearResults(){this._}removeAll(){this._searchEngine.removeAll(),this.idMaps={}}auto_suggest(e){let t=[];e.length>2&&[`'`,`"`].includes(e.slice(0,1))?(e=e.replaceAll(e.slice(0,1),``),t=this._searchEngine.search(e,{prefix:!0,combineWith:`AND`})):e.length>1&&(t=this._searchEngine.search(e,{prefix:!0}));let n=[];t.forEach(e=>{e.id in this.idMaps&&n.push(this.idMaps[e.id].path)});let r=[...new Set(n)],i=[];return r.forEach(e=>i.push({suggestion:`"`+e+`"`})),i}processResults(e,t){let n={regionPath:void 0,label:`Search Results for "`};return Array.isArray(t)?n.label+=`,`.join(t):n.label+=t,n.label+=`"`,e.length===1&&(e[0].isRegion?n.regionPath=e[0].getFullPath():e[0].isZincObject&&(n.regionPath=e[0].getRegion().getFullPath(),n.label=e[0].groupName)),n.zincObjects=xE(e),n}search(e){let t;e.length>2&&[`'`,`"`].includes(e.slice(0,1))?(e=e.replaceAll(e.slice(0,1),``),t=this._searchEngine.search(e,{prefix:!0,combineWith:`AND`})):e.length>1&&(t=this._searchEngine.search(e,{prefix:!0}));let n=[];return t.forEach(e=>{e.id in this.idMaps&&n.push(this.idMaps[e.id].zincObject)}),n}searchTerms(e){let t=[];return e.forEach(e=>{let n=this.search(e);t.push(...n)}),t}searchAndProcessResult(e){let t=[];return t=Array.isArray(e)?this.searchTerms(e):this.search(e),this.processResults(t,e)}},fO=[{id:0,nerve_id:`ILX:0793723`,label:`Auriculotemporal nerve`,"FMA subclasses (in human nerves)":[`FMA:53002`,`FMA:53001`],"subclass labels":[`Left auriculotemporal nerve`,`Right auriculotemporal nerve`]},{id:1,nerve_id:`ILX:0792409`,label:`gray communicating ramus of tenth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6895`,`FMA:6894`],"subclass labels":[`Left T10 grey ramus communicans`,`Right T10 grey ramus communicans`]},{id:2,nerve_id:`UBERON:0011326`,label:`superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53530`,`FMA:53536`],"subclass labels":[`Right superior laryngeal nerve`,`Left superior laryngeal nerve`]},{id:3,nerve_id:`ILX:0793220`,label:`white communicating ramus of first lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:4,nerve_id:`ILX:0787082`,label:`gray communicating ramus of the first thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6082`,`FMA:6084`],"subclass labels":[`Right T1 grey ramus communicans`,`Left T1 grey ramus communicans`]},{id:5,nerve_id:`ILX:0793809`,label:`Clitoral cavernous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:6,nerve_id:`UBERON:0011096`,label:`lacrimal nerve`,"FMA subclasses (in human nerves)":[`FMA:52630`,`FMA:52629`],"subclass labels":[`Left lacrimal nerve`,`Right lacrimal nerve`]},{id:7,nerve_id:`ILX:0793215`,label:`white communicating ramus of ninth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:8,nerve_id:`ILX:0795005`,label:`Posterior cutaneous nerve of arm`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:9,nerve_id:`UBERON:0001649`,label:`glossopharyngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:50894`,`FMA:50892`],"subclass labels":[]},{id:10,nerve_id:`UBERON:0022302`,label:`short ciliary nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:11,nerve_id:`ILX:0785932`,label:`gray communicating ramus of third lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65920`,`FMA:65919`],"subclass labels":[`Left L3 grey ramus communicans`,`Right L3 grey ramus communicans`]},{id:12,nerve_id:`ILX:0738293`,label:`Ganglioglomerular nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:13,nerve_id:`ILX:0739298`,label:`gray communicating ramus of twelfth thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:14,nerve_id:`UBERON:0001492`,label:`radial nerve`,"FMA subclasses (in human nerves)":[`FMA:37070`,`FMA:37071`],"subclass labels":[`Right radial nerve`,`Left radial nerve`]},{id:15,nerve_id:`ILX:0793214`,label:`white communicating ramus of eighth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:16,nerve_id:`UBERON:0018681`,label:`lesser splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6957`,`FMA:6958`],"subclass labels":[`Right lesser splanchnic nerve`,`Left lesser splanchnic nerve`]},{id:17,nerve_id:`ILX:0794476`,label:`abdominal branch of vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:18,nerve_id:`ILX:0791105`,label:`gray communicating ramus of the second thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6122`,`FMA:6757`],"subclass labels":[`Right T2 grey ramus communicans`,`Left T2 grey ramus communicans`]},{id:19,nerve_id:`ILX:0794853`,label:`esophageal vagus trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:20,nerve_id:`ILX:0793210`,label:`white communicating ramus of fourth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:21,nerve_id:`UBERON:0001759`,label:`vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:22,nerve_id:`UBERON:0009675`,label:`chorda tympani branch of facial nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:23,nerve_id:`ILX:0794949`,label:`recurrent branch of the median nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:24,nerve_id:`ILX:0789339`,label:`Pharyngeal branch of glossopharyngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53495`,`FMA:53494`],"subclass labels":[`Pharyngeal branch of left glossopharyngeal nerve`,`Pharyngeal branch of right glossopharyngeal nerve`]},{id:25,nerve_id:`ILX:0793712`,label:`Zygomatic nerve`,"FMA subclasses (in human nerves)":[`FMA:52968`,`FMA:52969`],"subclass labels":[`Right zygomatic nerve`,`Left zygomatic nerve`]},{id:26,nerve_id:`ILX:0788536`,label:`gray communicating ramus of fourth lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65917`,`FMA:65918`],"subclass labels":[`Right L4 grey ramus communicans`,`Left L4 grey ramus communicans`]},{id:27,nerve_id:`UBERON:0018680`,label:`greater splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6956`,`FMA:6955`],"subclass labels":[`Right greater splanchnic nerve`,`Left greater splanchnic nerve`]},{id:28,nerve_id:`UBERON:0001322`,label:`sciatic nerve`,"FMA subclasses (in human nerves)":[`FMA:22111`,`FMA:22112`],"subclass labels":[`Right sciatic nerve`,`Left sciatic nerve`]},{id:29,nerve_id:`ILX:0793209`,label:`white communicating ramus of third thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:30,nerve_id:`UBERON:0011391`,label:`perineal nerve`,"FMA subclasses (in human nerves)":[`FMA:21874`,`FMA:21873`],"subclass labels":[`Left perineal nerve`,`Right perineal nerve`]},{id:31,nerve_id:`ILX:0788945`,label:`gray communicating ramus of the fourth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6759`,`FMA:6758`],"subclass labels":[`Right T4 grey ramus communicans`,`Left T4 grey ramus communicans`]},{id:32,nerve_id:`ILX:0790497`,label:`Gray communicating ramus of cervicothoracic ganglion to first thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:33,nerve_id:`UBERON:0001323`,label:`tibial nerve`,"FMA subclasses (in human nerves)":[`FMA:22109`,`FMA:22110`],"subclass labels":[`Right tibial nerve`,`Left tibial nerve`]},{id:34,nerve_id:`ILX:0794969`,label:`deep branch of ulnar nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:35,nerve_id:`ILX:0793227`,label:`gray communicating ramus of thirteenth thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:36,nerve_id:`ILX:0793228`,label:`gray communicating ramus of first sacral nerve`,"FMA subclasses (in human nerves)":[`FMA:65992`,`FMA:65991`],"subclass labels":[`Left S1 grey ramus communicans`,`Right S1 grey ramus communicans`]},{id:37,nerve_id:`UBERON:0035111`,label:`medial plantar nerve`,"FMA subclasses (in human nerves)":[`FMA:45435`,`FMA:45434`],"subclass labels":[`Left medial plantar nerve`,`Right medial plantar nerve`]},{id:38,nerve_id:`UBERON:0001780`,label:`spinal nerve`,"FMA subclasses (in human nerves)":`FMA:6117.FMA:6435.FMA:6295.FMA:6422.FMA:6417.FMA:6421.FMA:6038.FMA:6292.FMA:6439.FMA:6313.FMA:6410.FMA:6412.FMA:6088.FMA:6298.FMA:6433.FMA:6411.FMA:6438.FMA:6314.FMA:6291.FMA:6420.FMA:6116.FMA:6413.FMA:6310.FMA:6432.FMA:6305.FMA:6182.FMA:6297.FMA:6436.FMA:6418.FMA:6039.FMA:6089.FMA:6301.FMA:6294.FMA:6303.FMA:6183.FMA:6434.FMA:6429.FMA:6308.FMA:6300.FMA:6430.FMA:6428.FMA:6419.FMA:6437.FMA:6307.FMA:6311.FMA:6431`.split(`.`),"subclass labels":`Left T3 spinal nerve.Left S4 spinal nerve.Left T5 spinal nerve.Left L5 spinal nerve.Right L3 spinal nerve.Right L5 spinal nerve.Right T1 spinal nerve.Left T4 spinal nerve.Left coccygeal spinal nerve.Right T11 spinal nerve.Right L1 spinal nerve.Right L2 spinal nerve.Right T2 spinal nerve.Left T6 spinal nerve.Left S3 spinal nerve.Left L1 spinal nerve.Right coccygeal spinal nerve.Left T11 spinal nerve.Right T4 spinal nerve.Left L4 spinal nerve.Right T3 spinal nerve.Left L2 spinal nerve.Right T10 spinal nerve.Right S3 spinal nerve.Left T8 spinal nerve.Right T12 spinal nerve.Right T6 spinal nerve.Right S5 spinal nerve.Left L3 spinal nerve.Left T1 spinal nerve.Left T2 spinal nerve.Left T7 spinal nerve.Right T5 spinal nerve.Right T8 spinal nerve.Left T12 spinal nerve.Right S4 spinal nerve.Left S1 spinal nerve.Left T9 spinal nerve.Right T7 spinal nerve.Right S2 spinal nerve.Right S1 spinal nerve.Right L4 spinal nerve.Left S5 spinal nerve.Right T9 spinal nerve.Left T10 spinal nerve.Left S2 spinal nerve`.split(`.`)},{id:39,nerve_id:`UBERON:0018683`,label:`lumbar splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6924`,`FMA:6928`,`FMA:6929`,`FMA:6931`,`FMA:6925`,`FMA:6930`,`FMA:6927`,`FMA:6926`],"subclass labels":[`Right first lumbar splanchnic nerve`,`Right third lumbar splanchnic nerve`,`Left third lumbar splanchnic nerve`,`Left fourth lumbar splanchnic nerve`,`Left first lumbar splanchnic nerve`,`Right fourth lumbar splanchnic nerve`,`Left second lumbar splanchnic nerve`,`Right second lumbar splanchnic nerve`]},{id:40,nerve_id:`UBERON:0001643`,label:`oculomotor nerve`,"FMA subclasses (in human nerves)":[`FMA:50880`,`FMA:50879`],"subclass labels":[`Left oculomotor nerve`,`Right oculomotor nerve`]},{id:41,nerve_id:`ILX:0793212`,label:`white communicating ramus of sixth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:42,nerve_id:`UBERON:0003724`,label:`musculocutaneous nerve`,"FMA subclasses (in human nerves)":[`FMA:37066`,`FMA:37065`],"subclass labels":[`Left musculocutaneous nerve`,`Right musculocutaneous nerve`]},{id:43,nerve_id:`ILX:0738372`,label:`white communicating ramus of first thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:44,nerve_id:`ILX:0793563`,label:`splenic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:45,nerve_id:`UBERON:0035526`,label:`superficial fibular nerve`,"FMA subclasses (in human nerves)":[`FMA:45363`,`FMA:45364`],"subclass labels":[`Right superficial fibular nerve`,`Left superficial fibular nerve`]},{id:46,nerve_id:`ILX:0791560`,label:`gray communicating ramus of eighth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6891`,`FMA:6890`],"subclass labels":[`Left T8 grey ramus communicans`,`Right T8 grey ramus communicans`]},{id:47,nerve_id:`ILX:0793827`,label:`posterior abdominal vagal trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:48,nerve_id:`ILX:0794141`,label:`right cervical vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:49,nerve_id:`ILX:0793714`,label:`Mesenteric nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:50,nerve_id:`UBERON:0001964`,label:`least splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6960`,`FMA:6959`],"subclass labels":[`Left least splanchnic nerve`,`Right least splanchnic nerve`]},{id:51,nerve_id:`UBERON:0001267`,label:`femoral nerve`,"FMA subclasses (in human nerves)":[`FMA:16499`,`FMA:16500`],"subclass labels":[`Right femoral nerve`,`Left femoral nerve`]},{id:52,nerve_id:`UBERON:0034984`,label:`nerve to quadratus femoris`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:53,nerve_id:`UBERON:0003721`,label:`lingual nerve`,"FMA subclasses (in human nerves)":[`FMA:53219`,`FMA:53220`],"subclass labels":[`Right lingual nerve`,`Left lingual nerve`]},{id:54,nerve_id:`UBERON:0036216`,label:`tympanic nerve`,"FMA subclasses (in human nerves)":[`FMA:53481`,`FMA:53482`],"subclass labels":[`Right tympanic nerve`,`Left tympanic nerve`]},{id:55,nerve_id:`ILX:0793216`,label:`white communicating ramus of tenth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:56,nerve_id:`ILX:0793362`,label:`White communicating ramus of fourth lumbar anterior ramus`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:57,nerve_id:`ILX:0793561`,label:`Internal branch of superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53539`,`FMA:53540`],"subclass labels":[`Right internal laryngeal nerve`,`Left internal laryngeal nerve`]},{id:58,nerve_id:`ILX:0738312`,label:`Aortic arch depressor nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:59,nerve_id:`ILX:0793218`,label:`white communicating ramus of twelfth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:60,nerve_id:`ILX:0738308`,label:`External branch of inferior laryngeal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:61,nerve_id:`ILX:0739299`,label:`gray communicating ramus of sixth lumbar nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:62,nerve_id:`ILX:0793559`,label:`bladder nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:63,nerve_id:`ILX:0793822`,label:`Superior ovarian nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:64,nerve_id:`ILX:0793807`,label:`Penile cavernous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:65,nerve_id:`UBERON:0011390`,label:`pudendal nerve`,"FMA subclasses (in human nerves)":[`FMA:21863`,`FMA:21864`],"subclass labels":[`Right pudendal nerve`,`Left pudendal nerve`]},{id:66,nerve_id:`UBERON:0008810`,label:`nasopalatine nerve`,"FMA subclasses (in human nerves)":[`FMA:52799`,`FMA:52798`],"subclass labels":[`Left nasopalatine nerve`,`Right nasopalatine nerve`]},{id:67,nerve_id:`ILX:0793219`,label:`white communicating ramus of thirteenth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:68,nerve_id:`ILX:0793632`,label:`lumbar colonic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:69,nerve_id:`ILX:0784439`,label:`gray communicating ramus of the fifth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6760`,`FMA:6761`],"subclass labels":[`Left T5 grey ramus communicans`,`Right T5 grey ramus communicans`]},{id:70,nerve_id:`ILX:0794977`,label:`deep branch of radial nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:71,nerve_id:`UBERON:0001884`,label:`phrenic nerve`,"FMA subclasses (in human nerves)":[`FMA:6193`,`FMA:6192`],"subclass labels":[`Left phrenic nerve`,`Right phrenic nerve`]},{id:72,nerve_id:`UBERON:0035110`,label:`lateral plantar nerve`,"FMA subclasses (in human nerves)":[`FMA:45450`,`FMA:45451`],"subclass labels":[`Right lateral plantar nerve`,`Left lateral plantar nerve`]},{id:73,nerve_id:`ILX:0793711`,label:`Communicating branch of zygomatic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:74,nerve_id:`ILX:0793560`,label:`External branch of superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53537`,`FMA:53538`],"subclass labels":[`Right external laryngeal nerve`,`Left external laryngeal nerve`]},{id:75,nerve_id:`ILX:0738309`,label:`Internal branch of inferior laryngeal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:76,nerve_id:`UBERON:0001021`,label:`nerve`,"FMA subclasses (in human nerves)":`FMA:6775.FMA:6894.FMA:6784.FMA:6728.FMA:65325.FMA:21873.FMA:45429.FMA:6844.FMA:53609.FMA:7116.FMA:44770.FMA:8916.FMA:52995.FMA:6071.FMA:45309.FMA:6122.FMA:6892.FMA:6767.FMA:16405.FMA:53560.FMA:6092.FMA:65343.FMA:37066.FMA:8894.FMA:8868.FMA:65341.FMA:53559.FMA:8897.FMA:82956.FMA:20633.FMA:6763.FMA:65339.FMA:8829.FMA:16493.FMA:8817.FMA:8821.FMA:11757.FMA:45456.FMA:45422.FMA:11261.FMA:65388.FMA:6192.FMA:65347.FMA:37068.FMA:65995.FMA:6764.FMA:39081.FMA:45338.FMA:53402.FMA:11210.FMA:52644.FMA:37067.FMA:65313.FMA:11153.FMA:6155.FMA:8797.FMA:53302.FMA:8883.FMA:53067.FMA:52939.FMA:53301.FMA:292889.FMA:45423.FMA:8791.FMA:45380.FMA:11759.FMA:7305.FMA:8830.FMA:78650.FMA:65389.FMA:45387.FMA:8827.FMA:8912.FMA:52941.FMA:6743.FMA:7126.FMA:53485.FMA:16492.FMA:53399.FMA:65337.FMA:11209.FMA:6772.FMA:52726.FMA:6121.FMA:52627.FMA:52974.FMA:53571.FMA:6729.FMA:8729.FMA:53606.FMA:80025.FMA:53481.FMA:53575.FMA:45451.FMA:11218.FMA:22109.FMA:6852.FMA:8909.FMA:11751.FMA:65991.FMA:8836.FMA:65350.FMA:53423.FMA:65569.FMA:65314.FMA:82957.FMA:65438.FMA:39146.FMA:8911.FMA:22111.FMA:65916.FMA:65739.FMA:65917.FMA:6779.FMA:8889.FMA:65924.FMA:65316.FMA:53002.FMA:16887.FMA:53366.FMA:6890.FMA:8790.FMA:6730.FMA:45358.FMA:52716.FMA:53494.FMA:7115.FMA:53561.FMA:78655.FMA:45366.FMA:11219.FMA:11555.FMA:7092.FMA:53220.FMA:45428.FMA:6193.FMA:20604.FMA:45433.FMA:21874.FMA:21875.FMA:53244.FMA:45432.FMA:6770.FMA:52640.FMA:11249.FMA:20630.FMA:53308.FMA:11216.FMA:65399.FMA:78649.FMA:11084.FMA:6897.FMA:53633.FMA:6085.FMA:6851.FMA:45457.FMA:6757.FMA:8732.FMA:8824.FMA:20632.FMA:6137.FMA:52730.FMA:7301.FMA:52699.FMA:53607.FMA:7300.FMA:53576.FMA:44904.FMA:65342.FMA:7127.FMA:6737.FMA:52669.FMA:21876.FMA:45425.FMA:65999.FMA:8728.FMA:21871.FMA:55172.FMA:6149.FMA:45453.FMA:44932.FMA:292832.FMA:6744.FMA:6781.FMA:44769.FMA:45326.FMA:6760.FMA:53634.FMA:53605.FMA:53530.FMA:6821.FMA:52968.FMA:53001.FMA:11552.FMA:45264.FMA:8835.FMA:6888.FMA:55160.FMA:44899.FMA:52979.FMA:45333.FMA:45310.FMA:6084.FMA:11781.FMA:82962.FMA:53280.FMA:52715.FMA:53311.FMA:16491.FMA:21880.FMA:44952.FMA:11687.FMA:11212.FMA:65335.FMA:52940.FMA:6774.FMA:8823.FMA:45388.FMA:6666.FMA:6072.FMA:16886.FMA:53312.FMA:65915.FMA:45357.FMA:11262.FMA:65921.FMA:0328826.FMA:81290.FMA:53279.FMA:11551.FMA:7293.FMA:6677.FMA:11756.FMA:53598.FMA:52732.FMA:44902.FMA:53545.FMA:6740.FMA:53502.FMA:53562.FMA:52700.FMA:7122.FMA:6118.FMA:65918.FMA:8814.FMA:16403.FMA:65346.FMA:6667.FMA:52630.FMA:52629.FMA:8871.FMA:16500.FMA:52725.FMA:6108.FMA:45363.FMA:65340.FMA:8872.FMA:11760.FMA:53604.FMA:11214.FMA:52777.FMA:21864.FMA:53503.FMA:6738.FMA:66000.FMA:6776.FMA:6777.FMA:6765.FMA:6111.FMA:8890.FMA:20607.FMA:52643.FMA:8908.FMA:65437.FMA:6762.FMA:11154.FMA:65344.FMA:52937.FMA:8919.FMA:45354.FMA:6766.FMA:53424.FMA:6145.FMA:65568.FMA:20634.FMA:6732.FMA:8893.FMA:11758.FMA:6889.FMA:11554.FMA:65922.FMA:7118.FMA:16884.FMA:45308.FMA:7290.FMA:6758.FMA:65743.FMA:11063.FMA:16885.FMA:8882.FMA:65286.FMA:291238.FMA:53482.FMA:52976.FMA:11308.FMA:53432.FMA:53540.FMA:45379.FMA:44871.FMA:6714.FMA:82955.FMA:65993.FMA:45452.FMA:52626.FMA:6083.FMA:53582.FMA:65919.FMA:52936.FMA:53506.FMA:8918.FMA:44901.FMA:6073.FMA:65315.FMA:53219.FMA:11194.FMA:6792.FMA:7119.FMA:52785.FMA:7296.FMA:53068.FMA:6845.FMA:52677.FMA:53504.FMA:53548.FMA:52698.FMA:53570.FMA:6771.FMA:7078.FMA:65997.FMA:65338.FMA:52969.FMA:16401.FMA:65416.FMA:6835.FMA:39082.FMA:8726.FMA:45254.FMA:8879.FMA:11250.FMA:53049.FMA:45382.FMA:8795.FMA:53495.FMA:45434.FMA:82963.FMA:0328827.FMA:52656.FMA:82961.FMA:11753.FMA:39147.FMA:45339.FMA:20605.FMA:20631.FMA:8898.FMA:6070.FMA:44892.FMA:16404.FMA:52942.FMA:6082.FMA:8861.FMA:82953.FMA:8808.FMA:8805.FMA:52994.FMA:65348.FMA:55173.FMA:7129.FMA:52674.FMA:44894.FMA:55159.FMA:65327.FMA:37320.FMA:6761.FMA:65349.FMA:11253.FMA:53507.FMA:11213.FMA:7307.FMA:6769.FMA:6759.FMA:55155.FMA:53675.FMA:53599.FMA:65282.FMA:53251.FMA:6731.FMA:11111.FMA:16497.FMA:8878.FMA:11211.FMA:65740.FMA:45367.FMA:53588.FMA:45365.UBERON:0011766.FMA:16502.FMA:6891.FMA:6091.FMA:11018.FMA:6090.FMA:292887.FMA:65401.FMA:65326.FMA:11215.FMA:44735.FMA:8735.FMA:53538.FMA:6849.FMA:53608.FMA:11217.FMA:8860.FMA:6134.FMA:6893.FMA:53534.FMA:45361.FMA:37321.FMA:82734.FMA:22112.FMA:7294.FMA:52987.FMA:65247.FMA:53535.FMA:6895.FMA:52787.FMA:53635.FMA:65920.FMA:55156.FMA:16498.FMA:53569.FMA:6739.FMA:8807.FMA:22110.FMA:81294.FMA:45450.FMA:8922.FMA:8725.FMA:20608.FMA:7308.FMA:65281.FMA:39084.FMA:78656.FMA:6133.FMA:53581.FMA:16494.FMA:53252.FMA:11789.FMA:45364.FMA:65345.FMA:44870.FMA:39083.FMA:45355.FMA:11193.FMA:16400.FMA:81287.FMA:52776.FMA:65747.FMA:8900.UBERON:0011767.FMA:45424.FMA:292830.FMA:44734.FMA:45381.FMA:82960.FMA:0328831.FMA:6689.FMA:7077.FMA:291236.FMA:8886.FMA:276381.FMA:6124.FMA:65336.FMA:65328.FMA:52670.FMA:53537.FMA:53636.FMA:6896.FMA:21879.FMA:8798.FMA:81288.FMA:53542.FMA:45368.FMA:53547.FMA:55157.FMA:65415.FMA:53309.FMA:65744.FMA:53367.FMA:53590.FMA:65923.FMA:53048.FMA:16499.FMA:53610.FMA:44951.FMA:44953.FMA:8832.FMA:45426.FMA:6114.FMA:52799.FMA:11039.FMA:53546.FMA:53589.FMA:8901.FMA:11681.FMA:52639.FMA:8905.FMA:52733.FMA:65992.FMA:52807.FMA:45435.FMA:53484.FMA:52975.FMA:7289.FMA:44905.FMA:37071.FMA:7130.FMA:65996.FMA:6132.FMA:8826.FMA:6741.FMA:11252.FMA:8917.FMA:82954.FMA:6832.FMA:37073.FMA:37074.FMA:44893.FMA:82959.FMA:20635.FMA:6093.FMA:65248.FMA:45362.FMA:52622.FMA:53508.FMA:11755.FMA:82958.FMA:52997.FMA:16501.FMA:65402.FMA:45427.FMA:52803.FMA:16402.FMA:8734.FMA:52784.FMA:45454.FMA:6736.FMA:7304.FMA:6742.FMA:52998.FMA:52804.FMA:11788.FMA:6713.FMA:52623.FMA:53536.FMA:11780.FMA:45334.FMA:52701.FMA:65998.FMA:11092.FMA:6684.FMA:52779.FMA:52778.FMA:78652.FMA:0328830.FMA:6733.FMA:44950.FMA:78653.FMA:45455.FMA:8864.FMA:8833.FMA:8876.FMA:8867.FMA:11752.FMA:53541.FMA:53611.FMA:8904.FMA:6745.FMA:21863.FMA:7297.FMA:52676.FMA:52798.FMA:8818.FMA:82735.FMA:52657.FMA:52786.FMA:6773.FMA:45253.FMA:6127.FMA:45263.FMA:8875.FMA:81295.FMA:11754.FMA:8812.FMA:45311.FMA:53568.FMA:276379.FMA:6842.FMA:8794.FMA:8820.FMA:53572.FMA:53409.FMA:37070.FMA:6119.FMA:53433.FMA:7123.FMA:8811.FMA:65444.FMA:52806.FMA:53245.FMA:65285.FMA:6768.FMA:8731.FMA:11220.FMA:6778.FMA:53509.FMA:55158.FMA:53567.FMA:65994.FMA:53539.FMA:45327.FMA:8865.FMA:44898.FMA:52673.FMA:80026.FMA:52980.FMA:53505.FMA:82952.FMA:21872.FMA:37065.FMA:52988.FMA:8815.FMA:53398.FMA:52729.FMA:81289.FMA:65398.FMA:52977.FMA:8887`.split(`.`),"subclass labels":`Left T9 white ramus communicans.Right T10 grey ramus communicans.Right T4 spinal nerve posterior ramus.Right fourth intercostal nerve.Right anterior interosseous nerve.Right perineal nerve.Left lateral calcaneal branch A of left sural nerve.Right C3 spinal nerve posterior ramus medial branch.Oesophageal branch of left recurrent laryngeal nerve.Anterior branch of lateral cutaneous branch of left third intercostal nerve.Left common plantar digital nerve F.Anterior cutaneous branch of right subcostal nerve.Left superior labial branch of infraorbital nerve.Left T1 spinal nerve posterior ramus.Anterior branch of left obturator nerve.Right T2 grey ramus communicans.Right T9 grey ramus communicans.Left T5 white ramus communicans.Left L3 spinal nerve posterior ramus lateral branch.Communicating branch of left vagus nerve with left glossopharyngeal nerve.Right second intercostal nerve.Right proper palmar digital nerve G.Left musculocutaneous nerve.Anterior cutaneous branch of left ninth intercostal nerve.Posterior branch of lateral cutaneous branch of left sixth intercostal nerve.Right proper palmar digital nerve H.Communicating branch of right vagus nerve with right glossopharyngeal nerve.Anterior branch of lateral cutaneous branch of right ninth intercostal nerve.Right proper plantar digital nerve C.Left genital branch of genitofemoral nerve.Left T6 grey ramus communicans.Right proper palmar digital nerve I.Right T12 spinal nerve posterior ramus.Right ilioinguinal nerve.Right T8 spinal nerve posterior ramus.Left T9 spinal nerve posterior ramus.Right T11 spinal nerve posterior ramus lateral branch.Right proper plantar digital nerve J.Right medial sural cutaneous nerve.Right T6 spinal nerve posterior ramus medial branch.Right lesser occipital nerve.Right phrenic nerve.Right proper palmar digital nerve E.Left median nerve.Right S3 grey ramus communicans.Right T4 white ramus communicans.Right medial cutaneous nerve of forearm.Right posterior femoral cutaneous nerve.Right vestibular nerve.Lateral cutaneous branch of left sixth intercostal nerve.Left supratrochlear nerve.Right median nerve.Anterior branch of right medial cutaneous nerve of forearm.Right T5 spinal nerve posterior ramus medial branch.Anterior cutaneous branch of right third intercostal nerve.Right C6 spinal nerve posterior ramus.Temporal branch of left facial nerve.Anterior cutaneous branch of left eighth intercostal nerve.Right buccal nerve.Right middle superior alveolar nerve.Temporal branch of right facial nerve.Left superficial branch of radial nerve.Left medial sural cutaneous nerve.Left C4 spinal nerve posterior ramus.Left lateral dorsal digital nerve of the third toe.Right T12 spinal nerve posterior ramus lateral branch.Anterior branch of lateral cutaneous branch of left eleventh intercostal nerve.Left T12 spinal nerve posterior ramus.Left anterior supraclavicular nerve.Left lesser occipital nerve.Right deep fibular nerve.Left T11 spinal nerve posterior ramus.Posterior branch of lateral cutaneous branch of left tenth intercostal nerve.Right anterior superior alveolar nerve.Left tenth intercostal nerve.Anterior branch of lateral cutaneous branch of right fourth intercostal nerve.Communicating branch of left glossopharyngeal nerve with auricular branch of left vagus nerve.Left iliohypogastric nerve.Cervical branch of left facial nerve.Right proper palmar digital nerve J.Lateral cutaneous branch of right sixth intercostal nerve.Right T8 white ramus communicans.Left maxillary nerve.Left intercostobrachial nerve.Left tentorial nerve.Right zygomaticotemporal nerve.Communicating branch of right internal laryngeal nerve with right recurrent laryngeal nerve.Left fourth intercostal nerve.Brachial plexus left C7 root.Vagal branch to right carotid body.Right proper plantar digital nerve G.Right tympanic nerve.Left lateral plantar nerve.Lateral cutaneous branch of left tenth intercostal nerve.Right tibial nerve.Left third occipital nerve.Anterior branch of lateral cutaneous branch of left tenth intercostal nerve.Right T8 spinal nerve posterior ramus lateral branch.Right S1 grey ramus communicans.Left L3 spinal nerve posterior ramus.Palmar cutaneous branch of left ulnar nerve.Right greater petrosal nerve.Left subcostal nerve.Anterior branch of left medial cutaneous nerve of forearm.Left proper plantar digital nerve C.Left C3 spinal nerve branch to left supraclavicular nerve.Right posterior cutaneous nerve of forearm.Posterior branch of lateral cutaneous branch of right tenth intercostal nerve.Right sciatic nerve.Left L5 grey ramus communicans.Right C4 spinal nerve posterior ramus medial branch.Right L4 grey ramus communicans.Left T11 white ramus communicans.Posterior branch of lateral cutaneous branch of right eighth intercostal nerve.Left L1 grey ramus communicans.Posterior branch of left medial cutaneous nerve of forearm.Left auriculotemporal nerve.Left L2 white ramus communicans.Marginal mandibular branch of right facial nerve.Right T8 grey ramus communicans.Right C4 spinal nerve posterior ramus.Right fifth intercostal nerve.Left common fibular nerve.Left posterior ethmoidal nerve.Pharyngeal branch of right glossopharyngeal nerve.Anterior branch of lateral cutaneous branch of right third intercostal nerve.Communicating branch of right external laryngeal nerve with right superior cardiac nerve.Right posterior supraclavicular nerve.Left medial dorsal cutaneous nerve.Lateral cutaneous branch of right eleventh intercostal nerve.Posterior branch of lateral cutaneous branch of left subcostal nerve.Anterior cutaneous branch of left second intercostal nerve.Left lingual nerve.Right lateral calcaneal branch A of right sural nerve.Left phrenic nerve.Right hypogastric nerve.Medial calcaneal branch A of left tibial nerve.Left perineal nerve.Right posterior scrotal nerve.Right inferior alveolar nerve.Medial calcaneal branch A of right tibial nerve.Right T7 white ramus communicans.Left frontal nerve.Right T1 spinal nerve posterior ramus medial branch.Right genitofemoral nerve.Zygomatic branch of right facial nerve.Lateral cutaneous branch of left ninth intercostal nerve.Left C2 spinal nerve branch to left great auricular nerve.Right anterior supraclavicular nerve.Lateral cutaneous branch of right fourth intercostal nerve.Left T11 grey ramus communicans.Lingual branch of right vagus nerve.Left T1 white ramus communicans.Left C3 spinal nerve posterior ramus medial branch.Left proper plantar digital nerve J.Left T2 grey ramus communicans.Brachial plexus left C6 root.Left T10 spinal nerve posterior ramus.Right genital branch of genitofemoral nerve.Anterior cutaneous branch of right first intercostal nerve.Left middle meningeal nerve.Anterior cutaneous branch of left eleventh intercostal nerve.Left infratrochlear nerve.Vagal branch to left carotid body.Anterior cutaneous branch of right eleventh intercostal nerve.Right proper palmar digital nerve B.Left proper palmar digital nerve H.Anterior branch of lateral cutaneous branch of left fourth intercostal nerve.Left seventh intercostal nerve.Right nasociliary nerve.Left posterior scrotal nerve.Left sural nerve.Right S5 grey ramus communicans.Brachial plexus right C7 root.Right inferior rectal nerve.Right transverse cervical nerve.Anterior cutaneous branch of left third intercostal nerve.Left proper plantar digital nerve H.Superficial branch of left ulnar nerve.Dorsal branch of left ulnar nerve.Right eleventh intercostal nerve.Right T2 white ramus communicans.Right common plantar digital nerve F.Infrapatellar branch of right saphenous nerve.Left T5 grey ramus communicans.Lingual branch of left vagus nerve.Thoracic cardiac branch of left vagus nerve.Right superior laryngeal nerve.Right C2 spinal nerve posterior ramus.Right zygomatic nerve.Right auriculotemporal nerve.Anterior branch of lateral cutaneous branch of left subcostal nerve.Left saphenous nerve.Right L3 spinal nerve posterior ramus.Right T7 grey ramus communicans.Left great auricular nerve posterior branch.Left proper palmar digital nerve A.Right infraorbital nerve.Cutaneous branch of right obturator nerve.Posterior branch of right obturator nerve.Left T1 grey ramus communicans.Right T12 white ramus communicans.Right proper plantar digital nerve F.Left posterior auricular nerve.Right posterior ethmoidal nerve.Buccal branch of right facial nerve.Right iliohypogastric nerve.Left dorsal nerve of penis.Right inferior lateral cutaneous nerve of arm.Left T7 spinal nerve posterior ramus lateral branch.Lateral cutaneous branch of left seventh intercostal nerve.Right posterior interosseous nerve.Left middle superior alveolar nerve.Right T9 white ramus communicans.Right T10 spinal nerve posterior ramus.Left deep fibular nerve.Hepatic branch of anterior vagal trunk.Left first intercostal nerve.Right L2 white ramus communicans.Buccal branch of left facial nerve.Right L5 grey ramus communicans.Right common fibular nerve.Left T6 spinal nerve posterior ramus medial branch.Right L2 grey ramus communicans.Right deep petrosal nerve.Left axillary nerve posterior branch.Right posterior auricular nerve.Anterior branch of lateral cutaneous branch of right subcostal nerve.Anterior branch of lateral cutaneous branch of right fifth intercostal nerve.Pyloric branch of greater posterior gastric nerve.Left T10 spinal nerve posterior ramus lateral branch.Superior cervical cardiac branch of right vagus nerve.Ganglionic branch of right maxillary nerve to pterygopalatine ganglion.Left proper palmar digital nerve C.Right superior cervical cardiac nerve.Right ninth intercostal nerve.Right lesser petrosal nerve.Communicating branch of left external laryngeal nerve with left superior cardiac nerve.Right long ciliary nerve B.Anterior cutaneous branch of right fourth intercostal nerve.Right third intercostal nerve.Left L4 grey ramus communicans.Right T7 spinal nerve posterior ramus.Left L2 spinal nerve posterior ramus lateral branch.Left proper palmar digital nerve F.Coeliac branch of posterior vagal trunk.Left lacrimal nerve.Right lacrimal nerve.Anterior cutaneous branch of right seventh intercostal nerve.Left femoral nerve.Right maxillary nerve.Lateral cutaneous branch of right third intercostal nerve.Right superficial fibular nerve.Left proper palmar digital nerve I.Anterior cutaneous branch of left seventh intercostal nerve.Left T12 spinal nerve posterior ramus lateral branch.Thoracic cardiac branch of right vagus nerve.Lateral cutaneous branch of left eighth intercostal nerve.Orbital branch of left maxillary nerve to left ethmoidal sinus.Left pudendal nerve.Left lesser petrosal nerve.Right eighth intercostal nerve.Left S5 grey ramus communicans.Right T10 white ramus communicans.Left T10 white ramus communicans.Left T4 white ramus communicans.Lateral cutaneous branch of left third intercostal nerve.Posterior branch of lateral cutaneous branch of left eighth intercostal nerve.Lateral cutaneous branch of right iliohypogastric nerve.Right supratrochlear nerve.Anterior branch of lateral cutaneous branch of right tenth intercostal nerve.Right C3 spinal nerve branch to right supraclavicular nerve.Right T6 grey ramus communicans.Left T5 spinal nerve posterior ramus medial branch.Left proper palmar digital nerve G.Left posterior superior alveolar nerve.Lateral cutaneous branch of left subcostal nerve.Gluteal branch A of right posterior femoral cutaneous nerve.Right T5 white ramus communicans.Left greater petrosal nerve.Left T3 spinal nerve posterior ramus.Right subcostal nerve.Right femoral branch of genitofemoral nerve.Right sixth intercostal nerve.Anterior cutaneous branch of right ninth intercostal nerve.Left T11 spinal nerve posterior ramus lateral branch.Left T7 grey ramus communicans.Posterior branch of lateral cutaneous branch of right subcostal nerve.Left L2 grey ramus communicans.Posterior branch of lateral cutaneous branch of right third intercostal nerve.Right L1 white ramus communicans.Anterior branch of right obturator nerve.Anterior cutaneous branch of left fifth intercostal nerve.Left T4 grey ramus communicans.Right C5 spinal nerve posterior ramus medial branch.Right T4 spinal nerve posterior ramus medial branch.Left L1 white ramus communicans.Anterior cutaneous branch of right eighth intercostal nerve.Left subclavian nerve.Pericardial branch of left phrenic nerve.Left tympanic nerve.Right zygomaticofacial nerve.Right intercostobrachial nerve.Right cochlear nerve.Left internal laryngeal nerve.Right lateral dorsal digital nerve of the third toe.Left proper palmar digital nerve D.Inferior cervical cardiac branch of left vagus nerve.Left proper plantar digital nerve B.Right S2 grey ramus communicans.Right proper plantar digital nerve H.Right tentorial nerve.Right T1 white ramus communicans.Inferior ramus of left internal laryngeal nerve.Right L3 grey ramus communicans.Right posterior superior alveolar nerve.Tonsillar branch of right glossopharyngeal nerve.Lateral cutaneous branch of right subcostal nerve.Right proper palmar digital nerve C.Right first intercostal nerve.Posterior branch of right medial cutaneous nerve of forearm.Right lingual nerve.Lateral cutaneous branch of right fifth intercostal nerve.Left T4 spinal nerve posterior ramus.Posterior branch of lateral cutaneous branch of left third intercostal nerve.Right posterior superior lateral nasal branch of maxillary nerve.Posterior branch of lateral cutaneous branch of right fifth intercostal nerve.Left buccal nerve.Right third occipital nerve.Left anterior ethmoidal nerve.Right lingual branch of glossopharyngeal nerve.Left laryngopharyngeal branch of superior cervical ganglion.Right infratrochlear nerve.Left external laryngeal nerve branch to pharyngeal plexus.Left T7 white ramus communicans.Left L1 spinal nerve posterior ramus.Right S4 grey ramus communicans.Left proper palmar digital nerve J.Left zygomatic nerve.Left L1 spinal nerve posterior ramus lateral branch.Left greater occipital nerve.Left medial cutaneous nerve of forearm.Brachial plexus left C8 root.Left anterior femoral cutaneous branch A.Posterior branch of lateral cutaneous branch of left seventh intercostal nerve.Left T1 spinal nerve posterior ramus medial branch.Left meningeal branch of mandibular nerve.Left medial dorsal digital nerve of the fourth toe.Left C5 spinal nerve posterior ramus.Pharyngeal branch of left glossopharyngeal nerve.Right medial plantar nerve.Left proper plantar digital nerve F.Left deep petrosal nerve.Right supraorbital nerve.Left proper plantar digital nerve E.Right T9 spinal nerve posterior ramus lateral branch.Left posterior cutaneous nerve of forearm.Left posterior femoral cutaneous nerve.Left hypogastric nerve.Left genitofemoral nerve.Anterior branch of lateral cutaneous branch of left ninth intercostal nerve.Right T1 spinal nerve posterior ramus.Right common palmar digital nerve A.Right L3 spinal nerve posterior ramus lateral branch.Left anterior superior alveolar nerve.Right T1 grey ramus communicans.Anterior cutaneous branch of left sixth intercostal nerve.Left proper plantar digital nerve A.Left T5 spinal nerve posterior ramus.Right T3 spinal nerve posterior ramus.Right superior labial branch of infraorbital nerve.Left proper palmar digital nerve E.Left transverse cervical nerve.Posterior branch of lateral cutaneous branch of right fourth intercostal nerve.Left communicating branch of nasociliary nerve with ciliary ganglion.Superficial branch of right ulnar nerve.Right great auricular nerve posterior branch.Palmar branch of right median nerve.Right ulnar nerve.Right T5 grey ramus communicans.Palmar cutaneous branch of right ulnar nerve.Left T2 spinal nerve posterior ramus medial branch.Tonsillar branch of left glossopharyngeal nerve.Lateral cutaneous branch of right eighth intercostal nerve.Posterior branch of lateral cutaneous branch of right eleventh intercostal nerve.Left T6 white ramus communicans.Right T4 grey ramus communicans.Branch of right vagus nerve to oesophageal nerve plexus.Superior cervical cardiac branch of left vagus nerve.Left long thoracic nerve.Right mental nerve.Left fifth intercostal nerve.Lateral cutaneous branch of left fourth intercostal nerve.Right lateral femoral cutaneous nerve.Posterior branch of lateral cutaneous branch of right seventh intercostal nerve.Lateral cutaneous branch of right seventh intercostal nerve.Left C4 spinal nerve posterior ramus medial branch.Right intermediate dorsal cutaneous nerve.Right medial dorsal cutaneous nerve.Left recurrent laryngeal nerve.Left obturator nerve.Left T8 grey ramus communicans.Right T2 spinal nerve posterior ramus.Right T3 spinal nerve posterior ramus medial branch.Left T2 spinal nerve posterior ramus.Right superficial branch of radial nerve.Right C3 spinal nerve branch to right great auricular nerve.Left anterior interosseous nerve.Lateral cutaneous branch of right ninth intercostal nerve.Left common plantar digital nerve E.Brachial plexus left C5 root.Left external laryngeal nerve.Left C3 spinal nerve posterior ramus.Oesophageal branch of right recurrent laryngeal nerve.Lateral cutaneous branch of right tenth intercostal nerve.Anterior cutaneous branch of right sixth intercostal nerve.Right T3 white ramus communicans.Left T9 grey ramus communicans.Auricular branch of right vagus nerve.Right lateral sural cutaneous nerve.Left ulnar nerve.Right long ciliary nerve A.Left sciatic nerve.Anterior branch of lateral cutaneous branch of left fifth intercostal nerve.Right inferior palpebral branch of infraorbital nerve.Right medial cutaneous nerve of arm.Auricular branch of left vagus nerve.Left T10 grey ramus communicans.Left medial posterior superior nasal nerve.Pharyngeal branch of right vagus nerve to pharyngeal nerve plexus.Left L3 grey ramus communicans.Left lateral femoral cutaneous nerve.Right external laryngeal nerve branch to pharyngeal plexus.Left eighth intercostal nerve.Right T5 spinal nerve posterior ramus.Left tibial nerve.Right superior lateral cutaneous nerve of arm.Right lateral plantar nerve.Anterior cutaneous branch of left first intercostal nerve.Brachial plexus right C8 root.Lateral cutaneous branch of left iliohypogastric nerve.Posterior branch of lateral cutaneous branch of left eleventh intercostal nerve.Right long thoracic nerve.Left lateral cutaneous nerve of forearm.Left posterior supraclavicular nerve.Left T3 grey ramus communicans.Left ilioinguinal nerve.Left mental nerve.Left T12 white ramus communicans.Left superficial fibular nerve.Right proper palmar digital nerve F.Right proper palmar digital nerve D.Right lateral cutaneous nerve of forearm.Gluteal branch A of left posterior femoral cutaneous nerve.Lateral cutaneous branch of left fifth intercostal nerve.Right L1 spinal nerve posterior ramus lateral branch.Right axillary nerve anterior branch.Orbital branch of right maxillary nerve to right ethmoidal sinus.Right C6 spinal nerve posterior ramus medial branch.Posterior branch of lateral cutaneous branch of right ninth intercostal nerve.Right recurrent laryngeal nerve.Right sural nerve.Dorsal branch of right ulnar nerve.Right common plantar digital nerve E.Right medial dorsal digital nerve of the fourth toe.Right proper plantar digital nerve E.Left caroticotympanic nerve.Greater posterior gastric nerve.Right L1 spinal nerve posterior ramus.Pericardial branch of right phrenic nerve.Anterior branch of lateral cutaneous branch of right eighth intercostal nerve.Left incisive branch of inferior alveolar nerve.Right T3 grey ramus communicans.Left posterior interosseous nerve.Palmar branch of left median nerve.Left nasociliary nerve.Right external laryngeal nerve.Pharyngeal branch of left vagus nerve to pharyngeal nerve plexus.Right T11 grey ramus communicans.Right dorsal nerve of penis.Left C6 spinal nerve posterior ramus.Left axillary nerve anterior branch.Meningeal branch of left vagus nerve.Left intermediate dorsal cutaneous nerve.Right laryngopharyngeal branch of superior cervical ganglion.Right great auricular nerve anterior branch.Zygomatic branch of left facial nerve.Left C5 spinal nerve posterior ramus medial branch.Marginal mandibular branch of left facial nerve.Right L1 grey ramus communicans.Right meningeal branch of mandibular nerve.Right femoral nerve.Tracheal branch of right recurrent laryngeal nerve.Left posterior cutaneous nerve of arm.Left inferior lateral cutaneous nerve of arm.Right L2 spinal nerve posterior ramus.Right lateral dorsal cutaneous nerve.Anterior cutaneous branch of right second intercostal nerve.Left nasopalatine nerve.Left T3 spinal nerve posterior ramus medial branch.Left superior cervical cardiac nerve.Posterior branch of lateral cutaneous branch of left ninth intercostal nerve.Right T7 spinal nerve posterior ramus lateral branch.Right frontal nerve.Anterior cutaneous branch of left tenth intercostal nerve.Ganglionic branch of left maxillary nerve to pterygopalatine ganglion.Left S1 grey ramus communicans.Left lesser palatine nerve.Left medial plantar nerve.Communicating branch of right glossopharyngeal nerve with auricular branch of right vagus nerve.Left zygomaticotemporal nerve.Anterior cutaneous branch of right fifth intercostal nerve.Left proper palmar digital nerve B.Left radial nerve.Posterior branch of lateral cutaneous branch of left fourth intercostal nerve.Left S3 grey ramus communicans.Left T3 white ramus communicans.Right T11 spinal nerve posterior ramus.Left ninth intercostal nerve.Right T2 spinal nerve posterior ramus medial branch.Anterior cutaneous branch of left subcostal nerve.Right proper plantar digital nerve B.Left C2 spinal nerve posterior ramus.Right axillary nerve.Left axillary nerve.Left common palmar digital nerve A.Left proper plantar digital nerve D.Left femoral branch of genitofemoral nerve.Left second intercostal nerve.Left medial cutaneous nerve of arm.Left lateral sural cutaneous nerve.Right ophthalmic nerve.Right carotid sinus nerve.Right T10 spinal nerve posterior ramus lateral branch.Right proper plantar digital nerve D.Right mandibular nerve.Right obturator nerve.Left C3 spinal nerve branch to left great auricular nerve.Left lateral dorsal cutaneous nerve.Right greater palatine nerve.Right L2 spinal nerve posterior ramus lateral branch.Brachial plexus right C5 root.Left posterior superior lateral nasal branch of maxillary nerve.Right proper plantar digital nerve I.Right seventh intercostal nerve.Anterior branch of lateral cutaneous branch of right eleventh intercostal nerve.Right tenth intercostal nerve.Left mandibular nerve.Left greater palatine nerve.Left T12 grey ramus communicans.Inferior cervical cardiac branch of right vagus nerve.Left ophthalmic nerve.Left superior laryngeal nerve.Right T12 grey ramus communicans.Cutaneous branch of left obturator nerve.Left long ciliary nerve B.Left S4 grey ramus communicans.Left T4 spinal nerve posterior ramus medial branch.Greater anterior gastric nerve.Orbital branch of left maxillary nerve to left sphenoidal sinus.Orbital branch of right maxillary nerve to right sphenoidal sinus.Right middle supraclavicular nerve.Right caroticotympanic nerve.Left sixth intercostal nerve.Right posterior cutaneous nerve of arm.Left middle supraclavicular nerve.Left proper plantar digital nerve I.Anterior branch of lateral cutaneous branch of right sixth intercostal nerve.Left L2 spinal nerve posterior ramus.Anterior branch of lateral cutaneous branch of left seventh intercostal nerve.Posterior branch of lateral cutaneous branch of right sixth intercostal nerve.Left T8 spinal nerve posterior ramus lateral branch.Meningeal branch of right vagus nerve.Tracheal branch of left recurrent laryngeal nerve.Anterior cutaneous branch of right tenth intercostal nerve.Left eleventh intercostal nerve.Right pudendal nerve.Posterior branch of lateral cutaneous branch of left fifth intercostal nerve.Right anterior ethmoidal nerve.Right nasopalatine nerve.Left T8 spinal nerve posterior ramus.Left long ciliary nerve A.Left supraorbital nerve.Right medial posterior superior nasal nerve.Left T8 white ramus communicans.Right anterior femoral cutaneous branch A.Left T2 white ramus communicans.Right saphenous nerve.Anterior branch of lateral cutaneous branch of right seventh intercostal nerve.Left superior lateral cutaneous nerve of arm.Left T9 spinal nerve posterior ramus lateral branch.Left T6 spinal nerve posterior ramus.Posterior branch of left obturator nerve.Left external laryngeal nerve branch to inferior pharyngeal constrictor.Right incisive branch of inferior alveolar nerve.Right C3 spinal nerve posterior ramus.Right C5 spinal nerve posterior ramus.Right T9 spinal nerve posterior ramus.Communicating branch of left internal laryngeal nerve with left recurrent laryngeal nerve.Left vestibular nerve.Right radial nerve.Left third intercostal nerve.Left cochlear nerve.Anterior cutaneous branch of left fourth intercostal nerve.Right T6 spinal nerve posterior ramus.Right greater occipital nerve.Right lesser palatine nerve.Left inferior alveolar nerve.Right subclavian nerve.Right T6 white ramus communicans.Brachial plexus right C6 root.Lateral cutaneous branch of left eleventh intercostal nerve.Right T11 white ramus communicans.Left carotid sinus nerve.Left great auricular nerve anterior branch.Right external laryngeal nerve branch to inferior pharyngeal constrictor.Left S2 grey ramus communicans.Right internal laryngeal nerve.Infrapatellar branch of left saphenous nerve.Anterior branch of lateral cutaneous branch of left sixth intercostal nerve.Right proper palmar digital nerve A.Right communicating branch of nasociliary nerve with ciliary ganglion.Left proper plantar digital nerve G.Left infraorbital nerve.Left lingual branch of glossopharyngeal nerve.Right proper plantar digital nerve A.Left inferior rectal nerve.Right musculocutaneous nerve.Left inferior palpebral branch of infraorbital nerve.Left T7 spinal nerve posterior ramus.Cervical branch of right facial nerve.Right middle meningeal nerve.Right axillary nerve posterior branch.Right C2 spinal nerve branch to right great auricular nerve.Left zygomaticofacial nerve.Anterior branch of lateral cutaneous branch of left eighth intercostal nerve`.split(`.`)},{id:77,nerve_id:`UBERON:0001647`,label:`facial nerve`,"FMA subclasses (in human nerves)":[`FMA:50888`,`FMA:50889`],"subclass labels":[`Right facial nerve`,`Left facial nerve`]},{id:78,nerve_id:`UBERON:0001148`,label:`median nerve`,"FMA subclasses (in human nerves)":[`FMA:37067`,`FMA:37068`],"subclass labels":[`Right median nerve`,`Left median nerve`]},{id:79,nerve_id:`UBERON:0009009`,label:`carotid sinus nerve`,"FMA subclasses (in human nerves)":[`FMA:53508`,`FMA:53509`],"subclass labels":[`Right carotid sinus nerve`,`Left carotid sinus nerve`]},{id:80,nerve_id:`UBERON:0003715`,label:`splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6924`,`FMA:6928`,`FMA:6929`,`FMA:6931`,`FMA:6930`,`FMA:6960`,`FMA:6958`,`FMA:6959`,`FMA:6925`,`FMA:6956`,`FMA:6927`,`FMA:6955`,`FMA:6926`,`FMA:6957`],"subclass labels":[`Right first lumbar splanchnic nerve`,`Right third lumbar splanchnic nerve`,`Left third lumbar splanchnic nerve`,`Left fourth lumbar splanchnic nerve`,`Right fourth lumbar splanchnic nerve`,`Left least splanchnic nerve`,`Left lesser splanchnic nerve`,`Right least splanchnic nerve`,`Left first lumbar splanchnic nerve`,`Right greater splanchnic nerve`,`Left second lumbar splanchnic nerve`,`Left greater splanchnic nerve`,`Right second lumbar splanchnic nerve`,`Right lesser splanchnic nerve`]},{id:81,nerve_id:`ILX:0793826`,label:`anterior abdominal vagal trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:82,nerve_id:`UBERON:0001650`,label:`hypoglossal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:83,nerve_id:`ILX:0794967`,label:`posterior interosseous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:84,nerve_id:`ILX:0793713`,label:`Deep petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:0328827`,`FMA:0328826`],"subclass labels":[`Left deep petrosal nerve`,`Right deep petrosal nerve`]},{id:85,nerve_id:`ILX:0793361`,label:`white communicating ramus of third lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:86,nerve_id:`ILX:0787562`,label:`gray communicating ramus of the third thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6133`,`FMA:6124`],"subclass labels":[`Left T3 grey ramus communicans`,`Right T3 grey ramus communicans`]},{id:87,nerve_id:`ILX:0793211`,label:`white communicating ramus of fifth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:88,nerve_id:`UBERON:0018679`,label:`thoracic splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6958`,`FMA:6960`,`FMA:6955`,`FMA:6959`,`FMA:6957`,`FMA:6956`],"subclass labels":[`Left lesser splanchnic nerve`,`Left least splanchnic nerve`,`Left greater splanchnic nerve`,`Right least splanchnic nerve`,`Right lesser splanchnic nerve`,`Right greater splanchnic nerve`]},{id:89,nerve_id:`ILX:0731969`,label:`least splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6960`,`FMA:6959`],"subclass labels":[`Left least splanchnic nerve`,`Right least splanchnic nerve`]},{id:90,nerve_id:`ILX:0788771`,label:`gray communicating ramus of seventh thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6888`,`FMA:6889`],"subclass labels":[`Right T7 grey ramus communicans`,`Left T7 grey ramus communicans`]},{id:91,nerve_id:`UBERON:0022301`,label:`long ciliary nerve`,"FMA subclasses (in human nerves)":[`FMA:52701`,`FMA:52700`,`FMA:82734`,`FMA:82735`],"subclass labels":[`Left long ciliary nerve B`,`Right long ciliary nerve B`,`Right long ciliary nerve A`,`Left long ciliary nerve A`]},{id:92,nerve_id:`ILX:0793221`,label:`white communicating ramus of second lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:93,nerve_id:`ILX:0785825`,label:`gray communicating ramus of first lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65924`,`FMA:65923`],"subclass labels":[`Left L1 grey ramus communicans`,`Right L1 grey ramus communicans`]},{id:94,nerve_id:`ILX:0793208`,label:`white communicating ramus of second thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:95,nerve_id:`UBERON:0018412`,label:`vidian nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:96,nerve_id:`ILX:0739303`,label:`gray communicating ramus of second thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:97,nerve_id:`ILX:0795006`,label:`Suboccipital nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:98,nerve_id:`ILX:0785733`,label:`gray communicating ramus of second lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65921`,`FMA:65922`],"subclass labels":[`Right L2 grey ramus communicans`,`Left L2 grey ramus communicans`]},{id:99,nerve_id:`UBERON:0035207`,label:`deep fibular nerve`,"FMA subclasses (in human nerves)":[`FMA:45387`,`FMA:45388`],"subclass labels":[`Right deep fibular nerve`,`Left deep fibular nerve`]},{id:100,nerve_id:`ILX:0739304`,label:`gray communicating ramus of third thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:101,nerve_id:`UBERON:0002019`,label:`accessory XI nerve`,"FMA subclasses (in human nerves)":[`FMA:50899`,`FMA:50897`],"subclass labels":[`Left accessory nerve`,`Right accessory nerve`]},{id:102,nerve_id:`ILX:0793217`,label:`white communicating ramus of eleventh thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:103,nerve_id:`ILX:0793722`,label:`Lesser petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:53503`,`FMA:53502`],"subclass labels":[`Left lesser petrosal nerve`,`Right lesser petrosal nerve`]},{id:104,nerve_id:`UBERON:0018675`,label:`pelvic splanchnic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:105,nerve_id:`ILX:0793702`,label:`Greater petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:53423`,`FMA:53424`],"subclass labels":[`Right greater petrosal nerve`,`Left greater petrosal nerve`]},{id:106,nerve_id:`ILX:0794916`,label:`white ramus communicans`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:107,nerve_id:`UBERON:0003716`,label:`Recurrent Laryngeal Nerve`,"FMA subclasses (in human nerves)":[`UBERON:0011766`,`UBERON:0011767`],"subclass labels":[`Left recurrent laryngeal nerve`,`Right recurrent laryngeal nerve`]},{id:108,nerve_id:`UBERON:0005465`,label:`obturator nerve`,"FMA subclasses (in human nerves)":[`FMA:16501`,`FMA:16502`],"subclass labels":[`Right obturator nerve`,`Left obturator nerve`]},{id:109,nerve_id:`ILX:0793213`,label:`white communicating ramus of seventh thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:110,nerve_id:`ILX:0785067`,label:`gray communicating ramus of eleventh thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6897`,`FMA:6896`],"subclass labels":[`Left T11 grey ramus communicans`,`Right T11 grey ramus communicans`]},{id:111,nerve_id:`UBERON:0001494`,label:`ulnar nerve`,"FMA subclasses (in human nerves)":[`FMA:37320`,`FMA:37321`],"subclass labels":[`Right ulnar nerve`,`Left ulnar nerve`]},{id:112,nerve_id:`ILX:0794959`,label:`posterior rami lower cervical nerves`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:113,nerve_id:`UBERON:0001493`,label:`axillary nerve`,"FMA subclasses (in human nerves)":[`FMA:37074`,`FMA:37073`],"subclass labels":[`Left axillary nerve`,`Right axillary nerve`]},{id:114,nerve_id:`ILX:0787946`,label:`gray communicating ramus of sixth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6762`,`FMA:6763`],"subclass labels":[`Right T6 grey ramus communicans`,`Left T6 grey ramus communicans`]},{id:115,nerve_id:`ILX:0785542`,label:`gray communicating ramus of ninth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6892`,`FMA:6893`],"subclass labels":[`Right T9 grey ramus communicans`,`Left T9 grey ramus communicans`]}],pO=()=>{let e={};return fO.forEach(t=>{t.nerve_id&&t.label!==`nerve`&&t[`subclass labels`].forEach(n=>{n in e||(e[n.toLowerCase()]=t.nerve_id)})}),e},mO=[{label:`urinary bladder`,anatomicalId:`UBERON:0001255`},{label:`brainstem`,anatomicalId:`UBERON:0002298`},{label:`caecum`,anatomicalId:`UBERON:0001153`},{label:`colon`,anatomicalId:`UBERON:0001155`},{label:`esophagus`,anatomicalId:`UBERON:0001043`},{label:`small intestine`,anatomicalId:`UBERON:0002108`},{label:`stomach`,anatomicalId:`UBERON:0000945`},{label:`heart`,anatomicalId:`UBERON:0000948`},{label:`lung`,anatomicalId:`UBERON:0002048`}],hO=()=>{let e={};return mO.forEach(t=>{let n=t.label.toLowerCase();n in e||(e[n.toLowerCase()]=t.anatomicalId)}),e},gO=pO(),_O=hO(),vO=0,yO={name:`ScaffoldVuer`,components:{Button:Km,Col:hg,Loading:tv,Option:kh,Popover:r_,Radio:lg,RadioGroup:ug,Row:mg,ScaffoldOverlay:cv,Select:Oh,Slider:C_,TabPane:U_,Tabs:H_,MapSvgIcon:a.MapSvgIcon,MapSvgSpriteColor:a.MapSvgSpriteColor,PrimitiveControls:rD,ScaffoldTooltip:lD,ElIconWarningFilled:Jd,ElIconArrowDown:Fd,ElIconArrowLeft:Id,DrawToolbar:n.DrawToolbar,ScaffoldTreeControls:NE},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new o.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},props:{annotationSidebar:{type:Boolean,default:!1},url:{type:String,default:``},showColourPicker:{type:Boolean,default:!1},displayUI:{type:Boolean,default:!0},displayAtStartUp:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},displayWarning:{type:Boolean,default:!1},warningMessage:{type:String,default:`Beta feature - under active development`},displayLatestChanges:{type:Boolean,default:!1},latestChangesMessage:{type:String,default:`New feature - Local search is now available`},displayMarkers:{type:Boolean,default:!1},markerCluster:{type:Boolean,default:!1},markerLabels:{type:Object,default:function(){return{}}},displayMinimap:{type:Boolean,default:!1},format:{type:String,default:`metadata`},minimapSettings:{type:Object,default:function(){return{x_offset:16,y_offset:16,width:128,height:128,align:`top-right`}}},enableOpenMapUI:{type:Boolean,default:!1},positionalRotation:{type:Boolean,default:!1},isNerves:{type:Object,default:function(){return{regions:[`nerves`]}}},openMapOptions:{type:Array,default:function(){return[{display:`Open AC Map`,key:`AC`},{display:`Open FC Map`,key:`FC`},{display:`Open 3D Human Map`,key:`3D`}]}},state:{type:Object,default:void 0},region:{type:String,default:``},viewURL:{type:String,default:``},render:{type:Boolean,default:!0},flatmapAPI:{type:String,default:`https://mapcore-demo.org/current/flatmap/v3/`},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},usageConfig:{type:Object,default:function(){return{showTubeLinesControls:!0,tubeLines:!1}}}},provide(){return{flatmapAPI:this.flatmapAPI,scaffoldUrl:this.url,boundingDims:this.boundingDims}},data:function(){return{annotator:void 0,clientHeight:300,colourRadio:!0,createData:{drawingBox:!1,renaming:!1,toBeConfirmed:!1,points:[],tempGroupName:void 0,shape:``,x:0,y:0,editingIndex:-1,faceIndex:-1,toBeDeleted:!1,regionPrefix:`__annotation`},currentTime:0,timeVarying:!1,isPlaying:!1,isReady:!1,isTransitioning:!1,tooltipAppendToBody:!1,hoverVisibilities:[{value:!1,ref:`zoomInPopover`},{value:!1,ref:`zoomOutPopover`},{value:!1,ref:`zoomFitPopover`},{value:!1,ref:`openMapPopover`},{value:!1,ref:`settingsPopover`},{value:!1,ref:`sliderPopover`},{value:!1,ref:`regionVisibilityPopover`},{value:!1,ref:`warningPopover`},{value:!1,ref:`whatsNewPopover`},{value:!1,refs:`toolbarPopover`,ref:`editPopover`},{value:!1,refs:`toolbarPopover`,ref:`pointPopover`},{value:!1,refs:`toolbarPopover`,ref:`lineStringPopover`},{value:!1,refs:`toolbarPopover`,ref:`deletePopover`}],inHelp:!1,helpModeActiveIndex:this.helpModeInitialIndex,loading:!1,duration:3e3,drawerOpen:!0,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],minimisedSlider:!1,sliderPosition:``,timeMax:100,orginalDuration:``,animateDuration:`6secs`,playSpeed:[{value:.1,label:`0.1x`},{value:.5,label:`0.5x`},{value:1,label:`1x`},{value:2,label:`2x`},{value:5,label:`5x`},{value:10,label:`10x`}],currentSpeed:1,timeStamps:{},defaultCheckedKeys:[],outlinesRadio:!0,tData:{label:``,region:``,visible:!1,x:200,y:200,active:!1},fileFormat:`metadata`,previousMarkerLabels:(0,t.markRaw)({}),viewingMode:`Exploration`,viewingModes:{Exploration:`View and explore detailed visualization of 3D scaffolds`,"Neuron Connection":`Discover nerve connections by selecting a nerve and viewing its associated connections`,Annotation:[`View feature annotations`,`Add, comment on and view feature annotations`]},openMapRef:void 0,backgroundIconRef:void 0,annotationFeature:{},offlineAnnotationEnabled:!1,offlineAnnotations:(0,t.markRaw)([]),authorisedUser:void 0,toolbarOptions:[`Delete`,`Edit`,`Point`,`LineString`],existDrawnFeatures:(0,t.markRaw)([]),activeDrawTool:void 0,activeDrawMode:void 0,boundingDims:{centre:[0,0,0],size:[1,1,1]},lastSelected:(0,t.markRaw)({region:``,group:``,isSearch:!1})}},watch:{format:{handler:function(e){this.fileFormat=e},immediate:!0},url:{handler:function(e){(this.state===void 0||this.state.url===void 0)&&this.setURL(e)},immediate:!0},region:{handler:function(e){this.state||this.viewURL||this.setFocusedRegion(e)},immediate:!0},state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},viewURL:{handler:function(e){this.updateViewURL(e)},immediate:!0},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},displayMarkers:function(e){this.$module.scene.displayMarkers=e,this.$module.scene.forcePickableObjectsUpdate=!0},displayMinimap:function(e){this.$module.scene.displayMinimap=e},currentTime:{handler:function(){this.$emit(`timeChanged`,this.currentTime)}},duration:function(){this.$module.scene.setDuration(this.duration)},minimapSettings:{deep:!0,handler:`updateMinimapScissor`},render:function(e){this.toggleRendering(e)},markerCluster:{handler:function(e){this.$module.scene.enableMarkerCluster(e)},immediate:!0},markerLabels:function(e){for(let[e,t]of Object.entries(this.previousMarkerLabels))this.setMarkerModeForObjectsWithName(e,t,`off`);for(let[t,n]of Object.entries(e))this.setMarkerModeForObjectsWithName(t,n,`on`);this.previousMarkerLabels=(0,t.markRaw)({...e})}},beforeCreate:function(){this.$module=new TD,this.selectedObjects=[],this.hoveredObjects=[],this.currentBackground=`white`,this._currentURL=void 0,this.availableBackground=[`white`,`black`,`lightskyblue`],this.$_searchIndex=new dO},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.$refs.scaffoldTreeControls.setModule(this.$module);let e=new mD;e.subscribe(this,this.eventNotifierCallback),this.$module.addNotifier(e),this.$module.addOrganPartAddedCallback(this.zincObjectAdded),this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved),this.$module.initialiseRenderer(this.$refs.display),this.toggleRendering(this.render),this.clientHeight=this.$refs.scaffoldContainer.$el.clientHeight,this.ro=new ResizeObserver(this.adjustLayout).observe(this.$refs.scaffoldContainer.$el),this.helpTextWait=[],this.helpTextWait.length=this.hoverVisibilities.length,this.defaultRate=this.$module.getPlayRate(),this.$module.zincRenderer.addPreRenderCallbackFunction(()=>{this.currentTime=this.$module.getCurrentTime()}),this.$module.zincRenderer.addContextRestoredCallbackFunction(()=>{this.backgroundChangeCallback(this.currentBackground)})},beforeUnmount:function(){this.ro&&this.ro.disconnect(),this.$module.destroy(),this.$module=void 0},computed:{...(0,i.mapStores)(iD),...(0,i.mapState)(iD,[`userToken`]),annotationDisplay:function(){return this.viewingMode===`Annotation`&&this.tData.active===!0&&this.activeDrawMode!==`Point`&&this.activeDrawMode!==`LineString`},enableColourPicker:function(){return this.showColourPicker&&this.colourRadio},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e}},methods:{zoomToNerves:function(e,t=!1){if(this.$module.scene){this.$module.setIgnorePicking(t);let n=[];this.$module.scene.getRootRegion().getChildRegions().forEach(r=>{r.getName()===`Nerves`&&t&&e.forEach(e=>{let t=this.findObjectsWithGroupName(e);n.push(...t)})}),this.$module.setSelectedByZincObjects(n,void 0,{},!0),this.$module.scene.viewAll()}},enableAxisDisplay:function(e,t){this.$module.scene&&this.$module.scene.enableAxisDisplay(e,t)},createAxisDisplay:function(e){this.$module.scene&&this.$module.scene.createAxisDisplay(e)},addZincObject:function(e){this.$module.scene&&this.$module.scene.addZincObject(e)},zincObjectAdded:function(e){this.loading=!1,this.$_searchIndex.addZincObject(e,e.uuid),this.timeVarying===!1&&e.isTimeVarying()&&(this.timeVarying=!0);let t=e.groupName.toLowerCase();t in _O&&e.setAnatomicalId(_O[t]);let n=e.getGroup();n&&n.position?e.userData.originalPos=[n.position.x,n.position.y,n.position.z]:e.userData.originalPos=[0,0,0];let r=this.isNerves?.regions;if(r){let n=e.getRegion().getFullPath().toLowerCase();for(let i=0;i<r.length;i++)n.includes(r[i].toLowerCase())?(e.userData.isNerves=!0,e.userData.defaultColour=`#${e.getColourHex()}`,e.userData.isGreyScale=!1,t in gO&&(vO++,e.setAnatomicalId(gO[t]))):e.userData.isNerves=!1}this.calculateBoundingBox(),this.$emit(`zinc-object-added`,e)},removeFromOfflineAnnotation:function(e,t){for(let n=0;n<this.offlineAnnotations.length;n++){let r=this.offlineAnnotations[n];if(r.region===e&&r.group===t){this.offlineAnnotations.splice(n,1);return}}},renameZincObject:function(e,t){if(this.$module.scene){let n=this.$refs.scaffoldTreeControls,r=e.groupName;e.setName(t),n.zincObjectRenamed(e,r),this.$_searchIndex.updateZincObject(e,e.uuid)}},zincObjectRemoved:function(e){if(this.$module.scene){let t=e.groupName;e.region.findObjectsWithGroupName(t,!1).length===0&&this.$_searchIndex.removeZincObject(e,e.uuid)}},addRegionsToSearchIndex:function(){this.$module.scene.getRootRegion().getChildRegions(!0).forEach(e=>{this.$_searchIndex.addRegion(e,e.uuid)})},backgroundChangeCallback:function(e){this.currentBackground=e,this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground,1)},captureScreenshotCallback:function(e,t,n){return()=>{this.$module.zincRenderer.removePostRenderCallbackFunction(this.captureID);let r=this.$module.zincRenderer.getThreeJSRenderer(),i=this.$module.scene.camera,a=r.domElement.width,o=r.domElement.height,s=i.aspect,c=r.getPixelRatio();r.setPixelRatio(1),r.setSize(t,n,!1),i.aspect=t/n,i.updateProjectionMatrix(),this.$module.zincRenderer.render();let l=r.domElement.toDataURL(`image/png`);r.setPixelRatio(c),r.setSize(a,o,!1),i.aspect=s,i.updateProjectionMatrix(),this.$module.zincRenderer.render();let u=document.createElement(`a`);u.download=e||`screenshot.png`,u.href=l,u.click(),u.remove()}},captureScreenshot:function(e,t=1920,n=1080){this.captureID=this.$module.zincRenderer.addPostRenderCallbackFunction(this.captureScreenshotCallback(e,t,n))},clearScene:function(){this.$refs.scaffoldTreeControls&&this.$refs.scaffoldTreeControls.clear(),this.$_searchIndex&&this.$_searchIndex.removeAll(),this.$module.scene&&this.$module.scene.clearAll()},addAndEditAnnotations:function(e,n,r,i){let a=TE(this.annotator,this.userToken,r,e,n,this.url,i);if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==a.item.id)),this.existDrawnFeatures.push(a.feature),this.offlineAnnotationEnabled){a.group=n;let t=e;t.slice(-1)===`/`&&(t=t.slice(0,-1)),a.region=t,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[];let r=this.offlineAnnotations.find(e=>e.group===a.group&&e.region===a.region&&e.resource===a.resource&&e.feature.geometry.type===a.feature.geometry.type);r?Object.assign(r,a):this.offlineAnnotations.push(a),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:e,group:n,zincObject:r})},renameAnnotations:function(e,n,r,i){let a=e.slice(-1)===`/`?e:e+`/`,o=a+i,s=TE(this.annotator,this.userToken,r,e,n,this.url,`Rename from ${o}`);if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==o)),this.existDrawnFeatures.push(s.feature),this.offlineAnnotationEnabled){s.group=n,a=e,a.slice(-1)===`/`&&(a=a.slice(0,-1)),s.region=a,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[];let t=this.offlineAnnotations.find(e=>e.group===i&&e.region===s.region&&e.resource===s.resource&&e.feature.geometry.type===s.feature.geometry.type);t&&Object.assign(t,s),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:e,group:n,zincObject:r,renamedFrom:i})},primitivesUpdated:function(e){if(e.isZincObject&&e.isEditable){let t=e.groupName,n=e.region.getFullPath();this.addAndEditAnnotations(n,t,e,`Position Updated`)}},confirmCreate:function(e){if(e){let t;if(e.shape===`Point`)t=this.$module.scene.createPoints(e.region,e.group,this.createData.points,e.group,8942);else if(e.shape===`LineString`)t=this.$module.scene.createLines(e.region,e.group,[this.createData.points[0],this.createData.points[1]],60962);else if(e.deleting)this.confirmDelete(e);else if(e.editingIndex>-1){if(this._editingZincObject){let t;e.editingIndex>-1&&(t=this.createData.faceIndex>-1?this.createData.points[1]:this.createData.points[0]),this._editingZincObject.editVertices([t],e.editingIndex);let n=this._editingZincObject.region.getFullPath()+`/`,r=this._editingZincObject.groupName;this.addAndEditAnnotations(n,r,this._editingZincObject,`Position Updated`)}}else if(e.renaming){let t=this._editingZincObject.groupName;this.renameZincObject(this._editingZincObject,e.group),this.renameAnnotations(e.region,e.group,this._editingZincObject,t)}t&&(this.addAndEditAnnotations(e.region,e.group,t.zincObject,`Create`),t.zincObject.isEditable=!0,this.tData.region=e.region,this.tData.label=e.group,this.changeActiveByName([e.group],e.region,!1))}this.cancelCreate()},cancelCreate:function(){this.changeActiveByName(void 0),this.createData.points.length=0,this.createData.renaming=!1,this.createData.toBeConfirmed=!1,this._editingZincObject=void 0,this.createData.editingIndex=-1,this.createData.faceIndex=-1,this.createData.tempGroupName=void 0,this.tData.visible=!1,this.createData.toBeDeleted=!1,this._tempLine&&=(this.$module.scene.removeTemporaryPrimitive(this._tempLine),void 0),this._tempPoint&&=(this.$module.scene.removeTemporaryPrimitive(this._tempPoint),void 0),this.annotationSidebar&&this.$emit(`annotation-close`)},confirmComment:function(e){if(this._editingZincObject){let n=e;this._editingZincObject.isEditable&&(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==n.item.id)),this.existDrawnFeatures.push(e.feature)),this.offlineAnnotationEnabled&&(n.group=this._editingZincObject.groupName,n.region=this._editingZincObject.region.getFullPath(),this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],this.offlineAnnotations.push(n),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations)))}},confirmDelete:function(e){if(this._editingZincObject?.isEditable){let n=this._editingZincObject.region.getFullPath()+`/`,r=this._editingZincObject.groupName,i=!0;e.editingIndex>-1&&this._editingZincObject.isPointset&&(i=1>this._editingZincObject.deleteVertices(e.editingIndex));let a=i?`Deleted`:`Removed a vertex`,o=TE(this.annotator,this.userToken,this._editingZincObject,n,r,this.url,a);if(o){if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==o.item.id)),i&&this.$module.scene.getRootRegion().findChildFromPath(n).removeZincObject(this._editingZincObject),this.offlineAnnotationEnabled){o.group=r;let t=e.region;if(t.slice(-1)===`/`&&(t=t.slice(0,-1)),o.region=t,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],i)this.offlineAnnotations=this.offlineAnnotations.filter(e=>e.item.id!==o.item.id);else{let e=this.offlineAnnotations.find(e=>e.group===r&&e.region===o.region&&e.resource===o.resource&&e.feature.geometry.type===o.feature.geometry.type);Object.assign(e,o),this.existDrawnFeatures.push(o.feature)}sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:this._editingZincObject.region,group:r,zincObject:this._editingZincObject,deleted:!0})}}this.cancelCreate()},onTooltipHide:function(){this.createData.toBeConfirmed&&!this.annotationSidebar&&this.cancelCreate()},formatTooltip(e){if(this.timeMax>=1e3&&e){let t=(e%6e4/1e3).toFixed(2)+`s`;return(e>6e4?(e/6e4).toFixed(0)+`m `:``)+t}return e?e.toFixed(2)+` ms`:`0 ms`},fitWindow:function(){if(this.$module.scene){let e=!1;this._boundingBoxGeo&&(e=this._boundingBoxGeo.getVisibility(),this._boundingBoxGeo.setVisibility(!1)),this.$module.scene.viewAll(),this._boundingBoxGeo&&(gE(this._boundingBoxGeo,this.$module.scene),this._boundingBoxGeo.setVisibility(e))}},zoomIn:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(-1)},zoomOut:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(1)},speedChanged:function(e){this.currentSpeed=e,this.$module.setPlayRate(this.defaultRate*this.currentSpeed)},stopFreeSpin:function(){this.$module.scene.getZincCameraControls().stopAutoTumble(),this.isTransitioning=!1},findObjectsWithGroupName:function(e){let t=[];return e&&e!=``&&this.$module.scene&&(t=this.$module.scene.findObjectsWithGroupName(e)),t},toggleDrawing:function(e,t){this.createData.toBeDeleted=!1,e===`mode`?(this.cancelCreate(),this.activeDrawMode=t,this.createData.shape=``,this.$module.selectObjectOnPick=!0):e===`tool`&&(this.activeDrawTool=t,this.createData.renaming=!1,this.createData.shape=this.activeDrawTool?this.activeDrawTool:``,this.$module.selectObjectOnPick=!1)},toggleDrawingBox:function(){this.createData.drawingBox=!this.createData.drawingBox},viewRegion:function(e){let t=vE(this.$module.scene.getRootRegion(),Array.isArray(e)?e:[e],``,!0),n=this.$module.scene.getBoundingBoxOfZincObjects(t);if(n){if(this.$module.isSyncControl())this.$module.setSyncControlZoomToBox(n);else{let e=this.$module.scene.camera.far-this.$module.scene.camera.near;this.$module.scene.viewAllWithBoundingBox(n),this.$module.scene.camera.far=this.$module.scene.camera.near+e,this.$module.scene.camera.updateProjectionMatrix()}return!0}return!1},setFocusedRegion:function(e){e&&(this.isReady?this.viewRegion(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({region:e})))},setRotationMode:function(e){this.$module.scene&&this.$module.scene.getZincCameraControls().setRotationMode(e)},updateViewURL:function(e){if(e){if(this.isReady){let t=new URL(e,this.url);this.$module.scene.loadViewURL(t)}else this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewURL:e}))}},createEditTemporaryPoint:function(e){let t=e[0].extraData.worldCoords;if(t&&(this.createData.shape===`Point`||this.createData.editingIndex>-1)&&this.createData.points.length===0){if(this.showRegionTooltipWithAnnotations(e,!1,!1),this.tData.x=50,this.tData.y=200,this._tempPoint){let e=this._tempPoint.geometry.getAttribute(`position`);e.setXYZ(0,t[0],t[1],t[2]),e.needsUpdate=!0}else this._tempPoint=this.$module.scene.addTemporaryPoints([t],65535)}},createEditTemporaryLines:function(e){let t=e[0].extraData.worldCoords;if(t&&(this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1)&&this.createData.points.length===1){if(this.showRegionTooltipWithAnnotations(e,!1,!1),this._tempLine){let e=this._tempLine.geometry.getAttribute(`position`);e.setXYZ(1,t[0],t[1],t[2]),e.needsUpdate=!0}else this._tempLine=this.$module.scene.addTemporaryLines([this.createData.points[0],t],65535)}},createEditTemporaryPrimitive:function(e){this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1?this.createEditTemporaryLines(e):(this.createData.shape===`Point`||this.createData.editingIndex>-1)&&this.createEditTemporaryPoint(e)},draw:function(e){e&&e.length>0&&e[0].data.group&&e[0].extraData.worldCoords&&(this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1?this.drawLine(e[0].extraData.worldCoords,e):(this.createData.shape===`Point`||this.createData.editingIndex>-1&&this.createData.faceIndex===-1)&&this.drawPoint(e[0].extraData.worldCoords,e))},drawPoint:function(e,t){this.createData.toBeConfirmed===!1&&(this.createData.points.length=0,this.createData.points.push(e),this.createData.editingIndex===-1&&!this.createData.renaming&&(this.createData.tempGroupName=void 0),this.createData.toBeConfirmed=!0,this.showRegionTooltipWithAnnotations(t,!1,!1),this.tData.x=50,this.tData.y=200,this._tempPoint||=this.$module.scene.addTemporaryPoints([e],16776960))},drawLine:function(e,t){this.createData.toBeConfirmed===!1&&(this.createData.points.length===1?(this.createData.points.push(e),this.createData.editingIndex===-1&&!this.createData.renaming&&(this.createData.tempGroupName=void 0),this.createData.toBeConfirmed=!0,this.showRegionTooltipWithAnnotations(t,!1,!1),this.tData.x=50,this.tData.y=200):(this._tempPoint=this.$module.scene.addTemporaryPoints([e],16776960),this.createData.points.push(e)))},getRendererInfo:function(){if(this.$module.zincRenderer)return this.$module.zincRenderer.getThreeJSRenderer().info},freeSpin:function(){if(this.$module.scene){let e=this.$module.scene.getZincCameraControls();this.isTransitioning=!0,e.enableAutoTumble(),e.autoTumble([1,0],Math.PI,!0),setTimeout(this.stopFreeSpin,4e3)}},activateDeleteMode:function(e){let t=uE(e);if(t){let n=lE(e),r=n?.index===void 0?-1:n.index;this._editingZincObject=t,this.createData.faceIndex=-1,this.createData.editingIndex=r,this.createData.renaming=!1,this.createData.tempGroupName=this._editingZincObject.groupName,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.toBeConfirmed=!0,this.createData.toBeDeleted=!0,this.tData.x=50,this.tData.y=200}},activateEditingMode:function(e){let t=lE(e);t?this.activatePointEditingMode(t.zincObject,t.index,t.point):(t=dE(e),t&&this.activateLineEditingMode(t.zincObject,t.faceIndex,t.vertexIndex,t.point))},activateRenamingMode:function(e){let t=lE(e);t||=dE(e),t&&(this._editingZincObject=t.zincObject,this.createData.faceIndex=-1,this.createData.editingIndex=-1,this.createData.renaming=!0,this.createData.tempGroupName=this._editingZincObject.groupName,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.toBeConfirmed=!0,this.createData.toBeDeleted=!1,this.showRegionTooltipWithAnnotations(e,!1,!1),this.tData.x=50,this.tData.y=200)},activateAnnotationMode:function(e,t){this.authorisedUser||this.offlineAnnotationEnabled?(this.createData.toBeDeleted=!1,this.createData.shape!==``||this.createData.editingIndex>-1?e.length>0&&t.identifiers[0].coords&&this.draw(t.identifiers):(this.activeDrawMode===`Edit`?this.activateEditingMode(t.identifiers):this.activeDrawMode===`Delete`&&this.activateDeleteMode(t.identifiers),this.activeDrawMode!==`Point`&&this.activeDrawMode!==`LineString`?this.showRegionTooltipWithAnnotations(t.identifiers,!0,!1):this.showRegionTooltipWithAnnotations(t.identifiers,!0,!0))):this.showRegionTooltipWithAnnotations(t.identifiers,!0,!0)},activatePointEditingMode:function(e,t,n){this._editingZincObject=e,this.createData.faceIndex=-1,this.createData.renaming=!1,this.createData.toBeDeleted=!1,this.createData.editingIndex=t,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.tempGroupName=this._editingZincObject.groupName},activateLineEditingMode:function(e,t,n,r){this._editingZincObject=e,this.createData.faceIndex=t,this.createData.renaming=!1,this.createData.toBeDeleted=!1,this.createData.editingIndex=n,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.tempGroupName=this._editingZincObject.groupName,this.drawLine(r,void 0)},eventNotifierCallback:function(e){if(!(this.createData.toBeConfirmed||this.createData.toBeDeleted)){let t=[],n=[];(e.eventType==1||e.eventType==2)&&(e.identifiers.forEach(e=>{if(e){let n=e.data.id?e.data.id:e.data.group;t.push(n)}}),n=e.zincObjects);let r,i;if(e.identifiers.length>0&&e.identifiers[0]&&(r=e.identifiers[0].data.id?e.identifiers[0].data.id:e.identifiers[0].data.group,e.identifiers[0].data.region&&(i=e.identifiers[0].data.region)),e.eventType==1){if(this.viewingMode===`Annotation`){this.tData.label=r,this.tData.region=i;let n=fE(e);if(this.createData.editingIndex===-1&&(this._editingZincObject=n),n){let e=this._editingZincObject.region.getFullPath()+`/`,t=this._editingZincObject.groupName;this.annotationFeature=wE(this._editingZincObject,e,t,this.url,``).feature}this.activateAnnotationMode(t,e)}else this.$refs.scaffoldTreeControls&&(t.length>0?(this.$refs.scaffoldTreeControls.updateActiveUI(n),this.updatePrimitiveControls(n)):(this.hideRegionTooltip(),this.$refs.scaffoldTreeControls.removeActive(!1))),e.identifiers.length===1?this.lastSelected={isSearch:!1,region:i,group:e.identifiers[0].data.group}:e.identifiers.length===0&&(this.lastSelected={isSearch:!1,region:``,group:``}),this.$emit(`scaffold-selected`,e.identifiers)}else if(e.eventType==2)this.hideRegionTooltip(),this.$refs.scaffoldTreeControls&&(t.length>0?this.$refs.scaffoldTreeControls.updateHoverUI(n):this.$refs.scaffoldTreeControls.removeHover(!0)),e.identifiers.length>0&&e.identifiers[0]&&e.identifiers[0].coords&&(this.tData.active=!1,(this.viewingMode!==`Annotation`||!this.annotationSidebar)&&(this.tData.visible=!0),this.tData.label=r,this.tData.region=i,this.tData.x=e.identifiers[0].coords.x,this.tData.y=e.identifiers[0].coords.y,this.createEditTemporaryPrimitive(e.identifiers)),this.$emit(`scaffold-highlighted`,e.identifiers);else if(e.eventType==3&&e.identifiers.length>0&&e.identifiers[0]){if(e.identifiers[0].coords){let t=this.$refs.scaffoldContainer.$el.getBoundingClientRect();this.tData.x=e.identifiers[0].coords.x-t.left,this.tData.y=e.identifiers[0].coords.y-t.top}this.createEditTemporaryPrimitive(e.identifiers)}}},getCoordinatesOfSelected:function(){if(this.selectedObjects&&this.selectedObjects.length>0)return this.$module.scene.getObjectsScreenXY(this.selectedObjects)},getDynamicSelectedCoordinates:function(){return this.$module.selectedScreenCoordinates},timeChange:function(e){let t=e/this.timeMax*100;t!=this.currentTime&&this.$module.updateTime(t)},updatePrimitiveControls:function(e){(this.viewingMode===`Exploration`||this.viewingMode===`Annotation`)&&(this.selectedObjects=e,this.selectedObjects&&this.selectedObjects.length>0?this.$refs.primitiveControls.setObject(this.selectedObjects[0]):this.$refs.primitiveControls.setObject(void 0))},objectSelected:function(e,t){this.$module.isIgnorePicking()||(this.updatePrimitiveControls(e),this.$module.setSelectedByZincObjects(e,void 0,{},t))},objectHovered:function(e,t){this.hoveredObjects=e,this.$module.setHighlightedByZincObjects(e,void 0,{},t)},changeActiveByName:function(e,t,n){let r=Array.isArray(e);if(e===void 0||r&&e.length===0)this.$refs.scaffoldTreeControls.removeActive(n);else{let i=e;r||(i=[i]),this.$refs.scaffoldTreeControls.changeActiveByNames(i,t,n)}},changeHighlightedByName:function(e,t,n){let r=Array.isArray(e);if(e===void 0||r&&e.length===0)this.$refs.scaffoldTreeControls.removeHover(n);else{let i=e;r||(i=[i]),this.$refs.scaffoldTreeControls.changeHoverByNames(i,t,n)}},play:function(e){this.$module.playAnimation(e),this.isPlaying=e},setRegionCheckboxDisabled:function(e,t,n=!0){this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(e,t,n)},setHelpMode:function(e){let t=this.hoverVisibilities.length,n=t-1,r=this.hoverVisibilities[this.helpModeActiveIndex];if(r){let e=r?.refs,t=r?.ref;this.$refs[e||t]||(this.helpModeActiveIndex+=1)}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),e&&this.helpModeActiveIndex>=n&&this.$emit(`help-mode-last-item`,!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(e=>{e.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1&&setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}),this.showHelpText(this.helpModeActiveIndex,200)},300):(this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}))},displayTooltipOfObjectsCallback:function(e,t,n,r,i){let a=this;return function(){a.$module.zincRenderer.removePostRenderCallbackFunction(a.$_regionTooltipCallback),a.$_regionTooltipCallback=void 0,a.displayTooltipOfObjects(e,t,n,r,i)}},liveUpdateTooltipPosition:function(){this.$module.selectedCenter&&(this.tData.x=this.$module.selectedScreenCoordinates.x,this.tData.y=this.$module.selectedScreenCoordinates.y)},displayTooltipOfObjects:function(e,t,n,r,i){if(t.length>0){let a=t[0].getClosestVertexDOMElementCoords(this.$module.scene);if(a)return a.inView?(e.includes(`Search Results for`)?this.tData.active=!1:this.tData.active=!0,this.tData.visible=!0,this.tData.label=e,this.tData.x=a.position.x,this.tData.y=a.position.y,this.tData.region=n,this.$_liveCoordinatesUpdated&&=(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),void 0),i&&(this.$module.setupLiveCoordinates(t),this.$_liveCoordinatesUpdated=this.$module.zincRenderer.addPostRenderCallbackFunction(this.liveUpdateTooltipPosition))):r&&(this.hideRegionTooltip(),this.$module.scene.viewAll(),this.$_regionTooltipCallback&&(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_regionTooltipCallback),this.$module.$_regionTooltipCallback=void 0),this.$_regionTooltipCallback=this.$module.zincRenderer.addPostRenderCallbackFunction(this.displayTooltipOfObjectsCallback(e,t,n,r,i))),!0}return this.hideRegionTooltip(),!1},showRegionTooltipWithObjects:function(e,t,n,r,i){return e&&t&&t.length>0&&this.$module.scene?this.displayTooltipOfObjects(e,t,n,r,i):(this.hideRegionTooltip(),!1)},showRegionTooltip:function(e,t,n){if(e&&this.$module.scene){let r=vE(this.$module.scene.getRootRegion(),[e],``,!0),i;return r&&r.length>0&&(i=r[0].getRegion().getFullPath()),this.showRegionTooltipWithObjects(e,r,i,t,n)}return this.hideRegionTooltip(),!1},showRegionTooltipWithAnnotations:function(e,t,n){if(this.$module.scene){let r=SE(this.$module.scene,e);if(this._editingZincObject&&(r.regionPath=this._editingZincObject.region.getFullPath()+`/`,r.label=this._editingZincObject.groupName),r&&r.objects.length>0){if(this.annotationSidebar){let e=[{featureId:(this.tData.region?this.tData.region+`/`:``)+this.tData.label,resourceId:this.url,resource:this.url,feature:this.annotationFeature,offline:this.offlineAnnotationEnabled}];this.$emit(`annotation-open`,{annotationEntry:e,createData:this.createData,confirmCreate:this.confirmCreate,cancelCreate:this.cancelCreate,confirmDelete:this.confirmDelete,confirmComment:this.confirmComment});return}return this.showRegionTooltipWithObjects(r.label,r.objects,r.regionPath,t,n)}}return this.hideRegionTooltip(),!1},clearAnnotationFeature:function(){let e=this.getOfflineAnnotations();this.existDrawnFeatures.map(e=>decodeURIComponent(e.id).split(`/`).pop()).forEach(e=>{let t=this.$module.scene.findObjectsWithGroupName(e,!1);if(t&&t.length){let e=t[0].region.getFullPath()+`/`;this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(t[0])}}),this.$refs.scaffoldTreeControls.removeRegion(`__annotation`),this.offlineAnnotations=e},addAnnotationFeature:async function(){let e;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],e=this.offlineAnnotations.filter(e=>e.resource===this.url&&e.feature.properties.drawn).map(e=>e.feature);else{e=[];let t=await EE(this.annotator,this.userToken,this.url);t&&t.features&&(e=[...t.features]);let n=await EE(this.annotator,this.userToken,encodeURIComponent(this.url));n&&n.features&&(e=[...e,...n.features])}this.existDrawnFeatures=(0,t.markRaw)(e),DE(this.$module.scene,e)},changeViewingMode:function(e){let t=!0;this.$module&&(e&&(this.viewingMode=e),this.clearAnnotationFeature(),this.viewingMode===`Annotation`?(this.loading=!0,this.annotator.authenticate(this.userToken).then(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.addAnnotationFeature(),this.loading=!1})):this.viewingMode===`Exploration`?(this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.createData.shape=``):this.viewingMode===`Neuron Connection`&&(t=!1),this.viewingMode===`Exploration`||this.viewingMode===`Neuron Connection`||this.viewingMode===`Annotation`&&this.createData.shape===``?this.$module.selectObjectOnPick=!0:this.$module.selectObjectOnPick=!1,this.cancelCreate(),e&&this.setObjectIsPickable(t))},emitOfflineAnnotationUpdate:function(){this.$emit(`update-offline-annotation-enabled`,this.offlineAnnotationEnabled)},forceContextRestore:function(){this.$module.zincRenderer.forceContextRestore()},forceContextLoss:function(){this.$module.zincRenderer.forceContextLoss()},hideRegionTooltip:function(){this.$_liveCoordinatesUpdated&&=(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),this.$module.setupLiveCoordinates(void 0),void 0),this.tData.active=!1,this.tData.visible=!1,this.tData.region=void 0},setObjectIsPickable:function(e){this.$module.scene.getRootRegion().getAllObjects(!0).forEach(t=>{!t.userData?.isNerves&&!t.anatomicalId&&t.setIsPickable(e)})},setGreyScale:function(e,t=[]){this.$module.scene.getRootRegion().getAllObjects(!0).forEach(n=>{let r=n.groupName.toLowerCase(),i=n.userData?.isNerves;(t.length>0&&i&&!t.includes(r)||t.length===0&&!i)&&(n.setGreyScale(e),n.userData.isGreyScale=e)}),this.$refs.scaffoldTreeControls.updateAllNodeColours()},setColour:function(e,t=!1){this.isReady&&this.$module.scene&&typeof e==`boolean`&&(t||e!==this.colourRadio)&&(this.loading=!0,setTimeout(()=>{this.setGreyScale(!e),this.loading=!1,this.colourRadio=e},100))},setOutlines:function(e,t=!1){this.isReady&&this.$module.scene&&typeof e==`boolean`&&(t||e!==this.outlinesRadio)&&(this.outlinesRadio=e,this.$nextTick(()=>this.$refs.scaffoldTreeControls.setOutlines(e)))},setMarkerModeForObjectsWithName:function(e,t,n){if(e&&this.$module.scene){let r=t;typeof t==`number`&&(r={number:t,imgURL:void 0}),vE(this.$module.scene.getRootRegion(),[e],``,!0).forEach(e=>e.setMarkerMode(n,r))}},setMarkerModeWithAnnotations:function(e,t){if(this.$module.scene){let n=SE(this.$module.scene,e);n&&n.objects.length>0&&n.objects.forEach(e=>e.setMarkerMode(t))}},showHelpText:function(e,t=500){this.inHelp||(clearTimeout(this.helpTextWait[e]),this.helpTextWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit(`shown-tooltip`)},t))},hideHelpText:function(e,t=500){this.inHelp||(clearTimeout(this.helpTextWait[e]),this.helpTextWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},search:function(e,t){if(this.$_searchIndex){if(e===void 0||e===``||Array.isArray(e)&&e.length===0)return this.lastSelected={region:``,group:``,isSearch:!0},this.objectSelected([],!0),!1;{this.lastSelected={region:``,group:e,isSearch:!0};let n=this.$_searchIndex.searchAndProcessResult(e),r=n.zincObjects;if(r.length>0){if(this.objectSelected(r,!0),t)for(let e=0;e<r.length;e++)r[e]&&r[e].groupName&&this.showRegionTooltipWithObjects(n.label,r,n.regionPath,!0,!0);return!0}this.objectSelected([],!0)}}return!1},fetchSuggestions:function(e){return this.$_searchIndex===void 0?[]:this.$_searchIndex.auto_suggest(e)},updateMinimapScissor:function(){Object.keys(this.minimapSettings).forEach(e=>{this.$module.scene.minimapScissor[e]=this.minimapSettings[e]}),this.$module.scene.minimapScissor.updateRequired=!0},updateSettingsfromScene:function(){this.currentSpeed=1,this.$module.setPlayRate(this.defaultRate),this.orginalDuration=this.$module.scene.getMetadataTag(`OriginalDuration`),this.animateDuration=this.$module.scene.getMetadataTag(`Duration`);let e=this.$module.scene.getMetadataTag(`TimeStamps`);this.timeStamps={};for(let t in e)this.timeStamps[e[t]]=t;this.timeMax=this.$module.scene.getDuration()},restoreSettings:function(e){if(e){if(e.viewport)this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport);else if(e.viewURL&&e.viewURL!==``){let t=new URL(e.viewURL,this.url);this.$module.scene.loadViewURL(t)}else e.region&&e.region!==``&&this.viewRegion(e.region);e.visibility&&this.$nextTick(()=>{this.$refs.scaffoldTreeControls.setState(e.visibility)}),e.background&&this.backgroundChangeCallback(e.background),`colour`in e&&this.setColour(e.colour),e.offlineAnnotations&&sessionStorage.setItem(`anonymous-annotation`,e.offlineAnnotations),`outlines`in e&&this.setOutlines(e.outlines),e.viewingMode&&this.changeViewingMode(e.viewingMode);let t=e.search;t&&t.group&&(t.isSearch?this.search(t.group,!0):this.changeActiveByName(t.group,t.region,!0))}},calculateBoundingBox:function(){if(this.isReady){let{centre:e,size:t}=this.$module.getCentreAndSize();this.boundingDims.centre=e,this.boundingDims.size=t}},downloadErrorCallback:function(){return e=>{this.$emit(`on-error`,e)}},setURLFinishCallback:function(e){return()=>{this.offlineAnnotations.length=0,this.updateSettingsfromScene(),this.$module.updateTime(.01),this.$module.updateTime(0),this.$module.unsetFinishDownloadCallback(),this.addRegionsToSearchIndex(),this.setMarkers(),this._boundingBoxGeo=this.$module.scene.addBoundingBoxPrimitive(`_helper`,`boundingBox`,4251856,.15),this._slides=this.$module.scene.addSlicesPrimitive(`_helper`,[`x-plane`,`y-plane`,`z-plane`],[16733525,5635925,5592575],.5),this.isReady=!0,this.calculateBoundingBox(),this.$nextTick(()=>{this.restoreSettings(e),this.$emit(`on-ready`)})}},getState:function(){let e={format:this.fileFormat,url:this._currentURL,viewport:void 0,visibility:void 0,background:this.currentBackground,colour:this.colourRadio,outlines:this.outlinesRadio,viewingMode:this.viewingMode,usageConfig:this.usageConfig};return this.$refs.scaffoldTreeControls&&(e.visibility=this.$refs.scaffoldTreeControls.getState()),this.$module.scene&&(e.viewport=this.$module.scene.getZincCameraControls().getCurrentViewport()),this.lastSelected&&this.lastSelected.group&&(e.search={...this.lastSelected}),this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem(`anonymous-annotation`)),e},setState:function(e){e&&(e.url&&e.url!==this._currentURL?this.setURLAndState(e.url,{fileFormat:e.fileFormat,viewport:e.viewport,visibility:e.visibility,background:e.background,colour:e.colour,outlines:e.outlines,viewingMode:e.viewingMode,search:e.search,offlineAnnotations:e.offlineAnnotations}):(e.background||e.colour||e.search||e.outlines||e.viewport||e.viewingMode||e.visibility)&&(this.isReady&&this.$module.scene?this.restoreSettings(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({background:e.background,colour:e.colour,search:e.search,offlineAnnotations:e.offlineAnnotations,outlines:e.outlines,viewingMode:e.viewingMode,viewport:e.viewport,visibility:e.visibility}))))},exportGLTF:function(e){return this.$module.scene.exportGLTF(e)},getOfflineAnnotations:function(){return[...this.offlineAnnotations]},importOfflineAnnotations:function(e){if(this.offlineAnnotationEnabled){e.forEach(e=>{let t=e.group,n=e.region,r=n.slice(-1)===`/`?n:n+`/`;e.region=r.slice(0,-1),r+=t;let i=r;e.item.id=i,e.feature.id=i});let t=e.map(e=>e.feature);DE(this.$module.scene,t),e.forEach(e=>{this.offlineAnnotations.push({...e})}),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}},setURLAndState:function(e,t){if(e!=this._currentURL){let n={};t?.format&&(this.fileFormat=t.format),this._currentURL=e,this.$refs.scaffoldTreeControls&&this.$refs.scaffoldTreeControls.clear(),this.loading=!0,this.timeVarying=!1,this.isReady=!1,this.$_searchIndex.removeAll(),this.hideRegionTooltip(),this.$module.setDownloadErrorCallback(this.downloadErrorCallback()),this.$module.setFinishDownloadCallback(this.setURLFinishCallback({background:t?.background,colour:t?.colour,outlines:t?.outlines,region:this.region,search:t?.search,viewingMode:t?.viewingMode,viewURL:this.viewURL,viewport:t?.viewport,visibility:t?.visibility,offlineAnnotations:t?.offlineAnnotations})),this.fileFormat===`gltf`?this.$module.loadGLTFFromURL(e,`scene`,!0):((this?.usageConfig?.tubeLines||t?.usageConfig?.tubeLines)&&(n.tubeLines=!0),this.$module.loadOrgansFromURL(e,void 0,void 0,`scene`,void 0,!0,n)),this.$module&&this.$module.scene&&(this.$module.scene.displayMarkers=this.displayMarkers,this.$module.scene.forcePickableObjectsUpdate=!0,this.$module.scene.displayMinimap=this.displayMinimap,this.updateMinimapScissor())}},setURL:function(e){this.setURLAndState(e,void 0)},drawerToggled:function(e){this.drawerOpen=e,this.adjustLayout()},adjustLayout:function(){if(this.$refs.scaffoldContainer?.$el){let e=this.$refs.scaffoldContainer.$el.clientWidth;this.clientHeight=this.$refs.scaffoldContainer.$el.clientHeight,this.minimisedSlider=e<812,this.sliderPosition=this.minimisedSlider?this.drawerOpen?`right`:`left`:``}},toggleRendering:function(e){this.$module.zincRenderer&&(e?(this.forceContextRestore(),this.$module.zincRenderer.animate()):(this.$module.zincRenderer.stopAnimate(),this.forceContextLoss()))},forceResize:function(){this.$module.zincRenderer&&this.$module.zincRenderer.onWindowResize()},syncControlCallback:function(){let e=this.$module.NDCCameraControl.getPanZoom();this.tData.visible&&this.showRegionTooltip(this.tData.label,!0,!0),this.$emit(`scaffold-navigated`,e)},toggleSyncControl:function(e,t){this.$module.toggleSyncControl(e,t),this.$module.setSyncControlCallback(this.syncControlCallback)},setMarkers:function(){for(let[e,t]of Object.entries(this.markerLabels))this.setMarkerModeForObjectsWithName(e,t,`on`)},readNIFTIFromSource:async function(e,t,n,r,i){return await uD(e,t,n,r,i)}}},bO={class:`animation-data`},xO={class:`purple`},SO={class:`animation-data`},CO={class:`purple`},wO={class:`animation-data`},TO={class:`bottom-right-control control-layer`},EO={class:`control-layer`},DO={class:`viewing-mode-container`},OO={style:{"margin-bottom":`2px`}},kO={key:0,class:`viewing-mode-title`},AO=[`onClick`],jO={class:`colour-radio-container`},MO={class:`outlines-radio-container`},NO={class:`background-colour-container`},PO=[`onClick`];function FO(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`map-svg-sprite-color`),c=lD,l=(0,t.resolveComponent)(`DrawToolbar`),u=Jd,d=Qd,f=r_,p=rD,m=NE,h=(0,t.resolveComponent)(`map-svg-icon`),g=C_,_=mg,v=U_,y=kh,b=Oh,x=H_,S=Km,C=lg,w=ug,T=cv,E=ev;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(T,{ref:`scaffoldContainer`,class:`scaffold-container`,"element-loading-text":`Loading...`,"element-loading-background":`rgba(0, 0, 0, 0.3)`,positionalRotation:r.positionalRotation,onOnRotationModeChange:o.setRotationMode},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s),(0,t.createVNode)(c,{createData:e.createData,label:e.tData.label,region:e.tData.region,visible:e.tData.visible,x:e.tData.x,y:e.tData.y,annotationDisplay:o.annotationDisplay,annotationFeature:e.annotationFeature,offlineAnnotationEnabled:e.offlineAnnotationEnabled,onConfirmCreate:n[0]||=e=>o.confirmCreate(e),onCancelCreate:n[1]||=e=>o.cancelCreate(),onConfirmComment:n[2]||=e=>o.confirmComment(e),onTooltipHide:n[3]||=e=>o.onTooltipHide(),onCreateGroupSuggestions:n[4]||=t=>e.$emit(`create-group-suggestions`,t),onCreateRegionSuggestions:n[5]||=t=>e.$emit(`create-region-suggestions`,t)},null,8,[`createData`,`label`,`region`,`visible`,`x`,`y`,`annotationDisplay`,`annotationFeature`,`offlineAnnotationEnabled`]),(0,t.createElementVNode)(`div`,{id:`organsDisplayArea`,ref:`display`,tabindex:`-1`,style:{height:`100%`,width:`100%`},onKeydown:n[6]||=(0,t.withKeys)((...e)=>o.backgroundChangeCallback&&o.backgroundChangeCallback(...e),[`66`])},null,544),(0,t.withDirectives)((0,t.createElementVNode)(`div`,null,[e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,class:`control-layer`,toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,hoverVisibilities:e.hoverVisibilities,onClickToolbar:o.toggleDrawing,onShowTooltip:o.showHelpText,onHideTooltip:o.hideHelpText,ref:`toolbarPopover`},null,8,[`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`hoverVisibilities`,`onClickToolbar`,`onShowTooltip`,`onHideTooltip`])):(0,t.createCommentVNode)(``,!0),r.displayWarning?((0,t.openBlock)(),(0,t.createBlock)(f,{key:1,ref:`warningPopover`,visible:e.hoverVisibilities[7].value,content:r.warningMessage,placement:`right`,width:`max-content`,teleported:!1,"popper-class":`scaffold-popper message-popper right-popper non-selectable`},{reference:(0,t.withCtx)(()=>[r.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`message-icon warning-icon control-layer`,onMouseover:n[7]||=e=>o.showHelpText(7),onMouseout:n[8]||=e=>o.hideHelpText(7)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),n[33]||=(0,t.createElementVNode)(`span`,{class:`message-text`},`Beta`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`,`content`])):(0,t.createCommentVNode)(``,!0),r.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,visible:e.hoverVisibilities[8].value,content:r.latestChangesMessage,placement:`right`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper message-popper right-popper non-selectable`,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[r.displayLatestChanges&&r.latestChangesMessage?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`el-icon-warning message-icon latest-changesicon control-layer`,onMouseover:n[9]||=e=>o.showHelpText(8),onMouseout:n[10]||=e=>o.hideHelpText(8)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),n[34]||=(0,t.createElementVNode)(`span`,{class:`message-text`},`What's new?`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`,`content`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{visible:e.hoverVisibilities[6].value,content:`Change region visibility`,placement:`right`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`regionVisibilityPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{class:`control-layer`,ref:`scaffoldTreeControls`,isReady:e.isReady,containerHeight:e.clientHeight,"show-colour-picker":o.enableColourPicker,onObjectSelected:o.objectSelected,onObjectHovered:o.objectHovered,onDrawerToggled:o.drawerToggled,onCheckChanged:n[11]||=t=>e.$emit(`check-changed`,t)},{treeSlot:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`treeSlot`,{},void 0,!0),(0,t.createVNode)(p,{class:`control-layer`,ref:`primitiveControls`,createData:e.createData,viewingMode:e.viewingMode,usageConfig:r.usageConfig,onPrimitivesUpdated:o.primitivesUpdated},null,8,[`createData`,`viewingMode`,`usageConfig`,`onPrimitivesUpdated`])]),_:3},8,[`isReady`,`containerHeight`,`show-colour-picker`,`onObjectSelected`,`onObjectHovered`,`onDrawerToggled`])]),_:3},8,[`visible`]),e.timeVarying?((0,t.openBlock)(),(0,t.createBlock)(f,{key:3,ref:`sliderPopover`,width:`max-content`,visible:e.hoverVisibilities[5].value,content:`Move the slider to animate the region`,placement:`top`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper top-popper non-selectable`},{reference:(0,t.withCtx)(()=>[e.timeVarying?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`time-slider-container control-layer`,[e.minimisedSlider?`minimised`:``,e.sliderPosition]])},[(0,t.createVNode)(x,{type:`card`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(v,{label:`Animate scaffold`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`tab-content`},{default:(0,t.withCtx)(()=>[e.isPlaying?((0,t.openBlock)(),(0,t.createBlock)(h,{key:0,icon:`pause`,class:`icon-button video-button`,onClick:n[12]||=e=>o.play(!1)})):((0,t.openBlock)(),(0,t.createBlock)(h,{key:1,icon:`play`,class:`video-button icon-button`,onClick:n[13]||=e=>o.play(!0)})),(0,t.createVNode)(g,{min:0,max:e.timeMax,"model-value":e.currentTime/100*e.timeMax,step:.1,"tooltip-class":`time-slider-tooltip`,class:`slider`,"format-tooltip":o.formatTooltip,marks:e.timeStamps,onInput:n[14]||=e=>o.timeChange(e)},null,8,[`max`,`model-value`,`format-tooltip`,`marks`])]),_:1})]),_:1}),(0,t.createVNode)(v,{label:`Animation data`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`tab-content`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,bO,[n[35]||=(0,t.createTextVNode)(` Original duration: `,-1),(0,t.createElementVNode)(`div`,xO,(0,t.toDisplayString)(e.orginalDuration),1)]),(0,t.createElementVNode)(`div`,SO,[n[36]||=(0,t.createTextVNode)(` Animation duration: `,-1),(0,t.createElementVNode)(`div`,CO,(0,t.toDisplayString)(e.animateDuration),1)]),(0,t.createElementVNode)(`div`,wO,[n[37]||=(0,t.createTextVNode)(` Playback speed `,-1),(0,t.createVNode)(b,{teleported:!0,"model-value":e.currentSpeed,placeholder:`Select`,class:`scaffold-select-box speed`,"popper-class":`scaffold_viewer_dropdown`,onChange:n[15]||=e=>o.speedChanged(e)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.playSpeed,e=>((0,t.openBlock)(),(0,t.createBlock)(y,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`])])]),_:1})]),_:1})]),_:1})],2)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,TO,[(0,t.createVNode)(f,{visible:e.hoverVisibilities[0].value,content:`Zoom in`,width:`max-content`,placement:`left`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper left-popper non-selectable`,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`zoomIn`,class:`icon-button zoomIn`,onClick:n[16]||=e=>o.zoomIn(),onMouseover:n[17]||=e=>o.showHelpText(0),onMouseout:n[18]||=e=>o.hideHelpText(0)})]),_:1},8,[`visible`]),(0,t.createVNode)(f,{visible:e.hoverVisibilities[1].value,content:`Zoom out`,placement:`top-end`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper popper-zoomout non-selectable`,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`zoomOut`,class:`icon-button zoomOut`,onClick:n[19]||=e=>o.zoomOut(),onMouseover:n[20]||=e=>o.showHelpText(1),onMouseout:n[21]||=e=>o.hideHelpText(1)})]),_:1},8,[`visible`]),(0,t.createVNode)(f,{visible:e.hoverVisibilities[2].value,placement:`top`,teleported:!1,trigger:`manual`,width:`max-content`,"popper-class":`scaffold-popper non-selectable`,ref:`zoomFitPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`fitWindow`,class:`icon-button fitWindow`,onClick:n[22]||=e=>o.fitWindow(),onMouseover:n[23]||=e=>o.showHelpText(2),onMouseout:n[24]||=e=>o.hideHelpText(2)})]),default:(0,t.withCtx)(()=>[n[38]||=(0,t.createElementVNode)(`div`,null,[(0,t.createTextVNode)(` Fit to `),(0,t.createElementVNode)(`br`),(0,t.createTextVNode)(` window `)],-1)]),_:1},8,[`visible`])]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:4,ref:`open-map-popover`,"virtual-ref":e.openMapRef,placement:`top-start`,width:`128`,teleported:!1,trigger:`click`,"popper-class":`open-map-popper`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(_,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper non-selectable h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,EO,[(0,t.createElementVNode)(`div`,DO,[(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[39]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,OO,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,kO,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>o.changeViewingMode(r)},(0,t.toDisplayString)(r),9,AO))],64))),128))]),(0,t.createVNode)(_,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(o.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(_,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...n[40]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1})]),(0,t.createElementVNode)(`div`,jO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[41]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{modelValue:e.colourRadio,"onUpdate:modelValue":n[25]||=t=>e.colourRadio=t,class:`scaffold-radio`,onChange:n[26]||=t=>o.setColour(e.colourRadio,!0)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(C,{value:!0},{default:(0,t.withCtx)(()=>[...n[42]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(C,{value:!1},{default:(0,t.withCtx)(()=>[...n[43]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1})]),(0,t.createElementVNode)(`div`,MO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[44]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{modelValue:e.outlinesRadio,"onUpdate:modelValue":n[27]||=t=>e.outlinesRadio=t,class:`scaffold-radio`,onChange:n[28]||=t=>o.setOutlines(e.outlinesRadio,!0)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(C,{value:!0},{default:(0,t.withCtx)(()=>[...n[45]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(C,{value:!1},{default:(0,t.withCtx)(()=>[...n[46]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1})]),(0,t.createElementVNode)(`div`,NO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[47]||=[(0,t.createTextVNode)(` Change background `,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundChooser`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>o.backgroundChangeCallback(n)},null,10,PO))),128))]),_:1})])])]),_:1},8,[`virtual-ref`]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group control-layer`,{open:e.drawerOpen,close:!e.drawerOpen}])},[r.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(_,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[3].value,content:`Open new map`,placement:`right`,teleported:!1,trigger:`manual`,width:`max-content`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[r.enableOpenMapUI&&r.openMapOptions.length>0?((0,t.openBlock)(),(0,t.createBlock)(h,{key:0,ref:`openMapRef`,icon:`openMap`,class:`icon-button open-map-button`,onMouseover:n[29]||=e=>o.showHelpText(3),onMouseout:n[30]||=e=>o.hideHelpText(3)},null,512)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0),r.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[4].value,content:`Change background color`,placement:`right`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{ref:`backgroundIconRef`,icon:`changeBckgd`,class:`icon-button`,onMouseover:n[31]||=e=>o.showHelpText(4),onMouseout:n[32]||=e=>o.hideHelpText(4)},null,512)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2)],512),[[t.vShow,r.displayUI&&!e.isTransitioning]])]),_:3},8,[`positionalRotation`,`onOnRotationModeChange`])),[[E,e.loading]])}e.ScaffoldVuer=nv(yO,[[`render`,FO],[`__scopeId`,`data-v-ab0848e7`]])});
4661
+ `,t}getExtensionLocation=function(){return e.MAGIC_COOKIE+4};getExtensionSize=Vn.prototype.getExtensionSize;getExtensionCode=Vn.prototype.getExtensionCode;addExtension=Vn.prototype.addExtension;removeExtension=Vn.prototype.removeExtension;getDatatypeCodeString=Vn.prototype.getDatatypeCodeString;getTransformCodeString=Vn.prototype.getTransformCodeString;getUnitsCodeString=Vn.prototype.getUnitsCodeString;getQformMat=Vn.prototype.getQformMat;convertNiftiQFormToNiftiSForm=Vn.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=Vn.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=Vn.prototype.nifti_mat33_mul;nifti_mat33_determ=Vn.prototype.nifti_mat33_determ;toArrayBuffer(e=!1){let t=544;if(e)for(let e of this.extensions)t+=e.esize;let n=new Uint8Array(t),r=new DataView(n.buffer);r.setInt32(0,540,this.littleEndian),n.set(new TextEncoder().encode(this.magic),4),r.setInt16(12,this.datatypeCode,this.littleEndian),r.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let e=0;e<8;e++)r.setBigInt64(16+8*e,BigInt(this.dims[e]),this.littleEndian);r.setFloat64(80,this.intent_p1,this.littleEndian),r.setFloat64(88,this.intent_p2,this.littleEndian),r.setFloat64(96,this.intent_p3,this.littleEndian);for(let e=0;e<8;e++)r.setFloat64(104+8*e,this.pixDims[e],this.littleEndian);r.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),r.setFloat64(176,this.scl_slope,this.littleEndian),r.setFloat64(184,this.scl_inter,this.littleEndian),r.setFloat64(192,this.cal_max,this.littleEndian),r.setFloat64(200,this.cal_min,this.littleEndian),r.setFloat64(208,this.slice_duration,this.littleEndian),r.setFloat64(216,this.toffset,this.littleEndian),r.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),r.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),n.set(new TextEncoder().encode(this.description),240),n.set(new TextEncoder().encode(this.aux_file),320),r.setInt32(344,this.qform_code,this.littleEndian),r.setInt32(348,this.sform_code,this.littleEndian),r.setFloat64(352,this.quatern_b,this.littleEndian),r.setFloat64(360,this.quatern_c,this.littleEndian),r.setFloat64(368,this.quatern_d,this.littleEndian),r.setFloat64(376,this.qoffset_x,this.littleEndian),r.setFloat64(384,this.qoffset_y,this.littleEndian),r.setFloat64(392,this.qoffset_z,this.littleEndian);let i=this.affine.flat();for(let e=0;e<12;e++)r.setFloat64(400+8*e,i[e],this.littleEndian);if(r.setInt32(496,this.slice_code,this.littleEndian),r.setInt32(500,this.xyzt_units,this.littleEndian),r.setInt32(504,this.intent_code,this.littleEndian),n.set(new TextEncoder().encode(this.intent_name),508),r.setUint8(524,this.dim_info),e){n.set(Uint8Array.from([1,0,0,0]),540);let e=this.getExtensionLocation();for(let t of this.extensions)r.setInt32(e,t.esize,t.littleEndian),r.setInt32(e+4,t.ecode,t.littleEndian),n.set(new Uint8Array(t.edata),e+8),e+=t.esize}else n.set(new Uint8Array(4).fill(0),540);return n.buffer}};function Un(e,t=!1){var n,r,i,a;return e.byteLength<Vn.STANDARD_HEADER_SIZE?!1:(n=new DataView(e),n&&(r=n.getUint8(Vn.MAGIC_NUMBER_LOCATION)),i=n.getUint8(Vn.MAGIC_NUMBER_LOCATION+1),a=n.getUint8(Vn.MAGIC_NUMBER_LOCATION+2),t&&r===Vn.MAGIC_NUMBER2[0]&&i===Vn.MAGIC_NUMBER2[1]&&a===Vn.MAGIC_NUMBER2[2]?!0:r===Vn.MAGIC_NUMBER[0]&&i===Vn.MAGIC_NUMBER[1]&&a===Vn.MAGIC_NUMBER[2])}function Wn(e,t=!1){var n,r,i,a;return e.byteLength<Vn.STANDARD_HEADER_SIZE?!1:(n=new DataView(e),r=n.getUint8(Hn.MAGIC_NUMBER_LOCATION),i=n.getUint8(Hn.MAGIC_NUMBER_LOCATION+1),a=n.getUint8(Hn.MAGIC_NUMBER_LOCATION+2),t&&r===Hn.MAGIC_NUMBER2[0]&&i===Hn.MAGIC_NUMBER2[1]&&a===Hn.MAGIC_NUMBER2[2]?!0:r===Hn.MAGIC_NUMBER[0]&&i===Hn.MAGIC_NUMBER[1]&&a===Hn.MAGIC_NUMBER[2])}function Gn(e,t=!1){return Un(e,t)||Wn(e,t)}function Kn(e){var t,n,r;return!!(e&&(t=new DataView(e),n=t.getUint8(0),r=t.getUint8(1),n===G.GUNZIP_MAGIC_COOKIE1||r===G.GUNZIP_MAGIC_COOKIE2))}function qn(e){return(0,i.decompressSync)(new Uint8Array(e)).buffer}function Jn(e,t=!1){let n=null;if(Kn(e)&&(e=qn(e)),Un(e,t)?n=new Vn:Wn(e,t)&&(n=new Hn),n)n.readHeader(e);else throw Error(`That file does not appear to be NIFTI!`);return n}function Yn(e,t){var n=e.vox_offset,r=1,i=1;e.dims[4]&&(r=e.dims[4]),e.dims[5]&&(i=e.dims[5]);var a=e.dims[1]*e.dims[2]*e.dims[3]*r*i*(e.numBitsPerVoxel/8);return t.slice(n,n+a)}var Xn={id:`mesh-location-orientation`,locations:[{identifier:1,label:`original`,orientation:[1,0,0,0,1,0,0,0,1],position:[0,0,0],scale:[1,1,1],flipY:!1,flipZ:!1,reference_point:`corner`}],settings:{slides:[{direction:`x`,value:.5},{direction:`y`,value:.5},{direction:`z`,value:.5}]},type:`slides`},Zn={hideBlackPixel:!0,keepScalePosition:!0,filterByValue:!0,timeEnabled:!1};function Qn(e){let t=Kn(e)?qn(e):e;if(Gn(t)){let e=Jn(t);return{niftiHeader:e,niftiImage:Yn(e,t)}}return t=void 0,{niftiHeader:void 0,niftiImage:void 0}}function $n(e,t){let n;switch(e.datatypeCode){case Vn.TYPE_UINT8:n=new Uint8Array(t);break;case Vn.TYPE_INT8:n=new Int8Array(t);break;case Vn.TYPE_UINT16:n=new Uint16Array(t);break;case Vn.TYPE_INT16:n=new Int16Array(t);break;case Vn.TYPE_UINT32:n=new Uint32Array(t);break;case Vn.TYPE_INT32:n=new Int32Array(t);break;case Vn.TYPE_FLOAT32:n=new Float32Array(t);break;case Vn.TYPE_FLOAT64:n=new Float64Array(t);break;default:throw Error(`Unsupported NIfTI data type`)}let r=1/0,i=-1/0,a=n.length;for(let e=0;e<a;e++){let t=n[e];t<r&&(r=t),t>i&&(i=t)}let o=new Uint8Array(a),s=i-r;for(let e=0;e<a;e++){let t=(n[e]-r)/s;t=Math.max(0,Math.min(1,t)),o[e]=Math.round(t*255)}return o}function er(e,t,n,r){if(e?.dims&&e.dims[0]===3){let i=e.dims[1],a=e.dims[2],o=e.dims[3],s=!1;(e.intent_code===1007||e.intent_code===1008||e.datatypeCode===128||e.datatypeCode===2304)&&(s=!0);let c=$n(e,t),l;if(n&&r){let e=n.dims[1],t=n.dims[2],s=n.dims[3];e===i&&t===a&&s===o&&(l=$n(n,r))}return{data:c,maskData:l,width:i,height:a,depth:o,isRGB:s}}}function tr(e,t){if(e?.affine&&e.dims){let n=e.affine,r=[0,0,0],i=[0,0,0];return r[0]=n[0][3],r[1]=n[1][3],r[2]=n[2][3],i[0]=n[0][0]*e.dims[1],i[1]=n[1][1]*e.dims[2],i[2]=n[2][2]*e.dims[3],t.keepScalePosition&&(i[0]=Math.abs(i[0]),i[1]=Math.abs(i[1]),i[2]=Math.abs(i[2])),{position:r,scale:i}}return{position:void 0,scale:void 0}}function nr(e,t){return e&&e.sform_code?tr(e,t):{position:void 0,scale:void 0}}function rr(t,n,r,i,a){let o=new e.DataArrayTexture(t,n,r,i);return o.anisotropy=4,a||(o.format=e.RedFormat),o.minFilter=e.NearestFilter,o.magFilter=e.NearestFilter,o.needsUpdate=!0,o}function ir(e){if(e?.data){let t=new Ye;return t.impl=new rr(e.data,e.width,e.height,e.depth),t.size={width:e.width,height:e.height,depth:e.depth},t.isLoading=!1,t}}function ar(e,t,n,r,i){if(t?.data){let a={...Zn};i&&Object.assign(a,i);let o=new tt,s=ir(t);if(s){o.groupName=`Images`,o.morph.renderOrder=1,o.texture=s;let i=structuredClone(Xn);if(Object.assign(i,r),n&&e){let{position:t,scale:n}=nr(e,a);t&&n&&(i.locations[0].scale=n,i.locations[0].position=t)}if(o.initialise(i,void 0),o.showEdges(10066329),t.maskData&&!a.timeEnabled){let e=rr(t.maskData,t.width,t.height,t.depth,!1);o.setMask(e)}return o.setNumberOfChannels(t.isRGB?3:1),o}}}async function or(e,t){let n,r;if(t){let e=Qn(await(await fetch(t)).arrayBuffer());n=e.niftiHeader,r=e.niftiImage}let{niftiHeader:i,niftiImage:a}=Qn(await(await fetch(e)).arrayBuffer());return{sources:er(i,a,n,r),niftiHeader:i}}async function sr(e,t,n,r,i){let a=!1,o,s=e;if(Array.isArray(e)&&(s=e[0],e.length>1&&i?.timeEnabled&&(a=!0)),typeof s==`string`){let{sources:e,niftiHeader:a}=await or(s,n,i);o=ar(a,e,t,r,i)}if(a&&o){for(let t=1;t<e.length;t++){let r=await cr(e[t],n,i);o.addTextureArray(r)}o.timeEnabled=!0}return o}async function cr(e,t,n){let{sources:r}=await or(e,t,n);return ir(r)}var lr=p.version,ur=new function(){this.Revision=lr,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.Geometry=we,this.Glyph=U,this.Glyphset=Ie,this.Pointset=Ke,this.Label=Te,this.Lines=qe,this.TextureSlides=tt,this.TextureArray=Ye,this.Renderer=zn,this.Scene=Rn,this.Viewport=nt,this.CameraControls=rt,this.SmoothCameraTransition=it,this.RayCaster=ot,this.CameraAutoTumble=st,this.StereoEffect=lt,this.loadExternalFile=T,this.loadExternalFiles=E,this.createPrimitivesFromNIFTI=sr,this.createTextureFromNIFTI=cr,this.THREE=e};return ur})}))(),1),lE={SELECTED_COLOUR:`#00ff00`,HIGHLIGHTED_COLOUR:`#ff0000`,DEFAULT_RADIUS:1,DEFAULT_RADIAL_SEGMENTS:8,ZOOM_RADIUS:5,ZOOM_RADIAL_SEGMENTS:12},uE=(e,t)=>{if(e){let n=``;e.forEach(e=>{n=e.uuid,e.region&&(n=e.region.uuid+`/`+n),e&&e.getVisibility()&&t.push(n)})}return t},dE=(e,t)=>{let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},fE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable&&t.isPointset){let n=e[0].extraData.intersected;if(n&&n.index>-1){let e=t.getVerticesByIndex(n.index);if(e)return{zincObject:t,index:n.index,point:e}}}},pE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable)return t},mE=e=>{let t=e[0].data?.zincObject;if(t&&t.isEditable&&t.isLines2){let n=e[0].extraData.intersected;if(n&&n.faceIndex>-1){let r=t.getVerticesByFaceIndex(n.faceIndex),i=e[0].extraData.intersected.pointOnLine;if(r.length>1)return dE(r[0],[i.x,i.y,i.z])>dE(r[1],[i.x,i.y,i.z])?{zincObject:t,faceIndex:n.faceIndex,vertexIndex:n.faceIndex*2+1,point:r[0]}:{zincObject:t,faceIndex:n.faceIndex,vertexIndex:n.faceIndex*2,point:r[1]}}}},hE=e=>{let t=e.zincObjects;if(t.length>0&&t[0])return t[0]},gE=(e,t,n)=>{if(e?.isEditable&&e?.isPointset){let r=!1;for(let e=0;e<3&&!r;e++)n[e]!==0&&(r=!0);if(r&&t>-1){let r=e.getVerticesByIndex(t);return r&&(r[0]+=n[0],r[1]+=n[1],r[2]+=n[2]),e.editVertices([r],t),e.boundingBoxUpdateRequired=!0,!0}}return!1},_E=(e,t)=>{if(e?.isEditable&&e?.isLines2&&t>-1){let n=e.getVerticesByFaceIndex(t);if(n&&n.length>1)return dE(n[1],n[0])}return 0},vE=(e,t,n,r)=>{if(e&&n!==0&&e.isEditable&&e.isLines2&&t>-1){let i=e.getVerticesByFaceIndex(t),a=[i[1][0]-i[0][0],i[1][1]-i[0][1],i[1][2]-i[0][2]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);for(let e=0;e<3;e++)a[e]=a[e]/o*n,r?i[1][e]=i[0][e]+a[e]:(i[0][e]=i[0][e]+a[e],i[1][e]=i[1][e]+a[e]);return e.editVertices(i,t*2),e.boundingBoxUpdateRequired=!0,!0}return!1},yE=(e,t)=>{let n=t.getBoundingBox(),r=new cE.THREE.Vector3().subVectors(n.max,n.min),i=new cE.THREE.BoxGeometry(r.x,r.y,r.z);r.addVectors(n.min,n.max).multiplyScalar(.5);let a=i.getAttribute(`position`),o=a.count,s=[];for(let e=0;e<o;e++)s[e]=[a.array[e*3],a.array[e*3+1],a.array[e*3+2]];e.editVertices(s,0),e.setPosition(r.x,r.y,r.z),i.dispose()},bE=(e,t)=>{let n=``;e.isRegion&&(n=`__r${e.regionPath}`),e.isPrimitives&&(n=`${e.regionPath}/${e.label}`),t.push(n),e.children&&e.children.forEach(e=>bE(e,t))},xE=(e,t,n,r)=>{let i=e,a=[];if(n&&(i=e.findChildFromPath(n)),i){let e=Array.isArray(t),n=t;e||(n=[n]),n.forEach(e=>{let t=i.findObjectsWithGroupName(e,r);a.push(...t)})}return a},SE=(e,t,n)=>{let r=e.findIndex(e=>e.uuid===t),i;return r>-1&&(i=e[r],n&&e.splice(r,1)),i},CE=(e,t)=>{let n=[];if(e&&t&&t.length>0){let r={},i={},a=[e,...e.getChildRegions(!0)],o,s,c;t.forEach(e=>{let t=e.split(`/`);c=t[0],o=SE(a,c,!1),o&&(i[c]||(i[c]=o.getFullPath()),t[1]?(r[c]||(r[c]=o.getAllObjects(!1)),s=SE(r[c],t[1],!0),s&&n.push(`${i[c]}/${s.groupName}`)):n.push(`__r/${i[c]}`))})}return n},wE=e=>{if(e){let t=[];return e.forEach(e=>{e.isZincObject?t.push(e):e.isRegion&&t.push(...e.getAllObjects(!0))}),Object.values(t.reduce((e,t)=>({...e,[t.uuid]:t}),{}))}return[]},TE=(e,t)=>{let n={label:`Multiple selections`,regionPath:``,objects:[]};if(t&&e){let r={},i=e.getRootRegion();t.length>0&&(n.regionPath=t[0].data.region,n.label=t[0].data.group),t.forEach(e=>{e.data.region.includes(n.regionPath)||(n.regionPath=``),n.label!==e.data.group&&(n.label=`Multiple selections`);let t=i.findChildFromPath(e.data.region);r[t.uuid]||(r[t.uuid]=t.getAllObjects(!1));let a=SE(r[t.uuid],e.data.uuid);a&&n.objects.push(a)})}return n},EE=e=>{let t=e.getMorph(),n=`position`;e.isLines2&&(n=`instanceStart`);let r=[],i=0,a=t.geometry.getAttribute(n);for(let t=0;t<e.drawRange;t++)r.push([a.array[i++],a.array[i++],a.array[i++]]);return r},DE=(e,t,n,r,i)=>{let a;a=e.isPointset?`MultiPoint`:e.isLines2?`MultiLineString`:`Feature`;let o=a!==`Feature`,s=a===`Feature`?`Feature annotation`:`Drawn annotation`;if(a){let c=EE(e),l=t.slice(-1)===`/`?t:t+`/`;l+=n;let u=l,d={resource:r,item:{id:u},body:{evidence:[],comment:i},feature:{id:u,properties:{drawn:o,label:s},geometry:{coordinates:c,type:a}}};return i===`Deleted`&&(d.feature=void 0),d}},OE=(e,t,n,r,i,a,o)=>{let s=DE(n,r,i,a,o);if(s)return e&&e.currentUser&&(s.creator={...e.currentUser},s.creator.orcid||(s.creator.orcid=`0000-0000-0000-0000`),e.addAnnotation(t,s).then(e=>{e.annotationId||console.log(`There is a problem with the submission, please try again later`)}).catch(()=>{console.log(`There is a problem with the submission, please try again later`)})),s},kE=async(e,t,n)=>{let r=n;return await e.drawnFeatures(t,r)},AE=(e,t)=>{e&&t.forEach(t=>{let n=t.geometry,r=decodeURIComponent(t.id),i=r.lastIndexOf(`/`),a=r.substring(0,i),o=r.substring(i+1),s;n.type===`MultiPoint`?s=e.createPoints(a,o,n.coordinates,o,8942):n.type===`MultiLineString`&&(s=e.createLines(a,o,n.coordinates,60962)),s&&(s.zincObject.isEditable=!0)})},jE=function(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].userData;if(r){if(r.isGlyph||r.isGlyphset){let e=r;r.isGlyph&&(e=r.getGlyphset()),t.push(e)}else t.push(r)}}return t},ME=(e,t)=>{let n=e.label.toUpperCase(),r=t.label.toUpperCase();return n<r?-1:+(n>r)},NE={name:`ScaffoldTreeControls`,components:{ElIconArrowLeft:Id,TreeControls:n.TreeControls},props:{containerHeight:Number,isReady:Boolean,showColourPicker:Boolean},data:function(){return{treeData:[{label:`Root`,regionPath:``,id:void 0,children:[]}],active:[],hover:[],drawerOpen:!0,nodeNumbers:0,module:void 0}},computed:{drawerBottom:function(){return 100>this.maxHeight?this.maxHeight:100},maxHeight:function(){let e=this.containerHeight-114;return 0>e&&(e=0),e},treeDataEntry:function(){return this.treeData[0].children}},watch:{treeDataEntry:{deep:!0,handler:function(e){this.isReady&&this.setColourField(e)}}},methods:{setCheckboxDisabled:function(e,t,n){e&&(n||(e.disabled=t),e.children&&e.children.forEach(e=>this.setCheckboxDisabled(e,t,!1)))},setRegionCheckboxDisabled:function(e,t,n){if(this.treeData[0]&&e?.uuid){let r=this.findDataWithId(this.treeData[0],e?.uuid);r&&this.setCheckboxDisabled(r,t,n)}},findDataWithId:function(e,t){if(e){if(e.id===t)return e;if(e.children)for(let n=0;n<e.children.length;n++){let r=this.findDataWithId(e.children[n],t);if(r)return r}}},addTreeItem:function(e,t,n){e.some(e=>e.label===t.label)||(Object.assign(t,{activeColour:this.getColour(t)}),e.push(t),e.sort((e,t)=>ME(e,t)),this.nodeNumbers++,this.$nextTick(()=>{!this.$refs.treeControls.$refs.regionTree.getCheckedKeys().includes(t.id)&&n.getVisibility()&&this.$refs.treeControls.$refs.regionTree.setChecked(t.id,!0)}))},findOrCreateRegion:function(e,t,n){if(this.module&&this.module.scene&&(this.treeData[0].id=this.module.scene.getRootRegion().uuid,this.treeData[0].isRegion=!0),t.length>0){let r=[...t],i=e.children.find(e=>e.label==r[0]),a=n+`/`+t[0],o=this.module.scene.getRootRegion().findChildFromPath(a);return i||(i={label:r[0],id:o.uuid,children:[],regionPath:a,isRegion:!0},this.addTreeItem(e.children,i,o),a===`/_helper`&&this.$nextTick(()=>{this.$refs.treeControls.$refs.regionTree.setChecked(i.id,!1)})),r.shift(),this.findOrCreateRegion(i,r,a)}return e},removeRegion:function(e){if(this.treeData[0].children){for(let t=0;t<this.treeData[0].children.length;t++)if(this.treeData[0].children[t].label===e){this.treeData[0].children.splice(t,1),this.nodeNumbers--;return}}},zincObjectAdded:function(e){let t=e.region;if(t){let n=t.getFullSeparatedPath(),r=this.findOrCreateRegion(this.treeData[0],n,``);if(e.groupName&&r){r.children||=[];let n={disabled:!1,label:e.groupName,id:t.uuid+`/`+e.uuid,isPrimitives:!0,regionPath:e.region.getFullPath(),isTextureSlides:!!e.isTextureSlides};this.addTreeItem(r.children,n,e)}}},removeGroupFromRegionTreeData:function(e,t){let n=e.getFullSeparatedPath(),r=this.findOrCreateRegion(this.treeData[0],n,``);for(let e=0;e<r.children.length;e++)if(r.children[e].label===t){r.children.splice(e,1),this.nodeNumbers--;return}},zincObjectRenamed:function(e,t){e.region.findObjectsWithGroupName(t,!1).length<1&&this.removeGroupFromRegionTreeData(e.region,t),this.zincObjectAdded(e)},zincObjectRemoved:function(e){let t=e.groupName;e.region.findObjectsWithGroupName(t,!1).length===0&&this.removeGroupFromRegionTreeData(e.region,t)},checkChanged:function(e,t){let n=e.isRegion,r=e.isPrimitives,i=t.checkedKeys.includes(e.id),a=this.module.scene.getRootRegion().findChildFromPath(e.regionPath);if(n&&(i?a.showAllPrimitives():a.hideAllPrimitives(),this.$emit(`check-changed`,{region:a,isChecked:i})),r){let t=a.findObjectsWithGroupName(e.label);t.forEach(t=>{let n=i&&!e.disabled;t.setVisibility(n)}),this.$emit(`check-changed`,{zincObjects:t,isChecked:i})}},updateActiveUI:function(e){this.active.length=0,uE(e,this.active)},changeActiveByPrimitives:function(e,t){e&&e.length>0?(this.updateActiveUI(e),this.$emit(`object-selected`,e,t)):this.removeActive(t),this.removeHover(t)},updateHoverUI:function(e){this.hover.length=0,uE(e,this.hover)},changeHoverByPrimitives:function(e,t){e&&e.length>0?(this.updateHoverUI(e),this.$emit(`object-hovered`,e,t)):this.removeHover(t)},changeActiveByNames:function(e,t,n){let r=xE(this.module.scene.getRootRegion(),e,t,!0);this.changeActiveByPrimitives(r,n)},changeHoverByNames:function(e,t,n){let r=xE(this.module.scene.getRootRegion(),e,t,!0);this.changeHoverByPrimitives(r,n)},changeActiveByNode:function(e,t){if(e.isPrimitives||e.isRegion){let n=!!e.isRegion,r=this.getZincObjectsFromNode(e,n);this.changeActiveByPrimitives(r,t)}},changeHoverByNode:function(e,t){if(e.isPrimitives){let n=this.getZincObjectsFromNode(e,!1);this.changeHoverByPrimitives(n,t)}},removeActive:function(e){this.active=[],this.$emit(`object-selected`,[],e)},removeHover:function(e){this.hover=[],this.$emit(`object-hovered`,[],e)},clear:function(){this.active.length=0,this.hover.length=0,this.nodeNumbers=0,this.$refs.treeControls.$refs.regionTree.updateKeyChildren(this.treeData[0].id,[]),this.treeData[0].children.length=0,this.treeData[0].id=void 0,this.$emit(`object-selected`,[])},forEachChildInNode:function(e,t,n,r,i){if(e.isRegion){if(e.children){let a=n===``||t.includes(e.id);e.children.forEach(n=>this.forEachChildInNode(n,t,e.regionPath,r&&a,i))}}else e.isPrimitives&&i(e,n,r)},getColour:function(e){if(e){let t=this.getZincObjectsFromNode(e,!1)[0];if(t){let e=t.getColourHex();if(e)return`#`+e}}return`#FFFFFF`},getNodeDataByRegionAndGroup:function(e,t){for(let n of this.treeDataEntry)if(n.isRegion&&n.label===e){let e=n.children;for(let n of e)if(n.isPrimitives&&n.label===t)return n}},getZincObjectsFromNode:function(e,t){let n=this.module.scene.getRootRegion();if(e.isPrimitives)return xE(n,e.label,e.regionPath,t);if(e.isRegion&&e.regionPath){let r=n.findChildFromPath(e.regionPath);if(r)return r.getAllObjects(t)}return[]},setModule:function(e){this.module=(0,t.markRaw)(e),this.nodeNumbers=0,this.module.scene.getRootRegion().getAllObjects(!0).forEach(e=>{this.zincObjectAdded(e)}),this.module.addOrganPartAddedCallback(this.zincObjectAdded),this.module.addOrganPartRemovedCallback(this.zincObjectRemoved)},setColourField:function(e,t=void 0){e.filter(e=>t&&!e.children?e.id===t.id:!0).map(e=>{if(e.children)this.setColourField(e.children,t);else{let t=this.getColour(e);e.defaultColour||=t,e.activeColour=t}})},setColour:function(e,t){e&&e.isPrimitives&&this.getZincObjectsFromNode(e,!1).forEach(n=>{let r=(t||e.defaultColour).replace(`#`,`0x`);n.setColourHex(r),this.setColourField(this.treeData[0].children,e)})},updateAllNodeColours:function(){let e=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();this.forEachChildInNode(this.treeData[0],e,``,!0,(e,t,n)=>{e.isPrimitives&&(e.activeColour=this.getColour(e))})},setOutlines:function(e){let t=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();this.forEachChildInNode(this.treeData[0],t,``,!0,(n,r,i)=>{let a=this.module.scene.getRootRegion().findChildFromPath(r).findObjectsWithGroupName(n.label);e?a.forEach(e=>{e.isLines&&(t.includes(n.id)&&i&&e.setVisibility(!0),n.disabled=!1)}):n.isPrimitives&&a.forEach(e=>{e.isLines&&(e.setVisibility(!1),n.disabled=!0)})})},visibilityToggle:function(e,t){this.module.changeOrganPartsVisibility(e,t),t==0&&(this.activeRegion===e&&this.removeActive(!0),this.hoverRegion===e&&this.removeHover(!0))},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen,this.$emit(`drawer-toggled`,this.drawerOpen)},setTreeVisibilityWithFullPaths:function(e,t,n,r){let i=!1,a=``;e.isRegion&&(a=`__r${e.regionPath}`),e.isPrimitives&&(a=`${e.regionPath}/${e.label}`);let o=t.indexOf(a);o>-1&&(i=!0,t.splice(o,1),n.push(e.id));let s=this.module.scene.getRootRegion().findChildFromPath(e.regionPath);a&&a!==`__r`&&e.isPrimitives&&s.findObjectsWithGroupName(e.label).forEach(e=>e.setVisibility(i)),e.children&&e.children.forEach(e=>{this.setTreeVisibilityWithFullPaths(e,t,n,!0)})},setCheckedKeys:function(e,t){this.$nextTick(()=>{t&&this.$refs.treeControls.$refs.regionTree.setCheckedKeys([]),e.forEach(e=>{this.$refs.treeControls.$refs.regionTree.setChecked(e,!0,!0)})})},checkAllKeys:function(e=[]){let t=[],n=[];bE(this.treeData[0],t);let r=t.filter(t=>!e.some(e=>t.includes(e)));this.setTreeVisibilityWithFullPaths(this.treeData[0],r,n,!0),this.$refs.treeControls.$refs.regionTree.setCheckedKeys(n)},getState:function(){let e=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();return e.length===this.nodeNumbers?{checkAll:!0,version:`2.0`}:{checkedItems:CE(this.module.scene.getRootRegion(),e),version:`2.0`}},setState:function(e){if(e){if(e.checkAll)this.checkAllKeys();else if(e.checkedItems){let t=[];e.version===`2.0`?t.push(...e.checkedItems):(t=e.checkedItems.map(e=>`/`+e),t.shift(`__r/`));let n=[];this.setTreeVisibilityWithFullPaths(this.treeData[0],t,n,!0),this.$refs.treeControls.$refs.regionTree.setCheckedKeys(n)}}}}},PE={class:`tree-controls-scroll`};function FE(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`TreeControls`),c=Id,l=Qd;return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`tree-controls`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createElementVNode)(`div`,PE,[(0,t.createElementVNode)(`div`,{class:`tree-controls-container`,style:(0,t.normalizeStyle)({"max-height":`${o.maxHeight}px`})},[(0,t.renderSlot)(e.$slots,`treeSlot`,{},void 0,!0),(0,t.createVNode)(s,{mapType:`scaffold`,title:`Regions`,isReady:r.isReady,treeData:o.treeDataEntry,active:e.active,hover:e.hover,showColourPicker:r.showColourPicker,onSetColour:o.setColour,onCheckChanged:o.checkChanged,onChangeActive:o.changeActiveByNode,onChangeHover:o.changeHoverByNode,ref:`treeControls`,onMouseleave:n[0]||=e=>o.removeHover(!0)},null,8,[`isReady`,`treeData`,`active`,`hover`,`showColourPicker`,`onSetColour`,`onCheckChanged`,`onChangeActive`,`onChangeHover`])],4)]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({bottom:`${o.drawerBottom}px`}),onClick:n[1]||=(...e)=>o.toggleDrawer&&o.toggleDrawer(...e)},[(0,t.createVNode)(l,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c)]),_:1})],6)],2)}var IE=nv(NE,[[`render`,FE],[`__scopeId`,`data-v-1ea383cd`]]),LE={name:`LinesControls`,components:{Button:Km,Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Slider:C_,ElIconArrowLeft:Id,ElIconArrowRight:Ld},props:{createData:{type:Object},usageConfig:{type:Object}},data:function(){return{adjust:0,pAdjust:0,lengthScale:0,distance:0,newDistance:0,width:1,radius:lE.DEFAULT_RADIUS,radialSegments:lE.DEFAULT_RADIAL_SEGMENTS,currentIndex:0,ElIconArrowLeft:(0,t.shallowRef)(Id),ElIconArrowRight:(0,t.shallowRef)(Ld),edited:!1,zincObject:void 0,isTubeLines:!1}},computed:{showTubeLinesControls(){return this.usageConfig.showTubeLinesControls}},watch:{"createData.faceIndex":{handler:function(e){this.zincObject?.isLines2&&(this.currentIndex=e,this.distance=_E(this.zincObject,this.currentIndex))},immediate:!0}},methods:{changeIndex:function(e){e?_E(this.zincObject,this.currentIndex+1)>0&&(this.currentIndex++,this.reset()):(this.currentIndex--,this.reset())},onLengthInput:function(){this.newDistance===0?this.newDistance=this.distance:(this.distance=this.newDistance,this.edited=vE(this.zincObject,this.currentIndex,this.newDistance,!0)||this.edited)},onLengthSliding:function(){this.newDistance=10**this.lengthScale*this.distance,this.edited=vE(this.zincObject,this.currentIndex,this.newDistance,!0)||this.edited},onMoveSliding:function(){let e=(this.adjust-this.pAdjust)*this.distance;this.edited=vE(this.zincObject,this.currentIndex,e,!1)||this.edited,this.pAdjust=this.adjust},reset:function(){this.adjust=0,this.pAdjust=0,this.lengthScale=0,this.distance=_E(this.zincObject,this.currentIndex),this.newDistance=this.distance,this.edited&&=(this.$emit(`primitivesUpdated`,this.zincObject),!1)},setObject:function(e){this.currentIndex=-1,this.distance=0,e.isLines2||e.isTubeLines?(this.zincObject=(0,t.markRaw)(e),this.width=this.zincObject.getMorph().material.linewidth,this.isTubeLines=e.isTubeLines,e.isEditable?(this.currentIndex=0,this.distance=_E(e,this.currentIndex)):e.userData?.isNerves&&(this.radius=lE.ZOOM_RADIUS,this.radialSegments=lE.ZOOM_RADIAL_SEGMENTS)):(this.zincObject=void 0,this.width=10)},modifyWidth:function(){this.zincObject.setWidth(this.width)},modifyTubeLines:function(){this.zincObject.setTubeLines(this.radius,this.radius*this.radialSegments)}}};function RE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=Km,f=Hg,p=zg;return(0,t.openBlock)(),(0,t.createBlock)(p,{class:`lines-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{class:`slides-block`},{default:(0,t.withCtx)(()=>[e.isTubeLines&&o.showTubeLinesControls?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[15]||=[(0,t.createTextVNode)(` Radius: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.radius,"onUpdate:modelValue":n[0]||=t=>e.radius=t,class:`my-slider`,step:1,min:1,max:32,"show-tooltip":!1,onInput:o.modifyTubeLines},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.radius,"onUpdate:modelValue":n[1]||=t=>e.radius=t,step:1,min:1,max:32,controls:!1,onChange:o.modifyTubeLines,class:`input-box number-input`},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` Radial Segments: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.radialSegments,"onUpdate:modelValue":n[2]||=t=>e.radialSegments=t,class:`my-slider`,step:1,min:8,max:32,"show-tooltip":!1,onInput:o.modifyTubeLines},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.radialSegments,"onUpdate:modelValue":n[3]||=t=>e.radialSegments=t,step:1,min:8,max:32,controls:!1,onChange:o.modifyTubeLines,class:`input-box number-input`},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1})],64)):e.isTubeLines?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)(u,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` Width: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:12},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.width,"onUpdate:modelValue":n[4]||=t=>e.width=t,class:`my-slider`,step:1,min:1,max:100,"show-tooltip":!1,onInput:o.modifyWidth},null,8,[`modelValue`,`onInput`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.width,"onUpdate:modelValue":n[5]||=t=>e.width=t,step:1,min:1,max:100,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1})),e.currentIndex>-1&&e.distance>0?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:2},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{size:`small`,disabled:e.currentIndex===0,icon:e.ElIconArrowLeft,onClick:n[6]||=e=>o.changeIndex(!1)},null,8,[`disabled`,`icon`])]),_:1}),(0,t.createVNode)(s,{offset:4,span:9},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` Editing Line `+(0,t.toDisplayString)(e.currentIndex+1),1)]),_:1}),(0,t.createVNode)(s,{offset:2,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{size:`small`,icon:e.ElIconArrowRight,onClick:n[7]||=e=>o.changeIndex(!0)},null,8,[`icon`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` Move: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.adjust,"onUpdate:modelValue":n[8]||=t=>e.adjust=t,step:.01,min:-3,max:3,"show-tooltip":!1,onInput:n[9]||=e=>o.onMoveSliding(),onChange:n[10]||=e=>o.reset()},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` Length: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.lengthScale,"onUpdate:modelValue":n[11]||=t=>e.lengthScale=t,step:.01,min:-1,max:1,"show-tooltip":!1,onInput:n[12]||=e=>o.onLengthSliding(),onChange:n[13]||=e=>o.reset()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.newDistance,"onUpdate:modelValue":n[14]||=t=>e.newDistance=t,controls:!1,class:`input-box number-input`,onChange:o.onLengthInput},null,8,[`modelValue`,`onChange`])]),_:1})]),_:1})],64)):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var zE=nv(LE,[[`render`,RE],[`__scopeId`,`data-v-0deb177d`]]),BE={name:`GlyphsControls`,components:{Checkbox:qh,Container:zg,Main:Hg},data:function(){return{displayLabels:!0}},watch:{displayLabels:{handler:function(e){e?this.zincObject.showLabel():this.zincObject.hideLabel()}}},methods:{reset:function(){this.displayLabels=!0},setObject:function(e){e.isGlyphset?(this.zincObject=(0,t.markRaw)(e),this.displayLabels=this.zincObject.isLabelDisplayed()):this.zincObject=void 0}}};function VE(e,n,r,i,a,o){let s=qh,c=zg;return(0,t.openBlock)(),(0,t.createBlock)(c,{class:`glyph-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{modelValue:e.displayLabels,"onUpdate:modelValue":n[0]||=t=>e.displayLabels=t,class:`block`},{default:(0,t.withCtx)(()=>[...n[1]||=[(0,t.createTextVNode)(` Display labels `,-1)]]),_:1},8,[`modelValue`])]),_:1})}var HE=nv(BE,[[`render`,VE],[`__scopeId`,`data-v-fce6c6da`]]),UE={name:`PointsControls`,components:{Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Select:Oh,Slider:C_,Row:mg,Option:kh,ElIconArrowLeft:Id,ElIconArrowRight:Ld},inject:[`boundingDims`],data:function(){return{attenuation:!1,size:10,choices:[{value:!0,label:`On`},{value:!1,label:`off`}],min:[0,0,0],max:[1,1,1],translation:[0,0,0],pTranslation:[0,0,0],currentIndex:-1,ElIconArrowLeft:(0,t.shallowRef)(Id),ElIconArrowRight:(0,t.shallowRef)(Ld),edited:!1,zincObject:void 0}},watch:{boundingDims:{handler:function(e){let t=e.size;this.min=[-t[0]/2,-t[1]/2,-t[2]/2],this.max=[t[0]/2,t[1]/2,t[2]/2]},immediate:!0,deep:!0}},methods:{changeIndex:function(e){e?this.zincObject.drawRange>this.currentIndex+1&&(this.currentIndex++,this.reset()):(this.currentIndex--,this.reset())},onMoveSliding:function(){let e=[this.translation[0]-this.pTranslation[0],this.translation[1]-this.pTranslation[1],this.translation[2]-this.pTranslation[2]];this.edited=gE(this.zincObject,this.currentIndex,e)||this.edited;for(let e=0;e<3;e++)this.pTranslation[e]=this.translation[e]},reset:function(){this.translation=[0,0,0],this.pTranslation=[0,0,0],this.edited&&=(this.$emit(`primitivesUpdated`,this.zincObject),!1)},setObject:function(e){this.currentIndex=-1,e.isPointset?(this.zincObject=(0,t.markRaw)(e),this.size=this.zincObject.morph.material.size,this.attenuation=this.zincObject.morph.material.sizeAttenuation,e.isEditable&&this.zincObject.drawRange>0&&(this.currentIndex=0)):(this.zincObject=void 0,this.size=10,this.attenuation=!1)},modifyAttenuation:function(e){this.attenuation=e,this.zincObject.setSizeAttenuation(e)},modifySize:function(){this.zincObject.setSize(this.size)}}};function WE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=kh,f=Oh,p=Km,m=Hg,h=zg;return(0,t.openBlock)(),(0,t.createBlock)(h,{class:`pointset-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[15]||=[(0,t.createTextVNode)(` Size: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.size,"onUpdate:modelValue":n[0]||=t=>e.size=t,class:`my-slider`,step:1,min:0,max:100,"show-tooltip":!1,onInput:n[1]||=e=>o.modifySize()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.size,"onUpdate:modelValue":n[2]||=t=>e.size=t,step:1,min:0,max:100,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` Size attenuation: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:5},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{teleported:!1,"model-value":e.attenuation,placeholder:`Select`,class:`input-box`,"popper-class":`viewer_dropdown`,onChange:n[3]||=t=>o.modifyAttenuation(t,e.slide)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.choices,e=>((0,t.openBlock)(),(0,t.createBlock)(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`])]),_:1})]),_:1}),e.currentIndex>-1?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:4},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{size:`small`,disabled:e.currentIndex===0,icon:e.ElIconArrowLeft,onClick:n[4]||=e=>o.changeIndex(!1)},null,8,[`disabled`,`icon`])]),_:1}),(0,t.createVNode)(s,{offset:4,span:9},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` Editing Point `+(0,t.toDisplayString)(e.currentIndex+1),1)]),_:1}),(0,t.createVNode)(s,{offset:2,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{size:`small`,icon:e.ElIconArrowRight,onClick:n[5]||=e=>o.changeIndex(!0)},null,8,[`icon`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` x: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[0],"onUpdate:modelValue":n[6]||=t=>e.translation[0]=t,step:.01,min:e.min[0],max:e.max[0],"show-tooltip":!1,onInput:n[7]||=e=>o.onMoveSliding(),onChange:n[8]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` y: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[1],"onUpdate:modelValue":n[9]||=t=>e.translation[1]=t,step:.01,min:e.min[1],max:e.max[1],"show-tooltip":!1,onInput:n[10]||=e=>o.onMoveSliding(),onChange:n[11]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` z: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:16},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.translation[2],"onUpdate:modelValue":n[12]||=t=>e.translation[2]=t,step:.01,min:e.min[2],max:e.max[2],"show-tooltip":!1,onInput:n[13]||=e=>o.onMoveSliding(),onChange:n[14]||=e=>o.reset()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1})],64)):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var GE=nv(UE,[[`render`,WE],[`__scopeId`,`data-v-d1de9c65`]]),KE={name:`TextureSlidesControls`,components:{Checkbox:qh,Col:hg,Container:zg,Divider:Wg,Footer:Bg,Icon:Qd,InputNumber:Qg,Main:Hg,Row:mg,Select:Oh,Slider:C_,Option:kh,ElIconDelete:Hd,ElIconPlus:Kd},data:function(){return{brightness:0,contrast:1,discardAlpha:!0,settings:[],directions:[{value:`x`,label:`x`},{value:`y`,label:`y`},{value:`z`,label:`z`}],zincObject:void 0}},watch:{brightness:{handler:function(e){this.zincObject&&this.zincObject.setBrightness(e)},immediate:!1},contrast:{handler:function(e){this.zincObject&&this.zincObject.setContrast(e)},immediate:!1},discardAlpha:{handler:function(e){this.zincObject&&this.zincObject.discardAlphaPixel(e)},immediate:!1}},methods:{setObject:function(e){e.isTextureSlides?(this.zincObject=(0,t.markRaw)(e),this.settings=this.zincObject.getTextureSettings(),this.brightness=this.zincObject.getBrightness(),this.contrast=this.zincObject.getContrast(),this.discardAlpha=this.zincObject.isAlphaPixelDiscarded()):(this.zincObject=void 0,this.settings=[],this.brightness=0,this.contrast=1,this.discardAlpha=!0)},addNewSlide:function(){let e=this.zincObject.createSlide({direction:`x`,value:0});this.settings.push(e)},modifyDirection:function(e,t){t&&(t.direction=e,this.zincObject.modifySlideSettings(t))},modifySlide:function(e){e&&this.zincObject.modifySlideSettings(e)},removeSlide:function(e,t){this.zincObject.removeSlideWithId(t.id),this.settings.splice(e,1)}}};function qE(e,n,r,i,a,o){let s=qh,c=mg,l=hg,u=C_,d=Qg,f=Wg,p=kh,m=Oh,h=Hd,g=Qd,_=Hg,v=Kd,y=Bg,b=zg;return(0,t.openBlock)(),(0,t.createBlock)(b,{class:`t-slides-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{modelValue:e.discardAlpha,"onUpdate:modelValue":n[0]||=t=>e.discardAlpha=t},{default:(0,t.withCtx)(()=>[...n[5]||=[(0,t.createTextVNode)(` Discard Translucent Pixel `,-1)]]),_:1},8,[`modelValue`])]),_:1}),(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:8},{default:(0,t.withCtx)(()=>[...n[6]||=[(0,t.createTextVNode)(` Brightness `,-1)]]),_:1}),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:e.brightness,"onUpdate:modelValue":n[1]||=t=>e.brightness=t,class:`my-slider`,step:.01,min:-1,max:1,"show-tooltip":!1},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:e.brightness,"onUpdate:modelValue":n[2]||=t=>e.brightness=t,step:.01,min:-1,max:1,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(c,{class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:8},{default:(0,t.withCtx)(()=>[...n[7]||=[(0,t.createTextVNode)(` Contrast `,-1)]]),_:1}),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:e.contrast,"onUpdate:modelValue":n[3]||=t=>e.contrast=t,class:`my-slider`,step:.01,min:0,max:10,"show-tooltip":!1},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:e.contrast,"onUpdate:modelValue":n[4]||=t=>e.contrast=t,step:.01,min:0,max:10,controls:!1,class:`input-box number-input`},null,8,[`modelValue`])]),_:1})]),_:1}),(0,t.createVNode)(f),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.settings,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:n.id,class:`slide-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{teleported:!1,"model-value":n.direction,placeholder:`Select`,class:`input-box`,"popper-class":`viewer_dropdown`,onChange:e=>o.modifyDirection(e,n)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.directions,e=>((0,t.openBlock)(),(0,t.createBlock)(p,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`onChange`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,class:`my-slider`,step:.001,min:0,max:1,"show-tooltip":!1,onInput:e=>o.modifySlide(n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onInput`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,onChange:e=>o.modifySlide(n),step:.001,min:0,max:1,controls:!1,class:`input-box number-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),_:2},1024),(0,t.createVNode)(l,{offset:0,span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(g,{class:`delete-icon`,onClick:e=>o.removeSlide(r,n)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(h)]),_:1},8,[`onClick`])]),_:2},1024)]),_:2},1024))),128))]),_:1}),(0,t.createVNode)(y,{height:`30px`,class:`add-slides-text`,onClick:o.addNewSlide},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{span:2},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(g,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(v)]),_:1})]),_:1}),(0,t.createVNode)(l,{span:20},{default:(0,t.withCtx)(()=>[...n[8]||=[(0,t.createTextVNode)(` Add a new slide `,-1)]]),_:1})]),_:1})]),_:1},8,[`onClick`])]),_:1})}var JE=nv(KE,[[`render`,qE],[`__scopeId`,`data-v-687baffd`]]),YE={name:`TransformationControls`,components:{Col:hg,Container:zg,InputNumber:Qg,Main:Hg,Slider:C_},inject:[`boundingDims`],data:function(){return{x:0,y:0,z:0,scale:1,min:[0,0,0],max:[1,1,1],zincObject:void 0,enableScaling:!0}},watch:{boundingDims:{handler:function(e){this.calculateMinAndMax()},immediate:!0,deep:!0}},methods:{calculateMinAndMax:function(){if(this.zincObject){let e=this.zincObject?.userData?.originalPos;this.zincObject.getGroup(),e&&this.boundingDims&&(this.min=[e[0]-this.boundingDims.size[0],e[1]-this.boundingDims.size[1],e[2]-this.boundingDims.size[2]],this.max=[e[0]+this.boundingDims.size[0],e[1]+this.boundingDims.size[1],e[2]+this.boundingDims.size[2]])}},setObject:function(e){if(e.isZincObject){this.zincObject=(0,t.markRaw)(e);let n=this.zincObject.getGroup();this.zincObject.userData.originalPos,n&&n.position&&(this.x=n.position.x,this.y=n.position.y,this.z=n.position.z,this.scale=this.zincObject.isGlyphset?this.zincObject.globalScale:n.scale.x,this.enableScaling=!this.zincObject.isTextureSlides,this.calculateMinAndMax())}else this.zincObject=void 0,this.x=0,this.y=0,this.z=0,this.scale=1},modifyPosition:function(){this.zincObject&&this.zincObject.setPosition(this.x,this.y,this.z)},modifyScale:function(){this.zincObject.setScaleAll(this.scale)}}};function XE(e,n,r,i,a,o){let s=hg,c=C_,l=Qg,u=mg,d=Hg,f=zg;return(0,t.openBlock)(),(0,t.createBlock)(f,{class:`transformation-container`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{class:`slides-block`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[16]||=[(0,t.createTextVNode)(` x: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.x,"onUpdate:modelValue":n[0]||=t=>e.x=t,step:.01,min:e.min[0],max:e.max[0],"show-tooltip":!1,onInput:n[1]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.x,"onUpdate:modelValue":n[2]||=t=>e.x=t,step:.01,min:e.min[0],max:e.max[0],controls:!1,class:`input-box number-input`,onChange:n[3]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[17]||=[(0,t.createTextVNode)(` y: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.y,"onUpdate:modelValue":n[4]||=t=>e.y=t,step:.01,min:e.min[1],max:e.max[1],"show-tooltip":!1,onInput:n[5]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.y,"onUpdate:modelValue":n[6]||=t=>e.y=t,step:.01,min:e.min[1],max:e.max[1],controls:!1,class:`input-box number-input`,onChange:n[7]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),(0,t.createVNode)(u,{class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[18]||=[(0,t.createTextVNode)(` z: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.z,"onUpdate:modelValue":n[8]||=t=>e.z=t,step:.01,min:e.min[2],max:e.max[2],"show-tooltip":!1,onInput:n[9]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.z,"onUpdate:modelValue":n[10]||=t=>e.z=t,step:.01,min:e.min[2],max:e.max[2],controls:!1,class:`input-box number-input`,onChange:n[11]||=e=>o.modifyPosition()},null,8,[`modelValue`,`min`,`max`])]),_:1})]),_:1}),e.enableScaling?((0,t.openBlock)(),(0,t.createBlock)(u,{key:0,class:`tool-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[...n[19]||=[(0,t.createTextVNode)(` Scale: `,-1)]]),_:1}),(0,t.createVNode)(s,{offset:0,span:10},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{modelValue:e.scale,"onUpdate:modelValue":n[12]||=t=>e.scale=t,step:.01,min:0,max:5,"show-tooltip":!1,onInput:n[13]||=e=>o.modifyScale()},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)(s,{offset:0,span:6},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{modelValue:e.scale,"onUpdate:modelValue":n[14]||=t=>e.scale=t,step:.01,min:0,max:5,controls:!1,class:`input-box number-input`,onChange:n[15]||=e=>o.modifyScale()},null,8,[`modelValue`])]),_:1})]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1})]),_:1})}var ZE=nv(YE,[[`render`,XE],[`__scopeId`,`data-v-962c6314`]]),QE={name:`OpacityControls`,components:{Container:zg,Header:Vg,Main:Hg,Slider:C_},props:{material:void 0,zincObject:void 0},data:function(){return{displayString:`100%`}},watch:{"material.opacity":function(){this.material&&this.zincObject&&this.zincObject.setAlpha(this.material.opacity)}},methods:{formatTooltip(e){return this.displayString=Math.floor(100*e+.5)+`%`,this.displayString}}},$E={class:`block`},eD={class:`display`};function tD(e,n,r,i,a,o){let s=C_,c=zg;return r.material?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,class:`opacity-container`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,$E,[(0,t.createElementVNode)(`span`,eD,(0,t.toDisplayString)(e.displayString),1),(0,t.createVNode)(s,{modelValue:r.material.opacity,"onUpdate:modelValue":n[0]||=e=>r.material.opacity=e,class:`my-slider`,step:.01,min:0,max:1,"format-tooltip":o.formatTooltip,"show-tooltip":!1},null,8,[`modelValue`,`format-tooltip`])])]),_:1})):(0,t.createCommentVNode)(``,!0)}var nD=nv(QE,[[`render`,tD],[`__scopeId`,`data-v-7e39127d`]]),rD={name:`PrimitiveControls`,components:{Collapse:jg,CollapseItem:Mg,GlyphsControls:HE,LinesControls:zE,OpacityControls:nD,PointsControls:GE,TextureSlidesControls:JE,TransformationControls:ZE,ElIconArrowRight:Ld},props:{createData:{type:Object},viewingMode:{type:String,default:`Exploration`},usageConfig:{type:Object}},data:function(){return{activeName:`oControls`,material:void 0,isTextureSlides:!1,isPointset:!1,isLines:!1,isGlyph:!1,zincObject:void 0,isEditable:!1,displayString:`100%`}},computed:{hasValidPrimitive:function(){return this.viewingMode===`Exploration`||this.viewingMode===`Annotation`?this.material!==void 0||this.isTextureSlides===!0:!1}},methods:{formatTooltip:function(e){return this.displayString=Math.floor(100*e+.5)+`%`,this.displayString},setObject:function(e){this.zincObject=e?(0,t.markRaw)(e):void 0,this.isEditable=!!this.zincObject?.isEditable,this.isPointset=!1,this.isTextureSlides=!1,this.isLines=!1,this.isGlyph=!1,this.activeName=`trControls`,e&&(e.isTextureSlides?(this.isTextureSlides=!0,this.$refs.tSlidesControls.setObject(e),this.activeName=`tsControls`):e.isPointset?(this.isPointset=!0,this.$refs.pointsetControls.setObject(e),this.activeName=`pControls`):e.isLines2||e.isTubeLines&&this.usageConfig?.showTubeLinesControls?(this.isLines=!0,this.$refs.linesControls.setObject(e),this.activeName=`lControls`):e.isGlyphset&&e.canShowLabel()&&(this.isGlyph=!0,this.$refs.glyphControls.setObject(e),this.activeName=`gControls`),this.$refs.transformationControls.setObject(e)),this.material=e&&e.getMorph()?e.getMorph().material:void 0}}},iD={class:`my-drawer`};function aD(e,n,r,i,a,o){let s=nD,c=Mg,l=ZE,u=JE,d=GE,f=HE,p=zE,m=jg;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,iD,[(0,t.createVNode)(m,{class:`collapse`,modelValue:e.activeName,"onUpdate:modelValue":n[3]||=t=>e.activeName=t,accordion:``},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createVNode)(c,{title:`Opacity`,name:`oControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s,{material:e.material,zincObject:e.zincObject,ref:`opacityControls`},null,8,[`material`,`zincObject`])]),_:1},512),[[t.vShow,!e.isTextureSlides]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Transformation`,name:`trControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(l,{class:`transformation-controls`,ref:`transformationControls`},null,512)]),_:1},512),[[t.vShow,!e.isEditable]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Texture Slides`,name:`tsControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u,{class:`texture-controls`,ref:`tSlidesControls`},null,512)]),_:1},512),[[t.vShow,e.isTextureSlides]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Points`,name:`pControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(d,{class:`pointset-controls`,ref:`pointsetControls`,onPrimitivesUpdated:n[0]||=t=>e.$emit(`primitivesUpdated`,t)},null,512)]),_:1},512),[[t.vShow,e.isPointset]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Glyphset`,name:`gControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{class:`glyph-controls`,ref:`glyphControls`,onPrimitivesUpdated:n[1]||=t=>e.$emit(`primitivesUpdated`,t)},null,512)]),_:1},512),[[t.vShow,e.isGlyph]]),(0,t.withDirectives)((0,t.createVNode)(c,{title:`Lines`,name:`lControls`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p,{class:`lines-controls`,ref:`linesControls`,createData:r.createData,usageConfig:r.usageConfig,onPrimitivesUpdated:n[2]||=t=>e.$emit(`primitivesUpdated`,t)},null,8,[`createData`,`usageConfig`])]),_:1},512),[[t.vShow,e.isLines]])]),_:1},8,[`modelValue`])],512)),[[t.vShow,o.hasValidPrimitive]])}var oD=nv(rD,[[`render`,aD],[`__scopeId`,`data-v-4b7eafcb`]]),sD=(0,i.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}}),cD={name:`ScaffoldTooltip`,components:{Col:hg,CreateTooltipContent:n.CreateTooltipContent,Icon:Qd,Popover:r_,Row:mg,Tooltip:n.Tooltip},props:{createData:{type:Object,default:{drawingBox:!1,renaming:!1,toBeConfirmed:!1,points:[],tempGroupName:void 0,shape:``,x:0,y:0,editingIndex:-1,faceIndex:-1,toBeDeleted:!1,regionPrefix:`__annotation`}},label:{type:String,default:``},annotationDisplay:{type:Boolean,default:!1},annotationFeature:{type:Object,default:{}},offlineAnnotationEnabled:{type:Boolean,default:!1},region:{type:String,default:``},visible:{type:Boolean,default:!1},x:{type:Number,default:200},y:{type:Number,default:200}},inject:[`scaffoldUrl`],provide(){return{userApiKey:this.userToken}},data:function(){return{display:!1,annotationEntry:[]}},computed:{...(0,i.mapState)(sD,[`userToken`]),position:function(){let e=40;return this.region&&(e=55),{left:this.x-40+`px`,top:this.y-e+`px`}}},methods:{checkForDisplay:function(){if(this.visible&&this.label&&this.label!==``){if(this.display=!0,this.annotationDisplay){let e=this.region?this.region+`/`:``;this.annotationEntry=[{featureId:e+this.label,resourceId:this.scaffoldUrl,resource:this.scaffoldUrl,feature:this.annotationFeature,offline:this.offlineAnnotationEnabled}]}}else this.display=!1,this.annotationEntry=[]},hideTriggered:function(){this.$emit(`tooltip-hide`)}},watch:{label:{handler:function(){this.checkForDisplay()},immediate:!0},visible:{handler:function(){this.checkForDisplay()},immediate:!0},annotationDisplay:{handler:function(){this.checkForDisplay()},immediate:!0}}},lD={class:`tooltip-text`},uD={key:0,class:`tooltip-text`};function dD(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`CreateTooltipContent`),c=(0,t.resolveComponent)(`Tooltip`),l=r_;return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{style:(0,t.normalizeStyle)(o.position),class:`region-tooltip`},[(0,t.createVNode)(l,{ref:`tooltip`,visible:r.visible,placement:`top`,"show-arrow":!1,teleported:!1,trigger:`manual`,"popper-class":`tooltip-popper non-selectable`,"virtual-triggering":``,onHide:o.hideTriggered},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,lD,(0,t.toDisplayString)(r.label),1),r.region&&r.region!=`/`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,uD,` Region: `+(0,t.toDisplayString)(r.region),1)):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createVNode)(s,{createData:r.createData,onConfirmCreate:n[0]||=t=>e.$emit(`confirm-create`,t),onCancelCreate:n[1]||=t=>e.$emit(`cancel-create`),onCreateRegionSuggestions:n[2]||=t=>e.$emit(`create-region-suggestions`,t),onCreateGroupSuggestions:n[3]||=t=>e.$emit(`create-group-suggestions`,t)},null,8,[`createData`]),[[t.vShow,r.createData.toBeConfirmed]]),(0,t.withDirectives)((0,t.createVNode)(c,{class:`p-tooltip`,ref:`annotationTooltip`,annotationDisplay:!0,annotationEntry:e.annotationEntry,onAnnotation:n[4]||=t=>e.$emit(`confirm-comment`,t)},null,8,[`annotationEntry`]),[[t.vShow,r.annotationDisplay&&!r.createData.toBeConfirmed]])]),_:1},8,[`visible`,`onHide`])],4)}var fD=nv(cD,[[`render`,dD],[`__scopeId`,`data-v-0b62fe75`]]),pD=async(e,t,n,r,i)=>await(0,cE.createPrimitivesFromNIFTI)(e,t,n,r,i),mD={ALL:0,SELECTED:1,HIGHLIGHTED:2,MOVE:3},hD=function(e,t,n){this.eventType=e,this.identifiers=t,this.zincObjects=n},gD=function(e,t,n){this.targetedID=[];let r=e,i=t;this.targetEventType=n;let a=this;n===void 0&&(this.targetEventType=mD.ALL),this.getEventType=function(){return n},this.notify=function(e,t,n,o){if(e!==r&&(a.targetEventType===mD.ALL||a.targetEventType===t)){let e=new hD(t,n,o);i(e)}}},_D=function(){let e=[];this.publish=function(t,n,r,i){for(let a=0;a<e.length;a++)e[a].notify(t,n,r,i)},this.subscribe=function(t,n,r){if(typeof n==`function`){let i=new gD(t,n,r);return e.push(i),i}},this.unsubscribe=function(t){for(let n=0;n<e.length;n++)if(t===e[n]){e.splice(n,1);return}}},vD={isWebGLAvailable:function(){try{var e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch{return!1}},isWebGL2Available:function(){try{var e=document.createElement(`canvas`);return!!(window.WebGL2RenderingContext&&e.getContext(`webgl2`))}catch{return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(e){var t={1:`WebGL`,2:`WebGL 2`},n={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},r=`This module requires <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#008">$1</a> support but your $0 does not seem to support it.`,i=document.createElement(`div`);return i.id=`webglmessage`,i.style.fontFamily=`monospace`,i.style.fontSize=`20px`,i.style.fontWeight=`normal`,i.style.textAlign=`center`,i.style.background=`#fff`,i.style.color=`#000`,i.style.padding=`1.5em`,i.style.width=`400px`,i.style.margin=`5em auto 0`,r=n[e]?r.replace(`$0`,`graphics card`):r.replace(`$0`,`browser`),r=r.replace(`$1`,t[e]),i.innerHTML=r,i}},yD={ALL:0,DESTROYED:1,NAME_CHANGED:2,SETTINGS_CHANGED:3},bD=function(){this.typeName=`Base Module`,this.instanceName=`default`,this.onChangedCallbacks=[],this.eventNotifiers=[]};bD.prototype.setName=function(e){if(e&&this.instanceName!==e){this.instanceName=e;let t=this.onChangedCallbacks.slice();for(let e=0;e<t.length;e++)t[e](this,yD.NAME_CHANGED)}},bD.prototype.settingsChanged=function(){let e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,yD.SETTINGS_CHANGED)},bD.prototype.exportSettings=function(){let e={};return e.dialog=this.typeName,e.name=this.instanceName,e},bD.prototype.importSettings=function(e){return e.dialog==this.typeName&&(this.setName(e.name),!0)},bD.prototype.publishChanges=function(e,t,n){for(let r=0;r<this.eventNotifiers.length;r++)this.eventNotifiers[r].publish(this,t,e,n)},bD.prototype.getName=function(){return this.instanceName},bD.prototype.destroy=function(){let e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,yD.DESTROYED);delete this},bD.prototype.addChangedCallback=function(e){this.onChangedCallbacks.includes(e)==0&&this.onChangedCallbacks.push(e)},bD.prototype.removeChangedCallback=function(e){let t=this.onChangedCallbacks.indexOf(e);t>-1&&this.onChangedCallbacks.splice(t,1)},bD.prototype.addNotifier=function(e){this.eventNotifiers.push(e)};var xD=(e,t,n,r)=>{for(let i=0;i<e.length;i++)if(e[i]&&e[i].material&&e[i].material.emissive){let a=e[i].userData;if(a&&a.isZincObject){let e=t;r===`highlight`&&`highlightColour`in a.userData&&(e=a.userData.highlightColour),r===`select`&&`selectedColour`in a.userData&&(e=a.userData.selectedColour),e&&a.setEmissiveRGB(e)}else e[i].material&&e[i].material.emissive&&e[i].material.emissive.setRGB(...t);n&&e[i].material.depthFunc&&(e[i].material.depthFunc=cE.THREE.LessEqualDepth),e[i].children.forEach(e=>{let n=e.userData;n&&n.isZincObject&&e.material&&e.material.emissive&&e.material.emissive.setRGB(...t)})}},SD=function(){let e=[],t=[];this.highlightColour=[.5,0,0],this.selectColour=[0,.5,0],this.originalColour=[0,0,0];let n=[],r=[],i=this,a=function(e,t){if(e.length==0&&t.length==0)return!1;for(let n=0;n<e.length;n++){let r=!1;for(let i=0;i<t.length;i++)e[n]===t[i]&&(r=!0);if(!r)return!0}for(let n=0;n<t.length;n++){let r=!1;for(let i=0;i<e.length;i++)t[n]===e[i]&&(r=!0);if(!r)return!0}return!1},o=function(e,t){if(n.length=0,t.length==0)return e;for(let r=0;r<e.length;r++){let i=!1;for(let n=0;n<t.length;n++)e[r]===t[n]&&(i=!0);i||n.push(e[r])}return n};this.setHighlighted=function(n){let r=[...e];this.setNervesStyle(r),i.resetHighlighted();let c=o(n,t),l=s(c);return this.setNervesStyle(c,lE.HIGHLIGHTED_COLOUR),xD(l,i.highlightColour,!1,`highlight`),e=c,a(e,r)},this.setSelected=function(e){let n=[...t];this.setNervesStyle(n),i.resetHighlighted(),i.resetSelected();let r=s(e);return this.setNervesStyle(e,lE.SELECTED_COLOUR),xD(r,i.selectColour,!1,`select`),t=e,a(t,n)};let s=function(e){r.length=0;for(let t=0;t<e.length;t++)e[t].material&&r.push(e[t]);return r};this.setNervesStyle=function(e,t){let n=jE(e);if(n&&n.length){let e=t?lE.ZOOM_RADIUS:lE.DEFAULT_RADIUS,r=t?lE.ZOOM_RADIAL_SEGMENTS:lE.DEFAULT_RADIAL_SEGMENTS;n.forEach(n=>{if(n.isTubeLines&&n.userData?.isNerves&&!n.userData?.isGreyScale){n.setTubeLines(e,r);let i=t||n.userData?.defaultColour;i=i.replace(`#`,`0x`),n.setColourHex(i)}})}},this.resetHighlighted=function(){let t=s(e);this.setNervesStyle(e),xD(t,i.originalColour,!0,`reset`),e=[]},this.resetSelected=function(){let n=s(t);this.setNervesStyle(e),xD(n,i.originalColour,!0,`reset`),t=[]},this.getSelected=function(){return t},this.reset=function(){i.resetSelected(),i.resetHighlighted()}},CD=cE.default.THREE,wD=function(){let e=document.createElement(`div`),t;if(e.style.height=`100%`,vD.isWebGLAvailable())t=new cE.default.Renderer(e,window),cE.default.defaultMaterialColor=16777116,t.initialiseVisualisation(),t.playAnimation=!1;else{let t=vD.getWebGLErrorMessage();e.appendChild(t)}return{Zinc:cE.default,renderer:t,container:e}},TD=function(){bD.call(this),this.scene=void 0,this.rendererContainer=void 0,this.displayArea=void 0,this.graphicsHighlight=new SD,this.selectObjectOnPick=!0,this.zincRenderer=null,this.selectedScreenCoordinates=new CD.Vector3,this.selectedCenter=void 0,this.liveUpdatesObjects=void 0,this.ignorePreviousSelected=!1};TD.prototype=Object.create(bD.prototype),TD.prototype.getIntersectedObject=function(e){if(e){let t=e.map(e=>{if(e&&e.object&&e.object.userData){if(e.object.userData.isMarker)return 1;if(e.object.name&&e.object.userData.isZincObject)return e.object.name===`_Unnamed`?3:2}return 0}),n=t.indexOf(1);return n>-1?e[n]:(n=t.indexOf(2),n=n>-1?n:t.indexOf(3),e[n])}},TD.prototype.getAnnotationsFromObjects=function(e,t){let n=[];for(var r=0;r<e.length;r++){let i=e[r].userData,a;if(i){if(i.isGlyph||i.isGlyphset){let n=i;i.isGlyph&&(n=i.getGlyphset()),a=n.userData?n.userData.annotation:void 0,a&&a.data&&(t&&`instanceId`in t?a.data.id=n.getLabel(t.instanceId):e[r].name&&e[r].name!=``?a.data.id=e[r].name:a.data.id=n.groupName)}else a=i.userData?i.userData.annotation:void 0,a&&a.data&&(a.data.id=e[r].name);a&&(a.data.anatomicalId=i.anatomicalId,a.data.isNerves=i.userData.isNerves,a.data.zincObject=i)}a&&n.push(a)}return n},TD.prototype.setHighlightedByObjects=function(e,t,n,r){let i=jE(e),a=this.graphicsHighlight.setHighlighted(e);if(r){let r=mD.MOVE;a&&(r=mD.HIGHLIGHTED);let o=this.getAnnotationsFromObjects(e,n);o.length>0&&(o[0].coords=t,o[0].extraData=n),this.publishChanges(o,r,i)}return a},TD.prototype.setHighlightedByZincObjects=function(e,t,n,r){let i=[];return e&&e.forEach(e=>{e&&e.getMorph()&&i.push(e.getMorph())}),this.setHighlightedByObjects(i,t,n,r)},TD.prototype.setupLiveCoordinates=function(e){if(this.liveUpdatesObjects=e,e&&e.length>0){let t=this.scene.getBoundingBoxOfZincObjects(e),n=new CD.Vector3;t?(t.getCenter(n),this.selectedCenter==null?this.selectedCenter=n:this.selectedCenter.copy(n)):this.selectedCenter=void 0}else this.selectedCenter=void 0},TD.prototype.setSelectedByObjects=function(e,t,n,r){let i=!1;if(i=!this.selectObjectOnPick||this.graphicsHighlight.setSelected(e),i||this.ignorePreviousSelected){let i=jE(e);if(this.selectObjectOnPick&&this.setupLiveCoordinates(i),r){let r=mD.SELECTED,a=this.getAnnotationsFromObjects(e,n);a.length>0&&(a[0].coords=t,a[0].extraData=n),this.publishChanges(a,r,i)}}return i},TD.prototype.setSelectedByZincObjects=function(e,t,n,r){let i=[];return e&&e.forEach(e=>{if(e){let t=e.getMorph();t&&i.push(t)}}),this.setSelectedByObjects(i,t,n,r)},TD.prototype.findObjectsByGroupName=function(e){return this.scene.findObjectsWithGroupName(e)},TD.prototype.setHighlightedByGroupName=function(e,t){let n=this.findObjectsByGroupName(e);return this.setHighlightedByObjects(n,void 0,{},t)},TD.prototype.setSelectedByGroupName=function(e,t){let n=this.findObjectsByGroupName(e);return this.setSelectedByObjects(n,void 0,{},t)},TD.prototype.changeBackgroundColour=function(e){let t=new CD.Color(e);this.zincRenderer&&this.zincRenderer.getThreeJSRenderer().setClearColor(t,1)},TD.prototype.resetView=function(){this.zincRenderer&&this.zincRenderer.resetView()},TD.prototype.viewAll=function(){this.zincRenderer&&this.zincRenderer.viewAll()},TD.prototype.playAnimation=function(e){this.zincRenderer&&(this.zincRenderer.playAnimation=e)},TD.prototype.setPlayRate=function(e){this.zincRenderer&&this.zincRenderer.setPlayRate(e)},TD.prototype.getPlayRate=function(e){return this.zincRenderer?this.zincRenderer.getPlayRate():0},TD.prototype.initialiseRenderer=function(e){if(this.zincRenderer===void 0||this.rendererContainer===void 0){let e=wD();this.Zinc=e.Zinc,this.zincRenderer=e.renderer,this.rendererContainer=e.container}e&&(this.displayArea=e,this.displayArea.appendChild(this.rendererContainer),this.zincRenderer&&this.zincRenderer.animate())},TD.prototype.destroy=function(){this.zincRenderer&&=(this.zincRenderer.dispose(),this.zincRenderer.getThreeJSRenderer().dispose(),void 0),bD.prototype.destroy.call(this)};var ED=function(){this.type=`anatomical`,this.data=void 0,this.isAnnotation=!0},DD=function(){this.currentName=``,this.currentSystem=``,this.currentPart=``,this.currentSpecies=``,this.metaURL=``,this.viewURL=``,this.timeVarying=!1,this.currentTime=0},OD=function(e){TD.call(this);let t=this;this.sceneData=new DD;let n=[],r=[],i=[],a=[],o,s,c=e;this.NDCCameraControl=void 0,t.typeName=`Organ Viewer`;let l=!1;this.isIgnorePicking=function(){return l},this.setIgnorePicking=function(e){l=e},this.getSceneData=function(){return t.sceneData},this.updateTime=function(e){let n=6e3;t.scene&&(n=t.scene.getDuration());let r=e/100*n;t.sceneData.nerveMapIsActive||t.scene&&t.scene.setMorphsTime(r),t.sceneData.currentTime=e};let u=function(){let e=3e3;t.scene&&(e=t.scene.getDuration());let r=t.zincRenderer.getCurrentTime();for(let e=0;e<n.length;e++)n[e](r);t.sceneData.nerveMapIsActive,t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setTime(r/e),t.sceneData.currentTime=r/e*100};this.getCurrentTime=function(){return t.sceneData.currentTime},this.toggleSyncControl=(e,t)=>{let n=this.scene.getZincCameraControls();e?(n.resetView(),this.NDCCameraControl=n.enableSyncControl(),n.setRotationMode(t)):(n.disableSyncControl(),this.NDCCameraControl=void 0,n.setRotationMode(`free`))},this.isSyncControl=()=>this.NDCCameraControl!==void 0,this.setSyncControlZoomToBox=e=>{this.NDCCameraControl&&this.NDCCameraControl.zoomToBox(e,2)},this.setSyncControlCallback=e=>{this.NDCCameraControl&&this.NDCCameraControl.setEventCallback(e)},this.setSyncControlCenterZoom=(e,t)=>{this.NDCCameraControl&&this.NDCCameraControl.setCenterZoom(e,t)};let d=function(){if(t.zincRenderer.playAnimation&&t.liveUpdatesObjects&&t.setupLiveCoordinates(t.liveUpdatesObjects),t.selectedCenter){let e=new cE.THREE.Vector3;e.copy(t.selectedCenter);let n=t.scene.vectorToScreenXY(e);t.selectedScreenCoordinates.x=n.x,t.selectedScreenCoordinates.y=n.y}},f=function(){return function(){u()}},p=function(){return function(){d()}};this.addTimeChangedCallback=function(e){n.push(e)},this.setTexturePos=function(e){t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setSliderPos(e)},this.addSceneChangedCallback=function(e){r.push(e)},this.addOrganPartAddedCallback=function(e){i.push(e)},this.addOrganPartRemovedCallback=function(e){a.push(e)},this.setFinishDownloadCallback=function(e){o=e},this.unsetFinishDownloadCallback=function(){o=void 0},this.setDownloadErrorCallback=function(e){s=e},this.unsetDownloadErrorCallback=function(){s=void 0},this.getNamedObjectsToScreenCoordinates=function(e,t){let n=new cE.THREE.Vector3;n.setFromMatrixPosition(obj.matrixWorld);let r=width/2,i=height/2;return n.project(t),n.x=n.x*r+r,n.y=-(n.y*i)+i,n};let m=function(e){let n,r;if(e!==void 0){let i=!1;e.object.userData&&e.object.userData.isMarker?(i=!0,r=e.object.userData.parent.getMorph()):r=e.object;try{r.userData.userData.annotation.data.lastActionOnMarker=i}finally{}if(r){if(r.name)n=r.name;else{let e=t.getAnnotationsFromObjects([r],void 0);e&&e[0]&&(n=e[0].data.group)}}}return{id:n,object:r}},h=function(){return function(e,n,r){let i=t.getIntersectedObject(e),a=m(i),o={worldCoords:[i?i.point.x:0,i?i.point.y:0,i?i.point.z:0],intersected:i,intersects:e,instanceId:i?.instanceId?i.instanceId:-1},s={x:n,y:r};if(a.id){o.threeID=a.object?.id,a.object.userData.isGlyph?a.object.name?t.setSelectedByObjects([a.object],s,o,!0):t.setSelectedByZincObjects(a.object.userData.getGlyphset(),s,o,!0):t.setSelectedByObjects([a.object],s,o,!0);return}l||t.setSelectedByObjects([],s,o,!0)}},g=function(){return function(e,n,r){let i=t.getIntersectedObject(e),a=m(i),o={worldCoords:[i?i.point.x:0,i?i.point.y:0,i?i.point.z:0],instanceId:i?.instanceId?i.instanceId:-1},s={x:n,y:r};if(a.id){o.threeID=a.object?.id,t.displayArea.style.cursor=`pointer`,t.setHighlightedByObjects([a.object],s,o,!0);return}t.displayArea.style.cursor=`auto`,t.setHighlightedByObjects([],s,o,!0)}},_=function(e,t,n,r){if(r==`all`||r==`geometries`){let r=e.findGeometriesWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`glyphsets`){let r=e.findGlyphsetsWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`pointsets`){let r=e.findPointsetsWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}if(r==`all`||r==`lines`){let r=e.findLinesWithGroupName(t);for(let e=0;e<r.length;e++)r[e].setVisibility(n)}};this.changeGeometriesVisibility=function(e,n){_(t.scene,e,n,`geometries`)},this.changeGlyphsetsVisibility=function(e,n){_(t.scene,e,n,`glyphsets`)},this.changeLinesVisibility=function(e,n){_(t.scene,e,n,`lines`)},this.changePointsetsVisibility=function(e,n){_(t.scene,e,n,`pointsets`)},this.changeOrganPartsVisibility=function(e,n,r){let i=`all`;r!==void 0&&(i=r),_(t.scene,e,n,i)},this.changeOrganPartsVisibilityCallback=function(e){return function(n){t.changeOrganPartsVisibility(e,n)}},this.changeBackgroundColour=function(e){let n=new cE.THREE.Color(e);t.zincRenderer&&t.zincRenderer.getThreeJSRenderer().setClearColor(n,1)};let v=function(e,n,r,a){for(let e=0;e<i.length;e++)i[e](a,t.scene.isTimeVarying());r&&c.setGeometryColour(a,e,n);let o=new ED,s=a.region.getFullPath();o.data={species:t.sceneData.currentSpecies,system:e,part:n,group:a.groupName,region:s,uuid:a.uuid,lastActionOnMarker:!1},a.userData.annotation=o},y=function(e,t,n,r){for(let e=0;e<a.length;e++)a[e](r)},b=function(e,t,n){return function(r){v(e,t,n,r)}},x=function(e,t,n){return function(r){y(e,t,n,r)}},S=function(){return function(){t.settingsChanged(),t.sceneData.timeVarying=t.scene.isTimeVarying(),o&&o()}},C=function(){return function(e){if(e?.type===`Error`&&s){let t={xhr:e.xhr,type:`download-error`};s(t)}}};this.updateFieldvisibility=function(e,n){for(let r=0;r<e.length;r++)if(n!=r){let n=e[r].PartName;t.changeOrganPartsVisibility(n,!1)}if(n>-1){let r=e[n].PartName;if(t.scene.findGeometriesWithGroupName(r).length>0||t.scene.findGlyphsetsWithGroupName(r).length>0)t.changeOrganPartsVisibility(r,!0);else{let i=getOrganDetails(e[n].SystemName,r);i!=null&&t.scene.loadMetadataURL(c.getOrgansDirectoryPrefix()+`/`+i.meta)}}},this.getAvailableSpecies=function(e,t,n){let r=[];r.push(`none`);let i=Object.keys(organsFileMap);for(index in i){let a=i[index];a!=e&&organsFileMap[a].hasOwnProperty(t)&&organsFileMap[a][t].hasOwnProperty(n)&&r.push(a)}return r},this.getCentreAndSize=function(){let e=new cE.THREE.Vector3,t=this.scene.getBoundingBox();t.getCenter(e);let n=[e.x,e.y,e.z];return t.getSize(e),{centre:n,size:[e.x,e.y,e.z]}};let w=function(e,n,r,i){t.sceneData.nerveMapIsActive=!1,t.sceneData.nerveMap=void 0,t.sceneData.metaURL=``,t.sceneData.viewURL=``,t.sceneData.currentSpecies=e,t.sceneData.currentSystem=n,t.sceneData.currentPart=r,t.sceneData.currentTime=0,t.sceneData.timeVarying=!1;let a=``;e&&(a=e+`/`),n&&(a=n+`/`),r&&(a=r),t.sceneData.currentName=a};this.loadOrgansFromURL=function(e,n,i,a,o,s,c){if(t.zincRenderer&&a&&t.sceneData.metaURL!==e){w(n,i,a,void 0);let l=t.sceneData.currentName,u=t.zincRenderer.getSceneByName(l);u?s&&u.clearAll():u=t.zincRenderer.createScene(l),t.selectObjectOnPick=!0;for(let e=0;e<r.length;e++)r[e](t.sceneData);o&&o!=``?(t.sceneData.viewURL=o,u.loadViewURL(t.sceneData.viewURL)):t.sceneData.viewURL=void 0,t.sceneData.metaURL=e,u.addZincObjectAddedCallbacks(b(i,a,!1)),u.addZincObjectRemovedCallbacks(x(void 0,a,!1)),u.loadMetadataURL(e,C(),S(),c),t.scene=u,t.zincRenderer.setCurrentScene(u),t.graphicsHighlight.reset();let d=u.getZincCameraControls();d.enableRaycaster(u,h(),g()),d.setMouseButtonAction(`AUXILIARY`,`ZOOM`),d.setMouseButtonAction(`SECONDARY`,`PAN`)}},this.loadGLTFFromURL=function(e,n,i){if(t.zincRenderer&&n&&t.sceneData.metaURL!==e){w(void 0,void 0,n,void 0);let a=t.sceneData.currentName,o=t.zincRenderer.getSceneByName(a);o?i&&o.clearAll():o=t.zincRenderer.createScene(a);for(let e=0;e<r.length;e++)r[e](t.sceneData);t.sceneData.viewURL=void 0,t.sceneData.metaURL=e,o.addZincObjectAddedCallbacks(b(void 0,n,!1)),o.addZincObjectRemovedCallbacks(x(void 0,n,!1)),o.loadGLTF(e,void 0,S()),t.scene=o,t.zincRenderer.setCurrentScene(o),t.graphicsHighlight.reset();let s=o.getZincCameraControls();s.enableRaycaster(o,h(),g()),s.setMouseButtonAction(`AUXILIARY`,`ZOOM`),s.setMouseButtonAction(`SECONDARY`,`PAN`)}},this.alignCameraWithSelectedObject=function(e){let n=t.graphicsHighlight.getSelected();n&&n[0]&&n[0].userData&&t.scene.alignObjectToCameraView(n[0].userData,e)},this.exportSettings=function(){let e={};return e.name=t.instanceName,t.sceneData.currentSystem&&(e.system=t.sceneData.currentSystem),t.sceneData.currentSpecies&&(e.species=t.sceneData.currentSpecies),t.sceneData.currentPart&&(e.part=t.sceneData.currentPart),e.metaURL=t.sceneData.metaURL,t.sceneData.viewURL&&(e.viewURL=t.sceneData.viewURL),e.dialog=`Organ Viewer`,e},this.importSettings=function(e){return e&&e.dialog==this.typeName?(t.setName(e.name),e.metaURL!==void 0&&e.metaURL!=``?t.loadOrgansFromURL(e.metaURL,e.species,e.system,e.part,e.viewURL,!0):t.loadOrgans(e.species,e.system,e.part),!0):!1},function(){t.initialiseRenderer(void 0),t.zincRenderer&&(t.zincRenderer.addPreRenderCallbackFunction(f()),t.zincRenderer.addPostRenderCallbackFunction(p()))}()};OD.prototype=Object.create(TD.prototype);var kD=`ENTRIES`,AD=`KEYS`,jD=`VALUES`,MD=``,ND=class{constructor(e,t){let n=e._tree,r=Array.from(n.keys());this.set=e,this._type=t,this._path=r.length>0?[{node:n,keys:r}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:t}=PD(this._path);if(PD(t)===MD)return{done:!1,value:this.result()};let n=e.get(PD(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=PD(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>PD(e)).filter(e=>e!==MD).join(``)}value(){return PD(this._path).node.get(MD)}result(){switch(this._type){case jD:return this.value();case AD:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},PD=e=>e[e.length-1],FD=(e,t,n)=>{let r=new Map;if(t===void 0)return r;let i=t.length+1,a=i+n,o=new Uint8Array(a*i).fill(n+1);for(let e=0;e<i;++e)o[e]=e;for(let e=1;e<a;++e)o[e*i]=e;return ID(e,t,n,r,o,1,i,``),r},ID=(e,t,n,r,i,a,o,s)=>{let c=a*o;key:for(let l of e.keys())if(l===MD){let t=i[c-1];t<=n&&r.set(s,[e.get(l),t])}else{let c=a;for(let e=0;e<l.length;++e,++c){let r=l[e],a=o*c,s=a-o,u=i[a],d=Math.max(0,c-n-1),f=Math.min(o-1,c+n);for(let e=d;e<f;++e){let n=r!==t[e],o=i[s+e]+ +n,c=i[s+e+1]+1,l=i[a+e]+1,d=i[a+e+1]=Math.min(o,c,l);d<u&&(u=d)}if(u>n)continue key}ID(e.get(l),t,n,r,i,c,o,s+l)}},LD=class e{constructor(e=new Map,t=``){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(t){if(!t.startsWith(this._prefix))throw Error(`Mismatched prefix`);let[n,r]=RD(this._tree,t.slice(this._prefix.length));if(n===void 0){let[n,i]=WD(r);for(let r of n.keys())if(r!==MD&&r.startsWith(i)){let a=new Map;return a.set(r.slice(i.length),n.get(r)),new e(a,t)}}return new e(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,VD(this._tree,e)}entries(){return new ND(this,kD)}forEach(e){for(let[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return FD(this._tree,e,t)}get(e){let t=zD(this._tree,e);return t===void 0?void 0:t.get(MD)}has(e){let t=zD(this._tree,e);return t!==void 0&&t.has(MD)}keys(){return new ND(this,AD)}set(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);return this._size=void 0,BD(this._tree,e).set(MD,t),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=BD(this._tree,e);return n.set(MD,t(n.get(MD))),this}fetch(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=BD(this._tree,e),r=n.get(MD);return r===void 0&&n.set(MD,r=t()),r}values(){return new ND(this,jD)}[Symbol.iterator](){return this.entries()}static from(t){let n=new e;for(let[e,r]of t)n.set(e,r);return n}static fromObject(t){return e.from(Object.entries(t))}},RD=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(let r of e.keys())if(r!==MD&&t.startsWith(r))return n.push([e,r]),RD(e.get(r),t.slice(r.length),n);return n.push([e,t]),RD(void 0,``,n)},zD=(e,t)=>{if(t.length===0||e==null)return e;for(let n of e.keys())if(n!==MD&&t.startsWith(n))return zD(e.get(n),t.slice(n.length))},BD=(e,t)=>{let n=t.length;outer:for(let r=0;e&&r<n;){for(let i of e.keys())if(i!==MD&&t[r]===i[0]){let a=Math.min(n-r,i.length),o=1;for(;o<a&&t[r+o]===i[o];)++o;let s=e.get(i);if(o===i.length)e=s;else{let n=new Map;n.set(i.slice(o),s),e.set(t.slice(r,r+o),n),e.delete(i),e=n}r+=o;continue outer}let i=new Map;return e.set(t.slice(r),i),i}return e},VD=(e,t)=>{let[n,r]=RD(e,t);if(n!==void 0){if(n.delete(MD),n.size===0)HD(r);else if(n.size===1){let[e,t]=n.entries().next().value;UD(r,e,t)}}},HD=e=>{if(e.length===0)return;let[t,n]=WD(e);if(t.delete(n),t.size===0)HD(e.slice(0,-1));else if(t.size===1){let[n,r]=t.entries().next().value;n!==MD&&UD(e.slice(0,-1),n,r)}},UD=(e,t,n)=>{if(e.length===0)return;let[r,i]=WD(e);r.set(i+t,n),r.delete(i)},WD=e=>e[e.length-1],GD=`or`,KD=`and`,qD=`and_not`,JD=class e{constructor(e){if(e?.fields==null)throw Error(`MiniSearch: option "fields" must be provided`);let t=e.autoVacuum==null||e.autoVacuum===!0?aO:e.autoVacuum;this._options={...eO,...e,autoVacuum:t,searchOptions:{...tO,...e.searchOptions||{}},autoSuggestOptions:{...nO,...e.autoSuggestOptions||{}}},this._index=new LD,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=iO,this.addFields(this._options.fields)}add(e){let{extractField:t,stringifyField:n,tokenize:r,processTerm:i,fields:a,idField:o}=this._options,s=t(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(s))throw Error(`MiniSearch: duplicate ID ${s}`);let c=this.addDocumentId(s);this.saveStoredFields(c,e);for(let o of a){let a=t(e,o);if(a==null)continue;let s=r(n(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.addFieldLength(c,l,this._documentCount-1,u);for(let e of s){let t=i(e,o);if(Array.isArray(t))for(let e of t)this.addTerm(l,c,e);else t&&this.addTerm(l,c,t)}}}addAll(e){for(let t of e)this.add(t)}addAllAsync(e,t={}){let{chunkSize:n=10}=t,r={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:e,promise:t},r,i)=>(e.push(r),(i+1)%n===0?{chunk:[],promise:t.then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.addAll(e))}:{chunk:e,promise:t}),r);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:t,processTerm:n,extractField:r,stringifyField:i,fields:a,idField:o}=this._options,s=r(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);let c=this._idToShortId.get(s);if(c==null)throw Error(`MiniSearch: cannot remove document with ID ${s}: it is not in the index`);for(let o of a){let a=r(e,o);if(a==null)continue;let s=t(i(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.removeFieldLength(c,l,this._documentCount,u);for(let e of s){let t=n(e,o);if(Array.isArray(t))for(let e of t)this.removeTerm(l,c,e);else t&&this.removeTerm(l,c,t)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(s),this._fieldLength.delete(c),--this._documentCount}removeAll(e){if(e)for(let t of e)this.remove(t);else if(arguments.length>0)throw Error(`Expected documents to be present. Omit the argument to remove all documents.`);else this._index=new LD,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}discard(e){let t=this._idToShortId.get(e);if(t==null)throw Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((e,n)=>{this.removeFieldLength(t,n,this._documentCount,e)}),this._fieldLength.delete(t),--this._documentCount,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:r}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:r},{minDirtCount:t,minDirtFactor:e})}discardAll(e){let t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let t of e)this.discard(t)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){let{idField:t,extractField:n}=this._options,r=n(e,t);this.discard(r),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum??=this._currentVacuum.then(()=>{let t=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=iO,this.performVacuuming(e,t)}),this._enqueuedVacuum):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){let n=this._dirtCount;if(this.vacuumConditionsMet(t)){let t=e.batchSize||rO.batchSize,r=e.batchWait||rO.batchWait,i=1;for(let[e,n]of this._index){for(let[e,t]of n)for(let[r]of t)this._documentIds.has(r)||(t.size<=1?n.delete(e):t.delete(r));this._index.get(e).size===0&&this._index.delete(e),i%t===0&&await new Promise(e=>setTimeout(e,r)),i+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t||=aO.minDirtCount,n||=aO.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(t,n={}){let{searchOptions:r}=this._options,i={...r,...n},a=this.executeQuery(t,n),o=[];for(let[e,{score:t,terms:n,match:r}]of a){let a=n.length||1,s={id:this._documentIds.get(e),score:t*a,terms:Object.keys(r),queryTerms:n,match:r};Object.assign(s,this._storedFields.get(e)),(i.filter==null||i.filter(s))&&o.push(s)}return t===e.wildcard&&i.boostDocument==null||o.sort(cO),o}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};let n=new Map;for(let{score:r,terms:i}of this.search(e,t)){let e=i.join(` `),t=n.get(e);t==null?n.set(e,{score:r,terms:i,count:1}):(t.score+=r,t.count+=1)}let r=[];for(let[e,{score:t,terms:i,count:a}]of n)r.push({suggestion:e,terms:i,score:t/a});return r.sort(cO),r}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJS(JSON.parse(e),t)}static async loadJSONAsync(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(eO.hasOwnProperty(e))return YD(eO,e);throw Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=uO(r),s._fieldLength=uO(i),s._storedFields=uO(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);for(let[e,t]of n){let n=new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),uO(r))}s._index.set(e,n)}return s}static async loadJSAsync(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=await dO(r),s._fieldLength=await dO(i),s._storedFields=await dO(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);let c=0;for(let[e,t]of n){let n=new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),await dO(r))}++c%1e3==0&&await fO(0),s._index.set(e,n)}return s}static instantiateMiniSearch(t,n){let{documentCount:r,nextId:i,fieldIds:a,averageFieldLength:o,dirtCount:s,serializationVersion:c}=t;if(c!==1&&c!==2)throw Error(`MiniSearch: cannot deserialize an index created with an incompatible version`);let l=new e(n);return l._documentCount=r,l._nextId=i,l._idToShortId=new Map,l._fieldIds=a,l._avgFieldLength=o,l._dirtCount=s||0,l._index=new LD,l}executeQuery(t,n={}){if(t===e.wildcard)return this.executeWildcardQuery(n);if(typeof t!=`string`){let e={...n,...t,queries:void 0},r=t.queries.map(t=>this.executeQuery(t,e));return this.combineResults(r,e.combineWith)}let{tokenize:r,processTerm:i,searchOptions:a}=this._options,o={tokenize:r,processTerm:i,...a,...n},{tokenize:s,processTerm:c}=o,l=s(t).flatMap(e=>c(e)).filter(e=>!!e).map($D(o)).map(e=>this.executeQuerySpec(e,o));return this.combineResults(l,o.combineWith)}executeQuerySpec(e,t){let n={...this._options.searchOptions,...t},r=(n.fields||this._options.fields).reduce((e,t)=>({...e,[t]:YD(n.boost,t)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:o,bm25:s}=n,{fuzzy:c,prefix:l}={...tO.weights,...a},u=this._index.get(e.term),d=this.termResults(e.term,e.term,1,e.termBoost,u,r,i,s),f,p;if(e.prefix&&(f=this._index.atPrefix(e.term)),e.fuzzy){let t=e.fuzzy===!0?.2:e.fuzzy,n=t<1?Math.min(o,Math.round(e.term.length*t)):t;n&&(p=this._index.fuzzyGet(e.term,n))}if(f)for(let[t,n]of f){let a=t.length-e.term.length;if(!a)continue;p?.delete(t);let o=l*t.length/(t.length+.3*a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}if(p)for(let t of p.keys()){let[n,a]=p.get(t);if(!a)continue;let o=c*t.length/(t.length+a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}return d}executeWildcardQuery(e){let t=new Map,n={...this._options.searchOptions,...e};for(let[e,r]of this._documentIds){let i=n.boostDocument?n.boostDocument(r,``,this._storedFields.get(e)):1;t.set(e,{score:i,terms:[],match:{}})}return t}combineResults(e,t=GD){if(e.length===0)return new Map;let n=XD[t.toLowerCase()];if(!n)throw Error(`Invalid combination operator: ${t}`);return e.reduce(n)||new Map}toJSON(){let e=[];for(let[t,n]of this._index){let r={};for(let[e,t]of n)r[e]=Object.fromEntries(t);e.push([t,r])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,t,n,r,i,a,o,s,c=new Map){if(i==null)return c;for(let l of Object.keys(a)){let u=a[l],d=this._fieldIds[l],f=i.get(d);if(f==null)continue;let p=f.size,m=this._avgFieldLength[d];for(let i of f.keys()){if(!this._documentIds.has(i)){this.removeTerm(d,i,t),--p;continue}let a=o?o(this._documentIds.get(i),t,this._storedFields.get(i)):1;if(!a)continue;let h=f.get(i),g=this._fieldLength.get(i)[d],_=QD(h,p,this._documentCount,g,m,s),v=n*r*u*a*_,y=c.get(i);if(y){y.score+=v,oO(y.terms,e);let n=YD(y.match,t);n?n.push(l):y.match[t]=[l]}else c.set(i,{score:v,terms:[e],match:{[t]:[l]}})}}return c}addTerm(e,t,n){let r=this._index.fetch(n,lO),i=r.get(e);if(i==null)i=new Map,i.set(t,1),r.set(e,i);else{let e=i.get(t);i.set(t,(e||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}let r=this._index.fetch(n,lO),i=r.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,n):i.get(t)<=1?i.size<=1?r.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(let r of Object.keys(this._fieldIds))if(this._fieldIds[r]===t){this._options.logger(`warn`,`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${r}". Removing a document after it has changed can corrupt the index!`,`version_conflict`);return}}addDocumentId(e){let t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,r){let i=this._fieldLength.get(e);i??this._fieldLength.set(e,i=[]),i[t]=r;let a=(this._avgFieldLength[t]||0)*n+r;this._avgFieldLength[t]=a/(n+1)}removeFieldLength(e,t,n,r){if(n===1){this._avgFieldLength[t]=0;return}let i=this._avgFieldLength[t]*n-r;this._avgFieldLength[t]=i/(n-1)}saveStoredFields(e,t){let{storeFields:n,extractField:r}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i??this._storedFields.set(e,i={});for(let e of n){let n=r(t,e);n!==void 0&&(i[e]=n)}}};JD.wildcard=Symbol(`*`);var YD=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,XD={[GD]:(e,t)=>{for(let n of t.keys()){let r=e.get(n);if(r==null)e.set(n,t.get(n));else{let{score:e,terms:i,match:a}=t.get(n);r.score+=e,r.match=Object.assign(r.match,a),sO(r.terms,i)}}return e},[KD]:(e,t)=>{let n=new Map;for(let r of t.keys()){let i=e.get(r);if(i==null)continue;let{score:a,terms:o,match:s}=t.get(r);sO(i.terms,o),n.set(r,{score:i.score+a,terms:i.terms,match:Object.assign(i.match,s)})}return n},[qD]:(e,t)=>{for(let n of t.keys())e.delete(n);return e}},ZD={k:1.2,b:.7,d:.5},QD=(e,t,n,r,i,a)=>{let{k:o,b:s,d:c}=a;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(o+1)/(e+o*(1-s+s*r/i)))},$D=e=>(t,n,r)=>({term:t,fuzzy:typeof e.fuzzy==`function`?e.fuzzy(t,n,r):e.fuzzy||!1,prefix:typeof e.prefix==`function`?e.prefix(t,n,r):e.prefix===!0,termBoost:typeof e.boostTerm==`function`?e.boostTerm(t,n,r):1}),eO={idField:`id`,extractField:(e,t)=>e[t],stringifyField:(e,t)=>e.toString(),tokenize:e=>e.split(pO),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])==`function`&&console[e](t)},autoVacuum:!0},tO={combineWith:GD,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:ZD},nO={combineWith:KD,prefix:(e,t,n)=>t===n.length-1},rO={batchSize:1e3,batchWait:10},iO={minDirtFactor:.1,minDirtCount:20},aO={...rO,...iO},oO=(e,t)=>{e.includes(t)||e.push(t)},sO=(e,t)=>{for(let n of t)e.includes(n)||e.push(n)},cO=({score:e},{score:t})=>t-e,lO=()=>new Map,uO=e=>{let t=new Map;for(let n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},dO=async e=>{let t=new Map,n=0;for(let r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3==0&&await fO(0);return t},fO=e=>new Promise(t=>setTimeout(t,e)),pO=/[\n\r\p{Z}\p{P}]+/u,mO=class{constructor(){this._searchEngine=new JD({fields:[`path`,`name`],storeFields:[`path`],tokenize:(e,t)=>e.split(/[\s/]+/)}),this.idMaps={}}updateZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.replace(a),this.idMaps[t]={path:i,zincObject:e}}addZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.add(a),this.idMaps[t]={path:i,zincObject:e}}removeZincObject(e,t){let n=e.getRegion().getFullPath(),r=e.groupName,i=n?`${n}/${e.groupName}`:e.groupName;r=r.replaceAll(`"`,``),i=i.replaceAll(`"`,``);let a={path:i,name:r,id:t};this._searchEngine.remove(a),delete this.idMaps[t]}addRegion(e,t){let n=e.getFullPath(),r=e.getName();n=n.replaceAll(`"`,``),r=r.replaceAll(`"`,``);let i={path:n,name:r,id:t};this._searchEngine.add(i),this.idMaps[t]={path:n,zincObject:e}}clearResults(){this._}removeAll(){this._searchEngine.removeAll(),this.idMaps={}}auto_suggest(e){let t=[];e.length>2&&[`'`,`"`].includes(e.slice(0,1))?(e=e.replaceAll(e.slice(0,1),``),t=this._searchEngine.search(e,{prefix:!0,combineWith:`AND`})):e.length>1&&(t=this._searchEngine.search(e,{prefix:!0}));let n=[];t.forEach(e=>{e.id in this.idMaps&&n.push(this.idMaps[e.id].path)});let r=[...new Set(n)],i=[];return r.forEach(e=>i.push({suggestion:`"`+e+`"`})),i}processResults(e,t){let n={regionPath:void 0,label:`Search Results for "`};return Array.isArray(t)?n.label+=`,`.join(t):n.label+=t,n.label+=`"`,e.length===1&&(e[0].isRegion?n.regionPath=e[0].getFullPath():e[0].isZincObject&&(n.regionPath=e[0].getRegion().getFullPath(),n.label=e[0].groupName)),n.zincObjects=wE(e),n}search(e){let t;e.length>2&&[`'`,`"`].includes(e.slice(0,1))?(e=e.replaceAll(e.slice(0,1),``),t=this._searchEngine.search(e,{prefix:!0,combineWith:`AND`})):e.length>1&&(t=this._searchEngine.search(e,{prefix:!0}));let n=[];return t.forEach(e=>{e.id in this.idMaps&&n.push(this.idMaps[e.id].zincObject)}),n}searchTerms(e){let t=[];return e.forEach(e=>{let n=this.search(e);t.push(...n)}),t}searchAndProcessResult(e){let t=[];return t=Array.isArray(e)?this.searchTerms(e):this.search(e),this.processResults(t,e)}},hO=[{id:0,nerve_id:`ILX:0793723`,label:`Auriculotemporal nerve`,"FMA subclasses (in human nerves)":[`FMA:53002`,`FMA:53001`],"subclass labels":[`Left auriculotemporal nerve`,`Right auriculotemporal nerve`]},{id:1,nerve_id:`ILX:0792409`,label:`gray communicating ramus of tenth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6895`,`FMA:6894`],"subclass labels":[`Left T10 grey ramus communicans`,`Right T10 grey ramus communicans`]},{id:2,nerve_id:`UBERON:0011326`,label:`superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53530`,`FMA:53536`],"subclass labels":[`Right superior laryngeal nerve`,`Left superior laryngeal nerve`]},{id:3,nerve_id:`ILX:0793220`,label:`white communicating ramus of first lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:4,nerve_id:`ILX:0787082`,label:`gray communicating ramus of the first thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6082`,`FMA:6084`],"subclass labels":[`Right T1 grey ramus communicans`,`Left T1 grey ramus communicans`]},{id:5,nerve_id:`ILX:0793809`,label:`Clitoral cavernous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:6,nerve_id:`UBERON:0011096`,label:`lacrimal nerve`,"FMA subclasses (in human nerves)":[`FMA:52630`,`FMA:52629`],"subclass labels":[`Left lacrimal nerve`,`Right lacrimal nerve`]},{id:7,nerve_id:`ILX:0793215`,label:`white communicating ramus of ninth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:8,nerve_id:`ILX:0795005`,label:`Posterior cutaneous nerve of arm`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:9,nerve_id:`UBERON:0001649`,label:`glossopharyngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:50894`,`FMA:50892`],"subclass labels":[]},{id:10,nerve_id:`UBERON:0022302`,label:`short ciliary nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:11,nerve_id:`ILX:0785932`,label:`gray communicating ramus of third lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65920`,`FMA:65919`],"subclass labels":[`Left L3 grey ramus communicans`,`Right L3 grey ramus communicans`]},{id:12,nerve_id:`ILX:0738293`,label:`Ganglioglomerular nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:13,nerve_id:`ILX:0739298`,label:`gray communicating ramus of twelfth thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:14,nerve_id:`UBERON:0001492`,label:`radial nerve`,"FMA subclasses (in human nerves)":[`FMA:37070`,`FMA:37071`],"subclass labels":[`Right radial nerve`,`Left radial nerve`]},{id:15,nerve_id:`ILX:0793214`,label:`white communicating ramus of eighth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:16,nerve_id:`UBERON:0018681`,label:`lesser splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6957`,`FMA:6958`],"subclass labels":[`Right lesser splanchnic nerve`,`Left lesser splanchnic nerve`]},{id:17,nerve_id:`ILX:0794476`,label:`abdominal branch of vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:18,nerve_id:`ILX:0791105`,label:`gray communicating ramus of the second thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6122`,`FMA:6757`],"subclass labels":[`Right T2 grey ramus communicans`,`Left T2 grey ramus communicans`]},{id:19,nerve_id:`ILX:0794853`,label:`esophageal vagus trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:20,nerve_id:`ILX:0793210`,label:`white communicating ramus of fourth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:21,nerve_id:`UBERON:0001759`,label:`vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:22,nerve_id:`UBERON:0009675`,label:`chorda tympani branch of facial nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:23,nerve_id:`ILX:0794949`,label:`recurrent branch of the median nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:24,nerve_id:`ILX:0789339`,label:`Pharyngeal branch of glossopharyngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53495`,`FMA:53494`],"subclass labels":[`Pharyngeal branch of left glossopharyngeal nerve`,`Pharyngeal branch of right glossopharyngeal nerve`]},{id:25,nerve_id:`ILX:0793712`,label:`Zygomatic nerve`,"FMA subclasses (in human nerves)":[`FMA:52968`,`FMA:52969`],"subclass labels":[`Right zygomatic nerve`,`Left zygomatic nerve`]},{id:26,nerve_id:`ILX:0788536`,label:`gray communicating ramus of fourth lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65917`,`FMA:65918`],"subclass labels":[`Right L4 grey ramus communicans`,`Left L4 grey ramus communicans`]},{id:27,nerve_id:`UBERON:0018680`,label:`greater splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6956`,`FMA:6955`],"subclass labels":[`Right greater splanchnic nerve`,`Left greater splanchnic nerve`]},{id:28,nerve_id:`UBERON:0001322`,label:`sciatic nerve`,"FMA subclasses (in human nerves)":[`FMA:22111`,`FMA:22112`],"subclass labels":[`Right sciatic nerve`,`Left sciatic nerve`]},{id:29,nerve_id:`ILX:0793209`,label:`white communicating ramus of third thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:30,nerve_id:`UBERON:0011391`,label:`perineal nerve`,"FMA subclasses (in human nerves)":[`FMA:21874`,`FMA:21873`],"subclass labels":[`Left perineal nerve`,`Right perineal nerve`]},{id:31,nerve_id:`ILX:0788945`,label:`gray communicating ramus of the fourth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6759`,`FMA:6758`],"subclass labels":[`Right T4 grey ramus communicans`,`Left T4 grey ramus communicans`]},{id:32,nerve_id:`ILX:0790497`,label:`Gray communicating ramus of cervicothoracic ganglion to first thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:33,nerve_id:`UBERON:0001323`,label:`tibial nerve`,"FMA subclasses (in human nerves)":[`FMA:22109`,`FMA:22110`],"subclass labels":[`Right tibial nerve`,`Left tibial nerve`]},{id:34,nerve_id:`ILX:0794969`,label:`deep branch of ulnar nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:35,nerve_id:`ILX:0793227`,label:`gray communicating ramus of thirteenth thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:36,nerve_id:`ILX:0793228`,label:`gray communicating ramus of first sacral nerve`,"FMA subclasses (in human nerves)":[`FMA:65992`,`FMA:65991`],"subclass labels":[`Left S1 grey ramus communicans`,`Right S1 grey ramus communicans`]},{id:37,nerve_id:`UBERON:0035111`,label:`medial plantar nerve`,"FMA subclasses (in human nerves)":[`FMA:45435`,`FMA:45434`],"subclass labels":[`Left medial plantar nerve`,`Right medial plantar nerve`]},{id:38,nerve_id:`UBERON:0001780`,label:`spinal nerve`,"FMA subclasses (in human nerves)":`FMA:6117.FMA:6435.FMA:6295.FMA:6422.FMA:6417.FMA:6421.FMA:6038.FMA:6292.FMA:6439.FMA:6313.FMA:6410.FMA:6412.FMA:6088.FMA:6298.FMA:6433.FMA:6411.FMA:6438.FMA:6314.FMA:6291.FMA:6420.FMA:6116.FMA:6413.FMA:6310.FMA:6432.FMA:6305.FMA:6182.FMA:6297.FMA:6436.FMA:6418.FMA:6039.FMA:6089.FMA:6301.FMA:6294.FMA:6303.FMA:6183.FMA:6434.FMA:6429.FMA:6308.FMA:6300.FMA:6430.FMA:6428.FMA:6419.FMA:6437.FMA:6307.FMA:6311.FMA:6431`.split(`.`),"subclass labels":`Left T3 spinal nerve.Left S4 spinal nerve.Left T5 spinal nerve.Left L5 spinal nerve.Right L3 spinal nerve.Right L5 spinal nerve.Right T1 spinal nerve.Left T4 spinal nerve.Left coccygeal spinal nerve.Right T11 spinal nerve.Right L1 spinal nerve.Right L2 spinal nerve.Right T2 spinal nerve.Left T6 spinal nerve.Left S3 spinal nerve.Left L1 spinal nerve.Right coccygeal spinal nerve.Left T11 spinal nerve.Right T4 spinal nerve.Left L4 spinal nerve.Right T3 spinal nerve.Left L2 spinal nerve.Right T10 spinal nerve.Right S3 spinal nerve.Left T8 spinal nerve.Right T12 spinal nerve.Right T6 spinal nerve.Right S5 spinal nerve.Left L3 spinal nerve.Left T1 spinal nerve.Left T2 spinal nerve.Left T7 spinal nerve.Right T5 spinal nerve.Right T8 spinal nerve.Left T12 spinal nerve.Right S4 spinal nerve.Left S1 spinal nerve.Left T9 spinal nerve.Right T7 spinal nerve.Right S2 spinal nerve.Right S1 spinal nerve.Right L4 spinal nerve.Left S5 spinal nerve.Right T9 spinal nerve.Left T10 spinal nerve.Left S2 spinal nerve`.split(`.`)},{id:39,nerve_id:`UBERON:0018683`,label:`lumbar splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6924`,`FMA:6928`,`FMA:6929`,`FMA:6931`,`FMA:6925`,`FMA:6930`,`FMA:6927`,`FMA:6926`],"subclass labels":[`Right first lumbar splanchnic nerve`,`Right third lumbar splanchnic nerve`,`Left third lumbar splanchnic nerve`,`Left fourth lumbar splanchnic nerve`,`Left first lumbar splanchnic nerve`,`Right fourth lumbar splanchnic nerve`,`Left second lumbar splanchnic nerve`,`Right second lumbar splanchnic nerve`]},{id:40,nerve_id:`UBERON:0001643`,label:`oculomotor nerve`,"FMA subclasses (in human nerves)":[`FMA:50880`,`FMA:50879`],"subclass labels":[`Left oculomotor nerve`,`Right oculomotor nerve`]},{id:41,nerve_id:`ILX:0793212`,label:`white communicating ramus of sixth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:42,nerve_id:`UBERON:0003724`,label:`musculocutaneous nerve`,"FMA subclasses (in human nerves)":[`FMA:37066`,`FMA:37065`],"subclass labels":[`Left musculocutaneous nerve`,`Right musculocutaneous nerve`]},{id:43,nerve_id:`ILX:0738372`,label:`white communicating ramus of first thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:44,nerve_id:`ILX:0793563`,label:`splenic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:45,nerve_id:`UBERON:0035526`,label:`superficial fibular nerve`,"FMA subclasses (in human nerves)":[`FMA:45363`,`FMA:45364`],"subclass labels":[`Right superficial fibular nerve`,`Left superficial fibular nerve`]},{id:46,nerve_id:`ILX:0791560`,label:`gray communicating ramus of eighth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6891`,`FMA:6890`],"subclass labels":[`Left T8 grey ramus communicans`,`Right T8 grey ramus communicans`]},{id:47,nerve_id:`ILX:0793827`,label:`posterior abdominal vagal trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:48,nerve_id:`ILX:0794141`,label:`right cervical vagus nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:49,nerve_id:`ILX:0793714`,label:`Mesenteric nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:50,nerve_id:`UBERON:0001964`,label:`least splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6960`,`FMA:6959`],"subclass labels":[`Left least splanchnic nerve`,`Right least splanchnic nerve`]},{id:51,nerve_id:`UBERON:0001267`,label:`femoral nerve`,"FMA subclasses (in human nerves)":[`FMA:16499`,`FMA:16500`],"subclass labels":[`Right femoral nerve`,`Left femoral nerve`]},{id:52,nerve_id:`UBERON:0034984`,label:`nerve to quadratus femoris`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:53,nerve_id:`UBERON:0003721`,label:`lingual nerve`,"FMA subclasses (in human nerves)":[`FMA:53219`,`FMA:53220`],"subclass labels":[`Right lingual nerve`,`Left lingual nerve`]},{id:54,nerve_id:`UBERON:0036216`,label:`tympanic nerve`,"FMA subclasses (in human nerves)":[`FMA:53481`,`FMA:53482`],"subclass labels":[`Right tympanic nerve`,`Left tympanic nerve`]},{id:55,nerve_id:`ILX:0793216`,label:`white communicating ramus of tenth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:56,nerve_id:`ILX:0793362`,label:`White communicating ramus of fourth lumbar anterior ramus`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:57,nerve_id:`ILX:0793561`,label:`Internal branch of superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53539`,`FMA:53540`],"subclass labels":[`Right internal laryngeal nerve`,`Left internal laryngeal nerve`]},{id:58,nerve_id:`ILX:0738312`,label:`Aortic arch depressor nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:59,nerve_id:`ILX:0793218`,label:`white communicating ramus of twelfth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:60,nerve_id:`ILX:0738308`,label:`External branch of inferior laryngeal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:61,nerve_id:`ILX:0739299`,label:`gray communicating ramus of sixth lumbar nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:62,nerve_id:`ILX:0793559`,label:`bladder nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:63,nerve_id:`ILX:0793822`,label:`Superior ovarian nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:64,nerve_id:`ILX:0793807`,label:`Penile cavernous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:65,nerve_id:`UBERON:0011390`,label:`pudendal nerve`,"FMA subclasses (in human nerves)":[`FMA:21863`,`FMA:21864`],"subclass labels":[`Right pudendal nerve`,`Left pudendal nerve`]},{id:66,nerve_id:`UBERON:0008810`,label:`nasopalatine nerve`,"FMA subclasses (in human nerves)":[`FMA:52799`,`FMA:52798`],"subclass labels":[`Left nasopalatine nerve`,`Right nasopalatine nerve`]},{id:67,nerve_id:`ILX:0793219`,label:`white communicating ramus of thirteenth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:68,nerve_id:`ILX:0793632`,label:`lumbar colonic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:69,nerve_id:`ILX:0784439`,label:`gray communicating ramus of the fifth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6760`,`FMA:6761`],"subclass labels":[`Left T5 grey ramus communicans`,`Right T5 grey ramus communicans`]},{id:70,nerve_id:`ILX:0794977`,label:`deep branch of radial nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:71,nerve_id:`UBERON:0001884`,label:`phrenic nerve`,"FMA subclasses (in human nerves)":[`FMA:6193`,`FMA:6192`],"subclass labels":[`Left phrenic nerve`,`Right phrenic nerve`]},{id:72,nerve_id:`UBERON:0035110`,label:`lateral plantar nerve`,"FMA subclasses (in human nerves)":[`FMA:45450`,`FMA:45451`],"subclass labels":[`Right lateral plantar nerve`,`Left lateral plantar nerve`]},{id:73,nerve_id:`ILX:0793711`,label:`Communicating branch of zygomatic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:74,nerve_id:`ILX:0793560`,label:`External branch of superior laryngeal nerve`,"FMA subclasses (in human nerves)":[`FMA:53537`,`FMA:53538`],"subclass labels":[`Right external laryngeal nerve`,`Left external laryngeal nerve`]},{id:75,nerve_id:`ILX:0738309`,label:`Internal branch of inferior laryngeal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:76,nerve_id:`UBERON:0001021`,label:`nerve`,"FMA subclasses (in human nerves)":`FMA:6775.FMA:6894.FMA:6784.FMA:6728.FMA:65325.FMA:21873.FMA:45429.FMA:6844.FMA:53609.FMA:7116.FMA:44770.FMA:8916.FMA:52995.FMA:6071.FMA:45309.FMA:6122.FMA:6892.FMA:6767.FMA:16405.FMA:53560.FMA:6092.FMA:65343.FMA:37066.FMA:8894.FMA:8868.FMA:65341.FMA:53559.FMA:8897.FMA:82956.FMA:20633.FMA:6763.FMA:65339.FMA:8829.FMA:16493.FMA:8817.FMA:8821.FMA:11757.FMA:45456.FMA:45422.FMA:11261.FMA:65388.FMA:6192.FMA:65347.FMA:37068.FMA:65995.FMA:6764.FMA:39081.FMA:45338.FMA:53402.FMA:11210.FMA:52644.FMA:37067.FMA:65313.FMA:11153.FMA:6155.FMA:8797.FMA:53302.FMA:8883.FMA:53067.FMA:52939.FMA:53301.FMA:292889.FMA:45423.FMA:8791.FMA:45380.FMA:11759.FMA:7305.FMA:8830.FMA:78650.FMA:65389.FMA:45387.FMA:8827.FMA:8912.FMA:52941.FMA:6743.FMA:7126.FMA:53485.FMA:16492.FMA:53399.FMA:65337.FMA:11209.FMA:6772.FMA:52726.FMA:6121.FMA:52627.FMA:52974.FMA:53571.FMA:6729.FMA:8729.FMA:53606.FMA:80025.FMA:53481.FMA:53575.FMA:45451.FMA:11218.FMA:22109.FMA:6852.FMA:8909.FMA:11751.FMA:65991.FMA:8836.FMA:65350.FMA:53423.FMA:65569.FMA:65314.FMA:82957.FMA:65438.FMA:39146.FMA:8911.FMA:22111.FMA:65916.FMA:65739.FMA:65917.FMA:6779.FMA:8889.FMA:65924.FMA:65316.FMA:53002.FMA:16887.FMA:53366.FMA:6890.FMA:8790.FMA:6730.FMA:45358.FMA:52716.FMA:53494.FMA:7115.FMA:53561.FMA:78655.FMA:45366.FMA:11219.FMA:11555.FMA:7092.FMA:53220.FMA:45428.FMA:6193.FMA:20604.FMA:45433.FMA:21874.FMA:21875.FMA:53244.FMA:45432.FMA:6770.FMA:52640.FMA:11249.FMA:20630.FMA:53308.FMA:11216.FMA:65399.FMA:78649.FMA:11084.FMA:6897.FMA:53633.FMA:6085.FMA:6851.FMA:45457.FMA:6757.FMA:8732.FMA:8824.FMA:20632.FMA:6137.FMA:52730.FMA:7301.FMA:52699.FMA:53607.FMA:7300.FMA:53576.FMA:44904.FMA:65342.FMA:7127.FMA:6737.FMA:52669.FMA:21876.FMA:45425.FMA:65999.FMA:8728.FMA:21871.FMA:55172.FMA:6149.FMA:45453.FMA:44932.FMA:292832.FMA:6744.FMA:6781.FMA:44769.FMA:45326.FMA:6760.FMA:53634.FMA:53605.FMA:53530.FMA:6821.FMA:52968.FMA:53001.FMA:11552.FMA:45264.FMA:8835.FMA:6888.FMA:55160.FMA:44899.FMA:52979.FMA:45333.FMA:45310.FMA:6084.FMA:11781.FMA:82962.FMA:53280.FMA:52715.FMA:53311.FMA:16491.FMA:21880.FMA:44952.FMA:11687.FMA:11212.FMA:65335.FMA:52940.FMA:6774.FMA:8823.FMA:45388.FMA:6666.FMA:6072.FMA:16886.FMA:53312.FMA:65915.FMA:45357.FMA:11262.FMA:65921.FMA:0328826.FMA:81290.FMA:53279.FMA:11551.FMA:7293.FMA:6677.FMA:11756.FMA:53598.FMA:52732.FMA:44902.FMA:53545.FMA:6740.FMA:53502.FMA:53562.FMA:52700.FMA:7122.FMA:6118.FMA:65918.FMA:8814.FMA:16403.FMA:65346.FMA:6667.FMA:52630.FMA:52629.FMA:8871.FMA:16500.FMA:52725.FMA:6108.FMA:45363.FMA:65340.FMA:8872.FMA:11760.FMA:53604.FMA:11214.FMA:52777.FMA:21864.FMA:53503.FMA:6738.FMA:66000.FMA:6776.FMA:6777.FMA:6765.FMA:6111.FMA:8890.FMA:20607.FMA:52643.FMA:8908.FMA:65437.FMA:6762.FMA:11154.FMA:65344.FMA:52937.FMA:8919.FMA:45354.FMA:6766.FMA:53424.FMA:6145.FMA:65568.FMA:20634.FMA:6732.FMA:8893.FMA:11758.FMA:6889.FMA:11554.FMA:65922.FMA:7118.FMA:16884.FMA:45308.FMA:7290.FMA:6758.FMA:65743.FMA:11063.FMA:16885.FMA:8882.FMA:65286.FMA:291238.FMA:53482.FMA:52976.FMA:11308.FMA:53432.FMA:53540.FMA:45379.FMA:44871.FMA:6714.FMA:82955.FMA:65993.FMA:45452.FMA:52626.FMA:6083.FMA:53582.FMA:65919.FMA:52936.FMA:53506.FMA:8918.FMA:44901.FMA:6073.FMA:65315.FMA:53219.FMA:11194.FMA:6792.FMA:7119.FMA:52785.FMA:7296.FMA:53068.FMA:6845.FMA:52677.FMA:53504.FMA:53548.FMA:52698.FMA:53570.FMA:6771.FMA:7078.FMA:65997.FMA:65338.FMA:52969.FMA:16401.FMA:65416.FMA:6835.FMA:39082.FMA:8726.FMA:45254.FMA:8879.FMA:11250.FMA:53049.FMA:45382.FMA:8795.FMA:53495.FMA:45434.FMA:82963.FMA:0328827.FMA:52656.FMA:82961.FMA:11753.FMA:39147.FMA:45339.FMA:20605.FMA:20631.FMA:8898.FMA:6070.FMA:44892.FMA:16404.FMA:52942.FMA:6082.FMA:8861.FMA:82953.FMA:8808.FMA:8805.FMA:52994.FMA:65348.FMA:55173.FMA:7129.FMA:52674.FMA:44894.FMA:55159.FMA:65327.FMA:37320.FMA:6761.FMA:65349.FMA:11253.FMA:53507.FMA:11213.FMA:7307.FMA:6769.FMA:6759.FMA:55155.FMA:53675.FMA:53599.FMA:65282.FMA:53251.FMA:6731.FMA:11111.FMA:16497.FMA:8878.FMA:11211.FMA:65740.FMA:45367.FMA:53588.FMA:45365.UBERON:0011766.FMA:16502.FMA:6891.FMA:6091.FMA:11018.FMA:6090.FMA:292887.FMA:65401.FMA:65326.FMA:11215.FMA:44735.FMA:8735.FMA:53538.FMA:6849.FMA:53608.FMA:11217.FMA:8860.FMA:6134.FMA:6893.FMA:53534.FMA:45361.FMA:37321.FMA:82734.FMA:22112.FMA:7294.FMA:52987.FMA:65247.FMA:53535.FMA:6895.FMA:52787.FMA:53635.FMA:65920.FMA:55156.FMA:16498.FMA:53569.FMA:6739.FMA:8807.FMA:22110.FMA:81294.FMA:45450.FMA:8922.FMA:8725.FMA:20608.FMA:7308.FMA:65281.FMA:39084.FMA:78656.FMA:6133.FMA:53581.FMA:16494.FMA:53252.FMA:11789.FMA:45364.FMA:65345.FMA:44870.FMA:39083.FMA:45355.FMA:11193.FMA:16400.FMA:81287.FMA:52776.FMA:65747.FMA:8900.UBERON:0011767.FMA:45424.FMA:292830.FMA:44734.FMA:45381.FMA:82960.FMA:0328831.FMA:6689.FMA:7077.FMA:291236.FMA:8886.FMA:276381.FMA:6124.FMA:65336.FMA:65328.FMA:52670.FMA:53537.FMA:53636.FMA:6896.FMA:21879.FMA:8798.FMA:81288.FMA:53542.FMA:45368.FMA:53547.FMA:55157.FMA:65415.FMA:53309.FMA:65744.FMA:53367.FMA:53590.FMA:65923.FMA:53048.FMA:16499.FMA:53610.FMA:44951.FMA:44953.FMA:8832.FMA:45426.FMA:6114.FMA:52799.FMA:11039.FMA:53546.FMA:53589.FMA:8901.FMA:11681.FMA:52639.FMA:8905.FMA:52733.FMA:65992.FMA:52807.FMA:45435.FMA:53484.FMA:52975.FMA:7289.FMA:44905.FMA:37071.FMA:7130.FMA:65996.FMA:6132.FMA:8826.FMA:6741.FMA:11252.FMA:8917.FMA:82954.FMA:6832.FMA:37073.FMA:37074.FMA:44893.FMA:82959.FMA:20635.FMA:6093.FMA:65248.FMA:45362.FMA:52622.FMA:53508.FMA:11755.FMA:82958.FMA:52997.FMA:16501.FMA:65402.FMA:45427.FMA:52803.FMA:16402.FMA:8734.FMA:52784.FMA:45454.FMA:6736.FMA:7304.FMA:6742.FMA:52998.FMA:52804.FMA:11788.FMA:6713.FMA:52623.FMA:53536.FMA:11780.FMA:45334.FMA:52701.FMA:65998.FMA:11092.FMA:6684.FMA:52779.FMA:52778.FMA:78652.FMA:0328830.FMA:6733.FMA:44950.FMA:78653.FMA:45455.FMA:8864.FMA:8833.FMA:8876.FMA:8867.FMA:11752.FMA:53541.FMA:53611.FMA:8904.FMA:6745.FMA:21863.FMA:7297.FMA:52676.FMA:52798.FMA:8818.FMA:82735.FMA:52657.FMA:52786.FMA:6773.FMA:45253.FMA:6127.FMA:45263.FMA:8875.FMA:81295.FMA:11754.FMA:8812.FMA:45311.FMA:53568.FMA:276379.FMA:6842.FMA:8794.FMA:8820.FMA:53572.FMA:53409.FMA:37070.FMA:6119.FMA:53433.FMA:7123.FMA:8811.FMA:65444.FMA:52806.FMA:53245.FMA:65285.FMA:6768.FMA:8731.FMA:11220.FMA:6778.FMA:53509.FMA:55158.FMA:53567.FMA:65994.FMA:53539.FMA:45327.FMA:8865.FMA:44898.FMA:52673.FMA:80026.FMA:52980.FMA:53505.FMA:82952.FMA:21872.FMA:37065.FMA:52988.FMA:8815.FMA:53398.FMA:52729.FMA:81289.FMA:65398.FMA:52977.FMA:8887`.split(`.`),"subclass labels":`Left T9 white ramus communicans.Right T10 grey ramus communicans.Right T4 spinal nerve posterior ramus.Right fourth intercostal nerve.Right anterior interosseous nerve.Right perineal nerve.Left lateral calcaneal branch A of left sural nerve.Right C3 spinal nerve posterior ramus medial branch.Oesophageal branch of left recurrent laryngeal nerve.Anterior branch of lateral cutaneous branch of left third intercostal nerve.Left common plantar digital nerve F.Anterior cutaneous branch of right subcostal nerve.Left superior labial branch of infraorbital nerve.Left T1 spinal nerve posterior ramus.Anterior branch of left obturator nerve.Right T2 grey ramus communicans.Right T9 grey ramus communicans.Left T5 white ramus communicans.Left L3 spinal nerve posterior ramus lateral branch.Communicating branch of left vagus nerve with left glossopharyngeal nerve.Right second intercostal nerve.Right proper palmar digital nerve G.Left musculocutaneous nerve.Anterior cutaneous branch of left ninth intercostal nerve.Posterior branch of lateral cutaneous branch of left sixth intercostal nerve.Right proper palmar digital nerve H.Communicating branch of right vagus nerve with right glossopharyngeal nerve.Anterior branch of lateral cutaneous branch of right ninth intercostal nerve.Right proper plantar digital nerve C.Left genital branch of genitofemoral nerve.Left T6 grey ramus communicans.Right proper palmar digital nerve I.Right T12 spinal nerve posterior ramus.Right ilioinguinal nerve.Right T8 spinal nerve posterior ramus.Left T9 spinal nerve posterior ramus.Right T11 spinal nerve posterior ramus lateral branch.Right proper plantar digital nerve J.Right medial sural cutaneous nerve.Right T6 spinal nerve posterior ramus medial branch.Right lesser occipital nerve.Right phrenic nerve.Right proper palmar digital nerve E.Left median nerve.Right S3 grey ramus communicans.Right T4 white ramus communicans.Right medial cutaneous nerve of forearm.Right posterior femoral cutaneous nerve.Right vestibular nerve.Lateral cutaneous branch of left sixth intercostal nerve.Left supratrochlear nerve.Right median nerve.Anterior branch of right medial cutaneous nerve of forearm.Right T5 spinal nerve posterior ramus medial branch.Anterior cutaneous branch of right third intercostal nerve.Right C6 spinal nerve posterior ramus.Temporal branch of left facial nerve.Anterior cutaneous branch of left eighth intercostal nerve.Right buccal nerve.Right middle superior alveolar nerve.Temporal branch of right facial nerve.Left superficial branch of radial nerve.Left medial sural cutaneous nerve.Left C4 spinal nerve posterior ramus.Left lateral dorsal digital nerve of the third toe.Right T12 spinal nerve posterior ramus lateral branch.Anterior branch of lateral cutaneous branch of left eleventh intercostal nerve.Left T12 spinal nerve posterior ramus.Left anterior supraclavicular nerve.Left lesser occipital nerve.Right deep fibular nerve.Left T11 spinal nerve posterior ramus.Posterior branch of lateral cutaneous branch of left tenth intercostal nerve.Right anterior superior alveolar nerve.Left tenth intercostal nerve.Anterior branch of lateral cutaneous branch of right fourth intercostal nerve.Communicating branch of left glossopharyngeal nerve with auricular branch of left vagus nerve.Left iliohypogastric nerve.Cervical branch of left facial nerve.Right proper palmar digital nerve J.Lateral cutaneous branch of right sixth intercostal nerve.Right T8 white ramus communicans.Left maxillary nerve.Left intercostobrachial nerve.Left tentorial nerve.Right zygomaticotemporal nerve.Communicating branch of right internal laryngeal nerve with right recurrent laryngeal nerve.Left fourth intercostal nerve.Brachial plexus left C7 root.Vagal branch to right carotid body.Right proper plantar digital nerve G.Right tympanic nerve.Left lateral plantar nerve.Lateral cutaneous branch of left tenth intercostal nerve.Right tibial nerve.Left third occipital nerve.Anterior branch of lateral cutaneous branch of left tenth intercostal nerve.Right T8 spinal nerve posterior ramus lateral branch.Right S1 grey ramus communicans.Left L3 spinal nerve posterior ramus.Palmar cutaneous branch of left ulnar nerve.Right greater petrosal nerve.Left subcostal nerve.Anterior branch of left medial cutaneous nerve of forearm.Left proper plantar digital nerve C.Left C3 spinal nerve branch to left supraclavicular nerve.Right posterior cutaneous nerve of forearm.Posterior branch of lateral cutaneous branch of right tenth intercostal nerve.Right sciatic nerve.Left L5 grey ramus communicans.Right C4 spinal nerve posterior ramus medial branch.Right L4 grey ramus communicans.Left T11 white ramus communicans.Posterior branch of lateral cutaneous branch of right eighth intercostal nerve.Left L1 grey ramus communicans.Posterior branch of left medial cutaneous nerve of forearm.Left auriculotemporal nerve.Left L2 white ramus communicans.Marginal mandibular branch of right facial nerve.Right T8 grey ramus communicans.Right C4 spinal nerve posterior ramus.Right fifth intercostal nerve.Left common fibular nerve.Left posterior ethmoidal nerve.Pharyngeal branch of right glossopharyngeal nerve.Anterior branch of lateral cutaneous branch of right third intercostal nerve.Communicating branch of right external laryngeal nerve with right superior cardiac nerve.Right posterior supraclavicular nerve.Left medial dorsal cutaneous nerve.Lateral cutaneous branch of right eleventh intercostal nerve.Posterior branch of lateral cutaneous branch of left subcostal nerve.Anterior cutaneous branch of left second intercostal nerve.Left lingual nerve.Right lateral calcaneal branch A of right sural nerve.Left phrenic nerve.Right hypogastric nerve.Medial calcaneal branch A of left tibial nerve.Left perineal nerve.Right posterior scrotal nerve.Right inferior alveolar nerve.Medial calcaneal branch A of right tibial nerve.Right T7 white ramus communicans.Left frontal nerve.Right T1 spinal nerve posterior ramus medial branch.Right genitofemoral nerve.Zygomatic branch of right facial nerve.Lateral cutaneous branch of left ninth intercostal nerve.Left C2 spinal nerve branch to left great auricular nerve.Right anterior supraclavicular nerve.Lateral cutaneous branch of right fourth intercostal nerve.Left T11 grey ramus communicans.Lingual branch of right vagus nerve.Left T1 white ramus communicans.Left C3 spinal nerve posterior ramus medial branch.Left proper plantar digital nerve J.Left T2 grey ramus communicans.Brachial plexus left C6 root.Left T10 spinal nerve posterior ramus.Right genital branch of genitofemoral nerve.Anterior cutaneous branch of right first intercostal nerve.Left middle meningeal nerve.Anterior cutaneous branch of left eleventh intercostal nerve.Left infratrochlear nerve.Vagal branch to left carotid body.Anterior cutaneous branch of right eleventh intercostal nerve.Right proper palmar digital nerve B.Left proper palmar digital nerve H.Anterior branch of lateral cutaneous branch of left fourth intercostal nerve.Left seventh intercostal nerve.Right nasociliary nerve.Left posterior scrotal nerve.Left sural nerve.Right S5 grey ramus communicans.Brachial plexus right C7 root.Right inferior rectal nerve.Right transverse cervical nerve.Anterior cutaneous branch of left third intercostal nerve.Left proper plantar digital nerve H.Superficial branch of left ulnar nerve.Dorsal branch of left ulnar nerve.Right eleventh intercostal nerve.Right T2 white ramus communicans.Right common plantar digital nerve F.Infrapatellar branch of right saphenous nerve.Left T5 grey ramus communicans.Lingual branch of left vagus nerve.Thoracic cardiac branch of left vagus nerve.Right superior laryngeal nerve.Right C2 spinal nerve posterior ramus.Right zygomatic nerve.Right auriculotemporal nerve.Anterior branch of lateral cutaneous branch of left subcostal nerve.Left saphenous nerve.Right L3 spinal nerve posterior ramus.Right T7 grey ramus communicans.Left great auricular nerve posterior branch.Left proper palmar digital nerve A.Right infraorbital nerve.Cutaneous branch of right obturator nerve.Posterior branch of right obturator nerve.Left T1 grey ramus communicans.Right T12 white ramus communicans.Right proper plantar digital nerve F.Left posterior auricular nerve.Right posterior ethmoidal nerve.Buccal branch of right facial nerve.Right iliohypogastric nerve.Left dorsal nerve of penis.Right inferior lateral cutaneous nerve of arm.Left T7 spinal nerve posterior ramus lateral branch.Lateral cutaneous branch of left seventh intercostal nerve.Right posterior interosseous nerve.Left middle superior alveolar nerve.Right T9 white ramus communicans.Right T10 spinal nerve posterior ramus.Left deep fibular nerve.Hepatic branch of anterior vagal trunk.Left first intercostal nerve.Right L2 white ramus communicans.Buccal branch of left facial nerve.Right L5 grey ramus communicans.Right common fibular nerve.Left T6 spinal nerve posterior ramus medial branch.Right L2 grey ramus communicans.Right deep petrosal nerve.Left axillary nerve posterior branch.Right posterior auricular nerve.Anterior branch of lateral cutaneous branch of right subcostal nerve.Anterior branch of lateral cutaneous branch of right fifth intercostal nerve.Pyloric branch of greater posterior gastric nerve.Left T10 spinal nerve posterior ramus lateral branch.Superior cervical cardiac branch of right vagus nerve.Ganglionic branch of right maxillary nerve to pterygopalatine ganglion.Left proper palmar digital nerve C.Right superior cervical cardiac nerve.Right ninth intercostal nerve.Right lesser petrosal nerve.Communicating branch of left external laryngeal nerve with left superior cardiac nerve.Right long ciliary nerve B.Anterior cutaneous branch of right fourth intercostal nerve.Right third intercostal nerve.Left L4 grey ramus communicans.Right T7 spinal nerve posterior ramus.Left L2 spinal nerve posterior ramus lateral branch.Left proper palmar digital nerve F.Coeliac branch of posterior vagal trunk.Left lacrimal nerve.Right lacrimal nerve.Anterior cutaneous branch of right seventh intercostal nerve.Left femoral nerve.Right maxillary nerve.Lateral cutaneous branch of right third intercostal nerve.Right superficial fibular nerve.Left proper palmar digital nerve I.Anterior cutaneous branch of left seventh intercostal nerve.Left T12 spinal nerve posterior ramus lateral branch.Thoracic cardiac branch of right vagus nerve.Lateral cutaneous branch of left eighth intercostal nerve.Orbital branch of left maxillary nerve to left ethmoidal sinus.Left pudendal nerve.Left lesser petrosal nerve.Right eighth intercostal nerve.Left S5 grey ramus communicans.Right T10 white ramus communicans.Left T10 white ramus communicans.Left T4 white ramus communicans.Lateral cutaneous branch of left third intercostal nerve.Posterior branch of lateral cutaneous branch of left eighth intercostal nerve.Lateral cutaneous branch of right iliohypogastric nerve.Right supratrochlear nerve.Anterior branch of lateral cutaneous branch of right tenth intercostal nerve.Right C3 spinal nerve branch to right supraclavicular nerve.Right T6 grey ramus communicans.Left T5 spinal nerve posterior ramus medial branch.Left proper palmar digital nerve G.Left posterior superior alveolar nerve.Lateral cutaneous branch of left subcostal nerve.Gluteal branch A of right posterior femoral cutaneous nerve.Right T5 white ramus communicans.Left greater petrosal nerve.Left T3 spinal nerve posterior ramus.Right subcostal nerve.Right femoral branch of genitofemoral nerve.Right sixth intercostal nerve.Anterior cutaneous branch of right ninth intercostal nerve.Left T11 spinal nerve posterior ramus lateral branch.Left T7 grey ramus communicans.Posterior branch of lateral cutaneous branch of right subcostal nerve.Left L2 grey ramus communicans.Posterior branch of lateral cutaneous branch of right third intercostal nerve.Right L1 white ramus communicans.Anterior branch of right obturator nerve.Anterior cutaneous branch of left fifth intercostal nerve.Left T4 grey ramus communicans.Right C5 spinal nerve posterior ramus medial branch.Right T4 spinal nerve posterior ramus medial branch.Left L1 white ramus communicans.Anterior cutaneous branch of right eighth intercostal nerve.Left subclavian nerve.Pericardial branch of left phrenic nerve.Left tympanic nerve.Right zygomaticofacial nerve.Right intercostobrachial nerve.Right cochlear nerve.Left internal laryngeal nerve.Right lateral dorsal digital nerve of the third toe.Left proper palmar digital nerve D.Inferior cervical cardiac branch of left vagus nerve.Left proper plantar digital nerve B.Right S2 grey ramus communicans.Right proper plantar digital nerve H.Right tentorial nerve.Right T1 white ramus communicans.Inferior ramus of left internal laryngeal nerve.Right L3 grey ramus communicans.Right posterior superior alveolar nerve.Tonsillar branch of right glossopharyngeal nerve.Lateral cutaneous branch of right subcostal nerve.Right proper palmar digital nerve C.Right first intercostal nerve.Posterior branch of right medial cutaneous nerve of forearm.Right lingual nerve.Lateral cutaneous branch of right fifth intercostal nerve.Left T4 spinal nerve posterior ramus.Posterior branch of lateral cutaneous branch of left third intercostal nerve.Right posterior superior lateral nasal branch of maxillary nerve.Posterior branch of lateral cutaneous branch of right fifth intercostal nerve.Left buccal nerve.Right third occipital nerve.Left anterior ethmoidal nerve.Right lingual branch of glossopharyngeal nerve.Left laryngopharyngeal branch of superior cervical ganglion.Right infratrochlear nerve.Left external laryngeal nerve branch to pharyngeal plexus.Left T7 white ramus communicans.Left L1 spinal nerve posterior ramus.Right S4 grey ramus communicans.Left proper palmar digital nerve J.Left zygomatic nerve.Left L1 spinal nerve posterior ramus lateral branch.Left greater occipital nerve.Left medial cutaneous nerve of forearm.Brachial plexus left C8 root.Left anterior femoral cutaneous branch A.Posterior branch of lateral cutaneous branch of left seventh intercostal nerve.Left T1 spinal nerve posterior ramus medial branch.Left meningeal branch of mandibular nerve.Left medial dorsal digital nerve of the fourth toe.Left C5 spinal nerve posterior ramus.Pharyngeal branch of left glossopharyngeal nerve.Right medial plantar nerve.Left proper plantar digital nerve F.Left deep petrosal nerve.Right supraorbital nerve.Left proper plantar digital nerve E.Right T9 spinal nerve posterior ramus lateral branch.Left posterior cutaneous nerve of forearm.Left posterior femoral cutaneous nerve.Left hypogastric nerve.Left genitofemoral nerve.Anterior branch of lateral cutaneous branch of left ninth intercostal nerve.Right T1 spinal nerve posterior ramus.Right common palmar digital nerve A.Right L3 spinal nerve posterior ramus lateral branch.Left anterior superior alveolar nerve.Right T1 grey ramus communicans.Anterior cutaneous branch of left sixth intercostal nerve.Left proper plantar digital nerve A.Left T5 spinal nerve posterior ramus.Right T3 spinal nerve posterior ramus.Right superior labial branch of infraorbital nerve.Left proper palmar digital nerve E.Left transverse cervical nerve.Posterior branch of lateral cutaneous branch of right fourth intercostal nerve.Left communicating branch of nasociliary nerve with ciliary ganglion.Superficial branch of right ulnar nerve.Right great auricular nerve posterior branch.Palmar branch of right median nerve.Right ulnar nerve.Right T5 grey ramus communicans.Palmar cutaneous branch of right ulnar nerve.Left T2 spinal nerve posterior ramus medial branch.Tonsillar branch of left glossopharyngeal nerve.Lateral cutaneous branch of right eighth intercostal nerve.Posterior branch of lateral cutaneous branch of right eleventh intercostal nerve.Left T6 white ramus communicans.Right T4 grey ramus communicans.Branch of right vagus nerve to oesophageal nerve plexus.Superior cervical cardiac branch of left vagus nerve.Left long thoracic nerve.Right mental nerve.Left fifth intercostal nerve.Lateral cutaneous branch of left fourth intercostal nerve.Right lateral femoral cutaneous nerve.Posterior branch of lateral cutaneous branch of right seventh intercostal nerve.Lateral cutaneous branch of right seventh intercostal nerve.Left C4 spinal nerve posterior ramus medial branch.Right intermediate dorsal cutaneous nerve.Right medial dorsal cutaneous nerve.Left recurrent laryngeal nerve.Left obturator nerve.Left T8 grey ramus communicans.Right T2 spinal nerve posterior ramus.Right T3 spinal nerve posterior ramus medial branch.Left T2 spinal nerve posterior ramus.Right superficial branch of radial nerve.Right C3 spinal nerve branch to right great auricular nerve.Left anterior interosseous nerve.Lateral cutaneous branch of right ninth intercostal nerve.Left common plantar digital nerve E.Brachial plexus left C5 root.Left external laryngeal nerve.Left C3 spinal nerve posterior ramus.Oesophageal branch of right recurrent laryngeal nerve.Lateral cutaneous branch of right tenth intercostal nerve.Anterior cutaneous branch of right sixth intercostal nerve.Right T3 white ramus communicans.Left T9 grey ramus communicans.Auricular branch of right vagus nerve.Right lateral sural cutaneous nerve.Left ulnar nerve.Right long ciliary nerve A.Left sciatic nerve.Anterior branch of lateral cutaneous branch of left fifth intercostal nerve.Right inferior palpebral branch of infraorbital nerve.Right medial cutaneous nerve of arm.Auricular branch of left vagus nerve.Left T10 grey ramus communicans.Left medial posterior superior nasal nerve.Pharyngeal branch of right vagus nerve to pharyngeal nerve plexus.Left L3 grey ramus communicans.Left lateral femoral cutaneous nerve.Right external laryngeal nerve branch to pharyngeal plexus.Left eighth intercostal nerve.Right T5 spinal nerve posterior ramus.Left tibial nerve.Right superior lateral cutaneous nerve of arm.Right lateral plantar nerve.Anterior cutaneous branch of left first intercostal nerve.Brachial plexus right C8 root.Lateral cutaneous branch of left iliohypogastric nerve.Posterior branch of lateral cutaneous branch of left eleventh intercostal nerve.Right long thoracic nerve.Left lateral cutaneous nerve of forearm.Left posterior supraclavicular nerve.Left T3 grey ramus communicans.Left ilioinguinal nerve.Left mental nerve.Left T12 white ramus communicans.Left superficial fibular nerve.Right proper palmar digital nerve F.Right proper palmar digital nerve D.Right lateral cutaneous nerve of forearm.Gluteal branch A of left posterior femoral cutaneous nerve.Lateral cutaneous branch of left fifth intercostal nerve.Right L1 spinal nerve posterior ramus lateral branch.Right axillary nerve anterior branch.Orbital branch of right maxillary nerve to right ethmoidal sinus.Right C6 spinal nerve posterior ramus medial branch.Posterior branch of lateral cutaneous branch of right ninth intercostal nerve.Right recurrent laryngeal nerve.Right sural nerve.Dorsal branch of right ulnar nerve.Right common plantar digital nerve E.Right medial dorsal digital nerve of the fourth toe.Right proper plantar digital nerve E.Left caroticotympanic nerve.Greater posterior gastric nerve.Right L1 spinal nerve posterior ramus.Pericardial branch of right phrenic nerve.Anterior branch of lateral cutaneous branch of right eighth intercostal nerve.Left incisive branch of inferior alveolar nerve.Right T3 grey ramus communicans.Left posterior interosseous nerve.Palmar branch of left median nerve.Left nasociliary nerve.Right external laryngeal nerve.Pharyngeal branch of left vagus nerve to pharyngeal nerve plexus.Right T11 grey ramus communicans.Right dorsal nerve of penis.Left C6 spinal nerve posterior ramus.Left axillary nerve anterior branch.Meningeal branch of left vagus nerve.Left intermediate dorsal cutaneous nerve.Right laryngopharyngeal branch of superior cervical ganglion.Right great auricular nerve anterior branch.Zygomatic branch of left facial nerve.Left C5 spinal nerve posterior ramus medial branch.Marginal mandibular branch of left facial nerve.Right L1 grey ramus communicans.Right meningeal branch of mandibular nerve.Right femoral nerve.Tracheal branch of right recurrent laryngeal nerve.Left posterior cutaneous nerve of arm.Left inferior lateral cutaneous nerve of arm.Right L2 spinal nerve posterior ramus.Right lateral dorsal cutaneous nerve.Anterior cutaneous branch of right second intercostal nerve.Left nasopalatine nerve.Left T3 spinal nerve posterior ramus medial branch.Left superior cervical cardiac nerve.Posterior branch of lateral cutaneous branch of left ninth intercostal nerve.Right T7 spinal nerve posterior ramus lateral branch.Right frontal nerve.Anterior cutaneous branch of left tenth intercostal nerve.Ganglionic branch of left maxillary nerve to pterygopalatine ganglion.Left S1 grey ramus communicans.Left lesser palatine nerve.Left medial plantar nerve.Communicating branch of right glossopharyngeal nerve with auricular branch of right vagus nerve.Left zygomaticotemporal nerve.Anterior cutaneous branch of right fifth intercostal nerve.Left proper palmar digital nerve B.Left radial nerve.Posterior branch of lateral cutaneous branch of left fourth intercostal nerve.Left S3 grey ramus communicans.Left T3 white ramus communicans.Right T11 spinal nerve posterior ramus.Left ninth intercostal nerve.Right T2 spinal nerve posterior ramus medial branch.Anterior cutaneous branch of left subcostal nerve.Right proper plantar digital nerve B.Left C2 spinal nerve posterior ramus.Right axillary nerve.Left axillary nerve.Left common palmar digital nerve A.Left proper plantar digital nerve D.Left femoral branch of genitofemoral nerve.Left second intercostal nerve.Left medial cutaneous nerve of arm.Left lateral sural cutaneous nerve.Right ophthalmic nerve.Right carotid sinus nerve.Right T10 spinal nerve posterior ramus lateral branch.Right proper plantar digital nerve D.Right mandibular nerve.Right obturator nerve.Left C3 spinal nerve branch to left great auricular nerve.Left lateral dorsal cutaneous nerve.Right greater palatine nerve.Right L2 spinal nerve posterior ramus lateral branch.Brachial plexus right C5 root.Left posterior superior lateral nasal branch of maxillary nerve.Right proper plantar digital nerve I.Right seventh intercostal nerve.Anterior branch of lateral cutaneous branch of right eleventh intercostal nerve.Right tenth intercostal nerve.Left mandibular nerve.Left greater palatine nerve.Left T12 grey ramus communicans.Inferior cervical cardiac branch of right vagus nerve.Left ophthalmic nerve.Left superior laryngeal nerve.Right T12 grey ramus communicans.Cutaneous branch of left obturator nerve.Left long ciliary nerve B.Left S4 grey ramus communicans.Left T4 spinal nerve posterior ramus medial branch.Greater anterior gastric nerve.Orbital branch of left maxillary nerve to left sphenoidal sinus.Orbital branch of right maxillary nerve to right sphenoidal sinus.Right middle supraclavicular nerve.Right caroticotympanic nerve.Left sixth intercostal nerve.Right posterior cutaneous nerve of arm.Left middle supraclavicular nerve.Left proper plantar digital nerve I.Anterior branch of lateral cutaneous branch of right sixth intercostal nerve.Left L2 spinal nerve posterior ramus.Anterior branch of lateral cutaneous branch of left seventh intercostal nerve.Posterior branch of lateral cutaneous branch of right sixth intercostal nerve.Left T8 spinal nerve posterior ramus lateral branch.Meningeal branch of right vagus nerve.Tracheal branch of left recurrent laryngeal nerve.Anterior cutaneous branch of right tenth intercostal nerve.Left eleventh intercostal nerve.Right pudendal nerve.Posterior branch of lateral cutaneous branch of left fifth intercostal nerve.Right anterior ethmoidal nerve.Right nasopalatine nerve.Left T8 spinal nerve posterior ramus.Left long ciliary nerve A.Left supraorbital nerve.Right medial posterior superior nasal nerve.Left T8 white ramus communicans.Right anterior femoral cutaneous branch A.Left T2 white ramus communicans.Right saphenous nerve.Anterior branch of lateral cutaneous branch of right seventh intercostal nerve.Left superior lateral cutaneous nerve of arm.Left T9 spinal nerve posterior ramus lateral branch.Left T6 spinal nerve posterior ramus.Posterior branch of left obturator nerve.Left external laryngeal nerve branch to inferior pharyngeal constrictor.Right incisive branch of inferior alveolar nerve.Right C3 spinal nerve posterior ramus.Right C5 spinal nerve posterior ramus.Right T9 spinal nerve posterior ramus.Communicating branch of left internal laryngeal nerve with left recurrent laryngeal nerve.Left vestibular nerve.Right radial nerve.Left third intercostal nerve.Left cochlear nerve.Anterior cutaneous branch of left fourth intercostal nerve.Right T6 spinal nerve posterior ramus.Right greater occipital nerve.Right lesser palatine nerve.Left inferior alveolar nerve.Right subclavian nerve.Right T6 white ramus communicans.Brachial plexus right C6 root.Lateral cutaneous branch of left eleventh intercostal nerve.Right T11 white ramus communicans.Left carotid sinus nerve.Left great auricular nerve anterior branch.Right external laryngeal nerve branch to inferior pharyngeal constrictor.Left S2 grey ramus communicans.Right internal laryngeal nerve.Infrapatellar branch of left saphenous nerve.Anterior branch of lateral cutaneous branch of left sixth intercostal nerve.Right proper palmar digital nerve A.Right communicating branch of nasociliary nerve with ciliary ganglion.Left proper plantar digital nerve G.Left infraorbital nerve.Left lingual branch of glossopharyngeal nerve.Right proper plantar digital nerve A.Left inferior rectal nerve.Right musculocutaneous nerve.Left inferior palpebral branch of infraorbital nerve.Left T7 spinal nerve posterior ramus.Cervical branch of right facial nerve.Right middle meningeal nerve.Right axillary nerve posterior branch.Right C2 spinal nerve branch to right great auricular nerve.Left zygomaticofacial nerve.Anterior branch of lateral cutaneous branch of left eighth intercostal nerve`.split(`.`)},{id:77,nerve_id:`UBERON:0001647`,label:`facial nerve`,"FMA subclasses (in human nerves)":[`FMA:50888`,`FMA:50889`],"subclass labels":[`Right facial nerve`,`Left facial nerve`]},{id:78,nerve_id:`UBERON:0001148`,label:`median nerve`,"FMA subclasses (in human nerves)":[`FMA:37067`,`FMA:37068`],"subclass labels":[`Right median nerve`,`Left median nerve`]},{id:79,nerve_id:`UBERON:0009009`,label:`carotid sinus nerve`,"FMA subclasses (in human nerves)":[`FMA:53508`,`FMA:53509`],"subclass labels":[`Right carotid sinus nerve`,`Left carotid sinus nerve`]},{id:80,nerve_id:`UBERON:0003715`,label:`splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6924`,`FMA:6928`,`FMA:6929`,`FMA:6931`,`FMA:6930`,`FMA:6960`,`FMA:6958`,`FMA:6959`,`FMA:6925`,`FMA:6956`,`FMA:6927`,`FMA:6955`,`FMA:6926`,`FMA:6957`],"subclass labels":[`Right first lumbar splanchnic nerve`,`Right third lumbar splanchnic nerve`,`Left third lumbar splanchnic nerve`,`Left fourth lumbar splanchnic nerve`,`Right fourth lumbar splanchnic nerve`,`Left least splanchnic nerve`,`Left lesser splanchnic nerve`,`Right least splanchnic nerve`,`Left first lumbar splanchnic nerve`,`Right greater splanchnic nerve`,`Left second lumbar splanchnic nerve`,`Left greater splanchnic nerve`,`Right second lumbar splanchnic nerve`,`Right lesser splanchnic nerve`]},{id:81,nerve_id:`ILX:0793826`,label:`anterior abdominal vagal trunk`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:82,nerve_id:`UBERON:0001650`,label:`hypoglossal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:83,nerve_id:`ILX:0794967`,label:`posterior interosseous nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:84,nerve_id:`ILX:0793713`,label:`Deep petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:0328827`,`FMA:0328826`],"subclass labels":[`Left deep petrosal nerve`,`Right deep petrosal nerve`]},{id:85,nerve_id:`ILX:0793361`,label:`white communicating ramus of third lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:86,nerve_id:`ILX:0787562`,label:`gray communicating ramus of the third thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6133`,`FMA:6124`],"subclass labels":[`Left T3 grey ramus communicans`,`Right T3 grey ramus communicans`]},{id:87,nerve_id:`ILX:0793211`,label:`white communicating ramus of fifth thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:88,nerve_id:`UBERON:0018679`,label:`thoracic splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6958`,`FMA:6960`,`FMA:6955`,`FMA:6959`,`FMA:6957`,`FMA:6956`],"subclass labels":[`Left lesser splanchnic nerve`,`Left least splanchnic nerve`,`Left greater splanchnic nerve`,`Right least splanchnic nerve`,`Right lesser splanchnic nerve`,`Right greater splanchnic nerve`]},{id:89,nerve_id:`ILX:0731969`,label:`least splanchnic nerve`,"FMA subclasses (in human nerves)":[`FMA:6960`,`FMA:6959`],"subclass labels":[`Left least splanchnic nerve`,`Right least splanchnic nerve`]},{id:90,nerve_id:`ILX:0788771`,label:`gray communicating ramus of seventh thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6888`,`FMA:6889`],"subclass labels":[`Right T7 grey ramus communicans`,`Left T7 grey ramus communicans`]},{id:91,nerve_id:`UBERON:0022301`,label:`long ciliary nerve`,"FMA subclasses (in human nerves)":[`FMA:52701`,`FMA:52700`,`FMA:82734`,`FMA:82735`],"subclass labels":[`Left long ciliary nerve B`,`Right long ciliary nerve B`,`Right long ciliary nerve A`,`Left long ciliary nerve A`]},{id:92,nerve_id:`ILX:0793221`,label:`white communicating ramus of second lumbar spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:93,nerve_id:`ILX:0785825`,label:`gray communicating ramus of first lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65924`,`FMA:65923`],"subclass labels":[`Left L1 grey ramus communicans`,`Right L1 grey ramus communicans`]},{id:94,nerve_id:`ILX:0793208`,label:`white communicating ramus of second thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:95,nerve_id:`UBERON:0018412`,label:`vidian nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:96,nerve_id:`ILX:0739303`,label:`gray communicating ramus of second thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:97,nerve_id:`ILX:0795006`,label:`Suboccipital nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:98,nerve_id:`ILX:0785733`,label:`gray communicating ramus of second lumbar nerve`,"FMA subclasses (in human nerves)":[`FMA:65921`,`FMA:65922`],"subclass labels":[`Right L2 grey ramus communicans`,`Left L2 grey ramus communicans`]},{id:99,nerve_id:`UBERON:0035207`,label:`deep fibular nerve`,"FMA subclasses (in human nerves)":[`FMA:45387`,`FMA:45388`],"subclass labels":[`Right deep fibular nerve`,`Left deep fibular nerve`]},{id:100,nerve_id:`ILX:0739304`,label:`gray communicating ramus of third thoracic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:101,nerve_id:`UBERON:0002019`,label:`accessory XI nerve`,"FMA subclasses (in human nerves)":[`FMA:50899`,`FMA:50897`],"subclass labels":[`Left accessory nerve`,`Right accessory nerve`]},{id:102,nerve_id:`ILX:0793217`,label:`white communicating ramus of eleventh thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:103,nerve_id:`ILX:0793722`,label:`Lesser petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:53503`,`FMA:53502`],"subclass labels":[`Left lesser petrosal nerve`,`Right lesser petrosal nerve`]},{id:104,nerve_id:`UBERON:0018675`,label:`pelvic splanchnic nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:105,nerve_id:`ILX:0793702`,label:`Greater petrosal nerve`,"FMA subclasses (in human nerves)":[`FMA:53423`,`FMA:53424`],"subclass labels":[`Right greater petrosal nerve`,`Left greater petrosal nerve`]},{id:106,nerve_id:`ILX:0794916`,label:`white ramus communicans`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:107,nerve_id:`UBERON:0003716`,label:`Recurrent Laryngeal Nerve`,"FMA subclasses (in human nerves)":[`UBERON:0011766`,`UBERON:0011767`],"subclass labels":[`Left recurrent laryngeal nerve`,`Right recurrent laryngeal nerve`]},{id:108,nerve_id:`UBERON:0005465`,label:`obturator nerve`,"FMA subclasses (in human nerves)":[`FMA:16501`,`FMA:16502`],"subclass labels":[`Right obturator nerve`,`Left obturator nerve`]},{id:109,nerve_id:`ILX:0793213`,label:`white communicating ramus of seventh thoracic spinal nerve`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:110,nerve_id:`ILX:0785067`,label:`gray communicating ramus of eleventh thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6897`,`FMA:6896`],"subclass labels":[`Left T11 grey ramus communicans`,`Right T11 grey ramus communicans`]},{id:111,nerve_id:`UBERON:0001494`,label:`ulnar nerve`,"FMA subclasses (in human nerves)":[`FMA:37320`,`FMA:37321`],"subclass labels":[`Right ulnar nerve`,`Left ulnar nerve`]},{id:112,nerve_id:`ILX:0794959`,label:`posterior rami lower cervical nerves`,"FMA subclasses (in human nerves)":[],"subclass labels":[]},{id:113,nerve_id:`UBERON:0001493`,label:`axillary nerve`,"FMA subclasses (in human nerves)":[`FMA:37074`,`FMA:37073`],"subclass labels":[`Left axillary nerve`,`Right axillary nerve`]},{id:114,nerve_id:`ILX:0787946`,label:`gray communicating ramus of sixth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6762`,`FMA:6763`],"subclass labels":[`Right T6 grey ramus communicans`,`Left T6 grey ramus communicans`]},{id:115,nerve_id:`ILX:0785542`,label:`gray communicating ramus of ninth thoracic nerve`,"FMA subclasses (in human nerves)":[`FMA:6892`,`FMA:6893`],"subclass labels":[`Right T9 grey ramus communicans`,`Left T9 grey ramus communicans`]}],gO=()=>{let e={};return hO.forEach(t=>{t.nerve_id&&t.label!==`nerve`&&t[`subclass labels`].forEach(n=>{n in e||(e[n.toLowerCase()]=t.nerve_id)})}),e},_O=[{label:`urinary bladder`,anatomicalId:`UBERON:0001255`},{label:`brainstem`,anatomicalId:`UBERON:0002298`},{label:`caecum`,anatomicalId:`UBERON:0001153`},{label:`colon`,anatomicalId:`UBERON:0001155`},{label:`esophagus`,anatomicalId:`UBERON:0001043`},{label:`small intestine`,anatomicalId:`UBERON:0002108`},{label:`stomach`,anatomicalId:`UBERON:0000945`},{label:`heart`,anatomicalId:`UBERON:0000948`},{label:`lung`,anatomicalId:`UBERON:0002048`}],vO=()=>{let e={};return _O.forEach(t=>{let n=t.label.toLowerCase();n in e||(e[n.toLowerCase()]=t.anatomicalId)}),e},yO=gO(),bO=vO(),xO=0,SO={name:`ScaffoldVuer`,components:{Button:Km,Col:hg,Loading:tv,Option:kh,Popover:r_,Radio:lg,RadioGroup:ug,Row:mg,ScaffoldOverlay:cv,Select:Oh,Slider:C_,TabPane:U_,Tabs:H_,MapSvgIcon:a.MapSvgIcon,MapSvgSpriteColor:a.MapSvgSpriteColor,PrimitiveControls:oD,ScaffoldTooltip:fD,ElIconWarningFilled:Jd,ElIconArrowDown:Fd,ElIconArrowLeft:Id,DrawToolbar:n.DrawToolbar,ScaffoldTreeControls:IE},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new o.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},props:{annotationIgnoreResource:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},url:{type:String,default:``},showColourPicker:{type:Boolean,default:!1},displayUI:{type:Boolean,default:!0},displayAtStartUp:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},displayWarning:{type:Boolean,default:!1},warningMessage:{type:String,default:`Beta feature - under active development`},displayLatestChanges:{type:Boolean,default:!1},latestChangesMessage:{type:String,default:`New feature - Local search is now available`},displayMarkers:{type:Boolean,default:!1},markerCluster:{type:Boolean,default:!1},markerLabels:{type:Object,default:function(){return{}}},displayMinimap:{type:Boolean,default:!1},format:{type:String,default:`metadata`},minimapSettings:{type:Object,default:function(){return{x_offset:16,y_offset:16,width:128,height:128,align:`top-right`}}},enableOpenMapUI:{type:Boolean,default:!1},positionalRotation:{type:Boolean,default:!1},isNerves:{type:Object,default:function(){return{regions:[`nerves`]}}},openMapOptions:{type:Array,default:function(){return[{display:`Open AC Map`,key:`AC`},{display:`Open FC Map`,key:`FC`},{display:`Open 3D Human Map`,key:`3D`}]}},state:{type:Object,default:void 0},region:{type:String,default:``},viewURL:{type:String,default:``},render:{type:Boolean,default:!0},flatmapAPI:{type:String,default:`https://mapcore-demo.org/current/flatmap/v3/`},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},usageConfig:{type:Object,default:function(){return{showTubeLinesControls:!0,tubeLines:!1}}}},provide(){return{flatmapAPI:this.flatmapAPI,scaffoldUrl:this.url,boundingDims:this.boundingDims}},data:function(){return{annotator:void 0,clientHeight:300,colourRadio:!0,createData:{drawingBox:!1,renaming:!1,toBeConfirmed:!1,points:[],tempGroupName:void 0,shape:``,x:0,y:0,editingIndex:-1,faceIndex:-1,toBeDeleted:!1,regionPrefix:`__annotation`},currentTime:0,timeVarying:!1,isPlaying:!1,isReady:!1,isTransitioning:!1,tooltipAppendToBody:!1,hoverVisibilities:[{value:!1,ref:`zoomInPopover`},{value:!1,ref:`zoomOutPopover`},{value:!1,ref:`zoomFitPopover`},{value:!1,ref:`openMapPopover`},{value:!1,ref:`settingsPopover`},{value:!1,ref:`sliderPopover`},{value:!1,ref:`regionVisibilityPopover`},{value:!1,ref:`warningPopover`},{value:!1,ref:`whatsNewPopover`},{value:!1,refs:`toolbarPopover`,ref:`editPopover`},{value:!1,refs:`toolbarPopover`,ref:`pointPopover`},{value:!1,refs:`toolbarPopover`,ref:`lineStringPopover`},{value:!1,refs:`toolbarPopover`,ref:`deletePopover`}],inHelp:!1,helpModeActiveIndex:this.helpModeInitialIndex,loading:!1,duration:3e3,drawerOpen:!0,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],minimisedSlider:!1,sliderPosition:``,timeMax:100,orginalDuration:``,animateDuration:`6secs`,playSpeed:[{value:.1,label:`0.1x`},{value:.5,label:`0.5x`},{value:1,label:`1x`},{value:2,label:`2x`},{value:5,label:`5x`},{value:10,label:`10x`}],currentSpeed:1,timeStamps:{},defaultCheckedKeys:[],outlinesRadio:!0,tData:{label:``,region:``,visible:!1,x:200,y:200,active:!1},fileFormat:`metadata`,previousMarkerLabels:(0,t.markRaw)({}),viewingMode:`Exploration`,viewingModes:{Exploration:`View and explore detailed visualization of 3D scaffolds`,"Neuron Connection":`Discover nerve connections by selecting a nerve and viewing its associated connections`,Annotation:[`View feature annotations`,`Add, comment on and view feature annotations`]},openMapRef:void 0,backgroundIconRef:void 0,annotationFeature:{},offlineAnnotationEnabled:!1,offlineAnnotations:(0,t.markRaw)([]),authorisedUser:void 0,toolbarOptions:[`Delete`,`Edit`,`Point`,`LineString`],existDrawnFeatures:(0,t.markRaw)([]),activeDrawTool:void 0,activeDrawMode:void 0,boundingDims:{centre:[0,0,0],size:[1,1,1]},lastSelected:(0,t.markRaw)({region:``,group:``,isSearch:!1})}},watch:{format:{handler:function(e){this.fileFormat=e},immediate:!0},url:{handler:function(e){(this.state===void 0||this.state.url===void 0)&&this.setURL(e)},immediate:!0},region:{handler:function(e){this.state||this.viewURL||this.setFocusedRegion(e)},immediate:!0},state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},viewURL:{handler:function(e){this.updateViewURL(e)},immediate:!0},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},displayMarkers:function(e){this.$module.scene.displayMarkers=e,this.$module.scene.forcePickableObjectsUpdate=!0},displayMinimap:function(e){this.$module.scene.displayMinimap=e},currentTime:{handler:function(){this.$emit(`timeChanged`,this.currentTime)}},duration:function(){this.$module.scene.setDuration(this.duration)},minimapSettings:{deep:!0,handler:`updateMinimapScissor`},render:function(e){this.toggleRendering(e)},markerCluster:{handler:function(e){this.$module.scene.enableMarkerCluster(e)},immediate:!0},markerLabels:function(e){for(let[e,t]of Object.entries(this.previousMarkerLabels))this.setMarkerModeForObjectsWithName(e,t,`off`);for(let[t,n]of Object.entries(e))this.setMarkerModeForObjectsWithName(t,n,`on`);this.previousMarkerLabels=(0,t.markRaw)({...e})}},beforeCreate:function(){this.$module=new OD,this.selectedObjects=[],this.hoveredObjects=[],this.currentBackground=`white`,this._currentURL=void 0,this.availableBackground=[`white`,`black`,`lightskyblue`],this.$_searchIndex=new mO},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.$refs.scaffoldTreeControls.setModule(this.$module);let e=new _D;e.subscribe(this,this.eventNotifierCallback),this.$module.addNotifier(e),this.$module.addOrganPartAddedCallback(this.zincObjectAdded),this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved),this.$module.initialiseRenderer(this.$refs.display),this.toggleRendering(this.render),this.clientHeight=this.$refs.scaffoldContainer.$el.clientHeight,this.ro=new ResizeObserver(this.adjustLayout).observe(this.$refs.scaffoldContainer.$el),this.helpTextWait=[],this.helpTextWait.length=this.hoverVisibilities.length,this.defaultRate=this.$module.getPlayRate(),this.$module.zincRenderer.addPreRenderCallbackFunction(()=>{this.currentTime=this.$module.getCurrentTime()}),this.$module.zincRenderer.addContextRestoredCallbackFunction(()=>{this.backgroundChangeCallback(this.currentBackground)})},beforeUnmount:function(){this.ro&&this.ro.disconnect(),this.$module.destroy(),this.$module=void 0},computed:{...(0,i.mapStores)(sD),...(0,i.mapState)(sD,[`userToken`]),annotationDisplay:function(){return this.viewingMode===`Annotation`&&this.tData.active===!0&&this.activeDrawMode!==`Point`&&this.activeDrawMode!==`LineString`},enableColourPicker:function(){return this.showColourPicker&&this.colourRadio},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e}},methods:{zoomToNerves:function(e,t=!1){if(this.$module.scene){this.$module.setIgnorePicking(t);let n=[];this.$module.scene.getRootRegion().getChildRegions().forEach(r=>{r.getName()===`Nerves`&&t&&e.forEach(e=>{let t=this.findObjectsWithGroupName(e);n.push(...t)})}),this.$module.setSelectedByZincObjects(n,void 0,{},!0),this.$module.scene.viewAll()}},enableAxisDisplay:function(e,t){this.$module.scene&&this.$module.scene.enableAxisDisplay(e,t)},createAxisDisplay:function(e){this.$module.scene&&this.$module.scene.createAxisDisplay(e)},addZincObject:function(e){this.$module.scene&&this.$module.scene.addZincObject(e)},zincObjectAdded:function(e){this.loading=!1,this.$_searchIndex.addZincObject(e,e.uuid),this.timeVarying===!1&&e.isTimeVarying()&&(this.timeVarying=!0);let t=e.groupName.toLowerCase();t in bO&&e.setAnatomicalId(bO[t]);let n=e.getGroup();n&&n.position?e.userData.originalPos=[n.position.x,n.position.y,n.position.z]:e.userData.originalPos=[0,0,0];let r=this.isNerves?.regions;if(r){let n=e.getRegion().getFullPath().toLowerCase();for(let i=0;i<r.length;i++)n.includes(r[i].toLowerCase())?(e.userData.isNerves=!0,e.userData.defaultColour=`#${e.getColourHex()}`,e.userData.isGreyScale=!1,t in yO&&(xO++,e.setAnatomicalId(yO[t]))):e.userData.isNerves=!1}this.calculateBoundingBox(),this.$emit(`zinc-object-added`,e)},removeFromOfflineAnnotation:function(e,t){for(let n=0;n<this.offlineAnnotations.length;n++){let r=this.offlineAnnotations[n];if(r.region===e&&r.group===t){this.offlineAnnotations.splice(n,1);return}}},renameZincObject:function(e,t){if(this.$module.scene){let n=this.$refs.scaffoldTreeControls,r=e.groupName;e.setName(t),n.zincObjectRenamed(e,r),this.$_searchIndex.updateZincObject(e,e.uuid)}},zincObjectRemoved:function(e){if(this.$module.scene){let t=e.groupName;e.region.findObjectsWithGroupName(t,!1).length===0&&this.$_searchIndex.removeZincObject(e,e.uuid)}},addRegionsToSearchIndex:function(){this.$module.scene.getRootRegion().getChildRegions(!0).forEach(e=>{this.$_searchIndex.addRegion(e,e.uuid)})},backgroundChangeCallback:function(e){this.currentBackground=e,this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground,1)},captureScreenshotCallback:function(e,t,n){return()=>{this.$module.zincRenderer.removePostRenderCallbackFunction(this.captureID);let r=this.$module.zincRenderer.getThreeJSRenderer(),i=this.$module.scene.camera,a=r.domElement.width,o=r.domElement.height,s=i.aspect,c=r.getPixelRatio();r.setPixelRatio(1),r.setSize(t,n,!1),i.aspect=t/n,i.updateProjectionMatrix(),this.$module.zincRenderer.render();let l=r.domElement.toDataURL(`image/png`);r.setPixelRatio(c),r.setSize(a,o,!1),i.aspect=s,i.updateProjectionMatrix(),this.$module.zincRenderer.render();let u=document.createElement(`a`);u.download=e||`screenshot.png`,u.href=l,u.click(),u.remove()}},captureScreenshot:function(e,t=1920,n=1080){this.captureID=this.$module.zincRenderer.addPostRenderCallbackFunction(this.captureScreenshotCallback(e,t,n))},clearScene:function(){this.$refs.scaffoldTreeControls&&this.$refs.scaffoldTreeControls.clear(),this.$_searchIndex&&this.$_searchIndex.removeAll(),this.$module.scene&&this.$module.scene.clearAll()},addAndEditAnnotations:function(e,n,r,i){let a=OE(this.annotator,this.userToken,r,e,n,this.url,i);if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==a.item.id)),this.existDrawnFeatures.push(a.feature),this.offlineAnnotationEnabled){a.group=n;let t=e;t.slice(-1)===`/`&&(t=t.slice(0,-1)),a.region=t,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[];let r=this.offlineAnnotations.find(e=>e.group===a.group&&e.region===a.region&&(this.annotationIgnoreResource||e.resource===a.resource)&&e.feature.geometry.type===a.feature.geometry.type);r?Object.assign(r,a):this.offlineAnnotations.push(a),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:e,group:n,zincObject:r})},renameAnnotations:function(e,n,r,i){let a=e.slice(-1)===`/`?e:e+`/`,o=a+i,s=OE(this.annotator,this.userToken,r,e,n,this.url,`Rename from ${o}`);if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==o)),this.existDrawnFeatures.push(s.feature),this.offlineAnnotationEnabled){s.group=n,a=e,a.slice(-1)===`/`&&(a=a.slice(0,-1)),s.region=a,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[];let t=this.offlineAnnotations.find(e=>e.group===i&&e.region===s.region&&(this.annotationIgnoreResource||e.resource===s.resource)&&e.feature.geometry.type===s.feature.geometry.type);t&&Object.assign(t,s),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:e,group:n,zincObject:r,renamedFrom:i})},primitivesUpdated:function(e){if(e.isZincObject&&e.isEditable){let t=e.groupName,n=e.region.getFullPath();this.addAndEditAnnotations(n,t,e,`Position Updated`)}},confirmCreate:function(e){if(e){let t;if(e.shape===`Point`)t=this.$module.scene.createPoints(e.region,e.group,this.createData.points,e.group,8942);else if(e.shape===`LineString`)t=this.$module.scene.createLines(e.region,e.group,[this.createData.points[0],this.createData.points[1]],60962);else if(e.deleting)this.confirmDelete(e);else if(e.editingIndex>-1){if(this._editingZincObject){let t;e.editingIndex>-1&&(t=this.createData.faceIndex>-1?this.createData.points[1]:this.createData.points[0]),this._editingZincObject.editVertices([t],e.editingIndex);let n=this._editingZincObject.region.getFullPath()+`/`,r=this._editingZincObject.groupName;this.addAndEditAnnotations(n,r,this._editingZincObject,`Position Updated`)}}else if(e.renaming){let t=this._editingZincObject.groupName;this.renameZincObject(this._editingZincObject,e.group),this.renameAnnotations(e.region,e.group,this._editingZincObject,t)}t&&(this.addAndEditAnnotations(e.region,e.group,t.zincObject,`Create`),t.zincObject.isEditable=!0,this.tData.region=e.region,this.tData.label=e.group,this.changeActiveByName([e.group],e.region,!1))}this.cancelCreate()},cancelCreate:function(){this.changeActiveByName(void 0),this.createData.points.length=0,this.createData.renaming=!1,this.createData.toBeConfirmed=!1,this._editingZincObject=void 0,this.createData.editingIndex=-1,this.createData.faceIndex=-1,this.createData.tempGroupName=void 0,this.tData.visible=!1,this.createData.toBeDeleted=!1,this._tempLine&&=(this.$module.scene.removeTemporaryPrimitive(this._tempLine),void 0),this._tempPoint&&=(this.$module.scene.removeTemporaryPrimitive(this._tempPoint),void 0),this.annotationSidebar&&this.$emit(`annotation-close`)},confirmComment:function(e){if(this._editingZincObject){let n=e;this._editingZincObject.isEditable&&(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==n.item.id)),this.existDrawnFeatures.push(e.feature)),this.offlineAnnotationEnabled&&(n.group=this._editingZincObject.groupName,n.region=this._editingZincObject.region.getFullPath(),this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],this.offlineAnnotations.push(n),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations)))}},confirmDelete:function(e){if(this._editingZincObject?.isEditable){let n=this._editingZincObject.region.getFullPath()+`/`,r=this._editingZincObject.groupName,i=!0;e.editingIndex>-1&&this._editingZincObject.isPointset&&(i=1>this._editingZincObject.deleteVertices(e.editingIndex));let a=i?`Deleted`:`Removed a vertex`,o=OE(this.annotator,this.userToken,this._editingZincObject,n,r,this.url,a);if(o){if(this.existDrawnFeatures=(0,t.markRaw)(this.existDrawnFeatures.filter(e=>e.id!==o.item.id)),i&&this.$module.scene.getRootRegion().findChildFromPath(n).removeZincObject(this._editingZincObject),this.offlineAnnotationEnabled){o.group=r;let t=e.region;if(t.slice(-1)===`/`&&(t=t.slice(0,-1)),o.region=t,this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],i)this.offlineAnnotations=this.offlineAnnotations.filter(e=>e.item.id!==o.item.id);else{let e=this.offlineAnnotations.find(e=>e.group===r&&e.region===o.region&&(this.annotationIgnoreResource||e.resource===o.resource)&&e.feature.geometry.type===o.feature.geometry.type);Object.assign(e,o),this.existDrawnFeatures.push(o.feature)}sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}this.$emit(`userPrimitivesUpdated`,{region:this._editingZincObject.region,group:r,zincObject:this._editingZincObject,deleted:!0})}}this.cancelCreate()},onTooltipHide:function(){this.createData.toBeConfirmed&&!this.annotationSidebar&&this.cancelCreate()},formatTooltip(e){if(this.timeMax>=1e3&&e){let t=(e%6e4/1e3).toFixed(2)+`s`;return(e>6e4?(e/6e4).toFixed(0)+`m `:``)+t}return e?e.toFixed(2)+` ms`:`0 ms`},fitWindow:function(){if(this.$module.scene){let e=!1;this._boundingBoxGeo&&(e=this._boundingBoxGeo.getVisibility(),this._boundingBoxGeo.setVisibility(!1)),this.$module.scene.viewAll(),this._boundingBoxGeo&&(yE(this._boundingBoxGeo,this.$module.scene),this._boundingBoxGeo.setVisibility(e))}},zoomIn:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(-1)},zoomOut:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(1)},speedChanged:function(e){this.currentSpeed=e,this.$module.setPlayRate(this.defaultRate*this.currentSpeed)},stopFreeSpin:function(){this.$module.scene.getZincCameraControls().stopAutoTumble(),this.isTransitioning=!1},findObjectsWithGroupName:function(e){let t=[];return e&&e!=``&&this.$module.scene&&(t=this.$module.scene.findObjectsWithGroupName(e)),t},toggleDrawing:function(e,t){this.createData.toBeDeleted=!1,e===`mode`?(this.cancelCreate(),this.activeDrawMode=t,this.createData.shape=``,this.$module.selectObjectOnPick=!0):e===`tool`&&(this.activeDrawTool=t,this.createData.renaming=!1,this.createData.shape=this.activeDrawTool?this.activeDrawTool:``,this.$module.selectObjectOnPick=!1)},toggleDrawingBox:function(){this.createData.drawingBox=!this.createData.drawingBox},viewRegion:function(e){let t=xE(this.$module.scene.getRootRegion(),Array.isArray(e)?e:[e],``,!0),n=this.$module.scene.getBoundingBoxOfZincObjects(t);if(n){if(this.$module.isSyncControl())this.$module.setSyncControlZoomToBox(n);else{let e=this.$module.scene.camera.far-this.$module.scene.camera.near;this.$module.scene.viewAllWithBoundingBox(n),this.$module.scene.camera.far=this.$module.scene.camera.near+e,this.$module.scene.camera.updateProjectionMatrix()}return!0}return!1},setFocusedRegion:function(e){e&&(this.isReady?this.viewRegion(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({region:e})))},setRotationMode:function(e){this.$module.scene&&this.$module.scene.getZincCameraControls().setRotationMode(e)},updateViewURL:function(e){if(e){if(this.isReady){let t=new URL(e,this.url);this.$module.scene.loadViewURL(t)}else this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewURL:e}))}},createEditTemporaryPoint:function(e){let t=e[0].extraData.worldCoords;if(t&&(this.createData.shape===`Point`||this.createData.editingIndex>-1)&&this.createData.points.length===0){if(this.showRegionTooltipWithAnnotations(e,!1,!1),this.tData.x=50,this.tData.y=200,this._tempPoint){let e=this._tempPoint.geometry.getAttribute(`position`);e.setXYZ(0,t[0],t[1],t[2]),e.needsUpdate=!0}else this._tempPoint=this.$module.scene.addTemporaryPoints([t],65535)}},createEditTemporaryLines:function(e){let t=e[0].extraData.worldCoords;if(t&&(this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1)&&this.createData.points.length===1){if(this.showRegionTooltipWithAnnotations(e,!1,!1),this._tempLine){let e=this._tempLine.geometry.getAttribute(`position`);e.setXYZ(1,t[0],t[1],t[2]),e.needsUpdate=!0}else this._tempLine=this.$module.scene.addTemporaryLines([this.createData.points[0],t],65535)}},createEditTemporaryPrimitive:function(e){this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1?this.createEditTemporaryLines(e):(this.createData.shape===`Point`||this.createData.editingIndex>-1)&&this.createEditTemporaryPoint(e)},draw:function(e){e&&e.length>0&&e[0].data.group&&e[0].extraData.worldCoords&&(this.createData.shape===`LineString`||this.createData.editingIndex>-1&&this.createData.faceIndex>-1?this.drawLine(e[0].extraData.worldCoords,e):(this.createData.shape===`Point`||this.createData.editingIndex>-1&&this.createData.faceIndex===-1)&&this.drawPoint(e[0].extraData.worldCoords,e))},drawPoint:function(e,t){this.createData.toBeConfirmed===!1&&(this.createData.points.length=0,this.createData.points.push(e),this.createData.editingIndex===-1&&!this.createData.renaming&&(this.createData.tempGroupName=void 0),this.createData.toBeConfirmed=!0,this.showRegionTooltipWithAnnotations(t,!1,!1),this.tData.x=50,this.tData.y=200,this._tempPoint||=this.$module.scene.addTemporaryPoints([e],16776960))},drawLine:function(e,t){this.createData.toBeConfirmed===!1&&(this.createData.points.length===1?(this.createData.points.push(e),this.createData.editingIndex===-1&&!this.createData.renaming&&(this.createData.tempGroupName=void 0),this.createData.toBeConfirmed=!0,this.showRegionTooltipWithAnnotations(t,!1,!1),this.tData.x=50,this.tData.y=200):(this._tempPoint=this.$module.scene.addTemporaryPoints([e],16776960),this.createData.points.push(e)))},getRendererInfo:function(){if(this.$module.zincRenderer)return this.$module.zincRenderer.getThreeJSRenderer().info},freeSpin:function(){if(this.$module.scene){let e=this.$module.scene.getZincCameraControls();this.isTransitioning=!0,e.enableAutoTumble(),e.autoTumble([1,0],Math.PI,!0),setTimeout(this.stopFreeSpin,4e3)}},activateDeleteMode:function(e){let t=pE(e);if(t){let n=fE(e),r=n?.index===void 0?-1:n.index;this._editingZincObject=t,this.createData.faceIndex=-1,this.createData.editingIndex=r,this.createData.renaming=!1,this.createData.tempGroupName=this._editingZincObject.groupName,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.toBeConfirmed=!0,this.createData.toBeDeleted=!0,this.tData.x=50,this.tData.y=200}},activateEditingMode:function(e){let t=fE(e);t?this.activatePointEditingMode(t.zincObject,t.index,t.point):(t=mE(e),t&&this.activateLineEditingMode(t.zincObject,t.faceIndex,t.vertexIndex,t.point))},activateRenamingMode:function(e){let t=fE(e);t||=mE(e),t&&(this._editingZincObject=t.zincObject,this.createData.faceIndex=-1,this.createData.editingIndex=-1,this.createData.renaming=!0,this.createData.tempGroupName=this._editingZincObject.groupName,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.toBeConfirmed=!0,this.createData.toBeDeleted=!1,this.showRegionTooltipWithAnnotations(e,!1,!1),this.tData.x=50,this.tData.y=200)},activateAnnotationMode:function(e,t){this.authorisedUser||this.offlineAnnotationEnabled?(this.createData.toBeDeleted=!1,this.createData.shape!==``||this.createData.editingIndex>-1?e.length>0&&t.identifiers[0].coords&&this.draw(t.identifiers):(this.activeDrawMode===`Edit`?this.activateEditingMode(t.identifiers):this.activeDrawMode===`Delete`&&this.activateDeleteMode(t.identifiers),this.activeDrawMode!==`Point`&&this.activeDrawMode!==`LineString`?this.showRegionTooltipWithAnnotations(t.identifiers,!0,!1):this.showRegionTooltipWithAnnotations(t.identifiers,!0,!0))):this.showRegionTooltipWithAnnotations(t.identifiers,!0,!0)},activatePointEditingMode:function(e,t,n){this._editingZincObject=e,this.createData.faceIndex=-1,this.createData.renaming=!1,this.createData.toBeDeleted=!1,this.createData.editingIndex=t,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.tempGroupName=this._editingZincObject.groupName},activateLineEditingMode:function(e,t,n,r){this._editingZincObject=e,this.createData.faceIndex=t,this.createData.renaming=!1,this.createData.toBeDeleted=!1,this.createData.editingIndex=n,this.createData.regionPrefix=this._editingZincObject.region.getFullPath(),this.createData.tempGroupName=this._editingZincObject.groupName,this.drawLine(r,void 0)},eventNotifierCallback:function(e){if(!(this.createData.toBeConfirmed||this.createData.toBeDeleted)){let t=[],n=[];(e.eventType==1||e.eventType==2)&&(e.identifiers.forEach(e=>{if(e){let n=e.data.id?e.data.id:e.data.group;t.push(n)}}),n=e.zincObjects);let r,i;if(e.identifiers.length>0&&e.identifiers[0]&&(r=e.identifiers[0].data.id?e.identifiers[0].data.id:e.identifiers[0].data.group,e.identifiers[0].data.region&&(i=e.identifiers[0].data.region)),e.eventType==1){if(this.viewingMode===`Annotation`){this.tData.label=r,this.tData.region=i;let n=hE(e);if(this.createData.editingIndex===-1&&(this._editingZincObject=n),n){let e=this._editingZincObject.region.getFullPath()+`/`,t=this._editingZincObject.groupName;this.annotationFeature=DE(this._editingZincObject,e,t,this.url,``).feature}this.activateAnnotationMode(t,e)}else this.$refs.scaffoldTreeControls&&(t.length>0?(this.$refs.scaffoldTreeControls.updateActiveUI(n),this.updatePrimitiveControls(n)):(this.hideRegionTooltip(),this.$refs.scaffoldTreeControls.removeActive(!1))),e.identifiers.length===1?this.lastSelected={isSearch:!1,region:i,group:e.identifiers[0].data.group}:e.identifiers.length===0&&(this.lastSelected={isSearch:!1,region:``,group:``}),this.$emit(`scaffold-selected`,e.identifiers)}else if(e.eventType==2)this.hideRegionTooltip(),this.$refs.scaffoldTreeControls&&(t.length>0?this.$refs.scaffoldTreeControls.updateHoverUI(n):this.$refs.scaffoldTreeControls.removeHover(!0)),e.identifiers.length>0&&e.identifiers[0]&&e.identifiers[0].coords&&(this.tData.active=!1,(this.viewingMode!==`Annotation`||!this.annotationSidebar)&&(this.tData.visible=!0),this.tData.label=r,this.tData.region=i,this.tData.x=e.identifiers[0].coords.x,this.tData.y=e.identifiers[0].coords.y,this.createEditTemporaryPrimitive(e.identifiers)),this.$emit(`scaffold-highlighted`,e.identifiers);else if(e.eventType==3&&e.identifiers.length>0&&e.identifiers[0]){if(e.identifiers[0].coords){let t=this.$refs.scaffoldContainer.$el.getBoundingClientRect();this.tData.x=e.identifiers[0].coords.x-t.left,this.tData.y=e.identifiers[0].coords.y-t.top}this.createEditTemporaryPrimitive(e.identifiers)}}},getCoordinatesOfSelected:function(){if(this.selectedObjects&&this.selectedObjects.length>0)return this.$module.scene.getObjectsScreenXY(this.selectedObjects)},getDynamicSelectedCoordinates:function(){return this.$module.selectedScreenCoordinates},timeChange:function(e){let t=e/this.timeMax*100;t!=this.currentTime&&this.$module.updateTime(t)},updatePrimitiveControls:function(e){(this.viewingMode===`Exploration`||this.viewingMode===`Annotation`)&&(this.selectedObjects=e,this.selectedObjects&&this.selectedObjects.length>0?this.$refs.primitiveControls.setObject(this.selectedObjects[0]):this.$refs.primitiveControls.setObject(void 0))},objectSelected:function(e,t){this.$module.isIgnorePicking()||(this.updatePrimitiveControls(e),this.$module.setSelectedByZincObjects(e,void 0,{},t))},objectHovered:function(e,t){this.hoveredObjects=e,this.$module.setHighlightedByZincObjects(e,void 0,{},t)},changeActiveByName:function(e,t,n){let r=Array.isArray(e);if(e===void 0||r&&e.length===0)this.$refs.scaffoldTreeControls.removeActive(n);else{let i=e;r||(i=[i]),this.$refs.scaffoldTreeControls.changeActiveByNames(i,t,n)}},changeHighlightedByName:function(e,t,n){let r=Array.isArray(e);if(e===void 0||r&&e.length===0)this.$refs.scaffoldTreeControls.removeHover(n);else{let i=e;r||(i=[i]),this.$refs.scaffoldTreeControls.changeHoverByNames(i,t,n)}},play:function(e){this.$module.playAnimation(e),this.isPlaying=e},setRegionCheckboxDisabled:function(e,t,n=!0){this.$refs.scaffoldTreeControls.setRegionCheckboxDisabled(e,t,n)},setHelpMode:function(e){let t=this.hoverVisibilities.length,n=t-1,r=this.hoverVisibilities[this.helpModeActiveIndex];if(r){let e=r?.refs,t=r?.ref;this.$refs[e||t]||(this.helpModeActiveIndex+=1)}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),e&&this.helpModeActiveIndex>=n&&this.$emit(`help-mode-last-item`,!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(e=>{e.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1&&setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}),this.showHelpText(this.helpModeActiveIndex,200)},300):(this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}))},displayTooltipOfObjectsCallback:function(e,t,n,r,i){let a=this;return function(){a.$module.zincRenderer.removePostRenderCallbackFunction(a.$_regionTooltipCallback),a.$_regionTooltipCallback=void 0,a.displayTooltipOfObjects(e,t,n,r,i)}},liveUpdateTooltipPosition:function(){this.$module.selectedCenter&&(this.tData.x=this.$module.selectedScreenCoordinates.x,this.tData.y=this.$module.selectedScreenCoordinates.y)},displayTooltipOfObjects:function(e,t,n,r,i){if(t.length>0){let a=t[0].getClosestVertexDOMElementCoords(this.$module.scene);if(a)return a.inView?(e.includes(`Search Results for`)?this.tData.active=!1:this.tData.active=!0,this.tData.visible=!0,this.tData.label=e,this.tData.x=a.position.x,this.tData.y=a.position.y,this.tData.region=n,this.$_liveCoordinatesUpdated&&=(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),void 0),i&&(this.$module.setupLiveCoordinates(t),this.$_liveCoordinatesUpdated=this.$module.zincRenderer.addPostRenderCallbackFunction(this.liveUpdateTooltipPosition))):r&&(this.hideRegionTooltip(),this.$module.scene.viewAll(),this.$_regionTooltipCallback&&(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_regionTooltipCallback),this.$module.$_regionTooltipCallback=void 0),this.$_regionTooltipCallback=this.$module.zincRenderer.addPostRenderCallbackFunction(this.displayTooltipOfObjectsCallback(e,t,n,r,i))),!0}return this.hideRegionTooltip(),!1},showRegionTooltipWithObjects:function(e,t,n,r,i){return e&&t&&t.length>0&&this.$module.scene?this.displayTooltipOfObjects(e,t,n,r,i):(this.hideRegionTooltip(),!1)},showRegionTooltip:function(e,t,n){if(e&&this.$module.scene){let r=xE(this.$module.scene.getRootRegion(),[e],``,!0),i;return r&&r.length>0&&(i=r[0].getRegion().getFullPath()),this.showRegionTooltipWithObjects(e,r,i,t,n)}return this.hideRegionTooltip(),!1},showRegionTooltipWithAnnotations:function(e,t,n){if(this.$module.scene){let r=TE(this.$module.scene,e);if(this._editingZincObject&&(r.regionPath=this._editingZincObject.region.getFullPath()+`/`,r.label=this._editingZincObject.groupName),r&&r.objects.length>0){if(this.annotationSidebar){let e=[{featureId:(this.tData.region?this.tData.region+`/`:``)+this.tData.label,resourceId:this.url,resource:this.url,feature:this.annotationFeature,offline:this.offlineAnnotationEnabled}];this.$emit(`annotation-open`,{annotationEntry:e,createData:this.createData,confirmCreate:this.confirmCreate,cancelCreate:this.cancelCreate,confirmDelete:this.confirmDelete,confirmComment:this.confirmComment});return}return this.showRegionTooltipWithObjects(r.label,r.objects,r.regionPath,t,n)}}return this.hideRegionTooltip(),!1},clearAnnotationFeature:function(){let e=this.getOfflineAnnotations();this.existDrawnFeatures.map(e=>decodeURIComponent(e.id).split(`/`).pop()).forEach(e=>{let t=this.$module.scene.findObjectsWithGroupName(e,!1);if(t&&t.length){let e=t[0].region.getFullPath()+`/`;this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(t[0])}}),this.$refs.scaffoldTreeControls.removeRegion(`__annotation`),this.offlineAnnotations=e},addAnnotationFeature:async function(){let e;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],e=this.offlineAnnotations.filter(e=>e.resource===this.url&&e.feature.properties.drawn).map(e=>e.feature);else{e=[];let t=await kE(this.annotator,this.userToken,this.url);t&&t.features&&(e=[...t.features]);let n=await kE(this.annotator,this.userToken,encodeURIComponent(this.url));n&&n.features&&(e=[...e,...n.features])}this.existDrawnFeatures=(0,t.markRaw)(e),AE(this.$module.scene,e)},changeViewingMode:function(e){let t=!0;this.$module&&(e&&(this.viewingMode=e),this.clearAnnotationFeature(),this.viewingMode===`Annotation`?(this.loading=!0,this.annotator.authenticate(this.userToken).then(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.addAnnotationFeature(),this.loading=!1})):this.viewingMode===`Exploration`?(this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.createData.shape=``):this.viewingMode===`Neuron Connection`&&(t=!1),this.viewingMode===`Exploration`||this.viewingMode===`Neuron Connection`||this.viewingMode===`Annotation`&&this.createData.shape===``?this.$module.selectObjectOnPick=!0:this.$module.selectObjectOnPick=!1,this.cancelCreate(),e&&this.setObjectIsPickable(t))},emitOfflineAnnotationUpdate:function(){this.$emit(`update-offline-annotation-enabled`,this.offlineAnnotationEnabled)},forceContextRestore:function(){this.$module.zincRenderer.forceContextRestore()},forceContextLoss:function(){this.$module.zincRenderer.forceContextLoss()},hideRegionTooltip:function(){this.$_liveCoordinatesUpdated&&=(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),this.$module.setupLiveCoordinates(void 0),void 0),this.tData.active=!1,this.tData.visible=!1,this.tData.region=void 0},setObjectIsPickable:function(e){this.$module.scene.getRootRegion().getAllObjects(!0).forEach(t=>{!t.userData?.isNerves&&!t.anatomicalId&&t.setIsPickable(e)})},setGreyScale:function(e,t=[]){this.$module.scene.getRootRegion().getAllObjects(!0).forEach(n=>{let r=n.groupName.toLowerCase(),i=n.userData?.isNerves;(t.length>0&&i&&!t.includes(r)||t.length===0&&!i)&&(n.setGreyScale(e),n.userData.isGreyScale=e)}),this.$refs.scaffoldTreeControls.updateAllNodeColours()},setColour:function(e,t=!1){this.isReady&&this.$module.scene&&typeof e==`boolean`&&(t||e!==this.colourRadio)&&(this.loading=!0,setTimeout(()=>{this.setGreyScale(!e),this.loading=!1,this.colourRadio=e},100))},setOutlines:function(e,t=!1){this.isReady&&this.$module.scene&&typeof e==`boolean`&&(t||e!==this.outlinesRadio)&&(this.outlinesRadio=e,this.$nextTick(()=>this.$refs.scaffoldTreeControls.setOutlines(e)))},setMarkerModeForObjectsWithName:function(e,t,n){if(e&&this.$module.scene){let r=t;typeof t==`number`&&(r={number:t,imgURL:void 0}),xE(this.$module.scene.getRootRegion(),[e],``,!0).forEach(e=>e.setMarkerMode(n,r))}},setMarkerModeWithAnnotations:function(e,t){if(this.$module.scene){let n=TE(this.$module.scene,e);n&&n.objects.length>0&&n.objects.forEach(e=>e.setMarkerMode(t))}},showHelpText:function(e,t=500){this.inHelp||(clearTimeout(this.helpTextWait[e]),this.helpTextWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit(`shown-tooltip`)},t))},hideHelpText:function(e,t=500){this.inHelp||(clearTimeout(this.helpTextWait[e]),this.helpTextWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},search:function(e,t){if(this.$_searchIndex){if(e===void 0||e===``||Array.isArray(e)&&e.length===0)return this.lastSelected={region:``,group:``,isSearch:!0},this.objectSelected([],!0),!1;{this.lastSelected={region:``,group:e,isSearch:!0};let n=this.$_searchIndex.searchAndProcessResult(e),r=n.zincObjects;if(r.length>0){if(this.objectSelected(r,!0),t)for(let e=0;e<r.length;e++)r[e]&&r[e].groupName&&this.showRegionTooltipWithObjects(n.label,r,n.regionPath,!0,!0);return!0}this.objectSelected([],!0)}}return!1},fetchSuggestions:function(e){return this.$_searchIndex===void 0?[]:this.$_searchIndex.auto_suggest(e)},updateMinimapScissor:function(){Object.keys(this.minimapSettings).forEach(e=>{this.$module.scene.minimapScissor[e]=this.minimapSettings[e]}),this.$module.scene.minimapScissor.updateRequired=!0},updateSettingsfromScene:function(){this.currentSpeed=1,this.$module.setPlayRate(this.defaultRate),this.orginalDuration=this.$module.scene.getMetadataTag(`OriginalDuration`),this.animateDuration=this.$module.scene.getMetadataTag(`Duration`);let e=this.$module.scene.getMetadataTag(`TimeStamps`);this.timeStamps={};for(let t in e)this.timeStamps[e[t]]=t;this.timeMax=this.$module.scene.getDuration()},restoreSettings:function(e){if(e){if(e.viewport)this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport);else if(e.viewURL&&e.viewURL!==``){let t=new URL(e.viewURL,this.url);this.$module.scene.loadViewURL(t)}else e.region&&e.region!==``&&this.viewRegion(e.region);e.visibility&&this.$nextTick(()=>{this.$refs.scaffoldTreeControls.setState(e.visibility)}),e.background&&this.backgroundChangeCallback(e.background),`colour`in e&&this.setColour(e.colour),e.offlineAnnotations&&sessionStorage.setItem(`anonymous-annotation`,e.offlineAnnotations),`outlines`in e&&this.setOutlines(e.outlines),e.viewingMode&&this.changeViewingMode(e.viewingMode);let t=e.search;t&&t.group&&(t.isSearch?this.search(t.group,!0):this.changeActiveByName(t.group,t.region,!0))}},calculateBoundingBox:function(){if(this.isReady){let{centre:e,size:t}=this.$module.getCentreAndSize();this.boundingDims.centre=e,this.boundingDims.size=t}},downloadErrorCallback:function(){return e=>{this.$emit(`on-error`,e)}},setURLFinishCallback:function(e){return()=>{this.offlineAnnotations.length=0,this.updateSettingsfromScene(),this.$module.updateTime(.01),this.$module.updateTime(0),this.$module.unsetFinishDownloadCallback(),this.addRegionsToSearchIndex(),this.setMarkers(),this._boundingBoxGeo=this.$module.scene.addBoundingBoxPrimitive(`_helper`,`boundingBox`,4251856,.15),this._slides=this.$module.scene.addSlicesPrimitive(`_helper`,[`x-plane`,`y-plane`,`z-plane`],[16733525,5635925,5592575],.5),this.isReady=!0,this.calculateBoundingBox(),this.$nextTick(()=>{this.restoreSettings(e),this.$emit(`on-ready`)})}},getState:function(){let e={format:this.fileFormat,url:this._currentURL,viewport:void 0,visibility:void 0,background:this.currentBackground,colour:this.colourRadio,outlines:this.outlinesRadio,viewingMode:this.viewingMode,usageConfig:this.usageConfig};return this.$refs.scaffoldTreeControls&&(e.visibility=this.$refs.scaffoldTreeControls.getState()),this.$module.scene&&(e.viewport=this.$module.scene.getZincCameraControls().getCurrentViewport()),this.lastSelected&&this.lastSelected.group&&(e.search={...this.lastSelected}),this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem(`anonymous-annotation`)),e},setState:function(e){e&&(e.url&&e.url!==this._currentURL?this.setURLAndState(e.url,{fileFormat:e.fileFormat,viewport:e.viewport,visibility:e.visibility,background:e.background,colour:e.colour,outlines:e.outlines,viewingMode:e.viewingMode,search:e.search,offlineAnnotations:e.offlineAnnotations}):(e.background||e.colour||e.search||e.outlines||e.viewport||e.viewingMode||e.visibility)&&(this.isReady&&this.$module.scene?this.restoreSettings(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({background:e.background,colour:e.colour,search:e.search,offlineAnnotations:e.offlineAnnotations,outlines:e.outlines,viewingMode:e.viewingMode,viewport:e.viewport,visibility:e.visibility}))))},exportGLTF:function(e){return this.$module.scene.exportGLTF(e)},getOfflineAnnotations:function(){return[...this.offlineAnnotations]},importOfflineAnnotations:function(e){if(this.offlineAnnotationEnabled){e.forEach(e=>{let t=e.group,n=e.region,r=n.slice(-1)===`/`?n:n+`/`;e.region=r.slice(0,-1),r+=t;let i=r;e.item.id=i,e.feature.id=i});let t=e.map(e=>e.feature);AE(this.$module.scene,t),e.forEach(e=>{this.offlineAnnotations.push({...e})}),sessionStorage.setItem(`anonymous-annotation`,JSON.stringify(this.offlineAnnotations))}},setURLAndState:function(e,t){if(e!=this._currentURL){let n={};t?.format&&(this.fileFormat=t.format),this._currentURL=e,this.$refs.scaffoldTreeControls&&this.$refs.scaffoldTreeControls.clear(),this.loading=!0,this.timeVarying=!1,this.isReady=!1,this.$_searchIndex.removeAll(),this.hideRegionTooltip(),this.$module.setDownloadErrorCallback(this.downloadErrorCallback()),this.$module.setFinishDownloadCallback(this.setURLFinishCallback({background:t?.background,colour:t?.colour,outlines:t?.outlines,region:this.region,search:t?.search,viewingMode:t?.viewingMode,viewURL:this.viewURL,viewport:t?.viewport,visibility:t?.visibility,offlineAnnotations:t?.offlineAnnotations})),this.fileFormat===`gltf`?this.$module.loadGLTFFromURL(e,`scene`,!0):((this?.usageConfig?.tubeLines||t?.usageConfig?.tubeLines)&&(n.tubeLines=!0),this.$module.loadOrgansFromURL(e,void 0,void 0,`scene`,void 0,!0,n)),this.$module&&this.$module.scene&&(this.$module.scene.displayMarkers=this.displayMarkers,this.$module.scene.forcePickableObjectsUpdate=!0,this.$module.scene.displayMinimap=this.displayMinimap,this.updateMinimapScissor())}},setURL:function(e){this.setURLAndState(e,void 0)},drawerToggled:function(e){this.drawerOpen=e,this.adjustLayout()},adjustLayout:function(){if(this.$refs.scaffoldContainer?.$el){let e=this.$refs.scaffoldContainer.$el.clientWidth;this.clientHeight=this.$refs.scaffoldContainer.$el.clientHeight,this.minimisedSlider=e<812,this.sliderPosition=this.minimisedSlider?this.drawerOpen?`right`:`left`:``}},toggleRendering:function(e){this.$module.zincRenderer&&(e?(this.forceContextRestore(),this.$module.zincRenderer.animate()):(this.$module.zincRenderer.stopAnimate(),this.forceContextLoss()))},forceResize:function(){this.$module.zincRenderer&&this.$module.zincRenderer.onWindowResize()},syncControlCallback:function(){let e=this.$module.NDCCameraControl.getPanZoom();this.tData.visible&&this.showRegionTooltip(this.tData.label,!0,!0),this.$emit(`scaffold-navigated`,e)},toggleSyncControl:function(e,t){this.$module.toggleSyncControl(e,t),this.$module.setSyncControlCallback(this.syncControlCallback)},setMarkers:function(){for(let[e,t]of Object.entries(this.markerLabels))this.setMarkerModeForObjectsWithName(e,t,`on`)},readNIFTIFromSource:async function(e,t,n,r,i){return await pD(e,t,n,r,i)}}},CO={class:`animation-data`},wO={class:`purple`},TO={class:`animation-data`},EO={class:`purple`},DO={class:`animation-data`},OO={class:`bottom-right-control control-layer`},kO={class:`control-layer`},AO={class:`viewing-mode-container`},jO={style:{"margin-bottom":`2px`}},MO={key:0,class:`viewing-mode-title`},NO=[`onClick`],PO={class:`colour-radio-container`},FO={class:`outlines-radio-container`},IO={class:`background-colour-container`},LO=[`onClick`];function RO(e,n,r,i,a,o){let s=(0,t.resolveComponent)(`map-svg-sprite-color`),c=fD,l=(0,t.resolveComponent)(`DrawToolbar`),u=Jd,d=Qd,f=r_,p=oD,m=IE,h=(0,t.resolveComponent)(`map-svg-icon`),g=C_,_=mg,v=U_,y=kh,b=Oh,x=H_,S=Km,C=lg,w=ug,T=cv,E=ev;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(T,{ref:`scaffoldContainer`,class:`scaffold-container`,"element-loading-text":`Loading...`,"element-loading-background":`rgba(0, 0, 0, 0.3)`,positionalRotation:r.positionalRotation,onOnRotationModeChange:o.setRotationMode},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(s),(0,t.createVNode)(c,{createData:e.createData,label:e.tData.label,region:e.tData.region,visible:e.tData.visible,x:e.tData.x,y:e.tData.y,annotationDisplay:o.annotationDisplay,annotationFeature:e.annotationFeature,offlineAnnotationEnabled:e.offlineAnnotationEnabled,onConfirmCreate:n[0]||=e=>o.confirmCreate(e),onCancelCreate:n[1]||=e=>o.cancelCreate(),onConfirmComment:n[2]||=e=>o.confirmComment(e),onTooltipHide:n[3]||=e=>o.onTooltipHide(),onCreateGroupSuggestions:n[4]||=t=>e.$emit(`create-group-suggestions`,t),onCreateRegionSuggestions:n[5]||=t=>e.$emit(`create-region-suggestions`,t)},null,8,[`createData`,`label`,`region`,`visible`,`x`,`y`,`annotationDisplay`,`annotationFeature`,`offlineAnnotationEnabled`]),(0,t.createElementVNode)(`div`,{id:`organsDisplayArea`,ref:`display`,tabindex:`-1`,style:{height:`100%`,width:`100%`},onKeydown:n[6]||=(0,t.withKeys)((...e)=>o.backgroundChangeCallback&&o.backgroundChangeCallback(...e),[`66`])},null,544),(0,t.withDirectives)((0,t.createElementVNode)(`div`,null,[e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,class:`control-layer`,toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,hoverVisibilities:e.hoverVisibilities,onClickToolbar:o.toggleDrawing,onShowTooltip:o.showHelpText,onHideTooltip:o.hideHelpText,ref:`toolbarPopover`},null,8,[`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`hoverVisibilities`,`onClickToolbar`,`onShowTooltip`,`onHideTooltip`])):(0,t.createCommentVNode)(``,!0),r.displayWarning?((0,t.openBlock)(),(0,t.createBlock)(f,{key:1,ref:`warningPopover`,visible:e.hoverVisibilities[7].value,content:r.warningMessage,placement:`right`,width:`max-content`,teleported:!1,"popper-class":`scaffold-popper message-popper right-popper non-selectable`},{reference:(0,t.withCtx)(()=>[r.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`message-icon warning-icon control-layer`,onMouseover:n[7]||=e=>o.showHelpText(7),onMouseout:n[8]||=e=>o.hideHelpText(7)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),n[33]||=(0,t.createElementVNode)(`span`,{class:`message-text`},`Beta`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`,`content`])):(0,t.createCommentVNode)(``,!0),r.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,visible:e.hoverVisibilities[8].value,content:r.latestChangesMessage,placement:`right`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper message-popper right-popper non-selectable`,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[r.displayLatestChanges&&r.latestChangesMessage?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`el-icon-warning message-icon latest-changesicon control-layer`,onMouseover:n[9]||=e=>o.showHelpText(8),onMouseout:n[10]||=e=>o.hideHelpText(8)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),n[34]||=(0,t.createElementVNode)(`span`,{class:`message-text`},`What's new?`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`,`content`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{visible:e.hoverVisibilities[6].value,content:`Change region visibility`,placement:`right`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`regionVisibilityPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(m,{class:`control-layer`,ref:`scaffoldTreeControls`,isReady:e.isReady,containerHeight:e.clientHeight,"show-colour-picker":o.enableColourPicker,onObjectSelected:o.objectSelected,onObjectHovered:o.objectHovered,onDrawerToggled:o.drawerToggled,onCheckChanged:n[11]||=t=>e.$emit(`check-changed`,t)},{treeSlot:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`treeSlot`,{},void 0,!0),(0,t.createVNode)(p,{class:`control-layer`,ref:`primitiveControls`,createData:e.createData,viewingMode:e.viewingMode,usageConfig:r.usageConfig,onPrimitivesUpdated:o.primitivesUpdated},null,8,[`createData`,`viewingMode`,`usageConfig`,`onPrimitivesUpdated`])]),_:3},8,[`isReady`,`containerHeight`,`show-colour-picker`,`onObjectSelected`,`onObjectHovered`,`onDrawerToggled`])]),_:3},8,[`visible`]),e.timeVarying?((0,t.openBlock)(),(0,t.createBlock)(f,{key:3,ref:`sliderPopover`,width:`max-content`,visible:e.hoverVisibilities[5].value,content:`Move the slider to animate the region`,placement:`top`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper top-popper non-selectable`},{reference:(0,t.withCtx)(()=>[e.timeVarying?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`time-slider-container control-layer`,[e.minimisedSlider?`minimised`:``,e.sliderPosition]])},[(0,t.createVNode)(x,{type:`card`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(v,{label:`Animate scaffold`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`tab-content`},{default:(0,t.withCtx)(()=>[e.isPlaying?((0,t.openBlock)(),(0,t.createBlock)(h,{key:0,icon:`pause`,class:`icon-button video-button`,onClick:n[12]||=e=>o.play(!1)})):((0,t.openBlock)(),(0,t.createBlock)(h,{key:1,icon:`play`,class:`video-button icon-button`,onClick:n[13]||=e=>o.play(!0)})),(0,t.createVNode)(g,{min:0,max:e.timeMax,"model-value":e.currentTime/100*e.timeMax,step:.1,"tooltip-class":`time-slider-tooltip`,class:`slider`,"format-tooltip":o.formatTooltip,marks:e.timeStamps,onInput:n[14]||=e=>o.timeChange(e)},null,8,[`max`,`model-value`,`format-tooltip`,`marks`])]),_:1})]),_:1}),(0,t.createVNode)(v,{label:`Animation data`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(_,{class:`tab-content`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,CO,[n[35]||=(0,t.createTextVNode)(` Original duration: `,-1),(0,t.createElementVNode)(`div`,wO,(0,t.toDisplayString)(e.orginalDuration),1)]),(0,t.createElementVNode)(`div`,TO,[n[36]||=(0,t.createTextVNode)(` Animation duration: `,-1),(0,t.createElementVNode)(`div`,EO,(0,t.toDisplayString)(e.animateDuration),1)]),(0,t.createElementVNode)(`div`,DO,[n[37]||=(0,t.createTextVNode)(` Playback speed `,-1),(0,t.createVNode)(b,{teleported:!0,"model-value":e.currentSpeed,placeholder:`Select`,class:`scaffold-select-box speed`,"popper-class":`scaffold_viewer_dropdown`,onChange:n[15]||=e=>o.speedChanged(e)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.playSpeed,e=>((0,t.openBlock)(),(0,t.createBlock)(y,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`])])]),_:1})]),_:1})]),_:1})],2)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,OO,[(0,t.createVNode)(f,{visible:e.hoverVisibilities[0].value,content:`Zoom in`,width:`max-content`,placement:`left`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper left-popper non-selectable`,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`zoomIn`,class:`icon-button zoomIn`,onClick:n[16]||=e=>o.zoomIn(),onMouseover:n[17]||=e=>o.showHelpText(0),onMouseout:n[18]||=e=>o.hideHelpText(0)})]),_:1},8,[`visible`]),(0,t.createVNode)(f,{visible:e.hoverVisibilities[1].value,content:`Zoom out`,placement:`top-end`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper popper-zoomout non-selectable`,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`zoomOut`,class:`icon-button zoomOut`,onClick:n[19]||=e=>o.zoomOut(),onMouseover:n[20]||=e=>o.showHelpText(1),onMouseout:n[21]||=e=>o.hideHelpText(1)})]),_:1},8,[`visible`]),(0,t.createVNode)(f,{visible:e.hoverVisibilities[2].value,placement:`top`,teleported:!1,trigger:`manual`,width:`max-content`,"popper-class":`scaffold-popper non-selectable`,ref:`zoomFitPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{icon:`fitWindow`,class:`icon-button fitWindow`,onClick:n[22]||=e=>o.fitWindow(),onMouseover:n[23]||=e=>o.showHelpText(2),onMouseout:n[24]||=e=>o.hideHelpText(2)})]),default:(0,t.withCtx)(()=>[n[38]||=(0,t.createElementVNode)(`div`,null,[(0,t.createTextVNode)(` Fit to `),(0,t.createElementVNode)(`br`),(0,t.createTextVNode)(` window `)],-1)]),_:1},8,[`visible`])]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:4,ref:`open-map-popover`,"virtual-ref":e.openMapRef,placement:`top-start`,width:`128`,teleported:!1,trigger:`click`,"popper-class":`open-map-popper`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(_,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper non-selectable h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,kO,[(0,t.createElementVNode)(`div`,AO,[(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[39]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,jO,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,MO,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>o.changeViewingMode(r)},(0,t.toDisplayString)(r),9,NO))],64))),128))]),(0,t.createVNode)(_,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(o.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(_,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...n[40]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1})]),(0,t.createElementVNode)(`div`,PO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[41]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{modelValue:e.colourRadio,"onUpdate:modelValue":n[25]||=t=>e.colourRadio=t,class:`scaffold-radio`,onChange:n[26]||=t=>o.setColour(e.colourRadio,!0)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(C,{value:!0},{default:(0,t.withCtx)(()=>[...n[42]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(C,{value:!1},{default:(0,t.withCtx)(()=>[...n[43]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1})]),(0,t.createElementVNode)(`div`,FO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[44]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{modelValue:e.outlinesRadio,"onUpdate:modelValue":n[27]||=t=>e.outlinesRadio=t,class:`scaffold-radio`,onChange:n[28]||=t=>o.setOutlines(e.outlinesRadio,!0)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(C,{value:!0},{default:(0,t.withCtx)(()=>[...n[45]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(C,{value:!1},{default:(0,t.withCtx)(()=>[...n[46]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1})]),(0,t.createElementVNode)(`div`,IO,[(0,t.createVNode)(_,{class:`backgroundSpacer`}),(0,t.createVNode)(_,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...n[47]||=[(0,t.createTextVNode)(` Change background `,-1)]]),_:1}),(0,t.createVNode)(_,{class:`backgroundChooser`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>o.backgroundChangeCallback(n)},null,10,LO))),128))]),_:1})])])]),_:1},8,[`virtual-ref`]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group control-layer`,{open:e.drawerOpen,close:!e.drawerOpen}])},[r.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(_,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[3].value,content:`Open new map`,placement:`right`,teleported:!1,trigger:`manual`,width:`max-content`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[r.enableOpenMapUI&&r.openMapOptions.length>0?((0,t.openBlock)(),(0,t.createBlock)(h,{key:0,ref:`openMapRef`,icon:`openMap`,class:`icon-button open-map-button`,onMouseover:n[29]||=e=>o.showHelpText(3),onMouseout:n[30]||=e=>o.hideHelpText(3)},null,512)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0),r.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[4].value,content:`Change background color`,placement:`right`,width:`max-content`,teleported:!1,trigger:`manual`,"popper-class":`scaffold-popper right-popper non-selectable`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(h,{ref:`backgroundIconRef`,icon:`changeBckgd`,class:`icon-button`,onMouseover:n[31]||=e=>o.showHelpText(4),onMouseout:n[32]||=e=>o.hideHelpText(4)},null,512)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2)],512),[[t.vShow,r.displayUI&&!e.isTransitioning]])]),_:3},8,[`positionalRotation`,`onOnRotationModeChange`])),[[E,e.loading]])}e.ScaffoldVuer=nv(SO,[[`render`,RO],[`__scopeId`,`data-v-9e505335`]])});