zincjs 1.20.1-beta.2 → 1.20.1-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.
- package/build/zinc.js +6 -6
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/label.js +2 -1
- package/src/utilities.js +2 -1
package/build/zinc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(w,Le){typeof exports=="object"&&typeof module<"u"?module.exports=Le(require("three"),require("three-spritetext"),require("css-element-queries"),require("three/examples/jsm/loaders/GLTFLoader")):typeof define=="function"&&define.amd?define(["three","three-spritetext","css-element-queries","three/examples/jsm/loaders/GLTFLoader"],Le):(w=typeof globalThis<"u"?globalThis:w||self,w.Zinc=Le(w.THREE,w.SpriteText,w.cssElememtQueries,w.GLTFLoader))})(this,function(w,Le,Ot,Li){"use strict";function Bi(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const S=Bi(w),Ui={version:"1.20.1-beta.2"},we=new w.Matrix4,rt=new w.Object3D,qe=new w.Vector3,Ae=new w.Vector3;function Be(){this.uuid=w.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}Be.prototype=Object.assign(Object.create(w.EventDispatcher.prototype),{constructor:Be,isGeometry:!0,applyMatrix4:function(n){const e=new w.Matrix3().getNormalMatrix(n);for(let t=0,s=this.vertices.length;t<s;t++)this.vertices[t].applyMatrix4(n);for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];i.normal.applyMatrix3(e).normalize();for(let r=0,o=i.vertexNormals.length;r<o;r++)i.vertexNormals[r].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(n){return we.makeRotationX(n),this.applyMatrix4(we),this},rotateY:function(n){return we.makeRotationY(n),this.applyMatrix4(we),this},rotateZ:function(n){return we.makeRotationZ(n),this.applyMatrix4(we),this},translate:function(n,e,t){return we.makeTranslation(n,e,t),this.applyMatrix4(we),this},scale:function(n,e,t){return we.makeScale(n,e,t),this.applyMatrix4(we),this},lookAt:function(n){return rt.lookAt(n),rt.updateMatrix(),this.applyMatrix4(rt.matrix),this},fromBufferGeometry:function(n){const e=this,t=n.index!==null?n.index:void 0,s=n.attributes;if(s.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const i=s.position,r=s.normal,o=s.color,a=s.uv,u=s.uv2;u!==void 0&&(this.faceVertexUvs[1]=[]);for(let c=0;c<i.count;c++)e.vertices.push(new w.Vector3().fromBufferAttribute(i,c)),o!==void 0&&e.colors.push(new w.Color().fromBufferAttribute(o,c));function f(c,d,h,m){const A=o===void 0?[]:[e.colors[c].clone(),e.colors[d].clone(),e.colors[h].clone()],b=r===void 0?[]:[new w.Vector3().fromBufferAttribute(r,c),new w.Vector3().fromBufferAttribute(r,d),new w.Vector3().fromBufferAttribute(r,h)],g=new De(c,d,h,b,A,m);e.faces.push(g),a!==void 0&&e.faceVertexUvs[0].push([new w.Vector2().fromBufferAttribute(a,c),new w.Vector2().fromBufferAttribute(a,d),new w.Vector2().fromBufferAttribute(a,h)]),u!==void 0&&e.faceVertexUvs[1].push([new w.Vector2().fromBufferAttribute(u,c),new w.Vector2().fromBufferAttribute(u,d),new w.Vector2().fromBufferAttribute(u,h)])}const l=n.groups;if(l.length>0)for(let c=0;c<l.length;c++){const d=l[c],h=d.start,m=d.count;for(let A=h,b=h+m;A<b;A+=3)t!==void 0?f(t.getX(A),t.getX(A+1),t.getX(A+2),d.materialIndex):f(A,A+1,A+2,d.materialIndex)}else if(t!==void 0)for(let c=0;c<t.count;c+=3)f(t.getX(c),t.getX(c+1),t.getX(c+2));else for(let c=0;c<i.count;c+=3)f(c,c+1,c+2);return this.computeFaceNormals(),n.boundingBox!==null&&(this.boundingBox=n.boundingBox.clone()),n.boundingSphere!==null&&(this.boundingSphere=n.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qe).negate(),this.translate(qe.x,qe.y,qe.z),this},normalize:function(){this.computeBoundingSphere();const n=this.boundingSphere.center,e=this.boundingSphere.radius,t=e===0?1:1/e,s=new w.Matrix4;return s.set(t,0,0,-t*n.x,0,t,0,-t*n.y,0,0,t,-t*n.z,0,0,0,1),this.applyMatrix4(s),this},computeFaceNormals:function(){const n=new w.Vector3,e=new w.Vector3;for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=this.vertices[i.a],o=this.vertices[i.b],a=this.vertices[i.c];n.subVectors(a,o),e.subVectors(r,o),n.cross(e),n.normalize(),i.normal.copy(n)}},computeVertexNormals:function(n=!0){const e=new Array(this.vertices.length);for(let t=0,s=this.vertices.length;t<s;t++)e[t]=new w.Vector3;if(n){const t=new w.Vector3,s=new w.Vector3;for(let i=0,r=this.faces.length;i<r;i++){const o=this.faces[i],a=this.vertices[o.a],u=this.vertices[o.b],f=this.vertices[o.c];t.subVectors(f,u),s.subVectors(a,u),t.cross(s),e[o.a].add(t),e[o.b].add(t),e[o.c].add(t)}}else{this.computeFaceNormals();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let t=0,s=this.vertices.length;t<s;t++)e[t].normalize();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=i.vertexNormals;r.length===3?(r[0].copy(e[i.a]),r[1].copy(e[i.b]),r[2].copy(e[i.c])):(r[0]=e[i.a].clone(),r[1]=e[i.b].clone(),r[2]=e[i.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),e},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let n=0,e=this.faces.length;n<e;n++){const t=this.faces[n],s=t.vertexNormals;s.length===3?(s[0].copy(t.normal),s[1].copy(t.normal),s[2].copy(t.normal)):(s[0]=t.normal.clone(),s[1]=t.normal.clone(),s[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.__originalFaceNormal?s.__originalFaceNormal.copy(s.normal):s.__originalFaceNormal=s.normal.clone(),s.__originalVertexNormals||(s.__originalVertexNormals=[]);for(let i=0,r=s.vertexNormals.length;i<r;i++)s.__originalVertexNormals[i]?s.__originalVertexNormals[i].copy(s.vertexNormals[i]):s.__originalVertexNormals[i]=s.vertexNormals[i].clone()}const n=new Be;n.faces=this.faces;for(let e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const r=this.morphNormals[e].faceNormals,o=this.morphNormals[e].vertexNormals;for(let a=0,u=this.faces.length;a<u;a++){const f=new w.Vector3,l={a:new w.Vector3,b:new w.Vector3,c:new w.Vector3};r.push(f),o.push(l)}}const s=this.morphNormals[e];n.vertices=this.morphTargets[e].vertices,n.computeFaceNormals();let i=n.computeVertexNormals();if(i&&i.length>0){this.morphTargets[e].normals=new Array(this.vertices.length);for(let r=0;r<i.length;r++)this.morphTargets[e].normals[r]=i[r].clone()}for(let r=0,o=this.faces.length;r<o;r++){const a=this.faces[r],u=s.faceNormals[r],f=s.vertexNormals[r];u.copy(a.normal),f.a.copy(a.vertexNormals[0]),f.b.copy(a.vertexNormals[1]),f.c.copy(a.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.normal=s.__originalFaceNormal,s.vertexNormals=s.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new w.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new w.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(n,e){const t=this.morphTargets.length,s=this.morphTargets,i=n.morphTargets,r=this.morphColors.length,o=this.morphColors,a=n.morphColors;if(t>0&&t==i.length)for(let u=0,f=s.length;u<f;u++){const l=s[u],c=i[u];for(let d=0,h=c.vertices.length;d<h;d++){const A=c.vertices[d].clone();e!==void 0&&A.applyMatrix4(e),l.vertices.push(A)}if(l.normals&&c.normals)for(let d=0;d<c.normals.length;d=d+3)Ae.set(c.normals2[d],c.normals2[d+1],c.normals2[d+2]),e!==void 0&&Ae.applyMatrix4(e),l.normals.push(Ae.x,Ae.y,Ae.z)}if(r>0&&r==a.length)for(let u=0,f=o.length;u<f;u++){const l=o[u],c=a[u];for(let d=0,h=c.colors;d<h;d++)l.colors.push(c.colors[d].clone())}},merge:function(n,e,t=0){if(!(n&&n.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",n);return}let s;const i=this.vertices.length,r=this.vertices,o=n.vertices,a=n.normals,u=this.faces,f=n.faces,l=this.colors,c=n.colors;e!==void 0&&(s=new w.Matrix3().getNormalMatrix(e));for(let d=0,h=o.length;d<h;d++){const A=o[d].clone();e!==void 0&&A.applyMatrix4(e),r.push(A)}for(let d=0;d<a.length;d=d+3)Ae.set(a[d],a[d+1],a[d+2]),e!==void 0&&Ae.applyMatrix4(e),this.normals.push(Ae.x,Ae.y,Ae.z);for(let d=0,h=c.length;d<h;d++)typeof c[d]=="number"?l.push(c[d]):l.push(c[d].clone());for(let d=0,h=f.length;d<h;d++){const m=f[d];let A,b;const g=m.vertexNormals,M=m.vertexColors,_=new De(m.a+i,m.b+i,m.c+i);_.normal.copy(m.normal),s!==void 0&&_.normal.applyMatrix3(s).normalize();for(let N=0,U=g.length;N<U;N++)A=g[N].clone(),s!==void 0&&A.applyMatrix3(s).normalize(),_.vertexNormals.push(A);_.color.copy(m.color);for(let N=0,U=M.length;N<U;N++)b=M[N],_.vertexColors.push(b.clone());_.materialIndex=m.materialIndex+t,u.push(_)}for(let d=0,h=n.faceVertexUvs.length;d<h;d++){const m=n.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let A=0,b=m.length;A<b;A++){const g=m[A],M=[];for(let _=0,N=g.length;_<N;_++)M.push(g[_].clone());this.faceVertexUvs[d].push(M)}}this.mergeMorph(n,e)},mergeMesh:function(n){if(!(n&&n.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",n);return}n.matrixAutoUpdate&&n.updateMatrix(),this.merge(n.geometry,n.matrix)},mergeVertices:function(n=4){const e={},t=[],s=[],i=Math.pow(10,n);for(let a=0,u=this.vertices.length;a<u;a++){const f=this.vertices[a],l=Math.round(f.x*i)+"_"+Math.round(f.y*i)+"_"+Math.round(f.z*i);e[l]===void 0?(e[l]=a,t.push(this.vertices[a]),s[a]=t.length-1):s[a]=s[e[l]]}const r=[];for(let a=0,u=this.faces.length;a<u;a++){const f=this.faces[a];f.a=s[f.a],f.b=s[f.b],f.c=s[f.c];const l=[f.a,f.b,f.c];for(let c=0;c<3;c++)if(l[c]===l[(c+1)%3]){r.push(a);break}}for(let a=r.length-1;a>=0;a--){const u=r[a];this.faces.splice(u,1);for(let f=0,l=this.faceVertexUvs.length;f<l;f++)this.faceVertexUvs[f].splice(u,1)}const o=this.vertices.length-t.length;return this.vertices=t,o},setFromPoints:function(n){this.vertices=[];for(let e=0,t=n.length;e<t;e++){const s=n[e];this.vertices.push(new w.Vector3(s.x,s.y,s.z||0))}return this},sortFacesByMaterialIndex:function(){const n=this.faces,e=n.length;for(let a=0;a<e;a++)n[a]._id=a;function t(a,u){return a.materialIndex-u.materialIndex}n.sort(t);const s=this.faceVertexUvs[0],i=this.faceVertexUvs[1];let r,o;s&&s.length===e&&(r=[]),i&&i.length===e&&(o=[]);for(let a=0;a<e;a++){const u=n[a]._id;r&&r.push(s[u]),o&&o.push(i[u])}r&&(this.faceVertexUvs[0]=r),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const n={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.parameters!==void 0){const h=this.parameters;for(const m in h)h[m]!==void 0&&(n[m]=h[m]);return n}const e=[];for(let h=0;h<this.vertices.length;h++){const m=this.vertices[h];e.push(m.x,m.y,m.z)}const t=[],s=[],i={},r=[],o={},a=[],u={};for(let h=0;h<this.faces.length;h++){const m=this.faces[h],A=!0,b=!1,g=this.faceVertexUvs[0][h]!==void 0,M=m.normal.length()>0,_=m.vertexNormals.length>0,N=m.color.r!==1||m.color.g!==1||m.color.b!==1,U=m.vertexColors.length>0;let I=0;if(I=f(I,0,0),I=f(I,1,A),I=f(I,2,b),I=f(I,3,g),I=f(I,4,M),I=f(I,5,_),I=f(I,6,N),I=f(I,7,U),t.push(I),t.push(m.a,m.b,m.c),t.push(m.materialIndex),g){const D=this.faceVertexUvs[0][h];t.push(d(D[0]),d(D[1]),d(D[2]))}if(M&&t.push(l(m.normal)),_){const D=m.vertexNormals;t.push(l(D[0]),l(D[1]),l(D[2]))}if(N&&t.push(c(m.color)),U){const D=m.vertexColors;t.push(c(D[0]),c(D[1]),c(D[2]))}}function f(h,m,A){return A?h|1<<m:h&~(1<<m)}function l(h){const m=h.x.toString()+h.y.toString()+h.z.toString();return i[m]!==void 0||(i[m]=s.length/3,s.push(h.x,h.y,h.z)),i[m]}function c(h){const m=h.r.toString()+h.g.toString()+h.b.toString();return o[m]!==void 0||(o[m]=r.length,r.push(h.getHex())),o[m]}function d(h){const m=h.x.toString()+h.y.toString();return u[m]!==void 0||(u[m]=a.length/2,a.push(h.x,h.y)),u[m]}return n.data={},n.data.vertices=e,n.data.normals=s,r.length>0&&(n.data.colors=r),a.length>0&&(n.data.uvs=[a]),n.data.faces=t,n},clone:function(){return new Be().copy(this)},copy:function(n){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=n.name;const e=n.vertices;for(let c=0,d=e.length;c<d;c++)this.vertices.push(e[c].clone());const t=n.colors;for(let c=0,d=t.length;c<d;c++)this.colors.push(t[c].clone());const s=n.faces;for(let c=0,d=s.length;c<d;c++)this.faces.push(s[c].clone());for(let c=0,d=n.faceVertexUvs.length;c<d;c++){const h=n.faceVertexUvs[c];this.faceVertexUvs[c]===void 0&&(this.faceVertexUvs[c]=[]);for(let m=0,A=h.length;m<A;m++){const b=h[m],g=[];for(let M=0,_=b.length;M<_;M++){const N=b[M];g.push(N.clone())}this.faceVertexUvs[c].push(g)}}const i=n.morphTargets;for(let c=0,d=i.length;c<d;c++){const h={};if(h.name=i[c].name,i[c].vertices!==void 0){h.vertices=[];for(let m=0,A=i[c].vertices.length;m<A;m++)h.vertices.push(i[c].vertices[m].clone())}if(i[c].normals!==void 0){h.normals=[];for(let m=0,A=i[c].normals.length;m<A;m++)h.normals.push(i[c].normals[m].clone())}this.morphTargets.push(h)}const r=n.morphNormals;for(let c=0,d=r.length;c<d;c++){const h={};if(r[c].vertexNormals!==void 0){h.vertexNormals=[];for(let m=0,A=r[c].vertexNormals.length;m<A;m++){const b=r[c].vertexNormals[m],g={};g.a=b.a.clone(),g.b=b.b.clone(),g.c=b.c.clone(),h.vertexNormals.push(g)}}if(r[c].faceNormals!==void 0){h.faceNormals=[];for(let m=0,A=r[c].faceNormals.length;m<A;m++)h.faceNormals.push(r[c].faceNormals[m].clone())}this.morphNormals.push(h)}const o=n.skinWeights;for(let c=0,d=o.length;c<d;c++)this.skinWeights.push(o[c].clone());const a=n.skinIndices;for(let c=0,d=a.length;c<d;c++)this.skinIndices.push(a[c].clone());const u=n.lineDistances;for(let c=0,d=u.length;c<d;c++)this.lineDistances.push(u[c]);const f=n.boundingBox;f!==null&&(this.boundingBox=f.clone());const l=n.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.elementsNeedUpdate=n.elementsNeedUpdate,this.verticesNeedUpdate=n.verticesNeedUpdate,this.uvsNeedUpdate=n.uvsNeedUpdate,this.normalsNeedUpdate=n.normalsNeedUpdate,this.colorsNeedUpdate=n.colorsNeedUpdate,this.lineDistancesNeedUpdate=n.lineDistancesNeedUpdate,this.groupsNeedUpdate=n.groupsNeedUpdate,this},computeGroups(){const n=[];let e,t,s;const i=this.faces;for(t=0;t<i.length;t++){const r=i[t];r.materialIndex!==s&&(s=r.materialIndex,e!==void 0&&(e.count=t*3-e.start,n.push(e)),e={start:t*3,materialIndex:s})}return e!==void 0&&(e.count=t*3-e.start,n.push(e)),n},toBufferGeometry:function(){const n=new Ni().fromGeometry(this),e=new w.BufferGeometry,t=new Float32Array(n.vertices.length*3);if(e.setAttribute("position",new w.BufferAttribute(t,3).copyVector3sArray(n.vertices)),n.normals.length>0){const s=new Float32Array(n.normals.length*3);e.setAttribute("normal",new w.BufferAttribute(s,3).copyVector3sArray(n.normals))}if(n.colors.length>0){const s=new Float32Array(n.colors.length*3);e.setAttribute("color",new w.BufferAttribute(s,3).copyColorsArray(n.colors))}if(n.uvs.length>0){const s=new Float32Array(n.uvs.length*2);e.setAttribute("uv",new w.BufferAttribute(s,2).copyVector2sArray(n.uvs))}if(n.uvs2.length>0){const s=new Float32Array(n.uvs2.length*2);e.setAttribute("uv2",new w.BufferAttribute(s,2).copyVector2sArray(n.uvs2))}e.groups=n.groups;for(const s in n.morphTargets){const i=[],r=n.morphTargets[s];for(let o=0,a=r.length;o<a;o++){const u=r[o],f=new w.Float32BufferAttribute(u.data.length*3,3);f.name=u.name,i.push(f.copyVector3sArray(u.data))}e.morphAttributes[s]=i}if(n.skinIndices.length>0){const s=new w.Float32BufferAttribute(n.skinIndices.length*4,4);e.setAttribute("skinIndex",s.copyVector4sArray(n.skinIndices))}if(n.skinWeights.length>0){const s=new w.Float32BufferAttribute(n.skinWeights.length*4,4);e.setAttribute("skinWeight",s.copyVector4sArray(n.skinWeights))}return n.boundingSphere!==null&&(e.boundingSphere=n.boundingSphere.clone()),n.boundingBox!==null&&(e.boundingBox=n.boundingBox.clone()),e},toIndexedBufferGeometry:function(){const n=new w.BufferGeometry,e=new Float32Array(this.vertices.length*3);if(n.setAttribute("position",new w.BufferAttribute(e,3).copyVector3sArray(this.vertices)),this.normals.length>0){const t=new Float32Array(this.normals.length);let s=new w.BufferAttribute(t,3).copyArray(this.normals);n.setAttribute("normal",s)}if(this.uvs.length>0&&this.uvs[0].length>0){const t=new Float32Array(this.uvs[0].length*2);n.setAttribute("uv",new w.BufferAttribute(t,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){const t=new Float32Array(this.uvs[1].length*2);n.setAttribute("uv2",new w.BufferAttribute(t,2).copyArray(this.uvs[1]))}if(this.colors.length>0){const t=[];for(let i=0;i<this.colors.length;i++)t.push(new w.Color(this.colors[i]));const s=new Float32Array(t.length*3);n.setAttribute("color",new w.BufferAttribute(s,3).copyColorsArray(t))}else{const t=new Float32Array(this.vertices.length*3);for(let s=0;s<this.vertices.length*3;s++)t[s]=1;n.setAttribute("color",new w.BufferAttribute(t,3))}if(this.faces.length>0){let t=[],s=[];for(let i=0;i<this.faces.length;i++){s.push(this.faces[i].a,this.faces[i].b,this.faces[i].c);const r=this.faces[i].vertexColors;if(r.length===3)t.push(r[0],r[1],r[2]);else{const o=this.faces[i].color;t.push(o,o,o)}}n.setIndex(s),n.groups=this.computeGroups()}if(this.morphTargets.length>0){const t=[],s=[];for(let i=0,r=this.morphTargets.length;i<r;i++){const o=this.morphTargets[i],a=new w.Float32BufferAttribute(o.vertices.length*3,3);if(a.name=o.name,t.push(a.copyVector3sArray(o.vertices)),o.normals){const u=new w.Float32BufferAttribute(o.normals.length*3,3);u.name=o.name,s.push(u.copyVector3sArray(o.normals))}}n.morphAttributes.position=t,n.morphAttributes.normal=s}if(this.skinIndices.length>0){const t=new w.Float32BufferAttribute(this.skinIndices.length*4,4);n.setAttribute("skinIndex",t.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){const t=new w.Float32BufferAttribute(this.skinWeights.length*4,4);n.setAttribute("skinWeight",t.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.clone()),n},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(n){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(n)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Be.createBufferGeometryFromObject=function(n){let e=new w.BufferGeometry;const t=n.geometry;if(n.isPoints||n.isLine){const s=new w.Float32BufferAttribute(t.vertices.length*3,3),i=new w.Float32BufferAttribute(t.colors.length*3,3);if(e.setAttribute("position",s.copyVector3sArray(t.vertices)),e.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){const r=new w.Float32BufferAttribute(t.lineDistances.length,1);e.setAttribute("lineDistance",r.copyArray(t.lineDistances))}t.boundingSphere!==null&&(e.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(e.boundingBox=t.boundingBox.clone())}else n.isMesh&&(e=t.toBufferGeometry());return e};class Ni{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let s,i,r;const o=e.faces;for(i=0;i<o.length;i++){const a=o[i];a.materialIndex!==r&&(r=a.materialIndex,s!==void 0&&(s.count=i*3-s.start,t.push(s)),s={start:i*3,materialIndex:r})}s!==void 0&&(s.count=i*3-s.start,t.push(s)),this.groups=t}fromGeometry(e){const t=e.faces,s=e.vertices,i=e.faceVertexUvs,r=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,a=e.morphTargets,u=a.length;let f;if(u>0){f=[];for(let g=0;g<u;g++)f[g]={name:a[g].name,data:[]};this.morphTargets.position=f}const l=e.morphNormals,c=l.length;let d;if(c>0){d=[];for(let g=0;g<c;g++)d[g]={name:l[g].name,data:[]};this.morphTargets.normal=d}const h=e.skinIndices,m=e.skinWeights,A=h.length===s.length,b=m.length===s.length;s.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<t.length;g++){const M=t[g];this.vertices.push(s[M.a],s[M.b],s[M.c]);const _=M.vertexNormals;if(_.length===3)this.normals.push(_[0],_[1],_[2]);else{const U=M.normal;this.normals.push(U,U,U)}const N=M.vertexColors;if(N.length===3)this.colors.push(N[0],N[1],N[2]);else{const U=M.color;this.colors.push(U,U,U)}if(r===!0){const U=i[0][g];U!==void 0?this.uvs.push(U[0],U[1],U[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new w.Vector2,new w.Vector2,new w.Vector2))}if(o===!0){const U=i[1][g];U!==void 0?this.uvs2.push(U[0],U[1],U[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new w.Vector2,new w.Vector2,new w.Vector2))}for(let U=0;U<u;U++){const I=a[U].vertices;f[U].data.push(I[M.a],I[M.b],I[M.c])}for(let U=0;U<c;U++){const I=l[U].vertexNormals[g];d[U].data.push(I.a,I.b,I.c)}A&&this.skinIndices.push(h[M.a],h[M.b],h[M.c]),b&&this.skinWeights.push(m[M.a],m[M.b],m[M.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}class De{constructor(e,t,s,i,r,o=0){this.a=e,this.b=t,this.c=s,this.normal=i&&i.isVector3?i:new w.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new w.Color,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,s=e.vertexNormals.length;t<s;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,s=e.vertexColors.length;t<s;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}const Pi="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==";function ye(n){let e=n,t=Se.modelPrefix;return t&&(t[t.length-1]!="/"&&(t=t+"/"),new RegExp("^(?:[a-z]+:)?//","i").test(n)||(e=t+n)),e}function Pe(n,e){const t=(s,i)=>{try{let r=new URL(s,i).href;if(s&&s.split("?").length<2){const o=i.split("?");o.length===2&&(r=r+"?"+o[1])}return r}catch{console.error(`There is an issue creating the url link with: ${s}.`)}};if(Array.isArray(n)){const s=[];return n.forEach(i=>{s.push(t(i,e))}),s}else return t(n,e)}function Vi(n,e,t,s,i){let r=n.morphTargetInfluences,o;n.geometry&&(o=n.geometry.morphAttributes);let a=!1;if(r&&o&&o.position){s.set(0,0,0),i.set(0,0,0);for(let u=0;u<r.length;u++)r[u]>0&&(a=!0,t.setFromArray(o.position[u].array),s.add(t.min.multiplyScalar(r[u])),i.add(t.max.multiplyScalar(r[u])));a&&e.set(s,i)}a||e.setFromBufferAttribute(n.geometry.attributes.position),n.updateWorldMatrix(!0,!0),e.applyMatrix4(n.matrixWorld)}function Tt(n,e,t,s){const i=new XMLHttpRequest;i.open("GET",ye(n),!0),i.onreadystatechange=()=>{i.readyState==4&&(i.status==200?t(i.responseText,e):s(n))},i.send(null)}function ki(n,e,t){const s=n.length;let i=0;const r=[];function o(a,u){r[u]=a,i++,i==s&&e(r)}for(let a=0;a<s;a++)Tt(n[a],a,o,t)}const Ri=(n,e)=>{const t=Math.floor(e/3),s=e%3;let i=0;s==0?i=n[t].r:s==1?i=n[t].g:s==2&&(i=n[t].b);const r=new S.Color(i);return[r.r,r.g,r.b]},Lt=function(n,e){if(e&&n&&n.morphAttributes&&n.morphAttributes.color){const t=n.morphAttributes.color,s=e.morphTargetInfluences,i=s.length;n.deleteAttribute("morphColor0"),n.deleteAttribute("morphColor1");let r=0,o=[];for(let a=0;1>r||a<i;a++)s[a]>0&&(r++,o.push([a,s[a]]));o.length==2?(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[1][0]])):o.length==1&&(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[0][0]]))}},Ze=(n,e)=>{let t;return n instanceof Be?(e.localTimeEnabled&&!n.morphNormalsReady&&(n.morphNormals==null||n.morphNormals.length==0)&&n.computeMorphNormals(),t=n.toIndexedBufferGeometry(),e.localMorphColour&&Ii(n,t)):n instanceof S.BufferGeometry&&(t=n.clone()),t.colorsNeedUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere(),n._video&&(t._video=n._video),t},Ii=(n,e)=>{if(n&&n.morphColors&&n.morphColors.length>0){let t=[],s=n.morphColors;for(let i=0,r=s.length;i<r;i++){const o=s[i],a=[];for(let f=0;f<o.colors.length*3;f++){let l=Ri(o.colors,f);a.push(l[0],l[1],l[2])}const u=new S.Float32BufferAttribute(a,3);u.name=o.name,t.push(u)}e.morphAttributes.color=t}};function Bt(n){let e,t,s,i=-1,r=0;for(let f=0;f<n.length;++f){const l=n[f];if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(s===void 0&&(s=l.normalized),s!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=l.gpuType),i!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=l.count*t}const o=new e(r),a=new S.BufferAttribute(o,t,s);let u=0;for(let f=0;f<n.length;++f){const l=n[f];if(l.isInterleavedBufferAttribute){const c=u/t;for(let d=0,h=l.count;d<h;d++)for(let m=0;m<t;m++){const A=l.getComponent(d,m);a.setComponent(d+c,m,A)}}else o.set(l.array,u);u+=l.count*t}return i!==void 0&&(a.gpuType=i),a}const Di=(n,e=!1)=>{const t=n[0].index!==null,s=new Set(Object.keys(n[0].attributes)),i=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,u=new S.BufferGeometry;let f=0;for(let l=0;l<n.length;++l){const c=n[l];let d=0;if(t!==(c.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const h in c.attributes){if(!s.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+'. All geometries must have compatible attributes; make sure "'+h+'" attribute exists among all geometries, or in none of them.'),null;r[h]===void 0&&(r[h]=[]),r[h].push(c.attributes[h]),d++}if(d!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const h in c.morphAttributes){if(!i.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphAttributes must be consistent throughout all geometries."),null;o[h]===void 0&&(o[h]=[]),o[h].push(c.morphAttributes[h])}if(e){let h;if(t)h=c.index.count;else if(c.attributes.position!==void 0)h=c.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". The geometry must have either an index or a position attribute"),null;u.addGroup(f,h,l),f+=h}}if(t){let l=0;const c=[];for(let d=0;d<n.length;++d){const h=n[d].index;for(let m=0;m<h.count;++m)c.push(h.getX(m)+l);l+=n[d].attributes.position.count}u.setIndex(c)}for(const l in r){const c=Bt(r[l]);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" attribute."),null;u.setAttribute(l,c)}for(const l in o){const c=o[l][0].length;if(c===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[l]=[];for(let d=0;d<c;++d){const h=[];for(let A=0;A<o[l].length;++A)h.push(o[l][A][d]);const m=Bt(h);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" morphAttribute."),null;u.morphAttributes[l].push(m)}}return u};function nt(n,e){if(e&&n>=e.length){const t=new S.BufferGeometry,s=new Float32Array(n*3);let i=0;return e.forEach(r=>{s[i++]=r[0],s[i++]=r[1],s[i++]=r[2]}),t.setAttribute("position",new S.BufferAttribute(s,3)),t.setDrawRange(0,e.length),t}}function Ut(){const n=new Image;n.src=Pi;const e=new S.Texture;return e.image=n,e.needsUpdate=!0,e}function ot(n,e,t,s,i,r){const o=new Le(n,e,t,s,i,r);return o.fontFace=s,o.fontSize=i,o.fontWeight=r,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o}function Nt(n,e,t){if(t){const s=n||"",i=e||"",r=t.lastIndexOf("/");if(r>-1){let o,a;if(o=t.substring(0,r),a=t.substring(r+1),(o==="*"||o==="**"||o.toLowerCase()===s.toLowerCase())&&(a==="*"||a==="**"||a.toLowerCase()===i.toLowerCase()))return!0}else if(s.toLowerCase()===t.toLowerCase()||i.toLowerCase()===t.toLowerCase())return!0}return!1}function Fi(n,e,t){const s=n.getAttribute("position"),i=n.getAttribute("normal");if(!s)return;const r=s.itemSize,o=e*r,a=r;let u=!1;const f=(l,c)=>{let d=!1;const h=Array.from(l.array);if(h.length>=o+a){h.splice(o,a),h.concat(new Array(a).fill(0)),d=!0;const m=new Float32Array(h);n.setAttribute(c,new S.BufferAttribute(m,r)),n.getAttribute(c).needsUpdate=!0}return d};return u=f(s,"position"),i&&f(i,"normal"),n.index!==null&&console.warn("Removing vertices from indexed geometry requires index buffer recalculation."),u}const Pt=function(){return function(n){n.vertexShader=n.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join(`
|
|
1
|
+
(function(w,Oe){typeof exports=="object"&&typeof module<"u"?module.exports=Oe(require("three"),require("three-spritetext"),require("css-element-queries"),require("three/examples/jsm/loaders/GLTFLoader")):typeof define=="function"&&define.amd?define(["three","three-spritetext","css-element-queries","three/examples/jsm/loaders/GLTFLoader"],Oe):(w=typeof globalThis<"u"?globalThis:w||self,w.Zinc=Oe(w.THREE,w.SpriteText,w.cssElememtQueries,w.GLTFLoader))})(this,function(w,Oe,Ot,Bi){"use strict";function Ui(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const S=Ui(w),Ni={version:"1.20.1-beta.3"},we=new w.Matrix4,rt=new w.Object3D,qe=new w.Vector3,Ae=new w.Vector3;function Be(){this.uuid=w.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}Be.prototype=Object.assign(Object.create(w.EventDispatcher.prototype),{constructor:Be,isGeometry:!0,applyMatrix4:function(n){const e=new w.Matrix3().getNormalMatrix(n);for(let t=0,s=this.vertices.length;t<s;t++)this.vertices[t].applyMatrix4(n);for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];i.normal.applyMatrix3(e).normalize();for(let r=0,o=i.vertexNormals.length;r<o;r++)i.vertexNormals[r].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(n){return we.makeRotationX(n),this.applyMatrix4(we),this},rotateY:function(n){return we.makeRotationY(n),this.applyMatrix4(we),this},rotateZ:function(n){return we.makeRotationZ(n),this.applyMatrix4(we),this},translate:function(n,e,t){return we.makeTranslation(n,e,t),this.applyMatrix4(we),this},scale:function(n,e,t){return we.makeScale(n,e,t),this.applyMatrix4(we),this},lookAt:function(n){return rt.lookAt(n),rt.updateMatrix(),this.applyMatrix4(rt.matrix),this},fromBufferGeometry:function(n){const e=this,t=n.index!==null?n.index:void 0,s=n.attributes;if(s.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const i=s.position,r=s.normal,o=s.color,a=s.uv,u=s.uv2;u!==void 0&&(this.faceVertexUvs[1]=[]);for(let c=0;c<i.count;c++)e.vertices.push(new w.Vector3().fromBufferAttribute(i,c)),o!==void 0&&e.colors.push(new w.Color().fromBufferAttribute(o,c));function f(c,d,h,m){const A=o===void 0?[]:[e.colors[c].clone(),e.colors[d].clone(),e.colors[h].clone()],b=r===void 0?[]:[new w.Vector3().fromBufferAttribute(r,c),new w.Vector3().fromBufferAttribute(r,d),new w.Vector3().fromBufferAttribute(r,h)],g=new De(c,d,h,b,A,m);e.faces.push(g),a!==void 0&&e.faceVertexUvs[0].push([new w.Vector2().fromBufferAttribute(a,c),new w.Vector2().fromBufferAttribute(a,d),new w.Vector2().fromBufferAttribute(a,h)]),u!==void 0&&e.faceVertexUvs[1].push([new w.Vector2().fromBufferAttribute(u,c),new w.Vector2().fromBufferAttribute(u,d),new w.Vector2().fromBufferAttribute(u,h)])}const l=n.groups;if(l.length>0)for(let c=0;c<l.length;c++){const d=l[c],h=d.start,m=d.count;for(let A=h,b=h+m;A<b;A+=3)t!==void 0?f(t.getX(A),t.getX(A+1),t.getX(A+2),d.materialIndex):f(A,A+1,A+2,d.materialIndex)}else if(t!==void 0)for(let c=0;c<t.count;c+=3)f(t.getX(c),t.getX(c+1),t.getX(c+2));else for(let c=0;c<i.count;c+=3)f(c,c+1,c+2);return this.computeFaceNormals(),n.boundingBox!==null&&(this.boundingBox=n.boundingBox.clone()),n.boundingSphere!==null&&(this.boundingSphere=n.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qe).negate(),this.translate(qe.x,qe.y,qe.z),this},normalize:function(){this.computeBoundingSphere();const n=this.boundingSphere.center,e=this.boundingSphere.radius,t=e===0?1:1/e,s=new w.Matrix4;return s.set(t,0,0,-t*n.x,0,t,0,-t*n.y,0,0,t,-t*n.z,0,0,0,1),this.applyMatrix4(s),this},computeFaceNormals:function(){const n=new w.Vector3,e=new w.Vector3;for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=this.vertices[i.a],o=this.vertices[i.b],a=this.vertices[i.c];n.subVectors(a,o),e.subVectors(r,o),n.cross(e),n.normalize(),i.normal.copy(n)}},computeVertexNormals:function(n=!0){const e=new Array(this.vertices.length);for(let t=0,s=this.vertices.length;t<s;t++)e[t]=new w.Vector3;if(n){const t=new w.Vector3,s=new w.Vector3;for(let i=0,r=this.faces.length;i<r;i++){const o=this.faces[i],a=this.vertices[o.a],u=this.vertices[o.b],f=this.vertices[o.c];t.subVectors(f,u),s.subVectors(a,u),t.cross(s),e[o.a].add(t),e[o.b].add(t),e[o.c].add(t)}}else{this.computeFaceNormals();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let t=0,s=this.vertices.length;t<s;t++)e[t].normalize();for(let t=0,s=this.faces.length;t<s;t++){const i=this.faces[t],r=i.vertexNormals;r.length===3?(r[0].copy(e[i.a]),r[1].copy(e[i.b]),r[2].copy(e[i.c])):(r[0]=e[i.a].clone(),r[1]=e[i.b].clone(),r[2]=e[i.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),e},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let n=0,e=this.faces.length;n<e;n++){const t=this.faces[n],s=t.vertexNormals;s.length===3?(s[0].copy(t.normal),s[1].copy(t.normal),s[2].copy(t.normal)):(s[0]=t.normal.clone(),s[1]=t.normal.clone(),s[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.__originalFaceNormal?s.__originalFaceNormal.copy(s.normal):s.__originalFaceNormal=s.normal.clone(),s.__originalVertexNormals||(s.__originalVertexNormals=[]);for(let i=0,r=s.vertexNormals.length;i<r;i++)s.__originalVertexNormals[i]?s.__originalVertexNormals[i].copy(s.vertexNormals[i]):s.__originalVertexNormals[i]=s.vertexNormals[i].clone()}const n=new Be;n.faces=this.faces;for(let e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];const r=this.morphNormals[e].faceNormals,o=this.morphNormals[e].vertexNormals;for(let a=0,u=this.faces.length;a<u;a++){const f=new w.Vector3,l={a:new w.Vector3,b:new w.Vector3,c:new w.Vector3};r.push(f),o.push(l)}}const s=this.morphNormals[e];n.vertices=this.morphTargets[e].vertices,n.computeFaceNormals();let i=n.computeVertexNormals();if(i&&i.length>0){this.morphTargets[e].normals=new Array(this.vertices.length);for(let r=0;r<i.length;r++)this.morphTargets[e].normals[r]=i[r].clone()}for(let r=0,o=this.faces.length;r<o;r++){const a=this.faces[r],u=s.faceNormals[r],f=s.vertexNormals[r];u.copy(a.normal),f.a.copy(a.vertexNormals[0]),f.b.copy(a.vertexNormals[1]),f.c.copy(a.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const s=this.faces[e];s.normal=s.__originalFaceNormal,s.vertexNormals=s.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new w.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new w.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(n,e){const t=this.morphTargets.length,s=this.morphTargets,i=n.morphTargets,r=this.morphColors.length,o=this.morphColors,a=n.morphColors;if(t>0&&t==i.length)for(let u=0,f=s.length;u<f;u++){const l=s[u],c=i[u];for(let d=0,h=c.vertices.length;d<h;d++){const A=c.vertices[d].clone();e!==void 0&&A.applyMatrix4(e),l.vertices.push(A)}if(l.normals&&c.normals)for(let d=0;d<c.normals.length;d=d+3)Ae.set(c.normals2[d],c.normals2[d+1],c.normals2[d+2]),e!==void 0&&Ae.applyMatrix4(e),l.normals.push(Ae.x,Ae.y,Ae.z)}if(r>0&&r==a.length)for(let u=0,f=o.length;u<f;u++){const l=o[u],c=a[u];for(let d=0,h=c.colors;d<h;d++)l.colors.push(c.colors[d].clone())}},merge:function(n,e,t=0){if(!(n&&n.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",n);return}let s;const i=this.vertices.length,r=this.vertices,o=n.vertices,a=n.normals,u=this.faces,f=n.faces,l=this.colors,c=n.colors;e!==void 0&&(s=new w.Matrix3().getNormalMatrix(e));for(let d=0,h=o.length;d<h;d++){const A=o[d].clone();e!==void 0&&A.applyMatrix4(e),r.push(A)}for(let d=0;d<a.length;d=d+3)Ae.set(a[d],a[d+1],a[d+2]),e!==void 0&&Ae.applyMatrix4(e),this.normals.push(Ae.x,Ae.y,Ae.z);for(let d=0,h=c.length;d<h;d++)typeof c[d]=="number"?l.push(c[d]):l.push(c[d].clone());for(let d=0,h=f.length;d<h;d++){const m=f[d];let A,b;const g=m.vertexNormals,M=m.vertexColors,_=new De(m.a+i,m.b+i,m.c+i);_.normal.copy(m.normal),s!==void 0&&_.normal.applyMatrix3(s).normalize();for(let N=0,U=g.length;N<U;N++)A=g[N].clone(),s!==void 0&&A.applyMatrix3(s).normalize(),_.vertexNormals.push(A);_.color.copy(m.color);for(let N=0,U=M.length;N<U;N++)b=M[N],_.vertexColors.push(b.clone());_.materialIndex=m.materialIndex+t,u.push(_)}for(let d=0,h=n.faceVertexUvs.length;d<h;d++){const m=n.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let A=0,b=m.length;A<b;A++){const g=m[A],M=[];for(let _=0,N=g.length;_<N;_++)M.push(g[_].clone());this.faceVertexUvs[d].push(M)}}this.mergeMorph(n,e)},mergeMesh:function(n){if(!(n&&n.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",n);return}n.matrixAutoUpdate&&n.updateMatrix(),this.merge(n.geometry,n.matrix)},mergeVertices:function(n=4){const e={},t=[],s=[],i=Math.pow(10,n);for(let a=0,u=this.vertices.length;a<u;a++){const f=this.vertices[a],l=Math.round(f.x*i)+"_"+Math.round(f.y*i)+"_"+Math.round(f.z*i);e[l]===void 0?(e[l]=a,t.push(this.vertices[a]),s[a]=t.length-1):s[a]=s[e[l]]}const r=[];for(let a=0,u=this.faces.length;a<u;a++){const f=this.faces[a];f.a=s[f.a],f.b=s[f.b],f.c=s[f.c];const l=[f.a,f.b,f.c];for(let c=0;c<3;c++)if(l[c]===l[(c+1)%3]){r.push(a);break}}for(let a=r.length-1;a>=0;a--){const u=r[a];this.faces.splice(u,1);for(let f=0,l=this.faceVertexUvs.length;f<l;f++)this.faceVertexUvs[f].splice(u,1)}const o=this.vertices.length-t.length;return this.vertices=t,o},setFromPoints:function(n){this.vertices=[];for(let e=0,t=n.length;e<t;e++){const s=n[e];this.vertices.push(new w.Vector3(s.x,s.y,s.z||0))}return this},sortFacesByMaterialIndex:function(){const n=this.faces,e=n.length;for(let a=0;a<e;a++)n[a]._id=a;function t(a,u){return a.materialIndex-u.materialIndex}n.sort(t);const s=this.faceVertexUvs[0],i=this.faceVertexUvs[1];let r,o;s&&s.length===e&&(r=[]),i&&i.length===e&&(o=[]);for(let a=0;a<e;a++){const u=n[a]._id;r&&r.push(s[u]),o&&o.push(i[u])}r&&(this.faceVertexUvs[0]=r),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){const n={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.parameters!==void 0){const h=this.parameters;for(const m in h)h[m]!==void 0&&(n[m]=h[m]);return n}const e=[];for(let h=0;h<this.vertices.length;h++){const m=this.vertices[h];e.push(m.x,m.y,m.z)}const t=[],s=[],i={},r=[],o={},a=[],u={};for(let h=0;h<this.faces.length;h++){const m=this.faces[h],A=!0,b=!1,g=this.faceVertexUvs[0][h]!==void 0,M=m.normal.length()>0,_=m.vertexNormals.length>0,N=m.color.r!==1||m.color.g!==1||m.color.b!==1,U=m.vertexColors.length>0;let I=0;if(I=f(I,0,0),I=f(I,1,A),I=f(I,2,b),I=f(I,3,g),I=f(I,4,M),I=f(I,5,_),I=f(I,6,N),I=f(I,7,U),t.push(I),t.push(m.a,m.b,m.c),t.push(m.materialIndex),g){const D=this.faceVertexUvs[0][h];t.push(d(D[0]),d(D[1]),d(D[2]))}if(M&&t.push(l(m.normal)),_){const D=m.vertexNormals;t.push(l(D[0]),l(D[1]),l(D[2]))}if(N&&t.push(c(m.color)),U){const D=m.vertexColors;t.push(c(D[0]),c(D[1]),c(D[2]))}}function f(h,m,A){return A?h|1<<m:h&~(1<<m)}function l(h){const m=h.x.toString()+h.y.toString()+h.z.toString();return i[m]!==void 0||(i[m]=s.length/3,s.push(h.x,h.y,h.z)),i[m]}function c(h){const m=h.r.toString()+h.g.toString()+h.b.toString();return o[m]!==void 0||(o[m]=r.length,r.push(h.getHex())),o[m]}function d(h){const m=h.x.toString()+h.y.toString();return u[m]!==void 0||(u[m]=a.length/2,a.push(h.x,h.y)),u[m]}return n.data={},n.data.vertices=e,n.data.normals=s,r.length>0&&(n.data.colors=r),a.length>0&&(n.data.uvs=[a]),n.data.faces=t,n},clone:function(){return new Be().copy(this)},copy:function(n){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=n.name;const e=n.vertices;for(let c=0,d=e.length;c<d;c++)this.vertices.push(e[c].clone());const t=n.colors;for(let c=0,d=t.length;c<d;c++)this.colors.push(t[c].clone());const s=n.faces;for(let c=0,d=s.length;c<d;c++)this.faces.push(s[c].clone());for(let c=0,d=n.faceVertexUvs.length;c<d;c++){const h=n.faceVertexUvs[c];this.faceVertexUvs[c]===void 0&&(this.faceVertexUvs[c]=[]);for(let m=0,A=h.length;m<A;m++){const b=h[m],g=[];for(let M=0,_=b.length;M<_;M++){const N=b[M];g.push(N.clone())}this.faceVertexUvs[c].push(g)}}const i=n.morphTargets;for(let c=0,d=i.length;c<d;c++){const h={};if(h.name=i[c].name,i[c].vertices!==void 0){h.vertices=[];for(let m=0,A=i[c].vertices.length;m<A;m++)h.vertices.push(i[c].vertices[m].clone())}if(i[c].normals!==void 0){h.normals=[];for(let m=0,A=i[c].normals.length;m<A;m++)h.normals.push(i[c].normals[m].clone())}this.morphTargets.push(h)}const r=n.morphNormals;for(let c=0,d=r.length;c<d;c++){const h={};if(r[c].vertexNormals!==void 0){h.vertexNormals=[];for(let m=0,A=r[c].vertexNormals.length;m<A;m++){const b=r[c].vertexNormals[m],g={};g.a=b.a.clone(),g.b=b.b.clone(),g.c=b.c.clone(),h.vertexNormals.push(g)}}if(r[c].faceNormals!==void 0){h.faceNormals=[];for(let m=0,A=r[c].faceNormals.length;m<A;m++)h.faceNormals.push(r[c].faceNormals[m].clone())}this.morphNormals.push(h)}const o=n.skinWeights;for(let c=0,d=o.length;c<d;c++)this.skinWeights.push(o[c].clone());const a=n.skinIndices;for(let c=0,d=a.length;c<d;c++)this.skinIndices.push(a[c].clone());const u=n.lineDistances;for(let c=0,d=u.length;c<d;c++)this.lineDistances.push(u[c]);const f=n.boundingBox;f!==null&&(this.boundingBox=f.clone());const l=n.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.elementsNeedUpdate=n.elementsNeedUpdate,this.verticesNeedUpdate=n.verticesNeedUpdate,this.uvsNeedUpdate=n.uvsNeedUpdate,this.normalsNeedUpdate=n.normalsNeedUpdate,this.colorsNeedUpdate=n.colorsNeedUpdate,this.lineDistancesNeedUpdate=n.lineDistancesNeedUpdate,this.groupsNeedUpdate=n.groupsNeedUpdate,this},computeGroups(){const n=[];let e,t,s;const i=this.faces;for(t=0;t<i.length;t++){const r=i[t];r.materialIndex!==s&&(s=r.materialIndex,e!==void 0&&(e.count=t*3-e.start,n.push(e)),e={start:t*3,materialIndex:s})}return e!==void 0&&(e.count=t*3-e.start,n.push(e)),n},toBufferGeometry:function(){const n=new Pi().fromGeometry(this),e=new w.BufferGeometry,t=new Float32Array(n.vertices.length*3);if(e.setAttribute("position",new w.BufferAttribute(t,3).copyVector3sArray(n.vertices)),n.normals.length>0){const s=new Float32Array(n.normals.length*3);e.setAttribute("normal",new w.BufferAttribute(s,3).copyVector3sArray(n.normals))}if(n.colors.length>0){const s=new Float32Array(n.colors.length*3);e.setAttribute("color",new w.BufferAttribute(s,3).copyColorsArray(n.colors))}if(n.uvs.length>0){const s=new Float32Array(n.uvs.length*2);e.setAttribute("uv",new w.BufferAttribute(s,2).copyVector2sArray(n.uvs))}if(n.uvs2.length>0){const s=new Float32Array(n.uvs2.length*2);e.setAttribute("uv2",new w.BufferAttribute(s,2).copyVector2sArray(n.uvs2))}e.groups=n.groups;for(const s in n.morphTargets){const i=[],r=n.morphTargets[s];for(let o=0,a=r.length;o<a;o++){const u=r[o],f=new w.Float32BufferAttribute(u.data.length*3,3);f.name=u.name,i.push(f.copyVector3sArray(u.data))}e.morphAttributes[s]=i}if(n.skinIndices.length>0){const s=new w.Float32BufferAttribute(n.skinIndices.length*4,4);e.setAttribute("skinIndex",s.copyVector4sArray(n.skinIndices))}if(n.skinWeights.length>0){const s=new w.Float32BufferAttribute(n.skinWeights.length*4,4);e.setAttribute("skinWeight",s.copyVector4sArray(n.skinWeights))}return n.boundingSphere!==null&&(e.boundingSphere=n.boundingSphere.clone()),n.boundingBox!==null&&(e.boundingBox=n.boundingBox.clone()),e},toIndexedBufferGeometry:function(){const n=new w.BufferGeometry,e=new Float32Array(this.vertices.length*3);if(n.setAttribute("position",new w.BufferAttribute(e,3).copyVector3sArray(this.vertices)),this.normals.length>0){const t=new Float32Array(this.normals.length);let s=new w.BufferAttribute(t,3).copyArray(this.normals);n.setAttribute("normal",s)}if(this.uvs.length>0&&this.uvs[0].length>0){const t=new Float32Array(this.uvs[0].length*2);n.setAttribute("uv",new w.BufferAttribute(t,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){const t=new Float32Array(this.uvs[1].length*2);n.setAttribute("uv2",new w.BufferAttribute(t,2).copyArray(this.uvs[1]))}if(this.colors.length>0){const t=[];for(let i=0;i<this.colors.length;i++)t.push(new w.Color(this.colors[i]));const s=new Float32Array(t.length*3);n.setAttribute("color",new w.BufferAttribute(s,3).copyColorsArray(t))}else{const t=new Float32Array(this.vertices.length*3);for(let s=0;s<this.vertices.length*3;s++)t[s]=1;n.setAttribute("color",new w.BufferAttribute(t,3))}if(this.faces.length>0){let t=[],s=[];for(let i=0;i<this.faces.length;i++){s.push(this.faces[i].a,this.faces[i].b,this.faces[i].c);const r=this.faces[i].vertexColors;if(r.length===3)t.push(r[0],r[1],r[2]);else{const o=this.faces[i].color;t.push(o,o,o)}}n.setIndex(s),n.groups=this.computeGroups()}if(this.morphTargets.length>0){const t=[],s=[];for(let i=0,r=this.morphTargets.length;i<r;i++){const o=this.morphTargets[i],a=new w.Float32BufferAttribute(o.vertices.length*3,3);if(a.name=o.name,t.push(a.copyVector3sArray(o.vertices)),o.normals){const u=new w.Float32BufferAttribute(o.normals.length*3,3);u.name=o.name,s.push(u.copyVector3sArray(o.normals))}}n.morphAttributes.position=t,n.morphAttributes.normal=s}if(this.skinIndices.length>0){const t=new w.Float32BufferAttribute(this.skinIndices.length*4,4);n.setAttribute("skinIndex",t.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){const t=new w.Float32BufferAttribute(this.skinWeights.length*4,4);n.setAttribute("skinWeight",t.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.clone()),n},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(n){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(n)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Be.createBufferGeometryFromObject=function(n){let e=new w.BufferGeometry;const t=n.geometry;if(n.isPoints||n.isLine){const s=new w.Float32BufferAttribute(t.vertices.length*3,3),i=new w.Float32BufferAttribute(t.colors.length*3,3);if(e.setAttribute("position",s.copyVector3sArray(t.vertices)),e.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){const r=new w.Float32BufferAttribute(t.lineDistances.length,1);e.setAttribute("lineDistance",r.copyArray(t.lineDistances))}t.boundingSphere!==null&&(e.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(e.boundingBox=t.boundingBox.clone())}else n.isMesh&&(e=t.toBufferGeometry());return e};class Pi{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let s,i,r;const o=e.faces;for(i=0;i<o.length;i++){const a=o[i];a.materialIndex!==r&&(r=a.materialIndex,s!==void 0&&(s.count=i*3-s.start,t.push(s)),s={start:i*3,materialIndex:r})}s!==void 0&&(s.count=i*3-s.start,t.push(s)),this.groups=t}fromGeometry(e){const t=e.faces,s=e.vertices,i=e.faceVertexUvs,r=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,a=e.morphTargets,u=a.length;let f;if(u>0){f=[];for(let g=0;g<u;g++)f[g]={name:a[g].name,data:[]};this.morphTargets.position=f}const l=e.morphNormals,c=l.length;let d;if(c>0){d=[];for(let g=0;g<c;g++)d[g]={name:l[g].name,data:[]};this.morphTargets.normal=d}const h=e.skinIndices,m=e.skinWeights,A=h.length===s.length,b=m.length===s.length;s.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<t.length;g++){const M=t[g];this.vertices.push(s[M.a],s[M.b],s[M.c]);const _=M.vertexNormals;if(_.length===3)this.normals.push(_[0],_[1],_[2]);else{const U=M.normal;this.normals.push(U,U,U)}const N=M.vertexColors;if(N.length===3)this.colors.push(N[0],N[1],N[2]);else{const U=M.color;this.colors.push(U,U,U)}if(r===!0){const U=i[0][g];U!==void 0?this.uvs.push(U[0],U[1],U[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new w.Vector2,new w.Vector2,new w.Vector2))}if(o===!0){const U=i[1][g];U!==void 0?this.uvs2.push(U[0],U[1],U[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new w.Vector2,new w.Vector2,new w.Vector2))}for(let U=0;U<u;U++){const I=a[U].vertices;f[U].data.push(I[M.a],I[M.b],I[M.c])}for(let U=0;U<c;U++){const I=l[U].vertexNormals[g];d[U].data.push(I.a,I.b,I.c)}A&&this.skinIndices.push(h[M.a],h[M.b],h[M.c]),b&&this.skinWeights.push(m[M.a],m[M.b],m[M.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}class De{constructor(e,t,s,i,r,o=0){this.a=e,this.b=t,this.c=s,this.normal=i&&i.isVector3?i:new w.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new w.Color,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,s=e.vertexNormals.length;t<s;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,s=e.vertexColors.length;t<s;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}const Vi="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==",ki=Oe.default||Oe;function ye(n){let e=n,t=Se.modelPrefix;return t&&(t[t.length-1]!="/"&&(t=t+"/"),new RegExp("^(?:[a-z]+:)?//","i").test(n)||(e=t+n)),e}function Pe(n,e){const t=(s,i)=>{try{let r=new URL(s,i).href;if(s&&s.split("?").length<2){const o=i.split("?");o.length===2&&(r=r+"?"+o[1])}return r}catch{console.error(`There is an issue creating the url link with: ${s}.`)}};if(Array.isArray(n)){const s=[];return n.forEach(i=>{s.push(t(i,e))}),s}else return t(n,e)}function Ri(n,e,t,s,i){let r=n.morphTargetInfluences,o;n.geometry&&(o=n.geometry.morphAttributes);let a=!1;if(r&&o&&o.position){s.set(0,0,0),i.set(0,0,0);for(let u=0;u<r.length;u++)r[u]>0&&(a=!0,t.setFromArray(o.position[u].array),s.add(t.min.multiplyScalar(r[u])),i.add(t.max.multiplyScalar(r[u])));a&&e.set(s,i)}a||e.setFromBufferAttribute(n.geometry.attributes.position),n.updateWorldMatrix(!0,!0),e.applyMatrix4(n.matrixWorld)}function Tt(n,e,t,s){const i=new XMLHttpRequest;i.open("GET",ye(n),!0),i.onreadystatechange=()=>{i.readyState==4&&(i.status==200?t(i.responseText,e):s(n))},i.send(null)}function Ii(n,e,t){const s=n.length;let i=0;const r=[];function o(a,u){r[u]=a,i++,i==s&&e(r)}for(let a=0;a<s;a++)Tt(n[a],a,o,t)}const Di=(n,e)=>{const t=Math.floor(e/3),s=e%3;let i=0;s==0?i=n[t].r:s==1?i=n[t].g:s==2&&(i=n[t].b);const r=new S.Color(i);return[r.r,r.g,r.b]},Lt=function(n,e){if(e&&n&&n.morphAttributes&&n.morphAttributes.color){const t=n.morphAttributes.color,s=e.morphTargetInfluences,i=s.length;n.deleteAttribute("morphColor0"),n.deleteAttribute("morphColor1");let r=0,o=[];for(let a=0;1>r||a<i;a++)s[a]>0&&(r++,o.push([a,s[a]]));o.length==2?(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[1][0]])):o.length==1&&(n.setAttribute("morphColor0",t[o[0][0]]),n.setAttribute("morphColor1",t[o[0][0]]))}},Ze=(n,e)=>{let t;return n instanceof Be?(e.localTimeEnabled&&!n.morphNormalsReady&&(n.morphNormals==null||n.morphNormals.length==0)&&n.computeMorphNormals(),t=n.toIndexedBufferGeometry(),e.localMorphColour&&Fi(n,t)):n instanceof S.BufferGeometry&&(t=n.clone()),t.colorsNeedUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere(),n._video&&(t._video=n._video),t},Fi=(n,e)=>{if(n&&n.morphColors&&n.morphColors.length>0){let t=[],s=n.morphColors;for(let i=0,r=s.length;i<r;i++){const o=s[i],a=[];for(let f=0;f<o.colors.length*3;f++){let l=Di(o.colors,f);a.push(l[0],l[1],l[2])}const u=new S.Float32BufferAttribute(a,3);u.name=o.name,t.push(u)}e.morphAttributes.color=t}};function Bt(n){let e,t,s,i=-1,r=0;for(let f=0;f<n.length;++f){const l=n[f];if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(s===void 0&&(s=l.normalized),s!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=l.gpuType),i!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=l.count*t}const o=new e(r),a=new S.BufferAttribute(o,t,s);let u=0;for(let f=0;f<n.length;++f){const l=n[f];if(l.isInterleavedBufferAttribute){const c=u/t;for(let d=0,h=l.count;d<h;d++)for(let m=0;m<t;m++){const A=l.getComponent(d,m);a.setComponent(d+c,m,A)}}else o.set(l.array,u);u+=l.count*t}return i!==void 0&&(a.gpuType=i),a}const Gi=(n,e=!1)=>{const t=n[0].index!==null,s=new Set(Object.keys(n[0].attributes)),i=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,u=new S.BufferGeometry;let f=0;for(let l=0;l<n.length;++l){const c=n[l];let d=0;if(t!==(c.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const h in c.attributes){if(!s.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+'. All geometries must have compatible attributes; make sure "'+h+'" attribute exists among all geometries, or in none of them.'),null;r[h]===void 0&&(r[h]=[]),r[h].push(c.attributes[h]),d++}if(d!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const h in c.morphAttributes){if(!i.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". .morphAttributes must be consistent throughout all geometries."),null;o[h]===void 0&&(o[h]=[]),o[h].push(c.morphAttributes[h])}if(e){let h;if(t)h=c.index.count;else if(c.attributes.position!==void 0)h=c.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+l+". The geometry must have either an index or a position attribute"),null;u.addGroup(f,h,l),f+=h}}if(t){let l=0;const c=[];for(let d=0;d<n.length;++d){const h=n[d].index;for(let m=0;m<h.count;++m)c.push(h.getX(m)+l);l+=n[d].attributes.position.count}u.setIndex(c)}for(const l in r){const c=Bt(r[l]);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" attribute."),null;u.setAttribute(l,c)}for(const l in o){const c=o[l][0].length;if(c===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[l]=[];for(let d=0;d<c;++d){const h=[];for(let A=0;A<o[l].length;++A)h.push(o[l][A][d]);const m=Bt(h);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+l+" morphAttribute."),null;u.morphAttributes[l].push(m)}}return u};function nt(n,e){if(e&&n>=e.length){const t=new S.BufferGeometry,s=new Float32Array(n*3);let i=0;return e.forEach(r=>{s[i++]=r[0],s[i++]=r[1],s[i++]=r[2]}),t.setAttribute("position",new S.BufferAttribute(s,3)),t.setDrawRange(0,e.length),t}}function Ut(){const n=new Image;n.src=Vi;const e=new S.Texture;return e.image=n,e.needsUpdate=!0,e}function ot(n,e,t,s,i,r){const o=new ki(n,e,t,s,i,r);return o.fontFace=s,o.fontSize=i,o.fontWeight=r,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o}function Nt(n,e,t){if(t){const s=n||"",i=e||"",r=t.lastIndexOf("/");if(r>-1){let o,a;if(o=t.substring(0,r),a=t.substring(r+1),(o==="*"||o==="**"||o.toLowerCase()===s.toLowerCase())&&(a==="*"||a==="**"||a.toLowerCase()===i.toLowerCase()))return!0}else if(s.toLowerCase()===t.toLowerCase()||i.toLowerCase()===t.toLowerCase())return!0}return!1}function ji(n,e,t){const s=n.getAttribute("position"),i=n.getAttribute("normal");if(!s)return;const r=s.itemSize,o=e*r,a=r;let u=!1;const f=(l,c)=>{let d=!1;const h=Array.from(l.array);if(h.length>=o+a){h.splice(o,a),h.concat(new Array(a).fill(0)),d=!0;const m=new Float32Array(h);n.setAttribute(c,new S.BufferAttribute(m,r)),n.getAttribute(c).needsUpdate=!0}return d};return u=f(s,"position"),i&&f(i,"normal"),n.index!==null&&console.warn("Removing vertices from indexed geometry requires index buffer recalculation."),u}const Pt=function(){return function(n){n.vertexShader=n.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join(`
|
|
2
2
|
`)),n.vertexShader=n.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join(`
|
|
3
|
-
`))}},Vt=new w.Vector3,kt=new w.Vector3,Rt=new w.Matrix4,at=new w.Ray,Ye=new w.Sphere,lt=new w.Vector3,ct=new w.Vector3,It=new w.Vector3,Dt=new w.Vector3;class Ft extends w.Object3D{constructor(e=new w.BufferGeometry,t=new w.LineBasicMaterial){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[0];for(let i=1,r=t.count;i<r;i++)Vt.fromBufferAttribute(t,i-1),kt.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=Vt.distanceTo(kt);e.setAttribute("lineDistance",new w.Float32BufferAttribute(s,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=s.drawRange,a=s.morphAttributes.position;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ye.copy(s.boundingSphere),Ye.applyMatrix4(i),Ye.radius+=r,e.ray.intersectsSphere(Ye)===!1)return;Rt.copy(i).invert(),at.copy(e.ray).applyMatrix4(Rt);const u=r/((this.scale.x+this.scale.y+this.scale.z)/3),f=u*u,l=new w.Vector3,c=new w.Vector3,d=new w.Vector3,h=new w.Vector3,m=this.isLineSegments?2:1;if(s.isBufferGeometry){const A=s.index,g=s.attributes.position;if(A!==null){const M=Math.max(0,o.start),_=Math.min(A.count,o.start+o.count);for(let N=M,U=_-1;N<U;N+=m){const I=A.getX(N),D=A.getX(N+1);if(Gt(l,c,this,g,a,I,D),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(h);F<e.near||F>e.far||t.push({distance:F,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}else{const M=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let N=M,U=_-1;N<U;N+=m){if(Gt(l,c,this,g,a,N,N+1),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(h);D<e.near||D>e.far||t.push({distance:D,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}}else s.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Gt(n,e,t,s,i,r,o){n.fromBufferAttribute(s,r),e.fromBufferAttribute(s,o);var a=t.morphTargetInfluences;if(t.material.morphTargets&&i&&a){lt.set(0,0,0),ct.set(0,0,0);for(var u=0,f=i.length;u<f;u++){var l=a[u],c=i[u];l!==0&&(It.fromBufferAttribute(c,r),Dt.fromBufferAttribute(c,o),lt.addScaledVector(It.sub(n),l),ct.addScaledVector(Dt.sub(e),l))}n.add(lt),e.add(ct)}}Ft.prototype.isLine=!0;const jt=new w.Vector3,Et=new w.Vector3;class Xe extends Ft{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,r=t.count;i<r;i+=2)jt.fromBufferAttribute(t,i),Et.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+jt.distanceTo(Et);e.setAttribute("lineDistance",new w.Float32BufferAttribute(s,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Xe.prototype.isLineSegments=!0;const Gi=function(n){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=n,this.addLevel=(t,s)=>{if(t){const i=Math.abs(s);let r;for(r=0;r<this.levels.length&&!(i<this.levels[r].distance);r++);const o={distance:i,morph:t,loaded:!0,loading:!1,url:""};this.levels.splice(r,0,o),t.renderOrder=this._renderOrder}},this.levelLoaded=(t,s)=>{if(t){const i=Math.abs(s);for(let r=0;r<this.levels.length;r++)if(i===this.levels[r].distance){this._parent.group.add(t),this.levels[r].morph=t,this.levels[r].loaded=!0,this.levels[r].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(t,s,i,r,o)=>{this._loader=t;const a=this.calculateDistance(s),u={distance:a,morph:void 0,loaded:!1,loading:!1,url:i,index:r};let f;for(f=0;f<this.levels.length&&!(a<this.levels[f].distance);f++);this.levels.splice(f,0,u),o&&this.loadLevel(f)},this.loadLevel=t=>{const s=this.levels[t];return!s.morph&&!s.loaded&&!s.loading&&(s.loading=!0,this._loader.load(s.url,this.lodLoader(s.distance),void 0,void 0,{index:s.index})),s.morph===void 0},this.calculateDistance=function(t){this._parent.getBoundingBox();const s=this._parent.radius;let i=0;return t==="far"?i=s*4.5:t==="medium"?i=s*2.5:t==="close"&&(i=0),i},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{const t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=S.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new S.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=S.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=S.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&t.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{const t=this.levels[this._currentLevel];return t&&t.morph?t.morph:this._parent.morph},this.lodLoader=function(t){return s=>{const i=this._material,r={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=Ze(s,r);let a;this._parent.isGeometry?a=new S.Mesh(o,i):this._parent.isLines&&(a=new Xe(o,i)),a.userData=this._parent,a.renderOrder=this._renderOrder,s.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==S.VertexColors||this._material.vertexColors==!0))if(t){const s=this.getCurrentMorph();Lt(s.geometry,s)}else this.levels.forEach(s=>{s.morph&&s.morph.geometry&&Lt(s.morph.geometry,s.morph)})},this.setColour=t=>{this._material.color=t,this._secondaryMaterial&&(this._secondaryMaterial.color=t),e()},this.setFrustumCulled=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.frustumCulled=t),s.secondaryMesh&&(s.secondaryMesh.frustumCulled=t)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=S.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(s=>{s.morph&&(s.morph.material=this._material,s.morph.geometry&&(s.morph.geometry.colorsNeedUpdate=!0)),s.secondaryMesh&&(s.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.name=t),s.secondaryMesh&&(s.secondaryMesh.name=t)})},this.setRenderOrder=t=>{this._renderOrder=t,this.levels.forEach(s=>{s.morph&&(s.morph.renderOrder=t),s.secondaryMesh&&(s.secondaryMesh.renderOrder=t)})},this.setVertexColors=t=>{this._material.vertexColors=t,e(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=t)},this.update=(t,s)=>{const i=this.levels;if(i.length>1){const r=t.cameraObject.position.distanceTo(s);let o=-1,a=-1,u,f;for(u=0,f=i.length;u<f&&r>=i[u].distance;u++)i[u].morph?(o>-1&&i[o].morph&&(i[o].morph.visible=!1),o=u,i[u].morph.visible=!0,a=-1):a=u;for(a>-1&&this.loadLevel(a);u<f;u++)i[u].morph&&(o>-1?i[u].morph.visible=!1:(i[u].morph.visible=!0,o=u));this._currentLevel!=o&&(this._currentLevel=o,this.checkTransparentMesh())}},this.toggleMarker=(t,s)=>{this.levels.forEach(i=>{i.morph&&(s?i.morph.add(t):i.morph.remove(t))})};const e=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&(t.morph.geometry.colorsNeedUpdate=!0)})}},ji="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",zt=new Image(128,128);zt.src=ji;const Je=new S.Texture;Je.image=zt,Je.needsUpdate=!0;const ht=[.02,.03,1],Ei=new S.SpriteMaterial({map:Je,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),Wt=function(n){Object.getPrototypeOf(this)!==Y.prototype&&Object.setPrototypeOf(Wt.prototype,Y.prototype),Y.call(this),this.texture=Je;let e,t,s,i,r,o=!0;this.morph=new S.Group,this.group=this.morph,this.parent=n,this.isMarker=!0;let a=!1;this.ndc=new S.Vector3;let u,f,l=()=>{e=new S.Sprite(Ei),e.center.set(.5,0),this.morph.add(e),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,e.scale.set(ht[0],ht[1],ht[2]),e.userData=this};this.updateVisual=(c,d)=>{let h=1,m=0;c!==d&&(m=1-(this.ndc.z-c)/(d-c),h=.6+m*.4),this.setSpriteSize(h)},this.updateNDC=c=>(this.ndc.copy(this.morph.position),this.ndc.project(c),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(c,d,h)=>{this.morph.position.set(c,d,h)},this.setSpriteSize=c=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(c)},this.setUserSprite=()=>{i&&(this.morph.add(i),o&&(this.morph.remove(e),f&&this.morph.remove(f),o=!1))},this.setImageForUserSprite=(c,d)=>{i&&(this.morph.remove(i),i=void 0),t&&t.dispose(),s&&s.dispose(),t=new S.Texture,t.image=c,t.needsUpdate=!0,s=new S.SpriteMaterial({map:t,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),d||(d=[.05,.05,1]),i=new S.Sprite(s),i.center.set(.5,0),i.scale.set(d[0],d[1],d[2]),i.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{o||(o=!0,this.morph.add(e),i&&this.morph.remove(i),f&&this.morph.add(f))},this.loadUserSprite=(c,d)=>{if(c)if(c!==r){r=c;const h=new Image(128,128);h.crossOrigin="anonymous",h.onload=()=>{this.setImageForUserSprite(h,d)},h.src=c}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),e&&(e.clear(),e=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>a,this.setNumber=c=>{(!c||u!=c)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&c&&(f=ot(c,.012,"black","Asap",120,700),this.morph.add(f)),u=c},this.getNumber=()=>u||1,this.setVisibility=function(c){c!==this.visible&&(this.visible=c,this.group.visible=c,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{a=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{a=!1,this.morph.visible=!1,this.visible=!1},l()};let zi=0;const Wi=function(){return"pr"+zi++},Y=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new S.Group,this._lod=new Gi(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 S.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=Wi(),this._v1=new S.Vector3,this._v2=new S.Vector3,this._b1=new S.Box3,this.center=new S.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};Y.prototype.setDuration=function(n){this.duration=n,this.clipAction&&this.clipAction.setDuration(this.duration)},Y.prototype.getDuration=function(){return this.duration},Y.prototype.setRegion=function(n){this.region=n},Y.prototype.getRegion=function(){return this.region},Y.prototype.getMorph=function(){const n=this._lod.getCurrentMorph();return n||this.morph},Y.prototype.getGroup=function(){return this.group},Y.prototype.setMorph=function(n){this.morph=n,this.group.add(this.morph);const e=this._lod.calculateDistance("far");this._lod.addLevel(n,e),this._lod.setMaterial(n.material)},Y.prototype.checkTransparentMesh=function(){},Y.prototype.setMesh=function(n,e,t){this.animationGroup=new S.AnimationObjectGroup(n),this.mixer=new S.AnimationMixer(this.animationGroup);const s=n.geometry;if(this.geometry=n.geometry,this.clipAction=void 0,s&&s.morphAttributes){let i=s.morphAttributes.position;i||(i=s.morphAttributes.color?s.morphAttributes.color:s.morphAttributes.normal),i&&(this.animationClip=S.AnimationClip.CreateClipsFromMorphTargetSequences(i,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=S.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=e,this.morphColour=t,n.userData=this,n.matrixAutoUpdate=!1,this.setMorph(n),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(s.setAttribute("morphTarget0",s.getAttribute("position")),s.setAttribute("morphTarget1",s.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},Y.prototype.setIsPickable=function(n){this.isPickable!==n&&(this.isPickable=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAnatomicalId=function(n){this.anatomicalId=n},Y.prototype.setName=function(n){this.groupName=n,this._lod.setName(n)},Y.prototype.getCurrentTime=function(){if(this.clipAction){const n=this.clipAction.time/this.clipAction._clip.duration;return this.duration*n}else return this.inbuildTime},Y.prototype.setMorphTime=function(n){let e=!1;if(this.clipAction){const t=n/this.duration,s=this.clipAction._clip.duration;let i=t*s;i!=this.clipAction.time&&(this.clipAction.time=i,e=!0),e&&this.isTimeVarying()&&this.mixer.update(0)}else{let t=n;n>this.duration?t=this.duration:0>n?t=0:t=n,t!=this.inbuildTime&&(this.inbuildTime=t,e=!0)}e&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},Y.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},Y.prototype.getVisibility=function(){return this.visible},Y.prototype.setVisibility=function(n){n!==this.visible&&(this.visible=n,this.group.visible=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAlpha=function(n){const e=this._lod._material;let t=!1;n<1&&(t=!0),e.opacity=n,e.transparent=t,this.checkTransparentMesh()},Y.prototype.setFrustumCulled=function(n){this._lod.setFrustumCulled(n)},Y.prototype.setVertexColors=function(n){this._lod.setVertexColors(n)},Y.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},Y.prototype.setColour=function(n){this._lod.setColour(n)},Y.prototype.setGreyScale=function(n){if(n){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new S.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},Y.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},Y.prototype.setColourHex=function(n){this._lod._material.color.setHex(n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(n)},Y.prototype.setEmissiveRGB=function(n){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...n)},Y.prototype.setMaterial=function(n){this._lod.setMaterial(n)},Y.prototype.getClosestVertexIndex=function(){let n=-1;const e=this.getMorph();if(e&&e.geometry){let t=e.geometry.attributes.position;if(t){this._b1.setFromBufferAttribute(t),this._b1.getCenter(this._v1);let s=-1,i=0;for(let r=0;r<t.count;r++)this._v2.fromArray(t.array,r*3),i=this._v2.distanceTo(this._v1),s==-1?s=i:s>i&&(s=i,n=r)}}return n},Y.prototype.getClosestVertex=function(n){let e=new S.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());const t=this.getMorph();if(t&&t.geometry&&this.closestVertexIndex>=0){let s=t.morphTargetInfluences,i=t.geometry.morphAttributes;if(s&&i&&i.position){let r=!1;for(let o=0;o<s.length;o++)s[o]>0&&(r=!0,this._v1.fromArray(i.position[o].array,this.closestVertexIndex*3),e.add(this._v1.multiplyScalar(s[o])));if(r)return n?e.applyMatrix4(t.matrixWorld):e}else return e.fromArray(t.geometry.attributes.position.array,this.closestVertexIndex*3),n?e.applyMatrix4(t.matrixWorld):e}return this.getBoundingBox(),e.copy(this.center),e},Y.prototype.getBoundingBox=function(){if(this.visible){let n=this._lod.getCurrentMorph();if(n&&n.visible)return this.boundingBoxUpdateRequired&&(Vi(n,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}},Y.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},Y.prototype.markerIsRequired=function(n){return!!(this.visible&&(this.markerMode==="on"||n&&n.displayMarkers&&this.markerMode==="inherited"))},Y.prototype.updateMarker=function(n,e){if(n==!1&&this.markerIsRequired(e)){let t=e.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new Wt(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let s=this.getClosestVertex(!1);s&&(this.marker.setPosition(s.x,s.y,s.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(e.markersList&&!(this.marker.uuid in e.markersList)&&(t=!0,e.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(),e&&e.camera&&(t||e.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(e.camera.cameraObject),e.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),e.markersList&&this.marker.uuid in e.markersList&&(e.markerCluster.markerUpdateRequired=!0,delete e.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},Y.prototype.processMarkerVisual=function(n,e){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(n,e)},Y.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},Y.prototype.setRenderOrder=function(n){this._lod.setRenderOrder(n)},Y.prototype.getClosestVertexDOMElementCoords=function(n){if(n&&n.camera){let e=!0;const t=this.getClosestVertex(!0);return t.project(n.camera),t.z=Math.min(Math.max(t.z,0),1),(t.x>1||t.x<-1||t.y>1||t.y<-1)&&(e=!1),n.getZincCameraControls().getRelativeCoordsFromNDC(t.x,t.y,t),{position:t,inView:e}}else return},Y.prototype.setMarkerMode=function(n,e){n!==this.markerMode&&(n==="on"||n==="off"?this.markerMode=n:this.markerMode="inherited",this.region&&(this.region.pickableUpdateRequired=!0)),e&&(this.markerNumber=e.number,this.markerImgURL=e.imgURL)},Y.prototype.render=function(n,e,t,s){if(this.visible&&!(this.timeEnabled&&e)&&this._lod.update(t,this.center),e==!0){if(this.clipAction&&this.isTimeVarying())this.mixer.update(n);else{let i=this.inbuildTime+n;i>this.duration&&(i=i-this.duration),this.inbuildTime=i}this.visible&&n!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(e,s)},Y.prototype.addLOD=function(n,e,t,s,i){this._lod.addLevelFromURL(n,e,t,s,i)},Y.prototype.addVertices=function(n){let e=this.getMorph(),t;if(!e)t=nt(500,n),this.drawRange=n.length;else if(this.drawRange>-1){const s=e.geometry.getAttribute("position");n.forEach(i=>{s.setXYZ(this.drawRange,i[0],i[1],i[2]),++this.drawRange}),s.needsUpdate=!0,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),t=e.geoemtry,this.boundingBoxUpdateRequired=!0}return t},Y.prototype.deleteVertices=function(n){let e=this.getMorph();return e!=null&&e.geometry&&this.drawRange>=n&&Fi(e.geometry,n)?(--this.drawRange,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},Y.prototype.setPosition=function(n,e,t){const s=this.getGroup();s&&(s.position.set(n,e,t),s.matrixWorldNeedsUpdate=!0,s.updateMatrix(),s.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},Y.prototype.loadAdditionalSources=function(n,e){n.load(ye(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},Y.prototype.setScaleAll=function(n){const e=this.getGroup();e&&(e.scale.set(n,n,n),e.updateMatrix(),this.boundingBoxUpdateRequired=!0)};const qi=(n,e,t)=>{let s=Ze(n,t),i=!1;1>t.opacity&&(i=!0);let r;if(s._video===void 0){const o=t.localTimeEnabled||t.localMorphColour;e?(r=e,r.morphTargets=o,r.morphNormals=t.localTimeEnabled):s instanceof S.BufferGeometry&&s.attributes.color===void 0?r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,transparent:i,opacity:t.opacity,side:S.DoubleSide}):r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,vertexColors:S.VertexColors,transparent:i,opacity:t.opacity,side:S.DoubleSide}),t.localMorphColour&&s.morphAttributes.color&&(r.onBeforeCompile=Pt())}else{let o=s._video.createCanvasVideoTexture();r=new S.MeshBasicMaterial({morphTargets:t.localTimeEnabled,color:new S.Color(1,1,1),transparent:i,opacity:t.opacity,map:o,side:S.DoubleSide}),(void 0).videoHandler=s._video}return new S.Mesh(s,r)},Fe=function(){Y.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(n,e,t)=>{if(this.morph&&this.morph.geometry&&n!=null)return;const s=qi(n,e,t);this.setMesh(s,t.localTimeEnabled,t.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();const n=this.geometry.boundingBox.max,e=this.geometry.boundingBox.min,t=new S.Vector2(0-e.x,0-e.y),s=new S.Vector2(n.x-e.x,n.y-e.y);this.geometry.faceVertexUvs[0]=[];for(let i=0;i<this.geometry.faces.length;i++){const r=this.geometry.vertices[this.geometry.faces[i].a],o=this.geometry.vertices[this.geometry.faces[i].b],a=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new S.Vector2((r.x+t.x)/s.x,(r.y+t.y)/s.y),new S.Vector2((o.x+t.x)/s.x,(o.y+t.y)/s.y),new S.Vector2((a.x+t.x)/s.x,(a.y+t.y)/s.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=n=>{this.morph.material.wireframe=n},this.editVertices=function(n,e){if(n&&n.length){let t=this.getMorph();const s=t.geometry.getAttribute("position");if(!t||0>e)return;{let i=e*3;n.forEach(r=>{s.array[i++]=r[0],s.array[i++]=r[1],s.array[i++]=r[2]}),s.needsUpdate=!0,t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}}};Fe.prototype=Object.create(Y.prototype);const ut=function(n,e){let t=n,s,i=500;e?s=new Le(t,.012,e.getStyle()):s=new Le(t,.012),s.fontFace="Asap",s.fontWeight=i,s.material.map.generateMipmaps=!1,s.material.sizeAttenuation=!1,s.center.x=-.05,s.center.y=0;const r=[s.scale.x,s.scale.y];this.getPosition=()=>s?[s.position.x,s.position.y,s.position.z]:[0,0,0],this.setPosition=(o,a,u)=>{s&&s.position.set(o,a,u)},this.setColour=o=>{o&&(s.color=o.getStyle())},this.setScale=o=>{s&&o>0&&s.scale.set(o,o,1)},this.setDepthTest=o=>{o&&o!==s.material.depthTest&&(s.material.depthTest=o)},this.setSize=o=>{o>0&&(s.scale.x=r[0]*o,s.scale.y=r[1]*o)},this.setFontWeight=o=>{o&&o!==i&&(s.fontWeight=o,i=o)},this.setText=o=>{o&&o!==s.text&&(s.text=o,t=o)},this.setVisibility=o=>{s.visible=o},this.dispose=()=>{},this.getSprite=()=>s,this.getString=()=>t},Ke=function(n,e,t,s){Y.call(this);let i;e&&(i=e.clone(),i.vertexColors=S.FaceColors);const r=s;this.id=t;let o,a;this.isGlyph=!0;let u=[0,0,0];this.fromMesh=f=>f&&f.isMesh?(this.morph=f.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,n&&i&&this.fromMesh(new S.Mesh(n,i)),this.getGlyphset=function(){return r},this.setLabel=f=>{f&&(typeof f=="string"||f instanceof String)&&(a=f,this.morph&&(this.morph.name=f))},this.showLabel=f=>{if(o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),a&&(typeof a=="string"||a instanceof String)){o=new ut(a,f),o.setPosition(u[0],u[1],u[2]);const l=o.getSprite();l.material.alphaTest=.5,l.material.transparent=!0,l.material.depthWrite=!1,this.group.add(o.getSprite())}},this.hideLabel=()=>{o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0)},this.getLabel=()=>a,this.getMesh=()=>this.morph,this.setTransformation=(f,l,c,d)=>{this.morph&&(this.morph.matrix.elements[0]=l[0],this.morph.matrix.elements[1]=l[1],this.morph.matrix.elements[2]=l[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=c[0],this.morph.matrix.elements[5]=c[1],this.morph.matrix.elements[6]=c[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=d[0],this.morph.matrix.elements[9]=d[1],this.morph.matrix.elements[10]=d[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=f[0],this.morph.matrix.elements[13]=f[1],this.morph.matrix.elements[14]=f[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),u=[...f],o&&o.setPosition(f[0],f[1],f[2])},this.setColour=f=>{o&&o.setColour(f),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}};Ke.prototype=Object.create(Y.prototype);function Qe(){}Qe.Handlers={handlers:[],add:function(n,e){this.handlers.push(n,e)},get:function(n){for(var e=this.handlers,t=0,s=e.length;t<s;t+=2){var i=e[t],r=e[t+1];if(i.test(n))return r}return null}},Object.assign(Qe.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(n,e,t){for(var s=[],i=0;i<n.length;++i)s[i]=this.createMaterial(n[i],e,t);return s},createMaterial:function(){var n={NoBlending:w.NoBlending,NormalBlending:w.NormalBlending,AdditiveBlending:w.AdditiveBlending,SubtractiveBlending:w.SubtractiveBlending,MultiplyBlending:w.MultiplyBlending,CustomBlending:w.CustomBlending},e=new w.Color,t=new w.TextureLoader,s=new w.MaterialLoader;return function(r,o,a){var u={};function f(h,m,A,b,g){var M=o+h,_=Qe.Handlers.get(M),N;_!==null?N=_.load(M):(t.setCrossOrigin(a),N=t.load(M)),m!==void 0&&(N.repeat.fromArray(m),m[0]!==1&&(N.wrapS=w.RepeatWrapping),m[1]!==1&&(N.wrapT=w.RepeatWrapping)),A!==void 0&&N.offset.fromArray(A),b!==void 0&&(b[0]==="repeat"&&(N.wrapS=w.RepeatWrapping),b[0]==="mirror"&&(N.wrapS=w.MirroredRepeatWrapping),b[1]==="repeat"&&(N.wrapT=w.RepeatWrapping),b[1]==="mirror"&&(N.wrapT=w.MirroredRepeatWrapping)),g!==void 0&&(N.anisotropy=g);var U=w.MathUtils.generateUUID();return u[U]=N,U}var l={uuid:w.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var c in r){var d=r[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":l.name=d;break;case"blending":l.blending=n[d];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":l.color=e.fromArray(d).getHex();break;case"colorSpecular":l.specular=e.fromArray(d).getHex();break;case"colorEmissive":l.emissive=e.fromArray(d).getHex();break;case"specularCoef":l.shininess=d;break;case"shading":d.toLowerCase()==="basic"&&(l.type="MeshBasicMaterial"),d.toLowerCase()==="phong"&&(l.type="MeshPhongMaterial"),d.toLowerCase()==="standard"&&(l.type="MeshStandardMaterial");break;case"mapDiffuse":l.map=f(d,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":l.emissiveMap=f(d,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":l.lightMap=f(d,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":l.aoMap=f(d,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":l.bumpMap=f(d,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":l.bumpScale=d;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":l.normalMap=f(d,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":l.normalScale=d;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":l.specularMap=f(d,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":l.metalnessMap=f(d,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":l.roughnessMap=f(d,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":l.alphaMap=f(d,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":l.side=w.BackSide;break;case"doubleSided":l.side=w.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),l.opacity=d;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":l[c]=d;break;case"vertexColors":d===!0&&(l.vertexColors=w.VertexColors),d==="face"&&(l.vertexColors=w.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,d);break}}return l.type==="MeshBasicMaterial"&&delete l.emissive,l.type!=="MeshPhongMaterial"&&delete l.specular,l.opacity<1&&(l.transparent=!0),s.setTextures(u),s.parse(l)}}()});const Zi=function(n){var e=this;this.video=void 0,this.videoTexture=void 0;var t=n,s=function(){document&&(e.video=document.createElement("video"),e.video.crossOrigin="anonymous",e.video.src=t,e.video.load(),e.video.loop=!0)};this.setMorphTime=function(i,r){var o=i/r*e.video.duration;e.video.currentTime=o},this.getVideoDuration=function(){return e.video.duration},this.createCanvasVideoTexture=function(){return e.videoTexture=new S.VideoTexture(e.video),e.videoTexture.minFilter=S.LinearFilter,e.videoTexture.magFilter=S.LinearFilter,e.videoTexture.format=S.RGBFormat,e.video.currentTime=0,e.videoTexture},this.getCurrentTime=function(i){return e.video?i*(e.video.currentTime/e.video.duration):0},this.isReadyToPlay=function(){return!!(e.video&&e.video.readyState>=3)},s()},qt=S.AnimationClip,dt=S.Color,Yi=S.DefaultLoadingManager,Xi=S.FileLoader,Ji=S.LoaderUtils,Zt=S.Vector2,Ge=S.Vector3,Yt=S.Vector4;function $e(n){typeof n=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),n=void 0),this.manager=n!==void 0?n:Yi,this.withCredentials=!1,this.paramsString=""}Object.assign($e.prototype,{load:function(n,e,t,s){var i=this,r=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:Ji.extractUrlBase(n),o=new Xi(this.manager);n.split("?"),n.length===2?this.paramsString=paramsStrings[1]:this.paramsString="",o.setWithCredentials(this.withCredentials),o.load(n,function(a){var u=void 0;try{u=JSON.parse(a)}catch{if(console.error("The loader has encountered an error while parsing the content of a resource."),s){s({responseURL:n});return}}var f=u.metadata;if(f!==void 0){var l=f.type;if(l!==void 0&&l.toLowerCase()==="object"){console.error("THREE.JSONLoader: "+n+" should be loaded with THREE.ObjectLoader instead.");return}}if(i&&i.parse)try{var c=i.parse(u,r);e(c.geometry,c.materials)}catch(d){if(console.error("The loader has encountered aon loading the geometry"),console.error(d),s){s({responseURL:n});return}}},t,s)},setTexturePath:function(n){this.texturePath=n},parse:function(){function n(i,r){function o(q,E){return q&1<<E}var a,u,f,l,c,d,h,m,A,b,g,M,_,N,U,I,D,Z,F,z,T,L,x,O,P,V,p,B=i.faces,y=i.vertices,C=i.normals,k=i.colors,R=i.scale,G=0;if(i.uvs!==void 0){for(a=0;a<i.uvs.length;a++)i.uvs[a].length&&G++;for(a=0;a<G;a++)r.faceVertexUvs[a]=[]}for(l=0,c=y.length;l<c;)Z=new Ge,Z.x=y[l++]*R,Z.y=y[l++]*R,Z.z=y[l++]*R,r.vertices.push(Z);if(l=0,c=B.length,i.uvs)for(a=0;a<i.uvs.length;a++){r.uvs[a]=[];for(let q=0;q<i.uvs[a].length;q++)r.uvs[a][q]=i.uvs[a][q]}if(C)for(a=0;a<C.length;a++)r.normals[a]=C[a];if(k)for(a=0;a<k.length;a++)r.colors[a]=k[a];for(;l<c;)if(b=B[l++],g=o(b,0),M=o(b,1),_=o(b,3),N=o(b,4),U=o(b,5),I=o(b,6),D=o(b,7),g){if(z=new De,z.a=B[l],z.b=B[l+1],z.c=B[l+3],T=new De,T.a=B[l+1],T.b=B[l+2],T.c=B[l+3],l+=4,M&&(A=B[l++],z.materialIndex=A,T.materialIndex=A),f=r.faces.length,_)for(a=0;a<G;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],r.faceVertexUvs[a][f+1]=[],u=0;u<4;u++)m=B[l++],V=O[m*2],p=O[m*2+1],P=new Zt(V,p),u!==2&&r.faceVertexUvs[a][f].push(P),u!==0&&r.faceVertexUvs[a][f+1].push(P);if(N&&(h=B[l++]*3,z.normal.set(C[h++],C[h++],C[h]),T.normal.copy(z.normal)),U)for(a=0;a<4;a++)h=B[l++]*3,x=new Ge(C[h++],C[h++],C[h]),a!==2&&z.vertexNormals.push(x),a!==0&&T.vertexNormals.push(x);if(I&&(d=B[l++],L=k[d],z.color.setHex(L),T.color.setHex(L)),D)for(a=0;a<4;a++)d=B[l++],L=k[d],a!==2&&z.vertexColors.push(new dt(L)),a!==0&&T.vertexColors.push(new dt(L));r.faces.push(z),r.faces.push(T)}else{if(F=new De,F.a=B[l++],F.b=B[l++],F.c=B[l++],F.b||(F.b=F.a),F.c||(F.c=F.b),M&&(A=B[l++],F.materialIndex=A),f=r.faces.length,_)for(a=0;a<G;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],u=0;u<3;u++)m=B[l++],V=O[m*2],p=O[m*2+1],P=new Zt(V,p),r.faceVertexUvs[a][f].push(P);if(N&&(h=B[l++]*3,F.normal.set(C[h++],C[h++],C[h])),U)for(a=0;a<3;a++)h=B[l++]*3,x=new Ge(C[h++],C[h++],C[h]),F.vertexNormals.push(x);if(I&&(d=B[l++],F.color.setHex(k[d])),D)for(a=0;a<3;a++)d=B[l++],F.vertexColors.push(new dt(k[d]));r.faces.push(F)}}function e(i,r){var o=i.influencesPerVertex!==void 0?i.influencesPerVertex:2;if(i.skinWeights)for(var a=0,u=i.skinWeights.length;a<u;a+=o){var f=i.skinWeights[a],l=o>1?i.skinWeights[a+1]:0,c=o>2?i.skinWeights[a+2]:0,d=o>3?i.skinWeights[a+3]:0;r.skinWeights.push(new Yt(f,l,c,d))}if(i.skinIndices)for(var a=0,u=i.skinIndices.length;a<u;a+=o){var h=i.skinIndices[a],m=o>1?i.skinIndices[a+1]:0,A=o>2?i.skinIndices[a+2]:0,b=o>3?i.skinIndices[a+3]:0;r.skinIndices.push(new Yt(h,m,A,b))}r.bones=i.bones,r.bones&&r.bones.length>0&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}function t(i,r){var o=i.scale;if(i.morphTargets!==void 0)for(var a=0,u=i.morphTargets.length;a<u;a++){r.morphTargets[a]={},r.morphTargets[a].name=i.morphTargets[a].name,r.morphTargets[a].vertices=[];for(var f=r.morphTargets[a].vertices,l=i.morphTargets[a].vertices,c=0,d=l.length;c<d;c+=3){var h=new Ge;h.x=l[c]*o,h.y=l[c+1]*o,h.z=l[c+2]*o,f.push(h)}}if(i.morphNormals!==void 0){for(var a=0,u=i.morphNormals.length;a<u;a++)if(r.morphTargets[a]){r.morphTargets[a].normals=[];for(var m=r.morphTargets[a].normals,A=i.morphNormals[a].normals,c=0,d=A.length;c<d;c+=3){var b=new Ge;b.x=A[c],b.y=A[c+1],b.z=A[c+2],m.push(b)}r.morphNormalsReady=!0}}if(i.morphColors!==void 0){var a,u,g,M,_,N,U;for(a=0,u=i.morphColors.length;a<u;a++)for(r.morphColors[a]={},r.morphColors[a].name=i.morphColors[a].name,r.morphColors[a].colors=[],_=r.morphColors[a].colors,N=i.morphColors[a].colors,g=0,M=N.length;g<M;g+=3)U=new S.Color(16755200),U.setRGB(N[g],N[g+1],N[g+2]),_.push(U)}}function s(i,r){var o=[],a=[];i.animation!==void 0&&a.push(i.animation),i.animations!==void 0&&(i.animations.length?a=a.concat(i.animations):a.push(i.animations));for(var u=0;u<a.length;u++){var f=qt.parseAnimation(a[u],r.bones);f&&o.push(f)}if(r.morphTargets){var l=qt.CreateClipsFromMorphTargetSequences(r.morphTargets,10);o=o.concat(l)}o.length>0&&(r.animations=o)}return function(r,o){r.data!==void 0&&(r=r.data),r.scale!==void 0?r.scale=1/r.scale:r.scale=1;var a=new Be;if(a.morphColors=[],n(r,a),e(r,a),t(r,a),s(r,a),a.computeFaceNormals(),a.computeBoundingSphere(),r.materials===void 0||r.materials.length===0)return{geometry:a};var u=Qe.prototype.initMaterials(r.materials,o,"Anonymous");if(r.materials[0].video){var f=o+r.materials[0].video;this.paramsString&&(f=f+`?${this.paramsString}`);const l=new Zi(f);a._video=l}return u&&u.length>0&&(r.materials[0].singleSided?u[0].side=S.FrontSide:r.materials[0].flipSided?u[0].side=S.BackSide:u[0].side=S.DoubleSide,r.materials[0].specularCoef&&(u[0].shininess=Math.floor(r.materials[0].specularCoef/3))),{geometry:a,materials:u}}}()});const ft=function(){Y.call(this);const n=[];let e,t,s,i,r,o,a,u=0,f=0,l=[0,0,0],c=[0,0,0],d=[0,0,0],h="NONE";this.ready=!1;let m=!1,A=!1;this.isGlyphset=!0;let b=new S.Matrix4;const g=new S.Color,M=new S.Color,_=new S.Box3,N=new S.Box3,U=new S.Box3,I=[],D=[],Z=[],F=[],z=[],T=[],L=[];this.globalScale=1;for(let y=0;y<8;y++)new S.Vector3;this.load=(y,C,k,R,G)=>{e=y.axis1,t=y.axis2,s=y.axis3,i=y.positions,r=y.scale,o=y.colors,a=y.label,m=y.metadata.MorphColours,A=y.metadata.MorphVertices,u=y.metadata.number_of_time_steps,h=y.metadata.repeat_mode,f=y.metadata.number_of_vertices,h=="AXES_2D"||h=="MIRROR"?f=f*2:h=="AXES_3D"&&(f=f*3),l=y.metadata.base_size,c=y.metadata.offset,d=y.metadata.scale_factors;const q=new $e;this.geometry=new S.BufferGeometry;const E=new S.InstancedMesh(this.geometry,void 0,f);if(this.setMorph(E),R){var K=q.parse(C);B(k,G)(K.geometry,K.materials),K.geometry.dispose()}else q.crossOrigin="Anonymous",q.load(C,B(k,G))};const x=(y,C,k,R,G,q)=>{if(h=="NONE"||h=="MIRROR"){let Q=[0,0,0],ee=[0,0,0],re=[0,0,0],H=[0,0,0],ue=[0,0,0];const ne=[0,0,0],te=[0,0,0],X=[0,0,0],ie=[0,0,0];for(var E=0;E<3;E++){var K=G[E]<0?-1:1;Q[E]=(K*l[E]+G[E]*d[E])*this.globalScale}for(var E=0;E<3;E++)ee[E]=C[E]*Q[0],re[E]=k[E]*Q[1],H[E]=R[E]*Q[2],ue[E]=y[E]+c[0]*ee[E]+c[1]*re[E]+c[2]*H[E],h=="MIRROR"&&(ne[E]=-ee[E],te[E]=-re[E],X[E]=-H[E],ie[E]=ue[E],G[0]<0&&(ue[E]-=ee[E],ie[E]-=ne[E]));0>H[0]*(ee[1]*re[2]-ee[2]*re[1])+H[1]*(ee[2]*re[0]-ee[0]*re[2])+H[2]*(ee[0]*re[1]-ee[1]*re[0])&&(H[0]=-H[0],H[1]=-H[1],H[2]=-H[2]),q[0]=[ue,ee,re,H],h=="MIRROR"&&(0>X[0]*(ne[1]*te[2]-ne[2]*te[1])+X[1]*(ne[2]*te[0]-ne[0]*te[2])+X[2]*(ne[0]*te[1]-ne[1]*te[0])&&(X[0]=-X[0],X[1]=-X[1],X[2]=-X[2]),q[1]=[ie,ne,te,X])}else if(h=="AXES_2D"||h=="AXES_3D"){let Q=[0,0,0],ee=[0,0,0];for(var E=0;E<3;E++){var K=G[E]<0?-1:1;Q[E]=(K*l[0]+G[E]*d[0])*this.globalScale}for(var E=0;E<3;E++)ee[E]=y[E]+c[0]*Q[0]*C[E]+c[1]*Q[1]*k[E]+c[2]*Q[2]*R[E];const re=glyph_repeat_mode=="AXES_2D"?2:3;for(let H=0;H<re;H++){let ue,ne;const te=G[H];let X=[0,0,0],ie=[0,0,0],ae=[0,0,0];H==0?(ue=C,ne=k):H==1?(ue=k,ne=glyph_repeat_mode=="AXES_2D"?C:R):(ue=R,ne=C);const Te=(l[0]+te*d[0])*this.globalScale;X[0]=ue[0]*Te,X[1]=ue[1]*Te,X[2]=ue[2]*Te,ae[0]=X[1]*ne[2]-ne[1]*X[2],ae[1]=X[2]*ne[0]-ne[2]*X[0],ae[2]=X[0]*ne[1]-X[1]*ne[0];let oe=Math.sqrt(ae[0]*ae[0]+ae[1]*ae[1]+ae[2]*ae[2]);if(0<oe){let Ne=(l[2]+te*d[2])*this.globalScale/oe;h=="AXES_2D"&&H>0&&(Ne*=-1),ae[0]*=Ne,ae[1]*=Ne,ae[2]*=Ne}if(ie[0]=ae[1]*X[2]-X[1]*ae[2],ie[1]=ae[2]*X[0]-X[2]*ae[0],ie[2]=ae[0]*X[1]-ae[1]*X[0],oe=Math.sqrt(ie[0]*ie[0]+ie[1]*ie[1]+ie[2]*ie[2]),0<oe){var $=(l[1]+te*d[1])*this.globalScale/oe;ie[0]*=$,ie[1]*=$,ie[2]*=$}q[H]=[ee,X,ie,ae]}}return q},O=(y,C,k,R,G)=>{let q=1;h=="AXES_2D"||h=="MIRROR"?q=2:h=="AXES_3D"&&(q=3);const E=y.length/3;let K=0;L.length=q;for(let $=0;$<E;$++){const Q=$*3,ee=[y[Q],y[Q+1],y[Q+2]],re=[C[Q],C[Q+1],C[Q+2]],H=[k[Q],k[Q+1],k[Q+2]],ue=[R[Q],R[Q+1],R[Q+2]],ne=[G[Q],G[Q+1],G[Q+2]],te=x(ee,re,H,ue,ne,L);if(te.length==q)for(let X=0;X<q;X++){b.elements[0]=te[X][1][0],b.elements[1]=te[X][1][1],b.elements[2]=te[X][1][2],b.elements[3]=0,b.elements[4]=te[X][2][0],b.elements[5]=te[X][2][1],b.elements[6]=te[X][2][2],b.elements[7]=0,b.elements[8]=te[X][3][0],b.elements[9]=te[X][3][1],b.elements[10]=te[X][3][2],b.elements[11]=0,b.elements[12]=te[X][0][0],b.elements[13]=te[X][0][1],b.elements[14]=te[X][0][2],b.elements[15]=1,this.morph.setMatrixAt(K,b);const ie=n[K];ie&&ie.setTransformation(te[X][0],te[X][1],te[X][2],te[X][3]),K++}}this.morph.instanceMatrix.needsUpdate=!0},P=y=>{let C=1;h=="AXES_2D"||h=="MIRROR"?C=2:h=="AXES_3D"&&(C=3);const k=y.length;let R=0;for(let G=0;G<k;G++){const q=y[G];for(let E=0;E<C;E++){g.setHex(q),this.morph.setColorAt(R,g);const K=n[R];K&&K.setColour(g),R++}}this.morph.instanceColor.needsUpdate=!0},V=()=>{let y=I,C=D,k=Z,R=F,G=z,q=T;const E=this.inbuildTime/this.duration*(u-1),K=Math.floor(E),$=1-(E-K),Q=Math.ceil(E);if(A){const ee=i[K.toString()],re=i[Q.toString()],H=e[K.toString()],ue=e[Q.toString()],ne=t[K.toString()],te=t[Q.toString()],X=s[K.toString()],ie=s[Q.toString()],ae=r[K.toString()],Te=r[Q.toString()];I.length=ee.length,D.length=ee.length,Z.length=ee.length,F.length=ee.length,z.length=ee.length;for(let oe=0;oe<ee.length;oe++)y[oe]=$*ee[oe]+(1-$)*re[oe],C[oe]=$*H[oe]+(1-$)*ue[oe],k[oe]=$*ne[oe]+(1-$)*te[oe],R[oe]=$*X[oe]+(1-$)*ie[oe],G[oe]=$*ae[oe]+(1-$)*Te[oe]}else y=i[0],C=e[0],k=t[0],R=s[0],G=r[0];if(O(y,C,k,R,G),this.boundingBoxUpdateRequired=!0,o!=null){if(m){const ee=o[K.toString()],re=o[Q.toString()];q.length=ee.length;for(let H=0;H<ee.length;H++)g.setHex(ee[H]),M.setHex(re[H]),g.setRGB(g.r*$+M.r*(1-$),g.g*$+M.g*(1-$),g.b*$+M.b*(1-$)),q[H]=g.getHex()}else q=o[0];P(q)}};this.getLabel=y=>{if(a&&a.length>y)return a[y]},this.showLabel=()=>{for(let y=0;y<n.length;y++)n[y].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(let y=0;y<n.length;y++)n[y].hideLabel()};const p=y=>{for(let C=0;C<f;C++){const k=new Ke(void 0,void 0,C,this);let R=a?a[C]:void 0;R=R||this.groupName,R&&k.setLabel(R),u>0&&k.setFrustumCulled(!1),n[C]=k,this.morph.add(k.getGroup())}y&&this.showLabel(),O(i[0],e[0],t[0],s[0],r[0]),o!=null&&P(o[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=y=>{y.isGlyph&&n.push(y),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(y,C)=>{if(y.isMesh){const k=new Ke(void 0,void 0,C,this);return k.fromMesh(y),n.push(k),this.morph.add(k.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,k}},this.forEachGlyph=y=>{for(let C=0;C<n.length;C++)y(n[C])};var B=(y,C)=>(k,R)=>{const G=k.toBufferGeometry();this.geometry.copy(G),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),G.dispose(),R&&R[0]&&(this.morph.material=R[0]),p(C),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),k.dispose(),y!=null&&typeof y=="function"&&y(this)};this.getClosestVertexIndex=function(){let y=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let C=i[0];const k=C.length/3;let R=-1,G=0;for(let q=0;q<k;q++){const E=q*3;this._v2.set(C[E],C[E+1],C[E+2]),G=this._v1.distanceTo(this._v2),(R==-1||R>G)&&(R=G,y=q)}}return y},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let y=new S.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,b),y.setFromMatrixPosition(b),y}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let y=0;y<f;y++)this.morph.getMatrixAt(y,b),N.copy(_).applyMatrix4(b),y==0?U.copy(N):U.union(N);if(U)this.cachedBoundingBox.copy(U),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=y=>{y>this.duration?this.inbuildTime=this.duration:0>y?this.inbuildTime=0:this.inbuildTime=y,(m||A)&&(V(),A&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||u>0)&&(m||A)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(y){this.globalScale=y,V()},this.dispose=()=>{for(let y=n.length-1;y>=0;y--)n[y].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),e=void 0,t=void 0,s=void 0,i=void 0,r=void 0,o=void 0,this.ready=!1,this.groupName=void 0},this.render=(y,C,k)=>{if(C==!0){let R=this.inbuildTime+y;R>this.duration&&(R=R-this.duration),this.inbuildTime=R,(m||A)&&V()}this.updateMarker(C,k)}};ft.prototype=Object.create(Y.prototype);const Xt=new w.Matrix4,pt=new w.Ray,He=new w.Sphere,je=new w.Vector3,mt=new w.Vector3,Jt=new w.Vector3;class gt extends w.Object3D{constructor(e=new w.BufferGeometry,t=new w.PointsMaterial){super(),this.type="Points",this.geometry=e,this.material=t,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),He.copy(s.boundingSphere),He.applyMatrix4(i),He.radius+=r,e.ray.intersectsSphere(He)===!1)return;Xt.copy(i).invert(),pt.copy(e.ray).applyMatrix4(Xt);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,u=a*a;if(s.isBufferGeometry){const f=s.index,c=s.attributes.position,d=s.morphAttributes.position;if(f!==null){const h=Math.max(0,o.start),m=Math.min(f.count,o.start+o.count);for(let A=h,b=m;A<b;A++){const g=f.getX(A);Qt(this,c,d,g),Kt(je,g,u,i,e,t,this)}}else{const h=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let A=h,b=m;A<b;A++)Qt(this,c,d,A),Kt(je,A,u,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}gt.prototype.isPoints=!0;function Kt(n,e,t,s,i,r,o){const a=pt.distanceSqToPoint(n);if(a<t){const u=new w.Vector3;pt.closestPointToPoint(n,u),u.applyMatrix4(s);const f=i.ray.origin.distanceTo(u);if(f<i.near||f>i.far)return;r.push({distance:f,distanceToRay:Math.sqrt(a),point:u,index:e,face:null,object:o})}}function Qt(n,e,t,s){je.fromBufferAttribute(e,s);const i=n.morphTargetInfluences;if(n.material.morphTargets&&t&&i){mt.set(0,0,0);for(var r=0,o=t.length;r<o;r++){const a=i[r],u=t[r];a!==0&&(Jt.fromBufferAttribute(u,s),mt.addScaledVector(Jt.sub(je),a))}je.add(mt)}}const Oe=function(){Y.call(this),this.isPointset=!0;const n=[];let e=1,t=!1,s=500,i=!0;this.createMesh=(a,u,f)=>{if(a&&u){let l=Ze(a,f);const c=Ut();u.map=c;let d=new gt(l,u);this.setMesh(d,f.localTimeEnabled,f.localMorphColour)}};const r=(a,u,f,l)=>{if(f){const c=new S.Color(l),d=new ut(f,c);d.setPosition(u[0],u[1],u[2]);const h=d.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=t,d.setFontWeight(s),d.setSize(e),d.setVisibility(i),this.group.add(h),n[a]=d}},o=a=>{const u=n[a];if(u){const f=u.getSprite();this.group.remove(f),u.dispose(),n.splice(a,1)}};this.addPoints=(a,u,f)=>{if(a&&a.length>0){let l=this.drawRange;l===-1&&(l=0);const c=this.addVertices(a);if(!this.getMorph()){let A=new S.PointsMaterial({alphaTest:.5,size:10,color:f,sizeAttenuation:!1});const b={localTimeEnabled:!1,localMorphColour:!1};c.colorsNeedUpdate=!0,this.createMesh(c,A,b)}let h=l+a.length,m=0;if(Array.isArray(u)&&u.length===a.length||typeof u=="string")for(n.length,l;l+m<h;){const A=typeof u=="string"?u:u[m];r(l+m,a[m],A,this._lod._material.color),m++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(a){this._lod._material.color.setHex(a),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setColour=a=>{this._lod.setColour(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setLabelDepthTest=a=>{t=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setDepthTest(a)},this.setLabelFontWeight=a=>{s=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setFontWeight(a)},this.setLabelSize=a=>{e=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setSize(e)},this.displayLabels=a=>{i=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setVisibility(i)},this.setSize=a=>{this.morph&&this.morph.material&&(this.morph.material.size=a,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=a=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=a,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(a){if(a>=0&&this.drawRange>a){const u=this.getMorph().geometry.getAttribute("position");return[u.getX(a),u.getY(a),u.getZ(a)]}},this.editVertices=function(a,u){if(a&&a.length){let f=this.getMorph();const l=u+a.length-1;if(!f||0>u||l>=this.drawRange)return;{const c=f.geometry.getAttribute("position");let d=u;a.forEach(h=>{const m=n[d];m&&m.setPosition(h[0],h[1],h[2]),c.setXYZ(d++,h[0],h[1],h[2])}),c.needsUpdate=!0,f.geometry.computeBoundingBox(),f.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(a){return Oe.prototype.deleteVertices.call(this,a)&&o(a),this.drawRange},this.setName=function(a){const u=this.groupName;Oe.prototype.setName.call(this,a),n.forEach(f=>{f.getString()===u&&(f==null||f.setText(a))})},this.render=(a,u,f,l)=>{this.morph&&f&&(this.morph.sizePerPixel=f.pixelHeight),Oe.prototype.render.call(this,a,u,f,l)}};Oe.prototype=Object.create(Y.prototype);const Ve=function(){Y.call(this),this.isLines=!0,this.createLineSegment=(n,e,t)=>{if(n&&e){let s=Ze(n,t);t.localMorphColour&&s.morphAttributes.color&&(e.onBeforeCompile=Pt());let i=new Xe(s,e);this.setMesh(i,t.localTimeEnabled,t.localMorphColour)}},this.setWidth=n=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=n,this.morph.material.needsUpdate=!0)},this.addLines=(n,e)=>{if(n&&n.length>0){const t=this.addVertices(n);if(!this.getMorph()){let i=new S.LineBasicMaterial({color:e});const r={localTimeEnabled:!1,localMorphColour:!1};t.colorsNeedUpdate=!0,this.createLineSegment(t,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}}};Ve.prototype=Object.create(Y.prototype);const Ue=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Ue.prototype.loadImage=function(n,e){return new Promise((t,s)=>{n.onload=()=>t(n),n.onerror=s,n.src=e})},Ue.prototype.imageToUint8Array=async function(n,e,t,s){await n.loadImage(e,t),s.width=e.width,s.height=e.height;const i=s.getContext("2d");return i.drawImage(e,0,0),{array:new Uint8Array(i.getImageData(0,0,s.width,s.height).data.buffer),width:s.width,height:s.height}},Ue.prototype.loadFromImages=async function(n){},Ue.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Ue.prototype.getMaterial=function(){if(this.impl)return new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide})};const yt=function(){Ue.call(this),this.isTextureArray=!0,this.loadFromImages=async n=>{let e=1,t=1,s=0;if(n&&n.length){this.isLoading=!0;const i=new Image;i.crossOrigin="Anonymous";const r=document.createElement("canvas");let o=0;const a=new Array(n.length);for(let f=0;f<n.length;f++){const l=await this.imageToUint8Array(this,i,n[f],r);l&&l.array&&(e=l.width,t=l.height,a[s]=l.array,o+=a[s].length,s++)}const u=new Uint8Array(o);o=0,a.forEach(f=>{u.set(f,o),o+=f.length}),this.impl=new S.DataTexture2DArray(u,e,t,s),this.size={width:e,height:t,depth:s},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=n=>{if(this.impl){let e;if(n){if(n.vs&&n.fs){let t=!0;"transparent"in n&&(t=n.transparent);let s=S.FrontSide;n.side&&(s=n.side),e=new S.ShaderMaterial({transparent:t,uniforms:n.uniforms,vertexShader:n.vs,fragmentShader:n.fs,side:s}),n.glslVersion&&(e.glslVersion=n.glslVersion)}}else e=new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide});if(e)return e.needsUpdate=!0,e}}};yt.prototype=Object.create(Ue.prototype);const Ki=S.GLSL3,Qi=`
|
|
3
|
+
`))}},Vt=new w.Vector3,kt=new w.Vector3,Rt=new w.Matrix4,at=new w.Ray,Ye=new w.Sphere,lt=new w.Vector3,ct=new w.Vector3,It=new w.Vector3,Dt=new w.Vector3;class Ft extends w.Object3D{constructor(e=new w.BufferGeometry,t=new w.LineBasicMaterial){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[0];for(let i=1,r=t.count;i<r;i++)Vt.fromBufferAttribute(t,i-1),kt.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=Vt.distanceTo(kt);e.setAttribute("lineDistance",new w.Float32BufferAttribute(s,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=s.drawRange,a=s.morphAttributes.position;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ye.copy(s.boundingSphere),Ye.applyMatrix4(i),Ye.radius+=r,e.ray.intersectsSphere(Ye)===!1)return;Rt.copy(i).invert(),at.copy(e.ray).applyMatrix4(Rt);const u=r/((this.scale.x+this.scale.y+this.scale.z)/3),f=u*u,l=new w.Vector3,c=new w.Vector3,d=new w.Vector3,h=new w.Vector3,m=this.isLineSegments?2:1;if(s.isBufferGeometry){const A=s.index,g=s.attributes.position;if(A!==null){const M=Math.max(0,o.start),_=Math.min(A.count,o.start+o.count);for(let N=M,U=_-1;N<U;N+=m){const I=A.getX(N),D=A.getX(N+1);if(Gt(l,c,this,g,a,I,D),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(h);F<e.near||F>e.far||t.push({distance:F,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}else{const M=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let N=M,U=_-1;N<U;N+=m){if(Gt(l,c,this,g,a,N,N+1),at.distanceSqToSegment(l,c,h,d)>f)continue;h.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(h);D<e.near||D>e.far||t.push({distance:D,point:d.clone().applyMatrix4(this.matrixWorld),index:N,face:null,faceIndex:null,object:this})}}}else s.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Gt(n,e,t,s,i,r,o){n.fromBufferAttribute(s,r),e.fromBufferAttribute(s,o);var a=t.morphTargetInfluences;if(t.material.morphTargets&&i&&a){lt.set(0,0,0),ct.set(0,0,0);for(var u=0,f=i.length;u<f;u++){var l=a[u],c=i[u];l!==0&&(It.fromBufferAttribute(c,r),Dt.fromBufferAttribute(c,o),lt.addScaledVector(It.sub(n),l),ct.addScaledVector(Dt.sub(e),l))}n.add(lt),e.add(ct)}}Ft.prototype.isLine=!0;const jt=new w.Vector3,Et=new w.Vector3;class Xe extends Ft{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,r=t.count;i<r;i+=2)jt.fromBufferAttribute(t,i),Et.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+jt.distanceTo(Et);e.setAttribute("lineDistance",new w.Float32BufferAttribute(s,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Xe.prototype.isLineSegments=!0;const Ei=function(n){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=n,this.addLevel=(t,s)=>{if(t){const i=Math.abs(s);let r;for(r=0;r<this.levels.length&&!(i<this.levels[r].distance);r++);const o={distance:i,morph:t,loaded:!0,loading:!1,url:""};this.levels.splice(r,0,o),t.renderOrder=this._renderOrder}},this.levelLoaded=(t,s)=>{if(t){const i=Math.abs(s);for(let r=0;r<this.levels.length;r++)if(i===this.levels[r].distance){this._parent.group.add(t),this.levels[r].morph=t,this.levels[r].loaded=!0,this.levels[r].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(t,s,i,r,o)=>{this._loader=t;const a=this.calculateDistance(s),u={distance:a,morph:void 0,loaded:!1,loading:!1,url:i,index:r};let f;for(f=0;f<this.levels.length&&!(a<this.levels[f].distance);f++);this.levels.splice(f,0,u),o&&this.loadLevel(f)},this.loadLevel=t=>{const s=this.levels[t];return!s.morph&&!s.loaded&&!s.loading&&(s.loading=!0,this._loader.load(s.url,this.lodLoader(s.distance),void 0,void 0,{index:s.index})),s.morph===void 0},this.calculateDistance=function(t){this._parent.getBoundingBox();const s=this._parent.radius;let i=0;return t==="far"?i=s*4.5:t==="medium"?i=s*2.5:t==="close"&&(i=0),i},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{const t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=S.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new S.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=S.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=S.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&t.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{const t=this.levels[this._currentLevel];return t&&t.morph?t.morph:this._parent.morph},this.lodLoader=function(t){return s=>{const i=this._material,r={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=Ze(s,r);let a;this._parent.isGeometry?a=new S.Mesh(o,i):this._parent.isLines&&(a=new Xe(o,i)),a.userData=this._parent,a.renderOrder=this._renderOrder,s.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==S.VertexColors||this._material.vertexColors==!0))if(t){const s=this.getCurrentMorph();Lt(s.geometry,s)}else this.levels.forEach(s=>{s.morph&&s.morph.geometry&&Lt(s.morph.geometry,s.morph)})},this.setColour=t=>{this._material.color=t,this._secondaryMaterial&&(this._secondaryMaterial.color=t),e()},this.setFrustumCulled=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.frustumCulled=t),s.secondaryMesh&&(s.secondaryMesh.frustumCulled=t)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=S.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(s=>{s.morph&&(s.morph.material=this._material,s.morph.geometry&&(s.morph.geometry.colorsNeedUpdate=!0)),s.secondaryMesh&&(s.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=t=>{this.levels.forEach(s=>{s.morph&&(s.morph.name=t),s.secondaryMesh&&(s.secondaryMesh.name=t)})},this.setRenderOrder=t=>{this._renderOrder=t,this.levels.forEach(s=>{s.morph&&(s.morph.renderOrder=t),s.secondaryMesh&&(s.secondaryMesh.renderOrder=t)})},this.setVertexColors=t=>{this._material.vertexColors=t,e(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=t)},this.update=(t,s)=>{const i=this.levels;if(i.length>1){const r=t.cameraObject.position.distanceTo(s);let o=-1,a=-1,u,f;for(u=0,f=i.length;u<f&&r>=i[u].distance;u++)i[u].morph?(o>-1&&i[o].morph&&(i[o].morph.visible=!1),o=u,i[u].morph.visible=!0,a=-1):a=u;for(a>-1&&this.loadLevel(a);u<f;u++)i[u].morph&&(o>-1?i[u].morph.visible=!1:(i[u].morph.visible=!0,o=u));this._currentLevel!=o&&(this._currentLevel=o,this.checkTransparentMesh())}},this.toggleMarker=(t,s)=>{this.levels.forEach(i=>{i.morph&&(s?i.morph.add(t):i.morph.remove(t))})};const e=()=>{this.levels.forEach(t=>{t.morph&&t.morph.geometry&&(t.morph.geometry.colorsNeedUpdate=!0)})}},zi="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",zt=new Image(128,128);zt.src=zi;const Je=new S.Texture;Je.image=zt,Je.needsUpdate=!0;const ht=[.02,.03,1],Wi=new S.SpriteMaterial({map:Je,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),Wt=function(n){Object.getPrototypeOf(this)!==Y.prototype&&Object.setPrototypeOf(Wt.prototype,Y.prototype),Y.call(this),this.texture=Je;let e,t,s,i,r,o=!0;this.morph=new S.Group,this.group=this.morph,this.parent=n,this.isMarker=!0;let a=!1;this.ndc=new S.Vector3;let u,f,l=()=>{e=new S.Sprite(Wi),e.center.set(.5,0),this.morph.add(e),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,e.scale.set(ht[0],ht[1],ht[2]),e.userData=this};this.updateVisual=(c,d)=>{let h=1,m=0;c!==d&&(m=1-(this.ndc.z-c)/(d-c),h=.6+m*.4),this.setSpriteSize(h)},this.updateNDC=c=>(this.ndc.copy(this.morph.position),this.ndc.project(c),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(c,d,h)=>{this.morph.position.set(c,d,h)},this.setSpriteSize=c=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(c)},this.setUserSprite=()=>{i&&(this.morph.add(i),o&&(this.morph.remove(e),f&&this.morph.remove(f),o=!1))},this.setImageForUserSprite=(c,d)=>{i&&(this.morph.remove(i),i=void 0),t&&t.dispose(),s&&s.dispose(),t=new S.Texture,t.image=c,t.needsUpdate=!0,s=new S.SpriteMaterial({map:t,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),d||(d=[.05,.05,1]),i=new S.Sprite(s),i.center.set(.5,0),i.scale.set(d[0],d[1],d[2]),i.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{o||(o=!0,this.morph.add(e),i&&this.morph.remove(i),f&&this.morph.add(f))},this.loadUserSprite=(c,d)=>{if(c)if(c!==r){r=c;const h=new Image(128,128);h.crossOrigin="anonymous",h.onload=()=>{this.setImageForUserSprite(h,d)},h.src=c}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),e&&(e.clear(),e=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>a,this.setNumber=c=>{(!c||u!=c)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&c&&(f=ot(c,.012,"black","Asap",120,700),this.morph.add(f)),u=c},this.getNumber=()=>u||1,this.setVisibility=function(c){c!==this.visible&&(this.visible=c,this.group.visible=c,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{a=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{a=!1,this.morph.visible=!1,this.visible=!1},l()};let qi=0;const Zi=function(){return"pr"+qi++},Y=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new S.Group,this._lod=new Ei(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 S.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=Zi(),this._v1=new S.Vector3,this._v2=new S.Vector3,this._b1=new S.Box3,this.center=new S.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};Y.prototype.setDuration=function(n){this.duration=n,this.clipAction&&this.clipAction.setDuration(this.duration)},Y.prototype.getDuration=function(){return this.duration},Y.prototype.setRegion=function(n){this.region=n},Y.prototype.getRegion=function(){return this.region},Y.prototype.getMorph=function(){const n=this._lod.getCurrentMorph();return n||this.morph},Y.prototype.getGroup=function(){return this.group},Y.prototype.setMorph=function(n){this.morph=n,this.group.add(this.morph);const e=this._lod.calculateDistance("far");this._lod.addLevel(n,e),this._lod.setMaterial(n.material)},Y.prototype.checkTransparentMesh=function(){},Y.prototype.setMesh=function(n,e,t){this.animationGroup=new S.AnimationObjectGroup(n),this.mixer=new S.AnimationMixer(this.animationGroup);const s=n.geometry;if(this.geometry=n.geometry,this.clipAction=void 0,s&&s.morphAttributes){let i=s.morphAttributes.position;i||(i=s.morphAttributes.color?s.morphAttributes.color:s.morphAttributes.normal),i&&(this.animationClip=S.AnimationClip.CreateClipsFromMorphTargetSequences(i,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=S.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=e,this.morphColour=t,n.userData=this,n.matrixAutoUpdate=!1,this.setMorph(n),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(s.setAttribute("morphTarget0",s.getAttribute("position")),s.setAttribute("morphTarget1",s.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},Y.prototype.setIsPickable=function(n){this.isPickable!==n&&(this.isPickable=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAnatomicalId=function(n){this.anatomicalId=n},Y.prototype.setName=function(n){this.groupName=n,this._lod.setName(n)},Y.prototype.getCurrentTime=function(){if(this.clipAction){const n=this.clipAction.time/this.clipAction._clip.duration;return this.duration*n}else return this.inbuildTime},Y.prototype.setMorphTime=function(n){let e=!1;if(this.clipAction){const t=n/this.duration,s=this.clipAction._clip.duration;let i=t*s;i!=this.clipAction.time&&(this.clipAction.time=i,e=!0),e&&this.isTimeVarying()&&this.mixer.update(0)}else{let t=n;n>this.duration?t=this.duration:0>n?t=0:t=n,t!=this.inbuildTime&&(this.inbuildTime=t,e=!0)}e&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},Y.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},Y.prototype.getVisibility=function(){return this.visible},Y.prototype.setVisibility=function(n){n!==this.visible&&(this.visible=n,this.group.visible=n,this.region&&(this.region.pickableUpdateRequired=!0))},Y.prototype.setAlpha=function(n){const e=this._lod._material;let t=!1;n<1&&(t=!0),e.opacity=n,e.transparent=t,this.checkTransparentMesh()},Y.prototype.setFrustumCulled=function(n){this._lod.setFrustumCulled(n)},Y.prototype.setVertexColors=function(n){this._lod.setVertexColors(n)},Y.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},Y.prototype.setColour=function(n){this._lod.setColour(n)},Y.prototype.setGreyScale=function(n){if(n){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new S.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},Y.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},Y.prototype.setColourHex=function(n){this._lod._material.color.setHex(n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(n)},Y.prototype.setEmissiveRGB=function(n){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...n),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...n)},Y.prototype.setMaterial=function(n){this._lod.setMaterial(n)},Y.prototype.getClosestVertexIndex=function(){let n=-1;const e=this.getMorph();if(e&&e.geometry){let t=e.geometry.attributes.position;if(t){this._b1.setFromBufferAttribute(t),this._b1.getCenter(this._v1);let s=-1,i=0;for(let r=0;r<t.count;r++)this._v2.fromArray(t.array,r*3),i=this._v2.distanceTo(this._v1),s==-1?s=i:s>i&&(s=i,n=r)}}return n},Y.prototype.getClosestVertex=function(n){let e=new S.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());const t=this.getMorph();if(t&&t.geometry&&this.closestVertexIndex>=0){let s=t.morphTargetInfluences,i=t.geometry.morphAttributes;if(s&&i&&i.position){let r=!1;for(let o=0;o<s.length;o++)s[o]>0&&(r=!0,this._v1.fromArray(i.position[o].array,this.closestVertexIndex*3),e.add(this._v1.multiplyScalar(s[o])));if(r)return n?e.applyMatrix4(t.matrixWorld):e}else return e.fromArray(t.geometry.attributes.position.array,this.closestVertexIndex*3),n?e.applyMatrix4(t.matrixWorld):e}return this.getBoundingBox(),e.copy(this.center),e},Y.prototype.getBoundingBox=function(){if(this.visible){let n=this._lod.getCurrentMorph();if(n&&n.visible)return this.boundingBoxUpdateRequired&&(Ri(n,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}},Y.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},Y.prototype.markerIsRequired=function(n){return!!(this.visible&&(this.markerMode==="on"||n&&n.displayMarkers&&this.markerMode==="inherited"))},Y.prototype.updateMarker=function(n,e){if(n==!1&&this.markerIsRequired(e)){let t=e.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new Wt(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let s=this.getClosestVertex(!1);s&&(this.marker.setPosition(s.x,s.y,s.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(e.markersList&&!(this.marker.uuid in e.markersList)&&(t=!0,e.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(),e&&e.camera&&(t||e.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(e.camera.cameraObject),e.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),e.markersList&&this.marker.uuid in e.markersList&&(e.markerCluster.markerUpdateRequired=!0,delete e.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},Y.prototype.processMarkerVisual=function(n,e){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(n,e)},Y.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},Y.prototype.setRenderOrder=function(n){this._lod.setRenderOrder(n)},Y.prototype.getClosestVertexDOMElementCoords=function(n){if(n&&n.camera){let e=!0;const t=this.getClosestVertex(!0);return t.project(n.camera),t.z=Math.min(Math.max(t.z,0),1),(t.x>1||t.x<-1||t.y>1||t.y<-1)&&(e=!1),n.getZincCameraControls().getRelativeCoordsFromNDC(t.x,t.y,t),{position:t,inView:e}}else return},Y.prototype.setMarkerMode=function(n,e){n!==this.markerMode&&(n==="on"||n==="off"?this.markerMode=n:this.markerMode="inherited",this.region&&(this.region.pickableUpdateRequired=!0)),e&&(this.markerNumber=e.number,this.markerImgURL=e.imgURL)},Y.prototype.render=function(n,e,t,s){if(this.visible&&!(this.timeEnabled&&e)&&this._lod.update(t,this.center),e==!0){if(this.clipAction&&this.isTimeVarying())this.mixer.update(n);else{let i=this.inbuildTime+n;i>this.duration&&(i=i-this.duration),this.inbuildTime=i}this.visible&&n!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(e,s)},Y.prototype.addLOD=function(n,e,t,s,i){this._lod.addLevelFromURL(n,e,t,s,i)},Y.prototype.addVertices=function(n){let e=this.getMorph(),t;if(!e)t=nt(500,n),this.drawRange=n.length;else if(this.drawRange>-1){const s=e.geometry.getAttribute("position");n.forEach(i=>{s.setXYZ(this.drawRange,i[0],i[1],i[2]),++this.drawRange}),s.needsUpdate=!0,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),t=e.geoemtry,this.boundingBoxUpdateRequired=!0}return t},Y.prototype.deleteVertices=function(n){let e=this.getMorph();return e!=null&&e.geometry&&this.drawRange>=n&&ji(e.geometry,n)?(--this.drawRange,e.geometry.setDrawRange(0,this.drawRange),e.geometry.computeBoundingBox(),e.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},Y.prototype.setPosition=function(n,e,t){const s=this.getGroup();s&&(s.position.set(n,e,t),s.matrixWorldNeedsUpdate=!0,s.updateMatrix(),s.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},Y.prototype.loadAdditionalSources=function(n,e){n.load(ye(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},Y.prototype.setScaleAll=function(n){const e=this.getGroup();e&&(e.scale.set(n,n,n),e.updateMatrix(),this.boundingBoxUpdateRequired=!0)};const Yi=(n,e,t)=>{let s=Ze(n,t),i=!1;1>t.opacity&&(i=!0);let r;if(s._video===void 0){const o=t.localTimeEnabled||t.localMorphColour;e?(r=e,r.morphTargets=o,r.morphNormals=t.localTimeEnabled):s instanceof S.BufferGeometry&&s.attributes.color===void 0?r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,transparent:i,opacity:t.opacity,side:S.DoubleSide}):r=new S.MeshPhongMaterial({color:t.colour,morphTargets:o,morphNormals:t.localTimeEnabled,vertexColors:S.VertexColors,transparent:i,opacity:t.opacity,side:S.DoubleSide}),t.localMorphColour&&s.morphAttributes.color&&(r.onBeforeCompile=Pt())}else{let o=s._video.createCanvasVideoTexture();r=new S.MeshBasicMaterial({morphTargets:t.localTimeEnabled,color:new S.Color(1,1,1),transparent:i,opacity:t.opacity,map:o,side:S.DoubleSide}),(void 0).videoHandler=s._video}return new S.Mesh(s,r)},Fe=function(){Y.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(n,e,t)=>{if(this.morph&&this.morph.geometry&&n!=null)return;const s=Yi(n,e,t);this.setMesh(s,t.localTimeEnabled,t.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();const n=this.geometry.boundingBox.max,e=this.geometry.boundingBox.min,t=new S.Vector2(0-e.x,0-e.y),s=new S.Vector2(n.x-e.x,n.y-e.y);this.geometry.faceVertexUvs[0]=[];for(let i=0;i<this.geometry.faces.length;i++){const r=this.geometry.vertices[this.geometry.faces[i].a],o=this.geometry.vertices[this.geometry.faces[i].b],a=this.geometry.vertices[this.geometry.faces[i].c];geometry.faceVertexUvs[0].push([new S.Vector2((r.x+t.x)/s.x,(r.y+t.y)/s.y),new S.Vector2((o.x+t.x)/s.x,(o.y+t.y)/s.y),new S.Vector2((a.x+t.x)/s.x,(a.y+t.y)/s.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=n=>{this.morph.material.wireframe=n},this.editVertices=function(n,e){if(n&&n.length){let t=this.getMorph();const s=t.geometry.getAttribute("position");if(!t||0>e)return;{let i=e*3;n.forEach(r=>{s.array[i++]=r[0],s.array[i++]=r[1],s.array[i++]=r[2]}),s.needsUpdate=!0,t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}}};Fe.prototype=Object.create(Y.prototype);const qt=Oe.default||Oe,ut=function(n,e){let t=n,s,i=500;e?s=new qt(t,.012,e.getStyle()):s=new qt(t,.012),s.fontFace="Asap",s.fontWeight=i,s.material.map.generateMipmaps=!1,s.material.sizeAttenuation=!1,s.center.x=-.05,s.center.y=0;const r=[s.scale.x,s.scale.y];this.getPosition=()=>s?[s.position.x,s.position.y,s.position.z]:[0,0,0],this.setPosition=(o,a,u)=>{s&&s.position.set(o,a,u)},this.setColour=o=>{o&&(s.color=o.getStyle())},this.setScale=o=>{s&&o>0&&s.scale.set(o,o,1)},this.setDepthTest=o=>{o&&o!==s.material.depthTest&&(s.material.depthTest=o)},this.setSize=o=>{o>0&&(s.scale.x=r[0]*o,s.scale.y=r[1]*o)},this.setFontWeight=o=>{o&&o!==i&&(s.fontWeight=o,i=o)},this.setText=o=>{o&&o!==s.text&&(s.text=o,t=o)},this.setVisibility=o=>{s.visible=o},this.dispose=()=>{},this.getSprite=()=>s,this.getString=()=>t},Ke=function(n,e,t,s){Y.call(this);let i;e&&(i=e.clone(),i.vertexColors=S.FaceColors);const r=s;this.id=t;let o,a;this.isGlyph=!0;let u=[0,0,0];this.fromMesh=f=>f&&f.isMesh?(this.morph=f.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,n&&i&&this.fromMesh(new S.Mesh(n,i)),this.getGlyphset=function(){return r},this.setLabel=f=>{f&&(typeof f=="string"||f instanceof String)&&(a=f,this.morph&&(this.morph.name=f))},this.showLabel=f=>{if(o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),a&&(typeof a=="string"||a instanceof String)){o=new ut(a,f),o.setPosition(u[0],u[1],u[2]);const l=o.getSprite();l.material.alphaTest=.5,l.material.transparent=!0,l.material.depthWrite=!1,this.group.add(o.getSprite())}},this.hideLabel=()=>{o&&(u=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0)},this.getLabel=()=>a,this.getMesh=()=>this.morph,this.setTransformation=(f,l,c,d)=>{this.morph&&(this.morph.matrix.elements[0]=l[0],this.morph.matrix.elements[1]=l[1],this.morph.matrix.elements[2]=l[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=c[0],this.morph.matrix.elements[5]=c[1],this.morph.matrix.elements[6]=c[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=d[0],this.morph.matrix.elements[9]=d[1],this.morph.matrix.elements[10]=d[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=f[0],this.morph.matrix.elements[13]=f[1],this.morph.matrix.elements[14]=f[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),u=[...f],o&&o.setPosition(f[0],f[1],f[2])},this.setColour=f=>{o&&o.setColour(f),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}};Ke.prototype=Object.create(Y.prototype);function Qe(){}Qe.Handlers={handlers:[],add:function(n,e){this.handlers.push(n,e)},get:function(n){for(var e=this.handlers,t=0,s=e.length;t<s;t+=2){var i=e[t],r=e[t+1];if(i.test(n))return r}return null}},Object.assign(Qe.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(n,e,t){for(var s=[],i=0;i<n.length;++i)s[i]=this.createMaterial(n[i],e,t);return s},createMaterial:function(){var n={NoBlending:w.NoBlending,NormalBlending:w.NormalBlending,AdditiveBlending:w.AdditiveBlending,SubtractiveBlending:w.SubtractiveBlending,MultiplyBlending:w.MultiplyBlending,CustomBlending:w.CustomBlending},e=new w.Color,t=new w.TextureLoader,s=new w.MaterialLoader;return function(r,o,a){var u={};function f(h,m,A,b,g){var M=o+h,_=Qe.Handlers.get(M),N;_!==null?N=_.load(M):(t.setCrossOrigin(a),N=t.load(M)),m!==void 0&&(N.repeat.fromArray(m),m[0]!==1&&(N.wrapS=w.RepeatWrapping),m[1]!==1&&(N.wrapT=w.RepeatWrapping)),A!==void 0&&N.offset.fromArray(A),b!==void 0&&(b[0]==="repeat"&&(N.wrapS=w.RepeatWrapping),b[0]==="mirror"&&(N.wrapS=w.MirroredRepeatWrapping),b[1]==="repeat"&&(N.wrapT=w.RepeatWrapping),b[1]==="mirror"&&(N.wrapT=w.MirroredRepeatWrapping)),g!==void 0&&(N.anisotropy=g);var U=w.MathUtils.generateUUID();return u[U]=N,U}var l={uuid:w.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var c in r){var d=r[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":l.name=d;break;case"blending":l.blending=n[d];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":l.color=e.fromArray(d).getHex();break;case"colorSpecular":l.specular=e.fromArray(d).getHex();break;case"colorEmissive":l.emissive=e.fromArray(d).getHex();break;case"specularCoef":l.shininess=d;break;case"shading":d.toLowerCase()==="basic"&&(l.type="MeshBasicMaterial"),d.toLowerCase()==="phong"&&(l.type="MeshPhongMaterial"),d.toLowerCase()==="standard"&&(l.type="MeshStandardMaterial");break;case"mapDiffuse":l.map=f(d,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":l.emissiveMap=f(d,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":l.lightMap=f(d,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":l.aoMap=f(d,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":l.bumpMap=f(d,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":l.bumpScale=d;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":l.normalMap=f(d,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":l.normalScale=d;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":l.specularMap=f(d,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":l.metalnessMap=f(d,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":l.roughnessMap=f(d,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":l.alphaMap=f(d,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":l.side=w.BackSide;break;case"doubleSided":l.side=w.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),l.opacity=d;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":l[c]=d;break;case"vertexColors":d===!0&&(l.vertexColors=w.VertexColors),d==="face"&&(l.vertexColors=w.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,d);break}}return l.type==="MeshBasicMaterial"&&delete l.emissive,l.type!=="MeshPhongMaterial"&&delete l.specular,l.opacity<1&&(l.transparent=!0),s.setTextures(u),s.parse(l)}}()});const Xi=function(n){var e=this;this.video=void 0,this.videoTexture=void 0;var t=n,s=function(){document&&(e.video=document.createElement("video"),e.video.crossOrigin="anonymous",e.video.src=t,e.video.load(),e.video.loop=!0)};this.setMorphTime=function(i,r){var o=i/r*e.video.duration;e.video.currentTime=o},this.getVideoDuration=function(){return e.video.duration},this.createCanvasVideoTexture=function(){return e.videoTexture=new S.VideoTexture(e.video),e.videoTexture.minFilter=S.LinearFilter,e.videoTexture.magFilter=S.LinearFilter,e.videoTexture.format=S.RGBFormat,e.video.currentTime=0,e.videoTexture},this.getCurrentTime=function(i){return e.video?i*(e.video.currentTime/e.video.duration):0},this.isReadyToPlay=function(){return!!(e.video&&e.video.readyState>=3)},s()},Zt=S.AnimationClip,dt=S.Color,Ji=S.DefaultLoadingManager,Ki=S.FileLoader,Qi=S.LoaderUtils,Yt=S.Vector2,Ge=S.Vector3,Xt=S.Vector4;function $e(n){typeof n=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),n=void 0),this.manager=n!==void 0?n:Ji,this.withCredentials=!1,this.paramsString=""}Object.assign($e.prototype,{load:function(n,e,t,s){var i=this,r=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:Qi.extractUrlBase(n),o=new Ki(this.manager);n.split("?"),n.length===2?this.paramsString=paramsStrings[1]:this.paramsString="",o.setWithCredentials(this.withCredentials),o.load(n,function(a){var u=void 0;try{u=JSON.parse(a)}catch{if(console.error("The loader has encountered an error while parsing the content of a resource."),s){s({responseURL:n});return}}var f=u.metadata;if(f!==void 0){var l=f.type;if(l!==void 0&&l.toLowerCase()==="object"){console.error("THREE.JSONLoader: "+n+" should be loaded with THREE.ObjectLoader instead.");return}}if(i&&i.parse)try{var c=i.parse(u,r);e(c.geometry,c.materials)}catch(d){if(console.error("The loader has encountered aon loading the geometry"),console.error(d),s){s({responseURL:n});return}}},t,s)},setTexturePath:function(n){this.texturePath=n},parse:function(){function n(i,r){function o(q,E){return q&1<<E}var a,u,f,l,c,d,h,m,A,b,g,M,_,N,U,I,D,Z,F,z,T,L,x,O,P,V,p,B=i.faces,y=i.vertices,C=i.normals,k=i.colors,R=i.scale,G=0;if(i.uvs!==void 0){for(a=0;a<i.uvs.length;a++)i.uvs[a].length&&G++;for(a=0;a<G;a++)r.faceVertexUvs[a]=[]}for(l=0,c=y.length;l<c;)Z=new Ge,Z.x=y[l++]*R,Z.y=y[l++]*R,Z.z=y[l++]*R,r.vertices.push(Z);if(l=0,c=B.length,i.uvs)for(a=0;a<i.uvs.length;a++){r.uvs[a]=[];for(let q=0;q<i.uvs[a].length;q++)r.uvs[a][q]=i.uvs[a][q]}if(C)for(a=0;a<C.length;a++)r.normals[a]=C[a];if(k)for(a=0;a<k.length;a++)r.colors[a]=k[a];for(;l<c;)if(b=B[l++],g=o(b,0),M=o(b,1),_=o(b,3),N=o(b,4),U=o(b,5),I=o(b,6),D=o(b,7),g){if(z=new De,z.a=B[l],z.b=B[l+1],z.c=B[l+3],T=new De,T.a=B[l+1],T.b=B[l+2],T.c=B[l+3],l+=4,M&&(A=B[l++],z.materialIndex=A,T.materialIndex=A),f=r.faces.length,_)for(a=0;a<G;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],r.faceVertexUvs[a][f+1]=[],u=0;u<4;u++)m=B[l++],V=O[m*2],p=O[m*2+1],P=new Yt(V,p),u!==2&&r.faceVertexUvs[a][f].push(P),u!==0&&r.faceVertexUvs[a][f+1].push(P);if(N&&(h=B[l++]*3,z.normal.set(C[h++],C[h++],C[h]),T.normal.copy(z.normal)),U)for(a=0;a<4;a++)h=B[l++]*3,x=new Ge(C[h++],C[h++],C[h]),a!==2&&z.vertexNormals.push(x),a!==0&&T.vertexNormals.push(x);if(I&&(d=B[l++],L=k[d],z.color.setHex(L),T.color.setHex(L)),D)for(a=0;a<4;a++)d=B[l++],L=k[d],a!==2&&z.vertexColors.push(new dt(L)),a!==0&&T.vertexColors.push(new dt(L));r.faces.push(z),r.faces.push(T)}else{if(F=new De,F.a=B[l++],F.b=B[l++],F.c=B[l++],F.b||(F.b=F.a),F.c||(F.c=F.b),M&&(A=B[l++],F.materialIndex=A),f=r.faces.length,_)for(a=0;a<G;a++)for(O=i.uvs[a],r.faceVertexUvs[a][f]=[],u=0;u<3;u++)m=B[l++],V=O[m*2],p=O[m*2+1],P=new Yt(V,p),r.faceVertexUvs[a][f].push(P);if(N&&(h=B[l++]*3,F.normal.set(C[h++],C[h++],C[h])),U)for(a=0;a<3;a++)h=B[l++]*3,x=new Ge(C[h++],C[h++],C[h]),F.vertexNormals.push(x);if(I&&(d=B[l++],F.color.setHex(k[d])),D)for(a=0;a<3;a++)d=B[l++],F.vertexColors.push(new dt(k[d]));r.faces.push(F)}}function e(i,r){var o=i.influencesPerVertex!==void 0?i.influencesPerVertex:2;if(i.skinWeights)for(var a=0,u=i.skinWeights.length;a<u;a+=o){var f=i.skinWeights[a],l=o>1?i.skinWeights[a+1]:0,c=o>2?i.skinWeights[a+2]:0,d=o>3?i.skinWeights[a+3]:0;r.skinWeights.push(new Xt(f,l,c,d))}if(i.skinIndices)for(var a=0,u=i.skinIndices.length;a<u;a+=o){var h=i.skinIndices[a],m=o>1?i.skinIndices[a+1]:0,A=o>2?i.skinIndices[a+2]:0,b=o>3?i.skinIndices[a+3]:0;r.skinIndices.push(new Xt(h,m,A,b))}r.bones=i.bones,r.bones&&r.bones.length>0&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}function t(i,r){var o=i.scale;if(i.morphTargets!==void 0)for(var a=0,u=i.morphTargets.length;a<u;a++){r.morphTargets[a]={},r.morphTargets[a].name=i.morphTargets[a].name,r.morphTargets[a].vertices=[];for(var f=r.morphTargets[a].vertices,l=i.morphTargets[a].vertices,c=0,d=l.length;c<d;c+=3){var h=new Ge;h.x=l[c]*o,h.y=l[c+1]*o,h.z=l[c+2]*o,f.push(h)}}if(i.morphNormals!==void 0){for(var a=0,u=i.morphNormals.length;a<u;a++)if(r.morphTargets[a]){r.morphTargets[a].normals=[];for(var m=r.morphTargets[a].normals,A=i.morphNormals[a].normals,c=0,d=A.length;c<d;c+=3){var b=new Ge;b.x=A[c],b.y=A[c+1],b.z=A[c+2],m.push(b)}r.morphNormalsReady=!0}}if(i.morphColors!==void 0){var a,u,g,M,_,N,U;for(a=0,u=i.morphColors.length;a<u;a++)for(r.morphColors[a]={},r.morphColors[a].name=i.morphColors[a].name,r.morphColors[a].colors=[],_=r.morphColors[a].colors,N=i.morphColors[a].colors,g=0,M=N.length;g<M;g+=3)U=new S.Color(16755200),U.setRGB(N[g],N[g+1],N[g+2]),_.push(U)}}function s(i,r){var o=[],a=[];i.animation!==void 0&&a.push(i.animation),i.animations!==void 0&&(i.animations.length?a=a.concat(i.animations):a.push(i.animations));for(var u=0;u<a.length;u++){var f=Zt.parseAnimation(a[u],r.bones);f&&o.push(f)}if(r.morphTargets){var l=Zt.CreateClipsFromMorphTargetSequences(r.morphTargets,10);o=o.concat(l)}o.length>0&&(r.animations=o)}return function(r,o){r.data!==void 0&&(r=r.data),r.scale!==void 0?r.scale=1/r.scale:r.scale=1;var a=new Be;if(a.morphColors=[],n(r,a),e(r,a),t(r,a),s(r,a),a.computeFaceNormals(),a.computeBoundingSphere(),r.materials===void 0||r.materials.length===0)return{geometry:a};var u=Qe.prototype.initMaterials(r.materials,o,"Anonymous");if(r.materials[0].video){var f=o+r.materials[0].video;this.paramsString&&(f=f+`?${this.paramsString}`);const l=new Xi(f);a._video=l}return u&&u.length>0&&(r.materials[0].singleSided?u[0].side=S.FrontSide:r.materials[0].flipSided?u[0].side=S.BackSide:u[0].side=S.DoubleSide,r.materials[0].specularCoef&&(u[0].shininess=Math.floor(r.materials[0].specularCoef/3))),{geometry:a,materials:u}}}()});const ft=function(){Y.call(this);const n=[];let e,t,s,i,r,o,a,u=0,f=0,l=[0,0,0],c=[0,0,0],d=[0,0,0],h="NONE";this.ready=!1;let m=!1,A=!1;this.isGlyphset=!0;let b=new S.Matrix4;const g=new S.Color,M=new S.Color,_=new S.Box3,N=new S.Box3,U=new S.Box3,I=[],D=[],Z=[],F=[],z=[],T=[],L=[];this.globalScale=1;for(let y=0;y<8;y++)new S.Vector3;this.load=(y,C,k,R,G)=>{e=y.axis1,t=y.axis2,s=y.axis3,i=y.positions,r=y.scale,o=y.colors,a=y.label,m=y.metadata.MorphColours,A=y.metadata.MorphVertices,u=y.metadata.number_of_time_steps,h=y.metadata.repeat_mode,f=y.metadata.number_of_vertices,h=="AXES_2D"||h=="MIRROR"?f=f*2:h=="AXES_3D"&&(f=f*3),l=y.metadata.base_size,c=y.metadata.offset,d=y.metadata.scale_factors;const q=new $e;this.geometry=new S.BufferGeometry;const E=new S.InstancedMesh(this.geometry,void 0,f);if(this.setMorph(E),R){var K=q.parse(C);B(k,G)(K.geometry,K.materials),K.geometry.dispose()}else q.crossOrigin="Anonymous",q.load(C,B(k,G))};const x=(y,C,k,R,G,q)=>{if(h=="NONE"||h=="MIRROR"){let Q=[0,0,0],ee=[0,0,0],re=[0,0,0],H=[0,0,0],ue=[0,0,0];const ne=[0,0,0],te=[0,0,0],X=[0,0,0],ie=[0,0,0];for(var E=0;E<3;E++){var K=G[E]<0?-1:1;Q[E]=(K*l[E]+G[E]*d[E])*this.globalScale}for(var E=0;E<3;E++)ee[E]=C[E]*Q[0],re[E]=k[E]*Q[1],H[E]=R[E]*Q[2],ue[E]=y[E]+c[0]*ee[E]+c[1]*re[E]+c[2]*H[E],h=="MIRROR"&&(ne[E]=-ee[E],te[E]=-re[E],X[E]=-H[E],ie[E]=ue[E],G[0]<0&&(ue[E]-=ee[E],ie[E]-=ne[E]));0>H[0]*(ee[1]*re[2]-ee[2]*re[1])+H[1]*(ee[2]*re[0]-ee[0]*re[2])+H[2]*(ee[0]*re[1]-ee[1]*re[0])&&(H[0]=-H[0],H[1]=-H[1],H[2]=-H[2]),q[0]=[ue,ee,re,H],h=="MIRROR"&&(0>X[0]*(ne[1]*te[2]-ne[2]*te[1])+X[1]*(ne[2]*te[0]-ne[0]*te[2])+X[2]*(ne[0]*te[1]-ne[1]*te[0])&&(X[0]=-X[0],X[1]=-X[1],X[2]=-X[2]),q[1]=[ie,ne,te,X])}else if(h=="AXES_2D"||h=="AXES_3D"){let Q=[0,0,0],ee=[0,0,0];for(var E=0;E<3;E++){var K=G[E]<0?-1:1;Q[E]=(K*l[0]+G[E]*d[0])*this.globalScale}for(var E=0;E<3;E++)ee[E]=y[E]+c[0]*Q[0]*C[E]+c[1]*Q[1]*k[E]+c[2]*Q[2]*R[E];const re=glyph_repeat_mode=="AXES_2D"?2:3;for(let H=0;H<re;H++){let ue,ne;const te=G[H];let X=[0,0,0],ie=[0,0,0],ae=[0,0,0];H==0?(ue=C,ne=k):H==1?(ue=k,ne=glyph_repeat_mode=="AXES_2D"?C:R):(ue=R,ne=C);const Le=(l[0]+te*d[0])*this.globalScale;X[0]=ue[0]*Le,X[1]=ue[1]*Le,X[2]=ue[2]*Le,ae[0]=X[1]*ne[2]-ne[1]*X[2],ae[1]=X[2]*ne[0]-ne[2]*X[0],ae[2]=X[0]*ne[1]-X[1]*ne[0];let oe=Math.sqrt(ae[0]*ae[0]+ae[1]*ae[1]+ae[2]*ae[2]);if(0<oe){let Ne=(l[2]+te*d[2])*this.globalScale/oe;h=="AXES_2D"&&H>0&&(Ne*=-1),ae[0]*=Ne,ae[1]*=Ne,ae[2]*=Ne}if(ie[0]=ae[1]*X[2]-X[1]*ae[2],ie[1]=ae[2]*X[0]-X[2]*ae[0],ie[2]=ae[0]*X[1]-ae[1]*X[0],oe=Math.sqrt(ie[0]*ie[0]+ie[1]*ie[1]+ie[2]*ie[2]),0<oe){var $=(l[1]+te*d[1])*this.globalScale/oe;ie[0]*=$,ie[1]*=$,ie[2]*=$}q[H]=[ee,X,ie,ae]}}return q},O=(y,C,k,R,G)=>{let q=1;h=="AXES_2D"||h=="MIRROR"?q=2:h=="AXES_3D"&&(q=3);const E=y.length/3;let K=0;L.length=q;for(let $=0;$<E;$++){const Q=$*3,ee=[y[Q],y[Q+1],y[Q+2]],re=[C[Q],C[Q+1],C[Q+2]],H=[k[Q],k[Q+1],k[Q+2]],ue=[R[Q],R[Q+1],R[Q+2]],ne=[G[Q],G[Q+1],G[Q+2]],te=x(ee,re,H,ue,ne,L);if(te.length==q)for(let X=0;X<q;X++){b.elements[0]=te[X][1][0],b.elements[1]=te[X][1][1],b.elements[2]=te[X][1][2],b.elements[3]=0,b.elements[4]=te[X][2][0],b.elements[5]=te[X][2][1],b.elements[6]=te[X][2][2],b.elements[7]=0,b.elements[8]=te[X][3][0],b.elements[9]=te[X][3][1],b.elements[10]=te[X][3][2],b.elements[11]=0,b.elements[12]=te[X][0][0],b.elements[13]=te[X][0][1],b.elements[14]=te[X][0][2],b.elements[15]=1,this.morph.setMatrixAt(K,b);const ie=n[K];ie&&ie.setTransformation(te[X][0],te[X][1],te[X][2],te[X][3]),K++}}this.morph.instanceMatrix.needsUpdate=!0},P=y=>{let C=1;h=="AXES_2D"||h=="MIRROR"?C=2:h=="AXES_3D"&&(C=3);const k=y.length;let R=0;for(let G=0;G<k;G++){const q=y[G];for(let E=0;E<C;E++){g.setHex(q),this.morph.setColorAt(R,g);const K=n[R];K&&K.setColour(g),R++}}this.morph.instanceColor.needsUpdate=!0},V=()=>{let y=I,C=D,k=Z,R=F,G=z,q=T;const E=this.inbuildTime/this.duration*(u-1),K=Math.floor(E),$=1-(E-K),Q=Math.ceil(E);if(A){const ee=i[K.toString()],re=i[Q.toString()],H=e[K.toString()],ue=e[Q.toString()],ne=t[K.toString()],te=t[Q.toString()],X=s[K.toString()],ie=s[Q.toString()],ae=r[K.toString()],Le=r[Q.toString()];I.length=ee.length,D.length=ee.length,Z.length=ee.length,F.length=ee.length,z.length=ee.length;for(let oe=0;oe<ee.length;oe++)y[oe]=$*ee[oe]+(1-$)*re[oe],C[oe]=$*H[oe]+(1-$)*ue[oe],k[oe]=$*ne[oe]+(1-$)*te[oe],R[oe]=$*X[oe]+(1-$)*ie[oe],G[oe]=$*ae[oe]+(1-$)*Le[oe]}else y=i[0],C=e[0],k=t[0],R=s[0],G=r[0];if(O(y,C,k,R,G),this.boundingBoxUpdateRequired=!0,o!=null){if(m){const ee=o[K.toString()],re=o[Q.toString()];q.length=ee.length;for(let H=0;H<ee.length;H++)g.setHex(ee[H]),M.setHex(re[H]),g.setRGB(g.r*$+M.r*(1-$),g.g*$+M.g*(1-$),g.b*$+M.b*(1-$)),q[H]=g.getHex()}else q=o[0];P(q)}};this.getLabel=y=>{if(a&&a.length>y)return a[y]},this.showLabel=()=>{for(let y=0;y<n.length;y++)n[y].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(let y=0;y<n.length;y++)n[y].hideLabel()};const p=y=>{for(let C=0;C<f;C++){const k=new Ke(void 0,void 0,C,this);let R=a?a[C]:void 0;R=R||this.groupName,R&&k.setLabel(R),u>0&&k.setFrustumCulled(!1),n[C]=k,this.morph.add(k.getGroup())}y&&this.showLabel(),O(i[0],e[0],t[0],s[0],r[0]),o!=null&&P(o[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=y=>{y.isGlyph&&n.push(y),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(y,C)=>{if(y.isMesh){const k=new Ke(void 0,void 0,C,this);return k.fromMesh(y),n.push(k),this.morph.add(k.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,k}},this.forEachGlyph=y=>{for(let C=0;C<n.length;C++)y(n[C])};var B=(y,C)=>(k,R)=>{const G=k.toBufferGeometry();this.geometry.copy(G),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),G.dispose(),R&&R[0]&&(this.morph.material=R[0]),p(C),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),k.dispose(),y!=null&&typeof y=="function"&&y(this)};this.getClosestVertexIndex=function(){let y=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let C=i[0];const k=C.length/3;let R=-1,G=0;for(let q=0;q<k;q++){const E=q*3;this._v2.set(C[E],C[E+1],C[E+2]),G=this._v1.distanceTo(this._v2),(R==-1||R>G)&&(R=G,y=q)}}return y},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let y=new S.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,b),y.setFromMatrixPosition(b),y}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let y=0;y<f;y++)this.morph.getMatrixAt(y,b),N.copy(_).applyMatrix4(b),y==0?U.copy(N):U.union(N);if(U)this.cachedBoundingBox.copy(U),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=y=>{y>this.duration?this.inbuildTime=this.duration:0>y?this.inbuildTime=0:this.inbuildTime=y,(m||A)&&(V(),A&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||u>0)&&(m||A)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(y){this.globalScale=y,V()},this.dispose=()=>{for(let y=n.length-1;y>=0;y--)n[y].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),e=void 0,t=void 0,s=void 0,i=void 0,r=void 0,o=void 0,this.ready=!1,this.groupName=void 0},this.render=(y,C,k)=>{if(C==!0){let R=this.inbuildTime+y;R>this.duration&&(R=R-this.duration),this.inbuildTime=R,(m||A)&&V()}this.updateMarker(C,k)}};ft.prototype=Object.create(Y.prototype);const Jt=new w.Matrix4,pt=new w.Ray,He=new w.Sphere,je=new w.Vector3,mt=new w.Vector3,Kt=new w.Vector3;class gt extends w.Object3D{constructor(e=new w.BufferGeometry,t=new w.PointsMaterial){super(),this.type="Points",this.geometry=e,this.material=t,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),He.copy(s.boundingSphere),He.applyMatrix4(i),He.radius+=r,e.ray.intersectsSphere(He)===!1)return;Jt.copy(i).invert(),pt.copy(e.ray).applyMatrix4(Jt);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,u=a*a;if(s.isBufferGeometry){const f=s.index,c=s.attributes.position,d=s.morphAttributes.position;if(f!==null){const h=Math.max(0,o.start),m=Math.min(f.count,o.start+o.count);for(let A=h,b=m;A<b;A++){const g=f.getX(A);$t(this,c,d,g),Qt(je,g,u,i,e,t,this)}}else{const h=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let A=h,b=m;A<b;A++)$t(this,c,d,A),Qt(je,A,u,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}gt.prototype.isPoints=!0;function Qt(n,e,t,s,i,r,o){const a=pt.distanceSqToPoint(n);if(a<t){const u=new w.Vector3;pt.closestPointToPoint(n,u),u.applyMatrix4(s);const f=i.ray.origin.distanceTo(u);if(f<i.near||f>i.far)return;r.push({distance:f,distanceToRay:Math.sqrt(a),point:u,index:e,face:null,object:o})}}function $t(n,e,t,s){je.fromBufferAttribute(e,s);const i=n.morphTargetInfluences;if(n.material.morphTargets&&t&&i){mt.set(0,0,0);for(var r=0,o=t.length;r<o;r++){const a=i[r],u=t[r];a!==0&&(Kt.fromBufferAttribute(u,s),mt.addScaledVector(Kt.sub(je),a))}je.add(mt)}}const Te=function(){Y.call(this),this.isPointset=!0;const n=[];let e=1,t=!1,s=500,i=!0;this.createMesh=(a,u,f)=>{if(a&&u){let l=Ze(a,f);const c=Ut();u.map=c;let d=new gt(l,u);this.setMesh(d,f.localTimeEnabled,f.localMorphColour)}};const r=(a,u,f,l)=>{if(f){const c=new S.Color(l),d=new ut(f,c);d.setPosition(u[0],u[1],u[2]);const h=d.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=t,d.setFontWeight(s),d.setSize(e),d.setVisibility(i),this.group.add(h),n[a]=d}},o=a=>{const u=n[a];if(u){const f=u.getSprite();this.group.remove(f),u.dispose(),n.splice(a,1)}};this.addPoints=(a,u,f)=>{if(a&&a.length>0){let l=this.drawRange;l===-1&&(l=0);const c=this.addVertices(a);if(!this.getMorph()){let A=new S.PointsMaterial({alphaTest:.5,size:10,color:f,sizeAttenuation:!1});const b={localTimeEnabled:!1,localMorphColour:!1};c.colorsNeedUpdate=!0,this.createMesh(c,A,b)}let h=l+a.length,m=0;if(Array.isArray(u)&&u.length===a.length||typeof u=="string")for(n.length,l;l+m<h;){const A=typeof u=="string"?u:u[m];r(l+m,a[m],A,this._lod._material.color),m++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(a){this._lod._material.color.setHex(a),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setColour=a=>{this._lod.setColour(a);for(let u=0;u<n.length;u++)n[u]&&n[u].setColour(this._lod._material.color)},this.setLabelDepthTest=a=>{t=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setDepthTest(a)},this.setLabelFontWeight=a=>{s=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setFontWeight(a)},this.setLabelSize=a=>{e=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setSize(e)},this.displayLabels=a=>{i=a;for(let u=0;u<n.length;u++)n[u]&&n[u].setVisibility(i)},this.setSize=a=>{this.morph&&this.morph.material&&(this.morph.material.size=a,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=a=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=a,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(a){if(a>=0&&this.drawRange>a){const u=this.getMorph().geometry.getAttribute("position");return[u.getX(a),u.getY(a),u.getZ(a)]}},this.editVertices=function(a,u){if(a&&a.length){let f=this.getMorph();const l=u+a.length-1;if(!f||0>u||l>=this.drawRange)return;{const c=f.geometry.getAttribute("position");let d=u;a.forEach(h=>{const m=n[d];m&&m.setPosition(h[0],h[1],h[2]),c.setXYZ(d++,h[0],h[1],h[2])}),c.needsUpdate=!0,f.geometry.computeBoundingBox(),f.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(a){return Te.prototype.deleteVertices.call(this,a)&&o(a),this.drawRange},this.setName=function(a){const u=this.groupName;Te.prototype.setName.call(this,a),n.forEach(f=>{f.getString()===u&&(f==null||f.setText(a))})},this.render=(a,u,f,l)=>{this.morph&&f&&(this.morph.sizePerPixel=f.pixelHeight),Te.prototype.render.call(this,a,u,f,l)}};Te.prototype=Object.create(Y.prototype);const Ve=function(){Y.call(this),this.isLines=!0,this.createLineSegment=(n,e,t)=>{if(n&&e){let s=Ze(n,t);t.localMorphColour&&s.morphAttributes.color&&(e.onBeforeCompile=Pt());let i=new Xe(s,e);this.setMesh(i,t.localTimeEnabled,t.localMorphColour)}},this.setWidth=n=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=n,this.morph.material.needsUpdate=!0)},this.addLines=(n,e)=>{if(n&&n.length>0){const t=this.addVertices(n);if(!this.getMorph()){let i=new S.LineBasicMaterial({color:e});const r={localTimeEnabled:!1,localMorphColour:!1};t.colorsNeedUpdate=!0,this.createLineSegment(t,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}}};Ve.prototype=Object.create(Y.prototype);const Ue=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Ue.prototype.loadImage=function(n,e){return new Promise((t,s)=>{n.onload=()=>t(n),n.onerror=s,n.src=e})},Ue.prototype.imageToUint8Array=async function(n,e,t,s){await n.loadImage(e,t),s.width=e.width,s.height=e.height;const i=s.getContext("2d");return i.drawImage(e,0,0),{array:new Uint8Array(i.getImageData(0,0,s.width,s.height).data.buffer),width:s.width,height:s.height}},Ue.prototype.loadFromImages=async function(n){},Ue.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Ue.prototype.getMaterial=function(){if(this.impl)return new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide})};const yt=function(){Ue.call(this),this.isTextureArray=!0,this.loadFromImages=async n=>{let e=1,t=1,s=0;if(n&&n.length){this.isLoading=!0;const i=new Image;i.crossOrigin="Anonymous";const r=document.createElement("canvas");let o=0;const a=new Array(n.length);for(let f=0;f<n.length;f++){const l=await this.imageToUint8Array(this,i,n[f],r);l&&l.array&&(e=l.width,t=l.height,a[s]=l.array,o+=a[s].length,s++)}const u=new Uint8Array(o);o=0,a.forEach(f=>{u.set(f,o),o+=f.length}),this.impl=new S.DataTexture2DArray(u,e,t,s),this.size={width:e,height:t,depth:s},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=n=>{if(this.impl){let e;if(n){if(n.vs&&n.fs){let t=!0;"transparent"in n&&(t=n.transparent);let s=S.FrontSide;n.side&&(s=n.side),e=new S.ShaderMaterial({transparent:t,uniforms:n.uniforms,vertexShader:n.vs,fragmentShader:n.fs,side:s}),n.glslVersion&&(e.glslVersion=n.glslVersion)}}else e=new S.MeshBasicMaterial({color:new S.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:S.DoubleSide});if(e)return e.needsUpdate=!0,e}}};yt.prototype=Object.create(Ue.prototype);const $i=S.GLSL3,Hi=`
|
|
4
4
|
precision highp float;
|
|
5
5
|
precision highp int;
|
|
6
6
|
precision highp sampler2DArray;
|
|
@@ -37,7 +37,7 @@ void main() {
|
|
|
37
37
|
vec3 contrastedColor = (brightenedColor - vec3(0.5)) * contrast + vec3(0.5);
|
|
38
38
|
outColor = vec4(contrastedColor, 1.0);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
`,es=`
|
|
41
41
|
out vec3 vUw;
|
|
42
42
|
uniform float depth;
|
|
43
43
|
uniform vec3 slide;
|
|
@@ -65,7 +65,7 @@ void main() {
|
|
|
65
65
|
vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);
|
|
66
66
|
|
|
67
67
|
}
|
|
68
|
-
`,Hi=function(){return{brightness:{value:0},contrast:{value:1},depth:{value:1},discardAlpha:{value:!0},diffuse0:{value:void 0},diffuse1:{value:void 0},direction:{value:1},flipY:{value:!0},flipZ:{value:!1},nChannels:{value:1},mask:{value:void 0},maskEnabled:{value:!1},slide:{value:new S.Vector3(0,0,1)},time:{value:0}}},ke=function(n){Y.call(this),this.isTexturePrimitive=!0,this.texture=n,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(e,t,s)=>{if(e&&e.images&&e.images.source){const i=new yt,r=[];e.images.source.forEach(a=>{r.push(ye(a))});const o=this;i.loadFromImages(r).then(()=>{o.texture=i,o.textureList.push(this.texture),o.initialise(e,t)})}},this.addTextureArray=e=>{this.textureList.length===0&&this.texture&&this.textureList.push(this.texture),e&&e.isTextureArray&&this.textureList.push(e)},this.initialise=(e,t)=>{t!=null&&typeof t=="function"&&t(this)}};ke.prototype=Object.create(Y.prototype),ke.prototype.constructor=ke;const Ee=function(n){ke.call(this,n),this.isTextureSlides=!0;const e=[],t={};this.morph=new S.Group,this.group=this.morph,this.morph.userData=this;let s,i=!0,r=!1,o=0,a=1,u=1,f,l=!1,c=!0,d=0,h=0,m=-.1;this.createSlides=g=>{g.forEach(M=>this.createSlide(M))};const A=(g,M)=>{const _=g.material,N=_.uniforms;switch(g.rotation.x=0,g.rotation.y=0,g.rotation.z=0,g.position.x=0,g.position.y=0,g.position.z=0,M.direction){case"x":const U=-Math.PI/2;g.rotation.y=U,N.direction.value=1,N.slide.value.set(M.value,0,0),g.position.x=M.value;break;case"y":g.rotation.x=Math.PI/2,N.direction.value=2,N.slide.value.set(0,M.value,0),g.position.y=M.value;break;case"z":N.direction.value=3,N.slide.value.set(0,0,M.value),g.position.z=M.value;break}_.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=g=>{g&&g.id&&g.id in t&&t[g.id]&&A(t[g.id],g)},this.createSlide=g=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&g&&g.direction&&g.value!==void 0){const M=new S.PlaneGeometry(1,1);M.translate(.5,.5,0);const _=Hi();_.brightness.value=o,_.contrast.value=a,_.diffuse0.value=this.texture.impl,_.diffuse1.value=this.texture.impl,_.discardAlpha.value=c,_.depth.value=this.texture.size.depth,_.flipY.value=i,_.flipZ.value=r,_.mask.value=f,_.maskEnabled.value=l,_.nChannels.value=u;const N={fs:Qi,vs:$i,uniforms:_,glslVersion:Ki,side:S.DoubleSide,transparent:!1},U=this.texture.getMaterial(N);U.needsUpdate=!0;const I=new S.Mesh(M,U);I.name=this.groupName,I.userData=this;const D={value:g.value,direction:g.direction,id:I.id};return e.push(D),A(I,D),t[I.id]=I,this.morph.add(I),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),D}},this.getTextureSettings=()=>[...e],this.getTextureSettingsWithId=g=>{for(let M=0;M<e.length;M++)if(g===e[M].id)return{...e[M]}},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=g=>{g&&this.removeSlideWithId(g.id)},this.removeSlideWithId=g=>{if(this.morph&&g in t&&t[g]){if(this.morph.getObjectById(g)){const _=t[g];this.morph.remove(_),_.clear(),_.geometry&&_.geometry.dispose(),_.material&&_.material.dispose(),this.boundingBoxUpdateRequired=!0}const M=e.findIndex(_=>_.id===g);M>-1&&e.splice(M,1)}},this.dispose=()=>{this.morph.children.forEach(g=>{g.geometry&&g.geometry.dispose(),g.material&&g.material.dispose()}),ke.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};const b=(g,M,_)=>{if(M)switch(M.direction.value){case 1:_.copy(M.slide.value),g.expandByPoint(_),_.setY(1),_.setZ(1),g.expandByPoint(_);break;case 2:_.copy(M.slide.value),g.expandByPoint(_),_.setX(1),_.setZ(1),g.expandByPoint(_);break;case 3:_.copy(M.slide.value),g.expandByPoint(_),_.setX(1),_.setY(1),g.expandByPoint(_);break}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();const g=new S.Vector3(0,0,0);this.morph.children.forEach(M=>{b(this.cachedBoundingBox,M.material.uniforms,g)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(g,M,_)=>{const N=new S.Matrix4;N.set(g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,0,0,0,0);const U=new S.Quaternion().setFromRotationMatrix(N);this.morph.position.set(...M),this.morph.quaternion.copy(U),this.morph.scale.set(..._),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=g=>{this.morph.renderOrder=g},this.initialise=(g,M)=>{if(g){const _=g.locations;_&&_.length>0&&(this.applyTransformation(_[0].orientation,_[0].position,_[0].scale),"flipY"in _[0]&&(i=_[0].flipY),"flipZ"in _[0]&&(r=_[0].flipZ)),this.createSlides(g.settings.slides),M!=null&&typeof M=="function"&&M(this)}},this.showEdges=g=>{if(s)s.material.color=g;else{const M=new S.BoxGeometry(1,1,1);M.translate(.5,.5,.5);const _=new S.EdgesGeometry(M);s=new S.LineSegments(_,new S.LineBasicMaterial({color:g})),this.group.add(s)}s.visible=!0},this.setUniformsValue=(g,M)=>{this.morph.children.forEach(_=>{const N=_.material;if(N.type==="ShaderMaterial"){const U=N.uniforms;U[g].value=M,N.needsUpdate=!0}})},this.isAlphaPixelDiscarded=()=>c,this.discardAlphaPixel=g=>{c=g,this.setUniformsValue("discardAlpha",c)},this.getBrightness=()=>o,this.setBrightness=g=>{o=g,this.setUniformsValue("brightness",o)},this.getContrast=()=>a,this.setContrast=g=>{a>=0&&(a=g,this.setUniformsValue("contrast",a))},this.getNumberOfChannels=()=>u,this.setNumberOfChannels=g=>{u=g,this.setUniformsValue("nChannels",u)},this.getMask=()=>f,this.setMask=g=>{f=g,this.setUniformsValue("mask",f),this.setUniformsValue("maskEnabled",!!f)},this.hideEdges=()=>{s&&(s.visible=!1)},this.updateTimeTexture=()=>{const g=this.textureList.length-1,M=this.inbuildTime/this.duration;if(this.timeEnabled&&g>0&&m!==M){const _=M*g,N=Math.floor(_),U=Math.ceil(_),I=_-N;this.morph.children.forEach(D=>{const Z=D.material;if(Z.type==="ShaderMaterial"){const F=Z.uniforms;d!==N&&(F.diffuse0.value=this.textureList[N].impl),h!==U&&(F.diffuse1.value=this.textureList[U].impl),F.time.value=I,Z.needsUpdate=!0}}),d=N,h=U,m=M}},this.setMorphTime=g=>{let M=g;g>this.duration?M=this.duration:0>g?M=0:M=g,M!=this.inbuildTime&&(this.inbuildTime=M,this.updateTimeTexture())},this.render=(g,M,_)=>{if(M==!0&&this.timeEnabled&&this.textureList.length>1){let N=this.inbuildTime+g;N>this.duration&&(N=N-this.duration),this.inbuildTime=N,this.updateTimeTexture()}}};Ee.prototype=Object.create(ke.prototype),Ee.prototype.constructor=Ee;const Re=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];const n=this;this.setFromObject=({nearPlane:e,farPlane:t,eyePosition:s,targetPosition:i,upVector:r})=>{n.nearPlane=e,n.farPlane=t,n.eyePosition=s,n.targetPosition=i,n.upVector=r}},$t=function(n,e,t,s){const i={DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,MINIMAP:5,SYNC_CONTROL:6},r={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},o={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},u={};u.MAIN=r.ROTATE,u.AUXILIARY=r.ZOOM,u.SECONDARY=r.PAN,this.cameraObject=n,this.domElement=e!==void 0?e:document,this.renderer=t,this.scene=s,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;let f=6e3,l=!0,c=0,d,h,m=!1,A=500,b,g="default",M=i.DEFAULT,_,N,U,I=0,D=o.FREE;this._state=r.NONE;let Z;this.targetTouchId=-1;let F;const z=new S.Vector3,T=new S.Vector3,L=new S.Vector3,x=new S.Vector3,O=new S.Vector3,P=new S.Vector3,V=new S.Vector3,p=new S.Vector3,B=new S.Sphere,y=new S.Vector3;let C=!1,k,R=0;const G={default:new Re};G.default.nearPlane=.1,G.default.farPlane=2e3,G.default.eyePosition=[0,0,0],G.default.targetPosition=[0,0,-1],G.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new S.Vector3(...G.default.targetPosition)),this.calculateMaxAllowedDistance=v=>{const j=v.getBoundingBox();if(j){j.getBoundingSphere(B),R=B.radius*6;let W=0;this.cameraObject&&(W=this.cameraObject.position.distanceTo(B.center)),R=W>R?W*1.5:R}else R=0};const q=v=>{z.copy(this.cameraObject.position);const W=z.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,W*.001),this.cameraObject.far=this.cameraObject.near*1e4};this.addViewport=(v,j)=>{v&&j&&(G[v]=j)},this.setDefaultViewport=v=>v&&v in G?(g=v,!0):!1,this.getDefaultViewport=()=>g,this.getViewportOfName=v=>G[v],this.setCurrentViewport=v=>v in G?(this.setCurrentCameraSettings(G[v]),!0):!1,this.setRotationMode=v=>{switch(v){case"none":D=o.NONE;break;case"horizontal":D=o.HORIZONTAL;break;case"vertical":D=o.VERTICAL;break;case"free":default:D=o.FREE}},this.onResize=()=>{F&&(F=void 0),k&&k.setCurrentCameraSettings(this.cameraObject,G[g])},this.getVisibleHeightAtZDepth=v=>{const j=this.cameraObject.position.distanceTo(this.cameraObject.target);v<j?v-=j:v+=j;const W=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(W/2)*Math.abs(v)},this.calculateHeightPerPixelAtZeroDepth=v=>{const j=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=j/v,this.pixelHeight},this.getNDCFromDocumentCoords=(v,j,W)=>{ie(!1);const J=W||new S.Vector2,he=(v-F.left)/F.width*2-1,le=-((j-F.top)/F.height)*2+1;return J.set(he,le)},this.getRelativeCoordsFromNDC=(v,j,W)=>{ie(!1);const J=W||new S.Vector2;return J.x=(v+1)*F.width/2,J.y=(1-j)*F.height/2,J},this.setMouseButtonAction=(v,j)=>{u[v]=r[j]};const E=(v,j)=>{v instanceof HTMLCanvasElement&&(v.tabIndex=j)},K=()=>{if(R>0){const v=y.distanceTo(B.center);return R>v||this.cameraObject.position.distanceTo(B.center)>v}return!0},$=v=>{y.copy(this.cameraObject.position).add(v),K()&&(this.cameraObject.target.add(v),this.cameraObject.position.add(v),this.updateDirectionalLight())},Q=v=>{ie(!1);let j;if(M===i.DEFAULT&&(j=this.scene.getNormalisedMinimapCoordinates(this.renderer,v)),!j)v.button==0?v.ctrlKey?this._state=u.AUXILIARY:v.shiftKey?this._state=u.SECONDARY:this._state=u.MAIN:v.button==1?(v.preventDefault(),this._state=u.AUXILIARY):v.button==2&&(this._state=u.SECONDARY),this.pointer_x=v.clientX-F.left,this.pointer_y=v.clientY-F.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{M=i.MINIMAP;let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);$(W)}},ee=v=>{if(ie(!1),F)if(this.pointer_x=v.clientX-F.left,this.pointer_y=v.clientY-F.top,M===i.MINIMAP){let j=this.scene.getNormalisedMinimapCoordinates(this.renderer,v);if(j){let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);$(W)}}else this._state===r.NONE&&Z!==void 0&&Z.move(this,v.clientX,v.clientY,this.renderer)},re=v=>{this._state=r.NONE,M==i.MINIMAP&&(M=i.DEFAULT),Z!==void 0&&this.pointer_x_start==v.clientX-F.left&&this.pointer_y_start==v.clientY-F.top&&Z.pick(this,v.clientX,v.clientY,this.renderer)},H=v=>{this._state=r.NONE},ue=v=>{ie(!1);const j=v.touches.length;if(j==1)this._state=r.TOUCH_ROTATE,this.pointer_x=v.touches[0].clientX-(F==null?void 0:F.left),this.pointer_y=v.touches[0].clientY-(F==null?void 0:F.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(j==2){this._state=r.TOUCH_ZOOM;const W=v.touches[0].clientX-v.touches[1].clientX,J=v.touches[0].clientY-v.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(W*W+J*J)}else j==3&&(this._state=r.TOUCH_PAN,this.targetTouchId=v.touches[0].identifier,this.pointer_x=v.touches[0].clientX-(F==null?void 0:F.left),this.pointer_y=v.touches[0].clientY-(F==null?void 0:F.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ne=v=>{v.preventDefault(),v.stopPropagation();const j=v.touches.length;if(j==1)this.pointer_x=v.touches[0].clientX-F.left,this.pointer_y=v.touches[0].clientY-F.top;else if(j==2){if(this._state===r.TOUCH_ZOOM){const W=v.touches[0].clientX-v.touches[1].clientX,J=v.touches[0].clientY-v.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(W*W+J*J)}}else if(j==3&&this._state===r.TOUCH_PAN)for(let W=0;W<3;W++)v.touches[W].identifier==this.targetTouchId&&(this.pointer_x=v.touches[0].clientX-F.left,this.pointer_y=v.touches[0].clientY-F.top)},te=v=>{const j=v.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=r.NONE,j==1&&Z!==void 0&&this.pointer_x_start==v.touches[0].clientX-F.left&&this.pointer_y_start==v.touches[0].clientY-F.top&&Z.pick(this.cameraObject,v.touches[0].clientX,v.touches[0].clientY,this.renderer)},X=()=>{ie(!0)},ie=v=>{if(v||F===void 0){const j=new IntersectionObserver(W=>{for(const J of W)F=J.boundingClientRect;j.disconnect()});j.observe(this.domElement)}},ae=v=>{ie(!1),this._state=r.SCROLL;let j=0;v.deltaY>0?j=this.zoomRate:v.deltaY<0&&(j=this.zoomRate*-1),I=I+j,v.preventDefault(),v.stopImmediatePropagation()},Te=v=>{ie(!1);let j=0;if(v.keyCode===a.EQUAL||v.keyCode===a.MINUS||v.keyCode===a.NUMPADADD||v.keyCode===a.NUMPADSUBTRACT){this._state=r.KEYBOARD_ZOOM;let W=1;v.shiftKey&&(W=W*2),v.keyCode===a.EQUAL||v.keyCode===a.NUMPADADD?j=this.zoomRate*W*-1:(v.keyCode===a.MINUS||v.keyCode===a.NUMPADSUBTRACT)&&(j=this.zoomRate*W),I=I+j}else(v.keyCode===a.ARROWLEFT||v.keyCode===a.ARROWUP||v.keyCode===a.ARROWRIGHT||v.keyCode===a.ARROWDOWN)&&(v.shiftKey?(this._state=r.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,j=this.rotateRate):(this._state=r.KEYBOARD_PAN,j=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,v.keyCode===a.ARROWLEFT?this.pointer_x=this.pointer_x-j:v.keyCode===a.ARROWUP?this.pointer_y=this.pointer_y-j:v.keyCode===a.ARROWRIGHT?this.pointer_x=this.pointer_x+j:v.keyCode===a.ARROWDOWN&&(this.pointer_y=this.pointer_y+j));Object.values(a).includes(v.keyCode)&&v.preventDefault()},oe=v=>{this._state=r.NONE},Ne=()=>{if(typeof this.cameraObject<"u"){const v=F.height,j=this.cameraObject.position.distanceTo(this.cameraObject.target);let W=0;this.cameraObject.far>this.cameraObject.near&&j>=this.cameraObject.near&&j<=this.cameraObject.far&&(W=(j-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),T.set(this.previous_pointer_x,v-this.previous_pointer_y,0),L.set(this.previous_pointer_x,v-this.previous_pointer_y,1),x.set(this.pointer_x,v-this.pointer_y,0),O.set(this.pointer_x,v-this.pointer_y,1),T.unproject(this.cameraObject),L.unproject(this.cameraObject),x.unproject(this.cameraObject),O.unproject(this.cameraObject);const J=-.002;x.sub(T).multiplyScalar(1-W),O.sub(L).multiplyScalar(W),x.add(O).multiplyScalar(J),$(x)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(v,j)=>{v.normalize(),V.copy(this.cameraObject.position).sub(this.cameraObject.target),p.copy(V),V.normalize(),.8<Math.abs(V.dot(v))&&V.copy(this.cameraObject.up),T.crossVectors(v,V).normalize(),L.crossVectors(v,T);const W=v.dot(p),J=T.dot(p),he=L.dot(p),le=v.dot(this.cameraObject.up),pe=T.dot(this.cameraObject.up),ce=L.dot(this.cameraObject.up),me=Math.cos(j),ve=Math.sin(j);return x.set(me*T.x+ve*L.x,me*T.y+ve*L.y,me*T.z+ve*L.z),O.set(me*L.x-ve*T.x,me*L.y-ve*T.y,me*L.z-ve*T.z),V.copy(this.cameraObject.target),V.x=V.x+v.x*W+x.x*J+O.x*he,V.y=V.y+v.y*W+x.y*J+O.y*he,V.z=V.z+v.z*W+x.z*J+O.z*he,z.set(v.x*le+x.x*pe+O.x*ce,v.y*le+x.y*pe+O.y*ce,v.z*le+x.z*pe+O.z*ce),{position:V,up:z}},this.rotateAboutLookAtpoint=(v,j)=>{const W=this.getVectorsFromRotateAboutLookAtPoints(v,j);this.cameraObject.position.copy(W.position),this.updateDirectionalLight(),this.cameraObject.up.copy(W.up)};const Si=()=>{if(typeof this.cameraObject<"u"){const v=F==null?void 0:F.width,j=F==null?void 0:F.height;if(0<v&&0<j){const W=.25*(v+j);let J=0,he=0;(D===o.FREE||D===o.HORIZONTAL)&&(J=this.pointer_x-this.previous_pointer_x),(D===o.FREE||D===o.VERTICAL)&&(he=this.previous_pointer_y-this.pointer_y);const le=Math.sqrt(J*J+he*he);if(le>0){const pe=-he*1/le,ce=J*1/le;let me=0;D===o.FREE&&pe*(this.pointer_x-.5*(v-1))+ce*(.5*(j-1)-this.pointer_y);const ve=Math.acos(me/W)-.5*Math.PI,We=this.tumble_rate*le/W;z.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),T.copy(this.cameraObject.up).normalize(),L.copy(T).cross(z).normalize().multiplyScalar(pe),T.multiplyScalar(ce),P.addVectors(L,T).multiplyScalar(Math.cos(ve)),z.multiplyScalar(Math.sin(ve)),P.add(z),this.rotateAboutLookAtpoint(P,-We)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},Ci=()=>{let v=0;return this._state===r.ZOOM?v=this.previous_pointer_y-this.pointer_y:this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM?v=I:(v=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),v};this.changeZoomByScrollRateUnit=v=>{const j=v*this.zoomRate;this.changeZoomByValue(j)},this.changeZoomByValue=v=>{if(typeof this.cameraObject<"u"){const j=F.height,W=this.cameraObject.position.clone();W.sub(this.cameraObject.target);const J=W.length(),he=1.5*v/j,le=J*he;J+le>.01&&(W.normalize(),y.copy(this.cameraObject.position),y.x+=W.x*le,y.y+=W.y*le,y.z+=W.z*le,K()&&(this.cameraObject.position.copy(y),this.updateDirectionalLight(),q(),C=!0))}};const Ds=()=>{const v=Ci();this.changeZoomByValue(v),this._state===r.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(I=0,this._state=r.NONE)};this.setDirectionalLight=v=>{this.directionalLight=v},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){l=!0,this.domElement&&this.domElement.addEventListener&&(E(this.domElement,0),this.domElement.addEventListener("mousedown",Q,!1),this.domElement.addEventListener("mousemove",ee,!1),this.domElement.addEventListener("mouseup",re,!1),this.domElement.addEventListener("mouseleave",H,!1),this.domElement.addEventListener("touchstart",ue,!1),this.domElement.addEventListener("touchmove",ne,!1),this.domElement.addEventListener("touchend",te,!1),this.domElement.addEventListener("wheel",ae,!1),this.domElement.addEventListener("mouseenter",X,!1),this.domElement.addEventListener("contextmenu",v=>{v.preventDefault()},!1),this.domElement.addEventListener("keydown",Te,!1),this.domElement.addEventListener("keyup",oe,!1))},this.disable=function(){l=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",Q,!1),this.domElement.removeEventListener("mousemove",ee,!1),this.domElement.removeEventListener("mouseup",re,!1),this.domElement.removeEventListener("mouseleave",H,!1),this.domElement.removeEventListener("touchstart",ue,!1),this.domElement.removeEventListener("touchmove",ne,!1),this.domElement.removeEventListener("touchend",te,!1),this.domElement.removeEventListener("wheel",ae,!1),this.domElement.removeEventListener("mouseenter",X,!1),this.domElement.removeEventListener("contextmenu",v=>{v.preventDefault()},!1),this.domElement.removeEventListener("keydown",Te,!1),this.domElement.removeEventListener("keyup",oe,!1),E(this.domElement,-1))},this.loadPath=v=>{d=v.CameraPath,h=v.NumberOfPoints},this.loadPathURL=(v,j)=>{const W=new XMLHttpRequest;W.onreadystatechange=()=>{if(W.readyState==4&&W.status==200){const he=JSON.parse(W.responseText);this.loadPath(he),j!=null&&typeof j=="function"&&j()}};const J=ye(v);W.open("GET",J,!0),W.send()},this.setPathDuration=v=>{f=v,_&&_.setDuration(f),N&&N.setDuration(f)},this.getPlayRate=()=>A,this.setPlayRate=v=>{A=v};const Fs=v=>{let j=c+v;j>f&&(j=j-f),c=j};this.getTime=()=>c,this.setTime=v=>{v>f?c=f:v<0?c=0:c=v},this.getNumberOfTimeFrame=()=>h,this.getCurrentTimeFrame=()=>{if(h>2){const v=c/f*(h-1),j=Math.floor(v),W=1-(v-j),J=Math.ceil(v);return j==J?j==h-1?[j-1,J,0]:[j,J+1,1]:[j,J,W]}else if(h==1)return[0,0,0]},this.setCurrentTimeFrame=v=>{h>2&&(c=f*v/(h-1),c<0&&(c=0),c>f&&(c=f))};const Oi=v=>{if(M===i.PATH&&(Fs(v),d)){const j=this.getCurrentTimeFrame(),W=j[0],J=j[1],he=j[2],le=[d[W*3],d[W*3+1],d[W*3+2]],pe=[d[J*3],d[J*3+1],d[J*3+2]],ce=[];for(let me=0;me<le.length;me++)ce.push(he*le[me]+(1-he)*pe[me]);this.cameraObject.position.set(ce[0],ce[1],ce[2]),this.cameraObject.target.set(pe[0],pe[1],pe[2]),b&&this.cameraObject.lookAt(this.cameraObject.target),m&&(this.directionalLight.position.set(ce[0],ce[1],ce[2]),this.directionalLight.target.position.set(pe[0],pe[1],pe[2]))}};this.calculatePathNow=()=>{Oi(0)};const Gs=()=>{this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Si():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?(Ne(),k.triggerCallback()):(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(k.zoom(Ci()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(this._state=r.NONE),I=0,k.triggerCallback())};this.update=v=>{const j=v*A;let W=l,J=!0;return M===i.PATH?Oi(j):M===i.SMOOTH_CAMERA_TRANSITION&&_?(_.update(j),_.isTransitionCompleted()&&(M=i.DEFAULT),W=!1):M===i.ROTATE_CAMERA_TRANSITION&&N?(N.update(j),N.isTransitionCompleted()&&(M=i.DEFAULT),W=!1):M===i.AUTO_TUMBLE&&U?U.update(j):M===i.SYNC_CONTROL&&k?(Gs(),W=!1):J=!1,W&&(this._state!==r.NONE&&(J=!0),this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Si():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?Ne():(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&Ds(),this._state!==r.NONE&&M===i.AUTO_TUMBLE&&U&&U.stopOnCameraInput,this._state===r.SCROLL&&(this._state=r.NONE)),b?(J=!0,b.update()):this.cameraObject.lookAt(this.cameraObject.target),J=J||C,C=!1,J},this.playPath=()=>{M=i.PATH},this.stopPath=()=>{M=i.DEFAULT},this.isPlayingPath=()=>M===i.PATH,this.enableDirectionalLightUpdateWithPath=v=>{m=v},this.enableDeviceOrientation=()=>{b||(b=new ts(this.cameraObject))},this.disableDeviceOrientation=()=>{b&&(b.dispose(),b=void 0)},this.isDeviceOrientationEnabled=()=>!!b,this.resetView=()=>{const v=G[g];this.cameraObject.near=v.nearPlane,this.cameraObject.far=v.farPlane,this.cameraObject.position.set(v.eyePosition[0],v.eyePosition[1],v.eyePosition[2]),this.cameraObject.target.set(v.targetPosition[0],v.targetPosition[1],v.targetPosition[2]),this.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=v=>{v.nearPlane&&(this.cameraObject.near=v.nearPlane),v.farPlane&&(this.cameraObject.far=v.farPlane),v.eyePosition&&this.cameraObject.position.set(v.eyePosition[0],v.eyePosition[1],v.eyePosition[2]),v.targetPosition&&this.cameraObject.target.set(v.targetPosition[0],v.targetPosition[1],v.targetPosition[2]),v.upVector&&this.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),C=!0},this.getViewportFromCentreAndRadius=(v,j,W,J,he,le)=>{z.copy(this.cameraObject.position),z.sub(this.cameraObject.target),z.normalize();const pe=[v,j,W],ce=J/Math.tan(he*Math.PI/360),me=[v+z.x*ce,j+z.y*ce,W+z.z*ce],ve=ce+le;let We=0;const Ti=.95;le>Ti*ce?We=(1-Ti)*ce:We=ce-le;const Ie=new Re;return Ie.nearPlane=We,Ie.farPlane=ve,Ie.eyePosition=me,Ie.targetPosition=pe,Ie.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],Ie},this.getViewportFromBoundingBox=(v,j)=>{const W=v.min.distanceTo(v.max)/2*j,J=(v.min.x+v.max.x)/2,he=(v.min.y+v.max.y)/2,le=(v.min.z+v.max.z)/2;return this.getViewportFromCentreAndRadius(J,he,le,W,40,W*4)},this.getCurrentViewport=()=>{const v=new Re;return v.nearPlane=this.cameraObject.near,v.farPlane=this.cameraObject.far,v.eyePosition[0]=this.cameraObject.position.x,v.eyePosition[1]=this.cameraObject.position.y,v.eyePosition[2]=this.cameraObject.position.z,v.targetPosition[0]=this.cameraObject.target.x,v.targetPosition[1]=this.cameraObject.target.y,v.targetPosition[2]=this.cameraObject.target.z,v.upVector[0]=this.cameraObject.up.x,v.upVector[1]=this.cameraObject.up.y,v.upVector[2]=this.cameraObject.up.z,v},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(v,j,W)=>{N==null&&(_=new Ht(v,j,this,W))},this.rotateCameraTransition=(v,j,W)=>{_==null&&(N=new es(v,j,this,W))},this.enableCameraTransition=()=>{_&&(M=i.SMOOTH_CAMERA_TRANSITION),N&&(M=i.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{M=i.DEFAULT},this.stopCameraTransition=()=>{M=i.DEFAULT,_=void 0,N=void 0},this.isTransitioningCamera=()=>M===i.SMOOTH_CAMERA_TRANSITION||M===i.ROTATE_CAMERA_TRANSITION,this.autoTumble=(v,j,W)=>{U=new ti(v,j,W,this)},this.enableAutoTumble=()=>{M=i.AUTO_TUMBLE},this.stopAutoTumble=()=>{M=i.DEFAULT,U=void 0},this.updateAutoTumble=()=>{U&&(U.requireUpdate=!0)},this.isAutoTumble=()=>M===i.AUTO_TUMBLE,this.enableRaycaster=(v,j,W)=>{Z==null&&(Z=new ei(v,this.scene,j,W,this.renderer))},this.disableRaycaster=()=>{Z.disable(),Z=void 0},this.isSyncControl=()=>currentMpde===i.SYNC_CONTROL,this.enableSyncControl=()=>(M=i.SYNC_CONTROL,k||(k=new is),k.setCurrentCameraSettings(this.cameraObject,G[g]),k),this.disableSyncControl=()=>{M=i.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},Ht=function(n,e,t,s){const i=n.eyePosition,r=n.targetPosition,o=n.upVector,a=e.eyePosition,u=e.targetPosition,f=e.upVector,l=t;let c=s,d=0,h=!1;l.near=Math.min(n.nearPlane,e.nearPlane),l.far=Math.max(n.farPlane,e.farPlane),l.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.setDuration=b=>{c=b};const m=b=>{let g=d+b;g>c&&(g=c),d=g},A=()=>{const b=d/c,g=[i[0]*(1-b)+a[0]*b,i[1]*(1-b)+a[1]*b,i[2]*(1-b)+a[2]*b],M=[r[0]*(1-b)+u[0]*b,r[1]*(1-b)+u[1]*b,r[2]*(1-b)+u[2]*b];o[0]*(1-b)+f[0]*b,o[1]*(1-b)+f[1]*b,o[2]*(1-b)+f[2]*b,l.cameraObject.position.set(g[0],g[1],g[2]),l.cameraObject.target.set(M[0],M[1],M[2])};this.update=b=>{this.enabled!==!1&&(m(b),A(),d==c&&(h=!0))},this.isTransitionCompleted=()=>h},es=function(n,e,t,s){const i=n,r=e,o=t;let a=s,u=0,f=!1;this.setDuration=c=>{a=c};const l=c=>{const d=u;let h=u+c;h>a&&(h=a),u=h;const b=(u-d)/a*r;o.rotateAboutLookAtpoint(i,b)};this.update=c=>{this.enabled!==!1&&(l(c),u==a&&(f=!0))},this.isTransitionCompleted=()=>f},ei=function(n,e,t,s,i){const r=n,o=e,a=i,u=t,f=s,l=new S.Raycaster;l.params.Line.threshold=.1,l.params.Points.threshold=1;const c=new S.Vector2;let d=!1,h=new Date,m=!1,A=0,b=new Array,g={zincCamera:void 0,x:-1,y:-1},M;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=U=>{if(o!==r){const D=r.getThreeJSScene();a.render(D,U.cameraObject)}let I=M||r.getPickableThreeJSObjects();return b.length=0,l.intersectObjects(I,!0,b)},this.setPickableObjects=U=>{U===void 0?M=void 0:(M=[],U.forEach(I=>{I.getGroup()&&I.getGroup().visible&&M.push(I.getGroup())}))},this.getIntersectsObjectWithOrigin=(U,I,D)=>(l.set(I,D),this.getIntersectsObject(U)),this.getIntersectsObjectWithCamera=(U,I,D)=>(U.getNDCFromDocumentCoords(I,D,c),l.setFromCamera(c,U.cameraObject),this.getIntersectsObject(U)),this.pick=(U,I,D)=>{if(a&&r&&U&&u){this.getIntersectsObjectWithCamera(U,I,D);const Z=b.length;for(let F=0;F<Z;F++){let z=b[F].object?b[F].object.userData:void 0;if(z&&z.isMarkerCluster&&z.visible&&z.clusterIsVisible(b[F].object.clusterIndex)&&z.zoomToCluster(b[F].object.clusterIndex))return}u(b,I,D)}};let _=(U,I,D)=>{if(a&&r&&U&&f){if(this.getIntersectsObjectWithCamera(U,I,D),h.setTime(Date.now()),b.length===0){if(m)return;m=!0}else m=!1;f(b,I,D)}};this.move=(U,I,D)=>{a&&r&&U&&f&&(r.displayMarkers?_(U,I,D):(g.zincCamera=U,g.x=I,g.y=D,d||(A=h?Date.now()-h.getTime():250,A>=250?_(U,I,D):(d=!0,setTimeout(N(g),A)))))};let N=U=>function(){d=!1,_(U.zincCamera,U.x,U.y)}},ti=function(n,e,t,s){const i=new S.Vector3,r=-e,o=s,a=n;this.stopOnCameraInput=t,this.requireUpdate=!0;const u=new S.Vector3,f=new S.Vector3,l=c=>{const d=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=Math.abs(c[0])*4,m=Math.abs(c[1])*4,A=.25*(h+m),b=-c[1]/d,g=c[0]/d;let M=b*c[0]+g*-c[1];M>A?M=A:M<-A&&(M=-A);const _=Math.acos(M/A)-.5*Math.PI;i.copy(o.cameraObject.position).sub(o.cameraObject.target).normalize(),u.copy(o.cameraObject.up).normalize(),f.crossVectors(u,i).normalize().multiplyScalar(b),u.multiplyScalar(g),u.add(f).multiplyScalar(Math.cos(_)),i.multiplyScalar(Math.sin(_)).add(u)};this.update=c=>{this.enabled!==!1&&(this.requireUpdate&&(l(a),this.requireUpdate=!1),o.rotateAboutLookAtpoint(i,r*c/1e3))}},ii=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new S.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new S.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(ii.prototype,{update:(()=>{let n,e,t,s,i,r;const o=new S.Matrix4,a=new S.Matrix4;return function(f){if(n!==f.focus||e!==f.fov||t!==f.aspect*this.aspect||s!==f.near||i!==f.far||r!==f.zoom){n=f.focus,e=f.fov,t=f.aspect*this.aspect,s=f.near,i=f.far,r=f.zoom;const c=f.projectionMatrix.clone(),d=.064/2,h=d*s/n,m=s*Math.tan(S.Math.DEG2RAD*e*.5)/f.zoom;let A,b;a.elements[12]=-d,o.elements[12]=d,A=-m*t+h,b=m*t+h,c.elements[0]=2*s/(b-A),c.elements[8]=(b+A)/(b-A),this.cameraL.projectionMatrix.copy(c),A=-m*t-h,b=m*t-h,c.elements[0]=2*s/(b-A),c.elements[8]=(b+A)/(b-A),this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(f.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(f.matrixWorld).multiply(o)}})()});const si=function(n){const e=new ii;e.aspect=.5,this.setSize=(t,s)=>{n.setSize(t,s)},this.render=(t,s)=>{t.updateMatrixWorld(),s.parent===null&&s.updateMatrixWorld(),e.update(s);const i=n.getSize();n.setScissorTest(!0),n.clear(),n.setScissor(0,0,i.width/2,i.height),n.setViewport(0,0,i.width/2,i.height),n.render(t,e.cameraL),n.setScissor(i.width/2,0,i.width/2,i.height),n.setViewport(i.width/2,0,i.width/2,i.height),n.render(t,e.cameraR),n.setScissorTest(!1)}},ts=function(n){const e=this;this.object=n,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;const t=r=>{e.deviceOrientation=r},s=()=>{typeof window<"u"&&(e.screenOrientation=window.orientation||0)},i=(()=>{const r=new S.Vector3(0,0,1),o=new S.Euler,a=new S.Quaternion,u=new S.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(f,l,c,d,h)=>{const m=new S.Vector3(0,0,1);m.subVectors(f.target,f.position),o.set(c,l,-d,"YXZ");const A=new S.Quaternion;A.setFromEuler(o),A.multiply(u),A.multiply(a.setFromAxisAngle(r,-h)),m.applyQuaternion(A),m.addVectors(f.position,m),f.lookAt(m)}})();this.connect=()=>{s(),typeof window<"u"&&(window.addEventListener("orientationchange",s,!1),window.addEventListener("deviceorientation",t,!1)),e.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",s,!1),window.removeEventListener("deviceorientation",t,!1)),e.enabled=!1},this.update=()=>{if(e.enabled===!1)return;const r=e.deviceOrientation.alpha?S.Math.degToRad(e.deviceOrientation.alpha):0,o=e.deviceOrientation.beta?S.Math.degToRad(e.deviceOrientation.beta):0,a=e.deviceOrientation.gamma?S.Math.degToRad(e.deviceOrientation.gamma):0,u=e.screenOrientation?S.Math.degToRad(e.screenOrientation):0;i(e.object,r,o,a,u)},this.dispose=function(){this.disconnect()},this.connect()},is=function(){let n,e,t;const s=new S.Vector3,i=new S.Vector3,r=new S.Vector3,o=new S.Vector3;let a;this.setCurrentCameraSettings=(u,f)=>{this.near_plane_fly_debt==0,n=u.clone(),e=u,t=f,n.near=t.nearPlane,t.farPlane&&(n.far=t.farPlane),t.eyePosition&&n.position.set(t.eyePosition[0],t.eyePosition[1],t.eyePosition[2]),t.upVector&&n.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),t.targetPosition&&(n.target=new S.Vector3(t.targetPosition[0],t.targetPosition[1],t.targetPosition[2]),n.lookAt(n.target)),n.updateProjectionMatrix(),s.copy(n.position).project(n),i.copy(n.target).project(n)},this.getCurrentPosition=()=>(i.copy(e.target).project(n),[i.x,i.y]),this.zoom=u=>{let f=u*.002,l=Math.max(e.zoom-f,1);e.zoom=l,e.updateProjectionMatrix()},this.zoomToBox=(u,f)=>{u.getCenter(r),r.project(n),this.setCenterZoom([r.x,r.y],f)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:e.zoom}),this.setCenterZoom=(u,f)=>{r.set(u[0],u[1],i.z).unproject(n),o.copy(r).sub(e.target),e.target.copy(r),e.lookAt(e.target),e.position.add(o),e.zoom=f,e.updateProjectionMatrix()},this.setEventCallback=u=>{(u===void 0||typeof u=="function")&&(a=u)},this.triggerCallback=()=>{a!==void 0&&typeof a=="function"&&a()}},ss="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,165,0);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ri=new Image(128,128);ri.src=ss;const et=new S.Texture;et.image=ri,et.needsUpdate=!0;const bt=[.02,.03,1],rs=new S.SpriteMaterial({map:et,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),ni=function(n){Y.call(this),this.texture=et;let e,t=n;this.morph=new S.Group,this.group=this.morph,this.isMarkerCluster=!0;let s=!0,i=[];this.markers={};let r=new S.Vector2,o=new S.Vector2,a=.1,u=Date.now();this.setSpriteSize=h=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(h)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};const f=h=>{const m=new S.Group,A=new S.Sprite(rs);return A.clusterIndex=h,A.center.set(.5,0),A.position.set(0,0,0),A.renderOrder=1e4,A.scale.set(bt[0],bt[1],bt[2]),A.userData=this,m.add(A),this.group.add(m),{group:m,marker:A,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},l=(h,m,A)=>{h.group.visible=!0,h.group.position.set(m.coords[0],m.coords[1],m.coords[2]),(h.label===void 0||A!==h.number)&&(h.label&&(h.group.remove(h.label),h.label.material.map.dispose(),h.label.material.dispose()),h.label=ot(A,.012,"black","Asap",120,700),h.number=A,h.group.add(h.label)),h.min=m.min,h.max=m.max},c=h=>{let m=0;for(h.forEach(A=>{const b=A.members.length;let g=0;b===1?A.members[0].setVisibility(!0):(A.members.forEach(M=>{g+=M.getNumber(),M.setVisibility(!1)}),i[m]||i.push(f(m)),l(i[m],A,g),m++)}),m;m<i.length;m++)i[m].group.visible=!1},d=(h,m)=>{let A=!0,b={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},g=0;for(let M in h)A?(r.set(h[M].ndc.x,h[M].ndc.y),this._b1.setFromPoints([h[M].morph.position]),A=!1,b.members.push(h[M]),b.coords=[h[M].morph.position.x,h[M].morph.position.y,h[M].morph.position.z],m.push(b),delete h[M]):(o.set(h[M].ndc.x,h[M].ndc.y),g=r.distanceTo(o),a>g&&(b.members.push(h[M]),this._b1.expandByPoint(h[M].morph.position),delete h[M]));b.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],b.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],A!==!0&&d(h,m)};this.calculate=()=>{if(s&&Date.now()-u>500){let m=[];d({...this.markers},m),c(m),u=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>s,this.enable=()=>{s=!0,this.morph.visible=!0},this.disable=()=>{var h;s=!1,this.morph.visible=!1;for(let m in this.markers)(h=this.markers[m])!=null&&h.isMarker&&this.markers[m].isEnabled()&&this.markers[m].setVisibility(!0)},this.zoomToCluster=h=>h!==void 0&&h>-1&&(this._v1.set(...i[h].min),this._v2.set(...i[h].max),Math.abs(this._v1.distanceTo(this._v2)>0))?(this._b1.set(this._v1,this._v2),t.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0):!1,this.clusterIsVisible=h=>{var m;return h!==void 0&&h>-1&&i[h]?(m=i[h].group)==null?void 0:m.visible:!1}};ni.prototype=Object.create(Y.prototype);const ns=function(n){let e=n;this.camera=new S.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;let t=new S.BufferGeometry;var s=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]);let i=new S.BufferAttribute(s,3);t.setAttribute("position",i);var r=new S.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new S.Mesh(t,r);let o=new S.Box3,a=new S.Vector3;this.getDiffFromNormalised=(f,l)=>{o.setFromBufferAttribute(i).getCenter(a);let c=a.clone().project(this.camera);return new S.Vector3(f,l,c.z).unproject(this.camera).sub(a)};let u=(f,l)=>{e.camera.near&&(this.camera.near=e.camera.near),l.farPlane&&(this.camera.far=l.farPlane),l.eyePosition&&this.camera.position.set(l.eyePosition[0],l.eyePosition[1],l.eyePosition[2]),l.upVector&&this.camera.up.set(l.upVector[0],l.upVector[1],l.upVector[2]),l.targetPosition&&this.camera.lookAt(new S.Vector3(l.targetPosition[0],l.targetPosition[1],l.targetPosition[2])),this.camera.zoom=1/f,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{let f=new S.Vector3().copy(e.camera.target).project(e.camera),l=new S.Vector3(-1,-1,f.z).unproject(e.camera),c=new S.Vector3(1,-1,f.z).unproject(e.camera),d=new S.Vector3(1,1,f.z).unproject(e.camera),h=new S.Vector3(-1,1,f.z).unproject(e.camera),m=[l,c,d,d,h,l];i.copyVector3sArray(m),i.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();let f=e.getZincCameraControls(),l=e.getBoundingBox();if(l){const c=l.min.distanceTo(l.max),d=c/2,h=(l.min.x+l.max.x)/2,m=(l.min.y+l.max.y)/2,A=(l.min.z+l.max.z)/2,g=f.getViewportFromCentreAndRadius(h,m,A,d,40,d*4);u(c,g)}}},oi=new w.Box3,tt=new w.Vector3;class xt extends w.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(s),this.setAttribute("position",new w.Float32BufferAttribute(e,3)),this.setAttribute("uv",new w.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,s=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),s.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new w.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new w.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceEnd",new w.InterleavedBufferAttribute(s,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new w.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new w.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceColorEnd",new w.InterleavedBufferAttribute(s,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new w.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;if(t.isGeometry){console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.");return}else t.isBufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new w.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),oi.setFromBufferAttribute(t),this.boundingBox.union(oi))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new w.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const s=this.boundingSphere.center;this.boundingBox.getCenter(s);let i=0;for(let r=0,o=e.count;r<o;r++)tt.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(tt)),tt.fromBufferAttribute(t,r),i=Math.max(i,s.distanceToSquared(tt));this.boundingSphere.radius=Math.sqrt(i),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(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}xt.prototype.isLineSegmentsGeometry=!0,w.UniformsLib.line={linewidth:{value:1},resolution:{value:new w.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},w.ShaderLib.line={uniforms:w.UniformsUtils.merge([w.UniformsLib.common,w.UniformsLib.fog,w.UniformsLib.line]),vertexShader:`
|
|
68
|
+
`,ts=function(){return{brightness:{value:0},contrast:{value:1},depth:{value:1},discardAlpha:{value:!0},diffuse0:{value:void 0},diffuse1:{value:void 0},direction:{value:1},flipY:{value:!0},flipZ:{value:!1},nChannels:{value:1},mask:{value:void 0},maskEnabled:{value:!1},slide:{value:new S.Vector3(0,0,1)},time:{value:0}}},ke=function(n){Y.call(this),this.isTexturePrimitive=!0,this.texture=n,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(e,t,s)=>{if(e&&e.images&&e.images.source){const i=new yt,r=[];e.images.source.forEach(a=>{r.push(ye(a))});const o=this;i.loadFromImages(r).then(()=>{o.texture=i,o.textureList.push(this.texture),o.initialise(e,t)})}},this.addTextureArray=e=>{this.textureList.length===0&&this.texture&&this.textureList.push(this.texture),e&&e.isTextureArray&&this.textureList.push(e)},this.initialise=(e,t)=>{t!=null&&typeof t=="function"&&t(this)}};ke.prototype=Object.create(Y.prototype),ke.prototype.constructor=ke;const Ee=function(n){ke.call(this,n),this.isTextureSlides=!0;const e=[],t={};this.morph=new S.Group,this.group=this.morph,this.morph.userData=this;let s,i=!0,r=!1,o=0,a=1,u=1,f,l=!1,c=!0,d=0,h=0,m=-.1;this.createSlides=g=>{g.forEach(M=>this.createSlide(M))};const A=(g,M)=>{const _=g.material,N=_.uniforms;switch(g.rotation.x=0,g.rotation.y=0,g.rotation.z=0,g.position.x=0,g.position.y=0,g.position.z=0,M.direction){case"x":const U=-Math.PI/2;g.rotation.y=U,N.direction.value=1,N.slide.value.set(M.value,0,0),g.position.x=M.value;break;case"y":g.rotation.x=Math.PI/2,N.direction.value=2,N.slide.value.set(0,M.value,0),g.position.y=M.value;break;case"z":N.direction.value=3,N.slide.value.set(0,0,M.value),g.position.z=M.value;break}_.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=g=>{g&&g.id&&g.id in t&&t[g.id]&&A(t[g.id],g)},this.createSlide=g=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&g&&g.direction&&g.value!==void 0){const M=new S.PlaneGeometry(1,1);M.translate(.5,.5,0);const _=ts();_.brightness.value=o,_.contrast.value=a,_.diffuse0.value=this.texture.impl,_.diffuse1.value=this.texture.impl,_.discardAlpha.value=c,_.depth.value=this.texture.size.depth,_.flipY.value=i,_.flipZ.value=r,_.mask.value=f,_.maskEnabled.value=l,_.nChannels.value=u;const N={fs:Hi,vs:es,uniforms:_,glslVersion:$i,side:S.DoubleSide,transparent:!1},U=this.texture.getMaterial(N);U.needsUpdate=!0;const I=new S.Mesh(M,U);I.name=this.groupName,I.userData=this;const D={value:g.value,direction:g.direction,id:I.id};return e.push(D),A(I,D),t[I.id]=I,this.morph.add(I),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),D}},this.getTextureSettings=()=>[...e],this.getTextureSettingsWithId=g=>{for(let M=0;M<e.length;M++)if(g===e[M].id)return{...e[M]}},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=g=>{g&&this.removeSlideWithId(g.id)},this.removeSlideWithId=g=>{if(this.morph&&g in t&&t[g]){if(this.morph.getObjectById(g)){const _=t[g];this.morph.remove(_),_.clear(),_.geometry&&_.geometry.dispose(),_.material&&_.material.dispose(),this.boundingBoxUpdateRequired=!0}const M=e.findIndex(_=>_.id===g);M>-1&&e.splice(M,1)}},this.dispose=()=>{this.morph.children.forEach(g=>{g.geometry&&g.geometry.dispose(),g.material&&g.material.dispose()}),ke.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};const b=(g,M,_)=>{if(M)switch(M.direction.value){case 1:_.copy(M.slide.value),g.expandByPoint(_),_.setY(1),_.setZ(1),g.expandByPoint(_);break;case 2:_.copy(M.slide.value),g.expandByPoint(_),_.setX(1),_.setZ(1),g.expandByPoint(_);break;case 3:_.copy(M.slide.value),g.expandByPoint(_),_.setX(1),_.setY(1),g.expandByPoint(_);break}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();const g=new S.Vector3(0,0,0);this.morph.children.forEach(M=>{b(this.cachedBoundingBox,M.material.uniforms,g)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(g,M,_)=>{const N=new S.Matrix4;N.set(g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,0,0,0,0);const U=new S.Quaternion().setFromRotationMatrix(N);this.morph.position.set(...M),this.morph.quaternion.copy(U),this.morph.scale.set(..._),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=g=>{this.morph.renderOrder=g},this.initialise=(g,M)=>{if(g){const _=g.locations;_&&_.length>0&&(this.applyTransformation(_[0].orientation,_[0].position,_[0].scale),"flipY"in _[0]&&(i=_[0].flipY),"flipZ"in _[0]&&(r=_[0].flipZ)),this.createSlides(g.settings.slides),M!=null&&typeof M=="function"&&M(this)}},this.showEdges=g=>{if(s)s.material.color=g;else{const M=new S.BoxGeometry(1,1,1);M.translate(.5,.5,.5);const _=new S.EdgesGeometry(M);s=new S.LineSegments(_,new S.LineBasicMaterial({color:g})),this.group.add(s)}s.visible=!0},this.setUniformsValue=(g,M)=>{this.morph.children.forEach(_=>{const N=_.material;if(N.type==="ShaderMaterial"){const U=N.uniforms;U[g].value=M,N.needsUpdate=!0}})},this.isAlphaPixelDiscarded=()=>c,this.discardAlphaPixel=g=>{c=g,this.setUniformsValue("discardAlpha",c)},this.getBrightness=()=>o,this.setBrightness=g=>{o=g,this.setUniformsValue("brightness",o)},this.getContrast=()=>a,this.setContrast=g=>{a>=0&&(a=g,this.setUniformsValue("contrast",a))},this.getNumberOfChannels=()=>u,this.setNumberOfChannels=g=>{u=g,this.setUniformsValue("nChannels",u)},this.getMask=()=>f,this.setMask=g=>{f=g,this.setUniformsValue("mask",f),this.setUniformsValue("maskEnabled",!!f)},this.hideEdges=()=>{s&&(s.visible=!1)},this.updateTimeTexture=()=>{const g=this.textureList.length-1,M=this.inbuildTime/this.duration;if(this.timeEnabled&&g>0&&m!==M){const _=M*g,N=Math.floor(_),U=Math.ceil(_),I=_-N;this.morph.children.forEach(D=>{const Z=D.material;if(Z.type==="ShaderMaterial"){const F=Z.uniforms;d!==N&&(F.diffuse0.value=this.textureList[N].impl),h!==U&&(F.diffuse1.value=this.textureList[U].impl),F.time.value=I,Z.needsUpdate=!0}}),d=N,h=U,m=M}},this.setMorphTime=g=>{let M=g;g>this.duration?M=this.duration:0>g?M=0:M=g,M!=this.inbuildTime&&(this.inbuildTime=M,this.updateTimeTexture())},this.render=(g,M,_)=>{if(M==!0&&this.timeEnabled&&this.textureList.length>1){let N=this.inbuildTime+g;N>this.duration&&(N=N-this.duration),this.inbuildTime=N,this.updateTimeTexture()}}};Ee.prototype=Object.create(ke.prototype),Ee.prototype.constructor=Ee;const Re=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];const n=this;this.setFromObject=({nearPlane:e,farPlane:t,eyePosition:s,targetPosition:i,upVector:r})=>{n.nearPlane=e,n.farPlane=t,n.eyePosition=s,n.targetPosition=i,n.upVector=r}},Ht=function(n,e,t,s){const i={DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,MINIMAP:5,SYNC_CONTROL:6},r={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},o={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},u={};u.MAIN=r.ROTATE,u.AUXILIARY=r.ZOOM,u.SECONDARY=r.PAN,this.cameraObject=n,this.domElement=e!==void 0?e:document,this.renderer=t,this.scene=s,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;let f=6e3,l=!0,c=0,d,h,m=!1,A=500,b,g="default",M=i.DEFAULT,_,N,U,I=0,D=o.FREE;this._state=r.NONE;let Z;this.targetTouchId=-1;let F;const z=new S.Vector3,T=new S.Vector3,L=new S.Vector3,x=new S.Vector3,O=new S.Vector3,P=new S.Vector3,V=new S.Vector3,p=new S.Vector3,B=new S.Sphere,y=new S.Vector3;let C=!1,k,R=0;const G={default:new Re};G.default.nearPlane=.1,G.default.farPlane=2e3,G.default.eyePosition=[0,0,0],G.default.targetPosition=[0,0,-1],G.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new S.Vector3(...G.default.targetPosition)),this.calculateMaxAllowedDistance=v=>{const j=v.getBoundingBox();if(j){j.getBoundingSphere(B),R=B.radius*6;let W=0;this.cameraObject&&(W=this.cameraObject.position.distanceTo(B.center)),R=W>R?W*1.5:R}else R=0};const q=v=>{z.copy(this.cameraObject.position);const W=z.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,W*.001),this.cameraObject.far=this.cameraObject.near*1e4};this.addViewport=(v,j)=>{v&&j&&(G[v]=j)},this.setDefaultViewport=v=>v&&v in G?(g=v,!0):!1,this.getDefaultViewport=()=>g,this.getViewportOfName=v=>G[v],this.setCurrentViewport=v=>v in G?(this.setCurrentCameraSettings(G[v]),!0):!1,this.setRotationMode=v=>{switch(v){case"none":D=o.NONE;break;case"horizontal":D=o.HORIZONTAL;break;case"vertical":D=o.VERTICAL;break;case"free":default:D=o.FREE}},this.onResize=()=>{F&&(F=void 0),k&&k.setCurrentCameraSettings(this.cameraObject,G[g])},this.getVisibleHeightAtZDepth=v=>{const j=this.cameraObject.position.distanceTo(this.cameraObject.target);v<j?v-=j:v+=j;const W=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(W/2)*Math.abs(v)},this.calculateHeightPerPixelAtZeroDepth=v=>{const j=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=j/v,this.pixelHeight},this.getNDCFromDocumentCoords=(v,j,W)=>{ie(!1);const J=W||new S.Vector2,he=(v-F.left)/F.width*2-1,le=-((j-F.top)/F.height)*2+1;return J.set(he,le)},this.getRelativeCoordsFromNDC=(v,j,W)=>{ie(!1);const J=W||new S.Vector2;return J.x=(v+1)*F.width/2,J.y=(1-j)*F.height/2,J},this.setMouseButtonAction=(v,j)=>{u[v]=r[j]};const E=(v,j)=>{v instanceof HTMLCanvasElement&&(v.tabIndex=j)},K=()=>{if(R>0){const v=y.distanceTo(B.center);return R>v||this.cameraObject.position.distanceTo(B.center)>v}return!0},$=v=>{y.copy(this.cameraObject.position).add(v),K()&&(this.cameraObject.target.add(v),this.cameraObject.position.add(v),this.updateDirectionalLight())},Q=v=>{ie(!1);let j;if(M===i.DEFAULT&&(j=this.scene.getNormalisedMinimapCoordinates(this.renderer,v)),!j)v.button==0?v.ctrlKey?this._state=u.AUXILIARY:v.shiftKey?this._state=u.SECONDARY:this._state=u.MAIN:v.button==1?(v.preventDefault(),this._state=u.AUXILIARY):v.button==2&&(this._state=u.SECONDARY),this.pointer_x=v.clientX-F.left,this.pointer_y=v.clientY-F.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{M=i.MINIMAP;let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);$(W)}},ee=v=>{if(ie(!1),F)if(this.pointer_x=v.clientX-F.left,this.pointer_y=v.clientY-F.top,M===i.MINIMAP){let j=this.scene.getNormalisedMinimapCoordinates(this.renderer,v);if(j){let W=this.scene.getMinimapDiffFromNormalised(j.x,j.y);$(W)}}else this._state===r.NONE&&Z!==void 0&&Z.move(this,v.clientX,v.clientY,this.renderer)},re=v=>{this._state=r.NONE,M==i.MINIMAP&&(M=i.DEFAULT),Z!==void 0&&this.pointer_x_start==v.clientX-F.left&&this.pointer_y_start==v.clientY-F.top&&Z.pick(this,v.clientX,v.clientY,this.renderer)},H=v=>{this._state=r.NONE},ue=v=>{ie(!1);const j=v.touches.length;if(j==1)this._state=r.TOUCH_ROTATE,this.pointer_x=v.touches[0].clientX-(F==null?void 0:F.left),this.pointer_y=v.touches[0].clientY-(F==null?void 0:F.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(j==2){this._state=r.TOUCH_ZOOM;const W=v.touches[0].clientX-v.touches[1].clientX,J=v.touches[0].clientY-v.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(W*W+J*J)}else j==3&&(this._state=r.TOUCH_PAN,this.targetTouchId=v.touches[0].identifier,this.pointer_x=v.touches[0].clientX-(F==null?void 0:F.left),this.pointer_y=v.touches[0].clientY-(F==null?void 0:F.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ne=v=>{v.preventDefault(),v.stopPropagation();const j=v.touches.length;if(j==1)this.pointer_x=v.touches[0].clientX-F.left,this.pointer_y=v.touches[0].clientY-F.top;else if(j==2){if(this._state===r.TOUCH_ZOOM){const W=v.touches[0].clientX-v.touches[1].clientX,J=v.touches[0].clientY-v.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(W*W+J*J)}}else if(j==3&&this._state===r.TOUCH_PAN)for(let W=0;W<3;W++)v.touches[W].identifier==this.targetTouchId&&(this.pointer_x=v.touches[0].clientX-F.left,this.pointer_y=v.touches[0].clientY-F.top)},te=v=>{const j=v.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=r.NONE,j==1&&Z!==void 0&&this.pointer_x_start==v.touches[0].clientX-F.left&&this.pointer_y_start==v.touches[0].clientY-F.top&&Z.pick(this.cameraObject,v.touches[0].clientX,v.touches[0].clientY,this.renderer)},X=()=>{ie(!0)},ie=v=>{if(v||F===void 0){const j=new IntersectionObserver(W=>{for(const J of W)F=J.boundingClientRect;j.disconnect()});j.observe(this.domElement)}},ae=v=>{ie(!1),this._state=r.SCROLL;let j=0;v.deltaY>0?j=this.zoomRate:v.deltaY<0&&(j=this.zoomRate*-1),I=I+j,v.preventDefault(),v.stopImmediatePropagation()},Le=v=>{ie(!1);let j=0;if(v.keyCode===a.EQUAL||v.keyCode===a.MINUS||v.keyCode===a.NUMPADADD||v.keyCode===a.NUMPADSUBTRACT){this._state=r.KEYBOARD_ZOOM;let W=1;v.shiftKey&&(W=W*2),v.keyCode===a.EQUAL||v.keyCode===a.NUMPADADD?j=this.zoomRate*W*-1:(v.keyCode===a.MINUS||v.keyCode===a.NUMPADSUBTRACT)&&(j=this.zoomRate*W),I=I+j}else(v.keyCode===a.ARROWLEFT||v.keyCode===a.ARROWUP||v.keyCode===a.ARROWRIGHT||v.keyCode===a.ARROWDOWN)&&(v.shiftKey?(this._state=r.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,j=this.rotateRate):(this._state=r.KEYBOARD_PAN,j=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,v.keyCode===a.ARROWLEFT?this.pointer_x=this.pointer_x-j:v.keyCode===a.ARROWUP?this.pointer_y=this.pointer_y-j:v.keyCode===a.ARROWRIGHT?this.pointer_x=this.pointer_x+j:v.keyCode===a.ARROWDOWN&&(this.pointer_y=this.pointer_y+j));Object.values(a).includes(v.keyCode)&&v.preventDefault()},oe=v=>{this._state=r.NONE},Ne=()=>{if(typeof this.cameraObject<"u"){const v=F.height,j=this.cameraObject.position.distanceTo(this.cameraObject.target);let W=0;this.cameraObject.far>this.cameraObject.near&&j>=this.cameraObject.near&&j<=this.cameraObject.far&&(W=(j-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),T.set(this.previous_pointer_x,v-this.previous_pointer_y,0),L.set(this.previous_pointer_x,v-this.previous_pointer_y,1),x.set(this.pointer_x,v-this.pointer_y,0),O.set(this.pointer_x,v-this.pointer_y,1),T.unproject(this.cameraObject),L.unproject(this.cameraObject),x.unproject(this.cameraObject),O.unproject(this.cameraObject);const J=-.002;x.sub(T).multiplyScalar(1-W),O.sub(L).multiplyScalar(W),x.add(O).multiplyScalar(J),$(x)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(v,j)=>{v.normalize(),V.copy(this.cameraObject.position).sub(this.cameraObject.target),p.copy(V),V.normalize(),.8<Math.abs(V.dot(v))&&V.copy(this.cameraObject.up),T.crossVectors(v,V).normalize(),L.crossVectors(v,T);const W=v.dot(p),J=T.dot(p),he=L.dot(p),le=v.dot(this.cameraObject.up),pe=T.dot(this.cameraObject.up),ce=L.dot(this.cameraObject.up),me=Math.cos(j),ve=Math.sin(j);return x.set(me*T.x+ve*L.x,me*T.y+ve*L.y,me*T.z+ve*L.z),O.set(me*L.x-ve*T.x,me*L.y-ve*T.y,me*L.z-ve*T.z),V.copy(this.cameraObject.target),V.x=V.x+v.x*W+x.x*J+O.x*he,V.y=V.y+v.y*W+x.y*J+O.y*he,V.z=V.z+v.z*W+x.z*J+O.z*he,z.set(v.x*le+x.x*pe+O.x*ce,v.y*le+x.y*pe+O.y*ce,v.z*le+x.z*pe+O.z*ce),{position:V,up:z}},this.rotateAboutLookAtpoint=(v,j)=>{const W=this.getVectorsFromRotateAboutLookAtPoints(v,j);this.cameraObject.position.copy(W.position),this.updateDirectionalLight(),this.cameraObject.up.copy(W.up)};const Ci=()=>{if(typeof this.cameraObject<"u"){const v=F==null?void 0:F.width,j=F==null?void 0:F.height;if(0<v&&0<j){const W=.25*(v+j);let J=0,he=0;(D===o.FREE||D===o.HORIZONTAL)&&(J=this.pointer_x-this.previous_pointer_x),(D===o.FREE||D===o.VERTICAL)&&(he=this.previous_pointer_y-this.pointer_y);const le=Math.sqrt(J*J+he*he);if(le>0){const pe=-he*1/le,ce=J*1/le;let me=0;D===o.FREE&&pe*(this.pointer_x-.5*(v-1))+ce*(.5*(j-1)-this.pointer_y);const ve=Math.acos(me/W)-.5*Math.PI,We=this.tumble_rate*le/W;z.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),T.copy(this.cameraObject.up).normalize(),L.copy(T).cross(z).normalize().multiplyScalar(pe),T.multiplyScalar(ce),P.addVectors(L,T).multiplyScalar(Math.cos(ve)),z.multiplyScalar(Math.sin(ve)),P.add(z),this.rotateAboutLookAtpoint(P,-We)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},Oi=()=>{let v=0;return this._state===r.ZOOM?v=this.previous_pointer_y-this.pointer_y:this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM?v=I:(v=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),v};this.changeZoomByScrollRateUnit=v=>{const j=v*this.zoomRate;this.changeZoomByValue(j)},this.changeZoomByValue=v=>{if(typeof this.cameraObject<"u"){const j=F.height,W=this.cameraObject.position.clone();W.sub(this.cameraObject.target);const J=W.length(),he=1.5*v/j,le=J*he;J+le>.01&&(W.normalize(),y.copy(this.cameraObject.position),y.x+=W.x*le,y.y+=W.y*le,y.z+=W.z*le,K()&&(this.cameraObject.position.copy(y),this.updateDirectionalLight(),q(),C=!0))}};const Gs=()=>{const v=Oi();this.changeZoomByValue(v),this._state===r.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(I=0,this._state=r.NONE)};this.setDirectionalLight=v=>{this.directionalLight=v},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){l=!0,this.domElement&&this.domElement.addEventListener&&(E(this.domElement,0),this.domElement.addEventListener("mousedown",Q,!1),this.domElement.addEventListener("mousemove",ee,!1),this.domElement.addEventListener("mouseup",re,!1),this.domElement.addEventListener("mouseleave",H,!1),this.domElement.addEventListener("touchstart",ue,!1),this.domElement.addEventListener("touchmove",ne,!1),this.domElement.addEventListener("touchend",te,!1),this.domElement.addEventListener("wheel",ae,!1),this.domElement.addEventListener("mouseenter",X,!1),this.domElement.addEventListener("contextmenu",v=>{v.preventDefault()},!1),this.domElement.addEventListener("keydown",Le,!1),this.domElement.addEventListener("keyup",oe,!1))},this.disable=function(){l=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",Q,!1),this.domElement.removeEventListener("mousemove",ee,!1),this.domElement.removeEventListener("mouseup",re,!1),this.domElement.removeEventListener("mouseleave",H,!1),this.domElement.removeEventListener("touchstart",ue,!1),this.domElement.removeEventListener("touchmove",ne,!1),this.domElement.removeEventListener("touchend",te,!1),this.domElement.removeEventListener("wheel",ae,!1),this.domElement.removeEventListener("mouseenter",X,!1),this.domElement.removeEventListener("contextmenu",v=>{v.preventDefault()},!1),this.domElement.removeEventListener("keydown",Le,!1),this.domElement.removeEventListener("keyup",oe,!1),E(this.domElement,-1))},this.loadPath=v=>{d=v.CameraPath,h=v.NumberOfPoints},this.loadPathURL=(v,j)=>{const W=new XMLHttpRequest;W.onreadystatechange=()=>{if(W.readyState==4&&W.status==200){const he=JSON.parse(W.responseText);this.loadPath(he),j!=null&&typeof j=="function"&&j()}};const J=ye(v);W.open("GET",J,!0),W.send()},this.setPathDuration=v=>{f=v,_&&_.setDuration(f),N&&N.setDuration(f)},this.getPlayRate=()=>A,this.setPlayRate=v=>{A=v};const js=v=>{let j=c+v;j>f&&(j=j-f),c=j};this.getTime=()=>c,this.setTime=v=>{v>f?c=f:v<0?c=0:c=v},this.getNumberOfTimeFrame=()=>h,this.getCurrentTimeFrame=()=>{if(h>2){const v=c/f*(h-1),j=Math.floor(v),W=1-(v-j),J=Math.ceil(v);return j==J?j==h-1?[j-1,J,0]:[j,J+1,1]:[j,J,W]}else if(h==1)return[0,0,0]},this.setCurrentTimeFrame=v=>{h>2&&(c=f*v/(h-1),c<0&&(c=0),c>f&&(c=f))};const Ti=v=>{if(M===i.PATH&&(js(v),d)){const j=this.getCurrentTimeFrame(),W=j[0],J=j[1],he=j[2],le=[d[W*3],d[W*3+1],d[W*3+2]],pe=[d[J*3],d[J*3+1],d[J*3+2]],ce=[];for(let me=0;me<le.length;me++)ce.push(he*le[me]+(1-he)*pe[me]);this.cameraObject.position.set(ce[0],ce[1],ce[2]),this.cameraObject.target.set(pe[0],pe[1],pe[2]),b&&this.cameraObject.lookAt(this.cameraObject.target),m&&(this.directionalLight.position.set(ce[0],ce[1],ce[2]),this.directionalLight.target.position.set(pe[0],pe[1],pe[2]))}};this.calculatePathNow=()=>{Ti(0)};const Es=()=>{this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Ci():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?(Ne(),k.triggerCallback()):(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(k.zoom(Oi()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&(this._state=r.NONE),I=0,k.triggerCallback())};this.update=v=>{const j=v*A;let W=l,J=!0;return M===i.PATH?Ti(j):M===i.SMOOTH_CAMERA_TRANSITION&&_?(_.update(j),_.isTransitionCompleted()&&(M=i.DEFAULT),W=!1):M===i.ROTATE_CAMERA_TRANSITION&&N?(N.update(j),N.isTransitionCompleted()&&(M=i.DEFAULT),W=!1):M===i.AUTO_TUMBLE&&U?U.update(j):M===i.SYNC_CONTROL&&k?(Es(),W=!1):J=!1,W&&(this._state!==r.NONE&&(J=!0),this._state===r.ROTATE||this._state===r.TOUCH_ROTATE||this._state===r.KEYBOARD_ROTATE?Ci():this._state===r.PAN||this._state===r.TOUCH_PAN||this._state===r.KEYBOARD_PAN?Ne():(this._state===r.ZOOM||this._state===r.TOUCH_ZOOM||this._state===r.SCROLL||this._state===r.KEYBOARD_ZOOM)&&Gs(),this._state!==r.NONE&&M===i.AUTO_TUMBLE&&U&&U.stopOnCameraInput,this._state===r.SCROLL&&(this._state=r.NONE)),b?(J=!0,b.update()):this.cameraObject.lookAt(this.cameraObject.target),J=J||C,C=!1,J},this.playPath=()=>{M=i.PATH},this.stopPath=()=>{M=i.DEFAULT},this.isPlayingPath=()=>M===i.PATH,this.enableDirectionalLightUpdateWithPath=v=>{m=v},this.enableDeviceOrientation=()=>{b||(b=new ss(this.cameraObject))},this.disableDeviceOrientation=()=>{b&&(b.dispose(),b=void 0)},this.isDeviceOrientationEnabled=()=>!!b,this.resetView=()=>{const v=G[g];this.cameraObject.near=v.nearPlane,this.cameraObject.far=v.farPlane,this.cameraObject.position.set(v.eyePosition[0],v.eyePosition[1],v.eyePosition[2]),this.cameraObject.target.set(v.targetPosition[0],v.targetPosition[1],v.targetPosition[2]),this.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=v=>{v.nearPlane&&(this.cameraObject.near=v.nearPlane),v.farPlane&&(this.cameraObject.far=v.farPlane),v.eyePosition&&this.cameraObject.position.set(v.eyePosition[0],v.eyePosition[1],v.eyePosition[2]),v.targetPosition&&this.cameraObject.target.set(v.targetPosition[0],v.targetPosition[1],v.targetPosition[2]),v.upVector&&this.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),C=!0},this.getViewportFromCentreAndRadius=(v,j,W,J,he,le)=>{z.copy(this.cameraObject.position),z.sub(this.cameraObject.target),z.normalize();const pe=[v,j,W],ce=J/Math.tan(he*Math.PI/360),me=[v+z.x*ce,j+z.y*ce,W+z.z*ce],ve=ce+le;let We=0;const Li=.95;le>Li*ce?We=(1-Li)*ce:We=ce-le;const Ie=new Re;return Ie.nearPlane=We,Ie.farPlane=ve,Ie.eyePosition=me,Ie.targetPosition=pe,Ie.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],Ie},this.getViewportFromBoundingBox=(v,j)=>{const W=v.min.distanceTo(v.max)/2*j,J=(v.min.x+v.max.x)/2,he=(v.min.y+v.max.y)/2,le=(v.min.z+v.max.z)/2;return this.getViewportFromCentreAndRadius(J,he,le,W,40,W*4)},this.getCurrentViewport=()=>{const v=new Re;return v.nearPlane=this.cameraObject.near,v.farPlane=this.cameraObject.far,v.eyePosition[0]=this.cameraObject.position.x,v.eyePosition[1]=this.cameraObject.position.y,v.eyePosition[2]=this.cameraObject.position.z,v.targetPosition[0]=this.cameraObject.target.x,v.targetPosition[1]=this.cameraObject.target.y,v.targetPosition[2]=this.cameraObject.target.z,v.upVector[0]=this.cameraObject.up.x,v.upVector[1]=this.cameraObject.up.y,v.upVector[2]=this.cameraObject.up.z,v},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(v,j,W)=>{N==null&&(_=new ei(v,j,this,W))},this.rotateCameraTransition=(v,j,W)=>{_==null&&(N=new is(v,j,this,W))},this.enableCameraTransition=()=>{_&&(M=i.SMOOTH_CAMERA_TRANSITION),N&&(M=i.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{M=i.DEFAULT},this.stopCameraTransition=()=>{M=i.DEFAULT,_=void 0,N=void 0},this.isTransitioningCamera=()=>M===i.SMOOTH_CAMERA_TRANSITION||M===i.ROTATE_CAMERA_TRANSITION,this.autoTumble=(v,j,W)=>{U=new ii(v,j,W,this)},this.enableAutoTumble=()=>{M=i.AUTO_TUMBLE},this.stopAutoTumble=()=>{M=i.DEFAULT,U=void 0},this.updateAutoTumble=()=>{U&&(U.requireUpdate=!0)},this.isAutoTumble=()=>M===i.AUTO_TUMBLE,this.enableRaycaster=(v,j,W)=>{Z==null&&(Z=new ti(v,this.scene,j,W,this.renderer))},this.disableRaycaster=()=>{Z.disable(),Z=void 0},this.isSyncControl=()=>currentMpde===i.SYNC_CONTROL,this.enableSyncControl=()=>(M=i.SYNC_CONTROL,k||(k=new rs),k.setCurrentCameraSettings(this.cameraObject,G[g]),k),this.disableSyncControl=()=>{M=i.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},ei=function(n,e,t,s){const i=n.eyePosition,r=n.targetPosition,o=n.upVector,a=e.eyePosition,u=e.targetPosition,f=e.upVector,l=t;let c=s,d=0,h=!1;l.near=Math.min(n.nearPlane,e.nearPlane),l.far=Math.max(n.farPlane,e.farPlane),l.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.setDuration=b=>{c=b};const m=b=>{let g=d+b;g>c&&(g=c),d=g},A=()=>{const b=d/c,g=[i[0]*(1-b)+a[0]*b,i[1]*(1-b)+a[1]*b,i[2]*(1-b)+a[2]*b],M=[r[0]*(1-b)+u[0]*b,r[1]*(1-b)+u[1]*b,r[2]*(1-b)+u[2]*b];o[0]*(1-b)+f[0]*b,o[1]*(1-b)+f[1]*b,o[2]*(1-b)+f[2]*b,l.cameraObject.position.set(g[0],g[1],g[2]),l.cameraObject.target.set(M[0],M[1],M[2])};this.update=b=>{this.enabled!==!1&&(m(b),A(),d==c&&(h=!0))},this.isTransitionCompleted=()=>h},is=function(n,e,t,s){const i=n,r=e,o=t;let a=s,u=0,f=!1;this.setDuration=c=>{a=c};const l=c=>{const d=u;let h=u+c;h>a&&(h=a),u=h;const b=(u-d)/a*r;o.rotateAboutLookAtpoint(i,b)};this.update=c=>{this.enabled!==!1&&(l(c),u==a&&(f=!0))},this.isTransitionCompleted=()=>f},ti=function(n,e,t,s,i){const r=n,o=e,a=i,u=t,f=s,l=new S.Raycaster;l.params.Line.threshold=.1,l.params.Points.threshold=1;const c=new S.Vector2;let d=!1,h=new Date,m=!1,A=0,b=new Array,g={zincCamera:void 0,x:-1,y:-1},M;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=U=>{if(o!==r){const D=r.getThreeJSScene();a.render(D,U.cameraObject)}let I=M||r.getPickableThreeJSObjects();return b.length=0,l.intersectObjects(I,!0,b)},this.setPickableObjects=U=>{U===void 0?M=void 0:(M=[],U.forEach(I=>{I.getGroup()&&I.getGroup().visible&&M.push(I.getGroup())}))},this.getIntersectsObjectWithOrigin=(U,I,D)=>(l.set(I,D),this.getIntersectsObject(U)),this.getIntersectsObjectWithCamera=(U,I,D)=>(U.getNDCFromDocumentCoords(I,D,c),l.setFromCamera(c,U.cameraObject),this.getIntersectsObject(U)),this.pick=(U,I,D)=>{if(a&&r&&U&&u){this.getIntersectsObjectWithCamera(U,I,D);const Z=b.length;for(let F=0;F<Z;F++){let z=b[F].object?b[F].object.userData:void 0;if(z&&z.isMarkerCluster&&z.visible&&z.clusterIsVisible(b[F].object.clusterIndex)&&z.zoomToCluster(b[F].object.clusterIndex))return}u(b,I,D)}};let _=(U,I,D)=>{if(a&&r&&U&&f){if(this.getIntersectsObjectWithCamera(U,I,D),h.setTime(Date.now()),b.length===0){if(m)return;m=!0}else m=!1;f(b,I,D)}};this.move=(U,I,D)=>{a&&r&&U&&f&&(r.displayMarkers?_(U,I,D):(g.zincCamera=U,g.x=I,g.y=D,d||(A=h?Date.now()-h.getTime():250,A>=250?_(U,I,D):(d=!0,setTimeout(N(g),A)))))};let N=U=>function(){d=!1,_(U.zincCamera,U.x,U.y)}},ii=function(n,e,t,s){const i=new S.Vector3,r=-e,o=s,a=n;this.stopOnCameraInput=t,this.requireUpdate=!0;const u=new S.Vector3,f=new S.Vector3,l=c=>{const d=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=Math.abs(c[0])*4,m=Math.abs(c[1])*4,A=.25*(h+m),b=-c[1]/d,g=c[0]/d;let M=b*c[0]+g*-c[1];M>A?M=A:M<-A&&(M=-A);const _=Math.acos(M/A)-.5*Math.PI;i.copy(o.cameraObject.position).sub(o.cameraObject.target).normalize(),u.copy(o.cameraObject.up).normalize(),f.crossVectors(u,i).normalize().multiplyScalar(b),u.multiplyScalar(g),u.add(f).multiplyScalar(Math.cos(_)),i.multiplyScalar(Math.sin(_)).add(u)};this.update=c=>{this.enabled!==!1&&(this.requireUpdate&&(l(a),this.requireUpdate=!1),o.rotateAboutLookAtpoint(i,r*c/1e3))}},si=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new S.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new S.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(si.prototype,{update:(()=>{let n,e,t,s,i,r;const o=new S.Matrix4,a=new S.Matrix4;return function(f){if(n!==f.focus||e!==f.fov||t!==f.aspect*this.aspect||s!==f.near||i!==f.far||r!==f.zoom){n=f.focus,e=f.fov,t=f.aspect*this.aspect,s=f.near,i=f.far,r=f.zoom;const c=f.projectionMatrix.clone(),d=.064/2,h=d*s/n,m=s*Math.tan(S.Math.DEG2RAD*e*.5)/f.zoom;let A,b;a.elements[12]=-d,o.elements[12]=d,A=-m*t+h,b=m*t+h,c.elements[0]=2*s/(b-A),c.elements[8]=(b+A)/(b-A),this.cameraL.projectionMatrix.copy(c),A=-m*t-h,b=m*t-h,c.elements[0]=2*s/(b-A),c.elements[8]=(b+A)/(b-A),this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(f.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(f.matrixWorld).multiply(o)}})()});const ri=function(n){const e=new si;e.aspect=.5,this.setSize=(t,s)=>{n.setSize(t,s)},this.render=(t,s)=>{t.updateMatrixWorld(),s.parent===null&&s.updateMatrixWorld(),e.update(s);const i=n.getSize();n.setScissorTest(!0),n.clear(),n.setScissor(0,0,i.width/2,i.height),n.setViewport(0,0,i.width/2,i.height),n.render(t,e.cameraL),n.setScissor(i.width/2,0,i.width/2,i.height),n.setViewport(i.width/2,0,i.width/2,i.height),n.render(t,e.cameraR),n.setScissorTest(!1)}},ss=function(n){const e=this;this.object=n,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;const t=r=>{e.deviceOrientation=r},s=()=>{typeof window<"u"&&(e.screenOrientation=window.orientation||0)},i=(()=>{const r=new S.Vector3(0,0,1),o=new S.Euler,a=new S.Quaternion,u=new S.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(f,l,c,d,h)=>{const m=new S.Vector3(0,0,1);m.subVectors(f.target,f.position),o.set(c,l,-d,"YXZ");const A=new S.Quaternion;A.setFromEuler(o),A.multiply(u),A.multiply(a.setFromAxisAngle(r,-h)),m.applyQuaternion(A),m.addVectors(f.position,m),f.lookAt(m)}})();this.connect=()=>{s(),typeof window<"u"&&(window.addEventListener("orientationchange",s,!1),window.addEventListener("deviceorientation",t,!1)),e.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",s,!1),window.removeEventListener("deviceorientation",t,!1)),e.enabled=!1},this.update=()=>{if(e.enabled===!1)return;const r=e.deviceOrientation.alpha?S.Math.degToRad(e.deviceOrientation.alpha):0,o=e.deviceOrientation.beta?S.Math.degToRad(e.deviceOrientation.beta):0,a=e.deviceOrientation.gamma?S.Math.degToRad(e.deviceOrientation.gamma):0,u=e.screenOrientation?S.Math.degToRad(e.screenOrientation):0;i(e.object,r,o,a,u)},this.dispose=function(){this.disconnect()},this.connect()},rs=function(){let n,e,t;const s=new S.Vector3,i=new S.Vector3,r=new S.Vector3,o=new S.Vector3;let a;this.setCurrentCameraSettings=(u,f)=>{this.near_plane_fly_debt==0,n=u.clone(),e=u,t=f,n.near=t.nearPlane,t.farPlane&&(n.far=t.farPlane),t.eyePosition&&n.position.set(t.eyePosition[0],t.eyePosition[1],t.eyePosition[2]),t.upVector&&n.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),t.targetPosition&&(n.target=new S.Vector3(t.targetPosition[0],t.targetPosition[1],t.targetPosition[2]),n.lookAt(n.target)),n.updateProjectionMatrix(),s.copy(n.position).project(n),i.copy(n.target).project(n)},this.getCurrentPosition=()=>(i.copy(e.target).project(n),[i.x,i.y]),this.zoom=u=>{let f=u*.002,l=Math.max(e.zoom-f,1);e.zoom=l,e.updateProjectionMatrix()},this.zoomToBox=(u,f)=>{u.getCenter(r),r.project(n),this.setCenterZoom([r.x,r.y],f)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:e.zoom}),this.setCenterZoom=(u,f)=>{r.set(u[0],u[1],i.z).unproject(n),o.copy(r).sub(e.target),e.target.copy(r),e.lookAt(e.target),e.position.add(o),e.zoom=f,e.updateProjectionMatrix()},this.setEventCallback=u=>{(u===void 0||typeof u=="function")&&(a=u)},this.triggerCallback=()=>{a!==void 0&&typeof a=="function"&&a()}},ns="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,165,0);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ni=new Image(128,128);ni.src=ns;const et=new S.Texture;et.image=ni,et.needsUpdate=!0;const bt=[.02,.03,1],os=new S.SpriteMaterial({map:et,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),oi=function(n){Y.call(this),this.texture=et;let e,t=n;this.morph=new S.Group,this.group=this.morph,this.isMarkerCluster=!0;let s=!0,i=[];this.markers={};let r=new S.Vector2,o=new S.Vector2,a=.1,u=Date.now();this.setSpriteSize=h=>{e.scale.set(.015,.02,1),e.scale.multiplyScalar(h)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};const f=h=>{const m=new S.Group,A=new S.Sprite(os);return A.clusterIndex=h,A.center.set(.5,0),A.position.set(0,0,0),A.renderOrder=1e4,A.scale.set(bt[0],bt[1],bt[2]),A.userData=this,m.add(A),this.group.add(m),{group:m,marker:A,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},l=(h,m,A)=>{h.group.visible=!0,h.group.position.set(m.coords[0],m.coords[1],m.coords[2]),(h.label===void 0||A!==h.number)&&(h.label&&(h.group.remove(h.label),h.label.material.map.dispose(),h.label.material.dispose()),h.label=ot(A,.012,"black","Asap",120,700),h.number=A,h.group.add(h.label)),h.min=m.min,h.max=m.max},c=h=>{let m=0;for(h.forEach(A=>{const b=A.members.length;let g=0;b===1?A.members[0].setVisibility(!0):(A.members.forEach(M=>{g+=M.getNumber(),M.setVisibility(!1)}),i[m]||i.push(f(m)),l(i[m],A,g),m++)}),m;m<i.length;m++)i[m].group.visible=!1},d=(h,m)=>{let A=!0,b={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},g=0;for(let M in h)A?(r.set(h[M].ndc.x,h[M].ndc.y),this._b1.setFromPoints([h[M].morph.position]),A=!1,b.members.push(h[M]),b.coords=[h[M].morph.position.x,h[M].morph.position.y,h[M].morph.position.z],m.push(b),delete h[M]):(o.set(h[M].ndc.x,h[M].ndc.y),g=r.distanceTo(o),a>g&&(b.members.push(h[M]),this._b1.expandByPoint(h[M].morph.position),delete h[M]));b.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],b.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],A!==!0&&d(h,m)};this.calculate=()=>{if(s&&Date.now()-u>500){let m=[];d({...this.markers},m),c(m),u=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>s,this.enable=()=>{s=!0,this.morph.visible=!0},this.disable=()=>{var h;s=!1,this.morph.visible=!1;for(let m in this.markers)(h=this.markers[m])!=null&&h.isMarker&&this.markers[m].isEnabled()&&this.markers[m].setVisibility(!0)},this.zoomToCluster=h=>h!==void 0&&h>-1&&(this._v1.set(...i[h].min),this._v2.set(...i[h].max),Math.abs(this._v1.distanceTo(this._v2)>0))?(this._b1.set(this._v1,this._v2),t.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0):!1,this.clusterIsVisible=h=>{var m;return h!==void 0&&h>-1&&i[h]?(m=i[h].group)==null?void 0:m.visible:!1}};oi.prototype=Object.create(Y.prototype);const as=function(n){let e=n;this.camera=new S.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;let t=new S.BufferGeometry;var s=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]);let i=new S.BufferAttribute(s,3);t.setAttribute("position",i);var r=new S.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new S.Mesh(t,r);let o=new S.Box3,a=new S.Vector3;this.getDiffFromNormalised=(f,l)=>{o.setFromBufferAttribute(i).getCenter(a);let c=a.clone().project(this.camera);return new S.Vector3(f,l,c.z).unproject(this.camera).sub(a)};let u=(f,l)=>{e.camera.near&&(this.camera.near=e.camera.near),l.farPlane&&(this.camera.far=l.farPlane),l.eyePosition&&this.camera.position.set(l.eyePosition[0],l.eyePosition[1],l.eyePosition[2]),l.upVector&&this.camera.up.set(l.upVector[0],l.upVector[1],l.upVector[2]),l.targetPosition&&this.camera.lookAt(new S.Vector3(l.targetPosition[0],l.targetPosition[1],l.targetPosition[2])),this.camera.zoom=1/f,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{let f=new S.Vector3().copy(e.camera.target).project(e.camera),l=new S.Vector3(-1,-1,f.z).unproject(e.camera),c=new S.Vector3(1,-1,f.z).unproject(e.camera),d=new S.Vector3(1,1,f.z).unproject(e.camera),h=new S.Vector3(-1,1,f.z).unproject(e.camera),m=[l,c,d,d,h,l];i.copyVector3sArray(m),i.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();let f=e.getZincCameraControls(),l=e.getBoundingBox();if(l){const c=l.min.distanceTo(l.max),d=c/2,h=(l.min.x+l.max.x)/2,m=(l.min.y+l.max.y)/2,A=(l.min.z+l.max.z)/2,g=f.getViewportFromCentreAndRadius(h,m,A,d,40,d*4);u(c,g)}}},ai=new w.Box3,tt=new w.Vector3;class xt extends w.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],s=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(s),this.setAttribute("position",new w.Float32BufferAttribute(e,3)),this.setAttribute("uv",new w.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,s=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),s.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new w.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new w.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceEnd",new w.InterleavedBufferAttribute(s,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const s=new w.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new w.InterleavedBufferAttribute(s,3,0)),this.setAttribute("instanceColorEnd",new w.InterleavedBufferAttribute(s,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new w.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;if(t.isGeometry){console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.");return}else t.isBufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new w.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),ai.setFromBufferAttribute(t),this.boundingBox.union(ai))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new w.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const s=this.boundingSphere.center;this.boundingBox.getCenter(s);let i=0;for(let r=0,o=e.count;r<o;r++)tt.fromBufferAttribute(e,r),i=Math.max(i,s.distanceToSquared(tt)),tt.fromBufferAttribute(t,r),i=Math.max(i,s.distanceToSquared(tt));this.boundingSphere.radius=Math.sqrt(i),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(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}xt.prototype.isLineSegmentsGeometry=!0,w.UniformsLib.line={linewidth:{value:1},resolution:{value:new w.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},w.ShaderLib.line={uniforms:w.UniformsUtils.merge([w.UniformsLib.common,w.UniformsLib.fog,w.UniformsLib.line]),vertexShader:`
|
|
69
69
|
#include <common>
|
|
70
70
|
#include <color_pars_vertex>
|
|
71
71
|
#include <fog_pars_vertex>
|
|
@@ -284,9 +284,9 @@ void main() {
|
|
|
284
284
|
#include <fog_fragment>
|
|
285
285
|
#include <premultiplied_alpha_fragment>
|
|
286
286
|
|
|
287
|
-
}`};class vt extends w.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:w.UniformsUtils.clone(w.ShaderLib.line.uniforms),vertexShader:w.ShaderLib.line.vertexShader,fragmentShader:w.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}vt.prototype.isLineMaterial=!0;const ai=new w.Vector3,li=new w.Vector3,de=new w.Vector4,fe=new w.Vector4,Me=new w.Vector4,wt=new w.Vector3,At=new w.Matrix4,be=new w.Line3,ci=new w.Vector3,Ce=new w.Box3,it=new w.Sphere,_e=new w.Vector4;class hi extends w.Mesh{constructor(e=new xt,t=new vt({color:Math.random()*16777215})){super(e,t),this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,s=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,a=0,u=t.count;o<u;o++,a+=2)ai.fromBufferAttribute(t,o),li.fromBufferAttribute(s,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+ai.distanceTo(li);const r=new w.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new w.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new w.InterleavedBufferAttribute(r,1,1)),this}raycast(e,t){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0,i=e.ray,r=e.camera,o=r.projectionMatrix,a=this.matrixWorld,u=this.geometry,f=this.material,l=f.resolution,c=f.linewidth+s,d=u.attributes.instanceStart,h=u.attributes.instanceEnd,m=-r.near,A=2*Math.max(c/l.width,c/l.height);u.boundingSphere===null&&u.computeBoundingSphere(),it.copy(u.boundingSphere).applyMatrix4(a);const b=Math.max(r.near,it.distanceToPoint(i.origin));_e.set(0,0,-b,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const g=Math.abs(A/_e.w)*.5;if(it.radius+=g,e.ray.intersectsSphere(it)===!1)return;u.boundingBox===null&&u.computeBoundingBox(),Ce.copy(u.boundingBox).applyMatrix4(a);const M=Math.max(r.near,Ce.distanceToPoint(i.origin));_e.set(0,0,-M,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const _=Math.abs(A/_e.w)*.5;if(Ce.max.x+=_,Ce.max.y+=_,Ce.max.z+=_,Ce.min.x-=_,Ce.min.y-=_,Ce.min.z-=_,e.ray.intersectsBox(Ce)!==!1){i.at(1,Me),Me.w=1,Me.applyMatrix4(r.matrixWorldInverse),Me.applyMatrix4(o),Me.multiplyScalar(1/Me.w),Me.x*=l.x/2,Me.y*=l.y/2,Me.z=0,wt.copy(Me),At.multiplyMatrices(r.matrixWorldInverse,a);for(let U=0,I=d.count;U<I;U++){de.fromBufferAttribute(d,U),fe.fromBufferAttribute(h,U),de.w=1,fe.w=1,de.applyMatrix4(At),fe.applyMatrix4(At);var N=de.z>m&&fe.z>m;if(N)continue;if(de.z>m){const T=de.z-fe.z,L=(de.z-m)/T;de.lerp(fe,L)}else if(fe.z>m){const T=fe.z-de.z,L=(fe.z-m)/T;fe.lerp(de,L)}de.applyMatrix4(o),fe.applyMatrix4(o),de.multiplyScalar(1/de.w),fe.multiplyScalar(1/fe.w),de.x*=l.x/2,de.y*=l.y/2,fe.x*=l.x/2,fe.y*=l.y/2,be.start.copy(de),be.start.z=0,be.end.copy(fe),be.end.z=0;const D=be.closestPointToPointParameter(wt,!0);be.at(D,ci);const Z=w.MathUtils.lerp(de.z,fe.z,D),F=Z>=-1&&Z<=1,z=wt.distanceTo(ci)<c*.5;if(F&&z){be.start.fromBufferAttribute(d,U),be.end.fromBufferAttribute(h,U),be.start.applyMatrix4(a),be.end.applyMatrix4(a);const T=new w.Vector3,L=new w.Vector3;i.distanceSqToSegment(be.start,be.end,L,T),t.push({point:L,pointOnLine:T,distance:i.origin.distanceTo(L),object:this,face:null,faceIndex:U,uv:null,uv2:null})}}}}}hi.prototype.LineSegments2=!0;const st=function(){Ve.call(this),this.isLines2=!0;let n=new Array(300);this.createLineSegment=(e,t,s)=>{if(e&&t){const i=new xt;i.setPositions(e),i.colorsNeedUpdate=!0;const r=new hi(i,t);r.scale.set(1,1,1),r.computeLineDistances(),this.setMesh(r,s.localTimeEnabled,s.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(e){if(e&&e.length){let t=this.getMorph();t||(this.drawRange=0);let s=this.drawRange*3;if(e.forEach(i=>{n[s++]=i[0],n[s++]=i[1],n[s++]=i[2],this.drawRange++}),!t)for(;s<300;)n[s++]=e[0][0],n[s++]=e[0][1],n[s++]=e[0][2];t&&(t.geometry.setPositions(n),t.computeLineDistances(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return n},this.getVerticesByFaceIndex=function(e){let t=e*2*3;const s=this.getMorph();if(s&&this.drawRange*3>t){const i=s.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(e,t){if(e&&e.length){let s=this.getMorph();const i=t+e.length-1;if(!s||0>t||i>=this.drawRange)return;{let r=t*3;for(e.forEach(o=>{n[r++]=o[0],n[r++]=o[1],n[r++]=o[2]}),r=this.drawRange*3;r<300;)n[r++]=e[0][0],n[r++]=e[0][1],n[r++]=e[0][2];s.geometry.setPositions(n),s.computeLineDistances(),s.geometry.computeBoundingBox(),s.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}return n},this.addLines=(e,t)=>{if(e&&e.length>0){if(this.addVertices(e),!this.getMorph()){const i=new vt({color:t,linewidth:1,vertexColors:!1,worldUnits:!1});i.resolution.set(window.innerWidth,window.innerHeight);const r={localTimeEnabled:!1,localMorphColour:!1};this.createLineSegment(n,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=(e,t,s,i)=>{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};st.prototype=Object.create(Ve.prototype),st.prototype.constructor=st;let os=0;const as=function(){return"re"+os++};let ui=function(n,e){let t=n,s=new S.Group;s.matrixAutoUpdate=!1,s.userData=this;let i=[],r="",o=[],a=e;const u=new S.Matrix4;let f=3e3;u.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=as(),this.hideAllPrimitives=()=>{i.forEach(l=>l.hideAllPrimitives()),o.forEach(l=>l.setVisibility(!1))},this.showAllPrimitives=()=>{i.forEach(l=>l.showAllPrimitives()),o.forEach(l=>l.setVisibility(!0))},this.setVisibility=l=>{l!=s.visible&&(s.visible=l,this.pickableUpdateRequired=!0)},this.getVisibility=()=>s.visible,this.getGroup=()=>s,this.setTransformation=l=>{u.set(...l),s.matrix.copy(u),s.updateMatrixWorld()},this.setName=l=>{l&&l!==""&&(r=l)},this.getName=()=>r,this.getParent=()=>t,this.getFullSeparatedPath=()=>{const l=[];if(r!==""){l.push(r);for(let c=t;c!==void 0;){const d=c.getName();d!==""&&l.unshift(d),c=c.getParent()}}return l},this.getFullPath=()=>{const l=this.getFullSeparatedPath();if(l.length>0){let c=l.shift();return l.forEach(d=>{c=c.concat("/",d)}),c}return""},this.createChild=l=>{let c=new ui(this,a);return c.setName(l),i.push(c),s.add(c.getGroup()),c},this.getChildWithName=l=>{if(l){const c=l.toLowerCase();for(let d=0;d<i.length;d++)if(i[d].getName().toLowerCase()===c)return i[d]}},this.findChildFromSeparatedPath=l=>{if(l&&l.length>0&&l[0]===""&&l.shift(),l&&l.length>0){const c=this.getChildWithName(l[0]);return c?(l.shift(),c.findChildFromSeparatedPath(l)):void 0}return this},this.findChildFromPath=l=>{const c=l.split("/");return this.findChildFromSeparatedPath(c)},this.createChildFromSeparatedPath=l=>{if(l.length>0&&l[0]===""&&l.shift(),l.length>0){let c=this.getChildWithName(l[0]);return c||(c=this.createChild(l[0])),l.shift(),c.createChildFromSeparatedPath(l)}return this},this.createChildFromPath=l=>{const c=l.split("/");return this.createChildFromSeparatedPath(c)},this.findOrCreateChildFromPath=l=>{let c=this.findChildFromPath(l);return c||(c=this.createChildFromPath(l)),c},this.addZincObject=l=>{l&&(l.setRegion(this),s.add(l.getGroup()),o.push(l),this.pickableUpdateRequired=!0,a&&a.triggerObjectAddedCallback(l))},this.removeZincObject=l=>{for(let c=0;c<o.length;c++)if(l===o[c]){s.remove(l.getGroup()),o.splice(c,1),a&&a.triggerObjectRemovedCallback(l),l.dispose(),this.pickableUpdateRequired=!0;return}},this.checkPickableUpdateRequred=l=>{if(this.pickableUpdateRequired)return!0;if(l){let c=!1;for(let d=0;d<i.length;d++)if(c=i[d].checkPickableUpdateRequred(l),c)return!0}return!1},this.getPickableThreeJSObjects=(l,c)=>(s.visible&&(o.forEach(d=>{if(d.isPickable&&d.getGroup()&&d.getGroup().visible){let h=d.marker;h&&h.isEnabled()&&l.push(h.getMorph()),l.push(d.getGroup())}}),c&&i.forEach(d=>{d.getPickableThreeJSObjects(l,c)}),this.pickableUpdateRequired=!1),l),this.setDuration=l=>{f=l,o.forEach(c=>c.setDuration(l)),i.forEach(c=>c.setDuration(l))},this.getDuration=()=>f,this.getBoundingBox=l=>{let c,d;return o.forEach(h=>{d=h.getBoundingBox(),d&&(c==null?c=d.clone():c.union(d))}),l&&i.forEach(h=>{d=h.getBoundingBox(l),d&&(c==null?c=d.clone():c.union(d))}),c},this.clear=l=>{l&&i.forEach(c=>c.clear(l)),o.forEach(c=>{s.remove(c.getGroup()),c.dispose()}),i=[],o=[]},this.objectIsInRegion=(l,c)=>{for(let d=0;d<o.length;d++)if(l===o[d])return!0;if(c){for(let d=0;d<i.length;d++)if(i[d].objectIsInRegion(l,c))return!0}return!1},this.forEachGeometry=(l,c)=>{o.forEach(d=>{d.isGeometry&&l(d)}),c&&i.forEach(d=>d.forEachGeometry(l,c))},this.forEachGlyphset=(l,c)=>{o.forEach(d=>{d.isGlyphset&&l(d)}),c&&i.forEach(d=>d.forEachGlyphset(l,c))},this.forEachPointset=(l,c)=>{o.forEach(d=>{d.isPointset&&l(d)}),c&&i.forEach(d=>d.forEachPointset(l,c))},this.forEachLine=(l,c)=>{o.forEach(d=>{d.isLines&&l(d)}),c&&i.forEach(d=>d.forEachLine(l,c))},this.findObjectsWithAnatomicalId=(l,c)=>{const d=[];return o.forEach(h=>{h.anatomicalId===l&&d.push(h)}),c&&i.forEach(h=>{let m=h.findObjectsWithAnatomicalId(l,c);d.push(...m)}),d},this.findObjectsWithGroupName=(l,c)=>{const d=[];return o.forEach(h=>{const m=h.groupName?h.groupName.toLowerCase():h.groupName,A=l&&l.toLowerCase();m===A&&d.push(h)}),c&&i.forEach(h=>{let m=h.findObjectsWithGroupName(l,c);d.push(...m)}),d},this.findGeometriesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isGeometry),this.findPointsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isPointset),this.findGlyphsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isGlyphset),this.findLinesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isLines),this.getAllObjects=l=>{const c=[...o];return l&&i.forEach(d=>{let h=d.getAllObjects(l);c.push(...h)}),c},this.getChildRegions=l=>{const c=[...i];return l&&i.forEach(d=>{const h=d.getChildRegions(l);c.push(...h)}),c},this.getCurrentTime=()=>{if(o[0]!=null)return o[0].getCurrentTime();for(let l=0;l<i.length;l++){const c=i[l].getCurrentTime();if(c!==-1)return c}return-1},this.setMorphTime=(l,c)=>{o.forEach(d=>{d.setMorphTime(l)}),c&&i.forEach(d=>{d.setMorphTime(l)})},this.isTimeVarying=()=>{for(let l=0;l<o.length;l++)if(o[l].isTimeVarying())return!0;for(let l=0;l<i.length;l++)if(i[l].isTimeVarying())return!0;return!1},this.renderGeometries=(l,c,d,h,m,A)=>{var g;this.getAllObjects(A).forEach(M=>{M.render(l*c,d,h,m)}),m&&d===!1&&((g=m.markerCluster)!=null&&g.markerUpdateRequired)&&m.markerCluster.calculate()},this.createPoints=(l,c,d,h)=>{let m=!1;const A=this.findObjectsWithGroupName(l,!1),b=A.findIndex(M=>M.isPointset),g=b>-1?A[b]:new Oe;return g.addPoints(c,d,h),b===-1?(g.setName(l),this.addZincObject(g),m=!0):this.pickableUpdateRequired=!0,{zincObject:g,isNew:m}},this.createLines=(l,c,d)=>{let h=!1;const m=this.findObjectsWithGroupName(l,!1),A=m.findIndex(g=>g.isLines),b=A>-1?m[A]:new st;return b.addLines(c,d),A===-1?(b.setName(l),this.addZincObject(b),h=!0):this.pickableUpdateRequired=!0,{zincObject:b,isNew:h}},this.createGeometryFromThreeJSGeometry=(l,c,d,h,m,A)=>{const b=new Fe,g=new S.MeshPhongMaterial({color:d,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:h,side:S.DoubleSide});if(b.createMesh(c,g,{localTimeEnabled:!1,localMorphColour:!1}),b.getMorph())return b.setVisibility(!1),b.setName(l),b.setRenderOrder(A),this.addZincObject(b),b}};class Mt{constructor(){this.pluginCallbacks=[],this.register(function(e){return new gs(e)}),this.register(function(e){return new ys(e)}),this.register(function(e){return new bs(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s){const i=new ms,r=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)r.push(this.pluginCallbacks[o](i));i.setPlugins(r),i.write(e,t,s)}}const se={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,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},ge={};ge[w.NearestFilter]=se.NEAREST,ge[w.NearestMipmapNearestFilter]=se.NEAREST_MIPMAP_NEAREST,ge[w.NearestMipmapLinearFilter]=se.NEAREST_MIPMAP_LINEAR,ge[w.LinearFilter]=se.LINEAR,ge[w.LinearMipmapNearestFilter]=se.LINEAR_MIPMAP_NEAREST,ge[w.LinearMipmapLinearFilter]=se.LINEAR_MIPMAP_LINEAR,ge[w.ClampToEdgeWrapping]=se.CLAMP_TO_EDGE,ge[w.RepeatWrapping]=se.REPEAT,ge[w.MirroredRepeatWrapping]=se.MIRRORED_REPEAT;const di={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},fi=12,ls=1179937895,cs=2,pi=8,hs=1313821514,us=5130562;function ze(n,e){return n.length===e.length&&n.every(function(t,s){return t===e[s]})}function ds(n){if(window.TextEncoder!==void 0)return new TextEncoder().encode(n).buffer;const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0,s=n.length;t<s;t++){const i=n.charCodeAt(t);e[t]=i>255?32:i}return e.buffer}function fs(n){return ze(n.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function ps(n,e,t){const s={min:new Array(n.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(n.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let r=0;r<n.itemSize;r++){let o;n.itemSize>4?o=n.array[i*n.itemSize+r]:r===0?o=n.getX(i):r===1?o=n.getY(i):r===2?o=n.getZ(i):r===3&&(o=n.getW(i)),s.min[r]=Math.min(s.min[r],o),s.max[r]=Math.max(s.max[r],o)}return s}function mi(n){return Math.ceil(n/4)*4}function _t(n,e=0){const t=mi(n.byteLength);if(t!==n.byteLength){const s=new Uint8Array(t);if(s.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i<t;i++)s[i]=e;return s.buffer}return n}let gi=null;class ms{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(e){this.plugins=e}write(e,t,s){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);const i=this;Promise.all(this.pending).then(function(){const r=i.buffers,o=i.json,a=i.options,u=i.extensionsUsed,f=new Blob(r,{type:"application/octet-stream"}),l=Object.keys(u);if(l.length>0&&(o.extensionsUsed=l),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=f.size),a.binary===!0){const c=new window.FileReader;c.readAsArrayBuffer(f),c.onloadend=function(){const d=_t(c.result),h=new DataView(new ArrayBuffer(pi));h.setUint32(0,d.byteLength,!0),h.setUint32(4,us,!0);const m=_t(ds(JSON.stringify(o)),32),A=new DataView(new ArrayBuffer(pi));A.setUint32(0,m.byteLength,!0),A.setUint32(4,hs,!0);const b=new ArrayBuffer(fi),g=new DataView(b);g.setUint32(0,ls,!0),g.setUint32(4,cs,!0);const M=fi+A.byteLength+m.byteLength+h.byteLength+d.byteLength;g.setUint32(8,M,!0);const _=new Blob([b,A,m,h,d],{type:"application/octet-stream"}),N=new window.FileReader;N.readAsArrayBuffer(_),N.onloadend=function(){t(N.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new window.FileReader;c.readAsDataURL(f),c.onloadend=function(){const d=c.result;o.buffers[0].uri=d,t(o)}}else t(o)})}serializeUserData(e,t){if(e.userData&&e.userData.isZincObject||Object.keys(e.userData).length===0)return;const s=this.options,i=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&r.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in r.gltfExtensions)t.extensions[o]=r.gltfExtensions[o],i[o]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const s=new w.Vector3;for(let i=0,r=e.count;i<r;i++)if(Math.abs(s.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const s=e.clone(),i=new w.Vector3;for(let r=0,o=s.count;r<o;r++)i.fromBufferAttribute(s,r),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),s.setXYZ(r,i.x,i.y,i.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),s=!0),t.rotation!==0&&(i.rotation=t.rotation,s=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,i,r){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===se.UNSIGNED_BYTE?a=1:t===se.UNSIGNED_SHORT?a=2:a=4;const u=mi(i*e.itemSize*a),f=new DataView(new ArrayBuffer(u));let l=0;for(let h=s;h<s+i;h++)for(let m=0;m<e.itemSize;m++){let A;e.itemSize>4?A=e.array[h*e.itemSize+m]:m===0?A=e.getX(h):m===1?A=e.getY(h):m===2?A=e.getZ(h):m===3&&(A=e.getW(h)),t===se.FLOAT?f.setFloat32(l,A,!0):t===se.UNSIGNED_INT?f.setUint32(l,A,!0):t===se.UNSIGNED_SHORT?f.setUint16(l,A,!0):t===se.UNSIGNED_BYTE&&f.setUint8(l,A),l+=a}const c={buffer:this.processBuffer(f.buffer),byteOffset:this.byteOffset,byteLength:u};return r!==void 0&&(c.target=r),r===se.ARRAY_BUFFER&&(c.byteStride=e.itemSize*a),this.byteOffset+=u,o.bufferViews.push(c),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise(function(i){const r=new window.FileReader;r.readAsArrayBuffer(e),r.onloadend=function(){const o=_t(r.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(s.bufferViews.push(a)-1)}})}processAccessor(e,t,s,i){const r=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let u;if(e.array.constructor===Float32Array)u=se.FLOAT;else if(e.array.constructor===Uint32Array)u=se.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)u=se.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)u=se.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(s===void 0&&(s=0),i===void 0&&(i=e.count),r.truncateDrawRange&&t!==void 0&&t.index===null){const h=s+i,m=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;s=Math.max(s,t.drawRange.start),i=Math.min(h,m)-s,i<0&&(i=0)}if(i===0)return null;const f=ps(e,s,i);let l;t!==void 0&&(l=e===t.index?se.ELEMENT_ARRAY_BUFFER:se.ARRAY_BUFFER);const c=this.processBufferView(e,u,s,i,l),d={bufferView:c.id,byteOffset:c.byteOffset,componentType:u,count:i,max:f.max,min:f.min,type:a[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(d)-1}processImage(e,t,s){const i=this,r=i.cache,o=i.json,a=i.options,u=i.pending;r.images.has(e)||r.images.set(e,{});const f=r.images.get(e),l=t===w.RGBAFormat?"image/png":"image/jpeg",c=l+":flipY/"+s.toString();if(f[c]!==void 0)return f[c];o.images||(o.images=[]);const d={mimeType:l};if(a.embedImages){const m=gi=gi||document.createElement("canvas");m.width=Math.min(e.width,a.maxTextureSize),m.height=Math.min(e.height,a.maxTextureSize);const A=m.getContext("2d");if(s===!0&&(A.translate(0,m.height),A.scale(1,-1)),typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)A.drawImage(e,0,0,m.width,m.height);else{t!==w.RGBAFormat&&t!==w.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const b=new Uint8ClampedArray(e.height*e.width*4);if(t===w.RGBAFormat)for(let g=0;g<b.length;g+=4)b[g+0]=e.data[g+0],b[g+1]=e.data[g+1],b[g+2]=e.data[g+2],b[g+3]=e.data[g+3];else for(let g=0,M=0;g<b.length;g+=4,M+=3)b[g+0]=e.data[M+0],b[g+1]=e.data[M+1],b[g+2]=e.data[M+2],b[g+3]=255;A.putImageData(new ImageData(b,e.width,e.height),0,0)}a.binary===!0?u.push(new Promise(function(b){m.toBlob(function(g){i.processBufferViewImage(g).then(function(M){d.bufferView=M,b()})},l)})):d.uri=m.toDataURL(l)}else d.uri=e.src;const h=o.images.push(d)-1;return f[c]=h,h}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const s={magFilter:ge[e.magFilter],minFilter:ge[e.minFilter],wrapS:ge[e.wrapS],wrapT:ge[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.cache,s=this.json;if(t.textures.has(e))return t.textures.get(e);s.textures||(s.textures=[]);const i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,i)});const r=s.textures.push(i)-1;return t.textures.set(e,r),r}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(ze(r,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){const a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),u=Math.max(a.r,a.g,a.b);if(u>1&&(a.multiplyScalar(1/u),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),u>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const f={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(f,e.emissiveMap),i.emissiveTexture=f}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==-1&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===w.DoubleSide&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=s.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,s=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,N=e.material.length;_<N;_++)i.push(e.material[_].uuid);else i.push(e.material.uuid);const r=i.join(":");if(t.meshes.has(r))return t.meshes.get(r);const o=e.geometry;let a;if(e.isLineSegments?a=se.LINES:e.isLineLoop?a=se.LINE_LOOP:e.isLine?a=se.LINE_STRIP:e.isPoints?a=se.POINTS:a=e.material.wireframe?se.LINES:se.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");const u={},f={},l=[],c=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},h=o.getAttribute("normal");h!==void 0&&!this.isNormalizedNormalAttribute(h)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(h)));let m=null;for(let _ in o.attributes){if(_.substr(0,5)==="morph")continue;const N=o.attributes[_];if(_=d[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(N))){f[_]=t.attributes.get(this.getUID(N));continue}m=null;const I=N.array;_==="JOINTS_0"&&!(I instanceof Uint16Array)&&!(I instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),m=new w.BufferAttribute(new Uint16Array(I),N.itemSize,N.normalized));const D=this.processAccessor(m||N,o);D!==null&&(f[_]=D,t.attributes.set(this.getUID(N),D))}if(h!==void 0&&o.setAttribute("normal",h),Object.keys(f).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const _=[],N=[],U={};if(e.morphTargetDictionary!==void 0)for(const I in e.morphTargetDictionary)U[e.morphTargetDictionary[I]]=I;for(let I=0;I<e.morphTargetInfluences.length;++I){const D={};let Z=!1;for(const F in o.morphAttributes){if(F!=="position"&&F!=="normal"&&F!=="color"){Z||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),Z=!0);continue}const z=o.morphAttributes[F][I];let T=F.toUpperCase();d[F]&&(T=d[F]);const L=o.attributes[F];if(t.attributes.has(this.getUID(z))){D[T]=t.attributes.get(this.getUID(z));continue}const x=L.clone();if(!o.morphTargetsRelative)if(L)for(let O=0,P=z.count;O<P;O++)L.count>O&&x.setXYZ(O,z.getX(O)-L.getX(O),z.getY(O)-L.getY(O),z.getZ(O)-L.getZ(O));else for(let O=0,P=z.count;O<P;O++)x.setXYZ(O,0,0,0);D[T]=this.processAccessor(x,o),t.attributes.set(this.getUID(L),D[T])}c.push(D),_.push(e.morphTargetInfluences[I]),e.morphTargetDictionary!==void 0&&N.push(U[I])}u.weights=_,N.length>0&&(u.extras={},u.extras.targetNames=N)}const A=Array.isArray(e.material);if(A&&o.groups.length===0)return null;const b=A?e.material:[e.material],g=A?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,N=g.length;_<N;_++){const U={mode:a,attributes:f};if(this.serializeUserData(o,U),c.length>0&&(U.targets=c),o.index!==null){let D=this.getUID(o.index);(g[_].start!==void 0||g[_].count!==void 0)&&(D+=":"+g[_].start+":"+g[_].count),t.attributes.has(D)?U.indices=t.attributes.get(D):(U.indices=this.processAccessor(o.index,o,g[_].start,g[_].count),t.attributes.set(D,U.indices)),U.indices===null&&delete U.indices}const I=this.processMaterial(b[g[_].materialIndex]);I!==null&&(U.material=I),l.push(U)}u.primitives=l,s.meshes||(s.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,u)});const M=s.meshes.push(u)-1;return t.meshes.set(r,M),M}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,i={type:s?"orthographic":"perspective"};return s?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:w.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const s=this.json,i=this.nodeMap;s.animations||(s.animations=[]),e=Mt.Utils.mergeMorphTargetTracks(e.clone(),t);const r=e.tracks,o=[],a=[];for(let u=0;u<r.length;++u){const f=r[u],l=w.PropertyBinding.parseTrackName(f.name);let c=w.PropertyBinding.findNode(t,l.nodeName);const d=di[l.propertyName];if(l.objectName==="bones"&&(c.isSkinnedMesh===!0?c=c.skeleton.getBoneByName(l.objectIndex):c=void 0),!c||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',f.name),null;const h=1;let m=f.values.length/f.times.length;d===di.morphTargetInfluences&&(m/=c.morphTargetInfluences.length);let A;f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(A="CUBICSPLINE",m/=3):f.getInterpolation()===w.InterpolateDiscrete?A="STEP":A="LINEAR",a.push({input:this.processAccessor(new w.BufferAttribute(f.times,h)),output:this.processAccessor(new w.BufferAttribute(f.values,m)),interpolation:A}),o.push({sampler:a.length-1,target:{node:i.get(c),path:d}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:a,channels:o}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,i=t.nodes[s.get(e)],r=e.skeleton;if(r===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],u=new Float32Array(r.bones.length*16),f=new w.Matrix4;for(let c=0;c<r.bones.length;++c)a.push(s.get(r.bones[c])),f.copy(r.boneInverses[c]),f.multiply(e.bindMatrix).toArray(u,c*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new w.BufferAttribute(u,16)),joints:a,skeleton:s.get(o)}),i.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);const r={};if(s.trs){const a=e.quaternion.toArray(),u=e.position.toArray(),f=e.scale.toArray();ze(a,[0,0,0,1])||(r.rotation=a),ze(u,[0,0,0])||(r.translation=u),ze(f,[1,1,1])||(r.scale=f)}else e.matrixAutoUpdate&&e.updateMatrix(),fs(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let u=0,f=e.children.length;u<f;u++){const l=e.children[u];if(l.visible||s.onlyVisible===!1){const c=this.processNode(l);c!==null&&a.push(c)}}a.length>0&&(r.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,r)});const o=t.nodes.push(r)-1;return i.set(e,o),o}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const r=[];for(let o=0,a=e.children.length;o<a;o++){const u=e.children[o];if(u.visible||s.onlyVisible===!1){const f=this.processNode(u);f!==null&&r.push(f)}}r.length>0&&(i.nodes=r),this.serializeUserData(e,i)}processObjects(e){const t=new w.Scene;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(i){i.beforeParse&&i.beforeParse(e)});const s=[];for(let i=0;i<e.length;i++)e[i]instanceof w.Scene?this.processScene(e[i]):s.push(e[i]);s.length>0&&this.processObjects(s);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i].clip,t.animations[i].mesh);this._invokeAll(function(i){i.afterParse&&i.afterParse(e)})}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}}class gs{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const s=this.writer,i=s.json,r=s.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.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."),r[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},r[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class ys{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class bs{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const s=this.writer,i=s.extensionsUsed,r={};t.pbrMetallicRoughness.baseColorFactor&&(r.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const o=[1,1,1];if(e.specular.toArray(o,0),r.specularFactor=o,r.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(r.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const a={index:s.processTexture(e.specularMap)};s.applyTextureTransform(a,e.specularMap),r.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}Mt.Utils={insertKeyframe:function(n,e){const s=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),r=new n.ValueBufferType(n.values.length+s),o=n.createInterpolant(new n.ValueBufferType(s));let a;if(n.times.length===0){i[0]=e;for(let u=0;u<s;u++)r[u]=0;a=0}else if(e<n.times[0]){if(Math.abs(n.times[0]-e)<.001)return 0;i[0]=e,i.set(n.times,1),r.set(o.evaluate(e),0),r.set(n.values,s),a=0}else if(e>n.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),r.set(n.values,0),r.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let u=0;u<n.times.length;u++){if(Math.abs(n.times[u]-e)<.001)return u;if(n.times[u]<e&&n.times[u+1]>e){i.set(n.times.slice(0,u+1),0),i[u+1]=e,i.set(n.times.slice(u+1),u+2),r.set(n.values.slice(0,(u+1)*s),0),r.set(o.evaluate(e),(u+1)*s),r.set(n.values.slice((u+1)*s),(u+2)*s),a=u+1;break}}return n.times=i,n.values=r,a},mergeMorphTargetTracks:function(n,e){const t=[],s={},i=n.tracks;for(let r=0;r<i.length;++r){let o=i[r];const a=w.PropertyBinding.parseTrackName(o.name),u=w.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.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."),o=o.clone(),o.setInterpolation(w.InterpolateLinear)}const f=u.morphTargetInfluences.length,l=u.morphTargetDictionary[a.propertyIndex];if(l===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let c;if(s[u.uuid]===void 0){c=o.clone();const h=new c.ValueBufferType(f*c.times.length);for(let m=0;m<c.times.length;m++)h[m*f+l]=c.values[m];c.name=(a.nodeName||"")+".morphTargetInfluences",c.values=h,s[u.uuid]=c,t.push(c);continue}const d=o.createInterpolant(new o.ValueBufferType(1));c=s[u.uuid];for(let h=0;h<c.times.length;h++)c.values[h*f+l]=d.evaluate(c.times[h]);for(let h=0;h<o.times.length;h++){const m=this.insertKeyframe(c,o.times[h]);c.values[m*f+l]=o.values[h]}}return n.tracks=t,n}};const xs=function(n){const e=n;this.exportGLTF=t=>{const i=e.getRootRegion().getAllObjects(!0),r=[];i.forEach(u=>{u.animationClip&&r.push({clip:u.animationClip[0],mesh:u.getMorph()})});const o=new Mt,a={binary:t,animations:r};return new Promise((u,f)=>{o.parse(e.getThreeJSScene(),function(l){u(l)},a)})}},vs=function(){const n=this;this.parseGLTFObjects=(e,t,s,i)=>{let r=t;if(s!==0)if(e.type==="Object3D"){if(e.name!==""&&(t&&(r=t.findOrCreateChildFromPath(e.name)),r)){const o=r.getGroup();o.position.copy(e.position),o.rotation.copy(e.rotation),o.quaternion.copy(e.quaternion),o.matrixAutoUpdate=!0}}else{let o;if(e.type==="Mesh"?o=new Fe:e.type==="LineSegments"?o=new Ve:e.type==="Points"&&(o=new Oe),o){let a=!1,u=!1;e.geometry&&e.geometry.morphAttributes&&(a=!!e.geometry.morphAttributes.position,u=!!e.geometry.morphAttributes.color),o.setMesh(e.clone(),a,u);const f=o.getMorph();o.groupName=f.name,f.matrixAutoUpdate=!0,t.addZincObject(o),i!=null&&typeof i=="function"&&i(o)}}s++,e.children.forEach(o=>{n.parseGLTFObjects(o,r,s,i)})},this.setCamera=e=>{e.viewAll();const t=e.getZincCameraControls(),s=t.getCurrentViewport();t.addViewport("default",s),t.setDefaultViewport("default")},this.load=(e,t,s,i,r,o)=>{const a=s.substring(0,s.lastIndexOf("/")+1),u=s.substring(s.lastIndexOf("/")+1,s.length);new Li.GLTFLoader().setPath(a).load(u,function(l){console.log(l),n.parseGLTFObjects(l.scene,t,0,i),n.setCamera(e),r!=null&&typeof r=="function"&&r()})}},ws=/^[og]\s*(.+)?/,As=/^mtllib /,Ms=/^usemtl /,_s=/^usemap /,yi=new w.Vector3,St=new w.Vector3,bi=new w.Vector3,xi=new w.Vector3,xe=new w.Vector3;function Ss(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,r){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:i||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(u){const f={index:typeof u=="number"?u:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return f.clone=this.clone.bind(f),f}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.vertices.length/3,r.groupCount=r.groupEnd-r.groupStart,r.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},s&&s.name&&typeof s.clone=="function"){const i=s.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseNormalIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseUVIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/2)*2},addVertex:function(e,t,s){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,s){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addFaceNormal:function(e,t,s){const i=this.vertices,r=this.object.geometry.normals;yi.fromArray(i,e),St.fromArray(i,t),bi.fromArray(i,s),xe.subVectors(bi,St),xi.subVectors(yi,St),xe.cross(xi),xe.normalize(),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z)},addColor:function(e,t,s){const i=this.colors,r=this.object.geometry.colors;i[e]!==void 0&&r.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&r.push(i[t+0],i[t+1],i[t+2]),i[s]!==void 0&&r.push(i[s+0],i[s+1],i[s+2])},addUV:function(e,t,s){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[s+0],i[s+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,s,i,r,o,a,u,f){const l=this.vertices.length;let c=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),h=this.parseVertexIndex(s,l);if(this.addVertex(c,d,h),this.addColor(c,d,h),a!==void 0&&a!==""){const m=this.normals.length;c=this.parseNormalIndex(a,m),d=this.parseNormalIndex(u,m),h=this.parseNormalIndex(f,m),this.addNormal(c,d,h)}else this.addFaceNormal(c,d,h);if(i!==void 0&&i!==""){const m=this.uvs.length;c=this.parseUVIndex(i,m),d=this.parseUVIndex(r,m),h=this.parseUVIndex(o,m),this.addUV(c,d,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let s=0,i=e.length;s<i;s++){const r=this.parseVertexIndex(e[s],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(let r=0,o=e.length;r<o;r++)this.addVertexLine(this.parseVertexIndex(e[r],s));for(let r=0,o=t.length;r<o;r++)this.addUVLine(this.parseUVIndex(t[r],i))}};return n.startObject("",!1),n}class vi extends w.Loader{constructor(e){super(e),this.materials=null}load(e,t,s,i){const r=this,o=new w.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Ss;e.indexOf(`\r
|
|
287
|
+
}`};class vt extends w.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:w.UniformsUtils.clone(w.ShaderLib.line.uniforms),vertexShader:w.ShaderLib.line.vertexShader,fragmentShader:w.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}vt.prototype.isLineMaterial=!0;const li=new w.Vector3,ci=new w.Vector3,de=new w.Vector4,fe=new w.Vector4,Me=new w.Vector4,wt=new w.Vector3,At=new w.Matrix4,be=new w.Line3,hi=new w.Vector3,Ce=new w.Box3,it=new w.Sphere,_e=new w.Vector4;class ui extends w.Mesh{constructor(e=new xt,t=new vt({color:Math.random()*16777215})){super(e,t),this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,s=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,a=0,u=t.count;o<u;o++,a+=2)li.fromBufferAttribute(t,o),ci.fromBufferAttribute(s,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+li.distanceTo(ci);const r=new w.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new w.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new w.InterleavedBufferAttribute(r,1,1)),this}raycast(e,t){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0,i=e.ray,r=e.camera,o=r.projectionMatrix,a=this.matrixWorld,u=this.geometry,f=this.material,l=f.resolution,c=f.linewidth+s,d=u.attributes.instanceStart,h=u.attributes.instanceEnd,m=-r.near,A=2*Math.max(c/l.width,c/l.height);u.boundingSphere===null&&u.computeBoundingSphere(),it.copy(u.boundingSphere).applyMatrix4(a);const b=Math.max(r.near,it.distanceToPoint(i.origin));_e.set(0,0,-b,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const g=Math.abs(A/_e.w)*.5;if(it.radius+=g,e.ray.intersectsSphere(it)===!1)return;u.boundingBox===null&&u.computeBoundingBox(),Ce.copy(u.boundingBox).applyMatrix4(a);const M=Math.max(r.near,Ce.distanceToPoint(i.origin));_e.set(0,0,-M,1).applyMatrix4(r.projectionMatrix),_e.multiplyScalar(1/_e.w),_e.applyMatrix4(r.projectionMatrixInverse);const _=Math.abs(A/_e.w)*.5;if(Ce.max.x+=_,Ce.max.y+=_,Ce.max.z+=_,Ce.min.x-=_,Ce.min.y-=_,Ce.min.z-=_,e.ray.intersectsBox(Ce)!==!1){i.at(1,Me),Me.w=1,Me.applyMatrix4(r.matrixWorldInverse),Me.applyMatrix4(o),Me.multiplyScalar(1/Me.w),Me.x*=l.x/2,Me.y*=l.y/2,Me.z=0,wt.copy(Me),At.multiplyMatrices(r.matrixWorldInverse,a);for(let U=0,I=d.count;U<I;U++){de.fromBufferAttribute(d,U),fe.fromBufferAttribute(h,U),de.w=1,fe.w=1,de.applyMatrix4(At),fe.applyMatrix4(At);var N=de.z>m&&fe.z>m;if(N)continue;if(de.z>m){const T=de.z-fe.z,L=(de.z-m)/T;de.lerp(fe,L)}else if(fe.z>m){const T=fe.z-de.z,L=(fe.z-m)/T;fe.lerp(de,L)}de.applyMatrix4(o),fe.applyMatrix4(o),de.multiplyScalar(1/de.w),fe.multiplyScalar(1/fe.w),de.x*=l.x/2,de.y*=l.y/2,fe.x*=l.x/2,fe.y*=l.y/2,be.start.copy(de),be.start.z=0,be.end.copy(fe),be.end.z=0;const D=be.closestPointToPointParameter(wt,!0);be.at(D,hi);const Z=w.MathUtils.lerp(de.z,fe.z,D),F=Z>=-1&&Z<=1,z=wt.distanceTo(hi)<c*.5;if(F&&z){be.start.fromBufferAttribute(d,U),be.end.fromBufferAttribute(h,U),be.start.applyMatrix4(a),be.end.applyMatrix4(a);const T=new w.Vector3,L=new w.Vector3;i.distanceSqToSegment(be.start,be.end,L,T),t.push({point:L,pointOnLine:T,distance:i.origin.distanceTo(L),object:this,face:null,faceIndex:U,uv:null,uv2:null})}}}}}ui.prototype.LineSegments2=!0;const st=function(){Ve.call(this),this.isLines2=!0;let n=new Array(300);this.createLineSegment=(e,t,s)=>{if(e&&t){const i=new xt;i.setPositions(e),i.colorsNeedUpdate=!0;const r=new ui(i,t);r.scale.set(1,1,1),r.computeLineDistances(),this.setMesh(r,s.localTimeEnabled,s.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(e){if(e&&e.length){let t=this.getMorph();t||(this.drawRange=0);let s=this.drawRange*3;if(e.forEach(i=>{n[s++]=i[0],n[s++]=i[1],n[s++]=i[2],this.drawRange++}),!t)for(;s<300;)n[s++]=e[0][0],n[s++]=e[0][1],n[s++]=e[0][2];t&&(t.geometry.setPositions(n),t.computeLineDistances(),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return n},this.getVerticesByFaceIndex=function(e){let t=e*2*3;const s=this.getMorph();if(s&&this.drawRange*3>t){const i=s.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(e,t){if(e&&e.length){let s=this.getMorph();const i=t+e.length-1;if(!s||0>t||i>=this.drawRange)return;{let r=t*3;for(e.forEach(o=>{n[r++]=o[0],n[r++]=o[1],n[r++]=o[2]}),r=this.drawRange*3;r<300;)n[r++]=e[0][0],n[r++]=e[0][1],n[r++]=e[0][2];s.geometry.setPositions(n),s.computeLineDistances(),s.geometry.computeBoundingBox(),s.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}return n},this.addLines=(e,t)=>{if(e&&e.length>0){if(this.addVertices(e),!this.getMorph()){const i=new vt({color:t,linewidth:1,vertexColors:!1,worldUnits:!1});i.resolution.set(window.innerWidth,window.innerHeight);const r={localTimeEnabled:!1,localMorphColour:!1};this.createLineSegment(n,i,r)}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=(e,t,s,i)=>{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};st.prototype=Object.create(Ve.prototype),st.prototype.constructor=st;let ls=0;const cs=function(){return"re"+ls++};let di=function(n,e){let t=n,s=new S.Group;s.matrixAutoUpdate=!1,s.userData=this;let i=[],r="",o=[],a=e;const u=new S.Matrix4;let f=3e3;u.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=cs(),this.hideAllPrimitives=()=>{i.forEach(l=>l.hideAllPrimitives()),o.forEach(l=>l.setVisibility(!1))},this.showAllPrimitives=()=>{i.forEach(l=>l.showAllPrimitives()),o.forEach(l=>l.setVisibility(!0))},this.setVisibility=l=>{l!=s.visible&&(s.visible=l,this.pickableUpdateRequired=!0)},this.getVisibility=()=>s.visible,this.getGroup=()=>s,this.setTransformation=l=>{u.set(...l),s.matrix.copy(u),s.updateMatrixWorld()},this.setName=l=>{l&&l!==""&&(r=l)},this.getName=()=>r,this.getParent=()=>t,this.getFullSeparatedPath=()=>{const l=[];if(r!==""){l.push(r);for(let c=t;c!==void 0;){const d=c.getName();d!==""&&l.unshift(d),c=c.getParent()}}return l},this.getFullPath=()=>{const l=this.getFullSeparatedPath();if(l.length>0){let c=l.shift();return l.forEach(d=>{c=c.concat("/",d)}),c}return""},this.createChild=l=>{let c=new di(this,a);return c.setName(l),i.push(c),s.add(c.getGroup()),c},this.getChildWithName=l=>{if(l){const c=l.toLowerCase();for(let d=0;d<i.length;d++)if(i[d].getName().toLowerCase()===c)return i[d]}},this.findChildFromSeparatedPath=l=>{if(l&&l.length>0&&l[0]===""&&l.shift(),l&&l.length>0){const c=this.getChildWithName(l[0]);return c?(l.shift(),c.findChildFromSeparatedPath(l)):void 0}return this},this.findChildFromPath=l=>{const c=l.split("/");return this.findChildFromSeparatedPath(c)},this.createChildFromSeparatedPath=l=>{if(l.length>0&&l[0]===""&&l.shift(),l.length>0){let c=this.getChildWithName(l[0]);return c||(c=this.createChild(l[0])),l.shift(),c.createChildFromSeparatedPath(l)}return this},this.createChildFromPath=l=>{const c=l.split("/");return this.createChildFromSeparatedPath(c)},this.findOrCreateChildFromPath=l=>{let c=this.findChildFromPath(l);return c||(c=this.createChildFromPath(l)),c},this.addZincObject=l=>{l&&(l.setRegion(this),s.add(l.getGroup()),o.push(l),this.pickableUpdateRequired=!0,a&&a.triggerObjectAddedCallback(l))},this.removeZincObject=l=>{for(let c=0;c<o.length;c++)if(l===o[c]){s.remove(l.getGroup()),o.splice(c,1),a&&a.triggerObjectRemovedCallback(l),l.dispose(),this.pickableUpdateRequired=!0;return}},this.checkPickableUpdateRequred=l=>{if(this.pickableUpdateRequired)return!0;if(l){let c=!1;for(let d=0;d<i.length;d++)if(c=i[d].checkPickableUpdateRequred(l),c)return!0}return!1},this.getPickableThreeJSObjects=(l,c)=>(s.visible&&(o.forEach(d=>{if(d.isPickable&&d.getGroup()&&d.getGroup().visible){let h=d.marker;h&&h.isEnabled()&&l.push(h.getMorph()),l.push(d.getGroup())}}),c&&i.forEach(d=>{d.getPickableThreeJSObjects(l,c)}),this.pickableUpdateRequired=!1),l),this.setDuration=l=>{f=l,o.forEach(c=>c.setDuration(l)),i.forEach(c=>c.setDuration(l))},this.getDuration=()=>f,this.getBoundingBox=l=>{let c,d;return o.forEach(h=>{d=h.getBoundingBox(),d&&(c==null?c=d.clone():c.union(d))}),l&&i.forEach(h=>{d=h.getBoundingBox(l),d&&(c==null?c=d.clone():c.union(d))}),c},this.clear=l=>{l&&i.forEach(c=>c.clear(l)),o.forEach(c=>{s.remove(c.getGroup()),c.dispose()}),i=[],o=[]},this.objectIsInRegion=(l,c)=>{for(let d=0;d<o.length;d++)if(l===o[d])return!0;if(c){for(let d=0;d<i.length;d++)if(i[d].objectIsInRegion(l,c))return!0}return!1},this.forEachGeometry=(l,c)=>{o.forEach(d=>{d.isGeometry&&l(d)}),c&&i.forEach(d=>d.forEachGeometry(l,c))},this.forEachGlyphset=(l,c)=>{o.forEach(d=>{d.isGlyphset&&l(d)}),c&&i.forEach(d=>d.forEachGlyphset(l,c))},this.forEachPointset=(l,c)=>{o.forEach(d=>{d.isPointset&&l(d)}),c&&i.forEach(d=>d.forEachPointset(l,c))},this.forEachLine=(l,c)=>{o.forEach(d=>{d.isLines&&l(d)}),c&&i.forEach(d=>d.forEachLine(l,c))},this.findObjectsWithAnatomicalId=(l,c)=>{const d=[];return o.forEach(h=>{h.anatomicalId===l&&d.push(h)}),c&&i.forEach(h=>{let m=h.findObjectsWithAnatomicalId(l,c);d.push(...m)}),d},this.findObjectsWithGroupName=(l,c)=>{const d=[];return o.forEach(h=>{const m=h.groupName?h.groupName.toLowerCase():h.groupName,A=l&&l.toLowerCase();m===A&&d.push(h)}),c&&i.forEach(h=>{let m=h.findObjectsWithGroupName(l,c);d.push(...m)}),d},this.findGeometriesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isGeometry),this.findPointsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isPointset),this.findGlyphsetsWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isGlyphset),this.findLinesWithGroupName=(l,c)=>this.findObjectsWithGroupName(l,c).filter(m=>m.isLines),this.getAllObjects=l=>{const c=[...o];return l&&i.forEach(d=>{let h=d.getAllObjects(l);c.push(...h)}),c},this.getChildRegions=l=>{const c=[...i];return l&&i.forEach(d=>{const h=d.getChildRegions(l);c.push(...h)}),c},this.getCurrentTime=()=>{if(o[0]!=null)return o[0].getCurrentTime();for(let l=0;l<i.length;l++){const c=i[l].getCurrentTime();if(c!==-1)return c}return-1},this.setMorphTime=(l,c)=>{o.forEach(d=>{d.setMorphTime(l)}),c&&i.forEach(d=>{d.setMorphTime(l)})},this.isTimeVarying=()=>{for(let l=0;l<o.length;l++)if(o[l].isTimeVarying())return!0;for(let l=0;l<i.length;l++)if(i[l].isTimeVarying())return!0;return!1},this.renderGeometries=(l,c,d,h,m,A)=>{var g;this.getAllObjects(A).forEach(M=>{M.render(l*c,d,h,m)}),m&&d===!1&&((g=m.markerCluster)!=null&&g.markerUpdateRequired)&&m.markerCluster.calculate()},this.createPoints=(l,c,d,h)=>{let m=!1;const A=this.findObjectsWithGroupName(l,!1),b=A.findIndex(M=>M.isPointset),g=b>-1?A[b]:new Te;return g.addPoints(c,d,h),b===-1?(g.setName(l),this.addZincObject(g),m=!0):this.pickableUpdateRequired=!0,{zincObject:g,isNew:m}},this.createLines=(l,c,d)=>{let h=!1;const m=this.findObjectsWithGroupName(l,!1),A=m.findIndex(g=>g.isLines),b=A>-1?m[A]:new st;return b.addLines(c,d),A===-1?(b.setName(l),this.addZincObject(b),h=!0):this.pickableUpdateRequired=!0,{zincObject:b,isNew:h}},this.createGeometryFromThreeJSGeometry=(l,c,d,h,m,A)=>{const b=new Fe,g=new S.MeshPhongMaterial({color:d,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:h,side:S.DoubleSide});if(b.createMesh(c,g,{localTimeEnabled:!1,localMorphColour:!1}),b.getMorph())return b.setVisibility(!1),b.setName(l),b.setRenderOrder(A),this.addZincObject(b),b}};class Mt{constructor(){this.pluginCallbacks=[],this.register(function(e){return new bs(e)}),this.register(function(e){return new xs(e)}),this.register(function(e){return new vs(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s){const i=new ys,r=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)r.push(this.pluginCallbacks[o](i));i.setPlugins(r),i.write(e,t,s)}}const se={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,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},ge={};ge[w.NearestFilter]=se.NEAREST,ge[w.NearestMipmapNearestFilter]=se.NEAREST_MIPMAP_NEAREST,ge[w.NearestMipmapLinearFilter]=se.NEAREST_MIPMAP_LINEAR,ge[w.LinearFilter]=se.LINEAR,ge[w.LinearMipmapNearestFilter]=se.LINEAR_MIPMAP_NEAREST,ge[w.LinearMipmapLinearFilter]=se.LINEAR_MIPMAP_LINEAR,ge[w.ClampToEdgeWrapping]=se.CLAMP_TO_EDGE,ge[w.RepeatWrapping]=se.REPEAT,ge[w.MirroredRepeatWrapping]=se.MIRRORED_REPEAT;const fi={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},pi=12,hs=1179937895,us=2,mi=8,ds=1313821514,fs=5130562;function ze(n,e){return n.length===e.length&&n.every(function(t,s){return t===e[s]})}function ps(n){if(window.TextEncoder!==void 0)return new TextEncoder().encode(n).buffer;const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0,s=n.length;t<s;t++){const i=n.charCodeAt(t);e[t]=i>255?32:i}return e.buffer}function ms(n){return ze(n.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function gs(n,e,t){const s={min:new Array(n.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(n.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let r=0;r<n.itemSize;r++){let o;n.itemSize>4?o=n.array[i*n.itemSize+r]:r===0?o=n.getX(i):r===1?o=n.getY(i):r===2?o=n.getZ(i):r===3&&(o=n.getW(i)),s.min[r]=Math.min(s.min[r],o),s.max[r]=Math.max(s.max[r],o)}return s}function gi(n){return Math.ceil(n/4)*4}function _t(n,e=0){const t=gi(n.byteLength);if(t!==n.byteLength){const s=new Uint8Array(t);if(s.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i<t;i++)s[i]=e;return s.buffer}return n}let yi=null;class ys{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(e){this.plugins=e}write(e,t,s){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);const i=this;Promise.all(this.pending).then(function(){const r=i.buffers,o=i.json,a=i.options,u=i.extensionsUsed,f=new Blob(r,{type:"application/octet-stream"}),l=Object.keys(u);if(l.length>0&&(o.extensionsUsed=l),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=f.size),a.binary===!0){const c=new window.FileReader;c.readAsArrayBuffer(f),c.onloadend=function(){const d=_t(c.result),h=new DataView(new ArrayBuffer(mi));h.setUint32(0,d.byteLength,!0),h.setUint32(4,fs,!0);const m=_t(ps(JSON.stringify(o)),32),A=new DataView(new ArrayBuffer(mi));A.setUint32(0,m.byteLength,!0),A.setUint32(4,ds,!0);const b=new ArrayBuffer(pi),g=new DataView(b);g.setUint32(0,hs,!0),g.setUint32(4,us,!0);const M=pi+A.byteLength+m.byteLength+h.byteLength+d.byteLength;g.setUint32(8,M,!0);const _=new Blob([b,A,m,h,d],{type:"application/octet-stream"}),N=new window.FileReader;N.readAsArrayBuffer(_),N.onloadend=function(){t(N.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new window.FileReader;c.readAsDataURL(f),c.onloadend=function(){const d=c.result;o.buffers[0].uri=d,t(o)}}else t(o)})}serializeUserData(e,t){if(e.userData&&e.userData.isZincObject||Object.keys(e.userData).length===0)return;const s=this.options,i=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&r.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in r.gltfExtensions)t.extensions[o]=r.gltfExtensions[o],i[o]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const s=new w.Vector3;for(let i=0,r=e.count;i<r;i++)if(Math.abs(s.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const s=e.clone(),i=new w.Vector3;for(let r=0,o=s.count;r<o;r++)i.fromBufferAttribute(s,r),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),s.setXYZ(r,i.x,i.y,i.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),s=!0),t.rotation!==0&&(i.rotation=t.rotation,s=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,i,r){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===se.UNSIGNED_BYTE?a=1:t===se.UNSIGNED_SHORT?a=2:a=4;const u=gi(i*e.itemSize*a),f=new DataView(new ArrayBuffer(u));let l=0;for(let h=s;h<s+i;h++)for(let m=0;m<e.itemSize;m++){let A;e.itemSize>4?A=e.array[h*e.itemSize+m]:m===0?A=e.getX(h):m===1?A=e.getY(h):m===2?A=e.getZ(h):m===3&&(A=e.getW(h)),t===se.FLOAT?f.setFloat32(l,A,!0):t===se.UNSIGNED_INT?f.setUint32(l,A,!0):t===se.UNSIGNED_SHORT?f.setUint16(l,A,!0):t===se.UNSIGNED_BYTE&&f.setUint8(l,A),l+=a}const c={buffer:this.processBuffer(f.buffer),byteOffset:this.byteOffset,byteLength:u};return r!==void 0&&(c.target=r),r===se.ARRAY_BUFFER&&(c.byteStride=e.itemSize*a),this.byteOffset+=u,o.bufferViews.push(c),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise(function(i){const r=new window.FileReader;r.readAsArrayBuffer(e),r.onloadend=function(){const o=_t(r.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(s.bufferViews.push(a)-1)}})}processAccessor(e,t,s,i){const r=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let u;if(e.array.constructor===Float32Array)u=se.FLOAT;else if(e.array.constructor===Uint32Array)u=se.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)u=se.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)u=se.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(s===void 0&&(s=0),i===void 0&&(i=e.count),r.truncateDrawRange&&t!==void 0&&t.index===null){const h=s+i,m=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;s=Math.max(s,t.drawRange.start),i=Math.min(h,m)-s,i<0&&(i=0)}if(i===0)return null;const f=gs(e,s,i);let l;t!==void 0&&(l=e===t.index?se.ELEMENT_ARRAY_BUFFER:se.ARRAY_BUFFER);const c=this.processBufferView(e,u,s,i,l),d={bufferView:c.id,byteOffset:c.byteOffset,componentType:u,count:i,max:f.max,min:f.min,type:a[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(d)-1}processImage(e,t,s){const i=this,r=i.cache,o=i.json,a=i.options,u=i.pending;r.images.has(e)||r.images.set(e,{});const f=r.images.get(e),l=t===w.RGBAFormat?"image/png":"image/jpeg",c=l+":flipY/"+s.toString();if(f[c]!==void 0)return f[c];o.images||(o.images=[]);const d={mimeType:l};if(a.embedImages){const m=yi=yi||document.createElement("canvas");m.width=Math.min(e.width,a.maxTextureSize),m.height=Math.min(e.height,a.maxTextureSize);const A=m.getContext("2d");if(s===!0&&(A.translate(0,m.height),A.scale(1,-1)),typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)A.drawImage(e,0,0,m.width,m.height);else{t!==w.RGBAFormat&&t!==w.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const b=new Uint8ClampedArray(e.height*e.width*4);if(t===w.RGBAFormat)for(let g=0;g<b.length;g+=4)b[g+0]=e.data[g+0],b[g+1]=e.data[g+1],b[g+2]=e.data[g+2],b[g+3]=e.data[g+3];else for(let g=0,M=0;g<b.length;g+=4,M+=3)b[g+0]=e.data[M+0],b[g+1]=e.data[M+1],b[g+2]=e.data[M+2],b[g+3]=255;A.putImageData(new ImageData(b,e.width,e.height),0,0)}a.binary===!0?u.push(new Promise(function(b){m.toBlob(function(g){i.processBufferViewImage(g).then(function(M){d.bufferView=M,b()})},l)})):d.uri=m.toDataURL(l)}else d.uri=e.src;const h=o.images.push(d)-1;return f[c]=h,h}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const s={magFilter:ge[e.magFilter],minFilter:ge[e.minFilter],wrapS:ge[e.wrapS],wrapT:ge[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.cache,s=this.json;if(t.textures.has(e))return t.textures.get(e);s.textures||(s.textures=[]);const i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,i)});const r=s.textures.push(i)-1;return t.textures.set(e,r),r}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(ze(r,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){const a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),u=Math.max(a.r,a.g,a.b);if(u>1&&(a.multiplyScalar(1/u),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),u>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const f={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(f,e.emissiveMap),i.emissiveTexture=f}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==-1&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===w.DoubleSide&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=s.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,s=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,N=e.material.length;_<N;_++)i.push(e.material[_].uuid);else i.push(e.material.uuid);const r=i.join(":");if(t.meshes.has(r))return t.meshes.get(r);const o=e.geometry;let a;if(e.isLineSegments?a=se.LINES:e.isLineLoop?a=se.LINE_LOOP:e.isLine?a=se.LINE_STRIP:e.isPoints?a=se.POINTS:a=e.material.wireframe?se.LINES:se.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");const u={},f={},l=[],c=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},h=o.getAttribute("normal");h!==void 0&&!this.isNormalizedNormalAttribute(h)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(h)));let m=null;for(let _ in o.attributes){if(_.substr(0,5)==="morph")continue;const N=o.attributes[_];if(_=d[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(N))){f[_]=t.attributes.get(this.getUID(N));continue}m=null;const I=N.array;_==="JOINTS_0"&&!(I instanceof Uint16Array)&&!(I instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),m=new w.BufferAttribute(new Uint16Array(I),N.itemSize,N.normalized));const D=this.processAccessor(m||N,o);D!==null&&(f[_]=D,t.attributes.set(this.getUID(N),D))}if(h!==void 0&&o.setAttribute("normal",h),Object.keys(f).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const _=[],N=[],U={};if(e.morphTargetDictionary!==void 0)for(const I in e.morphTargetDictionary)U[e.morphTargetDictionary[I]]=I;for(let I=0;I<e.morphTargetInfluences.length;++I){const D={};let Z=!1;for(const F in o.morphAttributes){if(F!=="position"&&F!=="normal"&&F!=="color"){Z||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),Z=!0);continue}const z=o.morphAttributes[F][I];let T=F.toUpperCase();d[F]&&(T=d[F]);const L=o.attributes[F];if(t.attributes.has(this.getUID(z))){D[T]=t.attributes.get(this.getUID(z));continue}const x=L.clone();if(!o.morphTargetsRelative)if(L)for(let O=0,P=z.count;O<P;O++)L.count>O&&x.setXYZ(O,z.getX(O)-L.getX(O),z.getY(O)-L.getY(O),z.getZ(O)-L.getZ(O));else for(let O=0,P=z.count;O<P;O++)x.setXYZ(O,0,0,0);D[T]=this.processAccessor(x,o),t.attributes.set(this.getUID(L),D[T])}c.push(D),_.push(e.morphTargetInfluences[I]),e.morphTargetDictionary!==void 0&&N.push(U[I])}u.weights=_,N.length>0&&(u.extras={},u.extras.targetNames=N)}const A=Array.isArray(e.material);if(A&&o.groups.length===0)return null;const b=A?e.material:[e.material],g=A?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,N=g.length;_<N;_++){const U={mode:a,attributes:f};if(this.serializeUserData(o,U),c.length>0&&(U.targets=c),o.index!==null){let D=this.getUID(o.index);(g[_].start!==void 0||g[_].count!==void 0)&&(D+=":"+g[_].start+":"+g[_].count),t.attributes.has(D)?U.indices=t.attributes.get(D):(U.indices=this.processAccessor(o.index,o,g[_].start,g[_].count),t.attributes.set(D,U.indices)),U.indices===null&&delete U.indices}const I=this.processMaterial(b[g[_].materialIndex]);I!==null&&(U.material=I),l.push(U)}u.primitives=l,s.meshes||(s.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,u)});const M=s.meshes.push(u)-1;return t.meshes.set(r,M),M}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,i={type:s?"orthographic":"perspective"};return s?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:w.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const s=this.json,i=this.nodeMap;s.animations||(s.animations=[]),e=Mt.Utils.mergeMorphTargetTracks(e.clone(),t);const r=e.tracks,o=[],a=[];for(let u=0;u<r.length;++u){const f=r[u],l=w.PropertyBinding.parseTrackName(f.name);let c=w.PropertyBinding.findNode(t,l.nodeName);const d=fi[l.propertyName];if(l.objectName==="bones"&&(c.isSkinnedMesh===!0?c=c.skeleton.getBoneByName(l.objectIndex):c=void 0),!c||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',f.name),null;const h=1;let m=f.values.length/f.times.length;d===fi.morphTargetInfluences&&(m/=c.morphTargetInfluences.length);let A;f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(A="CUBICSPLINE",m/=3):f.getInterpolation()===w.InterpolateDiscrete?A="STEP":A="LINEAR",a.push({input:this.processAccessor(new w.BufferAttribute(f.times,h)),output:this.processAccessor(new w.BufferAttribute(f.values,m)),interpolation:A}),o.push({sampler:a.length-1,target:{node:i.get(c),path:d}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:a,channels:o}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,i=t.nodes[s.get(e)],r=e.skeleton;if(r===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],u=new Float32Array(r.bones.length*16),f=new w.Matrix4;for(let c=0;c<r.bones.length;++c)a.push(s.get(r.bones[c])),f.copy(r.boneInverses[c]),f.multiply(e.bindMatrix).toArray(u,c*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new w.BufferAttribute(u,16)),joints:a,skeleton:s.get(o)}),i.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);const r={};if(s.trs){const a=e.quaternion.toArray(),u=e.position.toArray(),f=e.scale.toArray();ze(a,[0,0,0,1])||(r.rotation=a),ze(u,[0,0,0])||(r.translation=u),ze(f,[1,1,1])||(r.scale=f)}else e.matrixAutoUpdate&&e.updateMatrix(),ms(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let u=0,f=e.children.length;u<f;u++){const l=e.children[u];if(l.visible||s.onlyVisible===!1){const c=this.processNode(l);c!==null&&a.push(c)}}a.length>0&&(r.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,r)});const o=t.nodes.push(r)-1;return i.set(e,o),o}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const r=[];for(let o=0,a=e.children.length;o<a;o++){const u=e.children[o];if(u.visible||s.onlyVisible===!1){const f=this.processNode(u);f!==null&&r.push(f)}}r.length>0&&(i.nodes=r),this.serializeUserData(e,i)}processObjects(e){const t=new w.Scene;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(i){i.beforeParse&&i.beforeParse(e)});const s=[];for(let i=0;i<e.length;i++)e[i]instanceof w.Scene?this.processScene(e[i]):s.push(e[i]);s.length>0&&this.processObjects(s);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i].clip,t.animations[i].mesh);this._invokeAll(function(i){i.afterParse&&i.afterParse(e)})}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}}class bs{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const s=this.writer,i=s.json,r=s.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.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."),r[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},r[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class xs{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class vs{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;const s=this.writer,i=s.extensionsUsed,r={};t.pbrMetallicRoughness.baseColorFactor&&(r.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);const o=[1,1,1];if(e.specular.toArray(o,0),r.specularFactor=o,r.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(r.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){const a={index:s.processTexture(e.specularMap)};s.applyTextureTransform(a,e.specularMap),r.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}Mt.Utils={insertKeyframe:function(n,e){const s=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),r=new n.ValueBufferType(n.values.length+s),o=n.createInterpolant(new n.ValueBufferType(s));let a;if(n.times.length===0){i[0]=e;for(let u=0;u<s;u++)r[u]=0;a=0}else if(e<n.times[0]){if(Math.abs(n.times[0]-e)<.001)return 0;i[0]=e,i.set(n.times,1),r.set(o.evaluate(e),0),r.set(n.values,s),a=0}else if(e>n.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),r.set(n.values,0),r.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let u=0;u<n.times.length;u++){if(Math.abs(n.times[u]-e)<.001)return u;if(n.times[u]<e&&n.times[u+1]>e){i.set(n.times.slice(0,u+1),0),i[u+1]=e,i.set(n.times.slice(u+1),u+2),r.set(n.values.slice(0,(u+1)*s),0),r.set(o.evaluate(e),(u+1)*s),r.set(n.values.slice((u+1)*s),(u+2)*s),a=u+1;break}}return n.times=i,n.values=r,a},mergeMorphTargetTracks:function(n,e){const t=[],s={},i=n.tracks;for(let r=0;r<i.length;++r){let o=i[r];const a=w.PropertyBinding.parseTrackName(o.name),u=w.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.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."),o=o.clone(),o.setInterpolation(w.InterpolateLinear)}const f=u.morphTargetInfluences.length,l=u.morphTargetDictionary[a.propertyIndex];if(l===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let c;if(s[u.uuid]===void 0){c=o.clone();const h=new c.ValueBufferType(f*c.times.length);for(let m=0;m<c.times.length;m++)h[m*f+l]=c.values[m];c.name=(a.nodeName||"")+".morphTargetInfluences",c.values=h,s[u.uuid]=c,t.push(c);continue}const d=o.createInterpolant(new o.ValueBufferType(1));c=s[u.uuid];for(let h=0;h<c.times.length;h++)c.values[h*f+l]=d.evaluate(c.times[h]);for(let h=0;h<o.times.length;h++){const m=this.insertKeyframe(c,o.times[h]);c.values[m*f+l]=o.values[h]}}return n.tracks=t,n}};const ws=function(n){const e=n;this.exportGLTF=t=>{const i=e.getRootRegion().getAllObjects(!0),r=[];i.forEach(u=>{u.animationClip&&r.push({clip:u.animationClip[0],mesh:u.getMorph()})});const o=new Mt,a={binary:t,animations:r};return new Promise((u,f)=>{o.parse(e.getThreeJSScene(),function(l){u(l)},a)})}},As=function(){const n=this;this.parseGLTFObjects=(e,t,s,i)=>{let r=t;if(s!==0)if(e.type==="Object3D"){if(e.name!==""&&(t&&(r=t.findOrCreateChildFromPath(e.name)),r)){const o=r.getGroup();o.position.copy(e.position),o.rotation.copy(e.rotation),o.quaternion.copy(e.quaternion),o.matrixAutoUpdate=!0}}else{let o;if(e.type==="Mesh"?o=new Fe:e.type==="LineSegments"?o=new Ve:e.type==="Points"&&(o=new Te),o){let a=!1,u=!1;e.geometry&&e.geometry.morphAttributes&&(a=!!e.geometry.morphAttributes.position,u=!!e.geometry.morphAttributes.color),o.setMesh(e.clone(),a,u);const f=o.getMorph();o.groupName=f.name,f.matrixAutoUpdate=!0,t.addZincObject(o),i!=null&&typeof i=="function"&&i(o)}}s++,e.children.forEach(o=>{n.parseGLTFObjects(o,r,s,i)})},this.setCamera=e=>{e.viewAll();const t=e.getZincCameraControls(),s=t.getCurrentViewport();t.addViewport("default",s),t.setDefaultViewport("default")},this.load=(e,t,s,i,r,o)=>{const a=s.substring(0,s.lastIndexOf("/")+1),u=s.substring(s.lastIndexOf("/")+1,s.length);new Bi.GLTFLoader().setPath(a).load(u,function(l){console.log(l),n.parseGLTFObjects(l.scene,t,0,i),n.setCamera(e),r!=null&&typeof r=="function"&&r()})}},Ms=/^[og]\s*(.+)?/,_s=/^mtllib /,Ss=/^usemtl /,Cs=/^usemap /,bi=new w.Vector3,St=new w.Vector3,xi=new w.Vector3,vi=new w.Vector3,xe=new w.Vector3;function Os(){const n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,r){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:i||"",mtllib:Array.isArray(r)&&r.length>0?r[r.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(u){const f={index:typeof u=="number"?u:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return f.clone=this.clone.bind(f),f}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.vertices.length/3,r.groupCount=r.groupEnd-r.groupStart,r.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),r}},s&&s.name&&typeof s.clone=="function"){const i=s.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseNormalIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseUVIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/2)*2},addVertex:function(e,t,s){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,s){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[s+0],i[s+1],i[s+2])},addFaceNormal:function(e,t,s){const i=this.vertices,r=this.object.geometry.normals;bi.fromArray(i,e),St.fromArray(i,t),xi.fromArray(i,s),xe.subVectors(xi,St),vi.subVectors(bi,St),xe.cross(vi),xe.normalize(),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z),r.push(xe.x,xe.y,xe.z)},addColor:function(e,t,s){const i=this.colors,r=this.object.geometry.colors;i[e]!==void 0&&r.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&r.push(i[t+0],i[t+1],i[t+2]),i[s]!==void 0&&r.push(i[s+0],i[s+1],i[s+2])},addUV:function(e,t,s){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[s+0],i[s+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,s,i,r,o,a,u,f){const l=this.vertices.length;let c=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),h=this.parseVertexIndex(s,l);if(this.addVertex(c,d,h),this.addColor(c,d,h),a!==void 0&&a!==""){const m=this.normals.length;c=this.parseNormalIndex(a,m),d=this.parseNormalIndex(u,m),h=this.parseNormalIndex(f,m),this.addNormal(c,d,h)}else this.addFaceNormal(c,d,h);if(i!==void 0&&i!==""){const m=this.uvs.length;c=this.parseUVIndex(i,m),d=this.parseUVIndex(r,m),h=this.parseUVIndex(o,m),this.addUV(c,d,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let s=0,i=e.length;s<i;s++){const r=this.parseVertexIndex(e[s],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const s=this.vertices.length,i=this.uvs.length;for(let r=0,o=e.length;r<o;r++)this.addVertexLine(this.parseVertexIndex(e[r],s));for(let r=0,o=t.length;r<o;r++)this.addUVLine(this.parseUVIndex(t[r],i))}};return n.startObject("",!1),n}class wi extends w.Loader{constructor(e){super(e),this.materials=null}load(e,t,s,i){const r=this,o=new w.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Os;e.indexOf(`\r
|
|
288
288
|
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
289
289
|
`)),e.indexOf(`\\
|
|
290
290
|
`)!==-1&&(e=e.replace(/\\\n/g,""));const s=e.split(`
|
|
291
|
-
`);let i="",r="",o=0,a=[];const u=typeof"".trimLeft=="function";for(let c=0,d=s.length;c<d;c++)if(i=s[c],i=u?i.trimLeft():i.trim(),o=i.length,o!==0&&(r=i.charAt(0),r!=="#"))if(r==="v"){const h=i.split(/\s+/);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?t.colors.push(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(r==="f"){const m=i.substr(1).trim().split(/\s+/),A=[];for(let g=0,M=m.length;g<M;g++){const _=m[g];if(_.length>0){const N=_.split("/");A.push(N)}}const b=A[0];for(let g=1,M=A.length-1;g<M;g++){const _=A[g],N=A[g+1];t.addFace(b[0],_[0],N[0],b[1],_[1],N[1],b[2],_[2],N[2])}}else if(r==="l"){const h=i.substring(1).trim().split(" ");let m=[];const A=[];if(i.indexOf("/")===-1)m=h;else for(let b=0,g=h.length;b<g;b++){const M=h[b].split("/");M[0]!==""&&m.push(M[0]),M[1]!==""&&A.push(M[1])}t.addLineGeometry(m,A)}else if(r==="p"){const m=i.substr(1).trim().split(" ");t.addPointGeometry(m)}else if((a=ws.exec(i))!==null){const h=(" "+a[0].substr(1).trim()).substr(1);t.startObject(h)}else if(Ms.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(As.test(i))t.materialLibraries.push(i.substring(7).trim());else if(_s.test(i))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(r==="s"){if(a=i.split(" "),a.length>1){const m=a[1].trim().toLowerCase();t.object.smooth=m!=="0"&&m!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(i==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}t.finalize();const f=new w.Group;if(f.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let c=0,d=t.objects.length;c<d;c++){const h=t.objects[c],m=h.geometry,A=h.materials,b=m.type==="Line",g=m.type==="Points";let M=!1;if(m.vertices.length===0)continue;const _=new w.BufferGeometry;_.setAttribute("position",new w.Float32BufferAttribute(m.vertices,3)),m.normals.length>0&&_.setAttribute("normal",new w.Float32BufferAttribute(m.normals,3)),m.colors.length>0&&(M=!0,_.setAttribute("color",new w.Float32BufferAttribute(m.colors,3))),m.hasUVIndices===!0&&_.setAttribute("uv",new w.Float32BufferAttribute(m.uvs,2));const N=[];for(let I=0,D=A.length;I<D;I++){const Z=A[I],F=Z.name+"_"+Z.smooth+"_"+M;let z=t.materials[F];if(this.materials!==null){if(z=this.materials.create(Z.name),b&&z&&!(z instanceof w.LineBasicMaterial)){const T=new w.LineBasicMaterial;w.Material.prototype.copy.call(T,z),T.color.copy(z.color),z=T}else if(g&&z&&!(z instanceof w.PointsMaterial)){const T=new w.PointsMaterial({size:10,sizeAttenuation:!1});w.Material.prototype.copy.call(T,z),T.color.copy(z.color),T.map=z.map,z=T}}z===void 0&&(b?z=new w.LineBasicMaterial:g?z=new w.PointsMaterial({size:1,sizeAttenuation:!1}):z=new w.MeshPhongMaterial,z.name=Z.name,z.flatShading=!Z.smooth,z.vertexColors=M,t.materials[F]=z),N.push(z)}let U;if(N.length>1){for(let I=0,D=A.length;I<D;I++){const Z=A[I];_.addGroup(Z.groupStart,Z.groupCount,I)}b?U=new w.LineSegments(_,N):g?U=new w.Points(_,N):U=new w.Mesh(_,N)}else b?U=new w.LineSegments(_,N[0]):g?U=new w.Points(_,N[0]):U=new w.Mesh(_,N[0]);U.name=h.name,f.add(U)}else if(t.vertices.length>0){const c=new w.PointsMaterial({size:1,sizeAttenuation:!1}),d=new w.BufferGeometry;d.setAttribute("position",new w.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(d.setAttribute("color",new w.Float32BufferAttribute(t.colors,3)),c.vertexColors=!0);const h=new w.Points(d,c);f.add(h)}return f}}const wi=S.FileLoader,Cs=n=>{const e=(t,s)=>{t.metadata.number_of_vertices+=s.metadata.number_of_vertices,"labels"in t&&t.labels.push(...t.labels),["axis1","axis2","axis3","colors","positions","scale"].forEach(r=>{r in t&&Object.keys(t[r]).forEach(o=>{const a=s[r][o].length;for(let u=0;u<a;u++)t[r][o].push(s[r][o][u])})})};if(n&&n.length>0)for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}},Os=n=>{const e=(t,s)=>{t.merge(s)};if(n&&n.length>0){for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}return n[0]}},Ts=function(n,e,t){const s=new wi,i=new $e;s.crossOrigin=e;const r=n,o=t;let a,u=!1,f=!1,l;const c=[],d=b=>{const g=a[b.index];if(g)if("GlyphGeometriesURL"in g)b.onLoad(g);else{let M=i.parse(g);b.onLoad(M.geometry,M.materials)}else h(b)},h=b=>{b.onError&&(l||(l={responseURL:r}),b.onError(l))};this.downloadCompleted=b=>{try{a=JSON.parse(b[0]),u=!1,f=!0,Array.isArray(a)?c.forEach(g=>d(g)):c.forEach(g=>h(g))}catch{c.forEach(g=>h(g))}};const m=()=>b=>{l=b,f=!0,u=!1,c.forEach(g=>{h(g)})},A=()=>b=>{c.forEach(g=>{g.onProgress&&g.onProgress(b)})};this.load=(b,g,M,_)=>{const N={index:b,onLoad:g,onProgress:M,onError:_};f?a?d(N):h(l):u?c.push(N):(c.push(N),u=!0,s.load(r,o,A,m))}},Ls=function(n,e,t){const s=[],i=n,r=e;let o=0;const a=t.isGlyphsets;this.itemDownloaded=(u,f)=>{if(s[u]=f,o++,o==i&&s.length>0)if(a){const l=s.map(c=>JSON.parse(c[0]));Cs(l),r(l[0])}else{const l=s[0][1],c=s.map(h=>h[0]),d=Os(c);for(let h=1;h<i;h++)s[u][0].dispose(),s[u][1].forEach(m=>m.dispose());r(d,l)}}},Bs=function(){let n=0;const e=20;this.crossOrigin="Anonymous";const t=new $e,s=new wi;s.crossOrigin="Anonymous";const i=[],r={},o=(l,c,d,h,m)=>{const A=l.length,b=new Ls(A,c,m);let g=0;l.forEach(M=>{const _=m?{...m}:{};_.msHandler=b,_.order=g,g++,u(M,c,d,h,_)})},a=(l,c,d,h,m)=>{const A=m?{...m}:{};let b=r[l];if(!b)if(e>n){const g=new f(void 0,this,A);++n,b=new Ts(l,this.crossOrigin,g),r[l]=b}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:m});b&&(A.isHandler=b,b.load(m.index,c,d,h))},u=(l,c,d,h,m)=>{if(m&&m.index!==void 0)a(l,c,d,h,m);else if(e>n){++n;const A=new f(c,this,m),b=new f(h,this,m);m.isGlyphsets?s.load(l,A,d,b):(t.crossOrigin=this.crossOrigin,t.load(l,A,d,b))}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:m})};this.load=(l,c,d,h,m)=>{Array.isArray(l)?o(l,c,d,h,m):u(l,c,d,h,m)},this.loadFromWaitingList=()=>{for(;e>n;){const l=i.shift();if(l)this.load(l.url,l.onLoad,l.onProgress,l.onError,l.options);else return}},this.itemRemainingCheck=()=>{if(i.length===0&&n===0)for(let l in r)r.hasOwnProperty(l)&&delete r[l]};const f=function(l,c,d){return(...h)=>{--n,d!=null&&d.msHandler?d.msHandler.itemDownloaded(d.order,h):d!=null&&d.isHandler?d.isHandler.downloadCompleted(h):l&&l(...h),c.loadFromWaitingList(),c.itemRemainingCheck()}};this.parse=l=>loader.parse(l)};class Ai extends w.Loader{constructor(e){super(e)}load(e,t,s,i){const r=this,o=new w.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}parse(e){function t(f){const l=new DataView(f),c=32/8*3+32/8*3*3+16/8,d=l.getUint32(80,!0);if(80+32/8+d*c===l.byteLength)return!0;const m=[115,111,108,105,100];for(let A=0;A<5;A++)if(s(m,l,A))return!1;return!0}function s(f,l,c){for(let d=0,h=f.length;d<h;d++)if(f[d]!==l.getUint8(c+d,!1))return!1;return!0}function i(f){const l=new DataView(f),c=l.getUint32(80,!0);let d,h,m,A=!1,b,g,M,_,N;for(let z=0;z<70;z++)l.getUint32(z,!1)==1129270351&&l.getUint8(z+4)==82&&l.getUint8(z+5)==61&&(A=!0,b=new Float32Array(c*3*3),g=l.getUint8(z+6)/255,M=l.getUint8(z+7)/255,_=l.getUint8(z+8)/255,N=l.getUint8(z+9)/255);const U=84,I=12*4+2,D=new w.BufferGeometry,Z=new Float32Array(c*3*3),F=new Float32Array(c*3*3);for(let z=0;z<c;z++){const T=U+z*I,L=l.getFloat32(T,!0),x=l.getFloat32(T+4,!0),O=l.getFloat32(T+8,!0);if(A){const P=l.getUint16(T+48,!0);P&32768?(d=g,h=M,m=_):(d=(P&31)/31,h=(P>>5&31)/31,m=(P>>10&31)/31)}for(let P=1;P<=3;P++){const V=T+P*12,p=z*3*3+(P-1)*3;Z[p]=l.getFloat32(V,!0),Z[p+1]=l.getFloat32(V+4,!0),Z[p+2]=l.getFloat32(V+8,!0),F[p]=L,F[p+1]=x,F[p+2]=O,A&&(b[p]=d,b[p+1]=h,b[p+2]=m)}}return D.setAttribute("position",new w.BufferAttribute(Z,3)),D.setAttribute("normal",new w.BufferAttribute(F,3)),A&&(D.setAttribute("color",new w.BufferAttribute(b,3)),D.hasColors=!0,D.alpha=N),D}function r(f){const l=new w.BufferGeometry,c=/solid([\s\S]*?)endsolid/g,d=/facet([\s\S]*?)endfacet/g;let h=0;const m=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,A=new RegExp("vertex"+m+m+m,"g"),b=new RegExp("normal"+m+m+m,"g"),g=[],M=[],_=new w.Vector3;let N,U=0,I=0,D=0;for(;(N=c.exec(f))!==null;){I=D;const Z=N[0];for(;(N=d.exec(Z))!==null;){let T=0,L=0;const x=N[0];for(;(N=b.exec(x))!==null;)_.x=parseFloat(N[1]),_.y=parseFloat(N[2]),_.z=parseFloat(N[3]),L++;for(;(N=A.exec(x))!==null;)g.push(parseFloat(N[1]),parseFloat(N[2]),parseFloat(N[3])),M.push(_.x,_.y,_.z),T++,D++;L!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+h),T!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+h),h++}const F=I,z=D-I;l.addGroup(F,z,U),U++}return l.setAttribute("position",new w.Float32BufferAttribute(g,3)),l.setAttribute("normal",new w.Float32BufferAttribute(M,3)),l}function o(f){return typeof f!="string"?w.LoaderUtils.decodeText(new Uint8Array(f)):f}function a(f){if(typeof f=="string"){const l=new Uint8Array(f.length);for(let c=0;c<f.length;c++)l[c]=f.charCodeAt(c)&255;return l.buffer||l}else return f}const u=a(e);return t(u)?i(u):r(o(e))}}const Mi=function(){Y.call(this),this.isTubeLines=!0;let n={},e={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(s,i,r)=>{if(s&&i){n={geometryIn:s,materialIn:i,options:r};const o=t(s.vertices),a=new S.MeshStandardMaterial({color:i.color}),u=new S.Mesh(o,a);this.setMesh(u,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=s=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=s,this.morph.material.needsUpdate=!0)},this.setAlpha=function(s){let i=this.getMorph();i.material.opacity=s,i.material.transparent=s<1,i.material.depthWrite=s>.5},this.setWireframe=s=>{let i=this.getMorph();i.material.wireframe=s},this.setTubeLines=(s,i)=>{if(s&&i){const{geometryIn:r}=n;let o=this.getMorph();o.geometry.dispose(),e=Object.assign(e,{radius:s,radialSegments:i}),o.geometry=t(r.vertices)}};const t=s=>{const{radius:i,radialSegments:r,smooth:o}=e;let a;if(o){const u=new S.CatmullRomCurve3(s);a=new S.TubeGeometry(u,s.length,i,r,!1)}else{const u=[];for(let f=0;f+1<s.length;f=f+2){const l=new S.LineCurve3(s[f],s[f+1]),c=new S.TubeGeometry(l,1,i,r,!1);u.push(c)}a=Di(u,!0),u.forEach(f=>f.dispose())}return a}};Mi.prototype=Object.create(Y.prototype);const Us=function(n){const e=n;this.toBeDownloaded=0,this.progressMap={};let t=!1,s=!1;const i=new Bs;this.getDownloadProgress=()=>{let T=0,L=0,x=!1;for(const O in this.progressMap){const P=this.progressMap[O];T+=P[1],L+=P[0],P[1]==0&&(x=!0)}return x&&(T=0),[T,L,s]},this.onProgress=T=>L=>{this.progressMap[T]=[L.loaded,L.total]},this.onError=T=>L=>{this.toBeDownloaded=this.toBeDownloaded-1,s=!0,console.error(`There is an issue with external resource ${L!=null&&L.responseURL?": "+(L==null?void 0:L.responseURL):""}.`),T&&T({type:"Error",xhr:L})};let r=(T,L)=>{const x=L.Default;if(L.Inline)e.setupMultipleViews(x,L.Entries);else{const O=[];for(const[P,V]of Object.entries(L.Entries))T&&(newURL=Pe(V,T),O.push(new Promise((p,B)=>{fetch(newURL).then(y=>y.json()).then(y=>p({key:P,data:y})).catch(y=>B(y))})));Promise.all(O).then(P=>{const V={};P.forEach(B=>{V[B.key]=B.data}),e.setupMultipleViews(x,V);let p=e.getZincCameraControls();p&&p.setCurrentViewport(x),t=!0})}};this.loadViewURL=(T,L)=>{this.toBeDownloaded+=1;const x=new XMLHttpRequest;x.onreadystatechange=()=>{if(x.readyState==4)if(x.status==200){const P=JSON.parse(x.responseText);e.setupMultipleViews("default",{default:P}),e.resetView(),t=!0,--this.toBeDownloaded,L!=null&&typeof L=="function"&&L()}else this.onError(L)({responseURL:T})};const O=ye(T);x.open("GET",O,!0),x.send()},this.loadModelsURL=(T,L,x,O,P,V,p)=>{const B=L.length;this.toBeDownloaded+=B;for(let y=0;y<B;y++){const C=L[y];let k=Se.defaultMaterialColor,R=Se.defaultOpacity;x!=null&&x[y]!=null&&(k=!!x[y]),O!=null&&O[y]!=null&&(R=O[y]);let G=0;P!=null&&P[y]!=null&&(G=!!P[y]);let q=0;V!=null&&V[y]!=null&&(q=!!V[y]),i.load(ye(C),m(T,k,R,G,q,void 0,void 0,void 0,void 0,p),this.onProgress(C),this.onError(p))}},this.loadFromViewURL=(T,L,x)=>{const O=new XMLHttpRequest;O.onreadystatechange=()=>{if(O.readyState==4&&O.status==200){const V=JSON.parse(O.responseText);e.loadView(V);const p=[],B=L+"_";for(let y=0;y<V.numberOfResources;y++){const C=B+(y+1)+".json";p.push(C)}this.loadModelsURL(T,p,V.colour,V.opacity,V.timeEnabled,V.morphColour,x)}};const P=ye(L+"_view.json");O.open("GET",P,!0),O.send()};const o=(T,L,x,O,P,V,p,B,y)=>(C,k)=>{const R=B?new Mi:new Ve;let G;k&&k[0]&&(G=new S.LineBasicMaterial({color:k[0].color.clone()}),1>k[0].opacity&&(G.transparent=!0),G.opacity=k[0].opacity,G.morphTargets=L,G.vertexColors=k[0].vertexColors);let q={};if(q.localTimeEnabled=L,q.localMorphColour=x,R&&(R.createLineSegment(C,G,q),R.setName(O),R.setAnatomicalId(P),R.setRenderOrder(V),T.addZincObject(R),R.setDuration(e.getDuration()),p&&p.levels))for(const[E,K]of Object.entries(p.levels))R.addLOD(i,E,K.URL,K.Index,p.preload);--this.toBeDownloaded,C.dispose(),y!=null&&typeof y=="function"&&y(R)};this.loadLinesURL=(T,L,x,O,P,V,p)=>{let B=0;this.toBeDownloaded+=1;let y=p!=null&&p.isInline?p.isInline:!1,C=p!=null&&p.anatomicalId?p.anatomicalId:void 0,k=p&&"renderOrder"in p?p.renderOrder:void 0;x!=null&&(B=!!x);let R=0;O!=null&&(R=!!O);let G=p.tubeLines&&!B&&!R;if(y){let q=i.parse(L);o(T,B,R,P,C,k,p.lod,G,V)(q.geometry,q.materials)}else i.load(L,o(T,B,R,P,C,k,p.lod,G,V),this.onProgress(L),this.onError(V),p.loaderOptions)};const a=(T,L,x,O,P)=>V=>{let p=V;(typeof p=="string"||p instanceof String)&&(p=JSON.parse(V));let B=P&&P.isInline?P.isInline:void 0,y=P&&P.anatomicalId?P.anatomicalId:void 0,C=P&&P.displayLabels?P.displayLabels:void 0,k=P&&"renderOrder"in P?P.renderOrder:void 0;const R=new ft;R.setDuration(e.getDuration()),R.groupName=x;let G=()=>{--this.toBeDownloaded,O!=null&&typeof O=="function"&&O(R)};++this.toBeDownloaded,B?R.load(p,L,G,B,C):R.load(p,ye(L),G,B,C),R.setAnatomicalId(y),R.setRenderOrder(k),T.addZincObject(R)};this.loadGlyphsetURL=(T,L,x,O,P,V)=>{(V&&V.isInline?V.isInline:!1)?a(T,x,O,P,V)(L):i.load(L,a(T,x,O,P,V),this.onProgress(L),this.onError(P),V.loaderOptions)};const u=(T,L,x,O,P,V,p)=>(B,y)=>{const C=new Oe;let k=new S.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});y&&y[0]&&(1>y[0].opacity&&(k.transparent=!0),k.opacity=y[0].opacity,k.color=y[0].color,k.morphTargets=L,k.vertexColors=y[0].vertexColors);let R={};R.localTimeEnabled=L,R.localMorphColour=x,C&&(C.createMesh(B,k,R),C.setName(O),C.setAnatomicalId(P),T.addZincObject(C),C.setDuration(e.getDuration()),C.setRenderOrder(V)),B.dispose(),--this.toBeDownloaded,p!=null&&typeof p=="function"&&p(C)};this.loadSTL=(T,L,x,O)=>{this.toBeDownloaded+=1;const P=Se.defaultMaterialColor,V=Se.defaultOpacity,p=new Ai;p.crossOrigin="Anonymous",p.load(ye(L),m(T,P,V,!1,!1,x,void 0,void 0,void 0,O))},this.loadOBJ=(T,L,x,O)=>{this.toBeDownloaded+=1;const P=Se.defaultMaterialColor,V=Se.defaultOpacity,p=new vi;p.crossOrigin="Anonymous",p.load(ye(L),m(T,P,V,!1,!1,x,void 0,void 0,void 0,O))};const f=(T,L,x,O,P,V,p)=>{this.toBeDownloaded+=1;const B=Se.defaultMaterialColor,y=Se.defaultOpacity;let C=0,k=p&&p.isInline?p.isInline:!1,R=p&&p.fileFormat?p.fileFormat:void 0,G=p&&p.anatomicalId?p.anatomicalId:void 0,q=p&&"renderOrder"in p?p.renderOrder:void 0;x!=null&&(C=!!x);let E=0;O!=null&&(E=!!O);let K=i;if(R!==void 0){if(R=="STL")K=new Ai;else if(R=="OBJ"){K=new vi,K.crossOrigin="Anonymous",K.load(L,objloader(T,B,y,C,E,P,G,V),this.onProgress(L),this.onError,p.loaderOptions);return}}if(k){const $=i.parse(L);m(T,B,y,C,E,P,G,q,p,V)($.geometry,$.materials)}else K.crossOrigin="Anonymous",i.load(L,m(T,B,y,C,E,P,G,q,p,V),this.onProgress(L),this.onError(V),p.loaderOptions)},l=function(T,L,x){let O=0;return P=>{if(O=O+1,P&&L!=null&&typeof L=="function"&&L(P),O==T&&(t===!1&&e.viewAll(),x!=null&&typeof x=="function")){x();let V=e.getZincCameraControls();V&&V.calculateMaxAllowedDistance(e)}}};this.loadPointsetURL=(T,L,x,O,P,V,p)=>{let B=0;this.toBeDownloaded+=1,x!=null&&(B=!!x);let y=0;O!=null&&(y=!!O);let C=p&&p.isInline?p.isInline:!1,k=p&&p.anatomicalId?p.anatomicalId:void 0,R=p&&"renderOrder"in p?p.renderOrder:void 0;if(C){const G=i.parse(L);u(T,B,y,P,k,R,V)(G.geometry,G.materials)}else i.load(L,u(T,B,y,P,k,R,V),this.onProgress(L),this.onError(V),p.loaderOptions)};const c=(T,L,x,O,P,V)=>{let p=V&&V.isInline?V.isInline:void 0,B=V&&V.anatomicalId?V.anatomicalId:void 0,y=V&&"renderOrder"in V?V.renderOrder:void 0,C;if(x){if(L&&x.images&&x.images.source){const k=x.images.source;for(let R=0;R<k.length;R++){const G=Pe(k[R],L);x.images.source[R]=G}}if(x.type==="slides"&&(C=new Ee),C){C.groupName=O;let k=()=>{T.addZincObject(C),--this.toBeDownloaded,P!=null&&typeof P=="function"&&P(C)};++this.toBeDownloaded,C.load(x,k,p),C.setAnatomicalId(B),C.setRenderOrder(y)}}},d=(T,L,x,O,P)=>()=>{if(L.readyState==4&&L.status==200){const V=JSON.parse(L.responseText);c(T,L.responseURL,V,x,O,P)}};this.loadTextureURL=(T,L,x,O,P)=>{if(P&&P.isInline?P.isInline:!1)c(T,void 0,L,x,O,P);else{const p=new XMLHttpRequest;p.onreadystatechange=d(T,p,x,O,P),p.open("GET",ye(L),!0),p.send()}};const h=(T,L,x,O,P,V,p,B,y,C,k)=>{let R={};R.colour=x,R.opacity=O,R.localTimeEnabled=P,R.localMorphColour=V;const G=new Fe;if(G.createMesh(L,B,R),G.getMorph())return G.setName(y),G.setRenderOrder(C),G.setAnatomicalId(k),T&&T.addZincObject(G),G.setDuration(e.getDuration()),G.videoHandler&&e.setVideoHandler(G.videoHandler),G},m=(T,L,x,O,P,V,p,B,y,C)=>(k,R)=>{let G;R&&R[0]&&(G=R[0]);const q=h(T,k,L,x,O,P,void 0,G,V,B,p);if(y.lod&&y.lod.levels)for(const[E,K]of Object.entries(y.lod.levels))q.addLOD(i,E,K.URL,K.Index,y.lod.preload);--this.toBeDownloaded,k.dispose(),C!=null&&typeof C=="function"&&C(q)},A=T=>{const L=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,[,x,O,P,V,p,B,y]=T.match(L);return{years:x,months:O,weeks:P,days:V,hours:p,mins:B,secs:y}};this.loadSettings=T=>{if(T){if(T.Duration){const L=A(T.Duration);e.setDurationFromObject(L)}if(T.OriginalDuration){const L=A(T.OriginalDuration);e.setOriginalDurationFromObject(L)}if(T.TimeStamps)for(const L in T.TimeStamps){const x=A(T.TimeStamps[L]);e.addMetadataTimeStamp(L,x)}}};const b=(T,L,x,O,P)=>{if(x){let V,p=!1;x.URL?(V=x.URL,L&&(V=Pe(V,L))):x.Inline&&(V=x.Inline.URL,p=!0);const B={};if(x.LOD&&x.LOD.Levels){B.preload=!!x.LOD.Preload,B.levels={};for(const[k,R]of Object.entries(x.LOD.Levels))B.levels[k]={},B.levels[k].URL=Pe(R.URL,L),B.levels[k].Index=R.Index}let y=x.GroupName;(y===void 0||y==="")&&(y="_Unnamed");let C={loaderOptions:{index:x.Index},isInline:p,fileFormat:x.FileFormat,anatomicalId:x.AnatomicalId,compression:x.compression,tubeLines:x.tubeLines,lod:B,renderOrder:O};switch(x.Type){case"Surfaces":f(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Glyph":let k;p?k=x.Inline.GlyphGeometriesURL:(k=x.GlyphGeometriesURL,k=Pe(x.GlyphGeometriesURL,L)),x.DisplayLabels&&(C.displayLabels=!0),C.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(T,V,k,y,P,C);break;case"Points":this.loadPointsetURL(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Lines":this.loadLinesURL(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Texture":this.loadTextureURL(T,V,y,P,C);break}}},g=(T,L,x)=>{if(L){let O,P=!1;switch(L.URL?(O=L.URL,T&&(O=Pe(L.URL,T))):L.Inline&&(O=L.Inline.URL,P=!0),L.Type){case"View":P?(e.setupMultipleViews("default",{default:O}),t=!0,x!=null&&typeof x=="function"&&x()):this.loadViewURL(O,x);break;case"Settings":this.loadSettings(L);break}}};this.loadGLTF=(T,L,x,O,P)=>{new vs().load(e,T,L,x,O,P)};let M=(T,L,x,O)=>{if(x.Primitives&&x.Primitives.forEach(P=>{let V=1;P.Order&&(V=P.Order),b(T,L,P,V,O)}),x.Transformation&&T.setTransformation(x.Transformation),x.Children)for(const[P,V]of Object.entries(x.Children)){const p=T.findOrCreateChildFromPath(P);p&&M(p,L,V,O)}},_=(T,L)=>{var p,B;let x=T;const O=(p=L==null?void 0:L.enabled)==null?void 0:p.include,P=(B=L==null?void 0:L.enabled)==null?void 0:B.exclude,V=L==null?void 0:L.tubeLines;return(O!=null&&O.length||P!=null&&P.length)&&(O&&(x=T.filter(y=>{if(y.Type==="View")return!0;for(let C=0;C<O.length;C++)if(Nt(y.RegionPath,y.GroupName,O[C]))return!0;return!1})),P&&(x=x.filter(y=>{if(y.Type==="View")return!0;for(let C=0;C<P.length;C++)if(Nt(y.RegionPath,y.GroupName,P[C]))return!1;return!0}))),V&&x.forEach(y=>{y.Type==="Lines"&&(y.tubeLines=!0)}),x},N=(T,L)=>Array.isArray(T)?_(T,L):T,U=(T,L)=>{if(Array.isArray(T)){let x=0;for(let O=0;O<T.length;O++)T[O].Type&&(L&&T[O].Type==="View"||T[O].Type==="Surfaces"||T[O].Type==="Glyph"||T[O].Type==="Points"||T[O].Type==="Lines"||T[O].Type==="Texture")&&x++;return x}return 0},I=T=>{let L=T.Primitives?U(T.Primitives,!1):0;return T.Children&&Object.values(T.Children).forEach(x=>{L+=I(x)}),L},D=T=>{if(Array.isArray(T))return U(T,!0);if(typeof T=="object"&&T!==null&&T.Version==="2.0")return I(T.Regions)},Z=(T,L,x,O,P)=>{let V=T;x.RegionPath&&x.RegionPath!==""&&(V=T.findOrCreateChildFromPath(x.RegionPath)),b(V,L,x,O*2,P)},F=(T,L,x,O,P,V)=>{const p=N(L,V);let B=D(p),y=new l(B,O,P);for(let C=0;C<L.length;C++)g(x,p[C],y);for(let C=0;C<L.length;C++)Z(T,x,p[C],C,y)},z=(T,L,x,O,P)=>{let V=D(L),p=new l(V,O,P);L.Settings&&this.loadSettings(L.Settings),L.Views&&r(x,L.Views),L.Regions&&M(T,x,L.Regions,p)};this.loadMetadataURL=(T,L,x,O,P)=>{const V=new XMLHttpRequest,p=ye(L);V.onreadystatechange=()=>{if(V.readyState==4&&V.status==200){e.resetMetadata(),e.resetDuration(),t=!1;let B=V.responseURL;B===void 0&&(B=new URL(p).href);const y=JSON.parse(V.responseText);Array.isArray(y)?F(T,y,B,x,O,P):typeof y=="object"&&y!==null&&y.Version=="2.0"&&z(T,y,B,x,O)}},V.open("GET",p,!0),V.send()}};let Ns=0;const Ps=function(){return"sc"+Ns++},_i=function(){return{Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},Vs=6e3,Ct=function(n,e){const t=n;let s,i,r=new Us(this),o,a={},u=0,f={},l=0;const c=new S.Scene,d=new S.Scene,h=new ui(void 0,this);c.add(h.getGroup());const m=new S.Group;c.add(m),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let A=6e3,b;this.sceneName=void 0;let g=!1,M;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};let _={x:0,y:0},N=_i(),U=new S.Vector2,I=[];this.forcePickableObjectsUpdate=!1,this.uuid=Ps();let D=new ni(this);D.disable(),c.add(D.group);let Z={main:[],mini:[]};const F=new S.Vector3(0,0,0),z=()=>t?typeof t.clientWidth<"u"?t.clientWidth:t.width:0,T=()=>t?typeof t.clientHeight<"u"?t.clientHeight:t.height:0;this.getDownloadProgress=()=>r.getDownloadProgress(),this.onWindowResize=()=>{const p=T();this.camera.aspect=z()/p,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,b.onResize(),b.calculateHeightPerPixelAtZeroDepth(p)},this.resetView=()=>{this.onWindowResize(),b.resetView()},this.changeZoomByScrollRateUnit=p=>{b.changeZoomByScrollRateUnit(p)},(()=>{this.camera=new S.PerspectiveCamera(40,z()/T(),0,10),this.ambient=new S.AmbientLight(16777215,.2),c.add(this.ambient),this.directionalLight=new S.DirectionalLight(16777215,.8),c.add(this.directionalLight),b=new $t(this.camera,e.domElement,e,this),b.setDirectionalLight(this.directionalLight),b.resetView(),o=new ns(this)})(),this.loadView=p=>{const B=new Re;return B.setFromObject(p),b.setCurrentCameraSettings(B),!0},this.setupMultipleViews=(p,B)=>{for(const[y,C]of Object.entries(B)){const k=new Re;k.setFromObject(C),b.addViewport(y,k)}b.setDefaultViewport(p)},this.getBoundingBox=()=>h.getBoundingBox(!0),this.viewAllWithBoundingBox=p=>{if(p){const B=b.getViewportFromBoundingBox(p,1);b.setCurrentCameraSettings(B),b.calculateHeightPerPixelAtZeroDepth(T()),D.markerUpdateRequired=!0}},this.viewAll=()=>{const p=this.getBoundingBox();this.viewAllWithBoundingBox(p),D.markerUpdateRequired=!0},this.forEachGeometry=p=>{h.forEachGeometry(p,!0)},this.forEachGlyphset=p=>{h.forEachGlyphset(p,!0)},this.forEachPointset=p=>{h.forEachPointset(p,!0)},this.forEachLine=p=>{h.forEachLine(p,!0)},this.findGeometriesWithGroupName=p=>h.findGeometriesWithGroupName(p,!0),this.findPointsetsWithGroupName=p=>h.findPointsetsWithGroupName(p,!0),this.findGlyphsetsWithGroupName=p=>h.findGlyphsetsWithGroupName(p,!0),this.findLinesWithGroupName=p=>h.findLinesWithGroupName(p,!0),this.findObjectsWithGroupName=p=>h.findObjectsWithGroupName(p,!0),this.findObjectsWithAnatomicalId=p=>h.findObjectsWithAnatomicalId(p,!0),this.getBoundingBoxOfZincObjects=p=>{let B;for(let y=0;y<p.length;y++){let C=p[y].getBoundingBox();C&&(B?B.union(C):B=C)}return B},this.vectorToScreenXY=p=>{p.project(this.camera);let B=z(),y=T(),C=B/2,k=y/2;return p.x=p.x*C+C,p.y=-(p.y*k)+k,p},this.getObjectsScreenXY=p=>{if(p&&p.length>0){let B=this.getBoundingBoxOfZincObjects(p);const y=new S.Vector3;return B.getCenter(y),this.vectorToScreenXY(y)}},this.getNamedObjectsScreenXY=p=>{let B=this.findObjectsWithGroupName(p);return this.getObjectsScreenXY(B)},this.addZincObject=p=>{p&&(h.addZincObject(p),b&&b.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(p,B,y,C)=>{r.loadGlyphsetURL(h,p,B,y,C)},this.loadPointsetURL=(p,B,y,C,k)=>{r.loadPointsetURL(h,p,B,y,C,k)},this.loadLinesURL=(p,B,y,C,k)=>{r.loadLinesURL(h,p,B,y,C,k)},this.loadSTL=(p,B,y)=>{r.loadSTL(h,p,B,y)},this.loadOBJ=(p,B,y)=>{r.loadOBJ(h,p,B,y)},this.loadMetadataURL=(p,B,y,C)=>{r.loadMetadataURL(h,p,B,y,C)},this.loadModelsURL=(p,B,y,C,k,R)=>{r.loadModelsURL(h.urls,B,y,C,k,R)},this.loadViewURL=p=>{r.loadViewURL(p)},this.loadFromViewURL=(p,B)=>{r.loadFromViewURL(p,B)},this.loadGLTF=(p,B,y,C)=>{r.loadGLTF(h,p,B,y,C)},this.updateDirectionalLight=()=>{b.updateDirectionalLight()},this.addObject=p=>{c.add(p)},this.removeObject=p=>{c.remove(p)},this.getCurrentTime=()=>{if(i!=null)return i.getCurrentTime(A);const p=h.getCurrentTime();return p!==-1?p:0},this.setMorphsTime=p=>{i!=null&&i.setMorphTime(p,A),h.setMorphTime(p,!0)},this.isTimeVarying=()=>i&&i.video&&!i.video.error?!0:h.isTimeVarying(),this.renderGeometries=(p,B,y)=>{let C={};if(C.camera=b,C.displayMarkers=this.displayMarkers,C.markerCluster=D,C.markersList=D.markers,C.ndcToBeUpdated=!1,y&&(C.markerCluster.markerUpdateRequired=!0),i)if(i.isReadyToPlay()){y?i.video.play():i.video.pause();const k=i.video.currentTime/i.getVideoDuration()*A;r.toBeDownloaded==0?(b.setTime(k),C.ndcToBeUpdated=b.update(0),C.ndcToBeUpdated&&b.calculateHeightPerPixelAtZeroDepth(T()),h.setMorphTime(k,!0),h.renderGeometries(0,0,y,b,C,!0)):b.update(0)}else myPlayRate=0;else r.toBeDownloaded==0?(C.ndcToBeUpdated=b.update(B),C.ndcToBeUpdated&&b.calculateHeightPerPixelAtZeroDepth(T()),h.renderGeometries(p,B,y,b,C,!0)):b.update(0)},this.getThreeJSScene=()=>c,this.setVideoHandler=p=>{i||(i=p)},this.setAdditionalScenesGroup=p=>{c.add(p)};let x=(p,B,y,C,k,R,G)=>{let q=0,E=0;return p.includes("top")?E=G-k-y:p.includes("bottom")?E=y:E=Math.floor((G-k)/2),p.includes("left")?q=B:p.includes("right")?q=R-B-C:q=Math.floor((R-C)/2),{x:q,y:E}};const O=p=>{(this.displayMinimap||this.displayMiniAxes)&&(p.setScissorTest(!0),p.getSize(U),this.minimapScissor.updateRequired&&(_=x(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,U.x,U.y),this.minimapScissor.updateRequired=!1),p.setScissor(_.x,_.y,this.minimapScissor.width,this.minimapScissor.height),p.setViewport(_.x,_.y,this.minimapScissor.width,this.minimapScissor.height),o.updateCamera(),this.displayMiniAxes?p.render(d,o.camera):(c.add(o.mask),p.render(c,o.camera),c.remove(o.mask)),p.setScissorTest(!1),p.setViewport(0,0,U.x,U.y))};this.render=p=>{this.autoClearFlag&&p.clear(),g&&M?M.render(c,this.camera):(p.render(c,this.camera),O(p))},this.setInteractiveControlEnable=p=>{p==!0?b.enable():b.disable()},this.getZincCameraControls=()=>b,this.getThreeJSScene=()=>c,this.setDuration=p=>{h.setDuration(p),A=p,b.setPathDuration(p),r.duration=p},this.getDuration=()=>A,this.setStereoEffectEnable=p=>{p==!0&&(M||(M=new si(e))),e.setSize(z(),T()),this.camera.updateProjectionMatrix(),g=p},this.objectIsInScene=p=>h.objectIsInRegion(p,!0),this.alignBoundingBoxToCameraView=(p,B)=>{if(p){p.getCenter(F);const y=this.getZincCameraControls().getCurrentViewport(),C=new S.Vector3(y.targetPosition[0],y.targetPosition[1],y.targetPosition[2]),k=new S.Vector3(y.eyePosition[0],y.eyePosition[1],y.eyePosition[2]),R=new S.Vector3,G=new S.Vector3;R.subVectors(C,k).normalize(),G.subVectors(C,F).normalize();const q=new S.Vector3;q.crossVectors(R,G);const E=R.angleTo(G);B>0?(this.getZincCameraControls().rotateCameraTransition(q,E,B),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(q,E),D.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(p,B,y)=>{if(p){const C=this.getZincCameraControls().getCurrentViewport(),k=this.getZincCameraControls().getViewportFromBoundingBox(p,B);y>0&&(this.getZincCameraControls().cameraTransition(C,k,y),this.getZincCameraControls().enableCameraTransition()),D.markerUpdateRequired=!0}},this.alignObjectToCameraView=(p,B)=>{if(this.objectIsInScene(p)){const y=p.getBoundingBox();this.alignBoundingBoxToCameraView(y,B)}},this.setCameraTargetToObject=p=>{if(this.objectIsInScene(p)){const B=p.getBoundingBox(),y=this.getZincCameraControls().getCurrentViewport();B.getCenter(F);const C=new S.Vector3(y.targetPosition[0],y.targetPosition[1],y.targetPosition[2]),k=new S.Vector3(y.eyePosition[0],y.eyePosition[1],y.eyePosition[2]),R=new S.Vector3,G=new S.Vector3;R.subVectors(k,C),G.addVectors(F,R),y.eyePosition[0]=G.x,y.eyePosition[1]=G.y,y.eyePosition[2]=G.z,y.targetPosition[0]=F.x,y.targetPosition[1]=F.y,y.targetPosition[2]=F.z,this.getZincCameraControls().setCurrentCameraSettings(y),D.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>g,this.removeZincObject=p=>{h.removeZincObject(p),b&&b.calculateMaxAllowedDistance(this),D.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{I.length=0,D.isEnabled&&I.push(D.group),h.getPickableThreeJSObjects(I,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||h.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),I),this.getNormalisedMinimapCoordinates=(p,B)=>{if(this.displayMinimap){const y=new S.Vector2;p.getSize(y);let C=y.y-B.clientY;if(_.x+this.minimapScissor.width>B.clientX&&B.clientX>_.x&&_.y+this.minimapScissor.height>C&&C>_.y){let k=(B.clientX-_.x)/this.minimapScissor.width*2-1,R=(C-_.y)/this.minimapScissor.height*2-1;return{x:k,y:R}}}},this.getMinimapDiffFromNormalised=(p,B)=>{if(o)return o.getDiffFromNormalised(p,B)},this.isWebGL2=()=>e.isWebGL2(),this.clearAll=()=>{D.clear(),h.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),r.toBeDwonloaded=0,b&&b.calculateMaxAllowedDistance(this),D.markerUpdateRequired=!0},this.addMetadataTimeStamp=(p,B)=>{N.TimeStamps[p]=V(B)},this.getMetadataTag=p=>N[p],this.getMetadata=()=>N,this.setMetadataTag=(p,B)=>{N[p]=B},this.removeMetadataTag=p=>{delete N[p]},this.resetMetadata=()=>{N=_i()},this.resetDuration=()=>{this.setDuration(Vs)};const P=p=>[...p.years?[`${p.years}years`]:[],...p.months?[`${p.months}months`]:[],...p.weeks?[`${p.weeks}weeks`]:[],...p.days?[`${p.days}days`]:[],...p.hours?[`${p.hours}hours`]:[],...p.mins?[`${p.mins}mins`]:[],...p.secs?[`${p.secs}secs`]:[]].join(" "),V=p=>p.years?p.years*31536e6:0+p.months?p.months*2592e6:0+p.weeks?p.weeks*6048e5:0+p.days?p.days*864e5:0+p.hours?p.hours*36e5:0+p.mins?p.mins*6e4:0+p.secs?p.secs*1e3:0;this.setDurationFromObject=p=>{const B=P(p),y=V(p);this.setMetadataTag("Duration",B),this.setDuration(y)},this.setOriginalDurationFromObject=p=>{const B=P(p);this.setMetadataTag("OriginalDuration",B)},this.exportGLTF=p=>new xs(this).exportGLTF(p),this.getRootRegion=()=>h,this.createLines=(p,B,y,C)=>{let k=h.findChildFromPath(p);return k===void 0&&(k=h.createChildFromPath(p)),k.createLines(B,y,C)},this.createPoints=(p,B,y,C,k)=>{let R=h.findChildFromPath(p);return R===void 0&&(R=h.createChildFromPath(p)),R.createPoints(B,y,C,k)},this.addZincObjectAddedCallbacks=p=>(u=u+1,a[u]=p,u),this.addZincObjectRemovedCallbacks=p=>(l=l+1,f[l]=p,l),this.removeZincObjectAddedCallbacks=p=>{p in u&&delete a[p]},this.removeZincObjectRemovedCallbacks=p=>{p in l&&delete f[p]},this.clearZincObjectAddedCallbacks=()=>{a={},u=0},this.clearZincObjectRemovedCallbacks=()=>{f={},l=0},this.triggerObjectAddedCallback=p=>{for(let B in a)a.hasOwnProperty(B)&&a[B](p)},this.triggerObjectRemovedCallback=p=>{for(let B in f)f.hasOwnProperty(B)&&f[B](p)},this.addTemporaryPoints=(p,B)=>{const y=nt(p.length,p);let C=new S.PointsMaterial({alphaTest:.5,size:15,color:B,sizeAttenuation:!1});const k=Ut();C.map=k;let R=new gt(y,C);return m.add(R),R},this.addTemporaryLines=(p,B)=>{const y=nt(p.length,p),C=new S.LineBasicMaterial({color:B}),k=new Xe(y,C);return m.add(k),k},this.enableFrustumDisplay=()=>{this.camera&&!s&&(s=new S.CameraHelper(this.camera),c.add(s))},this.disableFrustumDisplay=()=>{s&&(c.remove(s),s.dispose(),s=void 0)},this.removeTemporaryPrimitive=p=>{m.remove(p),p.geometry.dispose(),p.material.dispose()},this.clearTemporaryPrimitives=()=>{let p=0;return m.children.forEach(y=>{y.geometry.dispose(),y.material.dispose(),p++}),m.clear(),p},this.addBoundingBoxPrimitive=(p,B,y,C,k,R=void 0)=>{let G=h.findChildFromPath(p);G===void 0&&(G=h.createChildFromPath(p));const q=R||this.getBoundingBox();F.set(0,0,0);const E=F.subVectors(q.max,q.min),K=new S.BoxGeometry(E.x,E.y,E.z),$=G.createGeometryFromThreeJSGeometry(B,K,y,C,k,1e4);return E.addVectors(q.min,q.max).multiplyScalar(.5),$.setPosition(E.x,E.y,E.z),$},this.addSlicesPrimitive=(p,B,y,C,k,R=void 0)=>{if(B&&B.length>=3&&y&&y.length>=3){let G=h.findChildFromPath(p);G===void 0&&(G=h.createChildFromPath(p));const q=R||this.getBoundingBox();F.set(0,0,0);const E=F.subVectors(q.max,q.min),K=["x","y","z"],$=[];let Q=0;return K.forEach(ee=>{let re;switch(ee){case"x":re=new S.PlaneGeometry(E.z,E.y),re.rotateY(Math.PI/2);break;case"y":re=new S.PlaneGeometry(E.x,E.z),re.rotateX(Math.PI/2);break;case"z":re=new S.PlaneGeometry(E.x,E.y);break}const H=G.createGeometryFromThreeJSGeometry(B[Q],re,y[Q],C,k,10001);$.push(H),Q++}),E.addVectors(q.min,q.max).multiplyScalar(.5),$.forEach(ee=>{ee.setPosition(E.x,E.y,E.z)}),$}},this.enableMarkerCluster=p=>{p?(D.markerUpdateRequired=!0,D.enable()):(D.markerUpdateRequired=!1,D.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,Z.main&&(this.enableAxisDisplay(!1,!1),Z.main.forEach(p=>{p.dispose&&p.dispose()})),Z.mini&&(this.enableAxisDisplay(!1,!0),Z.mini.forEach(p=>{p.dispose&&p.dispose()})),Z={main:[],mini:[]}},this.createAxisDisplay=(p=!1)=>{this.destroyAxisDisplay();const B=[{name:"x",dir:new S.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new S.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new S.Vector3(0,0,1),colour:"blue",hex:5592575}],y=this.getBoundingBox(),C=y.min.distanceTo(y.max);let k=new S.Vector3(0,0,0);p&&k.copy(y.min),B.forEach(R=>{const G=new S.ArrowHelper(R.dir,k,C,R.hex);Z.main.push(G);const q=new S.ArrowHelper(R.dir,y.getCenter(F),C/2,R.hex);Z.mini.push(q);const E=ot(R.name,.036,R.colour,"Asap",120,700),K=R.dir.clone().multiplyScalar(C).add(k);E.position.set(K.x,K.y,K.z),Z.main.push(E)})},this.enableAxisDisplay=(p,B=!1)=>{var y;B&&((y=Z==null?void 0:Z.mini)!=null&&y.length)?(this.displayMiniAxes=p,Z.mini.forEach(C=>{p?d.add(C):d.remove(C)})):!B&&Z.main&&Z.main.forEach(C=>{p?c.add(C):c.remove(C)})}},ks=function(n){let e=n,t,s;const i=new S.Clock(!1);this.playAnimation=!0;let r=1e3,o={},a=0,u={},f=0,l={},c=0,d={},h=0,m,A,b,g,M=[],_=[],N=new S.Group,U,I,D=!1,Z=!1;this.getDrawingWidth=()=>e?e.clientWidth:U?typeof U.clientWidth<"u"?Math.round(U.clientWidth):Math.round(U.width):0,this.getDrawingHeight=()=>e?e.clientHeight:U?typeof U.clientHeight<"u"?Math.round(U.clientHeight):Math.round(U.height):0,this.onWindowResize=()=>{s.onWindowResize();const x=this.getDrawingWidth(),O=this.getDrawingHeight();if(t!=null){let P;e?(P=e.getBoundingClientRect(),t.setSize(x,O)):U&&(typeof U.getBoundingClientRect<"u"&&(P=U.getBoundingClientRect(),U.width=x,U.height=O),t.setSize(x,O,!1)),P&&(P.left,P.top);const V=new S.Vector2;t.getSize(V),V.x,V.y}},this.initialiseVisualisation=x=>{if(!Z){if(x=x||{},x.antialias===void 0){let V=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(V=!0)}catch{V=!1}V?x.antialias=!1:x.antialias=!0}x.canvas&&(e=void 0,U=x.canvas),t=new S.WebGLRenderer(x),e!==void 0&&e.appendChild(t.domElement),t.setClearColor(16777215,1),U&&U.style&&(U.style.height="100%",U.style.width="100%");const O=t.domElement;O.addEventListener("webglcontextlost",F,!1),O.addEventListener("webglcontextrestored",z,!1),t.autoClear=!1;const P=this.createScene("default");this.setCurrentScene(P),Z=!0}};const F=x=>{x.preventDefault();for(let O of Object.keys(o))l.hasOwnProperty(O)&&l[O].call()},z=x=>{x.preventDefault();for(let O of Object.keys(o))d.hasOwnProperty(O)&&d[O].call()};this.getCurrentScene=()=>s,this.setCurrentScene=x=>{if(x){this.removeActiveScene(x);const O=s;s=x,O&&O.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(N),this.onWindowResize()}},this.getSceneByName=x=>M[x],this.createScene=x=>{if(M[x]==null){let O;return U?O=new Ct(U,t):O=new Ct(e,t),M[x]=O,O.sceneName=x,O}},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){const x=s.getBoundingBox();if(x){for(let O=0;O<_.length;O++){const P=_[O].getBoundingBox();P&&x.union(P)}s.viewAllWithBoundingBox(x)}}},this.loadModelsURL=(x,O,P,V,p,B)=>{s.loadModelsURL(x,O,P,V,p,B)},this.loadViewURL=x=>{s.loadViewURL(x)},this.loadFromViewURL=(x,O)=>{s.loadFromViewURL(x,O)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};let T=()=>{D?(m=requestAnimationFrame(T),this.render()):(cancelAnimationFrame(m),m=void 0)};this.stopAnimate=()=>{D&&(i.stop(),D=!1)},this.animate=()=>{D||(i.start(),D=!0,T())},this.addContextLostCallbackFunction=x=>(c=c+1,l[c]=x,c),this.removeContextLostCallbackFunction=x=>{x in l&&delete l[x]},this.addContextRestoredCallbackFunction=x=>(h=h+1,d[h]=x,h),this.removeContextRestoredCallbackFunction=x=>{x in h&&delete h[x]},this.addPreRenderCallbackFunction=x=>(a=a+1,o[a]=x,a),this.removePreRenderCallbackFunction=x=>{x in o&&delete o[x]},this.addPostRenderCallbackFunction=x=>(f=f+1,u[f]=x,f),this.removePostRenderCallbackFunction=x=>{x in u&&delete u[x]},this.getPlayRate=()=>r,this.setPlayRate=x=>{r=x},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=x=>{s.setMorphsTime(x)},this.getZincGeometryByID=x=>s.getZincGeometryByID(x),this.addToScene=x=>{s.addObject(x)},this.addToOrthoScene=x=>{if(b==null&&(b=new S.Scene),A==null){const O=this.getDrawingWidth(),P=this.getDrawingHeight();A=new S.OrthographicCamera(-O/2,O/2,P/2,-P/2,1,10),A.position.z=10}b.add(x)};const L=x=>O=>{O.needsUpdate=!0;const P=new S.SpriteMaterial({map:O}),V=P.map.image.width,p=P.map.image.height;x.material=P,x.scale.set(V,p,1);const B=this.getDrawingWidth(),y=this.getDrawingHeight();x.position.set((B-V)/2,(-y+p)/2,1),this.addToOrthoScene(x)};this.addLogo=()=>{g=new S.Sprite,S.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,L(g))},this.render=()=>{I||(e?e.clientWidth>0&&e.clientHeight>0&&(I=new Ot.ResizeSensor(e,this.onWindowResize)):U&&U.width>0&&U.height>0&&(I=new Ot.ResizeSensor(U,this.onWindowResize)));const x=i.getDelta();s.renderGeometries(r,x,this.playAnimation);for(let O=0;O<_.length;O++)_[O].renderGeometries(r,x,this.playAnimation);A!=null&&b!=null&&(t.clearDepth(),t.render(b,A));for(let O of Object.keys(o))o.hasOwnProperty(O)&&o[O].call();s.render(t);for(let O of Object.keys(u))u.hasOwnProperty(O)&&u[O].call()},this.forceContextLoss=()=>{t.forceContextLoss()},this.forceContextRestore=()=>{t.forceContextRestore()},this.getThreeJSRenderer=()=>t,this.isSceneActive=x=>{if(s===x)return!0;for(let O=0;O<_.length;O++)if(_[O]===x)return!0;return!1},this.addActiveScene=x=>{this.isSceneActive(x)||(_.push(x),N.add(x.getThreeJSScene()))},this.removeActiveScene=x=>{for(let O=0;O<_.length;O++)if(_[O]===x){_.splice(O,1),N.remove(x.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let x=0;x<_.length;x++)N.remove(_[x].getThreeJSScene());_.splice(0,_.length)},this.dispose=()=>{D&&cancelAnimationFrame(m);for(const O in M)M.hasOwnProperty(O)&&M[O].clearAll();M=[],_=[],N=new S.Group,this.stopAnimate(),o={},a=0,u={},u=0,l={},c=0,d={},h=0,A=void 0,b=void 0,g=void 0;const x=this.createScene("default");this.setCurrentScene(x),I=void 0,t==null||t.dispose()},this.transitionScene=(x,O)=>{if(s){const P=s.getZincCameraControls(),V=x.getBoundingBox();if(V){const p=V.min.distanceTo(V.max)/2,B=(V.min.x+V.max.x)/2,y=(V.min.y+V.max.y)/2,C=(V.min.z+V.max.z)/2,R=P.getViewportFromCentreAndRadius(B,y,C,p,40,p*4),G=P.getCurrentViewport();P.cameraTransition(G,R,O),P.enableCameraTransition()}}},this.isWebGL2=()=>t?t.capabilities.isWebGL2:!1},Rs=Ui.version,Is=function(){this.Revision=Rs,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=Fe,this.Glyph=Ke,this.Glyphset=ft,this.Pointset=Oe,this.Label=ut,this.Lines=Ve,this.TextureArray=yt,this.TextureSlides=Ee,this.Renderer=ks,this.Scene=Ct,this.Viewport=Re,this.CameraControls=$t,this.SmoothCameraTransition=Ht,this.RayCaster=ei,this.CameraAutoTumble=ti,this.StereoEffect=si,this.loadExternalFile=Tt,this.loadExternalFiles=ki,this.THREE=S},Se=new Is;return Se});
|
|
291
|
+
`);let i="",r="",o=0,a=[];const u=typeof"".trimLeft=="function";for(let c=0,d=s.length;c<d;c++)if(i=s[c],i=u?i.trimLeft():i.trim(),o=i.length,o!==0&&(r=i.charAt(0),r!=="#"))if(r==="v"){const h=i.split(/\s+/);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?t.colors.push(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(r==="f"){const m=i.substr(1).trim().split(/\s+/),A=[];for(let g=0,M=m.length;g<M;g++){const _=m[g];if(_.length>0){const N=_.split("/");A.push(N)}}const b=A[0];for(let g=1,M=A.length-1;g<M;g++){const _=A[g],N=A[g+1];t.addFace(b[0],_[0],N[0],b[1],_[1],N[1],b[2],_[2],N[2])}}else if(r==="l"){const h=i.substring(1).trim().split(" ");let m=[];const A=[];if(i.indexOf("/")===-1)m=h;else for(let b=0,g=h.length;b<g;b++){const M=h[b].split("/");M[0]!==""&&m.push(M[0]),M[1]!==""&&A.push(M[1])}t.addLineGeometry(m,A)}else if(r==="p"){const m=i.substr(1).trim().split(" ");t.addPointGeometry(m)}else if((a=Ms.exec(i))!==null){const h=(" "+a[0].substr(1).trim()).substr(1);t.startObject(h)}else if(Ss.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(_s.test(i))t.materialLibraries.push(i.substring(7).trim());else if(Cs.test(i))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(r==="s"){if(a=i.split(" "),a.length>1){const m=a[1].trim().toLowerCase();t.object.smooth=m!=="0"&&m!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(i==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}t.finalize();const f=new w.Group;if(f.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let c=0,d=t.objects.length;c<d;c++){const h=t.objects[c],m=h.geometry,A=h.materials,b=m.type==="Line",g=m.type==="Points";let M=!1;if(m.vertices.length===0)continue;const _=new w.BufferGeometry;_.setAttribute("position",new w.Float32BufferAttribute(m.vertices,3)),m.normals.length>0&&_.setAttribute("normal",new w.Float32BufferAttribute(m.normals,3)),m.colors.length>0&&(M=!0,_.setAttribute("color",new w.Float32BufferAttribute(m.colors,3))),m.hasUVIndices===!0&&_.setAttribute("uv",new w.Float32BufferAttribute(m.uvs,2));const N=[];for(let I=0,D=A.length;I<D;I++){const Z=A[I],F=Z.name+"_"+Z.smooth+"_"+M;let z=t.materials[F];if(this.materials!==null){if(z=this.materials.create(Z.name),b&&z&&!(z instanceof w.LineBasicMaterial)){const T=new w.LineBasicMaterial;w.Material.prototype.copy.call(T,z),T.color.copy(z.color),z=T}else if(g&&z&&!(z instanceof w.PointsMaterial)){const T=new w.PointsMaterial({size:10,sizeAttenuation:!1});w.Material.prototype.copy.call(T,z),T.color.copy(z.color),T.map=z.map,z=T}}z===void 0&&(b?z=new w.LineBasicMaterial:g?z=new w.PointsMaterial({size:1,sizeAttenuation:!1}):z=new w.MeshPhongMaterial,z.name=Z.name,z.flatShading=!Z.smooth,z.vertexColors=M,t.materials[F]=z),N.push(z)}let U;if(N.length>1){for(let I=0,D=A.length;I<D;I++){const Z=A[I];_.addGroup(Z.groupStart,Z.groupCount,I)}b?U=new w.LineSegments(_,N):g?U=new w.Points(_,N):U=new w.Mesh(_,N)}else b?U=new w.LineSegments(_,N[0]):g?U=new w.Points(_,N[0]):U=new w.Mesh(_,N[0]);U.name=h.name,f.add(U)}else if(t.vertices.length>0){const c=new w.PointsMaterial({size:1,sizeAttenuation:!1}),d=new w.BufferGeometry;d.setAttribute("position",new w.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(d.setAttribute("color",new w.Float32BufferAttribute(t.colors,3)),c.vertexColors=!0);const h=new w.Points(d,c);f.add(h)}return f}}const Ai=S.FileLoader,Ts=n=>{const e=(t,s)=>{t.metadata.number_of_vertices+=s.metadata.number_of_vertices,"labels"in t&&t.labels.push(...t.labels),["axis1","axis2","axis3","colors","positions","scale"].forEach(r=>{r in t&&Object.keys(t[r]).forEach(o=>{const a=s[r][o].length;for(let u=0;u<a;u++)t[r][o].push(s[r][o][u])})})};if(n&&n.length>0)for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}},Ls=n=>{const e=(t,s)=>{t.merge(s)};if(n&&n.length>0){for(;n.length>1;){const t=n.splice(1,1);e(n[0],t[0])}return n[0]}},Bs=function(n,e,t){const s=new Ai,i=new $e;s.crossOrigin=e;const r=n,o=t;let a,u=!1,f=!1,l;const c=[],d=b=>{const g=a[b.index];if(g)if("GlyphGeometriesURL"in g)b.onLoad(g);else{let M=i.parse(g);b.onLoad(M.geometry,M.materials)}else h(b)},h=b=>{b.onError&&(l||(l={responseURL:r}),b.onError(l))};this.downloadCompleted=b=>{try{a=JSON.parse(b[0]),u=!1,f=!0,Array.isArray(a)?c.forEach(g=>d(g)):c.forEach(g=>h(g))}catch{c.forEach(g=>h(g))}};const m=()=>b=>{l=b,f=!0,u=!1,c.forEach(g=>{h(g)})},A=()=>b=>{c.forEach(g=>{g.onProgress&&g.onProgress(b)})};this.load=(b,g,M,_)=>{const N={index:b,onLoad:g,onProgress:M,onError:_};f?a?d(N):h(l):u?c.push(N):(c.push(N),u=!0,s.load(r,o,A,m))}},Us=function(n,e,t){const s=[],i=n,r=e;let o=0;const a=t.isGlyphsets;this.itemDownloaded=(u,f)=>{if(s[u]=f,o++,o==i&&s.length>0)if(a){const l=s.map(c=>JSON.parse(c[0]));Ts(l),r(l[0])}else{const l=s[0][1],c=s.map(h=>h[0]),d=Ls(c);for(let h=1;h<i;h++)s[u][0].dispose(),s[u][1].forEach(m=>m.dispose());r(d,l)}}},Ns=function(){let n=0;const e=20;this.crossOrigin="Anonymous";const t=new $e,s=new Ai;s.crossOrigin="Anonymous";const i=[],r={},o=(l,c,d,h,m)=>{const A=l.length,b=new Us(A,c,m);let g=0;l.forEach(M=>{const _=m?{...m}:{};_.msHandler=b,_.order=g,g++,u(M,c,d,h,_)})},a=(l,c,d,h,m)=>{const A=m?{...m}:{};let b=r[l];if(!b)if(e>n){const g=new f(void 0,this,A);++n,b=new Bs(l,this.crossOrigin,g),r[l]=b}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:m});b&&(A.isHandler=b,b.load(m.index,c,d,h))},u=(l,c,d,h,m)=>{if(m&&m.index!==void 0)a(l,c,d,h,m);else if(e>n){++n;const A=new f(c,this,m),b=new f(h,this,m);m.isGlyphsets?s.load(l,A,d,b):(t.crossOrigin=this.crossOrigin,t.load(l,A,d,b))}else i.push({url:l,onLoad:c,onProgress:d,onError:h,options:m})};this.load=(l,c,d,h,m)=>{Array.isArray(l)?o(l,c,d,h,m):u(l,c,d,h,m)},this.loadFromWaitingList=()=>{for(;e>n;){const l=i.shift();if(l)this.load(l.url,l.onLoad,l.onProgress,l.onError,l.options);else return}},this.itemRemainingCheck=()=>{if(i.length===0&&n===0)for(let l in r)r.hasOwnProperty(l)&&delete r[l]};const f=function(l,c,d){return(...h)=>{--n,d!=null&&d.msHandler?d.msHandler.itemDownloaded(d.order,h):d!=null&&d.isHandler?d.isHandler.downloadCompleted(h):l&&l(...h),c.loadFromWaitingList(),c.itemRemainingCheck()}};this.parse=l=>loader.parse(l)};class Mi extends w.Loader{constructor(e){super(e)}load(e,t,s,i){const r=this,o=new w.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},s,i)}parse(e){function t(f){const l=new DataView(f),c=32/8*3+32/8*3*3+16/8,d=l.getUint32(80,!0);if(80+32/8+d*c===l.byteLength)return!0;const m=[115,111,108,105,100];for(let A=0;A<5;A++)if(s(m,l,A))return!1;return!0}function s(f,l,c){for(let d=0,h=f.length;d<h;d++)if(f[d]!==l.getUint8(c+d,!1))return!1;return!0}function i(f){const l=new DataView(f),c=l.getUint32(80,!0);let d,h,m,A=!1,b,g,M,_,N;for(let z=0;z<70;z++)l.getUint32(z,!1)==1129270351&&l.getUint8(z+4)==82&&l.getUint8(z+5)==61&&(A=!0,b=new Float32Array(c*3*3),g=l.getUint8(z+6)/255,M=l.getUint8(z+7)/255,_=l.getUint8(z+8)/255,N=l.getUint8(z+9)/255);const U=84,I=12*4+2,D=new w.BufferGeometry,Z=new Float32Array(c*3*3),F=new Float32Array(c*3*3);for(let z=0;z<c;z++){const T=U+z*I,L=l.getFloat32(T,!0),x=l.getFloat32(T+4,!0),O=l.getFloat32(T+8,!0);if(A){const P=l.getUint16(T+48,!0);P&32768?(d=g,h=M,m=_):(d=(P&31)/31,h=(P>>5&31)/31,m=(P>>10&31)/31)}for(let P=1;P<=3;P++){const V=T+P*12,p=z*3*3+(P-1)*3;Z[p]=l.getFloat32(V,!0),Z[p+1]=l.getFloat32(V+4,!0),Z[p+2]=l.getFloat32(V+8,!0),F[p]=L,F[p+1]=x,F[p+2]=O,A&&(b[p]=d,b[p+1]=h,b[p+2]=m)}}return D.setAttribute("position",new w.BufferAttribute(Z,3)),D.setAttribute("normal",new w.BufferAttribute(F,3)),A&&(D.setAttribute("color",new w.BufferAttribute(b,3)),D.hasColors=!0,D.alpha=N),D}function r(f){const l=new w.BufferGeometry,c=/solid([\s\S]*?)endsolid/g,d=/facet([\s\S]*?)endfacet/g;let h=0;const m=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,A=new RegExp("vertex"+m+m+m,"g"),b=new RegExp("normal"+m+m+m,"g"),g=[],M=[],_=new w.Vector3;let N,U=0,I=0,D=0;for(;(N=c.exec(f))!==null;){I=D;const Z=N[0];for(;(N=d.exec(Z))!==null;){let T=0,L=0;const x=N[0];for(;(N=b.exec(x))!==null;)_.x=parseFloat(N[1]),_.y=parseFloat(N[2]),_.z=parseFloat(N[3]),L++;for(;(N=A.exec(x))!==null;)g.push(parseFloat(N[1]),parseFloat(N[2]),parseFloat(N[3])),M.push(_.x,_.y,_.z),T++,D++;L!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+h),T!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+h),h++}const F=I,z=D-I;l.addGroup(F,z,U),U++}return l.setAttribute("position",new w.Float32BufferAttribute(g,3)),l.setAttribute("normal",new w.Float32BufferAttribute(M,3)),l}function o(f){return typeof f!="string"?w.LoaderUtils.decodeText(new Uint8Array(f)):f}function a(f){if(typeof f=="string"){const l=new Uint8Array(f.length);for(let c=0;c<f.length;c++)l[c]=f.charCodeAt(c)&255;return l.buffer||l}else return f}const u=a(e);return t(u)?i(u):r(o(e))}}const _i=function(){Y.call(this),this.isTubeLines=!0;let n={},e={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(s,i,r)=>{if(s&&i){n={geometryIn:s,materialIn:i,options:r};const o=t(s.vertices),a=new S.MeshStandardMaterial({color:i.color}),u=new S.Mesh(o,a);this.setMesh(u,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=s=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=s,this.morph.material.needsUpdate=!0)},this.setAlpha=function(s){let i=this.getMorph();i.material.opacity=s,i.material.transparent=s<1,i.material.depthWrite=s>.5},this.setWireframe=s=>{let i=this.getMorph();i.material.wireframe=s},this.setTubeLines=(s,i)=>{if(s&&i){const{geometryIn:r}=n;let o=this.getMorph();o.geometry.dispose(),e=Object.assign(e,{radius:s,radialSegments:i}),o.geometry=t(r.vertices)}};const t=s=>{const{radius:i,radialSegments:r,smooth:o}=e;let a;if(o){const u=new S.CatmullRomCurve3(s);a=new S.TubeGeometry(u,s.length,i,r,!1)}else{const u=[];for(let f=0;f+1<s.length;f=f+2){const l=new S.LineCurve3(s[f],s[f+1]),c=new S.TubeGeometry(l,1,i,r,!1);u.push(c)}a=Gi(u,!0),u.forEach(f=>f.dispose())}return a}};_i.prototype=Object.create(Y.prototype);const Ps=function(n){const e=n;this.toBeDownloaded=0,this.progressMap={};let t=!1,s=!1;const i=new Ns;this.getDownloadProgress=()=>{let T=0,L=0,x=!1;for(const O in this.progressMap){const P=this.progressMap[O];T+=P[1],L+=P[0],P[1]==0&&(x=!0)}return x&&(T=0),[T,L,s]},this.onProgress=T=>L=>{this.progressMap[T]=[L.loaded,L.total]},this.onError=T=>L=>{this.toBeDownloaded=this.toBeDownloaded-1,s=!0,console.error(`There is an issue with external resource ${L!=null&&L.responseURL?": "+(L==null?void 0:L.responseURL):""}.`),T&&T({type:"Error",xhr:L})};let r=(T,L)=>{const x=L.Default;if(L.Inline)e.setupMultipleViews(x,L.Entries);else{const O=[];for(const[P,V]of Object.entries(L.Entries))T&&(newURL=Pe(V,T),O.push(new Promise((p,B)=>{fetch(newURL).then(y=>y.json()).then(y=>p({key:P,data:y})).catch(y=>B(y))})));Promise.all(O).then(P=>{const V={};P.forEach(B=>{V[B.key]=B.data}),e.setupMultipleViews(x,V);let p=e.getZincCameraControls();p&&p.setCurrentViewport(x),t=!0})}};this.loadViewURL=(T,L)=>{this.toBeDownloaded+=1;const x=new XMLHttpRequest;x.onreadystatechange=()=>{if(x.readyState==4)if(x.status==200){const P=JSON.parse(x.responseText);e.setupMultipleViews("default",{default:P}),e.resetView(),t=!0,--this.toBeDownloaded,L!=null&&typeof L=="function"&&L()}else this.onError(L)({responseURL:T})};const O=ye(T);x.open("GET",O,!0),x.send()},this.loadModelsURL=(T,L,x,O,P,V,p)=>{const B=L.length;this.toBeDownloaded+=B;for(let y=0;y<B;y++){const C=L[y];let k=Se.defaultMaterialColor,R=Se.defaultOpacity;x!=null&&x[y]!=null&&(k=!!x[y]),O!=null&&O[y]!=null&&(R=O[y]);let G=0;P!=null&&P[y]!=null&&(G=!!P[y]);let q=0;V!=null&&V[y]!=null&&(q=!!V[y]),i.load(ye(C),m(T,k,R,G,q,void 0,void 0,void 0,void 0,p),this.onProgress(C),this.onError(p))}},this.loadFromViewURL=(T,L,x)=>{const O=new XMLHttpRequest;O.onreadystatechange=()=>{if(O.readyState==4&&O.status==200){const V=JSON.parse(O.responseText);e.loadView(V);const p=[],B=L+"_";for(let y=0;y<V.numberOfResources;y++){const C=B+(y+1)+".json";p.push(C)}this.loadModelsURL(T,p,V.colour,V.opacity,V.timeEnabled,V.morphColour,x)}};const P=ye(L+"_view.json");O.open("GET",P,!0),O.send()};const o=(T,L,x,O,P,V,p,B,y)=>(C,k)=>{const R=B?new _i:new Ve;let G;k&&k[0]&&(G=new S.LineBasicMaterial({color:k[0].color.clone()}),1>k[0].opacity&&(G.transparent=!0),G.opacity=k[0].opacity,G.morphTargets=L,G.vertexColors=k[0].vertexColors);let q={};if(q.localTimeEnabled=L,q.localMorphColour=x,R&&(R.createLineSegment(C,G,q),R.setName(O),R.setAnatomicalId(P),R.setRenderOrder(V),T.addZincObject(R),R.setDuration(e.getDuration()),p&&p.levels))for(const[E,K]of Object.entries(p.levels))R.addLOD(i,E,K.URL,K.Index,p.preload);--this.toBeDownloaded,C.dispose(),y!=null&&typeof y=="function"&&y(R)};this.loadLinesURL=(T,L,x,O,P,V,p)=>{let B=0;this.toBeDownloaded+=1;let y=p!=null&&p.isInline?p.isInline:!1,C=p!=null&&p.anatomicalId?p.anatomicalId:void 0,k=p&&"renderOrder"in p?p.renderOrder:void 0;x!=null&&(B=!!x);let R=0;O!=null&&(R=!!O);let G=p.tubeLines&&!B&&!R;if(y){let q=i.parse(L);o(T,B,R,P,C,k,p.lod,G,V)(q.geometry,q.materials)}else i.load(L,o(T,B,R,P,C,k,p.lod,G,V),this.onProgress(L),this.onError(V),p.loaderOptions)};const a=(T,L,x,O,P)=>V=>{let p=V;(typeof p=="string"||p instanceof String)&&(p=JSON.parse(V));let B=P&&P.isInline?P.isInline:void 0,y=P&&P.anatomicalId?P.anatomicalId:void 0,C=P&&P.displayLabels?P.displayLabels:void 0,k=P&&"renderOrder"in P?P.renderOrder:void 0;const R=new ft;R.setDuration(e.getDuration()),R.groupName=x;let G=()=>{--this.toBeDownloaded,O!=null&&typeof O=="function"&&O(R)};++this.toBeDownloaded,B?R.load(p,L,G,B,C):R.load(p,ye(L),G,B,C),R.setAnatomicalId(y),R.setRenderOrder(k),T.addZincObject(R)};this.loadGlyphsetURL=(T,L,x,O,P,V)=>{(V&&V.isInline?V.isInline:!1)?a(T,x,O,P,V)(L):i.load(L,a(T,x,O,P,V),this.onProgress(L),this.onError(P),V.loaderOptions)};const u=(T,L,x,O,P,V,p)=>(B,y)=>{const C=new Te;let k=new S.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});y&&y[0]&&(1>y[0].opacity&&(k.transparent=!0),k.opacity=y[0].opacity,k.color=y[0].color,k.morphTargets=L,k.vertexColors=y[0].vertexColors);let R={};R.localTimeEnabled=L,R.localMorphColour=x,C&&(C.createMesh(B,k,R),C.setName(O),C.setAnatomicalId(P),T.addZincObject(C),C.setDuration(e.getDuration()),C.setRenderOrder(V)),B.dispose(),--this.toBeDownloaded,p!=null&&typeof p=="function"&&p(C)};this.loadSTL=(T,L,x,O)=>{this.toBeDownloaded+=1;const P=Se.defaultMaterialColor,V=Se.defaultOpacity,p=new Mi;p.crossOrigin="Anonymous",p.load(ye(L),m(T,P,V,!1,!1,x,void 0,void 0,void 0,O))},this.loadOBJ=(T,L,x,O)=>{this.toBeDownloaded+=1;const P=Se.defaultMaterialColor,V=Se.defaultOpacity,p=new wi;p.crossOrigin="Anonymous",p.load(ye(L),m(T,P,V,!1,!1,x,void 0,void 0,void 0,O))};const f=(T,L,x,O,P,V,p)=>{this.toBeDownloaded+=1;const B=Se.defaultMaterialColor,y=Se.defaultOpacity;let C=0,k=p&&p.isInline?p.isInline:!1,R=p&&p.fileFormat?p.fileFormat:void 0,G=p&&p.anatomicalId?p.anatomicalId:void 0,q=p&&"renderOrder"in p?p.renderOrder:void 0;x!=null&&(C=!!x);let E=0;O!=null&&(E=!!O);let K=i;if(R!==void 0){if(R=="STL")K=new Mi;else if(R=="OBJ"){K=new wi,K.crossOrigin="Anonymous",K.load(L,objloader(T,B,y,C,E,P,G,V),this.onProgress(L),this.onError,p.loaderOptions);return}}if(k){const $=i.parse(L);m(T,B,y,C,E,P,G,q,p,V)($.geometry,$.materials)}else K.crossOrigin="Anonymous",i.load(L,m(T,B,y,C,E,P,G,q,p,V),this.onProgress(L),this.onError(V),p.loaderOptions)},l=function(T,L,x){let O=0;return P=>{if(O=O+1,P&&L!=null&&typeof L=="function"&&L(P),O==T&&(t===!1&&e.viewAll(),x!=null&&typeof x=="function")){x();let V=e.getZincCameraControls();V&&V.calculateMaxAllowedDistance(e)}}};this.loadPointsetURL=(T,L,x,O,P,V,p)=>{let B=0;this.toBeDownloaded+=1,x!=null&&(B=!!x);let y=0;O!=null&&(y=!!O);let C=p&&p.isInline?p.isInline:!1,k=p&&p.anatomicalId?p.anatomicalId:void 0,R=p&&"renderOrder"in p?p.renderOrder:void 0;if(C){const G=i.parse(L);u(T,B,y,P,k,R,V)(G.geometry,G.materials)}else i.load(L,u(T,B,y,P,k,R,V),this.onProgress(L),this.onError(V),p.loaderOptions)};const c=(T,L,x,O,P,V)=>{let p=V&&V.isInline?V.isInline:void 0,B=V&&V.anatomicalId?V.anatomicalId:void 0,y=V&&"renderOrder"in V?V.renderOrder:void 0,C;if(x){if(L&&x.images&&x.images.source){const k=x.images.source;for(let R=0;R<k.length;R++){const G=Pe(k[R],L);x.images.source[R]=G}}if(x.type==="slides"&&(C=new Ee),C){C.groupName=O;let k=()=>{T.addZincObject(C),--this.toBeDownloaded,P!=null&&typeof P=="function"&&P(C)};++this.toBeDownloaded,C.load(x,k,p),C.setAnatomicalId(B),C.setRenderOrder(y)}}},d=(T,L,x,O,P)=>()=>{if(L.readyState==4&&L.status==200){const V=JSON.parse(L.responseText);c(T,L.responseURL,V,x,O,P)}};this.loadTextureURL=(T,L,x,O,P)=>{if(P&&P.isInline?P.isInline:!1)c(T,void 0,L,x,O,P);else{const p=new XMLHttpRequest;p.onreadystatechange=d(T,p,x,O,P),p.open("GET",ye(L),!0),p.send()}};const h=(T,L,x,O,P,V,p,B,y,C,k)=>{let R={};R.colour=x,R.opacity=O,R.localTimeEnabled=P,R.localMorphColour=V;const G=new Fe;if(G.createMesh(L,B,R),G.getMorph())return G.setName(y),G.setRenderOrder(C),G.setAnatomicalId(k),T&&T.addZincObject(G),G.setDuration(e.getDuration()),G.videoHandler&&e.setVideoHandler(G.videoHandler),G},m=(T,L,x,O,P,V,p,B,y,C)=>(k,R)=>{let G;R&&R[0]&&(G=R[0]);const q=h(T,k,L,x,O,P,void 0,G,V,B,p);if(y.lod&&y.lod.levels)for(const[E,K]of Object.entries(y.lod.levels))q.addLOD(i,E,K.URL,K.Index,y.lod.preload);--this.toBeDownloaded,k.dispose(),C!=null&&typeof C=="function"&&C(q)},A=T=>{const L=/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,[,x,O,P,V,p,B,y]=T.match(L);return{years:x,months:O,weeks:P,days:V,hours:p,mins:B,secs:y}};this.loadSettings=T=>{if(T){if(T.Duration){const L=A(T.Duration);e.setDurationFromObject(L)}if(T.OriginalDuration){const L=A(T.OriginalDuration);e.setOriginalDurationFromObject(L)}if(T.TimeStamps)for(const L in T.TimeStamps){const x=A(T.TimeStamps[L]);e.addMetadataTimeStamp(L,x)}}};const b=(T,L,x,O,P)=>{if(x){let V,p=!1;x.URL?(V=x.URL,L&&(V=Pe(V,L))):x.Inline&&(V=x.Inline.URL,p=!0);const B={};if(x.LOD&&x.LOD.Levels){B.preload=!!x.LOD.Preload,B.levels={};for(const[k,R]of Object.entries(x.LOD.Levels))B.levels[k]={},B.levels[k].URL=Pe(R.URL,L),B.levels[k].Index=R.Index}let y=x.GroupName;(y===void 0||y==="")&&(y="_Unnamed");let C={loaderOptions:{index:x.Index},isInline:p,fileFormat:x.FileFormat,anatomicalId:x.AnatomicalId,compression:x.compression,tubeLines:x.tubeLines,lod:B,renderOrder:O};switch(x.Type){case"Surfaces":f(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Glyph":let k;p?k=x.Inline.GlyphGeometriesURL:(k=x.GlyphGeometriesURL,k=Pe(x.GlyphGeometriesURL,L)),x.DisplayLabels&&(C.displayLabels=!0),C.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(T,V,k,y,P,C);break;case"Points":this.loadPointsetURL(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Lines":this.loadLinesURL(T,V,x.MorphVertices,x.MorphColours,y,P,C);break;case"Texture":this.loadTextureURL(T,V,y,P,C);break}}},g=(T,L,x)=>{if(L){let O,P=!1;switch(L.URL?(O=L.URL,T&&(O=Pe(L.URL,T))):L.Inline&&(O=L.Inline.URL,P=!0),L.Type){case"View":P?(e.setupMultipleViews("default",{default:O}),t=!0,x!=null&&typeof x=="function"&&x()):this.loadViewURL(O,x);break;case"Settings":this.loadSettings(L);break}}};this.loadGLTF=(T,L,x,O,P)=>{new As().load(e,T,L,x,O,P)};let M=(T,L,x,O)=>{if(x.Primitives&&x.Primitives.forEach(P=>{let V=1;P.Order&&(V=P.Order),b(T,L,P,V,O)}),x.Transformation&&T.setTransformation(x.Transformation),x.Children)for(const[P,V]of Object.entries(x.Children)){const p=T.findOrCreateChildFromPath(P);p&&M(p,L,V,O)}},_=(T,L)=>{var p,B;let x=T;const O=(p=L==null?void 0:L.enabled)==null?void 0:p.include,P=(B=L==null?void 0:L.enabled)==null?void 0:B.exclude,V=L==null?void 0:L.tubeLines;return(O!=null&&O.length||P!=null&&P.length)&&(O&&(x=T.filter(y=>{if(y.Type==="View")return!0;for(let C=0;C<O.length;C++)if(Nt(y.RegionPath,y.GroupName,O[C]))return!0;return!1})),P&&(x=x.filter(y=>{if(y.Type==="View")return!0;for(let C=0;C<P.length;C++)if(Nt(y.RegionPath,y.GroupName,P[C]))return!1;return!0}))),V&&x.forEach(y=>{y.Type==="Lines"&&(y.tubeLines=!0)}),x},N=(T,L)=>Array.isArray(T)?_(T,L):T,U=(T,L)=>{if(Array.isArray(T)){let x=0;for(let O=0;O<T.length;O++)T[O].Type&&(L&&T[O].Type==="View"||T[O].Type==="Surfaces"||T[O].Type==="Glyph"||T[O].Type==="Points"||T[O].Type==="Lines"||T[O].Type==="Texture")&&x++;return x}return 0},I=T=>{let L=T.Primitives?U(T.Primitives,!1):0;return T.Children&&Object.values(T.Children).forEach(x=>{L+=I(x)}),L},D=T=>{if(Array.isArray(T))return U(T,!0);if(typeof T=="object"&&T!==null&&T.Version==="2.0")return I(T.Regions)},Z=(T,L,x,O,P)=>{let V=T;x.RegionPath&&x.RegionPath!==""&&(V=T.findOrCreateChildFromPath(x.RegionPath)),b(V,L,x,O*2,P)},F=(T,L,x,O,P,V)=>{const p=N(L,V);let B=D(p),y=new l(B,O,P);for(let C=0;C<L.length;C++)g(x,p[C],y);for(let C=0;C<L.length;C++)Z(T,x,p[C],C,y)},z=(T,L,x,O,P)=>{let V=D(L),p=new l(V,O,P);L.Settings&&this.loadSettings(L.Settings),L.Views&&r(x,L.Views),L.Regions&&M(T,x,L.Regions,p)};this.loadMetadataURL=(T,L,x,O,P)=>{const V=new XMLHttpRequest,p=ye(L);V.onreadystatechange=()=>{if(V.readyState==4&&V.status==200){e.resetMetadata(),e.resetDuration(),t=!1;let B=V.responseURL;B===void 0&&(B=new URL(p).href);const y=JSON.parse(V.responseText);Array.isArray(y)?F(T,y,B,x,O,P):typeof y=="object"&&y!==null&&y.Version=="2.0"&&z(T,y,B,x,O)}},V.open("GET",p,!0),V.send()}};let Vs=0;const ks=function(){return"sc"+Vs++},Si=function(){return{Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},Rs=6e3,Ct=function(n,e){const t=n;let s,i,r=new Ps(this),o,a={},u=0,f={},l=0;const c=new S.Scene,d=new S.Scene,h=new di(void 0,this);c.add(h.getGroup());const m=new S.Group;c.add(m),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let A=6e3,b;this.sceneName=void 0;let g=!1,M;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};let _={x:0,y:0},N=Si(),U=new S.Vector2,I=[];this.forcePickableObjectsUpdate=!1,this.uuid=ks();let D=new oi(this);D.disable(),c.add(D.group);let Z={main:[],mini:[]};const F=new S.Vector3(0,0,0),z=()=>t?typeof t.clientWidth<"u"?t.clientWidth:t.width:0,T=()=>t?typeof t.clientHeight<"u"?t.clientHeight:t.height:0;this.getDownloadProgress=()=>r.getDownloadProgress(),this.onWindowResize=()=>{const p=T();this.camera.aspect=z()/p,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,b.onResize(),b.calculateHeightPerPixelAtZeroDepth(p)},this.resetView=()=>{this.onWindowResize(),b.resetView()},this.changeZoomByScrollRateUnit=p=>{b.changeZoomByScrollRateUnit(p)},(()=>{this.camera=new S.PerspectiveCamera(40,z()/T(),0,10),this.ambient=new S.AmbientLight(16777215,.2),c.add(this.ambient),this.directionalLight=new S.DirectionalLight(16777215,.8),c.add(this.directionalLight),b=new Ht(this.camera,e.domElement,e,this),b.setDirectionalLight(this.directionalLight),b.resetView(),o=new as(this)})(),this.loadView=p=>{const B=new Re;return B.setFromObject(p),b.setCurrentCameraSettings(B),!0},this.setupMultipleViews=(p,B)=>{for(const[y,C]of Object.entries(B)){const k=new Re;k.setFromObject(C),b.addViewport(y,k)}b.setDefaultViewport(p)},this.getBoundingBox=()=>h.getBoundingBox(!0),this.viewAllWithBoundingBox=p=>{if(p){const B=b.getViewportFromBoundingBox(p,1);b.setCurrentCameraSettings(B),b.calculateHeightPerPixelAtZeroDepth(T()),D.markerUpdateRequired=!0}},this.viewAll=()=>{const p=this.getBoundingBox();this.viewAllWithBoundingBox(p),D.markerUpdateRequired=!0},this.forEachGeometry=p=>{h.forEachGeometry(p,!0)},this.forEachGlyphset=p=>{h.forEachGlyphset(p,!0)},this.forEachPointset=p=>{h.forEachPointset(p,!0)},this.forEachLine=p=>{h.forEachLine(p,!0)},this.findGeometriesWithGroupName=p=>h.findGeometriesWithGroupName(p,!0),this.findPointsetsWithGroupName=p=>h.findPointsetsWithGroupName(p,!0),this.findGlyphsetsWithGroupName=p=>h.findGlyphsetsWithGroupName(p,!0),this.findLinesWithGroupName=p=>h.findLinesWithGroupName(p,!0),this.findObjectsWithGroupName=p=>h.findObjectsWithGroupName(p,!0),this.findObjectsWithAnatomicalId=p=>h.findObjectsWithAnatomicalId(p,!0),this.getBoundingBoxOfZincObjects=p=>{let B;for(let y=0;y<p.length;y++){let C=p[y].getBoundingBox();C&&(B?B.union(C):B=C)}return B},this.vectorToScreenXY=p=>{p.project(this.camera);let B=z(),y=T(),C=B/2,k=y/2;return p.x=p.x*C+C,p.y=-(p.y*k)+k,p},this.getObjectsScreenXY=p=>{if(p&&p.length>0){let B=this.getBoundingBoxOfZincObjects(p);const y=new S.Vector3;return B.getCenter(y),this.vectorToScreenXY(y)}},this.getNamedObjectsScreenXY=p=>{let B=this.findObjectsWithGroupName(p);return this.getObjectsScreenXY(B)},this.addZincObject=p=>{p&&(h.addZincObject(p),b&&b.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(p,B,y,C)=>{r.loadGlyphsetURL(h,p,B,y,C)},this.loadPointsetURL=(p,B,y,C,k)=>{r.loadPointsetURL(h,p,B,y,C,k)},this.loadLinesURL=(p,B,y,C,k)=>{r.loadLinesURL(h,p,B,y,C,k)},this.loadSTL=(p,B,y)=>{r.loadSTL(h,p,B,y)},this.loadOBJ=(p,B,y)=>{r.loadOBJ(h,p,B,y)},this.loadMetadataURL=(p,B,y,C)=>{r.loadMetadataURL(h,p,B,y,C)},this.loadModelsURL=(p,B,y,C,k,R)=>{r.loadModelsURL(h.urls,B,y,C,k,R)},this.loadViewURL=p=>{r.loadViewURL(p)},this.loadFromViewURL=(p,B)=>{r.loadFromViewURL(p,B)},this.loadGLTF=(p,B,y,C)=>{r.loadGLTF(h,p,B,y,C)},this.updateDirectionalLight=()=>{b.updateDirectionalLight()},this.addObject=p=>{c.add(p)},this.removeObject=p=>{c.remove(p)},this.getCurrentTime=()=>{if(i!=null)return i.getCurrentTime(A);const p=h.getCurrentTime();return p!==-1?p:0},this.setMorphsTime=p=>{i!=null&&i.setMorphTime(p,A),h.setMorphTime(p,!0)},this.isTimeVarying=()=>i&&i.video&&!i.video.error?!0:h.isTimeVarying(),this.renderGeometries=(p,B,y)=>{let C={};if(C.camera=b,C.displayMarkers=this.displayMarkers,C.markerCluster=D,C.markersList=D.markers,C.ndcToBeUpdated=!1,y&&(C.markerCluster.markerUpdateRequired=!0),i)if(i.isReadyToPlay()){y?i.video.play():i.video.pause();const k=i.video.currentTime/i.getVideoDuration()*A;r.toBeDownloaded==0?(b.setTime(k),C.ndcToBeUpdated=b.update(0),C.ndcToBeUpdated&&b.calculateHeightPerPixelAtZeroDepth(T()),h.setMorphTime(k,!0),h.renderGeometries(0,0,y,b,C,!0)):b.update(0)}else myPlayRate=0;else r.toBeDownloaded==0?(C.ndcToBeUpdated=b.update(B),C.ndcToBeUpdated&&b.calculateHeightPerPixelAtZeroDepth(T()),h.renderGeometries(p,B,y,b,C,!0)):b.update(0)},this.getThreeJSScene=()=>c,this.setVideoHandler=p=>{i||(i=p)},this.setAdditionalScenesGroup=p=>{c.add(p)};let x=(p,B,y,C,k,R,G)=>{let q=0,E=0;return p.includes("top")?E=G-k-y:p.includes("bottom")?E=y:E=Math.floor((G-k)/2),p.includes("left")?q=B:p.includes("right")?q=R-B-C:q=Math.floor((R-C)/2),{x:q,y:E}};const O=p=>{(this.displayMinimap||this.displayMiniAxes)&&(p.setScissorTest(!0),p.getSize(U),this.minimapScissor.updateRequired&&(_=x(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,U.x,U.y),this.minimapScissor.updateRequired=!1),p.setScissor(_.x,_.y,this.minimapScissor.width,this.minimapScissor.height),p.setViewport(_.x,_.y,this.minimapScissor.width,this.minimapScissor.height),o.updateCamera(),this.displayMiniAxes?p.render(d,o.camera):(c.add(o.mask),p.render(c,o.camera),c.remove(o.mask)),p.setScissorTest(!1),p.setViewport(0,0,U.x,U.y))};this.render=p=>{this.autoClearFlag&&p.clear(),g&&M?M.render(c,this.camera):(p.render(c,this.camera),O(p))},this.setInteractiveControlEnable=p=>{p==!0?b.enable():b.disable()},this.getZincCameraControls=()=>b,this.getThreeJSScene=()=>c,this.setDuration=p=>{h.setDuration(p),A=p,b.setPathDuration(p),r.duration=p},this.getDuration=()=>A,this.setStereoEffectEnable=p=>{p==!0&&(M||(M=new ri(e))),e.setSize(z(),T()),this.camera.updateProjectionMatrix(),g=p},this.objectIsInScene=p=>h.objectIsInRegion(p,!0),this.alignBoundingBoxToCameraView=(p,B)=>{if(p){p.getCenter(F);const y=this.getZincCameraControls().getCurrentViewport(),C=new S.Vector3(y.targetPosition[0],y.targetPosition[1],y.targetPosition[2]),k=new S.Vector3(y.eyePosition[0],y.eyePosition[1],y.eyePosition[2]),R=new S.Vector3,G=new S.Vector3;R.subVectors(C,k).normalize(),G.subVectors(C,F).normalize();const q=new S.Vector3;q.crossVectors(R,G);const E=R.angleTo(G);B>0?(this.getZincCameraControls().rotateCameraTransition(q,E,B),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(q,E),D.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(p,B,y)=>{if(p){const C=this.getZincCameraControls().getCurrentViewport(),k=this.getZincCameraControls().getViewportFromBoundingBox(p,B);y>0&&(this.getZincCameraControls().cameraTransition(C,k,y),this.getZincCameraControls().enableCameraTransition()),D.markerUpdateRequired=!0}},this.alignObjectToCameraView=(p,B)=>{if(this.objectIsInScene(p)){const y=p.getBoundingBox();this.alignBoundingBoxToCameraView(y,B)}},this.setCameraTargetToObject=p=>{if(this.objectIsInScene(p)){const B=p.getBoundingBox(),y=this.getZincCameraControls().getCurrentViewport();B.getCenter(F);const C=new S.Vector3(y.targetPosition[0],y.targetPosition[1],y.targetPosition[2]),k=new S.Vector3(y.eyePosition[0],y.eyePosition[1],y.eyePosition[2]),R=new S.Vector3,G=new S.Vector3;R.subVectors(k,C),G.addVectors(F,R),y.eyePosition[0]=G.x,y.eyePosition[1]=G.y,y.eyePosition[2]=G.z,y.targetPosition[0]=F.x,y.targetPosition[1]=F.y,y.targetPosition[2]=F.z,this.getZincCameraControls().setCurrentCameraSettings(y),D.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>g,this.removeZincObject=p=>{h.removeZincObject(p),b&&b.calculateMaxAllowedDistance(this),D.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{I.length=0,D.isEnabled&&I.push(D.group),h.getPickableThreeJSObjects(I,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||h.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),I),this.getNormalisedMinimapCoordinates=(p,B)=>{if(this.displayMinimap){const y=new S.Vector2;p.getSize(y);let C=y.y-B.clientY;if(_.x+this.minimapScissor.width>B.clientX&&B.clientX>_.x&&_.y+this.minimapScissor.height>C&&C>_.y){let k=(B.clientX-_.x)/this.minimapScissor.width*2-1,R=(C-_.y)/this.minimapScissor.height*2-1;return{x:k,y:R}}}},this.getMinimapDiffFromNormalised=(p,B)=>{if(o)return o.getDiffFromNormalised(p,B)},this.isWebGL2=()=>e.isWebGL2(),this.clearAll=()=>{D.clear(),h.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),r.toBeDwonloaded=0,b&&b.calculateMaxAllowedDistance(this),D.markerUpdateRequired=!0},this.addMetadataTimeStamp=(p,B)=>{N.TimeStamps[p]=V(B)},this.getMetadataTag=p=>N[p],this.getMetadata=()=>N,this.setMetadataTag=(p,B)=>{N[p]=B},this.removeMetadataTag=p=>{delete N[p]},this.resetMetadata=()=>{N=Si()},this.resetDuration=()=>{this.setDuration(Rs)};const P=p=>[...p.years?[`${p.years}years`]:[],...p.months?[`${p.months}months`]:[],...p.weeks?[`${p.weeks}weeks`]:[],...p.days?[`${p.days}days`]:[],...p.hours?[`${p.hours}hours`]:[],...p.mins?[`${p.mins}mins`]:[],...p.secs?[`${p.secs}secs`]:[]].join(" "),V=p=>p.years?p.years*31536e6:0+p.months?p.months*2592e6:0+p.weeks?p.weeks*6048e5:0+p.days?p.days*864e5:0+p.hours?p.hours*36e5:0+p.mins?p.mins*6e4:0+p.secs?p.secs*1e3:0;this.setDurationFromObject=p=>{const B=P(p),y=V(p);this.setMetadataTag("Duration",B),this.setDuration(y)},this.setOriginalDurationFromObject=p=>{const B=P(p);this.setMetadataTag("OriginalDuration",B)},this.exportGLTF=p=>new ws(this).exportGLTF(p),this.getRootRegion=()=>h,this.createLines=(p,B,y,C)=>{let k=h.findChildFromPath(p);return k===void 0&&(k=h.createChildFromPath(p)),k.createLines(B,y,C)},this.createPoints=(p,B,y,C,k)=>{let R=h.findChildFromPath(p);return R===void 0&&(R=h.createChildFromPath(p)),R.createPoints(B,y,C,k)},this.addZincObjectAddedCallbacks=p=>(u=u+1,a[u]=p,u),this.addZincObjectRemovedCallbacks=p=>(l=l+1,f[l]=p,l),this.removeZincObjectAddedCallbacks=p=>{p in u&&delete a[p]},this.removeZincObjectRemovedCallbacks=p=>{p in l&&delete f[p]},this.clearZincObjectAddedCallbacks=()=>{a={},u=0},this.clearZincObjectRemovedCallbacks=()=>{f={},l=0},this.triggerObjectAddedCallback=p=>{for(let B in a)a.hasOwnProperty(B)&&a[B](p)},this.triggerObjectRemovedCallback=p=>{for(let B in f)f.hasOwnProperty(B)&&f[B](p)},this.addTemporaryPoints=(p,B)=>{const y=nt(p.length,p);let C=new S.PointsMaterial({alphaTest:.5,size:15,color:B,sizeAttenuation:!1});const k=Ut();C.map=k;let R=new gt(y,C);return m.add(R),R},this.addTemporaryLines=(p,B)=>{const y=nt(p.length,p),C=new S.LineBasicMaterial({color:B}),k=new Xe(y,C);return m.add(k),k},this.enableFrustumDisplay=()=>{this.camera&&!s&&(s=new S.CameraHelper(this.camera),c.add(s))},this.disableFrustumDisplay=()=>{s&&(c.remove(s),s.dispose(),s=void 0)},this.removeTemporaryPrimitive=p=>{m.remove(p),p.geometry.dispose(),p.material.dispose()},this.clearTemporaryPrimitives=()=>{let p=0;return m.children.forEach(y=>{y.geometry.dispose(),y.material.dispose(),p++}),m.clear(),p},this.addBoundingBoxPrimitive=(p,B,y,C,k,R=void 0)=>{let G=h.findChildFromPath(p);G===void 0&&(G=h.createChildFromPath(p));const q=R||this.getBoundingBox();F.set(0,0,0);const E=F.subVectors(q.max,q.min),K=new S.BoxGeometry(E.x,E.y,E.z),$=G.createGeometryFromThreeJSGeometry(B,K,y,C,k,1e4);return E.addVectors(q.min,q.max).multiplyScalar(.5),$.setPosition(E.x,E.y,E.z),$},this.addSlicesPrimitive=(p,B,y,C,k,R=void 0)=>{if(B&&B.length>=3&&y&&y.length>=3){let G=h.findChildFromPath(p);G===void 0&&(G=h.createChildFromPath(p));const q=R||this.getBoundingBox();F.set(0,0,0);const E=F.subVectors(q.max,q.min),K=["x","y","z"],$=[];let Q=0;return K.forEach(ee=>{let re;switch(ee){case"x":re=new S.PlaneGeometry(E.z,E.y),re.rotateY(Math.PI/2);break;case"y":re=new S.PlaneGeometry(E.x,E.z),re.rotateX(Math.PI/2);break;case"z":re=new S.PlaneGeometry(E.x,E.y);break}const H=G.createGeometryFromThreeJSGeometry(B[Q],re,y[Q],C,k,10001);$.push(H),Q++}),E.addVectors(q.min,q.max).multiplyScalar(.5),$.forEach(ee=>{ee.setPosition(E.x,E.y,E.z)}),$}},this.enableMarkerCluster=p=>{p?(D.markerUpdateRequired=!0,D.enable()):(D.markerUpdateRequired=!1,D.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,Z.main&&(this.enableAxisDisplay(!1,!1),Z.main.forEach(p=>{p.dispose&&p.dispose()})),Z.mini&&(this.enableAxisDisplay(!1,!0),Z.mini.forEach(p=>{p.dispose&&p.dispose()})),Z={main:[],mini:[]}},this.createAxisDisplay=(p=!1)=>{this.destroyAxisDisplay();const B=[{name:"x",dir:new S.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new S.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new S.Vector3(0,0,1),colour:"blue",hex:5592575}],y=this.getBoundingBox(),C=y.min.distanceTo(y.max);let k=new S.Vector3(0,0,0);p&&k.copy(y.min),B.forEach(R=>{const G=new S.ArrowHelper(R.dir,k,C,R.hex);Z.main.push(G);const q=new S.ArrowHelper(R.dir,y.getCenter(F),C/2,R.hex);Z.mini.push(q);const E=ot(R.name,.036,R.colour,"Asap",120,700),K=R.dir.clone().multiplyScalar(C).add(k);E.position.set(K.x,K.y,K.z),Z.main.push(E)})},this.enableAxisDisplay=(p,B=!1)=>{var y;B&&((y=Z==null?void 0:Z.mini)!=null&&y.length)?(this.displayMiniAxes=p,Z.mini.forEach(C=>{p?d.add(C):d.remove(C)})):!B&&Z.main&&Z.main.forEach(C=>{p?c.add(C):c.remove(C)})}},Is=function(n){let e=n,t,s;const i=new S.Clock(!1);this.playAnimation=!0;let r=1e3,o={},a=0,u={},f=0,l={},c=0,d={},h=0,m,A,b,g,M=[],_=[],N=new S.Group,U,I,D=!1,Z=!1;this.getDrawingWidth=()=>e?e.clientWidth:U?typeof U.clientWidth<"u"?Math.round(U.clientWidth):Math.round(U.width):0,this.getDrawingHeight=()=>e?e.clientHeight:U?typeof U.clientHeight<"u"?Math.round(U.clientHeight):Math.round(U.height):0,this.onWindowResize=()=>{s.onWindowResize();const x=this.getDrawingWidth(),O=this.getDrawingHeight();if(t!=null){let P;e?(P=e.getBoundingClientRect(),t.setSize(x,O)):U&&(typeof U.getBoundingClientRect<"u"&&(P=U.getBoundingClientRect(),U.width=x,U.height=O),t.setSize(x,O,!1)),P&&(P.left,P.top);const V=new S.Vector2;t.getSize(V),V.x,V.y}},this.initialiseVisualisation=x=>{if(!Z){if(x=x||{},x.antialias===void 0){let V=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(V=!0)}catch{V=!1}V?x.antialias=!1:x.antialias=!0}x.canvas&&(e=void 0,U=x.canvas),t=new S.WebGLRenderer(x),e!==void 0&&e.appendChild(t.domElement),t.setClearColor(16777215,1),U&&U.style&&(U.style.height="100%",U.style.width="100%");const O=t.domElement;O.addEventListener("webglcontextlost",F,!1),O.addEventListener("webglcontextrestored",z,!1),t.autoClear=!1;const P=this.createScene("default");this.setCurrentScene(P),Z=!0}};const F=x=>{x.preventDefault();for(let O of Object.keys(o))l.hasOwnProperty(O)&&l[O].call()},z=x=>{x.preventDefault();for(let O of Object.keys(o))d.hasOwnProperty(O)&&d[O].call()};this.getCurrentScene=()=>s,this.setCurrentScene=x=>{if(x){this.removeActiveScene(x);const O=s;s=x,O&&O.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(N),this.onWindowResize()}},this.getSceneByName=x=>M[x],this.createScene=x=>{if(M[x]==null){let O;return U?O=new Ct(U,t):O=new Ct(e,t),M[x]=O,O.sceneName=x,O}},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){const x=s.getBoundingBox();if(x){for(let O=0;O<_.length;O++){const P=_[O].getBoundingBox();P&&x.union(P)}s.viewAllWithBoundingBox(x)}}},this.loadModelsURL=(x,O,P,V,p,B)=>{s.loadModelsURL(x,O,P,V,p,B)},this.loadViewURL=x=>{s.loadViewURL(x)},this.loadFromViewURL=(x,O)=>{s.loadFromViewURL(x,O)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};let T=()=>{D?(m=requestAnimationFrame(T),this.render()):(cancelAnimationFrame(m),m=void 0)};this.stopAnimate=()=>{D&&(i.stop(),D=!1)},this.animate=()=>{D||(i.start(),D=!0,T())},this.addContextLostCallbackFunction=x=>(c=c+1,l[c]=x,c),this.removeContextLostCallbackFunction=x=>{x in l&&delete l[x]},this.addContextRestoredCallbackFunction=x=>(h=h+1,d[h]=x,h),this.removeContextRestoredCallbackFunction=x=>{x in h&&delete h[x]},this.addPreRenderCallbackFunction=x=>(a=a+1,o[a]=x,a),this.removePreRenderCallbackFunction=x=>{x in o&&delete o[x]},this.addPostRenderCallbackFunction=x=>(f=f+1,u[f]=x,f),this.removePostRenderCallbackFunction=x=>{x in u&&delete u[x]},this.getPlayRate=()=>r,this.setPlayRate=x=>{r=x},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=x=>{s.setMorphsTime(x)},this.getZincGeometryByID=x=>s.getZincGeometryByID(x),this.addToScene=x=>{s.addObject(x)},this.addToOrthoScene=x=>{if(b==null&&(b=new S.Scene),A==null){const O=this.getDrawingWidth(),P=this.getDrawingHeight();A=new S.OrthographicCamera(-O/2,O/2,P/2,-P/2,1,10),A.position.z=10}b.add(x)};const L=x=>O=>{O.needsUpdate=!0;const P=new S.SpriteMaterial({map:O}),V=P.map.image.width,p=P.map.image.height;x.material=P,x.scale.set(V,p,1);const B=this.getDrawingWidth(),y=this.getDrawingHeight();x.position.set((B-V)/2,(-y+p)/2,1),this.addToOrthoScene(x)};this.addLogo=()=>{g=new S.Sprite,S.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,L(g))},this.render=()=>{I||(e?e.clientWidth>0&&e.clientHeight>0&&(I=new Ot.ResizeSensor(e,this.onWindowResize)):U&&U.width>0&&U.height>0&&(I=new Ot.ResizeSensor(U,this.onWindowResize)));const x=i.getDelta();s.renderGeometries(r,x,this.playAnimation);for(let O=0;O<_.length;O++)_[O].renderGeometries(r,x,this.playAnimation);A!=null&&b!=null&&(t.clearDepth(),t.render(b,A));for(let O of Object.keys(o))o.hasOwnProperty(O)&&o[O].call();s.render(t);for(let O of Object.keys(u))u.hasOwnProperty(O)&&u[O].call()},this.forceContextLoss=()=>{t.forceContextLoss()},this.forceContextRestore=()=>{t.forceContextRestore()},this.getThreeJSRenderer=()=>t,this.isSceneActive=x=>{if(s===x)return!0;for(let O=0;O<_.length;O++)if(_[O]===x)return!0;return!1},this.addActiveScene=x=>{this.isSceneActive(x)||(_.push(x),N.add(x.getThreeJSScene()))},this.removeActiveScene=x=>{for(let O=0;O<_.length;O++)if(_[O]===x){_.splice(O,1),N.remove(x.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let x=0;x<_.length;x++)N.remove(_[x].getThreeJSScene());_.splice(0,_.length)},this.dispose=()=>{D&&cancelAnimationFrame(m);for(const O in M)M.hasOwnProperty(O)&&M[O].clearAll();M=[],_=[],N=new S.Group,this.stopAnimate(),o={},a=0,u={},u=0,l={},c=0,d={},h=0,A=void 0,b=void 0,g=void 0;const x=this.createScene("default");this.setCurrentScene(x),I=void 0,t==null||t.dispose()},this.transitionScene=(x,O)=>{if(s){const P=s.getZincCameraControls(),V=x.getBoundingBox();if(V){const p=V.min.distanceTo(V.max)/2,B=(V.min.x+V.max.x)/2,y=(V.min.y+V.max.y)/2,C=(V.min.z+V.max.z)/2,R=P.getViewportFromCentreAndRadius(B,y,C,p,40,p*4),G=P.getCurrentViewport();P.cameraTransition(G,R,O),P.enableCameraTransition()}}},this.isWebGL2=()=>t?t.capabilities.isWebGL2:!1},Ds=Ni.version,Fs=function(){this.Revision=Ds,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=Fe,this.Glyph=Ke,this.Glyphset=ft,this.Pointset=Te,this.Label=ut,this.Lines=Ve,this.TextureArray=yt,this.TextureSlides=Ee,this.Renderer=Is,this.Scene=Ct,this.Viewport=Re,this.CameraControls=Ht,this.SmoothCameraTransition=ei,this.RayCaster=ti,this.CameraAutoTumble=ii,this.StereoEffect=ri,this.loadExternalFile=Tt,this.loadExternalFiles=Ii,this.THREE=S},Se=new Fs;return Se});
|
|
292
292
|
//# sourceMappingURL=zinc.js.map
|