@abi-software/scaffoldvuer 1.8.0-beta.1 → 1.8.0-beta.3

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.
@@ -3179,9 +3179,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3179
3179
  `),s=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP"," vec4 texelGlossiness = texture2D( glossinessMap, vUv );"," // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture"," glossinessFactor *= texelGlossiness.a;","#endif"].join(`
3180
3180
  `),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join(`
3181
3181
  `),l={specular:{value:new Ae().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=l,this.onBeforeCompile=function(u){for(const c in l)u.uniforms[c]=l[c];u.fragmentShader=u.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",i).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",s).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return l.specular.value},set:function(u){l.specular.value=u}},specularMap:{get:function(){return l.specularMap.value},set:function(u){l.specularMap.value=u,u?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return l.glossiness.value},set:function(u){l.glossiness.value=u}},glossinessMap:{get:function(){return l.glossinessMap.value},set:function(u){l.glossinessMap.value=u,u?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class kB{constructor(){this.name=tt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return Sf}extendParams(e,t,i){const r=t.extensions[this.name];e.color=new Ae(1,1,1),e.opacity=1;const s=[];if(Array.isArray(r.diffuseFactor)){const o=r.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(r.diffuseTexture!==void 0&&s.push(i.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new Ae(0,0,0),e.glossiness=r.glossinessFactor!==void 0?r.glossinessFactor:1,e.specular=new Ae(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),r.specularGlossinessTexture!==void 0){const o=r.specularGlossinessTexture;s.push(i.assignTexture(e,"glossinessMap",o)),s.push(i.assignTexture(e,"specularMap",o))}return Promise.all(s)}createMaterial(e){const t=new Sf(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=ir,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class zB{constructor(){this.name=tt.KHR_MESH_QUANTIZATION}}class Ao extends ii{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}}Ao.prototype.beforeStart_=Ao.prototype.copySampleValue_,Ao.prototype.afterEnd_=Ao.prototype.copySampleValue_,Ao.prototype.interpolate_=function(n,e,t,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,l=o*2,u=o*3,c=i-e,f=(t-e)/c,h=f*f,p=h*f,y=n*u,m=y-u,d=-2*p+3*h,b=p-h,v=1-d,g=b-h+f;for(let w=0;w!==o;w++){const S=s[m+w+o],E=s[m+w+l]*c,M=s[y+w+o],_=s[y+w]*c;r[w]=v*S+g*E+d*M+b*_}return r};const Di={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},za={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hx={9728:St,9729:gt,9984:Qo,9985:kl,9986:ea,9987:Mi},fx={33071:zt,33648:Os,10497:nr},px={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_f={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},wr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},UB={CUBICSPLINE:void 0,LINEAR:Fr,STEP:Bs},Tf={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function mx(n,e){return typeof n!="string"||n===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(n)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(n)||/^data:.*,.*$/i.test(n)||/^blob:.*$/i.test(n)?n:e+n)}function GB(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Kr({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Qi})),n.DefaultMaterial}function Ua(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function ls(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function HB(n,e,t){let i=!1,r=!1;for(let l=0,u=e.length;l<u;l++){const c=e[l];if(c.POSITION!==void 0&&(i=!0),c.NORMAL!==void 0&&(r=!0),i&&r)break}if(!i&&!r)return Promise.resolve(n);const s=[],o=[];for(let l=0,u=e.length;l<u;l++){const c=e[l];if(i){const f=c.POSITION!==void 0?t.getDependency("accessor",c.POSITION):n.attributes.position;s.push(f)}if(r){const f=c.NORMAL!==void 0?t.getDependency("accessor",c.NORMAL):n.attributes.normal;o.push(f)}}return Promise.all([Promise.all(s),Promise.all(o)]).then(function(l){const u=l[0],c=l[1];return i&&(n.morphAttributes.position=u),r&&(n.morphAttributes.normal=c),n.morphTargetsRelative=!0,n})}function WB(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function jB(n){const e=n.extensions&&n.extensions[tt.KHR_DRACO_MESH_COMPRESSION];let t;return e?t="draco:"+e.bufferView+":"+e.indices+":"+gx(e.attributes):t=n.indices+":"+gx(n.attributes)+":"+n.mode,t}function gx(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function Ef(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class $B{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new AB,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},typeof createImageBitmap<"u"&&/Firefox/.test(navigator.userAgent)===!1?this.textureLoader=new af(this.options.manager):this.textureLoader=new Kh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new bn(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){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const l={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};Ua(s,l,r),ls(l,r),Promise.all(i._invokeAll(function(u){return u.afterRoot&&u.afterRoot(l)})).then(function(){e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const o=t[r].joints;for(let l=0,u=o.length;l<u;l++)e[o[l]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.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,i){if(e.refs[t]<=1)return i;const r=i.clone();return r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[tt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,o){i.load(mx(t.uri,r.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0)return Promise.resolve(null);const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){const l=o[0],u=px[r.type],c=za[r.componentType],f=c.BYTES_PER_ELEMENT,h=f*u,p=r.byteOffset||0,y=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,m=r.normalized===!0;let d,b;if(y&&y!==h){const v=Math.floor(p/y),g="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+v+":"+r.count;let w=t.cache.get(g);w||(d=new c(l,v*y,r.count*y/f),w=new pr(d,y/f),t.cache.add(g,w)),b=new Oi(w,u,p%y/f,m)}else l===null?d=new c(r.count*u):d=new c(l,p,r.count*u),b=new je(d,u,m);if(r.sparse!==void 0){const v=px.SCALAR,g=za[r.sparse.indices.componentType],w=r.sparse.indices.byteOffset||0,S=r.sparse.values.byteOffset||0,E=new g(o[1],w,r.sparse.count*v),M=new c(o[2],S,r.sparse.count*u);l!==null&&(b=new je(b.array.slice(),b.itemSize,b.normalized));for(let _=0,C=E.length;_<C;_++){const I=E[_];if(b.setX(I,M[_*u]),u>=2&&b.setY(I,M[_*u+1]),u>=3&&b.setZ(I,M[_*u+2]),u>=4&&b.setW(I,M[_*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return b})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e],s=t.images[r.source];let o=this.textureLoader;if(s.uri){const l=i.manager.getHandler(s.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,i){const r=this,s=this.json,o=this.options,l=s.textures[e],u=(t.uri||t.bufferView)+":"+l.sampler;if(this.textureCache[u])return this.textureCache[u];const c=self.URL||self.webkitURL;let f=t.uri||"",h=!1,p=!0;const y=f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0;if((t.mimeType==="image/jpeg"||y)&&(p=!1),t.bufferView!==void 0)f=r.getDependency("bufferView",t.bufferView).then(function(d){if(t.mimeType==="image/png"){const v=new DataView(d,25,1).getUint8(0,!1);p=v===6||v===4||v===3}h=!0;const b=new Blob([d],{type:t.mimeType});return f=c.createObjectURL(b),f});else if(t.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(f).then(function(d){return new Promise(function(b,v){let g=b;i.isImageBitmapLoader===!0&&(g=function(w){const S=new _t(w);S.needsUpdate=!0,b(S)}),i.load(mx(d,o.path),g,void 0,v)})}).then(function(d){h===!0&&c.revokeObjectURL(f),d.flipY=!1,l.name&&(d.name=l.name),p||(d.format=_i);const v=(s.samplers||{})[l.sampler]||{};return d.magFilter=hx[v.magFilter]||gt,d.minFilter=hx[v.minFilter]||Mi,d.wrapS=fx[v.wrapS]||nr,d.wrapT=fx[v.wrapT]||nr,r.associations.set(d,{type:"textures",index:e}),d}).catch(function(){return console.error("THREE.GLTFLoader: Couldn't load texture",f),null});return this.textureCache[u]=m,m}assignTexture(e,t,i){const r=this;return this.getDependency("texture",i.index).then(function(s){if(i.texCoord!==void 0&&i.texCoord!=0&&!(t==="aoMap"&&i.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[tt.KHR_TEXTURE_TRANSFORM]){const o=i.extensions!==void 0?i.extensions[tt.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=r.associations.get(s);s=r.extensions[tt.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),r.associations.set(s,l)}}e[t]=s})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent!==void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0,l=Object.keys(t.morphAttributes).length>0,u=l&&t.morphAttributes.normal!==void 0;if(e.isPoints){const c="PointsMaterial:"+i.uuid;let f=this.cache.get(c);f||(f=new mr,It.prototype.copy.call(f,i),f.color.copy(i.color),f.map=i.map,f.sizeAttenuation=!1,this.cache.add(c,f)),i=f}else if(e.isLine){const c="LineBasicMaterial:"+i.uuid;let f=this.cache.get(c);f||(f=new Ft,It.prototype.copy.call(f,i),f.color.copy(i.color),this.cache.add(c,f)),i=f}if(r||s||o||l){let c="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),r&&(c+="vertex-tangents:"),s&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");let f=this.cache.get(c);f||(f=i.clone(),s&&(f.vertexColors=!0),o&&(f.flatShading=!0),l&&(f.morphTargets=!0),u&&(f.morphNormals=!0),r&&(f.vertexTangents=!0,f.normalScale&&(f.normalScale.y*=-1),f.clearcoatNormalScale&&(f.clearcoatNormalScale.y*=-1)),this.cache.add(c,f),this.associations.set(f,this.associations.get(i))),i=f}i.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=i}getMaterialType(){return Kr}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const l={},u=s.extensions||{},c=[];if(u[tt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const h=r[tt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=h.getMaterialType(),c.push(h.extendParams(l,s,t))}else if(u[tt.KHR_MATERIALS_UNLIT]){const h=r[tt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(l,s,t))}else{const h=s.pbrMetallicRoughness||{};if(l.color=new Ae(1,1,1),l.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;l.color.fromArray(p),l.opacity=p[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(l,"map",h.baseColorTexture)),l.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,l.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(l,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(l,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,l)})))}s.doubleSided===!0&&(l.side=er);const f=s.alphaMode||Tf.OPAQUE;return f===Tf.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,f===Tf.MASK&&(l.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==dn&&(c.push(t.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new Se(1,-1),s.normalTexture.scale!==void 0&&l.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),s.occlusionTexture!==void 0&&o!==dn&&(c.push(t.assignTexture(l,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==dn&&(l.emissive=new Ae().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==dn&&c.push(t.assignTexture(l,"emissiveMap",s.emissiveTexture)),Promise.all(c).then(function(){let h;return o===Sf?h=r[tt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):h=new o(l),s.name&&(h.name=s.name),h.map&&(h.map.encoding=zr),h.emissiveMap&&(h.emissiveMap.encoding=zr),ls(h,s),t.associations.set(h,{type:"materials",index:e}),s.extensions&&Ua(r,h,s),h})}createUniqueName(e){const t=et.sanitizeNodeName(e||"");let i=t;for(let r=1;this.nodeNamesUsed[i];++r)i=t+"_"+r;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(l){return i[tt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(u){return vx(u,l,t)})}const o=[];for(let l=0,u=e.length;l<u;l++){const c=e[l],f=jB(c),h=r[f];if(h)o.push(h.promise);else{let p;c.extensions&&c.extensions[tt.KHR_DRACO_MESH_COMPRESSION]?p=s(c):p=vx(new ke,c,t),r[f]={primitive:c,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,l=[];for(let u=0,c=o.length;u<c;u++){const f=o[u].material===void 0?GB(this.cache):this.getDependency("material",o[u].material);l.push(f)}return l.push(t.loadGeometries(o)),Promise.all(l).then(function(u){const c=u.slice(0,u.length-1),f=u[u.length-1],h=[];for(let y=0,m=f.length;y<m;y++){const d=f[y],b=o[y];let v;const g=c[y];if(b.mode===Di.TRIANGLES||b.mode===Di.TRIANGLE_STRIP||b.mode===Di.TRIANGLE_FAN||b.mode===void 0)v=s.isSkinnedMesh===!0?new wa(d,g):new Et(d,g),v.isSkinnedMesh===!0&&!v.geometry.attributes.skinWeight.normalized&&v.normalizeSkinWeights(),b.mode===Di.TRIANGLE_STRIP?v.geometry=bx(v.geometry,My):b.mode===Di.TRIANGLE_FAN&&(v.geometry=bx(v.geometry,Fd));else if(b.mode===Di.LINES)v=new on(d,g);else if(b.mode===Di.LINE_STRIP)v=new ei(d,g);else if(b.mode===Di.LINE_LOOP)v=new Mc(d,g);else if(b.mode===Di.POINTS)v=new oo(d,g);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(v.geometry.morphAttributes).length>0&&WB(v,s),v.name=t.createUniqueName(s.name||"mesh_"+e),ls(v,s),b.extensions&&Ua(r,v,b),t.assignFinalMaterial(v),h.push(v)}if(h.length===1)return h[0];const p=new Qn;for(let y=0,m=h.length;y<m;y++)p.add(h[y]);return p})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Bt(Wd.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new So(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),ls(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then(function(r){return i.inverseBindMatrices=r,i})}loadAnimation(e){const i=this.json.animations[e],r=[],s=[],o=[],l=[],u=[];for(let c=0,f=i.channels.length;c<f;c++){const h=i.channels[c],p=i.samplers[h.sampler],y=h.target,m=y.node!==void 0?y.node:y.id,d=i.parameters!==void 0?i.parameters[p.input]:p.input,b=i.parameters!==void 0?i.parameters[p.output]:p.output;r.push(this.getDependency("node",m)),s.push(this.getDependency("accessor",d)),o.push(this.getDependency("accessor",b)),l.push(p),u.push(y)}return Promise.all([Promise.all(r),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(u)]).then(function(c){const f=c[0],h=c[1],p=c[2],y=c[3],m=c[4],d=[];for(let v=0,g=f.length;v<g;v++){const w=f[v],S=h[v],E=p[v],M=y[v],_=m[v];if(w===void 0)continue;w.updateMatrix(),w.matrixAutoUpdate=!0;let C;switch(wr[_.path]){case wr.weights:C=xo;break;case wr.rotation:C=Qr;break;case wr.position:case wr.scale:default:C=wo;break}const I=w.name?w.name:w.uuid,T=M.interpolation!==void 0?UB[M.interpolation]:Fr,P=[];wr[_.path]===wr.weights?w.traverse(function(R){R.isMesh===!0&&R.morphTargetInfluences&&P.push(R.name?R.name:R.uuid)}):P.push(I);let A=E.array;if(E.normalized){const R=Ef(A.constructor),L=new Float32Array(A.length);for(let N=0,x=A.length;N<x;N++)L[N]=A[N]*R;A=L}for(let R=0,L=P.length;R<L;R++){const N=new C(P[R]+"."+wr[_.path],S.array,A,T);M.interpolation==="CUBICSPLINE"&&(N.createInterpolant=function(O){return new Ao(this.times,this.values,this.getValueSize()/3,O)},N.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),d.push(N)}}const b=i.name?i.name:"animation_"+e;return new Mo(b,void 0,d)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(l){if(l.isMesh)for(let u=0,c=r.weights.length;u<c;u++)l.morphTargetInfluences[u]=r.weights[u]}),o})}loadNode(e){const t=this.json,i=this.extensions,r=this,s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"";return function(){const l=[],u=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return u&&l.push(u),s.camera!==void 0&&l.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){l.push(c)}),Promise.all(l)}().then(function(l){let u;if(s.isBone===!0?u=new Ma:l.length>1?u=new Qn:l.length===1?u=l[0]:u=new Ze,u!==l[0])for(let c=0,f=l.length;c<f;c++)u.add(l[c]);if(s.name&&(u.userData.name=s.name,u.name=o),ls(u,s),s.extensions&&Ua(i,u,s),s.matrix!==void 0){const c=new Ne;c.fromArray(s.matrix),u.applyMatrix4(c)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return r.associations.set(u,{type:"nodes",index:e}),u})}loadScene(e){const t=this.json,i=this.extensions,r=this.json.scenes[e],s=this,o=new Qn;r.name&&(o.name=s.createUniqueName(r.name)),ls(o,r),r.extensions&&Ua(i,o,r);const l=r.nodes||[],u=[];for(let c=0,f=l.length;c<f;c++)u.push(yx(l[c],o,t,s));return Promise.all(u).then(function(){return o})}}function yx(n,e,t,i){const r=t.nodes[n];return i.getDependency("node",n).then(function(s){if(r.skin===void 0)return s;let o;return i.getDependency("skin",r.skin).then(function(l){o=l;const u=[];for(let c=0,f=o.joints.length;c<f;c++)u.push(i.getDependency("node",o.joints[c]));return Promise.all(u)}).then(function(l){return s.traverse(function(u){if(!u.isMesh)return;const c=[],f=[];for(let h=0,p=l.length;h<p;h++){const y=l[h];if(y){c.push(y);const m=new Ne;o.inverseBindMatrices!==void 0&&m.fromArray(o.inverseBindMatrices.array,h*16),f.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',o.joints[h])}u.bind(new Sa(c,f),u.matrixWorld)}),s})}).then(function(s){e.add(s);const o=[];if(r.children){const l=r.children;for(let u=0,c=l.length;u<c;u++){const f=l[u];o.push(yx(f,s,t,i))}}return Promise.all(o)})}function ZB(n,e,t){const i=e.attributes,r=new un;if(i.POSITION!==void 0){const l=t.json.accessors[i.POSITION],u=l.min,c=l.max;if(u!==void 0&&c!==void 0){if(r.set(new q(u[0],u[1],u[2]),new q(c[0],c[1],c[2])),l.normalized){const f=Ef(za[l.componentType]);r.min.multiplyScalar(f),r.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const l=new q,u=new q;for(let c=0,f=s.length;c<f;c++){const h=s[c];if(h.POSITION!==void 0){const p=t.json.accessors[h.POSITION],y=p.min,m=p.max;if(y!==void 0&&m!==void 0){if(u.setX(Math.max(Math.abs(y[0]),Math.abs(m[0]))),u.setY(Math.max(Math.abs(y[1]),Math.abs(m[1]))),u.setZ(Math.max(Math.abs(y[2]),Math.abs(m[2]))),p.normalized){const d=Ef(za[p.componentType]);u.multiplyScalar(d)}l.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(l)}n.boundingBox=r;const o=new Ei;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function vx(n,e,t){const i=e.attributes,r=[];function s(o,l){return t.getDependency("accessor",o).then(function(u){n.setAttribute(l,u)})}for(const o in i){const l=_f[o]||o.toLowerCase();l in n.attributes||r.push(s(i[o],l))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(l){n.setIndex(l)});r.push(o)}return ls(n,e),ZB(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?HB(n,e.targets,t):n})}function bx(n,e){let t=n.getIndex();if(t===null){const o=[],l=n.getAttribute("position");if(l!==void 0){for(let u=0;u<l.count;u++)o.push(u);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(e===Fd)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s}const XB=Rl(Object.freeze(Object.defineProperty({__proto__:null,GLTFLoader:CB},Symbol.toStringTag,{value:"Module"})));var Cf={exports:{}},xx;function YB(){return xx||(xx=1,function(n){function e(c){var f={};function h(y){if(f[y])return f[y].exports;var m=f[y]={i:y,l:!1,exports:{}};return c[y].call(m.exports,m,m.exports,h),m.l=!0,m.exports}h.m=c,h.c=f,h.i=function(y){return y},h.d=function(y,m,d){h.o(y,m)||Object.defineProperty(y,m,{configurable:!1,enumerable:!0,get:d})},h.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},h.n=function(y){var m=y&&y.__esModule?function(){return y.default}:function(){return y};return h.d(m,"a",m),m},h.o=function(y,m){return Object.prototype.hasOwnProperty.call(y,m)},h.p="/",h.oe=function(y){throw console.error(y),y};var p=h(h.s=ENTRY_MODULE);return p.default||p}var t="[\\.|\\-|\\+|\\w|/|@]+",i="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+t+").*?\\)";function r(c){return(c+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(c){return!isNaN(1*c)}function o(c,f,h){var p={};p[h]=[];var y=f.toString(),m=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!m)return p;for(var d=m[1],b=new RegExp("(\\\\n|\\W)"+r(d)+i,"g"),v;v=b.exec(y);)v[3]!=="dll-reference"&&p[h].push(v[3]);for(b=new RegExp("\\("+r(d)+'\\("(dll-reference\\s('+t+'))"\\)\\)'+i,"g");v=b.exec(y);)c[v[2]]||(p[h].push(v[1]),c[v[2]]=__webpack_require__(v[1]).m),p[v[2]]=p[v[2]]||[],p[v[2]].push(v[4]);for(var g=Object.keys(p),w=0;w<g.length;w++)for(var S=0;S<p[g[w]].length;S++)s(p[g[w]][S])&&(p[g[w]][S]=1*p[g[w]][S]);return p}function l(c){var f=Object.keys(c);return f.reduce(function(h,p){return h||c[p].length>0},!1)}function u(c,f){for(var h={main:[f]},p={main:[]},y={main:{}};l(h);)for(var m=Object.keys(h),d=0;d<m.length;d++){var b=m[d],v=h[b],g=v.pop();if(y[b]=y[b]||{},!(y[b][g]||!c[b][g])){y[b][g]=!0,p[b]=p[b]||[],p[b].push(g);for(var w=o(c,c[b][g],b),S=Object.keys(w),E=0;E<S.length;E++)h[S[E]]=h[S[E]]||[],h[S[E]]=h[S[E]].concat(w[S[E]])}}return p}n.exports=function(c,f){f=f||{};var h={main:__webpack_modules__},p=f.all?{main:Object.keys(h.main)}:u(h,c),y="";Object.keys(p).filter(function(g){return g!=="main"}).forEach(function(g){for(var w=0;p[g][w];)w++;p[g].push(w),h[g][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+g+" = ("+e.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+p[g].map(function(S){return""+JSON.stringify(S)+": "+h[g][S].toString()}).join(",")+`});
3182
- `}),y=y+"new (("+e.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+p.main.map(function(g){return""+JSON.stringify(g)+": "+h.main[g].toString()}).join(",")+"}))(self);";var m=new window.Blob([y],{type:"text/javascript"});if(f.bare)return m;var d=window.URL||window.webkitURL||window.mozURL||window.msURL,b=d.createObjectURL(m),v=new window.Worker(b);return v.objectURL=b,v}}(Cf)),Cf.exports}function JB(n){var e=this.constructor;return this.then(function(t){return e.resolve(n()).then(function(){return t})},function(t){return e.resolve(n()).then(function(){return e.reject(t)})})}function KB(n){var e=this;return new e(function(t,i){if(!(n&&typeof n.length<"u"))return i(new TypeError(typeof n+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(n);if(r.length===0)return t([]);var s=r.length;function o(u,c){if(c&&(typeof c=="object"||typeof c=="function")){var f=c.then;if(typeof f=="function"){f.call(c,function(h){o(u,h)},function(h){r[u]={status:"rejected",reason:h},--s===0&&t(r)});return}}r[u]={status:"fulfilled",value:c},--s===0&&t(r)}for(var l=0;l<r.length;l++)o(l,r[l])})}function wx(n,e){this.name="AggregateError",this.errors=n,this.message=e||""}wx.prototype=Error.prototype;function qB(n){var e=this;return new e(function(t,i){if(!(n&&typeof n.length<"u"))return i(new TypeError("Promise.any accepts an array"));var r=Array.prototype.slice.call(n);if(r.length===0)return i();for(var s=[],o=0;o<r.length;o++)try{e.resolve(r[o]).then(t).catch(function(l){s.push(l),s.length===r.length&&i(new wx(s,"All promises were rejected"))})}catch(l){i(l)}})}var QB=setTimeout;function Mx(n){return!!(n&&typeof n.length<"u")}function eF(){}function tF(n,e){return function(){n.apply(e,arguments)}}function pt(n){if(!(this instanceof pt))throw new TypeError("Promises must be constructed via new");if(typeof n!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],_x(n,this)}function Sx(n,e){for(;n._state===3;)n=n._value;if(n._state===0){n._deferreds.push(e);return}n._handled=!0,pt._immediateFn(function(){var t=n._state===1?e.onFulfilled:e.onRejected;if(t===null){(n._state===1?Af:Ga)(e.promise,n._value);return}var i;try{i=t(n._value)}catch(r){Ga(e.promise,r);return}Af(e.promise,i)})}function Af(n,e){try{if(e===n)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof pt){n._state=3,n._value=e,Rf(n);return}else if(typeof t=="function"){_x(tF(t,e),n);return}}n._state=1,n._value=e,Rf(n)}catch(i){Ga(n,i)}}function Ga(n,e){n._state=2,n._value=e,Rf(n)}function Rf(n){n._state===2&&n._deferreds.length===0&&pt._immediateFn(function(){n._handled||pt._unhandledRejectionFn(n._value)});for(var e=0,t=n._deferreds.length;e<t;e++)Sx(n,n._deferreds[e]);n._deferreds=null}function nF(n,e,t){this.onFulfilled=typeof n=="function"?n:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function _x(n,e){var t=!1;try{n(function(i){t||(t=!0,Af(e,i))},function(i){t||(t=!0,Ga(e,i))})}catch(i){if(t)return;t=!0,Ga(e,i)}}pt.prototype.catch=function(n){return this.then(null,n)},pt.prototype.then=function(n,e){var t=new this.constructor(eF);return Sx(this,new nF(n,e,t)),t},pt.prototype.finally=JB,pt.all=function(n){return new pt(function(e,t){if(!Mx(n))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(n);if(i.length===0)return e([]);var r=i.length;function s(l,u){try{if(u&&(typeof u=="object"||typeof u=="function")){var c=u.then;if(typeof c=="function"){c.call(u,function(f){s(l,f)},t);return}}i[l]=u,--r===0&&e(i)}catch(f){t(f)}}for(var o=0;o<i.length;o++)s(o,i[o])})},pt.any=qB,pt.allSettled=KB,pt.resolve=function(n){return n&&typeof n=="object"&&n.constructor===pt?n:new pt(function(e){e(n)})},pt.reject=function(n){return new pt(function(e,t){t(n)})},pt.race=function(n){return new pt(function(e,t){if(!Mx(n))return t(new TypeError("Promise.race accepts an array"));for(var i=0,r=n.length;i<r;i++)pt.resolve(n[i]).then(e,t)})},pt._immediateFn=typeof setImmediate=="function"&&function(n){setImmediate(n)}||function(n){QB(n,0)},pt._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};const iF=Rl(Object.freeze(Object.defineProperty({__proto__:null,default:pt},Symbol.toStringTag,{value:"Module"})));(function(n,e){(function(i,r){n.exports=r()})(Ki,()=>(()=>{var t=[(o,l,u)=>{u(1);var c=u(2),f=c.version,h=function(){this.Revision=f,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=u(3).Geometry,this.Glyph=u(16).Glyph,this.Glyphset=u(18).Glyphset,this.Pointset=u(22).Pointset,this.Label=u(17).Label,this.Lines=u(24).Lines,this.TextureArray=u(25).TextureArray,this.TextureSlides=u(27).TextureSlides,this.Renderer=u(30).Renderer,this.Scene=u(32).Scene,this.GeometryCSG=u(50).GeometryCSG,this.GlyphsetCSG=u(56).GlyphsetCSG,this.Viewport=u(43).Viewport,this.CameraControls=u(43).CameraControls,this.SmoothCameraTransition=u(43).SmoothCameraTransition,this.RayCaster=u(43).RayCaster,this.CameraAutoTumble=u(43).CameraAutoTumble,this.StereoEffect=u(43).StereoEffect,this.loadExternalFile=u(5).loadExternalFile,this.loadExternalFiles=u(5).loadExternalFiles,this.THREE=u(4)};o.exports=new h},o=>{o.exports=JR()},o=>{o.exports=JSON.parse('{"name":"zincjs","version":"1.12.0","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}')},function(o,l,u){var c=u(4),f=u(5).toBufferGeometry,h=(y,m,d)=>{var b=f(y,d),v=!1;1>d.opacity&&(v=!0);var g;if(b._video===void 0){var w=d.localTimeEnabled||d.localMorphColour;m?(g=m,g.morphTargets=w,g.morphNormals=d.localTimeEnabled):b instanceof c.BufferGeometry&&b.attributes.color===void 0?g=new c.MeshPhongMaterial({color:d.colour,morphTargets:w,morphNormals:d.localTimeEnabled,transparent:v,opacity:d.opacity,side:c.DoubleSide}):g=new c.MeshPhongMaterial({color:d.colour,morphTargets:w,morphNormals:d.localTimeEnabled,vertexColors:c.VertexColors,transparent:v,opacity:d.opacity,side:c.DoubleSide}),d.localMorphColour&&b.morphAttributes.color&&(g.onBeforeCompile=u(9).augmentMorphColor())}else{var S=b._video.createCanvasVideoTexture();g=new c.MeshBasicMaterial({morphTargets:d.localTimeEnabled,color:new c.Color(1,1,1),transparent:v,opacity:d.opacity,map:S,side:c.DoubleSide}),this.videoHandler=b._video}return new c.Mesh(b,g)},p=function(){u(10).ZincObject.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(y,m,d)=>{if(!(this.morph&&this.morph.geometry&&y!=null)){var b=h(y,m,d);this.setMesh(b,d.localTimeEnabled,d.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var y=this.geometry.boundingBox.max,m=this.geometry.boundingBox.min,d=new c.Vector2(0-m.x,0-m.y),b=new c.Vector2(y.x-m.x,y.y-m.y);this.geometry.faceVertexUvs[0]=[];for(var v=0;v<this.geometry.faces.length;v++){var g=this.geometry.vertices[this.geometry.faces[v].a],w=this.geometry.vertices[this.geometry.faces[v].b],S=this.geometry.vertices[this.geometry.faces[v].c];geometry.faceVertexUvs[0].push([new c.Vector2((g.x+d.x)/b.x,(g.y+d.y)/b.y),new c.Vector2((w.x+d.x)/b.x,(w.y+d.y)/b.y),new c.Vector2((S.x+d.x)/b.x,(S.y+d.y)/b.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=y=>{this.morph.material.wireframe=y},this.editVertices=function(y,m){if(y&&y.length){var d=this.getMorph(),b=d.geometry.getAttribute("position");if(!d||0>m)return;var v=3*m;y.forEach(g=>{b.array[v++]=g[0],b.array[v++]=g[1],b.array[v++]=g[2]}),b.needsUpdate=!0,d.geometry.computeBoundingBox(),d.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};p.prototype=Object.create(u(10).ZincObject.prototype),l.Geometry=p},o=>{o.exports=cB},(o,l,u)=>{function c(C){throw new TypeError('"'+C+'" is read-only')}var f=u(4),h=u(6).Geometry,p=u(7).default;function y(C){var I=C,T=u(0).modelPrefix;return T&&(T[T.length-1]!="/"&&c("prefix"),/^(?:[a-z]+:)?\/\//i.test(C)||(I=T+C)),I}function m(C,I){var T=(A,R)=>{try{var L=new URL(A,R).href;if(A&&2>A.split("?").length){var N=R.split("?");N.length===2&&(L=L+"?"+N[1])}return L}catch{console.error("There is an issue creating the url link with: ".concat(A,"."))}};if(!Array.isArray(C))return T(C,I);var P=[];return C.forEach(A=>{P.push(T(A,I))}),P}function d(C,I,T,P,A){var R=C.morphTargetInfluences,L=void 0;C.geometry&&(L=C.geometry.morphAttributes);var N=!1;if(R&&L&&L.position){P.set(0,0,0),A.set(0,0,0);for(var x=0;x<R.length;x++)0<R[x]&&(N=!0,T.setFromArray(L.position[x].array),P.add(T.min.multiplyScalar(R[x])),A.add(T.max.multiplyScalar(R[x])));N&&I.set(P,A)}N||I.setFromBufferAttribute(C.geometry.attributes.position),C.updateWorldMatrix(!0,!0),I.applyMatrix4(C.matrixWorld)}function b(C,I,T,P){var A=new XMLHttpRequest;A.open("GET",y(C),!0),A.onreadystatechange=()=>{A.readyState==4&&(A.status==200?T(A.responseText,I):P(C))},A.send(null)}function v(C,I,T){function P(x,O){L[O]=x,R++,R==A&&I(L)}for(var A=C.length,R=0,L=[],N=0;N<A;N++)b(C[N],N,P,T)}l.getColorsRGB=(C,I)=>{var T=Math.floor(I/3),P=I%3,A=0;P==0?A=C[T].r:P==1?A=C[T].g:P==2&&(A=C[T].b);var R=new f.Color(A);return[R.r,R.g,R.b]},l.updateMorphColorAttribute=function(C,I){if(I&&C&&C.morphAttributes&&C.morphAttributes.color){var T=C.morphAttributes.color,P=I.morphTargetInfluences,A=P.length;C.deleteAttribute("morphColor0"),C.deleteAttribute("morphColor1");for(var R=0,L=[],N=0;1>R||N<A;N++)0<P[N]&&(R++,L.push([N,P[N]]));L.length==2?(C.setAttribute("morphColor0",T[L[0][0]]),C.setAttribute("morphColor1",T[L[1][0]])):L.length==1&&(C.setAttribute("morphColor0",T[L[0][0]]),C.setAttribute("morphColor1",T[L[0][0]]))}},l.toBufferGeometry=(C,I)=>{var T;return C instanceof h?(I.localTimeEnabled&&!C.morphNormalsReady&&(C.morphNormals==null||C.morphNormals.length==0)&&C.computeMorphNormals(),T=C.toIndexedBufferGeometry(),I.localMorphColour&&g(C,T)):C instanceof f.BufferGeometry&&(T=C.clone()),T.colorsNeedUpdate=!0,T.computeBoundingBox(),T.computeBoundingSphere(),C._video&&(T._video=C._video),T},l.copyMorphColorsToBufferGeometry=(C,I)=>{if(C&&C.morphColors&&0<C.morphColors.length){for(var T=[],P=C.morphColors,A=u(5).getColorsRGB,R=0,L=P.length;R<L;R++){for(var N=P[R],x=[],O=0;O<C.faces.length;O++){var B=C.faces[O],D=A(N.colors,B.a);x.push(D[0],D[1],D[2]),D=A(N.colors,B.b),x.push(D[0],D[1],D[2]),D=A(N.colors,B.c),x.push(D[0],D[1],D[2])}var z=new f.Float32BufferAttribute(3*(3*C.faces.length),3);z.name=N.name,T.push(z.copyArray(x))}I.morphAttributes.color=T}};var g=(C,I)=>{if(C&&C.morphColors&&0<C.morphColors.length){for(var T=[],P=C.morphColors,A=u(5).getColorsRGB,R=0,L=P.length;R<L;R++){for(var N,x=P[R],O=[],B=0;B<3*x.colors.length;B++)N=A(x.colors,B),O.push(N[0],N[1],N[2]);var D=new f.Float32BufferAttribute(O,3);D.name=x.name,T.push(D)}I.morphAttributes.color=T}};l.mergeVertices=function(C){var I=1<arguments.length&&arguments[1]!==void 0?arguments[1]:1e-4;I=Math.max(I,Number.EPSILON);for(var T,P={},A=C.getIndex(),R=C.getAttribute("position"),L=A?A.count:R.count,N=0,x=Object.keys(C.attributes),O={},B={},fe=[],D=["getX","getY","getZ","getW"],z=0,U=x.length;z<U;z++){T=x[z],O[T]=[];var H=C.morphAttributes[T];H&&(B[T]=Array(H.length).fill().map(()=>[]))}for(var Y=Math.log10(1/I),ie=Math.pow(10,Y),z=0;z<L;z++){for(var ae=A?A.getX(z):z,ee="",oe=0,U=x.length;oe<U;oe++)for(var T=x[oe],j=C.getAttribute(T),K=j.itemSize,$=0;$<K;$++)ee+="".concat(~~(j[D[$]](ae)*ie),",");if(ee in P)fe.push(P[ee]);else{for(var oe=0,U=x.length;oe<U;oe++)for(var re,T=x[oe],j=C.getAttribute(T),H=C.morphAttributes[T],K=j.itemSize,G=O[T],W=B[T],$=0;$<K;$++)if(re=D[$],G.push(j[re](ae)),H)for(var F=0,X=H.length;F<X;F++)W[F].push(H[F][re](ae));P[ee]=N,fe.push(N),N++}}for(var J=C.clone(),z=0,U=x.length;z<U;z++){var j,T=x[z],V=C.getAttribute(T),k=new V.array.constructor(O[T]);if(V.isInterleavedBufferAttribute?j=new f.BufferAttribute(k,V.itemSize,V.itemSize):(j=C.getAttribute(T).clone(),j.setArray(k)),J.setAttribute(T,j),T in B)for(var te,oe=0;oe<B[T].length;oe++)te=C.morphAttributes[T][oe].clone(),te.setArray(new te.array.constructor(B[T][oe])),J.morphAttributes[T][oe]=te}var se=Uint8Array;fe.length>=Math.pow(2,8)&&(se=Uint16Array),fe.length>=Math.pow(2,16)&&(se=Uint32Array);var le=new se(fe),fe=null;return A===null?fe=new f.BufferAttribute(le,1):(fe=C.getIndex().clone(),fe.setArray(le)),J.setIndex(fe),J};function w(C){if(C.isMeshPhongMaterial){var I=new f.MeshToonMaterial({color:C.color.clone(),morphTargets:C.morphTargets,morphNormals:C.morphNormals,vertexColors:C.vertexColors,transparent:C.transparent,opacity:C.opacity,side:C.side});return C.map&&(I.map=C.map),I}return C}function S(C,I){if(I&&C>=I.length){var T=new f.BufferGeometry,P=new Float32Array(3*C),A=0;return I.forEach(R=>{P[A++]=R[0],P[A++]=R[1],P[A++]=R[2]}),T.setAttribute("position",new f.BufferAttribute(P,3)),T.setDrawRange(0,I.length),T}}function E(){var C=new Image;C.src=u(8);var I=new f.Texture;return I.image=C,I.needsUpdate=!0,I}function M(C,I,T,P,A,R){var L=new p(C,I,T,P,A,R);return L.fontFace=P,L.fontSize=A,L.fontWeight=R,L.material.map.generateMipmaps=!1,L.material.map.anisotropy=4,L.material.sizeAttenuation=!1,L.material.alphaTest=.5,L.material.transparent=!0,L.material.depthWrite=!1,L.material.depthTest=!1,L.center.set(.5,-1.2),L.renderOrder=1e4,L}function _(C,I,T){if(T){var P=C||"",A=I||"",R=T.lastIndexOf("/");if(-1<R){var L=void 0,N=void 0;if(L=T.substring(0,R),N=T.substring(R+1),(L==="*"||L==="**"||L.toLowerCase()===P.toLowerCase())&&(N==="*"||N==="**"||N.toLowerCase()===A.toLowerCase()))return!0}else if(P.toLowerCase()===T.toLowerCase()||A.toLowerCase()===T.toLowerCase())return!0}return!1}l.getBoundingBox=d,l.createNewURL=m,l.createBufferGeometry=S,l.getCircularTexture=E,l.resolveURL=y,l.loadExternalFile=b,l.loadExternalFiles=v,l.PhongToToon=w,l.createNewSpriteText=M,l.isRegionGroup=_},(o,l,u)=>{u.r(l),u.d(l,{Face3:()=>b,Geometry:()=>m});var c=u(4),f=new c.Matrix4,h=new c.Object3D,p=new c.Vector3,y=new c.Vector3;function m(){this.uuid=c.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}m.prototype=Object.assign(Object.create(c.EventDispatcher.prototype),{constructor:m,isGeometry:!0,applyMatrix4:function(g){for(var w,S=new c.Matrix3().getNormalMatrix(g),E=0,M=this.vertices.length;E<M;E++)w=this.vertices[E],w.applyMatrix4(g);for(var _,C=0,I=this.faces.length;C<I;C++){_=this.faces[C],_.normal.applyMatrix3(S).normalize();for(var T=0,P=_.vertexNormals.length;T<P;T++)_.vertexNormals[T].applyMatrix3(S).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(g){return f.makeRotationX(g),this.applyMatrix4(f),this},rotateY:function(g){return f.makeRotationY(g),this.applyMatrix4(f),this},rotateZ:function(g){return f.makeRotationZ(g),this.applyMatrix4(f),this},translate:function(g,w,S){return f.makeTranslation(g,w,S),this.applyMatrix4(f),this},scale:function(g,w,S){return f.makeScale(g,w,S),this.applyMatrix4(f),this},lookAt:function(g){return h.lookAt(g),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(g){function w(H,Y,ie,ae){var ee=I===void 0?[]:[S.colors[H].clone(),S.colors[Y].clone(),S.colors[ie].clone()],oe=C===void 0?[]:[new c.Vector3().fromBufferAttribute(C,H),new c.Vector3().fromBufferAttribute(C,Y),new c.Vector3().fromBufferAttribute(C,ie)],j=new b(H,Y,ie,oe,ee,ae);S.faces.push(j),T!==void 0&&S.faceVertexUvs[0].push([new c.Vector2().fromBufferAttribute(T,H),new c.Vector2().fromBufferAttribute(T,Y),new c.Vector2().fromBufferAttribute(T,ie)]),P!==void 0&&S.faceVertexUvs[1].push([new c.Vector2().fromBufferAttribute(P,H),new c.Vector2().fromBufferAttribute(P,Y),new c.Vector2().fromBufferAttribute(P,ie)])}var S=this,E=g.index===null?void 0:g.index,M=g.attributes;if(M.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var _=M.position,C=M.normal,I=M.color,T=M.uv,P=M.uv2;P!==void 0&&(this.faceVertexUvs[1]=[]);for(var A=0;A<_.count;A++)S.vertices.push(new c.Vector3().fromBufferAttribute(_,A)),I!==void 0&&S.colors.push(new c.Color().fromBufferAttribute(I,A));var R=g.groups;if(0<R.length)for(var L=0;L<R.length;L++)for(var N=R[L],x=N.start,O=N.count,B=x,D=x+O;B<D;B+=3)E===void 0?w(B,B+1,B+2,N.materialIndex):w(E.getX(B),E.getX(B+1),E.getX(B+2),N.materialIndex);else if(E!==void 0)for(var z=0;z<E.count;z+=3)w(E.getX(z),E.getX(z+1),E.getX(z+2));else for(var U=0;U<_.count;U+=3)w(U,U+1,U+2);return this.computeFaceNormals(),g.boundingBox!==null&&(this.boundingBox=g.boundingBox.clone()),g.boundingSphere!==null&&(this.boundingSphere=g.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(p).negate(),this.translate(p.x,p.y,p.z),this},normalize:function(){this.computeBoundingSphere();var g=this.boundingSphere.center,w=this.boundingSphere.radius,S=w===0?1:1/w,E=new c.Matrix4;return E.set(S,0,0,-S*g.x,0,S,0,-S*g.y,0,0,S,-S*g.z,0,0,0,1),this.applyMatrix4(E),this},computeFaceNormals:function(){for(var g=new c.Vector3,w=new c.Vector3,S=0,E=this.faces.length;S<E;S++){var M=this.faces[S],_=this.vertices[M.a],C=this.vertices[M.b],I=this.vertices[M.c];g.subVectors(I,C),w.subVectors(_,C),g.cross(w),g.normalize(),M.normal.copy(g)}},computeVertexNormals:function(){for(var g=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],w=Array(this.vertices.length),S=0,E=this.vertices.length;S<E;S++)w[S]=new c.Vector3;if(g)for(var M=new c.Vector3,_=new c.Vector3,C=0,I=this.faces.length;C<I;C++){var T=this.faces[C],P=this.vertices[T.a],A=this.vertices[T.b],R=this.vertices[T.c];M.subVectors(R,A),_.subVectors(P,A),M.cross(_),w[T.a].add(M),w[T.b].add(M),w[T.c].add(M)}else{this.computeFaceNormals();for(var L,N=0,x=this.faces.length;N<x;N++)L=this.faces[N],w[L.a].add(L.normal),w[L.b].add(L.normal),w[L.c].add(L.normal)}for(var O=0,B=this.vertices.length;O<B;O++)w[O].normalize();for(var D=0,z=this.faces.length;D<z;D++){var U=this.faces[D],H=U.vertexNormals;H.length===3?(H[0].copy(w[U.a]),H[1].copy(w[U.b]),H[2].copy(w[U.c])):(H[0]=w[U.a].clone(),H[1]=w[U.b].clone(),H[2]=w[U.c].clone())}return 0<this.faces.length&&(this.normalsNeedUpdate=!0),w},computeFlatVertexNormals:function(){this.computeFaceNormals();for(var g=0,w=this.faces.length;g<w;g++){var S=this.faces[g],E=S.vertexNormals;E.length===3?(E[0].copy(S.normal),E[1].copy(S.normal),E[2].copy(S.normal)):(E[0]=S.normal.clone(),E[1]=S.normal.clone(),E[2]=S.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(var g,w=0,S=this.faces.length;w<S;w++){g=this.faces[w],g.__originalFaceNormal?g.__originalFaceNormal.copy(g.normal):g.__originalFaceNormal=g.normal.clone(),g.__originalVertexNormals||(g.__originalVertexNormals=[]);for(var E=0,M=g.vertexNormals.length;E<M;E++)g.__originalVertexNormals[E]?g.__originalVertexNormals[E].copy(g.vertexNormals[E]):g.__originalVertexNormals[E]=g.vertexNormals[E].clone()}var _=new m;_.faces=this.faces;for(var C=0,I=this.morphTargets.length;C<I;C++){if(!this.morphNormals[C]){this.morphNormals[C]={},this.morphNormals[C].faceNormals=[],this.morphNormals[C].vertexNormals=[];for(var T=this.morphNormals[C].faceNormals,P=this.morphNormals[C].vertexNormals,A=0,R=this.faces.length;A<R;A++){var L=new c.Vector3,N={a:new c.Vector3,b:new c.Vector3,c:new c.Vector3};T.push(L),P.push(N)}}var x=this.morphNormals[C];_.vertices=this.morphTargets[C].vertices,_.computeFaceNormals();var O=_.computeVertexNormals();if(O&&0<O.length){this.morphTargets[C].normals=Array(this.vertices.length);for(var B=0;B<O.length;B++)this.morphTargets[C].normals[B]=O[B].clone()}for(var D=0,z=this.faces.length;D<z;D++){var U=this.faces[D],H=x.faceNormals[D],Y=x.vertexNormals[D];H.copy(U.normal),Y.a.copy(U.vertexNormals[0]),Y.b.copy(U.vertexNormals[1]),Y.c.copy(U.vertexNormals[2])}}for(var ie,ae=0,ee=this.faces.length;ae<ee;ae++)ie=this.faces[ae],ie.normal=ie.__originalFaceNormal,ie.vertexNormals=ie.__originalVertexNormals;this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new c.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(g,w){var S=this.morphTargets.length,E=this.morphTargets,M=g.morphTargets,_=this.morphColors.length,C=this.morphColors,I=g.morphColors;if(0<S&&S==M.length)for(var T=0,P=E.length;T<P;T++){for(var A=E[T],R=M[T],L=0,N=R.vertices.length;L<N;L++){var x=R.vertices[L],O=x.clone();w!==void 0&&O.applyMatrix4(w),A.vertices.push(O)}if(A.normals&&R.normals)for(var B=0;B<R.normals.length;B+=3)y.set(R.normals2[B],R.normals2[B+1],R.normals2[B+2]),w!==void 0&&y.applyMatrix4(w),A.normals.push(y.x,y.y,y.z)}if(0<_&&_==I.length)for(var D=0,z=C.length;D<z;D++)for(var U=C[D],H=I[D],Y=0,ie=H.colors;Y<ie;Y++)U.colors.push(H.colors[Y].clone())},merge:function(g,w){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0;if(!(g&&g.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",g);var E,M=this.vertices.length,_=this.vertices,C=g.vertices,I=g.normals,T=this.faces,P=g.faces,A=this.colors,R=g.colors;w!==void 0&&(E=new c.Matrix3().getNormalMatrix(w));for(var L=0,N=C.length;L<N;L++){var x=C[L],O=x.clone();w!==void 0&&O.applyMatrix4(w),_.push(O)}for(var B=0;B<I.length;B+=3)y.set(I[B],I[B+1],I[B+2]),w!==void 0&&y.applyMatrix4(w),this.normals.push(y.x,y.y,y.z);for(var D=0,z=R.length;D<z;D++)typeof R[D]=="number"?A.push(R[D]):A.push(R[D].clone());for(var U=0,H=P.length;U<H;U++){var Y=P[U],ie=void 0,ae=void 0,ee=Y.vertexNormals,oe=Y.vertexColors,j=new b(Y.a+M,Y.b+M,Y.c+M);j.normal.copy(Y.normal),E!==void 0&&j.normal.applyMatrix3(E).normalize();for(var K=0,$=ee.length;K<$;K++)ie=ee[K].clone(),E!==void 0&&ie.applyMatrix3(E).normalize(),j.vertexNormals.push(ie);j.color.copy(Y.color);for(var re=0,G=oe.length;re<G;re++)ae=oe[re],j.vertexColors.push(ae.clone());j.materialIndex=Y.materialIndex+S,T.push(j)}for(var W,F=0,X=g.faceVertexUvs.length;F<X;F++){W=g.faceVertexUvs[F],this.faceVertexUvs[F]===void 0&&(this.faceVertexUvs[F]=[]);for(var J=0,V=W.length;J<V;J++){for(var k=W[J],te=[],se=0,le=k.length;se<le;se++)te.push(k[se].clone());this.faceVertexUvs[F].push(te)}}this.mergeMorph(g,w)},mergeMesh:function(g){return g&&g.isMesh?(g.matrixAutoUpdate&&g.updateMatrix(),void this.merge(g.geometry,g.matrix)):void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",g)},mergeVertices:function(){for(var g=0<arguments.length&&arguments[0]!==void 0?arguments[0]:4,w={},S=[],E=[],M=Math.pow(10,g),_=0,C=this.vertices.length;_<C;_++){var I=this.vertices[_],T=Math.round(I.x*M)+"_"+Math.round(I.y*M)+"_"+Math.round(I.z*M);w[T]===void 0?(w[T]=_,S.push(this.vertices[_]),E[_]=S.length-1):E[_]=E[w[T]]}for(var P,A=[],R=0,L=this.faces.length;R<L;R++){P=this.faces[R],P.a=E[P.a],P.b=E[P.b],P.c=E[P.c];for(var N=[P.a,P.b,P.c],x=0;3>x;x++)if(N[x]===N[(x+1)%3]){A.push(R);break}}for(var O,B=A.length-1;0<=B;B--){O=A[B],this.faces.splice(O,1);for(var D=0,z=this.faceVertexUvs.length;D<z;D++)this.faceVertexUvs[D].splice(O,1)}var U=this.vertices.length-S.length;return this.vertices=S,U},setFromPoints:function(g){this.vertices=[];for(var w,S=0,E=g.length;S<E;S++)w=g[S],this.vertices.push(new c.Vector3(w.x,w.y,w.z||0));return this},sortFacesByMaterialIndex:function(){for(var g=this.faces,w=g.length,S=0;S<w;S++)g[S]._id=S;g.sort(function(P,A){return P.materialIndex-A.materialIndex});var E,M,_=this.faceVertexUvs[0],C=this.faceVertexUvs[1];_&&_.length===w&&(E=[]),C&&C.length===w&&(M=[]);for(var I,T=0;T<w;T++)I=g[T]._id,E&&E.push(_[I]),M&&M.push(C[I]);E&&(this.faceVertexUvs[0]=E),M&&(this.faceVertexUvs[1]=M)},toJSON:function(){function g(G,W,F){return F?G|1<<W:G&~(1<<W)}function w(G){var W=G.x.toString()+G.y.toString()+G.z.toString();return L[W]===void 0&&(L[W]=R.length/3,R.push(G.x,G.y,G.z)),L[W]}function S(G){var W=G.r.toString()+G.g.toString()+G.b.toString();return x[W]===void 0&&(x[W]=N.length,N.push(G.getHex())),x[W]}function E(G){var W=G.x.toString()+G.y.toString();return B[W]===void 0&&(B[W]=O.length/2,O.push(G.x,G.y)),B[W]}var M={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(M.uuid=this.uuid,M.type=this.type,this.name!==""&&(M.name=this.name),this.parameters!==void 0){var _=this.parameters;for(var C in _)_[C]!==void 0&&(M[C]=_[C]);return M}for(var I,T=[],P=0;P<this.vertices.length;P++)I=this.vertices[P],T.push(I.x,I.y,I.z);for(var A=[],R=[],L={},N=[],x={},O=[],B={},D=0;D<this.faces.length;D++){var z=this.faces[D],U=!0,H=!1,Y=this.faceVertexUvs[0][D]!==void 0,ie=0<z.normal.length(),ae=0<z.vertexNormals.length,ee=z.color.r!==1||z.color.g!==1||z.color.b!==1,oe=0<z.vertexColors.length,j=0;if(j=g(j,0,0),j=g(j,1,U),j=g(j,2,H),j=g(j,3,Y),j=g(j,4,ie),j=g(j,5,ae),j=g(j,6,ee),j=g(j,7,oe),A.push(j),A.push(z.a,z.b,z.c),A.push(z.materialIndex),Y){var K=this.faceVertexUvs[0][D];A.push(E(K[0]),E(K[1]),E(K[2]))}if(ie&&A.push(w(z.normal)),ae){var $=z.vertexNormals;A.push(w($[0]),w($[1]),w($[2]))}if(ee&&A.push(S(z.color)),oe){var re=z.vertexColors;A.push(S(re[0]),S(re[1]),S(re[2]))}}return M.data={},M.data.vertices=T,M.data.normals=R,0<N.length&&(M.data.colors=N),0<O.length&&(M.data.uvs=[O]),M.data.faces=A,M},clone:function(){return new m().copy(this)},copy:function(g){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=g.name;for(var w=g.vertices,S=0,E=w.length;S<E;S++)this.vertices.push(w[S].clone());for(var M=g.colors,_=0,C=M.length;_<C;_++)this.colors.push(M[_].clone());for(var I=g.faces,T=0,P=I.length;T<P;T++)this.faces.push(I[T].clone());for(var A,R=0,L=g.faceVertexUvs.length;R<L;R++){A=g.faceVertexUvs[R],this.faceVertexUvs[R]===void 0&&(this.faceVertexUvs[R]=[]);for(var N=0,x=A.length;N<x;N++){for(var O,B=A[N],D=[],z=0,U=B.length;z<U;z++)O=B[z],D.push(O.clone());this.faceVertexUvs[R].push(D)}}for(var H,Y=g.morphTargets,ie=0,ae=Y.length;ie<ae;ie++){if(H={},H.name=Y[ie].name,Y[ie].vertices!==void 0){H.vertices=[];for(var ee=0,oe=Y[ie].vertices.length;ee<oe;ee++)H.vertices.push(Y[ie].vertices[ee].clone())}if(Y[ie].normals!==void 0){H.normals=[];for(var j=0,K=Y[ie].normals.length;j<K;j++)H.normals.push(Y[ie].normals[j].clone())}this.morphTargets.push(H)}for(var $,re=g.morphNormals,G=0,W=re.length;G<W;G++){if($={},re[G].vertexNormals!==void 0){$.vertexNormals=[];for(var F=0,X=re[G].vertexNormals.length;F<X;F++){var J=re[G].vertexNormals[F],V={};V.a=J.a.clone(),V.b=J.b.clone(),V.c=J.c.clone(),$.vertexNormals.push(V)}}if(re[G].faceNormals!==void 0){$.faceNormals=[];for(var k=0,te=re[G].faceNormals.length;k<te;k++)$.faceNormals.push(re[G].faceNormals[k].clone())}this.morphNormals.push($)}for(var se=g.skinWeights,le=0,fe=se.length;le<fe;le++)this.skinWeights.push(se[le].clone());for(var we=g.skinIndices,be=0,de=we.length;be<de;be++)this.skinIndices.push(we[be].clone());for(var ye=g.lineDistances,ne=0,he=ye.length;ne<he;ne++)this.lineDistances.push(ye[ne]);var me=g.boundingBox;me!==null&&(this.boundingBox=me.clone());var Re=g.boundingSphere;return Re!==null&&(this.boundingSphere=Re.clone()),this.elementsNeedUpdate=g.elementsNeedUpdate,this.verticesNeedUpdate=g.verticesNeedUpdate,this.uvsNeedUpdate=g.uvsNeedUpdate,this.normalsNeedUpdate=g.normalsNeedUpdate,this.colorsNeedUpdate=g.colorsNeedUpdate,this.lineDistancesNeedUpdate=g.lineDistancesNeedUpdate,this.groupsNeedUpdate=g.groupsNeedUpdate,this},computeGroups(){var v,g,w=[],S=void 0,E=this.faces;for(g=0;g<E.length;g++){var M=E[g];M.materialIndex!==S&&(S=M.materialIndex,v!==void 0&&(v.count=3*g-v.start,w.push(v)),v={start:3*g,materialIndex:S})}return v!==void 0&&(v.count=3*g-v.start,w.push(v)),w},toBufferGeometry:function(){var g=new d().fromGeometry(this),w=new c.BufferGeometry,S=new Float32Array(3*g.vertices.length);if(w.setAttribute("position",new c.BufferAttribute(S,3).copyVector3sArray(g.vertices)),0<g.normals.length){var E=new Float32Array(3*g.normals.length);w.setAttribute("normal",new c.BufferAttribute(E,3).copyVector3sArray(g.normals))}if(0<g.colors.length){var M=new Float32Array(3*g.colors.length);w.setAttribute("color",new c.BufferAttribute(M,3).copyColorsArray(g.colors))}if(0<g.uvs.length){var _=new Float32Array(2*g.uvs.length);w.setAttribute("uv",new c.BufferAttribute(_,2).copyVector2sArray(g.uvs))}if(0<g.uvs2.length){var C=new Float32Array(2*g.uvs2.length);w.setAttribute("uv2",new c.BufferAttribute(C,2).copyVector2sArray(g.uvs2))}for(var I in w.groups=g.groups,g.morphTargets){for(var T=[],P=g.morphTargets[I],A=0,R=P.length;A<R;A++){var L=P[A],N=new c.Float32BufferAttribute(3*L.data.length,3);N.name=L.name,T.push(N.copyVector3sArray(L.data))}w.morphAttributes[I]=T}if(0<g.skinIndices.length){var x=new c.Float32BufferAttribute(4*g.skinIndices.length,4);w.setAttribute("skinIndex",x.copyVector4sArray(g.skinIndices))}if(0<g.skinWeights.length){var O=new c.Float32BufferAttribute(4*g.skinWeights.length,4);w.setAttribute("skinWeight",O.copyVector4sArray(g.skinWeights))}return g.boundingSphere!==null&&(w.boundingSphere=g.boundingSphere.clone()),g.boundingBox!==null&&(w.boundingBox=g.boundingBox.clone()),w},toIndexedBufferGeometry:function(){var g=new c.BufferGeometry,w=new Float32Array(3*this.vertices.length);if(g.setAttribute("position",new c.BufferAttribute(w,3).copyVector3sArray(this.vertices)),0<this.normals.length){var S=new Float32Array(this.normals.length),E=new c.BufferAttribute(S,3).copyArray(this.normals);g.setAttribute("normal",E)}if(0<this.uvs.length&&0<this.uvs[0].length){var M=new Float32Array(2*this.uvs[0].length);g.setAttribute("uv",new c.BufferAttribute(M,2).copyArray(this.uvs[0]))}if(1<this.uvs.length&&0<this.uvs[1].length){var _=new Float32Array(2*this.uvs[1].length);g.setAttribute("uv2",new c.BufferAttribute(_,2).copyArray(this.uvs[1]))}if(0<this.colors.length){for(var C=[],I=0;I<this.colors.length;I++)C.push(new c.Color(this.colors[I]));var T=new Float32Array(3*C.length);g.setAttribute("color",new c.BufferAttribute(T,3).copyColorsArray(C))}else{for(var P=new Float32Array(3*this.vertices.length),A=0;A<3*this.vertices.length;A++)P[A]=1;g.setAttribute("color",new c.BufferAttribute(P,3))}if(0<this.faces.length){for(var R=[],L=[],N=0;N<this.faces.length;N++){L.push(this.faces[N].a,this.faces[N].b,this.faces[N].c);var x=this.faces[N].vertexColors;if(x.length===3)R.push(x[0],x[1],x[2]);else{var O=this.faces[N].color;R.push(O,O,O)}}g.setIndex(L),g.groups=this.computeGroups()}if(0<this.morphTargets.length){for(var B=[],D=[],z=0,U=this.morphTargets.length;z<U;z++){var H=this.morphTargets[z],Y=new c.Float32BufferAttribute(3*H.vertices.length,3);if(Y.name=H.name,B.push(Y.copyVector3sArray(H.vertices)),H.normals){var ie=new c.Float32BufferAttribute(3*H.normals.length,3);ie.name=H.name,D.push(ie.copyVector3sArray(H.normals))}}g.morphAttributes.position=B,g.morphAttributes.normal=D}if(0<this.skinIndices.length){var ae=new c.Float32BufferAttribute(4*this.skinIndices.length,4);g.setAttribute("skinIndex",ae.copyVector4sArray(this.skinIndices))}if(0<this.skinWeights.length){var ee=new c.Float32BufferAttribute(4*this.skinWeights.length,4);g.setAttribute("skinWeight",ee.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(g.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(g.boundingBox=this.boundingBox.clone()),g},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(g){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(g)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),m.createBufferGeometryFromObject=function(v){var g=new c.BufferGeometry,w=v.geometry;if(v.isPoints||v.isLine){var S=new c.Float32BufferAttribute(3*w.vertices.length,3),E=new c.Float32BufferAttribute(3*w.colors.length,3);if(g.setAttribute("position",S.copyVector3sArray(w.vertices)),g.setAttribute("color",E.copyColorsArray(w.colors)),w.lineDistances&&w.lineDistances.length===w.vertices.length){var M=new c.Float32BufferAttribute(w.lineDistances.length,1);g.setAttribute("lineDistance",M.copyArray(w.lineDistances))}w.boundingSphere!==null&&(g.boundingSphere=w.boundingSphere.clone()),w.boundingBox!==null&&(g.boundingBox=w.boundingBox.clone())}else v.isMesh&&(g=w.toBufferGeometry());return g};class d{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(g){var w,S,E=[],M=void 0,_=g.faces;for(S=0;S<_.length;S++){var C=_[S];C.materialIndex!==M&&(M=C.materialIndex,w!==void 0&&(w.count=3*S-w.start,E.push(w)),w={start:3*S,materialIndex:M})}w!==void 0&&(w.count=3*S-w.start,E.push(w)),this.groups=E}fromGeometry(g){var w,S=g.faces,E=g.vertices,M=g.faceVertexUvs,_=M[0]&&0<M[0].length,C=M[1]&&0<M[1].length,I=g.morphTargets,T=I.length;if(0<T){w=[];for(var P=0;P<T;P++)w[P]={name:I[P].name,data:[]};this.morphTargets.position=w}var A,R=g.morphNormals,L=R.length;if(0<L){A=[];for(var N=0;N<L;N++)A[N]={name:R[N].name,data:[]};this.morphTargets.normal=A}var x=g.skinIndices,O=g.skinWeights,B=x.length===E.length,D=O.length===E.length;0<E.length&&S.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var z,U=0;U<S.length;U++){z=S[U],this.vertices.push(E[z.a],E[z.b],E[z.c]);var H=z.vertexNormals;if(H.length===3)this.normals.push(H[0],H[1],H[2]);else{var Y=z.normal;this.normals.push(Y,Y,Y)}var ie=z.vertexColors;if(ie.length===3)this.colors.push(ie[0],ie[1],ie[2]);else{var ae=z.color;this.colors.push(ae,ae,ae)}if(_===!0){var ee=M[0][U];ee===void 0?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",U),this.uvs.push(new c.Vector2,new c.Vector2,new c.Vector2)):this.uvs.push(ee[0],ee[1],ee[2])}if(C===!0){var oe=M[1][U];oe===void 0?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",U),this.uvs2.push(new c.Vector2,new c.Vector2,new c.Vector2)):this.uvs2.push(oe[0],oe[1],oe[2])}for(var j,K=0;K<T;K++)j=I[K].vertices,w[K].data.push(j[z.a],j[z.b],j[z.c]);for(var $,re=0;re<L;re++)$=R[re].vertexNormals[U],A[re].data.push($.a,$.b,$.c);B&&this.skinIndices.push(x[z.a],x[z.b],x[z.c]),D&&this.skinWeights.push(O[z.a],O[z.b],O[z.c])}return this.computeGroups(g),this.verticesNeedUpdate=g.verticesNeedUpdate,this.normalsNeedUpdate=g.normalsNeedUpdate,this.colorsNeedUpdate=g.colorsNeedUpdate,this.uvsNeedUpdate=g.uvsNeedUpdate,this.groupsNeedUpdate=g.groupsNeedUpdate,g.boundingSphere!==null&&(this.boundingSphere=g.boundingSphere.clone()),g.boundingBox!==null&&(this.boundingBox=g.boundingBox.clone()),this}}class b{constructor(g,w,S,E,M){var _=5<arguments.length&&arguments[5]!==void 0?arguments[5]:0;this.a=g,this.b=w,this.c=S,this.normal=E&&E.isVector3?E:new c.Vector3,this.vertexNormals=Array.isArray(E)?E:[],this.color=M&&M.isColor?M:new c.Color,this.vertexColors=Array.isArray(M)?M:[],this.materialIndex=_}clone(){return new this.constructor().copy(this)}copy(g){this.a=g.a,this.b=g.b,this.c=g.c,this.normal.copy(g.normal),this.color.copy(g.color),this.materialIndex=g.materialIndex;for(var w=0,S=g.vertexNormals.length;w<S;w++)this.vertexNormals[w]=g.vertexNormals[w].clone();for(var E=0,M=g.vertexColors.length;E<M;E++)this.vertexColors[E]=g.vertexColors[E].clone();return this}}},o=>{o.exports=TB},o=>{o.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="},(o,l)=>{l.augmentMorphColor=function(){return function(u){u.vertexShader=u.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join(`
3182
+ `}),y=y+"new (("+e.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+p.main.map(function(g){return""+JSON.stringify(g)+": "+h.main[g].toString()}).join(",")+"}))(self);";var m=new window.Blob([y],{type:"text/javascript"});if(f.bare)return m;var d=window.URL||window.webkitURL||window.mozURL||window.msURL,b=d.createObjectURL(m),v=new window.Worker(b);return v.objectURL=b,v}}(Cf)),Cf.exports}function JB(n){var e=this.constructor;return this.then(function(t){return e.resolve(n()).then(function(){return t})},function(t){return e.resolve(n()).then(function(){return e.reject(t)})})}function KB(n){var e=this;return new e(function(t,i){if(!(n&&typeof n.length<"u"))return i(new TypeError(typeof n+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(n);if(r.length===0)return t([]);var s=r.length;function o(u,c){if(c&&(typeof c=="object"||typeof c=="function")){var f=c.then;if(typeof f=="function"){f.call(c,function(h){o(u,h)},function(h){r[u]={status:"rejected",reason:h},--s===0&&t(r)});return}}r[u]={status:"fulfilled",value:c},--s===0&&t(r)}for(var l=0;l<r.length;l++)o(l,r[l])})}function wx(n,e){this.name="AggregateError",this.errors=n,this.message=e||""}wx.prototype=Error.prototype;function qB(n){var e=this;return new e(function(t,i){if(!(n&&typeof n.length<"u"))return i(new TypeError("Promise.any accepts an array"));var r=Array.prototype.slice.call(n);if(r.length===0)return i();for(var s=[],o=0;o<r.length;o++)try{e.resolve(r[o]).then(t).catch(function(l){s.push(l),s.length===r.length&&i(new wx(s,"All promises were rejected"))})}catch(l){i(l)}})}var QB=setTimeout;function Mx(n){return!!(n&&typeof n.length<"u")}function eF(){}function tF(n,e){return function(){n.apply(e,arguments)}}function pt(n){if(!(this instanceof pt))throw new TypeError("Promises must be constructed via new");if(typeof n!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],_x(n,this)}function Sx(n,e){for(;n._state===3;)n=n._value;if(n._state===0){n._deferreds.push(e);return}n._handled=!0,pt._immediateFn(function(){var t=n._state===1?e.onFulfilled:e.onRejected;if(t===null){(n._state===1?Af:Ga)(e.promise,n._value);return}var i;try{i=t(n._value)}catch(r){Ga(e.promise,r);return}Af(e.promise,i)})}function Af(n,e){try{if(e===n)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof pt){n._state=3,n._value=e,Rf(n);return}else if(typeof t=="function"){_x(tF(t,e),n);return}}n._state=1,n._value=e,Rf(n)}catch(i){Ga(n,i)}}function Ga(n,e){n._state=2,n._value=e,Rf(n)}function Rf(n){n._state===2&&n._deferreds.length===0&&pt._immediateFn(function(){n._handled||pt._unhandledRejectionFn(n._value)});for(var e=0,t=n._deferreds.length;e<t;e++)Sx(n,n._deferreds[e]);n._deferreds=null}function nF(n,e,t){this.onFulfilled=typeof n=="function"?n:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function _x(n,e){var t=!1;try{n(function(i){t||(t=!0,Af(e,i))},function(i){t||(t=!0,Ga(e,i))})}catch(i){if(t)return;t=!0,Ga(e,i)}}pt.prototype.catch=function(n){return this.then(null,n)},pt.prototype.then=function(n,e){var t=new this.constructor(eF);return Sx(this,new nF(n,e,t)),t},pt.prototype.finally=JB,pt.all=function(n){return new pt(function(e,t){if(!Mx(n))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(n);if(i.length===0)return e([]);var r=i.length;function s(l,u){try{if(u&&(typeof u=="object"||typeof u=="function")){var c=u.then;if(typeof c=="function"){c.call(u,function(f){s(l,f)},t);return}}i[l]=u,--r===0&&e(i)}catch(f){t(f)}}for(var o=0;o<i.length;o++)s(o,i[o])})},pt.any=qB,pt.allSettled=KB,pt.resolve=function(n){return n&&typeof n=="object"&&n.constructor===pt?n:new pt(function(e){e(n)})},pt.reject=function(n){return new pt(function(e,t){t(n)})},pt.race=function(n){return new pt(function(e,t){if(!Mx(n))return t(new TypeError("Promise.race accepts an array"));for(var i=0,r=n.length;i<r;i++)pt.resolve(n[i]).then(e,t)})},pt._immediateFn=typeof setImmediate=="function"&&function(n){setImmediate(n)}||function(n){QB(n,0)},pt._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};const iF=Rl(Object.freeze(Object.defineProperty({__proto__:null,default:pt},Symbol.toStringTag,{value:"Module"})));(function(n,e){(function(i,r){n.exports=r()})(Ki,()=>(()=>{var t=[(o,l,u)=>{u(1);var c=u(2),f=c.version,h=function(){this.Revision=f,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=u(3).Geometry,this.Glyph=u(16).Glyph,this.Glyphset=u(18).Glyphset,this.Pointset=u(22).Pointset,this.Label=u(17).Label,this.Lines=u(24).Lines,this.TextureArray=u(25).TextureArray,this.TextureSlides=u(27).TextureSlides,this.Renderer=u(30).Renderer,this.Scene=u(32).Scene,this.GeometryCSG=u(50).GeometryCSG,this.GlyphsetCSG=u(56).GlyphsetCSG,this.Viewport=u(43).Viewport,this.CameraControls=u(43).CameraControls,this.SmoothCameraTransition=u(43).SmoothCameraTransition,this.RayCaster=u(43).RayCaster,this.CameraAutoTumble=u(43).CameraAutoTumble,this.StereoEffect=u(43).StereoEffect,this.loadExternalFile=u(5).loadExternalFile,this.loadExternalFiles=u(5).loadExternalFiles,this.THREE=u(4)};o.exports=new h},o=>{o.exports=JR()},o=>{o.exports=JSON.parse('{"name":"zincjs","version":"1.12.2","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}')},function(o,l,u){var c=u(4),f=u(5).toBufferGeometry,h=(y,m,d)=>{var b=f(y,d),v=!1;1>d.opacity&&(v=!0);var g;if(b._video===void 0){var w=d.localTimeEnabled||d.localMorphColour;m?(g=m,g.morphTargets=w,g.morphNormals=d.localTimeEnabled):b instanceof c.BufferGeometry&&b.attributes.color===void 0?g=new c.MeshPhongMaterial({color:d.colour,morphTargets:w,morphNormals:d.localTimeEnabled,transparent:v,opacity:d.opacity,side:c.DoubleSide}):g=new c.MeshPhongMaterial({color:d.colour,morphTargets:w,morphNormals:d.localTimeEnabled,vertexColors:c.VertexColors,transparent:v,opacity:d.opacity,side:c.DoubleSide}),d.localMorphColour&&b.morphAttributes.color&&(g.onBeforeCompile=u(9).augmentMorphColor())}else{var S=b._video.createCanvasVideoTexture();g=new c.MeshBasicMaterial({morphTargets:d.localTimeEnabled,color:new c.Color(1,1,1),transparent:v,opacity:d.opacity,map:S,side:c.DoubleSide}),this.videoHandler=b._video}return new c.Mesh(b,g)},p=function(){u(10).ZincObject.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(y,m,d)=>{if(!(this.morph&&this.morph.geometry&&y!=null)){var b=h(y,m,d);this.setMesh(b,d.localTimeEnabled,d.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var y=this.geometry.boundingBox.max,m=this.geometry.boundingBox.min,d=new c.Vector2(0-m.x,0-m.y),b=new c.Vector2(y.x-m.x,y.y-m.y);this.geometry.faceVertexUvs[0]=[];for(var v=0;v<this.geometry.faces.length;v++){var g=this.geometry.vertices[this.geometry.faces[v].a],w=this.geometry.vertices[this.geometry.faces[v].b],S=this.geometry.vertices[this.geometry.faces[v].c];geometry.faceVertexUvs[0].push([new c.Vector2((g.x+d.x)/b.x,(g.y+d.y)/b.y),new c.Vector2((w.x+d.x)/b.x,(w.y+d.y)/b.y),new c.Vector2((S.x+d.x)/b.x,(S.y+d.y)/b.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=y=>{this.morph.material.wireframe=y},this.editVertices=function(y,m){if(y&&y.length){var d=this.getMorph(),b=d.geometry.getAttribute("position");if(!d||0>m)return;var v=3*m;y.forEach(g=>{b.array[v++]=g[0],b.array[v++]=g[1],b.array[v++]=g[2]}),b.needsUpdate=!0,d.geometry.computeBoundingBox(),d.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};p.prototype=Object.create(u(10).ZincObject.prototype),l.Geometry=p},o=>{o.exports=cB},(o,l,u)=>{function c(C){throw new TypeError('"'+C+'" is read-only')}var f=u(4),h=u(6).Geometry,p=u(7).default;function y(C){var I=C,T=u(0).modelPrefix;return T&&(T[T.length-1]!="/"&&c("prefix"),/^(?:[a-z]+:)?\/\//i.test(C)||(I=T+C)),I}function m(C,I){var T=(A,R)=>{try{var L=new URL(A,R).href;if(A&&2>A.split("?").length){var N=R.split("?");N.length===2&&(L=L+"?"+N[1])}return L}catch{console.error("There is an issue creating the url link with: ".concat(A,"."))}};if(!Array.isArray(C))return T(C,I);var P=[];return C.forEach(A=>{P.push(T(A,I))}),P}function d(C,I,T,P,A){var R=C.morphTargetInfluences,L=void 0;C.geometry&&(L=C.geometry.morphAttributes);var N=!1;if(R&&L&&L.position){P.set(0,0,0),A.set(0,0,0);for(var x=0;x<R.length;x++)0<R[x]&&(N=!0,T.setFromArray(L.position[x].array),P.add(T.min.multiplyScalar(R[x])),A.add(T.max.multiplyScalar(R[x])));N&&I.set(P,A)}N||I.setFromBufferAttribute(C.geometry.attributes.position),C.updateWorldMatrix(!0,!0),I.applyMatrix4(C.matrixWorld)}function b(C,I,T,P){var A=new XMLHttpRequest;A.open("GET",y(C),!0),A.onreadystatechange=()=>{A.readyState==4&&(A.status==200?T(A.responseText,I):P(C))},A.send(null)}function v(C,I,T){function P(x,O){L[O]=x,R++,R==A&&I(L)}for(var A=C.length,R=0,L=[],N=0;N<A;N++)b(C[N],N,P,T)}l.getColorsRGB=(C,I)=>{var T=Math.floor(I/3),P=I%3,A=0;P==0?A=C[T].r:P==1?A=C[T].g:P==2&&(A=C[T].b);var R=new f.Color(A);return[R.r,R.g,R.b]},l.updateMorphColorAttribute=function(C,I){if(I&&C&&C.morphAttributes&&C.morphAttributes.color){var T=C.morphAttributes.color,P=I.morphTargetInfluences,A=P.length;C.deleteAttribute("morphColor0"),C.deleteAttribute("morphColor1");for(var R=0,L=[],N=0;1>R||N<A;N++)0<P[N]&&(R++,L.push([N,P[N]]));L.length==2?(C.setAttribute("morphColor0",T[L[0][0]]),C.setAttribute("morphColor1",T[L[1][0]])):L.length==1&&(C.setAttribute("morphColor0",T[L[0][0]]),C.setAttribute("morphColor1",T[L[0][0]]))}},l.toBufferGeometry=(C,I)=>{var T;return C instanceof h?(I.localTimeEnabled&&!C.morphNormalsReady&&(C.morphNormals==null||C.morphNormals.length==0)&&C.computeMorphNormals(),T=C.toIndexedBufferGeometry(),I.localMorphColour&&g(C,T)):C instanceof f.BufferGeometry&&(T=C.clone()),T.colorsNeedUpdate=!0,T.computeBoundingBox(),T.computeBoundingSphere(),C._video&&(T._video=C._video),T},l.copyMorphColorsToBufferGeometry=(C,I)=>{if(C&&C.morphColors&&0<C.morphColors.length){for(var T=[],P=C.morphColors,A=u(5).getColorsRGB,R=0,L=P.length;R<L;R++){for(var N=P[R],x=[],O=0;O<C.faces.length;O++){var B=C.faces[O],D=A(N.colors,B.a);x.push(D[0],D[1],D[2]),D=A(N.colors,B.b),x.push(D[0],D[1],D[2]),D=A(N.colors,B.c),x.push(D[0],D[1],D[2])}var z=new f.Float32BufferAttribute(3*(3*C.faces.length),3);z.name=N.name,T.push(z.copyArray(x))}I.morphAttributes.color=T}};var g=(C,I)=>{if(C&&C.morphColors&&0<C.morphColors.length){for(var T=[],P=C.morphColors,A=u(5).getColorsRGB,R=0,L=P.length;R<L;R++){for(var N,x=P[R],O=[],B=0;B<3*x.colors.length;B++)N=A(x.colors,B),O.push(N[0],N[1],N[2]);var D=new f.Float32BufferAttribute(O,3);D.name=x.name,T.push(D)}I.morphAttributes.color=T}};l.mergeVertices=function(C){var I=1<arguments.length&&arguments[1]!==void 0?arguments[1]:1e-4;I=Math.max(I,Number.EPSILON);for(var T,P={},A=C.getIndex(),R=C.getAttribute("position"),L=A?A.count:R.count,N=0,x=Object.keys(C.attributes),O={},B={},fe=[],D=["getX","getY","getZ","getW"],z=0,U=x.length;z<U;z++){T=x[z],O[T]=[];var H=C.morphAttributes[T];H&&(B[T]=Array(H.length).fill().map(()=>[]))}for(var Y=Math.log10(1/I),ie=Math.pow(10,Y),z=0;z<L;z++){for(var ae=A?A.getX(z):z,ee="",oe=0,U=x.length;oe<U;oe++)for(var T=x[oe],j=C.getAttribute(T),K=j.itemSize,$=0;$<K;$++)ee+="".concat(~~(j[D[$]](ae)*ie),",");if(ee in P)fe.push(P[ee]);else{for(var oe=0,U=x.length;oe<U;oe++)for(var re,T=x[oe],j=C.getAttribute(T),H=C.morphAttributes[T],K=j.itemSize,G=O[T],W=B[T],$=0;$<K;$++)if(re=D[$],G.push(j[re](ae)),H)for(var F=0,X=H.length;F<X;F++)W[F].push(H[F][re](ae));P[ee]=N,fe.push(N),N++}}for(var J=C.clone(),z=0,U=x.length;z<U;z++){var j,T=x[z],V=C.getAttribute(T),k=new V.array.constructor(O[T]);if(V.isInterleavedBufferAttribute?j=new f.BufferAttribute(k,V.itemSize,V.itemSize):(j=C.getAttribute(T).clone(),j.setArray(k)),J.setAttribute(T,j),T in B)for(var te,oe=0;oe<B[T].length;oe++)te=C.morphAttributes[T][oe].clone(),te.setArray(new te.array.constructor(B[T][oe])),J.morphAttributes[T][oe]=te}var se=Uint8Array;fe.length>=Math.pow(2,8)&&(se=Uint16Array),fe.length>=Math.pow(2,16)&&(se=Uint32Array);var le=new se(fe),fe=null;return A===null?fe=new f.BufferAttribute(le,1):(fe=C.getIndex().clone(),fe.setArray(le)),J.setIndex(fe),J};function w(C){if(C.isMeshPhongMaterial){var I=new f.MeshToonMaterial({color:C.color.clone(),morphTargets:C.morphTargets,morphNormals:C.morphNormals,vertexColors:C.vertexColors,transparent:C.transparent,opacity:C.opacity,side:C.side});return C.map&&(I.map=C.map),I}return C}function S(C,I){if(I&&C>=I.length){var T=new f.BufferGeometry,P=new Float32Array(3*C),A=0;return I.forEach(R=>{P[A++]=R[0],P[A++]=R[1],P[A++]=R[2]}),T.setAttribute("position",new f.BufferAttribute(P,3)),T.setDrawRange(0,I.length),T}}function E(){var C=new Image;C.src=u(8);var I=new f.Texture;return I.image=C,I.needsUpdate=!0,I}function M(C,I,T,P,A,R){var L=new p(C,I,T,P,A,R);return L.fontFace=P,L.fontSize=A,L.fontWeight=R,L.material.map.generateMipmaps=!1,L.material.map.anisotropy=4,L.material.sizeAttenuation=!1,L.material.alphaTest=.5,L.material.transparent=!0,L.material.depthWrite=!1,L.material.depthTest=!1,L.center.set(.5,-1.2),L.renderOrder=1e4,L}function _(C,I,T){if(T){var P=C||"",A=I||"",R=T.lastIndexOf("/");if(-1<R){var L=void 0,N=void 0;if(L=T.substring(0,R),N=T.substring(R+1),(L==="*"||L==="**"||L.toLowerCase()===P.toLowerCase())&&(N==="*"||N==="**"||N.toLowerCase()===A.toLowerCase()))return!0}else if(P.toLowerCase()===T.toLowerCase()||A.toLowerCase()===T.toLowerCase())return!0}return!1}l.getBoundingBox=d,l.createNewURL=m,l.createBufferGeometry=S,l.getCircularTexture=E,l.resolveURL=y,l.loadExternalFile=b,l.loadExternalFiles=v,l.PhongToToon=w,l.createNewSpriteText=M,l.isRegionGroup=_},(o,l,u)=>{u.r(l),u.d(l,{Face3:()=>b,Geometry:()=>m});var c=u(4),f=new c.Matrix4,h=new c.Object3D,p=new c.Vector3,y=new c.Vector3;function m(){this.uuid=c.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}m.prototype=Object.assign(Object.create(c.EventDispatcher.prototype),{constructor:m,isGeometry:!0,applyMatrix4:function(g){for(var w,S=new c.Matrix3().getNormalMatrix(g),E=0,M=this.vertices.length;E<M;E++)w=this.vertices[E],w.applyMatrix4(g);for(var _,C=0,I=this.faces.length;C<I;C++){_=this.faces[C],_.normal.applyMatrix3(S).normalize();for(var T=0,P=_.vertexNormals.length;T<P;T++)_.vertexNormals[T].applyMatrix3(S).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(g){return f.makeRotationX(g),this.applyMatrix4(f),this},rotateY:function(g){return f.makeRotationY(g),this.applyMatrix4(f),this},rotateZ:function(g){return f.makeRotationZ(g),this.applyMatrix4(f),this},translate:function(g,w,S){return f.makeTranslation(g,w,S),this.applyMatrix4(f),this},scale:function(g,w,S){return f.makeScale(g,w,S),this.applyMatrix4(f),this},lookAt:function(g){return h.lookAt(g),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(g){function w(H,Y,ie,ae){var ee=I===void 0?[]:[S.colors[H].clone(),S.colors[Y].clone(),S.colors[ie].clone()],oe=C===void 0?[]:[new c.Vector3().fromBufferAttribute(C,H),new c.Vector3().fromBufferAttribute(C,Y),new c.Vector3().fromBufferAttribute(C,ie)],j=new b(H,Y,ie,oe,ee,ae);S.faces.push(j),T!==void 0&&S.faceVertexUvs[0].push([new c.Vector2().fromBufferAttribute(T,H),new c.Vector2().fromBufferAttribute(T,Y),new c.Vector2().fromBufferAttribute(T,ie)]),P!==void 0&&S.faceVertexUvs[1].push([new c.Vector2().fromBufferAttribute(P,H),new c.Vector2().fromBufferAttribute(P,Y),new c.Vector2().fromBufferAttribute(P,ie)])}var S=this,E=g.index===null?void 0:g.index,M=g.attributes;if(M.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var _=M.position,C=M.normal,I=M.color,T=M.uv,P=M.uv2;P!==void 0&&(this.faceVertexUvs[1]=[]);for(var A=0;A<_.count;A++)S.vertices.push(new c.Vector3().fromBufferAttribute(_,A)),I!==void 0&&S.colors.push(new c.Color().fromBufferAttribute(I,A));var R=g.groups;if(0<R.length)for(var L=0;L<R.length;L++)for(var N=R[L],x=N.start,O=N.count,B=x,D=x+O;B<D;B+=3)E===void 0?w(B,B+1,B+2,N.materialIndex):w(E.getX(B),E.getX(B+1),E.getX(B+2),N.materialIndex);else if(E!==void 0)for(var z=0;z<E.count;z+=3)w(E.getX(z),E.getX(z+1),E.getX(z+2));else for(var U=0;U<_.count;U+=3)w(U,U+1,U+2);return this.computeFaceNormals(),g.boundingBox!==null&&(this.boundingBox=g.boundingBox.clone()),g.boundingSphere!==null&&(this.boundingSphere=g.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(p).negate(),this.translate(p.x,p.y,p.z),this},normalize:function(){this.computeBoundingSphere();var g=this.boundingSphere.center,w=this.boundingSphere.radius,S=w===0?1:1/w,E=new c.Matrix4;return E.set(S,0,0,-S*g.x,0,S,0,-S*g.y,0,0,S,-S*g.z,0,0,0,1),this.applyMatrix4(E),this},computeFaceNormals:function(){for(var g=new c.Vector3,w=new c.Vector3,S=0,E=this.faces.length;S<E;S++){var M=this.faces[S],_=this.vertices[M.a],C=this.vertices[M.b],I=this.vertices[M.c];g.subVectors(I,C),w.subVectors(_,C),g.cross(w),g.normalize(),M.normal.copy(g)}},computeVertexNormals:function(){for(var g=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],w=Array(this.vertices.length),S=0,E=this.vertices.length;S<E;S++)w[S]=new c.Vector3;if(g)for(var M=new c.Vector3,_=new c.Vector3,C=0,I=this.faces.length;C<I;C++){var T=this.faces[C],P=this.vertices[T.a],A=this.vertices[T.b],R=this.vertices[T.c];M.subVectors(R,A),_.subVectors(P,A),M.cross(_),w[T.a].add(M),w[T.b].add(M),w[T.c].add(M)}else{this.computeFaceNormals();for(var L,N=0,x=this.faces.length;N<x;N++)L=this.faces[N],w[L.a].add(L.normal),w[L.b].add(L.normal),w[L.c].add(L.normal)}for(var O=0,B=this.vertices.length;O<B;O++)w[O].normalize();for(var D=0,z=this.faces.length;D<z;D++){var U=this.faces[D],H=U.vertexNormals;H.length===3?(H[0].copy(w[U.a]),H[1].copy(w[U.b]),H[2].copy(w[U.c])):(H[0]=w[U.a].clone(),H[1]=w[U.b].clone(),H[2]=w[U.c].clone())}return 0<this.faces.length&&(this.normalsNeedUpdate=!0),w},computeFlatVertexNormals:function(){this.computeFaceNormals();for(var g=0,w=this.faces.length;g<w;g++){var S=this.faces[g],E=S.vertexNormals;E.length===3?(E[0].copy(S.normal),E[1].copy(S.normal),E[2].copy(S.normal)):(E[0]=S.normal.clone(),E[1]=S.normal.clone(),E[2]=S.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(var g,w=0,S=this.faces.length;w<S;w++){g=this.faces[w],g.__originalFaceNormal?g.__originalFaceNormal.copy(g.normal):g.__originalFaceNormal=g.normal.clone(),g.__originalVertexNormals||(g.__originalVertexNormals=[]);for(var E=0,M=g.vertexNormals.length;E<M;E++)g.__originalVertexNormals[E]?g.__originalVertexNormals[E].copy(g.vertexNormals[E]):g.__originalVertexNormals[E]=g.vertexNormals[E].clone()}var _=new m;_.faces=this.faces;for(var C=0,I=this.morphTargets.length;C<I;C++){if(!this.morphNormals[C]){this.morphNormals[C]={},this.morphNormals[C].faceNormals=[],this.morphNormals[C].vertexNormals=[];for(var T=this.morphNormals[C].faceNormals,P=this.morphNormals[C].vertexNormals,A=0,R=this.faces.length;A<R;A++){var L=new c.Vector3,N={a:new c.Vector3,b:new c.Vector3,c:new c.Vector3};T.push(L),P.push(N)}}var x=this.morphNormals[C];_.vertices=this.morphTargets[C].vertices,_.computeFaceNormals();var O=_.computeVertexNormals();if(O&&0<O.length){this.morphTargets[C].normals=Array(this.vertices.length);for(var B=0;B<O.length;B++)this.morphTargets[C].normals[B]=O[B].clone()}for(var D=0,z=this.faces.length;D<z;D++){var U=this.faces[D],H=x.faceNormals[D],Y=x.vertexNormals[D];H.copy(U.normal),Y.a.copy(U.vertexNormals[0]),Y.b.copy(U.vertexNormals[1]),Y.c.copy(U.vertexNormals[2])}}for(var ie,ae=0,ee=this.faces.length;ae<ee;ae++)ie=this.faces[ae],ie.normal=ie.__originalFaceNormal,ie.vertexNormals=ie.__originalVertexNormals;this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new c.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(g,w){var S=this.morphTargets.length,E=this.morphTargets,M=g.morphTargets,_=this.morphColors.length,C=this.morphColors,I=g.morphColors;if(0<S&&S==M.length)for(var T=0,P=E.length;T<P;T++){for(var A=E[T],R=M[T],L=0,N=R.vertices.length;L<N;L++){var x=R.vertices[L],O=x.clone();w!==void 0&&O.applyMatrix4(w),A.vertices.push(O)}if(A.normals&&R.normals)for(var B=0;B<R.normals.length;B+=3)y.set(R.normals2[B],R.normals2[B+1],R.normals2[B+2]),w!==void 0&&y.applyMatrix4(w),A.normals.push(y.x,y.y,y.z)}if(0<_&&_==I.length)for(var D=0,z=C.length;D<z;D++)for(var U=C[D],H=I[D],Y=0,ie=H.colors;Y<ie;Y++)U.colors.push(H.colors[Y].clone())},merge:function(g,w){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0;if(!(g&&g.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",g);var E,M=this.vertices.length,_=this.vertices,C=g.vertices,I=g.normals,T=this.faces,P=g.faces,A=this.colors,R=g.colors;w!==void 0&&(E=new c.Matrix3().getNormalMatrix(w));for(var L=0,N=C.length;L<N;L++){var x=C[L],O=x.clone();w!==void 0&&O.applyMatrix4(w),_.push(O)}for(var B=0;B<I.length;B+=3)y.set(I[B],I[B+1],I[B+2]),w!==void 0&&y.applyMatrix4(w),this.normals.push(y.x,y.y,y.z);for(var D=0,z=R.length;D<z;D++)typeof R[D]=="number"?A.push(R[D]):A.push(R[D].clone());for(var U=0,H=P.length;U<H;U++){var Y=P[U],ie=void 0,ae=void 0,ee=Y.vertexNormals,oe=Y.vertexColors,j=new b(Y.a+M,Y.b+M,Y.c+M);j.normal.copy(Y.normal),E!==void 0&&j.normal.applyMatrix3(E).normalize();for(var K=0,$=ee.length;K<$;K++)ie=ee[K].clone(),E!==void 0&&ie.applyMatrix3(E).normalize(),j.vertexNormals.push(ie);j.color.copy(Y.color);for(var re=0,G=oe.length;re<G;re++)ae=oe[re],j.vertexColors.push(ae.clone());j.materialIndex=Y.materialIndex+S,T.push(j)}for(var W,F=0,X=g.faceVertexUvs.length;F<X;F++){W=g.faceVertexUvs[F],this.faceVertexUvs[F]===void 0&&(this.faceVertexUvs[F]=[]);for(var J=0,V=W.length;J<V;J++){for(var k=W[J],te=[],se=0,le=k.length;se<le;se++)te.push(k[se].clone());this.faceVertexUvs[F].push(te)}}this.mergeMorph(g,w)},mergeMesh:function(g){return g&&g.isMesh?(g.matrixAutoUpdate&&g.updateMatrix(),void this.merge(g.geometry,g.matrix)):void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",g)},mergeVertices:function(){for(var g=0<arguments.length&&arguments[0]!==void 0?arguments[0]:4,w={},S=[],E=[],M=Math.pow(10,g),_=0,C=this.vertices.length;_<C;_++){var I=this.vertices[_],T=Math.round(I.x*M)+"_"+Math.round(I.y*M)+"_"+Math.round(I.z*M);w[T]===void 0?(w[T]=_,S.push(this.vertices[_]),E[_]=S.length-1):E[_]=E[w[T]]}for(var P,A=[],R=0,L=this.faces.length;R<L;R++){P=this.faces[R],P.a=E[P.a],P.b=E[P.b],P.c=E[P.c];for(var N=[P.a,P.b,P.c],x=0;3>x;x++)if(N[x]===N[(x+1)%3]){A.push(R);break}}for(var O,B=A.length-1;0<=B;B--){O=A[B],this.faces.splice(O,1);for(var D=0,z=this.faceVertexUvs.length;D<z;D++)this.faceVertexUvs[D].splice(O,1)}var U=this.vertices.length-S.length;return this.vertices=S,U},setFromPoints:function(g){this.vertices=[];for(var w,S=0,E=g.length;S<E;S++)w=g[S],this.vertices.push(new c.Vector3(w.x,w.y,w.z||0));return this},sortFacesByMaterialIndex:function(){for(var g=this.faces,w=g.length,S=0;S<w;S++)g[S]._id=S;g.sort(function(P,A){return P.materialIndex-A.materialIndex});var E,M,_=this.faceVertexUvs[0],C=this.faceVertexUvs[1];_&&_.length===w&&(E=[]),C&&C.length===w&&(M=[]);for(var I,T=0;T<w;T++)I=g[T]._id,E&&E.push(_[I]),M&&M.push(C[I]);E&&(this.faceVertexUvs[0]=E),M&&(this.faceVertexUvs[1]=M)},toJSON:function(){function g(G,W,F){return F?G|1<<W:G&~(1<<W)}function w(G){var W=G.x.toString()+G.y.toString()+G.z.toString();return L[W]===void 0&&(L[W]=R.length/3,R.push(G.x,G.y,G.z)),L[W]}function S(G){var W=G.r.toString()+G.g.toString()+G.b.toString();return x[W]===void 0&&(x[W]=N.length,N.push(G.getHex())),x[W]}function E(G){var W=G.x.toString()+G.y.toString();return B[W]===void 0&&(B[W]=O.length/2,O.push(G.x,G.y)),B[W]}var M={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(M.uuid=this.uuid,M.type=this.type,this.name!==""&&(M.name=this.name),this.parameters!==void 0){var _=this.parameters;for(var C in _)_[C]!==void 0&&(M[C]=_[C]);return M}for(var I,T=[],P=0;P<this.vertices.length;P++)I=this.vertices[P],T.push(I.x,I.y,I.z);for(var A=[],R=[],L={},N=[],x={},O=[],B={},D=0;D<this.faces.length;D++){var z=this.faces[D],U=!0,H=!1,Y=this.faceVertexUvs[0][D]!==void 0,ie=0<z.normal.length(),ae=0<z.vertexNormals.length,ee=z.color.r!==1||z.color.g!==1||z.color.b!==1,oe=0<z.vertexColors.length,j=0;if(j=g(j,0,0),j=g(j,1,U),j=g(j,2,H),j=g(j,3,Y),j=g(j,4,ie),j=g(j,5,ae),j=g(j,6,ee),j=g(j,7,oe),A.push(j),A.push(z.a,z.b,z.c),A.push(z.materialIndex),Y){var K=this.faceVertexUvs[0][D];A.push(E(K[0]),E(K[1]),E(K[2]))}if(ie&&A.push(w(z.normal)),ae){var $=z.vertexNormals;A.push(w($[0]),w($[1]),w($[2]))}if(ee&&A.push(S(z.color)),oe){var re=z.vertexColors;A.push(S(re[0]),S(re[1]),S(re[2]))}}return M.data={},M.data.vertices=T,M.data.normals=R,0<N.length&&(M.data.colors=N),0<O.length&&(M.data.uvs=[O]),M.data.faces=A,M},clone:function(){return new m().copy(this)},copy:function(g){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=g.name;for(var w=g.vertices,S=0,E=w.length;S<E;S++)this.vertices.push(w[S].clone());for(var M=g.colors,_=0,C=M.length;_<C;_++)this.colors.push(M[_].clone());for(var I=g.faces,T=0,P=I.length;T<P;T++)this.faces.push(I[T].clone());for(var A,R=0,L=g.faceVertexUvs.length;R<L;R++){A=g.faceVertexUvs[R],this.faceVertexUvs[R]===void 0&&(this.faceVertexUvs[R]=[]);for(var N=0,x=A.length;N<x;N++){for(var O,B=A[N],D=[],z=0,U=B.length;z<U;z++)O=B[z],D.push(O.clone());this.faceVertexUvs[R].push(D)}}for(var H,Y=g.morphTargets,ie=0,ae=Y.length;ie<ae;ie++){if(H={},H.name=Y[ie].name,Y[ie].vertices!==void 0){H.vertices=[];for(var ee=0,oe=Y[ie].vertices.length;ee<oe;ee++)H.vertices.push(Y[ie].vertices[ee].clone())}if(Y[ie].normals!==void 0){H.normals=[];for(var j=0,K=Y[ie].normals.length;j<K;j++)H.normals.push(Y[ie].normals[j].clone())}this.morphTargets.push(H)}for(var $,re=g.morphNormals,G=0,W=re.length;G<W;G++){if($={},re[G].vertexNormals!==void 0){$.vertexNormals=[];for(var F=0,X=re[G].vertexNormals.length;F<X;F++){var J=re[G].vertexNormals[F],V={};V.a=J.a.clone(),V.b=J.b.clone(),V.c=J.c.clone(),$.vertexNormals.push(V)}}if(re[G].faceNormals!==void 0){$.faceNormals=[];for(var k=0,te=re[G].faceNormals.length;k<te;k++)$.faceNormals.push(re[G].faceNormals[k].clone())}this.morphNormals.push($)}for(var se=g.skinWeights,le=0,fe=se.length;le<fe;le++)this.skinWeights.push(se[le].clone());for(var we=g.skinIndices,be=0,de=we.length;be<de;be++)this.skinIndices.push(we[be].clone());for(var ye=g.lineDistances,ne=0,he=ye.length;ne<he;ne++)this.lineDistances.push(ye[ne]);var me=g.boundingBox;me!==null&&(this.boundingBox=me.clone());var Re=g.boundingSphere;return Re!==null&&(this.boundingSphere=Re.clone()),this.elementsNeedUpdate=g.elementsNeedUpdate,this.verticesNeedUpdate=g.verticesNeedUpdate,this.uvsNeedUpdate=g.uvsNeedUpdate,this.normalsNeedUpdate=g.normalsNeedUpdate,this.colorsNeedUpdate=g.colorsNeedUpdate,this.lineDistancesNeedUpdate=g.lineDistancesNeedUpdate,this.groupsNeedUpdate=g.groupsNeedUpdate,this},computeGroups(){var v,g,w=[],S=void 0,E=this.faces;for(g=0;g<E.length;g++){var M=E[g];M.materialIndex!==S&&(S=M.materialIndex,v!==void 0&&(v.count=3*g-v.start,w.push(v)),v={start:3*g,materialIndex:S})}return v!==void 0&&(v.count=3*g-v.start,w.push(v)),w},toBufferGeometry:function(){var g=new d().fromGeometry(this),w=new c.BufferGeometry,S=new Float32Array(3*g.vertices.length);if(w.setAttribute("position",new c.BufferAttribute(S,3).copyVector3sArray(g.vertices)),0<g.normals.length){var E=new Float32Array(3*g.normals.length);w.setAttribute("normal",new c.BufferAttribute(E,3).copyVector3sArray(g.normals))}if(0<g.colors.length){var M=new Float32Array(3*g.colors.length);w.setAttribute("color",new c.BufferAttribute(M,3).copyColorsArray(g.colors))}if(0<g.uvs.length){var _=new Float32Array(2*g.uvs.length);w.setAttribute("uv",new c.BufferAttribute(_,2).copyVector2sArray(g.uvs))}if(0<g.uvs2.length){var C=new Float32Array(2*g.uvs2.length);w.setAttribute("uv2",new c.BufferAttribute(C,2).copyVector2sArray(g.uvs2))}for(var I in w.groups=g.groups,g.morphTargets){for(var T=[],P=g.morphTargets[I],A=0,R=P.length;A<R;A++){var L=P[A],N=new c.Float32BufferAttribute(3*L.data.length,3);N.name=L.name,T.push(N.copyVector3sArray(L.data))}w.morphAttributes[I]=T}if(0<g.skinIndices.length){var x=new c.Float32BufferAttribute(4*g.skinIndices.length,4);w.setAttribute("skinIndex",x.copyVector4sArray(g.skinIndices))}if(0<g.skinWeights.length){var O=new c.Float32BufferAttribute(4*g.skinWeights.length,4);w.setAttribute("skinWeight",O.copyVector4sArray(g.skinWeights))}return g.boundingSphere!==null&&(w.boundingSphere=g.boundingSphere.clone()),g.boundingBox!==null&&(w.boundingBox=g.boundingBox.clone()),w},toIndexedBufferGeometry:function(){var g=new c.BufferGeometry,w=new Float32Array(3*this.vertices.length);if(g.setAttribute("position",new c.BufferAttribute(w,3).copyVector3sArray(this.vertices)),0<this.normals.length){var S=new Float32Array(this.normals.length),E=new c.BufferAttribute(S,3).copyArray(this.normals);g.setAttribute("normal",E)}if(0<this.uvs.length&&0<this.uvs[0].length){var M=new Float32Array(2*this.uvs[0].length);g.setAttribute("uv",new c.BufferAttribute(M,2).copyArray(this.uvs[0]))}if(1<this.uvs.length&&0<this.uvs[1].length){var _=new Float32Array(2*this.uvs[1].length);g.setAttribute("uv2",new c.BufferAttribute(_,2).copyArray(this.uvs[1]))}if(0<this.colors.length){for(var C=[],I=0;I<this.colors.length;I++)C.push(new c.Color(this.colors[I]));var T=new Float32Array(3*C.length);g.setAttribute("color",new c.BufferAttribute(T,3).copyColorsArray(C))}else{for(var P=new Float32Array(3*this.vertices.length),A=0;A<3*this.vertices.length;A++)P[A]=1;g.setAttribute("color",new c.BufferAttribute(P,3))}if(0<this.faces.length){for(var R=[],L=[],N=0;N<this.faces.length;N++){L.push(this.faces[N].a,this.faces[N].b,this.faces[N].c);var x=this.faces[N].vertexColors;if(x.length===3)R.push(x[0],x[1],x[2]);else{var O=this.faces[N].color;R.push(O,O,O)}}g.setIndex(L),g.groups=this.computeGroups()}if(0<this.morphTargets.length){for(var B=[],D=[],z=0,U=this.morphTargets.length;z<U;z++){var H=this.morphTargets[z],Y=new c.Float32BufferAttribute(3*H.vertices.length,3);if(Y.name=H.name,B.push(Y.copyVector3sArray(H.vertices)),H.normals){var ie=new c.Float32BufferAttribute(3*H.normals.length,3);ie.name=H.name,D.push(ie.copyVector3sArray(H.normals))}}g.morphAttributes.position=B,g.morphAttributes.normal=D}if(0<this.skinIndices.length){var ae=new c.Float32BufferAttribute(4*this.skinIndices.length,4);g.setAttribute("skinIndex",ae.copyVector4sArray(this.skinIndices))}if(0<this.skinWeights.length){var ee=new c.Float32BufferAttribute(4*this.skinWeights.length,4);g.setAttribute("skinWeight",ee.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(g.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(g.boundingBox=this.boundingBox.clone()),g},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(g){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(g)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),m.createBufferGeometryFromObject=function(v){var g=new c.BufferGeometry,w=v.geometry;if(v.isPoints||v.isLine){var S=new c.Float32BufferAttribute(3*w.vertices.length,3),E=new c.Float32BufferAttribute(3*w.colors.length,3);if(g.setAttribute("position",S.copyVector3sArray(w.vertices)),g.setAttribute("color",E.copyColorsArray(w.colors)),w.lineDistances&&w.lineDistances.length===w.vertices.length){var M=new c.Float32BufferAttribute(w.lineDistances.length,1);g.setAttribute("lineDistance",M.copyArray(w.lineDistances))}w.boundingSphere!==null&&(g.boundingSphere=w.boundingSphere.clone()),w.boundingBox!==null&&(g.boundingBox=w.boundingBox.clone())}else v.isMesh&&(g=w.toBufferGeometry());return g};class d{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(g){var w,S,E=[],M=void 0,_=g.faces;for(S=0;S<_.length;S++){var C=_[S];C.materialIndex!==M&&(M=C.materialIndex,w!==void 0&&(w.count=3*S-w.start,E.push(w)),w={start:3*S,materialIndex:M})}w!==void 0&&(w.count=3*S-w.start,E.push(w)),this.groups=E}fromGeometry(g){var w,S=g.faces,E=g.vertices,M=g.faceVertexUvs,_=M[0]&&0<M[0].length,C=M[1]&&0<M[1].length,I=g.morphTargets,T=I.length;if(0<T){w=[];for(var P=0;P<T;P++)w[P]={name:I[P].name,data:[]};this.morphTargets.position=w}var A,R=g.morphNormals,L=R.length;if(0<L){A=[];for(var N=0;N<L;N++)A[N]={name:R[N].name,data:[]};this.morphTargets.normal=A}var x=g.skinIndices,O=g.skinWeights,B=x.length===E.length,D=O.length===E.length;0<E.length&&S.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var z,U=0;U<S.length;U++){z=S[U],this.vertices.push(E[z.a],E[z.b],E[z.c]);var H=z.vertexNormals;if(H.length===3)this.normals.push(H[0],H[1],H[2]);else{var Y=z.normal;this.normals.push(Y,Y,Y)}var ie=z.vertexColors;if(ie.length===3)this.colors.push(ie[0],ie[1],ie[2]);else{var ae=z.color;this.colors.push(ae,ae,ae)}if(_===!0){var ee=M[0][U];ee===void 0?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",U),this.uvs.push(new c.Vector2,new c.Vector2,new c.Vector2)):this.uvs.push(ee[0],ee[1],ee[2])}if(C===!0){var oe=M[1][U];oe===void 0?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",U),this.uvs2.push(new c.Vector2,new c.Vector2,new c.Vector2)):this.uvs2.push(oe[0],oe[1],oe[2])}for(var j,K=0;K<T;K++)j=I[K].vertices,w[K].data.push(j[z.a],j[z.b],j[z.c]);for(var $,re=0;re<L;re++)$=R[re].vertexNormals[U],A[re].data.push($.a,$.b,$.c);B&&this.skinIndices.push(x[z.a],x[z.b],x[z.c]),D&&this.skinWeights.push(O[z.a],O[z.b],O[z.c])}return this.computeGroups(g),this.verticesNeedUpdate=g.verticesNeedUpdate,this.normalsNeedUpdate=g.normalsNeedUpdate,this.colorsNeedUpdate=g.colorsNeedUpdate,this.uvsNeedUpdate=g.uvsNeedUpdate,this.groupsNeedUpdate=g.groupsNeedUpdate,g.boundingSphere!==null&&(this.boundingSphere=g.boundingSphere.clone()),g.boundingBox!==null&&(this.boundingBox=g.boundingBox.clone()),this}}class b{constructor(g,w,S,E,M){var _=5<arguments.length&&arguments[5]!==void 0?arguments[5]:0;this.a=g,this.b=w,this.c=S,this.normal=E&&E.isVector3?E:new c.Vector3,this.vertexNormals=Array.isArray(E)?E:[],this.color=M&&M.isColor?M:new c.Color,this.vertexColors=Array.isArray(M)?M:[],this.materialIndex=_}clone(){return new this.constructor().copy(this)}copy(g){this.a=g.a,this.b=g.b,this.c=g.c,this.normal.copy(g.normal),this.color.copy(g.color),this.materialIndex=g.materialIndex;for(var w=0,S=g.vertexNormals.length;w<S;w++)this.vertexNormals[w]=g.vertexNormals[w].clone();for(var E=0,M=g.vertexColors.length;E<M;E++)this.vertexColors[E]=g.vertexColors[E].clone();return this}}},o=>{o.exports=TB},o=>{o.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="},(o,l)=>{l.augmentMorphColor=function(){return function(u){u.vertexShader=u.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join(`
3183
3183
  `)),u.vertexShader=u.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join(`
3184
- `))}}},(o,l,u)=>{var c=u(4),f=u(5).createBufferGeometry,h=u(5).resolveURL,p=0,y=function(){return"pr"+p++},m=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new c.Group,this._lod=new(u(11)).LOD(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new c.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=y(),this._v1=new c.Vector3,this._v2=new c.Vector3,this._b1=new c.Box3,this.center=new c.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1};m.prototype.setDuration=function(d){this.duration=d,this.clipAction&&this.clipAction.setDuration(this.duration)},m.prototype.getDuration=function(){return this.duration},m.prototype.setRegion=function(d){this.region=d},m.prototype.getRegion=function(){return this.region},m.prototype.getMorph=function(){var d=this._lod.getCurrentMorph();return d||this.morph},m.prototype.getGroup=function(){return this.group},m.prototype.setMorph=function(d){this.morph=d,this.group.add(this.morph);var b=this._lod.calculateDistance("far");this._lod.addLevel(d,b),this._lod.setMaterial(d.material)},m.prototype.checkTransparentMesh=function(){},m.prototype.setMesh=function(d,b,v){this.animationGroup=new c.AnimationObjectGroup(d),this.mixer=new c.AnimationMixer(this.animationGroup);var g=d.geometry;if(this.geometry=d.geometry,this.clipAction=void 0,g&&g.morphAttributes){var w=g.morphAttributes.position;w||(w=g.morphAttributes.color?g.morphAttributes.color:g.morphAttributes.normal),w&&(this.animationClip=c.AnimationClip.CreateClipsFromMorphTargetSequences(w,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=c.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=b,this.morphColour=v,d.userData=this,d.matrixAutoUpdate=!1,this.setMorph(d),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(g.setAttribute("morphTarget0",g.getAttribute("position")),g.setAttribute("morphTarget1",g.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},m.prototype.setName=function(d){this.groupName=d,this._lod.setName(d)},m.prototype.getCurrentTime=function(){if(this.clipAction){var d=this.clipAction.time/this.clipAction._clip.duration;return this.duration*d}return this.inbuildTime},m.prototype.setMorphTime=function(d){var b=!1;if(this.clipAction){var v=d/this.duration,g=this.clipAction._clip.duration,w=v*g;w!=this.clipAction.time&&(this.clipAction.time=w,b=!0),b&&this.isTimeVarying()&&this.mixer.update(0)}else{var S=d;S=d>this.duration?this.duration:0>d?0:d,S!=this.inbuildTime&&(this.inbuildTime=S,b=!0)}b&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},m.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},m.prototype.getVisibility=function(){return this.visible},m.prototype.setVisibility=function(d){d!==this.visible&&(this.visible=d,this.group.visible=d,this.region&&(this.region.pickableUpdateRequired=!0))},m.prototype.setAlpha=function(d){var b=this._lod._material,v=!1;1>d&&(v=!0),b.opacity=d,b.transparent=v,this.checkTransparentMesh()},m.prototype.setFrustumCulled=function(d){this._lod.setFrustumCulled(d)},m.prototype.setVertexColors=function(d){this._lod.setVertexColors(d)},m.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},m.prototype.setColour=function(d){this._lod.setColour(d)},m.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},m.prototype.setColourHex=function(d){this._lod._material.color.setHex(d),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(d)},m.prototype.setEmissiveRGB=function(d){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...d),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...d)},m.prototype.setMaterial=function(d){this._lod.setMaterial(d)},m.prototype.getClosestVertexIndex=function(){var d=-1,b=this.getMorph();if(b&&b.geoemtry){var v=b.geometry.attributes.position;if(this._b1.setFromBufferAttribute(v),this._b1.getCenter(this._v1),v)for(var g=-1,w=0,S=0;S<v.count;S++)this._v2.fromArray(v.array,3*S),w=this._v2.distanceTo(this._v1),g==-1?g=w:g>w&&(g=w,d=S)}return d},m.prototype.getClosestVertex=function(d){var b=new c.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());var v=this.getMorph();if(v&&v.geometry&&0<=this.closestVertexIndex){var g=v.morphTargetInfluences,w=v.geometry.morphAttributes;if(g&&w&&w.position){for(var S=!1,E=0;E<g.length;E++)0<g[E]&&(S=!0,this._v1.fromArray(w.position[E].array,3*this.closestVertexIndex),b.add(this._v1.multiplyScalar(g[E])));if(S)return d?b.applyMatrix4(v.matrixWorld):b}else return b.fromArray(v.geometry.attributes.position.array,3*this.closestVertexIndex),d?b.applyMatrix4(v.matrixWorld):b}return this.getBoundingBox(),b.copy(this.center),d?b.applyMatrix4(this.morph.matrixWorld):b},m.prototype.getBoundingBox=function(){if(this.visible){var d=this._lod.getCurrentMorph();if(d&&d.visible)return this.boundingBoxUpdateRequired&&(u(5).getBoundingBox(d,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},m.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},m.prototype.markerIsRequired=function(d){return!!(this.visible&&(this.markerMode==="on"||d&&d.displayMarkers&&this.markerMode==="inherited"))},m.prototype.updateMarker=function(d,b){if(d==!1&&this.markerIsRequired(b)){var v=b.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new(u(14)).Marker(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var g=this.getClosestVertex(!1);g&&(this.marker.setPosition(g.x,g.y,g.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(b.markersList&&!(this.marker.uuid in b.markersList)&&(v=!0,b.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(),b&&b.camera&&(v||b.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(b.camera.cameraObject),b.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),b.markersList&&this.marker.uuid in b.markersList&&(b.markerCluster.markerUpdateRequired=!0,delete b.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},m.prototype.processMarkerVisual=function(d,b){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(d,b)},m.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},m.prototype.setRenderOrder=function(d){this._lod.setRenderOrder(d)},m.prototype.getClosestVertexDOMElementCoords=function(d){if(d&&d.camera){var b=!0,v=this.getClosestVertex(!0);return v.project(d.camera),v.z=Math.min(Math.max(v.z,0),1),(1<v.x||-1>v.x||1<v.y||-1>v.y)&&(b=!1),d.getZincCameraControls().getRelativeCoordsFromNDC(v.x,v.y,v),{position:v,inView:b}}},m.prototype.setMarkerMode=function(d,b){d!==this.markerMode&&(this.markerMode=d==="on"||d==="off"?d:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),b&&(this.markerNumber=b.number,this.markerImgURL=b.imgURL)},m.prototype.render=function(d,b,v,g){if(this.visible&&!(this.timeEnabled&&b)&&this._lod.update(v,this.center),b==!0){if(this.clipAction&&this.isTimeVarying())this.mixer.update(d);else{var w=this.inbuildTime+d;w>this.duration&&(w-=this.duration),this.inbuildTime=w}this.visible&&d!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(b,g)},m.prototype.addLOD=function(d,b,v,g,w){this._lod.addLevelFromURL(d,b,v,g,w)},m.prototype.addVertices=function(d){var b=this.getMorph(),v=void 0;if(!b)v=f(500,d),this.drawRange=d.length;else if(-1<this.drawRange){var g=b.geometry.getAttribute("position");d.forEach(w=>{g.setXYZ(this.drawRange,w[0],w[1],w[2]),++this.drawRange}),g.needsUpdate=!0,b.geometry.setDrawRange(0,this.drawRange),b.geometry.computeBoundingBox(),b.geometry.computeBoundingSphere(),v=b.geoemtry,this.boundingBoxUpdateRequired=!0}return v},m.prototype.setPosition=function(d,b,v){var g=this.getGroup();g&&(g.position.set(d,b,v),g.updateMatrix(),this.boundingBoxUpdateRequired=!0)},m.prototype.loadAdditionalSources=function(d){d.load(h(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},m.prototype.setScaleAll=function(d){var b=this.getGroup();b&&(b.scale.set(d,d,d),b.updateMatrix(),this.boundingBoxUpdateRequired=!0)},l.ZincObject=m},(o,l,u)=>{var c=u(4),f=u(5).updateMorphColorAttribute,h=u(5).toBufferGeometry,p=function(y){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=y,this.addLevel=(d,b)=>{if(d){var v,g=Math.abs(b);for(v=0;v<this.levels.length&&!(g<this.levels[v].distance);v++);this.levels.splice(v,0,{distance:g,morph:d,loaded:!0,loading:!1,url:""}),d.renderOrder=this._renderOrder}},this.levelLoaded=(d,b)=>{if(d){for(var v=Math.abs(b),g=0;g<this.levels.length;g++)if(v===this.levels[g].distance){this._parent.group.add(d),this.levels[g].morph=d,this.levels[g].loaded=!0,this.levels[g].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(d,b,v,g,w)=>{this._loader=d;var S,E=this.calculateDistance(b);for(S=0;S<this.levels.length&&!(E<this.levels[S].distance);S++);this.levels.splice(S,0,{distance:E,morph:void 0,loaded:!1,loading:!1,url:v,index:g}),w&&this.loadLevel(S)},this.loadLevel=d=>{var b=this.levels[d];return b.morph||b.loaded||b.loading||(b.loading=!0,this._loader.load(b.url,this.lodLoader(b.distance),void 0,void 0,{index:b.index})),b.morph===void 0},this.calculateDistance=function(d){this._parent.getBoundingBox();var b=this._parent.radius,v=0;return d==="far"?v=4.5*b:d==="medium"?v=2.5*b:d=="close"&&(v=0),v},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=()=>{var d=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=c.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!d.secondaryMesh&&(d.secondaryMesh=new c.Mesh(d.morph.geometry,this._secondaryMaterial),d.secondaryMesh.renderOrder=d.morph.renderOrder+1,d.secondaryMesh.userData=d.morph.userData,d.secondaryMesh.name=d.morph.name),this._material.side=c.BackSide,this._material.needsUpdate=!0,!d.secondaryMesh.parent&&(d.morph.add(d.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(d.secondaryMesh))):(d.secondaryMesh&&(d.morph.remove(d.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(d.secondaryMesh),this._parent.animationGroup.remove(d.secondaryMesh))),this._material.side=c.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(d=>{d.morph&&d.morph.geometry&&d.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var d=this.levels[this._currentLevel];return d&&d.morph?d.morph:this._parent.morph},this.lodLoader=function(d){return b=>{var v=this._material,g={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},w=h(b,g),S=void 0;this._parent.isGeometry?S=new c.Mesh(w,v):this._parent.isLines&&(S=new(u(12)).LineSegments(w,v)),S.userData=this._parent,S.renderOrder=this._renderOrder,b.dispose(),this.levelLoaded(S,d)}},this.updateMorphColorAttribute=d=>{if(this._material&&(this._material.vertexColors==c.VertexColors||this._material.vertexColors==!0))if(d){var b=this.getCurrentMorph();f(b.geometry,b)}else this.levels.forEach(v=>{v.morph&&v.morph.geometry&&f(v.morph.geometry,v.morph)})},this.setColour=d=>{this._material.color=d,this._secondaryMaterial&&(this._secondaryMaterial.color=d),m()},this.setFrustumCulled=d=>{this.levels.forEach(b=>{b.morph&&(b.morph.frustumCulled=d),b.secondaryMesh&&(b.secondaryMesh.frustumCulled=d)})},this.setMaterial=d=>{d&&(!this._material||this._material.id!==d.id)&&(this._material=d,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=d.clone(),this._secondaryMaterial.side=c.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(b=>{b.morph&&(b.morph.material=this._material,b.morph.geometry&&(b.morph.geometry.colorsNeedUpdate=!0)),b.secondaryMesh&&(b.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=d=>{this.levels.forEach(b=>{b.morph&&(b.morph.name=d),b.secondaryMesh&&(b.secondaryMesh.name=d)})},this.setRenderOrder=d=>{this._renderOrder=d,this.levels.forEach(b=>{b.morph&&(b.morph.renderOrder=d),b.secondaryMesh&&(b.secondaryMesh.renderOrder=d)})},this.setVertexColors=d=>{this._material.vertexColors=d,m(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=d)},this.update=(d,b)=>{var v=this.levels;if(1<v.length){var g,w,S=d.cameraObject.position.distanceTo(b),E=-1,M=-1;for(g=0,w=v.length;g<w&&S>=v[g].distance;g++)v[g].morph?(-1<E&&v[E].morph&&(v[E].morph.visible=!1),E=g,v[g].morph.visible=!0,M=-1):M=g;for(-1<M&&this.loadLevel(M);g<w;g++)v[g].morph&&(-1<E?v[g].morph.visible=!1:(v[g].morph.visible=!0,E=g));this._currentLevel!=E&&(this._currentLevel=E,this.checkTransparentMesh())}},this.toggleMarker=(d,b)=>{this.levels.forEach(v=>{v.morph&&(b?v.morph.add(d):v.morph.remove(d))})};var m=()=>{this.levels.forEach(d=>{d.morph&&d.morph.geometry&&(d.morph.geometry.colorsNeedUpdate=!0)})}};l.LOD=p},(o,l,u)=>{u.r(l),u.d(l,{LineSegments:()=>y});var c=u(13),f=u(4),h=new f.Vector3,p=new f.Vector3;class y extends c.Line{constructor(d,b){super(d,b),this.type="LineSegments"}computeLineDistances(){var d=this.geometry;if(!d.isBufferGeometry)d.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else if(d.index===null){for(var b=d.attributes.position,v=[],g=0,w=b.count;g<w;g+=2)h.fromBufferAttribute(b,g),p.fromBufferAttribute(b,g+1),v[g]=g==0?0:v[g-1],v[g+1]=v[g]+h.distanceTo(p);d.setAttribute("lineDistance",new f.Float32BufferAttribute(v,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}y.prototype.isLineSegments=!0},(o,l,u)=>{u.r(l),u.d(l,{Line:()=>w});var c=u(4),f=new c.Vector3,h=new c.Vector3,p=new c.Matrix4,y=new c.Ray,m=new c.Sphere,d=new c.Vector3,b=new c.Vector3,v=new c.Vector3,g=new c.Vector3;class w extends c.Object3D{constructor(){var M=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new c.BufferGeometry,_=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new c.LineBasicMaterial;super(),this.type="Line",this.geometry=M,this.material=_,this.updateMorphTargets()}copy(M){return super.copy(M),this.material=M.material,this.geometry=M.geometry,this}computeLineDistances(){var M=this.geometry;if(!M.isBufferGeometry)M.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else if(M.index===null){for(var _=M.attributes.position,C=[0],I=1,T=_.count;I<T;I++)f.fromBufferAttribute(_,I-1),h.fromBufferAttribute(_,I),C[I]=C[I-1],C[I]+=f.distanceTo(h);M.setAttribute("lineDistance",new c.Float32BufferAttribute(C,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(M,_){var C=this.geometry,I=this.matrixWorld,T=M.params.Line.threshold,P=C.drawRange,A=C.morphAttributes.position;if(C.boundingSphere===null&&C.computeBoundingSphere(),m.copy(C.boundingSphere),m.applyMatrix4(I),m.radius+=T,M.ray.intersectsSphere(m)!==!1){p.copy(I).invert(),y.copy(M.ray).applyMatrix4(p);var R=T/((this.scale.x+this.scale.y+this.scale.z)/3),L=R*R,N=new c.Vector3,x=new c.Vector3,O=new c.Vector3,B=new c.Vector3,D=this.isLineSegments?2:1;if(C.isBufferGeometry){var z=C.index,U=C.attributes,H=U.position;if(z!==null)for(var Y=Math.max(0,P.start),ie=Math.min(z.count,P.start+P.count),ae=Y;ae<ie-1;ae+=D){var ee=z.getX(ae),oe=z.getX(ae+1);S(N,x,this,H,A,ee,oe);var j=y.distanceSqToSegment(N,x,B,O);if(!(j>L)){B.applyMatrix4(this.matrixWorld);var K=M.ray.origin.distanceTo(B);K<M.near||K>M.far||_.push({distance:K,point:O.clone().applyMatrix4(this.matrixWorld),index:ae,face:null,faceIndex:null,object:this})}}else for(var $=Math.max(0,P.start),re=Math.min(H.count,P.start+P.count),G=$;G<re-1;G+=D){S(N,x,this,H,A,G,G+1);var W=y.distanceSqToSegment(N,x,B,O);if(!(W>L)){B.applyMatrix4(this.matrixWorld);var F=M.ray.origin.distanceTo(B);F<M.near||F>M.far||_.push({distance:F,point:O.clone().applyMatrix4(this.matrixWorld),index:G,face:null,faceIndex:null,object:this})}}}else C.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var M=this.geometry;if(M.isBufferGeometry){var _=M.morphAttributes,C=Object.keys(_);if(0<C.length){var I=_[C[0]];if(I!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var T,P=0,A=I.length;P<A;P++)T=I[P].name||P+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[T]=P}}}else{var R=M.morphTargets;R!==void 0&&0<R.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function S(E,M,_,C,I,T,P){E.fromBufferAttribute(C,T),M.fromBufferAttribute(C,P);var A=_.morphTargetInfluences;if(_.material.morphTargets&&I&&A){d.set(0,0,0),b.set(0,0,0);for(var R=0,L=I.length;R<L;R++){var N=A[R],x=I[R];N!==0&&(v.fromBufferAttribute(x,T),g.fromBufferAttribute(x,P),d.addScaledVector(v.sub(E),N),b.addScaledVector(g.sub(M),N))}E.add(d),M.add(b)}}w.prototype.isLine=!0},(o,l,u)=>{var c=u(4),f=new Image(128,128);f.src=u(15);var h=new c.Texture;h.image=f,h.needsUpdate=!0;var p=[.02,.03,1],y=new c.SpriteMaterial({map:h,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),m=u(5).createNewSpriteText,d=function(b){u(10).ZincObject.call(this),this.texture=h;var v=void 0,g=void 0,w=void 0,S=void 0,E=void 0,M=!0;this.morph=new c.Group,this.group=this.morph,this.parent=b,this.isMarker=!0;var _=!1;this.ndc=new c.Vector3;var C=void 0,I=void 0,T=()=>{v=new c.Sprite(y),v.center.set(.5,0),this.morph.add(v),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,v.scale.set(p[0],p[1],p[2]),v.userData=this};this.updateVisual=(P,A)=>{var R=1,L=0;P!==A&&(L=1-(this.ndc.z-P)/(A-P),R=.6+.4*L),this.setSpriteSize(R)},this.updateNDC=P=>(this.ndc.copy(this.morph.position),this.ndc.project(P),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(P,A,R)=>{this.morph.position.set(P,A,R)},this.setSpriteSize=P=>{v.scale.set(.015,.02,1),v.scale.multiplyScalar(P)},this.setUserSprite=()=>{S&&(this.morph.add(S),M&&(this.morph.remove(v),I&&this.morph.remove(I),M=!1))},this.setImageForUserSprite=(P,A)=>{S&&(this.morph.remove(S),S=void 0),g&&g.dispose(),w&&w.dispose(),g=new c.Texture,g.image=P,g.needsUpdate=!0,w=new c.SpriteMaterial({map:g,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),A||(A=[.05,.05,1]),S=new c.Sprite(w),S.center.set(.5,0),S.scale.set(A[0],A[1],A[2]),S.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{M||(M=!0,this.morph.add(v),S&&this.morph.remove(S),I&&this.morph.add(I))},this.loadUserSprite=(P,A)=>{if(P)if(P!==E){E=P;var R=new Image(128,128);R.crossOrigin="anonymous",R.onload=()=>{this.setImageForUserSprite(R,A)},R.src=P}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),v&&(v.clear(),v=void 0),I&&(I.material.map.dispose(),I.material.dispose(),I=void 0)},this.isEnabled=()=>_,this.setNumber=P=>{(!P||C!=P)&&I&&(this.morph.remove(I),I.material.map.dispose(),I.material.dispose(),I=void 0),!I&&P&&(I=m(P,.012,"black","Asap",120,700),this.morph.add(I)),C=P},this.getNumber=()=>C||1,this.setVisibility=function(P){P!==this.visible&&(this.visible=P,this.group.visible=P,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{_=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{_=!1,this.morph.visible=!1,this.visible=!1},T()};d.prototype=Object.create(u(10).ZincObject.prototype),l.Marker=d},o=>{o.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="},(o,l,u)=>{var c=u(4),f=function(h,p,y,m){u(10).ZincObject.call(this);var d;p&&(d=p.clone(),d.vertexColors=c.FaceColors),this.id=y;var b=void 0,v=void 0;this.isGlyph=!0;var g=[0,0,0];this.fromMesh=w=>!!(w&&w.isMesh)&&(this.morph=w.clone(),this.morph.userData=this,this.group.add(this.morph),!0),h&&d&&this.fromMesh(new c.Mesh(h,d)),this.getGlyphset=function(){return m},this.setLabel=w=>{w&&(typeof w=="string"||w instanceof String)&&(v=w,this.morph&&(this.morph.name=w))},this.showLabel=w=>{b&&(g=b.getPosition(),this.group.remove(b.getSprite()),b.dispose(),b=void 0),v&&(typeof v=="string"||v instanceof String)&&(b=new(u(17)).Label(v,w),b.setPosition(g[0],g[1],g[2]),this.group.add(b.getSprite()))},this.hideLabel=()=>{b&&(g=b.getPosition(),this.group.remove(b.getSprite()),b.dispose(),b=void 0)},this.getLabel=()=>v,this.getMesh=()=>this.morph,this.setTransformation=(w,S,E,M)=>{this.morph&&(this.morph.matrix.elements[0]=S[0],this.morph.matrix.elements[1]=S[1],this.morph.matrix.elements[2]=S[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=E[0],this.morph.matrix.elements[5]=E[1],this.morph.matrix.elements[6]=E[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=M[0],this.morph.matrix.elements[9]=M[1],this.morph.matrix.elements[10]=M[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=w[0],this.morph.matrix.elements[13]=w[1],this.morph.matrix.elements[14]=w[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),g=[...w],b&&b.setPosition(w[0],w[1],w[2])},this.setColour=w=>{b&&b.setColour(w),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}};f.prototype=Object.create(u(10).ZincObject.prototype),l.Glyph=f},(o,l,u)=>{var c=u(7).default;l.Label=function(f,h){var p=f,y=void 0;y=h?new c(p,.015,h.getStyle()):new c(p,.015),y.fontFace="Asap",y.fontWeight=700,y.material.map.generateMipmaps=!1,y.material.sizeAttenuation=!1,y.center.x=-.05,y.center.y=0,this.getPosition=()=>y?[y.position.x,y.position.y,y.position.z]:[0,0,0],this.setPosition=(m,d,b)=>{y&&y.position.set(m,d,b)},this.setColour=m=>{y.color=m.getStyle()},this.setScale=m=>{y&&0<m&&y.scale.set(m,m,1)},this.dispose=()=>{y.dispose()},this.getSprite=()=>y,this.getString=()=>p}},(o,l,u)=>{var c=u(4),f=u(19).JSONLoader,h=function(){u(10).ZincObject.call(this);var p=[],y=void 0,m=void 0,d=void 0,b=void 0,v=void 0,g=void 0,w=void 0,S=0,E=0,M=[0,0,0],_=[0,0,0],C=[0,0,0],I="NONE";this.ready=!1;var T=!1,P=!1;this.isGlyphset=!0;var A=new c.Matrix4,R=new c.Color,L=new c.Color,N=new c.Box3,x=new c.Box3,O=new c.Box3,B=[],D=[],z=[],U=[],H=[],Y=[],ie=[];this.globalScale=1;for(var ae=0;8>ae;ae++)new c.Vector3;this.load=(G,W,F,X,J)=>{y=G.axis1,m=G.axis2,d=G.axis3,b=G.positions,v=G.scale,g=G.colors,w=G.label,T=G.metadata.MorphColours,P=G.metadata.MorphVertices,S=G.metadata.number_of_time_steps,I=G.metadata.repeat_mode,E=G.metadata.number_of_vertices,I=="AXES_2D"||I=="MIRROR"?E*=2:I=="AXES_3D"&&(E*=3),M=G.metadata.base_size,_=G.metadata.offset,C=G.metadata.scale_factors;var V=new f;this.geometry=new c.BufferGeometry;var k=new c.InstancedMesh(this.geometry,void 0,E);if(this.setMorph(k),X){var te=V.parse(W);re(F,J)(te.geometry,te.materials),te.geometry.dispose()}else V.crossOrigin="Anonymous",V.load(W,re(F,J))};var ee=(G,W,F,X,J,V)=>{if(I=="NONE"||I=="MIRROR"){for(var k,te=[0,0,0],se=[0,0,0],le=[0,0,0],fe=[0,0,0],we=[0,0,0],be=[0,0,0],de=[0,0,0],ye=[0,0,0],ne=[0,0,0],he=0;3>he;he++)k=0>J[he]?-1:1,te[he]=(k*M[he]+J[he]*C[he])*this.globalScale;for(var he=0;3>he;he++)se[he]=W[he]*te[0],le[he]=F[he]*te[1],fe[he]=X[he]*te[2],we[he]=G[he]+_[0]*se[he]+_[1]*le[he]+_[2]*fe[he],I=="MIRROR"&&(be[he]=-se[he],de[he]=-le[he],ye[he]=-fe[he],ne[he]=we[he],0>J[0]&&(we[he]-=se[he],ne[he]-=be[he]));0>fe[0]*(se[1]*le[2]-se[2]*le[1])+fe[1]*(se[2]*le[0]-se[0]*le[2])+fe[2]*(se[0]*le[1]-se[1]*le[0])&&(fe[0]=-fe[0],fe[1]=-fe[1],fe[2]=-fe[2]),V[0]=[we,se,le,fe],I=="MIRROR"&&(0>ye[0]*(be[1]*de[2]-be[2]*de[1])+ye[1]*(be[2]*de[0]-be[0]*de[2])+ye[2]*(be[0]*de[1]-be[1]*de[0])&&(ye[0]=-ye[0],ye[1]=-ye[1],ye[2]=-ye[2]),V[1]=[ne,be,de,ye])}else if(I=="AXES_2D"||I=="AXES_3D"){for(var k,me=[0,0,0],Re=[0,0,0],he=0;3>he;he++)k=0>J[he]?-1:1,me[he]=(k*M[0]+J[he]*C[0])*this.globalScale;for(var he=0;3>he;he++)Re[he]=G[he]+_[0]*me[0]*W[he]+_[1]*me[1]*F[he]+_[2]*me[2]*X[he];for(var Te=glyph_repeat_mode=="AXES_2D"?2:3,De=0;De<Te;De++){var Ye=void 0,ze=void 0,st=J[De],Ce=[0,0,0],He=[0,0,0],Ge=[0,0,0];De==0?(Ye=W,ze=F):De==1?(Ye=F,ze=glyph_repeat_mode=="AXES_2D"?W:X):(Ye=X,ze=W);var Ot=(M[0]+st*C[0])*this.globalScale;Ce[0]=Ye[0]*Ot,Ce[1]=Ye[1]*Ot,Ce[2]=Ye[2]*Ot,Ge[0]=Ce[1]*ze[2]-ze[1]*Ce[2],Ge[1]=Ce[2]*ze[0]-ze[2]*Ce[0],Ge[2]=Ce[0]*ze[1]-Ce[1]*ze[0];var Nt=Math.sqrt(Ge[0]*Ge[0]+Ge[1]*Ge[1]+Ge[2]*Ge[2]);if(0<Nt){var mt=(M[2]+st*C[2])*this.globalScale/Nt;I=="AXES_2D"&&0<De&&(mt*=-1),Ge[0]*=mt,Ge[1]*=mt,Ge[2]*=mt}if(He[0]=Ge[1]*Ce[2]-Ce[1]*Ge[2],He[1]=Ge[2]*Ce[0]-Ce[2]*Ge[0],He[2]=Ge[0]*Ce[1]-Ge[1]*Ce[0],Nt=Math.sqrt(He[0]*He[0]+He[1]*He[1]+He[2]*He[2]),0<Nt){var xt=(M[1]+st*C[1])*this.globalScale/Nt;He[0]*=xt,He[1]*=xt,He[2]*=xt}V[De]=[Re,Ce,He,Ge]}}return V},oe=(G,W,F,X,J)=>{var V=1;I=="AXES_2D"||I=="MIRROR"?V=2:I=="AXES_3D"&&(V=3);var k=G.length/3,te=0;ie.length=V;for(var se=0;se<k;se++){var le=3*se,fe=[G[le],G[le+1],G[le+2]],we=[W[le],W[le+1],W[le+2]],be=[F[le],F[le+1],F[le+2]],de=[X[le],X[le+1],X[le+2]],ye=[J[le],J[le+1],J[le+2]],ne=ee(fe,we,be,de,ye,ie);if(ne.length==V)for(var he=0;he<V;he++){A.elements[0]=ne[he][1][0],A.elements[1]=ne[he][1][1],A.elements[2]=ne[he][1][2],A.elements[3]=0,A.elements[4]=ne[he][2][0],A.elements[5]=ne[he][2][1],A.elements[6]=ne[he][2][2],A.elements[7]=0,A.elements[8]=ne[he][3][0],A.elements[9]=ne[he][3][1],A.elements[10]=ne[he][3][2],A.elements[11]=0,A.elements[12]=ne[he][0][0],A.elements[13]=ne[he][0][1],A.elements[14]=ne[he][0][2],A.elements[15]=1,this.morph.setMatrixAt(te,A);var me=p[te];me&&me.setTransformation(ne[he][0],ne[he][1],ne[he][2],ne[he][3]),te++}}this.morph.instanceMatrix.needsUpdate=!0},j=G=>{var W=1;I=="AXES_2D"||I=="MIRROR"?W=2:I=="AXES_3D"&&(W=3);for(var F,X=G.length,J=0,V=0;V<X;V++){F=G[V];for(var k=0;k<W;k++){R.setHex(F),this.morph.setColorAt(J,R);var te=p[J];te&&te.setColour(R),J++}}this.morph.instanceColor.needsUpdate=!0},K=()=>{var G=B,W=D,F=z,X=U,J=H,V=Y,k=this.inbuildTime/this.duration*(S-1),te=Math.floor(k),se=1-(k-te),le=Math.ceil(k);if(P){var fe=b[te.toString()],we=b[le.toString()],be=y[te.toString()],de=y[le.toString()],ye=m[te.toString()],ne=m[le.toString()],he=d[te.toString()],me=d[le.toString()],Re=v[te.toString()],Te=v[le.toString()];B.length=fe.length,D.length=fe.length,z.length=fe.length,U.length=fe.length,H.length=fe.length;for(var De=0;De<fe.length;De++)G[De]=se*fe[De]+(1-se)*we[De],W[De]=se*be[De]+(1-se)*de[De],F[De]=se*ye[De]+(1-se)*ne[De],X[De]=se*he[De]+(1-se)*me[De],J[De]=se*Re[De]+(1-se)*Te[De]}else G=b[0],W=y[0],F=m[0],X=d[0],J=v[0];if(oe(G,W,F,X,J),this.boundingBoxUpdateRequired=!0,g!=null){if(T){var Ye=g[te.toString()],ze=g[le.toString()];V.length=Ye.length;for(var st=0;st<Ye.length;st++)R.setHex(Ye[st]),L.setHex(ze[st]),R.setRGB(R.r*se+L.r*(1-se),R.g*se+L.g*(1-se),R.b*se+L.b*(1-se)),V[st]=R.getHex()}else V=g[0];j(V)}};this.showLabel=()=>{for(var G=0;G<p.length;G++)p[G].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var G=0;G<p.length;G++)p[G].hideLabel()};var $=G=>{for(var W=0;W<E;W++){var F=new(u(16)).Glyph(void 0,void 0,W,this),X=w?w[W]:void 0;X=X||this.groupName,X&&F.setLabel(X),0<S&&F.setFrustumCulled(!1),p[W]=F,this.morph.add(F.getGroup())}G&&this.showLabel(),oe(b[0],y[0],m[0],d[0],v[0]),g!=null&&j(g[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=G=>{G.isGlyph&&p.push(G),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(G,W)=>{if(G.isMesh){var F=new(u(16)).Glyph(void 0,void 0,W,this);return F.fromMesh(G),p.push(F),this.morph.add(F.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,F}},this.forEachGlyph=G=>{for(var W=0;W<p.length;W++)G(p[W])};var re=(G,W)=>(F,X)=>{var J=F.toBufferGeometry();this.geometry.copy(J),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),J.dispose(),X&&X[0]&&(this.morph.material=X[0]),$(W),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),F.dispose(),G!=null&&typeof G=="function"&&G(this)};this.getClosestVertexIndex=function(){var G=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var W,F=b[0],X=F.length/3,J=-1,V=0,k=0;k<X;k++)W=3*k,this._v2.set(F[W],F[W+1],F[W+2]),V=this._v1.distanceTo(this._v2),(J==-1||J>V)&&(J=V,G=k)}return G},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph){var G=new c.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,A),G.setFromMatrixPosition(A),G}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){N.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var G=0;G<E;G++)this.morph.getMatrixAt(G,A),x.copy(N).applyMatrix4(A),G==0?O.copy(x):O.union(x);if(O)this.cachedBoundingBox.copy(O),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=G=>{this.inbuildTime=G>this.duration?this.duration:0>G?0:G,(T||P)&&(K(),P&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||0<S)&&(T||P)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(G){this.globalScale=G,K()},this.dispose=()=>{for(var G=p.length-1;0<=G;G--)p[G].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),y=void 0,m=void 0,d=void 0,b=void 0,v=void 0,g=void 0,this.ready=!1,this.groupName=void 0},this.render=(G,W,F)=>{if(W==!0){var X=this.inbuildTime+G;X>this.duration&&(X-=this.duration),this.inbuildTime=X,(T||P)&&K()}this.updateMarker(W,F)}};h.prototype=Object.create(u(10).ZincObject.prototype),l.Glyphset=h},(o,l,u)=>{u.r(l),u.d(l,{JSONLoader:()=>M});var c=u(4),f=u(20).Loader,h=c.LoaderUtils,p=c.AnimationClip,y=c.Vector3,m=c.Vector4,d=c.Color,b=c.Vector2,v=u(6).Face3,g=u(6).Geometry,w=c.FileLoader,S=c.DefaultLoadingManager,E=u(21).VideoHandler;function M(_){typeof _=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),_=void 0),this.manager=_===void 0?S:_,this.withCredentials=!1,this.paramsString=""}Object.assign(M.prototype,{load:function(C,I,T,P){var A=this,R=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:h.extractUrlBase(C),L=new w(this.manager);C.split("?"),this.paramsString=C.length===2?paramsStrings[1]:"",L.setWithCredentials(this.withCredentials),L.load(C,function(N){var x;try{x=JSON.parse(N)}catch{if(console.error("The loader has encountered an error while parsing the content of a resource."),P)return void P({responseURL:C})}var O=x.metadata;if(O!==void 0){var B=O.type;if(B!==void 0&&B.toLowerCase()==="object")return void console.error("THREE.JSONLoader: "+C+" should be loaded with THREE.ObjectLoader instead.")}if(A&&A.parse){var D=A.parse(x,R);I(D.geometry,D.materials)}},T,P)},setTexturePath:function(C){this.texturePath=C},parse:function(){function _(P,A){function R(he,me){return he&1<<me}var L,N,x,O,B,D,z,U,H,Y,ie,ae,ee,oe,j,K,$,re,G,W,F,X,J,V,k,te,se,le=P.faces,fe=P.vertices,we=P.normals,be=P.colors,de=P.scale,ye=0;if(P.uvs!==void 0){for(L=0;L<P.uvs.length;L++)P.uvs[L].length&&ye++;for(L=0;L<ye;L++)A.faceVertexUvs[L]=[]}for(O=0,B=fe.length;O<B;)re=new y,re.x=fe[O++]*de,re.y=fe[O++]*de,re.z=fe[O++]*de,A.vertices.push(re);if(O=0,B=le.length,P.uvs)for(L=0;L<P.uvs.length;L++){A.uvs[L]=[];for(var ne=0;ne<P.uvs[L].length;ne++)A.uvs[L][ne]=P.uvs[L][ne]}if(we)for(L=0;L<we.length;L++)A.normals[L]=we[L];if(be)for(L=0;L<be.length;L++)A.colors[L]=be[L];for(;O<B;)if(Y=le[O++],ie=R(Y,0),ae=R(Y,1),ee=R(Y,3),oe=R(Y,4),j=R(Y,5),K=R(Y,6),$=R(Y,7),ie){if(W=new v,W.a=le[O],W.b=le[O+1],W.c=le[O+3],F=new v,F.a=le[O+1],F.b=le[O+2],F.c=le[O+3],O+=4,ae&&(H=le[O++],W.materialIndex=H,F.materialIndex=H),x=A.faces.length,ee)for(L=0;L<ye;L++)for(V=P.uvs[L],A.faceVertexUvs[L][x]=[],A.faceVertexUvs[L][x+1]=[],N=0;4>N;N++)U=le[O++],te=V[2*U],se=V[2*U+1],k=new b(te,se),N!==2&&A.faceVertexUvs[L][x].push(k),N!==0&&A.faceVertexUvs[L][x+1].push(k);if(oe&&(z=3*le[O++],W.normal.set(we[z++],we[z++],we[z]),F.normal.copy(W.normal)),j)for(L=0;4>L;L++)z=3*le[O++],J=new y(we[z++],we[z++],we[z]),L!==2&&W.vertexNormals.push(J),L!==0&&F.vertexNormals.push(J);if(K&&(D=le[O++],X=be[D],W.color.setHex(X),F.color.setHex(X)),$)for(L=0;4>L;L++)D=le[O++],X=be[D],L!==2&&W.vertexColors.push(new d(X)),L!==0&&F.vertexColors.push(new d(X));A.faces.push(W),A.faces.push(F)}else{if(G=new v,G.a=le[O++],G.b=le[O++],G.c=le[O++],ae&&(H=le[O++],G.materialIndex=H),x=A.faces.length,ee)for(L=0;L<ye;L++)for(V=P.uvs[L],A.faceVertexUvs[L][x]=[],N=0;3>N;N++)U=le[O++],te=V[2*U],se=V[2*U+1],k=new b(te,se),A.faceVertexUvs[L][x].push(k);if(oe&&(z=3*le[O++],G.normal.set(we[z++],we[z++],we[z])),j)for(L=0;3>L;L++)z=3*le[O++],J=new y(we[z++],we[z++],we[z]),G.vertexNormals.push(J);if(K&&(D=le[O++],G.color.setHex(be[D])),$)for(L=0;3>L;L++)D=le[O++],G.vertexColors.push(new d(be[D]));A.faces.push(G)}}function C(P,A){var R=P.influencesPerVertex===void 0?2:P.influencesPerVertex;if(P.skinWeights)for(var L=0,N=P.skinWeights.length;L<N;L+=R){var x=P.skinWeights[L],O=1<R?P.skinWeights[L+1]:0,B=2<R?P.skinWeights[L+2]:0,D=3<R?P.skinWeights[L+3]:0;A.skinWeights.push(new m(x,O,B,D))}if(P.skinIndices)for(var L=0,N=P.skinIndices.length;L<N;L+=R){var z=P.skinIndices[L],U=1<R?P.skinIndices[L+1]:0,H=2<R?P.skinIndices[L+2]:0,Y=3<R?P.skinIndices[L+3]:0;A.skinIndices.push(new m(z,U,H,Y))}A.bones=P.bones,A.bones&&0<A.bones.length&&(A.skinWeights.length!==A.skinIndices.length||A.skinIndices.length!==A.vertices.length)&&console.warn("When skinning, number of vertices ("+A.vertices.length+"), skinIndices ("+A.skinIndices.length+"), and skinWeights ("+A.skinWeights.length+") should match.")}function I(P,A){var R=P.scale;if(P.morphTargets!==void 0)for(var L=0,N=P.morphTargets.length;L<N;L++){A.morphTargets[L]={},A.morphTargets[L].name=P.morphTargets[L].name,A.morphTargets[L].vertices=[];for(var x,O=A.morphTargets[L].vertices,B=P.morphTargets[L].vertices,D=0,z=B.length;D<z;D+=3)x=new y,x.x=B[D]*R,x.y=B[D+1]*R,x.z=B[D+2]*R,O.push(x)}if(P.morphNormals!==void 0){for(var L=0,N=P.morphNormals.length;L<N;L++)if(A.morphTargets[L]){A.morphTargets[L].normals=[];for(var U,H=A.morphTargets[L].normals,Y=P.morphNormals[L].normals,D=0,z=Y.length;D<z;D+=3)U=new y,U.x=Y[D],U.y=Y[D+1],U.z=Y[D+2],H.push(U);A.morphNormalsReady=!0}}if(P.morphColors!==void 0){var L,N,ie,ae,ee,oe,j;for(L=0,N=P.morphColors.length;L<N;L++)for(A.morphColors[L]={},A.morphColors[L].name=P.morphColors[L].name,A.morphColors[L].colors=[],ee=A.morphColors[L].colors,oe=P.morphColors[L].colors,ie=0,ae=oe.length;ie<ae;ie+=3)j=new c.Color(16755200),j.setRGB(oe[ie],oe[ie+1],oe[ie+2]),ee.push(j)}}function T(P,A){var R=[],L=[];P.animation!==void 0&&L.push(P.animation),P.animations!==void 0&&(P.animations.length?L=L.concat(P.animations):L.push(P.animations));for(var N,x=0;x<L.length;x++)N=p.parseAnimation(L[x],A.bones),N&&R.push(N);if(A.morphTargets){var O=p.CreateClipsFromMorphTargetSequences(A.morphTargets,10);R=R.concat(O)}0<R.length&&(A.animations=R)}return function(P,A){P.data!==void 0&&(P=P.data),P.scale=P.scale===void 0?1:1/P.scale;var R=new g;if(R.morphColors=[],_(P,R),C(P,R),I(P,R),T(P,R),R.computeFaceNormals(),R.computeBoundingSphere(),P.materials===void 0||P.materials.length===0)return{geometry:R};var L=f.prototype.initMaterials(P.materials,A,"Anonymous");if(P.materials[0].video){var N=A+P.materials[0].video;this.paramsString&&(N+="?".concat(this.paramsString));var x=new E(N);R._video=x}return L&&0<L.length&&(L[0].side=P.materials[0].singleSided?c.FrontSide:P.materials[0].flipSided?c.BackSide:c.DoubleSide,P.materials[0].specularCoef&&(L[0].shininess=Math.floor(P.materials[0].specularCoef/3))),{geometry:R,materials:L}}}()})},(o,l,u)=>{u.r(l),u.d(l,{Loader:()=>f});var c=u(4);u(4);function f(){}f.Handlers={handlers:[],add:function(p,y){this.handlers.push(p,y)},get:function(p){for(var y=this.handlers,m=0,d=y.length;m<d;m+=2){var b=y[m],v=y[m+1];if(b.test(p))return v}return null}},Object.assign(f.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(p,y,m){for(var d=[],b=0;b<p.length;++b)d[b]=this.createMaterial(p[b],y,m);return d},createMaterial:function(){var h={NoBlending:c.NoBlending,NormalBlending:c.NormalBlending,AdditiveBlending:c.AdditiveBlending,SubtractiveBlending:c.SubtractiveBlending,MultiplyBlending:c.MultiplyBlending,CustomBlending:c.CustomBlending},p=new c.Color,y=new c.TextureLoader,m=new c.MaterialLoader;return function(d,b,v){function g(_,C,I,T,P){var A,R=b+_,L=f.Handlers.get(R);L===null?(y.setCrossOrigin(v),A=y.load(R)):A=L.load(R),C!==void 0&&(A.repeat.fromArray(C),C[0]!==1&&(A.wrapS=c.RepeatWrapping),C[1]!==1&&(A.wrapT=c.RepeatWrapping)),I!==void 0&&A.offset.fromArray(I),T!==void 0&&(T[0]==="repeat"&&(A.wrapS=c.RepeatWrapping),T[0]==="mirror"&&(A.wrapS=c.MirroredRepeatWrapping),T[1]==="repeat"&&(A.wrapT=c.RepeatWrapping),T[1]==="mirror"&&(A.wrapT=c.MirroredRepeatWrapping)),P!==void 0&&(A.anisotropy=P);var N=c.MathUtils.generateUUID();return w[N]=A,N}var w={},S={uuid:c.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var E in d){var M=d[E];switch(E){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":S.name=M;break;case"blending":S.blending=h[M];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",E,"is no longer supported.");break;case"colorDiffuse":S.color=p.fromArray(M).getHex();break;case"colorSpecular":S.specular=p.fromArray(M).getHex();break;case"colorEmissive":S.emissive=p.fromArray(M).getHex();break;case"specularCoef":S.shininess=M;break;case"shading":M.toLowerCase()==="basic"&&(S.type="MeshBasicMaterial"),M.toLowerCase()==="phong"&&(S.type="MeshPhongMaterial"),M.toLowerCase()==="standard"&&(S.type="MeshStandardMaterial");break;case"mapDiffuse":S.map=g(M,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":S.emissiveMap=g(M,d.mapEmissiveRepeat,d.mapEmissiveOffset,d.mapEmissiveWrap,d.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":S.lightMap=g(M,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":S.aoMap=g(M,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":S.bumpMap=g(M,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case"mapBumpScale":S.bumpScale=M;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":S.normalMap=g(M,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);break;case"mapNormalFactor":S.normalScale=M;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":S.specularMap=g(M,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":S.metalnessMap=g(M,d.mapMetalnessRepeat,d.mapMetalnessOffset,d.mapMetalnessWrap,d.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":S.roughnessMap=g(M,d.mapRoughnessRepeat,d.mapRoughnessOffset,d.mapRoughnessWrap,d.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":S.alphaMap=g(M,d.mapAlphaRepeat,d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":S.side=c.BackSide;break;case"doubleSided":S.side=c.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),S.opacity=M;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":S[E]=M;break;case"vertexColors":M===!0&&(S.vertexColors=c.VertexColors),M==="face"&&(S.vertexColors=c.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",E,M)}}return S.type==="MeshBasicMaterial"&&delete S.emissive,S.type!=="MeshPhongMaterial"&&delete S.specular,1>S.opacity&&(S.transparent=!0),m.setTextures(w),m.parse(S)}}()})},(o,l,u)=>{var c=u(4);l.VideoHandler=function(f){var h=this;this.video=void 0,this.videoTexture=void 0,this.setMorphTime=function(p,y){var m=p/y*h.video.duration;h.video.currentTime=m},this.getVideoDuration=function(){return h.video.duration},this.createCanvasVideoTexture=function(){return h.videoTexture=new c.VideoTexture(h.video),h.videoTexture.minFilter=c.LinearFilter,h.videoTexture.magFilter=c.LinearFilter,h.videoTexture.format=c.RGBFormat,h.video.currentTime=0,h.videoTexture},this.getCurrentTime=function(p){return h.video?p*(h.video.currentTime/h.video.duration):0},this.isReadyToPlay=function(){return!!(h.video&&3<=h.video.readyState)},function(){document&&(h.video=document.createElement("video"),h.video.crossOrigin="anonymous",h.video.src=f,h.video.load(),h.video.loop=!0)}()}},(o,l,u)=>{var c=u(4),f=u(23).Points,h=u(5).toBufferGeometry,p=u(5).getCircularTexture,y=u(17).Label,m=function(){u(10).ZincObject.call(this),this.isPointset=!0;var d=[];this.createMesh=(v,g,w)=>{if(v&&g){var S=h(v,w),E=p();g.map=E;var M=new f(S,g);this.setMesh(M,w.localTimeEnabled,w.localMorphColour)}};var b=(v,g,w,S)=>{if(w){var E=new c.Color(S),M=new y(w,E);M.setPosition(g[0],g[1],g[2]);var _=M.getSprite();_.material.sizeAttenuation=!1,_.material.alphaTest=.5,_.material.transparent=!0,_.material.depthWrite=!1,_.material.depthTest=!1,this.group.add(_),d[v]=M}};this.addPoints=(v,g,w)=>{if(v&&0<v.length){var S=this.drawRange-1,E=this.addVertices(v),M=this.getMorph();if(!M){var _=new c.PointsMaterial({alphaTest:.5,size:10,color:w,sizeAttenuation:!1});E.colorsNeedUpdate=!0,this.createMesh(E,_,{localTimeEnabled:!1,localMorphColour:!1})}var C=S+v.length,I=0;if(Array.isArray(g)&&g.length===v.length||typeof g=="string")for(S;S+I<C;){var T=typeof g=="string"?g:g[I];b(I,v[I],T,w),I++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setSize=v=>{this.morph&&this.morph.material&&(this.morph.material.size=v,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=v=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=v,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(v){if(0<=v&&this.drawRange>v){var g=this.getMorph().geometry.getAttribute("position");return[g.getX(v),g.getY(v),g.getZ(v)]}},this.editVertices=function(v,g){if(v&&v.length){var w=this.getMorph(),S=g+v.length-1;if(!w||0>g||S>=this.drawRange)return;var E=w.geometry.getAttribute("position"),M=g;v.forEach(_=>{var C=d[M];C&&C.setPosition(_[0],_[1],_[2]),E.setXYZ(M++,_[0],_[1],_[2])}),E.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(v,g,w,S)=>{this.morph&&w&&(this.morph.sizePerPixel=w.pixelHeight),m.prototype.render.call(this,v,g,w,S)}};m.prototype=Object.create(u(10).ZincObject.prototype),l.Pointset=m},(o,l,u)=>{u.r(l),u.d(l,{Points:()=>b});var c=u(4),f=new c.Matrix4,h=new c.Ray,p=new c.Sphere,y=new c.Vector3,m=new c.Vector3,d=new c.Vector3;class b extends c.Object3D{constructor(){var S=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new c.BufferGeometry,E=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new c.PointsMaterial;super(),this.type="Points",this.geometry=S,this.material=E,this.sizePerPixel=1,this.updateMorphTargets()}copy(S){return super.copy(S),this.material=S.material,this.geometry=S.geometry,this}raycast(S,E){var M=this.geometry,_=this.matrixWorld,C=S.params.Points.threshold,I=M.drawRange;if(M.boundingSphere===null&&M.computeBoundingSphere(),p.copy(M.boundingSphere),p.applyMatrix4(_),p.radius+=C,S.ray.intersectsSphere(p)!==!1){f.copy(_).invert(),h.copy(S.ray).applyMatrix4(f);var T=C/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,P=T*T;if(M.isBufferGeometry){var A=M.index,R=M.attributes,L=R.position,N=M.morphAttributes.position;if(A!==null)for(var x,O=Math.max(0,I.start),B=Math.min(A.count,I.start+I.count),D=O;D<B;D++)x=A.getX(D),g(this,L,N,x),v(y,x,P,_,S,E,this);else for(var z=Math.max(0,I.start),U=Math.min(L.count,I.start+I.count),H=z;H<U;H++)g(this,L,N,H),v(y,H,P,_,S,E,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var S=this.geometry;if(S.isBufferGeometry){var E=S.morphAttributes,M=Object.keys(E);if(0<M.length){var _=E[M[0]];if(_!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var C,I=0,T=_.length;I<T;I++)C=_[I].name||I+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[C]=I}}}else{var P=S.morphTargets;P!==void 0&&0<P.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}b.prototype.isPoints=!0;function v(w,S,E,M,_,C,I){var T=h.distanceSqToPoint(w);if(T<E){var P=new c.Vector3;h.closestPointToPoint(w,P),P.applyMatrix4(M);var A=_.ray.origin.distanceTo(P);if(A<_.near||A>_.far)return;C.push({distance:A,distanceToRay:Math.sqrt(T),point:P,index:S,face:null,object:I})}}function g(w,S,E,M){y.fromBufferAttribute(S,M);var _=w.morphTargetInfluences;if(w.material.morphTargets&&E&&_){m.set(0,0,0);for(var C=0,I=E.length;C<I;C++){var T=_[C],P=E[C];T!==0&&(d.fromBufferAttribute(P,M),m.addScaledVector(d.sub(y),T))}y.add(m)}}},(o,l,u)=>{var c=u(4),f=u(5).toBufferGeometry,h=function(){u(10).ZincObject.call(this),this.isLines=!0,this.createLineSegment=(p,y,m)=>{if(p&&y){var d=f(p,m);m.localMorphColour&&d.morphAttributes.color&&(y.onBeforeCompile=u(9).augmentMorphColor());var b=new(u(12)).LineSegments(d,y);this.setMesh(b,m.localTimeEnabled,m.localMorphColour)}},this.setWidth=p=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=p,this.morph.material.needsUpdate=!0)},this.addLines=(p,y)=>{if(p&&0<p.length){var m=this.addVertices(p),d=this.getMorph();if(!d){var b=new c.LineBasicMaterial({color:y});m.colorsNeedUpdate=!0,this.createLineSegment(m,b,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};h.prototype=Object.create(u(10).ZincObject.prototype),l.Lines=h},(o,l,u)=>{function c(y,m,d,b,v,g,w){try{var S=y[g](w),E=S.value}catch(M){return void d(M)}S.done?m(E):Promise.resolve(E).then(b,v)}function f(y){return function(){var m=this,d=arguments;return new Promise(function(b,v){function g(E){c(S,b,v,g,w,"next",E)}function w(E){c(S,b,v,g,w,"throw",E)}var S=y.apply(m,d);g(void 0)})}}var h=u(4),p=function(){var y=this;u(26).Texture.call(this),this.isTextureArray=!0,this.loadFromImages=function(){var m=f(function*(d){var b=1,v=1,g=0;if(d&&d.length){y.isLoading=!0;var w=new Image;w.crossOrigin="Anonymous";for(var S,E=document.createElement("canvas"),M=0,_=Array(d.length),C=0;C<d.length;C++)S=yield y.imageToUint8Array(y,w,d[C],E),S&&S.array&&(b=S.width,v=S.height,_[g]=S.array,M+=_[g].length,g++);var I=new Uint8Array(M);M=0,_.forEach(T=>{I.set(T,M),M+=T.length}),y.impl=new h.DataTexture2DArray(I,b,v,g),y.size={width:b,height:v,depth:g},y.isLoading=!1,y.impl.needsUpdate=!0}});return function(){return m.apply(this,arguments)}}(),this.getMaterial=m=>{if(this.impl){var d;if(!m)d=new h.MeshBasicMaterial({color:new h.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:h.DoubleSide});else if(m.vs&&m.fs){var b=!0;m.transparent&&(b=m.transparent);var v=h.FrontSide;m.side&&(v=m.side),d=new h.ShaderMaterial({transparent:b,uniforms:m.uniforms,vertexShader:m.vs,fragmentShader:m.fs,side:v}),m.glslVersion&&(d.glslVersion=m.glslVersion)}if(d)return d.needsUpdate=!0,d}}};p.prototype=Object.create(u(26).Texture.prototype),l.TextureArray=p},(o,l,u)=>{function c(y,m,d,b,v,g,w){try{var S=y[g](w),E=S.value}catch(M){return void d(M)}S.done?m(E):Promise.resolve(E).then(b,v)}function f(y){return function(){var m=this,d=arguments;return new Promise(function(b,v){function g(E){c(S,b,v,g,w,"next",E)}function w(E){c(S,b,v,g,w,"throw",E)}var S=y.apply(m,d);g(void 0)})}}var h=u(4),p=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};p.prototype.loadImage=function(y,m){return new Promise((d,b)=>{y.onload=()=>d(y),y.onerror=b,y.src=m})},p.prototype.imageToUint8Array=function(){var y=f(function*(m,d,b,v){yield m.loadImage(d,b),v.width=d.width,v.height=d.height;var g=v.getContext("2d");return g.drawImage(d,0,0),{array:new Uint8Array(g.getImageData(0,0,v.width,v.height).data.buffer),width:v.width,height:v.height}});return function(){return y.apply(this,arguments)}}(),p.prototype.loadFromImages=function(){var y=f(function*(){});return function(){return y.apply(this,arguments)}}(),p.prototype.isReady=function(){return!(!this.impl||this.isLoading)},p.prototype.getMaterial=function(){if(this.impl)return new h.MeshBasicMaterial({color:new h.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:h.DoubleSide})},l.Texture=p},(o,l,u)=>{function c(v,g){var w=Object.keys(v);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(v);g&&(S=S.filter(function(E){return Object.getOwnPropertyDescriptor(v,E).enumerable})),w.push.apply(w,S)}return w}function f(v){for(var g,w=1;w<arguments.length;w++)g=arguments[w]==null?{}:arguments[w],w%2?c(Object(g),!0).forEach(function(S){h(v,S,g[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(g)):c(Object(g)).forEach(function(S){Object.defineProperty(v,S,Object.getOwnPropertyDescriptor(g,S))});return v}function h(v,g,w){return g=p(g),g in v?Object.defineProperty(v,g,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[g]=w,v}function p(v){var g=y(v,"string");return typeof g=="symbol"?g:g+""}function y(v,g){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var S=w.call(v,g||"default");if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(g==="string"?String:Number)(v)}var m=u(4),d=u(28),b=function(v){u(29).TexturePrimitive.call(this,v),this.isTextureSlides=!0;var g=[],w={};this.morph=new m.Group,this.group=this.morph,this.morph.userData=this;var S=!0;this.createSlides=_=>{_.forEach(C=>this.createSlide(C))};var E=(_,C)=>{var I=_.material,T=I.uniforms;switch(_.rotation.x=0,_.rotation.y=0,_.rotation.z=0,_.position.x=0,_.position.y=0,_.position.z=0,C.direction){case"x":var P=S?-Math.PI/2:Math.PI/2;_.rotation.y=P,T.direction.value=1,T.slide.value.set(C.value,0,0),_.position.x=C.value;break;case"y":_.rotation.x=Math.PI/2,T.direction.value=2,T.slide.value.set(0,C.value,0),_.position.y=C.value;break;case"z":T.direction.value=3,T.slide.value.set(0,0,C.value),_.position.z=C.value;break}I.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=_=>{_&&_.id&&_.id in w&&w[_.id]&&E(w[_.id],_)},this.createSlide=_=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&_&&_.direction&&_.value!==void 0){var C=new m.PlaneGeometry(1,1);C.translate(.5,.5,0);var I=d.getUniforms();I.diffuse.value=this.texture.impl,I.depth.value=this.texture.size.depth,I.flipY.value=S;var T={fs:d.fs,vs:d.vs,uniforms:I,glslVersion:d.glslVersion,side:m.DoubleSide,transparent:!1},P=this.texture.getMaterial(T);P.needsUpdate=!0;var A=new m.Mesh(C,P);A.name=this.groupName,A.userData=this;var R={value:_.value,direction:_.direction,id:A.id};return g.push(R),E(A,R),w[A.id]=A,this.morph.add(A),this.boundingBoxUpdateRequired=!0,R}},this.getTextureSettings=()=>[...g],this.getTextureSettingsWithId=_=>{for(var C=0;C<g.length;C++)if(_===g[C].id)return f({},g[C])},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=_=>{_&&this.removeSlideWithId(_.id)},this.removeSlideWithId=_=>{if(this.morph&&_ in w&&w[_]){if(this.morph.getObjectById(_)){var C=w[_];this.morph.remove(C),C.clear(),C.geometry&&C.geometry.dispose(),C.material&&C.material.dispose(),this.boundingBoxUpdateRequired=!0}var I=g.findIndex(T=>T.id===_);-1<I&&g.splice(I,1)}},this.dispose=()=>{this.morph.children.forEach(_=>{_.geometry&&_.geometry.dispose(),_.material&&_.material.dispose()}),u(29).TexturePrimitive.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};var M=(_,C,I)=>{switch(C.direction.value){case 1:I.copy(C.slide.value),_.expandByPoint(I),I.setY(1),I.setZ(1),_.expandByPoint(I);break;case 2:I.copy(C.slide.value),_.expandByPoint(I),I.setX(1),I.setZ(1),_.expandByPoint(I);break;case 3:I.copy(C.slide.value),_.expandByPoint(I),I.setX(1),I.setY(1),_.expandByPoint(I);break}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var _=new m.Vector3(0,0,0);this.morph.children.forEach(C=>{M(this.cachedBoundingBox,C.material.uniforms,_)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(_,C,I)=>{var T=new m.Matrix4;T.set(_[0],_[1],_[2],0,_[3],_[4],_[5],0,_[6],_[7],_[8],0,0,0,0,0);var P=new m.Quaternion().setFromRotationMatrix(T);this.morph.position.set(...C),this.morph.quaternion.copy(P),this.morph.scale.set(...I),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.initialise=(_,C)=>{if(_){var I=_.locations;I&&0<I.length&&(this.applyTransformation(I[0].orientation,I[0].position,I[0].scale),"flipY"in I[0]&&(S=I[0].flipY)),this.createSlides(_.settings.slides),C!=null&&typeof C=="function"&&C(this)}}};b.prototype=Object.create(u(29).TexturePrimitive.prototype),b.prototype.constructor=b,l.TextureSlides=b},(o,l,u)=>{var c=u(4),f=c.GLSL3,h=`
3184
+ `))}}},(o,l,u)=>{var c=u(4),f=u(5).createBufferGeometry,h=u(5).resolveURL,p=0,y=function(){return"pr"+p++},m=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new c.Group,this._lod=new(u(11)).LOD(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new c.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=y(),this._v1=new c.Vector3,this._v2=new c.Vector3,this._b1=new c.Box3,this.center=new c.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1};m.prototype.setDuration=function(d){this.duration=d,this.clipAction&&this.clipAction.setDuration(this.duration)},m.prototype.getDuration=function(){return this.duration},m.prototype.setRegion=function(d){this.region=d},m.prototype.getRegion=function(){return this.region},m.prototype.getMorph=function(){var d=this._lod.getCurrentMorph();return d||this.morph},m.prototype.getGroup=function(){return this.group},m.prototype.setMorph=function(d){this.morph=d,this.group.add(this.morph);var b=this._lod.calculateDistance("far");this._lod.addLevel(d,b),this._lod.setMaterial(d.material)},m.prototype.checkTransparentMesh=function(){},m.prototype.setMesh=function(d,b,v){this.animationGroup=new c.AnimationObjectGroup(d),this.mixer=new c.AnimationMixer(this.animationGroup);var g=d.geometry;if(this.geometry=d.geometry,this.clipAction=void 0,g&&g.morphAttributes){var w=g.morphAttributes.position;w||(w=g.morphAttributes.color?g.morphAttributes.color:g.morphAttributes.normal),w&&(this.animationClip=c.AnimationClip.CreateClipsFromMorphTargetSequences(w,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=c.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=b,this.morphColour=v,d.userData=this,d.matrixAutoUpdate=!1,this.setMorph(d),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(g.setAttribute("morphTarget0",g.getAttribute("position")),g.setAttribute("morphTarget1",g.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},m.prototype.setName=function(d){this.groupName=d,this._lod.setName(d)},m.prototype.getCurrentTime=function(){if(this.clipAction){var d=this.clipAction.time/this.clipAction._clip.duration;return this.duration*d}return this.inbuildTime},m.prototype.setMorphTime=function(d){var b=!1;if(this.clipAction){var v=d/this.duration,g=this.clipAction._clip.duration,w=v*g;w!=this.clipAction.time&&(this.clipAction.time=w,b=!0),b&&this.isTimeVarying()&&this.mixer.update(0)}else{var S=d;S=d>this.duration?this.duration:0>d?0:d,S!=this.inbuildTime&&(this.inbuildTime=S,b=!0)}b&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},m.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},m.prototype.getVisibility=function(){return this.visible},m.prototype.setVisibility=function(d){d!==this.visible&&(this.visible=d,this.group.visible=d,this.region&&(this.region.pickableUpdateRequired=!0))},m.prototype.setAlpha=function(d){var b=this._lod._material,v=!1;1>d&&(v=!0),b.opacity=d,b.transparent=v,this.checkTransparentMesh()},m.prototype.setFrustumCulled=function(d){this._lod.setFrustumCulled(d)},m.prototype.setVertexColors=function(d){this._lod.setVertexColors(d)},m.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},m.prototype.setColour=function(d){this._lod.setColour(d)},m.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},m.prototype.setColourHex=function(d){this._lod._material.color.setHex(d),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(d)},m.prototype.setEmissiveRGB=function(d){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...d),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...d)},m.prototype.setMaterial=function(d){this._lod.setMaterial(d)},m.prototype.getClosestVertexIndex=function(){var d=-1,b=this.getMorph();if(b&&b.geoemtry){var v=b.geometry.attributes.position;if(this._b1.setFromBufferAttribute(v),this._b1.getCenter(this._v1),v)for(var g=-1,w=0,S=0;S<v.count;S++)this._v2.fromArray(v.array,3*S),w=this._v2.distanceTo(this._v1),g==-1?g=w:g>w&&(g=w,d=S)}return d},m.prototype.getClosestVertex=function(d){var b=new c.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());var v=this.getMorph();if(v&&v.geometry&&0<=this.closestVertexIndex){var g=v.morphTargetInfluences,w=v.geometry.morphAttributes;if(g&&w&&w.position){for(var S=!1,E=0;E<g.length;E++)0<g[E]&&(S=!0,this._v1.fromArray(w.position[E].array,3*this.closestVertexIndex),b.add(this._v1.multiplyScalar(g[E])));if(S)return d?b.applyMatrix4(v.matrixWorld):b}else return b.fromArray(v.geometry.attributes.position.array,3*this.closestVertexIndex),d?b.applyMatrix4(v.matrixWorld):b}return this.getBoundingBox(),b.copy(this.center),d?b.applyMatrix4(this.morph.matrixWorld):b},m.prototype.getBoundingBox=function(){if(this.visible){var d=this._lod.getCurrentMorph();if(d&&d.visible)return this.boundingBoxUpdateRequired&&(u(5).getBoundingBox(d,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},m.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},m.prototype.markerIsRequired=function(d){return!!(this.visible&&(this.markerMode==="on"||d&&d.displayMarkers&&this.markerMode==="inherited"))},m.prototype.updateMarker=function(d,b){if(d==!1&&this.markerIsRequired(b)){var v=b.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new(u(14)).Marker(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var g=this.getClosestVertex(!1);g&&(this.marker.setPosition(g.x,g.y,g.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(b.markersList&&!(this.marker.uuid in b.markersList)&&(v=!0,b.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(),b&&b.camera&&(v||b.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(b.camera.cameraObject),b.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),b.markersList&&this.marker.uuid in b.markersList&&(b.markerCluster.markerUpdateRequired=!0,delete b.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},m.prototype.processMarkerVisual=function(d,b){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(d,b)},m.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},m.prototype.setRenderOrder=function(d){this._lod.setRenderOrder(d)},m.prototype.getClosestVertexDOMElementCoords=function(d){if(d&&d.camera){var b=!0,v=this.getClosestVertex(!0);return v.project(d.camera),v.z=Math.min(Math.max(v.z,0),1),(1<v.x||-1>v.x||1<v.y||-1>v.y)&&(b=!1),d.getZincCameraControls().getRelativeCoordsFromNDC(v.x,v.y,v),{position:v,inView:b}}},m.prototype.setMarkerMode=function(d,b){d!==this.markerMode&&(this.markerMode=d==="on"||d==="off"?d:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),b&&(this.markerNumber=b.number,this.markerImgURL=b.imgURL)},m.prototype.render=function(d,b,v,g){if(this.visible&&!(this.timeEnabled&&b)&&this._lod.update(v,this.center),b==!0){if(this.clipAction&&this.isTimeVarying())this.mixer.update(d);else{var w=this.inbuildTime+d;w>this.duration&&(w-=this.duration),this.inbuildTime=w}this.visible&&d!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(b,g)},m.prototype.addLOD=function(d,b,v,g,w){this._lod.addLevelFromURL(d,b,v,g,w)},m.prototype.addVertices=function(d){var b=this.getMorph(),v=void 0;if(!b)v=f(500,d),this.drawRange=d.length;else if(-1<this.drawRange){var g=b.geometry.getAttribute("position");d.forEach(w=>{g.setXYZ(this.drawRange,w[0],w[1],w[2]),++this.drawRange}),g.needsUpdate=!0,b.geometry.setDrawRange(0,this.drawRange),b.geometry.computeBoundingBox(),b.geometry.computeBoundingSphere(),v=b.geoemtry,this.boundingBoxUpdateRequired=!0}return v},m.prototype.setPosition=function(d,b,v){var g=this.getGroup();g&&(g.position.set(d,b,v),g.updateMatrix(),this.boundingBoxUpdateRequired=!0)},m.prototype.loadAdditionalSources=function(d){d.load(h(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},m.prototype.setScaleAll=function(d){var b=this.getGroup();b&&(b.scale.set(d,d,d),b.updateMatrix(),this.boundingBoxUpdateRequired=!0)},l.ZincObject=m},(o,l,u)=>{var c=u(4),f=u(5).updateMorphColorAttribute,h=u(5).toBufferGeometry,p=function(y){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=y,this.addLevel=(d,b)=>{if(d){var v,g=Math.abs(b);for(v=0;v<this.levels.length&&!(g<this.levels[v].distance);v++);this.levels.splice(v,0,{distance:g,morph:d,loaded:!0,loading:!1,url:""}),d.renderOrder=this._renderOrder}},this.levelLoaded=(d,b)=>{if(d){for(var v=Math.abs(b),g=0;g<this.levels.length;g++)if(v===this.levels[g].distance){this._parent.group.add(d),this.levels[g].morph=d,this.levels[g].loaded=!0,this.levels[g].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(d,b,v,g,w)=>{this._loader=d;var S,E=this.calculateDistance(b);for(S=0;S<this.levels.length&&!(E<this.levels[S].distance);S++);this.levels.splice(S,0,{distance:E,morph:void 0,loaded:!1,loading:!1,url:v,index:g}),w&&this.loadLevel(S)},this.loadLevel=d=>{var b=this.levels[d];return b.morph||b.loaded||b.loading||(b.loading=!0,this._loader.load(b.url,this.lodLoader(b.distance),void 0,void 0,{index:b.index})),b.morph===void 0},this.calculateDistance=function(d){this._parent.getBoundingBox();var b=this._parent.radius,v=0;return d==="far"?v=4.5*b:d==="medium"?v=2.5*b:d=="close"&&(v=0),v},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=()=>{var d=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=c.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!d.secondaryMesh&&(d.secondaryMesh=new c.Mesh(d.morph.geometry,this._secondaryMaterial),d.secondaryMesh.renderOrder=d.morph.renderOrder+1,d.secondaryMesh.userData=d.morph.userData,d.secondaryMesh.name=d.morph.name),this._material.side=c.BackSide,this._material.needsUpdate=!0,!d.secondaryMesh.parent&&(d.morph.add(d.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(d.secondaryMesh))):(d.secondaryMesh&&(d.morph.remove(d.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(d.secondaryMesh),this._parent.animationGroup.remove(d.secondaryMesh))),this._material.side=c.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(d=>{d.morph&&d.morph.geometry&&d.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var d=this.levels[this._currentLevel];return d&&d.morph?d.morph:this._parent.morph},this.lodLoader=function(d){return b=>{var v=this._material,g={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},w=h(b,g),S=void 0;this._parent.isGeometry?S=new c.Mesh(w,v):this._parent.isLines&&(S=new(u(12)).LineSegments(w,v)),S.userData=this._parent,S.renderOrder=this._renderOrder,b.dispose(),this.levelLoaded(S,d)}},this.updateMorphColorAttribute=d=>{if(this._material&&(this._material.vertexColors==c.VertexColors||this._material.vertexColors==!0))if(d){var b=this.getCurrentMorph();f(b.geometry,b)}else this.levels.forEach(v=>{v.morph&&v.morph.geometry&&f(v.morph.geometry,v.morph)})},this.setColour=d=>{this._material.color=d,this._secondaryMaterial&&(this._secondaryMaterial.color=d),m()},this.setFrustumCulled=d=>{this.levels.forEach(b=>{b.morph&&(b.morph.frustumCulled=d),b.secondaryMesh&&(b.secondaryMesh.frustumCulled=d)})},this.setMaterial=d=>{d&&(!this._material||this._material.id!==d.id)&&(this._material=d,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=d.clone(),this._secondaryMaterial.side=c.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(b=>{b.morph&&(b.morph.material=this._material,b.morph.geometry&&(b.morph.geometry.colorsNeedUpdate=!0)),b.secondaryMesh&&(b.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=d=>{this.levels.forEach(b=>{b.morph&&(b.morph.name=d),b.secondaryMesh&&(b.secondaryMesh.name=d)})},this.setRenderOrder=d=>{this._renderOrder=d,this.levels.forEach(b=>{b.morph&&(b.morph.renderOrder=d),b.secondaryMesh&&(b.secondaryMesh.renderOrder=d)})},this.setVertexColors=d=>{this._material.vertexColors=d,m(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=d)},this.update=(d,b)=>{var v=this.levels;if(1<v.length){var g,w,S=d.cameraObject.position.distanceTo(b),E=-1,M=-1;for(g=0,w=v.length;g<w&&S>=v[g].distance;g++)v[g].morph?(-1<E&&v[E].morph&&(v[E].morph.visible=!1),E=g,v[g].morph.visible=!0,M=-1):M=g;for(-1<M&&this.loadLevel(M);g<w;g++)v[g].morph&&(-1<E?v[g].morph.visible=!1:(v[g].morph.visible=!0,E=g));this._currentLevel!=E&&(this._currentLevel=E,this.checkTransparentMesh())}},this.toggleMarker=(d,b)=>{this.levels.forEach(v=>{v.morph&&(b?v.morph.add(d):v.morph.remove(d))})};var m=()=>{this.levels.forEach(d=>{d.morph&&d.morph.geometry&&(d.morph.geometry.colorsNeedUpdate=!0)})}};l.LOD=p},(o,l,u)=>{u.r(l),u.d(l,{LineSegments:()=>y});var c=u(13),f=u(4),h=new f.Vector3,p=new f.Vector3;class y extends c.Line{constructor(d,b){super(d,b),this.type="LineSegments"}computeLineDistances(){var d=this.geometry;if(!d.isBufferGeometry)d.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else if(d.index===null){for(var b=d.attributes.position,v=[],g=0,w=b.count;g<w;g+=2)h.fromBufferAttribute(b,g),p.fromBufferAttribute(b,g+1),v[g]=g==0?0:v[g-1],v[g+1]=v[g]+h.distanceTo(p);d.setAttribute("lineDistance",new f.Float32BufferAttribute(v,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}y.prototype.isLineSegments=!0},(o,l,u)=>{u.r(l),u.d(l,{Line:()=>w});var c=u(4),f=new c.Vector3,h=new c.Vector3,p=new c.Matrix4,y=new c.Ray,m=new c.Sphere,d=new c.Vector3,b=new c.Vector3,v=new c.Vector3,g=new c.Vector3;class w extends c.Object3D{constructor(){var M=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new c.BufferGeometry,_=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new c.LineBasicMaterial;super(),this.type="Line",this.geometry=M,this.material=_,this.updateMorphTargets()}copy(M){return super.copy(M),this.material=M.material,this.geometry=M.geometry,this}computeLineDistances(){var M=this.geometry;if(!M.isBufferGeometry)M.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");else if(M.index===null){for(var _=M.attributes.position,C=[0],I=1,T=_.count;I<T;I++)f.fromBufferAttribute(_,I-1),h.fromBufferAttribute(_,I),C[I]=C[I-1],C[I]+=f.distanceTo(h);M.setAttribute("lineDistance",new c.Float32BufferAttribute(C,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(M,_){var C=this.geometry,I=this.matrixWorld,T=M.params.Line.threshold,P=C.drawRange,A=C.morphAttributes.position;if(C.boundingSphere===null&&C.computeBoundingSphere(),m.copy(C.boundingSphere),m.applyMatrix4(I),m.radius+=T,M.ray.intersectsSphere(m)!==!1){p.copy(I).invert(),y.copy(M.ray).applyMatrix4(p);var R=T/((this.scale.x+this.scale.y+this.scale.z)/3),L=R*R,N=new c.Vector3,x=new c.Vector3,O=new c.Vector3,B=new c.Vector3,D=this.isLineSegments?2:1;if(C.isBufferGeometry){var z=C.index,U=C.attributes,H=U.position;if(z!==null)for(var Y=Math.max(0,P.start),ie=Math.min(z.count,P.start+P.count),ae=Y;ae<ie-1;ae+=D){var ee=z.getX(ae),oe=z.getX(ae+1);S(N,x,this,H,A,ee,oe);var j=y.distanceSqToSegment(N,x,B,O);if(!(j>L)){B.applyMatrix4(this.matrixWorld);var K=M.ray.origin.distanceTo(B);K<M.near||K>M.far||_.push({distance:K,point:O.clone().applyMatrix4(this.matrixWorld),index:ae,face:null,faceIndex:null,object:this})}}else for(var $=Math.max(0,P.start),re=Math.min(H.count,P.start+P.count),G=$;G<re-1;G+=D){S(N,x,this,H,A,G,G+1);var W=y.distanceSqToSegment(N,x,B,O);if(!(W>L)){B.applyMatrix4(this.matrixWorld);var F=M.ray.origin.distanceTo(B);F<M.near||F>M.far||_.push({distance:F,point:O.clone().applyMatrix4(this.matrixWorld),index:G,face:null,faceIndex:null,object:this})}}}else C.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var M=this.geometry;if(M.isBufferGeometry){var _=M.morphAttributes,C=Object.keys(_);if(0<C.length){var I=_[C[0]];if(I!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var T,P=0,A=I.length;P<A;P++)T=I[P].name||P+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[T]=P}}}else{var R=M.morphTargets;R!==void 0&&0<R.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function S(E,M,_,C,I,T,P){E.fromBufferAttribute(C,T),M.fromBufferAttribute(C,P);var A=_.morphTargetInfluences;if(_.material.morphTargets&&I&&A){d.set(0,0,0),b.set(0,0,0);for(var R=0,L=I.length;R<L;R++){var N=A[R],x=I[R];N!==0&&(v.fromBufferAttribute(x,T),g.fromBufferAttribute(x,P),d.addScaledVector(v.sub(E),N),b.addScaledVector(g.sub(M),N))}E.add(d),M.add(b)}}w.prototype.isLine=!0},(o,l,u)=>{var c=u(4),f=new Image(128,128);f.src=u(15);var h=new c.Texture;h.image=f,h.needsUpdate=!0;var p=[.02,.03,1],y=new c.SpriteMaterial({map:h,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),m=u(5).createNewSpriteText,d=function(b){u(10).ZincObject.call(this),this.texture=h;var v=void 0,g=void 0,w=void 0,S=void 0,E=void 0,M=!0;this.morph=new c.Group,this.group=this.morph,this.parent=b,this.isMarker=!0;var _=!1;this.ndc=new c.Vector3;var C=void 0,I=void 0,T=()=>{v=new c.Sprite(y),v.center.set(.5,0),this.morph.add(v),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,v.scale.set(p[0],p[1],p[2]),v.userData=this};this.updateVisual=(P,A)=>{var R=1,L=0;P!==A&&(L=1-(this.ndc.z-P)/(A-P),R=.6+.4*L),this.setSpriteSize(R)},this.updateNDC=P=>(this.ndc.copy(this.morph.position),this.ndc.project(P),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(P,A,R)=>{this.morph.position.set(P,A,R)},this.setSpriteSize=P=>{v.scale.set(.015,.02,1),v.scale.multiplyScalar(P)},this.setUserSprite=()=>{S&&(this.morph.add(S),M&&(this.morph.remove(v),I&&this.morph.remove(I),M=!1))},this.setImageForUserSprite=(P,A)=>{S&&(this.morph.remove(S),S=void 0),g&&g.dispose(),w&&w.dispose(),g=new c.Texture,g.image=P,g.needsUpdate=!0,w=new c.SpriteMaterial({map:g,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),A||(A=[.05,.05,1]),S=new c.Sprite(w),S.center.set(.5,0),S.scale.set(A[0],A[1],A[2]),S.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{M||(M=!0,this.morph.add(v),S&&this.morph.remove(S),I&&this.morph.add(I))},this.loadUserSprite=(P,A)=>{if(P)if(P!==E){E=P;var R=new Image(128,128);R.crossOrigin="anonymous",R.onload=()=>{this.setImageForUserSprite(R,A)},R.src=P}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),v&&(v.clear(),v=void 0),I&&(I.material.map.dispose(),I.material.dispose(),I=void 0)},this.isEnabled=()=>_,this.setNumber=P=>{(!P||C!=P)&&I&&(this.morph.remove(I),I.material.map.dispose(),I.material.dispose(),I=void 0),!I&&P&&(I=m(P,.012,"black","Asap",120,700),this.morph.add(I)),C=P},this.getNumber=()=>C||1,this.setVisibility=function(P){P!==this.visible&&(this.visible=P,this.group.visible=P,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{_=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{_=!1,this.morph.visible=!1,this.visible=!1},T()};d.prototype=Object.create(u(10).ZincObject.prototype),l.Marker=d},o=>{o.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="},(o,l,u)=>{var c=u(4),f=function(h,p,y,m){u(10).ZincObject.call(this);var d;p&&(d=p.clone(),d.vertexColors=c.FaceColors),this.id=y;var b=void 0,v=void 0;this.isGlyph=!0;var g=[0,0,0];this.fromMesh=w=>!!(w&&w.isMesh)&&(this.morph=w.clone(),this.morph.userData=this,this.group.add(this.morph),!0),h&&d&&this.fromMesh(new c.Mesh(h,d)),this.getGlyphset=function(){return m},this.setLabel=w=>{w&&(typeof w=="string"||w instanceof String)&&(v=w,this.morph&&(this.morph.name=w))},this.showLabel=w=>{b&&(g=b.getPosition(),this.group.remove(b.getSprite()),b.dispose(),b=void 0),v&&(typeof v=="string"||v instanceof String)&&(b=new(u(17)).Label(v,w),b.setPosition(g[0],g[1],g[2]),this.group.add(b.getSprite()))},this.hideLabel=()=>{b&&(g=b.getPosition(),this.group.remove(b.getSprite()),b.dispose(),b=void 0)},this.getLabel=()=>v,this.getMesh=()=>this.morph,this.setTransformation=(w,S,E,M)=>{this.morph&&(this.morph.matrix.elements[0]=S[0],this.morph.matrix.elements[1]=S[1],this.morph.matrix.elements[2]=S[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=E[0],this.morph.matrix.elements[5]=E[1],this.morph.matrix.elements[6]=E[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=M[0],this.morph.matrix.elements[9]=M[1],this.morph.matrix.elements[10]=M[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=w[0],this.morph.matrix.elements[13]=w[1],this.morph.matrix.elements[14]=w[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),g=[...w],b&&b.setPosition(w[0],w[1],w[2])},this.setColour=w=>{b&&b.setColour(w),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}};f.prototype=Object.create(u(10).ZincObject.prototype),l.Glyph=f},(o,l,u)=>{var c=u(7).default;l.Label=function(f,h){var p=f,y=void 0;y=h?new c(p,.015,h.getStyle()):new c(p,.015),y.fontFace="Asap",y.fontWeight=700,y.material.map.generateMipmaps=!1,y.material.sizeAttenuation=!1,y.center.x=-.05,y.center.y=0,this.getPosition=()=>y?[y.position.x,y.position.y,y.position.z]:[0,0,0],this.setPosition=(m,d,b)=>{y&&y.position.set(m,d,b)},this.setColour=m=>{y.color=m.getStyle()},this.setScale=m=>{y&&0<m&&y.scale.set(m,m,1)},this.dispose=()=>{},this.getSprite=()=>y,this.getString=()=>p}},(o,l,u)=>{var c=u(4),f=u(19).JSONLoader,h=function(){u(10).ZincObject.call(this);var p=[],y=void 0,m=void 0,d=void 0,b=void 0,v=void 0,g=void 0,w=void 0,S=0,E=0,M=[0,0,0],_=[0,0,0],C=[0,0,0],I="NONE";this.ready=!1;var T=!1,P=!1;this.isGlyphset=!0;var A=new c.Matrix4,R=new c.Color,L=new c.Color,N=new c.Box3,x=new c.Box3,O=new c.Box3,B=[],D=[],z=[],U=[],H=[],Y=[],ie=[];this.globalScale=1;for(var ae=0;8>ae;ae++)new c.Vector3;this.load=(G,W,F,X,J)=>{y=G.axis1,m=G.axis2,d=G.axis3,b=G.positions,v=G.scale,g=G.colors,w=G.label,T=G.metadata.MorphColours,P=G.metadata.MorphVertices,S=G.metadata.number_of_time_steps,I=G.metadata.repeat_mode,E=G.metadata.number_of_vertices,I=="AXES_2D"||I=="MIRROR"?E*=2:I=="AXES_3D"&&(E*=3),M=G.metadata.base_size,_=G.metadata.offset,C=G.metadata.scale_factors;var V=new f;this.geometry=new c.BufferGeometry;var k=new c.InstancedMesh(this.geometry,void 0,E);if(this.setMorph(k),X){var te=V.parse(W);re(F,J)(te.geometry,te.materials),te.geometry.dispose()}else V.crossOrigin="Anonymous",V.load(W,re(F,J))};var ee=(G,W,F,X,J,V)=>{if(I=="NONE"||I=="MIRROR"){for(var k,te=[0,0,0],se=[0,0,0],le=[0,0,0],fe=[0,0,0],we=[0,0,0],be=[0,0,0],de=[0,0,0],ye=[0,0,0],ne=[0,0,0],he=0;3>he;he++)k=0>J[he]?-1:1,te[he]=(k*M[he]+J[he]*C[he])*this.globalScale;for(var he=0;3>he;he++)se[he]=W[he]*te[0],le[he]=F[he]*te[1],fe[he]=X[he]*te[2],we[he]=G[he]+_[0]*se[he]+_[1]*le[he]+_[2]*fe[he],I=="MIRROR"&&(be[he]=-se[he],de[he]=-le[he],ye[he]=-fe[he],ne[he]=we[he],0>J[0]&&(we[he]-=se[he],ne[he]-=be[he]));0>fe[0]*(se[1]*le[2]-se[2]*le[1])+fe[1]*(se[2]*le[0]-se[0]*le[2])+fe[2]*(se[0]*le[1]-se[1]*le[0])&&(fe[0]=-fe[0],fe[1]=-fe[1],fe[2]=-fe[2]),V[0]=[we,se,le,fe],I=="MIRROR"&&(0>ye[0]*(be[1]*de[2]-be[2]*de[1])+ye[1]*(be[2]*de[0]-be[0]*de[2])+ye[2]*(be[0]*de[1]-be[1]*de[0])&&(ye[0]=-ye[0],ye[1]=-ye[1],ye[2]=-ye[2]),V[1]=[ne,be,de,ye])}else if(I=="AXES_2D"||I=="AXES_3D"){for(var k,me=[0,0,0],Re=[0,0,0],he=0;3>he;he++)k=0>J[he]?-1:1,me[he]=(k*M[0]+J[he]*C[0])*this.globalScale;for(var he=0;3>he;he++)Re[he]=G[he]+_[0]*me[0]*W[he]+_[1]*me[1]*F[he]+_[2]*me[2]*X[he];for(var Te=glyph_repeat_mode=="AXES_2D"?2:3,De=0;De<Te;De++){var Ye=void 0,ze=void 0,st=J[De],Ce=[0,0,0],He=[0,0,0],Ge=[0,0,0];De==0?(Ye=W,ze=F):De==1?(Ye=F,ze=glyph_repeat_mode=="AXES_2D"?W:X):(Ye=X,ze=W);var Ot=(M[0]+st*C[0])*this.globalScale;Ce[0]=Ye[0]*Ot,Ce[1]=Ye[1]*Ot,Ce[2]=Ye[2]*Ot,Ge[0]=Ce[1]*ze[2]-ze[1]*Ce[2],Ge[1]=Ce[2]*ze[0]-ze[2]*Ce[0],Ge[2]=Ce[0]*ze[1]-Ce[1]*ze[0];var Nt=Math.sqrt(Ge[0]*Ge[0]+Ge[1]*Ge[1]+Ge[2]*Ge[2]);if(0<Nt){var mt=(M[2]+st*C[2])*this.globalScale/Nt;I=="AXES_2D"&&0<De&&(mt*=-1),Ge[0]*=mt,Ge[1]*=mt,Ge[2]*=mt}if(He[0]=Ge[1]*Ce[2]-Ce[1]*Ge[2],He[1]=Ge[2]*Ce[0]-Ce[2]*Ge[0],He[2]=Ge[0]*Ce[1]-Ge[1]*Ce[0],Nt=Math.sqrt(He[0]*He[0]+He[1]*He[1]+He[2]*He[2]),0<Nt){var xt=(M[1]+st*C[1])*this.globalScale/Nt;He[0]*=xt,He[1]*=xt,He[2]*=xt}V[De]=[Re,Ce,He,Ge]}}return V},oe=(G,W,F,X,J)=>{var V=1;I=="AXES_2D"||I=="MIRROR"?V=2:I=="AXES_3D"&&(V=3);var k=G.length/3,te=0;ie.length=V;for(var se=0;se<k;se++){var le=3*se,fe=[G[le],G[le+1],G[le+2]],we=[W[le],W[le+1],W[le+2]],be=[F[le],F[le+1],F[le+2]],de=[X[le],X[le+1],X[le+2]],ye=[J[le],J[le+1],J[le+2]],ne=ee(fe,we,be,de,ye,ie);if(ne.length==V)for(var he=0;he<V;he++){A.elements[0]=ne[he][1][0],A.elements[1]=ne[he][1][1],A.elements[2]=ne[he][1][2],A.elements[3]=0,A.elements[4]=ne[he][2][0],A.elements[5]=ne[he][2][1],A.elements[6]=ne[he][2][2],A.elements[7]=0,A.elements[8]=ne[he][3][0],A.elements[9]=ne[he][3][1],A.elements[10]=ne[he][3][2],A.elements[11]=0,A.elements[12]=ne[he][0][0],A.elements[13]=ne[he][0][1],A.elements[14]=ne[he][0][2],A.elements[15]=1,this.morph.setMatrixAt(te,A);var me=p[te];me&&me.setTransformation(ne[he][0],ne[he][1],ne[he][2],ne[he][3]),te++}}this.morph.instanceMatrix.needsUpdate=!0},j=G=>{var W=1;I=="AXES_2D"||I=="MIRROR"?W=2:I=="AXES_3D"&&(W=3);for(var F,X=G.length,J=0,V=0;V<X;V++){F=G[V];for(var k=0;k<W;k++){R.setHex(F),this.morph.setColorAt(J,R);var te=p[J];te&&te.setColour(R),J++}}this.morph.instanceColor.needsUpdate=!0},K=()=>{var G=B,W=D,F=z,X=U,J=H,V=Y,k=this.inbuildTime/this.duration*(S-1),te=Math.floor(k),se=1-(k-te),le=Math.ceil(k);if(P){var fe=b[te.toString()],we=b[le.toString()],be=y[te.toString()],de=y[le.toString()],ye=m[te.toString()],ne=m[le.toString()],he=d[te.toString()],me=d[le.toString()],Re=v[te.toString()],Te=v[le.toString()];B.length=fe.length,D.length=fe.length,z.length=fe.length,U.length=fe.length,H.length=fe.length;for(var De=0;De<fe.length;De++)G[De]=se*fe[De]+(1-se)*we[De],W[De]=se*be[De]+(1-se)*de[De],F[De]=se*ye[De]+(1-se)*ne[De],X[De]=se*he[De]+(1-se)*me[De],J[De]=se*Re[De]+(1-se)*Te[De]}else G=b[0],W=y[0],F=m[0],X=d[0],J=v[0];if(oe(G,W,F,X,J),this.boundingBoxUpdateRequired=!0,g!=null){if(T){var Ye=g[te.toString()],ze=g[le.toString()];V.length=Ye.length;for(var st=0;st<Ye.length;st++)R.setHex(Ye[st]),L.setHex(ze[st]),R.setRGB(R.r*se+L.r*(1-se),R.g*se+L.g*(1-se),R.b*se+L.b*(1-se)),V[st]=R.getHex()}else V=g[0];j(V)}};this.showLabel=()=>{for(var G=0;G<p.length;G++)p[G].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var G=0;G<p.length;G++)p[G].hideLabel()};var $=G=>{for(var W=0;W<E;W++){var F=new(u(16)).Glyph(void 0,void 0,W,this),X=w?w[W]:void 0;X=X||this.groupName,X&&F.setLabel(X),0<S&&F.setFrustumCulled(!1),p[W]=F,this.morph.add(F.getGroup())}G&&this.showLabel(),oe(b[0],y[0],m[0],d[0],v[0]),g!=null&&j(g[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=G=>{G.isGlyph&&p.push(G),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(G,W)=>{if(G.isMesh){var F=new(u(16)).Glyph(void 0,void 0,W,this);return F.fromMesh(G),p.push(F),this.morph.add(F.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,F}},this.forEachGlyph=G=>{for(var W=0;W<p.length;W++)G(p[W])};var re=(G,W)=>(F,X)=>{var J=F.toBufferGeometry();this.geometry.copy(J),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),J.dispose(),X&&X[0]&&(this.morph.material=X[0]),$(W),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),F.dispose(),G!=null&&typeof G=="function"&&G(this)};this.getClosestVertexIndex=function(){var G=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var W,F=b[0],X=F.length/3,J=-1,V=0,k=0;k<X;k++)W=3*k,this._v2.set(F[W],F[W+1],F[W+2]),V=this._v1.distanceTo(this._v2),(J==-1||J>V)&&(J=V,G=k)}return G},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph){var G=new c.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,A),G.setFromMatrixPosition(A),G}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){N.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var G=0;G<E;G++)this.morph.getMatrixAt(G,A),x.copy(N).applyMatrix4(A),G==0?O.copy(x):O.union(x);if(O)this.cachedBoundingBox.copy(O),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=G=>{this.inbuildTime=G>this.duration?this.duration:0>G?0:G,(T||P)&&(K(),P&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||0<S)&&(T||P)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(G){this.globalScale=G,K()},this.dispose=()=>{for(var G=p.length-1;0<=G;G--)p[G].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),y=void 0,m=void 0,d=void 0,b=void 0,v=void 0,g=void 0,this.ready=!1,this.groupName=void 0},this.render=(G,W,F)=>{if(W==!0){var X=this.inbuildTime+G;X>this.duration&&(X-=this.duration),this.inbuildTime=X,(T||P)&&K()}this.updateMarker(W,F)}};h.prototype=Object.create(u(10).ZincObject.prototype),l.Glyphset=h},(o,l,u)=>{u.r(l),u.d(l,{JSONLoader:()=>M});var c=u(4),f=u(20).Loader,h=c.LoaderUtils,p=c.AnimationClip,y=c.Vector3,m=c.Vector4,d=c.Color,b=c.Vector2,v=u(6).Face3,g=u(6).Geometry,w=c.FileLoader,S=c.DefaultLoadingManager,E=u(21).VideoHandler;function M(_){typeof _=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),_=void 0),this.manager=_===void 0?S:_,this.withCredentials=!1,this.paramsString=""}Object.assign(M.prototype,{load:function(C,I,T,P){var A=this,R=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:h.extractUrlBase(C),L=new w(this.manager);C.split("?"),this.paramsString=C.length===2?paramsStrings[1]:"",L.setWithCredentials(this.withCredentials),L.load(C,function(N){var x;try{x=JSON.parse(N)}catch{if(console.error("The loader has encountered an error while parsing the content of a resource."),P)return void P({responseURL:C})}var O=x.metadata;if(O!==void 0){var B=O.type;if(B!==void 0&&B.toLowerCase()==="object")return void console.error("THREE.JSONLoader: "+C+" should be loaded with THREE.ObjectLoader instead.")}if(A&&A.parse){var D=A.parse(x,R);I(D.geometry,D.materials)}},T,P)},setTexturePath:function(C){this.texturePath=C},parse:function(){function _(P,A){function R(he,me){return he&1<<me}var L,N,x,O,B,D,z,U,H,Y,ie,ae,ee,oe,j,K,$,re,G,W,F,X,J,V,k,te,se,le=P.faces,fe=P.vertices,we=P.normals,be=P.colors,de=P.scale,ye=0;if(P.uvs!==void 0){for(L=0;L<P.uvs.length;L++)P.uvs[L].length&&ye++;for(L=0;L<ye;L++)A.faceVertexUvs[L]=[]}for(O=0,B=fe.length;O<B;)re=new y,re.x=fe[O++]*de,re.y=fe[O++]*de,re.z=fe[O++]*de,A.vertices.push(re);if(O=0,B=le.length,P.uvs)for(L=0;L<P.uvs.length;L++){A.uvs[L]=[];for(var ne=0;ne<P.uvs[L].length;ne++)A.uvs[L][ne]=P.uvs[L][ne]}if(we)for(L=0;L<we.length;L++)A.normals[L]=we[L];if(be)for(L=0;L<be.length;L++)A.colors[L]=be[L];for(;O<B;)if(Y=le[O++],ie=R(Y,0),ae=R(Y,1),ee=R(Y,3),oe=R(Y,4),j=R(Y,5),K=R(Y,6),$=R(Y,7),ie){if(W=new v,W.a=le[O],W.b=le[O+1],W.c=le[O+3],F=new v,F.a=le[O+1],F.b=le[O+2],F.c=le[O+3],O+=4,ae&&(H=le[O++],W.materialIndex=H,F.materialIndex=H),x=A.faces.length,ee)for(L=0;L<ye;L++)for(V=P.uvs[L],A.faceVertexUvs[L][x]=[],A.faceVertexUvs[L][x+1]=[],N=0;4>N;N++)U=le[O++],te=V[2*U],se=V[2*U+1],k=new b(te,se),N!==2&&A.faceVertexUvs[L][x].push(k),N!==0&&A.faceVertexUvs[L][x+1].push(k);if(oe&&(z=3*le[O++],W.normal.set(we[z++],we[z++],we[z]),F.normal.copy(W.normal)),j)for(L=0;4>L;L++)z=3*le[O++],J=new y(we[z++],we[z++],we[z]),L!==2&&W.vertexNormals.push(J),L!==0&&F.vertexNormals.push(J);if(K&&(D=le[O++],X=be[D],W.color.setHex(X),F.color.setHex(X)),$)for(L=0;4>L;L++)D=le[O++],X=be[D],L!==2&&W.vertexColors.push(new d(X)),L!==0&&F.vertexColors.push(new d(X));A.faces.push(W),A.faces.push(F)}else{if(G=new v,G.a=le[O++],G.b=le[O++],G.c=le[O++],ae&&(H=le[O++],G.materialIndex=H),x=A.faces.length,ee)for(L=0;L<ye;L++)for(V=P.uvs[L],A.faceVertexUvs[L][x]=[],N=0;3>N;N++)U=le[O++],te=V[2*U],se=V[2*U+1],k=new b(te,se),A.faceVertexUvs[L][x].push(k);if(oe&&(z=3*le[O++],G.normal.set(we[z++],we[z++],we[z])),j)for(L=0;3>L;L++)z=3*le[O++],J=new y(we[z++],we[z++],we[z]),G.vertexNormals.push(J);if(K&&(D=le[O++],G.color.setHex(be[D])),$)for(L=0;3>L;L++)D=le[O++],G.vertexColors.push(new d(be[D]));A.faces.push(G)}}function C(P,A){var R=P.influencesPerVertex===void 0?2:P.influencesPerVertex;if(P.skinWeights)for(var L=0,N=P.skinWeights.length;L<N;L+=R){var x=P.skinWeights[L],O=1<R?P.skinWeights[L+1]:0,B=2<R?P.skinWeights[L+2]:0,D=3<R?P.skinWeights[L+3]:0;A.skinWeights.push(new m(x,O,B,D))}if(P.skinIndices)for(var L=0,N=P.skinIndices.length;L<N;L+=R){var z=P.skinIndices[L],U=1<R?P.skinIndices[L+1]:0,H=2<R?P.skinIndices[L+2]:0,Y=3<R?P.skinIndices[L+3]:0;A.skinIndices.push(new m(z,U,H,Y))}A.bones=P.bones,A.bones&&0<A.bones.length&&(A.skinWeights.length!==A.skinIndices.length||A.skinIndices.length!==A.vertices.length)&&console.warn("When skinning, number of vertices ("+A.vertices.length+"), skinIndices ("+A.skinIndices.length+"), and skinWeights ("+A.skinWeights.length+") should match.")}function I(P,A){var R=P.scale;if(P.morphTargets!==void 0)for(var L=0,N=P.morphTargets.length;L<N;L++){A.morphTargets[L]={},A.morphTargets[L].name=P.morphTargets[L].name,A.morphTargets[L].vertices=[];for(var x,O=A.morphTargets[L].vertices,B=P.morphTargets[L].vertices,D=0,z=B.length;D<z;D+=3)x=new y,x.x=B[D]*R,x.y=B[D+1]*R,x.z=B[D+2]*R,O.push(x)}if(P.morphNormals!==void 0){for(var L=0,N=P.morphNormals.length;L<N;L++)if(A.morphTargets[L]){A.morphTargets[L].normals=[];for(var U,H=A.morphTargets[L].normals,Y=P.morphNormals[L].normals,D=0,z=Y.length;D<z;D+=3)U=new y,U.x=Y[D],U.y=Y[D+1],U.z=Y[D+2],H.push(U);A.morphNormalsReady=!0}}if(P.morphColors!==void 0){var L,N,ie,ae,ee,oe,j;for(L=0,N=P.morphColors.length;L<N;L++)for(A.morphColors[L]={},A.morphColors[L].name=P.morphColors[L].name,A.morphColors[L].colors=[],ee=A.morphColors[L].colors,oe=P.morphColors[L].colors,ie=0,ae=oe.length;ie<ae;ie+=3)j=new c.Color(16755200),j.setRGB(oe[ie],oe[ie+1],oe[ie+2]),ee.push(j)}}function T(P,A){var R=[],L=[];P.animation!==void 0&&L.push(P.animation),P.animations!==void 0&&(P.animations.length?L=L.concat(P.animations):L.push(P.animations));for(var N,x=0;x<L.length;x++)N=p.parseAnimation(L[x],A.bones),N&&R.push(N);if(A.morphTargets){var O=p.CreateClipsFromMorphTargetSequences(A.morphTargets,10);R=R.concat(O)}0<R.length&&(A.animations=R)}return function(P,A){P.data!==void 0&&(P=P.data),P.scale=P.scale===void 0?1:1/P.scale;var R=new g;if(R.morphColors=[],_(P,R),C(P,R),I(P,R),T(P,R),R.computeFaceNormals(),R.computeBoundingSphere(),P.materials===void 0||P.materials.length===0)return{geometry:R};var L=f.prototype.initMaterials(P.materials,A,"Anonymous");if(P.materials[0].video){var N=A+P.materials[0].video;this.paramsString&&(N+="?".concat(this.paramsString));var x=new E(N);R._video=x}return L&&0<L.length&&(L[0].side=P.materials[0].singleSided?c.FrontSide:P.materials[0].flipSided?c.BackSide:c.DoubleSide,P.materials[0].specularCoef&&(L[0].shininess=Math.floor(P.materials[0].specularCoef/3))),{geometry:R,materials:L}}}()})},(o,l,u)=>{u.r(l),u.d(l,{Loader:()=>f});var c=u(4);u(4);function f(){}f.Handlers={handlers:[],add:function(p,y){this.handlers.push(p,y)},get:function(p){for(var y=this.handlers,m=0,d=y.length;m<d;m+=2){var b=y[m],v=y[m+1];if(b.test(p))return v}return null}},Object.assign(f.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(p,y,m){for(var d=[],b=0;b<p.length;++b)d[b]=this.createMaterial(p[b],y,m);return d},createMaterial:function(){var h={NoBlending:c.NoBlending,NormalBlending:c.NormalBlending,AdditiveBlending:c.AdditiveBlending,SubtractiveBlending:c.SubtractiveBlending,MultiplyBlending:c.MultiplyBlending,CustomBlending:c.CustomBlending},p=new c.Color,y=new c.TextureLoader,m=new c.MaterialLoader;return function(d,b,v){function g(_,C,I,T,P){var A,R=b+_,L=f.Handlers.get(R);L===null?(y.setCrossOrigin(v),A=y.load(R)):A=L.load(R),C!==void 0&&(A.repeat.fromArray(C),C[0]!==1&&(A.wrapS=c.RepeatWrapping),C[1]!==1&&(A.wrapT=c.RepeatWrapping)),I!==void 0&&A.offset.fromArray(I),T!==void 0&&(T[0]==="repeat"&&(A.wrapS=c.RepeatWrapping),T[0]==="mirror"&&(A.wrapS=c.MirroredRepeatWrapping),T[1]==="repeat"&&(A.wrapT=c.RepeatWrapping),T[1]==="mirror"&&(A.wrapT=c.MirroredRepeatWrapping)),P!==void 0&&(A.anisotropy=P);var N=c.MathUtils.generateUUID();return w[N]=A,N}var w={},S={uuid:c.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var E in d){var M=d[E];switch(E){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":S.name=M;break;case"blending":S.blending=h[M];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",E,"is no longer supported.");break;case"colorDiffuse":S.color=p.fromArray(M).getHex();break;case"colorSpecular":S.specular=p.fromArray(M).getHex();break;case"colorEmissive":S.emissive=p.fromArray(M).getHex();break;case"specularCoef":S.shininess=M;break;case"shading":M.toLowerCase()==="basic"&&(S.type="MeshBasicMaterial"),M.toLowerCase()==="phong"&&(S.type="MeshPhongMaterial"),M.toLowerCase()==="standard"&&(S.type="MeshStandardMaterial");break;case"mapDiffuse":S.map=g(M,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":S.emissiveMap=g(M,d.mapEmissiveRepeat,d.mapEmissiveOffset,d.mapEmissiveWrap,d.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":S.lightMap=g(M,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":S.aoMap=g(M,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":S.bumpMap=g(M,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case"mapBumpScale":S.bumpScale=M;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":S.normalMap=g(M,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);break;case"mapNormalFactor":S.normalScale=M;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":S.specularMap=g(M,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":S.metalnessMap=g(M,d.mapMetalnessRepeat,d.mapMetalnessOffset,d.mapMetalnessWrap,d.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":S.roughnessMap=g(M,d.mapRoughnessRepeat,d.mapRoughnessOffset,d.mapRoughnessWrap,d.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":S.alphaMap=g(M,d.mapAlphaRepeat,d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":S.side=c.BackSide;break;case"doubleSided":S.side=c.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),S.opacity=M;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":S[E]=M;break;case"vertexColors":M===!0&&(S.vertexColors=c.VertexColors),M==="face"&&(S.vertexColors=c.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",E,M)}}return S.type==="MeshBasicMaterial"&&delete S.emissive,S.type!=="MeshPhongMaterial"&&delete S.specular,1>S.opacity&&(S.transparent=!0),m.setTextures(w),m.parse(S)}}()})},(o,l,u)=>{var c=u(4);l.VideoHandler=function(f){var h=this;this.video=void 0,this.videoTexture=void 0,this.setMorphTime=function(p,y){var m=p/y*h.video.duration;h.video.currentTime=m},this.getVideoDuration=function(){return h.video.duration},this.createCanvasVideoTexture=function(){return h.videoTexture=new c.VideoTexture(h.video),h.videoTexture.minFilter=c.LinearFilter,h.videoTexture.magFilter=c.LinearFilter,h.videoTexture.format=c.RGBFormat,h.video.currentTime=0,h.videoTexture},this.getCurrentTime=function(p){return h.video?p*(h.video.currentTime/h.video.duration):0},this.isReadyToPlay=function(){return!!(h.video&&3<=h.video.readyState)},function(){document&&(h.video=document.createElement("video"),h.video.crossOrigin="anonymous",h.video.src=f,h.video.load(),h.video.loop=!0)}()}},(o,l,u)=>{var c=u(4),f=u(23).Points,h=u(5).toBufferGeometry,p=u(5).getCircularTexture,y=u(17).Label,m=function(){u(10).ZincObject.call(this),this.isPointset=!0;var d=[];this.createMesh=(v,g,w)=>{if(v&&g){var S=h(v,w),E=p();g.map=E;var M=new f(S,g);this.setMesh(M,w.localTimeEnabled,w.localMorphColour)}};var b=(v,g,w,S)=>{if(w){var E=new c.Color(S),M=new y(w,E);M.setPosition(g[0],g[1],g[2]);var _=M.getSprite();_.material.sizeAttenuation=!1,_.material.alphaTest=.5,_.material.transparent=!0,_.material.depthWrite=!1,_.material.depthTest=!1,this.group.add(_),d[v]=M}};this.addPoints=(v,g,w)=>{if(v&&0<v.length){var S=this.drawRange-1,E=this.addVertices(v),M=this.getMorph();if(!M){var _=new c.PointsMaterial({alphaTest:.5,size:10,color:w,sizeAttenuation:!1});E.colorsNeedUpdate=!0,this.createMesh(E,_,{localTimeEnabled:!1,localMorphColour:!1})}var C=S+v.length,I=0;if(Array.isArray(g)&&g.length===v.length||typeof g=="string")for(S;S+I<C;){var T=typeof g=="string"?g:g[I];b(I,v[I],T,w),I++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setSize=v=>{this.morph&&this.morph.material&&(this.morph.material.size=v,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=v=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=v,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(v){if(0<=v&&this.drawRange>v){var g=this.getMorph().geometry.getAttribute("position");return[g.getX(v),g.getY(v),g.getZ(v)]}},this.editVertices=function(v,g){if(v&&v.length){var w=this.getMorph(),S=g+v.length-1;if(!w||0>g||S>=this.drawRange)return;var E=w.geometry.getAttribute("position"),M=g;v.forEach(_=>{var C=d[M];C&&C.setPosition(_[0],_[1],_[2]),E.setXYZ(M++,_[0],_[1],_[2])}),E.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(v,g,w,S)=>{this.morph&&w&&(this.morph.sizePerPixel=w.pixelHeight),m.prototype.render.call(this,v,g,w,S)}};m.prototype=Object.create(u(10).ZincObject.prototype),l.Pointset=m},(o,l,u)=>{u.r(l),u.d(l,{Points:()=>b});var c=u(4),f=new c.Matrix4,h=new c.Ray,p=new c.Sphere,y=new c.Vector3,m=new c.Vector3,d=new c.Vector3;class b extends c.Object3D{constructor(){var S=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new c.BufferGeometry,E=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new c.PointsMaterial;super(),this.type="Points",this.geometry=S,this.material=E,this.sizePerPixel=1,this.updateMorphTargets()}copy(S){return super.copy(S),this.material=S.material,this.geometry=S.geometry,this}raycast(S,E){var M=this.geometry,_=this.matrixWorld,C=S.params.Points.threshold,I=M.drawRange;if(M.boundingSphere===null&&M.computeBoundingSphere(),p.copy(M.boundingSphere),p.applyMatrix4(_),p.radius+=C,S.ray.intersectsSphere(p)!==!1){f.copy(_).invert(),h.copy(S.ray).applyMatrix4(f);var T=C/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,P=T*T;if(M.isBufferGeometry){var A=M.index,R=M.attributes,L=R.position,N=M.morphAttributes.position;if(A!==null)for(var x,O=Math.max(0,I.start),B=Math.min(A.count,I.start+I.count),D=O;D<B;D++)x=A.getX(D),g(this,L,N,x),v(y,x,P,_,S,E,this);else for(var z=Math.max(0,I.start),U=Math.min(L.count,I.start+I.count),H=z;H<U;H++)g(this,L,N,H),v(y,H,P,_,S,E,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var S=this.geometry;if(S.isBufferGeometry){var E=S.morphAttributes,M=Object.keys(E);if(0<M.length){var _=E[M[0]];if(_!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var C,I=0,T=_.length;I<T;I++)C=_[I].name||I+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[C]=I}}}else{var P=S.morphTargets;P!==void 0&&0<P.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}b.prototype.isPoints=!0;function v(w,S,E,M,_,C,I){var T=h.distanceSqToPoint(w);if(T<E){var P=new c.Vector3;h.closestPointToPoint(w,P),P.applyMatrix4(M);var A=_.ray.origin.distanceTo(P);if(A<_.near||A>_.far)return;C.push({distance:A,distanceToRay:Math.sqrt(T),point:P,index:S,face:null,object:I})}}function g(w,S,E,M){y.fromBufferAttribute(S,M);var _=w.morphTargetInfluences;if(w.material.morphTargets&&E&&_){m.set(0,0,0);for(var C=0,I=E.length;C<I;C++){var T=_[C],P=E[C];T!==0&&(d.fromBufferAttribute(P,M),m.addScaledVector(d.sub(y),T))}y.add(m)}}},(o,l,u)=>{var c=u(4),f=u(5).toBufferGeometry,h=function(){u(10).ZincObject.call(this),this.isLines=!0,this.createLineSegment=(p,y,m)=>{if(p&&y){var d=f(p,m);m.localMorphColour&&d.morphAttributes.color&&(y.onBeforeCompile=u(9).augmentMorphColor());var b=new(u(12)).LineSegments(d,y);this.setMesh(b,m.localTimeEnabled,m.localMorphColour)}},this.setWidth=p=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=p,this.morph.material.needsUpdate=!0)},this.addLines=(p,y)=>{if(p&&0<p.length){var m=this.addVertices(p),d=this.getMorph();if(!d){var b=new c.LineBasicMaterial({color:y});m.colorsNeedUpdate=!0,this.createLineSegment(m,b,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};h.prototype=Object.create(u(10).ZincObject.prototype),l.Lines=h},(o,l,u)=>{function c(y,m,d,b,v,g,w){try{var S=y[g](w),E=S.value}catch(M){return void d(M)}S.done?m(E):Promise.resolve(E).then(b,v)}function f(y){return function(){var m=this,d=arguments;return new Promise(function(b,v){function g(E){c(S,b,v,g,w,"next",E)}function w(E){c(S,b,v,g,w,"throw",E)}var S=y.apply(m,d);g(void 0)})}}var h=u(4),p=function(){var y=this;u(26).Texture.call(this),this.isTextureArray=!0,this.loadFromImages=function(){var m=f(function*(d){var b=1,v=1,g=0;if(d&&d.length){y.isLoading=!0;var w=new Image;w.crossOrigin="Anonymous";for(var S,E=document.createElement("canvas"),M=0,_=Array(d.length),C=0;C<d.length;C++)S=yield y.imageToUint8Array(y,w,d[C],E),S&&S.array&&(b=S.width,v=S.height,_[g]=S.array,M+=_[g].length,g++);var I=new Uint8Array(M);M=0,_.forEach(T=>{I.set(T,M),M+=T.length}),y.impl=new h.DataTexture2DArray(I,b,v,g),y.size={width:b,height:v,depth:g},y.isLoading=!1,y.impl.needsUpdate=!0}});return function(){return m.apply(this,arguments)}}(),this.getMaterial=m=>{if(this.impl){var d;if(!m)d=new h.MeshBasicMaterial({color:new h.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:h.DoubleSide});else if(m.vs&&m.fs){var b=!0;m.transparent&&(b=m.transparent);var v=h.FrontSide;m.side&&(v=m.side),d=new h.ShaderMaterial({transparent:b,uniforms:m.uniforms,vertexShader:m.vs,fragmentShader:m.fs,side:v}),m.glslVersion&&(d.glslVersion=m.glslVersion)}if(d)return d.needsUpdate=!0,d}}};p.prototype=Object.create(u(26).Texture.prototype),l.TextureArray=p},(o,l,u)=>{function c(y,m,d,b,v,g,w){try{var S=y[g](w),E=S.value}catch(M){return void d(M)}S.done?m(E):Promise.resolve(E).then(b,v)}function f(y){return function(){var m=this,d=arguments;return new Promise(function(b,v){function g(E){c(S,b,v,g,w,"next",E)}function w(E){c(S,b,v,g,w,"throw",E)}var S=y.apply(m,d);g(void 0)})}}var h=u(4),p=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};p.prototype.loadImage=function(y,m){return new Promise((d,b)=>{y.onload=()=>d(y),y.onerror=b,y.src=m})},p.prototype.imageToUint8Array=function(){var y=f(function*(m,d,b,v){yield m.loadImage(d,b),v.width=d.width,v.height=d.height;var g=v.getContext("2d");return g.drawImage(d,0,0),{array:new Uint8Array(g.getImageData(0,0,v.width,v.height).data.buffer),width:v.width,height:v.height}});return function(){return y.apply(this,arguments)}}(),p.prototype.loadFromImages=function(){var y=f(function*(){});return function(){return y.apply(this,arguments)}}(),p.prototype.isReady=function(){return!(!this.impl||this.isLoading)},p.prototype.getMaterial=function(){if(this.impl)return new h.MeshBasicMaterial({color:new h.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:h.DoubleSide})},l.Texture=p},(o,l,u)=>{function c(v,g){var w=Object.keys(v);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(v);g&&(S=S.filter(function(E){return Object.getOwnPropertyDescriptor(v,E).enumerable})),w.push.apply(w,S)}return w}function f(v){for(var g,w=1;w<arguments.length;w++)g=arguments[w]==null?{}:arguments[w],w%2?c(Object(g),!0).forEach(function(S){h(v,S,g[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(g)):c(Object(g)).forEach(function(S){Object.defineProperty(v,S,Object.getOwnPropertyDescriptor(g,S))});return v}function h(v,g,w){return g=p(g),g in v?Object.defineProperty(v,g,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[g]=w,v}function p(v){var g=y(v,"string");return typeof g=="symbol"?g:g+""}function y(v,g){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var S=w.call(v,g||"default");if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(g==="string"?String:Number)(v)}var m=u(4),d=u(28),b=function(v){u(29).TexturePrimitive.call(this,v),this.isTextureSlides=!0;var g=[],w={};this.morph=new m.Group,this.group=this.morph,this.morph.userData=this;var S=!0;this.createSlides=_=>{_.forEach(C=>this.createSlide(C))};var E=(_,C)=>{var I=_.material,T=I.uniforms;switch(_.rotation.x=0,_.rotation.y=0,_.rotation.z=0,_.position.x=0,_.position.y=0,_.position.z=0,C.direction){case"x":var P=S?-Math.PI/2:Math.PI/2;_.rotation.y=P,T.direction.value=1,T.slide.value.set(C.value,0,0),_.position.x=C.value;break;case"y":_.rotation.x=Math.PI/2,T.direction.value=2,T.slide.value.set(0,C.value,0),_.position.y=C.value;break;case"z":T.direction.value=3,T.slide.value.set(0,0,C.value),_.position.z=C.value;break}I.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=_=>{_&&_.id&&_.id in w&&w[_.id]&&E(w[_.id],_)},this.createSlide=_=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&_&&_.direction&&_.value!==void 0){var C=new m.PlaneGeometry(1,1);C.translate(.5,.5,0);var I=d.getUniforms();I.diffuse.value=this.texture.impl,I.depth.value=this.texture.size.depth,I.flipY.value=S;var T={fs:d.fs,vs:d.vs,uniforms:I,glslVersion:d.glslVersion,side:m.DoubleSide,transparent:!1},P=this.texture.getMaterial(T);P.needsUpdate=!0;var A=new m.Mesh(C,P);A.name=this.groupName,A.userData=this;var R={value:_.value,direction:_.direction,id:A.id};return g.push(R),E(A,R),w[A.id]=A,this.morph.add(A),this.boundingBoxUpdateRequired=!0,R}},this.getTextureSettings=()=>[...g],this.getTextureSettingsWithId=_=>{for(var C=0;C<g.length;C++)if(_===g[C].id)return f({},g[C])},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=_=>{_&&this.removeSlideWithId(_.id)},this.removeSlideWithId=_=>{if(this.morph&&_ in w&&w[_]){if(this.morph.getObjectById(_)){var C=w[_];this.morph.remove(C),C.clear(),C.geometry&&C.geometry.dispose(),C.material&&C.material.dispose(),this.boundingBoxUpdateRequired=!0}var I=g.findIndex(T=>T.id===_);-1<I&&g.splice(I,1)}},this.dispose=()=>{this.morph.children.forEach(_=>{_.geometry&&_.geometry.dispose(),_.material&&_.material.dispose()}),u(29).TexturePrimitive.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};var M=(_,C,I)=>{switch(C.direction.value){case 1:I.copy(C.slide.value),_.expandByPoint(I),I.setY(1),I.setZ(1),_.expandByPoint(I);break;case 2:I.copy(C.slide.value),_.expandByPoint(I),I.setX(1),I.setZ(1),_.expandByPoint(I);break;case 3:I.copy(C.slide.value),_.expandByPoint(I),I.setX(1),I.setY(1),_.expandByPoint(I);break}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var _=new m.Vector3(0,0,0);this.morph.children.forEach(C=>{M(this.cachedBoundingBox,C.material.uniforms,_)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(_,C,I)=>{var T=new m.Matrix4;T.set(_[0],_[1],_[2],0,_[3],_[4],_[5],0,_[6],_[7],_[8],0,0,0,0,0);var P=new m.Quaternion().setFromRotationMatrix(T);this.morph.position.set(...C),this.morph.quaternion.copy(P),this.morph.scale.set(...I),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.initialise=(_,C)=>{if(_){var I=_.locations;I&&0<I.length&&(this.applyTransformation(I[0].orientation,I[0].position,I[0].scale),"flipY"in I[0]&&(S=I[0].flipY)),this.createSlides(_.settings.slides),C!=null&&typeof C=="function"&&C(this)}}};b.prototype=Object.create(u(29).TexturePrimitive.prototype),b.prototype.constructor=b,l.TextureSlides=b},(o,l,u)=>{var c=u(4),f=c.GLSL3,h=`
3185
3185
  precision highp float;
3186
3186
  precision highp int;
3187
3187
  precision highp sampler2DArray;
@@ -3228,7 +3228,7 @@ void main() {
3228
3228
  `)!==-1&&(M=M.replace(/\r\n/g,`
3229
3229
  `)),M.indexOf(`\\
3230
3230
  `)!==-1&&(M=M.replace(/\\\n/g,""));for(var C=M.split(`
3231
- `),I="",T="",P=0,A=[],R=typeof"".trimLeft=="function",L=0,N=C.length;L<N;L++)if(I=C[L],I=R?I.trimLeft():I.trim(),P=I.length,P!==0&&(T=I.charAt(0),T!=="#"))if(T==="v"){var x=I.split(/\s+/);switch(x[0]){case"v":_.vertices.push(parseFloat(x[1]),parseFloat(x[2]),parseFloat(x[3])),7<=x.length?_.colors.push(parseFloat(x[4]),parseFloat(x[5]),parseFloat(x[6])):_.colors.push(void 0,void 0,void 0);break;case"vn":_.normals.push(parseFloat(x[1]),parseFloat(x[2]),parseFloat(x[3]));break;case"vt":_.uvs.push(parseFloat(x[1]),parseFloat(x[2]))}}else if(T==="f"){for(var O,B=I.substr(1).trim(),D=B.split(/\s+/),z=[],U=0,H=D.length;U<H;U++)if(O=D[U],0<O.length){var Y=O.split("/");z.push(Y)}for(var ie=z[0],ae=1,ee=z.length-1;ae<ee;ae++){var oe=z[ae],j=z[ae+1];_.addFace(ie[0],oe[0],j[0],ie[1],oe[1],j[1],ie[2],oe[2],j[2])}}else if(T==="l"){var K=I.substring(1).trim().split(" "),$=[],re=[];if(I.indexOf("/")===-1)$=K;else for(var G,W=0,F=K.length;W<F;W++)G=K[W].split("/"),G[0]!==""&&$.push(G[0]),G[1]!==""&&re.push(G[1]);_.addLineGeometry($,re)}else if(T==="p"){var X=I.substr(1).trim(),J=X.split(" ");_.addPointGeometry(J)}else if((A=f.exec(I))!==null){var V=(" "+A[0].substr(1).trim()).substr(1);_.startObject(V)}else if(p.test(I))_.object.startMaterial(I.substring(7).trim(),_.materialLibraries);else if(h.test(I))_.materialLibraries.push(I.substring(7).trim());else if(y.test(I))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(T==="s"){if(A=I.split(" "),1<A.length){var k=A[1].trim().toLowerCase();_.object.smooth=k!=="0"&&k!=="off"}else _.object.smooth=!0;var te=_.object.currentMaterial();te&&(te.smooth=_.object.smooth)}else{if(I==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+I+'"')}_.finalize();var se=new c.Group;se.materialLibraries=[].concat(_.materialLibraries);var le=_.objects.length!==1||_.objects[0].geometry.vertices.length!==0;if(le==!0)for(var fe=0,we=_.objects.length;fe<we;fe++){var be=_.objects[fe],de=be.geometry,ye=be.materials,ne=de.type==="Line",he=de.type==="Points",me=!1;if(de.vertices.length!==0){var Re=new c.BufferGeometry;Re.setAttribute("position",new c.Float32BufferAttribute(de.vertices,3)),0<de.normals.length&&Re.setAttribute("normal",new c.Float32BufferAttribute(de.normals,3)),0<de.colors.length&&(me=!0,Re.setAttribute("color",new c.Float32BufferAttribute(de.colors,3))),de.hasUVIndices===!0&&Re.setAttribute("uv",new c.Float32BufferAttribute(de.uvs,2));for(var Te=[],De=0,Ye=ye.length;De<Ye;De++){var ze=ye[De],st=ze.name+"_"+ze.smooth+"_"+me,Ce=_.materials[st];if(this.materials!==null){if(Ce=this.materials.create(ze.name),ne&&Ce&&!(Ce instanceof c.LineBasicMaterial)){var He=new c.LineBasicMaterial;c.Material.prototype.copy.call(He,Ce),He.color.copy(Ce.color),Ce=He}else if(he&&Ce&&!(Ce instanceof c.PointsMaterial)){var Ge=new c.PointsMaterial({size:10,sizeAttenuation:!1});c.Material.prototype.copy.call(Ge,Ce),Ge.color.copy(Ce.color),Ge.map=Ce.map,Ce=Ge}}Ce===void 0&&(Ce=ne?new c.LineBasicMaterial:he?new c.PointsMaterial({size:1,sizeAttenuation:!1}):new c.MeshPhongMaterial,Ce.name=ze.name,Ce.flatShading=!ze.smooth,Ce.vertexColors=me,_.materials[st]=Ce),Te.push(Ce)}var Ot=void 0;if(1<Te.length){for(var Nt,mt=0,xt=ye.length;mt<xt;mt++)Nt=ye[mt],Re.addGroup(Nt.groupStart,Nt.groupCount,mt);Ot=ne?new c.LineSegments(Re,Te):he?new c.Points(Re,Te):new c.Mesh(Re,Te)}else Ot=ne?new c.LineSegments(Re,Te[0]):he?new c.Points(Re,Te[0]):new c.Mesh(Re,Te[0]);Ot.name=be.name,se.add(Ot)}}else if(0<_.vertices.length){var Vi=new c.PointsMaterial({size:1,sizeAttenuation:!1}),ki=new c.BufferGeometry;ki.setAttribute("position",new c.Float32BufferAttribute(_.vertices,3)),0<_.colors.length&&_.colors[0]!==void 0&&(ki.setAttribute("color",new c.Float32BufferAttribute(_.colors,3)),Vi.vertexColors=!0);var Hn=new c.Points(ki,Vi);se.add(Hn)}return se}}},(o,l,u)=>{function c(S,E){var M=Object.keys(S);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(S);E&&(_=_.filter(function(C){return Object.getOwnPropertyDescriptor(S,C).enumerable})),M.push.apply(M,_)}return M}function f(S){for(var E,M=1;M<arguments.length;M++)E=arguments[M]==null?{}:arguments[M],M%2?c(Object(E),!0).forEach(function(_){h(S,_,E[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(S,Object.getOwnPropertyDescriptors(E)):c(Object(E)).forEach(function(_){Object.defineProperty(S,_,Object.getOwnPropertyDescriptor(E,_))});return S}function h(S,E,M){return E=p(E),E in S?Object.defineProperty(S,E,{value:M,enumerable:!0,configurable:!0,writable:!0}):S[E]=M,S}function p(S){var E=y(S,"string");return typeof E=="symbol"?E:E+""}function y(S,E){if(typeof S!="object"||!S)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var _=M.call(S,E||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(S)}var m=u(19).JSONLoader,d=u(4),b=d.FileLoader,v=S=>{var E=(_,C)=>{_.merge(C)};if(S&&0<S.length){for(;1<S.length;){var M=S.splice(1,1);E(S[0],M[0])}return S[0]}},g=function(E,M,_){var C=new b,I=new m;C.crossOrigin=M;var T=E,P=_,A=void 0,R=!1,L=!1,N=void 0,x=[],O=U=>{var H=A[U.index];if(H){var Y=I.parse(H);U.onLoad(Y.geometry,Y.materials)}else B(U)},B=U=>{U.onError&&(!N&&(N={responseURL:T}),U.onError(N))};this.downloadCompleted=U=>{try{A=JSON.parse(U[0]),R=!1,L=!0,Array.isArray(A)?x.forEach(H=>O(H)):x.forEach(H=>B(H))}catch{x.forEach(Y=>B(Y))}};var D=()=>U=>{N=U,L=!0,R=!1,x.forEach(H=>{B(H)})},z=()=>U=>{x.forEach(H=>{H.onProgress&&H.onProgress(U)})};this.load=(U,H,Y,ie)=>{var ae={index:U,onLoad:H,onProgress:Y,onError:ie};L?A?O(ae):B(N):R?x.push(ae):(x.push(ae),R=!0,C.load(T,P,z,D))}},w=function(E,M){var _=[],C=E,I=M,T=0;this.itemDownloaded=(P,A)=>{if(_[P]=A,T++,T==C){for(var R=_[0][1],L=_.map(O=>O[0]),N=v(L),x=1;x<C;x++)_[P][0].dispose(),_[P][1].forEach(O=>O.dispose());I(N,R)}}};l.PrimitivesLoader=function(){var S=0,E=20;this.crossOrigin="Anonymous";var M=new m,_=[],C={},I=(R,L,N,x,O)=>{var B=R.length,D=new w(B,L),z=0;R.forEach(U=>{var H=O?f({},O):{};H.msHandler=D,H.order=z,z++,P(U,L,N,x,H)})},T=(R,L,N,x,O)=>{var B=O?f({},O):{},D=C[R];if(!D)if(E>S){var z=new A(void 0,this,B);++S,D=new g(R,this.crossOrigin,z),C[R]=D}else _.push({url:R,onLoad:L,onProgress:N,onError:x,options:O});D&&(B.isHandler=D,D.load(O.index,L,N,x))},P=(R,L,N,x,O)=>{if(O&&O.index!==void 0)T(R,L,N,x,O);else if(E>S){++S;var B=new A(L,this,O),D=new A(x,this,O);M.crossOrigin=this.crossOrigin,M.load(R,B,N,D)}else _.push({url:R,onLoad:L,onProgress:N,onError:x,options:O})};this.load=(R,L,N,x,O)=>{Array.isArray(R)?I(R,L,N,x,O):P(R,L,N,x,O)},this.loadFromWaitingList=()=>{for(;E>S;){var R=_.shift();if(R)this.load(R.url,R.onLoad,R.onProgress,R.onError,R.options);else return}},this.itemRemainingCheck=()=>{if(_.length===0&&S==0)for(var R in C)C.hasOwnProperty(R)&&delete C[R]};var A=function(L,N,x){return function(){--S;for(var O=arguments.length,B=Array(O),D=0;D<O;D++)B[D]=arguments[D];x!=null&&x.msHandler?x.msHandler.itemDownloaded(x.order,B):x!=null&&x.isHandler?x.isHandler.downloadCompleted(B):L&&L(...B),N.loadFromWaitingList(),N.itemRemainingCheck()}};this.parse=R=>M.parse(R)}},(o,l,u)=>{u(4);var c=u(40).GLTFLoader,f=function(){var h=this;this.parseGLTFObjects=(p,y,m,d)=>{var b=y;if(m!==0){if(p.type!=="Object3D"){var v;if(p.type==="Mesh"?v=new(u(3)).Geometry:p.type==="LineSegments"?v=new(u(24)).Lines:p.type==="Points"&&(v=new(u(22)).Pointset),v){var g=!1,w=!1;p.geometry&&p.geometry.morphAttributes&&(g=!!p.geometry.morphAttributes.position,w=!!p.geometry.morphAttributes.color),v.setMesh(p.clone(),g,w);var S=v.getMorph();v.groupName=S.name,S.matrixAutoUpdate=!0,y.addZincObject(v),d!=null&&typeof d=="function"&&d(v)}}else if(p.name!==""&&(y&&(b=y.findOrCreateChildFromPath(p.name)),b)){var E=b.getGroup();E.position.copy(p.position),E.rotation.copy(p.rotation),E.quaternion.copy(p.quaternion),E.matrixAutoUpdate=!0}}m++,p.children.forEach(M=>{h.parseGLTFObjects(M,b,m,d)})},this.setCamera=p=>{p.viewAll();var y=p.getZincCameraControls(),m=y.getCurrentViewport();y.addViewport("default",m),y.setDefaultViewport("default")},this.load=(p,y,m,d,b)=>{var v=m.substring(0,m.lastIndexOf("/")+1),g=m.substring(m.lastIndexOf("/")+1,m.length),w=new c().setPath(v);w.load(g,function(S){console.log(S),h.parseGLTFObjects(S.scene,y,0,d),h.setCamera(p),b!=null&&typeof b=="function"&&b()})}};l.GLTFToZincJSLoader=f},o=>{o.exports=XB},(o,l,u)=>{var c=u(42).GLTFExporter,f=function(h){var p=h;this.exportGLTF=y=>{var m=p.getRootRegion(),d=m.getAllObjects(!0),b=[];d.forEach(w=>{w.animationClip&&b.push({clip:w.animationClip[0],mesh:w.getMorph()})});var v=new c,g={binary:y,animations:b};return new Promise(w=>{v.parse(p.getThreeJSScene(),function(S){w(S)},g)})}};l.SceneExporter=f},(o,l,u)=>{u.r(l),u.d(l,{GLTFExporter:()=>f});var c=u(4);class f{constructor(){this.pluginCallbacks=[],this.register(function(x){return new A(x)}),this.register(function(x){return new R(x)}),this.register(function(x){return new L(x)})}register(x){return this.pluginCallbacks.indexOf(x)===-1&&this.pluginCallbacks.push(x),this}unregister(x){return this.pluginCallbacks.indexOf(x)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(x),1),this}parse(x,O,B){for(var D=new P,z=[],U=0,H=this.pluginCallbacks.length;U<H;U++)z.push(this.pluginCallbacks[U](D));D.setPlugins(z),D.write(x,O,B)}}var h={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},p={};p[c.NearestFilter]=h.NEAREST,p[c.NearestMipmapNearestFilter]=h.NEAREST_MIPMAP_NEAREST,p[c.NearestMipmapLinearFilter]=h.NEAREST_MIPMAP_LINEAR,p[c.LinearFilter]=h.LINEAR,p[c.LinearMipmapNearestFilter]=h.LINEAR_MIPMAP_NEAREST,p[c.LinearMipmapLinearFilter]=h.LINEAR_MIPMAP_LINEAR,p[c.ClampToEdgeWrapping]=h.CLAMP_TO_EDGE,p[c.RepeatWrapping]=h.REPEAT,p[c.MirroredRepeatWrapping]=h.MIRRORED_REPEAT;var y={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},m=12,d=1179937895,b=2,v=8,g=1313821514,w=5130562;function S(N,x){return N.length===x.length&&N.every(function(O,B){return O===x[B]})}function E(N){if(window.TextEncoder!==void 0)return new TextEncoder().encode(N).buffer;for(var x,O=new Uint8Array(new ArrayBuffer(N.length)),B=0,D=N.length;B<D;B++)x=N.charCodeAt(B),O[B]=255<x?32:x;return O.buffer}function M(N){return S(N.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function _(N,x,O){for(var B={min:Array(N.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(N.itemSize).fill(Number.NEGATIVE_INFINITY)},D=x;D<x+O;D++)for(var z,U=0;U<N.itemSize;U++)z=void 0,4<N.itemSize?z=N.array[D*N.itemSize+U]:U===0?z=N.getX(D):U===1?z=N.getY(D):U===2?z=N.getZ(D):U==3&&(z=N.getW(D)),B.min[U]=Math.min(B.min[U],z),B.max[U]=Math.max(B.max[U],z);return B}function C(N){return 4*Math.ceil(N/4)}function I(N){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,O=C(N.byteLength);if(O!==N.byteLength){var B=new Uint8Array(O);if(B.set(new Uint8Array(N)),x!==0)for(var D=N.byteLength;D<O;D++)B[D]=x;return B.buffer}return N}var T=null;class P{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(x){this.plugins=x}write(x,O,B){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},B),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(x);var D=this;Promise.all(this.pending).then(function(){var z=D.buffers,U=D.json,H=D.options,Y=D.extensionsUsed,ie=new Blob(z,{type:"application/octet-stream"}),ae=Object.keys(Y);if(0<ae.length&&(U.extensionsUsed=ae),U.buffers&&0<U.buffers.length&&(U.buffers[0].byteLength=ie.size),H.binary===!0){var ee=new window.FileReader;ee.readAsArrayBuffer(ie),ee.onloadend=function(){var j=I(ee.result),K=new DataView(new ArrayBuffer(v));K.setUint32(0,j.byteLength,!0),K.setUint32(4,w,!0);var $=I(E(JSON.stringify(U)),32),re=new DataView(new ArrayBuffer(v));re.setUint32(0,$.byteLength,!0),re.setUint32(4,g,!0);var G=new ArrayBuffer(m),W=new DataView(G);W.setUint32(0,d,!0),W.setUint32(4,b,!0);var F=m+re.byteLength+$.byteLength+K.byteLength+j.byteLength;W.setUint32(8,F,!0);var X=new Blob([G,re,$,K,j],{type:"application/octet-stream"}),J=new window.FileReader;J.readAsArrayBuffer(X),J.onloadend=function(){O(J.result)}}}else if(U.buffers&&0<U.buffers.length){var oe=new window.FileReader;oe.readAsDataURL(ie),oe.onloadend=function(){var j=oe.result;U.buffers[0].uri=j,O(U)}}else O(U)})}serializeUserData(x,O){if(!(x.userData&&x.userData.isZincObject)&&Object.keys(x.userData).length!==0){var B=this.options,D=this.extensionsUsed;try{var z=JSON.parse(JSON.stringify(x.userData));if(B.includeCustomExtensions&&z.gltfExtensions){for(var U in O.extensions===void 0&&(O.extensions={}),z.gltfExtensions)O.extensions[U]=z.gltfExtensions[U],D[U]=!0;delete z.gltfExtensions}0<Object.keys(z).length&&(O.extras=z)}catch(H){console.warn("THREE.GLTFExporter: userData of '"+x.name+"' won't be serialized because of JSON.stringify error - "+H.message)}}}getUID(x){return this.uids.has(x)||this.uids.set(x,this.uid++),this.uids.get(x)}isNormalizedNormalAttribute(x){var O=this.cache;if(O.attributesNormalized.has(x))return!1;for(var B=new c.Vector3,D=0,z=x.count;D<z;D++)if(5e-4<Math.abs(B.fromBufferAttribute(x,D).length()-1))return!1;return!0}createNormalizedNormalAttribute(x){var O=this.cache;if(O.attributesNormalized.has(x))return O.attributesNormalized.get(x);for(var B=x.clone(),D=new c.Vector3,z=0,U=B.count;z<U;z++)D.fromBufferAttribute(B,z),D.x===0&&D.y===0&&D.z===0?D.setX(1):D.normalize(),B.setXYZ(z,D.x,D.y,D.z);return O.attributesNormalized.set(x,B),B}applyTextureTransform(x,O){var B=!1,D={};(O.offset.x!==0||O.offset.y!==0)&&(D.offset=O.offset.toArray(),B=!0),O.rotation!==0&&(D.rotation=O.rotation,B=!0),(O.repeat.x!==1||O.repeat.y!==1)&&(D.scale=O.repeat.toArray(),B=!0),B&&(x.extensions=x.extensions||{},x.extensions.KHR_texture_transform=D,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(x){var O=this.json,B=this.buffers;return O.buffers||(O.buffers=[{byteLength:0}]),B.push(x),0}processBufferView(x,O,B,D,z){var U=this.json;U.bufferViews||(U.bufferViews=[]);for(var H=O===h.UNSIGNED_BYTE?1:O===h.UNSIGNED_SHORT?2:4,Y=C(D*x.itemSize*H),ie=new DataView(new ArrayBuffer(Y)),ae=0,ee=B;ee<B+D;ee++)for(var oe,j=0;j<x.itemSize;j++)oe=void 0,4<x.itemSize?oe=x.array[ee*x.itemSize+j]:j===0?oe=x.getX(ee):j===1?oe=x.getY(ee):j===2?oe=x.getZ(ee):j==3&&(oe=x.getW(ee)),O===h.FLOAT?ie.setFloat32(ae,oe,!0):O===h.UNSIGNED_INT?ie.setUint32(ae,oe,!0):O===h.UNSIGNED_SHORT?ie.setUint16(ae,oe,!0):O===h.UNSIGNED_BYTE&&ie.setUint8(ae,oe),ae+=H;var K={buffer:this.processBuffer(ie.buffer),byteOffset:this.byteOffset,byteLength:Y};z!==void 0&&(K.target=z),z===h.ARRAY_BUFFER&&(K.byteStride=x.itemSize*H),this.byteOffset+=Y,U.bufferViews.push(K);var $={id:U.bufferViews.length-1,byteLength:0};return $}processBufferViewImage(x){var O=this,B=O.json;return B.bufferViews||(B.bufferViews=[]),new Promise(function(D){var z=new window.FileReader;z.readAsArrayBuffer(x),z.onloadend=function(){var U=I(z.result),H={buffer:O.processBuffer(U),byteOffset:O.byteOffset,byteLength:U.byteLength};O.byteOffset+=U.byteLength,D(B.bufferViews.push(H)-1)}})}processAccessor(x,O,B,D){var z,U=this.options,H=this.json;if(x.array.constructor===Float32Array)z=h.FLOAT;else if(x.array.constructor===Uint32Array)z=h.UNSIGNED_INT;else if(x.array.constructor===Uint16Array)z=h.UNSIGNED_SHORT;else if(x.array.constructor===Uint8Array)z=h.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(B===void 0&&(B=0),D===void 0&&(D=x.count),U.truncateDrawRange&&O!==void 0&&O.index===null){var Y=B+D,ie=O.drawRange.count===1/0?x.count:O.drawRange.start+O.drawRange.count;B=Math.max(B,O.drawRange.start),D=Math.min(Y,ie)-B,0>D&&(D=0)}if(D===0)return null;var ae,ee=_(x,B,D);O!==void 0&&(ae=x===O.index?h.ELEMENT_ARRAY_BUFFER:h.ARRAY_BUFFER);var oe=this.processBufferView(x,z,B,D,ae),j={bufferView:oe.id,byteOffset:oe.byteOffset,componentType:z,count:D,max:ee.max,min:ee.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[x.itemSize]};return x.normalized===!0&&(j.normalized=!0),H.accessors||(H.accessors=[]),H.accessors.push(j)-1}processImage(x,O,B){var D=this,z=D.cache,U=D.json,H=D.options,Y=D.pending;z.images.has(x)||z.images.set(x,{});var ie=z.images.get(x),ae=O===c.RGBAFormat?"image/png":"image/jpeg",ee=ae+":flipY/"+B.toString();if(ie[ee]!==void 0)return ie[ee];U.images||(U.images=[]);var oe={mimeType:ae};if(H.embedImages){var j=T=T||document.createElement("canvas");j.width=Math.min(x.width,H.maxTextureSize),j.height=Math.min(x.height,H.maxTextureSize);var K=j.getContext("2d");if(B===!0&&(K.translate(0,j.height),K.scale(1,-1)),typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&x instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&x instanceof ImageBitmap)K.drawImage(x,0,0,j.width,j.height);else{O!==c.RGBAFormat&&O!==c.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(x.width>H.maxTextureSize||x.height>H.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",x);var $=new Uint8ClampedArray(4*(x.height*x.width));if(O===c.RGBAFormat)for(var re=0;re<$.length;re+=4)$[re+0]=x.data[re+0],$[re+1]=x.data[re+1],$[re+2]=x.data[re+2],$[re+3]=x.data[re+3];else for(var G=0,W=0;G<$.length;G+=4,W+=3)$[G+0]=x.data[W+0],$[G+1]=x.data[W+1],$[G+2]=x.data[W+2],$[G+3]=255;K.putImageData(new ImageData($,x.width,x.height),0,0)}H.binary===!0?Y.push(new Promise(function(X){j.toBlob(function(J){D.processBufferViewImage(J).then(function(V){oe.bufferView=V,X()})},ae)})):oe.uri=j.toDataURL(ae)}else oe.uri=x.src;var F=U.images.push(oe)-1;return ie[ee]=F,F}processSampler(x){var O=this.json;O.samplers||(O.samplers=[]);var B={magFilter:p[x.magFilter],minFilter:p[x.minFilter],wrapS:p[x.wrapS],wrapT:p[x.wrapT]};return O.samplers.push(B)-1}processTexture(x){var O=this.cache,B=this.json;if(O.textures.has(x))return O.textures.get(x);B.textures||(B.textures=[]);var D={sampler:this.processSampler(x),source:this.processImage(x.image,x.format,x.flipY)};x.name&&(D.name=x.name),this._invokeAll(function(U){U.writeTexture&&U.writeTexture(x,D)});var z=B.textures.push(D)-1;return O.textures.set(x,z),z}processMaterial(x){var O=this.cache,B=this.json;if(O.materials.has(x))return O.materials.get(x);if(x.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;B.materials||(B.materials=[]);var D={pbrMetallicRoughness:{}};x.isMeshStandardMaterial!==!0&&x.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var z=x.color.toArray().concat([x.opacity]);if(S(z,[1,1,1,1])||(D.pbrMetallicRoughness.baseColorFactor=z),x.isMeshStandardMaterial?(D.pbrMetallicRoughness.metallicFactor=x.metalness,D.pbrMetallicRoughness.roughnessFactor=x.roughness):(D.pbrMetallicRoughness.metallicFactor=.5,D.pbrMetallicRoughness.roughnessFactor=.5),x.metalnessMap||x.roughnessMap)if(x.metalnessMap===x.roughnessMap){var U={index:this.processTexture(x.metalnessMap)};this.applyTextureTransform(U,x.metalnessMap),D.pbrMetallicRoughness.metallicRoughnessTexture=U}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(x.map){var H={index:this.processTexture(x.map)};this.applyTextureTransform(H,x.map),D.pbrMetallicRoughness.baseColorTexture=H}if(x.emissive){var Y=x.emissive.clone().multiplyScalar(x.emissiveIntensity),ie=Math.max(Y.r,Y.g,Y.b);if(1<ie&&(Y.multiplyScalar(1/ie),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<ie&&(D.emissiveFactor=Y.toArray()),x.emissiveMap){var ae={index:this.processTexture(x.emissiveMap)};this.applyTextureTransform(ae,x.emissiveMap),D.emissiveTexture=ae}}if(x.normalMap){var ee={index:this.processTexture(x.normalMap)};x.normalScale&&x.normalScale.x!==-1&&(x.normalScale.x!==x.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),ee.scale=x.normalScale.x),this.applyTextureTransform(ee,x.normalMap),D.normalTexture=ee}if(x.aoMap){var oe={index:this.processTexture(x.aoMap),texCoord:1};x.aoMapIntensity!==1&&(oe.strength=x.aoMapIntensity),this.applyTextureTransform(oe,x.aoMap),D.occlusionTexture=oe}x.transparent?D.alphaMode="BLEND":0<x.alphaTest&&(D.alphaMode="MASK",D.alphaCutoff=x.alphaTest),x.side===c.DoubleSide&&(D.doubleSided=!0),x.name!==""&&(D.name=x.name),this.serializeUserData(x,D),this._invokeAll(function(K){K.writeMaterial&&K.writeMaterial(x,D)});var j=B.materials.push(D)-1;return O.materials.set(x,j),j}processMesh(x){var O=this.cache,B=this.json,D=[x.geometry.uuid];if(Array.isArray(x.material))for(var z=0,U=x.material.length;z<U;z++)D.push(x.material[z].uuid);else D.push(x.material.uuid);var H=D.join(":");if(O.meshes.has(H))return O.meshes.get(H);var Y,ie=x.geometry;if(Y=x.isLineSegments?h.LINES:x.isLineLoop?h.LINE_LOOP:x.isLine?h.LINE_STRIP:x.isPoints?h.POINTS:x.material.wireframe?h.LINES:h.TRIANGLES,ie.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var ae={},ee={},oe=[],j=[],K={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},$=ie.getAttribute("normal");$===void 0||this.isNormalizedNormalAttribute($)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),ie.setAttribute("normal",this.createNormalizedNormalAttribute($)));var re=null;for(var G in ie.attributes)if(G.substr(0,5)!=="morph"){var W=ie.attributes[G];G=K[G]||G.toUpperCase();var F=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(F.test(G)||(G="_"+G),O.attributes.has(this.getUID(W))){ee[G]=O.attributes.get(this.getUID(W));continue}re=null;var X=W.array;G!=="JOINTS_0"||X instanceof Uint16Array||X instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),re=new c.BufferAttribute(new Uint16Array(X),W.itemSize,W.normalized));var J=this.processAccessor(re||W,ie);J!==null&&(ee[G]=J,O.attributes.set(this.getUID(W),J))}if($!==void 0&&ie.setAttribute("normal",$),Object.keys(ee).length===0)return null;if(x.morphTargetInfluences!==void 0&&0<x.morphTargetInfluences.length){var V=[],k=[],te={};if(x.morphTargetDictionary!==void 0)for(var se in x.morphTargetDictionary)te[x.morphTargetDictionary[se]]=se;for(var le=0;le<x.morphTargetInfluences.length;++le){var fe={},we=!1;for(var be in ie.morphAttributes){if(be!="position"&&be!=="normal"&&be!=="color"){we||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),we=!0);continue}var de=ie.morphAttributes[be][le],ye=be.toUpperCase();K[be]&&(ye=K[be]);var ne=ie.attributes[be];if(O.attributes.has(this.getUID(de))){fe[ye]=O.attributes.get(this.getUID(de));continue}var he=ne.clone();if(!ie.morphTargetsRelative)if(ne)for(var me=0,Re=de.count;me<Re;me++)ne.count>me&&he.setXYZ(me,de.getX(me)-ne.getX(me),de.getY(me)-ne.getY(me),de.getZ(me)-ne.getZ(me));else for(var Te=0,De=de.count;Te<De;Te++)he.setXYZ(Te,0,0,0);fe[ye]=this.processAccessor(he,ie),O.attributes.set(this.getUID(ne),fe[ye])}j.push(fe),V.push(x.morphTargetInfluences[le]),x.morphTargetDictionary!==void 0&&k.push(te[le])}ae.weights=V,0<k.length&&(ae.extras={},ae.extras.targetNames=k)}var Ye=Array.isArray(x.material);if(Ye&&ie.groups.length===0)return null;for(var ze,st=Ye?x.material:[x.material],Ce=Ye?ie.groups:[{materialIndex:0,start:void 0,count:void 0}],He=0,Ge=Ce.length;He<Ge;He++){if(ze={mode:Y,attributes:ee},this.serializeUserData(ie,ze),0<j.length&&(ze.targets=j),ie.index!==null){var Ot=this.getUID(ie.index);(Ce[He].start!==void 0||Ce[He].count!==void 0)&&(Ot+=":"+Ce[He].start+":"+Ce[He].count),O.attributes.has(Ot)?ze.indices=O.attributes.get(Ot):(ze.indices=this.processAccessor(ie.index,ie,Ce[He].start,Ce[He].count),O.attributes.set(Ot,ze.indices)),ze.indices===null&&delete ze.indices}var Nt=this.processMaterial(st[Ce[He].materialIndex]);Nt!==null&&(ze.material=Nt),oe.push(ze)}ae.primitives=oe,B.meshes||(B.meshes=[]),this._invokeAll(function(xt){xt.writeMesh&&xt.writeMesh(x,ae)});var mt=B.meshes.push(ae)-1;return O.meshes.set(H,mt),mt}processCamera(x){var O=this.json;O.cameras||(O.cameras=[]);var B=x.isOrthographicCamera,D={type:B?"orthographic":"perspective"};return B?D.orthographic={xmag:2*x.right,ymag:2*x.top,zfar:0>=x.far?.001:x.far,znear:0>x.near?0:x.near}:D.perspective={aspectRatio:x.aspect,yfov:c.MathUtils.degToRad(x.fov),zfar:0>=x.far?.001:x.far,znear:0>x.near?0:x.near},x.name!==""&&(D.name=x.type),O.cameras.push(D)-1}processAnimation(x,O){var B=this.json,D=this.nodeMap;B.animations||(B.animations=[]),x=f.Utils.mergeMorphTargetTracks(x.clone(),O);for(var z=x.tracks,U=[],H=[],Y=0;Y<z.length;++Y){var ie=z[Y],ae=c.PropertyBinding.parseTrackName(ie.name),ee=c.PropertyBinding.findNode(O,ae.nodeName),oe=y[ae.propertyName];if(ae.objectName==="bones"&&(ee.isSkinnedMesh===!0?ee=ee.skeleton.getBoneByName(ae.objectIndex):ee=void 0),!ee||!oe)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',ie.name),null;var j=1,K=ie.values.length/ie.times.length;oe===y.morphTargetInfluences&&(K/=ee.morphTargetInfluences.length);var $=void 0;ie.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?($="CUBICSPLINE",K/=3):ie.getInterpolation()===c.InterpolateDiscrete?$="STEP":$="LINEAR",H.push({input:this.processAccessor(new c.BufferAttribute(ie.times,j)),output:this.processAccessor(new c.BufferAttribute(ie.values,K)),interpolation:$}),U.push({sampler:H.length-1,target:{node:D.get(ee),path:oe}})}return B.animations.push({name:x.name||"clip_"+B.animations.length,samplers:H,channels:U}),B.animations.length-1}processSkin(x){var O=this.json,B=this.nodeMap,D=O.nodes[B.get(x)],z=x.skeleton;if(z===void 0)return null;var U=x.skeleton.bones[0];if(U===void 0)return null;for(var H=[],Y=new Float32Array(16*z.bones.length),ie=new c.Matrix4,ae=0;ae<z.bones.length;++ae)H.push(B.get(z.bones[ae])),ie.copy(z.boneInverses[ae]),ie.multiply(x.bindMatrix).toArray(Y,16*ae);O.skins===void 0&&(O.skins=[]),O.skins.push({inverseBindMatrices:this.processAccessor(new c.BufferAttribute(Y,16)),joints:H,skeleton:B.get(U)});var ee=D.skin=O.skins.length-1;return ee}processNode(x){var O=this.json,B=this.options,D=this.nodeMap;O.nodes||(O.nodes=[]);var z={};if(B.trs){var U=x.quaternion.toArray(),H=x.position.toArray(),Y=x.scale.toArray();S(U,[0,0,0,1])||(z.rotation=U),S(H,[0,0,0])||(z.translation=H),S(Y,[1,1,1])||(z.scale=Y)}else x.matrixAutoUpdate&&x.updateMatrix(),M(x.matrix)===!1&&(z.matrix=x.matrix.elements);if(x.name!==""&&(z.name=x.name+""),this.serializeUserData(x,z),x.isMesh||x.isLine||x.isPoints){var ie=this.processMesh(x);ie!==null&&(z.mesh=ie)}else x.isCamera&&(z.camera=this.processCamera(x));if(x.isSkinnedMesh&&this.skins.push(x),0<x.children.length){for(var ae,ee=[],oe=0,j=x.children.length;oe<j;oe++)if(ae=x.children[oe],ae.visible||B.onlyVisible===!1){var K=this.processNode(ae);K!==null&&ee.push(K)}0<ee.length&&(z.children=ee)}this._invokeAll(function(re){re.writeNode&&re.writeNode(x,z)});var $=O.nodes.push(z)-1;return D.set(x,$),$}processScene(x){var O=this.json,B=this.options;O.scenes||(O.scenes=[],O.scene=0);var D={};x.name!==""&&(D.name=x.name),O.scenes.push(D);for(var z,U=[],H=0,Y=x.children.length;H<Y;H++)if(z=x.children[H],z.visible||B.onlyVisible===!1){var ie=this.processNode(z);ie!==null&&U.push(ie)}0<U.length&&(D.nodes=U),this.serializeUserData(x,D)}processObjects(x){var O=new c.Scene;O.name="AuxScene";for(var B=0;B<x.length;B++)O.children.push(x[B]);this.processScene(O)}processInput(x){var O=this.options;x=x instanceof Array?x:[x],this._invokeAll(function(H){H.beforeParse&&H.beforeParse(x)});for(var B=[],D=0;D<x.length;D++)x[D]instanceof c.Scene?this.processScene(x[D]):B.push(x[D]);0<B.length&&this.processObjects(B);for(var z=0;z<this.skins.length;++z)this.processSkin(this.skins[z]);for(var U=0;U<O.animations.length;++U)this.processAnimation(O.animations[U].clip,O.animations[U].mesh);this._invokeAll(function(H){H.afterParse&&H.afterParse(x)})}_invokeAll(x){for(var O=0,B=this.plugins.length;O<B;O++)x(this.plugins[O])}}class A{constructor(x){this.writer=x,this.name="KHR_lights_punctual"}writeNode(x,O){if(x.isLight){if(!x.isDirectionalLight&&!x.isPointLight&&!x.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",x);var B=this.writer,D=B.json,z=B.extensionsUsed,U={};x.name&&(U.name=x.name),U.color=x.color.toArray(),U.intensity=x.intensity,x.isDirectionalLight?U.type="directional":x.isPointLight?(U.type="point",0<x.distance&&(U.range=x.distance)):x.isSpotLight&&(U.type="spot",0<x.distance&&(U.range=x.distance),U.spot={},U.spot.innerConeAngle=-1*((x.penumbra-1)*x.angle),U.spot.outerConeAngle=x.angle),x.decay!==void 0&&x.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),x.target&&(x.target.parent!==x||x.target.position.x!==0||x.target.position.y!==0||x.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),z[this.name]||(D.extensions=D.extensions||{},D.extensions[this.name]={lights:[]},z[this.name]=!0);var H=D.extensions[this.name].lights;H.push(U),O.extensions=O.extensions||{},O.extensions[this.name]={light:H.length-1}}}}class R{constructor(x){this.writer=x,this.name="KHR_materials_unlit"}writeMaterial(x,O){if(x.isMeshBasicMaterial){var B=this.writer,D=B.extensionsUsed;O.extensions=O.extensions||{},O.extensions[this.name]={},D[this.name]=!0,O.pbrMetallicRoughness.metallicFactor=0,O.pbrMetallicRoughness.roughnessFactor=.9}}}class L{constructor(x){this.writer=x,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(x,O){if(x.isGLTFSpecularGlossinessMaterial){var B=this.writer,D=B.extensionsUsed,z={};O.pbrMetallicRoughness.baseColorFactor&&(z.diffuseFactor=O.pbrMetallicRoughness.baseColorFactor);var U=[1,1,1];if(x.specular.toArray(U,0),z.specularFactor=U,z.glossinessFactor=x.glossiness,O.pbrMetallicRoughness.baseColorTexture&&(z.diffuseTexture=O.pbrMetallicRoughness.baseColorTexture),x.specularMap){var H={index:B.processTexture(x.specularMap)};B.applyTextureTransform(H,x.specularMap),z.specularGlossinessTexture=H}O.extensions=O.extensions||{},O.extensions[this.name]=z,D[this.name]=!0}}}f.Utils={insertKeyframe:function(x,O){var B,D=.001,z=x.getValueSize(),U=new x.TimeBufferType(x.times.length+1),H=new x.ValueBufferType(x.values.length+z),Y=x.createInterpolant(new x.ValueBufferType(z));if(x.times.length===0){U[0]=O;for(var ie=0;ie<z;ie++)H[ie]=0;B=0}else if(O<x.times[0]){if(Math.abs(x.times[0]-O)<D)return 0;U[0]=O,U.set(x.times,1),H.set(Y.evaluate(O),0),H.set(x.values,z),B=0}else if(O>x.times[x.times.length-1]){if(Math.abs(x.times[x.times.length-1]-O)<D)return x.times.length-1;U[U.length-1]=O,U.set(x.times,0),H.set(x.values,0),H.set(Y.evaluate(O),x.values.length),B=U.length-1}else for(var ae=0;ae<x.times.length;ae++){if(Math.abs(x.times[ae]-O)<D)return ae;if(x.times[ae]<O&&x.times[ae+1]>O){U.set(x.times.slice(0,ae+1),0),U[ae+1]=O,U.set(x.times.slice(ae+1),ae+2),H.set(x.values.slice(0,(ae+1)*z),0),H.set(Y.evaluate(O),(ae+1)*z),H.set(x.values.slice((ae+1)*z),(ae+2)*z),B=ae+1;break}}return x.times=U,x.values=H,B},mergeMorphTargetTracks:function(x,O){for(var B=[],D={},z=x.tracks,U=0;U<z.length;++U){var H=z[U],Y=c.PropertyBinding.parseTrackName(H.name),ie=c.PropertyBinding.findNode(O,Y.nodeName);if(Y.propertyName!=="morphTargetInfluences"||Y.propertyIndex===void 0){B.push(H);continue}if(H.createInterpolant!==H.InterpolantFactoryMethodDiscrete&&H.createInterpolant!==H.InterpolantFactoryMethodLinear){if(H.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),H=H.clone(),H.setInterpolation(c.InterpolateLinear)}var ae=ie.morphTargetInfluences.length,ee=ie.morphTargetDictionary[Y.propertyIndex];if(ee===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+Y.propertyIndex);var oe=void 0;if(D[ie.uuid]===void 0){oe=H.clone();for(var j=new oe.ValueBufferType(ae*oe.times.length),K=0;K<oe.times.length;K++)j[K*ae+ee]=oe.values[K];oe.name=(Y.nodeName||"")+".morphTargetInfluences",oe.values=j,D[ie.uuid]=oe,B.push(oe);continue}var $=H.createInterpolant(new H.ValueBufferType(1));oe=D[ie.uuid];for(var re=0;re<oe.times.length;re++)oe.values[re*ae+ee]=$.evaluate(oe.times[re]);for(var G,W=0;W<H.times.length;W++)G=this.insertKeyframe(oe,H.times[W]),oe.values[G*ae+ee]=H.values[W]}return x.tracks=B,x}}},(o,l,u)=>{var c=u(4),f=u(5).resolveURL,h=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var E=this;this.setFromObject=M=>{var{nearPlane:_,farPlane:C,eyePosition:I,targetPosition:T,upVector:P}=M;E.nearPlane=_,E.farPlane=C,E.eyePosition=I,E.targetPosition=T,E.upVector=P}},p=function(E,M,_,C){var I={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},T={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},P={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},A={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},R={};R.MAIN=T.ROTATE,R.AUXILIARY=T.ZOOM,R.SECONDARY=T.PAN,this.cameraObject=E,this.domElement=M===void 0?document:M,this.renderer=_,this.scene=C,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;var L=6e3,N=!0,x=0,O=void 0,B=void 0,D=!1,z=500,U=void 0,H="default",Y=I.DEFAULT,ie=void 0,ae=void 0,ee=void 0,oe=0,j=P.FREE;this._state=T.NONE;var K;this.targetTouchId=-1;var $=void 0,re=new c.Vector3,G=new c.Vector3,W=new c.Vector3,F=new c.Vector3,X=new c.Vector3,J=new c.Vector3,V=new c.Vector3,k=new c.Vector3,te=new c.Sphere,se=new c.Vector3,le=!1,fe=void 0,we=0,be={default:new h};be.default.nearPlane=.1,be.default.farPlane=2e3,be.default.eyePosition=[0,0,0],be.default.targetPosition=[0,0,-1],be.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new c.Vector3(...be.default.targetPosition)),this.calculateMaxAllowedDistance=Q=>{var xe=Q.getBoundingBox();if(xe){xe.getBoundingSphere(te),we=6*te.radius;var Ee=0;this.cameraObject&&(Ee=this.cameraObject.position.distanceTo(te.center)),we=Ee>we?1.5*Ee:we}else we=0},this.addViewport=(Q,xe)=>{Q&&xe&&(be[Q]=xe)},this.setDefaultViewport=Q=>!!(Q&&Q in be)&&(H=Q,!0),this.getDefaultViewport=()=>H,this.getViewportOfName=Q=>be[Q],this.setCurrentViewport=Q=>Q in be&&(this.setCurrentCameraSettings(be[Q]),!0),this.setRotationMode=Q=>{switch(Q){case"none":j=P.NONE;break;case"horizontal":j=P.HORIZONTAL;break;case"vertical":j=P.VERTICAL;break;case"free":default:j=P.FREE}},this.onResize=()=>{$&&($=void 0),fe&&fe.setCurrentCameraSettings(this.cameraObject,be[H])},this.getVisibleHeightAtZDepth=Q=>{var xe=this.cameraObject.position.distanceTo(this.cameraObject.target);Q<xe?Q-=xe:Q+=xe;var Ee=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(Ee/2)*Math.abs(Q)},this.calculateHeightPerPixelAtZeroDepth=Q=>{var xe=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=xe/Q,this.pixelHeight},this.getNDCFromDocumentCoords=(Q,xe,Ee)=>{Ce(!1);var Be=Ee||new c.Vector2,Ke=2*((Q-$.left)/$.width)-1,Z=2*-((xe-$.top)/$.height)+1;return Be.set(Ke,Z)},this.getRelativeCoordsFromNDC=(Q,xe,Ee)=>{Ce(!1);var Be=Ee||new c.Vector2;return Be.x=(Q+1)*$.width/2,Be.y=(1-xe)*$.height/2,Be},this.setMouseButtonAction=(Q,xe)=>{R[Q]=T[xe]};var de=(Q,xe)=>{Q instanceof HTMLCanvasElement&&(Q.tabIndex=xe)},ye=()=>{if(0<we){var Q=se.distanceTo(te.center);return we>Q||this.cameraObject.position.distanceTo(te.center)>Q}return!0},ne=Q=>{se.copy(this.cameraObject.position).add(Q),ye()&&(this.cameraObject.target.add(Q),this.cameraObject.position.add(Q),this.updateDirectionalLight())},he=Q=>{Ce(!1);var xe;if(Y===I.DEFAULT&&(xe=this.scene.getNormalisedMinimapCoordinates(this.renderer,Q)),!xe)Q.button==0?Q.ctrlKey?this._state=R.AUXILIARY:Q.shiftKey?this._state=R.SECONDARY:this._state=R.MAIN:Q.button==1?(Q.preventDefault(),this._state=R.AUXILIARY):Q.button==2&&(this._state=R.SECONDARY),this.pointer_x=Q.clientX-$.left,this.pointer_y=Q.clientY-$.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{Y=I.MINIMAP;var Ee=this.scene.getMinimapDiffFromNormalised(xe.x,xe.y);ne(Ee)}},me=Q=>{if(Ce(!1),$)if(this.pointer_x=Q.clientX-$.left,this.pointer_y=Q.clientY-$.top,Y===I.MINIMAP){var xe=this.scene.getNormalisedMinimapCoordinates(this.renderer,Q);if(xe){var Ee=this.scene.getMinimapDiffFromNormalised(xe.x,xe.y);ne(Ee)}}else this._state===T.NONE&&K!==void 0&&K.move(this,Q.clientX,Q.clientY,this.renderer)},Re=Q=>{this._state=T.NONE,Y==I.MINIMAP&&(Y=I.DEFAULT),K!==void 0&&this.pointer_x_start==Q.clientX-$.left&&this.pointer_y_start==Q.clientY-$.top&&K.pick(this,Q.clientX,Q.clientY,this.renderer)},Te=Q=>{this._state=T.NONE},De=Q=>{Ce(!1);var xe=Q.touches.length;if(xe==1){var Ee,Be;this._state=T.TOUCH_ROTATE,this.pointer_x=Q.touches[0].clientX-((Ee=$)===null||Ee===void 0?void 0:Ee.left),this.pointer_y=Q.touches[0].clientY-((Be=$)===null||Be===void 0?void 0:Be.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}else if(xe==2){this._state=T.TOUCH_ZOOM;var Ke=Q.touches[0].clientX-Q.touches[1].clientX,Z=Q.touches[0].clientY-Q.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(Ke*Ke+Z*Z)}else if(xe==3){var pe,ce;this._state=T.TOUCH_PAN,this.targetTouchId=Q.touches[0].identifier,this.pointer_x=Q.touches[0].clientX-((pe=$)===null||pe===void 0?void 0:pe.left),this.pointer_y=Q.touches[0].clientY-((ce=$)===null||ce===void 0?void 0:ce.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}},Ye=Q=>{Q.preventDefault(),Q.stopPropagation();var xe=Q.touches.length;if(xe==1)this.pointer_x=Q.touches[0].clientX-$.left,this.pointer_y=Q.touches[0].clientY-$.top;else if(xe==2){if(this._state===T.TOUCH_ZOOM){var Ee=Q.touches[0].clientX-Q.touches[1].clientX,Be=Q.touches[0].clientY-Q.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(Ee*Ee+Be*Be)}}else if(xe==3&&this._state===T.TOUCH_PAN)for(var Ke=0;3>Ke;Ke++)Q.touches[Ke].identifier==this.targetTouchId&&(this.pointer_x=Q.touches[0].clientX-$.left,this.pointer_y=Q.touches[0].clientY-$.top)},ze=Q=>{var xe=Q.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=T.NONE,xe==1&&K!==void 0&&this.pointer_x_start==Q.touches[0].clientX-$.left&&this.pointer_y_start==Q.touches[0].clientY-$.top&&K.pick(this.cameraObject,Q.touches[0].clientX,Q.touches[0].clientY,this.renderer)},st=()=>{Ce(!0)},Ce=Q=>{if(Q||$===void 0){var xe=new IntersectionObserver(Ee=>{for(var Be of Ee)$=Be.boundingClientRect;xe.disconnect()});xe.observe(this.domElement)}},He=Q=>{Ce(!1),this._state=T.SCROLL;var xe=0;0<Q.deltaY?xe=this.zoomRate:0>Q.deltaY&&(xe=-1*this.zoomRate),oe+=xe,Q.preventDefault(),Q.stopImmediatePropagation()},Ge=Q=>{Ce(!1);var xe=0;if(Q.keyCode===A.EQUAL||Q.keyCode===A.MINUS||Q.keyCode===A.NUMPADADD||Q.keyCode===A.NUMPADSUBTRACT){this._state=T.KEYBOARD_ZOOM;var Ee=1;Q.shiftKey&&(Ee*=2),Q.keyCode===A.EQUAL||Q.keyCode===A.NUMPADADD?xe=-1*(this.zoomRate*Ee):(Q.keyCode===A.MINUS||Q.keyCode===A.NUMPADSUBTRACT)&&(xe=this.zoomRate*Ee),oe+=xe}else(Q.keyCode===A.ARROWLEFT||Q.keyCode===A.ARROWUP||Q.keyCode===A.ARROWRIGHT||Q.keyCode===A.ARROWDOWN)&&(Q.shiftKey?(this._state=T.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,xe=this.rotateRate):(this._state=T.KEYBOARD_PAN,xe=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,Q.keyCode===A.ARROWLEFT?this.pointer_x-=xe:Q.keyCode===A.ARROWUP?this.pointer_y-=xe:Q.keyCode===A.ARROWRIGHT?this.pointer_x+=xe:Q.keyCode===A.ARROWDOWN&&(this.pointer_y+=xe));Q.preventDefault()},Ot=Q=>{this._state=T.NONE},Nt=()=>{if(typeof this.cameraObject<"u"){var Q=$.height,xe=this.cameraObject.position.distanceTo(this.cameraObject.target),Ee=0;this.cameraObject.far>this.cameraObject.near&&xe>=this.cameraObject.near&&xe<=this.cameraObject.far&&(Ee=(xe-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),G.set(this.previous_pointer_x,Q-this.previous_pointer_y,0),W.set(this.previous_pointer_x,Q-this.previous_pointer_y,1),F.set(this.pointer_x,Q-this.pointer_y,0),X.set(this.pointer_x,Q-this.pointer_y,1),G.unproject(this.cameraObject),W.unproject(this.cameraObject),F.unproject(this.cameraObject),X.unproject(this.cameraObject);var Be=-.002;F.sub(G).multiplyScalar(1-Ee),X.sub(W).multiplyScalar(Ee),F.add(X).multiplyScalar(Be),ne(F)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(Q,xe)=>{Q.normalize(),V.copy(this.cameraObject.position).sub(this.cameraObject.target),k.copy(V),V.normalize(),.8<Math.abs(V.dot(Q))&&V.copy(this.cameraObject.up),G.crossVectors(Q,V).normalize(),W.crossVectors(Q,G);var Ee=Q.dot(k),Be=G.dot(k),Ke=W.dot(k),Z=Q.dot(this.cameraObject.up),pe=G.dot(this.cameraObject.up),ce=W.dot(this.cameraObject.up),ge=Math.cos(xe),Me=Math.sin(xe);return F.set(ge*G.x+Me*W.x,ge*G.y+Me*W.y,ge*G.z+Me*W.z),X.set(ge*W.x-Me*G.x,ge*W.y-Me*G.y,ge*W.z-Me*G.z),V.copy(this.cameraObject.target),V.x=V.x+Q.x*Ee+F.x*Be+X.x*Ke,V.y=V.y+Q.y*Ee+F.y*Be+X.y*Ke,V.z=V.z+Q.z*Ee+F.z*Be+X.z*Ke,re.set(Q.x*Z+F.x*pe+X.x*ce,Q.y*Z+F.y*pe+X.y*ce,Q.z*Z+F.z*pe+X.z*ce),{position:V,up:re}},this.rotateAboutLookAtpoint=(Q,xe)=>{var Ee=this.getVectorsFromRotateAboutLookAtPoints(Q,xe);this.cameraObject.position.copy(Ee.position),this.updateDirectionalLight(),this.cameraObject.up.copy(Ee.up)};var mt=()=>{if(typeof this.cameraObject<"u"){var Q,xe,Ee=(Q=$)===null||Q===void 0?void 0:Q.width,Be=(xe=$)===null||xe===void 0?void 0:xe.height;if(0<Ee&&0<Be){var Ke=.25*(Ee+Be),Z=0,pe=0;(j===P.FREE||j===P.HORIZONTAL)&&(Z=this.pointer_x-this.previous_pointer_x),(j===P.FREE||j===P.VERTICAL)&&(pe=this.previous_pointer_y-this.pointer_y);var ce=Math.sqrt(Z*Z+pe*pe);if(0<ce){var ge=1*-pe/ce,Me=1*Z/ce,ue=0;j===P.FREE&&ge*(this.pointer_x-.5*(Ee-1))+Me*(.5*(Be-1)-this.pointer_y);var ve=Math.acos(ue/Ke)-.5*Math.PI,_e=this.tumble_rate*ce/Ke;re.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),G.copy(this.cameraObject.up).normalize(),W.copy(G).cross(re).normalize().multiplyScalar(ge),G.multiplyScalar(Me),J.addVectors(W,G).multiplyScalar(Math.cos(ve)),re.multiplyScalar(Math.sin(ve)),J.add(re),this.rotateAboutLookAtpoint(J,-_e)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},xt=()=>{var Q=0;return this._state===T.ZOOM?Q=this.previous_pointer_y-this.pointer_y:this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM?Q=oe:(Q=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),Q};this.changeZoomByScrollRateUnit=Q=>{var xe=Q*this.zoomRate;this.changeZoomByValue(xe)},this.changeZoomByValue=Q=>{if(typeof this.cameraObject<"u"){var xe=$.height,Ee=this.cameraObject.position.clone();Ee.sub(this.cameraObject.target);var Be=Ee.length(),Ke=1.5*Q/xe;if(.01<Be+Ke*Be&&(Ee.normalize(),se.copy(this.cameraObject.position),se.x+=Ee.x*Ke*Be,se.y+=Ee.y*Ke*Be,se.z+=Ee.z*Ke*Be,ye())){this.cameraObject.position.copy(se),this.updateDirectionalLight();var Z=1e-5;if(Z*this.cameraObject.far<this.cameraObject.near+Ke*Be+this.near_plane_fly_debt)this.near_plane_fly_debt!=0&&(this.near_plane_fly_debt+=Ke*Be,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=Ke*Be,this.cameraObject.far+=Ke*Be));else{if(this.near_plane_fly_debt==0){var pe=this.cameraObject.near-Z*this.cameraObject.far;this.cameraObject.near=Z*this.cameraObject.far,this.cameraObject.far-=pe,this.near_plane_fly_debt-=Z*this.cameraObject.far}this.near_plane_fly_debt+=Ke*Be}le=!0}}};var Vi=()=>{var Q=xt();this.changeZoomByValue(Q),this._state===T.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(oe=0,this._state=T.NONE)};this.setDirectionalLight=Q=>{this.directionalLight=Q},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){N=!0,this.domElement&&this.domElement.addEventListener&&(de(this.domElement,0),this.domElement.addEventListener("mousedown",he,!1),this.domElement.addEventListener("mousemove",me,!1),this.domElement.addEventListener("mouseup",Re,!1),this.domElement.addEventListener("mouseleave",Te,!1),this.domElement.addEventListener("touchstart",De,!1),this.domElement.addEventListener("touchmove",Ye,!1),this.domElement.addEventListener("touchend",ze,!1),this.domElement.addEventListener("wheel",He,!1),this.domElement.addEventListener("mouseenter",st,!1),this.domElement.addEventListener("contextmenu",Q=>{Q.preventDefault()},!1),this.domElement.addEventListener("keydown",Ge,!1),this.domElement.addEventListener("keyup",Ot,!1))},this.disable=function(){N=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",he,!1),this.domElement.removeEventListener("mousemove",me,!1),this.domElement.removeEventListener("mouseup",Re,!1),this.domElement.removeEventListener("mouseleave",Te,!1),this.domElement.removeEventListener("touchstart",De,!1),this.domElement.removeEventListener("touchmove",Ye,!1),this.domElement.removeEventListener("touchend",ze,!1),this.domElement.removeEventListener("wheel",He,!1),this.domElement.removeEventListener("mouseenter",st,!1),this.domElement.removeEventListener("contextmenu",Q=>{Q.preventDefault()},!1),this.domElement.removeEventListener("keydown",Ge,!1),this.domElement.removeEventListener("keyup",Ot,!1),de(this.domElement,-1))},this.loadPath=Q=>{O=Q.CameraPath,B=Q.NumberOfPoints},this.loadPathURL=(Q,xe)=>{var Ee=new XMLHttpRequest;Ee.onreadystatechange=()=>{if(Ee.readyState==4&&Ee.status==200){var Ke=JSON.parse(Ee.responseText);this.loadPath(Ke),xe!=null&&typeof xe=="function"&&xe()}};var Be=f(Q);Ee.open("GET",Be,!0),Ee.send()},this.setPathDuration=Q=>{L=Q,ie&&ie.setDuration(L),ae&&ae.setDuration(L)},this.getPlayRate=()=>z,this.setPlayRate=Q=>{z=Q};var ki=Q=>{var xe=x+Q;xe>L&&(xe-=L),x=xe};this.getTime=()=>x,this.setTime=Q=>{x=Q>L?L:0>Q?0:Q},this.getNumberOfTimeFrame=()=>B,this.getCurrentTimeFrame=()=>{if(2<B){var Q=x/L*(B-1),xe=Math.floor(Q),Ee=1-(Q-xe),Be=Math.ceil(Q);return xe==Be?xe==B-1?[xe-1,Be,0]:[xe,Be+1,1]:[xe,Be,Ee]}return B==1?[0,0,0]:void 0},this.setCurrentTimeFrame=Q=>{2<B&&(x=L*Q/(B-1),0>x&&(x=0),x>L&&(x=L))};var Hn=Q=>{if(Y===I.PATH&&(ki(Q),O)){for(var xe=this.getCurrentTimeFrame(),Ee=xe[0],Be=xe[1],Ke=xe[2],Z=[O[3*Ee],O[3*Ee+1],O[3*Ee+2]],pe=[O[3*Be],O[3*Be+1],O[3*Be+2]],ce=[],ge=0;ge<Z.length;ge++)ce.push(Ke*Z[ge]+(1-Ke)*pe[ge]);this.cameraObject.position.set(ce[0],ce[1],ce[2]),this.cameraObject.target.set(pe[0],pe[1],pe[2]),U&&this.cameraObject.lookAt(this.cameraObject.target),D&&(this.directionalLight.position.set(ce[0],ce[1],ce[2]),this.directionalLight.target.position.set(pe[0],pe[1],pe[2]))}};this.calculatePathNow=()=>{Hn(0)};var us=()=>{this._state===T.ROTATE||this._state===T.TOUCH_ROTATE||this._state===T.KEYBOARD_ROTATE?mt():this._state===T.PAN||this._state===T.TOUCH_PAN||this._state===T.KEYBOARD_PAN?(Nt(),fe.triggerCallback()):(this._state===T.ZOOM||this._state===T.TOUCH_ZOOM||this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(fe.zoom(xt()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(this._state=T.NONE),oe=0,fe.triggerCallback())};this.update=Q=>{var xe=Q*z,Ee=N,Be=!0;return Y===I.PATH?Hn(xe):Y===I.SMOOTH_CAMERA_TRANSITION&&ie?(ie.update(xe),ie.isTransitionCompleted()&&(Y=I.DEFAULT),Ee=!1):Y===I.ROTATE_CAMERA_TRANSITION&&ae?(ae.update(xe),ae.isTransitionCompleted()&&(Y=I.DEFAULT),Ee=!1):Y===I.AUTO_TUMBLE&&ee?ee.update(xe):Y===I.SYNC_CONTROL&&fe?(us(),Ee=!1):Be=!1,Ee&&(this._state!==T.NONE&&(Be=!0),this._state===T.ROTATE||this._state===T.TOUCH_ROTATE||this._state===T.KEYBOARD_ROTATE?mt():this._state===T.PAN||this._state===T.TOUCH_PAN||this._state===T.KEYBOARD_PAN?Nt():(this._state===T.ZOOM||this._state===T.TOUCH_ZOOM||this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&Vi(),this._state!==T.NONE&&Y===I.AUTO_TUMBLE&&ee&&ee.stopOnCameraInput,this._state===T.SCROLL&&(this._state=T.NONE)),U?(Be=!0,U.update()):this.cameraObject.lookAt(this.cameraObject.target),Be=Be||le,le=!1,Be},this.playPath=()=>{Y=I.PATH},this.stopPath=()=>{Y=I.DEFAULT},this.isPlayingPath=()=>Y===I.PATH,this.enableDirectionalLightUpdateWithPath=Q=>{D=Q},this.enableDeviceOrientation=()=>{U||(U=new w(this.cameraObject))},this.disableDeviceOrientation=()=>{U&&(U.dispose(),U=void 0)},this.isDeviceOrientationEnabled=()=>!!U,this.resetView=()=>{var Q=be[H];this.cameraObject.near=Q.nearPlane,this.cameraObject.far=Q.farPlane,this.cameraObject.position.set(Q.eyePosition[0],Q.eyePosition[1],Q.eyePosition[2]),this.cameraObject.target.set(Q.targetPosition[0],Q.targetPosition[1],Q.targetPosition[2]),this.cameraObject.up.set(Q.upVector[0],Q.upVector[1],Q.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=Q=>{Q.nearPlane&&(this.cameraObject.near=Q.nearPlane),Q.farPlane&&(this.cameraObject.far=Q.farPlane),Q.eyePosition&&this.cameraObject.position.set(Q.eyePosition[0],Q.eyePosition[1],Q.eyePosition[2]),Q.targetPosition&&this.cameraObject.target.set(Q.targetPosition[0],Q.targetPosition[1],Q.targetPosition[2]),Q.upVector&&this.cameraObject.up.set(Q.upVector[0],Q.upVector[1],Q.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),le=!0},this.getViewportFromCentreAndRadius=(Q,xe,Ee,Be,Ke,Z)=>{var pe=this.cameraObject.position.x-this.cameraObject.target.x,ce=this.cameraObject.position.y-this.cameraObject.target.y,ge=this.cameraObject.position.z-this.cameraObject.target.z,Me=1/Math.sqrt(pe*pe+ce*ce+ge*ge);pe*=Me,ce*=Me,ge*=Me;var ue=[Q,xe,Ee],ve=Be/Math.tan(Ke*Math.PI/360),_e=[Q+pe*ve,xe+ce*ve,Ee+ge*ve],Pe=ve+Z,Oe=0,Ue=.95;Oe=Z>Ue*ve?(1-Ue)*ve:ve-Z;var Fe=new h;return Fe.nearPlane=Oe,Fe.farPlane=Pe,Fe.eyePosition=_e,Fe.targetPosition=ue,Fe.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],Fe},this.getViewportFromBoundingBox=(Q,xe)=>{var Ee=Q.min.distanceTo(Q.max)/2*xe,Be=(Q.min.x+Q.max.x)/2,Ke=(Q.min.y+Q.max.y)/2,Z=(Q.min.z+Q.max.z)/2,pe=4,ce=this.getViewportFromCentreAndRadius(Be,Ke,Z,Ee,40,Ee*pe);return ce},this.getCurrentViewport=()=>{var Q=new h;return Q.nearPlane=this.cameraObject.near,Q.farPlane=this.cameraObject.far,Q.eyePosition[0]=this.cameraObject.position.x,Q.eyePosition[1]=this.cameraObject.position.y,Q.eyePosition[2]=this.cameraObject.position.z,Q.targetPosition[0]=this.cameraObject.target.x,Q.targetPosition[1]=this.cameraObject.target.y,Q.targetPosition[2]=this.cameraObject.target.z,Q.upVector[0]=this.cameraObject.up.x,Q.upVector[1]=this.cameraObject.up.y,Q.upVector[2]=this.cameraObject.up.z,Q},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(Q,xe,Ee)=>{ae==null&&(ie=new y(Q,xe,this,Ee))},this.rotateCameraTransition=(Q,xe,Ee)=>{ie==null&&(ae=new m(Q,xe,this,Ee))},this.enableCameraTransition=()=>{ie&&(Y=I.SMOOTH_CAMERA_TRANSITION),ae&&(Y=I.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{Y=I.DEFAULT},this.stopCameraTransition=()=>{Y=I.DEFAULT,ie=void 0,ae=void 0},this.isTransitioningCamera=()=>Y===I.SMOOTH_CAMERA_TRANSITION||Y===I.ROTATE_CAMERA_TRANSITION,this.autoTumble=(Q,xe,Ee)=>{ee=new b(Q,xe,Ee,this)},this.enableAutoTumble=()=>{Y=I.AUTO_TUMBLE},this.stopAutoTumble=()=>{Y=I.DEFAULT,ee=void 0},this.updateAutoTumble=()=>{ee&&(ee.requireUpdate=!0)},this.isAutoTumble=()=>Y===I.AUTO_TUMBLE,this.enableRaycaster=(Q,xe,Ee)=>{K==null&&(K=new d(Q,this.scene,xe,Ee,this.renderer))},this.disableRaycaster=()=>{K.disable(),K=void 0},this.isSyncControl=()=>currentMpde===I.SYNC_CONTROL,this.enableSyncControl=()=>(Y=I.SYNC_CONTROL,fe||(fe=new S),fe.setCurrentCameraSettings(this.cameraObject,be[H]),fe),this.disableSyncControl=()=>{Y=I.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},y=function(M,_,C,I){var T=M.eyePosition,P=M.targetPosition,A=M.upVector,R=_.eyePosition,L=_.targetPosition,N=_.upVector,x=C,O=I,B=0,D=!1;x.near=Math.min(M.nearPlane,_.nearPlane),x.far=Math.max(M.farPlane,_.farPlane),x.cameraObject.up.set(_.upVector[0],_.upVector[1],_.upVector[2]),this.setDuration=H=>{O=H};var z=H=>{var Y=B+H;Y>O&&(Y=O),B=Y},U=()=>{var H=B/O,Y=[T[0]*(1-H)+R[0]*H,T[1]*(1-H)+R[1]*H,T[2]*(1-H)+R[2]*H],ie=[P[0]*(1-H)+L[0]*H,P[1]*(1-H)+L[1]*H,P[2]*(1-H)+L[2]*H];A[0]*(1-H)+N[0]*H,A[1]*(1-H)+N[1]*H,A[2]*(1-H)+N[2]*H,x.cameraObject.position.set(Y[0],Y[1],Y[2]),x.cameraObject.target.set(ie[0],ie[1],ie[2])};this.update=H=>{this.enabled===!1||(z(H),U(),B==O&&(D=!0))},this.isTransitionCompleted=()=>D},m=function(M,_,C,I){var T=M,P=_,A=C,R=I,L=0,N=!1;this.setDuration=O=>{R=O};var x=O=>{var B=L,D=L+O;D>R&&(D=R),L=D;var z=L-B,U=z/R,H=U*P;A.rotateAboutLookAtpoint(T,H)};this.update=O=>{this.enabled===!1||(x(O),L==R&&(N=!0))},this.isTransitionCompleted=()=>N},d=function(M,_,C,I,T){var P=M,A=_,R=T,L=C,N=I,x=new c.Raycaster;x.params.Line.threshold=.1,x.params.Points.threshold=1;var O=new c.Vector2,B=!1,D=new Date,z=!1,U=0,H=[],Y={zincCamera:void 0,x:-1,y:-1},ie=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=oe=>{if(A!==P){var j=P.getThreeJSScene();R.render(j,oe.cameraObject)}var K=ie||P.getPickableThreeJSObjects();return H.length=0,x.intersectObjects(K,!0,H)},this.setPickableObjects=oe=>{oe===void 0?ie=void 0:(ie=[],oe.forEach(j=>{j.getGroup()&&j.getGroup().visible&&ie.push(j.getGroup())}))},this.getIntersectsObjectWithOrigin=(oe,j,K)=>(x.set(j,K),this.getIntersectsObject(oe)),this.getIntersectsObjectWithCamera=(oe,j,K)=>(oe.getNDCFromDocumentCoords(j,K,O),x.setFromCamera(O,oe.cameraObject),this.getIntersectsObject(oe)),this.pick=(oe,j,K)=>{if(R&&P&&oe&&L){this.getIntersectsObjectWithCamera(oe,j,K);for(var $,re=H.length,G=0;G<re;G++)if($=H[G].object?H[G].object.userData:void 0,$&&$.isMarkerCluster&&$.visible&&$.clusterIsVisible(H[G].object.clusterIndex)&&$.zoomToCluster(H[G].object.clusterIndex))return;L(H,j,K)}};var ae=(oe,j,K)=>{if(R&&P&&oe&&N){if(this.getIntersectsObjectWithCamera(oe,j,K),D.setTime(Date.now()),H.length===0){if(z)return;z=!0}else z=!1;N(H,j,K)}};this.move=(oe,j,K)=>{R&&P&&oe&&N&&(P.displayMarkers?ae(oe,j,K):(Y.zincCamera=oe,Y.x=j,Y.y=K,!B&&(U=D?Date.now()-D.getTime():250,250<=U?ae(oe,j,K):(B=!0,setTimeout(ee(Y),U)))))};var ee=oe=>function(){B=!1,ae(oe.zincCamera,oe.x,oe.y)}},b=function(M,_,C,I){var T=new c.Vector3,P=-_,A=I,R=M;this.stopOnCameraInput=C,this.requireUpdate=!0;var L=new c.Vector3,N=new c.Vector3,x=O=>{var B=Math.sqrt(O[0]*O[0]+O[1]*O[1]),D=4*Math.abs(O[0]),z=4*Math.abs(O[1]),U=.25*(D+z),H=-O[1]/B,Y=O[0]/B,ie=H*O[0]+Y*-O[1];ie>U?ie=U:ie<-U&&(ie=-U);var ae=Math.acos(ie/U)-.5*Math.PI;T.copy(A.cameraObject.position).sub(A.cameraObject.target).normalize(),L.copy(A.cameraObject.up).normalize(),N.crossVectors(L,T).normalize().multiplyScalar(H),L.multiplyScalar(Y),L.add(N).multiplyScalar(Math.cos(ae)),T.multiplyScalar(Math.sin(ae)).add(L)};this.update=O=>{this.enabled===!1||(this.requireUpdate&&(x(R),this.requireUpdate=!1),A.rotateAboutLookAtpoint(T,P*O/1e3))}},v=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new c.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new c.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(v.prototype,{update:(()=>{var E,M,_,C,I,T,P=new c.Matrix4,A=new c.Matrix4;return function(L){var N=E!==L.focus||M!==L.fov||_!==L.aspect*this.aspect||C!==L.near||I!==L.far||T!==L.zoom;if(N){E=L.focus,M=L.fov,_=L.aspect*this.aspect,C=L.near,I=L.far,T=L.zoom;var x,O,B=L.projectionMatrix.clone(),D=.064/2,z=D*C/E,U=C*Math.tan(.5*(c.Math.DEG2RAD*M))/L.zoom;A.elements[12]=-D,P.elements[12]=D,x=-U*_+z,O=U*_+z,B.elements[0]=2*C/(O-x),B.elements[8]=(O+x)/(O-x),this.cameraL.projectionMatrix.copy(B),x=-U*_-z,O=U*_-z,B.elements[0]=2*C/(O-x),B.elements[8]=(O+x)/(O-x),this.cameraR.projectionMatrix.copy(B)}this.cameraL.matrixWorld.copy(L.matrixWorld).multiply(A),this.cameraR.matrixWorld.copy(L.matrixWorld).multiply(P)}})()});var g=function(M){var _=new v;_.aspect=.5,this.setSize=(C,I)=>{M.setSize(C,I)},this.render=(C,I)=>{C.updateMatrixWorld(),I.parent===null&&I.updateMatrixWorld(),_.update(I);var T=M.getSize();M.setScissorTest(!0),M.clear(),M.setScissor(0,0,T.width/2,T.height),M.setViewport(0,0,T.width/2,T.height),M.render(C,_.cameraL),M.setScissor(T.width/2,0,T.width/2,T.height),M.setViewport(T.width/2,0,T.width/2,T.height),M.render(C,_.cameraR),M.setScissorTest(!1)}},w=function(M){var _=this;this.object=M,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var C=P=>{_.deviceOrientation=P},I=()=>{typeof window<"u"&&(_.screenOrientation=window.orientation||0)},T=(()=>{var P=new c.Vector3(0,0,1),A=new c.Euler,R=new c.Quaternion,L=new c.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(N,x,O,B,D)=>{var z=new c.Vector3(0,0,1);z.subVectors(N.target,N.position),A.set(O,x,-B,"YXZ");var U=new c.Quaternion;U.setFromEuler(A),U.multiply(L),U.multiply(R.setFromAxisAngle(P,-D)),z.applyQuaternion(U),z.addVectors(N.position,z),N.lookAt(z)}})();this.connect=()=>{I(),typeof window<"u"&&(window.addEventListener("orientationchange",I,!1),window.addEventListener("deviceorientation",C,!1)),_.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",I,!1),window.removeEventListener("deviceorientation",C,!1)),_.enabled=!1},this.update=()=>{if(_.enabled!==!1){var P=_.deviceOrientation.alpha?c.Math.degToRad(_.deviceOrientation.alpha):0,A=_.deviceOrientation.beta?c.Math.degToRad(_.deviceOrientation.beta):0,R=_.deviceOrientation.gamma?c.Math.degToRad(_.deviceOrientation.gamma):0,L=_.screenOrientation?c.Math.degToRad(_.screenOrientation):0;T(_.object,P,A,R,L)}},this.dispose=function(){this.disconnect()},this.connect()},S=function(){var M=void 0,_=void 0,C=void 0,I=new c.Vector3,T=new c.Vector3,P=new c.Vector3,A=new c.Vector3,R=void 0;this.setCurrentCameraSettings=(L,N)=>{M=L.clone(),_=L,C=N,M.near=C.nearPlane,C.farPlane&&(M.far=C.farPlane),C.eyePosition&&M.position.set(C.eyePosition[0],C.eyePosition[1],C.eyePosition[2]),C.upVector&&M.up.set(C.upVector[0],C.upVector[1],C.upVector[2]),C.targetPosition&&(M.target=new c.Vector3(C.targetPosition[0],C.targetPosition[1],C.targetPosition[2]),M.lookAt(M.target)),M.updateProjectionMatrix(),I.copy(M.position).project(M),T.copy(M.target).project(M)},this.getCurrentPosition=()=>(T.copy(_.target).project(M),[T.x,T.y]),this.zoom=L=>{var N=.002*L,x=Math.max(_.zoom-N,1);_.zoom=x,_.updateProjectionMatrix()},this.zoomToBox=(L,N)=>{L.getCenter(P),P.project(M),this.setCenterZoom([P.x,P.y],N)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:_.zoom}),this.setCenterZoom=(L,N)=>{P.set(L[0],L[1],T.z).unproject(M),A.copy(P).sub(_.target),_.target.copy(P),_.lookAt(_.target),_.position.add(A),_.zoom=N,_.updateProjectionMatrix()},this.setEventCallback=L=>{(L===void 0||typeof L=="function")&&(R=L)},this.triggerCallback=()=>{R!==void 0&&typeof R=="function"&&R()}};l.Viewport=h,l.CameraControls=p,l.SmoothCameraTransition=y,l.RotateCameraTransition=m,l.RayCaster=d,l.CameraAutoTumble=b,l.StereoEffect=g,l.NDCCameraControl=S},(o,l,u)=>{var{Group:c,Matrix4:f}=u(4),h=u(22).Pointset;u(24).Lines;var p=u(45).Lines2,y=u(3).Geometry,m=u(4),d=0,b=function(){return"re"+d++},v=function(g,w){var S=g,E=new c;E.matrixAutoUpdate=!1,E.userData=this;var M=[],_="",C=[],I=w,T=new f,P=3e3;T.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=b(),this.hideAllPrimitives=()=>{M.forEach(A=>A.hideAllPrimitives()),C.forEach(A=>A.setVisibility(!1))},this.showAllPrimitives=()=>{M.forEach(A=>A.showAllPrimitives()),C.forEach(A=>A.setVisibility(!0))},this.setVisibility=A=>{A!=E.visible&&(E.visible=A,this.pickableUpdateRequired=!0)},this.getVisibility=()=>E.visible,this.getGroup=()=>E,this.setTransformation=A=>{T.set(...A),E.matrix.copy(T),E.updateMatrixWorld()},this.setName=A=>{A&&A!==""&&(_=A)},this.getName=()=>_,this.getParent=()=>S,this.getFullSeparatedPath=()=>{var A=[];if(_!==""){A.push(_);for(var R,L=S;L!==void 0;)R=L.getName(),R!==""&&A.unshift(R),L=L.getParent()}return A},this.getFullPath=()=>{var A=this.getFullSeparatedPath();if(0<A.length){var R=A.shift();return A.forEach(L=>{R=R.concat("/",L)}),R}return""},this.createChild=A=>{var R=new v(this,I);return R.setName(A),M.push(R),E.add(R.getGroup()),R},this.getChildWithName=A=>{if(A){for(var R=A.toLowerCase(),L=0;L<M.length;L++)if(M[L].getName().toLowerCase()===R)return M[L]}},this.findChildFromSeparatedPath=A=>{if(A&&0<A.length&&A[0]===""&&A.shift(),A&&0<A.length){var R=this.getChildWithName(A[0]);return R?(A.shift(),R.findChildFromSeparatedPath(A)):void 0}return this},this.findChildFromPath=A=>{var R=A.split("/");return this.findChildFromSeparatedPath(R)},this.createChildFromSeparatedPath=A=>{if(0<A.length&&A[0]===""&&A.shift(),0<A.length){var R=this.getChildWithName(A[0]);return R||(R=this.createChild(A[0])),A.shift(),R.createChildFromSeparatedPath(A)}return this},this.createChildFromPath=A=>{var R=A.split("/");return this.createChildFromSeparatedPath(R)},this.findOrCreateChildFromPath=A=>{var R=this.findChildFromPath(A);return R||(R=this.createChildFromPath(A)),R},this.addZincObject=A=>{A&&(A.setRegion(this),E.add(A.getGroup()),C.push(A),this.pickableUpdateRequired=!0,I&&I.triggerObjectAddedCallback(A))},this.removeZincObject=A=>{for(var R=0;R<C.length;R++)if(A===C[R])return E.remove(A.getGroup()),C.splice(R,1),I&&I.triggerObjectRemovedCallback(A),A.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=A=>{if(this.pickableUpdateRequired)return!0;if(A){for(var R=!1,L=0;L<M.length;L++)if(R=M[L].checkPickableUpdateRequred(A),R)return!0}return!1},this.getPickableThreeJSObjects=(A,R)=>(E.visible&&(C.forEach(L=>{if(L.getGroup()&&L.getGroup().visible){var N=L.marker;N&&N.isEnabled()&&A.push(N.getMorph()),A.push(L.getGroup())}}),R&&M.forEach(L=>{L.getPickableThreeJSObjects(A,R)}),this.pickableUpdateRequired=!1),A),this.setDuration=A=>{P=A,C.forEach(R=>R.setDuration(A)),M.forEach(R=>R.setDuration(A))},this.getDuration=()=>P,this.getBoundingBox=A=>{var R,L;return C.forEach(N=>{L=N.getBoundingBox(),L&&(R==null?R=L.clone():R.union(L))}),A&&M.forEach(N=>{L=N.getBoundingBox(A),L&&(R==null?R=L.clone():R.union(L))}),R},this.clear=A=>{A&&M.forEach(R=>R.clear(A)),C.forEach(R=>{E.remove(R.getGroup()),R.dispose()}),M=[],C=[]},this.objectIsInRegion=(A,R)=>{for(var L=0;L<C.length;L++)if(A===C[L])return!0;if(R){for(var N=0;N<M.length;N++)if(M[N].objectIsInRegion(A,R))return!0}return!1},this.forEachGeometry=(A,R)=>{C.forEach(L=>{L.isGeometry&&A(L)}),R&&M.forEach(L=>L.forEachGeometry(A,R))},this.forEachGlyphset=(A,R)=>{C.forEach(L=>{L.isGlyphset&&A(L)}),R&&M.forEach(L=>L.forEachGlyphset(A,R))},this.forEachPointset=(A,R)=>{C.forEach(L=>{L.isPointset&&A(L)}),R&&M.forEach(L=>L.forEachPointset(A,R))},this.forEachLine=(A,R)=>{C.forEach(L=>{L.isLines&&A(L)}),R&&M.forEach(L=>L.forEachLine(A,R))},this.findObjectsWithAnatomicalId=(A,R)=>(C.forEach(L=>{L.anatomicalId===A&&objectsArray.push(L)}),R&&M.forEach(L=>{var N=L.findObjectsWithAnatomicalId(A,R);objectsArray.push(...N)}),objectsArray),this.findObjectsWithGroupName=(A,R)=>{var L=[];return C.forEach(N=>{var x=N.groupName?N.groupName.toLowerCase():N.groupName,O=A&&A.toLowerCase();x===O&&L.push(N)}),R&&M.forEach(N=>{var x=N.findObjectsWithGroupName(A,R);L.push(...x)}),L},this.findGeometriesWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isGeometry);return N},this.findPointsetsWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isPointset);return N},this.findGlyphsetsWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isGlyphset);return N},this.findLinesWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isLines);return N},this.getAllObjects=A=>{var R=[...C];return A&&M.forEach(L=>{var N=L.getAllObjects(A);R.push(...N)}),R},this.getChildRegions=A=>{var R=[...M];return A&&M.forEach(L=>{var N=L.getChildRegions(A);R.push(...N)}),R},this.getCurrentTime=()=>{if(C[0]!=null)return C[0].getCurrentTime();for(var A,R=0;R<M.length;R++)if(A=M[R].getCurrentTime(),A!==-1)return A;return-1},this.setMorphTime=(A,R)=>{C.forEach(L=>{L.setMorphTime(A)}),R&&M.forEach(L=>{L.setMorphTime(A)})},this.isTimeVarying=()=>{for(var A=0;A<C.length;A++)if(C[A].isTimeVarying())return!0;for(var R=0;R<M.length;R++)if(M[R].isTimeVarying())return!0;return!1},this.renderGeometries=(A,R,L,N,x,O)=>{var B,D=this.getAllObjects(O);D.forEach(z=>{z.render(A*R,L,N,x)}),x&&L===!1&&(B=x.markerCluster)!==null&&B!==void 0&&B.markerUpdateRequired&&x.markerCluster.calculate()},this.createPoints=(A,R,L,N)=>{var x=!1,O=this.findObjectsWithGroupName(A,!1),B=O.findIndex(z=>z.isPointset),D=-1<B?O[B]:new h;return D.addPoints(R,L,N),B===-1?(D.setName(A),this.addZincObject(D),x=!0):this.pickableUpdateRequired=!0,{zincObject:D,isNew:x}},this.createLines=(A,R,L)=>{var N=!1,x=this.findObjectsWithGroupName(A,!1),O=x.findIndex(D=>D.isLines),B=-1<O?x[O]:new p;return B.addLines(R,L),O===-1?(B.setName(A),this.addZincObject(B),N=!0):this.pickableUpdateRequired=!0,{zincObject:B,isNew:N}},this.createGeometryFromThreeJSGeometry=(A,R,L,N,x,O)=>{var B=new y,D=new m.MeshPhongMaterial({color:L,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:N,side:m.DoubleSide});return B.createMesh(R,D,{localTimeEnabled:!1,localMorphColour:!1}),B.getMorph()?(B.setVisibility(!1),B.setName(A),B.setRenderOrder(O),this.addZincObject(B),B):void 0}};l.Region=v},(o,l,u)=>{u(4),u(5).toBufferGeometry;var c=u(46).LineSegments2,f=u(48).LineMaterial,h=u(47).LineSegmentsGeometry,p=function(){u(24).Lines.call(this),this.isLines2=!0;var y=Array(300);this.createLineSegment=(m,d,b)=>{if(m&&d){var v=new h;v.setPositions(m),v.colorsNeedUpdate=!0;var g=new c(v,d);g.scale.set(1,1,1),g.computeLineDistances(),this.setMesh(g,b.localTimeEnabled,b.localMorphColour)}},this.setWidth=m=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=m,this.morph.material.needsUpdate=!0)},this.addVertices=function(m){if(m&&m.length){var d=this.getMorph();d||(this.drawRange=0);var b=3*this.drawRange;if(m.forEach(v=>{y[b++]=v[0],y[b++]=v[1],y[b++]=v[2],this.drawRange++}),!d)for(;300>b;)y[b++]=m[0][0],y[b++]=m[0][1],y[b++]=m[0][2];d&&(d.geometry.setPositions(y),d.computeLineDistances(),this.boundingBoxUpdateRequired=!0)}return y},this.getVerticesByFaceIndex=function(m){var d=3*(2*m),b=this.getMorph();if(b&&3*this.drawRange>d){var v=b.geometry.getAttribute("instanceStart");return[[v.data.array[d],v.data.array[++d],v.data.array[++d]],[v.data.array[++d],v.data.array[++d],v.data.array[++d]]]}return[]},this.editVertices=function(m,d){if(m&&m.length){var b=this.getMorph(),v=d+m.length-1;if(!b||0>d||v>=this.drawRange)return;var g=3*d;for(m.forEach(w=>{y[g++]=w[0],y[g++]=w[1],y[g++]=w[2]}),g=3*this.drawRange;300>g;)y[g++]=m[0][0],y[g++]=m[0][1],y[g++]=m[0][2];b.geometry.setPositions(y),b.computeLineDistances(),this.boundingBoxUpdateRequired=!0}return y},this.addLines=(m,d)=>{if(m&&0<m.length){this.addVertices(m);var b=this.getMorph();if(!b){var v=new f({color:d,linewidth:1,vertexColors:!1,worldUnits:!1});v.resolution.set(window.innerWidth,window.innerHeight),this.createLineSegment(y,v,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=()=>{var m=this.getMorph().material;m.resolution.set(window.innerWidth,window.innerHeight)}};p.prototype=Object.create(u(24).Lines.prototype),p.prototype.constructor=p,l.Lines2=p},(o,l,u)=>{u.r(l),u.d(l,{LineSegments2:()=>C});var c=u(4),f=u(47),h=u(48),p=new c.Vector3,y=new c.Vector3,m=new c.Vector4,d=new c.Vector4,b=new c.Vector4,v=new c.Vector3,g=new c.Matrix4,w=new c.Line3,S=new c.Vector3,E=new c.Box3,M=new c.Sphere,_=new c.Vector4;class C extends c.Mesh{constructor(){var T=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new f.LineSegmentsGeometry,P=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new h.LineMaterial({color:16777215*Math.random()});super(T,P),this.type="LineSegments2"}computeLineDistances(){for(var T=this.geometry,P=T.attributes.instanceStart,A=T.attributes.instanceEnd,R=new Float32Array(2*P.count),L=0,N=0,x=P.count;L<x;L++,N+=2)p.fromBufferAttribute(P,L),y.fromBufferAttribute(A,L),R[N]=N==0?0:R[N-1],R[N+1]=R[N]+p.distanceTo(y);var O=new c.InstancedInterleavedBuffer(R,2,1);return T.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(O,1,0)),T.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(O,1,1)),this}raycast(T,P){T.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var A=T.params.Line2===void 0?0:T.params.Line2.threshold||0,R=T.ray,L=T.camera,N=L.projectionMatrix,x=this.matrixWorld,O=this.geometry,B=this.material,D=B.resolution,z=B.linewidth+A,U=O.attributes.instanceStart,H=O.attributes.instanceEnd,Y=-L.near,ie=2*Math.max(z/D.width,z/D.height);O.boundingSphere===null&&O.computeBoundingSphere(),M.copy(O.boundingSphere).applyMatrix4(x);var ae=Math.max(L.near,M.distanceToPoint(R.origin));_.set(0,0,-ae,1).applyMatrix4(L.projectionMatrix),_.multiplyScalar(1/_.w),_.applyMatrix4(L.projectionMatrixInverse);var ee=.5*Math.abs(ie/_.w);if(M.radius+=ee,T.ray.intersectsSphere(M)!==!1){O.boundingBox===null&&O.computeBoundingBox(),E.copy(O.boundingBox).applyMatrix4(x);var oe=Math.max(L.near,E.distanceToPoint(R.origin));_.set(0,0,-oe,1).applyMatrix4(L.projectionMatrix),_.multiplyScalar(1/_.w),_.applyMatrix4(L.projectionMatrixInverse);var j=.5*Math.abs(ie/_.w);if(E.max.x+=j,E.max.y+=j,E.max.z+=j,E.min.x-=j,E.min.y-=j,E.min.z-=j,T.ray.intersectsBox(E)!==!1){R.at(1,b),b.w=1,b.applyMatrix4(L.matrixWorldInverse),b.applyMatrix4(N),b.multiplyScalar(1/b.w),b.x*=D.x/2,b.y*=D.y/2,b.z=0,v.copy(b),g.multiplyMatrices(L.matrixWorldInverse,x);for(var K=0,$=U.count;K<$;K++){m.fromBufferAttribute(U,K),d.fromBufferAttribute(H,K),m.w=1,d.w=1,m.applyMatrix4(g),d.applyMatrix4(g);var re=m.z>Y&&d.z>Y;if(!re){if(m.z>Y){var G=m.z-d.z,W=(m.z-Y)/G;m.lerp(d,W)}else if(d.z>Y){var F=d.z-m.z,X=(d.z-Y)/F;d.lerp(m,X)}m.applyMatrix4(N),d.applyMatrix4(N),m.multiplyScalar(1/m.w),d.multiplyScalar(1/d.w),m.x*=D.x/2,m.y*=D.y/2,d.x*=D.x/2,d.y*=D.y/2,w.start.copy(m),w.start.z=0,w.end.copy(d),w.end.z=0;var J=w.closestPointToPointParameter(v,!0);w.at(J,S);var V=c.MathUtils.lerp(m.z,d.z,J),k=-1<=V&&1>=V,te=v.distanceTo(S)<.5*z;if(k&&te){w.start.fromBufferAttribute(U,K),w.end.fromBufferAttribute(H,K),w.start.applyMatrix4(x),w.end.applyMatrix4(x);var se=new c.Vector3,le=new c.Vector3;R.distanceSqToSegment(w.start,w.end,le,se),P.push({point:le,pointOnLine:se,distance:R.origin.distanceTo(le),object:this,face:null,faceIndex:K,uv:null,uv2:null})}}}}}}}C.prototype.LineSegments2=!0},(o,l,u)=>{u.r(l),u.d(l,{LineSegmentsGeometry:()=>p});var c=u(4),f=new c.Box3,h=new c.Vector3;class p extends c.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new c.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new c.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(m){var d=this.attributes.instanceStart,b=this.attributes.instanceEnd;return d!==void 0&&(d.applyMatrix4(m),b.applyMatrix4(m),d.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(m){var d;m instanceof Float32Array?d=m:Array.isArray(m)&&(d=new Float32Array(m));var b=new c.InstancedInterleavedBuffer(d,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(b,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(b,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(m){var d;m instanceof Float32Array?d=m:Array.isArray(m)&&(d=new Float32Array(m));var b=new c.InstancedInterleavedBuffer(d,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(b,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(b,3,3)),this}fromWireframeGeometry(m){return this.setPositions(m.attributes.position.array),this}fromEdgesGeometry(m){return this.setPositions(m.attributes.position.array),this}fromMesh(m){return this.fromWireframeGeometry(new c.WireframeGeometry(m.geometry)),this}fromLineSegments(m){var d=m.geometry;return d.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(d.isBufferGeometry&&this.setPositions(d.attributes.position.array),this)}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);var m=this.attributes.instanceStart,d=this.attributes.instanceEnd;m!==void 0&&d!==void 0&&(this.boundingBox.setFromBufferAttribute(m),f.setFromBufferAttribute(d),this.boundingBox.union(f))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();var m=this.attributes.instanceStart,d=this.attributes.instanceEnd;if(m!==void 0&&d!==void 0){var b=this.boundingSphere.center;this.boundingBox.getCenter(b);for(var v=0,g=0,w=m.count;g<w;g++)h.fromBufferAttribute(m,g),v=Math.max(v,b.distanceToSquared(h)),h.fromBufferAttribute(d,g),v=Math.max(v,b.distanceToSquared(h));this.boundingSphere.radius=Math.sqrt(v),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(m){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(m)}}p.prototype.isLineSegmentsGeometry=!0},(o,l,u)=>{u.r(l),u.d(l,{LineMaterial:()=>f});var c=u(4);c.UniformsLib.line={linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
3231
+ `),I="",T="",P=0,A=[],R=typeof"".trimLeft=="function",L=0,N=C.length;L<N;L++)if(I=C[L],I=R?I.trimLeft():I.trim(),P=I.length,P!==0&&(T=I.charAt(0),T!=="#"))if(T==="v"){var x=I.split(/\s+/);switch(x[0]){case"v":_.vertices.push(parseFloat(x[1]),parseFloat(x[2]),parseFloat(x[3])),7<=x.length?_.colors.push(parseFloat(x[4]),parseFloat(x[5]),parseFloat(x[6])):_.colors.push(void 0,void 0,void 0);break;case"vn":_.normals.push(parseFloat(x[1]),parseFloat(x[2]),parseFloat(x[3]));break;case"vt":_.uvs.push(parseFloat(x[1]),parseFloat(x[2]))}}else if(T==="f"){for(var O,B=I.substr(1).trim(),D=B.split(/\s+/),z=[],U=0,H=D.length;U<H;U++)if(O=D[U],0<O.length){var Y=O.split("/");z.push(Y)}for(var ie=z[0],ae=1,ee=z.length-1;ae<ee;ae++){var oe=z[ae],j=z[ae+1];_.addFace(ie[0],oe[0],j[0],ie[1],oe[1],j[1],ie[2],oe[2],j[2])}}else if(T==="l"){var K=I.substring(1).trim().split(" "),$=[],re=[];if(I.indexOf("/")===-1)$=K;else for(var G,W=0,F=K.length;W<F;W++)G=K[W].split("/"),G[0]!==""&&$.push(G[0]),G[1]!==""&&re.push(G[1]);_.addLineGeometry($,re)}else if(T==="p"){var X=I.substr(1).trim(),J=X.split(" ");_.addPointGeometry(J)}else if((A=f.exec(I))!==null){var V=(" "+A[0].substr(1).trim()).substr(1);_.startObject(V)}else if(p.test(I))_.object.startMaterial(I.substring(7).trim(),_.materialLibraries);else if(h.test(I))_.materialLibraries.push(I.substring(7).trim());else if(y.test(I))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(T==="s"){if(A=I.split(" "),1<A.length){var k=A[1].trim().toLowerCase();_.object.smooth=k!=="0"&&k!=="off"}else _.object.smooth=!0;var te=_.object.currentMaterial();te&&(te.smooth=_.object.smooth)}else{if(I==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+I+'"')}_.finalize();var se=new c.Group;se.materialLibraries=[].concat(_.materialLibraries);var le=_.objects.length!==1||_.objects[0].geometry.vertices.length!==0;if(le==!0)for(var fe=0,we=_.objects.length;fe<we;fe++){var be=_.objects[fe],de=be.geometry,ye=be.materials,ne=de.type==="Line",he=de.type==="Points",me=!1;if(de.vertices.length!==0){var Re=new c.BufferGeometry;Re.setAttribute("position",new c.Float32BufferAttribute(de.vertices,3)),0<de.normals.length&&Re.setAttribute("normal",new c.Float32BufferAttribute(de.normals,3)),0<de.colors.length&&(me=!0,Re.setAttribute("color",new c.Float32BufferAttribute(de.colors,3))),de.hasUVIndices===!0&&Re.setAttribute("uv",new c.Float32BufferAttribute(de.uvs,2));for(var Te=[],De=0,Ye=ye.length;De<Ye;De++){var ze=ye[De],st=ze.name+"_"+ze.smooth+"_"+me,Ce=_.materials[st];if(this.materials!==null){if(Ce=this.materials.create(ze.name),ne&&Ce&&!(Ce instanceof c.LineBasicMaterial)){var He=new c.LineBasicMaterial;c.Material.prototype.copy.call(He,Ce),He.color.copy(Ce.color),Ce=He}else if(he&&Ce&&!(Ce instanceof c.PointsMaterial)){var Ge=new c.PointsMaterial({size:10,sizeAttenuation:!1});c.Material.prototype.copy.call(Ge,Ce),Ge.color.copy(Ce.color),Ge.map=Ce.map,Ce=Ge}}Ce===void 0&&(Ce=ne?new c.LineBasicMaterial:he?new c.PointsMaterial({size:1,sizeAttenuation:!1}):new c.MeshPhongMaterial,Ce.name=ze.name,Ce.flatShading=!ze.smooth,Ce.vertexColors=me,_.materials[st]=Ce),Te.push(Ce)}var Ot=void 0;if(1<Te.length){for(var Nt,mt=0,xt=ye.length;mt<xt;mt++)Nt=ye[mt],Re.addGroup(Nt.groupStart,Nt.groupCount,mt);Ot=ne?new c.LineSegments(Re,Te):he?new c.Points(Re,Te):new c.Mesh(Re,Te)}else Ot=ne?new c.LineSegments(Re,Te[0]):he?new c.Points(Re,Te[0]):new c.Mesh(Re,Te[0]);Ot.name=be.name,se.add(Ot)}}else if(0<_.vertices.length){var Vi=new c.PointsMaterial({size:1,sizeAttenuation:!1}),ki=new c.BufferGeometry;ki.setAttribute("position",new c.Float32BufferAttribute(_.vertices,3)),0<_.colors.length&&_.colors[0]!==void 0&&(ki.setAttribute("color",new c.Float32BufferAttribute(_.colors,3)),Vi.vertexColors=!0);var Hn=new c.Points(ki,Vi);se.add(Hn)}return se}}},(o,l,u)=>{function c(S,E){var M=Object.keys(S);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(S);E&&(_=_.filter(function(C){return Object.getOwnPropertyDescriptor(S,C).enumerable})),M.push.apply(M,_)}return M}function f(S){for(var E,M=1;M<arguments.length;M++)E=arguments[M]==null?{}:arguments[M],M%2?c(Object(E),!0).forEach(function(_){h(S,_,E[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(S,Object.getOwnPropertyDescriptors(E)):c(Object(E)).forEach(function(_){Object.defineProperty(S,_,Object.getOwnPropertyDescriptor(E,_))});return S}function h(S,E,M){return E=p(E),E in S?Object.defineProperty(S,E,{value:M,enumerable:!0,configurable:!0,writable:!0}):S[E]=M,S}function p(S){var E=y(S,"string");return typeof E=="symbol"?E:E+""}function y(S,E){if(typeof S!="object"||!S)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var _=M.call(S,E||"default");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(S)}var m=u(19).JSONLoader,d=u(4),b=d.FileLoader,v=S=>{var E=(_,C)=>{_.merge(C)};if(S&&0<S.length){for(;1<S.length;){var M=S.splice(1,1);E(S[0],M[0])}return S[0]}},g=function(E,M,_){var C=new b,I=new m;C.crossOrigin=M;var T=E,P=_,A=void 0,R=!1,L=!1,N=void 0,x=[],O=U=>{var H=A[U.index];if(H){var Y=I.parse(H);U.onLoad(Y.geometry,Y.materials)}else B(U)},B=U=>{U.onError&&(!N&&(N={responseURL:T}),U.onError(N))};this.downloadCompleted=U=>{try{A=JSON.parse(U[0]),R=!1,L=!0,Array.isArray(A)?x.forEach(H=>O(H)):x.forEach(H=>B(H))}catch{x.forEach(Y=>B(Y))}};var D=()=>U=>{N=U,L=!0,R=!1,x.forEach(H=>{B(H)})},z=()=>U=>{x.forEach(H=>{H.onProgress&&H.onProgress(U)})};this.load=(U,H,Y,ie)=>{var ae={index:U,onLoad:H,onProgress:Y,onError:ie};L?A?O(ae):B(N):R?x.push(ae):(x.push(ae),R=!0,C.load(T,P,z,D))}},w=function(E,M){var _=[],C=E,I=M,T=0;this.itemDownloaded=(P,A)=>{if(_[P]=A,T++,T==C){for(var R=_[0][1],L=_.map(O=>O[0]),N=v(L),x=1;x<C;x++)_[P][0].dispose(),_[P][1].forEach(O=>O.dispose());I(N,R)}}};l.PrimitivesLoader=function(){var S=0,E=20;this.crossOrigin="Anonymous";var M=new m,_=[],C={},I=(R,L,N,x,O)=>{var B=R.length,D=new w(B,L),z=0;R.forEach(U=>{var H=O?f({},O):{};H.msHandler=D,H.order=z,z++,P(U,L,N,x,H)})},T=(R,L,N,x,O)=>{var B=O?f({},O):{},D=C[R];if(!D)if(E>S){var z=new A(void 0,this,B);++S,D=new g(R,this.crossOrigin,z),C[R]=D}else _.push({url:R,onLoad:L,onProgress:N,onError:x,options:O});D&&(B.isHandler=D,D.load(O.index,L,N,x))},P=(R,L,N,x,O)=>{if(O&&O.index!==void 0)T(R,L,N,x,O);else if(E>S){++S;var B=new A(L,this,O),D=new A(x,this,O);M.crossOrigin=this.crossOrigin,M.load(R,B,N,D)}else _.push({url:R,onLoad:L,onProgress:N,onError:x,options:O})};this.load=(R,L,N,x,O)=>{Array.isArray(R)?I(R,L,N,x,O):P(R,L,N,x,O)},this.loadFromWaitingList=()=>{for(;E>S;){var R=_.shift();if(R)this.load(R.url,R.onLoad,R.onProgress,R.onError,R.options);else return}},this.itemRemainingCheck=()=>{if(_.length===0&&S==0)for(var R in C)C.hasOwnProperty(R)&&delete C[R]};var A=function(L,N,x){return function(){--S;for(var O=arguments.length,B=Array(O),D=0;D<O;D++)B[D]=arguments[D];x!=null&&x.msHandler?x.msHandler.itemDownloaded(x.order,B):x!=null&&x.isHandler?x.isHandler.downloadCompleted(B):L&&L(...B),N.loadFromWaitingList(),N.itemRemainingCheck()}};this.parse=R=>M.parse(R)}},(o,l,u)=>{u(4);var c=u(40).GLTFLoader,f=function(){var h=this;this.parseGLTFObjects=(p,y,m,d)=>{var b=y;if(m!==0){if(p.type!=="Object3D"){var v;if(p.type==="Mesh"?v=new(u(3)).Geometry:p.type==="LineSegments"?v=new(u(24)).Lines:p.type==="Points"&&(v=new(u(22)).Pointset),v){var g=!1,w=!1;p.geometry&&p.geometry.morphAttributes&&(g=!!p.geometry.morphAttributes.position,w=!!p.geometry.morphAttributes.color),v.setMesh(p.clone(),g,w);var S=v.getMorph();v.groupName=S.name,S.matrixAutoUpdate=!0,y.addZincObject(v),d!=null&&typeof d=="function"&&d(v)}}else if(p.name!==""&&(y&&(b=y.findOrCreateChildFromPath(p.name)),b)){var E=b.getGroup();E.position.copy(p.position),E.rotation.copy(p.rotation),E.quaternion.copy(p.quaternion),E.matrixAutoUpdate=!0}}m++,p.children.forEach(M=>{h.parseGLTFObjects(M,b,m,d)})},this.setCamera=p=>{p.viewAll();var y=p.getZincCameraControls(),m=y.getCurrentViewport();y.addViewport("default",m),y.setDefaultViewport("default")},this.load=(p,y,m,d,b)=>{var v=m.substring(0,m.lastIndexOf("/")+1),g=m.substring(m.lastIndexOf("/")+1,m.length),w=new c().setPath(v);w.load(g,function(S){console.log(S),h.parseGLTFObjects(S.scene,y,0,d),h.setCamera(p),b!=null&&typeof b=="function"&&b()})}};l.GLTFToZincJSLoader=f},o=>{o.exports=XB},(o,l,u)=>{var c=u(42).GLTFExporter,f=function(h){var p=h;this.exportGLTF=y=>{var m=p.getRootRegion(),d=m.getAllObjects(!0),b=[];d.forEach(w=>{w.animationClip&&b.push({clip:w.animationClip[0],mesh:w.getMorph()})});var v=new c,g={binary:y,animations:b};return new Promise(w=>{v.parse(p.getThreeJSScene(),function(S){w(S)},g)})}};l.SceneExporter=f},(o,l,u)=>{u.r(l),u.d(l,{GLTFExporter:()=>f});var c=u(4);class f{constructor(){this.pluginCallbacks=[],this.register(function(x){return new A(x)}),this.register(function(x){return new R(x)}),this.register(function(x){return new L(x)})}register(x){return this.pluginCallbacks.indexOf(x)===-1&&this.pluginCallbacks.push(x),this}unregister(x){return this.pluginCallbacks.indexOf(x)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(x),1),this}parse(x,O,B){for(var D=new P,z=[],U=0,H=this.pluginCallbacks.length;U<H;U++)z.push(this.pluginCallbacks[U](D));D.setPlugins(z),D.write(x,O,B)}}var h={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},p={};p[c.NearestFilter]=h.NEAREST,p[c.NearestMipmapNearestFilter]=h.NEAREST_MIPMAP_NEAREST,p[c.NearestMipmapLinearFilter]=h.NEAREST_MIPMAP_LINEAR,p[c.LinearFilter]=h.LINEAR,p[c.LinearMipmapNearestFilter]=h.LINEAR_MIPMAP_NEAREST,p[c.LinearMipmapLinearFilter]=h.LINEAR_MIPMAP_LINEAR,p[c.ClampToEdgeWrapping]=h.CLAMP_TO_EDGE,p[c.RepeatWrapping]=h.REPEAT,p[c.MirroredRepeatWrapping]=h.MIRRORED_REPEAT;var y={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},m=12,d=1179937895,b=2,v=8,g=1313821514,w=5130562;function S(N,x){return N.length===x.length&&N.every(function(O,B){return O===x[B]})}function E(N){if(window.TextEncoder!==void 0)return new TextEncoder().encode(N).buffer;for(var x,O=new Uint8Array(new ArrayBuffer(N.length)),B=0,D=N.length;B<D;B++)x=N.charCodeAt(B),O[B]=255<x?32:x;return O.buffer}function M(N){return S(N.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function _(N,x,O){for(var B={min:Array(N.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(N.itemSize).fill(Number.NEGATIVE_INFINITY)},D=x;D<x+O;D++)for(var z,U=0;U<N.itemSize;U++)z=void 0,4<N.itemSize?z=N.array[D*N.itemSize+U]:U===0?z=N.getX(D):U===1?z=N.getY(D):U===2?z=N.getZ(D):U==3&&(z=N.getW(D)),B.min[U]=Math.min(B.min[U],z),B.max[U]=Math.max(B.max[U],z);return B}function C(N){return 4*Math.ceil(N/4)}function I(N){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,O=C(N.byteLength);if(O!==N.byteLength){var B=new Uint8Array(O);if(B.set(new Uint8Array(N)),x!==0)for(var D=N.byteLength;D<O;D++)B[D]=x;return B.buffer}return N}var T=null;class P{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(x){this.plugins=x}write(x,O,B){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},B),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(x);var D=this;Promise.all(this.pending).then(function(){var z=D.buffers,U=D.json,H=D.options,Y=D.extensionsUsed,ie=new Blob(z,{type:"application/octet-stream"}),ae=Object.keys(Y);if(0<ae.length&&(U.extensionsUsed=ae),U.buffers&&0<U.buffers.length&&(U.buffers[0].byteLength=ie.size),H.binary===!0){var ee=new window.FileReader;ee.readAsArrayBuffer(ie),ee.onloadend=function(){var j=I(ee.result),K=new DataView(new ArrayBuffer(v));K.setUint32(0,j.byteLength,!0),K.setUint32(4,w,!0);var $=I(E(JSON.stringify(U)),32),re=new DataView(new ArrayBuffer(v));re.setUint32(0,$.byteLength,!0),re.setUint32(4,g,!0);var G=new ArrayBuffer(m),W=new DataView(G);W.setUint32(0,d,!0),W.setUint32(4,b,!0);var F=m+re.byteLength+$.byteLength+K.byteLength+j.byteLength;W.setUint32(8,F,!0);var X=new Blob([G,re,$,K,j],{type:"application/octet-stream"}),J=new window.FileReader;J.readAsArrayBuffer(X),J.onloadend=function(){O(J.result)}}}else if(U.buffers&&0<U.buffers.length){var oe=new window.FileReader;oe.readAsDataURL(ie),oe.onloadend=function(){var j=oe.result;U.buffers[0].uri=j,O(U)}}else O(U)})}serializeUserData(x,O){if(!(x.userData&&x.userData.isZincObject)&&Object.keys(x.userData).length!==0){var B=this.options,D=this.extensionsUsed;try{var z=JSON.parse(JSON.stringify(x.userData));if(B.includeCustomExtensions&&z.gltfExtensions){for(var U in O.extensions===void 0&&(O.extensions={}),z.gltfExtensions)O.extensions[U]=z.gltfExtensions[U],D[U]=!0;delete z.gltfExtensions}0<Object.keys(z).length&&(O.extras=z)}catch(H){console.warn("THREE.GLTFExporter: userData of '"+x.name+"' won't be serialized because of JSON.stringify error - "+H.message)}}}getUID(x){return this.uids.has(x)||this.uids.set(x,this.uid++),this.uids.get(x)}isNormalizedNormalAttribute(x){var O=this.cache;if(O.attributesNormalized.has(x))return!1;for(var B=new c.Vector3,D=0,z=x.count;D<z;D++)if(5e-4<Math.abs(B.fromBufferAttribute(x,D).length()-1))return!1;return!0}createNormalizedNormalAttribute(x){var O=this.cache;if(O.attributesNormalized.has(x))return O.attributesNormalized.get(x);for(var B=x.clone(),D=new c.Vector3,z=0,U=B.count;z<U;z++)D.fromBufferAttribute(B,z),D.x===0&&D.y===0&&D.z===0?D.setX(1):D.normalize(),B.setXYZ(z,D.x,D.y,D.z);return O.attributesNormalized.set(x,B),B}applyTextureTransform(x,O){var B=!1,D={};(O.offset.x!==0||O.offset.y!==0)&&(D.offset=O.offset.toArray(),B=!0),O.rotation!==0&&(D.rotation=O.rotation,B=!0),(O.repeat.x!==1||O.repeat.y!==1)&&(D.scale=O.repeat.toArray(),B=!0),B&&(x.extensions=x.extensions||{},x.extensions.KHR_texture_transform=D,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(x){var O=this.json,B=this.buffers;return O.buffers||(O.buffers=[{byteLength:0}]),B.push(x),0}processBufferView(x,O,B,D,z){var U=this.json;U.bufferViews||(U.bufferViews=[]);for(var H=O===h.UNSIGNED_BYTE?1:O===h.UNSIGNED_SHORT?2:4,Y=C(D*x.itemSize*H),ie=new DataView(new ArrayBuffer(Y)),ae=0,ee=B;ee<B+D;ee++)for(var oe,j=0;j<x.itemSize;j++)oe=void 0,4<x.itemSize?oe=x.array[ee*x.itemSize+j]:j===0?oe=x.getX(ee):j===1?oe=x.getY(ee):j===2?oe=x.getZ(ee):j==3&&(oe=x.getW(ee)),O===h.FLOAT?ie.setFloat32(ae,oe,!0):O===h.UNSIGNED_INT?ie.setUint32(ae,oe,!0):O===h.UNSIGNED_SHORT?ie.setUint16(ae,oe,!0):O===h.UNSIGNED_BYTE&&ie.setUint8(ae,oe),ae+=H;var K={buffer:this.processBuffer(ie.buffer),byteOffset:this.byteOffset,byteLength:Y};z!==void 0&&(K.target=z),z===h.ARRAY_BUFFER&&(K.byteStride=x.itemSize*H),this.byteOffset+=Y,U.bufferViews.push(K);var $={id:U.bufferViews.length-1,byteLength:0};return $}processBufferViewImage(x){var O=this,B=O.json;return B.bufferViews||(B.bufferViews=[]),new Promise(function(D){var z=new window.FileReader;z.readAsArrayBuffer(x),z.onloadend=function(){var U=I(z.result),H={buffer:O.processBuffer(U),byteOffset:O.byteOffset,byteLength:U.byteLength};O.byteOffset+=U.byteLength,D(B.bufferViews.push(H)-1)}})}processAccessor(x,O,B,D){var z,U=this.options,H=this.json;if(x.array.constructor===Float32Array)z=h.FLOAT;else if(x.array.constructor===Uint32Array)z=h.UNSIGNED_INT;else if(x.array.constructor===Uint16Array)z=h.UNSIGNED_SHORT;else if(x.array.constructor===Uint8Array)z=h.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(B===void 0&&(B=0),D===void 0&&(D=x.count),U.truncateDrawRange&&O!==void 0&&O.index===null){var Y=B+D,ie=O.drawRange.count===1/0?x.count:O.drawRange.start+O.drawRange.count;B=Math.max(B,O.drawRange.start),D=Math.min(Y,ie)-B,0>D&&(D=0)}if(D===0)return null;var ae,ee=_(x,B,D);O!==void 0&&(ae=x===O.index?h.ELEMENT_ARRAY_BUFFER:h.ARRAY_BUFFER);var oe=this.processBufferView(x,z,B,D,ae),j={bufferView:oe.id,byteOffset:oe.byteOffset,componentType:z,count:D,max:ee.max,min:ee.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[x.itemSize]};return x.normalized===!0&&(j.normalized=!0),H.accessors||(H.accessors=[]),H.accessors.push(j)-1}processImage(x,O,B){var D=this,z=D.cache,U=D.json,H=D.options,Y=D.pending;z.images.has(x)||z.images.set(x,{});var ie=z.images.get(x),ae=O===c.RGBAFormat?"image/png":"image/jpeg",ee=ae+":flipY/"+B.toString();if(ie[ee]!==void 0)return ie[ee];U.images||(U.images=[]);var oe={mimeType:ae};if(H.embedImages){var j=T=T||document.createElement("canvas");j.width=Math.min(x.width,H.maxTextureSize),j.height=Math.min(x.height,H.maxTextureSize);var K=j.getContext("2d");if(B===!0&&(K.translate(0,j.height),K.scale(1,-1)),typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&x instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&x instanceof ImageBitmap)K.drawImage(x,0,0,j.width,j.height);else{O!==c.RGBAFormat&&O!==c.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(x.width>H.maxTextureSize||x.height>H.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",x);var $=new Uint8ClampedArray(4*(x.height*x.width));if(O===c.RGBAFormat)for(var re=0;re<$.length;re+=4)$[re+0]=x.data[re+0],$[re+1]=x.data[re+1],$[re+2]=x.data[re+2],$[re+3]=x.data[re+3];else for(var G=0,W=0;G<$.length;G+=4,W+=3)$[G+0]=x.data[W+0],$[G+1]=x.data[W+1],$[G+2]=x.data[W+2],$[G+3]=255;K.putImageData(new ImageData($,x.width,x.height),0,0)}H.binary===!0?Y.push(new Promise(function(X){j.toBlob(function(J){D.processBufferViewImage(J).then(function(V){oe.bufferView=V,X()})},ae)})):oe.uri=j.toDataURL(ae)}else oe.uri=x.src;var F=U.images.push(oe)-1;return ie[ee]=F,F}processSampler(x){var O=this.json;O.samplers||(O.samplers=[]);var B={magFilter:p[x.magFilter],minFilter:p[x.minFilter],wrapS:p[x.wrapS],wrapT:p[x.wrapT]};return O.samplers.push(B)-1}processTexture(x){var O=this.cache,B=this.json;if(O.textures.has(x))return O.textures.get(x);B.textures||(B.textures=[]);var D={sampler:this.processSampler(x),source:this.processImage(x.image,x.format,x.flipY)};x.name&&(D.name=x.name),this._invokeAll(function(U){U.writeTexture&&U.writeTexture(x,D)});var z=B.textures.push(D)-1;return O.textures.set(x,z),z}processMaterial(x){var O=this.cache,B=this.json;if(O.materials.has(x))return O.materials.get(x);if(x.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;B.materials||(B.materials=[]);var D={pbrMetallicRoughness:{}};x.isMeshStandardMaterial!==!0&&x.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var z=x.color.toArray().concat([x.opacity]);if(S(z,[1,1,1,1])||(D.pbrMetallicRoughness.baseColorFactor=z),x.isMeshStandardMaterial?(D.pbrMetallicRoughness.metallicFactor=x.metalness,D.pbrMetallicRoughness.roughnessFactor=x.roughness):(D.pbrMetallicRoughness.metallicFactor=.5,D.pbrMetallicRoughness.roughnessFactor=.5),x.metalnessMap||x.roughnessMap)if(x.metalnessMap===x.roughnessMap){var U={index:this.processTexture(x.metalnessMap)};this.applyTextureTransform(U,x.metalnessMap),D.pbrMetallicRoughness.metallicRoughnessTexture=U}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(x.map){var H={index:this.processTexture(x.map)};this.applyTextureTransform(H,x.map),D.pbrMetallicRoughness.baseColorTexture=H}if(x.emissive){var Y=x.emissive.clone().multiplyScalar(x.emissiveIntensity),ie=Math.max(Y.r,Y.g,Y.b);if(1<ie&&(Y.multiplyScalar(1/ie),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<ie&&(D.emissiveFactor=Y.toArray()),x.emissiveMap){var ae={index:this.processTexture(x.emissiveMap)};this.applyTextureTransform(ae,x.emissiveMap),D.emissiveTexture=ae}}if(x.normalMap){var ee={index:this.processTexture(x.normalMap)};x.normalScale&&x.normalScale.x!==-1&&(x.normalScale.x!==x.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),ee.scale=x.normalScale.x),this.applyTextureTransform(ee,x.normalMap),D.normalTexture=ee}if(x.aoMap){var oe={index:this.processTexture(x.aoMap),texCoord:1};x.aoMapIntensity!==1&&(oe.strength=x.aoMapIntensity),this.applyTextureTransform(oe,x.aoMap),D.occlusionTexture=oe}x.transparent?D.alphaMode="BLEND":0<x.alphaTest&&(D.alphaMode="MASK",D.alphaCutoff=x.alphaTest),x.side===c.DoubleSide&&(D.doubleSided=!0),x.name!==""&&(D.name=x.name),this.serializeUserData(x,D),this._invokeAll(function(K){K.writeMaterial&&K.writeMaterial(x,D)});var j=B.materials.push(D)-1;return O.materials.set(x,j),j}processMesh(x){var O=this.cache,B=this.json,D=[x.geometry.uuid];if(Array.isArray(x.material))for(var z=0,U=x.material.length;z<U;z++)D.push(x.material[z].uuid);else D.push(x.material.uuid);var H=D.join(":");if(O.meshes.has(H))return O.meshes.get(H);var Y,ie=x.geometry;if(Y=x.isLineSegments?h.LINES:x.isLineLoop?h.LINE_LOOP:x.isLine?h.LINE_STRIP:x.isPoints?h.POINTS:x.material.wireframe?h.LINES:h.TRIANGLES,ie.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var ae={},ee={},oe=[],j=[],K={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},$=ie.getAttribute("normal");$===void 0||this.isNormalizedNormalAttribute($)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),ie.setAttribute("normal",this.createNormalizedNormalAttribute($)));var re=null;for(var G in ie.attributes)if(G.substr(0,5)!=="morph"){var W=ie.attributes[G];G=K[G]||G.toUpperCase();var F=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(F.test(G)||(G="_"+G),O.attributes.has(this.getUID(W))){ee[G]=O.attributes.get(this.getUID(W));continue}re=null;var X=W.array;G!=="JOINTS_0"||X instanceof Uint16Array||X instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),re=new c.BufferAttribute(new Uint16Array(X),W.itemSize,W.normalized));var J=this.processAccessor(re||W,ie);J!==null&&(ee[G]=J,O.attributes.set(this.getUID(W),J))}if($!==void 0&&ie.setAttribute("normal",$),Object.keys(ee).length===0)return null;if(x.morphTargetInfluences!==void 0&&0<x.morphTargetInfluences.length){var V=[],k=[],te={};if(x.morphTargetDictionary!==void 0)for(var se in x.morphTargetDictionary)te[x.morphTargetDictionary[se]]=se;for(var le=0;le<x.morphTargetInfluences.length;++le){var fe={},we=!1;for(var be in ie.morphAttributes){if(be!="position"&&be!=="normal"&&be!=="color"){we||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),we=!0);continue}var de=ie.morphAttributes[be][le],ye=be.toUpperCase();K[be]&&(ye=K[be]);var ne=ie.attributes[be];if(O.attributes.has(this.getUID(de))){fe[ye]=O.attributes.get(this.getUID(de));continue}var he=ne.clone();if(!ie.morphTargetsRelative)if(ne)for(var me=0,Re=de.count;me<Re;me++)ne.count>me&&he.setXYZ(me,de.getX(me)-ne.getX(me),de.getY(me)-ne.getY(me),de.getZ(me)-ne.getZ(me));else for(var Te=0,De=de.count;Te<De;Te++)he.setXYZ(Te,0,0,0);fe[ye]=this.processAccessor(he,ie),O.attributes.set(this.getUID(ne),fe[ye])}j.push(fe),V.push(x.morphTargetInfluences[le]),x.morphTargetDictionary!==void 0&&k.push(te[le])}ae.weights=V,0<k.length&&(ae.extras={},ae.extras.targetNames=k)}var Ye=Array.isArray(x.material);if(Ye&&ie.groups.length===0)return null;for(var ze,st=Ye?x.material:[x.material],Ce=Ye?ie.groups:[{materialIndex:0,start:void 0,count:void 0}],He=0,Ge=Ce.length;He<Ge;He++){if(ze={mode:Y,attributes:ee},this.serializeUserData(ie,ze),0<j.length&&(ze.targets=j),ie.index!==null){var Ot=this.getUID(ie.index);(Ce[He].start!==void 0||Ce[He].count!==void 0)&&(Ot+=":"+Ce[He].start+":"+Ce[He].count),O.attributes.has(Ot)?ze.indices=O.attributes.get(Ot):(ze.indices=this.processAccessor(ie.index,ie,Ce[He].start,Ce[He].count),O.attributes.set(Ot,ze.indices)),ze.indices===null&&delete ze.indices}var Nt=this.processMaterial(st[Ce[He].materialIndex]);Nt!==null&&(ze.material=Nt),oe.push(ze)}ae.primitives=oe,B.meshes||(B.meshes=[]),this._invokeAll(function(xt){xt.writeMesh&&xt.writeMesh(x,ae)});var mt=B.meshes.push(ae)-1;return O.meshes.set(H,mt),mt}processCamera(x){var O=this.json;O.cameras||(O.cameras=[]);var B=x.isOrthographicCamera,D={type:B?"orthographic":"perspective"};return B?D.orthographic={xmag:2*x.right,ymag:2*x.top,zfar:0>=x.far?.001:x.far,znear:0>x.near?0:x.near}:D.perspective={aspectRatio:x.aspect,yfov:c.MathUtils.degToRad(x.fov),zfar:0>=x.far?.001:x.far,znear:0>x.near?0:x.near},x.name!==""&&(D.name=x.type),O.cameras.push(D)-1}processAnimation(x,O){var B=this.json,D=this.nodeMap;B.animations||(B.animations=[]),x=f.Utils.mergeMorphTargetTracks(x.clone(),O);for(var z=x.tracks,U=[],H=[],Y=0;Y<z.length;++Y){var ie=z[Y],ae=c.PropertyBinding.parseTrackName(ie.name),ee=c.PropertyBinding.findNode(O,ae.nodeName),oe=y[ae.propertyName];if(ae.objectName==="bones"&&(ee.isSkinnedMesh===!0?ee=ee.skeleton.getBoneByName(ae.objectIndex):ee=void 0),!ee||!oe)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',ie.name),null;var j=1,K=ie.values.length/ie.times.length;oe===y.morphTargetInfluences&&(K/=ee.morphTargetInfluences.length);var $=void 0;ie.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?($="CUBICSPLINE",K/=3):ie.getInterpolation()===c.InterpolateDiscrete?$="STEP":$="LINEAR",H.push({input:this.processAccessor(new c.BufferAttribute(ie.times,j)),output:this.processAccessor(new c.BufferAttribute(ie.values,K)),interpolation:$}),U.push({sampler:H.length-1,target:{node:D.get(ee),path:oe}})}return B.animations.push({name:x.name||"clip_"+B.animations.length,samplers:H,channels:U}),B.animations.length-1}processSkin(x){var O=this.json,B=this.nodeMap,D=O.nodes[B.get(x)],z=x.skeleton;if(z===void 0)return null;var U=x.skeleton.bones[0];if(U===void 0)return null;for(var H=[],Y=new Float32Array(16*z.bones.length),ie=new c.Matrix4,ae=0;ae<z.bones.length;++ae)H.push(B.get(z.bones[ae])),ie.copy(z.boneInverses[ae]),ie.multiply(x.bindMatrix).toArray(Y,16*ae);O.skins===void 0&&(O.skins=[]),O.skins.push({inverseBindMatrices:this.processAccessor(new c.BufferAttribute(Y,16)),joints:H,skeleton:B.get(U)});var ee=D.skin=O.skins.length-1;return ee}processNode(x){var O=this.json,B=this.options,D=this.nodeMap;O.nodes||(O.nodes=[]);var z={};if(B.trs){var U=x.quaternion.toArray(),H=x.position.toArray(),Y=x.scale.toArray();S(U,[0,0,0,1])||(z.rotation=U),S(H,[0,0,0])||(z.translation=H),S(Y,[1,1,1])||(z.scale=Y)}else x.matrixAutoUpdate&&x.updateMatrix(),M(x.matrix)===!1&&(z.matrix=x.matrix.elements);if(x.name!==""&&(z.name=x.name+""),this.serializeUserData(x,z),x.isMesh||x.isLine||x.isPoints){var ie=this.processMesh(x);ie!==null&&(z.mesh=ie)}else x.isCamera&&(z.camera=this.processCamera(x));if(x.isSkinnedMesh&&this.skins.push(x),0<x.children.length){for(var ae,ee=[],oe=0,j=x.children.length;oe<j;oe++)if(ae=x.children[oe],ae.visible||B.onlyVisible===!1){var K=this.processNode(ae);K!==null&&ee.push(K)}0<ee.length&&(z.children=ee)}this._invokeAll(function(re){re.writeNode&&re.writeNode(x,z)});var $=O.nodes.push(z)-1;return D.set(x,$),$}processScene(x){var O=this.json,B=this.options;O.scenes||(O.scenes=[],O.scene=0);var D={};x.name!==""&&(D.name=x.name),O.scenes.push(D);for(var z,U=[],H=0,Y=x.children.length;H<Y;H++)if(z=x.children[H],z.visible||B.onlyVisible===!1){var ie=this.processNode(z);ie!==null&&U.push(ie)}0<U.length&&(D.nodes=U),this.serializeUserData(x,D)}processObjects(x){var O=new c.Scene;O.name="AuxScene";for(var B=0;B<x.length;B++)O.children.push(x[B]);this.processScene(O)}processInput(x){var O=this.options;x=x instanceof Array?x:[x],this._invokeAll(function(H){H.beforeParse&&H.beforeParse(x)});for(var B=[],D=0;D<x.length;D++)x[D]instanceof c.Scene?this.processScene(x[D]):B.push(x[D]);0<B.length&&this.processObjects(B);for(var z=0;z<this.skins.length;++z)this.processSkin(this.skins[z]);for(var U=0;U<O.animations.length;++U)this.processAnimation(O.animations[U].clip,O.animations[U].mesh);this._invokeAll(function(H){H.afterParse&&H.afterParse(x)})}_invokeAll(x){for(var O=0,B=this.plugins.length;O<B;O++)x(this.plugins[O])}}class A{constructor(x){this.writer=x,this.name="KHR_lights_punctual"}writeNode(x,O){if(x.isLight){if(!x.isDirectionalLight&&!x.isPointLight&&!x.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",x);var B=this.writer,D=B.json,z=B.extensionsUsed,U={};x.name&&(U.name=x.name),U.color=x.color.toArray(),U.intensity=x.intensity,x.isDirectionalLight?U.type="directional":x.isPointLight?(U.type="point",0<x.distance&&(U.range=x.distance)):x.isSpotLight&&(U.type="spot",0<x.distance&&(U.range=x.distance),U.spot={},U.spot.innerConeAngle=-1*((x.penumbra-1)*x.angle),U.spot.outerConeAngle=x.angle),x.decay!==void 0&&x.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),x.target&&(x.target.parent!==x||x.target.position.x!==0||x.target.position.y!==0||x.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),z[this.name]||(D.extensions=D.extensions||{},D.extensions[this.name]={lights:[]},z[this.name]=!0);var H=D.extensions[this.name].lights;H.push(U),O.extensions=O.extensions||{},O.extensions[this.name]={light:H.length-1}}}}class R{constructor(x){this.writer=x,this.name="KHR_materials_unlit"}writeMaterial(x,O){if(x.isMeshBasicMaterial){var B=this.writer,D=B.extensionsUsed;O.extensions=O.extensions||{},O.extensions[this.name]={},D[this.name]=!0,O.pbrMetallicRoughness.metallicFactor=0,O.pbrMetallicRoughness.roughnessFactor=.9}}}class L{constructor(x){this.writer=x,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(x,O){if(x.isGLTFSpecularGlossinessMaterial){var B=this.writer,D=B.extensionsUsed,z={};O.pbrMetallicRoughness.baseColorFactor&&(z.diffuseFactor=O.pbrMetallicRoughness.baseColorFactor);var U=[1,1,1];if(x.specular.toArray(U,0),z.specularFactor=U,z.glossinessFactor=x.glossiness,O.pbrMetallicRoughness.baseColorTexture&&(z.diffuseTexture=O.pbrMetallicRoughness.baseColorTexture),x.specularMap){var H={index:B.processTexture(x.specularMap)};B.applyTextureTransform(H,x.specularMap),z.specularGlossinessTexture=H}O.extensions=O.extensions||{},O.extensions[this.name]=z,D[this.name]=!0}}}f.Utils={insertKeyframe:function(x,O){var B,D=.001,z=x.getValueSize(),U=new x.TimeBufferType(x.times.length+1),H=new x.ValueBufferType(x.values.length+z),Y=x.createInterpolant(new x.ValueBufferType(z));if(x.times.length===0){U[0]=O;for(var ie=0;ie<z;ie++)H[ie]=0;B=0}else if(O<x.times[0]){if(Math.abs(x.times[0]-O)<D)return 0;U[0]=O,U.set(x.times,1),H.set(Y.evaluate(O),0),H.set(x.values,z),B=0}else if(O>x.times[x.times.length-1]){if(Math.abs(x.times[x.times.length-1]-O)<D)return x.times.length-1;U[U.length-1]=O,U.set(x.times,0),H.set(x.values,0),H.set(Y.evaluate(O),x.values.length),B=U.length-1}else for(var ae=0;ae<x.times.length;ae++){if(Math.abs(x.times[ae]-O)<D)return ae;if(x.times[ae]<O&&x.times[ae+1]>O){U.set(x.times.slice(0,ae+1),0),U[ae+1]=O,U.set(x.times.slice(ae+1),ae+2),H.set(x.values.slice(0,(ae+1)*z),0),H.set(Y.evaluate(O),(ae+1)*z),H.set(x.values.slice((ae+1)*z),(ae+2)*z),B=ae+1;break}}return x.times=U,x.values=H,B},mergeMorphTargetTracks:function(x,O){for(var B=[],D={},z=x.tracks,U=0;U<z.length;++U){var H=z[U],Y=c.PropertyBinding.parseTrackName(H.name),ie=c.PropertyBinding.findNode(O,Y.nodeName);if(Y.propertyName!=="morphTargetInfluences"||Y.propertyIndex===void 0){B.push(H);continue}if(H.createInterpolant!==H.InterpolantFactoryMethodDiscrete&&H.createInterpolant!==H.InterpolantFactoryMethodLinear){if(H.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),H=H.clone(),H.setInterpolation(c.InterpolateLinear)}var ae=ie.morphTargetInfluences.length,ee=ie.morphTargetDictionary[Y.propertyIndex];if(ee===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+Y.propertyIndex);var oe=void 0;if(D[ie.uuid]===void 0){oe=H.clone();for(var j=new oe.ValueBufferType(ae*oe.times.length),K=0;K<oe.times.length;K++)j[K*ae+ee]=oe.values[K];oe.name=(Y.nodeName||"")+".morphTargetInfluences",oe.values=j,D[ie.uuid]=oe,B.push(oe);continue}var $=H.createInterpolant(new H.ValueBufferType(1));oe=D[ie.uuid];for(var re=0;re<oe.times.length;re++)oe.values[re*ae+ee]=$.evaluate(oe.times[re]);for(var G,W=0;W<H.times.length;W++)G=this.insertKeyframe(oe,H.times[W]),oe.values[G*ae+ee]=H.values[W]}return x.tracks=B,x}}},(o,l,u)=>{var c=u(4),f=u(5).resolveURL,h=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var E=this;this.setFromObject=M=>{var{nearPlane:_,farPlane:C,eyePosition:I,targetPosition:T,upVector:P}=M;E.nearPlane=_,E.farPlane=C,E.eyePosition=I,E.targetPosition=T,E.upVector=P}},p=function(E,M,_,C){var I={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},T={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},P={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},A={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},R={};R.MAIN=T.ROTATE,R.AUXILIARY=T.ZOOM,R.SECONDARY=T.PAN,this.cameraObject=E,this.domElement=M===void 0?document:M,this.renderer=_,this.scene=C,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;var L=6e3,N=!0,x=0,O=void 0,B=void 0,D=!1,z=500,U=void 0,H="default",Y=I.DEFAULT,ie=void 0,ae=void 0,ee=void 0,oe=0,j=P.FREE;this._state=T.NONE;var K;this.targetTouchId=-1;var $=void 0,re=new c.Vector3,G=new c.Vector3,W=new c.Vector3,F=new c.Vector3,X=new c.Vector3,J=new c.Vector3,V=new c.Vector3,k=new c.Vector3,te=new c.Sphere,se=new c.Vector3,le=!1,fe=void 0,we=0,be={default:new h};be.default.nearPlane=.1,be.default.farPlane=2e3,be.default.eyePosition=[0,0,0],be.default.targetPosition=[0,0,-1],be.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new c.Vector3(...be.default.targetPosition)),this.calculateMaxAllowedDistance=Q=>{var xe=Q.getBoundingBox();if(xe){xe.getBoundingSphere(te),we=6*te.radius;var Ee=0;this.cameraObject&&(Ee=this.cameraObject.position.distanceTo(te.center)),we=Ee>we?1.5*Ee:we}else we=0},this.addViewport=(Q,xe)=>{Q&&xe&&(be[Q]=xe)},this.setDefaultViewport=Q=>!!(Q&&Q in be)&&(H=Q,!0),this.getDefaultViewport=()=>H,this.getViewportOfName=Q=>be[Q],this.setCurrentViewport=Q=>Q in be&&(this.setCurrentCameraSettings(be[Q]),!0),this.setRotationMode=Q=>{switch(Q){case"none":j=P.NONE;break;case"horizontal":j=P.HORIZONTAL;break;case"vertical":j=P.VERTICAL;break;case"free":default:j=P.FREE}},this.onResize=()=>{$&&($=void 0),fe&&fe.setCurrentCameraSettings(this.cameraObject,be[H])},this.getVisibleHeightAtZDepth=Q=>{var xe=this.cameraObject.position.distanceTo(this.cameraObject.target);Q<xe?Q-=xe:Q+=xe;var Ee=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(Ee/2)*Math.abs(Q)},this.calculateHeightPerPixelAtZeroDepth=Q=>{var xe=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=xe/Q,this.pixelHeight},this.getNDCFromDocumentCoords=(Q,xe,Ee)=>{Ce(!1);var Be=Ee||new c.Vector2,Ke=2*((Q-$.left)/$.width)-1,Z=2*-((xe-$.top)/$.height)+1;return Be.set(Ke,Z)},this.getRelativeCoordsFromNDC=(Q,xe,Ee)=>{Ce(!1);var Be=Ee||new c.Vector2;return Be.x=(Q+1)*$.width/2,Be.y=(1-xe)*$.height/2,Be},this.setMouseButtonAction=(Q,xe)=>{R[Q]=T[xe]};var de=(Q,xe)=>{Q instanceof HTMLCanvasElement&&(Q.tabIndex=xe)},ye=()=>{if(0<we){var Q=se.distanceTo(te.center);return we>Q||this.cameraObject.position.distanceTo(te.center)>Q}return!0},ne=Q=>{se.copy(this.cameraObject.position).add(Q),ye()&&(this.cameraObject.target.add(Q),this.cameraObject.position.add(Q),this.updateDirectionalLight())},he=Q=>{Ce(!1);var xe;if(Y===I.DEFAULT&&(xe=this.scene.getNormalisedMinimapCoordinates(this.renderer,Q)),!xe)Q.button==0?Q.ctrlKey?this._state=R.AUXILIARY:Q.shiftKey?this._state=R.SECONDARY:this._state=R.MAIN:Q.button==1?(Q.preventDefault(),this._state=R.AUXILIARY):Q.button==2&&(this._state=R.SECONDARY),this.pointer_x=Q.clientX-$.left,this.pointer_y=Q.clientY-$.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{Y=I.MINIMAP;var Ee=this.scene.getMinimapDiffFromNormalised(xe.x,xe.y);ne(Ee)}},me=Q=>{if(Ce(!1),$)if(this.pointer_x=Q.clientX-$.left,this.pointer_y=Q.clientY-$.top,Y===I.MINIMAP){var xe=this.scene.getNormalisedMinimapCoordinates(this.renderer,Q);if(xe){var Ee=this.scene.getMinimapDiffFromNormalised(xe.x,xe.y);ne(Ee)}}else this._state===T.NONE&&K!==void 0&&K.move(this,Q.clientX,Q.clientY,this.renderer)},Re=Q=>{this._state=T.NONE,Y==I.MINIMAP&&(Y=I.DEFAULT),K!==void 0&&this.pointer_x_start==Q.clientX-$.left&&this.pointer_y_start==Q.clientY-$.top&&K.pick(this,Q.clientX,Q.clientY,this.renderer)},Te=Q=>{this._state=T.NONE},De=Q=>{Ce(!1);var xe=Q.touches.length;if(xe==1){var Ee,Be;this._state=T.TOUCH_ROTATE,this.pointer_x=Q.touches[0].clientX-((Ee=$)===null||Ee===void 0?void 0:Ee.left),this.pointer_y=Q.touches[0].clientY-((Be=$)===null||Be===void 0?void 0:Be.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}else if(xe==2){this._state=T.TOUCH_ZOOM;var Ke=Q.touches[0].clientX-Q.touches[1].clientX,Z=Q.touches[0].clientY-Q.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(Ke*Ke+Z*Z)}else if(xe==3){var pe,ce;this._state=T.TOUCH_PAN,this.targetTouchId=Q.touches[0].identifier,this.pointer_x=Q.touches[0].clientX-((pe=$)===null||pe===void 0?void 0:pe.left),this.pointer_y=Q.touches[0].clientY-((ce=$)===null||ce===void 0?void 0:ce.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}},Ye=Q=>{Q.preventDefault(),Q.stopPropagation();var xe=Q.touches.length;if(xe==1)this.pointer_x=Q.touches[0].clientX-$.left,this.pointer_y=Q.touches[0].clientY-$.top;else if(xe==2){if(this._state===T.TOUCH_ZOOM){var Ee=Q.touches[0].clientX-Q.touches[1].clientX,Be=Q.touches[0].clientY-Q.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(Ee*Ee+Be*Be)}}else if(xe==3&&this._state===T.TOUCH_PAN)for(var Ke=0;3>Ke;Ke++)Q.touches[Ke].identifier==this.targetTouchId&&(this.pointer_x=Q.touches[0].clientX-$.left,this.pointer_y=Q.touches[0].clientY-$.top)},ze=Q=>{var xe=Q.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=T.NONE,xe==1&&K!==void 0&&this.pointer_x_start==Q.touches[0].clientX-$.left&&this.pointer_y_start==Q.touches[0].clientY-$.top&&K.pick(this.cameraObject,Q.touches[0].clientX,Q.touches[0].clientY,this.renderer)},st=()=>{Ce(!0)},Ce=Q=>{if(Q||$===void 0){var xe=new IntersectionObserver(Ee=>{for(var Be of Ee)$=Be.boundingClientRect;xe.disconnect()});xe.observe(this.domElement)}},He=Q=>{Ce(!1),this._state=T.SCROLL;var xe=0;0<Q.deltaY?xe=this.zoomRate:0>Q.deltaY&&(xe=-1*this.zoomRate),oe+=xe,Q.preventDefault(),Q.stopImmediatePropagation()},Ge=Q=>{Ce(!1);var xe=0;if(Q.keyCode===A.EQUAL||Q.keyCode===A.MINUS||Q.keyCode===A.NUMPADADD||Q.keyCode===A.NUMPADSUBTRACT){this._state=T.KEYBOARD_ZOOM;var Ee=1;Q.shiftKey&&(Ee*=2),Q.keyCode===A.EQUAL||Q.keyCode===A.NUMPADADD?xe=-1*(this.zoomRate*Ee):(Q.keyCode===A.MINUS||Q.keyCode===A.NUMPADSUBTRACT)&&(xe=this.zoomRate*Ee),oe+=xe}else(Q.keyCode===A.ARROWLEFT||Q.keyCode===A.ARROWUP||Q.keyCode===A.ARROWRIGHT||Q.keyCode===A.ARROWDOWN)&&(Q.shiftKey?(this._state=T.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,xe=this.rotateRate):(this._state=T.KEYBOARD_PAN,xe=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,Q.keyCode===A.ARROWLEFT?this.pointer_x-=xe:Q.keyCode===A.ARROWUP?this.pointer_y-=xe:Q.keyCode===A.ARROWRIGHT?this.pointer_x+=xe:Q.keyCode===A.ARROWDOWN&&(this.pointer_y+=xe));Object.values(A).includes(Q.keyCode)&&Q.preventDefault()},Ot=Q=>{this._state=T.NONE},Nt=()=>{if(typeof this.cameraObject<"u"){var Q=$.height,xe=this.cameraObject.position.distanceTo(this.cameraObject.target),Ee=0;this.cameraObject.far>this.cameraObject.near&&xe>=this.cameraObject.near&&xe<=this.cameraObject.far&&(Ee=(xe-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),G.set(this.previous_pointer_x,Q-this.previous_pointer_y,0),W.set(this.previous_pointer_x,Q-this.previous_pointer_y,1),F.set(this.pointer_x,Q-this.pointer_y,0),X.set(this.pointer_x,Q-this.pointer_y,1),G.unproject(this.cameraObject),W.unproject(this.cameraObject),F.unproject(this.cameraObject),X.unproject(this.cameraObject);var Be=-.002;F.sub(G).multiplyScalar(1-Ee),X.sub(W).multiplyScalar(Ee),F.add(X).multiplyScalar(Be),ne(F)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(Q,xe)=>{Q.normalize(),V.copy(this.cameraObject.position).sub(this.cameraObject.target),k.copy(V),V.normalize(),.8<Math.abs(V.dot(Q))&&V.copy(this.cameraObject.up),G.crossVectors(Q,V).normalize(),W.crossVectors(Q,G);var Ee=Q.dot(k),Be=G.dot(k),Ke=W.dot(k),Z=Q.dot(this.cameraObject.up),pe=G.dot(this.cameraObject.up),ce=W.dot(this.cameraObject.up),ge=Math.cos(xe),Me=Math.sin(xe);return F.set(ge*G.x+Me*W.x,ge*G.y+Me*W.y,ge*G.z+Me*W.z),X.set(ge*W.x-Me*G.x,ge*W.y-Me*G.y,ge*W.z-Me*G.z),V.copy(this.cameraObject.target),V.x=V.x+Q.x*Ee+F.x*Be+X.x*Ke,V.y=V.y+Q.y*Ee+F.y*Be+X.y*Ke,V.z=V.z+Q.z*Ee+F.z*Be+X.z*Ke,re.set(Q.x*Z+F.x*pe+X.x*ce,Q.y*Z+F.y*pe+X.y*ce,Q.z*Z+F.z*pe+X.z*ce),{position:V,up:re}},this.rotateAboutLookAtpoint=(Q,xe)=>{var Ee=this.getVectorsFromRotateAboutLookAtPoints(Q,xe);this.cameraObject.position.copy(Ee.position),this.updateDirectionalLight(),this.cameraObject.up.copy(Ee.up)};var mt=()=>{if(typeof this.cameraObject<"u"){var Q,xe,Ee=(Q=$)===null||Q===void 0?void 0:Q.width,Be=(xe=$)===null||xe===void 0?void 0:xe.height;if(0<Ee&&0<Be){var Ke=.25*(Ee+Be),Z=0,pe=0;(j===P.FREE||j===P.HORIZONTAL)&&(Z=this.pointer_x-this.previous_pointer_x),(j===P.FREE||j===P.VERTICAL)&&(pe=this.previous_pointer_y-this.pointer_y);var ce=Math.sqrt(Z*Z+pe*pe);if(0<ce){var ge=1*-pe/ce,Me=1*Z/ce,ue=0;j===P.FREE&&ge*(this.pointer_x-.5*(Ee-1))+Me*(.5*(Be-1)-this.pointer_y);var ve=Math.acos(ue/Ke)-.5*Math.PI,_e=this.tumble_rate*ce/Ke;re.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),G.copy(this.cameraObject.up).normalize(),W.copy(G).cross(re).normalize().multiplyScalar(ge),G.multiplyScalar(Me),J.addVectors(W,G).multiplyScalar(Math.cos(ve)),re.multiplyScalar(Math.sin(ve)),J.add(re),this.rotateAboutLookAtpoint(J,-_e)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},xt=()=>{var Q=0;return this._state===T.ZOOM?Q=this.previous_pointer_y-this.pointer_y:this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM?Q=oe:(Q=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),Q};this.changeZoomByScrollRateUnit=Q=>{var xe=Q*this.zoomRate;this.changeZoomByValue(xe)},this.changeZoomByValue=Q=>{if(typeof this.cameraObject<"u"){var xe=$.height,Ee=this.cameraObject.position.clone();Ee.sub(this.cameraObject.target);var Be=Ee.length(),Ke=1.5*Q/xe;if(.01<Be+Ke*Be&&(Ee.normalize(),se.copy(this.cameraObject.position),se.x+=Ee.x*Ke*Be,se.y+=Ee.y*Ke*Be,se.z+=Ee.z*Ke*Be,ye())){this.cameraObject.position.copy(se),this.updateDirectionalLight();var Z=1e-5;if(Z*this.cameraObject.far<this.cameraObject.near+Ke*Be+this.near_plane_fly_debt)this.near_plane_fly_debt!=0&&(this.near_plane_fly_debt+=Ke*Be,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=Ke*Be,this.cameraObject.far+=Ke*Be));else{if(this.near_plane_fly_debt==0){var pe=this.cameraObject.near-Z*this.cameraObject.far;this.cameraObject.near=Z*this.cameraObject.far,this.cameraObject.far-=pe,this.near_plane_fly_debt-=Z*this.cameraObject.far}this.near_plane_fly_debt+=Ke*Be}le=!0}}};var Vi=()=>{var Q=xt();this.changeZoomByValue(Q),this._state===T.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(oe=0,this._state=T.NONE)};this.setDirectionalLight=Q=>{this.directionalLight=Q},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){N=!0,this.domElement&&this.domElement.addEventListener&&(de(this.domElement,0),this.domElement.addEventListener("mousedown",he,!1),this.domElement.addEventListener("mousemove",me,!1),this.domElement.addEventListener("mouseup",Re,!1),this.domElement.addEventListener("mouseleave",Te,!1),this.domElement.addEventListener("touchstart",De,!1),this.domElement.addEventListener("touchmove",Ye,!1),this.domElement.addEventListener("touchend",ze,!1),this.domElement.addEventListener("wheel",He,!1),this.domElement.addEventListener("mouseenter",st,!1),this.domElement.addEventListener("contextmenu",Q=>{Q.preventDefault()},!1),this.domElement.addEventListener("keydown",Ge,!1),this.domElement.addEventListener("keyup",Ot,!1))},this.disable=function(){N=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",he,!1),this.domElement.removeEventListener("mousemove",me,!1),this.domElement.removeEventListener("mouseup",Re,!1),this.domElement.removeEventListener("mouseleave",Te,!1),this.domElement.removeEventListener("touchstart",De,!1),this.domElement.removeEventListener("touchmove",Ye,!1),this.domElement.removeEventListener("touchend",ze,!1),this.domElement.removeEventListener("wheel",He,!1),this.domElement.removeEventListener("mouseenter",st,!1),this.domElement.removeEventListener("contextmenu",Q=>{Q.preventDefault()},!1),this.domElement.removeEventListener("keydown",Ge,!1),this.domElement.removeEventListener("keyup",Ot,!1),de(this.domElement,-1))},this.loadPath=Q=>{O=Q.CameraPath,B=Q.NumberOfPoints},this.loadPathURL=(Q,xe)=>{var Ee=new XMLHttpRequest;Ee.onreadystatechange=()=>{if(Ee.readyState==4&&Ee.status==200){var Ke=JSON.parse(Ee.responseText);this.loadPath(Ke),xe!=null&&typeof xe=="function"&&xe()}};var Be=f(Q);Ee.open("GET",Be,!0),Ee.send()},this.setPathDuration=Q=>{L=Q,ie&&ie.setDuration(L),ae&&ae.setDuration(L)},this.getPlayRate=()=>z,this.setPlayRate=Q=>{z=Q};var ki=Q=>{var xe=x+Q;xe>L&&(xe-=L),x=xe};this.getTime=()=>x,this.setTime=Q=>{x=Q>L?L:0>Q?0:Q},this.getNumberOfTimeFrame=()=>B,this.getCurrentTimeFrame=()=>{if(2<B){var Q=x/L*(B-1),xe=Math.floor(Q),Ee=1-(Q-xe),Be=Math.ceil(Q);return xe==Be?xe==B-1?[xe-1,Be,0]:[xe,Be+1,1]:[xe,Be,Ee]}return B==1?[0,0,0]:void 0},this.setCurrentTimeFrame=Q=>{2<B&&(x=L*Q/(B-1),0>x&&(x=0),x>L&&(x=L))};var Hn=Q=>{if(Y===I.PATH&&(ki(Q),O)){for(var xe=this.getCurrentTimeFrame(),Ee=xe[0],Be=xe[1],Ke=xe[2],Z=[O[3*Ee],O[3*Ee+1],O[3*Ee+2]],pe=[O[3*Be],O[3*Be+1],O[3*Be+2]],ce=[],ge=0;ge<Z.length;ge++)ce.push(Ke*Z[ge]+(1-Ke)*pe[ge]);this.cameraObject.position.set(ce[0],ce[1],ce[2]),this.cameraObject.target.set(pe[0],pe[1],pe[2]),U&&this.cameraObject.lookAt(this.cameraObject.target),D&&(this.directionalLight.position.set(ce[0],ce[1],ce[2]),this.directionalLight.target.position.set(pe[0],pe[1],pe[2]))}};this.calculatePathNow=()=>{Hn(0)};var us=()=>{this._state===T.ROTATE||this._state===T.TOUCH_ROTATE||this._state===T.KEYBOARD_ROTATE?mt():this._state===T.PAN||this._state===T.TOUCH_PAN||this._state===T.KEYBOARD_PAN?(Nt(),fe.triggerCallback()):(this._state===T.ZOOM||this._state===T.TOUCH_ZOOM||this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(fe.zoom(xt()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&(this._state=T.NONE),oe=0,fe.triggerCallback())};this.update=Q=>{var xe=Q*z,Ee=N,Be=!0;return Y===I.PATH?Hn(xe):Y===I.SMOOTH_CAMERA_TRANSITION&&ie?(ie.update(xe),ie.isTransitionCompleted()&&(Y=I.DEFAULT),Ee=!1):Y===I.ROTATE_CAMERA_TRANSITION&&ae?(ae.update(xe),ae.isTransitionCompleted()&&(Y=I.DEFAULT),Ee=!1):Y===I.AUTO_TUMBLE&&ee?ee.update(xe):Y===I.SYNC_CONTROL&&fe?(us(),Ee=!1):Be=!1,Ee&&(this._state!==T.NONE&&(Be=!0),this._state===T.ROTATE||this._state===T.TOUCH_ROTATE||this._state===T.KEYBOARD_ROTATE?mt():this._state===T.PAN||this._state===T.TOUCH_PAN||this._state===T.KEYBOARD_PAN?Nt():(this._state===T.ZOOM||this._state===T.TOUCH_ZOOM||this._state===T.SCROLL||this._state===T.KEYBOARD_ZOOM)&&Vi(),this._state!==T.NONE&&Y===I.AUTO_TUMBLE&&ee&&ee.stopOnCameraInput,this._state===T.SCROLL&&(this._state=T.NONE)),U?(Be=!0,U.update()):this.cameraObject.lookAt(this.cameraObject.target),Be=Be||le,le=!1,Be},this.playPath=()=>{Y=I.PATH},this.stopPath=()=>{Y=I.DEFAULT},this.isPlayingPath=()=>Y===I.PATH,this.enableDirectionalLightUpdateWithPath=Q=>{D=Q},this.enableDeviceOrientation=()=>{U||(U=new w(this.cameraObject))},this.disableDeviceOrientation=()=>{U&&(U.dispose(),U=void 0)},this.isDeviceOrientationEnabled=()=>!!U,this.resetView=()=>{var Q=be[H];this.cameraObject.near=Q.nearPlane,this.cameraObject.far=Q.farPlane,this.cameraObject.position.set(Q.eyePosition[0],Q.eyePosition[1],Q.eyePosition[2]),this.cameraObject.target.set(Q.targetPosition[0],Q.targetPosition[1],Q.targetPosition[2]),this.cameraObject.up.set(Q.upVector[0],Q.upVector[1],Q.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=Q=>{Q.nearPlane&&(this.cameraObject.near=Q.nearPlane),Q.farPlane&&(this.cameraObject.far=Q.farPlane),Q.eyePosition&&this.cameraObject.position.set(Q.eyePosition[0],Q.eyePosition[1],Q.eyePosition[2]),Q.targetPosition&&this.cameraObject.target.set(Q.targetPosition[0],Q.targetPosition[1],Q.targetPosition[2]),Q.upVector&&this.cameraObject.up.set(Q.upVector[0],Q.upVector[1],Q.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),le=!0},this.getViewportFromCentreAndRadius=(Q,xe,Ee,Be,Ke,Z)=>{var pe=this.cameraObject.position.x-this.cameraObject.target.x,ce=this.cameraObject.position.y-this.cameraObject.target.y,ge=this.cameraObject.position.z-this.cameraObject.target.z,Me=1/Math.sqrt(pe*pe+ce*ce+ge*ge);pe*=Me,ce*=Me,ge*=Me;var ue=[Q,xe,Ee],ve=Be/Math.tan(Ke*Math.PI/360),_e=[Q+pe*ve,xe+ce*ve,Ee+ge*ve],Pe=ve+Z,Oe=0,Ue=.95;Oe=Z>Ue*ve?(1-Ue)*ve:ve-Z;var Fe=new h;return Fe.nearPlane=Oe,Fe.farPlane=Pe,Fe.eyePosition=_e,Fe.targetPosition=ue,Fe.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],Fe},this.getViewportFromBoundingBox=(Q,xe)=>{var Ee=Q.min.distanceTo(Q.max)/2*xe,Be=(Q.min.x+Q.max.x)/2,Ke=(Q.min.y+Q.max.y)/2,Z=(Q.min.z+Q.max.z)/2,pe=4,ce=this.getViewportFromCentreAndRadius(Be,Ke,Z,Ee,40,Ee*pe);return ce},this.getCurrentViewport=()=>{var Q=new h;return Q.nearPlane=this.cameraObject.near,Q.farPlane=this.cameraObject.far,Q.eyePosition[0]=this.cameraObject.position.x,Q.eyePosition[1]=this.cameraObject.position.y,Q.eyePosition[2]=this.cameraObject.position.z,Q.targetPosition[0]=this.cameraObject.target.x,Q.targetPosition[1]=this.cameraObject.target.y,Q.targetPosition[2]=this.cameraObject.target.z,Q.upVector[0]=this.cameraObject.up.x,Q.upVector[1]=this.cameraObject.up.y,Q.upVector[2]=this.cameraObject.up.z,Q},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(Q,xe,Ee)=>{ae==null&&(ie=new y(Q,xe,this,Ee))},this.rotateCameraTransition=(Q,xe,Ee)=>{ie==null&&(ae=new m(Q,xe,this,Ee))},this.enableCameraTransition=()=>{ie&&(Y=I.SMOOTH_CAMERA_TRANSITION),ae&&(Y=I.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{Y=I.DEFAULT},this.stopCameraTransition=()=>{Y=I.DEFAULT,ie=void 0,ae=void 0},this.isTransitioningCamera=()=>Y===I.SMOOTH_CAMERA_TRANSITION||Y===I.ROTATE_CAMERA_TRANSITION,this.autoTumble=(Q,xe,Ee)=>{ee=new b(Q,xe,Ee,this)},this.enableAutoTumble=()=>{Y=I.AUTO_TUMBLE},this.stopAutoTumble=()=>{Y=I.DEFAULT,ee=void 0},this.updateAutoTumble=()=>{ee&&(ee.requireUpdate=!0)},this.isAutoTumble=()=>Y===I.AUTO_TUMBLE,this.enableRaycaster=(Q,xe,Ee)=>{K==null&&(K=new d(Q,this.scene,xe,Ee,this.renderer))},this.disableRaycaster=()=>{K.disable(),K=void 0},this.isSyncControl=()=>currentMpde===I.SYNC_CONTROL,this.enableSyncControl=()=>(Y=I.SYNC_CONTROL,fe||(fe=new S),fe.setCurrentCameraSettings(this.cameraObject,be[H]),fe),this.disableSyncControl=()=>{Y=I.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},y=function(M,_,C,I){var T=M.eyePosition,P=M.targetPosition,A=M.upVector,R=_.eyePosition,L=_.targetPosition,N=_.upVector,x=C,O=I,B=0,D=!1;x.near=Math.min(M.nearPlane,_.nearPlane),x.far=Math.max(M.farPlane,_.farPlane),x.cameraObject.up.set(_.upVector[0],_.upVector[1],_.upVector[2]),this.setDuration=H=>{O=H};var z=H=>{var Y=B+H;Y>O&&(Y=O),B=Y},U=()=>{var H=B/O,Y=[T[0]*(1-H)+R[0]*H,T[1]*(1-H)+R[1]*H,T[2]*(1-H)+R[2]*H],ie=[P[0]*(1-H)+L[0]*H,P[1]*(1-H)+L[1]*H,P[2]*(1-H)+L[2]*H];A[0]*(1-H)+N[0]*H,A[1]*(1-H)+N[1]*H,A[2]*(1-H)+N[2]*H,x.cameraObject.position.set(Y[0],Y[1],Y[2]),x.cameraObject.target.set(ie[0],ie[1],ie[2])};this.update=H=>{this.enabled===!1||(z(H),U(),B==O&&(D=!0))},this.isTransitionCompleted=()=>D},m=function(M,_,C,I){var T=M,P=_,A=C,R=I,L=0,N=!1;this.setDuration=O=>{R=O};var x=O=>{var B=L,D=L+O;D>R&&(D=R),L=D;var z=L-B,U=z/R,H=U*P;A.rotateAboutLookAtpoint(T,H)};this.update=O=>{this.enabled===!1||(x(O),L==R&&(N=!0))},this.isTransitionCompleted=()=>N},d=function(M,_,C,I,T){var P=M,A=_,R=T,L=C,N=I,x=new c.Raycaster;x.params.Line.threshold=.1,x.params.Points.threshold=1;var O=new c.Vector2,B=!1,D=new Date,z=!1,U=0,H=[],Y={zincCamera:void 0,x:-1,y:-1},ie=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=oe=>{if(A!==P){var j=P.getThreeJSScene();R.render(j,oe.cameraObject)}var K=ie||P.getPickableThreeJSObjects();return H.length=0,x.intersectObjects(K,!0,H)},this.setPickableObjects=oe=>{oe===void 0?ie=void 0:(ie=[],oe.forEach(j=>{j.getGroup()&&j.getGroup().visible&&ie.push(j.getGroup())}))},this.getIntersectsObjectWithOrigin=(oe,j,K)=>(x.set(j,K),this.getIntersectsObject(oe)),this.getIntersectsObjectWithCamera=(oe,j,K)=>(oe.getNDCFromDocumentCoords(j,K,O),x.setFromCamera(O,oe.cameraObject),this.getIntersectsObject(oe)),this.pick=(oe,j,K)=>{if(R&&P&&oe&&L){this.getIntersectsObjectWithCamera(oe,j,K);for(var $,re=H.length,G=0;G<re;G++)if($=H[G].object?H[G].object.userData:void 0,$&&$.isMarkerCluster&&$.visible&&$.clusterIsVisible(H[G].object.clusterIndex)&&$.zoomToCluster(H[G].object.clusterIndex))return;L(H,j,K)}};var ae=(oe,j,K)=>{if(R&&P&&oe&&N){if(this.getIntersectsObjectWithCamera(oe,j,K),D.setTime(Date.now()),H.length===0){if(z)return;z=!0}else z=!1;N(H,j,K)}};this.move=(oe,j,K)=>{R&&P&&oe&&N&&(P.displayMarkers?ae(oe,j,K):(Y.zincCamera=oe,Y.x=j,Y.y=K,!B&&(U=D?Date.now()-D.getTime():250,250<=U?ae(oe,j,K):(B=!0,setTimeout(ee(Y),U)))))};var ee=oe=>function(){B=!1,ae(oe.zincCamera,oe.x,oe.y)}},b=function(M,_,C,I){var T=new c.Vector3,P=-_,A=I,R=M;this.stopOnCameraInput=C,this.requireUpdate=!0;var L=new c.Vector3,N=new c.Vector3,x=O=>{var B=Math.sqrt(O[0]*O[0]+O[1]*O[1]),D=4*Math.abs(O[0]),z=4*Math.abs(O[1]),U=.25*(D+z),H=-O[1]/B,Y=O[0]/B,ie=H*O[0]+Y*-O[1];ie>U?ie=U:ie<-U&&(ie=-U);var ae=Math.acos(ie/U)-.5*Math.PI;T.copy(A.cameraObject.position).sub(A.cameraObject.target).normalize(),L.copy(A.cameraObject.up).normalize(),N.crossVectors(L,T).normalize().multiplyScalar(H),L.multiplyScalar(Y),L.add(N).multiplyScalar(Math.cos(ae)),T.multiplyScalar(Math.sin(ae)).add(L)};this.update=O=>{this.enabled===!1||(this.requireUpdate&&(x(R),this.requireUpdate=!1),A.rotateAboutLookAtpoint(T,P*O/1e3))}},v=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new c.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new c.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(v.prototype,{update:(()=>{var E,M,_,C,I,T,P=new c.Matrix4,A=new c.Matrix4;return function(L){var N=E!==L.focus||M!==L.fov||_!==L.aspect*this.aspect||C!==L.near||I!==L.far||T!==L.zoom;if(N){E=L.focus,M=L.fov,_=L.aspect*this.aspect,C=L.near,I=L.far,T=L.zoom;var x,O,B=L.projectionMatrix.clone(),D=.064/2,z=D*C/E,U=C*Math.tan(.5*(c.Math.DEG2RAD*M))/L.zoom;A.elements[12]=-D,P.elements[12]=D,x=-U*_+z,O=U*_+z,B.elements[0]=2*C/(O-x),B.elements[8]=(O+x)/(O-x),this.cameraL.projectionMatrix.copy(B),x=-U*_-z,O=U*_-z,B.elements[0]=2*C/(O-x),B.elements[8]=(O+x)/(O-x),this.cameraR.projectionMatrix.copy(B)}this.cameraL.matrixWorld.copy(L.matrixWorld).multiply(A),this.cameraR.matrixWorld.copy(L.matrixWorld).multiply(P)}})()});var g=function(M){var _=new v;_.aspect=.5,this.setSize=(C,I)=>{M.setSize(C,I)},this.render=(C,I)=>{C.updateMatrixWorld(),I.parent===null&&I.updateMatrixWorld(),_.update(I);var T=M.getSize();M.setScissorTest(!0),M.clear(),M.setScissor(0,0,T.width/2,T.height),M.setViewport(0,0,T.width/2,T.height),M.render(C,_.cameraL),M.setScissor(T.width/2,0,T.width/2,T.height),M.setViewport(T.width/2,0,T.width/2,T.height),M.render(C,_.cameraR),M.setScissorTest(!1)}},w=function(M){var _=this;this.object=M,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var C=P=>{_.deviceOrientation=P},I=()=>{typeof window<"u"&&(_.screenOrientation=window.orientation||0)},T=(()=>{var P=new c.Vector3(0,0,1),A=new c.Euler,R=new c.Quaternion,L=new c.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(N,x,O,B,D)=>{var z=new c.Vector3(0,0,1);z.subVectors(N.target,N.position),A.set(O,x,-B,"YXZ");var U=new c.Quaternion;U.setFromEuler(A),U.multiply(L),U.multiply(R.setFromAxisAngle(P,-D)),z.applyQuaternion(U),z.addVectors(N.position,z),N.lookAt(z)}})();this.connect=()=>{I(),typeof window<"u"&&(window.addEventListener("orientationchange",I,!1),window.addEventListener("deviceorientation",C,!1)),_.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",I,!1),window.removeEventListener("deviceorientation",C,!1)),_.enabled=!1},this.update=()=>{if(_.enabled!==!1){var P=_.deviceOrientation.alpha?c.Math.degToRad(_.deviceOrientation.alpha):0,A=_.deviceOrientation.beta?c.Math.degToRad(_.deviceOrientation.beta):0,R=_.deviceOrientation.gamma?c.Math.degToRad(_.deviceOrientation.gamma):0,L=_.screenOrientation?c.Math.degToRad(_.screenOrientation):0;T(_.object,P,A,R,L)}},this.dispose=function(){this.disconnect()},this.connect()},S=function(){var M=void 0,_=void 0,C=void 0,I=new c.Vector3,T=new c.Vector3,P=new c.Vector3,A=new c.Vector3,R=void 0;this.setCurrentCameraSettings=(L,N)=>{M=L.clone(),_=L,C=N,M.near=C.nearPlane,C.farPlane&&(M.far=C.farPlane),C.eyePosition&&M.position.set(C.eyePosition[0],C.eyePosition[1],C.eyePosition[2]),C.upVector&&M.up.set(C.upVector[0],C.upVector[1],C.upVector[2]),C.targetPosition&&(M.target=new c.Vector3(C.targetPosition[0],C.targetPosition[1],C.targetPosition[2]),M.lookAt(M.target)),M.updateProjectionMatrix(),I.copy(M.position).project(M),T.copy(M.target).project(M)},this.getCurrentPosition=()=>(T.copy(_.target).project(M),[T.x,T.y]),this.zoom=L=>{var N=.002*L,x=Math.max(_.zoom-N,1);_.zoom=x,_.updateProjectionMatrix()},this.zoomToBox=(L,N)=>{L.getCenter(P),P.project(M),this.setCenterZoom([P.x,P.y],N)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:_.zoom}),this.setCenterZoom=(L,N)=>{P.set(L[0],L[1],T.z).unproject(M),A.copy(P).sub(_.target),_.target.copy(P),_.lookAt(_.target),_.position.add(A),_.zoom=N,_.updateProjectionMatrix()},this.setEventCallback=L=>{(L===void 0||typeof L=="function")&&(R=L)},this.triggerCallback=()=>{R!==void 0&&typeof R=="function"&&R()}};l.Viewport=h,l.CameraControls=p,l.SmoothCameraTransition=y,l.RotateCameraTransition=m,l.RayCaster=d,l.CameraAutoTumble=b,l.StereoEffect=g,l.NDCCameraControl=S},(o,l,u)=>{var{Group:c,Matrix4:f}=u(4),h=u(22).Pointset;u(24).Lines;var p=u(45).Lines2,y=u(3).Geometry,m=u(4),d=0,b=function(){return"re"+d++},v=function(g,w){var S=g,E=new c;E.matrixAutoUpdate=!1,E.userData=this;var M=[],_="",C=[],I=w,T=new f,P=3e3;T.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=b(),this.hideAllPrimitives=()=>{M.forEach(A=>A.hideAllPrimitives()),C.forEach(A=>A.setVisibility(!1))},this.showAllPrimitives=()=>{M.forEach(A=>A.showAllPrimitives()),C.forEach(A=>A.setVisibility(!0))},this.setVisibility=A=>{A!=E.visible&&(E.visible=A,this.pickableUpdateRequired=!0)},this.getVisibility=()=>E.visible,this.getGroup=()=>E,this.setTransformation=A=>{T.set(...A),E.matrix.copy(T),E.updateMatrixWorld()},this.setName=A=>{A&&A!==""&&(_=A)},this.getName=()=>_,this.getParent=()=>S,this.getFullSeparatedPath=()=>{var A=[];if(_!==""){A.push(_);for(var R,L=S;L!==void 0;)R=L.getName(),R!==""&&A.unshift(R),L=L.getParent()}return A},this.getFullPath=()=>{var A=this.getFullSeparatedPath();if(0<A.length){var R=A.shift();return A.forEach(L=>{R=R.concat("/",L)}),R}return""},this.createChild=A=>{var R=new v(this,I);return R.setName(A),M.push(R),E.add(R.getGroup()),R},this.getChildWithName=A=>{if(A){for(var R=A.toLowerCase(),L=0;L<M.length;L++)if(M[L].getName().toLowerCase()===R)return M[L]}},this.findChildFromSeparatedPath=A=>{if(A&&0<A.length&&A[0]===""&&A.shift(),A&&0<A.length){var R=this.getChildWithName(A[0]);return R?(A.shift(),R.findChildFromSeparatedPath(A)):void 0}return this},this.findChildFromPath=A=>{var R=A.split("/");return this.findChildFromSeparatedPath(R)},this.createChildFromSeparatedPath=A=>{if(0<A.length&&A[0]===""&&A.shift(),0<A.length){var R=this.getChildWithName(A[0]);return R||(R=this.createChild(A[0])),A.shift(),R.createChildFromSeparatedPath(A)}return this},this.createChildFromPath=A=>{var R=A.split("/");return this.createChildFromSeparatedPath(R)},this.findOrCreateChildFromPath=A=>{var R=this.findChildFromPath(A);return R||(R=this.createChildFromPath(A)),R},this.addZincObject=A=>{A&&(A.setRegion(this),E.add(A.getGroup()),C.push(A),this.pickableUpdateRequired=!0,I&&I.triggerObjectAddedCallback(A))},this.removeZincObject=A=>{for(var R=0;R<C.length;R++)if(A===C[R])return E.remove(A.getGroup()),C.splice(R,1),I&&I.triggerObjectRemovedCallback(A),A.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=A=>{if(this.pickableUpdateRequired)return!0;if(A){for(var R=!1,L=0;L<M.length;L++)if(R=M[L].checkPickableUpdateRequred(A),R)return!0}return!1},this.getPickableThreeJSObjects=(A,R)=>(E.visible&&(C.forEach(L=>{if(L.getGroup()&&L.getGroup().visible){var N=L.marker;N&&N.isEnabled()&&A.push(N.getMorph()),A.push(L.getGroup())}}),R&&M.forEach(L=>{L.getPickableThreeJSObjects(A,R)}),this.pickableUpdateRequired=!1),A),this.setDuration=A=>{P=A,C.forEach(R=>R.setDuration(A)),M.forEach(R=>R.setDuration(A))},this.getDuration=()=>P,this.getBoundingBox=A=>{var R,L;return C.forEach(N=>{L=N.getBoundingBox(),L&&(R==null?R=L.clone():R.union(L))}),A&&M.forEach(N=>{L=N.getBoundingBox(A),L&&(R==null?R=L.clone():R.union(L))}),R},this.clear=A=>{A&&M.forEach(R=>R.clear(A)),C.forEach(R=>{E.remove(R.getGroup()),R.dispose()}),M=[],C=[]},this.objectIsInRegion=(A,R)=>{for(var L=0;L<C.length;L++)if(A===C[L])return!0;if(R){for(var N=0;N<M.length;N++)if(M[N].objectIsInRegion(A,R))return!0}return!1},this.forEachGeometry=(A,R)=>{C.forEach(L=>{L.isGeometry&&A(L)}),R&&M.forEach(L=>L.forEachGeometry(A,R))},this.forEachGlyphset=(A,R)=>{C.forEach(L=>{L.isGlyphset&&A(L)}),R&&M.forEach(L=>L.forEachGlyphset(A,R))},this.forEachPointset=(A,R)=>{C.forEach(L=>{L.isPointset&&A(L)}),R&&M.forEach(L=>L.forEachPointset(A,R))},this.forEachLine=(A,R)=>{C.forEach(L=>{L.isLines&&A(L)}),R&&M.forEach(L=>L.forEachLine(A,R))},this.findObjectsWithAnatomicalId=(A,R)=>(C.forEach(L=>{L.anatomicalId===A&&objectsArray.push(L)}),R&&M.forEach(L=>{var N=L.findObjectsWithAnatomicalId(A,R);objectsArray.push(...N)}),objectsArray),this.findObjectsWithGroupName=(A,R)=>{var L=[];return C.forEach(N=>{var x=N.groupName?N.groupName.toLowerCase():N.groupName,O=A&&A.toLowerCase();x===O&&L.push(N)}),R&&M.forEach(N=>{var x=N.findObjectsWithGroupName(A,R);L.push(...x)}),L},this.findGeometriesWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isGeometry);return N},this.findPointsetsWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isPointset);return N},this.findGlyphsetsWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isGlyphset);return N},this.findLinesWithGroupName=(A,R)=>{var L=this.findObjectsWithGroupName(A,R),N=L.filter(x=>x.isLines);return N},this.getAllObjects=A=>{var R=[...C];return A&&M.forEach(L=>{var N=L.getAllObjects(A);R.push(...N)}),R},this.getChildRegions=A=>{var R=[...M];return A&&M.forEach(L=>{var N=L.getChildRegions(A);R.push(...N)}),R},this.getCurrentTime=()=>{if(C[0]!=null)return C[0].getCurrentTime();for(var A,R=0;R<M.length;R++)if(A=M[R].getCurrentTime(),A!==-1)return A;return-1},this.setMorphTime=(A,R)=>{C.forEach(L=>{L.setMorphTime(A)}),R&&M.forEach(L=>{L.setMorphTime(A)})},this.isTimeVarying=()=>{for(var A=0;A<C.length;A++)if(C[A].isTimeVarying())return!0;for(var R=0;R<M.length;R++)if(M[R].isTimeVarying())return!0;return!1},this.renderGeometries=(A,R,L,N,x,O)=>{var B,D=this.getAllObjects(O);D.forEach(z=>{z.render(A*R,L,N,x)}),x&&L===!1&&(B=x.markerCluster)!==null&&B!==void 0&&B.markerUpdateRequired&&x.markerCluster.calculate()},this.createPoints=(A,R,L,N)=>{var x=!1,O=this.findObjectsWithGroupName(A,!1),B=O.findIndex(z=>z.isPointset),D=-1<B?O[B]:new h;return D.addPoints(R,L,N),B===-1?(D.setName(A),this.addZincObject(D),x=!0):this.pickableUpdateRequired=!0,{zincObject:D,isNew:x}},this.createLines=(A,R,L)=>{var N=!1,x=this.findObjectsWithGroupName(A,!1),O=x.findIndex(D=>D.isLines),B=-1<O?x[O]:new p;return B.addLines(R,L),O===-1?(B.setName(A),this.addZincObject(B),N=!0):this.pickableUpdateRequired=!0,{zincObject:B,isNew:N}},this.createGeometryFromThreeJSGeometry=(A,R,L,N,x,O)=>{var B=new y,D=new m.MeshPhongMaterial({color:L,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:N,side:m.DoubleSide});return B.createMesh(R,D,{localTimeEnabled:!1,localMorphColour:!1}),B.getMorph()?(B.setVisibility(!1),B.setName(A),B.setRenderOrder(O),this.addZincObject(B),B):void 0}};l.Region=v},(o,l,u)=>{u(4),u(5).toBufferGeometry;var c=u(46).LineSegments2,f=u(48).LineMaterial,h=u(47).LineSegmentsGeometry,p=function(){u(24).Lines.call(this),this.isLines2=!0;var y=Array(300);this.createLineSegment=(m,d,b)=>{if(m&&d){var v=new h;v.setPositions(m),v.colorsNeedUpdate=!0;var g=new c(v,d);g.scale.set(1,1,1),g.computeLineDistances(),this.setMesh(g,b.localTimeEnabled,b.localMorphColour)}},this.setWidth=m=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=m,this.morph.material.needsUpdate=!0)},this.addVertices=function(m){if(m&&m.length){var d=this.getMorph();d||(this.drawRange=0);var b=3*this.drawRange;if(m.forEach(v=>{y[b++]=v[0],y[b++]=v[1],y[b++]=v[2],this.drawRange++}),!d)for(;300>b;)y[b++]=m[0][0],y[b++]=m[0][1],y[b++]=m[0][2];d&&(d.geometry.setPositions(y),d.computeLineDistances(),this.boundingBoxUpdateRequired=!0)}return y},this.getVerticesByFaceIndex=function(m){var d=3*(2*m),b=this.getMorph();if(b&&3*this.drawRange>d){var v=b.geometry.getAttribute("instanceStart");return[[v.data.array[d],v.data.array[++d],v.data.array[++d]],[v.data.array[++d],v.data.array[++d],v.data.array[++d]]]}return[]},this.editVertices=function(m,d){if(m&&m.length){var b=this.getMorph(),v=d+m.length-1;if(!b||0>d||v>=this.drawRange)return;var g=3*d;for(m.forEach(w=>{y[g++]=w[0],y[g++]=w[1],y[g++]=w[2]}),g=3*this.drawRange;300>g;)y[g++]=m[0][0],y[g++]=m[0][1],y[g++]=m[0][2];b.geometry.setPositions(y),b.computeLineDistances(),this.boundingBoxUpdateRequired=!0}return y},this.addLines=(m,d)=>{if(m&&0<m.length){this.addVertices(m);var b=this.getMorph();if(!b){var v=new f({color:d,linewidth:1,vertexColors:!1,worldUnits:!1});v.resolution.set(window.innerWidth,window.innerHeight),this.createLineSegment(y,v,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=()=>{var m=this.getMorph().material;m.resolution.set(window.innerWidth,window.innerHeight)}};p.prototype=Object.create(u(24).Lines.prototype),p.prototype.constructor=p,l.Lines2=p},(o,l,u)=>{u.r(l),u.d(l,{LineSegments2:()=>C});var c=u(4),f=u(47),h=u(48),p=new c.Vector3,y=new c.Vector3,m=new c.Vector4,d=new c.Vector4,b=new c.Vector4,v=new c.Vector3,g=new c.Matrix4,w=new c.Line3,S=new c.Vector3,E=new c.Box3,M=new c.Sphere,_=new c.Vector4;class C extends c.Mesh{constructor(){var T=0<arguments.length&&arguments[0]!==void 0?arguments[0]:new f.LineSegmentsGeometry,P=1<arguments.length&&arguments[1]!==void 0?arguments[1]:new h.LineMaterial({color:16777215*Math.random()});super(T,P),this.type="LineSegments2"}computeLineDistances(){for(var T=this.geometry,P=T.attributes.instanceStart,A=T.attributes.instanceEnd,R=new Float32Array(2*P.count),L=0,N=0,x=P.count;L<x;L++,N+=2)p.fromBufferAttribute(P,L),y.fromBufferAttribute(A,L),R[N]=N==0?0:R[N-1],R[N+1]=R[N]+p.distanceTo(y);var O=new c.InstancedInterleavedBuffer(R,2,1);return T.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(O,1,0)),T.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(O,1,1)),this}raycast(T,P){T.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var A=T.params.Line2===void 0?0:T.params.Line2.threshold||0,R=T.ray,L=T.camera,N=L.projectionMatrix,x=this.matrixWorld,O=this.geometry,B=this.material,D=B.resolution,z=B.linewidth+A,U=O.attributes.instanceStart,H=O.attributes.instanceEnd,Y=-L.near,ie=2*Math.max(z/D.width,z/D.height);O.boundingSphere===null&&O.computeBoundingSphere(),M.copy(O.boundingSphere).applyMatrix4(x);var ae=Math.max(L.near,M.distanceToPoint(R.origin));_.set(0,0,-ae,1).applyMatrix4(L.projectionMatrix),_.multiplyScalar(1/_.w),_.applyMatrix4(L.projectionMatrixInverse);var ee=.5*Math.abs(ie/_.w);if(M.radius+=ee,T.ray.intersectsSphere(M)!==!1){O.boundingBox===null&&O.computeBoundingBox(),E.copy(O.boundingBox).applyMatrix4(x);var oe=Math.max(L.near,E.distanceToPoint(R.origin));_.set(0,0,-oe,1).applyMatrix4(L.projectionMatrix),_.multiplyScalar(1/_.w),_.applyMatrix4(L.projectionMatrixInverse);var j=.5*Math.abs(ie/_.w);if(E.max.x+=j,E.max.y+=j,E.max.z+=j,E.min.x-=j,E.min.y-=j,E.min.z-=j,T.ray.intersectsBox(E)!==!1){R.at(1,b),b.w=1,b.applyMatrix4(L.matrixWorldInverse),b.applyMatrix4(N),b.multiplyScalar(1/b.w),b.x*=D.x/2,b.y*=D.y/2,b.z=0,v.copy(b),g.multiplyMatrices(L.matrixWorldInverse,x);for(var K=0,$=U.count;K<$;K++){m.fromBufferAttribute(U,K),d.fromBufferAttribute(H,K),m.w=1,d.w=1,m.applyMatrix4(g),d.applyMatrix4(g);var re=m.z>Y&&d.z>Y;if(!re){if(m.z>Y){var G=m.z-d.z,W=(m.z-Y)/G;m.lerp(d,W)}else if(d.z>Y){var F=d.z-m.z,X=(d.z-Y)/F;d.lerp(m,X)}m.applyMatrix4(N),d.applyMatrix4(N),m.multiplyScalar(1/m.w),d.multiplyScalar(1/d.w),m.x*=D.x/2,m.y*=D.y/2,d.x*=D.x/2,d.y*=D.y/2,w.start.copy(m),w.start.z=0,w.end.copy(d),w.end.z=0;var J=w.closestPointToPointParameter(v,!0);w.at(J,S);var V=c.MathUtils.lerp(m.z,d.z,J),k=-1<=V&&1>=V,te=v.distanceTo(S)<.5*z;if(k&&te){w.start.fromBufferAttribute(U,K),w.end.fromBufferAttribute(H,K),w.start.applyMatrix4(x),w.end.applyMatrix4(x);var se=new c.Vector3,le=new c.Vector3;R.distanceSqToSegment(w.start,w.end,le,se),P.push({point:le,pointOnLine:se,distance:R.origin.distanceTo(le),object:this,face:null,faceIndex:K,uv:null,uv2:null})}}}}}}}C.prototype.LineSegments2=!0},(o,l,u)=>{u.r(l),u.d(l,{LineSegmentsGeometry:()=>p});var c=u(4),f=new c.Box3,h=new c.Vector3;class p extends c.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new c.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new c.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(m){var d=this.attributes.instanceStart,b=this.attributes.instanceEnd;return d!==void 0&&(d.applyMatrix4(m),b.applyMatrix4(m),d.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(m){var d;m instanceof Float32Array?d=m:Array.isArray(m)&&(d=new Float32Array(m));var b=new c.InstancedInterleavedBuffer(d,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(b,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(b,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(m){var d;m instanceof Float32Array?d=m:Array.isArray(m)&&(d=new Float32Array(m));var b=new c.InstancedInterleavedBuffer(d,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(b,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(b,3,3)),this}fromWireframeGeometry(m){return this.setPositions(m.attributes.position.array),this}fromEdgesGeometry(m){return this.setPositions(m.attributes.position.array),this}fromMesh(m){return this.fromWireframeGeometry(new c.WireframeGeometry(m.geometry)),this}fromLineSegments(m){var d=m.geometry;return d.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(d.isBufferGeometry&&this.setPositions(d.attributes.position.array),this)}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);var m=this.attributes.instanceStart,d=this.attributes.instanceEnd;m!==void 0&&d!==void 0&&(this.boundingBox.setFromBufferAttribute(m),f.setFromBufferAttribute(d),this.boundingBox.union(f))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();var m=this.attributes.instanceStart,d=this.attributes.instanceEnd;if(m!==void 0&&d!==void 0){var b=this.boundingSphere.center;this.boundingBox.getCenter(b);for(var v=0,g=0,w=m.count;g<w;g++)h.fromBufferAttribute(m,g),v=Math.max(v,b.distanceToSquared(h)),h.fromBufferAttribute(d,g),v=Math.max(v,b.distanceToSquared(h));this.boundingSphere.radius=Math.sqrt(v),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(m){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(m)}}p.prototype.isLineSegmentsGeometry=!0},(o,l,u)=>{u.r(l),u.d(l,{LineMaterial:()=>f});var c=u(4);c.UniformsLib.line={linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
3232
3232
  #include <common>
3233
3233
  #include <color_pars_vertex>
3234
3234
  #include <fog_pars_vertex>