@abi-software/mapintegratedvuer 0.7.0-vue3.5 → 0.7.0-vue3.6

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.
@@ -4716,7 +4716,7 @@ void main() {
4716
4716
  `)!==-1&&(v=v.replace(/\r\n/g,`
4717
4717
  `)),v.indexOf(`\\
4718
4718
  `)!==-1&&(v=v.replace(/\\\n/g,""));for(var b=v.split(`
4719
- `),L="",w="",k=0,C=[],A=typeof"".trimLeft=="function",O=0,N=b.length;O<N;O++)if(L=b[O],L=A?L.trimLeft():L.trim(),k=L.length,k!==0&&(w=L.charAt(0),w!=="#"))if(w==="v"){var I=L.split(/\s+/);switch(I[0]){case"v":_.vertices.push(parseFloat(I[1]),parseFloat(I[2]),parseFloat(I[3])),7<=I.length?_.colors.push(parseFloat(I[4]),parseFloat(I[5]),parseFloat(I[6])):_.colors.push(void 0,void 0,void 0);break;case"vn":_.normals.push(parseFloat(I[1]),parseFloat(I[2]),parseFloat(I[3]));break;case"vt":_.uvs.push(parseFloat(I[1]),parseFloat(I[2]))}}else if(w==="f"){for(var B,F=L.substr(1).trim(),j=F.split(/\s+/),G=[],P=0,Z=j.length;P<Z;P++)if(B=j[P],0<B.length){var K=B.split("/");G.push(K)}for(var U=G[0],X=1,ee=G.length-1;X<ee;X++){var oe=G[X],he=G[X+1];_.addFace(U[0],oe[0],he[0],U[1],oe[1],he[1],U[2],oe[2],he[2])}}else if(w==="l"){var me=L.substring(1).trim().split(" "),ie=[],be=[];if(L.indexOf("/")===-1)ie=me;else for(var re,ue=0,ne=me.length;ue<ne;ue++)re=me[ue].split("/"),re[0]!==""&&ie.push(re[0]),re[1]!==""&&be.push(re[1]);_.addLineGeometry(ie,be)}else if(w==="p"){var ye=L.substr(1).trim(),_e=ye.split(" ");_.addPointGeometry(_e)}else if((C=s.exec(L))!==null){var Ie=(" "+C[0].substr(1).trim()).substr(1);_.startObject(Ie)}else if(c.test(L))_.object.startMaterial(L.substring(7).trim(),_.materialLibraries);else if(l.test(L))_.materialLibraries.push(L.substring(7).trim());else if(u.test(L))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(w==="s"){if(C=L.split(" "),1<C.length){var qe=C[1].trim().toLowerCase();_.object.smooth=qe!=="0"&&qe!=="off"}else _.object.smooth=!0;var Ge=_.object.currentMaterial();Ge&&(Ge.smooth=_.object.smooth)}else{if(L==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+L+'"')}_.finalize();var et=new o.Group;et.materialLibraries=[].concat(_.materialLibraries);var Ve=_.objects.length!==1||_.objects[0].geometry.vertices.length!==0;if(Ve==!0)for(var Ne=0,it=_.objects.length;Ne<it;Ne++){var Be=_.objects[Ne],pt=Be.geometry,yt=Be.materials,ct=pt.type==="Line",xe=pt.type==="Points",Ue=!1;if(pt.vertices.length!==0){var $e=new o.BufferGeometry;$e.setAttribute("position",new o.Float32BufferAttribute(pt.vertices,3)),0<pt.normals.length&&$e.setAttribute("normal",new o.Float32BufferAttribute(pt.normals,3)),0<pt.colors.length&&(Ue=!0,$e.setAttribute("color",new o.Float32BufferAttribute(pt.colors,3))),pt.hasUVIndices===!0&&$e.setAttribute("uv",new o.Float32BufferAttribute(pt.uvs,2));for(var at=[],Ht=0,Vt=yt.length;Ht<Vt;Ht++){var Dt=yt[Ht],Gt=Dt.name+"_"+Dt.smooth+"_"+Ue,Je=_.materials[Gt];if(this.materials!==null){if(Je=this.materials.create(Dt.name),ct&&Je&&!(Je instanceof o.LineBasicMaterial)){var ft=new o.LineBasicMaterial;o.Material.prototype.copy.call(ft,Je),ft.color.copy(Je.color),Je=ft}else if(xe&&Je&&!(Je instanceof o.PointsMaterial)){var St=new o.PointsMaterial({size:10,sizeAttenuation:!1});o.Material.prototype.copy.call(St,Je),St.color.copy(Je.color),St.map=Je.map,Je=St}}Je===void 0&&(Je=ct?new o.LineBasicMaterial:xe?new o.PointsMaterial({size:1,sizeAttenuation:!1}):new o.MeshPhongMaterial,Je.name=Dt.name,Je.flatShading=!Dt.smooth,Je.vertexColors=Ue,_.materials[Gt]=Je),at.push(Je)}var Wt=void 0;if(1<at.length){for(var Jt,Pt=0,rt=yt.length;Pt<rt;Pt++)Jt=yt[Pt],$e.addGroup(Jt.groupStart,Jt.groupCount,Pt);Wt=ct?new o.LineSegments($e,at):xe?new o.Points($e,at):new o.Mesh($e,at)}else Wt=ct?new o.LineSegments($e,at[0]):xe?new o.Points($e,at[0]):new o.Mesh($e,at[0]);Wt.name=Be.name,et.add(Wt)}}else if(0<_.vertices.length){var Et=new o.PointsMaterial({size:1,sizeAttenuation:!1}),kt=new o.BufferGeometry;kt.setAttribute("position",new o.Float32BufferAttribute(_.vertices,3)),0<_.colors.length&&_.colors[0]!==void 0&&(kt.setAttribute("color",new o.Float32BufferAttribute(_.colors,3)),Et.vertexColors=!0);var or=new o.Points(kt,Et);et.add(or)}return et}}},function(r,n,i){var o=i(14).JSONLoader;n.PrimitivesLoader=function(){var s=0;this.crossOrigin="Anonymous";var l=new o,c=[];this.load=(d,p,h,f)=>{if(20>s){++s,l.crossOrigin=this.crossOrigin;var m=new u(p,this),g=new u(f,this);l.load(d,m,h,g)}else c.push({url:d,onLoad:p,onProgress:h,onError:f})},this.loadFromWaitingList=()=>{var d=c.shift();d&&this.load(d.url,d.onLoad,d.onProgress,d.onError)};var u=function(d,p){return function(){--s,d(...arguments),p.loadFromWaitingList()}};this.parse=d=>l.parse(d)}},function(r,n,i){i(3);var o=i(36).GLTFLoader,s=function(){var l=this;this.parseGLTFObjects=(c,u,d,p)=>{var h=u;if(d!==0){if(c.type!=="Object3D"){var f;if(c.type==="Mesh"?f=new(i(2)).Geometry:c.type==="LineSegments"?f=new(i(20)).Lines:c.type==="Points"&&(f=new(i(17)).Pointset),f){var m=!1,g=!1;c.geometry&&c.geometry.morphAttributes&&(m=!!c.geometry.morphAttributes.position,g=!!c.geometry.morphAttributes.color),f.setMesh(c.clone(),m,g),u.addZincObject(f),f.groupName=f.morph.name,f.morph.matrixAutoUpdate=!0,p!=null&&typeof p=="function"&&p(f)}}else if(c.name!==""&&(u&&(h=u.findOrCreateChildFromPath(c.name)),h)){var T=h.getGroup();T.position.copy(c.position),T.rotation.copy(c.rotation),T.quaternion.copy(c.quaternion),T.matrixAutoUpdate=!0}}d++,c.children.forEach(y=>{l.parseGLTFObjects(y,h,d,p)})},this.setCamera=c=>{c.viewAll();var u=c.getZincCameraControls(),d=u.getCurrentViewport();u.addViewport("default",d),u.setDefaultViewport("default")},this.load=(c,u,d,p,h)=>{var f=d.substring(0,d.lastIndexOf("/")+1),m=d.substring(d.lastIndexOf("/")+1,d.length),g=new o().setPath(f);g.load(m,function(T){console.log(T),l.parseGLTFObjects(T.scene,u,0,p),l.setCamera(c),h!=null&&typeof h=="function"&&h()})}};n.GLTFToZincJSLoader=s},function(r,n){r.exports=n8r},function(r,n,i){var o=i(38).GLTFExporter,s=function(l){var c=l;this.exportGLTF=u=>{var d=c.getRootRegion(),p=d.getAllObjects(!0),h=[];p.forEach(g=>{g.animationClip&&h.push({clip:g.animationClip[0],mesh:g.morph})});var f=new o,m={binary:u,animations:h};return new Promise(g=>{f.parse(c.getThreeJSScene(),function(T){g(T)},m)})}};n.SceneExporter=s},function(r,n,i){i.r(n),i.d(n,"GLTFExporter",function(){return s});var o=i(3);class s{constructor(){this.pluginCallbacks=[],this.register(function(I){return new C(I)}),this.register(function(I){return new A(I)}),this.register(function(I){return new O(I)})}register(I){return this.pluginCallbacks.indexOf(I)===-1&&this.pluginCallbacks.push(I),this}unregister(I){return this.pluginCallbacks.indexOf(I)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(I),1),this}parse(I,B,F){for(var j=new k,G=[],P=0,Z=this.pluginCallbacks.length;P<Z;P++)G.push(this.pluginCallbacks[P](j));j.setPlugins(G),j.write(I,B,F)}}var l={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},c={};c[o.NearestFilter]=l.NEAREST,c[o.NearestMipmapNearestFilter]=l.NEAREST_MIPMAP_NEAREST,c[o.NearestMipmapLinearFilter]=l.NEAREST_MIPMAP_LINEAR,c[o.LinearFilter]=l.LINEAR,c[o.LinearMipmapNearestFilter]=l.LINEAR_MIPMAP_NEAREST,c[o.LinearMipmapLinearFilter]=l.LINEAR_MIPMAP_LINEAR,c[o.ClampToEdgeWrapping]=l.CLAMP_TO_EDGE,c[o.RepeatWrapping]=l.REPEAT,c[o.MirroredRepeatWrapping]=l.MIRRORED_REPEAT;var u={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},d=12,p=1179937895,h=2,f=8,m=1313821514,g=5130562;function T(N,I){return N.length===I.length&&N.every(function(B,F){return B===I[F]})}function y(N){if(window.TextEncoder!==void 0)return new TextEncoder().encode(N).buffer;for(var I,B=new Uint8Array(new ArrayBuffer(N.length)),F=0,j=N.length;F<j;F++)I=N.charCodeAt(F),B[F]=255<I?32:I;return B.buffer}function v(N){return T(N.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function _(N,I,B){for(var F={min:Array(N.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(N.itemSize).fill(Number.NEGATIVE_INFINITY)},j=I;j<I+B;j++)for(var G,P=0;P<N.itemSize;P++)G=void 0,4<N.itemSize?G=N.array[j*N.itemSize+P]:P===0?G=N.getX(j):P===1?G=N.getY(j):P===2?G=N.getZ(j):P==3&&(G=N.getW(j)),F.min[P]=Math.min(F.min[P],G),F.max[P]=Math.max(F.max[P],G);return F}function b(N){return 4*Math.ceil(N/4)}function L(N){var I=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,B=b(N.byteLength);if(B!==N.byteLength){var F=new Uint8Array(B);if(F.set(new Uint8Array(N)),I!==0)for(var j=N.byteLength;j<B;j++)F[j]=I;return F.buffer}return N}var w=null;class k{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(I){this.plugins=I}write(I,B,F){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},F),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(I);var j=this;Promise.all(this.pending).then(function(){var G=j.buffers,P=j.json,Z=j.options,K=j.extensionsUsed,U=new Blob(G,{type:"application/octet-stream"}),X=Object.keys(K);if(0<X.length&&(P.extensionsUsed=X),P.buffers&&0<P.buffers.length&&(P.buffers[0].byteLength=U.size),Z.binary===!0){var ee=new window.FileReader;ee.readAsArrayBuffer(U),ee.onloadend=function(){var he=L(ee.result),me=new DataView(new ArrayBuffer(f));me.setUint32(0,he.byteLength,!0),me.setUint32(4,g,!0);var ie=L(y(JSON.stringify(P)),32),be=new DataView(new ArrayBuffer(f));be.setUint32(0,ie.byteLength,!0),be.setUint32(4,m,!0);var re=new ArrayBuffer(d),ue=new DataView(re);ue.setUint32(0,p,!0),ue.setUint32(4,h,!0);var ne=d+be.byteLength+ie.byteLength+me.byteLength+he.byteLength;ue.setUint32(8,ne,!0);var ye=new Blob([re,be,ie,me,he],{type:"application/octet-stream"}),_e=new window.FileReader;_e.readAsArrayBuffer(ye),_e.onloadend=function(){B(_e.result)}}}else if(P.buffers&&0<P.buffers.length){var oe=new window.FileReader;oe.readAsDataURL(U),oe.onloadend=function(){var he=oe.result;P.buffers[0].uri=he,B(P)}}else B(P)})}serializeUserData(I,B){if(!(I.userData&&I.userData.isZincObject)&&Object.keys(I.userData).length!==0){var F=this.options,j=this.extensionsUsed;try{var G=JSON.parse(JSON.stringify(I.userData));if(F.includeCustomExtensions&&G.gltfExtensions){for(var P in B.extensions===void 0&&(B.extensions={}),G.gltfExtensions)B.extensions[P]=G.gltfExtensions[P],j[P]=!0;delete G.gltfExtensions}0<Object.keys(G).length&&(B.extras=G)}catch(Z){console.warn("THREE.GLTFExporter: userData of '"+I.name+"' won't be serialized because of JSON.stringify error - "+Z.message)}}}getUID(I){return this.uids.has(I)||this.uids.set(I,this.uid++),this.uids.get(I)}isNormalizedNormalAttribute(I){var B=this.cache;if(B.attributesNormalized.has(I))return!1;for(var F=new o.Vector3,j=0,G=I.count;j<G;j++)if(5e-4<Math.abs(F.fromBufferAttribute(I,j).length()-1))return!1;return!0}createNormalizedNormalAttribute(I){var B=this.cache;if(B.attributesNormalized.has(I))return B.attributesNormalized.get(I);for(var F=I.clone(),j=new o.Vector3,G=0,P=F.count;G<P;G++)j.fromBufferAttribute(F,G),j.x===0&&j.y===0&&j.z===0?j.setX(1):j.normalize(),F.setXYZ(G,j.x,j.y,j.z);return B.attributesNormalized.set(I,F),F}applyTextureTransform(I,B){var F=!1,j={};(B.offset.x!==0||B.offset.y!==0)&&(j.offset=B.offset.toArray(),F=!0),B.rotation!==0&&(j.rotation=B.rotation,F=!0),(B.repeat.x!==1||B.repeat.y!==1)&&(j.scale=B.repeat.toArray(),F=!0),F&&(I.extensions=I.extensions||{},I.extensions.KHR_texture_transform=j,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(I){var B=this.json,F=this.buffers;return B.buffers||(B.buffers=[{byteLength:0}]),F.push(I),0}processBufferView(I,B,F,j,G){var P=this.json;P.bufferViews||(P.bufferViews=[]);for(var Z=B===l.UNSIGNED_BYTE?1:B===l.UNSIGNED_SHORT?2:4,K=b(j*I.itemSize*Z),U=new DataView(new ArrayBuffer(K)),X=0,ee=F;ee<F+j;ee++)for(var oe,he=0;he<I.itemSize;he++)oe=void 0,4<I.itemSize?oe=I.array[ee*I.itemSize+he]:he===0?oe=I.getX(ee):he===1?oe=I.getY(ee):he===2?oe=I.getZ(ee):he==3&&(oe=I.getW(ee)),B===l.FLOAT?U.setFloat32(X,oe,!0):B===l.UNSIGNED_INT?U.setUint32(X,oe,!0):B===l.UNSIGNED_SHORT?U.setUint16(X,oe,!0):B===l.UNSIGNED_BYTE&&U.setUint8(X,oe),X+=Z;var me={buffer:this.processBuffer(U.buffer),byteOffset:this.byteOffset,byteLength:K};G!==void 0&&(me.target=G),G===l.ARRAY_BUFFER&&(me.byteStride=I.itemSize*Z),this.byteOffset+=K,P.bufferViews.push(me);var ie={id:P.bufferViews.length-1,byteLength:0};return ie}processBufferViewImage(I){var B=this,F=B.json;return F.bufferViews||(F.bufferViews=[]),new Promise(function(j){var G=new window.FileReader;G.readAsArrayBuffer(I),G.onloadend=function(){var P=L(G.result),Z={buffer:B.processBuffer(P),byteOffset:B.byteOffset,byteLength:P.byteLength};B.byteOffset+=P.byteLength,j(F.bufferViews.push(Z)-1)}})}processAccessor(I,B,F,j){var G,P=this.options,Z=this.json;if(I.array.constructor===Float32Array)G=l.FLOAT;else if(I.array.constructor===Uint32Array)G=l.UNSIGNED_INT;else if(I.array.constructor===Uint16Array)G=l.UNSIGNED_SHORT;else if(I.array.constructor===Uint8Array)G=l.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(F===void 0&&(F=0),j===void 0&&(j=I.count),P.truncateDrawRange&&B!==void 0&&B.index===null){var K=F+j,U=B.drawRange.count===1/0?I.count:B.drawRange.start+B.drawRange.count;F=Math.max(F,B.drawRange.start),j=Math.min(K,U)-F,0>j&&(j=0)}if(j===0)return null;var X,ee=_(I,F,j);B!==void 0&&(X=I===B.index?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER);var oe=this.processBufferView(I,G,F,j,X),he={bufferView:oe.id,byteOffset:oe.byteOffset,componentType:G,count:j,max:ee.max,min:ee.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[I.itemSize]};return I.normalized===!0&&(he.normalized=!0),Z.accessors||(Z.accessors=[]),Z.accessors.push(he)-1}processImage(I,B,F){var j=this,G=j.cache,P=j.json,Z=j.options,K=j.pending;G.images.has(I)||G.images.set(I,{});var U=G.images.get(I),X=B===o.RGBAFormat?"image/png":"image/jpeg",ee=X+":flipY/"+F.toString();if(U[ee]!==void 0)return U[ee];P.images||(P.images=[]);var oe={mimeType:X};if(Z.embedImages){var he=w=w||document.createElement("canvas");he.width=Math.min(I.width,Z.maxTextureSize),he.height=Math.min(I.height,Z.maxTextureSize);var me=he.getContext("2d");if(F===!0&&(me.translate(0,he.height),me.scale(1,-1)),typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&I instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&I instanceof ImageBitmap)me.drawImage(I,0,0,he.width,he.height);else{B!==o.RGBAFormat&&B!==o.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(I.width>Z.maxTextureSize||I.height>Z.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",I);var ie=new Uint8ClampedArray(4*(I.height*I.width));if(B===o.RGBAFormat)for(var be=0;be<ie.length;be+=4)ie[be+0]=I.data[be+0],ie[be+1]=I.data[be+1],ie[be+2]=I.data[be+2],ie[be+3]=I.data[be+3];else for(var re=0,ue=0;re<ie.length;re+=4,ue+=3)ie[re+0]=I.data[ue+0],ie[re+1]=I.data[ue+1],ie[re+2]=I.data[ue+2],ie[re+3]=255;me.putImageData(new ImageData(ie,I.width,I.height),0,0)}Z.binary===!0?K.push(new Promise(function(ye){he.toBlob(function(_e){j.processBufferViewImage(_e).then(function(Ie){oe.bufferView=Ie,ye()})},X)})):oe.uri=he.toDataURL(X)}else oe.uri=I.src;var ne=P.images.push(oe)-1;return U[ee]=ne,ne}processSampler(I){var B=this.json;B.samplers||(B.samplers=[]);var F={magFilter:c[I.magFilter],minFilter:c[I.minFilter],wrapS:c[I.wrapS],wrapT:c[I.wrapT]};return B.samplers.push(F)-1}processTexture(I){var B=this.cache,F=this.json;if(B.textures.has(I))return B.textures.get(I);F.textures||(F.textures=[]);var j={sampler:this.processSampler(I),source:this.processImage(I.image,I.format,I.flipY)};I.name&&(j.name=I.name),this._invokeAll(function(P){P.writeTexture&&P.writeTexture(I,j)});var G=F.textures.push(j)-1;return B.textures.set(I,G),G}processMaterial(I){var B=this.cache,F=this.json;if(B.materials.has(I))return B.materials.get(I);if(I.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;F.materials||(F.materials=[]);var j={pbrMetallicRoughness:{}};I.isMeshStandardMaterial!==!0&&I.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var G=I.color.toArray().concat([I.opacity]);if(T(G,[1,1,1,1])||(j.pbrMetallicRoughness.baseColorFactor=G),I.isMeshStandardMaterial?(j.pbrMetallicRoughness.metallicFactor=I.metalness,j.pbrMetallicRoughness.roughnessFactor=I.roughness):(j.pbrMetallicRoughness.metallicFactor=.5,j.pbrMetallicRoughness.roughnessFactor=.5),I.metalnessMap||I.roughnessMap)if(I.metalnessMap===I.roughnessMap){var P={index:this.processTexture(I.metalnessMap)};this.applyTextureTransform(P,I.metalnessMap),j.pbrMetallicRoughness.metallicRoughnessTexture=P}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(I.map){var Z={index:this.processTexture(I.map)};this.applyTextureTransform(Z,I.map),j.pbrMetallicRoughness.baseColorTexture=Z}if(I.emissive){var K=I.emissive.clone().multiplyScalar(I.emissiveIntensity),U=Math.max(K.r,K.g,K.b);if(1<U&&(K.multiplyScalar(1/U),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<U&&(j.emissiveFactor=K.toArray()),I.emissiveMap){var X={index:this.processTexture(I.emissiveMap)};this.applyTextureTransform(X,I.emissiveMap),j.emissiveTexture=X}}if(I.normalMap){var ee={index:this.processTexture(I.normalMap)};I.normalScale&&I.normalScale.x!==-1&&(I.normalScale.x!==I.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),ee.scale=I.normalScale.x),this.applyTextureTransform(ee,I.normalMap),j.normalTexture=ee}if(I.aoMap){var oe={index:this.processTexture(I.aoMap),texCoord:1};I.aoMapIntensity!==1&&(oe.strength=I.aoMapIntensity),this.applyTextureTransform(oe,I.aoMap),j.occlusionTexture=oe}I.transparent?j.alphaMode="BLEND":0<I.alphaTest&&(j.alphaMode="MASK",j.alphaCutoff=I.alphaTest),I.side===o.DoubleSide&&(j.doubleSided=!0),I.name!==""&&(j.name=I.name),this.serializeUserData(I,j),this._invokeAll(function(me){me.writeMaterial&&me.writeMaterial(I,j)});var he=F.materials.push(j)-1;return B.materials.set(I,he),he}processMesh(I){var B=this.cache,F=this.json,j=[I.geometry.uuid];if(Array.isArray(I.material))for(var G=0,P=I.material.length;G<P;G++)j.push(I.material[G].uuid);else j.push(I.material.uuid);var Z=j.join(":");if(B.meshes.has(Z))return B.meshes.get(Z);var K,U=I.geometry;if(K=I.isLineSegments?l.LINES:I.isLineLoop?l.LINE_LOOP:I.isLine?l.LINE_STRIP:I.isPoints?l.POINTS:I.material.wireframe?l.LINES:l.TRIANGLES,U.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var X={},ee={},oe=[],he=[],me={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},ie=U.getAttribute("normal");ie===void 0||this.isNormalizedNormalAttribute(ie)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),U.setAttribute("normal",this.createNormalizedNormalAttribute(ie)));var be=null;for(var re in U.attributes)if(re.substr(0,5)!=="morph"){var ue=U.attributes[re];re=me[re]||re.toUpperCase();var ne=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(ne.test(re)||(re="_"+re),B.attributes.has(this.getUID(ue))){ee[re]=B.attributes.get(this.getUID(ue));continue}be=null;var ye=ue.array;re!=="JOINTS_0"||ye instanceof Uint16Array||ye instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),be=new o.BufferAttribute(new Uint16Array(ye),ue.itemSize,ue.normalized));var _e=this.processAccessor(be||ue,U);_e!==null&&(ee[re]=_e,B.attributes.set(this.getUID(ue),_e))}if(ie!==void 0&&U.setAttribute("normal",ie),Object.keys(ee).length===0)return null;if(I.morphTargetInfluences!==void 0&&0<I.morphTargetInfluences.length){var Ie=[],qe=[],Ge={};if(I.morphTargetDictionary!==void 0)for(var et in I.morphTargetDictionary)Ge[I.morphTargetDictionary[et]]=et;for(var Ve=0;Ve<I.morphTargetInfluences.length;++Ve){var Ne={},it=!1;for(var Be in U.morphAttributes){if(Be!="position"&&Be!=="normal"&&Be!=="color"){it||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),it=!0);continue}var pt=U.morphAttributes[Be][Ve],yt=Be.toUpperCase();me[Be]&&(yt=me[Be]);var ct=U.attributes[Be];if(B.attributes.has(this.getUID(pt))){Ne[yt]=B.attributes.get(this.getUID(pt));continue}var xe=ct.clone();if(!U.morphTargetsRelative)if(ct)for(var Ue=0,$e=pt.count;Ue<$e;Ue++)ct.count>Ue&&xe.setXYZ(Ue,pt.getX(Ue)-ct.getX(Ue),pt.getY(Ue)-ct.getY(Ue),pt.getZ(Ue)-ct.getZ(Ue));else for(var at=0,Ht=pt.count;at<Ht;at++)xe.setXYZ(at,0,0,0);Ne[yt]=this.processAccessor(xe,U),B.attributes.set(this.getUID(ct),Ne[yt])}he.push(Ne),Ie.push(I.morphTargetInfluences[Ve]),I.morphTargetDictionary!==void 0&&qe.push(Ge[Ve])}X.weights=Ie,0<qe.length&&(X.extras={},X.extras.targetNames=qe)}var Vt=Array.isArray(I.material);if(Vt&&U.groups.length===0)return null;for(var Dt,Gt=Vt?I.material:[I.material],Je=Vt?U.groups:[{materialIndex:0,start:void 0,count:void 0}],ft=0,St=Je.length;ft<St;ft++){if(Dt={mode:K,attributes:ee},this.serializeUserData(U,Dt),0<he.length&&(Dt.targets=he),U.index!==null){var Wt=this.getUID(U.index);(Je[ft].start!==void 0||Je[ft].count!==void 0)&&(Wt+=":"+Je[ft].start+":"+Je[ft].count),B.attributes.has(Wt)?Dt.indices=B.attributes.get(Wt):(Dt.indices=this.processAccessor(U.index,U,Je[ft].start,Je[ft].count),B.attributes.set(Wt,Dt.indices)),Dt.indices===null&&delete Dt.indices}var Jt=this.processMaterial(Gt[Je[ft].materialIndex]);Jt!==null&&(Dt.material=Jt),oe.push(Dt)}X.primitives=oe,F.meshes||(F.meshes=[]),this._invokeAll(function(rt){rt.writeMesh&&rt.writeMesh(I,X)});var Pt=F.meshes.push(X)-1;return B.meshes.set(Z,Pt),Pt}processCamera(I){var B=this.json;B.cameras||(B.cameras=[]);var F=I.isOrthographicCamera,j={type:F?"orthographic":"perspective"};return F?j.orthographic={xmag:2*I.right,ymag:2*I.top,zfar:0>=I.far?.001:I.far,znear:0>I.near?0:I.near}:j.perspective={aspectRatio:I.aspect,yfov:o.MathUtils.degToRad(I.fov),zfar:0>=I.far?.001:I.far,znear:0>I.near?0:I.near},I.name!==""&&(j.name=I.type),B.cameras.push(j)-1}processAnimation(I,B){var F=this.json,j=this.nodeMap;F.animations||(F.animations=[]),I=s.Utils.mergeMorphTargetTracks(I.clone(),B);for(var G=I.tracks,P=[],Z=[],K=0;K<G.length;++K){var U=G[K],X=o.PropertyBinding.parseTrackName(U.name),ee=o.PropertyBinding.findNode(B,X.nodeName),oe=u[X.propertyName];if(X.objectName==="bones"&&(ee.isSkinnedMesh===!0?ee=ee.skeleton.getBoneByName(X.objectIndex):ee=void 0),!ee||!oe)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',U.name),null;var he=U.values.length/U.times.length;oe===u.morphTargetInfluences&&(he/=ee.morphTargetInfluences.length);var me=void 0;U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(me="CUBICSPLINE",he/=3):U.getInterpolation()===o.InterpolateDiscrete?me="STEP":me="LINEAR",Z.push({input:this.processAccessor(new o.BufferAttribute(U.times,1)),output:this.processAccessor(new o.BufferAttribute(U.values,he)),interpolation:me}),P.push({sampler:Z.length-1,target:{node:j.get(ee),path:oe}})}return F.animations.push({name:I.name||"clip_"+F.animations.length,samplers:Z,channels:P}),F.animations.length-1}processSkin(I){var B=this.json,F=this.nodeMap,j=B.nodes[F.get(I)],G=I.skeleton;if(G===void 0)return null;var P=I.skeleton.bones[0];if(P===void 0)return null;for(var Z=[],K=new Float32Array(16*G.bones.length),U=new o.Matrix4,X=0;X<G.bones.length;++X)Z.push(F.get(G.bones[X])),U.copy(G.boneInverses[X]),U.multiply(I.bindMatrix).toArray(K,16*X);B.skins===void 0&&(B.skins=[]),B.skins.push({inverseBindMatrices:this.processAccessor(new o.BufferAttribute(K,16)),joints:Z,skeleton:F.get(P)});var ee=j.skin=B.skins.length-1;return ee}processNode(I){var B=this.json,F=this.options,j=this.nodeMap;B.nodes||(B.nodes=[]);var G={};if(F.trs){var P=I.quaternion.toArray(),Z=I.position.toArray(),K=I.scale.toArray();T(P,[0,0,0,1])||(G.rotation=P),T(Z,[0,0,0])||(G.translation=Z),T(K,[1,1,1])||(G.scale=K)}else I.matrixAutoUpdate&&I.updateMatrix(),v(I.matrix)===!1&&(G.matrix=I.matrix.elements);if(I.name!==""&&(G.name=I.name+""),this.serializeUserData(I,G),I.isMesh||I.isLine||I.isPoints){var U=this.processMesh(I);U!==null&&(G.mesh=U)}else I.isCamera&&(G.camera=this.processCamera(I));if(I.isSkinnedMesh&&this.skins.push(I),0<I.children.length){for(var X,ee=[],oe=0,he=I.children.length;oe<he;oe++)if(X=I.children[oe],X.visible||F.onlyVisible===!1){var me=this.processNode(X);me!==null&&ee.push(me)}0<ee.length&&(G.children=ee)}this._invokeAll(function(be){be.writeNode&&be.writeNode(I,G)});var ie=B.nodes.push(G)-1;return j.set(I,ie),ie}processScene(I){var B=this.json,F=this.options;B.scenes||(B.scenes=[],B.scene=0);var j={};I.name!==""&&(j.name=I.name),B.scenes.push(j);for(var G,P=[],Z=0,K=I.children.length;Z<K;Z++)if(G=I.children[Z],G.visible||F.onlyVisible===!1){var U=this.processNode(G);U!==null&&P.push(U)}0<P.length&&(j.nodes=P),this.serializeUserData(I,j)}processObjects(I){var B=new o.Scene;B.name="AuxScene";for(var F=0;F<I.length;F++)B.children.push(I[F]);this.processScene(B)}processInput(I){var B=this.options;I=I instanceof Array?I:[I],this._invokeAll(function(Z){Z.beforeParse&&Z.beforeParse(I)});for(var F=[],j=0;j<I.length;j++)I[j]instanceof o.Scene?this.processScene(I[j]):F.push(I[j]);0<F.length&&this.processObjects(F);for(var G=0;G<this.skins.length;++G)this.processSkin(this.skins[G]);for(var P=0;P<B.animations.length;++P)this.processAnimation(B.animations[P].clip,B.animations[P].mesh);this._invokeAll(function(Z){Z.afterParse&&Z.afterParse(I)})}_invokeAll(I){for(var B=0,F=this.plugins.length;B<F;B++)I(this.plugins[B])}}class C{constructor(I){this.writer=I,this.name="KHR_lights_punctual"}writeNode(I,B){if(I.isLight){if(!I.isDirectionalLight&&!I.isPointLight&&!I.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",I);var F=this.writer,j=F.json,G=F.extensionsUsed,P={};I.name&&(P.name=I.name),P.color=I.color.toArray(),P.intensity=I.intensity,I.isDirectionalLight?P.type="directional":I.isPointLight?(P.type="point",0<I.distance&&(P.range=I.distance)):I.isSpotLight&&(P.type="spot",0<I.distance&&(P.range=I.distance),P.spot={},P.spot.innerConeAngle=-1*((I.penumbra-1)*I.angle),P.spot.outerConeAngle=I.angle),I.decay!==void 0&&I.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),I.target&&(I.target.parent!==I||I.target.position.x!==0||I.target.position.y!==0||I.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."),G[this.name]||(j.extensions=j.extensions||{},j.extensions[this.name]={lights:[]},G[this.name]=!0);var Z=j.extensions[this.name].lights;Z.push(P),B.extensions=B.extensions||{},B.extensions[this.name]={light:Z.length-1}}}}class A{constructor(I){this.writer=I,this.name="KHR_materials_unlit"}writeMaterial(I,B){if(I.isMeshBasicMaterial){var F=this.writer,j=F.extensionsUsed;B.extensions=B.extensions||{},B.extensions[this.name]={},j[this.name]=!0,B.pbrMetallicRoughness.metallicFactor=0,B.pbrMetallicRoughness.roughnessFactor=.9}}}class O{constructor(I){this.writer=I,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(I,B){if(I.isGLTFSpecularGlossinessMaterial){var F=this.writer,j=F.extensionsUsed,G={};B.pbrMetallicRoughness.baseColorFactor&&(G.diffuseFactor=B.pbrMetallicRoughness.baseColorFactor);var P=[1,1,1];if(I.specular.toArray(P,0),G.specularFactor=P,G.glossinessFactor=I.glossiness,B.pbrMetallicRoughness.baseColorTexture&&(G.diffuseTexture=B.pbrMetallicRoughness.baseColorTexture),I.specularMap){var Z={index:F.processTexture(I.specularMap)};F.applyTextureTransform(Z,I.specularMap),G.specularGlossinessTexture=Z}B.extensions=B.extensions||{},B.extensions[this.name]=G,j[this.name]=!0}}}s.Utils={insertKeyframe:function(N,I){var B,F=.001,j=N.getValueSize(),G=new N.TimeBufferType(N.times.length+1),P=new N.ValueBufferType(N.values.length+j),Z=N.createInterpolant(new N.ValueBufferType(j));if(N.times.length===0){G[0]=I;for(var K=0;K<j;K++)P[K]=0;B=0}else if(I<N.times[0]){if(Math.abs(N.times[0]-I)<F)return 0;G[0]=I,G.set(N.times,1),P.set(Z.evaluate(I),0),P.set(N.values,j),B=0}else if(I>N.times[N.times.length-1]){if(Math.abs(N.times[N.times.length-1]-I)<F)return N.times.length-1;G[G.length-1]=I,G.set(N.times,0),P.set(N.values,0),P.set(Z.evaluate(I),N.values.length),B=G.length-1}else for(var U=0;U<N.times.length;U++){if(Math.abs(N.times[U]-I)<F)return U;if(N.times[U]<I&&N.times[U+1]>I){G.set(N.times.slice(0,U+1),0),G[U+1]=I,G.set(N.times.slice(U+1),U+2),P.set(N.values.slice(0,(U+1)*j),0),P.set(Z.evaluate(I),(U+1)*j),P.set(N.values.slice((U+1)*j),(U+2)*j),B=U+1;break}}return N.times=G,N.values=P,B},mergeMorphTargetTracks:function(N,I){for(var B=[],F={},j=N.tracks,G=0;G<j.length;++G){var P=j[G],Z=o.PropertyBinding.parseTrackName(P.name),K=o.PropertyBinding.findNode(I,Z.nodeName);if(Z.propertyName!=="morphTargetInfluences"||Z.propertyIndex===void 0){B.push(P);continue}if(P.createInterpolant!==P.InterpolantFactoryMethodDiscrete&&P.createInterpolant!==P.InterpolantFactoryMethodLinear){if(P.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."),P=P.clone(),P.setInterpolation(o.InterpolateLinear)}var U=K.morphTargetInfluences.length,X=K.morphTargetDictionary[Z.propertyIndex];if(X===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+Z.propertyIndex);var ee=void 0;if(F[K.uuid]===void 0){ee=P.clone();for(var oe=new ee.ValueBufferType(U*ee.times.length),he=0;he<ee.times.length;he++)oe[he*U+X]=ee.values[he];ee.name=(Z.nodeName||"")+".morphTargetInfluences",ee.values=oe,F[K.uuid]=ee,B.push(ee);continue}var me=P.createInterpolant(new P.ValueBufferType(1));ee=F[K.uuid];for(var ie=0;ie<ee.times.length;ie++)ee.values[ie*U+X]=me.evaluate(ee.times[ie]);for(var be,re=0;re<P.times.length;re++)be=this.insertKeyframe(ee,P.times[re]),ee.values[be*U+X]=P.values[re]}return N.tracks=B,N}}},function(r,n,i){var o=i(3),s=i(4).resolveURL,l=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var y=this;this.setFromObject=v=>{var{nearPlane:_,farPlane:b,eyePosition:L,targetPosition:w,upVector:k}=v;y.nearPlane=_,y.farPlane=b,y.eyePosition=L,y.targetPosition=w,y.upVector=k}},c=function(y,v,_,b){var L={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},w={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},k={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},C={};C.MAIN=w.ROTATE,C.AUXILIARY=w.ZOOM,C.SECONDARY=w.PAN,this.cameraObject=y,this.domElement=v===void 0?document:v,this.renderer=_,this.scene=b,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.scrollRate=50;var A=6e3,O=!0,N=0,I=void 0,B=void 0,F=!1,j=500,G=void 0,P="default",Z=L.DEFAULT,K=void 0,U=void 0,X=void 0,ee=0,oe=k.FREE;this._state=w.NONE;var he;this.targetTouchId=-1;var me=void 0,ie=new o.Vector3,be=new o.Vector3,re=new o.Vector3,ue=new o.Vector3,ne=new o.Vector3,ye=new o.Vector3,_e=new o.Vector3,Ie=new o.Vector3,qe=new o.Sphere,Ge=new o.Vector3,et=void 0,Ve=0,Ne={default:new l};Ne.default.nearPlane=.1,Ne.default.farPlane=2e3,Ne.default.eyePosition=[0,0,0],Ne.default.targetPosition=[0,0,-1],Ne.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new o.Vector3(...Ne.default.targetPosition)),this.calculateMaxAllowedDistance=rt=>{var Et=rt.getBoundingBox();if(Et){Et.getBoundingSphere(qe),Ve=6*qe.radius;var kt=0;this.cameraObject&&(kt=this.cameraObject.position.distanceTo(qe.center)),Ve=kt>Ve?kt:Ve}else Ve=0},this.addViewport=(rt,Et)=>{rt&&Et&&(Ne[rt]=Et)},this.setDefaultViewport=rt=>!!(rt&&rt in Ne)&&(P=rt,!0),this.getDefaultViewport=()=>P,this.getViewportOfName=rt=>Ne[rt],this.setCurrentViewport=rt=>rt in Ne&&(this.setCurrentCameraSettings(Ne[rt]),!0),this.setRotationMode=rt=>{switch(rt){case"none":oe=k.NONE;break;case"horizontal":oe=k.HORIZONTAL;break;case"vertical":oe=k.VERTICAL;break;case"free":default:oe=k.FREE}},this.onResize=()=>{me&&(me=void 0),et&&et.setCurrentCameraSettings(this.cameraObject,Ne[P])},this.getNDCFromDocumentCoords=(rt,Et,kt)=>{Vt(!1);var or=kt||new o.Vector2,$t=2*((rt-me.left)/me.width)-1,wt=2*-((Et-me.top)/me.height)+1;return or.set($t,wt)},this.getRelativeCoordsFromNDC=(rt,Et,kt)=>{Vt(!1);var or=kt||new o.Vector2;return or.x=(rt+1)*me.width/2,or.y=(1-Et)*me.height/2,or},this.setMouseButtonAction=(rt,Et)=>{C[rt]=w[Et]};var it=()=>{if(0<Ve){var rt=Ge.distanceTo(qe.center);return Ve>rt||this.cameraObject.position.distanceTo(qe.center)>rt}return!0},Be=rt=>{Ge.copy(this.cameraObject.position).add(rt),it()&&(this.cameraObject.target.add(rt),this.cameraObject.position.add(rt),this.updateDirectionalLight())},pt=rt=>{Vt(!1);var Et;if(Z===L.DEFAULT&&(Et=this.scene.getNormalisedMinimapCoordinates(this.renderer,rt)),!Et)rt.button==0?rt.ctrlKey?this._state=C.AUXILIARY:rt.shiftKey?this._state=C.SECONDARY:this._state=C.MAIN:rt.button==1?(rt.preventDefault(),this._state=C.AUXILIARY):rt.button==2&&(this._state=C.SECONDARY),this.pointer_x=rt.clientX-me.left,this.pointer_y=rt.clientY-me.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{Z=L.MINIMAP;var kt=this.scene.getMinimapDiffFromNormalised(Et.x,Et.y);Be(kt)}},yt=rt=>{if(Vt(!1),this.pointer_x=rt.clientX-me.left,this.pointer_y=rt.clientY-me.top,Z===L.MINIMAP){var Et=this.scene.getNormalisedMinimapCoordinates(this.renderer,rt);if(Et){var kt=this.scene.getMinimapDiffFromNormalised(Et.x,Et.y);Be(kt)}}else this._state===w.NONE&&he!==void 0&&he.move(this,rt.clientX,rt.clientY,this.renderer)},ct=rt=>{this._state=w.NONE,Z==L.MINIMAP&&(Z=L.DEFAULT),he!==void 0&&this.pointer_x_start==rt.clientX-me.left&&this.pointer_y_start==rt.clientY-me.top&&he.pick(this,rt.clientX,rt.clientY,this.renderer)},xe=()=>{this._state=w.NONE},Ue=rt=>{Vt(!1);var Et=rt.touches.length;if(Et==1)this._state=w.TOUCH_ROTATE,this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.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(Et==2){this._state=w.TOUCH_ZOOM;var kt=rt.touches[0].clientX-rt.touches[1].clientX,or=rt.touches[0].clientY-rt.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(kt*kt+or*or)}else Et==3&&(this._state=w.TOUCH_PAN,this.targetTouchId=rt.touches[0].identifier,this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},$e=rt=>{rt.preventDefault(),rt.stopPropagation();var Et=rt.touches.length;if(Et==1)this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top;else if(Et==2){if(this._state===w.TOUCH_ZOOM){var kt=rt.touches[0].clientX-rt.touches[1].clientX,or=rt.touches[0].clientY-rt.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(kt*kt+or*or)}}else if(Et==3&&this._state===w.TOUCH_PAN)for(var $t=0;3>$t;$t++)rt.touches[$t].identifier==this.targetTouchId&&(this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top)},at=rt=>{var Et=rt.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=w.NONE,Et==1&&he!==void 0&&this.pointer_x_start==rt.touches[0].clientX-me.left&&this.pointer_y_start==rt.touches[0].clientY-me.top&&he.pick(this.cameraObject,rt.touches[0].clientX,rt.touches[0].clientY,this.renderer)},Ht=()=>{Vt(!0)},Vt=rt=>{if(rt||me===void 0){var Et=new IntersectionObserver(kt=>{for(var or of kt)me=or.boundingClientRect;Et.disconnect()});Et.observe(this.domElement)}},Dt=rt=>{Vt(!1),this._state=w.SCROLL;var Et=0;0<rt.deltaY?Et=this.scrollRate:0>rt.deltaY&&(Et=-1*this.scrollRate),ee+=Et,rt.preventDefault(),rt.stopImmediatePropagation()},Gt=()=>{if(typeof this.cameraObject<"u"){var rt=me.height,Et=this.cameraObject.position.distanceTo(this.cameraObject.target),kt=0;this.cameraObject.far>this.cameraObject.near&&Et>=this.cameraObject.near&&Et<=this.cameraObject.far&&(kt=(Et-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),be.set(this.previous_pointer_x,rt-this.previous_pointer_y,0),re.set(this.previous_pointer_x,rt-this.previous_pointer_y,1),ue.set(this.pointer_x,rt-this.pointer_y,0),ne.set(this.pointer_x,rt-this.pointer_y,1),be.unproject(this.cameraObject),re.unproject(this.cameraObject),ue.unproject(this.cameraObject),ne.unproject(this.cameraObject),ue.sub(be).multiplyScalar(1-kt),ne.sub(re).multiplyScalar(kt),ue.add(ne).multiplyScalar(-.002),Be(ue)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(rt,Et)=>{rt.normalize(),_e.copy(this.cameraObject.position).sub(this.cameraObject.target),Ie.copy(_e),_e.normalize(),.8<Math.abs(_e.dot(rt))&&_e.copy(this.cameraObject.up),be.crossVectors(rt,_e).normalize(),re.crossVectors(rt,be);var kt=rt.dot(Ie),or=be.dot(Ie),$t=re.dot(Ie),wt=rt.dot(this.cameraObject.up),je=be.dot(this.cameraObject.up),ke=re.dot(this.cameraObject.up),Oe=Math.cos(Et),Ye=Math.sin(Et);return ue.set(Oe*be.x+Ye*re.x,Oe*be.y+Ye*re.y,Oe*be.z+Ye*re.z),ne.set(Oe*re.x-Ye*be.x,Oe*re.y-Ye*be.y,Oe*re.z-Ye*be.z),_e.copy(this.cameraObject.target),_e.x=_e.x+rt.x*kt+ue.x*or+ne.x*$t,_e.y=_e.y+rt.y*kt+ue.y*or+ne.y*$t,_e.z=_e.z+rt.z*kt+ue.z*or+ne.z*$t,ie.set(rt.x*wt+ue.x*je+ne.x*ke,rt.y*wt+ue.y*je+ne.y*ke,rt.z*wt+ue.z*je+ne.z*ke),{position:_e,up:ie}},this.rotateAboutLookAtpoint=(rt,Et)=>{var kt=this.getVectorsFromRotateAboutLookAtPoints(rt,Et);this.cameraObject.position.copy(kt.position),this.updateDirectionalLight(),this.cameraObject.up.copy(kt.up)};var Je=()=>{if(typeof this.cameraObject<"u"){var rt=me.width,Et=me.height;if(0<rt&&0<Et){var kt=.25*(rt+Et),or=0,$t=0;(oe===k.FREE||oe===k.HORIZONTAL)&&(or=this.pointer_x-this.previous_pointer_x),(oe===k.FREE||oe===k.VERTICAL)&&($t=this.previous_pointer_y-this.pointer_y);var wt=Math.sqrt(or*or+$t*$t);if(0<wt){var je=1*-$t/wt,ke=1*or/wt;oe===k.FREE&&je*(this.pointer_x-.5*(rt-1))+ke*(.5*(Et-1)-this.pointer_y);var Oe=Math.acos(0/kt)-.5*Math.PI,Ye=this.tumble_rate*wt/kt;ie.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),be.copy(this.cameraObject.up).normalize(),re.copy(be).cross(ie).normalize().multiplyScalar(je),be.multiplyScalar(ke),ye.addVectors(re,be).multiplyScalar(Math.cos(Oe)),ie.multiplyScalar(Math.sin(Oe)),ye.add(ie),this.rotateAboutLookAtpoint(ye,-Ye)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},ft=()=>{var rt=0;return this._state===w.ZOOM?rt=this.previous_pointer_y-this.pointer_y:this._state===w.SCROLL?rt=ee:(rt=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),rt};this.changeZoomByScrollRateUnit=rt=>{var Et=rt*this.scrollRate;this.changeZoomByValue(Et)},this.changeZoomByValue=rt=>{if(typeof this.cameraObject<"u"){me.width;var Et=me.height,kt=this.cameraObject.position.clone();kt.sub(this.cameraObject.target);var or=kt.length(),$t=1.5*rt/Et;if(.01<or+$t*or&&(kt.normalize(),Ge.copy(this.cameraObject.position),Ge.x+=kt.x*$t*or,Ge.y+=kt.y*$t*or,Ge.z+=kt.z*$t*or,it())){this.cameraObject.position.copy(Ge),this.updateDirectionalLight();var wt=1e-5;if(wt*this.cameraObject.far<this.cameraObject.near+$t*or+this.near_plane_fly_debt)this.near_plane_fly_debt!=0&&(this.near_plane_fly_debt+=$t*or,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=$t*or,this.cameraObject.far+=$t*or));else{if(this.near_plane_fly_debt==0){var je=this.cameraObject.near-wt*this.cameraObject.far;this.cameraObject.near=wt*this.cameraObject.far,this.cameraObject.far-=je,this.near_plane_fly_debt-=wt*this.cameraObject.far}this.near_plane_fly_debt+=$t*or}}}};var St=()=>{var rt=ft();this.changeZoomByValue(rt),this._state===w.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),this._state===w.SCROLL&&(ee=0,this._state=w.NONE)};this.setDirectionalLight=rt=>{this.directionalLight=rt},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){O=!0,this.domElement&&this.domElement.addEventListener&&(this.domElement.addEventListener("mousedown",pt,!1),this.domElement.addEventListener("mousemove",yt,!1),this.domElement.addEventListener("mouseup",ct,!1),this.domElement.addEventListener("mouseleave",xe,!1),this.domElement.addEventListener("touchstart",Ue,!1),this.domElement.addEventListener("touchmove",$e,!1),this.domElement.addEventListener("touchend",at,!1),this.domElement.addEventListener("wheel",Dt,!1),this.domElement.addEventListener("contextmenu",rt=>{rt.preventDefault()},!1),this.domElement.addEventListener("mouseenter",Ht,!1))},this.disable=function(){O=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",pt,!1),this.domElement.removeEventListener("mousemove",yt,!1),this.domElement.removeEventListener("mouseup",ct,!1),this.domElement.removeEventListener("mouseleave",xe,!1),this.domElement.removeEventListener("touchstart",Ue,!1),this.domElement.removeEventListener("touchmove",$e,!1),this.domElement.removeEventListener("touchend",at,!1),this.domElement.removeEventListener("wheel",Dt,!1),this.domElement.removeEventListener("mouseenter",Ht,!1),this.domElement.removeEventListener("contextmenu",rt=>{rt.preventDefault()},!1))},this.loadPath=rt=>{I=rt.CameraPath,B=rt.NumberOfPoints},this.loadPathURL=(rt,Et)=>{var kt=new XMLHttpRequest;kt.onreadystatechange=()=>{if(kt.readyState==4&&kt.status==200){var $t=JSON.parse(kt.responseText);this.loadPath($t),Et!=null&&typeof Et=="function"&&Et()}};var or=s(rt);kt.open("GET",or,!0),kt.send()},this.setPathDuration=rt=>{A=rt,K&&K.setDuration(A),U&&U.setDuration(A)},this.getPlayRate=()=>j,this.setPlayRate=rt=>{j=rt};var Wt=rt=>{var Et=N+rt;Et>A&&(Et-=A),N=Et};this.getTime=()=>N,this.setTime=rt=>{N=rt>A?A:0>rt?0:rt},this.getNumberOfTimeFrame=()=>B,this.getCurrentTimeFrame=()=>{if(2<B){var rt=N/A*(B-1),Et=Math.floor(rt),kt=Math.ceil(rt);return Et==kt?Et==B-1?[Et-1,kt,0]:[Et,kt+1,1]:[Et,kt,1-(rt-Et)]}return B==1?[0,0,0]:void 0},this.setCurrentTimeFrame=rt=>{2<B&&(N=A*rt/(B-1),0>N&&(N=0),N>A&&(N=A))};var Jt=rt=>{if(Z===L.PATH&&(Wt(rt),I)){for(var Et=this.getCurrentTimeFrame(),kt=Et[0],or=Et[1],$t=Et[2],wt=[I[3*kt],I[3*kt+1],I[3*kt+2]],je=[I[3*or],I[3*or+1],I[3*or+2]],ke=[],Oe=0;Oe<wt.length;Oe++)ke.push($t*wt[Oe]+(1-$t)*je[Oe]);this.cameraObject.position.set(ke[0],ke[1],ke[2]),this.cameraObject.target.set(je[0],je[1],je[2]),G&&this.cameraObject.lookAt(this.cameraObject.target),F&&(this.directionalLight.position.set(ke[0],ke[1],ke[2]),this.directionalLight.target.position.set(je[0],je[1],je[2]))}};this.calculatePathNow=()=>{Jt(0)};var Pt=()=>{this._state===w.ROTATE||this._state===w.TOUCH_ROTATE?Je():this._state===w.PAN||this._state===w.TOUCH_PAN?(Gt(),et.triggerCallback()):(this._state===w.ZOOM||this._state===w.TOUCH_ZOOM||this._state===w.SCROLL)&&(et.zoom(ft()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,this._state===w.SCROLL&&(this._state=w.NONE),ee=0,et.triggerCallback())};this.update=rt=>{var Et=rt*j,kt=O;Z===L.PATH?Jt(Et):Z===L.SMOOTH_CAMERA_TRANSITION&&K?(K.update(Et),K.isTransitionCompleted()&&(Z=L.DEFAULT),kt=!1):Z===L.ROTATE_CAMERA_TRANSITION&&U?(U.update(Et),U.isTransitionCompleted()&&(Z=L.DEFAULT),kt=!1):Z===L.AUTO_TUMBLE&&X?X.update(Et):Z===L.SYNC_CONTROL&&et&&(Pt(),kt=!1),kt&&(this._state===w.ROTATE||this._state===w.TOUCH_ROTATE?Je():this._state===w.PAN||this._state===w.TOUCH_PAN?Gt():(this._state===w.ZOOM||this._state===w.TOUCH_ZOOM||this._state===w.SCROLL)&&St(),this._state!==w.NONE&&Z===L.AUTO_TUMBLE&&X&&X.stopOnCameraInput,this._state===w.SCROLL&&(this._state=w.NONE)),G?G.update():this.cameraObject.lookAt(this.cameraObject.target)},this.playPath=()=>{Z=L.PATH},this.stopPath=()=>{Z=L.DEFAULT},this.isPlayingPath=()=>Z===L.PATH,this.enableDirectionalLightUpdateWithPath=rt=>{F=rt},this.enableDeviceOrientation=()=>{G||(G=new g(this.cameraObject))},this.disableDeviceOrientation=()=>{G&&(G.dispose(),G=void 0)},this.isDeviceOrientationEnabled=()=>!!G,this.resetView=()=>{var rt=Ne[P];this.cameraObject.near=rt.nearPlane,this.cameraObject.far=rt.farPlane,this.cameraObject.position.set(rt.eyePosition[0],rt.eyePosition[1],rt.eyePosition[2]),this.cameraObject.target.set(rt.targetPosition[0],rt.targetPosition[1],rt.targetPosition[2]),this.cameraObject.up.set(rt.upVector[0],rt.upVector[1],rt.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=rt=>{rt.nearPlane&&(this.cameraObject.near=rt.nearPlane),rt.farPlane&&(this.cameraObject.far=rt.farPlane),rt.eyePosition&&this.cameraObject.position.set(rt.eyePosition[0],rt.eyePosition[1],rt.eyePosition[2]),rt.targetPosition&&this.cameraObject.target.set(rt.targetPosition[0],rt.targetPosition[1],rt.targetPosition[2]),rt.upVector&&this.cameraObject.up.set(rt.upVector[0],rt.upVector[1],rt.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.getViewportFromCentreAndRadius=(rt,Et,kt,or,$t,wt)=>{var je=this.cameraObject.position.x-this.cameraObject.target.x,ke=this.cameraObject.position.y-this.cameraObject.target.y,Oe=this.cameraObject.position.z-this.cameraObject.target.z,Ye=1/Math.sqrt(je*je+ke*ke+Oe*Oe);je*=Ye,ke*=Ye,Oe*=Ye;var ve=or/Math.tan($t*Math.PI/360),Ae=[rt+je*ve,Et+ke*ve,kt+Oe*ve],Re=0,Se=.95;Re=wt>Se*ve?(1-Se)*ve:ve-wt;var ge=new l;return ge.nearPlane=Re,ge.farPlane=ve+wt,ge.eyePosition=Ae,ge.targetPosition=[rt,Et,kt],ge.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],ge},this.getCurrentViewport=()=>{var rt=new l;return rt.nearPlane=this.cameraObject.near,rt.farPlane=this.cameraObject.far,rt.eyePosition[0]=this.cameraObject.position.x,rt.eyePosition[1]=this.cameraObject.position.y,rt.eyePosition[2]=this.cameraObject.position.z,rt.targetPosition[0]=this.cameraObject.target.x,rt.targetPosition[1]=this.cameraObject.target.y,rt.targetPosition[2]=this.cameraObject.target.z,rt.upVector[0]=this.cameraObject.up.x,rt.upVector[1]=this.cameraObject.up.y,rt.upVector[2]=this.cameraObject.up.z,rt},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(rt,Et,kt)=>{U==null&&(K=new u(rt,Et,this,kt))},this.rotateCameraTransition=(rt,Et,kt)=>{K==null&&(U=new d(rt,Et,this,kt))},this.enableCameraTransition=()=>{K&&(Z=L.SMOOTH_CAMERA_TRANSITION),U&&(Z=L.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{Z=L.DEFAULT},this.stopCameraTransition=()=>{Z=L.DEFAULT,K=void 0,U=void 0},this.isTransitioningCamera=()=>Z===L.SMOOTH_CAMERA_TRANSITION||Z===L.ROTATE_CAMERA_TRANSITION,this.autoTumble=(rt,Et,kt)=>{X=new h(rt,Et,kt,this)},this.enableAutoTumble=()=>{Z=L.AUTO_TUMBLE},this.stopAutoTumble=()=>{Z=L.DEFAULT,X=void 0},this.updateAutoTumble=()=>{X&&(X.requireUpdate=!0)},this.isAutoTumble=()=>Z===L.AUTO_TUMBLE,this.enableRaycaster=(rt,Et,kt)=>{he==null&&(he=new p(rt,this.scene,Et,kt,this.renderer))},this.disableRaycaster=()=>{he.disable(),he=void 0},this.isSyncControl=()=>currentMpde===L.SYNC_CONTROL,this.enableSyncControl=()=>(Z=L.SYNC_CONTROL,et||(et=new T),et.setCurrentCameraSettings(this.cameraObject,Ne[P]),et),this.disableSyncControl=()=>{Z=L.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},u=function(y,v,_,b){var L=y.eyePosition,w=y.targetPosition,k=y.upVector,C=v.eyePosition,A=v.targetPosition,O=v.upVector,N=_,I=b,B=0,F=!1;N.near=Math.min(y.nearPlane,v.nearPlane),N.far=Math.max(y.farPlane,v.farPlane),N.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.setDuration=P=>{I=P};var j=P=>{var Z=B+P;Z>I&&(Z=I),B=Z},G=()=>{var P=B/I,Z=[L[0]*(1-P)+C[0]*P,L[1]*(1-P)+C[1]*P,L[2]*(1-P)+C[2]*P],K=[w[0]*(1-P)+A[0]*P,w[1]*(1-P)+A[1]*P,w[2]*(1-P)+A[2]*P];k[0]*(1-P)+O[0]*P,k[1]*(1-P)+O[1]*P,k[2]*(1-P)+O[2]*P,N.cameraObject.position.set(Z[0],Z[1],Z[2]),N.cameraObject.target.set(K[0],K[1],K[2])};this.update=P=>{this.enabled===!1||(j(P),G(),B==I&&(F=!0))},this.isTransitionCompleted=()=>F},d=function(y,v,_,b){var L=b,w=0,k=!1;this.setDuration=A=>{L=A};var C=A=>{var O=w,N=w+A;N>L&&(N=L),w=N;var I=w-O,B=I/L;_.rotateAboutLookAtpoint(y,B*v)};this.update=A=>{this.enabled===!1||(C(A),w==L&&(k=!0))},this.isTransitionCompleted=()=>k},p=function(y,v,_,b,L){var w=y,k=L,C=_,A=b,O=new o.Raycaster;O.params.Line.threshold=.1,O.params.Points.threshold=.1;var N=new o.Vector2,I=!1,B=new Date,F=!1,j=0,G=[],P={zincCamera:void 0,x:-1,y:-1};this.enable=()=>{enable=!0},this.disable=()=>{enable=!1};var Z=(X,ee,oe)=>{if(X.getNDCFromDocumentCoords(ee,oe,N),v!==w){var he=w.getThreeJSScene();k.render(he,X.cameraObject)}O.setFromCamera(N,X.cameraObject);var me=w.getPickableThreeJSObjects();return G.length=0,O.intersectObjects(me,!0,G)};this.pick=(X,ee,oe)=>{k&&w&&X&&C&&(Z(X,ee,oe),C(G,ee,oe))};var K=(X,ee,oe)=>{if(k&&w&&X&&A){if(Z(X,ee,oe),B.setTime(Date.now()),G.length===0){if(F)return;F=!0}else F=!1;A(G,ee,oe)}};this.move=(X,ee,oe)=>{k&&w&&X&&A&&(w.displayMarkers?K(X,ee,oe):(P.zincCamera=X,P.x=ee,P.y=oe,!I&&(j=B?Date.now()-B.getTime():250,250<=j?K(X,ee,oe):(I=!0,setTimeout(U(P),j)))))};var U=X=>function(){I=!1,K(X.zincCamera,X.x,X.y)}},h=function(y,v,_,b){var L=new o.Vector3,w=b;this.stopOnCameraInput=_,this.requireUpdate=!0;var k=new o.Vector3,C=new o.Vector3,A=O=>{var N=Math.sqrt(O[0]*O[0]+O[1]*O[1]),I=4*Math.abs(O[0]),B=4*Math.abs(O[1]),F=.25*(I+B),j=-O[1]/N,G=O[0]/N,P=j*O[0]+G*-O[1];P>F?P=F:P<-F&&(P=-F);var Z=Math.acos(P/F)-.5*Math.PI;L.copy(w.cameraObject.position).sub(w.cameraObject.target).normalize(),k.copy(w.cameraObject.up).normalize(),C.crossVectors(k,L).normalize().multiplyScalar(j),k.multiplyScalar(G),k.add(C).multiplyScalar(Math.cos(Z)),L.multiplyScalar(Math.sin(Z)).add(k)};this.update=O=>{this.enabled===!1||(this.requireUpdate&&(A(y),this.requireUpdate=!1),w.rotateAboutLookAtpoint(L,-v*O/1e3))}},f=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new o.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new o.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(f.prototype,{update:(()=>{var y,v,_,b,L,w,k=new o.Matrix4,C=new o.Matrix4;return function(A){var O=y!==A.focus||v!==A.fov||_!==A.aspect*this.aspect||b!==A.near||L!==A.far||w!==A.zoom;if(O){y=A.focus,v=A.fov,_=A.aspect*this.aspect,b=A.near,L=A.far,w=A.zoom;var N,I,B=A.projectionMatrix.clone(),F=.064/2,j=F*b/y,G=b*Math.tan(.5*(o.Math.DEG2RAD*v))/A.zoom;C.elements[12]=-F,k.elements[12]=F,N=-G*_+j,I=G*_+j,B.elements[0]=2*b/(I-N),B.elements[8]=(I+N)/(I-N),this.cameraL.projectionMatrix.copy(B),N=-G*_-j,I=G*_-j,B.elements[0]=2*b/(I-N),B.elements[8]=(I+N)/(I-N),this.cameraR.projectionMatrix.copy(B)}this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(C),this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(k)}})()});var m=function(y){var v=new f;v.aspect=.5,this.setSize=(_,b)=>{y.setSize(_,b)},this.render=(_,b)=>{_.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),v.update(b);var L=y.getSize();y.setScissorTest(!0),y.clear(),y.setScissor(0,0,L.width/2,L.height),y.setViewport(0,0,L.width/2,L.height),y.render(_,v.cameraL),y.setScissor(L.width/2,0,L.width/2,L.height),y.setViewport(L.width/2,0,L.width/2,L.height),y.render(_,v.cameraR),y.setScissorTest(!1)}},g=function(y){var v=this;this.object=y,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var _=w=>{v.deviceOrientation=w},b=()=>{typeof window<"u"&&(v.screenOrientation=window.orientation||0)},L=(()=>{var w=new o.Vector3(0,0,1),k=new o.Euler,C=new o.Quaternion,A=new o.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(O,N,I,B,F)=>{var j=new o.Vector3(0,0,1);j.subVectors(O.target,O.position),k.set(I,N,-B,"YXZ");var G=new o.Quaternion;G.setFromEuler(k),G.multiply(A),G.multiply(C.setFromAxisAngle(w,-F)),j.applyQuaternion(G),j.addVectors(O.position,j),O.lookAt(j)}})();this.connect=()=>{b(),typeof window<"u"&&(window.addEventListener("orientationchange",b,!1),window.addEventListener("deviceorientation",_,!1)),v.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",b,!1),window.removeEventListener("deviceorientation",_,!1)),v.enabled=!1},this.update=()=>{if(v.enabled!==!1){var w=v.deviceOrientation.alpha?o.Math.degToRad(v.deviceOrientation.alpha):0,k=v.deviceOrientation.beta?o.Math.degToRad(v.deviceOrientation.beta):0,C=v.deviceOrientation.gamma?o.Math.degToRad(v.deviceOrientation.gamma):0,A=v.screenOrientation?o.Math.degToRad(v.screenOrientation):0;L(v.object,w,k,C,A)}},this.dispose=function(){this.disconnect()},this.connect()},T=function(){var y=void 0,v=void 0,_=void 0,b=new o.Vector3,L=new o.Vector3,w=new o.Vector3,k=new o.Vector3,C=void 0;this.setCurrentCameraSettings=(A,O)=>{y=A.clone(),v=A,_=O,y.near=_.nearPlane,_.farPlane&&(y.far=_.farPlane),_.eyePosition&&y.position.set(_.eyePosition[0],_.eyePosition[1],_.eyePosition[2]),_.upVector&&y.up.set(_.upVector[0],_.upVector[1],_.upVector[2]),_.targetPosition&&(y.target=new o.Vector3(_.targetPosition[0],_.targetPosition[1],_.targetPosition[2]),y.lookAt(y.target)),y.updateProjectionMatrix(),b.copy(y.position).project(y),L.copy(y.target).project(y)},this.getCurrentPosition=()=>(L.copy(v.target).project(y),[L.x,L.y]),this.zoom=A=>{var O=Math.max(v.zoom-.002*A,1);v.zoom=O,v.updateProjectionMatrix()},this.zoomToBox=(A,O)=>{A.getCenter(w),w.project(y),this.setCenterZoom([w.x,w.y],O)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:v.zoom}),this.setCenterZoom=(A,O)=>{w.set(A[0],A[1],L.z).unproject(y),k.copy(w).sub(v.target),v.target.copy(w),v.lookAt(v.target),v.position.add(k),v.zoom=O,v.updateProjectionMatrix()},this.setEventCallback=A=>{(A===void 0||typeof A=="function")&&(C=A)},this.triggerCallback=()=>{C!==void 0&&typeof C=="function"&&C()}};n.Viewport=l,n.CameraControls=c,n.SmoothCameraTransition=u,n.RotateCameraTransition=d,n.RayCaster=p,n.CameraAutoTumble=h,n.StereoEffect=m,n.NDCCameraControl=T},function(r,n,i){var{Group:o,Matrix4:s}=i(3),l=0,c=function(){return"re"+l++},u=function(d){var p=d,h=new o;h.matrixAutoUpdate=!1,h.userData=this;var f=[],m="",g=[],T=new s,y=3e3;T.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=c(),this.hideAllPrimitives=()=>{f.forEach(v=>v.hideAllPrimitives()),g.forEach(v=>v.setVisibility(!1))},this.showAllPrimitives=()=>{f.forEach(v=>v.showAllPrimitives()),g.forEach(v=>v.setVisibility(!0))},this.setVisibility=v=>{h.visible=v},this.getVisibility=()=>h.visible,this.getGroup=()=>h,this.setTransformation=v=>{T.set(...v),h.matrix.copy(T),h.updateMatrixWorld()},this.setName=v=>{v&&v!==""&&(m=v)},this.getName=()=>m,this.getParent=()=>p,this.getFullSeparatedPath=()=>{var v=[];if(m!==""){v.push(m);for(var _,b=p;b!==void 0;)_=b.getName(),_!==""&&v.unshift(_),b=b.getParent()}return v},this.getFullPath=()=>{var v=this.getFullSeparatedPath();if(0<v.length){var _=v.shift();return v.forEach(b=>{_=_.concat("/",b)}),_}return""},this.createChild=v=>{var _=new u(this);return _.setName(v),f.push(_),h.add(_.getGroup()),_},this.getChildWithName=v=>{if(v){for(var _=v.toLowerCase(),b=0;b<f.length;b++)if(f[b].getName().toLowerCase()===_)return f[b]}},this.findChildFromSeparatedPath=v=>{if(v&&0<v.length&&v[0]===""&&v.shift(),v&&0<v.length){var _=this.getChildWithName(v[0]);return _?(v.shift(),_.findChildFromSeparatedPath(v)):void 0}return this},this.findChildFromPath=v=>{var _=v.split("/");return this.findChildFromSeparatedPath(_)},this.createChildFromSeparatedPath=v=>{if(0<v.length&&v[0]===""&&v.shift(),0<v.length){var _=this.getChildWithName(v[0]);return _||(_=this.createChild(v[0])),v.shift(),_.createChildFromSeparatedPath(v)}return this},this.createChildFromPath=v=>{var _=v.split("/");return this.createChildFromSeparatedPath(_)},this.findOrCreateChildFromPath=v=>{var _=this.findChildFromPath(v);return _||(_=this.createChildFromPath(v)),_},this.addZincObject=v=>{v&&(v.setRegion(this),h.add(v.morph),g.push(v),this.pickableUpdateRequired=!0)},this.removeZincObject=v=>{for(var _=0;_<g.length;_++)if(v===g[_])return h.remove(v.morph),g.splice(_,1),void v.dispose()},this.checkPickableUpdateRequred=v=>{if(this.pickableUpdateRequired)return!0;if(v){for(var _=!1,b=0;b<f.length;b++)if(_=f[b].checkPickableUpdateRequred(v),_)return!0}return!1},this.getPickableThreeJSObjects=(v,_)=>(g.forEach(b=>{if(b.morph&&b.morph.visible){var L=b.marker;L&&L.isEnabled()&&v.push(L.morph),v.push(b.morph)}}),_&&f.forEach(b=>{b.getPickableThreeJSObjects(v,_)}),this.pickableUpdateRequired=!1,v),this.setDuration=v=>{y=v,g.forEach(_=>_.setDuration(v)),f.forEach(_=>_.setDuration(v))},this.getDuration=()=>y,this.getBoundingBox=v=>{var _,b;return g.forEach(L=>{b=L.getBoundingBox(),b&&(_==null?_=b.clone():_.union(b))}),v&&f.forEach(L=>{b=L.getBoundingBox(v),b&&(_==null?_=b.clone():_.union(b))}),_},this.clear=v=>{v&&f.forEach(_=>_.clear(v)),g.forEach(_=>{h.remove(_.morph),_.dispose()}),f=[],g=[]},this.objectIsInRegion=(v,_)=>{for(var b=0;b<g.length;b++)if(v===g[b])return!0;if(_){for(var L=0;L<f.length;L++)if(f[L].objectIsInRegion(v,_))return!0}return!1},this.forEachGeometry=(v,_)=>{g.forEach(b=>{b.isGeometry&&v(b)}),_&&f.forEach(b=>b.forEachGeometry(v,_))},this.forEachGlyphset=(v,_)=>{g.forEach(b=>{b.isGlyphset&&v(b)}),_&&f.forEach(b=>b.forEachGlyphset(v,_))},this.forEachPointset=(v,_)=>{g.forEach(b=>{b.isPointset&&v(b)}),_&&f.forEach(b=>b.forEachPointset(v,_))},this.forEachLine=(v,_)=>{g.forEach(b=>{b.isLines&&v(b)}),_&&f.forEach(b=>b.forEachLine(v,_))},this.findObjectsWithAnatomicalId=(v,_)=>(g.forEach(b=>{b.anatomicalId===v&&objectsArray.push(b)}),_&&f.forEach(b=>{var L=b.findObjectsWithAnatomicalId(v,_);objectsArray.push(...L)}),objectsArray),this.findObjectsWithGroupName=(v,_)=>{var b=[];return g.forEach(L=>{var w=L.groupName?L.groupName.toLowerCase():L.groupName,k=v&&v.toLowerCase();w===k&&b.push(L)}),_&&f.forEach(L=>{var w=L.findObjectsWithGroupName(v,_);b.push(...w)}),b},this.findGeometriesWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isGeometry);return L},this.findPointsetsWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isPointset);return L},this.findGlyphsetsWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isGlyphset);return L},this.findLinesWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isLines);return L},this.getAllObjects=v=>{var _=[...g];return v&&f.forEach(b=>{var L=b.getAllObjects(v);_.push(...L)}),_},this.getChildRegions=v=>{var _=[...f];return v&&f.forEach(b=>{var L=b.getChildRegions(v);_.push(...L)}),_},this.getCurrentTime=()=>{if(g[0]!=null)return g[0].getCurrentTime();for(var v,_=0;_<f.length;_++)if(v=f[_].getCurrentTime(),v!==-1)return v;return-1},this.setMorphTime=(v,_)=>{g.forEach(b=>{b.setMorphTime(v)}),_&&f.forEach(b=>{b.setMorphTime(v)})},this.isTimeVarying=()=>{for(var v=0;v<g.length;v++)if(g[v].isTimeVarying())return!0;for(var _=0;_<f.length;_++)if(f[_].isTimeVarying())return!0;return!1},this.renderGeometries=(v,_,b,L,w)=>{var k=this.getAllObjects(w);if(k.forEach(O=>{O.render(v*_,b,L)}),L&&L.displayMarkers&&b===!1&&0<L.markerDepths.length){var C=Math.min(...L.markerDepths),A=Math.max(...L.markerDepths);k.forEach(O=>{O.processMarkerVisual(C,A,L)})}}};n.Region=u},function(r,n,i){var o=i(3);n.Minimap=function(s){var l=s;this.camera=new o.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var c=new o.BufferGeometry,u=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),d=new o.BufferAttribute(u,3);c.setAttribute("position",d);var p=new o.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new o.Mesh(c,p);var h=new o.Box3,f=new o.Vector3;this.getDiffFromNormalised=(g,T)=>{h.setFromBufferAttribute(d).getCenter(f);var y=f.clone().project(this.camera),v=new o.Vector3(g,T,y.z).unproject(this.camera);return v.sub(f)};var m=(g,T)=>{l.camera.near&&(this.camera.near=l.camera.near),T.farPlane&&(this.camera.far=T.farPlane),T.eyePosition&&this.camera.position.set(T.eyePosition[0],T.eyePosition[1],T.eyePosition[2]),T.upVector&&this.camera.up.set(T.upVector[0],T.upVector[1],T.upVector[2]),T.targetPosition&&this.camera.lookAt(new o.Vector3(T.targetPosition[0],T.targetPosition[1],T.targetPosition[2])),this.camera.zoom=1/g,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var g=new o.Vector3().copy(l.camera.target).project(l.camera),T=new o.Vector3(-1,-1,g.z).unproject(l.camera),y=new o.Vector3(1,-1,g.z).unproject(l.camera),v=new o.Vector3(1,1,g.z).unproject(l.camera),_=new o.Vector3(-1,1,g.z).unproject(l.camera);d.copyVector3sArray([T,y,v,v,_,T]),d.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var g=l.getZincCameraControls(),T=l.getBoundingBox();if(T){var y=T.min.distanceTo(T.max),v=y/2,_=(T.min.x+T.max.x)/2,b=(T.min.y+T.max.y)/2,L=(T.min.z+T.max.z)/2,w=g.getViewportFromCentreAndRadius(_,b,L,v,40,v*4);m(y,w)}}}},function(r,n,i){var o=i(3),s=i(43)(o),l=i(2).Geometry,c=i(44),u=i(45).default,d=o.BufferGeometryLoader,p=function(h){var f;h&&h.isGeometry&&(f=h);var m=void 0,g=void 0,T=!1,y=void 0,v=k=>{var C=f.morph.material.clone();C.morphTargets=!1;var A=new l,O=new d,N=O.parse(k),I=new o.Mesh(N.geometry,C);return A.geometry=I.geometry,A.morph=I,A.morph.userData=A,A},_=k=>{switch(k.data.action){case"message":console.log(k.data.message);break;case"result":var C=new p(v(k.data.object));y&&y(C),y=void 0,T=!1;break;default:throw"Cannot handle specified action."}},b=k=>{if(c!==void 0&&(g=c(46)),!g)m=new(i(47)).GeometryCSGInternal(k);else if(k&&k.isGeometry){var C=k.morph,A=C.geometry.clone().applyMatrix(C.matrix).toJSON();g.addEventListener("message",function(O){_(O)}),g.postMessage({action:"initialise",object:A})}};this.getHostGeometry=()=>{var k=new s(f.morph);return new L(k)},this.getGeometry=()=>f;var L=k=>{var C=f.morph.material.clone();C.morphTargets=!1;var A=k.toMesh(C),O=new l;return O.geometry=A.geometry,O.morph=A,O.morph.userData=O,O};this.setCSG=k=>{m.setCSG(k)};var w=(k,C,A,O)=>{if(T)O("On progress");else{var N=k.morph,I=N.geometry.clone().applyMatrix(N.matrix).toJSON();y=A,T=!0,g.postMessage({action:C,object:I})}};this.intersect=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.intersect(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.subtract=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.subtract(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.union=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.union(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.terminateWorker=()=>{g&&g.terminate()},b(h)};n.GeometryCSG=p},function(r,n,i){var o=1e-5,s=0,l=1,c=2,u=3;r.exports=function(d){var p=function(h){var f,m,g,T,y,v,_,b=[];if(h.isBufferGeometry&&(h=new d.Geometry().fromBufferGeometry(h)),h instanceof d.Geometry)this.matrix=new d.Matrix4;else if(h.isMesh)h.updateMatrix(),this.matrix=h.matrix.clone(),h=h.geometry,h.isBufferGeometry&&(h=new d.Geometry().fromBufferGeometry(h)),h.mergeVertices(),h.computeVertexNormals(!1);else{if(h instanceof p.Node)return this.tree=h,this.matrix=new d.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported"}for(f=0,m=h.faces.length;f<m;f++)g=h.faces[f],y=h.faceVertexUvs[0][f],_=new p.Polygon,g instanceof d.Face3?(T=h.vertices[g.a],v=y?new d.Vector2(y[0].x,y[0].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[0],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.b],v=y?new d.Vector2(y[1].x,y[1].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.c],v=y?new d.Vector2(y[2].x,y[2].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T)):(d.Face4,T=h.vertices[g.a],v=y?new d.Vector2(y[0].x,y[0].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[0],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.b],v=y?new d.Vector2(y[1].x,y[1].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[1],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.c],v=y?new d.Vector2(y[2].x,y[2].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.d],v=y?new d.Vector2(y[3].x,y[3].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[3],v),T.applyMatrix4(this.matrix),_.vertices.push(T)),_.calculateProperties(),b.push(_);this.tree=new p.Node(b)};return p.prototype.subtract=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.invert(),f.clipTo(m),m.clipTo(f),m.invert(),m.clipTo(f),m.invert(),f.build(m.allPolygons()),f.invert(),f=new p(f),f.matrix=this.matrix,f},p.prototype.union=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.clipTo(m),m.clipTo(f),m.invert(),m.clipTo(f),m.invert(),f.build(m.allPolygons()),f=new p(f),f.matrix=this.matrix,f},p.prototype.intersect=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.invert(),m.clipTo(f),m.invert(),f.clipTo(m),m.clipTo(f),f.build(m.allPolygons()),f.invert(),f=new p(f),f.matrix=this.matrix,f},p.prototype.toGeometry=function(){var h,f,m,g,T,y,v,_,b,L,w=new d.Matrix4().getInverse(this.matrix),k=new d.Geometry,C=this.tree.allPolygons(),A=C.length,O={};for(h=0;h<A;h++)for(m=C[h],g=m.vertices.length,f=2;f<g;f++)L=[],_=m.vertices[0],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),T=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):T=O[_.x+","+_.y+","+_.z],_=m.vertices[f-1],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),y=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):y=O[_.x+","+_.y+","+_.z],_=m.vertices[f],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),v=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):v=O[_.x+","+_.y+","+_.z],b=new d.Face3(T,y,v,new d.Vector3(m.normal.x,m.normal.y,m.normal.z)),k.faces.push(b),k.faceVertexUvs[0].push(L);return k},p.prototype.toBufferGeometry=function(){var h=this.toGeometry(),f=new d.BufferGeometry().fromGeometry(h);return f},p.prototype.toMesh=function(h){var f=this.toBufferGeometry(),m=new d.Mesh(f,h);return m.position.setFromMatrixPosition(this.matrix),m.rotation.setFromRotationMatrix(this.matrix),m},p.Polygon=function(h){h instanceof Array||(h=[]),this.vertices=h,0<h.length?this.calculateProperties():this.normal=this.w=void 0},p.Polygon.prototype.calculateProperties=function(){var h=this.vertices[0],f=this.vertices[1],m=this.vertices[2];return this.normal=f.clone().subtract(h).cross(m.clone().subtract(h)).normalize(),this.w=this.normal.clone().dot(h),this},p.Polygon.prototype.clone=function(){var h,f,m=new p.Polygon;for(h=0,f=this.vertices.length;h<f;h++)m.vertices.push(this.vertices[h].clone());return m.calculateProperties(),m},p.Polygon.prototype.flip=function(){var h,f=[];for(this.normal.multiplyScalar(-1),this.w*=-1,h=this.vertices.length-1;0<=h;h--)f.push(this.vertices[h]);return this.vertices=f,this},p.Polygon.prototype.classifyVertex=function(h){var f=this.normal.dot(h)-this.w;return f<-o?c:f>o?l:s},p.Polygon.prototype.classifySide=function(h){var f,m,g,T=0,y=0,v=h.vertices.length;for(f=0;f<v;f++)m=h.vertices[f],g=this.classifyVertex(m),g===l?T++:g===c&&y++;return 0<T&&y===0?l:T===0&&0<y?c:T===0&&y===0?s:u},p.Polygon.prototype.splitPolygon=function(h,f,m,g,T){var y=this.classifySide(h);if(y===s)(0<this.normal.dot(h.normal)?f:m).push(h);else if(y===l)g.push(h);else if(y===c)T.push(h);else{var v,_,b,L,w,k,C,A,O,N=[],I=[];for(_=0,v=h.vertices.length;_<v;_++)b=(_+1)%v,k=h.vertices[_],C=h.vertices[b],L=this.classifyVertex(k),w=this.classifyVertex(C),L!=c&&N.push(k),L!=l&&I.push(k),(L|w)===u&&(A=(this.w-this.normal.dot(k))/this.normal.dot(C.clone().subtract(k)),O=k.interpolate(C,A),N.push(O),I.push(O));3<=N.length&&g.push(new p.Polygon(N).calculateProperties()),3<=I.length&&T.push(new p.Polygon(I).calculateProperties())}},p.Vertex=function(h,f,m,g,T){this.x=h,this.y=f,this.z=m,this.normal=g||new d.Vector3,this.uv=T||new d.Vector2},p.Vertex.prototype.clone=function(){return new p.Vertex(this.x,this.y,this.z,this.normal.clone(),this.uv.clone())},p.Vertex.prototype.add=function(h){return this.x+=h.x,this.y+=h.y,this.z+=h.z,this},p.Vertex.prototype.subtract=function(h){return this.x-=h.x,this.y-=h.y,this.z-=h.z,this},p.Vertex.prototype.multiplyScalar=function(h){return this.x*=h,this.y*=h,this.z*=h,this},p.Vertex.prototype.cross=function(h){var f=this.x,m=this.y,g=this.z;return this.x=m*h.z-g*h.y,this.y=g*h.x-f*h.z,this.z=f*h.y-m*h.x,this},p.Vertex.prototype.normalize=function(){var h=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=h,this.y/=h,this.z/=h,this},p.Vertex.prototype.dot=function(h){return this.x*h.x+this.y*h.y+this.z*h.z},p.Vertex.prototype.lerp=function(h,f){return this.add(h.clone().subtract(this).multiplyScalar(f)),this.normal.add(h.normal.clone().sub(this.normal).multiplyScalar(f)),this.uv.add(h.uv.clone().sub(this.uv).multiplyScalar(f)),this},p.Vertex.prototype.interpolate=function(h,f){return this.clone().lerp(h,f)},p.Vertex.prototype.applyMatrix4=function(h){var f=this.x,m=this.y,g=this.z,T=h.elements;return this.x=T[0]*f+T[4]*m+T[8]*g+T[12],this.y=T[1]*f+T[5]*m+T[9]*g+T[13],this.z=T[2]*f+T[6]*m+T[10]*g+T[14],this},p.Node=function(h){var f,m,g=[],T=[];if(this.polygons=[],this.front=this.back=void 0,h instanceof Array&&h.length!==0){for(this.divider=h[0].clone(),f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],this.polygons,this.polygons,g,T);0<g.length&&(this.front=new p.Node(g)),0<T.length&&(this.back=new p.Node(T))}},p.Node.isConvex=function(h){var f,m;for(f=0;f<h.length;f++)for(m=0;m<h.length;m++)if(f!==m&&h[f].classifySide(h[m])!==c)return!1;return!0},p.Node.prototype.build=function(h){var f,m,g=[],T=[];for(this.divider||(this.divider=h[0].clone()),f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],this.polygons,this.polygons,g,T);0<g.length&&(!this.front&&(this.front=new p.Node),this.front.build(g)),0<T.length&&(!this.back&&(this.back=new p.Node),this.back.build(T))},p.Node.prototype.allPolygons=function(){var h=this.polygons.slice();return this.front&&(h=h.concat(this.front.allPolygons())),this.back&&(h=h.concat(this.back.allPolygons())),h},p.Node.prototype.clone=function(){var h=new p.Node;return h.divider=this.divider.clone(),h.polygons=this.polygons.map(function(f){return f.clone()}),h.front=this.front&&this.front.clone(),h.back=this.back&&this.back.clone(),h},p.Node.prototype.invert=function(){var h,f,m;for(h=0,f=this.polygons.length;h<f;h++)this.polygons[h].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),m=this.front,this.front=this.back,this.back=m,this},p.Node.prototype.clipPolygons=function(h){var f,m,g,T;if(!this.divider)return h.slice();for(g=[],T=[],f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],g,T,g,T);return this.front&&(g=this.front.clipPolygons(g)),T=this.back?this.back.clipPolygons(T):[],g.concat(T)},p.Node.prototype.clipTo=function(h){this.polygons=h.clipPolygons(this.polygons),this.front&&this.front.clipTo(h),this.back&&this.back.clipTo(h)},p}},function(r,n){r.exports=i8r()},function(r,n){r.exports=h8r},function(r,n,i){var o=i(2).Geometry,s=i(3),l=s.BufferGeometryLoader;r.exports=function(c){var u=void 0,d=function(g){var T=new l,y=T.parse(g),v=new s.MeshPhongMaterial,_=new s.Mesh(y.geometry,v),b=new o;return b.morph=_,b},p=function(g){var T=d(g);u=new(i(47)).GeometryCSGInternal(T),c.postMessage({action:"message",message:"Initialised"})},h=function(g){if(u){var T=d(g),y=u.intersect(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}},f=function(g){if(u){var T=d(g),y=u.subtract(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}},m=function(g){if(u){var T=d(g),y=u.union(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}};c.addEventListener("message",function(g){switch(g.data.action){case"initialise":p(g.data.object);break;case"intersect":h(g.data.object);break;case"subtract":f(g.data.object);break;case"union":m(g.data.object);break;default:throw"Cannot handle specified action."}})}},function(r,n,i){var o=i(3),s=i(43)(o);i(2).Geometry,i(42).GeometryCSG;var l=function(c){var u;c&&c.isGeometry&&(u=c);var d;this.setGeometry=h=>{h&&h.isGeometry&&(u=h),d=void 0},this.setCSG=h=>{d=h};var p=h=>{if(u&&u.morph&&h&&h.morph){d===void 0&&(d=new s(u.morph));var f=new s(h.morph);return f}};this.intersect=h=>{var f=p(h);return d&&f?d.intersect(f):void 0},this.subtract=h=>{var f=p(h);return d&&f?d.subtract(f):void 0},this.union=h=>{var f=p(h);return d&&f?d.union(f):void 0}};n.GeometryCSGInternal=l},function(r,n,i){var o=i(3),s=i(43)(o);i(13).Glyphset;var l=function(c){var u;c&&c.isGlyphset&&(u=c);var d=[];this.setGlyphset=f=>{f&&f.isGlyphset&&(u=f),hostCSG=void 0},this.getGlyphset=()=>u;var p=()=>f=>{var m=f.getMesh(),g=f.getLabel();if(m){var T=new s(m.geometry.clone().applyMatrix(m.matrix)),y=[];y.csg=T,y.label=g,m.material&&(y.material=m.material.clone()),d.push(y)}},h=f=>{if(u&&f&&f.morph){d.length==0&&u.forEachGlyph(p());var m=new s(f.morph);return m}};this.intersect=f=>{var m=h(f);if(0<d.length&&m){for(var g=new(i(13)).Glyphset,T=0;T<d.length;T++){var y=d[T],v=y.csg.intersect(m),_=v.toMesh();if(_&&_.geometry&&0<_.geometry.vertices.length){y.material&&(_.material=y.material,_.material.side=o.DoubleSide,_.material.clippingPlanes=null);var b=g.addMeshAsGlyph(_,T+1);b.setLabel(y.label)}}var L=new l(g);return L}}};n.GlyphsetCSG=l}])})})(hEe);var Uv=hEe.exports;const zB=Ucr(Uv),ZVe={isWebGLAvailable:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}},isWebGL2Available:function(){try{var e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(e){var t={1:"WebGL",2:"WebGL 2"},r={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},n='This module requires <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#008">$1</a> support but your $0 does not seem to support it.',i=document.createElement("div");return i.id="webglmessage",i.style.fontFamily="monospace",i.style.fontSize="20px",i.style.fontWeight="normal",i.style.textAlign="center",i.style.background="#fff",i.style.color="#000",i.style.padding="1.5em",i.style.width="400px",i.style.margin="5em auto 0",r[e]?n=n.replace("$0","graphics card"):n=n.replace("$0","browser"),n=n.replace("$1",t[e]),i.innerHTML=n,i}},lne={ALL:0,DESTROYED:1,NAME_CHANGED:2,SETTINGS_CHANGED:3},D2=function(){this.typeName="Base Module",this.instanceName="default",this.onChangedCallbacks=[],this.eventNotifiers=[]};D2.prototype.setName=function(e){if(e&&this.instanceName!==e){this.instanceName=e;const t=this.onChangedCallbacks.slice();for(let r=0;r<t.length;r++)t[r](this,lne.NAME_CHANGED)}},D2.prototype.settingsChanged=function(){const e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,lne.SETTINGS_CHANGED)},D2.prototype.exportSettings=function(){const e={};return e.dialog=this.typeName,e.name=this.instanceName,e},D2.prototype.importSettings=function(e){return e.dialog==this.typeName?(this.setName(e.name),!0):!1},D2.prototype.publishChanges=function(e,t,r){for(let n=0;n<this.eventNotifiers.length;n++)this.eventNotifiers[n].publish(this,t,e,r)},D2.prototype.getName=function(){return this.instanceName},D2.prototype.destroy=function(){const e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,lne.DESTROYED);delete this},D2.prototype.addChangedCallback=function(e){this.onChangedCallbacks.includes(e)==!1&&this.onChangedCallbacks.push(e)},D2.prototype.removeChangedCallback=function(e){const t=this.onChangedCallbacks.indexOf(e);t>-1&&this.onChangedCallbacks.splice(t,1)},D2.prototype.addNotifier=function(e){this.eventNotifiers.push(e)};const ak={ALL:0,SELECTED:1,HIGHLIGHTED:2,MOVE:3},f8r=function(e,t,r){this.eventType=e,this.identifiers=t,this.zincObjects=r},m8r=function(e,t,r){this.targetedID=[];const n=e,i=t;this.targetEventType=r;const o=this;r===void 0&&(this.targetEventType=ak.ALL),this.getEventType=function(){return r},this.notify=function(s,l,c,u){if(s!==n&&(o.targetEventType===ak.ALL||o.targetEventType===l)){const d=new f8r(l,c,u);i(d)}}},g8r=function(){const e=[];this.publish=function(t,r,n,i){for(let o=0;o<e.length;o++)e[o].notify(t,r,n,i)},this.subscribe=function(t,r,n){if(typeof r=="function"){const i=new m8r(t,r,n);return e.push(i),i}},this.unsubscribe=function(t){for(let r=0;r<e.length;r++)if(t===e[r]){e.splice(r,1);return}}},y8r=function(){let e=[],t=[];this.highlightColour=[1,0,0],this.selectColour=[0,1,0],this.originalColour=[0,0,0];const r=[],n=[],i=this,o=function(c,u){if(c.length==0&&u.length==0)return!1;for(let d=0;d<c.length;d++){let p=!1;for(let h=0;h<u.length;h++)c[d]===u[h]&&(p=!0);if(!p)return!0}for(let d=0;d<u.length;d++){let p=!1;for(let h=0;h<c.length;h++)u[d]===c[h]&&(p=!0);if(!p)return!0}return!1},s=function(c,u){if(r.length=0,u.length==0)return c;for(let d=0;d<c.length;d++){let p=!1;for(let h=0;h<u.length;h++)c[d]===u[h]&&(p=!0);p||r.push(c[d])}return r};this.setHighlighted=function(c){const u=[...e];i.resetHighlighted();const d=s(c,t),p=l(d);for(let h=0;h<p.length;h++)p[h]&&p[h].material&&p[h].material.emissive&&p[h].material.emissive.setRGB(...i.highlightColour);return e=d,o(e,u)},this.setSelected=function(c){const u=[...t];s(e,c),i.resetHighlighted(),i.resetSelected();const d=l(c);for(let p=0;p<d.length;p++)d[p]&&d[p].material&&d[p].material.emissive&&d[p].material.emissive.setRGB(...i.selectColour);return t=c,o(t,u)};const l=function(c){n.length=0;for(let u=0;u<c.length;u++)c[u].material&&n.push(c[u]);return n};this.resetHighlighted=function(){const c=l(e);for(let u=0;u<c.length;u++)c[u]&&c[u].material&&(c[u].material.emissive&&c[u].material.emissive.setRGB(...i.originalColour),c[u].material.depthFunc&&(c[u].material.depthFunc=Uv.THREE.LessEqualDepth));e=[]},this.resetSelected=function(){const c=l(t);for(let u=0;u<c.length;u++)c[u]&&c[u].material&&(c[u].material.emissive&&c[u].material.emissive.setRGB(...i.originalColour),c[u].material.depthFunc&&(c[u].material.depthFunc=Uv.THREE.LessEqualDepth));t=[]},this.getSelected=function(){return t},this.reset=function(){i.resetSelected(),i.resetHighlighted()}},cne=zB.THREE,T8r=function(){const e=document.createElement("div");let t;if(e.style.height="100%",ZVe.isWebGLAvailable())t=new zB.Renderer(e,window),zB.defaultMaterialColor=16777116,t.initialiseVisualisation(),t.playAnimation=!1;else{const r=ZVe.getWebGLErrorMessage();e.appendChild(r)}return{Zinc:zB,renderer:t,container:e}},ts=function(){D2.call(this),this.scene=void 0,this.rendererContainer=void 0,this.displayArea=void 0,this.graphicsHighlight=new y8r,this.zincRenderer=null,this.selectedScreenCoordinates=new cne.Vector3,this.selectedCenter=void 0,this.liveUpdatesObjects=void 0};ts.prototype=Object.create(D2.prototype),ts.prototype.getIntersectedObject=function(e){if(e){const t=e.map(n=>{if(n&&n.object&&n.object.userData){if(n.object.userData.isMarker)return 1;if(n.object.name&&n.object.userData.isZincObject)return 2}return 0});let r=t.indexOf(1);return r=r>-1?r:t.indexOf(2),e[r]}},ts.prototype.getAnnotationsFromObjects=function(e){const t=[];for(var r=0;r<e.length;r++){const n=e[r].userData;let i;if(n)if(n.isGlyph||n.isGlyphset){let o=n;n.isGlyph&&(o=n.getGlyphset()),i=o.userData?o.userData.annotation:void 0,i&&i.data&&(e[r].name&&e[r].name!=""?i.data.id=e[r].name:i.data.id=o.groupName)}else i=n.userData?n.userData.annotation:void 0,i&&i.data&&(i.data.id=e[r].name);i&&t.push(i)}return t},ts.prototype.setHighlightedByObjects=function(e,t,r){const n=this.graphicsHighlight.setHighlighted(e),i=this.objectsToZincObjects(e);if(r){let o=ak.MOVE;n&&(o=ak.HIGHLIGHTED);const s=this.getAnnotationsFromObjects(e);s.length>0&&(s[0].coords=t),this.publishChanges(s,o,i)}return n},ts.prototype.setHighlightedByZincObjects=function(e,t,r){let n=[];return e&&e.forEach(i=>{i&&i.morph&&n.push(i.morph)}),this.setHighlightedByObjects(n,t,r)},ts.prototype.setupLiveCoordinates=function(e){if(this.liveUpdatesObjects=e,e&&e.length>0){const t=this.scene.getBoundingBoxOfZincObjects(e);let r=new cne.Vector3;t.getCenter(r),this.selectedCenter==null?this.selectedCenter=r:this.selectedCenter.copy(r)}else this.selectedCenter=void 0},ts.prototype.objectsToZincObjects=function(e){const t=[];for(let r=0;r<e.length;r++){let n=e[r].userData;if(n)if(n.isGlyph||n.isGlyphset){let i=n;n.isGlyph&&(i=n.getGlyphset()),t.push(i)}else t.push(n)}return t},ts.prototype.setSelectedByObjects=function(e,t,r){const n=this.graphicsHighlight.setSelected(e);if(n){const i=this.objectsToZincObjects(e);if(this.setupLiveCoordinates(i),r){const o=ak.SELECTED,s=this.getAnnotationsFromObjects(e);s.length>0&&(s[0].coords=t),this.publishChanges(s,o,i)}}return n},ts.prototype.setSelectedByZincObjects=function(e,t,r){let n=[];return e&&e.forEach(i=>{i&&i.morph&&n.push(i.morph)}),this.setSelectedByObjects(n,t,r)};const v8r=function(e){return function(t){e.push(t.getMesh())}};ts.prototype.findObjectsByGroupName=function(e){const t=this.scene.findGeometriesWithGroupName(e),r=[];for(let i=0;i<t.length;i++)r.push(t[i].morph);const n=this.scene.findGlyphsetsWithGroupName(e);for(let i=0;i<n.length;i++)n[i].forEachGlyph(v8r(r));return r},ts.prototype.setHighlightedByGroupName=function(e,t){const r=this.findObjectsByGroupName(e);return this.setHighlightedByObjects(r,void 0,t)},ts.prototype.setSelectedByGroupName=function(e,t){const r=this.findObjectsByGroupName(e);return this.setSelectedByObjects(r,void 0,t)},ts.prototype.changeBackgroundColour=function(e){const t=new cne.Color(e);this.zincRenderer&&this.zincRenderer.getThreeJSRenderer().setClearColor(t,1)},ts.prototype.resetView=function(){this.zincRenderer&&this.zincRenderer.resetView()},ts.prototype.viewAll=function(){this.zincRenderer&&this.zincRenderer.viewAll()},ts.prototype.playAnimation=function(e){this.zincRenderer&&(this.zincRenderer.playAnimation=e)},ts.prototype.setPlayRate=function(e){this.zincRenderer&&this.zincRenderer.setPlayRate(e)},ts.prototype.getPlayRate=function(e){return this.zincRenderer?this.zincRenderer.getPlayRate():0},ts.prototype.initialiseRenderer=function(e){if(this.zincRenderer===void 0||this.rendererContainer===void 0){let t=T8r();this.Zinc=t.Zinc,this.zincRenderer=t.renderer,this.rendererContainer=t.container}e&&(this.displayArea=e,this.displayArea.appendChild(this.rendererContainer),this.zincRenderer&&this.zincRenderer.animate())},ts.prototype.destroy=function(){this.zincRenderer&&(this.zincRenderer.dispose(),this.zincRenderer.getThreeJSRenderer().dispose(),this.zincRenderer=void 0),D2.prototype.destroy.call(this)};const Q8r=function(){this.type="anatomical",this.data=void 0,this.isAnnotation=!0},b8r=function(){this.currentName="",this.currentSystem="",this.currentPart="",this.currentSpecies="",this.metaURL="",this.viewURL="",this.currentTime=0,this.timeVarying=!1},WVe=function(e){ts.call(this);const t=this;let r;this.sceneData=new b8r;const n=new Array,i=new Array,o=new Array;let s;const l=e;this.NDCCameraControl=void 0,t.typeName="Organ Viewer",this.currentTime=0,this.getSceneData=function(){return t.sceneData},this.updateTime=function(b){let L=6e3;t.scene&&(L=t.scene.getDuration());const w=b/100*L;t.sceneData.nerveMapIsActive||t.scene&&t.scene.setMorphsTime(w),t.sceneData.currentTime=b,t.currentTime=b};const c=function(){let b=3e3;t.scene&&(b=t.scene.getDuration());const L=t.zincRenderer.getCurrentTime();for(let w=0;w<n.length;w++)n[w](L);!t.sceneData.nerveMapIsActive&&r&&r.setMorphsTime(L),t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setTime(L/b),t.sceneData.currentTime=L/b*100,t.currentTime=L/b*100};this.getCurrentTime=function(){return t.sceneData.currentTime},this.toggleSyncControl=(b,L)=>{let w=this.scene.getZincCameraControls();b?(w.resetView(),this.NDCCameraControl=w.enableSyncControl(),w.setRotationMode(L)):(w.disableSyncControl(),this.NDCCameraControl=void 0,w.setRotationMode("free"))},this.isSyncControl=()=>this.NDCCameraControl!==void 0,this.setSyncControlZoomToBox=b=>{this.NDCCameraControl&&this.NDCCameraControl.zoomToBox(b,2)},this.setSyncControlCallback=b=>{this.NDCCameraControl&&this.NDCCameraControl.setEventCallback(b)},this.setSyncControlCenterZoom=(b,L)=>{this.NDCCameraControl&&this.NDCCameraControl.setCenterZoom(b,L)};const u=function(){if(t.zincRenderer.playAnimation&&t.liveUpdatesObjects&&t.setupLiveCoordinates(t.liveUpdatesObjects),t.selectedCenter){const b=new Uv.THREE.Vector3;b.copy(t.selectedCenter);const L=t.scene.vectorToScreenXY(b);t.selectedScreenCoordinates.x=L.x,t.selectedScreenCoordinates.y=L.y}},d=function(){return function(){c()}},p=function(){return function(){u()}};this.addTimeChangedCallback=function(b){n.push(b)},this.setTexturePos=function(b){t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setSliderPos(b)},this.addSceneChangedCallback=function(b){i.push(b)},this.addOrganPartAddedCallback=function(b){o.push(b)},this.setFinishDownloadCallback=function(b){s=b},this.unsetFinishDownloadCallback=function(){s=void 0},this.getNamedObjectsToScreenCoordinates=function(b,L){const w=new Uv.THREE.Vector3;w.setFromMatrixPosition(obj.matrixWorld);const k=width/2,C=height/2;return w.project(L),w.x=w.x*k+k,w.y=-(w.y*C)+C,w};const h=function(b){let L,w;if(b!==void 0){let k=!1;b.object.userData&&b.object.userData.isMarker?(k=!0,w=b.object.userData.parent.morph):w=b.object;try{w.userData.userData.annotation.data.lastActionOnMarker=k}finally{}if(w)if(w.name)L=w.name;else{const C=t.getAnnotationsFromObjects([w]);C&&C[0]&&(L=C[0].data.group)}}return{id:L,object:w}},f=function(){return function(b,L,w){const k=t.getIntersectedObject(b),C=h(k),A={x:L,y:w};if(C.id){C.object.userData.isGlyph?C.object.name?t.setSelectedByObjects([C.object],A,!0):t.setSelectedByZincObjects(C.object.userData.getGlyphset(),A,!0):t.setSelectedByObjects([C.object],A,!0);return}else t.setSelectedByObjects([],A,!0)}},m=function(){return function(b,L,w){const k=t.getIntersectedObject(b),C=h(k),A={x:L,y:w};if(C.id){t.displayArea.style.cursor="pointer",t.setHighlightedByObjects([C.object],A,!0);return}else t.displayArea.style.cursor="auto",t.setHighlightedByObjects([],A,!0)}},g=function(b,L,w,k){if(k=="all"||k=="geometries"){const C=b.findGeometriesWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="glyphsets"){const C=b.findGlyphsetsWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="pointsets"){const C=b.findPointsetsWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="lines"){const C=b.findLinesWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}};this.changeGeometriesVisibility=function(b,L){g(t.scene,b,L,"geometries")},this.changeGlyphsetsVisibility=function(b,L){g(t.scene,b,L,"glyphsets")},this.changeLinesVisibility=function(b,L){g(t.scene,b,L,"lines")},this.changePointsetsVisibility=function(b,L){g(t.scene,b,L,"pointsets")},this.changeOrganPartsVisibility=function(b,L,w){let k="all";w!==void 0&&(k=w),g(t.scene,b,L,k)},this.changeOrganPartsVisibilityCallback=function(b){return function(L){t.changeOrganPartsVisibility(b,L)}},this.changeBackgroundColour=function(b){const L=new Uv.THREE.Color(b);t.zincRenderer&&t.zincRenderer.getThreeJSRenderer().setClearColor(L,1)};const T=function(b,L,w,k){for(let O=0;O<o.length;O++)o[O](k,t.scene.isTimeVarying());w&&l.setGeometryColour(k,b,L);const C=new Q8r,A=k.region.getFullPath();C.data={species:t.sceneData.currentSpecies,system:b,part:L,group:k.groupName,region:A,uuid:k.uuid,lastActionOnMarker:!1},k.userData.annotation=C},y=function(b,L,w){return function(k){T(b,L,w,k)}},v=function(){return function(){t.settingsChanged(),t.sceneData.timeVarying=t.scene.isTimeVarying(),s&&s()}};this.updateFieldvisibility=function(b,L){for(let w=0;w<b.length;w++)if(L!=w){const k=b[w].PartName;t.changeOrganPartsVisibility(k,!1)}if(L>-1){const w=b[L].PartName;if(t.scene.findGeometriesWithGroupName(w).length>0||t.scene.findGlyphsetsWithGroupName(w).length>0)t.changeOrganPartsVisibility(w,!0);else{const k=getOrganDetails(b[L].SystemName,w);k!=null&&t.scene.loadMetadataURL(l.getOrgansDirectoryPrefix()+"/"+k.meta)}}},this.getAvailableSpecies=function(b,L,w){const k=new Array;k.push("none");const C=Object.keys(organsFileMap);for(index in C){const A=C[index];A!=b&&organsFileMap[A].hasOwnProperty(L)&&organsFileMap[A][L].hasOwnProperty(w)&&k.push(A)}return k};const _=function(b,L,w,k){t.sceneData.nerveMapIsActive=!1,t.sceneData.nerveMap=void 0,t.sceneData.metaURL="",t.sceneData.viewURL="",t.sceneData.currentSpecies=b,t.sceneData.currentSystem=L,t.sceneData.currentPart=w,t.sceneData.currentTime=0,t.sceneData.timeVarying=!1,t.currentTime=0;let C="";b&&(C=b+"/"),L&&(C=L+"/"),w&&(C=w),t.sceneData.currentName=C};this.loadOrgansFromURL=function(b,L,w,k,C,A){if(t.zincRenderer&&k&&t.sceneData.metaURL!==b){_(L,w,k);const O=t.sceneData.currentName;let N=t.zincRenderer.getSceneByName(O);N?A&&N.clearAll():N=t.zincRenderer.createScene(O);for(let B=0;B<i.length;B++)i[B](t.sceneData);C&&C!=""?(t.sceneData.viewURL=C,N.loadViewURL(t.sceneData.viewURL)):t.sceneData.viewURL=void 0,t.sceneData.metaURL=b,N.loadMetadataURL(b,y(w,k,!1),v()),t.scene=N,t.zincRenderer.setCurrentScene(N),t.graphicsHighlight.reset();const I=N.getZincCameraControls();I.enableRaycaster(N,f(),m()),I.setMouseButtonAction("AUXILIARY","ZOOM"),I.setMouseButtonAction("SECONDARY","PAN")}},this.loadGLTFFromURL=function(b,L,w){if(t.zincRenderer&&L&&t.sceneData.metaURL!==b){_(void 0,void 0,L);const k=t.sceneData.currentName;let C=t.zincRenderer.getSceneByName(k);C?w&&C.clearAll():C=t.zincRenderer.createScene(k);for(let O=0;O<i.length;O++)i[O](t.sceneData);t.sceneData.viewURL=void 0,t.sceneData.metaURL=b,C.loadGLTF(b,y(void 0,L,!1),v()),t.scene=C,t.zincRenderer.setCurrentScene(C),t.graphicsHighlight.reset();const A=C.getZincCameraControls();A.enableRaycaster(C,f(),m()),A.setMouseButtonAction("AUXILIARY","ZOOM"),A.setMouseButtonAction("SECONDARY","PAN")}},this.alignCameraWithSelectedObject=function(b){const L=t.graphicsHighlight.getSelected();L&&L[0]&&L[0].userData&&t.scene.alignObjectToCameraView(L[0].userData,b)},this.exportSettings=function(){const b={};return b.name=t.instanceName,t.sceneData.currentSystem&&(b.system=t.sceneData.currentSystem),t.sceneData.currentSpecies&&(b.species=t.sceneData.currentSpecies),t.sceneData.currentPart&&(b.part=t.sceneData.currentPart),b.metaURL=t.sceneData.metaURL,t.sceneData.viewURL&&(b.viewURL=t.sceneData.viewURL),b.dialog="Organ Viewer",b},this.importSettings=function(b){return b&&b.dialog==this.typeName?(t.setName(b.name),b.metaURL!==void 0&&b.metaURL!=""?t.loadOrgansFromURL(b.metaURL,b.species,b.system,b.part,b.viewURL,!0):t.loadOrgans(b.species,b.system,b.part),!0):!1},function(){t.initialiseRenderer(void 0),t.zincRenderer&&(t.zincRenderer.addPreRenderCallbackFunction(d()),t.zincRenderer.addPostRenderCallbackFunction(p()))}()};WVe.prototype=Object.create(ts.prototype);const x8r={name:"ScaffoldVuer",components:{Button:YN,Col:oS,Loading:ZCe,Option:kee,Popover:aR,Row:WT,Select:See,Slider:XT,TabPane:DCe,Tabs:BCe,MapSvgIcon:Wb,MapSvgSpriteColor:BC,PrimitiveControls:JCe,ScaffoldTooltip:rEe,TreeControls:tEe,ElIconWarningFilled:Xke,ElIconArrowDown:ON,ElIconArrowLeft:HN},props:{url:{type:String,default:""},showColourPicker:{type:Boolean,default:!1},displayUI:{type:Boolean,default:!0},displayAtStartUp:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!0},warningMessage:{type:String,default:"Beta feature - under active development"},displayLatestChanges:{type:Boolean,default:!1},latestChangesMessage:{type:String,default:"New feature - Local search is now available"},displayMarkers:{type:Boolean,default:!1},markerLabels:{type:Array,default:function(){return[]}},displayMinimap:{type:Boolean,default:!1},format:{type:String,default:"metadata"},minimapSettings:{type:Object,default:function(){return{x_offset:16,y_offset:16,width:128,height:128,align:"top-right"}}},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},state:{type:Object,default:void 0},region:{type:String,default:""},viewURL:{type:String,default:""},render:{type:Boolean,default:!0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"}},provide(){return{flatmapAPI:this.flatmapAPI,scaffoldUrl:this.url}},data:function(){return{currentTime:0,timeVarying:void 0,isPlaying:!1,isReady:!1,isTransitioning:!1,tooltipAppendToBody:!1,hoverVisibilities:[{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1}],inHelp:!1,loading:!1,duration:3e3,drawerOpen:!0,currentBackground:"white",availableBackground:["white","lightskyblue","black"],minimisedSlider:!1,sliderPosition:"",timeMax:100,orginalDuration:"",animateDuration:"6secs",playSpeed:[{value:.1,label:"0.1x"},{value:.5,label:"0.5x"},{value:1,label:"1x"},{value:2,label:"2x"},{value:5,label:"5x"},{value:10,label:"10x"}],currentSpeed:1,timeStamps:{},defaultCheckedKeys:[],tData:{label:"",region:"",visible:!1,x:200,y:200,active:!1},fileFormat:"metadata",previousMarkerLabels:[],viewingMode:"Exploration",viewingModes:["Annotation","Exploration"],openMapRef:void 0,backgroundIconRef:void 0}},watch:{format:{handler:function(e){this.fileFormat=e},immediate:!0},url:{handler:function(e){(this.state===void 0||this.state.url===void 0)&&this.setURL(e)},immediate:!0},region:{handler:function(e){this.state||this.viewURL||this.setFocusedRegion(e)},immediate:!0},state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},viewURL:{handler:function(e){this.updateViewURL(e)},immediate:!0},helpMode:function(e){this.setHelpMode(e)},displayMarkers:function(e){this.$module.scene.displayMarkers=e,this.$module.scene.forcePickableObjectsUpdate=!0},displayMinimap:function(e){this.$module.scene.displayMinimap=e},currentTime:{handler:function(){this.$emit("timeChanged",this.currentTime)}},duration:function(){this.$module.scene.setDuration(this.duration)},minimapSettings:{deep:!0,handler:"updateMinimapScissor"},render:function(e){this.toggleRendering(e)},markerLabels:function(e){this.previousMarkerLabels.forEach(t=>{this.setMarkerModeForObjectsWithName(t,"off")}),e.forEach(t=>{this.setMarkerModeForObjectsWithName(t,"on")}),this.previousMarkerLabels=e}},beforeCreate:function(){this.$module=new WVe,this.selectedObjects=[],this.hoveredObjects=[],this.currentBackground="white",this._currentURL=void 0,this.availableBackground=["white","black","lightskyblue"],this.$_searchIndex=new t3r},created:function(){this.timeVarying=a.toRef(this.$module.sceneData,"timeVarying")},mounted:function(){this.openMapRef=a.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=a.shallowRef(this.$refs.backgroundIconRef),this.$refs.treeControls.setModule(this.$module);let e=new g8r;e.subscribe(this,this.eventNotifierCallback),this.$module.addNotifier(e),this.$module.addOrganPartAddedCallback(this.zincObjectAdded),this.$module.initialiseRenderer(this.$refs.display),this.toggleRendering(this.render),this.ro=new ResizeObserver(this.adjustLayout).observe(this.$refs.scaffoldContainer),this.defaultRate=this.$module.getPlayRate(),this.$module.zincRenderer.addPreRenderCallbackFunction(()=>{this.currentTime=this.$module.getCurrentTime()})},beforeDestroy:function(){this.ro&&this.ro.disconnect(),this.$module.destroy(),this.$module=void 0},methods:{addZincObject:function(e){this.$module.scene&&(this.$module.scene.addZincObject(e),this.zincObjectAdded(e),this.$refs.treeControls&&this.$refs.treeControls.zincObjectAdded(e))},zincObjectAdded:function(e){this.loading=!1,this.$_searchIndex.addZincObject(e,e.uuid),this.$emit("zinc-object-added",e)},addRegionsToSearchIndex:function(){this.$module.scene.getRootRegion().getChildRegions(!0).forEach(e=>{this.$_searchIndex.addRegion(e,e.uuid)})},backgroundChangeCallback:function(e){this.currentBackground=e,this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground,1)},captureScreenshotCallback:function(){this.$module.zincRenderer.removePostRenderCallbackFunction(this.captureID);let e=this.$module.zincRenderer.getThreeJSRenderer().domElement.toDataURL("image/png"),t=document.createElement("a");document.body.append(t),this.captureFilename?t.download=this.captureFilename:t.download="screenshot.png",t.href=e,t.click(),t.remove()},captureScreenshot:function(e){this.captureFilename=e,this.captureID=this.$module.zincRenderer.addPostRenderCallbackFunction(this.captureScreenshotCallback)},clearScene:function(){this.$refs.treeControls&&this.$refs.treeControls.clear(),this.$_searchIndex&&this.$_searchIndex.removeAll(),this.$module.scene&&this.$module.scene.clearAll()},formatTooltip(e){if(this.timeMax>=1e3&&e){let t=(e%6e4/1e3).toFixed(2)+"s";return(e>6e4?(e/6e4).toFixed(0)+"m ":"")+t}return e?e.toFixed(2)+" ms":"0 ms"},fitWindow:function(){this.$module.scene&&this.$module.scene.viewAll()},zoomIn:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(-1)},zoomOut:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(1)},speedChanged:function(e){this.currentSpeed=e,this.$module.setPlayRate(this.defaultRate*this.currentSpeed)},stopFreeSpin:function(){this.$module.scene.getZincCameraControls().stopAutoTumble(),this.isTransitioning=!1},findObjectsWithGroupName:function(e){let t=[];return e&&e!=""&&this.$module.scene&&(t=this.$module.scene.findObjectsWithGroupName(e)),t},viewRegion:function(e){const t=this.$module.scene.getRootRegion(),r=Array.isArray(e)?e:[e],n=$T(t,r,"",!0);let i=this.$module.scene.getBoundingBoxOfZincObjects(n);if(i){if(this.$module.isSyncControl())this.$module.setSyncControlZoomToBox(i);else{const o=this.$module.scene.camera.far-this.$module.scene.camera.near;this.$module.scene.viewAllWithBoundingBox(i),this.$module.scene.camera.far=this.$module.scene.camera.near+o,this.$module.scene.camera.updateProjectionMatrix()}return!0}return!1},setFocusedRegion:function(e){e&&(this.isReady?this.viewRegion(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({region:e})))},updateViewURL:function(e){if(e)if(this.isReady){const t=new URL(e,this.url);this.$module.scene.loadViewURL(t)}else this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewURL:e}))},getRendererInfo:function(){if(this.$module.zincRenderer)return this.$module.zincRenderer.getThreeJSRenderer().info},freeSpin:function(){if(this.$module.scene){let e=this.$module.scene.getZincCameraControls();this.isTransitioning=!0,e.enableAutoTumble(),e.autoTumble([1,0],Math.PI,!0),setTimeout(this.stopFreeSpin,4e3)}},eventNotifierCallback:function(e){const t=[];let r=[];if((e.eventType==1||e.eventType==2)&&(e.identifiers.forEach(n=>{if(n){let i=n.data.id?n.data.id:n.data.group;t.push(i)}}),r=e.zincObjects),e.eventType==1)this.$refs.treeControls&&(t.length>0?this.$refs.treeControls.updateActiveUI(r):(this.hideRegionTooltip(),this.$refs.treeControls.removeActive(!0))),this.viewingMode==="Annotation"&&this.showRegionTooltipWithAnnotations(e.identifiers,!0,!0),this.$emit("scaffold-selected",e.identifiers);else if(e.eventType==2){if(this.selectedObjects.length===0){if(this.hideRegionTooltip(),this.$refs.treeControls&&(t.length>0?this.$refs.treeControls.updateHoverUI(r):this.$refs.treeControls.removeHover(!0)),e.identifiers.length>0&&e.identifiers[0]){let n=e.identifiers[0].data.id?e.identifiers[0].data.id:e.identifiers[0].data.group;e.identifiers[0].coords&&(this.tData.active=!1,this.tData.visible=!0,this.tData.label=n,e.identifiers[0].data.region?this.tData.region=e.identifiers[0].data.region:this.tData.region=void 0,this.tData.x=e.identifiers[0].coords.x,this.tData.y=e.identifiers[0].coords.y)}this.$emit("scaffold-highlighted",e.identifiers)}}else if(e.eventType==3&&e.identifiers.length>0&&e.identifiers[0]&&e.identifiers[0].coords){const n=this.$refs.scaffoldContainer.getBoundingClientRect();this.tData.x=e.identifiers[0].coords.x-n.left,this.tData.y=e.identifiers[0].coords.y-n.top}},getCoordinatesOfSelected:function(){if(this.selectedObjects&&this.selectedObjects.length>0)return this.$module.scene.getObjectsScreenXY(this.selectedObjects)},getDynamicSelectedCoordinates:function(){return this.$module.selectedScreenCoordinates},timeChange:function(e){let t=e/this.timeMax*100;t!=this.currentTime&&(this.$module.updateTime(t),console.log(this.currentTime))},objectSelected:function(e,t){this.selectedObjects=e,this.selectedObjects&&this.selectedObjects.length>0&&this.$refs.primitiveControls.setObject(this.selectedObjects[0]),this.$module.setSelectedByZincObjects(e,void 0,t)},objectHovered:function(e,t){this.hoveredObjects=e,this.$module.setHighlightedByZincObjects(e,void 0,t)},changeActiveByName:function(e,t,r){const n=Array.isArray(e);if(e===void 0||n&&e.length===0)this.$refs.treeControls.removeActive(r);else{let i=e;n||(i=[i]),this.$refs.treeControls.changeActiveByNames(i,t,r)}},changeHighlightedByName:function(e,t,r){const n=Array.isArray(e);if(e===void 0||n&&e.length===0)this.$refs.treeControls.removeHover(r);else{let i=e;n||(i=[i]),this.$refs.treeControls.changeHoverByNames(i,t,r)}},play:function(e){this.$module.playAnimation(e),this.isPlaying=e},setHelpMode:function(e){e?(this.inHelp=!0,this.hoverVisibilities.forEach(t=>{t.value=!0})):(this.inHelp=!1,this.hoverVisibilities.forEach(t=>{t.value=!1}))},displayTooltipOfObjectsCallback:function(e,t,r,n,i){const o=this;return function(){o.$module.zincRenderer.removePostRenderCallbackFunction(o.$_regionTooltipCallback),o.$_regionTooltipCallback=void 0,o.displayTooltipOfObjects(e,t,r,n,i)}},liveUpdateTooltipPosition:function(){this.$module.selectedCenter&&(this.tData.x=this.$module.selectedScreenCoordinates.x,this.tData.y=this.$module.selectedScreenCoordinates.y)},displayTooltipOfObjects:function(e,t,r,n,i){if(t.length>0){let o=t[0].getClosestVertexDOMElementCoords(this.$module.scene);if(o)return o.inView?(e.includes("Search Results for")?this.tData.active=!1:this.tData.active=!0,this.tData.visible=!0,this.tData.label=e,this.tData.x=o.position.x,this.tData.y=o.position.y,this.tData.region=r,this.$_liveCoordinatesUpdated&&this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),i&&(this.$module.setupLiveCoordinates(t),this.$_liveCoordinatesUpdated=this.$module.zincRenderer.addPostRenderCallbackFunction(this.liveUpdateTooltipPosition))):(this.hideRegionTooltip(),n&&(this.$module.scene.viewAll(),this.$_regionTooltipCallback&&this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_regionTooltipCallback),this.$_regionTooltipCallback=this.$module.zincRenderer.addPostRenderCallbackFunction(this.displayTooltipOfObjectsCallback(e,t,r,n,i)))),!0}return this.hideRegionTooltip(),!1},showRegionTooltipWithObjects:function(e,t,r,n,i){return e&&t&&t.length>0&&this.$module.scene?this.displayTooltipOfObjects(e,t,r,n,i):(this.hideRegionTooltip(),!1)},showRegionTooltip:function(e,t,r){if(e&&this.$module.scene){const n=this.$module.scene.getRootRegion(),i=$T(n,[e],"",!0);let o;return i&&i.length>0&&(o=i[0].getRegion().getFullPath()),this.showRegionTooltipWithObjects(e,i,o,t,r)}return this.hideRegionTooltip(),!1},showRegionTooltipWithAnnotations:function(e,t,r){if(this.$module.scene){const n=eEe(this.$module.scene,e);if(n&&n.objects.length>0)return this.showRegionTooltipWithObjects(n.label,n.objects,n.regionPath,t,r)}return this.hideRegionTooltip(),!1},hideRegionTooltip:function(){this.$_liveCoordinatesUpdated&&(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),this.$module.setupLiveCoordinates(void 0)),this.tData.active=!1,this.tData.visible=!1,this.tData.region=void 0},setMarkerModeForObjectsWithName:function(e,t){if(e&&this.$module.scene){const r=this.$module.scene.getRootRegion();$T(r,[e],"",!0).forEach(n=>n.setMarkerMode(t))}},setMarkerModeWithAnnotations:function(e,t){if(this.$module.scene){const r=eEe(this.$module.scene,e);r&&r.objects.length>0&&r.objects.forEach(n=>n.setMarkerMode(t))}},showHelpText:function(e){this.inHelp||(this.helpTextWait=setTimeout(()=>{this.hoverVisibilities[e].value=!0},500))},hideHelpText:function(e){this.inHelp||(this.hoverVisibilities[e].value=!1,clearTimeout(this.helpTextWait))},search:function(e,t){if(this.$_searchIndex){if(e===void 0||e===""||Array.isArray(e)&&e.length===0)return this.objectSelected([],!0),!1;{const r=this.$_searchIndex.searchAndProcessResult(e),n=r.zincObjects;if(n.length>0){if(this.objectSelected(n,!0),t)for(let i=0;i<n.length;i++)n[i]&&n[i].groupName&&this.showRegionTooltipWithObjects(r.label,n,r.regionPath,!0,!0);return!0}else this.objectSelected([],!0)}}return!1},fetchSuggestions:function(e){return this.$_searchIndex===void 0?[]:this.$_searchIndex.auto_suggest(e)},updateMinimapScissor:function(){Object.keys(this.minimapSettings).forEach(e=>{this.$module.scene.minimapScissor[e]=this.minimapSettings[e]}),this.$module.scene.minimapScissor.updateRequired=!0},updateSettingsfromScene:function(){this.currentSpeed=1,this.$module.setPlayRate(this.defaultRate),this.orginalDuration=this.$module.scene.getMetadataTag("OriginalDuration"),this.animateDuration=this.$module.scene.getMetadataTag("Duration");let e=this.$module.scene.getMetadataTag("TimeStamps");this.timeStamps={};for(const t in e)this.timeStamps[e[t]]=t;this.timeMax=this.$module.scene.getDuration()},setURLFinishCallback:function(e){return()=>{if(e){if(e.viewport)this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport);else if(e.viewURL&&e.viewURL!==""){const t=new URL(e.viewURL,this.url);this.$module.scene.loadViewURL(t)}else e.region&&e.region!==""&&this.viewRegion(e.region);e.visibility&&this.$nextTick(()=>{this.$refs.treeControls.setState(e.visibility)})}this.updateSettingsfromScene(),this.$module.updateTime(.01),this.$module.updateTime(0),this.$module.unsetFinishDownloadCallback(),this.addRegionsToSearchIndex(),this.$emit("on-ready"),this.setMarkers(),this.isReady=!0}},getState:function(){let e={format:this.fileFormat,url:this._currentURL,viewport:void 0,visibility:void 0};if(this.$refs.treeControls&&(e.visibility=this.$refs.treeControls.getState()),this.$module.scene){let t=this.$module.scene.getZincCameraControls();e.viewport=t.getCurrentViewport()}return e},setState:function(e){e&&(e.url&&e.url!==this._currentURL?this.setURLAndState(e.url,{fileFormat:e.fileFormat,viewport:e.viewport,visibility:e.visibility}):(e.viewport||e.visibility)&&(this.isReady&&this.$module.scene?(e.viewport&&this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport),e.visibility&&this.$refs.treeControls.setState(e.visibility)):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewport:e.viewport,visibility:e.visibility}))))},exportGLTF:function(e){return this.$module.scene.exportGLTF(e)},setURLAndState:function(e,t){if(e!=this._currentURL){t&&t.format&&(this.fileFormat=t.format);let r=t&&t.viewport?t.viewport:void 0,n=t&&t.visibility?t.visibility:void 0;this._currentURL=e,this.$refs.treeControls&&this.$refs.treeControls.clear(),this.loading=!0,this.isReady=!1,this.$_searchIndex.removeAll(),this.hideRegionTooltip(),this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewport:r,region:this.region,viewURL:this.viewURL,visibility:n})),this.fileFormat==="gltf"?this.$module.loadGLTFFromURL(e,"scene",!0):this.$module.loadOrgansFromURL(e,void 0,void 0,"scene",void 0,!0),this.$module&&this.$module.scene&&(this.$module.scene.displayMarkers=this.displayMarkers,this.$module.scene.forcePickableObjectsUpdate=!0,this.$module.scene.displayMinimap=this.displayMinimap,this.updateMinimapScissor())}},setURL:function(e){this.setURLAndState(e,void 0)},drawerToggled:function(e){this.drawerOpen=e,this.adjustLayout()},adjustLayout:function(){let e=this.$refs.scaffoldContainer.clientWidth;this.minimisedSlider=e<812,this.minimisedSlider?this.sliderPosition=this.drawerOpen?"right":"left":this.sliderPosition=""},toggleRendering:function(e){this.$module.zincRenderer&&(e?this.$module.zincRenderer.animate():this.$module.zincRenderer.stopAnimate())},forceResize:function(){this.$module.zincRenderer&&this.$module.zincRenderer.onWindowResize()},syncControlCallback:function(){const e=this.$module.NDCCameraControl.getPanZoom();this.tData.visible&&this.showRegionTooltip(this.tData.label,!0,!0),this.$emit("scaffold-navigated",e)},toggleSyncControl:function(e,t){this.$module.toggleSyncControl(e,t),this.$module.setSyncControlCallback(this.syncControlCallback)},setMarkers:function(){this.markerLabels.forEach(e=>{this.setMarkerModeForObjectsWithName(e,"on")})}}},une=e=>(a.pushScopeId("data-v-69979745"),e=e(),a.popScopeId(),e),_8r={ref:"scaffoldContainer",class:"scaffold-container","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},w8r=une(()=>a.createElementVNode("span",{class:"message-text"},"Beta",-1)),L8r=une(()=>a.createElementVNode("span",{class:"message-text"},"What's new?",-1)),S8r={class:"primitive-controls-box"},k8r={class:"animation-data"},M8r={class:"purple"},C8r={class:"animation-data"},E8r={class:"purple"},A8r={class:"animation-data"},O8r={class:"bottom-right-control"},H8r=une(()=>a.createElementVNode("div",null,[a.createTextVNode(" Fit to "),a.createElementVNode("br"),a.createTextVNode(" window ")],-1)),V8r=["onClick"];function I8r(e,t,r,n,i,o){const s=a.resolveComponent("map-svg-sprite-color"),l=rEe,c=Xke,u=ja,d=aR,p=tEe,h=JCe,f=a.resolveComponent("map-svg-icon"),m=XT,g=WT,T=DCe,y=kee,v=See,_=BCe,b=YN,L=oS,w=hR;return a.withDirectives((a.openBlock(),a.createElementBlock("div",_8r,[a.createVNode(s),a.createVNode(l,{label:e.tData.label,region:e.tData.region,visible:e.tData.visible,x:e.tData.x,y:e.tData.y,annotationDisplay:e.viewingMode==="Annotation"&&e.tData.active===!0},null,8,["label","region","visible","x","y","annotationDisplay"]),a.createElementVNode("div",{id:"organsDisplayArea",ref:"display",tabindex:"-1",style:{height:"100%",width:"100%"},onKeydown:t[0]||(t[0]=a.withKeys((...k)=>o.backgroundChangeCallback&&o.backgroundChangeCallback(...k),["66"]))},null,544),a.withDirectives(a.createElementVNode("div",null,[r.displayWarning?(a.openBlock(),a.createBlock(d,{key:0,ref:"warningPopover",visible:e.hoverVisibilities[6].value,content:r.warningMessage,placement:"right",teleported:!1,"popper-class":"scaffold-popper message-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.displayWarning?(a.openBlock(),a.createElementBlock("div",{key:0,class:"message-icon warning-icon",onMouseover:t[1]||(t[1]=k=>o.showHelpText(6)),onMouseout:t[2]||(t[2]=k=>o.hideHelpText(6))},[a.createVNode(u,null,{default:a.withCtx(()=>[a.createVNode(c)]),_:1}),w8r],32)):a.createCommentVNode("",!0)]),_:1},8,["visible","content"])):a.createCommentVNode("",!0),r.displayLatestChanges?(a.openBlock(),a.createBlock(d,{key:1,visible:e.hoverVisibilities[7].value,content:r.latestChangesMessage,placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper message-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.displayLatestChanges&&r.latestChangesMessage?(a.openBlock(),a.createElementBlock("div",{key:0,class:"el-icon-warning message-icon latest-changesicon",onMouseover:t[3]||(t[3]=k=>o.showHelpText(7)),onMouseout:t[4]||(t[4]=k=>o.hideHelpText(7))},[a.createVNode(u,null,{default:a.withCtx(()=>[a.createVNode(c)]),_:1}),L8r],32)):a.createCommentVNode("",!0)]),_:1},8,["visible","content"])):a.createCommentVNode("",!0),a.createVNode(d,{visible:e.hoverVisibilities[5].value,content:"Change region visibility",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(p,{ref:"treeControls","help-mode":r.helpMode,isReady:e.isReady,"show-colour-picker":r.showColourPicker,onObjectSelected:o.objectSelected,onObjectHovered:o.objectHovered,onDrawerToggled:o.drawerToggled},null,8,["help-mode","isReady","show-colour-picker","onObjectSelected","onObjectHovered","onDrawerToggled"])]),_:1},8,["visible"]),a.createElementVNode("div",S8r,[a.createVNode(h,{ref:"primitiveControls"},null,512)]),e.timeVarying?(a.openBlock(),a.createBlock(d,{key:2,ref:"sliderPopover",visible:e.hoverVisibilities[4].value,content:"Move the slider to animate the region",placement:"top",teleported:!1,trigger:"manual","popper-class":"scaffold-popper top-popper non-selectable"},{reference:a.withCtx(()=>[e.timeVarying?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["time-slider-container",[e.minimisedSlider?"minimised":"",e.sliderPosition]])},[a.createVNode(_,{type:"card"},{default:a.withCtx(()=>[a.createVNode(T,{label:"Animate scaffold"},{default:a.withCtx(()=>[a.createVNode(g,{class:"tab-content"},{default:a.withCtx(()=>[e.isPlaying?(a.openBlock(),a.createBlock(f,{key:0,icon:"pause",class:"icon-button video-button",onClick:t[5]||(t[5]=k=>o.play(!1))})):(a.openBlock(),a.createBlock(f,{key:1,icon:"play",class:"video-button icon-button",onClick:t[6]||(t[6]=k=>o.play(!0))})),a.createVNode(m,{min:0,max:e.timeMax,"model-value":e.currentTime/100*e.timeMax,step:.1,"tooltip-class":"time-slider-tooltip",class:"slider","format-tooltip":o.formatTooltip,marks:e.timeStamps,onInput:t[7]||(t[7]=k=>o.timeChange(k))},null,8,["max","model-value","format-tooltip","marks"])]),_:1})]),_:1}),a.createVNode(T,{label:"Animation data"},{default:a.withCtx(()=>[a.createVNode(g,{class:"tab-content"},{default:a.withCtx(()=>[a.createElementVNode("div",k8r,[a.createTextVNode(" Original duration: "),a.createElementVNode("div",M8r,a.toDisplayString(e.orginalDuration),1)]),a.createElementVNode("div",C8r,[a.createTextVNode(" Animation duration: "),a.createElementVNode("div",E8r,a.toDisplayString(e.animateDuration),1)]),a.createElementVNode("div",A8r,[a.createTextVNode(" Playback speed "),a.createVNode(v,{teleported:!0,"model-value":e.currentSpeed,placeholder:"Select",class:"select-box","popper-class":"scaffold_viewer_dropdown",onChange:t[8]||(t[8]=k=>o.speedChanged(k))},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.playSpeed,k=>(a.openBlock(),a.createBlock(y,{key:k.value,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["model-value"])])]),_:1})]),_:1})]),_:1})],2)):a.createCommentVNode("",!0)]),_:1},8,["visible"])):a.createCommentVNode("",!0),a.createElementVNode("div",O8r,[a.createVNode(d,{visible:e.hoverVisibilities[0].value,content:"Zoom in",placement:"left",teleported:!1,trigger:"manual","popper-class":"scaffold-popper left-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"zoomIn",class:"icon-button zoomIn",onClick:t[9]||(t[9]=k=>o.zoomIn()),onMouseover:t[10]||(t[10]=k=>o.showHelpText(0)),onMouseout:t[11]||(t[11]=k=>o.hideHelpText(0))})]),_:1},8,["visible"]),a.createVNode(d,{visible:e.hoverVisibilities[1].value,content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual","popper-class":"scaffold-popper popper-zoomout non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"zoomOut",class:"icon-button zoomOut",onClick:t[12]||(t[12]=k=>o.zoomOut()),onMouseover:t[13]||(t[13]=k=>o.showHelpText(1)),onMouseout:t[14]||(t[14]=k=>o.hideHelpText(1))})]),_:1},8,["visible"]),a.createVNode(d,{visible:e.hoverVisibilities[2].value,placement:"top",teleported:!1,trigger:"manual","popper-class":"scaffold-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"fitWindow",class:"icon-button fitWindow",onClick:t[15]||(t[15]=k=>o.fitWindow()),onMouseover:t[16]||(t[16]=k=>o.showHelpText(2)),onMouseout:t[17]||(t[17]=k=>o.hideHelpText(2))})]),default:a.withCtx(()=>[H8r]),_:1},8,["visible"])]),e.openMapRef?(a.openBlock(),a.createBlock(d,{key:3,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"128",teleported:!1,trigger:"click","popper-class":"open-map-popper","virtual-triggering":""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.openMapOptions,k=>(a.openBlock(),a.createBlock(g,{key:k.key},{default:a.withCtx(()=>[a.createVNode(b,{type:"primary",plain:"",onClick:C=>e.$emit("open-map",k.key)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(k.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):a.createCommentVNode("",!0),a.createVNode(d,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"128",teleported:!1,trigger:"click","popper-class":"background-popper non-selectable","virtual-triggering":""},{default:a.withCtx(()=>[a.createElementVNode("div",null,[a.createVNode(g,{class:"backgroundText"},{default:a.withCtx(()=>[a.createTextVNode("Viewing Mode")]),_:1}),a.createVNode(g,{class:"backgroundControl"},{default:a.withCtx(()=>[a.createVNode(v,{teleported:!1,modelValue:e.viewingMode,"onUpdate:modelValue":t[18]||(t[18]=k=>e.viewingMode=k),placeholder:"Select",class:"select-box viewing-mode","popper-class":"scaffold_viewer_dropdown"},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.viewingModes,k=>(a.openBlock(),a.createBlock(y,{key:k,label:k,value:k},{default:a.withCtx(()=>[a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(L,{span:12},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(k),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a.createVNode(g,{class:"backgroundSpacer"}),a.createVNode(g,{class:"backgroundText"},{default:a.withCtx(()=>[a.createTextVNode(" Change background ")]),_:1}),a.createVNode(g,{class:"backgroundChooser"},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.availableBackground,k=>(a.openBlock(),a.createElementBlock("div",{key:k,class:a.normalizeClass(["backgroundChoice",k,k==e.currentBackground?"active":""]),onClick:C=>o.backgroundChangeCallback(k)},null,10,V8r))),128))]),_:1})])]),_:1},8,["virtual-ref"]),a.createElementVNode("div",{class:a.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(d,{visible:e.hoverVisibilities[8].value,content:"Open new map",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.enableOpenMapUI&&r.openMapOptions.length>0?(a.openBlock(),a.createBlock(f,{key:0,ref:"openMapRef",icon:"openMap",class:"icon-button open-map-button",onMouseover:t[19]||(t[19]=k=>o.showHelpText(8)),onMouseout:t[20]||(t[20]=k=>o.hideHelpText(8))},null,512)):a.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1}),a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(d,{visible:e.hoverVisibilities[3].value,content:"Change background color",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{ref:"backgroundIconRef",icon:"changeBckgd",class:"icon-button",onMouseover:t[21]||(t[21]=k=>o.showHelpText(3)),onMouseout:t[22]||(t[22]=k=>o.hideHelpText(3))},null,512)]),_:1},8,["visible"])]),_:1})],2)],512),[[a.vShow,r.displayUI&&!e.isTransitioning]])])),[[w,e.loading]])}const P8r={name:"Scaffold",mixins:[ay],components:{ScaffoldVuer:YT(x8r,[["render",I8r],["__scopeId","data-v-69979745"]])},methods:{onResize:function(){this.scaffoldCamera.onResize()},getState:function(){return this.$refs.scaffold.getState()},search:function(e){const t=e.replace(/(^"|"$)/g,"");return this.$refs.scaffold.search(t,!0)},searchSuggestions:function(e,t){if(e===""||!this.$refs.scaffold)return t;this.$refs.scaffold.fetchSuggestions(e).forEach(n=>{n.suggestion&&t.push(n.suggestion)})},handleSyncPanZoomEvent:function(e){if(!this.mouseHovered&&e.type!==this.entry.type){const t=e.payload.origin,r=e.payload.size,n=[t[0]+r[0]/2,t[1]+r[1]/2],i=[(n[0]-.5)*2,(.5-n[1])*2],o=1/Math.max(r[0],r[1]);this.$refs.scaffold.$module.setSyncControlCenterZoom(i,o)}},displayTooltip:function(e){let t;e&&(t=e.name),t?this.$refs.scaffold.search(t,!0):this.$refs.scaffold.hideRegionTooltip()},zoomToFeatures:function(e,t){let r;Array.isArray(e)?r=e:r=[e.name],t&&this.$refs.scaffold.changeActiveByName(r,"",!1),this.$refs.scaffold.viewRegion(r)},highlightFeatures:function(e){let t;Array.isArray(e)?t=e:t=[e.name],this.$refs.scaffold.changeHighlightedByName(t,"",!1)},scaffoldIsReady:function(){if(this.scaffoldLoaded=!0,this.$refs.scaffold.$module.graphicsHighlight.highlightColour=[1,0,1],this.isVisible()){let e="free";this.entry.rotation&&(e=this.entry.rotation),this.$refs.scaffold.toggleSyncControl(this.splitFlowStore.globalCallback,e),this.splitFlowStore.syncMode&&this.$refs.scaffold.fitWindow()}},requestSynchronisedEvent:function(e){if(this.scaffoldLoaded){let t="free";this.entry.rotation&&(t=this.entry.rotation),this.$refs.scaffold.toggleSyncControl(e,t)}},scaffoldHighlighted:function(e,t){const r={paneIndex:this.entry.id,type:e,resource:t,internalName:void 0};t&&t[0]&&(r.internalName=t[0].data.id,r.eventType="highlighted"),this.$emit("resource-selected",r)},scaffoldNavigated:function(e,t){if(this.mouseHovered){const r={paneIndex:this.entry.id,eventType:"panZoom",payload:t,type:e};this.$emit("resource-selected",r)}},updateWithViewUrl:function(e){this.$refs.scaffold.updateViewURL(e)}},computed:{warningMessage:function(){return this.entry.isBodyScaffold?"This map displays the anatomical location and connectivity of nerves, through which the neuron populations from the ApiNATOMY models available in SCKAN can be routed.":"Under active development"},markerLabels:function(){return this.settingsStore.facetLabels}},data:function(){return{apiLocation:process.env.VUE_APP_API_LOCATION,scaffoldCamera:void 0,scaffoldLoaded:!1}},mounted:function(){this.scaffoldCamera=this.$refs.scaffold.$module.scene.getZincCameraControls(),Xo.on("startHelp",()=>{this.startHelp()})}};function N8r(e,t,r,n,i,o){const s=a.resolveComponent("ScaffoldVuer");return a.openBlock(),a.createBlock(s,{state:e.entry.state,url:e.entry.resource,region:e.entry.region,onScaffoldSelected:t[0]||(t[0]=l=>e.resourceSelected(e.entry.type,l,!0)),onScaffoldHighlighted:t[1]||(t[1]=l=>o.scaffoldHighlighted(e.entry.type,l)),onScaffoldNavigated:t[2]||(t[2]=l=>o.scaffoldNavigated(e.entry.type,l)),onOnReady:o.scaffoldIsReady,onOpenMap:e.openMap,ref:"scaffold","background-toggle":!0,traditional:!0,"help-mode":e.helpMode,render:e.visible,"display-latest-message":!0,"warning-message":o.warningMessage,"display-minimap":!1,"display-markers":!1,enableOpenMapUI:!0,"view-u-r-l":e.entry.viewUrl,markerLabels:o.markerLabels,flatmapAPI:e.flatmapAPI},null,8,["state","url","region","onOnReady","onOpenMap","help-mode","render","warning-message","view-u-r-l","markerLabels","flatmapAPI"])}const R8r=Gl(P8r,[["render",N8r],["__scopeId","data-v-4a090bca"]]),Wp=(e,t,{checkForDefaultPrevented:r=!0}={})=>n=>{const i=e==null?void 0:e(n);if(r===!1||!i)return t==null?void 0:t(n)};var KVe;const Ml=typeof window<"u",B8r=e=>typeof e=="string",XVe=()=>{},D8r=Ml&&((KVe=window==null?void 0:window.navigator)==null?void 0:KVe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function JVe(e){return typeof e=="function"?e():a.unref(e)}function F8r(e){return e}function jB(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function z8r(e,t=!0){a.getCurrentInstance()?a.onMounted(e):t?e():a.nextTick(e)}function Kp(e){var t;const r=JVe(e);return(t=r==null?void 0:r.$el)!=null?t:r}const UB=Ml?window:void 0;function J5(...e){let t,r,n,i;if(B8r(e[0])||Array.isArray(e[0])?([r,n,i]=e,t=UB):[t,r,n,i]=e,!t)return XVe;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(d=>d()),o.length=0},l=(d,p,h,f)=>(d.addEventListener(p,h,f),()=>d.removeEventListener(p,h,f)),c=a.watch(()=>[Kp(t),JVe(i)],([d,p])=>{s(),d&&o.push(...r.flatMap(h=>n.map(f=>l(d,h,f,p))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return jB(u),u}let YVe=!1;function j8r(e,t,r={}){const{window:n=UB,ignore:i=[],capture:o=!0,detectIframe:s=!1}=r;if(!n)return;D8r&&!YVe&&(YVe=!0,Array.from(n.document.body.children).forEach(d=>d.addEventListener("click",XVe)));let l=!0;const c=d=>i.some(p=>{if(typeof p=="string")return Array.from(n.document.querySelectorAll(p)).some(h=>h===d.target||d.composedPath().includes(h));{const h=Kp(p);return h&&(d.target===h||d.composedPath().includes(h))}}),u=[J5(n,"click",d=>{const p=Kp(e);if(!(!p||p===d.target||d.composedPath().includes(p))){if(d.detail===0&&(l=!c(d)),!l){l=!0;return}t(d)}},{passive:!0,capture:o}),J5(n,"pointerdown",d=>{const p=Kp(e);p&&(l=!d.composedPath().includes(p)&&!c(d))},{passive:!0}),s&&J5(n,"blur",d=>{var p;const h=Kp(e);((p=n.document.activeElement)==null?void 0:p.tagName)==="IFRAME"&&!(h!=null&&h.contains(n.document.activeElement))&&t(d)})].filter(Boolean);return()=>u.forEach(d=>d())}function $Ve(e,t=!1){const r=a.ref(),n=()=>r.value=!!e();return n(),z8r(n,t),r}const eIe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tIe="__vueuse_ssr_handlers__";eIe[tIe]=eIe[tIe]||{};var rIe=Object.getOwnPropertySymbols,U8r=Object.prototype.hasOwnProperty,G8r=Object.prototype.propertyIsEnumerable,q8r=(e,t)=>{var r={};for(var n in e)U8r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&rIe)for(var n of rIe(e))t.indexOf(n)<0&&G8r.call(e,n)&&(r[n]=e[n]);return r};function Xp(e,t,r={}){const n=r,{window:i=UB}=n,o=q8r(n,["window"]);let s;const l=$Ve(()=>i&&"ResizeObserver"in i),c=()=>{s&&(s.disconnect(),s=void 0)},u=a.watch(()=>Kp(e),p=>{c(),l.value&&i&&p&&(s=new ResizeObserver(t),s.observe(p,o))},{immediate:!0,flush:"post"}),d=()=>{c(),u()};return jB(d),{isSupported:l,stop:d}}var nIe=Object.getOwnPropertySymbols,Z8r=Object.prototype.hasOwnProperty,W8r=Object.prototype.propertyIsEnumerable,K8r=(e,t)=>{var r={};for(var n in e)Z8r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nIe)for(var n of nIe(e))t.indexOf(n)<0&&W8r.call(e,n)&&(r[n]=e[n]);return r};function X8r(e,t,r={}){const n=r,{window:i=UB}=n,o=K8r(n,["window"]);let s;const l=$Ve(()=>i&&"MutationObserver"in i),c=()=>{s&&(s.disconnect(),s=void 0)},u=a.watch(()=>Kp(e),p=>{c(),l.value&&i&&p&&(s=new MutationObserver(t),s.observe(p,o))},{immediate:!0}),d=()=>{c(),u()};return jB(d),{isSupported:l,stop:d}}var iIe;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(iIe||(iIe={}));var J8r=Object.defineProperty,oIe=Object.getOwnPropertySymbols,Y8r=Object.prototype.hasOwnProperty,$8r=Object.prototype.propertyIsEnumerable,aIe=(e,t,r)=>t in e?J8r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,emr=(e,t)=>{for(var r in t||(t={}))Y8r.call(t,r)&&aIe(e,r,t[r]);if(oIe)for(var r of oIe(t))$8r.call(t,r)&&aIe(e,r,t[r]);return e};emr({linear:F8r},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});const tmr=()=>Ml&&/firefox/i.test(window.navigator.userAgent);/**
4719
+ `),L="",w="",k=0,C=[],A=typeof"".trimLeft=="function",O=0,N=b.length;O<N;O++)if(L=b[O],L=A?L.trimLeft():L.trim(),k=L.length,k!==0&&(w=L.charAt(0),w!=="#"))if(w==="v"){var I=L.split(/\s+/);switch(I[0]){case"v":_.vertices.push(parseFloat(I[1]),parseFloat(I[2]),parseFloat(I[3])),7<=I.length?_.colors.push(parseFloat(I[4]),parseFloat(I[5]),parseFloat(I[6])):_.colors.push(void 0,void 0,void 0);break;case"vn":_.normals.push(parseFloat(I[1]),parseFloat(I[2]),parseFloat(I[3]));break;case"vt":_.uvs.push(parseFloat(I[1]),parseFloat(I[2]))}}else if(w==="f"){for(var B,F=L.substr(1).trim(),j=F.split(/\s+/),G=[],P=0,Z=j.length;P<Z;P++)if(B=j[P],0<B.length){var K=B.split("/");G.push(K)}for(var U=G[0],X=1,ee=G.length-1;X<ee;X++){var oe=G[X],he=G[X+1];_.addFace(U[0],oe[0],he[0],U[1],oe[1],he[1],U[2],oe[2],he[2])}}else if(w==="l"){var me=L.substring(1).trim().split(" "),ie=[],be=[];if(L.indexOf("/")===-1)ie=me;else for(var re,ue=0,ne=me.length;ue<ne;ue++)re=me[ue].split("/"),re[0]!==""&&ie.push(re[0]),re[1]!==""&&be.push(re[1]);_.addLineGeometry(ie,be)}else if(w==="p"){var ye=L.substr(1).trim(),_e=ye.split(" ");_.addPointGeometry(_e)}else if((C=s.exec(L))!==null){var Ie=(" "+C[0].substr(1).trim()).substr(1);_.startObject(Ie)}else if(c.test(L))_.object.startMaterial(L.substring(7).trim(),_.materialLibraries);else if(l.test(L))_.materialLibraries.push(L.substring(7).trim());else if(u.test(L))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(w==="s"){if(C=L.split(" "),1<C.length){var qe=C[1].trim().toLowerCase();_.object.smooth=qe!=="0"&&qe!=="off"}else _.object.smooth=!0;var Ge=_.object.currentMaterial();Ge&&(Ge.smooth=_.object.smooth)}else{if(L==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+L+'"')}_.finalize();var et=new o.Group;et.materialLibraries=[].concat(_.materialLibraries);var Ve=_.objects.length!==1||_.objects[0].geometry.vertices.length!==0;if(Ve==!0)for(var Ne=0,it=_.objects.length;Ne<it;Ne++){var Be=_.objects[Ne],pt=Be.geometry,yt=Be.materials,ct=pt.type==="Line",xe=pt.type==="Points",Ue=!1;if(pt.vertices.length!==0){var $e=new o.BufferGeometry;$e.setAttribute("position",new o.Float32BufferAttribute(pt.vertices,3)),0<pt.normals.length&&$e.setAttribute("normal",new o.Float32BufferAttribute(pt.normals,3)),0<pt.colors.length&&(Ue=!0,$e.setAttribute("color",new o.Float32BufferAttribute(pt.colors,3))),pt.hasUVIndices===!0&&$e.setAttribute("uv",new o.Float32BufferAttribute(pt.uvs,2));for(var at=[],Ht=0,Vt=yt.length;Ht<Vt;Ht++){var Dt=yt[Ht],Gt=Dt.name+"_"+Dt.smooth+"_"+Ue,Je=_.materials[Gt];if(this.materials!==null){if(Je=this.materials.create(Dt.name),ct&&Je&&!(Je instanceof o.LineBasicMaterial)){var ft=new o.LineBasicMaterial;o.Material.prototype.copy.call(ft,Je),ft.color.copy(Je.color),Je=ft}else if(xe&&Je&&!(Je instanceof o.PointsMaterial)){var St=new o.PointsMaterial({size:10,sizeAttenuation:!1});o.Material.prototype.copy.call(St,Je),St.color.copy(Je.color),St.map=Je.map,Je=St}}Je===void 0&&(Je=ct?new o.LineBasicMaterial:xe?new o.PointsMaterial({size:1,sizeAttenuation:!1}):new o.MeshPhongMaterial,Je.name=Dt.name,Je.flatShading=!Dt.smooth,Je.vertexColors=Ue,_.materials[Gt]=Je),at.push(Je)}var Wt=void 0;if(1<at.length){for(var Jt,Pt=0,rt=yt.length;Pt<rt;Pt++)Jt=yt[Pt],$e.addGroup(Jt.groupStart,Jt.groupCount,Pt);Wt=ct?new o.LineSegments($e,at):xe?new o.Points($e,at):new o.Mesh($e,at)}else Wt=ct?new o.LineSegments($e,at[0]):xe?new o.Points($e,at[0]):new o.Mesh($e,at[0]);Wt.name=Be.name,et.add(Wt)}}else if(0<_.vertices.length){var Et=new o.PointsMaterial({size:1,sizeAttenuation:!1}),kt=new o.BufferGeometry;kt.setAttribute("position",new o.Float32BufferAttribute(_.vertices,3)),0<_.colors.length&&_.colors[0]!==void 0&&(kt.setAttribute("color",new o.Float32BufferAttribute(_.colors,3)),Et.vertexColors=!0);var or=new o.Points(kt,Et);et.add(or)}return et}}},function(r,n,i){var o=i(14).JSONLoader;n.PrimitivesLoader=function(){var s=0;this.crossOrigin="Anonymous";var l=new o,c=[];this.load=(d,p,h,f)=>{if(20>s){++s,l.crossOrigin=this.crossOrigin;var m=new u(p,this),g=new u(f,this);l.load(d,m,h,g)}else c.push({url:d,onLoad:p,onProgress:h,onError:f})},this.loadFromWaitingList=()=>{var d=c.shift();d&&this.load(d.url,d.onLoad,d.onProgress,d.onError)};var u=function(d,p){return function(){--s,d(...arguments),p.loadFromWaitingList()}};this.parse=d=>l.parse(d)}},function(r,n,i){i(3);var o=i(36).GLTFLoader,s=function(){var l=this;this.parseGLTFObjects=(c,u,d,p)=>{var h=u;if(d!==0){if(c.type!=="Object3D"){var f;if(c.type==="Mesh"?f=new(i(2)).Geometry:c.type==="LineSegments"?f=new(i(20)).Lines:c.type==="Points"&&(f=new(i(17)).Pointset),f){var m=!1,g=!1;c.geometry&&c.geometry.morphAttributes&&(m=!!c.geometry.morphAttributes.position,g=!!c.geometry.morphAttributes.color),f.setMesh(c.clone(),m,g),u.addZincObject(f),f.groupName=f.morph.name,f.morph.matrixAutoUpdate=!0,p!=null&&typeof p=="function"&&p(f)}}else if(c.name!==""&&(u&&(h=u.findOrCreateChildFromPath(c.name)),h)){var T=h.getGroup();T.position.copy(c.position),T.rotation.copy(c.rotation),T.quaternion.copy(c.quaternion),T.matrixAutoUpdate=!0}}d++,c.children.forEach(y=>{l.parseGLTFObjects(y,h,d,p)})},this.setCamera=c=>{c.viewAll();var u=c.getZincCameraControls(),d=u.getCurrentViewport();u.addViewport("default",d),u.setDefaultViewport("default")},this.load=(c,u,d,p,h)=>{var f=d.substring(0,d.lastIndexOf("/")+1),m=d.substring(d.lastIndexOf("/")+1,d.length),g=new o().setPath(f);g.load(m,function(T){console.log(T),l.parseGLTFObjects(T.scene,u,0,p),l.setCamera(c),h!=null&&typeof h=="function"&&h()})}};n.GLTFToZincJSLoader=s},function(r,n){r.exports=n8r},function(r,n,i){var o=i(38).GLTFExporter,s=function(l){var c=l;this.exportGLTF=u=>{var d=c.getRootRegion(),p=d.getAllObjects(!0),h=[];p.forEach(g=>{g.animationClip&&h.push({clip:g.animationClip[0],mesh:g.morph})});var f=new o,m={binary:u,animations:h};return new Promise(g=>{f.parse(c.getThreeJSScene(),function(T){g(T)},m)})}};n.SceneExporter=s},function(r,n,i){i.r(n),i.d(n,"GLTFExporter",function(){return s});var o=i(3);class s{constructor(){this.pluginCallbacks=[],this.register(function(I){return new C(I)}),this.register(function(I){return new A(I)}),this.register(function(I){return new O(I)})}register(I){return this.pluginCallbacks.indexOf(I)===-1&&this.pluginCallbacks.push(I),this}unregister(I){return this.pluginCallbacks.indexOf(I)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(I),1),this}parse(I,B,F){for(var j=new k,G=[],P=0,Z=this.pluginCallbacks.length;P<Z;P++)G.push(this.pluginCallbacks[P](j));j.setPlugins(G),j.write(I,B,F)}}var l={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},c={};c[o.NearestFilter]=l.NEAREST,c[o.NearestMipmapNearestFilter]=l.NEAREST_MIPMAP_NEAREST,c[o.NearestMipmapLinearFilter]=l.NEAREST_MIPMAP_LINEAR,c[o.LinearFilter]=l.LINEAR,c[o.LinearMipmapNearestFilter]=l.LINEAR_MIPMAP_NEAREST,c[o.LinearMipmapLinearFilter]=l.LINEAR_MIPMAP_LINEAR,c[o.ClampToEdgeWrapping]=l.CLAMP_TO_EDGE,c[o.RepeatWrapping]=l.REPEAT,c[o.MirroredRepeatWrapping]=l.MIRRORED_REPEAT;var u={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},d=12,p=1179937895,h=2,f=8,m=1313821514,g=5130562;function T(N,I){return N.length===I.length&&N.every(function(B,F){return B===I[F]})}function y(N){if(window.TextEncoder!==void 0)return new TextEncoder().encode(N).buffer;for(var I,B=new Uint8Array(new ArrayBuffer(N.length)),F=0,j=N.length;F<j;F++)I=N.charCodeAt(F),B[F]=255<I?32:I;return B.buffer}function v(N){return T(N.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function _(N,I,B){for(var F={min:Array(N.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(N.itemSize).fill(Number.NEGATIVE_INFINITY)},j=I;j<I+B;j++)for(var G,P=0;P<N.itemSize;P++)G=void 0,4<N.itemSize?G=N.array[j*N.itemSize+P]:P===0?G=N.getX(j):P===1?G=N.getY(j):P===2?G=N.getZ(j):P==3&&(G=N.getW(j)),F.min[P]=Math.min(F.min[P],G),F.max[P]=Math.max(F.max[P],G);return F}function b(N){return 4*Math.ceil(N/4)}function L(N){var I=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,B=b(N.byteLength);if(B!==N.byteLength){var F=new Uint8Array(B);if(F.set(new Uint8Array(N)),I!==0)for(var j=N.byteLength;j<B;j++)F[j]=I;return F.buffer}return N}var w=null;class k{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(I){this.plugins=I}write(I,B,F){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},F),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(I);var j=this;Promise.all(this.pending).then(function(){var G=j.buffers,P=j.json,Z=j.options,K=j.extensionsUsed,U=new Blob(G,{type:"application/octet-stream"}),X=Object.keys(K);if(0<X.length&&(P.extensionsUsed=X),P.buffers&&0<P.buffers.length&&(P.buffers[0].byteLength=U.size),Z.binary===!0){var ee=new window.FileReader;ee.readAsArrayBuffer(U),ee.onloadend=function(){var he=L(ee.result),me=new DataView(new ArrayBuffer(f));me.setUint32(0,he.byteLength,!0),me.setUint32(4,g,!0);var ie=L(y(JSON.stringify(P)),32),be=new DataView(new ArrayBuffer(f));be.setUint32(0,ie.byteLength,!0),be.setUint32(4,m,!0);var re=new ArrayBuffer(d),ue=new DataView(re);ue.setUint32(0,p,!0),ue.setUint32(4,h,!0);var ne=d+be.byteLength+ie.byteLength+me.byteLength+he.byteLength;ue.setUint32(8,ne,!0);var ye=new Blob([re,be,ie,me,he],{type:"application/octet-stream"}),_e=new window.FileReader;_e.readAsArrayBuffer(ye),_e.onloadend=function(){B(_e.result)}}}else if(P.buffers&&0<P.buffers.length){var oe=new window.FileReader;oe.readAsDataURL(U),oe.onloadend=function(){var he=oe.result;P.buffers[0].uri=he,B(P)}}else B(P)})}serializeUserData(I,B){if(!(I.userData&&I.userData.isZincObject)&&Object.keys(I.userData).length!==0){var F=this.options,j=this.extensionsUsed;try{var G=JSON.parse(JSON.stringify(I.userData));if(F.includeCustomExtensions&&G.gltfExtensions){for(var P in B.extensions===void 0&&(B.extensions={}),G.gltfExtensions)B.extensions[P]=G.gltfExtensions[P],j[P]=!0;delete G.gltfExtensions}0<Object.keys(G).length&&(B.extras=G)}catch(Z){console.warn("THREE.GLTFExporter: userData of '"+I.name+"' won't be serialized because of JSON.stringify error - "+Z.message)}}}getUID(I){return this.uids.has(I)||this.uids.set(I,this.uid++),this.uids.get(I)}isNormalizedNormalAttribute(I){var B=this.cache;if(B.attributesNormalized.has(I))return!1;for(var F=new o.Vector3,j=0,G=I.count;j<G;j++)if(5e-4<Math.abs(F.fromBufferAttribute(I,j).length()-1))return!1;return!0}createNormalizedNormalAttribute(I){var B=this.cache;if(B.attributesNormalized.has(I))return B.attributesNormalized.get(I);for(var F=I.clone(),j=new o.Vector3,G=0,P=F.count;G<P;G++)j.fromBufferAttribute(F,G),j.x===0&&j.y===0&&j.z===0?j.setX(1):j.normalize(),F.setXYZ(G,j.x,j.y,j.z);return B.attributesNormalized.set(I,F),F}applyTextureTransform(I,B){var F=!1,j={};(B.offset.x!==0||B.offset.y!==0)&&(j.offset=B.offset.toArray(),F=!0),B.rotation!==0&&(j.rotation=B.rotation,F=!0),(B.repeat.x!==1||B.repeat.y!==1)&&(j.scale=B.repeat.toArray(),F=!0),F&&(I.extensions=I.extensions||{},I.extensions.KHR_texture_transform=j,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(I){var B=this.json,F=this.buffers;return B.buffers||(B.buffers=[{byteLength:0}]),F.push(I),0}processBufferView(I,B,F,j,G){var P=this.json;P.bufferViews||(P.bufferViews=[]);for(var Z=B===l.UNSIGNED_BYTE?1:B===l.UNSIGNED_SHORT?2:4,K=b(j*I.itemSize*Z),U=new DataView(new ArrayBuffer(K)),X=0,ee=F;ee<F+j;ee++)for(var oe,he=0;he<I.itemSize;he++)oe=void 0,4<I.itemSize?oe=I.array[ee*I.itemSize+he]:he===0?oe=I.getX(ee):he===1?oe=I.getY(ee):he===2?oe=I.getZ(ee):he==3&&(oe=I.getW(ee)),B===l.FLOAT?U.setFloat32(X,oe,!0):B===l.UNSIGNED_INT?U.setUint32(X,oe,!0):B===l.UNSIGNED_SHORT?U.setUint16(X,oe,!0):B===l.UNSIGNED_BYTE&&U.setUint8(X,oe),X+=Z;var me={buffer:this.processBuffer(U.buffer),byteOffset:this.byteOffset,byteLength:K};G!==void 0&&(me.target=G),G===l.ARRAY_BUFFER&&(me.byteStride=I.itemSize*Z),this.byteOffset+=K,P.bufferViews.push(me);var ie={id:P.bufferViews.length-1,byteLength:0};return ie}processBufferViewImage(I){var B=this,F=B.json;return F.bufferViews||(F.bufferViews=[]),new Promise(function(j){var G=new window.FileReader;G.readAsArrayBuffer(I),G.onloadend=function(){var P=L(G.result),Z={buffer:B.processBuffer(P),byteOffset:B.byteOffset,byteLength:P.byteLength};B.byteOffset+=P.byteLength,j(F.bufferViews.push(Z)-1)}})}processAccessor(I,B,F,j){var G,P=this.options,Z=this.json;if(I.array.constructor===Float32Array)G=l.FLOAT;else if(I.array.constructor===Uint32Array)G=l.UNSIGNED_INT;else if(I.array.constructor===Uint16Array)G=l.UNSIGNED_SHORT;else if(I.array.constructor===Uint8Array)G=l.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(F===void 0&&(F=0),j===void 0&&(j=I.count),P.truncateDrawRange&&B!==void 0&&B.index===null){var K=F+j,U=B.drawRange.count===1/0?I.count:B.drawRange.start+B.drawRange.count;F=Math.max(F,B.drawRange.start),j=Math.min(K,U)-F,0>j&&(j=0)}if(j===0)return null;var X,ee=_(I,F,j);B!==void 0&&(X=I===B.index?l.ELEMENT_ARRAY_BUFFER:l.ARRAY_BUFFER);var oe=this.processBufferView(I,G,F,j,X),he={bufferView:oe.id,byteOffset:oe.byteOffset,componentType:G,count:j,max:ee.max,min:ee.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[I.itemSize]};return I.normalized===!0&&(he.normalized=!0),Z.accessors||(Z.accessors=[]),Z.accessors.push(he)-1}processImage(I,B,F){var j=this,G=j.cache,P=j.json,Z=j.options,K=j.pending;G.images.has(I)||G.images.set(I,{});var U=G.images.get(I),X=B===o.RGBAFormat?"image/png":"image/jpeg",ee=X+":flipY/"+F.toString();if(U[ee]!==void 0)return U[ee];P.images||(P.images=[]);var oe={mimeType:X};if(Z.embedImages){var he=w=w||document.createElement("canvas");he.width=Math.min(I.width,Z.maxTextureSize),he.height=Math.min(I.height,Z.maxTextureSize);var me=he.getContext("2d");if(F===!0&&(me.translate(0,he.height),me.scale(1,-1)),typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&I instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&I instanceof ImageBitmap)me.drawImage(I,0,0,he.width,he.height);else{B!==o.RGBAFormat&&B!==o.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(I.width>Z.maxTextureSize||I.height>Z.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",I);var ie=new Uint8ClampedArray(4*(I.height*I.width));if(B===o.RGBAFormat)for(var be=0;be<ie.length;be+=4)ie[be+0]=I.data[be+0],ie[be+1]=I.data[be+1],ie[be+2]=I.data[be+2],ie[be+3]=I.data[be+3];else for(var re=0,ue=0;re<ie.length;re+=4,ue+=3)ie[re+0]=I.data[ue+0],ie[re+1]=I.data[ue+1],ie[re+2]=I.data[ue+2],ie[re+3]=255;me.putImageData(new ImageData(ie,I.width,I.height),0,0)}Z.binary===!0?K.push(new Promise(function(ye){he.toBlob(function(_e){j.processBufferViewImage(_e).then(function(Ie){oe.bufferView=Ie,ye()})},X)})):oe.uri=he.toDataURL(X)}else oe.uri=I.src;var ne=P.images.push(oe)-1;return U[ee]=ne,ne}processSampler(I){var B=this.json;B.samplers||(B.samplers=[]);var F={magFilter:c[I.magFilter],minFilter:c[I.minFilter],wrapS:c[I.wrapS],wrapT:c[I.wrapT]};return B.samplers.push(F)-1}processTexture(I){var B=this.cache,F=this.json;if(B.textures.has(I))return B.textures.get(I);F.textures||(F.textures=[]);var j={sampler:this.processSampler(I),source:this.processImage(I.image,I.format,I.flipY)};I.name&&(j.name=I.name),this._invokeAll(function(P){P.writeTexture&&P.writeTexture(I,j)});var G=F.textures.push(j)-1;return B.textures.set(I,G),G}processMaterial(I){var B=this.cache,F=this.json;if(B.materials.has(I))return B.materials.get(I);if(I.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;F.materials||(F.materials=[]);var j={pbrMetallicRoughness:{}};I.isMeshStandardMaterial!==!0&&I.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var G=I.color.toArray().concat([I.opacity]);if(T(G,[1,1,1,1])||(j.pbrMetallicRoughness.baseColorFactor=G),I.isMeshStandardMaterial?(j.pbrMetallicRoughness.metallicFactor=I.metalness,j.pbrMetallicRoughness.roughnessFactor=I.roughness):(j.pbrMetallicRoughness.metallicFactor=.5,j.pbrMetallicRoughness.roughnessFactor=.5),I.metalnessMap||I.roughnessMap)if(I.metalnessMap===I.roughnessMap){var P={index:this.processTexture(I.metalnessMap)};this.applyTextureTransform(P,I.metalnessMap),j.pbrMetallicRoughness.metallicRoughnessTexture=P}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(I.map){var Z={index:this.processTexture(I.map)};this.applyTextureTransform(Z,I.map),j.pbrMetallicRoughness.baseColorTexture=Z}if(I.emissive){var K=I.emissive.clone().multiplyScalar(I.emissiveIntensity),U=Math.max(K.r,K.g,K.b);if(1<U&&(K.multiplyScalar(1/U),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<U&&(j.emissiveFactor=K.toArray()),I.emissiveMap){var X={index:this.processTexture(I.emissiveMap)};this.applyTextureTransform(X,I.emissiveMap),j.emissiveTexture=X}}if(I.normalMap){var ee={index:this.processTexture(I.normalMap)};I.normalScale&&I.normalScale.x!==-1&&(I.normalScale.x!==I.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),ee.scale=I.normalScale.x),this.applyTextureTransform(ee,I.normalMap),j.normalTexture=ee}if(I.aoMap){var oe={index:this.processTexture(I.aoMap),texCoord:1};I.aoMapIntensity!==1&&(oe.strength=I.aoMapIntensity),this.applyTextureTransform(oe,I.aoMap),j.occlusionTexture=oe}I.transparent?j.alphaMode="BLEND":0<I.alphaTest&&(j.alphaMode="MASK",j.alphaCutoff=I.alphaTest),I.side===o.DoubleSide&&(j.doubleSided=!0),I.name!==""&&(j.name=I.name),this.serializeUserData(I,j),this._invokeAll(function(me){me.writeMaterial&&me.writeMaterial(I,j)});var he=F.materials.push(j)-1;return B.materials.set(I,he),he}processMesh(I){var B=this.cache,F=this.json,j=[I.geometry.uuid];if(Array.isArray(I.material))for(var G=0,P=I.material.length;G<P;G++)j.push(I.material[G].uuid);else j.push(I.material.uuid);var Z=j.join(":");if(B.meshes.has(Z))return B.meshes.get(Z);var K,U=I.geometry;if(K=I.isLineSegments?l.LINES:I.isLineLoop?l.LINE_LOOP:I.isLine?l.LINE_STRIP:I.isPoints?l.POINTS:I.material.wireframe?l.LINES:l.TRIANGLES,U.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var X={},ee={},oe=[],he=[],me={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},ie=U.getAttribute("normal");ie===void 0||this.isNormalizedNormalAttribute(ie)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),U.setAttribute("normal",this.createNormalizedNormalAttribute(ie)));var be=null;for(var re in U.attributes)if(re.substr(0,5)!=="morph"){var ue=U.attributes[re];re=me[re]||re.toUpperCase();var ne=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(ne.test(re)||(re="_"+re),B.attributes.has(this.getUID(ue))){ee[re]=B.attributes.get(this.getUID(ue));continue}be=null;var ye=ue.array;re!=="JOINTS_0"||ye instanceof Uint16Array||ye instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),be=new o.BufferAttribute(new Uint16Array(ye),ue.itemSize,ue.normalized));var _e=this.processAccessor(be||ue,U);_e!==null&&(ee[re]=_e,B.attributes.set(this.getUID(ue),_e))}if(ie!==void 0&&U.setAttribute("normal",ie),Object.keys(ee).length===0)return null;if(I.morphTargetInfluences!==void 0&&0<I.morphTargetInfluences.length){var Ie=[],qe=[],Ge={};if(I.morphTargetDictionary!==void 0)for(var et in I.morphTargetDictionary)Ge[I.morphTargetDictionary[et]]=et;for(var Ve=0;Ve<I.morphTargetInfluences.length;++Ve){var Ne={},it=!1;for(var Be in U.morphAttributes){if(Be!="position"&&Be!=="normal"&&Be!=="color"){it||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),it=!0);continue}var pt=U.morphAttributes[Be][Ve],yt=Be.toUpperCase();me[Be]&&(yt=me[Be]);var ct=U.attributes[Be];if(B.attributes.has(this.getUID(pt))){Ne[yt]=B.attributes.get(this.getUID(pt));continue}var xe=ct.clone();if(!U.morphTargetsRelative)if(ct)for(var Ue=0,$e=pt.count;Ue<$e;Ue++)ct.count>Ue&&xe.setXYZ(Ue,pt.getX(Ue)-ct.getX(Ue),pt.getY(Ue)-ct.getY(Ue),pt.getZ(Ue)-ct.getZ(Ue));else for(var at=0,Ht=pt.count;at<Ht;at++)xe.setXYZ(at,0,0,0);Ne[yt]=this.processAccessor(xe,U),B.attributes.set(this.getUID(ct),Ne[yt])}he.push(Ne),Ie.push(I.morphTargetInfluences[Ve]),I.morphTargetDictionary!==void 0&&qe.push(Ge[Ve])}X.weights=Ie,0<qe.length&&(X.extras={},X.extras.targetNames=qe)}var Vt=Array.isArray(I.material);if(Vt&&U.groups.length===0)return null;for(var Dt,Gt=Vt?I.material:[I.material],Je=Vt?U.groups:[{materialIndex:0,start:void 0,count:void 0}],ft=0,St=Je.length;ft<St;ft++){if(Dt={mode:K,attributes:ee},this.serializeUserData(U,Dt),0<he.length&&(Dt.targets=he),U.index!==null){var Wt=this.getUID(U.index);(Je[ft].start!==void 0||Je[ft].count!==void 0)&&(Wt+=":"+Je[ft].start+":"+Je[ft].count),B.attributes.has(Wt)?Dt.indices=B.attributes.get(Wt):(Dt.indices=this.processAccessor(U.index,U,Je[ft].start,Je[ft].count),B.attributes.set(Wt,Dt.indices)),Dt.indices===null&&delete Dt.indices}var Jt=this.processMaterial(Gt[Je[ft].materialIndex]);Jt!==null&&(Dt.material=Jt),oe.push(Dt)}X.primitives=oe,F.meshes||(F.meshes=[]),this._invokeAll(function(rt){rt.writeMesh&&rt.writeMesh(I,X)});var Pt=F.meshes.push(X)-1;return B.meshes.set(Z,Pt),Pt}processCamera(I){var B=this.json;B.cameras||(B.cameras=[]);var F=I.isOrthographicCamera,j={type:F?"orthographic":"perspective"};return F?j.orthographic={xmag:2*I.right,ymag:2*I.top,zfar:0>=I.far?.001:I.far,znear:0>I.near?0:I.near}:j.perspective={aspectRatio:I.aspect,yfov:o.MathUtils.degToRad(I.fov),zfar:0>=I.far?.001:I.far,znear:0>I.near?0:I.near},I.name!==""&&(j.name=I.type),B.cameras.push(j)-1}processAnimation(I,B){var F=this.json,j=this.nodeMap;F.animations||(F.animations=[]),I=s.Utils.mergeMorphTargetTracks(I.clone(),B);for(var G=I.tracks,P=[],Z=[],K=0;K<G.length;++K){var U=G[K],X=o.PropertyBinding.parseTrackName(U.name),ee=o.PropertyBinding.findNode(B,X.nodeName),oe=u[X.propertyName];if(X.objectName==="bones"&&(ee.isSkinnedMesh===!0?ee=ee.skeleton.getBoneByName(X.objectIndex):ee=void 0),!ee||!oe)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',U.name),null;var he=U.values.length/U.times.length;oe===u.morphTargetInfluences&&(he/=ee.morphTargetInfluences.length);var me=void 0;U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(me="CUBICSPLINE",he/=3):U.getInterpolation()===o.InterpolateDiscrete?me="STEP":me="LINEAR",Z.push({input:this.processAccessor(new o.BufferAttribute(U.times,1)),output:this.processAccessor(new o.BufferAttribute(U.values,he)),interpolation:me}),P.push({sampler:Z.length-1,target:{node:j.get(ee),path:oe}})}return F.animations.push({name:I.name||"clip_"+F.animations.length,samplers:Z,channels:P}),F.animations.length-1}processSkin(I){var B=this.json,F=this.nodeMap,j=B.nodes[F.get(I)],G=I.skeleton;if(G===void 0)return null;var P=I.skeleton.bones[0];if(P===void 0)return null;for(var Z=[],K=new Float32Array(16*G.bones.length),U=new o.Matrix4,X=0;X<G.bones.length;++X)Z.push(F.get(G.bones[X])),U.copy(G.boneInverses[X]),U.multiply(I.bindMatrix).toArray(K,16*X);B.skins===void 0&&(B.skins=[]),B.skins.push({inverseBindMatrices:this.processAccessor(new o.BufferAttribute(K,16)),joints:Z,skeleton:F.get(P)});var ee=j.skin=B.skins.length-1;return ee}processNode(I){var B=this.json,F=this.options,j=this.nodeMap;B.nodes||(B.nodes=[]);var G={};if(F.trs){var P=I.quaternion.toArray(),Z=I.position.toArray(),K=I.scale.toArray();T(P,[0,0,0,1])||(G.rotation=P),T(Z,[0,0,0])||(G.translation=Z),T(K,[1,1,1])||(G.scale=K)}else I.matrixAutoUpdate&&I.updateMatrix(),v(I.matrix)===!1&&(G.matrix=I.matrix.elements);if(I.name!==""&&(G.name=I.name+""),this.serializeUserData(I,G),I.isMesh||I.isLine||I.isPoints){var U=this.processMesh(I);U!==null&&(G.mesh=U)}else I.isCamera&&(G.camera=this.processCamera(I));if(I.isSkinnedMesh&&this.skins.push(I),0<I.children.length){for(var X,ee=[],oe=0,he=I.children.length;oe<he;oe++)if(X=I.children[oe],X.visible||F.onlyVisible===!1){var me=this.processNode(X);me!==null&&ee.push(me)}0<ee.length&&(G.children=ee)}this._invokeAll(function(be){be.writeNode&&be.writeNode(I,G)});var ie=B.nodes.push(G)-1;return j.set(I,ie),ie}processScene(I){var B=this.json,F=this.options;B.scenes||(B.scenes=[],B.scene=0);var j={};I.name!==""&&(j.name=I.name),B.scenes.push(j);for(var G,P=[],Z=0,K=I.children.length;Z<K;Z++)if(G=I.children[Z],G.visible||F.onlyVisible===!1){var U=this.processNode(G);U!==null&&P.push(U)}0<P.length&&(j.nodes=P),this.serializeUserData(I,j)}processObjects(I){var B=new o.Scene;B.name="AuxScene";for(var F=0;F<I.length;F++)B.children.push(I[F]);this.processScene(B)}processInput(I){var B=this.options;I=I instanceof Array?I:[I],this._invokeAll(function(Z){Z.beforeParse&&Z.beforeParse(I)});for(var F=[],j=0;j<I.length;j++)I[j]instanceof o.Scene?this.processScene(I[j]):F.push(I[j]);0<F.length&&this.processObjects(F);for(var G=0;G<this.skins.length;++G)this.processSkin(this.skins[G]);for(var P=0;P<B.animations.length;++P)this.processAnimation(B.animations[P].clip,B.animations[P].mesh);this._invokeAll(function(Z){Z.afterParse&&Z.afterParse(I)})}_invokeAll(I){for(var B=0,F=this.plugins.length;B<F;B++)I(this.plugins[B])}}class C{constructor(I){this.writer=I,this.name="KHR_lights_punctual"}writeNode(I,B){if(I.isLight){if(!I.isDirectionalLight&&!I.isPointLight&&!I.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",I);var F=this.writer,j=F.json,G=F.extensionsUsed,P={};I.name&&(P.name=I.name),P.color=I.color.toArray(),P.intensity=I.intensity,I.isDirectionalLight?P.type="directional":I.isPointLight?(P.type="point",0<I.distance&&(P.range=I.distance)):I.isSpotLight&&(P.type="spot",0<I.distance&&(P.range=I.distance),P.spot={},P.spot.innerConeAngle=-1*((I.penumbra-1)*I.angle),P.spot.outerConeAngle=I.angle),I.decay!==void 0&&I.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),I.target&&(I.target.parent!==I||I.target.position.x!==0||I.target.position.y!==0||I.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."),G[this.name]||(j.extensions=j.extensions||{},j.extensions[this.name]={lights:[]},G[this.name]=!0);var Z=j.extensions[this.name].lights;Z.push(P),B.extensions=B.extensions||{},B.extensions[this.name]={light:Z.length-1}}}}class A{constructor(I){this.writer=I,this.name="KHR_materials_unlit"}writeMaterial(I,B){if(I.isMeshBasicMaterial){var F=this.writer,j=F.extensionsUsed;B.extensions=B.extensions||{},B.extensions[this.name]={},j[this.name]=!0,B.pbrMetallicRoughness.metallicFactor=0,B.pbrMetallicRoughness.roughnessFactor=.9}}}class O{constructor(I){this.writer=I,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(I,B){if(I.isGLTFSpecularGlossinessMaterial){var F=this.writer,j=F.extensionsUsed,G={};B.pbrMetallicRoughness.baseColorFactor&&(G.diffuseFactor=B.pbrMetallicRoughness.baseColorFactor);var P=[1,1,1];if(I.specular.toArray(P,0),G.specularFactor=P,G.glossinessFactor=I.glossiness,B.pbrMetallicRoughness.baseColorTexture&&(G.diffuseTexture=B.pbrMetallicRoughness.baseColorTexture),I.specularMap){var Z={index:F.processTexture(I.specularMap)};F.applyTextureTransform(Z,I.specularMap),G.specularGlossinessTexture=Z}B.extensions=B.extensions||{},B.extensions[this.name]=G,j[this.name]=!0}}}s.Utils={insertKeyframe:function(N,I){var B,F=.001,j=N.getValueSize(),G=new N.TimeBufferType(N.times.length+1),P=new N.ValueBufferType(N.values.length+j),Z=N.createInterpolant(new N.ValueBufferType(j));if(N.times.length===0){G[0]=I;for(var K=0;K<j;K++)P[K]=0;B=0}else if(I<N.times[0]){if(Math.abs(N.times[0]-I)<F)return 0;G[0]=I,G.set(N.times,1),P.set(Z.evaluate(I),0),P.set(N.values,j),B=0}else if(I>N.times[N.times.length-1]){if(Math.abs(N.times[N.times.length-1]-I)<F)return N.times.length-1;G[G.length-1]=I,G.set(N.times,0),P.set(N.values,0),P.set(Z.evaluate(I),N.values.length),B=G.length-1}else for(var U=0;U<N.times.length;U++){if(Math.abs(N.times[U]-I)<F)return U;if(N.times[U]<I&&N.times[U+1]>I){G.set(N.times.slice(0,U+1),0),G[U+1]=I,G.set(N.times.slice(U+1),U+2),P.set(N.values.slice(0,(U+1)*j),0),P.set(Z.evaluate(I),(U+1)*j),P.set(N.values.slice((U+1)*j),(U+2)*j),B=U+1;break}}return N.times=G,N.values=P,B},mergeMorphTargetTracks:function(N,I){for(var B=[],F={},j=N.tracks,G=0;G<j.length;++G){var P=j[G],Z=o.PropertyBinding.parseTrackName(P.name),K=o.PropertyBinding.findNode(I,Z.nodeName);if(Z.propertyName!=="morphTargetInfluences"||Z.propertyIndex===void 0){B.push(P);continue}if(P.createInterpolant!==P.InterpolantFactoryMethodDiscrete&&P.createInterpolant!==P.InterpolantFactoryMethodLinear){if(P.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."),P=P.clone(),P.setInterpolation(o.InterpolateLinear)}var U=K.morphTargetInfluences.length,X=K.morphTargetDictionary[Z.propertyIndex];if(X===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+Z.propertyIndex);var ee=void 0;if(F[K.uuid]===void 0){ee=P.clone();for(var oe=new ee.ValueBufferType(U*ee.times.length),he=0;he<ee.times.length;he++)oe[he*U+X]=ee.values[he];ee.name=(Z.nodeName||"")+".morphTargetInfluences",ee.values=oe,F[K.uuid]=ee,B.push(ee);continue}var me=P.createInterpolant(new P.ValueBufferType(1));ee=F[K.uuid];for(var ie=0;ie<ee.times.length;ie++)ee.values[ie*U+X]=me.evaluate(ee.times[ie]);for(var be,re=0;re<P.times.length;re++)be=this.insertKeyframe(ee,P.times[re]),ee.values[be*U+X]=P.values[re]}return N.tracks=B,N}}},function(r,n,i){var o=i(3),s=i(4).resolveURL,l=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var y=this;this.setFromObject=v=>{var{nearPlane:_,farPlane:b,eyePosition:L,targetPosition:w,upVector:k}=v;y.nearPlane=_,y.farPlane=b,y.eyePosition=L,y.targetPosition=w,y.upVector=k}},c=function(y,v,_,b){var L={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},w={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},k={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},C={};C.MAIN=w.ROTATE,C.AUXILIARY=w.ZOOM,C.SECONDARY=w.PAN,this.cameraObject=y,this.domElement=v===void 0?document:v,this.renderer=_,this.scene=b,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.scrollRate=50;var A=6e3,O=!0,N=0,I=void 0,B=void 0,F=!1,j=500,G=void 0,P="default",Z=L.DEFAULT,K=void 0,U=void 0,X=void 0,ee=0,oe=k.FREE;this._state=w.NONE;var he;this.targetTouchId=-1;var me=void 0,ie=new o.Vector3,be=new o.Vector3,re=new o.Vector3,ue=new o.Vector3,ne=new o.Vector3,ye=new o.Vector3,_e=new o.Vector3,Ie=new o.Vector3,qe=new o.Sphere,Ge=new o.Vector3,et=void 0,Ve=0,Ne={default:new l};Ne.default.nearPlane=.1,Ne.default.farPlane=2e3,Ne.default.eyePosition=[0,0,0],Ne.default.targetPosition=[0,0,-1],Ne.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new o.Vector3(...Ne.default.targetPosition)),this.calculateMaxAllowedDistance=rt=>{var Et=rt.getBoundingBox();if(Et){Et.getBoundingSphere(qe),Ve=6*qe.radius;var kt=0;this.cameraObject&&(kt=this.cameraObject.position.distanceTo(qe.center)),Ve=kt>Ve?kt:Ve}else Ve=0},this.addViewport=(rt,Et)=>{rt&&Et&&(Ne[rt]=Et)},this.setDefaultViewport=rt=>!!(rt&&rt in Ne)&&(P=rt,!0),this.getDefaultViewport=()=>P,this.getViewportOfName=rt=>Ne[rt],this.setCurrentViewport=rt=>rt in Ne&&(this.setCurrentCameraSettings(Ne[rt]),!0),this.setRotationMode=rt=>{switch(rt){case"none":oe=k.NONE;break;case"horizontal":oe=k.HORIZONTAL;break;case"vertical":oe=k.VERTICAL;break;case"free":default:oe=k.FREE}},this.onResize=()=>{me&&(me=void 0),et&&et.setCurrentCameraSettings(this.cameraObject,Ne[P])},this.getNDCFromDocumentCoords=(rt,Et,kt)=>{Vt(!1);var or=kt||new o.Vector2,$t=2*((rt-me.left)/me.width)-1,wt=2*-((Et-me.top)/me.height)+1;return or.set($t,wt)},this.getRelativeCoordsFromNDC=(rt,Et,kt)=>{Vt(!1);var or=kt||new o.Vector2;return or.x=(rt+1)*me.width/2,or.y=(1-Et)*me.height/2,or},this.setMouseButtonAction=(rt,Et)=>{C[rt]=w[Et]};var it=()=>{if(0<Ve){var rt=Ge.distanceTo(qe.center);return Ve>rt||this.cameraObject.position.distanceTo(qe.center)>rt}return!0},Be=rt=>{Ge.copy(this.cameraObject.position).add(rt),it()&&(this.cameraObject.target.add(rt),this.cameraObject.position.add(rt),this.updateDirectionalLight())},pt=rt=>{Vt(!1);var Et;if(Z===L.DEFAULT&&(Et=this.scene.getNormalisedMinimapCoordinates(this.renderer,rt)),!Et)rt.button==0?rt.ctrlKey?this._state=C.AUXILIARY:rt.shiftKey?this._state=C.SECONDARY:this._state=C.MAIN:rt.button==1?(rt.preventDefault(),this._state=C.AUXILIARY):rt.button==2&&(this._state=C.SECONDARY),this.pointer_x=rt.clientX-me.left,this.pointer_y=rt.clientY-me.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{Z=L.MINIMAP;var kt=this.scene.getMinimapDiffFromNormalised(Et.x,Et.y);Be(kt)}},yt=rt=>{if(Vt(!1),this.pointer_x=rt.clientX-me.left,this.pointer_y=rt.clientY-me.top,Z===L.MINIMAP){var Et=this.scene.getNormalisedMinimapCoordinates(this.renderer,rt);if(Et){var kt=this.scene.getMinimapDiffFromNormalised(Et.x,Et.y);Be(kt)}}else this._state===w.NONE&&he!==void 0&&he.move(this,rt.clientX,rt.clientY,this.renderer)},ct=rt=>{this._state=w.NONE,Z==L.MINIMAP&&(Z=L.DEFAULT),he!==void 0&&this.pointer_x_start==rt.clientX-me.left&&this.pointer_y_start==rt.clientY-me.top&&he.pick(this,rt.clientX,rt.clientY,this.renderer)},xe=()=>{this._state=w.NONE},Ue=rt=>{Vt(!1);var Et=rt.touches.length;if(Et==1)this._state=w.TOUCH_ROTATE,this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.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(Et==2){this._state=w.TOUCH_ZOOM;var kt=rt.touches[0].clientX-rt.touches[1].clientX,or=rt.touches[0].clientY-rt.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(kt*kt+or*or)}else Et==3&&(this._state=w.TOUCH_PAN,this.targetTouchId=rt.touches[0].identifier,this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},$e=rt=>{rt.preventDefault(),rt.stopPropagation();var Et=rt.touches.length;if(Et==1)this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top;else if(Et==2){if(this._state===w.TOUCH_ZOOM){var kt=rt.touches[0].clientX-rt.touches[1].clientX,or=rt.touches[0].clientY-rt.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(kt*kt+or*or)}}else if(Et==3&&this._state===w.TOUCH_PAN)for(var $t=0;3>$t;$t++)rt.touches[$t].identifier==this.targetTouchId&&(this.pointer_x=rt.touches[0].clientX-me.left,this.pointer_y=rt.touches[0].clientY-me.top)},at=rt=>{var Et=rt.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=w.NONE,Et==1&&he!==void 0&&this.pointer_x_start==rt.touches[0].clientX-me.left&&this.pointer_y_start==rt.touches[0].clientY-me.top&&he.pick(this.cameraObject,rt.touches[0].clientX,rt.touches[0].clientY,this.renderer)},Ht=()=>{Vt(!0)},Vt=rt=>{if(rt||me===void 0){var Et=new IntersectionObserver(kt=>{for(var or of kt)me=or.boundingClientRect;Et.disconnect()});Et.observe(this.domElement)}},Dt=rt=>{Vt(!1),this._state=w.SCROLL;var Et=0;0<rt.deltaY?Et=this.scrollRate:0>rt.deltaY&&(Et=-1*this.scrollRate),ee+=Et,rt.preventDefault(),rt.stopImmediatePropagation()},Gt=()=>{if(typeof this.cameraObject<"u"){var rt=me.height,Et=this.cameraObject.position.distanceTo(this.cameraObject.target),kt=0;this.cameraObject.far>this.cameraObject.near&&Et>=this.cameraObject.near&&Et<=this.cameraObject.far&&(kt=(Et-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),be.set(this.previous_pointer_x,rt-this.previous_pointer_y,0),re.set(this.previous_pointer_x,rt-this.previous_pointer_y,1),ue.set(this.pointer_x,rt-this.pointer_y,0),ne.set(this.pointer_x,rt-this.pointer_y,1),be.unproject(this.cameraObject),re.unproject(this.cameraObject),ue.unproject(this.cameraObject),ne.unproject(this.cameraObject),ue.sub(be).multiplyScalar(1-kt),ne.sub(re).multiplyScalar(kt),ue.add(ne).multiplyScalar(-.002),Be(ue)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(rt,Et)=>{rt.normalize(),_e.copy(this.cameraObject.position).sub(this.cameraObject.target),Ie.copy(_e),_e.normalize(),.8<Math.abs(_e.dot(rt))&&_e.copy(this.cameraObject.up),be.crossVectors(rt,_e).normalize(),re.crossVectors(rt,be);var kt=rt.dot(Ie),or=be.dot(Ie),$t=re.dot(Ie),wt=rt.dot(this.cameraObject.up),je=be.dot(this.cameraObject.up),ke=re.dot(this.cameraObject.up),Oe=Math.cos(Et),Ye=Math.sin(Et);return ue.set(Oe*be.x+Ye*re.x,Oe*be.y+Ye*re.y,Oe*be.z+Ye*re.z),ne.set(Oe*re.x-Ye*be.x,Oe*re.y-Ye*be.y,Oe*re.z-Ye*be.z),_e.copy(this.cameraObject.target),_e.x=_e.x+rt.x*kt+ue.x*or+ne.x*$t,_e.y=_e.y+rt.y*kt+ue.y*or+ne.y*$t,_e.z=_e.z+rt.z*kt+ue.z*or+ne.z*$t,ie.set(rt.x*wt+ue.x*je+ne.x*ke,rt.y*wt+ue.y*je+ne.y*ke,rt.z*wt+ue.z*je+ne.z*ke),{position:_e,up:ie}},this.rotateAboutLookAtpoint=(rt,Et)=>{var kt=this.getVectorsFromRotateAboutLookAtPoints(rt,Et);this.cameraObject.position.copy(kt.position),this.updateDirectionalLight(),this.cameraObject.up.copy(kt.up)};var Je=()=>{if(typeof this.cameraObject<"u"){var rt=me.width,Et=me.height;if(0<rt&&0<Et){var kt=.25*(rt+Et),or=0,$t=0;(oe===k.FREE||oe===k.HORIZONTAL)&&(or=this.pointer_x-this.previous_pointer_x),(oe===k.FREE||oe===k.VERTICAL)&&($t=this.previous_pointer_y-this.pointer_y);var wt=Math.sqrt(or*or+$t*$t);if(0<wt){var je=1*-$t/wt,ke=1*or/wt;oe===k.FREE&&je*(this.pointer_x-.5*(rt-1))+ke*(.5*(Et-1)-this.pointer_y);var Oe=Math.acos(0/kt)-.5*Math.PI,Ye=this.tumble_rate*wt/kt;ie.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),be.copy(this.cameraObject.up).normalize(),re.copy(be).cross(ie).normalize().multiplyScalar(je),be.multiplyScalar(ke),ye.addVectors(re,be).multiplyScalar(Math.cos(Oe)),ie.multiplyScalar(Math.sin(Oe)),ye.add(ie),this.rotateAboutLookAtpoint(ye,-Ye)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},ft=()=>{var rt=0;return this._state===w.ZOOM?rt=this.previous_pointer_y-this.pointer_y:this._state===w.SCROLL?rt=ee:(rt=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),rt};this.changeZoomByScrollRateUnit=rt=>{var Et=rt*this.scrollRate;this.changeZoomByValue(Et)},this.changeZoomByValue=rt=>{if(typeof this.cameraObject<"u"){me.width;var Et=me.height,kt=this.cameraObject.position.clone();kt.sub(this.cameraObject.target);var or=kt.length(),$t=1.5*rt/Et;if(.01<or+$t*or&&(kt.normalize(),Ge.copy(this.cameraObject.position),Ge.x+=kt.x*$t*or,Ge.y+=kt.y*$t*or,Ge.z+=kt.z*$t*or,it())){this.cameraObject.position.copy(Ge),this.updateDirectionalLight();var wt=1e-5;if(wt*this.cameraObject.far<this.cameraObject.near+$t*or+this.near_plane_fly_debt)this.near_plane_fly_debt!=0&&(this.near_plane_fly_debt+=$t*or,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=$t*or,this.cameraObject.far+=$t*or));else{if(this.near_plane_fly_debt==0){var je=this.cameraObject.near-wt*this.cameraObject.far;this.cameraObject.near=wt*this.cameraObject.far,this.cameraObject.far-=je,this.near_plane_fly_debt-=wt*this.cameraObject.far}this.near_plane_fly_debt+=$t*or}}}};var St=()=>{var rt=ft();this.changeZoomByValue(rt),this._state===w.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),this._state===w.SCROLL&&(ee=0,this._state=w.NONE)};this.setDirectionalLight=rt=>{this.directionalLight=rt},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){O=!0,this.domElement&&this.domElement.addEventListener&&(this.domElement.addEventListener("mousedown",pt,!1),this.domElement.addEventListener("mousemove",yt,!1),this.domElement.addEventListener("mouseup",ct,!1),this.domElement.addEventListener("mouseleave",xe,!1),this.domElement.addEventListener("touchstart",Ue,!1),this.domElement.addEventListener("touchmove",$e,!1),this.domElement.addEventListener("touchend",at,!1),this.domElement.addEventListener("wheel",Dt,!1),this.domElement.addEventListener("contextmenu",rt=>{rt.preventDefault()},!1),this.domElement.addEventListener("mouseenter",Ht,!1))},this.disable=function(){O=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",pt,!1),this.domElement.removeEventListener("mousemove",yt,!1),this.domElement.removeEventListener("mouseup",ct,!1),this.domElement.removeEventListener("mouseleave",xe,!1),this.domElement.removeEventListener("touchstart",Ue,!1),this.domElement.removeEventListener("touchmove",$e,!1),this.domElement.removeEventListener("touchend",at,!1),this.domElement.removeEventListener("wheel",Dt,!1),this.domElement.removeEventListener("mouseenter",Ht,!1),this.domElement.removeEventListener("contextmenu",rt=>{rt.preventDefault()},!1))},this.loadPath=rt=>{I=rt.CameraPath,B=rt.NumberOfPoints},this.loadPathURL=(rt,Et)=>{var kt=new XMLHttpRequest;kt.onreadystatechange=()=>{if(kt.readyState==4&&kt.status==200){var $t=JSON.parse(kt.responseText);this.loadPath($t),Et!=null&&typeof Et=="function"&&Et()}};var or=s(rt);kt.open("GET",or,!0),kt.send()},this.setPathDuration=rt=>{A=rt,K&&K.setDuration(A),U&&U.setDuration(A)},this.getPlayRate=()=>j,this.setPlayRate=rt=>{j=rt};var Wt=rt=>{var Et=N+rt;Et>A&&(Et-=A),N=Et};this.getTime=()=>N,this.setTime=rt=>{N=rt>A?A:0>rt?0:rt},this.getNumberOfTimeFrame=()=>B,this.getCurrentTimeFrame=()=>{if(2<B){var rt=N/A*(B-1),Et=Math.floor(rt),kt=Math.ceil(rt);return Et==kt?Et==B-1?[Et-1,kt,0]:[Et,kt+1,1]:[Et,kt,1-(rt-Et)]}return B==1?[0,0,0]:void 0},this.setCurrentTimeFrame=rt=>{2<B&&(N=A*rt/(B-1),0>N&&(N=0),N>A&&(N=A))};var Jt=rt=>{if(Z===L.PATH&&(Wt(rt),I)){for(var Et=this.getCurrentTimeFrame(),kt=Et[0],or=Et[1],$t=Et[2],wt=[I[3*kt],I[3*kt+1],I[3*kt+2]],je=[I[3*or],I[3*or+1],I[3*or+2]],ke=[],Oe=0;Oe<wt.length;Oe++)ke.push($t*wt[Oe]+(1-$t)*je[Oe]);this.cameraObject.position.set(ke[0],ke[1],ke[2]),this.cameraObject.target.set(je[0],je[1],je[2]),G&&this.cameraObject.lookAt(this.cameraObject.target),F&&(this.directionalLight.position.set(ke[0],ke[1],ke[2]),this.directionalLight.target.position.set(je[0],je[1],je[2]))}};this.calculatePathNow=()=>{Jt(0)};var Pt=()=>{this._state===w.ROTATE||this._state===w.TOUCH_ROTATE?Je():this._state===w.PAN||this._state===w.TOUCH_PAN?(Gt(),et.triggerCallback()):(this._state===w.ZOOM||this._state===w.TOUCH_ZOOM||this._state===w.SCROLL)&&(et.zoom(ft()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,this._state===w.SCROLL&&(this._state=w.NONE),ee=0,et.triggerCallback())};this.update=rt=>{var Et=rt*j,kt=O;Z===L.PATH?Jt(Et):Z===L.SMOOTH_CAMERA_TRANSITION&&K?(K.update(Et),K.isTransitionCompleted()&&(Z=L.DEFAULT),kt=!1):Z===L.ROTATE_CAMERA_TRANSITION&&U?(U.update(Et),U.isTransitionCompleted()&&(Z=L.DEFAULT),kt=!1):Z===L.AUTO_TUMBLE&&X?X.update(Et):Z===L.SYNC_CONTROL&&et&&(Pt(),kt=!1),kt&&(this._state===w.ROTATE||this._state===w.TOUCH_ROTATE?Je():this._state===w.PAN||this._state===w.TOUCH_PAN?Gt():(this._state===w.ZOOM||this._state===w.TOUCH_ZOOM||this._state===w.SCROLL)&&St(),this._state!==w.NONE&&Z===L.AUTO_TUMBLE&&X&&X.stopOnCameraInput,this._state===w.SCROLL&&(this._state=w.NONE)),G?G.update():this.cameraObject.lookAt(this.cameraObject.target)},this.playPath=()=>{Z=L.PATH},this.stopPath=()=>{Z=L.DEFAULT},this.isPlayingPath=()=>Z===L.PATH,this.enableDirectionalLightUpdateWithPath=rt=>{F=rt},this.enableDeviceOrientation=()=>{G||(G=new g(this.cameraObject))},this.disableDeviceOrientation=()=>{G&&(G.dispose(),G=void 0)},this.isDeviceOrientationEnabled=()=>!!G,this.resetView=()=>{var rt=Ne[P];this.cameraObject.near=rt.nearPlane,this.cameraObject.far=rt.farPlane,this.cameraObject.position.set(rt.eyePosition[0],rt.eyePosition[1],rt.eyePosition[2]),this.cameraObject.target.set(rt.targetPosition[0],rt.targetPosition[1],rt.targetPosition[2]),this.cameraObject.up.set(rt.upVector[0],rt.upVector[1],rt.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=rt=>{rt.nearPlane&&(this.cameraObject.near=rt.nearPlane),rt.farPlane&&(this.cameraObject.far=rt.farPlane),rt.eyePosition&&this.cameraObject.position.set(rt.eyePosition[0],rt.eyePosition[1],rt.eyePosition[2]),rt.targetPosition&&this.cameraObject.target.set(rt.targetPosition[0],rt.targetPosition[1],rt.targetPosition[2]),rt.upVector&&this.cameraObject.up.set(rt.upVector[0],rt.upVector[1],rt.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.getViewportFromCentreAndRadius=(rt,Et,kt,or,$t,wt)=>{var je=this.cameraObject.position.x-this.cameraObject.target.x,ke=this.cameraObject.position.y-this.cameraObject.target.y,Oe=this.cameraObject.position.z-this.cameraObject.target.z,Ye=1/Math.sqrt(je*je+ke*ke+Oe*Oe);je*=Ye,ke*=Ye,Oe*=Ye;var ve=or/Math.tan($t*Math.PI/360),Ae=[rt+je*ve,Et+ke*ve,kt+Oe*ve],Re=0,Se=.95;Re=wt>Se*ve?(1-Se)*ve:ve-wt;var ge=new l;return ge.nearPlane=Re,ge.farPlane=ve+wt,ge.eyePosition=Ae,ge.targetPosition=[rt,Et,kt],ge.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],ge},this.getCurrentViewport=()=>{var rt=new l;return rt.nearPlane=this.cameraObject.near,rt.farPlane=this.cameraObject.far,rt.eyePosition[0]=this.cameraObject.position.x,rt.eyePosition[1]=this.cameraObject.position.y,rt.eyePosition[2]=this.cameraObject.position.z,rt.targetPosition[0]=this.cameraObject.target.x,rt.targetPosition[1]=this.cameraObject.target.y,rt.targetPosition[2]=this.cameraObject.target.z,rt.upVector[0]=this.cameraObject.up.x,rt.upVector[1]=this.cameraObject.up.y,rt.upVector[2]=this.cameraObject.up.z,rt},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(rt,Et,kt)=>{U==null&&(K=new u(rt,Et,this,kt))},this.rotateCameraTransition=(rt,Et,kt)=>{K==null&&(U=new d(rt,Et,this,kt))},this.enableCameraTransition=()=>{K&&(Z=L.SMOOTH_CAMERA_TRANSITION),U&&(Z=L.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{Z=L.DEFAULT},this.stopCameraTransition=()=>{Z=L.DEFAULT,K=void 0,U=void 0},this.isTransitioningCamera=()=>Z===L.SMOOTH_CAMERA_TRANSITION||Z===L.ROTATE_CAMERA_TRANSITION,this.autoTumble=(rt,Et,kt)=>{X=new h(rt,Et,kt,this)},this.enableAutoTumble=()=>{Z=L.AUTO_TUMBLE},this.stopAutoTumble=()=>{Z=L.DEFAULT,X=void 0},this.updateAutoTumble=()=>{X&&(X.requireUpdate=!0)},this.isAutoTumble=()=>Z===L.AUTO_TUMBLE,this.enableRaycaster=(rt,Et,kt)=>{he==null&&(he=new p(rt,this.scene,Et,kt,this.renderer))},this.disableRaycaster=()=>{he.disable(),he=void 0},this.isSyncControl=()=>currentMpde===L.SYNC_CONTROL,this.enableSyncControl=()=>(Z=L.SYNC_CONTROL,et||(et=new T),et.setCurrentCameraSettings(this.cameraObject,Ne[P]),et),this.disableSyncControl=()=>{Z=L.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},u=function(y,v,_,b){var L=y.eyePosition,w=y.targetPosition,k=y.upVector,C=v.eyePosition,A=v.targetPosition,O=v.upVector,N=_,I=b,B=0,F=!1;N.near=Math.min(y.nearPlane,v.nearPlane),N.far=Math.max(y.farPlane,v.farPlane),N.cameraObject.up.set(v.upVector[0],v.upVector[1],v.upVector[2]),this.setDuration=P=>{I=P};var j=P=>{var Z=B+P;Z>I&&(Z=I),B=Z},G=()=>{var P=B/I,Z=[L[0]*(1-P)+C[0]*P,L[1]*(1-P)+C[1]*P,L[2]*(1-P)+C[2]*P],K=[w[0]*(1-P)+A[0]*P,w[1]*(1-P)+A[1]*P,w[2]*(1-P)+A[2]*P];k[0]*(1-P)+O[0]*P,k[1]*(1-P)+O[1]*P,k[2]*(1-P)+O[2]*P,N.cameraObject.position.set(Z[0],Z[1],Z[2]),N.cameraObject.target.set(K[0],K[1],K[2])};this.update=P=>{this.enabled===!1||(j(P),G(),B==I&&(F=!0))},this.isTransitionCompleted=()=>F},d=function(y,v,_,b){var L=b,w=0,k=!1;this.setDuration=A=>{L=A};var C=A=>{var O=w,N=w+A;N>L&&(N=L),w=N;var I=w-O,B=I/L;_.rotateAboutLookAtpoint(y,B*v)};this.update=A=>{this.enabled===!1||(C(A),w==L&&(k=!0))},this.isTransitionCompleted=()=>k},p=function(y,v,_,b,L){var w=y,k=L,C=_,A=b,O=new o.Raycaster;O.params.Line.threshold=.1,O.params.Points.threshold=.1;var N=new o.Vector2,I=!1,B=new Date,F=!1,j=0,G=[],P={zincCamera:void 0,x:-1,y:-1};this.enable=()=>{enable=!0},this.disable=()=>{enable=!1};var Z=(X,ee,oe)=>{if(X.getNDCFromDocumentCoords(ee,oe,N),v!==w){var he=w.getThreeJSScene();k.render(he,X.cameraObject)}O.setFromCamera(N,X.cameraObject);var me=w.getPickableThreeJSObjects();return G.length=0,O.intersectObjects(me,!0,G)};this.pick=(X,ee,oe)=>{k&&w&&X&&C&&(Z(X,ee,oe),C(G,ee,oe))};var K=(X,ee,oe)=>{if(k&&w&&X&&A){if(Z(X,ee,oe),B.setTime(Date.now()),G.length===0){if(F)return;F=!0}else F=!1;A(G,ee,oe)}};this.move=(X,ee,oe)=>{k&&w&&X&&A&&(w.displayMarkers?K(X,ee,oe):(P.zincCamera=X,P.x=ee,P.y=oe,!I&&(j=B?Date.now()-B.getTime():250,250<=j?K(X,ee,oe):(I=!0,setTimeout(U(P),j)))))};var U=X=>function(){I=!1,K(X.zincCamera,X.x,X.y)}},h=function(y,v,_,b){var L=new o.Vector3,w=b;this.stopOnCameraInput=_,this.requireUpdate=!0;var k=new o.Vector3,C=new o.Vector3,A=O=>{var N=Math.sqrt(O[0]*O[0]+O[1]*O[1]),I=4*Math.abs(O[0]),B=4*Math.abs(O[1]),F=.25*(I+B),j=-O[1]/N,G=O[0]/N,P=j*O[0]+G*-O[1];P>F?P=F:P<-F&&(P=-F);var Z=Math.acos(P/F)-.5*Math.PI;L.copy(w.cameraObject.position).sub(w.cameraObject.target).normalize(),k.copy(w.cameraObject.up).normalize(),C.crossVectors(k,L).normalize().multiplyScalar(j),k.multiplyScalar(G),k.add(C).multiplyScalar(Math.cos(Z)),L.multiplyScalar(Math.sin(Z)).add(k)};this.update=O=>{this.enabled===!1||(this.requireUpdate&&(A(y),this.requireUpdate=!1),w.rotateAboutLookAtpoint(L,-v*O/1e3))}},f=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new o.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new o.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(f.prototype,{update:(()=>{var y,v,_,b,L,w,k=new o.Matrix4,C=new o.Matrix4;return function(A){var O=y!==A.focus||v!==A.fov||_!==A.aspect*this.aspect||b!==A.near||L!==A.far||w!==A.zoom;if(O){y=A.focus,v=A.fov,_=A.aspect*this.aspect,b=A.near,L=A.far,w=A.zoom;var N,I,B=A.projectionMatrix.clone(),F=.064/2,j=F*b/y,G=b*Math.tan(.5*(o.Math.DEG2RAD*v))/A.zoom;C.elements[12]=-F,k.elements[12]=F,N=-G*_+j,I=G*_+j,B.elements[0]=2*b/(I-N),B.elements[8]=(I+N)/(I-N),this.cameraL.projectionMatrix.copy(B),N=-G*_-j,I=G*_-j,B.elements[0]=2*b/(I-N),B.elements[8]=(I+N)/(I-N),this.cameraR.projectionMatrix.copy(B)}this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(C),this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(k)}})()});var m=function(y){var v=new f;v.aspect=.5,this.setSize=(_,b)=>{y.setSize(_,b)},this.render=(_,b)=>{_.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),v.update(b);var L=y.getSize();y.setScissorTest(!0),y.clear(),y.setScissor(0,0,L.width/2,L.height),y.setViewport(0,0,L.width/2,L.height),y.render(_,v.cameraL),y.setScissor(L.width/2,0,L.width/2,L.height),y.setViewport(L.width/2,0,L.width/2,L.height),y.render(_,v.cameraR),y.setScissorTest(!1)}},g=function(y){var v=this;this.object=y,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var _=w=>{v.deviceOrientation=w},b=()=>{typeof window<"u"&&(v.screenOrientation=window.orientation||0)},L=(()=>{var w=new o.Vector3(0,0,1),k=new o.Euler,C=new o.Quaternion,A=new o.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(O,N,I,B,F)=>{var j=new o.Vector3(0,0,1);j.subVectors(O.target,O.position),k.set(I,N,-B,"YXZ");var G=new o.Quaternion;G.setFromEuler(k),G.multiply(A),G.multiply(C.setFromAxisAngle(w,-F)),j.applyQuaternion(G),j.addVectors(O.position,j),O.lookAt(j)}})();this.connect=()=>{b(),typeof window<"u"&&(window.addEventListener("orientationchange",b,!1),window.addEventListener("deviceorientation",_,!1)),v.enabled=!0},this.disconnect=()=>{typeof window<"u"&&(window.removeEventListener("orientationchange",b,!1),window.removeEventListener("deviceorientation",_,!1)),v.enabled=!1},this.update=()=>{if(v.enabled!==!1){var w=v.deviceOrientation.alpha?o.Math.degToRad(v.deviceOrientation.alpha):0,k=v.deviceOrientation.beta?o.Math.degToRad(v.deviceOrientation.beta):0,C=v.deviceOrientation.gamma?o.Math.degToRad(v.deviceOrientation.gamma):0,A=v.screenOrientation?o.Math.degToRad(v.screenOrientation):0;L(v.object,w,k,C,A)}},this.dispose=function(){this.disconnect()},this.connect()},T=function(){var y=void 0,v=void 0,_=void 0,b=new o.Vector3,L=new o.Vector3,w=new o.Vector3,k=new o.Vector3,C=void 0;this.setCurrentCameraSettings=(A,O)=>{y=A.clone(),v=A,_=O,y.near=_.nearPlane,_.farPlane&&(y.far=_.farPlane),_.eyePosition&&y.position.set(_.eyePosition[0],_.eyePosition[1],_.eyePosition[2]),_.upVector&&y.up.set(_.upVector[0],_.upVector[1],_.upVector[2]),_.targetPosition&&(y.target=new o.Vector3(_.targetPosition[0],_.targetPosition[1],_.targetPosition[2]),y.lookAt(y.target)),y.updateProjectionMatrix(),b.copy(y.position).project(y),L.copy(y.target).project(y)},this.getCurrentPosition=()=>(L.copy(v.target).project(y),[L.x,L.y]),this.zoom=A=>{var O=Math.max(v.zoom-.002*A,1);v.zoom=O,v.updateProjectionMatrix()},this.zoomToBox=(A,O)=>{A.getCenter(w),w.project(y),this.setCenterZoom([w.x,w.y],O)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:v.zoom}),this.setCenterZoom=(A,O)=>{w.set(A[0],A[1],L.z).unproject(y),k.copy(w).sub(v.target),v.target.copy(w),v.lookAt(v.target),v.position.add(k),v.zoom=O,v.updateProjectionMatrix()},this.setEventCallback=A=>{(A===void 0||typeof A=="function")&&(C=A)},this.triggerCallback=()=>{C!==void 0&&typeof C=="function"&&C()}};n.Viewport=l,n.CameraControls=c,n.SmoothCameraTransition=u,n.RotateCameraTransition=d,n.RayCaster=p,n.CameraAutoTumble=h,n.StereoEffect=m,n.NDCCameraControl=T},function(r,n,i){var{Group:o,Matrix4:s}=i(3),l=0,c=function(){return"re"+l++},u=function(d){var p=d,h=new o;h.matrixAutoUpdate=!1,h.userData=this;var f=[],m="",g=[],T=new s,y=3e3;T.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=c(),this.hideAllPrimitives=()=>{f.forEach(v=>v.hideAllPrimitives()),g.forEach(v=>v.setVisibility(!1))},this.showAllPrimitives=()=>{f.forEach(v=>v.showAllPrimitives()),g.forEach(v=>v.setVisibility(!0))},this.setVisibility=v=>{h.visible=v},this.getVisibility=()=>h.visible,this.getGroup=()=>h,this.setTransformation=v=>{T.set(...v),h.matrix.copy(T),h.updateMatrixWorld()},this.setName=v=>{v&&v!==""&&(m=v)},this.getName=()=>m,this.getParent=()=>p,this.getFullSeparatedPath=()=>{var v=[];if(m!==""){v.push(m);for(var _,b=p;b!==void 0;)_=b.getName(),_!==""&&v.unshift(_),b=b.getParent()}return v},this.getFullPath=()=>{var v=this.getFullSeparatedPath();if(0<v.length){var _=v.shift();return v.forEach(b=>{_=_.concat("/",b)}),_}return""},this.createChild=v=>{var _=new u(this);return _.setName(v),f.push(_),h.add(_.getGroup()),_},this.getChildWithName=v=>{if(v){for(var _=v.toLowerCase(),b=0;b<f.length;b++)if(f[b].getName().toLowerCase()===_)return f[b]}},this.findChildFromSeparatedPath=v=>{if(v&&0<v.length&&v[0]===""&&v.shift(),v&&0<v.length){var _=this.getChildWithName(v[0]);return _?(v.shift(),_.findChildFromSeparatedPath(v)):void 0}return this},this.findChildFromPath=v=>{var _=v.split("/");return this.findChildFromSeparatedPath(_)},this.createChildFromSeparatedPath=v=>{if(0<v.length&&v[0]===""&&v.shift(),0<v.length){var _=this.getChildWithName(v[0]);return _||(_=this.createChild(v[0])),v.shift(),_.createChildFromSeparatedPath(v)}return this},this.createChildFromPath=v=>{var _=v.split("/");return this.createChildFromSeparatedPath(_)},this.findOrCreateChildFromPath=v=>{var _=this.findChildFromPath(v);return _||(_=this.createChildFromPath(v)),_},this.addZincObject=v=>{v&&(v.setRegion(this),h.add(v.morph),g.push(v),this.pickableUpdateRequired=!0)},this.removeZincObject=v=>{for(var _=0;_<g.length;_++)if(v===g[_])return h.remove(v.morph),g.splice(_,1),void v.dispose()},this.checkPickableUpdateRequred=v=>{if(this.pickableUpdateRequired)return!0;if(v){for(var _=!1,b=0;b<f.length;b++)if(_=f[b].checkPickableUpdateRequred(v),_)return!0}return!1},this.getPickableThreeJSObjects=(v,_)=>(g.forEach(b=>{if(b.morph&&b.morph.visible){var L=b.marker;L&&L.isEnabled()&&v.push(L.morph),v.push(b.morph)}}),_&&f.forEach(b=>{b.getPickableThreeJSObjects(v,_)}),this.pickableUpdateRequired=!1,v),this.setDuration=v=>{y=v,g.forEach(_=>_.setDuration(v)),f.forEach(_=>_.setDuration(v))},this.getDuration=()=>y,this.getBoundingBox=v=>{var _,b;return g.forEach(L=>{b=L.getBoundingBox(),b&&(_==null?_=b.clone():_.union(b))}),v&&f.forEach(L=>{b=L.getBoundingBox(v),b&&(_==null?_=b.clone():_.union(b))}),_},this.clear=v=>{v&&f.forEach(_=>_.clear(v)),g.forEach(_=>{h.remove(_.morph),_.dispose()}),f=[],g=[]},this.objectIsInRegion=(v,_)=>{for(var b=0;b<g.length;b++)if(v===g[b])return!0;if(_){for(var L=0;L<f.length;L++)if(f[L].objectIsInRegion(v,_))return!0}return!1},this.forEachGeometry=(v,_)=>{g.forEach(b=>{b.isGeometry&&v(b)}),_&&f.forEach(b=>b.forEachGeometry(v,_))},this.forEachGlyphset=(v,_)=>{g.forEach(b=>{b.isGlyphset&&v(b)}),_&&f.forEach(b=>b.forEachGlyphset(v,_))},this.forEachPointset=(v,_)=>{g.forEach(b=>{b.isPointset&&v(b)}),_&&f.forEach(b=>b.forEachPointset(v,_))},this.forEachLine=(v,_)=>{g.forEach(b=>{b.isLines&&v(b)}),_&&f.forEach(b=>b.forEachLine(v,_))},this.findObjectsWithAnatomicalId=(v,_)=>(g.forEach(b=>{b.anatomicalId===v&&objectsArray.push(b)}),_&&f.forEach(b=>{var L=b.findObjectsWithAnatomicalId(v,_);objectsArray.push(...L)}),objectsArray),this.findObjectsWithGroupName=(v,_)=>{var b=[];return g.forEach(L=>{var w=L.groupName?L.groupName.toLowerCase():L.groupName,k=v&&v.toLowerCase();w===k&&b.push(L)}),_&&f.forEach(L=>{var w=L.findObjectsWithGroupName(v,_);b.push(...w)}),b},this.findGeometriesWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isGeometry);return L},this.findPointsetsWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isPointset);return L},this.findGlyphsetsWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isGlyphset);return L},this.findLinesWithGroupName=(v,_)=>{var b=this.findObjectsWithGroupName(v,_),L=b.filter(w=>w.isLines);return L},this.getAllObjects=v=>{var _=[...g];return v&&f.forEach(b=>{var L=b.getAllObjects(v);_.push(...L)}),_},this.getChildRegions=v=>{var _=[...f];return v&&f.forEach(b=>{var L=b.getChildRegions(v);_.push(...L)}),_},this.getCurrentTime=()=>{if(g[0]!=null)return g[0].getCurrentTime();for(var v,_=0;_<f.length;_++)if(v=f[_].getCurrentTime(),v!==-1)return v;return-1},this.setMorphTime=(v,_)=>{g.forEach(b=>{b.setMorphTime(v)}),_&&f.forEach(b=>{b.setMorphTime(v)})},this.isTimeVarying=()=>{for(var v=0;v<g.length;v++)if(g[v].isTimeVarying())return!0;for(var _=0;_<f.length;_++)if(f[_].isTimeVarying())return!0;return!1},this.renderGeometries=(v,_,b,L,w)=>{var k=this.getAllObjects(w);if(k.forEach(O=>{O.render(v*_,b,L)}),L&&L.displayMarkers&&b===!1&&0<L.markerDepths.length){var C=Math.min(...L.markerDepths),A=Math.max(...L.markerDepths);k.forEach(O=>{O.processMarkerVisual(C,A,L)})}}};n.Region=u},function(r,n,i){var o=i(3);n.Minimap=function(s){var l=s;this.camera=new o.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var c=new o.BufferGeometry,u=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),d=new o.BufferAttribute(u,3);c.setAttribute("position",d);var p=new o.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new o.Mesh(c,p);var h=new o.Box3,f=new o.Vector3;this.getDiffFromNormalised=(g,T)=>{h.setFromBufferAttribute(d).getCenter(f);var y=f.clone().project(this.camera),v=new o.Vector3(g,T,y.z).unproject(this.camera);return v.sub(f)};var m=(g,T)=>{l.camera.near&&(this.camera.near=l.camera.near),T.farPlane&&(this.camera.far=T.farPlane),T.eyePosition&&this.camera.position.set(T.eyePosition[0],T.eyePosition[1],T.eyePosition[2]),T.upVector&&this.camera.up.set(T.upVector[0],T.upVector[1],T.upVector[2]),T.targetPosition&&this.camera.lookAt(new o.Vector3(T.targetPosition[0],T.targetPosition[1],T.targetPosition[2])),this.camera.zoom=1/g,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var g=new o.Vector3().copy(l.camera.target).project(l.camera),T=new o.Vector3(-1,-1,g.z).unproject(l.camera),y=new o.Vector3(1,-1,g.z).unproject(l.camera),v=new o.Vector3(1,1,g.z).unproject(l.camera),_=new o.Vector3(-1,1,g.z).unproject(l.camera);d.copyVector3sArray([T,y,v,v,_,T]),d.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var g=l.getZincCameraControls(),T=l.getBoundingBox();if(T){var y=T.min.distanceTo(T.max),v=y/2,_=(T.min.x+T.max.x)/2,b=(T.min.y+T.max.y)/2,L=(T.min.z+T.max.z)/2,w=g.getViewportFromCentreAndRadius(_,b,L,v,40,v*4);m(y,w)}}}},function(r,n,i){var o=i(3),s=i(43)(o),l=i(2).Geometry,c=i(44),u=i(45).default,d=o.BufferGeometryLoader,p=function(h){var f;h&&h.isGeometry&&(f=h);var m=void 0,g=void 0,T=!1,y=void 0,v=k=>{var C=f.morph.material.clone();C.morphTargets=!1;var A=new l,O=new d,N=O.parse(k),I=new o.Mesh(N.geometry,C);return A.geometry=I.geometry,A.morph=I,A.morph.userData=A,A},_=k=>{switch(k.data.action){case"message":console.log(k.data.message);break;case"result":var C=new p(v(k.data.object));y&&y(C),y=void 0,T=!1;break;default:throw"Cannot handle specified action."}},b=k=>{if(c!==void 0&&(g=c(46)),!g)m=new(i(47)).GeometryCSGInternal(k);else if(k&&k.isGeometry){var C=k.morph,A=C.geometry.clone().applyMatrix(C.matrix).toJSON();g.addEventListener("message",function(O){_(O)}),g.postMessage({action:"initialise",object:A})}};this.getHostGeometry=()=>{var k=new s(f.morph);return new L(k)},this.getGeometry=()=>f;var L=k=>{var C=f.morph.material.clone();C.morphTargets=!1;var A=k.toMesh(C),O=new l;return O.geometry=A.geometry,O.morph=A,O.morph.userData=O,O};this.setCSG=k=>{m.setCSG(k)};var w=(k,C,A,O)=>{if(T)O("On progress");else{var N=k.morph,I=N.geometry.clone().applyMatrix(N.matrix).toJSON();y=A,T=!0,g.postMessage({action:C,object:I})}};this.intersect=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.intersect(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.subtract=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.subtract(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.union=k=>new u((C,A)=>{if(g)w(k,"intersect",C,A);else{var O=m.union(k),N=new p(L(O));N.setCSG(O),C(N)}}),this.terminateWorker=()=>{g&&g.terminate()},b(h)};n.GeometryCSG=p},function(r,n,i){var o=1e-5,s=0,l=1,c=2,u=3;r.exports=function(d){var p=function(h){var f,m,g,T,y,v,_,b=[];if(h.isBufferGeometry&&(h=new d.Geometry().fromBufferGeometry(h)),h instanceof d.Geometry)this.matrix=new d.Matrix4;else if(h.isMesh)h.updateMatrix(),this.matrix=h.matrix.clone(),h=h.geometry,h.isBufferGeometry&&(h=new d.Geometry().fromBufferGeometry(h)),h.mergeVertices(),h.computeVertexNormals(!1);else{if(h instanceof p.Node)return this.tree=h,this.matrix=new d.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported"}for(f=0,m=h.faces.length;f<m;f++)g=h.faces[f],y=h.faceVertexUvs[0][f],_=new p.Polygon,g instanceof d.Face3?(T=h.vertices[g.a],v=y?new d.Vector2(y[0].x,y[0].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[0],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.b],v=y?new d.Vector2(y[1].x,y[1].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.c],v=y?new d.Vector2(y[2].x,y[2].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T)):(d.Face4,T=h.vertices[g.a],v=y?new d.Vector2(y[0].x,y[0].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[0],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.b],v=y?new d.Vector2(y[1].x,y[1].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[1],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.c],v=y?new d.Vector2(y[2].x,y[2].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[2],v),T.applyMatrix4(this.matrix),_.vertices.push(T),T=h.vertices[g.d],v=y?new d.Vector2(y[3].x,y[3].y):null,T=new p.Vertex(T.x,T.y,T.z,g.vertexNormals[3],v),T.applyMatrix4(this.matrix),_.vertices.push(T)),_.calculateProperties(),b.push(_);this.tree=new p.Node(b)};return p.prototype.subtract=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.invert(),f.clipTo(m),m.clipTo(f),m.invert(),m.clipTo(f),m.invert(),f.build(m.allPolygons()),f.invert(),f=new p(f),f.matrix=this.matrix,f},p.prototype.union=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.clipTo(m),m.clipTo(f),m.invert(),m.clipTo(f),m.invert(),f.build(m.allPolygons()),f=new p(f),f.matrix=this.matrix,f},p.prototype.intersect=function(h){var f=this.tree.clone(),m=h.tree.clone();return f.invert(),m.clipTo(f),m.invert(),f.clipTo(m),m.clipTo(f),f.build(m.allPolygons()),f.invert(),f=new p(f),f.matrix=this.matrix,f},p.prototype.toGeometry=function(){var h,f,m,g,T,y,v,_,b,L,w=new d.Matrix4().getInverse(this.matrix),k=new d.Geometry,C=this.tree.allPolygons(),A=C.length,O={};for(h=0;h<A;h++)for(m=C[h],g=m.vertices.length,f=2;f<g;f++)L=[],_=m.vertices[0],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),T=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):T=O[_.x+","+_.y+","+_.z],_=m.vertices[f-1],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),y=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):y=O[_.x+","+_.y+","+_.z],_=m.vertices[f],L.push(new d.Vector2(_.uv.x,_.uv.y)),_=new d.Vector3(_.x,_.y,_.z),_.applyMatrix4(w),typeof O[_.x+","+_.y+","+_.z]>"u"?(k.vertices.push(_),v=O[_.x+","+_.y+","+_.z]=k.vertices.length-1):v=O[_.x+","+_.y+","+_.z],b=new d.Face3(T,y,v,new d.Vector3(m.normal.x,m.normal.y,m.normal.z)),k.faces.push(b),k.faceVertexUvs[0].push(L);return k},p.prototype.toBufferGeometry=function(){var h=this.toGeometry(),f=new d.BufferGeometry().fromGeometry(h);return f},p.prototype.toMesh=function(h){var f=this.toBufferGeometry(),m=new d.Mesh(f,h);return m.position.setFromMatrixPosition(this.matrix),m.rotation.setFromRotationMatrix(this.matrix),m},p.Polygon=function(h){h instanceof Array||(h=[]),this.vertices=h,0<h.length?this.calculateProperties():this.normal=this.w=void 0},p.Polygon.prototype.calculateProperties=function(){var h=this.vertices[0],f=this.vertices[1],m=this.vertices[2];return this.normal=f.clone().subtract(h).cross(m.clone().subtract(h)).normalize(),this.w=this.normal.clone().dot(h),this},p.Polygon.prototype.clone=function(){var h,f,m=new p.Polygon;for(h=0,f=this.vertices.length;h<f;h++)m.vertices.push(this.vertices[h].clone());return m.calculateProperties(),m},p.Polygon.prototype.flip=function(){var h,f=[];for(this.normal.multiplyScalar(-1),this.w*=-1,h=this.vertices.length-1;0<=h;h--)f.push(this.vertices[h]);return this.vertices=f,this},p.Polygon.prototype.classifyVertex=function(h){var f=this.normal.dot(h)-this.w;return f<-o?c:f>o?l:s},p.Polygon.prototype.classifySide=function(h){var f,m,g,T=0,y=0,v=h.vertices.length;for(f=0;f<v;f++)m=h.vertices[f],g=this.classifyVertex(m),g===l?T++:g===c&&y++;return 0<T&&y===0?l:T===0&&0<y?c:T===0&&y===0?s:u},p.Polygon.prototype.splitPolygon=function(h,f,m,g,T){var y=this.classifySide(h);if(y===s)(0<this.normal.dot(h.normal)?f:m).push(h);else if(y===l)g.push(h);else if(y===c)T.push(h);else{var v,_,b,L,w,k,C,A,O,N=[],I=[];for(_=0,v=h.vertices.length;_<v;_++)b=(_+1)%v,k=h.vertices[_],C=h.vertices[b],L=this.classifyVertex(k),w=this.classifyVertex(C),L!=c&&N.push(k),L!=l&&I.push(k),(L|w)===u&&(A=(this.w-this.normal.dot(k))/this.normal.dot(C.clone().subtract(k)),O=k.interpolate(C,A),N.push(O),I.push(O));3<=N.length&&g.push(new p.Polygon(N).calculateProperties()),3<=I.length&&T.push(new p.Polygon(I).calculateProperties())}},p.Vertex=function(h,f,m,g,T){this.x=h,this.y=f,this.z=m,this.normal=g||new d.Vector3,this.uv=T||new d.Vector2},p.Vertex.prototype.clone=function(){return new p.Vertex(this.x,this.y,this.z,this.normal.clone(),this.uv.clone())},p.Vertex.prototype.add=function(h){return this.x+=h.x,this.y+=h.y,this.z+=h.z,this},p.Vertex.prototype.subtract=function(h){return this.x-=h.x,this.y-=h.y,this.z-=h.z,this},p.Vertex.prototype.multiplyScalar=function(h){return this.x*=h,this.y*=h,this.z*=h,this},p.Vertex.prototype.cross=function(h){var f=this.x,m=this.y,g=this.z;return this.x=m*h.z-g*h.y,this.y=g*h.x-f*h.z,this.z=f*h.y-m*h.x,this},p.Vertex.prototype.normalize=function(){var h=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=h,this.y/=h,this.z/=h,this},p.Vertex.prototype.dot=function(h){return this.x*h.x+this.y*h.y+this.z*h.z},p.Vertex.prototype.lerp=function(h,f){return this.add(h.clone().subtract(this).multiplyScalar(f)),this.normal.add(h.normal.clone().sub(this.normal).multiplyScalar(f)),this.uv.add(h.uv.clone().sub(this.uv).multiplyScalar(f)),this},p.Vertex.prototype.interpolate=function(h,f){return this.clone().lerp(h,f)},p.Vertex.prototype.applyMatrix4=function(h){var f=this.x,m=this.y,g=this.z,T=h.elements;return this.x=T[0]*f+T[4]*m+T[8]*g+T[12],this.y=T[1]*f+T[5]*m+T[9]*g+T[13],this.z=T[2]*f+T[6]*m+T[10]*g+T[14],this},p.Node=function(h){var f,m,g=[],T=[];if(this.polygons=[],this.front=this.back=void 0,h instanceof Array&&h.length!==0){for(this.divider=h[0].clone(),f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],this.polygons,this.polygons,g,T);0<g.length&&(this.front=new p.Node(g)),0<T.length&&(this.back=new p.Node(T))}},p.Node.isConvex=function(h){var f,m;for(f=0;f<h.length;f++)for(m=0;m<h.length;m++)if(f!==m&&h[f].classifySide(h[m])!==c)return!1;return!0},p.Node.prototype.build=function(h){var f,m,g=[],T=[];for(this.divider||(this.divider=h[0].clone()),f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],this.polygons,this.polygons,g,T);0<g.length&&(!this.front&&(this.front=new p.Node),this.front.build(g)),0<T.length&&(!this.back&&(this.back=new p.Node),this.back.build(T))},p.Node.prototype.allPolygons=function(){var h=this.polygons.slice();return this.front&&(h=h.concat(this.front.allPolygons())),this.back&&(h=h.concat(this.back.allPolygons())),h},p.Node.prototype.clone=function(){var h=new p.Node;return h.divider=this.divider.clone(),h.polygons=this.polygons.map(function(f){return f.clone()}),h.front=this.front&&this.front.clone(),h.back=this.back&&this.back.clone(),h},p.Node.prototype.invert=function(){var h,f,m;for(h=0,f=this.polygons.length;h<f;h++)this.polygons[h].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),m=this.front,this.front=this.back,this.back=m,this},p.Node.prototype.clipPolygons=function(h){var f,m,g,T;if(!this.divider)return h.slice();for(g=[],T=[],f=0,m=h.length;f<m;f++)this.divider.splitPolygon(h[f],g,T,g,T);return this.front&&(g=this.front.clipPolygons(g)),T=this.back?this.back.clipPolygons(T):[],g.concat(T)},p.Node.prototype.clipTo=function(h){this.polygons=h.clipPolygons(this.polygons),this.front&&this.front.clipTo(h),this.back&&this.back.clipTo(h)},p}},function(r,n){r.exports=i8r()},function(r,n){r.exports=h8r},function(r,n,i){var o=i(2).Geometry,s=i(3),l=s.BufferGeometryLoader;r.exports=function(c){var u=void 0,d=function(g){var T=new l,y=T.parse(g),v=new s.MeshPhongMaterial,_=new s.Mesh(y.geometry,v),b=new o;return b.morph=_,b},p=function(g){var T=d(g);u=new(i(47)).GeometryCSGInternal(T),c.postMessage({action:"message",message:"Initialised"})},h=function(g){if(u){var T=d(g),y=u.intersect(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}},f=function(g){if(u){var T=d(g),y=u.subtract(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}},m=function(g){if(u){var T=d(g),y=u.union(T),v=y.toBufferGeometry().toJSON();c.postMessage({action:"result",object:v})}};c.addEventListener("message",function(g){switch(g.data.action){case"initialise":p(g.data.object);break;case"intersect":h(g.data.object);break;case"subtract":f(g.data.object);break;case"union":m(g.data.object);break;default:throw"Cannot handle specified action."}})}},function(r,n,i){var o=i(3),s=i(43)(o);i(2).Geometry,i(42).GeometryCSG;var l=function(c){var u;c&&c.isGeometry&&(u=c);var d;this.setGeometry=h=>{h&&h.isGeometry&&(u=h),d=void 0},this.setCSG=h=>{d=h};var p=h=>{if(u&&u.morph&&h&&h.morph){d===void 0&&(d=new s(u.morph));var f=new s(h.morph);return f}};this.intersect=h=>{var f=p(h);return d&&f?d.intersect(f):void 0},this.subtract=h=>{var f=p(h);return d&&f?d.subtract(f):void 0},this.union=h=>{var f=p(h);return d&&f?d.union(f):void 0}};n.GeometryCSGInternal=l},function(r,n,i){var o=i(3),s=i(43)(o);i(13).Glyphset;var l=function(c){var u;c&&c.isGlyphset&&(u=c);var d=[];this.setGlyphset=f=>{f&&f.isGlyphset&&(u=f),hostCSG=void 0},this.getGlyphset=()=>u;var p=()=>f=>{var m=f.getMesh(),g=f.getLabel();if(m){var T=new s(m.geometry.clone().applyMatrix(m.matrix)),y=[];y.csg=T,y.label=g,m.material&&(y.material=m.material.clone()),d.push(y)}},h=f=>{if(u&&f&&f.morph){d.length==0&&u.forEachGlyph(p());var m=new s(f.morph);return m}};this.intersect=f=>{var m=h(f);if(0<d.length&&m){for(var g=new(i(13)).Glyphset,T=0;T<d.length;T++){var y=d[T],v=y.csg.intersect(m),_=v.toMesh();if(_&&_.geometry&&0<_.geometry.vertices.length){y.material&&(_.material=y.material,_.material.side=o.DoubleSide,_.material.clippingPlanes=null);var b=g.addMeshAsGlyph(_,T+1);b.setLabel(y.label)}}var L=new l(g);return L}}};n.GlyphsetCSG=l}])})})(hEe);var Uv=hEe.exports;const zB=Ucr(Uv),ZVe={isWebGLAvailable:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}},isWebGL2Available:function(){try{var e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(e){var t={1:"WebGL",2:"WebGL 2"},r={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},n='This module requires <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#008">$1</a> support but your $0 does not seem to support it.',i=document.createElement("div");return i.id="webglmessage",i.style.fontFamily="monospace",i.style.fontSize="20px",i.style.fontWeight="normal",i.style.textAlign="center",i.style.background="#fff",i.style.color="#000",i.style.padding="1.5em",i.style.width="400px",i.style.margin="5em auto 0",r[e]?n=n.replace("$0","graphics card"):n=n.replace("$0","browser"),n=n.replace("$1",t[e]),i.innerHTML=n,i}},lne={ALL:0,DESTROYED:1,NAME_CHANGED:2,SETTINGS_CHANGED:3},D2=function(){this.typeName="Base Module",this.instanceName="default",this.onChangedCallbacks=[],this.eventNotifiers=[]};D2.prototype.setName=function(e){if(e&&this.instanceName!==e){this.instanceName=e;const t=this.onChangedCallbacks.slice();for(let r=0;r<t.length;r++)t[r](this,lne.NAME_CHANGED)}},D2.prototype.settingsChanged=function(){const e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,lne.SETTINGS_CHANGED)},D2.prototype.exportSettings=function(){const e={};return e.dialog=this.typeName,e.name=this.instanceName,e},D2.prototype.importSettings=function(e){return e.dialog==this.typeName?(this.setName(e.name),!0):!1},D2.prototype.publishChanges=function(e,t,r){for(let n=0;n<this.eventNotifiers.length;n++)this.eventNotifiers[n].publish(this,t,e,r)},D2.prototype.getName=function(){return this.instanceName},D2.prototype.destroy=function(){const e=this.onChangedCallbacks.slice();for(let t=0;t<e.length;t++)e[t](this,lne.DESTROYED);delete this},D2.prototype.addChangedCallback=function(e){this.onChangedCallbacks.includes(e)==!1&&this.onChangedCallbacks.push(e)},D2.prototype.removeChangedCallback=function(e){const t=this.onChangedCallbacks.indexOf(e);t>-1&&this.onChangedCallbacks.splice(t,1)},D2.prototype.addNotifier=function(e){this.eventNotifiers.push(e)};const ak={ALL:0,SELECTED:1,HIGHLIGHTED:2,MOVE:3},f8r=function(e,t,r){this.eventType=e,this.identifiers=t,this.zincObjects=r},m8r=function(e,t,r){this.targetedID=[];const n=e,i=t;this.targetEventType=r;const o=this;r===void 0&&(this.targetEventType=ak.ALL),this.getEventType=function(){return r},this.notify=function(s,l,c,u){if(s!==n&&(o.targetEventType===ak.ALL||o.targetEventType===l)){const d=new f8r(l,c,u);i(d)}}},g8r=function(){const e=[];this.publish=function(t,r,n,i){for(let o=0;o<e.length;o++)e[o].notify(t,r,n,i)},this.subscribe=function(t,r,n){if(typeof r=="function"){const i=new m8r(t,r,n);return e.push(i),i}},this.unsubscribe=function(t){for(let r=0;r<e.length;r++)if(t===e[r]){e.splice(r,1);return}}},y8r=function(){let e=[],t=[];this.highlightColour=[1,0,0],this.selectColour=[0,1,0],this.originalColour=[0,0,0];const r=[],n=[],i=this,o=function(c,u){if(c.length==0&&u.length==0)return!1;for(let d=0;d<c.length;d++){let p=!1;for(let h=0;h<u.length;h++)c[d]===u[h]&&(p=!0);if(!p)return!0}for(let d=0;d<u.length;d++){let p=!1;for(let h=0;h<c.length;h++)u[d]===c[h]&&(p=!0);if(!p)return!0}return!1},s=function(c,u){if(r.length=0,u.length==0)return c;for(let d=0;d<c.length;d++){let p=!1;for(let h=0;h<u.length;h++)c[d]===u[h]&&(p=!0);p||r.push(c[d])}return r};this.setHighlighted=function(c){const u=[...e];i.resetHighlighted();const d=s(c,t),p=l(d);for(let h=0;h<p.length;h++)p[h]&&p[h].material&&p[h].material.emissive&&p[h].material.emissive.setRGB(...i.highlightColour);return e=d,o(e,u)},this.setSelected=function(c){const u=[...t];s(e,c),i.resetHighlighted(),i.resetSelected();const d=l(c);for(let p=0;p<d.length;p++)d[p]&&d[p].material&&d[p].material.emissive&&d[p].material.emissive.setRGB(...i.selectColour);return t=c,o(t,u)};const l=function(c){n.length=0;for(let u=0;u<c.length;u++)c[u].material&&n.push(c[u]);return n};this.resetHighlighted=function(){const c=l(e);for(let u=0;u<c.length;u++)c[u]&&c[u].material&&(c[u].material.emissive&&c[u].material.emissive.setRGB(...i.originalColour),c[u].material.depthFunc&&(c[u].material.depthFunc=Uv.THREE.LessEqualDepth));e=[]},this.resetSelected=function(){const c=l(t);for(let u=0;u<c.length;u++)c[u]&&c[u].material&&(c[u].material.emissive&&c[u].material.emissive.setRGB(...i.originalColour),c[u].material.depthFunc&&(c[u].material.depthFunc=Uv.THREE.LessEqualDepth));t=[]},this.getSelected=function(){return t},this.reset=function(){i.resetSelected(),i.resetHighlighted()}},cne=zB.THREE,T8r=function(){const e=document.createElement("div");let t;if(e.style.height="100%",ZVe.isWebGLAvailable())t=new zB.Renderer(e,window),zB.defaultMaterialColor=16777116,t.initialiseVisualisation(),t.playAnimation=!1;else{const r=ZVe.getWebGLErrorMessage();e.appendChild(r)}return{Zinc:zB,renderer:t,container:e}},ts=function(){D2.call(this),this.scene=void 0,this.rendererContainer=void 0,this.displayArea=void 0,this.graphicsHighlight=new y8r,this.zincRenderer=null,this.selectedScreenCoordinates=new cne.Vector3,this.selectedCenter=void 0,this.liveUpdatesObjects=void 0};ts.prototype=Object.create(D2.prototype),ts.prototype.getIntersectedObject=function(e){if(e){const t=e.map(n=>{if(n&&n.object&&n.object.userData){if(n.object.userData.isMarker)return 1;if(n.object.name&&n.object.userData.isZincObject)return 2}return 0});let r=t.indexOf(1);return r=r>-1?r:t.indexOf(2),e[r]}},ts.prototype.getAnnotationsFromObjects=function(e){const t=[];for(var r=0;r<e.length;r++){const n=e[r].userData;let i;if(n)if(n.isGlyph||n.isGlyphset){let o=n;n.isGlyph&&(o=n.getGlyphset()),i=o.userData?o.userData.annotation:void 0,i&&i.data&&(e[r].name&&e[r].name!=""?i.data.id=e[r].name:i.data.id=o.groupName)}else i=n.userData?n.userData.annotation:void 0,i&&i.data&&(i.data.id=e[r].name);i&&t.push(i)}return t},ts.prototype.setHighlightedByObjects=function(e,t,r){const n=this.graphicsHighlight.setHighlighted(e),i=this.objectsToZincObjects(e);if(r){let o=ak.MOVE;n&&(o=ak.HIGHLIGHTED);const s=this.getAnnotationsFromObjects(e);s.length>0&&(s[0].coords=t),this.publishChanges(s,o,i)}return n},ts.prototype.setHighlightedByZincObjects=function(e,t,r){let n=[];return e&&e.forEach(i=>{i&&i.morph&&n.push(i.morph)}),this.setHighlightedByObjects(n,t,r)},ts.prototype.setupLiveCoordinates=function(e){if(this.liveUpdatesObjects=e,e&&e.length>0){const t=this.scene.getBoundingBoxOfZincObjects(e);let r=new cne.Vector3;t.getCenter(r),this.selectedCenter==null?this.selectedCenter=r:this.selectedCenter.copy(r)}else this.selectedCenter=void 0},ts.prototype.objectsToZincObjects=function(e){const t=[];for(let r=0;r<e.length;r++){let n=e[r].userData;if(n)if(n.isGlyph||n.isGlyphset){let i=n;n.isGlyph&&(i=n.getGlyphset()),t.push(i)}else t.push(n)}return t},ts.prototype.setSelectedByObjects=function(e,t,r){const n=this.graphicsHighlight.setSelected(e);if(n){const i=this.objectsToZincObjects(e);if(this.setupLiveCoordinates(i),r){const o=ak.SELECTED,s=this.getAnnotationsFromObjects(e);s.length>0&&(s[0].coords=t),this.publishChanges(s,o,i)}}return n},ts.prototype.setSelectedByZincObjects=function(e,t,r){let n=[];return e&&e.forEach(i=>{i&&i.morph&&n.push(i.morph)}),this.setSelectedByObjects(n,t,r)};const v8r=function(e){return function(t){e.push(t.getMesh())}};ts.prototype.findObjectsByGroupName=function(e){const t=this.scene.findGeometriesWithGroupName(e),r=[];for(let i=0;i<t.length;i++)r.push(t[i].morph);const n=this.scene.findGlyphsetsWithGroupName(e);for(let i=0;i<n.length;i++)n[i].forEachGlyph(v8r(r));return r},ts.prototype.setHighlightedByGroupName=function(e,t){const r=this.findObjectsByGroupName(e);return this.setHighlightedByObjects(r,void 0,t)},ts.prototype.setSelectedByGroupName=function(e,t){const r=this.findObjectsByGroupName(e);return this.setSelectedByObjects(r,void 0,t)},ts.prototype.changeBackgroundColour=function(e){const t=new cne.Color(e);this.zincRenderer&&this.zincRenderer.getThreeJSRenderer().setClearColor(t,1)},ts.prototype.resetView=function(){this.zincRenderer&&this.zincRenderer.resetView()},ts.prototype.viewAll=function(){this.zincRenderer&&this.zincRenderer.viewAll()},ts.prototype.playAnimation=function(e){this.zincRenderer&&(this.zincRenderer.playAnimation=e)},ts.prototype.setPlayRate=function(e){this.zincRenderer&&this.zincRenderer.setPlayRate(e)},ts.prototype.getPlayRate=function(e){return this.zincRenderer?this.zincRenderer.getPlayRate():0},ts.prototype.initialiseRenderer=function(e){if(this.zincRenderer===void 0||this.rendererContainer===void 0){let t=T8r();this.Zinc=t.Zinc,this.zincRenderer=t.renderer,this.rendererContainer=t.container}e&&(this.displayArea=e,this.displayArea.appendChild(this.rendererContainer),this.zincRenderer&&this.zincRenderer.animate())},ts.prototype.destroy=function(){this.zincRenderer&&(this.zincRenderer.dispose(),this.zincRenderer.getThreeJSRenderer().dispose(),this.zincRenderer=void 0),D2.prototype.destroy.call(this)};const Q8r=function(){this.type="anatomical",this.data=void 0,this.isAnnotation=!0},b8r=function(){this.currentName="",this.currentSystem="",this.currentPart="",this.currentSpecies="",this.metaURL="",this.viewURL="",this.currentTime=0,this.timeVarying=!1},WVe=function(e){ts.call(this);const t=this;let r;this.sceneData=new b8r;const n=new Array,i=new Array,o=new Array;let s;const l=e;this.NDCCameraControl=void 0,t.typeName="Organ Viewer",this.currentTime=0,this.getSceneData=function(){return t.sceneData},this.updateTime=function(b){let L=6e3;t.scene&&(L=t.scene.getDuration());const w=b/100*L;t.sceneData.nerveMapIsActive||t.scene&&t.scene.setMorphsTime(w),t.sceneData.currentTime=b,t.currentTime=b};const c=function(){let b=3e3;t.scene&&(b=t.scene.getDuration());const L=t.zincRenderer.getCurrentTime();for(let w=0;w<n.length;w++)n[w](L);!t.sceneData.nerveMapIsActive&&r&&r.setMorphsTime(L),t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setTime(L/b),t.sceneData.currentTime=L/b*100,t.currentTime=L/b*100};this.getCurrentTime=function(){return t.sceneData.currentTime},this.toggleSyncControl=(b,L)=>{let w=this.scene.getZincCameraControls();b?(w.resetView(),this.NDCCameraControl=w.enableSyncControl(),w.setRotationMode(L)):(w.disableSyncControl(),this.NDCCameraControl=void 0,w.setRotationMode("free"))},this.isSyncControl=()=>this.NDCCameraControl!==void 0,this.setSyncControlZoomToBox=b=>{this.NDCCameraControl&&this.NDCCameraControl.zoomToBox(b,2)},this.setSyncControlCallback=b=>{this.NDCCameraControl&&this.NDCCameraControl.setEventCallback(b)},this.setSyncControlCenterZoom=(b,L)=>{this.NDCCameraControl&&this.NDCCameraControl.setCenterZoom(b,L)};const u=function(){if(t.zincRenderer.playAnimation&&t.liveUpdatesObjects&&t.setupLiveCoordinates(t.liveUpdatesObjects),t.selectedCenter){const b=new Uv.THREE.Vector3;b.copy(t.selectedCenter);const L=t.scene.vectorToScreenXY(b);t.selectedScreenCoordinates.x=L.x,t.selectedScreenCoordinates.y=L.y}},d=function(){return function(){c()}},p=function(){return function(){u()}};this.addTimeChangedCallback=function(b){n.push(b)},this.setTexturePos=function(b){t.sceneData.nerveMap&&t.sceneData.nerveMap.additionalReader&&t.sceneData.nerveMap.additionalReader.setSliderPos(b)},this.addSceneChangedCallback=function(b){i.push(b)},this.addOrganPartAddedCallback=function(b){o.push(b)},this.setFinishDownloadCallback=function(b){s=b},this.unsetFinishDownloadCallback=function(){s=void 0},this.getNamedObjectsToScreenCoordinates=function(b,L){const w=new Uv.THREE.Vector3;w.setFromMatrixPosition(obj.matrixWorld);const k=width/2,C=height/2;return w.project(L),w.x=w.x*k+k,w.y=-(w.y*C)+C,w};const h=function(b){let L,w;if(b!==void 0){let k=!1;b.object.userData&&b.object.userData.isMarker?(k=!0,w=b.object.userData.parent.morph):w=b.object;try{w.userData.userData.annotation.data.lastActionOnMarker=k}finally{}if(w)if(w.name)L=w.name;else{const C=t.getAnnotationsFromObjects([w]);C&&C[0]&&(L=C[0].data.group)}}return{id:L,object:w}},f=function(){return function(b,L,w){const k=t.getIntersectedObject(b),C=h(k),A={x:L,y:w};if(C.id){C.object.userData.isGlyph?C.object.name?t.setSelectedByObjects([C.object],A,!0):t.setSelectedByZincObjects(C.object.userData.getGlyphset(),A,!0):t.setSelectedByObjects([C.object],A,!0);return}else t.setSelectedByObjects([],A,!0)}},m=function(){return function(b,L,w){const k=t.getIntersectedObject(b),C=h(k),A={x:L,y:w};if(C.id){t.displayArea.style.cursor="pointer",t.setHighlightedByObjects([C.object],A,!0);return}else t.displayArea.style.cursor="auto",t.setHighlightedByObjects([],A,!0)}},g=function(b,L,w,k){if(k=="all"||k=="geometries"){const C=b.findGeometriesWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="glyphsets"){const C=b.findGlyphsetsWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="pointsets"){const C=b.findPointsetsWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}if(k=="all"||k=="lines"){const C=b.findLinesWithGroupName(L);for(let A=0;A<C.length;A++)C[A].setVisibility(w)}};this.changeGeometriesVisibility=function(b,L){g(t.scene,b,L,"geometries")},this.changeGlyphsetsVisibility=function(b,L){g(t.scene,b,L,"glyphsets")},this.changeLinesVisibility=function(b,L){g(t.scene,b,L,"lines")},this.changePointsetsVisibility=function(b,L){g(t.scene,b,L,"pointsets")},this.changeOrganPartsVisibility=function(b,L,w){let k="all";w!==void 0&&(k=w),g(t.scene,b,L,k)},this.changeOrganPartsVisibilityCallback=function(b){return function(L){t.changeOrganPartsVisibility(b,L)}},this.changeBackgroundColour=function(b){const L=new Uv.THREE.Color(b);t.zincRenderer&&t.zincRenderer.getThreeJSRenderer().setClearColor(L,1)};const T=function(b,L,w,k){for(let O=0;O<o.length;O++)o[O](k,t.scene.isTimeVarying());w&&l.setGeometryColour(k,b,L);const C=new Q8r,A=k.region.getFullPath();C.data={species:t.sceneData.currentSpecies,system:b,part:L,group:k.groupName,region:A,uuid:k.uuid,lastActionOnMarker:!1},k.userData.annotation=C},y=function(b,L,w){return function(k){T(b,L,w,k)}},v=function(){return function(){t.settingsChanged(),t.sceneData.timeVarying=t.scene.isTimeVarying(),s&&s()}};this.updateFieldvisibility=function(b,L){for(let w=0;w<b.length;w++)if(L!=w){const k=b[w].PartName;t.changeOrganPartsVisibility(k,!1)}if(L>-1){const w=b[L].PartName;if(t.scene.findGeometriesWithGroupName(w).length>0||t.scene.findGlyphsetsWithGroupName(w).length>0)t.changeOrganPartsVisibility(w,!0);else{const k=getOrganDetails(b[L].SystemName,w);k!=null&&t.scene.loadMetadataURL(l.getOrgansDirectoryPrefix()+"/"+k.meta)}}},this.getAvailableSpecies=function(b,L,w){const k=new Array;k.push("none");const C=Object.keys(organsFileMap);for(index in C){const A=C[index];A!=b&&organsFileMap[A].hasOwnProperty(L)&&organsFileMap[A][L].hasOwnProperty(w)&&k.push(A)}return k};const _=function(b,L,w,k){t.sceneData.nerveMapIsActive=!1,t.sceneData.nerveMap=void 0,t.sceneData.metaURL="",t.sceneData.viewURL="",t.sceneData.currentSpecies=b,t.sceneData.currentSystem=L,t.sceneData.currentPart=w,t.sceneData.currentTime=0,t.sceneData.timeVarying=!1,t.currentTime=0;let C="";b&&(C=b+"/"),L&&(C=L+"/"),w&&(C=w),t.sceneData.currentName=C};this.loadOrgansFromURL=function(b,L,w,k,C,A){if(t.zincRenderer&&k&&t.sceneData.metaURL!==b){_(L,w,k);const O=t.sceneData.currentName;let N=t.zincRenderer.getSceneByName(O);N?A&&N.clearAll():N=t.zincRenderer.createScene(O);for(let B=0;B<i.length;B++)i[B](t.sceneData);C&&C!=""?(t.sceneData.viewURL=C,N.loadViewURL(t.sceneData.viewURL)):t.sceneData.viewURL=void 0,t.sceneData.metaURL=b,N.loadMetadataURL(b,y(w,k,!1),v()),t.scene=N,t.zincRenderer.setCurrentScene(N),t.graphicsHighlight.reset();const I=N.getZincCameraControls();I.enableRaycaster(N,f(),m()),I.setMouseButtonAction("AUXILIARY","ZOOM"),I.setMouseButtonAction("SECONDARY","PAN")}},this.loadGLTFFromURL=function(b,L,w){if(t.zincRenderer&&L&&t.sceneData.metaURL!==b){_(void 0,void 0,L);const k=t.sceneData.currentName;let C=t.zincRenderer.getSceneByName(k);C?w&&C.clearAll():C=t.zincRenderer.createScene(k);for(let O=0;O<i.length;O++)i[O](t.sceneData);t.sceneData.viewURL=void 0,t.sceneData.metaURL=b,C.loadGLTF(b,y(void 0,L,!1),v()),t.scene=C,t.zincRenderer.setCurrentScene(C),t.graphicsHighlight.reset();const A=C.getZincCameraControls();A.enableRaycaster(C,f(),m()),A.setMouseButtonAction("AUXILIARY","ZOOM"),A.setMouseButtonAction("SECONDARY","PAN")}},this.alignCameraWithSelectedObject=function(b){const L=t.graphicsHighlight.getSelected();L&&L[0]&&L[0].userData&&t.scene.alignObjectToCameraView(L[0].userData,b)},this.exportSettings=function(){const b={};return b.name=t.instanceName,t.sceneData.currentSystem&&(b.system=t.sceneData.currentSystem),t.sceneData.currentSpecies&&(b.species=t.sceneData.currentSpecies),t.sceneData.currentPart&&(b.part=t.sceneData.currentPart),b.metaURL=t.sceneData.metaURL,t.sceneData.viewURL&&(b.viewURL=t.sceneData.viewURL),b.dialog="Organ Viewer",b},this.importSettings=function(b){return b&&b.dialog==this.typeName?(t.setName(b.name),b.metaURL!==void 0&&b.metaURL!=""?t.loadOrgansFromURL(b.metaURL,b.species,b.system,b.part,b.viewURL,!0):t.loadOrgans(b.species,b.system,b.part),!0):!1},function(){t.initialiseRenderer(void 0),t.zincRenderer&&(t.zincRenderer.addPreRenderCallbackFunction(d()),t.zincRenderer.addPostRenderCallbackFunction(p()))}()};WVe.prototype=Object.create(ts.prototype);const x8r={name:"ScaffoldVuer",components:{Button:YN,Col:oS,Loading:ZCe,Option:kee,Popover:aR,Row:WT,Select:See,Slider:XT,TabPane:DCe,Tabs:BCe,MapSvgIcon:Wb,MapSvgSpriteColor:BC,PrimitiveControls:JCe,ScaffoldTooltip:rEe,TreeControls:tEe,ElIconWarningFilled:Xke,ElIconArrowDown:ON,ElIconArrowLeft:HN},props:{url:{type:String,default:""},showColourPicker:{type:Boolean,default:!1},displayUI:{type:Boolean,default:!0},displayAtStartUp:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!0},warningMessage:{type:String,default:"Beta feature - under active development"},displayLatestChanges:{type:Boolean,default:!1},latestChangesMessage:{type:String,default:"New feature - Local search is now available"},displayMarkers:{type:Boolean,default:!1},markerLabels:{type:Array,default:function(){return[]}},displayMinimap:{type:Boolean,default:!1},format:{type:String,default:"metadata"},minimapSettings:{type:Object,default:function(){return{x_offset:16,y_offset:16,width:128,height:128,align:"top-right"}}},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},state:{type:Object,default:void 0},region:{type:String,default:""},viewURL:{type:String,default:""},render:{type:Boolean,default:!0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"}},provide(){return{flatmapAPI:this.flatmapAPI,scaffoldUrl:this.url}},data:function(){return{currentTime:0,timeVarying:void 0,isPlaying:!1,isReady:!1,isTransitioning:!1,tooltipAppendToBody:!1,hoverVisibilities:[{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1},{value:!1}],inHelp:!1,loading:!1,duration:3e3,drawerOpen:!0,currentBackground:"white",availableBackground:["white","lightskyblue","black"],minimisedSlider:!1,sliderPosition:"",timeMax:100,orginalDuration:"",animateDuration:"6secs",playSpeed:[{value:.1,label:"0.1x"},{value:.5,label:"0.5x"},{value:1,label:"1x"},{value:2,label:"2x"},{value:5,label:"5x"},{value:10,label:"10x"}],currentSpeed:1,timeStamps:{},defaultCheckedKeys:[],tData:{label:"",region:"",visible:!1,x:200,y:200,active:!1},fileFormat:"metadata",previousMarkerLabels:[],viewingMode:"Exploration",viewingModes:["Annotation","Exploration"],openMapRef:void 0,backgroundIconRef:void 0}},watch:{format:{handler:function(e){this.fileFormat=e},immediate:!0},url:{handler:function(e){(this.state===void 0||this.state.url===void 0)&&this.setURL(e)},immediate:!0},region:{handler:function(e){this.state||this.viewURL||this.setFocusedRegion(e)},immediate:!0},state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},viewURL:{handler:function(e){this.updateViewURL(e)},immediate:!0},helpMode:function(e){this.setHelpMode(e)},displayMarkers:function(e){this.$module.scene.displayMarkers=e,this.$module.scene.forcePickableObjectsUpdate=!0},displayMinimap:function(e){this.$module.scene.displayMinimap=e},currentTime:{handler:function(){this.$emit("timeChanged",this.currentTime)}},duration:function(){this.$module.scene.setDuration(this.duration)},minimapSettings:{deep:!0,handler:"updateMinimapScissor"},render:function(e){this.toggleRendering(e)},markerLabels:function(e){this.previousMarkerLabels.forEach(t=>{this.setMarkerModeForObjectsWithName(t,"off")}),e.forEach(t=>{this.setMarkerModeForObjectsWithName(t,"on")}),this.previousMarkerLabels=e}},beforeCreate:function(){this.$module=new WVe,this.selectedObjects=[],this.hoveredObjects=[],this.currentBackground="white",this._currentURL=void 0,this.availableBackground=["white","black","lightskyblue"],this.$_searchIndex=new t3r},created:function(){this.timeVarying=a.toRef(this.$module.sceneData,"timeVarying")},mounted:function(){this.openMapRef=a.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=a.shallowRef(this.$refs.backgroundIconRef),this.$refs.treeControls.setModule(this.$module);let e=new g8r;e.subscribe(this,this.eventNotifierCallback),this.$module.addNotifier(e),this.$module.addOrganPartAddedCallback(this.zincObjectAdded),this.$module.initialiseRenderer(this.$refs.display),this.toggleRendering(this.render),this.ro=new ResizeObserver(this.adjustLayout).observe(this.$refs.scaffoldContainer),this.defaultRate=this.$module.getPlayRate(),this.$module.zincRenderer.addPreRenderCallbackFunction(()=>{this.currentTime=this.$module.getCurrentTime()})},beforeDestroy:function(){this.ro&&this.ro.disconnect(),this.$module.destroy(),this.$module=void 0},methods:{addZincObject:function(e){this.$module.scene&&(this.$module.scene.addZincObject(e),this.zincObjectAdded(e),this.$refs.treeControls&&this.$refs.treeControls.zincObjectAdded(e))},zincObjectAdded:function(e){this.loading=!1,this.$_searchIndex.addZincObject(e,e.uuid),this.$emit("zinc-object-added",e)},addRegionsToSearchIndex:function(){this.$module.scene.getRootRegion().getChildRegions(!0).forEach(e=>{this.$_searchIndex.addRegion(e,e.uuid)})},backgroundChangeCallback:function(e){this.currentBackground=e,this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground,1)},captureScreenshotCallback:function(){this.$module.zincRenderer.removePostRenderCallbackFunction(this.captureID);let e=this.$module.zincRenderer.getThreeJSRenderer().domElement.toDataURL("image/png"),t=document.createElement("a");document.body.append(t),this.captureFilename?t.download=this.captureFilename:t.download="screenshot.png",t.href=e,t.click(),t.remove()},captureScreenshot:function(e){this.captureFilename=e,this.captureID=this.$module.zincRenderer.addPostRenderCallbackFunction(this.captureScreenshotCallback)},clearScene:function(){this.$refs.treeControls&&this.$refs.treeControls.clear(),this.$_searchIndex&&this.$_searchIndex.removeAll(),this.$module.scene&&this.$module.scene.clearAll()},formatTooltip(e){if(this.timeMax>=1e3&&e){let t=(e%6e4/1e3).toFixed(2)+"s";return(e>6e4?(e/6e4).toFixed(0)+"m ":"")+t}return e?e.toFixed(2)+" ms":"0 ms"},fitWindow:function(){this.$module.scene&&this.$module.scene.viewAll()},zoomIn:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(-1)},zoomOut:function(){this.$module.scene&&this.$module.scene.changeZoomByScrollRateUnit(1)},speedChanged:function(e){this.currentSpeed=e,this.$module.setPlayRate(this.defaultRate*this.currentSpeed)},stopFreeSpin:function(){this.$module.scene.getZincCameraControls().stopAutoTumble(),this.isTransitioning=!1},findObjectsWithGroupName:function(e){let t=[];return e&&e!=""&&this.$module.scene&&(t=this.$module.scene.findObjectsWithGroupName(e)),t},viewRegion:function(e){const t=this.$module.scene.getRootRegion(),r=Array.isArray(e)?e:[e],n=$T(t,r,"",!0);let i=this.$module.scene.getBoundingBoxOfZincObjects(n);if(i){if(this.$module.isSyncControl())this.$module.setSyncControlZoomToBox(i);else{const o=this.$module.scene.camera.far-this.$module.scene.camera.near;this.$module.scene.viewAllWithBoundingBox(i),this.$module.scene.camera.far=this.$module.scene.camera.near+o,this.$module.scene.camera.updateProjectionMatrix()}return!0}return!1},setFocusedRegion:function(e){e&&(this.isReady?this.viewRegion(e):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({region:e})))},updateViewURL:function(e){if(e)if(this.isReady){const t=new URL(e,this.url);this.$module.scene.loadViewURL(t)}else this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewURL:e}))},getRendererInfo:function(){if(this.$module.zincRenderer)return this.$module.zincRenderer.getThreeJSRenderer().info},freeSpin:function(){if(this.$module.scene){let e=this.$module.scene.getZincCameraControls();this.isTransitioning=!0,e.enableAutoTumble(),e.autoTumble([1,0],Math.PI,!0),setTimeout(this.stopFreeSpin,4e3)}},eventNotifierCallback:function(e){const t=[];let r=[];if((e.eventType==1||e.eventType==2)&&(e.identifiers.forEach(n=>{if(n){let i=n.data.id?n.data.id:n.data.group;t.push(i)}}),r=e.zincObjects),e.eventType==1)this.$refs.treeControls&&(t.length>0?this.$refs.treeControls.updateActiveUI(r):(this.hideRegionTooltip(),this.$refs.treeControls.removeActive(!0))),this.viewingMode==="Annotation"&&this.showRegionTooltipWithAnnotations(e.identifiers,!0,!0),this.$emit("scaffold-selected",e.identifiers);else if(e.eventType==2){if(this.selectedObjects.length===0){if(this.hideRegionTooltip(),this.$refs.treeControls&&(t.length>0?this.$refs.treeControls.updateHoverUI(r):this.$refs.treeControls.removeHover(!0)),e.identifiers.length>0&&e.identifiers[0]){let n=e.identifiers[0].data.id?e.identifiers[0].data.id:e.identifiers[0].data.group;e.identifiers[0].coords&&(this.tData.active=!1,this.tData.visible=!0,this.tData.label=n,e.identifiers[0].data.region?this.tData.region=e.identifiers[0].data.region:this.tData.region=void 0,this.tData.x=e.identifiers[0].coords.x,this.tData.y=e.identifiers[0].coords.y)}this.$emit("scaffold-highlighted",e.identifiers)}}else if(e.eventType==3&&e.identifiers.length>0&&e.identifiers[0]&&e.identifiers[0].coords){const n=this.$refs.scaffoldContainer.getBoundingClientRect();this.tData.x=e.identifiers[0].coords.x-n.left,this.tData.y=e.identifiers[0].coords.y-n.top}},getCoordinatesOfSelected:function(){if(this.selectedObjects&&this.selectedObjects.length>0)return this.$module.scene.getObjectsScreenXY(this.selectedObjects)},getDynamicSelectedCoordinates:function(){return this.$module.selectedScreenCoordinates},timeChange:function(e){let t=e/this.timeMax*100;t!=this.currentTime&&(this.$module.updateTime(t),console.log(this.currentTime))},objectSelected:function(e,t){this.selectedObjects=e,this.selectedObjects&&this.selectedObjects.length>0&&this.$refs.primitiveControls.setObject(this.selectedObjects[0]),this.$module.setSelectedByZincObjects(e,void 0,t)},objectHovered:function(e,t){this.hoveredObjects=e,this.$module.setHighlightedByZincObjects(e,void 0,t)},changeActiveByName:function(e,t,r){const n=Array.isArray(e);if(e===void 0||n&&e.length===0)this.$refs.treeControls.removeActive(r);else{let i=e;n||(i=[i]),this.$refs.treeControls.changeActiveByNames(i,t,r)}},changeHighlightedByName:function(e,t,r){const n=Array.isArray(e);if(e===void 0||n&&e.length===0)this.$refs.treeControls.removeHover(r);else{let i=e;n||(i=[i]),this.$refs.treeControls.changeHoverByNames(i,t,r)}},play:function(e){this.$module.playAnimation(e),this.isPlaying=e},setHelpMode:function(e){e?(this.inHelp=!0,this.hoverVisibilities.forEach(t=>{t.value=!0})):(this.inHelp=!1,this.hoverVisibilities.forEach(t=>{t.value=!1}))},displayTooltipOfObjectsCallback:function(e,t,r,n,i){const o=this;return function(){o.$module.zincRenderer.removePostRenderCallbackFunction(o.$_regionTooltipCallback),o.$_regionTooltipCallback=void 0,o.displayTooltipOfObjects(e,t,r,n,i)}},liveUpdateTooltipPosition:function(){this.$module.selectedCenter&&(this.tData.x=this.$module.selectedScreenCoordinates.x,this.tData.y=this.$module.selectedScreenCoordinates.y)},displayTooltipOfObjects:function(e,t,r,n,i){if(t.length>0){let o=t[0].getClosestVertexDOMElementCoords(this.$module.scene);if(o)return o.inView?(e.includes("Search Results for")?this.tData.active=!1:this.tData.active=!0,this.tData.visible=!0,this.tData.label=e,this.tData.x=o.position.x,this.tData.y=o.position.y,this.tData.region=r,this.$_liveCoordinatesUpdated&&this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),i&&(this.$module.setupLiveCoordinates(t),this.$_liveCoordinatesUpdated=this.$module.zincRenderer.addPostRenderCallbackFunction(this.liveUpdateTooltipPosition))):(this.hideRegionTooltip(),n&&(this.$module.scene.viewAll(),this.$_regionTooltipCallback&&this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_regionTooltipCallback),this.$_regionTooltipCallback=this.$module.zincRenderer.addPostRenderCallbackFunction(this.displayTooltipOfObjectsCallback(e,t,r,n,i)))),!0}return this.hideRegionTooltip(),!1},showRegionTooltipWithObjects:function(e,t,r,n,i){return e&&t&&t.length>0&&this.$module.scene?this.displayTooltipOfObjects(e,t,r,n,i):(this.hideRegionTooltip(),!1)},showRegionTooltip:function(e,t,r){if(e&&this.$module.scene){const n=this.$module.scene.getRootRegion(),i=$T(n,[e],"",!0);let o;return i&&i.length>0&&(o=i[0].getRegion().getFullPath()),this.showRegionTooltipWithObjects(e,i,o,t,r)}return this.hideRegionTooltip(),!1},showRegionTooltipWithAnnotations:function(e,t,r){if(this.$module.scene){const n=eEe(this.$module.scene,e);if(n&&n.objects.length>0)return this.showRegionTooltipWithObjects(n.label,n.objects,n.regionPath,t,r)}return this.hideRegionTooltip(),!1},hideRegionTooltip:function(){this.$_liveCoordinatesUpdated&&(this.$module.zincRenderer.removePostRenderCallbackFunction(this.$_liveCoordinatesUpdated),this.$module.setupLiveCoordinates(void 0)),this.tData.active=!1,this.tData.visible=!1,this.tData.region=void 0},setMarkerModeForObjectsWithName:function(e,t){if(e&&this.$module.scene){const r=this.$module.scene.getRootRegion();$T(r,[e],"",!0).forEach(n=>n.setMarkerMode(t))}},setMarkerModeWithAnnotations:function(e,t){if(this.$module.scene){const r=eEe(this.$module.scene,e);r&&r.objects.length>0&&r.objects.forEach(n=>n.setMarkerMode(t))}},showHelpText:function(e){this.inHelp||(this.helpTextWait=setTimeout(()=>{this.hoverVisibilities[e].value=!0},500))},hideHelpText:function(e){this.inHelp||(this.hoverVisibilities[e].value=!1,clearTimeout(this.helpTextWait))},search:function(e,t){if(this.$_searchIndex){if(e===void 0||e===""||Array.isArray(e)&&e.length===0)return this.objectSelected([],!0),!1;{const r=this.$_searchIndex.searchAndProcessResult(e),n=r.zincObjects;if(n.length>0){if(this.objectSelected(n,!0),t)for(let i=0;i<n.length;i++)n[i]&&n[i].groupName&&this.showRegionTooltipWithObjects(r.label,n,r.regionPath,!0,!0);return!0}else this.objectSelected([],!0)}}return!1},fetchSuggestions:function(e){return this.$_searchIndex===void 0?[]:this.$_searchIndex.auto_suggest(e)},updateMinimapScissor:function(){Object.keys(this.minimapSettings).forEach(e=>{this.$module.scene.minimapScissor[e]=this.minimapSettings[e]}),this.$module.scene.minimapScissor.updateRequired=!0},updateSettingsfromScene:function(){this.currentSpeed=1,this.$module.setPlayRate(this.defaultRate),this.orginalDuration=this.$module.scene.getMetadataTag("OriginalDuration"),this.animateDuration=this.$module.scene.getMetadataTag("Duration");let e=this.$module.scene.getMetadataTag("TimeStamps");this.timeStamps={};for(const t in e)this.timeStamps[e[t]]=t;this.timeMax=this.$module.scene.getDuration()},setURLFinishCallback:function(e){return()=>{if(e){if(e.viewport)this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport);else if(e.viewURL&&e.viewURL!==""){const t=new URL(e.viewURL,this.url);this.$module.scene.loadViewURL(t)}else e.region&&e.region!==""&&this.viewRegion(e.region);e.visibility&&this.$nextTick(()=>{this.$refs.treeControls.setState(e.visibility)})}this.updateSettingsfromScene(),this.$module.updateTime(.01),this.$module.updateTime(0),this.$module.unsetFinishDownloadCallback(),this.addRegionsToSearchIndex(),this.$emit("on-ready"),this.setMarkers(),this.isReady=!0}},getState:function(){let e={format:this.fileFormat,url:this._currentURL,viewport:void 0,visibility:void 0};if(this.$refs.treeControls&&(e.visibility=this.$refs.treeControls.getState()),this.$module.scene){let t=this.$module.scene.getZincCameraControls();e.viewport=t.getCurrentViewport()}return e},setState:function(e){e&&(e.url&&e.url!==this._currentURL?this.setURLAndState(e.url,{fileFormat:e.fileFormat,viewport:e.viewport,visibility:e.visibility}):(e.viewport||e.visibility)&&(this.isReady&&this.$module.scene?(e.viewport&&this.$module.scene.getZincCameraControls().setCurrentCameraSettings(e.viewport),e.visibility&&this.$refs.treeControls.setState(e.visibility)):this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewport:e.viewport,visibility:e.visibility}))))},exportGLTF:function(e){return this.$module.scene.exportGLTF(e)},setURLAndState:function(e,t){if(e!=this._currentURL){t&&t.format&&(this.fileFormat=t.format);let r=t&&t.viewport?t.viewport:void 0,n=t&&t.visibility?t.visibility:void 0;this._currentURL=e,this.$refs.treeControls&&this.$refs.treeControls.clear(),this.loading=!0,this.isReady=!1,this.$_searchIndex.removeAll(),this.hideRegionTooltip(),this.$module.setFinishDownloadCallback(this.setURLFinishCallback({viewport:r,region:this.region,viewURL:this.viewURL,visibility:n})),this.fileFormat==="gltf"?this.$module.loadGLTFFromURL(e,"scene",!0):this.$module.loadOrgansFromURL(e,void 0,void 0,"scene",void 0,!0),this.$module&&this.$module.scene&&(this.$module.scene.displayMarkers=this.displayMarkers,this.$module.scene.forcePickableObjectsUpdate=!0,this.$module.scene.displayMinimap=this.displayMinimap,this.updateMinimapScissor())}},setURL:function(e){this.setURLAndState(e,void 0)},drawerToggled:function(e){this.drawerOpen=e,this.adjustLayout()},adjustLayout:function(){let e=this.$refs.scaffoldContainer.clientWidth;this.minimisedSlider=e<812,this.minimisedSlider?this.sliderPosition=this.drawerOpen?"right":"left":this.sliderPosition=""},toggleRendering:function(e){this.$module.zincRenderer&&(e?this.$module.zincRenderer.animate():this.$module.zincRenderer.stopAnimate())},forceResize:function(){this.$module.zincRenderer&&this.$module.zincRenderer.onWindowResize()},syncControlCallback:function(){const e=this.$module.NDCCameraControl.getPanZoom();this.tData.visible&&this.showRegionTooltip(this.tData.label,!0,!0),this.$emit("scaffold-navigated",e)},toggleSyncControl:function(e,t){this.$module.toggleSyncControl(e,t),this.$module.setSyncControlCallback(this.syncControlCallback)},setMarkers:function(){this.markerLabels.forEach(e=>{this.setMarkerModeForObjectsWithName(e,"on")})}}},une=e=>(a.pushScopeId("data-v-958eb79e"),e=e(),a.popScopeId(),e),_8r={ref:"scaffoldContainer",class:"scaffold-container","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},w8r=une(()=>a.createElementVNode("span",{class:"message-text"},"Beta",-1)),L8r=une(()=>a.createElementVNode("span",{class:"message-text"},"What's new?",-1)),S8r={class:"primitive-controls-box"},k8r={class:"animation-data"},M8r={class:"purple"},C8r={class:"animation-data"},E8r={class:"purple"},A8r={class:"animation-data"},O8r={class:"bottom-right-control"},H8r=une(()=>a.createElementVNode("div",null,[a.createTextVNode(" Fit to "),a.createElementVNode("br"),a.createTextVNode(" window ")],-1)),V8r=["onClick"];function I8r(e,t,r,n,i,o){const s=a.resolveComponent("map-svg-sprite-color"),l=rEe,c=Xke,u=ja,d=aR,p=tEe,h=JCe,f=a.resolveComponent("map-svg-icon"),m=XT,g=WT,T=DCe,y=kee,v=See,_=BCe,b=YN,L=oS,w=hR;return a.withDirectives((a.openBlock(),a.createElementBlock("div",_8r,[a.createVNode(s),a.createVNode(l,{label:e.tData.label,region:e.tData.region,visible:e.tData.visible,x:e.tData.x,y:e.tData.y,annotationDisplay:e.viewingMode==="Annotation"&&e.tData.active===!0},null,8,["label","region","visible","x","y","annotationDisplay"]),a.createElementVNode("div",{id:"organsDisplayArea",ref:"display",tabindex:"-1",style:{height:"100%",width:"100%"},onKeydown:t[0]||(t[0]=a.withKeys((...k)=>o.backgroundChangeCallback&&o.backgroundChangeCallback(...k),["66"]))},null,544),a.withDirectives(a.createElementVNode("div",null,[r.displayWarning?(a.openBlock(),a.createBlock(d,{key:0,ref:"warningPopover",visible:e.hoverVisibilities[6].value,content:r.warningMessage,placement:"right",teleported:!1,"popper-class":"scaffold-popper message-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.displayWarning?(a.openBlock(),a.createElementBlock("div",{key:0,class:"message-icon warning-icon",onMouseover:t[1]||(t[1]=k=>o.showHelpText(6)),onMouseout:t[2]||(t[2]=k=>o.hideHelpText(6))},[a.createVNode(u,null,{default:a.withCtx(()=>[a.createVNode(c)]),_:1}),w8r],32)):a.createCommentVNode("",!0)]),_:1},8,["visible","content"])):a.createCommentVNode("",!0),r.displayLatestChanges?(a.openBlock(),a.createBlock(d,{key:1,visible:e.hoverVisibilities[7].value,content:r.latestChangesMessage,placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper message-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.displayLatestChanges&&r.latestChangesMessage?(a.openBlock(),a.createElementBlock("div",{key:0,class:"el-icon-warning message-icon latest-changesicon",onMouseover:t[3]||(t[3]=k=>o.showHelpText(7)),onMouseout:t[4]||(t[4]=k=>o.hideHelpText(7))},[a.createVNode(u,null,{default:a.withCtx(()=>[a.createVNode(c)]),_:1}),L8r],32)):a.createCommentVNode("",!0)]),_:1},8,["visible","content"])):a.createCommentVNode("",!0),a.createVNode(d,{visible:e.hoverVisibilities[5].value,content:"Change region visibility",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(p,{ref:"treeControls","help-mode":r.helpMode,isReady:e.isReady,"show-colour-picker":r.showColourPicker,onObjectSelected:o.objectSelected,onObjectHovered:o.objectHovered,onDrawerToggled:o.drawerToggled},null,8,["help-mode","isReady","show-colour-picker","onObjectSelected","onObjectHovered","onDrawerToggled"])]),_:1},8,["visible"]),a.createElementVNode("div",S8r,[a.createVNode(h,{ref:"primitiveControls"},null,512)]),e.timeVarying?(a.openBlock(),a.createBlock(d,{key:2,ref:"sliderPopover",visible:e.hoverVisibilities[4].value,content:"Move the slider to animate the region",placement:"top",teleported:!1,trigger:"manual","popper-class":"scaffold-popper top-popper non-selectable"},{reference:a.withCtx(()=>[e.timeVarying?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["time-slider-container",[e.minimisedSlider?"minimised":"",e.sliderPosition]])},[a.createVNode(_,{type:"card"},{default:a.withCtx(()=>[a.createVNode(T,{label:"Animate scaffold"},{default:a.withCtx(()=>[a.createVNode(g,{class:"tab-content"},{default:a.withCtx(()=>[e.isPlaying?(a.openBlock(),a.createBlock(f,{key:0,icon:"pause",class:"icon-button video-button",onClick:t[5]||(t[5]=k=>o.play(!1))})):(a.openBlock(),a.createBlock(f,{key:1,icon:"play",class:"video-button icon-button",onClick:t[6]||(t[6]=k=>o.play(!0))})),a.createVNode(m,{min:0,max:e.timeMax,"model-value":e.currentTime/100*e.timeMax,step:.1,"tooltip-class":"time-slider-tooltip",class:"slider","format-tooltip":o.formatTooltip,marks:e.timeStamps,onInput:t[7]||(t[7]=k=>o.timeChange(k))},null,8,["max","model-value","format-tooltip","marks"])]),_:1})]),_:1}),a.createVNode(T,{label:"Animation data"},{default:a.withCtx(()=>[a.createVNode(g,{class:"tab-content"},{default:a.withCtx(()=>[a.createElementVNode("div",k8r,[a.createTextVNode(" Original duration: "),a.createElementVNode("div",M8r,a.toDisplayString(e.orginalDuration),1)]),a.createElementVNode("div",C8r,[a.createTextVNode(" Animation duration: "),a.createElementVNode("div",E8r,a.toDisplayString(e.animateDuration),1)]),a.createElementVNode("div",A8r,[a.createTextVNode(" Playback speed "),a.createVNode(v,{teleported:!0,"model-value":e.currentSpeed,placeholder:"Select",class:"select-box","popper-class":"scaffold_viewer_dropdown",onChange:t[8]||(t[8]=k=>o.speedChanged(k))},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.playSpeed,k=>(a.openBlock(),a.createBlock(y,{key:k.value,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["model-value"])])]),_:1})]),_:1})]),_:1})],2)):a.createCommentVNode("",!0)]),_:1},8,["visible"])):a.createCommentVNode("",!0),a.createElementVNode("div",O8r,[a.createVNode(d,{visible:e.hoverVisibilities[0].value,content:"Zoom in",placement:"left",teleported:!1,trigger:"manual","popper-class":"scaffold-popper left-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"zoomIn",class:"icon-button zoomIn",onClick:t[9]||(t[9]=k=>o.zoomIn()),onMouseover:t[10]||(t[10]=k=>o.showHelpText(0)),onMouseout:t[11]||(t[11]=k=>o.hideHelpText(0))})]),_:1},8,["visible"]),a.createVNode(d,{visible:e.hoverVisibilities[1].value,content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual","popper-class":"scaffold-popper popper-zoomout non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"zoomOut",class:"icon-button zoomOut",onClick:t[12]||(t[12]=k=>o.zoomOut()),onMouseover:t[13]||(t[13]=k=>o.showHelpText(1)),onMouseout:t[14]||(t[14]=k=>o.hideHelpText(1))})]),_:1},8,["visible"]),a.createVNode(d,{visible:e.hoverVisibilities[2].value,placement:"top",teleported:!1,trigger:"manual","popper-class":"scaffold-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{icon:"fitWindow",class:"icon-button fitWindow",onClick:t[15]||(t[15]=k=>o.fitWindow()),onMouseover:t[16]||(t[16]=k=>o.showHelpText(2)),onMouseout:t[17]||(t[17]=k=>o.hideHelpText(2))})]),default:a.withCtx(()=>[H8r]),_:1},8,["visible"])]),e.openMapRef?(a.openBlock(),a.createBlock(d,{key:3,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"128",teleported:!1,trigger:"click","popper-class":"open-map-popper","virtual-triggering":""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.openMapOptions,k=>(a.openBlock(),a.createBlock(g,{key:k.key},{default:a.withCtx(()=>[a.createVNode(b,{type:"primary",plain:"",onClick:C=>e.$emit("open-map",k.key)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(k.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):a.createCommentVNode("",!0),a.createVNode(d,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"128",teleported:!1,trigger:"click","popper-class":"background-popper non-selectable","virtual-triggering":""},{default:a.withCtx(()=>[a.createElementVNode("div",null,[a.createVNode(g,{class:"backgroundText"},{default:a.withCtx(()=>[a.createTextVNode("Viewing Mode")]),_:1}),a.createVNode(g,{class:"backgroundControl"},{default:a.withCtx(()=>[a.createVNode(v,{teleported:!1,modelValue:e.viewingMode,"onUpdate:modelValue":t[18]||(t[18]=k=>e.viewingMode=k),placeholder:"Select",class:"select-box viewing-mode","popper-class":"scaffold_viewer_dropdown"},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.viewingModes,k=>(a.openBlock(),a.createBlock(y,{key:k,label:k,value:k},{default:a.withCtx(()=>[a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(L,{span:12},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(k),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a.createVNode(g,{class:"backgroundSpacer"}),a.createVNode(g,{class:"backgroundText"},{default:a.withCtx(()=>[a.createTextVNode(" Change background ")]),_:1}),a.createVNode(g,{class:"backgroundChooser"},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.availableBackground,k=>(a.openBlock(),a.createElementBlock("div",{key:k,class:a.normalizeClass(["backgroundChoice",k,k==e.currentBackground?"active":""]),onClick:C=>o.backgroundChangeCallback(k)},null,10,V8r))),128))]),_:1})])]),_:1},8,["virtual-ref"]),a.createElementVNode("div",{class:a.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(d,{visible:e.hoverVisibilities[8].value,content:"Open new map",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[r.enableOpenMapUI&&r.openMapOptions.length>0?(a.openBlock(),a.createBlock(f,{key:0,ref:"openMapRef",icon:"openMap",class:"icon-button open-map-button",onMouseover:t[19]||(t[19]=k=>o.showHelpText(8)),onMouseout:t[20]||(t[20]=k=>o.hideHelpText(8))},null,512)):a.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1}),a.createVNode(g,null,{default:a.withCtx(()=>[a.createVNode(d,{visible:e.hoverVisibilities[3].value,content:"Change background color",placement:"right",teleported:!1,trigger:"manual","popper-class":"scaffold-popper right-popper non-selectable"},{reference:a.withCtx(()=>[a.createVNode(f,{ref:"backgroundIconRef",icon:"changeBckgd",class:"icon-button",onMouseover:t[21]||(t[21]=k=>o.showHelpText(3)),onMouseout:t[22]||(t[22]=k=>o.hideHelpText(3))},null,512)]),_:1},8,["visible"])]),_:1})],2)],512),[[a.vShow,r.displayUI&&!e.isTransitioning]])])),[[w,e.loading]])}const P8r={name:"Scaffold",mixins:[ay],components:{ScaffoldVuer:YT(x8r,[["render",I8r],["__scopeId","data-v-958eb79e"]])},methods:{onResize:function(){this.scaffoldCamera.onResize()},getState:function(){return this.$refs.scaffold.getState()},search:function(e){const t=e.replace(/(^"|"$)/g,"");return this.$refs.scaffold.search(t,!0)},searchSuggestions:function(e,t){if(e===""||!this.$refs.scaffold)return t;this.$refs.scaffold.fetchSuggestions(e).forEach(n=>{n.suggestion&&t.push(n.suggestion)})},handleSyncPanZoomEvent:function(e){if(!this.mouseHovered&&e.type!==this.entry.type){const t=e.payload.origin,r=e.payload.size,n=[t[0]+r[0]/2,t[1]+r[1]/2],i=[(n[0]-.5)*2,(.5-n[1])*2],o=1/Math.max(r[0],r[1]);this.$refs.scaffold.$module.setSyncControlCenterZoom(i,o)}},displayTooltip:function(e){let t;e&&(t=e.name),t?this.$refs.scaffold.search(t,!0):this.$refs.scaffold.hideRegionTooltip()},zoomToFeatures:function(e,t){let r;Array.isArray(e)?r=e:r=[e.name],t&&this.$refs.scaffold.changeActiveByName(r,"",!1),this.$refs.scaffold.viewRegion(r)},highlightFeatures:function(e){let t;Array.isArray(e)?t=e:t=[e.name],this.$refs.scaffold.changeHighlightedByName(t,"",!1)},scaffoldIsReady:function(){if(this.scaffoldLoaded=!0,this.$refs.scaffold.$module.graphicsHighlight.highlightColour=[1,0,1],this.isVisible()){let e="free";this.entry.rotation&&(e=this.entry.rotation),this.$refs.scaffold.toggleSyncControl(this.splitFlowStore.globalCallback,e),this.splitFlowStore.syncMode&&this.$refs.scaffold.fitWindow()}},requestSynchronisedEvent:function(e){if(this.scaffoldLoaded){let t="free";this.entry.rotation&&(t=this.entry.rotation),this.$refs.scaffold.toggleSyncControl(e,t)}},scaffoldHighlighted:function(e,t){const r={paneIndex:this.entry.id,type:e,resource:t,internalName:void 0};t&&t[0]&&(r.internalName=t[0].data.id,r.eventType="highlighted"),this.$emit("resource-selected",r)},scaffoldNavigated:function(e,t){if(this.mouseHovered){const r={paneIndex:this.entry.id,eventType:"panZoom",payload:t,type:e};this.$emit("resource-selected",r)}},updateWithViewUrl:function(e){this.$refs.scaffold.updateViewURL(e)}},computed:{warningMessage:function(){return this.entry.isBodyScaffold?"This map displays the anatomical location and connectivity of nerves, through which the neuron populations from the ApiNATOMY models available in SCKAN can be routed.":"Under active development"},markerLabels:function(){return this.settingsStore.facetLabels}},data:function(){return{apiLocation:process.env.VUE_APP_API_LOCATION,scaffoldCamera:void 0,scaffoldLoaded:!1}},mounted:function(){this.scaffoldCamera=this.$refs.scaffold.$module.scene.getZincCameraControls(),Xo.on("startHelp",()=>{this.startHelp()})}};function N8r(e,t,r,n,i,o){const s=a.resolveComponent("ScaffoldVuer");return a.openBlock(),a.createBlock(s,{state:e.entry.state,url:e.entry.resource,region:e.entry.region,onScaffoldSelected:t[0]||(t[0]=l=>e.resourceSelected(e.entry.type,l,!0)),onScaffoldHighlighted:t[1]||(t[1]=l=>o.scaffoldHighlighted(e.entry.type,l)),onScaffoldNavigated:t[2]||(t[2]=l=>o.scaffoldNavigated(e.entry.type,l)),onOnReady:o.scaffoldIsReady,onOpenMap:e.openMap,ref:"scaffold","background-toggle":!0,traditional:!0,"help-mode":e.helpMode,render:e.visible,"display-latest-message":!0,"warning-message":o.warningMessage,"display-minimap":!1,"display-markers":!1,enableOpenMapUI:!0,"view-u-r-l":e.entry.viewUrl,markerLabels:o.markerLabels,flatmapAPI:e.flatmapAPI},null,8,["state","url","region","onOnReady","onOpenMap","help-mode","render","warning-message","view-u-r-l","markerLabels","flatmapAPI"])}const R8r=Gl(P8r,[["render",N8r],["__scopeId","data-v-4a090bca"]]),Wp=(e,t,{checkForDefaultPrevented:r=!0}={})=>n=>{const i=e==null?void 0:e(n);if(r===!1||!i)return t==null?void 0:t(n)};var KVe;const Ml=typeof window<"u",B8r=e=>typeof e=="string",XVe=()=>{},D8r=Ml&&((KVe=window==null?void 0:window.navigator)==null?void 0:KVe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function JVe(e){return typeof e=="function"?e():a.unref(e)}function F8r(e){return e}function jB(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function z8r(e,t=!0){a.getCurrentInstance()?a.onMounted(e):t?e():a.nextTick(e)}function Kp(e){var t;const r=JVe(e);return(t=r==null?void 0:r.$el)!=null?t:r}const UB=Ml?window:void 0;function J5(...e){let t,r,n,i;if(B8r(e[0])||Array.isArray(e[0])?([r,n,i]=e,t=UB):[t,r,n,i]=e,!t)return XVe;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(d=>d()),o.length=0},l=(d,p,h,f)=>(d.addEventListener(p,h,f),()=>d.removeEventListener(p,h,f)),c=a.watch(()=>[Kp(t),JVe(i)],([d,p])=>{s(),d&&o.push(...r.flatMap(h=>n.map(f=>l(d,h,f,p))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return jB(u),u}let YVe=!1;function j8r(e,t,r={}){const{window:n=UB,ignore:i=[],capture:o=!0,detectIframe:s=!1}=r;if(!n)return;D8r&&!YVe&&(YVe=!0,Array.from(n.document.body.children).forEach(d=>d.addEventListener("click",XVe)));let l=!0;const c=d=>i.some(p=>{if(typeof p=="string")return Array.from(n.document.querySelectorAll(p)).some(h=>h===d.target||d.composedPath().includes(h));{const h=Kp(p);return h&&(d.target===h||d.composedPath().includes(h))}}),u=[J5(n,"click",d=>{const p=Kp(e);if(!(!p||p===d.target||d.composedPath().includes(p))){if(d.detail===0&&(l=!c(d)),!l){l=!0;return}t(d)}},{passive:!0,capture:o}),J5(n,"pointerdown",d=>{const p=Kp(e);p&&(l=!d.composedPath().includes(p)&&!c(d))},{passive:!0}),s&&J5(n,"blur",d=>{var p;const h=Kp(e);((p=n.document.activeElement)==null?void 0:p.tagName)==="IFRAME"&&!(h!=null&&h.contains(n.document.activeElement))&&t(d)})].filter(Boolean);return()=>u.forEach(d=>d())}function $Ve(e,t=!1){const r=a.ref(),n=()=>r.value=!!e();return n(),z8r(n,t),r}const eIe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tIe="__vueuse_ssr_handlers__";eIe[tIe]=eIe[tIe]||{};var rIe=Object.getOwnPropertySymbols,U8r=Object.prototype.hasOwnProperty,G8r=Object.prototype.propertyIsEnumerable,q8r=(e,t)=>{var r={};for(var n in e)U8r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&rIe)for(var n of rIe(e))t.indexOf(n)<0&&G8r.call(e,n)&&(r[n]=e[n]);return r};function Xp(e,t,r={}){const n=r,{window:i=UB}=n,o=q8r(n,["window"]);let s;const l=$Ve(()=>i&&"ResizeObserver"in i),c=()=>{s&&(s.disconnect(),s=void 0)},u=a.watch(()=>Kp(e),p=>{c(),l.value&&i&&p&&(s=new ResizeObserver(t),s.observe(p,o))},{immediate:!0,flush:"post"}),d=()=>{c(),u()};return jB(d),{isSupported:l,stop:d}}var nIe=Object.getOwnPropertySymbols,Z8r=Object.prototype.hasOwnProperty,W8r=Object.prototype.propertyIsEnumerable,K8r=(e,t)=>{var r={};for(var n in e)Z8r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nIe)for(var n of nIe(e))t.indexOf(n)<0&&W8r.call(e,n)&&(r[n]=e[n]);return r};function X8r(e,t,r={}){const n=r,{window:i=UB}=n,o=K8r(n,["window"]);let s;const l=$Ve(()=>i&&"MutationObserver"in i),c=()=>{s&&(s.disconnect(),s=void 0)},u=a.watch(()=>Kp(e),p=>{c(),l.value&&i&&p&&(s=new MutationObserver(t),s.observe(p,o))},{immediate:!0}),d=()=>{c(),u()};return jB(d),{isSupported:l,stop:d}}var iIe;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(iIe||(iIe={}));var J8r=Object.defineProperty,oIe=Object.getOwnPropertySymbols,Y8r=Object.prototype.hasOwnProperty,$8r=Object.prototype.propertyIsEnumerable,aIe=(e,t,r)=>t in e?J8r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,emr=(e,t)=>{for(var r in t||(t={}))Y8r.call(t,r)&&aIe(e,r,t[r]);if(oIe)for(var r of oIe(t))$8r.call(t,r)&&aIe(e,r,t[r]);return e};emr({linear:F8r},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});const tmr=()=>Ml&&/firefox/i.test(window.navigator.userAgent);/**
4720
4720
  * @vue/shared v3.4.15
4721
4721
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4722
4722
  * @license MIT