@abi-software/scaffoldvuer 1.21.1-beta.1 → 1.21.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scaffoldvuer.js +19 -8
- package/dist/scaffoldvuer.umd.cjs +2 -2
- package/package.json +2 -2
|
@@ -552,11 +552,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
552
552
|
`),d=`${this.fontWeight} ${this.fontSize}px ${this.fontFace}`;n.font=d;var f=Math.max.apply(Math,ZY(u.map(function(e){return n.measureText(e).width}))),p=this.fontSize*u.length,m=f+a[0]*2+c[0]*2,h=p+a[1]*2+c[1]*2;if(t.width=m+Math.abs(l[0]),t.height=h+Math.abs(l[1]),n.translate.apply(n,ZY(l.map(function(e){return Math.max(0,e)}))),this.borderWidth){if(n.strokeStyle=this.borderColor,a[0]){var g=a[0]/2;n.lineWidth=a[0],n.beginPath(),n.moveTo(g,o[0]),n.lineTo(g,h-o[3]),n.moveTo(m-g,o[1]),n.lineTo(m-g,h-o[2]),n.stroke()}if(a[1]){var _=a[1]/2;n.lineWidth=a[1],n.beginPath(),n.moveTo(Math.max(a[0],o[0]),_),n.lineTo(m-Math.max(a[0],o[1]),_),n.moveTo(Math.max(a[0],o[3]),h-_),n.lineTo(m-Math.max(a[0],o[2]),h-_),n.stroke()}if(this.borderRadius){var v=Math.max.apply(Math,ZY(a)),y=v/2;n.lineWidth=v,n.beginPath(),[!!o[0]&&[o[0],y,y,o[0]],!!o[1]&&[m-o[1],m-y,y,o[1]],!!o[2]&&[m-o[2],m-y,h-y,h-o[2]],!!o[3]&&[o[3],y,h-y,h-o[3]]].filter(function(e){return e}).forEach(function(e){var t=XY(e,4),r=t[0],i=t[1],a=t[2],o=t[3];n.moveTo(r,a),n.quadraticCurveTo(i,a,i,o)}),n.stroke()}}this.backgroundColor&&(n.fillStyle=this.backgroundColor,this.borderRadius?(n.beginPath(),n.moveTo(a[0],o[0]),[[a[0],o[0],m-o[1],a[1],a[1],a[1]],[m-a[0],m-a[0],m-a[0],a[1],o[1],h-o[2]],[m-a[0],m-o[2],o[3],h-a[1],h-a[1],h-a[1]],[a[0],a[0],a[0],h-a[1],h-o[3],o[0]]].forEach(function(e){var t=XY(e,6),r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];n.quadraticCurveTo(r,o,i,s),n.lineTo(a,c)}),n.closePath(),n.fill()):n.fillRect(a[0],a[1],m-a[0]*2,h-a[1]*2)),n.translate.apply(n,ZY(a)),n.translate.apply(n,ZY(c)),n.font=d,n.fillStyle=this.color,n.textBaseline=`bottom`;var b=this.strokeWidth>0;b&&(n.lineWidth=this.strokeWidth*this.fontSize/10,n.strokeStyle=this.strokeColor),u.forEach(function(t,r){var i=(f-n.measureText(t).width)/2,a=(r+1)*e.fontSize;b&&n.strokeText(t,i,a),n.fillText(t,i,a)}),this.material.map&&this.material.map.dispose();var x=this.material.map=new eX.CanvasTexture(t);x.colorSpace=eX.SRGBColorSpace;var S=this.textHeight*u.length+i[1]*2+s[1]*2+Math.abs(this.offsetY);this.scale.set(S*t.width/t.height,S,0)}},{key:`clone`,value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:`copy`,value:function(e){return eX.Sprite.prototype.copy.call(this,e),this.color=e.color,this.backgroundColor=e.backgroundColor,this.padding=e.padding,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.offsetX=e.offsetX,this.offsetY=e.offsetY,this.fontFace=e.fontFace,this.fontSize=e.fontSize,this.fontWeight=e.fontWeight,this.strokeWidth=e.strokeWidth,this.strokeColor=e.strokeColor,this}}])}(eX.Sprite)})),due=h({BRDF_GGX:()=>nX,BRDF_Lambert:()=>rX,BasicPointShadowFilter:()=>iX,BasicShadowFilter:()=>aX,Break:()=>oX,Const:()=>sX,Continue:()=>cX,DFGLUT:()=>lX,D_GGX:()=>uX,Discard:()=>dX,EPSILON:()=>fX,F_Schlick:()=>pX,Fn:()=>mX,HALF_PI:()=>DX,INFINITY:()=>hX,If:()=>gX,Loop:()=>_X,NodeAccess:()=>vX,NodeShaderStage:()=>yX,NodeType:()=>bX,NodeUpdateType:()=>xX,OnBeforeMaterialUpdate:()=>M4,OnBeforeObjectUpdate:()=>j4,OnMaterialUpdate:()=>P4,OnObjectUpdate:()=>N4,PCFShadowFilter:()=>SX,PCFSoftShadowFilter:()=>CX,PI:()=>wX,PI2:()=>TX,PointShadowFilter:()=>OX,Return:()=>kX,Schlick_to_F0:()=>AX,ShaderNode:()=>jX,Stack:()=>MX,Switch:()=>NX,TBNViewMatrix:()=>PX,TWO_PI:()=>EX,VSMShadowFilter:()=>FX,V_GGX_SmithCorrelated:()=>IX,Var:()=>LX,VarIntent:()=>RX,abs:()=>zX,acesFilmicToneMapping:()=>BX,acos:()=>VX,acosh:()=>HX,add:()=>UX,addMethodChaining:()=>WX,addNodeElement:()=>GX,agxToneMapping:()=>KX,all:()=>qX,alphaT:()=>JX,ambientOcclusion:()=>YX,and:()=>XX,anisotropy:()=>ZX,anisotropyB:()=>QX,anisotropyT:()=>$X,any:()=>eZ,append:()=>tZ,array:()=>nZ,asin:()=>rZ,asinh:()=>iZ,assign:()=>aZ,atan:()=>oZ,atanh:()=>sZ,atomicAdd:()=>cZ,atomicAnd:()=>lZ,atomicFunc:()=>uZ,atomicLoad:()=>dZ,atomicMax:()=>fZ,atomicMin:()=>pZ,atomicOr:()=>mZ,atomicStore:()=>hZ,atomicSub:()=>gZ,atomicXor:()=>_Z,attenuationColor:()=>vZ,attenuationDistance:()=>yZ,attribute:()=>bZ,attributeArray:()=>xZ,backgroundBlurriness:()=>SZ,backgroundIntensity:()=>CZ,backgroundRotation:()=>wZ,batch:()=>TZ,bentNormalView:()=>EZ,billboarding:()=>DZ,bitAnd:()=>OZ,bitNot:()=>kZ,bitOr:()=>AZ,bitXor:()=>jZ,bitangentGeometry:()=>MZ,bitangentLocal:()=>NZ,bitangentView:()=>PZ,bitangentWorld:()=>FZ,bitcast:()=>IZ,blendBurn:()=>LZ,blendColor:()=>RZ,blendDodge:()=>zZ,blendOverlay:()=>BZ,blendScreen:()=>VZ,blur:()=>HZ,bool:()=>UZ,buffer:()=>WZ,bufferAttribute:()=>GZ,builtin:()=>qZ,builtinAOContext:()=>JZ,builtinShadowContext:()=>YZ,bumpMap:()=>KZ,bvec2:()=>XZ,bvec3:()=>ZZ,bvec4:()=>QZ,bypass:()=>$Z,cache:()=>eQ,call:()=>tQ,cameraFar:()=>nQ,cameraIndex:()=>rQ,cameraNear:()=>iQ,cameraNormalMatrix:()=>aQ,cameraPosition:()=>oQ,cameraProjectionMatrix:()=>sQ,cameraProjectionMatrixInverse:()=>cQ,cameraViewMatrix:()=>lQ,cameraViewport:()=>uQ,cameraWorldMatrix:()=>dQ,cbrt:()=>fQ,cdl:()=>pQ,ceil:()=>mQ,checker:()=>hQ,cineonToneMapping:()=>gQ,clamp:()=>_Q,clearcoat:()=>vQ,clearcoatNormalView:()=>yQ,clearcoatRoughness:()=>bQ,clipSpace:()=>xQ,code:()=>SQ,color:()=>CQ,colorSpaceToWorking:()=>wQ,colorToDirection:()=>TQ,compute:()=>EQ,computeKernel:()=>DQ,computeSkinning:()=>OQ,context:()=>kQ,convert:()=>AQ,convertColorSpace:()=>jQ,convertToTexture:()=>MQ,cos:()=>IQ,cosh:()=>LQ,countLeadingZeros:()=>NQ,countOneBits:()=>PQ,countTrailingZeros:()=>FQ,cross:()=>RQ,cubeTexture:()=>zQ,cubeTextureBase:()=>BQ,dFdx:()=>VQ,dFdy:()=>HQ,dashSize:()=>UQ,debug:()=>WQ,decrement:()=>GQ,decrementBefore:()=>KQ,defaultBuildStages:()=>qQ,defaultShaderStages:()=>JQ,defined:()=>YQ,degrees:()=>XQ,deltaTime:()=>ZQ,densityFog:()=>QQ,densityFogFactor:()=>$Q,depth:()=>e$,depthPass:()=>t$,determinant:()=>n$,difference:()=>r$,diffuseColor:()=>i$,directPointLight:()=>a$,directionToColor:()=>o$,directionToFaceDirection:()=>s$,dispersion:()=>c$,distance:()=>l$,div:()=>u$,dot:()=>d$,drawIndex:()=>f$,dynamicBufferAttribute:()=>p$,element:()=>m$,emissive:()=>h$,equal:()=>g$,equirectDirection:()=>_$,equirectUV:()=>v$,exp:()=>y$,exp2:()=>b$,exponentialHeightFogFactor:()=>x$,expression:()=>S$,faceDirection:()=>C$,faceForward:()=>w$,faceforward:()=>T$,float:()=>E$,floatBitsToInt:()=>D$,floatBitsToUint:()=>O$,floor:()=>k$,fog:()=>A$,fract:()=>j$,frameGroup:()=>M$,frameId:()=>N$,frontFacing:()=>P$,fwidth:()=>F$,gain:()=>I$,gapSize:()=>L$,getConstNodeType:()=>R$,getCurrentStack:()=>z$,getDirection:()=>B$,getDistanceAttenuation:()=>V$,getGeometryRoughness:()=>H$,getNormalFromDepth:()=>U$,getParallaxCorrectNormal:()=>K$,getRoughness:()=>q$,getScreenPosition:()=>J$,getShIrradianceAt:()=>Y$,getShadowMaterial:()=>X$,getShadowRenderObjectFunction:()=>Z$,getTextureIndex:()=>Q$,getViewPosition:()=>e1,globalId:()=>t1,glsl:()=>n1,glslFn:()=>r1,grayscale:()=>i1,greaterThan:()=>a1,greaterThanEqual:()=>o1,hash:()=>s1,highpModelNormalViewMatrix:()=>c1,highpModelViewMatrix:()=>l1,hue:()=>u1,increment:()=>d1,incrementBefore:()=>f1,instance:()=>p1,instanceIndex:()=>m1,instancedArray:()=>h1,instancedBufferAttribute:()=>g1,instancedDynamicBufferAttribute:()=>_1,instancedMesh:()=>v1,int:()=>y1,intBitsToFloat:()=>b1,interleavedGradientNoise:()=>W$,inverse:()=>x1,inverseSqrt:()=>S1,inversesqrt:()=>C1,invocationLocalIndex:()=>w1,invocationSubgroupIndex:()=>T1,ior:()=>E1,iridescence:()=>D1,iridescenceIOR:()=>O1,iridescenceThickness:()=>k1,ivec2:()=>A1,ivec3:()=>j1,ivec4:()=>M1,js:()=>N1,label:()=>P1,length:()=>F1,lengthSq:()=>I1,lessThan:()=>L1,lessThanEqual:()=>R1,lightPosition:()=>z1,lightProjectionUV:()=>B1,lightShadowMatrix:()=>V1,lightTargetDirection:()=>H1,lightTargetPosition:()=>U1,lightViewPosition:()=>W1,lightingContext:()=>G1,lights:()=>K1,linearDepth:()=>q1,linearToneMapping:()=>J1,localId:()=>Y1,log:()=>X1,log2:()=>Z1,logarithmicDepthToViewZ:()=>Q1,luminance:()=>$1,mat2:()=>e0,mat3:()=>t0,mat4:()=>n0,matcapUV:()=>r0,materialAO:()=>i0,materialAlphaTest:()=>a0,materialAnisotropy:()=>o0,materialAnisotropyVector:()=>s0,materialAttenuationColor:()=>c0,materialAttenuationDistance:()=>l0,materialClearcoat:()=>u0,materialClearcoatNormal:()=>d0,materialClearcoatRoughness:()=>f0,materialColor:()=>p0,materialDispersion:()=>m0,materialEmissive:()=>h0,materialEnvIntensity:()=>g0,materialEnvRotation:()=>_0,materialIOR:()=>v0,materialIridescence:()=>y0,materialIridescenceIOR:()=>b0,materialIridescenceThickness:()=>x0,materialLightMap:()=>S0,materialLineDashOffset:()=>C0,materialLineDashSize:()=>w0,materialLineGapSize:()=>T0,materialLineScale:()=>E0,materialLineWidth:()=>D0,materialMetalness:()=>O0,materialNormal:()=>k0,materialOpacity:()=>A0,materialPointSize:()=>j0,materialReference:()=>M0,materialReflectivity:()=>N0,materialRefractionRatio:()=>P0,materialRotation:()=>F0,materialRoughness:()=>I0,materialSheen:()=>L0,materialSheenRoughness:()=>R0,materialShininess:()=>z0,materialSpecular:()=>B0,materialSpecularColor:()=>V0,materialSpecularIntensity:()=>H0,materialSpecularStrength:()=>U0,materialThickness:()=>W0,materialTransmission:()=>G0,max:()=>K0,maxMipLevel:()=>q0,mediumpModelViewMatrix:()=>J0,metalness:()=>Y0,min:()=>X0,mix:()=>Z0,mixElement:()=>Q0,mod:()=>$0,modelDirection:()=>e2,modelNormalMatrix:()=>t2,modelPosition:()=>n2,modelRadius:()=>r2,modelScale:()=>i2,modelViewMatrix:()=>a2,modelViewPosition:()=>o2,modelViewProjection:()=>s2,modelWorldMatrix:()=>c2,modelWorldMatrixInverse:()=>l2,morphReference:()=>u2,mrt:()=>d2,mul:()=>f2,mx_aastep:()=>p2,mx_add:()=>m2,mx_atan2:()=>h2,mx_cell_noise_float:()=>g2,mx_contrast:()=>_2,mx_divide:()=>v2,mx_fractal_noise_float:()=>y2,mx_fractal_noise_vec2:()=>b2,mx_fractal_noise_vec3:()=>x2,mx_fractal_noise_vec4:()=>S2,mx_frame:()=>C2,mx_heighttonormal:()=>w2,mx_hsvtorgb:()=>T2,mx_ifequal:()=>E2,mx_ifgreater:()=>D2,mx_ifgreatereq:()=>O2,mx_invert:()=>k2,mx_modulo:()=>A2,mx_multiply:()=>j2,mx_noise_float:()=>M2,mx_noise_vec3:()=>N2,mx_noise_vec4:()=>P2,mx_place2d:()=>F2,mx_power:()=>I2,mx_ramp4:()=>L2,mx_ramplr:()=>R2,mx_ramptb:()=>z2,mx_rgbtohsv:()=>B2,mx_rotate2d:()=>V2,mx_rotate3d:()=>H2,mx_safepower:()=>U2,mx_separate:()=>W2,mx_splitlr:()=>G2,mx_splittb:()=>K2,mx_srgb_texture_to_lin_rec709:()=>q2,mx_subtract:()=>J2,mx_timer:()=>Y2,mx_transform_uv:()=>X2,mx_unifiednoise2d:()=>Z2,mx_unifiednoise3d:()=>Q2,mx_worley_noise_float:()=>$2,mx_worley_noise_vec2:()=>e4,mx_worley_noise_vec3:()=>t4,negate:()=>n4,negateOnBackSide:()=>r4,neutralToneMapping:()=>i4,nodeArray:()=>a4,nodeImmutable:()=>o4,nodeObject:()=>s4,nodeObjectIntent:()=>c4,nodeObjects:()=>l4,nodeProxy:()=>u4,nodeProxyIntent:()=>d4,normalFlat:()=>f4,normalGeometry:()=>p4,normalLocal:()=>m4,normalMap:()=>h4,normalView:()=>g4,normalViewGeometry:()=>_4,normalWorld:()=>v4,normalWorldGeometry:()=>y4,normalize:()=>b4,not:()=>x4,notEqual:()=>S4,numWorkgroups:()=>C4,objectDirection:()=>w4,objectGroup:()=>T4,objectPosition:()=>E4,objectRadius:()=>D4,objectScale:()=>O4,objectViewPosition:()=>k4,objectWorldMatrix:()=>A4,oneMinus:()=>F4,or:()=>I4,orthographicDepthToViewZ:()=>L4,oscSawtooth:()=>R4,oscSine:()=>z4,oscSquare:()=>B4,oscTriangle:()=>V4,output:()=>H4,outputStruct:()=>U4,overloadingFn:()=>W4,overrideNode:()=>G4,overrideNodes:()=>K4,packHalf2x16:()=>q4,packNormalToRGB:()=>X4,packSnorm2x16:()=>J4,packUnorm2x16:()=>Y4,parabola:()=>Z4,parallaxDirection:()=>Q4,parallaxUV:()=>$4,parameter:()=>e3,pass:()=>t3,passTexture:()=>n3,pcurve:()=>r3,perspectiveDepthToViewZ:()=>i3,pmremTexture:()=>a3,pointShadow:()=>o3,pointUV:()=>s3,pointWidth:()=>c3,positionGeometry:()=>l3,positionLocal:()=>u3,positionPrevious:()=>d3,positionView:()=>f3,positionViewDirection:()=>p3,positionWorld:()=>m3,positionWorldDirection:()=>h3,posterize:()=>g3,pow:()=>_3,pow2:()=>v3,pow3:()=>y3,pow4:()=>b3,premultiplyAlpha:()=>x3,property:()=>S3,radians:()=>C3,rand:()=>w3,range:()=>T3,rangeFog:()=>E3,rangeFogFactor:()=>D3,reciprocal:()=>O3,reference:()=>k3,referenceBuffer:()=>A3,reflect:()=>j3,reflectVector:()=>M3,reflectView:()=>N3,reflector:()=>P3,refract:()=>F3,refractVector:()=>I3,refractView:()=>L3,reinhardToneMapping:()=>R3,remap:()=>z3,remapClamp:()=>B3,renderGroup:()=>V3,renderOutput:()=>H3,rendererReference:()=>U3,replaceDefaultUV:()=>W3,rotate:()=>G3,rotateUV:()=>K3,roughness:()=>q3,round:()=>J3,rtt:()=>Y3,sRGBTransferEOTF:()=>X3,sRGBTransferOETF:()=>Z3,sample:()=>Q3,sampler:()=>$3,samplerComparison:()=>e6,saturate:()=>t6,saturation:()=>n6,screen:()=>r6,screenCoordinate:()=>i6,screenDPR:()=>a6,screenSize:()=>o6,screenUV:()=>s6,select:()=>c6,setCurrentStack:()=>l6,setName:()=>u6,shaderStages:()=>d6,shadow:()=>f6,shadowPositionWorld:()=>p6,shapeCircle:()=>m6,sharedUniformGroup:()=>h6,sheen:()=>g6,sheenRoughness:()=>_6,shiftLeft:()=>v6,shiftRight:()=>y6,shininess:()=>b6,sign:()=>x6,sin:()=>S6,sinc:()=>w6,sinh:()=>C6,skinning:()=>T6,smoothstep:()=>E6,smoothstepElement:()=>D6,specularColor:()=>O6,specularF90:()=>k6,spherizeUV:()=>A6,split:()=>j6,spritesheetUV:()=>M6,sqrt:()=>N6,stack:()=>P6,step:()=>F6,stepElement:()=>I6,storage:()=>L6,storageBarrier:()=>R6,storageTexture:()=>z6,storageTexture3D:()=>B6,struct:()=>V6,sub:()=>H6,subBuild:()=>X6,subgroupAdd:()=>U6,subgroupAll:()=>W6,subgroupAnd:()=>G6,subgroupAny:()=>K6,subgroupBallot:()=>q6,subgroupBroadcast:()=>J6,subgroupBroadcastFirst:()=>Y6,subgroupElect:()=>Z6,subgroupExclusiveAdd:()=>Q6,subgroupExclusiveMul:()=>$6,subgroupInclusiveAdd:()=>e8,subgroupInclusiveMul:()=>t8,subgroupIndex:()=>n8,subgroupMax:()=>r8,subgroupMin:()=>i8,subgroupMul:()=>a8,subgroupOr:()=>o8,subgroupShuffle:()=>s8,subgroupShuffleDown:()=>c8,subgroupShuffleUp:()=>l8,subgroupShuffleXor:()=>u8,subgroupSize:()=>d8,subgroupXor:()=>f8,tan:()=>p8,tangentGeometry:()=>h8,tangentLocal:()=>g8,tangentView:()=>_8,tangentWorld:()=>v8,tanh:()=>m8,texture:()=>y8,texture3D:()=>b8,textureBarrier:()=>x8,textureBicubic:()=>S8,textureBicubicLevel:()=>C8,textureCubeUV:()=>w8,textureLevel:()=>D8,textureLoad:()=>T8,textureSize:()=>E8,textureStore:()=>O8,thickness:()=>k8,time:()=>A8,toneMapping:()=>j8,toneMappingExposure:()=>M8,toonOutlinePass:()=>N8,transformDirection:()=>P8,transformNormal:()=>F8,transformNormalByInverseViewMatrix:()=>I8,transformNormalByViewMatrix:()=>L8,transformNormalToView:()=>R8,transformedClearcoatNormalView:()=>z8,transformedNormalView:()=>B8,transformedNormalWorld:()=>V8,transmission:()=>H8,transpose:()=>U8,triNoise3D:()=>W8,triplanarTexture:()=>G8,triplanarTextures:()=>K8,trunc:()=>q8,uint:()=>J8,uintBitsToFloat:()=>Y8,uniform:()=>X8,uniformArray:()=>Z8,uniformCubeTexture:()=>Q8,uniformFlow:()=>e5,uniformGroup:()=>$8,uniformTexture:()=>t5,unpackHalf2x16:()=>n5,unpackRGBToNormal:()=>a5,unpackSnorm2x16:()=>r5,unpackUnorm2x16:()=>i5,unpremultiplyAlpha:()=>o5,userData:()=>s5,uv:()=>c5,uvec2:()=>l5,uvec3:()=>u5,uvec4:()=>d5,varying:()=>f5,varyingProperty:()=>p5,vec2:()=>m5,vec3:()=>h5,vec4:()=>g5,vectorComponents:()=>_5,velocity:()=>v5,vertexColor:()=>y5,vertexIndex:()=>b5,vertexStage:()=>x5,vibrance:()=>S5,viewZToLogarithmicDepth:()=>C5,viewZToOrthographicDepth:()=>w5,viewZToPerspectiveDepth:()=>T5,viewZToReversedOrthographicDepth:()=>E5,viewZToReversedPerspectiveDepth:()=>D5,viewport:()=>O5,viewportCoordinate:()=>k5,viewportDepthTexture:()=>A5,viewportLinearDepth:()=>j5,viewportMipTexture:()=>M5,viewportOpaqueMipTexture:()=>N5,viewportResolution:()=>P5,viewportSafeUV:()=>F5,viewportSharedTexture:()=>I5,viewportSize:()=>L5,viewportTexture:()=>R5,viewportUV:()=>z5,vogelDiskSample:()=>G$,wgsl:()=>B5,wgslFn:()=>V5,workgroupArray:()=>H5,workgroupBarrier:()=>U5,workgroupId:()=>W5,workingToColorSpace:()=>G5,xor:()=>K5}),nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ,AZ,jZ,MZ,NZ,PZ,FZ,IZ,LZ,RZ,zZ,BZ,VZ,HZ,UZ,WZ,GZ,KZ,qZ,JZ,YZ,XZ,ZZ,QZ,$Z,eQ,tQ,nQ,rQ,iQ,aQ,oQ,sQ,cQ,lQ,uQ,dQ,fQ,pQ,mQ,hQ,gQ,_Q,vQ,yQ,bQ,xQ,SQ,CQ,wQ,TQ,EQ,DQ,OQ,kQ,AQ,jQ,MQ,NQ,PQ,FQ,IQ,LQ,RQ,zQ,BQ,VQ,HQ,UQ,WQ,GQ,KQ,qQ,JQ,YQ,XQ,ZQ,QQ,$Q,e$,t$,n$,r$,i$,a$,o$,s$,c$,l$,u$,d$,f$,p$,m$,h$,g$,_$,v$,y$,b$,x$,S$,C$,w$,T$,E$,D$,O$,k$,A$,j$,M$,N$,P$,F$,I$,L$,R$,z$,B$,V$,H$,U$,W$,G$,K$,q$,J$,Y$,X$,Z$,Q$,e1,t1,n1,r1,i1,a1,o1,s1,c1,l1,u1,d1,f1,p1,m1,h1,g1,_1,v1,y1,b1,x1,S1,C1,w1,T1,E1,D1,O1,k1,A1,j1,M1,N1,P1,F1,I1,L1,R1,z1,B1,V1,H1,U1,W1,G1,K1,q1,J1,Y1,X1,Z1,Q1,$1,e0,t0,n0,r0,i0,a0,o0,s0,c0,l0,u0,d0,f0,p0,m0,h0,g0,_0,v0,y0,b0,x0,S0,C0,w0,T0,E0,D0,O0,k0,A0,j0,M0,N0,P0,F0,I0,L0,R0,z0,B0,V0,H0,U0,W0,G0,K0,q0,J0,Y0,X0,Z0,Q0,$0,e2,t2,n2,r2,i2,a2,o2,s2,c2,l2,u2,d2,f2,p2,m2,h2,g2,_2,v2,y2,b2,x2,S2,C2,w2,T2,E2,D2,O2,k2,A2,j2,M2,N2,P2,F2,I2,L2,R2,z2,B2,V2,H2,U2,W2,G2,K2,q2,J2,Y2,X2,Z2,Q2,$2,e4,t4,n4,r4,i4,a4,o4,s4,c4,l4,u4,d4,f4,p4,m4,h4,g4,_4,v4,y4,b4,x4,S4,C4,w4,T4,E4,D4,O4,k4,A4,j4,M4,N4,P4,F4,I4,L4,R4,z4,B4,V4,H4,U4,W4,G4,K4,q4,J4,Y4,X4,Z4,Q4,$4,e3,t3,n3,r3,i3,a3,o3,s3,c3,l3,u3,d3,f3,p3,m3,h3,g3,_3,v3,y3,b3,x3,S3,C3,w3,T3,E3,D3,O3,k3,A3,j3,M3,N3,P3,F3,I3,L3,R3,z3,B3,V3,H3,U3,W3,G3,K3,q3,J3,Y3,X3,Z3,Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6,l6,u6,d6,f6,p6,m6,h6,g6,_6,v6,y6,b6,x6,S6,C6,w6,T6,E6,D6,O6,k6,A6,j6,M6,N6,P6,F6,I6,L6,R6,z6,B6,V6,H6,U6,W6,G6,K6,q6,J6,Y6,X6,Z6,Q6,$6,e8,t8,n8,r8,i8,a8,o8,s8,c8,l8,u8,d8,f8,p8,m8,h8,g8,_8,v8,y8,b8,x8,S8,C8,w8,T8,E8,D8,O8,k8,A8,j8,M8,N8,P8,F8,I8,L8,R8,z8,B8,V8,H8,U8,W8,G8,K8,q8,J8,Y8,X8,Z8,Q8,$8,e5,t5,n5,r5,i5,a5,o5,s5,c5,l5,u5,d5,f5,p5,m5,h5,g5,_5,v5,y5,b5,x5,S5,C5,w5,T5,E5,D5,O5,k5,A5,j5,M5,N5,P5,F5,I5,L5,R5,z5,B5,V5,H5,U5,W5,G5,K5,fue=p((()=>{WY(),nX=Q.BRDF_GGX,rX=Q.BRDF_Lambert,iX=Q.BasicPointShadowFilter,aX=Q.BasicShadowFilter,oX=Q.Break,sX=Q.Const,cX=Q.Continue,lX=Q.DFGLUT,uX=Q.D_GGX,dX=Q.Discard,fX=Q.EPSILON,pX=Q.F_Schlick,mX=Q.Fn,hX=Q.INFINITY,gX=Q.If,_X=Q.Loop,vX=Q.NodeAccess,yX=Q.NodeShaderStage,bX=Q.NodeType,xX=Q.NodeUpdateType,SX=Q.PCFShadowFilter,CX=Q.PCFSoftShadowFilter,wX=Q.PI,TX=Q.PI2,EX=Q.TWO_PI,DX=Q.HALF_PI,OX=Q.PointShadowFilter,kX=Q.Return,AX=Q.Schlick_to_F0,jX=Q.ShaderNode,MX=Q.Stack,NX=Q.Switch,PX=Q.TBNViewMatrix,FX=Q.VSMShadowFilter,IX=Q.V_GGX_SmithCorrelated,LX=Q.Var,RX=Q.VarIntent,zX=Q.abs,BX=Q.acesFilmicToneMapping,VX=Q.acos,HX=Q.acosh,UX=Q.add,WX=Q.addMethodChaining,GX=Q.addNodeElement,KX=Q.agxToneMapping,qX=Q.all,JX=Q.alphaT,YX=Q.ambientOcclusion,XX=Q.and,ZX=Q.anisotropy,QX=Q.anisotropyB,$X=Q.anisotropyT,eZ=Q.any,tZ=Q.append,nZ=Q.array,rZ=Q.asin,iZ=Q.asinh,aZ=Q.assign,oZ=Q.atan,sZ=Q.atanh,cZ=Q.atomicAdd,lZ=Q.atomicAnd,uZ=Q.atomicFunc,dZ=Q.atomicLoad,fZ=Q.atomicMax,pZ=Q.atomicMin,mZ=Q.atomicOr,hZ=Q.atomicStore,gZ=Q.atomicSub,_Z=Q.atomicXor,vZ=Q.attenuationColor,yZ=Q.attenuationDistance,bZ=Q.attribute,xZ=Q.attributeArray,SZ=Q.backgroundBlurriness,CZ=Q.backgroundIntensity,wZ=Q.backgroundRotation,TZ=Q.batch,EZ=Q.bentNormalView,DZ=Q.billboarding,OZ=Q.bitAnd,kZ=Q.bitNot,AZ=Q.bitOr,jZ=Q.bitXor,MZ=Q.bitangentGeometry,NZ=Q.bitangentLocal,PZ=Q.bitangentView,FZ=Q.bitangentWorld,IZ=Q.bitcast,LZ=Q.blendBurn,RZ=Q.blendColor,zZ=Q.blendDodge,BZ=Q.blendOverlay,VZ=Q.blendScreen,HZ=Q.blur,UZ=Q.bool,WZ=Q.buffer,GZ=Q.bufferAttribute,KZ=Q.bumpMap,qZ=Q.builtin,JZ=Q.builtinAOContext,YZ=Q.builtinShadowContext,XZ=Q.bvec2,ZZ=Q.bvec3,QZ=Q.bvec4,$Z=Q.bypass,eQ=Q.cache,tQ=Q.call,nQ=Q.cameraFar,rQ=Q.cameraIndex,iQ=Q.cameraNear,aQ=Q.cameraNormalMatrix,oQ=Q.cameraPosition,sQ=Q.cameraProjectionMatrix,cQ=Q.cameraProjectionMatrixInverse,lQ=Q.cameraViewMatrix,uQ=Q.cameraViewport,dQ=Q.cameraWorldMatrix,fQ=Q.cbrt,pQ=Q.cdl,mQ=Q.ceil,hQ=Q.checker,gQ=Q.cineonToneMapping,_Q=Q.clamp,vQ=Q.clearcoat,yQ=Q.clearcoatNormalView,bQ=Q.clearcoatRoughness,xQ=Q.clipSpace,SQ=Q.code,CQ=Q.color,wQ=Q.colorSpaceToWorking,TQ=Q.colorToDirection,EQ=Q.compute,DQ=Q.computeKernel,OQ=Q.computeSkinning,kQ=Q.context,AQ=Q.convert,jQ=Q.convertColorSpace,MQ=Q.convertToTexture,NQ=Q.countLeadingZeros,PQ=Q.countOneBits,FQ=Q.countTrailingZeros,IQ=Q.cos,LQ=Q.cosh,RQ=Q.cross,zQ=Q.cubeTexture,BQ=Q.cubeTextureBase,VQ=Q.dFdx,HQ=Q.dFdy,UQ=Q.dashSize,WQ=Q.debug,GQ=Q.decrement,KQ=Q.decrementBefore,qQ=Q.defaultBuildStages,JQ=Q.defaultShaderStages,YQ=Q.defined,XQ=Q.degrees,ZQ=Q.deltaTime,QQ=Q.densityFog,$Q=Q.densityFogFactor,e$=Q.depth,t$=Q.depthPass,n$=Q.determinant,r$=Q.difference,i$=Q.diffuseColor,a$=Q.directPointLight,o$=Q.directionToColor,s$=Q.directionToFaceDirection,c$=Q.dispersion,l$=Q.distance,u$=Q.div,d$=Q.dot,f$=Q.drawIndex,p$=Q.dynamicBufferAttribute,m$=Q.element,h$=Q.emissive,g$=Q.equal,_$=Q.equirectDirection,v$=Q.equirectUV,y$=Q.exp,b$=Q.exp2,x$=Q.exponentialHeightFogFactor,S$=Q.expression,C$=Q.faceDirection,w$=Q.faceForward,T$=Q.faceforward,E$=Q.float,D$=Q.floatBitsToInt,O$=Q.floatBitsToUint,k$=Q.floor,A$=Q.fog,j$=Q.fract,M$=Q.frameGroup,N$=Q.frameId,P$=Q.frontFacing,F$=Q.fwidth,I$=Q.gain,L$=Q.gapSize,R$=Q.getConstNodeType,z$=Q.getCurrentStack,B$=Q.getDirection,V$=Q.getDistanceAttenuation,H$=Q.getGeometryRoughness,U$=Q.getNormalFromDepth,W$=Q.interleavedGradientNoise,G$=Q.vogelDiskSample,K$=Q.getParallaxCorrectNormal,q$=Q.getRoughness,J$=Q.getScreenPosition,Y$=Q.getShIrradianceAt,X$=Q.getShadowMaterial,Z$=Q.getShadowRenderObjectFunction,Q$=Q.getTextureIndex,e1=Q.getViewPosition,t1=Q.globalId,n1=Q.glsl,r1=Q.glslFn,i1=Q.grayscale,a1=Q.greaterThan,o1=Q.greaterThanEqual,s1=Q.hash,c1=Q.highpModelNormalViewMatrix,l1=Q.highpModelViewMatrix,u1=Q.hue,d1=Q.increment,f1=Q.incrementBefore,p1=Q.instance,m1=Q.instanceIndex,h1=Q.instancedArray,g1=Q.instancedBufferAttribute,_1=Q.instancedDynamicBufferAttribute,v1=Q.instancedMesh,y1=Q.int,b1=Q.intBitsToFloat,x1=Q.inverse,S1=Q.inverseSqrt,C1=Q.inversesqrt,w1=Q.invocationLocalIndex,T1=Q.invocationSubgroupIndex,E1=Q.ior,D1=Q.iridescence,O1=Q.iridescenceIOR,k1=Q.iridescenceThickness,A1=Q.ivec2,j1=Q.ivec3,M1=Q.ivec4,N1=Q.js,P1=Q.label,F1=Q.length,I1=Q.lengthSq,L1=Q.lessThan,R1=Q.lessThanEqual,z1=Q.lightPosition,B1=Q.lightProjectionUV,V1=Q.lightShadowMatrix,H1=Q.lightTargetDirection,U1=Q.lightTargetPosition,W1=Q.lightViewPosition,G1=Q.lightingContext,K1=Q.lights,q1=Q.linearDepth,J1=Q.linearToneMapping,Y1=Q.localId,X1=Q.log,Z1=Q.log2,Q1=Q.logarithmicDepthToViewZ,$1=Q.luminance,e0=Q.mat2,t0=Q.mat3,n0=Q.mat4,r0=Q.matcapUV,i0=Q.materialAO,a0=Q.materialAlphaTest,o0=Q.materialAnisotropy,s0=Q.materialAnisotropyVector,c0=Q.materialAttenuationColor,l0=Q.materialAttenuationDistance,u0=Q.materialClearcoat,d0=Q.materialClearcoatNormal,f0=Q.materialClearcoatRoughness,p0=Q.materialColor,m0=Q.materialDispersion,h0=Q.materialEmissive,g0=Q.materialEnvIntensity,_0=Q.materialEnvRotation,v0=Q.materialIOR,y0=Q.materialIridescence,b0=Q.materialIridescenceIOR,x0=Q.materialIridescenceThickness,S0=Q.materialLightMap,C0=Q.materialLineDashOffset,w0=Q.materialLineDashSize,T0=Q.materialLineGapSize,E0=Q.materialLineScale,D0=Q.materialLineWidth,O0=Q.materialMetalness,k0=Q.materialNormal,A0=Q.materialOpacity,j0=Q.materialPointSize,M0=Q.materialReference,N0=Q.materialReflectivity,P0=Q.materialRefractionRatio,F0=Q.materialRotation,I0=Q.materialRoughness,L0=Q.materialSheen,R0=Q.materialSheenRoughness,z0=Q.materialShininess,B0=Q.materialSpecular,V0=Q.materialSpecularColor,H0=Q.materialSpecularIntensity,U0=Q.materialSpecularStrength,W0=Q.materialThickness,G0=Q.materialTransmission,K0=Q.max,q0=Q.maxMipLevel,J0=Q.mediumpModelViewMatrix,Y0=Q.metalness,X0=Q.min,Z0=Q.mix,Q0=Q.mixElement,$0=Q.mod,e2=Q.modelDirection,t2=Q.modelNormalMatrix,n2=Q.modelPosition,r2=Q.modelRadius,i2=Q.modelScale,a2=Q.modelViewMatrix,o2=Q.modelViewPosition,s2=Q.modelViewProjection,c2=Q.modelWorldMatrix,l2=Q.modelWorldMatrixInverse,u2=Q.morphReference,d2=Q.mrt,f2=Q.mul,p2=Q.mx_aastep,m2=Q.mx_add,h2=Q.mx_atan2,g2=Q.mx_cell_noise_float,_2=Q.mx_contrast,v2=Q.mx_divide,y2=Q.mx_fractal_noise_float,b2=Q.mx_fractal_noise_vec2,x2=Q.mx_fractal_noise_vec3,S2=Q.mx_fractal_noise_vec4,C2=Q.mx_frame,w2=Q.mx_heighttonormal,T2=Q.mx_hsvtorgb,E2=Q.mx_ifequal,D2=Q.mx_ifgreater,O2=Q.mx_ifgreatereq,k2=Q.mx_invert,A2=Q.mx_modulo,j2=Q.mx_multiply,M2=Q.mx_noise_float,N2=Q.mx_noise_vec3,P2=Q.mx_noise_vec4,F2=Q.mx_place2d,I2=Q.mx_power,L2=Q.mx_ramp4,R2=Q.mx_ramplr,z2=Q.mx_ramptb,B2=Q.mx_rgbtohsv,V2=Q.mx_rotate2d,H2=Q.mx_rotate3d,U2=Q.mx_safepower,W2=Q.mx_separate,G2=Q.mx_splitlr,K2=Q.mx_splittb,q2=Q.mx_srgb_texture_to_lin_rec709,J2=Q.mx_subtract,Y2=Q.mx_timer,X2=Q.mx_transform_uv,Z2=Q.mx_unifiednoise2d,Q2=Q.mx_unifiednoise3d,$2=Q.mx_worley_noise_float,e4=Q.mx_worley_noise_vec2,t4=Q.mx_worley_noise_vec3,n4=Q.negate,r4=Q.negateOnBackSide,i4=Q.neutralToneMapping,a4=Q.nodeArray,o4=Q.nodeImmutable,s4=Q.nodeObject,c4=Q.nodeObjectIntent,l4=Q.nodeObjects,u4=Q.nodeProxy,d4=Q.nodeProxyIntent,f4=Q.normalFlat,p4=Q.normalGeometry,m4=Q.normalLocal,h4=Q.normalMap,g4=Q.normalView,_4=Q.normalViewGeometry,v4=Q.normalWorld,y4=Q.normalWorldGeometry,b4=Q.normalize,x4=Q.not,S4=Q.notEqual,C4=Q.numWorkgroups,w4=Q.objectDirection,T4=Q.objectGroup,E4=Q.objectPosition,D4=Q.objectRadius,O4=Q.objectScale,k4=Q.objectViewPosition,A4=Q.objectWorldMatrix,j4=Q.OnBeforeObjectUpdate,M4=Q.OnBeforeMaterialUpdate,N4=Q.OnObjectUpdate,P4=Q.OnMaterialUpdate,F4=Q.oneMinus,I4=Q.or,L4=Q.orthographicDepthToViewZ,R4=Q.oscSawtooth,z4=Q.oscSine,B4=Q.oscSquare,V4=Q.oscTriangle,H4=Q.output,U4=Q.outputStruct,W4=Q.overloadingFn,G4=Q.overrideNode,K4=Q.overrideNodes,q4=Q.packHalf2x16,J4=Q.packSnorm2x16,Y4=Q.packUnorm2x16,X4=Q.packNormalToRGB,Z4=Q.parabola,Q4=Q.parallaxDirection,$4=Q.parallaxUV,e3=Q.parameter,t3=Q.pass,n3=Q.passTexture,r3=Q.pcurve,i3=Q.perspectiveDepthToViewZ,a3=Q.pmremTexture,o3=Q.pointShadow,s3=Q.pointUV,c3=Q.pointWidth,l3=Q.positionGeometry,u3=Q.positionLocal,d3=Q.positionPrevious,f3=Q.positionView,p3=Q.positionViewDirection,m3=Q.positionWorld,h3=Q.positionWorldDirection,g3=Q.posterize,_3=Q.pow,v3=Q.pow2,y3=Q.pow3,b3=Q.pow4,x3=Q.premultiplyAlpha,S3=Q.property,C3=Q.radians,w3=Q.rand,T3=Q.range,E3=Q.rangeFog,D3=Q.rangeFogFactor,O3=Q.reciprocal,k3=Q.reference,A3=Q.referenceBuffer,j3=Q.reflect,M3=Q.reflectVector,N3=Q.reflectView,P3=Q.reflector,F3=Q.refract,I3=Q.refractVector,L3=Q.refractView,R3=Q.reinhardToneMapping,z3=Q.remap,B3=Q.remapClamp,V3=Q.renderGroup,H3=Q.renderOutput,U3=Q.rendererReference,W3=Q.replaceDefaultUV,G3=Q.rotate,K3=Q.rotateUV,q3=Q.roughness,J3=Q.round,Y3=Q.rtt,X3=Q.sRGBTransferEOTF,Z3=Q.sRGBTransferOETF,Q3=Q.sample,$3=Q.sampler,e6=Q.samplerComparison,t6=Q.saturate,n6=Q.saturation,r6=Q.screen,i6=Q.screenCoordinate,a6=Q.screenDPR,o6=Q.screenSize,s6=Q.screenUV,c6=Q.select,l6=Q.setCurrentStack,u6=Q.setName,d6=Q.shaderStages,f6=Q.shadow,p6=Q.shadowPositionWorld,m6=Q.shapeCircle,h6=Q.sharedUniformGroup,g6=Q.sheen,_6=Q.sheenRoughness,v6=Q.shiftLeft,y6=Q.shiftRight,b6=Q.shininess,x6=Q.sign,S6=Q.sin,C6=Q.sinh,w6=Q.sinc,T6=Q.skinning,E6=Q.smoothstep,D6=Q.smoothstepElement,O6=Q.specularColor,k6=Q.specularF90,A6=Q.spherizeUV,j6=Q.split,M6=Q.spritesheetUV,N6=Q.sqrt,P6=Q.stack,F6=Q.step,I6=Q.stepElement,L6=Q.storage,R6=Q.storageBarrier,z6=Q.storageTexture,B6=Q.storageTexture3D,V6=Q.struct,H6=Q.sub,U6=Q.subgroupAdd,W6=Q.subgroupAll,G6=Q.subgroupAnd,K6=Q.subgroupAny,q6=Q.subgroupBallot,J6=Q.subgroupBroadcast,Y6=Q.subgroupBroadcastFirst,X6=Q.subBuild,Z6=Q.subgroupElect,Q6=Q.subgroupExclusiveAdd,$6=Q.subgroupExclusiveMul,e8=Q.subgroupInclusiveAdd,t8=Q.subgroupInclusiveMul,n8=Q.subgroupIndex,r8=Q.subgroupMax,i8=Q.subgroupMin,a8=Q.subgroupMul,o8=Q.subgroupOr,s8=Q.subgroupShuffle,c8=Q.subgroupShuffleDown,l8=Q.subgroupShuffleUp,u8=Q.subgroupShuffleXor,d8=Q.subgroupSize,f8=Q.subgroupXor,p8=Q.tan,m8=Q.tanh,h8=Q.tangentGeometry,g8=Q.tangentLocal,_8=Q.tangentView,v8=Q.tangentWorld,y8=Q.texture,b8=Q.texture3D,x8=Q.textureBarrier,S8=Q.textureBicubic,C8=Q.textureBicubicLevel,w8=Q.textureCubeUV,T8=Q.textureLoad,E8=Q.textureSize,D8=Q.textureLevel,O8=Q.textureStore,k8=Q.thickness,A8=Q.time,j8=Q.toneMapping,M8=Q.toneMappingExposure,N8=Q.toonOutlinePass,P8=Q.transformDirection,F8=Q.transformNormal,I8=Q.transformNormalByInverseViewMatrix,L8=Q.transformNormalByViewMatrix,R8=Q.transformNormalToView,z8=Q.transformedClearcoatNormalView,B8=Q.transformedNormalView,V8=Q.transformedNormalWorld,H8=Q.transmission,U8=Q.transpose,W8=Q.triNoise3D,G8=Q.triplanarTexture,K8=Q.triplanarTextures,q8=Q.trunc,J8=Q.uint,Y8=Q.uintBitsToFloat,X8=Q.uniform,Z8=Q.uniformArray,Q8=Q.uniformCubeTexture,$8=Q.uniformGroup,e5=Q.uniformFlow,t5=Q.uniformTexture,n5=Q.unpackHalf2x16,r5=Q.unpackSnorm2x16,i5=Q.unpackUnorm2x16,a5=Q.unpackRGBToNormal,o5=Q.unpremultiplyAlpha,s5=Q.userData,c5=Q.uv,l5=Q.uvec2,u5=Q.uvec3,d5=Q.uvec4,f5=Q.varying,p5=Q.varyingProperty,m5=Q.vec2,h5=Q.vec3,g5=Q.vec4,_5=Q.vectorComponents,v5=Q.velocity,y5=Q.vertexColor,b5=Q.vertexIndex,x5=Q.vertexStage,S5=Q.vibrance,C5=Q.viewZToLogarithmicDepth,w5=Q.viewZToOrthographicDepth,T5=Q.viewZToPerspectiveDepth,E5=Q.viewZToReversedOrthographicDepth,D5=Q.viewZToReversedPerspectiveDepth,O5=Q.viewport,k5=Q.viewportCoordinate,A5=Q.viewportDepthTexture,j5=Q.viewportLinearDepth,M5=Q.viewportMipTexture,N5=Q.viewportOpaqueMipTexture,P5=Q.viewportResolution,F5=Q.viewportSafeUV,I5=Q.viewportSharedTexture,L5=Q.viewportSize,R5=Q.viewportTexture,z5=Q.viewportUV,B5=Q.wgsl,V5=Q.wgslFn,H5=Q.workgroupArray,U5=Q.workgroupBarrier,W5=Q.workgroupId,G5=Q.workingToColorSpace,K5=Q.xor})),q5=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define(r):typeof e==`object`?t.exports=r():n.ResizeSensor=r()})(typeof window<`u`?window:e,function(){if(typeof window>`u`)return null;var e=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)(),t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)},n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||function(t){e.clearTimeout(t)};function r(e,t){var n=Object.prototype.toString.call(e),r=n===`[object Array]`||n===`[object NodeList]`||n===`[object HTMLCollection]`||n===`[object Object]`||typeof jQuery<`u`&&e instanceof jQuery||typeof Elements<`u`&&e instanceof Elements,i=0,a=e.length;if(r)for(;i<a;i++)t(e[i]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function a(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}var o=function(e,s){var c=0;function l(){var e=[];this.add=function(t){e.push(t)};var t,n;this.call=function(r){for(t=0,n=e.length;t<n;t++)e[t].call(this,r)},this.remove=function(r){var i=[];for(t=0,n=e.length;t<n;t++)e[t]!==r&&i.push(e[t]);e=i},this.length=function(){return e.length}}function u(e,n){if(e){if(e.resizedAttached){e.resizedAttached.add(n);return}e.resizedAttached=new l,e.resizedAttached.add(n),e.resizeSensor=document.createElement(`div`),e.resizeSensor.dir=`ltr`,e.resizeSensor.className=`resize-sensor`;var r={pointerEvents:`none`,position:`absolute`,left:`0px`,top:`0px`,right:`0px`,bottom:`0px`,overflow:`hidden`,zIndex:`-1`,visibility:`hidden`,maxWidth:`100%`},o={position:`absolute`,left:`0px`,top:`0px`,transition:`0s`};a(e.resizeSensor,r);var s=document.createElement(`div`);s.className=`resize-sensor-expand`,a(s,r);var u=document.createElement(`div`);a(u,o),s.appendChild(u);var d=document.createElement(`div`);d.className=`resize-sensor-shrink`,a(d,r);var f=document.createElement(`div`);a(f,o),a(f,{width:`200%`,height:`200%`}),d.appendChild(f),e.resizeSensor.appendChild(s),e.resizeSensor.appendChild(d),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue(`position`):null;m!==`absolute`&&m!==`relative`&&m!==`fixed`&&m!==`sticky`&&(e.style.position=`relative`);var h=!1,g=0,_=i(e),v=0,y=0,b=!0;c=0;var x=function(){var t=e.offsetWidth,n=e.offsetHeight;u.style.width=t+10+`px`,u.style.height=n+10+`px`,s.scrollLeft=t+10,s.scrollTop=n+10,d.scrollLeft=t+10,d.scrollTop=n+10},S=function(){if(b){if(e.offsetWidth===0&&e.offsetHeight===0){c||=t(function(){c=0,S()});return}b=!1}x()};e.resizeSensor.resetSensor=S;var C=function(){g=0,h&&(v=_.width,y=_.height,e.resizedAttached&&e.resizedAttached.call(_))},w=function(){_=i(e),h=_.width!==v||_.height!==y,h&&!g&&(g=t(C)),S()},T=function(e,t,n){e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener(t,n)};T(s,`scroll`,w),T(d,`scroll`,w),c=t(function(){c=0,S()})}}r(e,function(e){u(e,s)}),this.detach=function(t){c||=(n(c),0),o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};if(o.reset=function(e){r(e,function(e){e.resizeSensor.resetSensor()})},o.detach=function(e,t){r(e,function(e){e&&(e.resizedAttached&&typeof t==`function`&&(e.resizedAttached.remove(t),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},typeof MutationObserver<`u`){var s=new MutationObserver(function(e){for(var t in e)if(e.hasOwnProperty(t))for(var n=e[t].addedNodes,r=0;r<n.length;r++)n[r].resizeSensor&&o.reset(n[r])});document.addEventListener(`DOMContentLoaded`,function(e){s.observe(document.body,{childList:!0,subtree:!0})})}return o})})),pue=m(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define([`./ResizeSensor.js`],r):typeof e==`object`?t.exports=r(q5()):(n.ElementQueries=r(n.ResizeSensor),n.ElementQueries.listen())})(typeof window<`u`?window:e,function(e){var t=function(){var t,n={},r=[];function i(e){e||=document.documentElement;var t=window.getComputedStyle(e,null).fontSize;return parseFloat(t)||16}function a(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function o(e,t){var n=t.split(/\d/),r=n[n.length-1];switch(t=parseFloat(t),r){case`px`:return t;case`em`:return t*i(e);case`rem`:return t*i();case`vw`:return t*document.documentElement.clientWidth/100;case`vh`:return t*document.documentElement.clientHeight/100;case`vmin`:case`vmax`:var a=document.documentElement.clientWidth/100,o=document.documentElement.clientHeight/100,s=Math[r===`vmin`?`min`:`max`];return t*s(a,o);default:return t}}function s(e,t){this.element=e;var r,i,s,c,l,u,d,f,p=[`min-width`,`min-height`,`max-width`,`max-height`];this.call=function(){for(r in s=a(this.element),u={},n[t])n[t].hasOwnProperty(r)&&(i=n[t][r],c=o(this.element,i.value),l=i.property===`width`?s.width:s.height,f=i.mode+`-`+i.property,d=``,i.mode===`min`&&l>=c&&(d+=i.value),i.mode===`max`&&l<=c&&(d+=i.value),u[f]||(u[f]=``),d&&(` `+u[f]+` `).indexOf(` `+d+` `)===-1&&(u[f]+=` `+d));for(var e in p)p.hasOwnProperty(e)&&(u[p[e]]?this.element.setAttribute(p[e],u[p[e]].substr(1)):this.element.removeAttribute(p[e]))}}function c(t,n){t.elementQueriesSetupInformation||=new s(t,n),t.elementQueriesSensor||=new e(t,function(){t.elementQueriesSetupInformation.call()})}function l(e,i,a,o){if(n[e]===void 0){n[e]=[];var s=r.length;t.innerHTML+=`
|
|
553
553
|
`+e+` {animation: 0.1s element-queries;}`,t.innerHTML+=`
|
|
554
554
|
`+e+` > .resize-sensor {min-width: `+s+`px;}`,r.push(e)}n[e].push({mode:i,property:a,value:o})}function u(e){var t;if(document.querySelectorAll&&(t=e?e.querySelectorAll.bind(e):document.querySelectorAll.bind(document)),!t&&typeof $$<`u`&&(t=$$),!t&&typeof jQuery<`u`&&(t=jQuery),!t)throw`No document.querySelectorAll, jQuery or Mootools's $$ found.`;return t}function d(e){var t=u(e);for(var r in n)if(n.hasOwnProperty(r))for(var i=t(r,e),a=0,o=i.length;a<o;a++)c(i[a],r)}function f(t){var n=[],r=[],i=[],a=0,o=-1,s=[];for(var c in t.children)if(t.children.hasOwnProperty(c)&&t.children[c].tagName&&t.children[c].tagName.toLowerCase()===`img`){n.push(t.children[c]);var l=t.children[c].getAttribute(`min-width`)||t.children[c].getAttribute(`data-min-width`),u=t.children[c].getAttribute(`data-src`)||t.children[c].getAttribute(`url`);i.push(u);var d={minWidth:l};r.push(d),l?t.children[c].style.display=`none`:(a=n.length-1,t.children[c].style.display=`block`)}o=a;function f(){var e=!1,c;for(c in n)n.hasOwnProperty(c)&&r[c].minWidth&&t.offsetWidth>r[c].minWidth&&(e=c);if(e||=a,o!==e){if(s[e])n[o].style.display=`none`,n[e].style.display=`block`,o=e;else{var l=new Image;l.onload=function(){n[e].src=i[e],n[o].style.display=`none`,n[e].style.display=`block`,s[e]=!0,o=e},l.src=i[e]}}else n[e].src=i[e]}t.resizeSensorInstance=new e(t,f),f()}function p(){for(var e=u()(`[data-responsive-image],[responsive-image]`),t=0,n=e.length;t<n;t++)f(e[t])}var m=/,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/gim,h=/\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/gim;function g(e){var t,n,r,i;for(e=e.replace(/'/g,`"`);(t=m.exec(e))!==null;)for(n=t[1]+t[3],r=t[2];(i=h.exec(r))!==null;)l(n,i[1],i[2],i[3])}function _(e){var t=``;if(e){if(typeof e==`string`)e=e.toLowerCase(),(e.indexOf(`min-width`)!==-1||e.indexOf(`max-width`)!==-1)&&g(e);else for(var n=0,r=e.length;n<r;n++)e[n].type===1?(t=e[n].selectorText||e[n].cssText,(t.indexOf(`min-height`)!==-1||t.indexOf(`max-height`)!==-1||t.indexOf(`min-width`)!==-1||t.indexOf(`max-width`)!==-1)&&g(t)):e[n].type===4?_(e[n].cssRules||e[n].rules):e[n].type===3&&e[n].styleSheet.hasOwnProperty(`cssRules`)&&_(e[n].styleSheet.cssRules)}}var v=!1;this.init=function(){var n=`animationstart`;document.documentElement.style.webkitAnimationName===void 0?document.documentElement.style.MozAnimationName===void 0?document.documentElement.style.OAnimationName!==void 0&&(n=`oanimationstart`):n=`mozanimationstart`:n=`webkitAnimationStart`,document.body.addEventListener(n,function(t){var n=t.target,i=n&&window.getComputedStyle(n,null),a=i&&i.getPropertyValue(`animation-name`);if(a&&a.indexOf(`element-queries`)!==-1){n.elementQueriesSensor=new e(n,function(){n.elementQueriesSetupInformation&&n.elementQueriesSetupInformation.call()});var o=window.getComputedStyle(n.resizeSensor,null).getPropertyValue(`min-width`);o=parseInt(o.replace(`px`,``)),c(t.target,r[o])}}),v||=(t=document.createElement(`style`),t.type=`text/css`,t.innerHTML=`[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}`,t.innerHTML+=`
|
|
555
|
-
@keyframes element-queries { 0% { visibility: inherit; } }`,document.getElementsByTagName(`head`)[0].appendChild(t),!0);for(var i=0,a=document.styleSheets.length;i<a;i++)try{document.styleSheets[i].href&&document.styleSheets[i].href.indexOf(`file://`)===0&&console.warn(`CssElementQueries: unable to parse local css files, `+document.styleSheets[i].href),_(document.styleSheets[i].cssRules||document.styleSheets[i].rules||document.styleSheets[i].cssText)}catch{}p()},this.findElementQueriesElements=function(e){d(e)},this.update=function(){this.init()}};t.update=function(){t.instance.update()},t.detach=function(e){e.elementQueriesSetupInformation?(e.elementQueriesSensor.detach(),delete e.elementQueriesSetupInformation,delete e.elementQueriesSensor):e.resizeSensorInstance&&(e.resizeSensorInstance.detach(),delete e.resizeSensorInstance)},t.init=function(){t.instance||=new t,t.instance.init()};var n=function(e){if(document.addEventListener)document.addEventListener(`DOMContentLoaded`,e,!1);else if(/KHTML|WebKit|iCab/i.test(navigator.userAgent))var t=setInterval(function(){/loaded|complete/i.test(document.readyState)&&(e(),clearInterval(t))},10);else window.onload=e};return t.findElementQueriesElements=function(e){t.instance.findElementQueriesElements(e)},t.listen=function(){n(t.init)},t})})),mue=m(((e,t)=>{t.exports={ResizeSensor:q5(),ElementQueries:pue()}}));function J5(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}let r=n.count-2,i=[];if(t===2)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),a.clearGroups(),a}return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,t),e}var hue=p((()=>{GY()}));function gue(e){let t=new Map,n=new Map,r=e.clone();return Y5(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function Y5(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)Y5(e.children[r],t.children[r],n)}var _ue=p((()=>{})),vue=h({GLTFLoader:()=>n7});function yue(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function X5(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function bue(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new uy({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function Z5(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Q5(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function xue(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function Sue(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function Cue(e){let t,n=e.extensions&&e.extensions[r7.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+$5(n.attributes):e.indices+`:`+$5(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+$5(e.targets[n]);return t}function $5(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function e7(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function wue(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function Tue(e,t,n){let r=t.attributes,i=new ch;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new B(t[0],t[1],t[2]),new B(a[0],a[1],a[2])),e.normalized){let t=e7(N7[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new B,t=new B;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=e7(N7[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new Bh;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function t7(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=L7[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return Jp.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Jp.workingColorSpace}" not supported.`),Q5(e,t),Tue(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:xue(e,t.targets,n)})}var n7,r7,i7,a7,o7,s7,c7,l7,u7,d7,f7,p7,m7,h7,g7,_7,v7,y7,b7,x7,S7,C7,w7,T7,E7,D7,O7,k7,A7,j7,M7,N7,P7,F7,I7,L7,R7,z7,B7,V7,H7,Eue=p((()=>{GY(),hue(),_ue(),n7=class extends Ry{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new s7(e)}),this.register(function(e){return new c7(e)}),this.register(function(e){return new _7(e)}),this.register(function(e){return new v7(e)}),this.register(function(e){return new y7(e)}),this.register(function(e){return new u7(e)}),this.register(function(e){return new d7(e)}),this.register(function(e){return new f7(e)}),this.register(function(e){return new p7(e)}),this.register(function(e){return new o7(e)}),this.register(function(e){return new m7(e)}),this.register(function(e){return new l7(e)}),this.register(function(e){return new g7(e)}),this.register(function(e){return new h7(e)}),this.register(function(e){return new i7(e)}),this.register(function(e){return new b7(e,r7.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new b7(e,r7.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new x7(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=Sb.extractUrlBase(e);a=Sb.resolveURL(t,this.path)}else a=Sb.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new Vy(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===S7){try{a[r7.KHR_BINARY_GLTF]=new T7(e)}catch(e){r&&r(e);return}i=JSON.parse(a[r7.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new H7(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case r7.KHR_MATERIALS_UNLIT:a[t]=new a7;break;case r7.KHR_DRACO_MESH_COMPRESSION:a[t]=new E7(i,this.dracoLoader);break;case r7.KHR_TEXTURE_TRANSFORM:a[t]=new D7;break;case r7.KHR_MESH_QUANTIZATION:a[t]=new O7;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},r7={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},i7=class{constructor(e){this.parser=e,this.name=r7.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new Um(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],ap);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new hb(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new fb(s),o.distance=c;break;case`spot`:o=new ub(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),Q5(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},a7=class{constructor(){this.name=r7.KHR_MATERIALS_UNLIT}getMaterialType(){return Eg}extendParams(e,t,n){let r=[];e.color=new Um(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ap),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,ip))}return Promise.all(r)}},o7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},s7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new z(e,e)}return Promise.all(r)}},c7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_DISPERSION}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},l7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},u7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_SHEEN}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new Um(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ap)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,ip)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},d7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},f7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_VOLUME}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new Um().setRGB(i[0],i[1],i[2],ap),Promise.all(r)}},p7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_IOR}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null?Promise.resolve():(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3),Promise.resolve())}},m7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_SPECULAR}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new Um().setRGB(i[0],i[1],i[2],ap),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,ip)),Promise.all(r)}},h7=class{constructor(e){this.parser=e,this.name=r7.EXT_MATERIALS_BUMP}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},g7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},_7=class{constructor(e){this.parser=e,this.name=r7.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},v7=class{constructor(e){this.parser=e,this.name=r7.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},y7=class{constructor(e){this.parser=e,this.name=r7.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},b7=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},x7=class{constructor(e){this.name=r7.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==M7.TRIANGLES&&e.mode!==M7.TRIANGLE_STRIP&&e.mode!==M7.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new lm,n=new B,a=new Vp,s=new B(1,1,1),c=new c_(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));for(let t in o)if(t===`_COLOR_0`){let e=o[t];c.instanceColor=new e_(e.array,e.itemSize,e.normalized)}else t!==`TRANSLATION`&&t!==`ROTATION`&&t!==`SCALE`&&e.geometry.setAttribute(t,o[t]);Im.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},S7=`glTF`,C7=12,w7={JSON:1313821514,BIN:5130562},T7=class{constructor(e){this.name=r7.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,C7),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==S7)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-C7,i=new DataView(e,C7),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===w7.JSON){let r=new Uint8Array(e,C7+a,t);this.content=n.decode(r)}else if(r===w7.BIN){let n=C7+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},E7=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=r7.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=L7[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=L7[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=N7[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,ap,n)})})}},D7=class{constructor(){this.name=r7.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0?e:(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e)}},O7=class{constructor(){this.name=r7.KHR_MESH_QUANTIZATION}},k7=class extends xy{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},A7=new Vp,j7=class extends k7{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return A7.fromArray(i).normalize().toArray(i),i}},M7={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},N7={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},P7={9728:Td,9729:Ad,9984:Ed,9985:jd,9986:Od,9987:Nd},F7={33071:Cd,33648:wd,10497:Sd},I7={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L7={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},R7={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},z7={CUBICSPLINE:void 0,LINEAR:Kf,STEP:Gf},B7={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},V7=new lm,H7=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new yue,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}this.textureLoader=typeof createImageBitmap>`u`||n&&r<17||i&&a<98?new Jy(this.options.manager):new jb(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Vy(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return Z5(i,a,r),Q5(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[r7.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(Sb.resolveURL(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=I7[r.type],t=N7[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new Dh(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=I7[r.type],o=N7[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new Yh(f,u/s),t.cache.add(n,c)),p=new Zh(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new Dh(f,a,d);if(r.sparse!==void 0){let t=I7.SCALAR,n=N7[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new Dh(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=P7[n.magFilter]||1006,t.minFilter=P7[n.minFilter]||1008,t.wrapS=F7[n.wrapS]||1e3,t.wrapT=F7[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new tm(e);t.needsUpdate=!0,n(t)}),t.load(Sb.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),Q5(e,a),e.userData.mimeType=a.mimeType||wue(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[r7.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[r7.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[r7.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new K_,$h.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new N_,$h.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return uy}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[r7.KHR_MATERIALS_UNLIT]){let e=r[r7.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Um(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],ap),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,ip)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||B7.OPAQUE;if(l===B7.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===B7.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==Eg&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new z(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==Eg&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==Eg){let e=i.emissiveFactor;o.emissive=new Um().setRGB(e[0],e[1],e[2],ap)}return i.emissiveTexture!==void 0&&a!==Eg&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,ip)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),Q5(n,i),t.associations.set(n,{materials:e}),i.extensions&&Z5(r,n,i),n})}createUniqueName(e){let t=hx.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[r7.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return t7(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=Cue(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[r7.KHR_DRACO_MESH_COMPRESSION]?i(o):t7(new Jh,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?bue(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===M7.TRIANGLES||u.mode===M7.TRIANGLE_STRIP||u.mode===M7.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new Jg(l,f):new Rg(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),u.mode===M7.TRIANGLE_STRIP?d.geometry=J5(d.geometry,1):u.mode===M7.TRIANGLE_FAN&&(d.geometry=J5(d.geometry,2));else if(u.mode===M7.LINES)d=new W_(l,f);else if(u.mode===M7.LINE_STRIP)d=new V_(l,f);else if(u.mode===M7.LINE_LOOP)d=new G_(l,f);else if(u.mode===M7.POINTS)d=new Z_(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&Sue(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),Q5(d,i),u.extensions&&Z5(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&Z5(r,c[0],i),c[0];let l=new Lm;i.extensions&&Z5(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new cb(Bp.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new pb(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Q5(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new lm;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new $g(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new Py(i,void 0,l);return Q5(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,V7)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new B().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new Yg:t.length>1?new Lm:t.length===1?t[0]:new Im,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),Q5(o,i),i.extensions&&Z5(n,o,i),i.matrix!==void 0){let e=new lm;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new Lm;n.name&&(i.name=r.createUniqueName(n.name)),Q5(i,n),n.extensions&&Z5(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(gue(n))}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof $h||e instanceof tm)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}R7[i.path]===R7.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(R7[i.path]){case R7.weights:l=ky;break;case R7.rotation:l=jy;break;case R7.translation:case R7.scale:l=Ny;break;default:switch(n.itemSize){case 1:l=ky;break;default:l=Ny}}let u=r.interpolation===void 0?Kf:z7[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+R7[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=e7(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof jy?j7:k7)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),Due=m((e=>{e.deflate=Ue,e.deflateSync=We,e.inflate=qe,e.inflateSync=Je,e.gzip=Ze,e.compress=Ze,e.gzipSync=Qe,e.compressSync=Qe,e.gunzip=tt,e.gunzipSync=nt,e.zlib=it,e.zlibSync=at,e.unzlib=ct,e.unzlibSync=lt,e.gzip=Ze,e.compress=Ze,e.decompress=dt,e.decompressSync=ft,e.strToU8=vt,e.strFromU8=yt,e.zip=Ot,e.zipSync=kt,e.unzip=Mt,e.unzipSync=Nt;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var ee=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],j=function(e,t,n){var r=Error(t||ee[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,j),!n)throw r;return r},M=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,ee=a*8;do{if(!b){g=D(e,_,1);var M=D(e,_+1,3);if(_+=3,!M){var N=k(_)+4,te=e[N-4]|e[N-3]<<8,ne=N+te;if(ne>a){p&&j(0);break}f&&h(v+te),n.set(e.subarray(N,ne),v),t.b=v+=te,t.p=_=ne*8,t.f=g;continue}if(M==1)b=C,x=T,S=9,w=5;else if(M==2){var re=D(e,_,31)+257,ie=D(e,_+10,15)+4,ae=re+D(e,_+5,31)+1;_+=14;for(var oe=new r(ae),se=new r(19),ce=0;ce<ie;++ce)se[c[ce]]=D(e,_+ce*3,7);_+=ie*3;for(var le=E(se),ue=(1<<le)-1,de=y(se,le,1),ce=0;ce<ae;){var fe=de[D(e,_,ue)];_+=fe&15;var N=fe>>4;if(N<16)oe[ce++]=N;else{var pe=0,me=0;for(N==16?(me=3+D(e,_,3),_+=2,pe=oe[ce-1]):N==17?(me=3+D(e,_,7),_+=3):N==18&&(me=11+D(e,_,127),_+=7);me--;)oe[ce++]=pe}}var he=oe.subarray(0,re),ge=oe.subarray(re);S=E(he),w=E(ge),b=y(he,S,1),x=y(ge,w,1)}else j(1);if(_>ee){p&&j(0);break}}f&&h(v+131072);for(var _e=(1<<S)-1,ve=(1<<w)-1,ye=_;;ye=_){var pe=b[O(e,_)&_e],be=pe>>4;if(_+=pe&15,_>ee){p&&j(0);break}if(pe||j(2),be<256)n[v++]=be;else if(be==256){ye=_,b=null;break}else{var P=be-254;if(be>264){var ce=be-257,xe=o[ce];P=D(e,_,(1<<xe)-1)+d[ce],_+=xe}var Se=x[O(e,_)&ve],Ce=Se>>4;Se||j(3),_+=Se&15;var ge=m[Ce];if(Ce>3){var xe=s[Ce];ge+=O(e,_)&(1<<xe)-1,_+=xe}if(_>ee){p&&j(0);break}f&&h(v+131072);var we=v+P;if(v<ge){var Te=l-ge,Ee=Math.min(ge,we);for(Te+v<0&&j(3);v<Ee;++v)n[v]=i[Te+v]}for(;v<we;++v)n[v]=n[v-ge]}}t.l=b,t.p=ye,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},N=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},te=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ne=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:le,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=re(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},re=function(e,t,n){return e.s==-1?Math.max(re(e.l,t,n+1),re(e.r,t,n+1)):t[e.s]=n},ie=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},ae=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},oe=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},se=function(e,t,n,r,a,l,u,d,f,p,m){N(t,m++,n),++a[256];for(var h=ne(a,15),g=h.t,_=h.l,v=ne(l,15),C=v.t,T=v.l,E=ie(g),D=E.c,O=E.n,k=ie(C),A=k.c,ee=k.n,j=new i(19),M=0;M<D.length;++M)++j[D[M]&31];for(var M=0;M<A.length;++M)++j[A[M]&31];for(var re=ne(j,7),se=re.t,ce=re.l,le=19;le>4&&!se[c[le-1]];--le);var ue=p+5<<3,de=ae(a,b)+ae(l,x)+u,fe=ae(a,g)+ae(l,C)+u+14+3*le+ae(j,se)+2*j[16]+3*j[17]+7*j[18];if(f>=0&&ue<=de&&ue<=fe)return oe(t,m,e.subarray(f,f+p));var pe,me,he,ge;if(N(t,m,1+(fe<de)),m+=2,fe<de){pe=y(g,_,0),me=g,he=y(C,T,0),ge=C;var _e=y(se,ce,0);N(t,m,O-257),N(t,m+5,ee-1),N(t,m+10,le-4),m+=14;for(var M=0;M<le;++M)N(t,m+3*M,se[c[M]]);m+=3*le;for(var ve=[D,A],ye=0;ye<2;++ye)for(var be=ve[ye],M=0;M<be.length;++M){var P=be[M]&31;N(t,m,_e[P]),m+=se[P],P>15&&(N(t,m,be[M]>>5&127),m+=be[M]>>12)}}else pe=S,me=b,he=w,ge=x;for(var M=0;M<d;++M){var xe=r[M];if(xe>255){var P=xe>>18&31;te(t,m,pe[P+257]),m+=me[P+257],P>7&&(N(t,m,xe>>23&31),m+=o[P]);var Se=xe&31;te(t,m,he[Se]),m+=ge[Se],Se>3&&(te(t,m,xe>>5&8191),m+=s[Se])}else te(t,m,pe[xe]),m+=me[xe]}return te(t,m,pe[256]),m+me[256]},ce=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),le=new r(0),ue=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=ce[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),ee=new i(32),j=0,M=0,N=u.i||0,te=0,ne=u.w||0,re=0;N+2<d;++N){var ie=E(N),ae=N&32767,le=C[ie];if(S[ae]=le,C[ie]=ae,ne<=N){var ue=d-N;if((j>7e3||te>24576)&&(ue>423||!g)){_=se(e,m,0,D,O,ee,M,te,re,N-re,_),te=j=M=0,re=N;for(var de=0;de<286;++de)O[de]=0;for(var de=0;de<30;++de)ee[de]=0}var fe=2,pe=0,me=b,he=ae-le&32767;if(ue>2&&ie==E(N-he))for(var ge=Math.min(y,ue)-1,_e=Math.min(32767,N),ve=Math.min(258,ue);he<=_e&&--me&&ae!=le;){if(e[N+fe]==e[N+fe-he]){for(var ye=0;ye<ve&&e[N+ye]==e[N+ye-he];++ye);if(ye>fe){if(fe=ye,pe=he,ye>ge)break;for(var be=Math.min(he,ye-2),P=0,de=0;de<be;++de){var xe=N-he+de&32767,Se=xe-S[xe]&32767;Se>P&&(P=Se,le=xe)}}}ae=le,le=S[ae],he+=ae-le&32767}if(pe){D[te++]=268435456|f[fe]<<18|h[pe];var Ce=f[fe]&31,we=h[pe]&31;M+=o[Ce]+s[we],++O[257+Ce],++ee[we],ne=N+fe,++j}else D[te++]=e[N],++O[e[N]]}}for(N=Math.max(N,ne);N<d;++N)D[te++]=e[N],++O[e[N]];_=se(e,m,g,D,O,ee,M,te,re,N-re,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=N,u.w=ne)}else{for(var N=u.w||0;N<d+g;N+=65535){var Te=N+65535;Te>=d&&(m[_/8|0]=g,Te=d),_=oe(m,_+1,e.subarray(N,Te))}u.i=d}return A(p,0,c+k(_)+l)},de=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),fe=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=de[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},pe=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},me=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ue(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},he=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ge=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},_e=[],ve=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},ye=function(e,t,r,i){if(!_e[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=ge(e[c],a,o);_e[r]={c:ge(e[s],a,o),e:o}}var l=he({},_e[r].e);return(0,n.default)(_e[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,ve(l),i)},be=function(){return[r,i,a,o,s,c,d,m,C,T,g,ee,y,E,D,O,k,A,j,M,Je,Te,Ee]},P=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,ce,le,y,N,te,ne,re,ie,ae,oe,se,k,A,ue,me,We,Te]},xe=function(){return[Pe,Le,Ne,fe,de]},Se=function(){return[Fe,Ie]},Ce=function(){return[Re,Ne,pe]},we=function(){return[ze]},Te=function(e){return postMessage(e,[e.buffer])},Ee=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},De=function(e,t,n,r,i,a){var o=ye(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Oe=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},ke=function(e,t,n,r,i,a,o){var s,c=ye(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||j(5),s&&t.ondata(j(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},Ae=function(e,t){return e[t]|e[t+1]<<8},je=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Me=function(e,t){return je(e,t)+je(e,t+4)*4294967296},Ne=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Pe=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Ne(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Fe=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&j(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ie=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Le=function(e){return 10+(e.filename?e.filename.length+1:0)},Re=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=pe();i.p(t.dictionary),Ne(e,2,i.d())}},ze=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&j(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&j(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Be(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var Ve=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(me(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||j(5),this.s.l&&j(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=le)},e.prototype.flush=function(e){if(this.ondata||j(5),this.s.l&&j(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=oe(t,this.s.r,le);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=Ve;var He=function(){function e(e,t){ke([P,function(){return[Oe,Ve]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ve(e.data))},6,1)}return e}();e.AsyncDeflate=He;function Ue(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P],function(e){return Te(We(e.data[0],e.data[1]))},0,n)}function We(e,t){return me(e,t||{},0,0)}var Ge=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||j(5),this.d&&j(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=M(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Ge;var Ke=function(){function e(e,t){ke([be,function(){return[Oe,Ge]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ge(e.data))},7,0)}return e}();e.AsyncInflate=Ke;function qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be],function(e){return Te(Je(e.data[0],Ee(e.data[1])))},1,n)}function Je(e,t){return M(e,{i:2},t&&t.out,t&&t.dictionary)}var Ye=function(){function e(e,t){this.c=fe(),this.l=0,this.v=1,Ve.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Ve.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=me(e,this.o,this.v&&Le(this.o),t&&8,this.s);this.v&&=(Pe(n,this.o),0),t&&(Ne(n,n.length-8,this.c.d()),Ne(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){Ve.prototype.flush.call(this,e)},e}();e.Gzip=Ye,e.Compress=Ye;var Xe=function(){function e(e,t){ke([P,xe,function(){return[Oe,Ve,Ye]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ye(e.data))},8,1)}return e}();e.AsyncGzip=Xe,e.AsyncCompress=Xe;function Ze(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P,xe,function(){return[Qe]}],function(e){return Te(Qe(e.data[0],e.data[1]))},2,n)}function Qe(e,t){t||={};var n=fe(),r=e.length;n.p(e);var i=me(e,t,Le(t),8),a=i.length;return Pe(i,t),Ne(i,a-8,n.d()),Ne(i,a-4,r),i}var $e=function(){function e(e,t){this.v=1,this.r=0,Ge.call(this,e,t)}return e.prototype.push=function(e,t){if(Ge.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?Fe(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Ge.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Ge.prototype.c.call(this,t)},e}();e.Gunzip=$e;var et=function(){function e(e,t){var n=this;ke([be,Se,function(){return[Oe,Ge,$e]}],this,Be.call(this,e,t),function(e){var t=new $e(e.data);t.onmember=function(e){return postMessage(e)},onmessage=Oe(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=et;function tt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be,Se,function(){return[nt]}],function(e){return Te(nt(e.data[0],e.data[1]))},3,n)}function nt(e,t){var n=Fe(e);return n+8>e.length&&j(6,`invalid gzip data`),M(e.subarray(n,-8),{i:2},t&&t.out||new r(Ie(e)),t&&t.dictionary)}var rt=function(){function e(e,t){this.c=pe(),this.v=1,Ve.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Ve.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=me(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(Re(n,this.o),0),t&&Ne(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){Ve.prototype.flush.call(this,e)},e}();e.Zlib=rt,e.AsyncZlib=function(){function e(e,t){ke([P,Ce,function(){return[Oe,Ve,rt]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new rt(e.data))},10,1)}return e}();function it(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P,Ce,function(){return[at]}],function(e){return Te(at(e.data[0],e.data[1]))},4,n)}function at(e,t){t||={};var n=pe();n.p(e);var r=me(e,t,t.dictionary?6:2,4);return Re(r,t),Ne(r,r.length-4,n.d()),r}var ot=function(){function e(e,t){Ge.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Ge.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ze(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&j(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Ge.prototype.c.call(this,t)},e}();e.Unzlib=ot;var st=function(){function e(e,t){ke([be,we,function(){return[Oe,Ge,ot]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new ot(e.data))},11,0)}return e}();e.AsyncUnzlib=st;function ct(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be,we,function(){return[lt]}],function(e){return Te(lt(e.data[0],Ee(e.data[1])))},5,n)}function lt(e,t){return M(e.subarray(ze(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var ut=function(){function e(e,t){this.o=Be.call(this,e,t)||{},this.G=$e,this.I=Ge,this.Z=ot}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||j(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=ut,e.AsyncDecompress=function(){function e(e,t){ut.call(this,e,t),this.queuedSize=0,this.G=et,this.I=Ke,this.Z=st}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,ut.prototype.push.call(this,e,t)},e}();function dt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),e[0]==31&&e[1]==139&&e[2]==8?tt(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?qe(e,t,n):ct(e,t,n)}function ft(e,t){return e[0]==31&&e[1]==139&&e[2]==8?nt(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Je(e,t):lt(e,t)}var pt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=he(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],pt(o,s,n,i))}},mt=typeof TextEncoder<`u`&&new TextEncoder,ht=typeof TextDecoder<`u`&&new TextDecoder,gt=0;try{ht.decode(le,{stream:!0}),gt=1}catch{}var _t=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,gt?this.t=new TextDecoder:this.p=le}return e.prototype.push=function(e,t){if(this.ondata||j(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&j(8),this.t=null);return}this.p||j(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=_t(n),a=i.s,o=i.r;t?(o.length&&j(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||j(5),this.d&&j(4),this.ondata(vt(e),this.d=t||!1)},e}();function vt(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(mt)return mt.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function yt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(ht)return ht.decode(e);var i=_t(e),a=i.s,n=i.r;return n.length&&j(8),a}var bt=function(e){return e==1?3:e<6?2:+(e==9)},xt=function(e,t){return t+30+Ae(e,t+26)+Ae(e,t+28)},St=function(e,t,n){var r=Ae(e,t+28),i=Ae(e,t+30),a=yt(e.subarray(t+46,t+46+r),!(Ae(e,t+8)&2048)),o=t+46+r,s=Ct(e,o,i,n,je(e,t+20),je(e,t+24),je(e,t+42)),c=s[0],l=s[1],u=s[2];return[Ae(e,t+10),c,l,a,o+i+Ae(e,t+32),u]},Ct=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+Ae(e,t+2))if(Ae(e,t)==1)return[s?Me(e,t+4+8*c):i,c?Me(e,t+4):a,l?Me(e,t+4+8*(c+s)):o,1];r<2&&j(13)}return[i,a,o,0]},wt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&j(9),t+=r+4}return t},Tt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=wt(l);Ne(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&j(10),Ne(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Ne(e,t,n.crc),Ne(e,t+4,a<0?-a-2:a),Ne(e,t+8,n.size)),Ne(e,t+12,c),Ne(e,t+14,d),t+=16,o!=null&&(Ne(e,t,u),Ne(e,t+6,n.attrs),Ne(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Ne(e,t,+m),Ne(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Et=function(e,t,n,r,i){Ne(e,t,101010256),Ne(e,t+8,n),Ne(e,t+10,n),Ne(e,t+12,r),Ne(e,t+16,i)},Dt=function(){function e(e){this.filename=e,this.c=fe(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||j(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=Dt,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},Dt.call(this,e),this.d=new Ve(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=bt(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){Dt.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},Dt.call(this,e),this.d=new He(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=bt(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){Dt.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||j(5),this.d&2)this.ondata(j(4+(this.d&1)*8,0,1),null,!1);else{var n=vt(e.filename),i=n.length,a=e.comment,o=a&&vt(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+wt(e.extra)+30;i>65535&&this.ondata(j(11,0,1),null,!1);var l=new r(c);Tt(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=he(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Ne(o,0,134695760),Ne(o,4,e.crc),Ne(o,8,h),Ne(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(j(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+wt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];Tt(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+wt(o.extra)+(o.o?o.o.length:0),t+=o.b}Et(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function Ot(e,t,n){n||(n=t,t={}),typeof n!=`function`&&j(7);var i={};pt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){jt(function(){n(e,t)})};jt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;Tt(e,c,a,a.f,a.u,o);var d=30+a.f.length+wt(a.extra),f=c+d;e.set(a.c,f),Tt(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}Et(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=fe(),g=r.length;h.p(r);var _=vt(t),v=_.length,y=l.comment,b=y&&vt(y),x=b&&b.length,S=wt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=he(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(j(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,We(r,l))}catch(e){w(e,null)}else d.push(Ue(r,l,w))},g=0;g<l;++g)h(g);return f}function kt(e,t){t||={};var n={},i=[];pt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=vt(s),p=f.length,m=u.comment,h=m&&vt(m),g=h&&h.length,_=wt(u.extra);p>65535&&j(11);var v=d?We(l,u):l,y=v.length,b=fe();b.p(l),i.push(he(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];Tt(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+wt(f.extra);x.set(f.c,f.o+T),Tt(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return Et(x,a,i.length,C,S),x}var At=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=At,e.UnzipInflate=function(){function e(){var e=this;this.i=new Ge(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Ge(function(e,t){n.ondata(null,e,t)}):(this.i=new Ke(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:At},this.p=le}return e.prototype.push=function(e,t){var n=this;if(this.onfile||j(5),this.p||j(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=je(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=Ae(l,s+6),r=Ae(l,s+8),i=t&2048,a=t&8,f=Ae(l,s+26),p=Ae(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=je(l,s+18),_=je(l,s+22),v=yt(l.subarray(s+30,s+=30+f),!i),y=Ct(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||j(5),!b)w.ondata(null,le,!0);else{var e=n.o[r];e||w.ondata(j(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(le,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=le,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(je(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&j(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var jt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function Mt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&j(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){jt(function(){n(e,t)})};jt(function(){s=n});for(var c=e.length-22;je(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(j(13,0,1),null),a;var l=Ae(e,c+8);if(l){var u=l,d=je(e,c+16),f=je(e,c-20)==117853008;if(f){var p=je(e,c-12);f=je(e,p)==101075792,f&&(u=l=je(e,p+32),d=je(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=St(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=xt(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Je(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(qe(b,{size:p},y))}else y(j(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function Nt(e,t){for(var n={},i=e.length-22;je(e,i)!=101010256;--i)(!i||e.length-i>65558)&&j(13);var a=Ae(e,i+8);if(!a)return{};var o=je(e,i+16),s=je(e,i-20)==117853008;if(s){var c=je(e,i-12);s=je(e,c)==101075792,s&&(a=je(e,c+32),o=je(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=St(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=xt(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Je(e.subarray(v,v+p),{out:new r(m)}):j(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),U7=_(m(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r((WY(),v(xle)),(uue(),v(Yle)),(fue(),v(due)),mue(),(Eue(),v(vue)),Due()):typeof define==`function`&&define.amd?define([`three/webgpu`,`three-spritetext`,`three/tsl`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.THREE,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i,a){var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},p=(e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e));e=p(e,1),t=p(t,1);var m={name:`zincjs`,version:`2.4.1-beta.0`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,engines:{node:`24.20.0`},allowScripts:{"msw@2.14.6":!0},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`,webgpu:`^0.4.0`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.185.1`,"three-spritetext":`1.10.0`}},h=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,g=t.default.default||t.default;function _(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function v(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function y(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function b(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)y(e[t],t,o,n)}var x=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},S=function(t,n){if(n&&t&&t.morphAttributes&&t.morphAttributes.color){let r=t.morphAttributes.color,i=n.morphTargetInfluences,a=i.length,o=[];for(let e=0;e<a;e++)i[e]>0&&o.push([e,i[e]]);let s=0,c=0,l=0;if(o.length>=2){c=o[0][0],l=o[1][0];let e=o[0][1]+o[1][1];s=e>0?o[1][1]/e:0}else o.length==1&&(c=l=o[0][0]);let u=t.getAttribute(`morphColor0`),d=t.getAttribute(`morphColor1`);(!u||!d)&&(u=new e.Float32BufferAttribute(new Float32Array(r[0].array.length),r[0].itemSize),d=new e.Float32BufferAttribute(new Float32Array(r[0].array.length),r[0].itemSize),u.setUsage(e.DynamicDrawUsage),d.setUsage(e.DynamicDrawUsage),t.setAttribute(`morphColor0`,u),t.setAttribute(`morphColor1`,d)),u.array.set(r[c].array),u.needsUpdate=!0,d.array.set(r[l].array),d.needsUpdate=!0;let f=n.material&&n.material.userData&&n.material.userData.uniforms&&n.material.userData.uniforms.morphColorMix;f&&(f.value=s)}},C=e=>{let t=e.clone();return t.colorsNeedUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere(),e._video&&(t._video=e._video),t};function w(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var T=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=w(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=w(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function E(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function D(){let t=new Image;t.src=h;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function O(e,t,n,r,i,a){let o=new g(e,t,n,r,i,a);return o.canvasScale=4,o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!0,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=10001,o}function k(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function A(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}function ee(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z}return e.needsUpdate=!0,e}var j={MeshBasicMaterial:e.MeshBasicNodeMaterial,MeshLambertMaterial:e.MeshLambertNodeMaterial,MeshPhongMaterial:e.MeshPhongNodeMaterial,MeshStandardMaterial:e.MeshStandardNodeMaterial,LineBasicMaterial:e.LineBasicNodeMaterial},M=t=>{let r=t;r.isNodeMaterial||(r=new(j[t.type]||e.MeshBasicNodeMaterial),r.copy(t));let i=(0,n.uniform)(0);return r.colorNode=(0,n.Fn)(()=>{let e=(0,n.attribute)(`morphColor0`,`vec3`),t=(0,n.attribute)(`morphColor1`,`vec3`),r=(0,n.mix)(e,t,i);return(0,n.vec4)(r.mul(n.materialColor),n.materialOpacity)})(),r.userData.uniforms={...r.userData.uniforms,morphColorMix:i},r},N=new e.Vector3,te=new e.Vector3,ne=new e.Matrix4,re=new e.Ray,ie=new e.Sphere,ae=new e.Vector3,oe=new e.Vector3,se=new e.Vector3,ce=new e.Vector3,le=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)N.fromBufferAttribute(n,e-1),te.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=N.distanceTo(te);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),ie.copy(r.boundingSphere),ie.applyMatrix4(i),ie.radius+=a,t.ray.intersectsSphere(ie)===!1)return;ne.copy(i).invert(),re.copy(t.ray).applyMatrix4(ne);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(ue(u,d,this,i,s,r,a),re.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(ue(u,d,this,i,s,a,a+1),re.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function ue(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(i&&s){ae.set(0,0,0),oe.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(se.fromBufferAttribute(d,a),ce.fromBufferAttribute(d,o),ae.addScaledVector(se.sub(e),u),oe.addScaledVector(ce.sub(t),u))}e.add(ae),t.add(oe)}}le.prototype.isLine=!0;var de=new e.Vector3,fe=new e.Vector3,pe=class extends le{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)de.fromBufferAttribute(n,e),fe.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+de.distanceTo(fe);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};pe.prototype.isLineSegments=!0;var me=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=C(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour,isLines:this._parent.isLines}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new pe(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=e=>{if(this._material&&this._material.userData&&this._material.userData.uniforms&&this._material.userData.uniforms.morphColorMix){if(e){let e=this.getCurrentMorph();S(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&S(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},he=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);he.colorSpace=e.SRGBColorSpace;var ge=[.02,.03,1],_e=new e.SpriteMaterial({map:he,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),ve=function(t){Object.getPrototypeOf(this)!==P.prototype&&Object.setPrototypeOf(ve.prototype,P.prototype),P.call(this),this.texture=he;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(_e),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(ge[0],ge[1],ge[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=O(e,.012,`black`,`Asap`,120,700),u.renderOrder=10001,this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},ye=0,be=function(){return`pr`+ye++},P=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new me(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=be(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};P.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},P.prototype.getDuration=function(){return this.duration},P.prototype.setRegion=function(e){this.region=e},P.prototype.getRegion=function(){return this.region},P.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},P.prototype.getGroup=function(){return this.group},P.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},P.prototype.checkTransparentMesh=function(){},P.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play(),this.mixer.update(0)))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.morphColour&&this.initiateMorphColor(),this.boundingBoxUpdateRequired=!0},P.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},P.prototype.setAnatomicalId=function(e){this.anatomicalId=e},P.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},P.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},P.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},P.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},P.prototype.getVisibility=function(){return this.visible},P.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},P.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},P.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},P.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},P.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},P.prototype.setColour=function(e){this._lod.setColour(e)},P.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},P.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},P.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},P.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},P.prototype.setMaterial=function(e){this._lod.setMaterial(e)},P.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},P.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},P.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(v(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},P.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},P.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},P.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new ve(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},P.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},P.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},P.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},P.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},P.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},P.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},P.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},P.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=E(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},P.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&A(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},P.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},P.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},P.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var xe=(t,n,r)=>{let i=C(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0)o=n||new e.MeshPhongMaterial({color:r.colour,vertexColors:!1,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.vertexColors=!1,o=M(o));else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide})}return new e.Mesh(i,o)},Se=function(){P.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=xe(e,t,n);this.videoHandler=r.geometry._video,this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour||this.videoHandler)}};Se.prototype=Object.create(P.prototype);var Ce=t.default.default||t.default,we=function(t,n){let r=t,i,a=1,o=500,s=.012;i=n?new Ce(r,s,n.getStyle()):new Ce(r,s),i.fontFace=`Asap`,i.fontSize=90,i.fontWeight=o,i.material.map.generateMipmaps=!0,i.material.map.anisotropy=4,i.material.minFilter=e.LinearMipmapLinearFilter,i.material.magFilter=e.LinearFilter,i.material.sizeAttenuation=!1,i.center.x=-.05,i.center.y=0,this.getPosition=()=>i?[i.position.x,i.position.y,i.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{i&&i.position.set(e,t,n)},this.setColour=e=>{e&&(i.color=e.getStyle())},this.setScale=e=>{i&&e>0&&i.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==i.material.depthTest&&(i.material.depthTest=e)},this.setSize=e=>{e>0&&(i.textHeight=s*e,a=e)},this.setFontWeight=e=>{e&&e!==o&&(i.fontWeight=e,o=e)},this.setText=e=>{if(e&&e!==i.text){if(i._canvas,i.material&&i.material.map&&i.material.map.dispose(),i._canvas){let e=i._canvas.getContext(`2d`);e&&e.clearRect(0,0,i._canvas.width,i._canvas.height),i._canvas.width=1,i._canvas.height=1}i.text=e,i.textHeight=s*a,r=e,i.material&&i.material.map&&(i.material.map.needsUpdate=!0)}},this.setVisibility=e=>{i.visible=e},this.dispose=()=>{},this.getSprite=()=>i,this.getString=()=>r},Te=function(t,n,r,i){P.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new we(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};Te.prototype=Object.create(P.prototype);function Ee(){}Ee.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(Ee.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=Ee.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`video`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var De=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){let r=e/t*n.video.duration;Number.isFinite(r)||(r=0),n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},Oe=e.BufferAttribute,ke=e.BufferGeometry,Ae=e.Color,je=e.DefaultLoadingManager,Me=e.FileLoader,Ne=e.Float32BufferAttribute,Pe=e.LoaderUtils;function Fe(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?je:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Fe.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:Pe.extractUrlBase(e),o=new Me(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){return e&1<<t}function n(e){let n=e.faces,r=0;if(e.uvs!==void 0)for(let t=0;t<e.uvs.length;t++)e.uvs[t].length&&r++;let i=[],a=[],o=0,s=n.length;for(;o<s;){let e=n[o++],s=t(e,0),c=t(e,1),l=t(e,3),u=t(e,4),d=t(e,5),f=t(e,6),p=t(e,7),m,h,g;if(s){let e=n[o],t=n[o+1],s=n[o+2],m=n[o+3];o+=4;let h=0;c&&(h=n[o++]),l&&(o+=r*4),u&&(o+=1),d&&(o+=4),f&&(o+=1),p&&(o+=4),i.push(e,t,m),a.push(h),i.push(t,s,m),a.push(h);continue}m=n[o++],h=n[o++],g=n[o++],h||=m,g||=h;let _=0;c&&(_=n[o++]),l&&(o+=r*3),u&&(o+=1),d&&(o+=3),f&&(o+=1),p&&(o+=3),i.push(m,h,g),a.push(_)}return{indices:i,materialIndices:a}}function r(e){let t=[],n,r;for(let i=0;i<e.length;i++)e[i]!==r&&(r=e[i],n!==void 0&&(n.count=i*3-n.start,t.push(n)),n={start:i*3,materialIndex:r});return n!==void 0&&(n.count=e.length*3-n.start,t.push(n)),t}function i(e,t){let n=new ke;n.setIndex(t),n.setAttribute(`position`,e),n.computeVertexNormals();let r=n.getAttribute(`normal`);return r.name=e.name,r}function a(e,t){let n=[];if(e.morphTargets!==void 0)for(let r=0,i=e.morphTargets.length;r<i;r++){let i=e.morphTargets[r].vertices,a=new Float32Array(i.length);for(let e=0,n=i.length;e<n;e++)a[e]=i[e]*t;let o=new Ne(a,3);o.name=e.morphTargets[r].name,n.push(o)}let r=[];if(e.morphNormals!==void 0){for(let t=0,i=e.morphNormals.length;t<i;t++)if(n[t]){let i=e.morphNormals[t].normals,a=new Ne(Float32Array.from(i),3);a.name=n[t].name,r[t]=a}}return{morphPositions:n,morphNormals:r}}function o(e){if(e.morphColors===void 0)return;let t=[];for(let n=0,r=e.morphColors.length;n<r;n++){let r=e.morphColors[n].colors,i=[];for(let e=0,t=r.length;e<t;e+=3){let t=new Ae(16755200);t.setRGB(r[e],r[e+1],r[e+2]),i.push(t)}let a=[];for(let e=0,t=i.length*3;e<t;e++){let t=x(i,e);a.push(t[0],t[1],t[2])}let o=new Ne(a,3);o.name=e.morphColors[n].name,t.push(o)}return t}return function(t,s){t.data!==void 0&&(t=t.data);let c=t.scale===void 0?1:1/t.scale,l=t.vertices,u=l.length/3,d=new Float32Array(l.length);for(let e=0,t=l.length;e<t;e++)d[e]=l[e]*c;let f=new ke;if(f.setAttribute(`position`,new Oe(d,3)),t.normals!==void 0&&t.normals.length>0&&f.setAttribute(`normal`,new Oe(Float32Array.from(t.normals),3)),t.uvs!==void 0&&(t.uvs[0]&&t.uvs[0].length>0&&f.setAttribute(`uv`,new Oe(Float32Array.from(t.uvs[0]),2)),t.uvs[1]&&t.uvs[1].length>0&&f.setAttribute(`uv2`,new Oe(Float32Array.from(t.uvs[1]),2))),t.colors!==void 0&&t.colors.length>0){let e=new Float32Array(t.colors.length*3);for(let n=0,r=t.colors.length;n<r;n++){let r=new Ae(t.colors[n]);e[n*3]=r.r,e[n*3+1]=r.g,e[n*3+2]=r.b}f.setAttribute(`color`,new Oe(e,3))}else{let e=new Float32Array(u*3).fill(1);f.setAttribute(`color`,new Oe(e,3))}let{indices:p,materialIndices:m}=n(t);p.length>0&&(f.setIndex(p),f.groups=r(m));let{morphPositions:h,morphNormals:g}=a(t,c);if(h.length>0){f.morphAttributes.position=h;let e=[];for(let t=0;t<h.length;t++)g[t]?e.push(g[t]):p.length>0&&e.push(i(h[t],p));e.length>0&&(f.morphAttributes.normal=e)}let _=o(t);if(_!==void 0&&(f.morphAttributes.color=_),f.computeBoundingBox(),f.computeBoundingSphere(),t.materials===void 0||t.materials.length===0)return{geometry:f};var v=Ee.prototype.initMaterials(t.materials,s,`Anonymous`);if(t.materials[0].video){var y=s+t.materials[0].video;this.paramsString&&(y+=`?${this.paramsString}`),f._video=new De(y)}return v&&v.length>0&&(t.materials[0].singleSided?v[0].side=e.FrontSide:t.materials[0].flipSided?v[0].side=e.BackSide:v[0].side=e.DoubleSide,t.materials[0].specularCoef&&(v[0].shininess=Math.floor(t.materials[0].specularCoef/3))),{geometry:f,materials:v}}})()});var Ie=function(){P.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],ee=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Fe;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);re(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,re(v,b))};let j=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},M=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;ee.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=j(u,d,f,p,m,ee);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0,this.boundingBoxUpdateRequired=!0,this.morph.computeBoundingSphere()},N=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},te=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(M(e,t,c,u,d),s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];N(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ne=e=>{for(let e=0;e<u;e++){let n=new Te(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&c.length>0&&e&&this.showLabel(),M(a[0],n[0],r[0],i[0],o[0]),s!=null&&N(s[0]),this.ready=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new Te(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var re=(e,t)=>(n,r)=>{this.geometry.copy(n),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),r&&r[0]&&(this.morph.material=r[0]),ne(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(te(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,te()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&te()}this.updateMarker(t,n)}};Ie.prototype=Object.create(P.prototype);var Le=new e.Matrix4,Re=new e.Ray,ze=new e.Vector3,Be=class extends e.InstancedMesh{constructor(e,t,n){super(e,t,n),this.type=`InstancedPoints`,this.isInstancedPoints=!0,this.frustumCulled=!1,this.pointSize=10,this.sizePerPixel=1,this.pointPositions=new Float32Array}raycast(t,n){let r=this.matrixWorld,i=t.params.Points?t.params.Points.threshold:1,a=this.count,o=this.pointPositions;if(!a||!o||o.length<a*3)return;Le.copy(r).invert(),Re.copy(t.ray).applyMatrix4(Le);let s=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.pointSize*this.sizePerPixel,c=s*s;for(let i=0;i<a;i++){ze.fromArray(o,i*3);let a=Re.distanceSqToPoint(ze);if(a<c){let o=new e.Vector3;Re.closestPointToPoint(ze,o),o.applyMatrix4(r);let s=t.ray.origin.distanceTo(o);if(s<t.near||s>t.far)continue;n.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:i,face:null,object:this})}}}},Ve=new e.Vector2,He=t=>{let r=new e.MeshBasicNodeMaterial,i={pointSize:(0,n.uniform)(10),sizeAttenuation:(0,n.uniform)(0),viewportScale:(0,n.uniform)(1).onFrameUpdate(function({renderer:e}){let t=e.getSize(Ve);this.value=.5*t.y})};return r.vertexNode=(0,n.Fn)(()=>{let e=(0,n.attribute)(`instancePosition`,`vec3`),t=n.modelViewMatrix.mul((0,n.vec4)(e,1)),r=i.pointSize.mul(n.screenDPR),a=r.mul(i.viewportScale.div(t.z.negate()));r=(0,n.mix)(r,a,i.sizeAttenuation);let o=n.positionGeometry.xy.mul(r);o=o.div(n.viewportSize.div(2));let s=n.cameraProjectionMatrix.mul(t);return o=o.mul(s.w),(0,n.vec4)(s.xy.add(o),s.z,s.w)})(),r.colorNode=(0,n.Fn)(()=>{let e=(0,n.texture)(t,(0,n.uv)());return(0,n.vec4)(e.rgb.mul(n.materialColor),e.a.mul(n.materialOpacity))})(),r.userData.uniforms=i,r.size=i.pointSize.value,r.sizeAttenuation=!!i.sizeAttenuation.value,r},Ue=500,We=t=>{let n=new e.PlaneGeometry(1,1),r=new e.InstancedBufferAttribute(new Float32Array(t*3),3);return r.setUsage(e.DynamicDrawUsage),n.setAttribute(`instancePosition`,r),n},Ge=(e,t)=>{let n=e.getAttribute(`position`),r=[Float32Array.from(n.array)],i=e.morphAttributes.position;if(t&&i&&i.length>0){let t=e.morphTargetsRelative;i.forEach(e=>{if(t){let t=new Float32Array(n.array.length);for(let r=0;r<t.length;r++)t[r]=n.array[r]+e.array[r];r.push(t)}else r.push(Float32Array.from(e.array))})}return r},Ke=(e,t)=>{let n=e.morphAttributes.color;if(t&&n&&n.length>0){let t=e.getAttribute(`color`),r=[];return r.push(t?Float32Array.from(t.array):new Float32Array(n[0].array.length)),n.forEach(e=>{r.push(Float32Array.from(e.array))}),r}},qe=e=>{let t=e.getAttribute(`color`);return t?Float32Array.from(t.array):void 0},Je=function(){P.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0,o=[],s,c=!1,l=!1,u=new e.Color,d=()=>{let e=this.getMorph();if(!e||o.length===0)return;let t=e.count,n=o.length,r=0,i=0,a=1;if(n>1){let e=this.inbuildTime/this.duration*(n-1);r=Math.floor(e),i=Math.ceil(e),a=1-(e-r)}if(c){let n=o[r],s=o[i],c=e.pointPositions,l=t*3;for(let e=0;e<l;e++)c[e]=a*n[e]+(1-a)*s[e];let u=e.geometry.getAttribute(`instancePosition`);u.array.set(c.subarray(0,l)),u.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}if(l&&s){let n=s[Math.min(r,s.length-1)],o=s[Math.min(i,s.length-1)];for(let r=0;r<t;r++){let t=r*3;u.setRGB(a*n[t]+(1-a)*o[t],a*n[t+1]+(1-a)*o[t+1],a*n[t+2]+(1-a)*o[t+2]),e.setColorAt(r,u)}e.instanceColor.needsUpdate=!0}};this.createMesh=(e,t,n)=>{if(!e||!t)return;let r=C(e,n);o=Ge(r,n.localTimeEnabled),s=Ke(r,n.localMorphColour),c=o.length>1,l=!!s,this.timeEnabled=c,this.morphColour=l;let i=o[0].length/3,a=We(i),d=He(D());t.color&&d.color.copy(t.color),t.opacity!==void 0&&(d.opacity=t.opacity),d.transparent=!!t.transparent,d.alphaTest=t.alphaTest===void 0?.5:t.alphaTest;let f=new Be(a,d,i);f.count=i,f.pointPositions=new Float32Array(i*3),f.pointPositions.set(o[0]),f.userData=this,this.drawRange=i;let p=a.getAttribute(`instancePosition`);p.array.set(o[0]),p.needsUpdate=!0;let m=s?s[0]:qe(r);if(m)for(let e=0;e<i;e++)u.setRGB(m[e*3],m[e*3+1],m[e*3+2]),f.setColorAt(e,u);this.setMorph(f),r.dispose(),this.boundingBoxUpdateRequired=!0},this.setMesh=(e,t,n)=>{this.createMesh(e.geometry,e.material,{localTimeEnabled:t,localMorphColour:n});let r=this.getMorph();r&&(r.name=e.name)};let f=(o,s,c,l)=>{if(c){let u=new we(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},p=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(e,t,n)=>{if(e&&e.length>0){let r=this.getMorph(),i=this.drawRange;if(!r){i=0,this.drawRange=0;let e=We(Ue),t=He(D());t.color.set(n),t.alphaTest=.5,r=new Be(e,t,Ue),r.pointPositions=new Float32Array(Ue*3),r.count=0,r.userData=this,this.setMorph(r)}let a=r.geometry.getAttribute(`instancePosition`);e.forEach(e=>{this.drawRange<Ue&&(a.setXYZ(this.drawRange,e[0],e[1],e[2]),r.pointPositions[this.drawRange*3]=e[0],r.pointPositions[this.drawRange*3+1]=e[1],r.pointPositions[this.drawRange*3+2]=e[2],this.drawRange++)}),a.needsUpdate=!0,r.count=this.drawRange;let o=i+e.length,s=0;if(Array.isArray(t)&&t.length===e.length||typeof t==`string`)for(;i+s<o;){let n=typeof t==`string`?t:t[s];f(i+s,e[s],n,this._lod._material.color),s++}this.boundingBoxUpdateRequired=!0,this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.userData.uniforms.pointSize.value=e,this.morph.pointSize=e)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.userData.uniforms.sizeAttenuation.value=+!!e)},this.getVerticesByIndex=function(e){let t=this.getMorph();if(t&&e>=0&&this.drawRange>e)return[t.pointPositions[e*3],t.pointPositions[e*3+1],t.pointPositions[e*3+2]]},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`instancePosition`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a,e[0],e[1],e[2]),r.pointPositions[a*3]=e[0],r.pointPositions[a*3+1]=e[1],r.pointPositions[a*3+2]=e[2],o[0]&&(o[0][a*3]=e[0],o[0][a*3+1]=e[1],o[0][a*3+2]=e[2]),a++}),i.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){let t=this.getMorph();if(!t||0>e||e>=this.drawRange)return this.drawRange;let n=t.geometry.getAttribute(`instancePosition`),r=this.drawRange-1;return n.array.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.pointPositions.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.instanceColor&&(t.instanceColor.array.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.instanceColor.needsUpdate=!0),n.needsUpdate=!0,this.drawRange=r,t.count=this.drawRange,p(e),this.boundingBoxUpdateRequired=!0,this.drawRange},this.setName=function(e){let n=this.groupName;Je.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&this.drawRange>0){this._b1.setFromArray(t.pointPositions.subarray(0,this.drawRange*3)),this._b1.getCenter(this._v1);let n=-1;for(let r=0;r<this.drawRange;r++){this._v2.fromArray(t.pointPositions,r*3);let i=this._v1.distanceTo(this._v2);(n===-1||i<n)&&(n=i,e=r)}}return e},this.getClosestVertex=function(t){let n=this.getMorph();this.closestVertexIndex===-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=new e.Vector3;return n&&this.closestVertexIndex>=0?(r.fromArray(n.pointPositions,this.closestVertexIndex*3),t?r.applyMatrix4(n.matrixWorld):r):(this.getBoundingBox(),r.copy(this.center),r)},this.getBoundingBox=function(){let e=this.getMorph();if(this.visible&&e&&e.visible&&this.drawRange>0)return this.boundingBoxUpdateRequired&&=(this._b1.setFromArray(e.pointPositions.subarray(0,this.drawRange*3)),this.cachedBoundingBox.copy(this._b1),e.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(e.matrixWorld),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox},this.isTimeVarying=()=>c||l,this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(c||l)&&d()},this.render=(e,t,n,r)=>{if(this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),this.visible&&this._lod.update(n,this.center),t===!0&&(c||l)){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,d()}this.updateMarker(t,r)}};Je.prototype=Object.create(P.prototype);var Ye=function(){P.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=C(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!1,t=M(t));let i=new pe(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};Ye.prototype=Object.create(P.prototype);var Xe=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Xe.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Xe.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Xe.prototype.loadFromImages=async function(e){},Xe.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Xe.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ze=function(){Xe.call(this),this.isTextureArray=!0,this.imageData=void 0,this.setDataTexture=e=>{this.impl=e,console.log(`setDataTexture`,e),this.imageData=e.image.data},this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.Data3DTexture(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ze.prototype=Object.create(Xe.prototype);function Qe(){let t=new e.MeshBasicNodeMaterial({side:e.DoubleSide}),r=new Uint8Array(32),i=new e.Data3DTexture(r,2,2,2);i.image={data:r,width:2,height:2,depth:2},i.format=e.RGBAFormat,i.type=e.UnsignedByteType,i.minFilter=e.LinearFilter,i.magFilter=e.LinearFilter,i.generateMipmaps=!1,i.unpackAlignment=1,i.needsUpdate=!0;let a={brightness:(0,n.uniform)(0),contrast:(0,n.uniform)(1),depth:(0,n.uniform)(1),discardAlpha:(0,n.uniform)(!0),direction:(0,n.uniform)(1),flipY:(0,n.uniform)(!0),flipZ:(0,n.uniform)(!1),nChannels:(0,n.uniform)(1),maskEnabled:(0,n.uniform)(!1),slide:(0,n.uniform)(new e.Vector3(0,0,1)),time:(0,n.uniform)(0)},o=(0,n.varying)((0,n.vec3)(0),`vUw`);a.diffuse0=(0,n.texture3D)(i,o),a.diffuse1=(0,n.texture3D)(i,o),a.mask=(0,n.texture3D)(i,o);let s=(0,n.Fn)(()=>{let e=(0,n.vec3)(n.positionLocal).toVar();return(0,n.If)(a.direction.equal(1),()=>{e.assign((0,n.vec3)(a.slide.x,n.positionLocal.y,n.positionLocal.x))}),(0,n.If)(a.direction.equal(2),()=>{e.assign((0,n.vec3)(n.positionLocal.x,a.slide.y,n.positionLocal.y))}),(0,n.If)(a.direction.equal(3),()=>{e.assign((0,n.vec3)(n.positionLocal.x,n.positionLocal.y,a.slide.z))}),(0,n.If)(a.flipY,()=>{e.y.assign((0,n.float)(1).sub(e.y))}),(0,n.If)(a.flipZ,()=>{e.z.assign((0,n.float)(1).sub(e.z))}),o.assign((0,n.vec3)(e.x,e.y,e.z)),n.positionLocal}),c=(0,n.Fn)(()=>{let e=a.diffuse0.r,t=a.diffuse1.r,r=(0,n.mix)(e,t,a.time).toVar();(0,n.If)(a.maskEnabled.and(a.discardAlpha),()=>{let e=a.mask.r;(0,n.If)(e.equal(0),()=>{(0,n.Discard)()})});let i=(0,n.vec3)(r).add((0,n.vec3)(a.brightness)).sub((0,n.vec3)(.5)).mul(a.contrast).add((0,n.vec3)(.5));return(0,n.vec4)(i,1)});return t.positionNode=s(),t.colorNode=c(),t.userData.uniforms=a,t}var $e=function(e){P.call(this),this.isTexturePrimitive=!0,this.texture=e,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(e,t,n)=>{if(e&&e.images&&e.images.source){let n=new Ze,r=[];e.images.source.forEach(e=>{r.push(e)});let i=this;n.loadFromImages(r).then(()=>{i.texture=n,i.textureList.push(this.texture),i.initialise(e,t)})}},this.addTextureArray=e=>{this.textureList.length===0&&this.texture&&this.textureList.push(this.texture),e&&e.isTextureArray&&this.textureList.push(e)},this.initialise=(e,t)=>{t!=null&&typeof t==`function`&&t(this)}};$e.prototype=Object.create(P.prototype),$e.prototype.constructor=$e;var et=t=>{let n=t.image,r=n.width,i=n.height,a=n.depth,o=n.data,s=new e.Data3DTexture(o,r,i,a);return s.format=t.format,s.type=t.type,s.minFilter=t.minFilter,s.magFilter=t.magFilter,s.wrapS=t.wrapS,s.wrapT=t.wrapT,s.wrapR=t.wrapR,s.needsUpdate=!0,s},tt=function(t){$e.call(this,t),this.isTextureSlides=!0;let n=[],r={};this.morph=new e.Group,this.group=this.morph,this.morph.userData=this;let i,a=!0,o=!1,s=0,c=1,l=1,u,d=!1,f=!0,p=0,m=0,h=-.1;this.createSlides=e=>{e.forEach(e=>this.createSlide(e))};let g=(e,t)=>{let n=e.material.userData.uniforms;switch(e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.position.x=0,e.position.y=0,e.position.z=0,t.direction){case`x`:let r=-Math.PI/2;e.rotation.y=r,n.direction.value=1,n.slide.value.set(t.value,0,0),e.position.x=t.value;break;case`y`:e.rotation.x=Math.PI/2,n.direction.value=2,n.slide.value.set(0,t.value,0),e.position.y=t.value;break;case`z`:n.direction.value=3,n.slide.value.set(0,0,t.value),e.position.z=t.value}this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=e=>{e&&e.id&&e.id in r&&r[e.id]&&g(r[e.id],e)},this.createSlide=t=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&t&&t.direction&&t.value!==void 0){let i=new e.PlaneGeometry(1,1);i.translate(.5,.5,0);let p=Qe();p.userData.uniforms.brightness.value=s,p.userData.uniforms.contrast.value=c,p.userData.uniforms.diffuse0.value=et(this.texture.impl),p.userData.uniforms.diffuse1.value=et(this.texture.impl),p.userData.uniforms.discardAlpha.value=f,p.userData.uniforms.depth.value=this.texture.size.depth,p.userData.uniforms.flipY.value=a,p.userData.uniforms.flipZ.value=o,u&&(p.userData.uniforms.mask.value=u),p.userData.uniforms.maskEnabled.value=d,p.userData.uniforms.nChannels.value=l;let m=new e.Mesh(i,p);m.name=this.groupName,m.userData=this;let h={value:t.value,direction:t.direction,id:m.id};return n.push(h),g(m,h),r[m.id]=m,this.morph.add(m),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),h}},this.getTextureSettings=()=>[...n],this.getTextureSettingsWithId=e=>{for(let t=0;t<n.length;t++)if(e===n[t].id)return{...n[t]}},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=e=>{e&&this.removeSlideWithId(e.id)},this.removeSlideWithId=e=>{if(this.morph&&e in r&&r[e]){if(this.morph.getObjectById(e)){let t=r[e];this.morph.remove(t),t.clear(),t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose(),this.boundingBoxUpdateRequired=!0}let t=n.findIndex(t=>t.id===e);t>-1&&n.splice(t,1)}},this.dispose=()=>{this.morph.children.forEach(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),$e.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};let _=(e,t,n)=>{if(t)switch(t.direction.value){case 1:n.copy(t.slide.value),e.expandByPoint(n),n.setY(1),n.setZ(1),e.expandByPoint(n);break;case 2:n.copy(t.slide.value),e.expandByPoint(n),n.setX(1),n.setZ(1),e.expandByPoint(n);break;case 3:n.copy(t.slide.value),e.expandByPoint(n),n.setX(1),n.setY(1),e.expandByPoint(n)}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();let t=new e.Vector3(0,0,0);this.morph.children.forEach(e=>{_(this.cachedBoundingBox,e.material.userData.uniforms,t)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(t,n,r)=>{let i=new e.Matrix4;i.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,0);let a=new e.Quaternion().setFromRotationMatrix(i);this.morph.position.set(...n),this.morph.quaternion.copy(a),this.morph.scale.set(...r),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=e=>{this.morph.renderOrder=e},this.initialise=(e,t)=>{if(e){let n=e.locations;n&&n.length>0&&(this.applyTransformation(n[0].orientation,n[0].position,n[0].scale),`flipY`in n[0]&&(a=n[0].flipY),`flipZ`in n[0]&&(o=n[0].flipZ)),this.createSlides(e.settings.slides),t!=null&&typeof t==`function`&&t(this)}},this.showEdges=t=>{if(i)i.material.color=t;else{let n=new e.BoxGeometry(1,1,1);n.translate(.5,.5,.5);let r=new e.EdgesGeometry(n);i=new e.LineSegments(r,new e.LineBasicMaterial({color:t})),this.group.add(i)}i.visible=!0},this.setUniformsValue=(e,t)=>{this.morph.children.forEach(n=>{let r=n.material;if(r.userData.uniforms){let n=r.userData.uniforms;n[e].value=t}})},this.isAlphaPixelDiscarded=()=>f,this.discardAlphaPixel=e=>{f=e,this.setUniformsValue(`discardAlpha`,f)},this.getBrightness=()=>s,this.setBrightness=e=>{s=e,this.setUniformsValue(`brightness`,s)},this.getContrast=()=>c,this.setContrast=e=>{c>=0&&(c=e,this.setUniformsValue(`contrast`,c))},this.getNumberOfChannels=()=>l,this.setNumberOfChannels=e=>{l=e,this.setUniformsValue(`nChannels`,l)},this.getMask=()=>u,this.setMask=e=>{u=e,d=!!u,this.morph.children.forEach(e=>{let t=e.material;if(t.userData.uniforms){let e=t.userData.uniforms;u&&(e.mask.value=u)}}),this.setUniformsValue(`maskEnabled`,d)},this.hideEdges=()=>{i&&(i.visible=!1)},this.updateTimeTexture=()=>{let e=this.textureList.length-1,t=this.inbuildTime/this.duration;if(this.timeEnabled&&e>0&&h!==t){let n=t*e,r=Math.floor(n),i=Math.ceil(n),a=n-r;this.morph.children.forEach(e=>{let t=e.material;if(t.userData.uniforms){let e=t.userData.uniforms;p!==r&&(e.diffuse0.value.image.data=this.textureList[r].imageData,e.diffuse0.value.needsUpdate=!0),m!==i&&(e.diffuse1.value.image.data=this.textureList[i].imageData,e.diffuse1.value.needsUpdate=!0),e.time.value=a}}),p=r,m=i,h=t}},this.setMorphTime=e=>{let t=e;t=e>this.duration?this.duration:0>e?0:e,t!=this.inbuildTime&&(this.inbuildTime=t,this.updateTimeTexture())},this.render=(e,t,n)=>{if(t==1&&this.timeEnabled&&this.textureList.length>1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,this.updateTimeTexture()}}};tt.prototype=Object.create($e.prototype),tt.prototype.constructor=tt;var nt=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];let e=this;this.setFromObject=({nearPlane:t,farPlane:n,eyePosition:r,targetPosition:i,upVector:a})=>{e.nearPlane=t,e.farPlane=n,e.eyePosition=r,e.targetPosition=i,e.upVector=a}},rt=function(t,n,r,i){let a={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},o={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},s={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},c={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},l={};l.MAIN=o.ROTATE,l.AUXILIARY=o.ZOOM,l.SECONDARY=o.PAN,this.cameraObject=t,this.domElement=n===void 0?document:n,this.renderer=r,this.scene=i,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;let u=6e3,d=!0,f=0,p,m,h=!1,g=500,_,v=`default`,y=a.DEFAULT,b,x,S,C=0,w=s.FREE;this._state=o.NONE;let T;this.targetTouchId=-1;let E,D=new e.Vector3,O=new e.Vector3,k=new e.Vector3,A=new e.Vector3,ee=new e.Vector3,j=new e.Vector3,M=new e.Vector3,N=new e.Vector3,te=new e.Sphere,ne=new e.Vector3,re=!1,ie,ae=0,oe={default:new nt};oe.default.nearPlane=.1,oe.default.farPlane=2e3,oe.default.eyePosition=[0,0,0],oe.default.targetPosition=[0,0,-1],oe.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new e.Vector3(...oe.default.targetPosition)),this.calculateMaxAllowedDistance=e=>{let t=e.getBoundingBox();if(t){t.getBoundingSphere(te),ae=te.radius*6;let e=0;this.cameraObject&&(e=this.cameraObject.position.distanceTo(te.center)),ae=e>ae?e*1.5:ae}else ae=0};let se=e=>{D.copy(this.cameraObject.position);let t=D.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,t*.001),this.cameraObject.far=this.cameraObject.near*1e4};this.addViewport=(e,t)=>{e&&t&&(oe[e]=t)},this.setDefaultViewport=e=>e&&e in oe?(v=e,!0):!1,this.getDefaultViewport=()=>v,this.getViewportOfName=e=>oe[e],this.setCurrentViewport=e=>e in oe&&(this.setCurrentCameraSettings(oe[e]),!0),this.setRotationMode=e=>{switch(e){case`none`:w=s.NONE;break;case`horizontal`:w=s.HORIZONTAL;break;case`vertical`:w=s.VERTICAL;break;default:w=s.FREE}},this.onResize=()=>{E&&=void 0,ie&&ie.setCurrentCameraSettings(this.cameraObject,oe[v])},this.getVisibleHeightAtZDepth=e=>{let t=this.cameraObject.position.distanceTo(this.cameraObject.target);e<t?e-=t:e+=t;let n=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(n/2)*Math.abs(e)},this.calculateHeightPerPixelAtZeroDepth=e=>{let t=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=t/e,this.pixelHeight},this.getNDCFromDocumentCoords=(t,n,r)=>{ye(!1);let i=r||new e.Vector2,a=(t-E.left)/E.width*2-1,o=-((n-E.top)/E.height)*2+1;return i.set(a,o)},this.getRelativeCoordsFromNDC=(t,n,r)=>{ye(!1);let i=r||new e.Vector2;return i.x=(t+1)*E.width/2,i.y=(1-n)*E.height/2,i},this.setMouseButtonAction=(e,t)=>{l[e]=o[t]};let ce=(e,t)=>{e instanceof HTMLCanvasElement&&(e.tabIndex=t)},le=()=>{if(ae>0){let e=ne.distanceTo(te.center);return ae>e||this.cameraObject.position.distanceTo(te.center)>e}return!0},ue=e=>{ne.copy(this.cameraObject.position).add(e),le()&&(this.cameraObject.target.add(e),this.cameraObject.position.add(e),this.updateDirectionalLight())},de=e=>{ye(!1);let t;if(y===a.DEFAULT&&(t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e)),!t)e.button==0?this._state=e.ctrlKey?l.AUXILIARY:e.shiftKey?l.SECONDARY:l.MAIN:e.button==1?(e.preventDefault(),this._state=l.AUXILIARY):e.button==2&&(this._state=l.SECONDARY),this.pointer_x=e.clientX-E.left,this.pointer_y=e.clientY-E.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{y=a.MINIMAP;let e=this.scene.getMinimapDiffFromNormalised(t.x,t.y);ue(e)}},fe=e=>{if(ye(!1),E){if(this.pointer_x=e.clientX-E.left,this.pointer_y=e.clientY-E.top,y===a.MINIMAP){let t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e);if(t){let e=this.scene.getMinimapDiffFromNormalised(t.x,t.y);ue(e)}}else this._state===o.NONE&&T!==void 0&&T.move(this,e.clientX,e.clientY,this.renderer)}},pe=e=>{this._state=o.NONE,y==a.MINIMAP&&(y=a.DEFAULT),T!==void 0&&this.pointer_x_start==e.clientX-E.left&&this.pointer_y_start==e.clientY-E.top&&T.pick(this,e.clientX,e.clientY,this.renderer)},me=e=>{this._state=o.NONE},he=e=>{ye(!1);let t=e.touches.length;if(t==1)this._state=o.TOUCH_ROTATE,this.pointer_x=e.touches[0].clientX-E?.left,this.pointer_y=e.touches[0].clientY-E?.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(t==2){this._state=o.TOUCH_ZOOM;let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(t*t+n*n)}else t==3&&(this._state=o.TOUCH_PAN,this.targetTouchId=e.touches[0].identifier,this.pointer_x=e.touches[0].clientX-E?.left,this.pointer_y=e.touches[0].clientY-E?.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ge=e=>{e.preventDefault(),e.stopPropagation();let t=e.touches.length;if(t==1)this.pointer_x=e.touches[0].clientX-E.left,this.pointer_y=e.touches[0].clientY-E.top;else if(t==2){if(this._state===o.TOUCH_ZOOM){let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(t*t+n*n)}}else if(t==3&&this._state===o.TOUCH_PAN)for(let t=0;t<3;t++)e.touches[t].identifier==this.targetTouchId&&(this.pointer_x=e.touches[0].clientX-E.left,this.pointer_y=e.touches[0].clientY-E.top)},_e=e=>{let t=e.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=o.NONE,t==1&&T!==void 0&&this.pointer_x_start==e.touches[0].clientX-E.left&&this.pointer_y_start==e.touches[0].clientY-E.top&&T.pick(this.cameraObject,e.touches[0].clientX,e.touches[0].clientY,this.renderer)},ve=()=>{ye(!0)},ye=e=>{if(e||E===void 0){let e=new IntersectionObserver(t=>{for(let e of t)E=e.boundingClientRect;e.disconnect()});e.observe(this.domElement)}},be=e=>{ye(!1),this._state=o.SCROLL;let t=0;e.deltaY>0?t=this.zoomRate:e.deltaY<0&&(t=this.zoomRate*-1),C+=t,e.preventDefault(),e.stopImmediatePropagation()},P=e=>{ye(!1);let t=0;if(e.keyCode===c.EQUAL||e.keyCode===c.MINUS||e.keyCode===c.NUMPADADD||e.keyCode===c.NUMPADSUBTRACT){this._state=o.KEYBOARD_ZOOM;let n=1;e.shiftKey&&(n*=2),e.keyCode===c.EQUAL||e.keyCode===c.NUMPADADD?t=this.zoomRate*n*-1:(e.keyCode===c.MINUS||e.keyCode===c.NUMPADSUBTRACT)&&(t=this.zoomRate*n),C+=t}else(e.keyCode===c.ARROWLEFT||e.keyCode===c.ARROWUP||e.keyCode===c.ARROWRIGHT||e.keyCode===c.ARROWDOWN)&&(e.shiftKey?(this._state=o.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,t=this.rotateRate):(this._state=o.KEYBOARD_PAN,t=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,e.keyCode===c.ARROWLEFT?this.pointer_x-=t:e.keyCode===c.ARROWUP?this.pointer_y-=t:e.keyCode===c.ARROWRIGHT?this.pointer_x+=t:e.keyCode===c.ARROWDOWN&&(this.pointer_y+=t));Object.values(c).includes(e.keyCode)&&e.preventDefault()},xe=e=>{this._state=o.NONE},Se=()=>{if(this.cameraObject!==void 0){let e=E.height,t=this.cameraObject.position.distanceTo(this.cameraObject.target),n=0;this.cameraObject.far>this.cameraObject.near&&t>=this.cameraObject.near&&t<=this.cameraObject.far&&(n=(t-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),O.set(this.previous_pointer_x,e-this.previous_pointer_y,0),k.set(this.previous_pointer_x,e-this.previous_pointer_y,1),A.set(this.pointer_x,e-this.pointer_y,0),ee.set(this.pointer_x,e-this.pointer_y,1),O.unproject(this.cameraObject),k.unproject(this.cameraObject),A.unproject(this.cameraObject),ee.unproject(this.cameraObject),A.sub(O).multiplyScalar(1-n),ee.sub(k).multiplyScalar(n),A.add(ee).multiplyScalar(-.002),ue(A)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(e,t)=>{e.normalize(),M.copy(this.cameraObject.position).sub(this.cameraObject.target),N.copy(M),M.normalize(),.8<Math.abs(M.dot(e))&&M.copy(this.cameraObject.up),O.crossVectors(e,M).normalize(),k.crossVectors(e,O);let n=e.dot(N),r=O.dot(N),i=k.dot(N),a=e.dot(this.cameraObject.up),o=O.dot(this.cameraObject.up),s=k.dot(this.cameraObject.up),c=Math.cos(t),l=Math.sin(t);return A.set(c*O.x+l*k.x,c*O.y+l*k.y,c*O.z+l*k.z),ee.set(c*k.x-l*O.x,c*k.y-l*O.y,c*k.z-l*O.z),M.copy(this.cameraObject.target),M.x=M.x+e.x*n+A.x*r+ee.x*i,M.y=M.y+e.y*n+A.y*r+ee.y*i,M.z=M.z+e.z*n+A.z*r+ee.z*i,D.set(e.x*a+A.x*o+ee.x*s,e.y*a+A.y*o+ee.y*s,e.z*a+A.z*o+ee.z*s),{position:M,up:D}},this.rotateAboutLookAtpoint=(e,t)=>{let n=this.getVectorsFromRotateAboutLookAtPoints(e,t);this.cameraObject.position.copy(n.position),this.updateDirectionalLight(),this.cameraObject.up.copy(n.up)};let Ce=()=>{if(this.cameraObject!==void 0){let e=E?.width,t=E?.height;if(0<e&&0<t){let n=.25*(e+t),r=0,i=0;(w===s.FREE||w===s.HORIZONTAL)&&(r=this.pointer_x-this.previous_pointer_x),(w===s.FREE||w===s.VERTICAL)&&(i=this.previous_pointer_y-this.pointer_y);let a=Math.sqrt(r*r+i*i);if(a>0){let o=-i*1/a,c=r*1/a;if(w===s.FREE){let r=o*(this.pointer_x-.5*(e-1))+c*(.5*(t-1)-this.pointer_y);r>n?r=n:r<-n&&(r=-n)}let l=Math.acos(0/n)-.5*Math.PI,u=this.tumble_rate*a/n;D.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),O.copy(this.cameraObject.up).normalize(),k.copy(O).cross(D).normalize().multiplyScalar(o),O.multiplyScalar(c),j.addVectors(k,O).multiplyScalar(Math.cos(l)),D.multiplyScalar(Math.sin(l)),j.add(D),this.rotateAboutLookAtpoint(j,-u)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},we=()=>{let e=0;return this._state===o.ZOOM?e=this.previous_pointer_y-this.pointer_y:this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM?e=C:(e=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),e};this.changeZoomByScrollRateUnit=e=>{let t=e*this.zoomRate;this.changeZoomByValue(t)},this.changeZoomByValue=e=>{if(this.cameraObject!==void 0){let t=E.height,n=this.cameraObject.position.clone();n.sub(this.cameraObject.target);let r=n.length(),i=r*(1.5*e/t);r+i>.01&&(n.normalize(),ne.copy(this.cameraObject.position),ne.x+=n.x*i,ne.y+=n.y*i,ne.z+=n.z*i,le()&&(this.cameraObject.position.copy(ne),this.updateDirectionalLight(),se(i),re=!0))}};let Te=()=>{let e=we();this.changeZoomByValue(e),this._state===o.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(C=0,this._state=o.NONE)};this.setDirectionalLight=e=>{this.directionalLight=e},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){d=!0,this.domElement&&this.domElement.addEventListener&&(ce(this.domElement,0),this.domElement.addEventListener(`mousedown`,de,!1),this.domElement.addEventListener(`mousemove`,fe,!1),this.domElement.addEventListener(`mouseup`,pe,!1),this.domElement.addEventListener(`mouseleave`,me,!1),this.domElement.addEventListener(`touchstart`,he,!1),this.domElement.addEventListener(`touchmove`,ge,!1),this.domElement.addEventListener(`touchend`,_e,!1),this.domElement.addEventListener(`wheel`,be,!1),this.domElement.addEventListener(`mouseenter`,ve,!1),this.domElement.addEventListener(`contextmenu`,e=>{e.preventDefault()},!1),this.domElement.addEventListener(`keydown`,P,!1),this.domElement.addEventListener(`keyup`,xe,!1))},this.disable=function(){d=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener(`mousedown`,de,!1),this.domElement.removeEventListener(`mousemove`,fe,!1),this.domElement.removeEventListener(`mouseup`,pe,!1),this.domElement.removeEventListener(`mouseleave`,me,!1),this.domElement.removeEventListener(`touchstart`,he,!1),this.domElement.removeEventListener(`touchmove`,ge,!1),this.domElement.removeEventListener(`touchend`,_e,!1),this.domElement.removeEventListener(`wheel`,be,!1),this.domElement.removeEventListener(`mouseenter`,ve,!1),this.domElement.removeEventListener(`contextmenu`,e=>{e.preventDefault()},!1),this.domElement.removeEventListener(`keydown`,P,!1),this.domElement.removeEventListener(`keyup`,xe,!1),ce(this.domElement,-1))},this.loadPath=e=>{p=e.CameraPath,m=e.NumberOfPoints},this.loadPathURL=(e,t)=>{let n=e;fetch(n).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{this.loadPath(e),t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Failed to load path asset from: ${n}`,e)})},this.setPathDuration=e=>{u=e,b&&b.setDuration(u),x&&x.setDuration(u)},this.getPlayRate=()=>g,this.setPlayRate=e=>{g=e};let Ee=e=>{let t=f+e;t>u&&(t-=u),f=t};this.getTime=()=>f,this.setTime=e=>{f=e>u?u:e<0?0:e},this.getNumberOfTimeFrame=()=>m,this.getCurrentTimeFrame=()=>{if(m>2){let e=f/u*(m-1),t=Math.floor(e),n=1-(e-t),r=Math.ceil(e);return t==r?t==m-1?[t-1,r,0]:[t,r+1,1]:[t,r,n]}if(m==1)return[0,0,0]},this.setCurrentTimeFrame=e=>{m>2&&(f=u*e/(m-1),f<0&&(f=0),f>u&&(f=u))};let De=e=>{if(y===a.PATH&&(Ee(e),p)){let e=this.getCurrentTimeFrame(),t=e[0],n=e[1],r=e[2],i=[p[t*3],p[t*3+1],p[t*3+2]],a=[p[n*3],p[n*3+1],p[n*3+2]],o=[];for(let e=0;e<i.length;e++)o.push(r*i[e]+(1-r)*a[e]);this.cameraObject.position.set(o[0],o[1],o[2]),this.cameraObject.target.set(a[0],a[1],a[2]),_&&this.cameraObject.lookAt(this.cameraObject.target),h&&(this.directionalLight.position.set(o[0],o[1],o[2]),this.directionalLight.target.position.set(a[0],a[1],a[2]))}};this.calculatePathNow=()=>{De(0)};let Oe=()=>{this._state===o.ROTATE||this._state===o.TOUCH_ROTATE||this._state===o.KEYBOARD_ROTATE?Ce():this._state===o.PAN||this._state===o.TOUCH_PAN||this._state===o.KEYBOARD_PAN?(Se(),ie.triggerCallback()):(this._state===o.ZOOM||this._state===o.TOUCH_ZOOM||this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(ie.zoom(we()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(this._state=o.NONE),C=0,ie.triggerCallback())};this.update=e=>{let t=e*g,n=d,r=!0;return y===a.PATH?De(t):y===a.SMOOTH_CAMERA_TRANSITION&&b?(b.update(t),b.isTransitionCompleted()&&(y=a.DEFAULT),n=!1):y===a.ROTATE_CAMERA_TRANSITION&&x?(x.update(t),x.isTransitionCompleted()&&(y=a.DEFAULT),n=!1):y===a.AUTO_TUMBLE&&S?S.update(t):y===a.SYNC_CONTROL&&ie?(Oe(),n=!1):r=!1,n&&(this._state!==o.NONE&&(r=!0),this._state===o.ROTATE||this._state===o.TOUCH_ROTATE||this._state===o.KEYBOARD_ROTATE?Ce():this._state===o.PAN||this._state===o.TOUCH_PAN||this._state===o.KEYBOARD_PAN?Se():(this._state===o.ZOOM||this._state===o.TOUCH_ZOOM||this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&Te(),this._state!==o.NONE&&y===a.AUTO_TUMBLE&&S&&S.stopOnCameraInput,this._state===o.SCROLL&&(this._state=o.NONE)),_?(r=!0,_.update()):this.cameraObject.lookAt(this.cameraObject.target),r||=re,re=!1,r},this.playPath=()=>{y=a.PATH},this.stopPath=()=>{y=a.DEFAULT},this.isPlayingPath=()=>y===a.PATH,this.enableDirectionalLightUpdateWithPath=e=>{h=e},this.enableDeviceOrientation=()=>{_||=new ut(this.cameraObject)},this.disableDeviceOrientation=()=>{_&&=(_.dispose(),void 0)},this.isDeviceOrientationEnabled=()=>!!_,this.resetView=()=>{let e=oe[v];this.cameraObject.near=e.nearPlane,this.cameraObject.far=e.farPlane,this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=e=>{e.nearPlane&&(this.cameraObject.near=e.nearPlane),e.farPlane&&(this.cameraObject.far=e.farPlane),e.eyePosition&&this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),e.targetPosition&&this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),e.upVector&&this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),re=!0},this.getViewportFromCentreAndRadius=(e,t,n,r,i,a)=>{D.copy(this.cameraObject.position),D.sub(this.cameraObject.target),D.normalize();let o=[e,t,n],s=r/Math.tan(i*Math.PI/360),c=[e+D.x*s,t+D.y*s,n+D.z*s],l=s+a,u=0;u=a>.95*s?.050000000000000044*s:s-a;let d=new nt;return d.nearPlane=u,d.farPlane=l,d.eyePosition=c,d.targetPosition=o,d.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],d},this.getViewportFromBoundingBox=(e,t)=>{let n=e.min.distanceTo(e.max)/2*t,r=(e.min.x+e.max.x)/2,i=(e.min.y+e.max.y)/2,a=(e.min.z+e.max.z)/2;return this.getViewportFromCentreAndRadius(r,i,a,n,40,n*4)},this.getCurrentViewport=()=>{let e=new nt;return e.nearPlane=this.cameraObject.near,e.farPlane=this.cameraObject.far,e.eyePosition[0]=this.cameraObject.position.x,e.eyePosition[1]=this.cameraObject.position.y,e.eyePosition[2]=this.cameraObject.position.z,e.targetPosition[0]=this.cameraObject.target.x,e.targetPosition[1]=this.cameraObject.target.y,e.targetPosition[2]=this.cameraObject.target.z,e.upVector[0]=this.cameraObject.up.x,e.upVector[1]=this.cameraObject.up.y,e.upVector[2]=this.cameraObject.up.z,e},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(e,t,n)=>{x??(b=new it(e,t,this,n))},this.rotateCameraTransition=(e,t,n)=>{b??(x=new at(e,t,this,n))},this.enableCameraTransition=()=>{b&&(y=a.SMOOTH_CAMERA_TRANSITION),x&&(y=a.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{y=a.DEFAULT},this.stopCameraTransition=()=>{y=a.DEFAULT,b=void 0,x=void 0},this.isTransitioningCamera=()=>y===a.SMOOTH_CAMERA_TRANSITION||y===a.ROTATE_CAMERA_TRANSITION,this.autoTumble=(e,t,n)=>{S=new st(e,t,n,this)},this.enableAutoTumble=()=>{y=a.AUTO_TUMBLE},this.stopAutoTumble=()=>{y=a.DEFAULT,S=void 0},this.updateAutoTumble=()=>{S&&(S.requireUpdate=!0)},this.isAutoTumble=()=>y===a.AUTO_TUMBLE,this.enableRaycaster=(e,t,n)=>{T??=new ot(e,this.scene,t,n,this.renderer)},this.disableRaycaster=()=>{T.disable(),T=void 0},this.isSyncControl=()=>currentMpde===a.SYNC_CONTROL,this.enableSyncControl=()=>(y=a.SYNC_CONTROL,ie||=new dt,ie.setCurrentCameraSettings(this.cameraObject,oe[v]),ie),this.disableSyncControl=()=>{y=a.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},it=function(e,t,n,r){let i=e.eyePosition,a=e.targetPosition,o=e.upVector,s=t.eyePosition,c=t.targetPosition,l=t.upVector,u=n,d=r,f=0,p=!1;u.near=Math.min(e.nearPlane,t.nearPlane),u.far=Math.max(e.farPlane,t.farPlane),u.cameraObject.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),this.setDuration=e=>{d=e};let m=e=>{let t=f+e;t>d&&(t=d),f=t},h=()=>{let e=f/d,t=[i[0]*(1-e)+s[0]*e,i[1]*(1-e)+s[1]*e,i[2]*(1-e)+s[2]*e],n=[a[0]*(1-e)+c[0]*e,a[1]*(1-e)+c[1]*e,a[2]*(1-e)+c[2]*e];o[0]*(1-e)+l[0]*e,o[1]*(1-e)+l[1]*e,o[2]*(1-e)+l[2]*e,u.cameraObject.position.set(t[0],t[1],t[2]),u.cameraObject.target.set(n[0],n[1],n[2])};this.update=e=>{this.enabled!==!1&&(m(e),h(),f==d&&(p=!0))},this.isTransitionCompleted=()=>p},at=function(e,t,n,r){let i=e,a=t,o=n,s=r,c=0;c/s;let l=!1;this.setDuration=e=>{s=e};let u=e=>{let t=c,n=c+e;n>s&&(n=s),c=n;let r=(c-t)/s*a;o.rotateAboutLookAtpoint(i,r)};this.update=e=>{this.enabled!==!1&&(u(e),c==s&&(l=!0))},this.isTransitionCompleted=()=>l},ot=function(t,n,r,i,a){let o=t,s=n,c=a,l=r,u=i,d=!0,f=new e.Raycaster;f.params.Line.threshold=.1,f.params.Points.threshold=1;let p=new e.Vector2,m=!1,h=new Date,g=!1,_=0,v=[],y={zincCamera:void 0,x:-1,y:-1},b;this.enable=()=>{d=!0},this.disable=()=>{d=!1},this.getIntersectsObject=e=>{if(s!==o){let t=o.getThreeJSScene();c.render(t,e.cameraObject)}let t=b||o.getPickableThreeJSObjects();return v.length=0,f.intersectObjects(t,!0,v)},this.setPickableObjects=e=>{e===void 0?b=void 0:(b=[],e.forEach(e=>{e.getGroup()&&e.getGroup().visible&&b.push(e.getGroup())}))},this.getIntersectsObjectWithOrigin=(e,t,n)=>(f.set(t,n),this.getIntersectsObject(e)),this.getIntersectsObjectWithCamera=(e,t,n)=>(e.getNDCFromDocumentCoords(t,n,p),f.setFromCamera(p,e.cameraObject),this.getIntersectsObject(e)),this.pick=(e,t,n)=>{if(d&&c&&o&&e&&l){this.getIntersectsObjectWithCamera(e,t,n);let r=v.length;for(let e=0;e<r;e++){let t=v[e].object?v[e].object.userData:void 0;if(t&&t.isMarkerCluster&&t.visible&&t.clusterIsVisible(v[e].object.clusterIndex)&&t.zoomToCluster(v[e].object.clusterIndex))return}l(v,t,n)}};let x=(e,t,n)=>{if(d&&c&&o&&e&&u){if(this.getIntersectsObjectWithCamera(e,t,n),h.setTime(Date.now()),v.length===0){if(g)return;g=!0}else g=!1;u(v,t,n)}};this.move=(e,t,n)=>{d&&c&&o&&e&&u&&(o.displayMarkers?x(e,t,n):(y.zincCamera=e,y.x=t,y.y=n,m||(_=h?Date.now()-h.getTime():250,_>=250?x(e,t,n):(m=!0,setTimeout(S(y),_)))))};let S=e=>function(){m=!1,x(e.zincCamera,e.x,e.y)}},st=function(t,n,r,i){let a=new e.Vector3,o=-n,s=i,c=t;this.stopOnCameraInput=r,this.requireUpdate=!0;let l=new e.Vector3,u=new e.Vector3,d=e=>{let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=.25*(Math.abs(e[0])*4+Math.abs(e[1])*4),r=-e[1]/t,i=e[0]/t,o=r*e[0]+i*-e[1];o>n?o=n:o<-n&&(o=-n);let c=Math.acos(o/n)-.5*Math.PI;a.copy(s.cameraObject.position).sub(s.cameraObject.target).normalize(),l.copy(s.cameraObject.up).normalize(),u.crossVectors(l,a).normalize().multiplyScalar(r),l.multiplyScalar(i),l.add(u).multiplyScalar(Math.cos(c)),a.multiplyScalar(Math.sin(c)).add(l)};this.update=e=>{this.enabled!==!1&&(this.requireUpdate&&=(d(c),!1),s.rotateAboutLookAtpoint(a,o*e/1e3))}},ct=function(){this.type=`StereoCamera`,this.aspect=1,this.cameraL=new e.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new e.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(ct.prototype,{update:(()=>{let t,n,r,i,a,o,s=new e.Matrix4,c=new e.Matrix4;return function(l){if(t!==l.focus||n!==l.fov||r!==l.aspect*this.aspect||i!==l.near||a!==l.far||o!==l.zoom){t=l.focus,n=l.fov,r=l.aspect*this.aspect,i=l.near,a=l.far,o=l.zoom;let u=l.projectionMatrix.clone(),d=.064/2,f=d*i/t,p=i*Math.tan(e.Math.DEG2RAD*n*.5)/l.zoom,m,h;c.elements[12]=-.032,s.elements[12]=d,m=-p*r+f,h=p*r+f,u.elements[0]=2*i/(h-m),u.elements[8]=(h+m)/(h-m),this.cameraL.projectionMatrix.copy(u),m=-p*r-f,h=p*r-f,u.elements[0]=2*i/(h-m),u.elements[8]=(h+m)/(h-m),this.cameraR.projectionMatrix.copy(u)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(s)}})()});var lt=function(e){let t=new ct;t.aspect=.5,this.setSize=(t,n)=>{e.setSize(t,n)},this.render=(n,r)=>{n.updateMatrixWorld(),r.parent===null&&r.updateMatrixWorld(),t.update(r);let i=e.getSize();e.setScissorTest(!0),e.clear(),e.setScissor(0,0,i.width/2,i.height),e.setViewport(0,0,i.width/2,i.height),e.render(n,t.cameraL),e.setScissor(i.width/2,0,i.width/2,i.height),e.setViewport(i.width/2,0,i.width/2,i.height),e.render(n,t.cameraR),e.setScissorTest(!1)}},ut=function(t){let n=this;this.object=t,this.object.rotation.reorder(`YXZ`),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;let r=e=>{n.deviceOrientation=e},i=()=>{typeof window<`u`&&(n.screenOrientation=window.orientation||0)},a=(()=>{let t=new e.Vector3(0,0,1),n=new e.Euler,r=new e.Quaternion,i=new e.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(a,o,s,c,l)=>{let u=new e.Vector3(0,0,1);u.subVectors(a.target,a.position),n.set(s,o,-c,`YXZ`);let d=new e.Quaternion;d.setFromEuler(n),d.multiply(i),d.multiply(r.setFromAxisAngle(t,-l)),u.applyQuaternion(d),u.addVectors(a.position,u),a.lookAt(u)}})();this.connect=()=>{i(),typeof window<`u`&&(window.addEventListener(`orientationchange`,i,!1),window.addEventListener(`deviceorientation`,r,!1)),n.enabled=!0},this.disconnect=()=>{typeof window<`u`&&(window.removeEventListener(`orientationchange`,i,!1),window.removeEventListener(`deviceorientation`,r,!1)),n.enabled=!1},this.update=()=>{if(n.enabled===!1)return;let t=n.deviceOrientation.alpha?e.Math.degToRad(n.deviceOrientation.alpha):0,r=n.deviceOrientation.beta?e.Math.degToRad(n.deviceOrientation.beta):0,i=n.deviceOrientation.gamma?e.Math.degToRad(n.deviceOrientation.gamma):0,o=n.screenOrientation?e.Math.degToRad(n.screenOrientation):0;a(n.object,t,r,i,o)},this.dispose=function(){this.disconnect()},this.connect()},dt=function(){let t,n,r,i=new e.Vector3,a=new e.Vector3,o=new e.Vector3,s=new e.Vector3,c;this.setCurrentCameraSettings=(o,s)=>{this.near_plane_fly_debt,t=o.clone(),n=o,r=s,t.near=r.nearPlane,r.farPlane&&(t.far=r.farPlane),r.eyePosition&&t.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&t.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&(t.target=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),t.lookAt(t.target)),t.updateProjectionMatrix(),i.copy(t.position).project(t),a.copy(t.target).project(t)},this.getCurrentPosition=()=>(a.copy(n.target).project(t),[a.x,a.y]),this.zoom=e=>{let t=e*.002,r=Math.max(n.zoom-t,1);n.zoom=r,n.updateProjectionMatrix()},this.zoomToBox=(e,n)=>{e.getCenter(o),o.project(t),this.setCenterZoom([o.x,o.y],n)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:n.zoom}),this.setCenterZoom=(e,r)=>{o.set(e[0],e[1],a.z).unproject(t),s.copy(o).sub(n.target),n.target.copy(o),n.lookAt(n.target),n.position.add(s),n.zoom=r,n.updateProjectionMatrix()},this.setEventCallback=e=>{(e===void 0||typeof e==`function`)&&(c=e)},this.triggerCallback=()=>{c!==void 0&&typeof c==`function`&&c()}},ft=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,165,0);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);ft.colorSpace=e.SRGBColorSpace;var pt=[.02,.03,1],mt=new e.SpriteMaterial({map:ft,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),ht=function(t){P.call(this),this.texture=ft;let n=t;this.morph=new e.Group,this.group=this.morph,this.isMarkerCluster=!0;let r=!0,i=[];this.markers={};let a=new e.Vector2,o=new e.Vector2,s=Date.now();this.setSpriteSize=e=>{(void 0).scale.set(.015,.02,1),(void 0).scale.multiplyScalar(e)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};let c=t=>{let n=new e.Group,r=new e.Sprite(mt);return r.clusterIndex=t,r.center.set(.5,0),r.position.set(0,0,0),r.renderOrder=1e4,r.scale.set(pt[0],pt[1],pt[2]),r.userData=this,n.add(r),this.group.add(n),{group:n,marker:r,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},l=(e,t,n)=>{e.group.visible=!0,e.group.position.set(t.coords[0],t.coords[1],t.coords[2]),(e.label===void 0||n!==e.number)&&(e.label&&(e.group.remove(e.label),e.label.material.map.dispose(),e.label.material.dispose()),e.label=O(n,.012,`black`,`Asap`,120,700),e.label.renderOrder=10001,e.number=n,e.group.add(e.label)),e.min=t.min,e.max=t.max},u=e=>{let t=0;for(e.forEach(e=>{let n=e.members.length,r=0;n===1?e.members[0].setVisibility(!0):(e.members.forEach(e=>{r+=e.getNumber(),e.setVisibility(!1)}),i[t]||i.push(c(t)),l(i[t],e,r),t++)});t<i.length;t++)i[t].group.visible=!1},d=(e,t)=>{let n=!0,r={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},i=0;for(let s in e)n?(a.set(e[s].ndc.x,e[s].ndc.y),this._b1.setFromPoints([e[s].morph.position]),n=!1,r.members.push(e[s]),r.coords=[e[s].morph.position.x,e[s].morph.position.y,e[s].morph.position.z],t.push(r),delete e[s]):(o.set(e[s].ndc.x,e[s].ndc.y),i=a.distanceTo(o),.1>i&&(r.members.push(e[s]),this._b1.expandByPoint(e[s].morph.position),delete e[s]));r.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],r.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],n!==!0&&d(e,t)};this.calculate=()=>{if(r&&Date.now()-s>500){let e=[];d({...this.markers},e),u(e),s=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>r,this.enable=()=>{r=!0,this.morph.visible=!0},this.disable=()=>{r=!1,this.morph.visible=!1;for(let e in this.markers)this.markers[e]?.isMarker&&this.markers[e].isEnabled()&&this.markers[e].setVisibility(!0)},this.zoomToCluster=e=>e!==void 0&&e>-1&&(this._v1.set(...i[e].min),this._v2.set(...i[e].max),Math.abs(this._v1.distanceTo(this._v2)>0))?(this._b1.set(this._v1,this._v2),n.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0):!1,this.clusterIsVisible=e=>e!==void 0&&e>-1&&i[e]?i[e].group?.visible:!1};ht.prototype=Object.create(P.prototype);var gt=function(t){let n=t;this.camera=new e.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;let r=new e.BufferGeometry;var i=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]);let a=new e.BufferAttribute(i,3);r.setAttribute(`position`,a);var o=new e.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new e.Mesh(r,o);let s=new e.Box3,c=new e.Vector3;this.getDiffFromNormalised=(t,n)=>{s.setFromBufferAttribute(a).getCenter(c);let r=c.clone().project(this.camera);return new e.Vector3(t,n,r.z).unproject(this.camera).sub(c)};let l=(t,r)=>{n.camera.near&&(this.camera.near=n.camera.near),r.farPlane&&(this.camera.far=r.farPlane),r.eyePosition&&this.camera.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&this.camera.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&this.camera.lookAt(new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2])),this.camera.zoom=1/t,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{let t=new e.Vector3().copy(n.camera.target).project(n.camera),r=new e.Vector3(-1,-1,t.z).unproject(n.camera),i=new e.Vector3(1,-1,t.z).unproject(n.camera),o=new e.Vector3(1,1,t.z).unproject(n.camera),s=[r,i,o,o,new e.Vector3(-1,1,t.z).unproject(n.camera),r];ee(a,s)},this.updateCamera=()=>{this.getBoundary();let e=n.getZincCameraControls(),t=n.getBoundingBox();if(t){let n=t.min.distanceTo(t.max),r=n/2,i=(t.min.x+t.max.x)/2,a=(t.min.y+t.max.y)/2,o=(t.min.z+t.max.z)/2,s=e.getViewportFromCentreAndRadius(i,a,o,r,40,r*4);l(n,s)}}},_t=new e.Box3,vt=new e.Vector3,yt=class extends e.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new e.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let n;t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));let r=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceStart`,new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new e.InterleavedBufferAttribute(r,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let n;t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));let r=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceColorStart`,new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new e.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new e.Box3);let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;t!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(t),_t.setFromBufferAttribute(n),this.boundingBox.union(_t))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(t!==void 0&&n!==void 0){let e=this.boundingSphere.center;this.boundingBox.getCenter(e);let r=0;for(let i=0,a=t.count;i<a;i++)vt.fromBufferAttribute(t,i),r=Math.max(r,e.distanceToSquared(vt)),vt.fromBufferAttribute(n,i),r=Math.max(r,e.distanceToSquared(vt));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}},bt=new e.Vector3,xt=new e.Vector3,St=new e.Vector4,Ct=new e.Vector4,wt=new e.Vector4,Tt=new e.Vector3,Et=new e.Matrix4,Dt=new e.Line3,Ot=new e.Vector3,kt=new e.Box3,At=new e.Sphere,jt=new e.Vector4,Mt=new e.Vector4,Nt,Pt;function Ft(e,t,n){return jt.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),jt.multiplyScalar(1/jt.w),jt.x=Pt/n.width,jt.y=Pt/n.height,jt.applyMatrix4(e.projectionMatrixInverse),jt.multiplyScalar(1/jt.w),Math.abs(Math.max(jt.x,jt.y))}function It(t,n){let r=t.matrixWorld,i=t.geometry,a=i.attributes.instanceStart,o=i.attributes.instanceEnd,s=Math.min(i.instanceCount,a.count);for(let i=0,c=s;i<c;i++){Dt.start.fromBufferAttribute(a,i),Dt.end.fromBufferAttribute(o,i),Dt.applyMatrix4(r);let s=new e.Vector3,c=new e.Vector3;Nt.distanceSqToSegment(Dt.start,Dt.end,c,s),c.distanceTo(s)<Pt*.5&&n.push({point:c,pointOnLine:s,distance:Nt.origin.distanceTo(c),object:t,face:null,faceIndex:i,uv:null,uv1:null})}}function Lt(t,n,r){let i=n.projectionMatrix,a=t.matrixWorld,o=t._resolution,s=t.geometry,c=s.attributes.instanceStart,l=s.attributes.instanceEnd,u=Math.min(s.instanceCount,c.count),d=-n.near;Nt.at(1,wt),wt.w=1,wt.applyMatrix4(n.matrixWorldInverse),wt.applyMatrix4(i),wt.multiplyScalar(1/wt.w),wt.x*=o.x/2,wt.y*=o.y/2,wt.z=0,Tt.copy(wt),Et.multiplyMatrices(n.matrixWorldInverse,a);for(let n=0,s=u;n<s;n++){if(St.fromBufferAttribute(c,n),Ct.fromBufferAttribute(l,n),St.w=1,Ct.w=1,St.applyMatrix4(Et),Ct.applyMatrix4(Et),St.z>d&&Ct.z>d)continue;if(St.z>d){let e=St.z-Ct.z,t=(St.z-d)/e;St.lerp(Ct,t)}else if(Ct.z>d){let e=Ct.z-St.z,t=(Ct.z-d)/e;Ct.lerp(St,t)}St.applyMatrix4(i),Ct.applyMatrix4(i),St.multiplyScalar(1/St.w),Ct.multiplyScalar(1/Ct.w),St.x*=o.x/2,St.y*=o.y/2,Ct.x*=o.x/2,Ct.y*=o.y/2,Dt.start.copy(St),Dt.start.z=0,Dt.end.copy(Ct),Dt.end.z=0;let s=Dt.closestPointToPointParameter(Tt,!0);Dt.at(s,Ot);let u=e.MathUtils.lerp(St.z,Ct.z,s),f=u>=-1&&u<=1,p=Tt.distanceTo(Ot)<Pt*.5;if(f&&p){Dt.start.fromBufferAttribute(c,n),Dt.end.fromBufferAttribute(l,n),Dt.start.applyMatrix4(a),Dt.end.applyMatrix4(a);let i=new e.Vector3,o=new e.Vector3;Nt.distanceSqToSegment(Dt.start,Dt.end,o,i),r.push({point:o,pointOnLine:i,distance:Nt.origin.distanceTo(o),object:t,face:null,faceIndex:n,uv:null,uv1:null})}}}var Rt=class extends e.Mesh{constructor(t=new yt,n=new e.Line2NodeMaterial({color:Math.random()*16777215})){super(t,n),this.isLineSegments2=!0,this.type=`LineSegments2`,this._resolution=new e.Vector2}computeLineDistances(){let t=this.geometry,n=t.attributes.instanceStart,r=t.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let e=0,t=0,a=n.count;e<a;e++,t+=2)bt.fromBufferAttribute(n,e),xt.fromBufferAttribute(r,e),i[t]=t===0?0:i[t-1],i[t+1]=i[t]+bt.distanceTo(xt);let a=new e.InstancedInterleavedBuffer(i,2,1);return t.setAttribute(`instanceDistanceStart`,new e.InterleavedBufferAttribute(a,1,0)),t.setAttribute(`instanceDistanceEnd`,new e.InterleavedBufferAttribute(a,1,1)),this}onBeforeRender(e){e.getViewport(Mt),this._resolution.set(Mt.z,Mt.w)}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.`),n===!1&&(this._resolution.x===0||this._resolution.y===0))return;let i=e.params.Line2===void 0?0:e.params.Line2.threshold||0;Nt=e.ray;let a=this.matrixWorld,o=this.geometry;Pt=this.material.linewidth+i,o.boundingSphere===null&&o.computeBoundingSphere(),At.copy(o.boundingSphere).applyMatrix4(a);let s;if(s=n?Pt*.5:Ft(r,Math.max(r.near,At.distanceToPoint(Nt.origin)),this._resolution),At.radius+=s,Nt.intersectsSphere(At)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),kt.copy(o.boundingBox).applyMatrix4(a);let c;c=n?Pt*.5:Ft(r,Math.max(r.near,kt.distanceToPoint(Nt.origin)),this._resolution),kt.expandByScalar(c),Nt.intersectsBox(kt)!==!1&&(n?It(this,t):Lt(this,r,t))}},zt=function(){Ye.call(this),this.isLines2=!0;let t=Array(300);this.createLineSegment=(e,t,n)=>{if(e&&t){let r=new yt;r.setPositions(e),r.colorsNeedUpdate=!0;let i=new Rt(r,t);i.scale.set(1,1,1),i.computeLineDistances(),this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(e){if(e&&e.length){let n=this.getMorph();n||(this.drawRange=0);let r=this.drawRange*3;if(e.forEach(e=>{t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],this.drawRange++}),!n)for(;r<300;)t[r++]=e[0][0],t[r++]=e[0][1],t[r++]=e[0][2];n&&(n.geometry.setPositions(t),n.computeLineDistances(),n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return t},this.getVerticesByFaceIndex=function(e){let t=e*2*3,n=this.getMorph();if(n&&this.drawRange*3>t){let e=n.geometry.getAttribute(`instanceStart`);return[[e.data.array[t],e.data.array[++t],e.data.array[++t]],[e.data.array[++t],e.data.array[++t],e.data.array[++t]]]}return[]},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=n*3;for(e.forEach(e=>{t[i++]=e[0],t[i++]=e[1],t[i++]=e[2]}),i=this.drawRange*3;i<300;)t[i++]=e[0][0],t[i++]=e[0][1],t[i++]=e[0][2];r.geometry.setPositions(t),r.computeLineDistances(),r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}return t},this.addLines=(n,r)=>{if(n&&n.length>0){if(this.addVertices(n),!this.getMorph()){let n=new e.Line2NodeMaterial({color:r,linewidth:1,vertexColors:!1,worldUnits:!1});this.createLineSegment(t,n,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};zt.prototype=Object.create(Ye.prototype),zt.prototype.constructor=zt;var Bt=0,Vt=function(){return`re`+Bt++},Ht=function(t,n){let r=t,i=new e.Group;i.matrixAutoUpdate=!1,i.userData=this;let a=[],o=``,s=[],c=n,l=new e.Matrix4,u=3e3;l.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=Vt(),this.hideAllPrimitives=()=>{a.forEach(e=>e.hideAllPrimitives()),s.forEach(e=>e.setVisibility(!1))},this.showAllPrimitives=()=>{a.forEach(e=>e.showAllPrimitives()),s.forEach(e=>e.setVisibility(!0))},this.setVisibility=e=>{e!=i.visible&&(i.visible=e,this.pickableUpdateRequired=!0)},this.getVisibility=()=>i.visible,this.getGroup=()=>i,this.setTransformation=e=>{l.set(...e),i.matrix.copy(l),i.updateMatrixWorld()},this.setName=e=>{e&&e!==``&&(o=e)},this.getName=()=>o,this.getParent=()=>r,this.getFullSeparatedPath=()=>{let e=[];if(o!==``){e.push(o);for(let t=r;t!==void 0;){let n=t.getName();n!==``&&e.unshift(n),t=t.getParent()}}return e},this.getFullPath=()=>{let e=this.getFullSeparatedPath();if(e.length>0){let t=e.shift();return e.forEach(e=>{t=t.concat(`/`,e)}),t}return``},this.createChild=e=>{let t=new Ht(this,c);return t.setName(e),a.push(t),i.add(t.getGroup()),t},this.getChildWithName=e=>{if(e){let t=e.toLowerCase();for(let e=0;e<a.length;e++)if(a[e].getName().toLowerCase()===t)return a[e]}},this.findChildFromSeparatedPath=e=>{if(e&&e.length>0&&e[0]===``&&e.shift(),e&&e.length>0){let t=this.getChildWithName(e[0]);return t?(e.shift(),t.findChildFromSeparatedPath(e)):void 0}return this},this.findChildFromPath=e=>{let t=e.split(`/`);return this.findChildFromSeparatedPath(t)},this.createChildFromSeparatedPath=e=>{if(e.length>0&&e[0]===``&&e.shift(),e.length>0){let t=this.getChildWithName(e[0]);return t||=this.createChild(e[0]),e.shift(),t.createChildFromSeparatedPath(e)}return this},this.createChildFromPath=e=>{let t=e.split(`/`);return this.createChildFromSeparatedPath(t)},this.findOrCreateChildFromPath=e=>{let t=this.findChildFromPath(e);return t||=this.createChildFromPath(e),t},this.addZincObject=e=>{e&&(e.setRegion(this),i.add(e.getGroup()),s.push(e),this.pickableUpdateRequired=!0,c&&c.triggerObjectAddedCallback(e))},this.removeZincObject=e=>{for(let t=0;t<s.length;t++)if(e===s[t]){i.remove(e.getGroup()),s.splice(t,1),c&&c.triggerObjectRemovedCallback(e),e.dispose(),this.pickableUpdateRequired=!0;return}},this.checkPickableUpdateRequred=e=>{if(this.pickableUpdateRequired)return!0;if(e){let t=!1;for(let n=0;n<a.length;n++)if(t=a[n].checkPickableUpdateRequred(e),t)return!0}return!1},this.getPickableThreeJSObjects=(e,t)=>(i.visible&&(s.forEach(t=>{if(t.isPickable&&t.getGroup()&&t.getGroup().visible){let n=t.marker;n&&n.isEnabled()&&e.push(n.getMorph()),e.push(t.getGroup())}}),t&&a.forEach(n=>{n.getPickableThreeJSObjects(e,t)}),this.pickableUpdateRequired=!1),e),this.setDuration=e=>{u=e,s.forEach(t=>t.setDuration(e)),a.forEach(t=>t.setDuration(e))},this.getDuration=()=>u,this.getBoundingBox=e=>{let t,n;return s.forEach(e=>{n=e.getBoundingBox(),n&&(t==null?t=n.clone():t.union(n))}),e&&a.forEach(r=>{n=r.getBoundingBox(e),n&&(t==null?t=n.clone():t.union(n))}),t},this.clear=e=>{e&&a.forEach(t=>t.clear(e)),s.forEach(e=>{i.remove(e.getGroup()),e.dispose()}),a=[],s=[]},this.objectIsInRegion=(e,t)=>{for(let t=0;t<s.length;t++)if(e===s[t])return!0;if(t){for(let n=0;n<a.length;n++)if(a[n].objectIsInRegion(e,t))return!0}return!1},this.forEachGeometry=(e,t)=>{s.forEach(t=>{t.isGeometry&&e(t)}),t&&a.forEach(n=>n.forEachGeometry(e,t))},this.forEachGlyphset=(e,t)=>{s.forEach(t=>{t.isGlyphset&&e(t)}),t&&a.forEach(n=>n.forEachGlyphset(e,t))},this.forEachPointset=(e,t)=>{s.forEach(t=>{t.isPointset&&e(t)}),t&&a.forEach(n=>n.forEachPointset(e,t))},this.forEachLine=(e,t)=>{s.forEach(t=>{t.isLines&&e(t)}),t&&a.forEach(n=>n.forEachLine(e,t))},this.findObjectsWithAnatomicalId=(e,t)=>{let n=[];return s.forEach(t=>{t.anatomicalId===e&&n.push(t)}),t&&a.forEach(r=>{let i=r.findObjectsWithAnatomicalId(e,t);n.push(...i)}),n},this.findObjectsWithGroupName=(e,t)=>{let n=[];return s.forEach(t=>{(t.groupName?t.groupName.toLowerCase():t.groupName)===(e&&e.toLowerCase())&&n.push(t)}),t&&a.forEach(r=>{let i=r.findObjectsWithGroupName(e,t);n.push(...i)}),n},this.findGeometriesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isGeometry),this.findPointsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isPointset),this.findGlyphsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isGlyphset),this.findLinesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isLines),this.getAllObjects=e=>{let t=[...s];return e&&a.forEach(n=>{let r=n.getAllObjects(e);t.push(...r)}),t},this.getChildRegions=e=>{let t=[...a];return e&&a.forEach(n=>{let r=n.getChildRegions(e);t.push(...r)}),t},this.getCurrentTime=()=>{if(s[0]!=null)return s[0].getCurrentTime();for(let e=0;e<a.length;e++){let t=a[e].getCurrentTime();if(t!==-1)return t}return-1},this.setMorphTime=(e,t)=>{s.forEach(t=>{t.setMorphTime(e)}),t&&a.forEach(t=>{t.setMorphTime(e)})},this.isTimeVarying=()=>{for(let e=0;e<s.length;e++)if(s[e].isTimeVarying())return!0;for(let e=0;e<a.length;e++)if(a[e].isTimeVarying())return!0;return!1},this.renderGeometries=(e,t,n,r,i,a)=>{this.getAllObjects(a).forEach(a=>{a.render(e*t,n,r,i)}),i&&n===!1&&i.markerCluster?.markerUpdateRequired&&i.markerCluster.calculate()},this.createPoints=(e,t,n,r)=>{let i=!1,a=this.findObjectsWithGroupName(e,!1),o=a.findIndex(e=>e.isPointset),s=o>-1?a[o]:new Je;return s.addPoints(t,n,r),o===-1?(s.setName(e),this.addZincObject(s),i=!0):this.pickableUpdateRequired=!0,{zincObject:s,isNew:i}},this.createLines=(e,t,n)=>{let r=!1,i=this.findObjectsWithGroupName(e,!1),a=i.findIndex(e=>e.isLines),o=a>-1?i[a]:new zt;return o.addLines(t,n),a===-1?(o.setName(e),this.addZincObject(o),r=!0):this.pickableUpdateRequired=!0,{zincObject:o,isNew:r}},this.createGeometryFromThreeJSGeometry=(t,n,r,i,a,o)=>{let s=new Se,c=new e.MeshPhongMaterial({color:r,transparent:!0,opacity:i,side:e.DoubleSide});if(s.createMesh(n,c,{localTimeEnabled:!1,localMorphColour:!1}),s.getMorph())return s.setVisibility(!1),s.setName(t),s.setRenderOrder(o),this.addZincObject(s),s}},Ut=class{constructor(){this.pluginCallbacks=[],this.register(function(e){return new cn(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new un(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n){let r=new sn,i=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)i.push(this.pluginCallbacks[e](r));r.setPlugins(i),r.write(e,t,n)}},Wt={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},Gt={};Gt[e.NearestFilter]=Wt.NEAREST,Gt[e.NearestMipmapNearestFilter]=Wt.NEAREST_MIPMAP_NEAREST,Gt[e.NearestMipmapLinearFilter]=Wt.NEAREST_MIPMAP_LINEAR,Gt[e.LinearFilter]=Wt.LINEAR,Gt[e.LinearMipmapNearestFilter]=Wt.LINEAR_MIPMAP_NEAREST,Gt[e.LinearMipmapLinearFilter]=Wt.LINEAR_MIPMAP_LINEAR,Gt[e.ClampToEdgeWrapping]=Wt.CLAMP_TO_EDGE,Gt[e.RepeatWrapping]=Wt.REPEAT,Gt[e.MirroredRepeatWrapping]=Wt.MIRRORED_REPEAT;var Kt={scale:`scale`,position:`translation`,quaternion:`rotation`,morphTargetInfluences:`weights`},qt=12,Jt=1179937895,Yt=2,Xt=8,Zt=1313821514,Qt=5130562;function $t(e,t){return e.length===t.length&&e.every(function(e,n){return e===t[n]})}function en(e){if(window.TextEncoder!==void 0)return new TextEncoder().encode(e).buffer;let t=new Uint8Array(new ArrayBuffer(e.length));for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);t[n]=r>255?32:r}return t.buffer}function tn(e){return $t(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function nn(e,t,n){let r={min:Array(e.itemSize).fill(1/0),max:Array(e.itemSize).fill(-1/0)};for(let i=t;i<t+n;i++)for(let t=0;t<e.itemSize;t++){let n;e.itemSize>4?n=e.array[i*e.itemSize+t]:t===0?n=e.getX(i):t===1?n=e.getY(i):t===2?n=e.getZ(i):t===3&&(n=e.getW(i)),r.min[t]=Math.min(r.min[t],n),r.max[t]=Math.max(r.max[t],n)}return r}function rn(e){return Math.ceil(e/4)*4}function an(e,t=0){let n=rn(e.byteLength);if(n!==e.byteLength){let r=new Uint8Array(n);if(r.set(new Uint8Array(e)),t!==0)for(let i=e.byteLength;i<n;i++)r[i]=t;return r.buffer}return e}var on=null,sn=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:`2.0`,generator:`THREE.GLTFExporter`}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,n){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);let r=this;Promise.all(this.pending).then(function(){let e=r.buffers,n=r.json,i=r.options,a=r.extensionsUsed,o=new Blob(e,{type:`application/octet-stream`}),s=Object.keys(a);if(s.length>0&&(n.extensionsUsed=s),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=o.size),i.binary===!0){let e=new window.FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){let r=an(e.result),i=new DataView(new ArrayBuffer(Xt));i.setUint32(0,r.byteLength,!0),i.setUint32(4,Qt,!0);let a=an(en(JSON.stringify(n)),32),o=new DataView(new ArrayBuffer(Xt));o.setUint32(0,a.byteLength,!0),o.setUint32(4,Zt,!0);let s=new ArrayBuffer(qt),c=new DataView(s);c.setUint32(0,Jt,!0),c.setUint32(4,Yt,!0);let l=qt+o.byteLength+a.byteLength+i.byteLength+r.byteLength;c.setUint32(8,l,!0);let u=new Blob([s,o,a,i,r],{type:`application/octet-stream`}),d=new window.FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){let e=new window.FileReader;e.readAsDataURL(o),e.onloadend=function(){let r=e.result;n.buffers[0].uri=r,t(n)}}else t(n)})}serializeUserData(e,t){if(e.userData&&e.userData.isZincObject||Object.keys(e.userData).length===0)return;let n=this.options,r=this.extensionsUsed;try{let i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let e in i.gltfExtensions)t.extensions[e]=i.gltfExtensions[e],r[e]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(t){console.warn(`THREE.GLTFExporter: userData of '`+e.name+`' won't be serialized because of JSON.stringify error - `+t.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;let n=new e.Vector3;for(let e=0,r=t.count;e<r;e++)if(Math.abs(n.fromBufferAttribute(t,e).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){let n=this.cache;if(n.attributesNormalized.has(t))return n.attributesNormalized.get(t);let r=t.clone(),i=new e.Vector3;for(let e=0,t=r.count;e<t;e++)i.fromBufferAttribute(r,e),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),r.setXYZ(e,i.x,i.y,i.z);return n.attributesNormalized.set(t,r),r}applyTextureTransform(e,t){let n=!1,r={};(t.offset.x!==0||t.offset.y!==0)&&(r.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(r.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){let t=this.json,n=this.buffers;return t.buffers||=[{byteLength:0}],n.push(e),0}processBufferView(e,t,n,r,i){let a=this.json;a.bufferViews||=[];let o;o=t===Wt.UNSIGNED_BYTE?1:t===Wt.UNSIGNED_SHORT?2:4;let s=rn(r*e.itemSize*o),c=new DataView(new ArrayBuffer(s)),l=0;for(let i=n;i<n+r;i++)for(let n=0;n<e.itemSize;n++){let r;e.itemSize>4?r=e.array[i*e.itemSize+n]:n===0?r=e.getX(i):n===1?r=e.getY(i):n===2?r=e.getZ(i):n===3&&(r=e.getW(i)),t===Wt.FLOAT?c.setFloat32(l,r,!0):t===Wt.UNSIGNED_INT?c.setUint32(l,r,!0):t===Wt.UNSIGNED_SHORT?c.setUint16(l,r,!0):t===Wt.UNSIGNED_BYTE&&c.setUint8(l,r),l+=o}let u={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:s};return i!==void 0&&(u.target=i),i===Wt.ARRAY_BUFFER&&(u.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(u),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,n=t.json;return n.bufferViews||=[],new Promise(function(r){let i=new window.FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){let e=an(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,r){let i=this.options,a=this.json,o={1:`SCALAR`,2:`VEC2`,3:`VEC3`,4:`VEC4`,16:`MAT4`},s;if(e.array.constructor===Float32Array)s=Wt.FLOAT;else if(e.array.constructor===Uint32Array)s=Wt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)s=Wt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)s=Wt.UNSIGNED_BYTE;else throw Error(`THREE.GLTFExporter: Unsupported bufferAttribute component type.`);if(n===void 0&&(n=0),r===void 0&&(r=e.count),i.truncateDrawRange&&t!==void 0&&t.index===null){let i=n+r,a=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;n=Math.max(n,t.drawRange.start),r=Math.min(i,a)-n,r<0&&(r=0)}if(r===0)return null;let c=nn(e,n,r),l;t!==void 0&&(l=e===t.index?Wt.ELEMENT_ARRAY_BUFFER:Wt.ARRAY_BUFFER);let u=this.processBufferView(e,s,n,r,l),d={bufferView:u.id,byteOffset:u.byteOffset,componentType:s,count:r,max:c.max,min:c.min,type:o[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),a.accessors||=[],a.accessors.push(d)-1}processImage(t,n,r){let i=this,a=i.cache,o=i.json,s=i.options,c=i.pending;a.images.has(t)||a.images.set(t,{});let l=a.images.get(t),u=n===e.RGBAFormat?`image/png`:`image/jpeg`,d=u+`:flipY/`+r.toString();if(l[d]!==void 0)return l[d];o.images||=[];let f={mimeType:u};if(s.embedImages){let a=on||=document.createElement(`canvas`);a.width=Math.min(t.width,s.maxTextureSize),a.height=Math.min(t.height,s.maxTextureSize);let o=a.getContext(`2d`);if(r===!0&&(o.translate(0,a.height),o.scale(1,-1)),typeof HTMLImageElement<`u`&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&t instanceof OffscreenCanvas||typeof ImageBitmap<`u`&&t instanceof ImageBitmap)o.drawImage(t,0,0,a.width,a.height);else{n!==e.RGBAFormat&&n!==e.RGBFormat&&console.error(`GLTFExporter: Only RGB and RGBA formats are supported.`),(t.width>s.maxTextureSize||t.height>s.maxTextureSize)&&console.warn(`GLTFExporter: Image size is bigger than maxTextureSize`,t);let r=new Uint8ClampedArray(t.height*t.width*4);if(n===e.RGBAFormat)for(let e=0;e<r.length;e+=4)r[e+0]=t.data[e+0],r[e+1]=t.data[e+1],r[e+2]=t.data[e+2],r[e+3]=t.data[e+3];else for(let e=0,n=0;e<r.length;e+=4,n+=3)r[e+0]=t.data[n+0],r[e+1]=t.data[n+1],r[e+2]=t.data[n+2],r[e+3]=255;o.putImageData(new ImageData(r,t.width,t.height),0,0)}s.binary===!0?c.push(new Promise(function(e){a.toBlob(function(t){i.processBufferViewImage(t).then(function(t){f.bufferView=t,e()})},u)})):f.uri=a.toDataURL(u)}else f.uri=t.src;let p=o.images.push(f)-1;return l[d]=p,p}processSampler(e){let t=this.json;t.samplers||=[];let n={magFilter:Gt[e.magFilter],minFilter:Gt[e.minFilter],wrapS:Gt[e.wrapS],wrapT:Gt[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){let t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||=[];let r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(r.name=e.name),this._invokeAll(function(t){t.writeTexture&&t.writeTexture(e,r)});let i=n.textures.push(r)-1;return t.textures.set(e,i),i}processMaterial(t){let n=this.cache,r=this.json;if(n.materials.has(t))return n.materials.get(t);if(t.isShaderMaterial)return console.warn(`GLTFExporter: THREE.ShaderMaterial not supported.`),null;r.materials||=[];let i={pbrMetallicRoughness:{}};t.isMeshStandardMaterial!==!0&&t.isMeshBasicMaterial!==!0&&console.warn(`GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.`);let a=t.color.toArray().concat([t.opacity]);if($t(a,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),t.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=t.metalness,i.pbrMetallicRoughness.roughnessFactor=t.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),t.metalnessMap||t.roughnessMap){if(t.metalnessMap===t.roughnessMap){let e={index:this.processTexture(t.metalnessMap)};this.applyTextureTransform(e,t.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=e}else console.warn(`THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.`)}if(t.map){let e={index:this.processTexture(t.map)};this.applyTextureTransform(e,t.map),i.pbrMetallicRoughness.baseColorTexture=e}if(t.emissive){let e=t.emissive.clone().multiplyScalar(t.emissiveIntensity),n=Math.max(e.r,e.g,e.b);if(n>1&&(e.multiplyScalar(1/n),console.warn(`THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited`)),n>0&&(i.emissiveFactor=e.toArray()),t.emissiveMap){let e={index:this.processTexture(t.emissiveMap)};this.applyTextureTransform(e,t.emissiveMap),i.emissiveTexture=e}}if(t.normalMap){let e={index:this.processTexture(t.normalMap)};t.normalScale&&t.normalScale.x!==-1&&(t.normalScale.x!==t.normalScale.y&&console.warn(`THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X.`),e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),i.normalTexture=e}if(t.aoMap){let e={index:this.processTexture(t.aoMap),texCoord:1};t.aoMapIntensity!==1&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),i.occlusionTexture=e}t.transparent?i.alphaMode=`BLEND`:t.alphaTest>0&&(i.alphaMode=`MASK`,i.alphaCutoff=t.alphaTest),t.side===e.DoubleSide&&(i.doubleSided=!0),t.name!==``&&(i.name=t.name),this.serializeUserData(t,i),this._invokeAll(function(e){e.writeMaterial&&e.writeMaterial(t,i)});let o=r.materials.push(i)-1;return n.materials.set(t,o),o}substituteInstancedPointsGeometry(t){let n=t.count,r=new e.BufferGeometry;r.setAttribute(`position`,new e.BufferAttribute(t.pointPositions.slice(0,n*3),3)),t.instanceColor&&r.setAttribute(`color`,new e.BufferAttribute(t.instanceColor.array.slice(0,n*3),3));let i=t.geometry,a=t.isPoints;return t.geometry=r,t.isPoints=!0,function(){t.geometry=i,t.isPoints=a,r.dispose()}}processMesh(t){let n=this.cache,r=this.json,i=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,n=t.material.length;e<n;e++)i.push(t.material[e].uuid);else i.push(t.material.uuid);let a=i.join(`:`);if(n.meshes.has(a))return n.meshes.get(a);let o=t.geometry,s;if(s=t.isLineSegments?Wt.LINES:t.isLineLoop?Wt.LINE_LOOP:t.isLine?Wt.LINE_STRIP:t.isPoints?Wt.POINTS:t.material.wireframe?Wt.LINES:Wt.TRIANGLES,o.isBufferGeometry!==!0)throw Error(`THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.`);let c={},l={},u=[],d=[],f={uv:`TEXCOORD_0`,uv2:`TEXCOORD_1`,color:`COLOR_0`,skinWeight:`WEIGHTS_0`,skinIndex:`JOINTS_0`},p=o.getAttribute(`normal`);p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn(`THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.`),o.setAttribute(`normal`,this.createNormalizedNormalAttribute(p)));let m=null;for(let t in o.attributes){if(t.substr(0,5)===`morph`)continue;let r=o.attributes[t];if(t=f[t]||t.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t=`_`+t),n.attributes.has(this.getUID(r))){l[t]=n.attributes.get(this.getUID(r));continue}m=null;let i=r.array;t===`JOINTS_0`&&!(i instanceof Uint16Array)&&!(i instanceof Uint8Array)&&(console.warn(`GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.`),m=new e.BufferAttribute(new Uint16Array(i),r.itemSize,r.normalized));let a=this.processAccessor(m||r,o);a!==null&&(l[t]=a,n.attributes.set(this.getUID(r),a))}if(p!==void 0&&o.setAttribute(`normal`,p),Object.keys(l).length===0)return null;if(t.morphTargetInfluences!==void 0&&t.morphTargetInfluences.length>0){let e=[],r=[],i={};if(t.morphTargetDictionary!==void 0)for(let e in t.morphTargetDictionary)i[t.morphTargetDictionary[e]]=e;for(let a=0;a<t.morphTargetInfluences.length;++a){let s={},c=!1;for(let e in o.morphAttributes){if(e!==`position`&&e!==`normal`&&e!==`color`){c||=(console.warn(`GLTFExporter: Only POSITION and NORMAL morph are supported.`),!0);continue}let t=o.morphAttributes[e][a],r=e.toUpperCase();f[e]&&(r=f[e]);let i=o.attributes[e];if(n.attributes.has(this.getUID(t))){s[r]=n.attributes.get(this.getUID(t));continue}let l=i.clone();if(!o.morphTargetsRelative){if(i)for(let e=0,n=t.count;e<n;e++)i.count>e&&l.setXYZ(e,t.getX(e)-i.getX(e),t.getY(e)-i.getY(e),t.getZ(e)-i.getZ(e));else for(let e=0,n=t.count;e<n;e++)l.setXYZ(e,0,0,0)}s[r]=this.processAccessor(l,o),n.attributes.set(this.getUID(i),s[r])}d.push(s),e.push(t.morphTargetInfluences[a]),t.morphTargetDictionary!==void 0&&r.push(i[a])}c.weights=e,r.length>0&&(c.extras={},c.extras.targetNames=r)}let h=Array.isArray(t.material);if(h&&o.groups.length===0)return null;let g=h?t.material:[t.material],_=h?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,t=_.length;e<t;e++){let t={mode:s,attributes:l};if(this.serializeUserData(o,t),d.length>0&&(t.targets=d),o.index!==null){let r=this.getUID(o.index);(_[e].start!==void 0||_[e].count!==void 0)&&(r+=`:`+_[e].start+`:`+_[e].count),n.attributes.has(r)?t.indices=n.attributes.get(r):(t.indices=this.processAccessor(o.index,o,_[e].start,_[e].count),n.attributes.set(r,t.indices)),t.indices===null&&delete t.indices}let r=this.processMaterial(g[_[e].materialIndex]);r!==null&&(t.material=r),u.push(t)}c.primitives=u,r.meshes||=[],this._invokeAll(function(e){e.writeMesh&&e.writeMesh(t,c)});let v=r.meshes.push(c)-1;return n.meshes.set(a,v),v}processCamera(t){let n=this.json;n.cameras||=[];let r=t.isOrthographicCamera,i={type:r?`orthographic`:`perspective`};return r?i.orthographic={xmag:t.right*2,ymag:t.top*2,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:i.perspective={aspectRatio:t.aspect,yfov:e.MathUtils.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near},t.name!==``&&(i.name=t.type),n.cameras.push(i)-1}processAnimation(t,n){let r=this.json,i=this.nodeMap;r.animations||=[],t=Ut.Utils.mergeMorphTargetTracks(t.clone(),n);let a=t.tracks,o=[],s=[];for(let t=0;t<a.length;++t){let r=a[t],c=e.PropertyBinding.parseTrackName(r.name),l=e.PropertyBinding.findNode(n,c.nodeName),u=Kt[c.propertyName];if(c.objectName===`bones`&&(l=l.isSkinnedMesh===!0?l.skeleton.getBoneByName(c.objectIndex):void 0),!l||!u)return console.warn(`THREE.GLTFExporter: Could not export animation track "%s".`,r.name),null;let d=r.values.length/r.times.length;u===Kt.morphTargetInfluences&&(d/=l.morphTargetInfluences.length);let f;r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(f=`CUBICSPLINE`,d/=3):f=r.getInterpolation()===e.InterpolateDiscrete?`STEP`:`LINEAR`,s.push({input:this.processAccessor(new e.BufferAttribute(r.times,1)),output:this.processAccessor(new e.BufferAttribute(r.values,d)),interpolation:f}),o.push({sampler:s.length-1,target:{node:i.get(l),path:u}})}return r.animations.push({name:t.name||`clip_`+r.animations.length,samplers:s,channels:o}),r.animations.length-1}processSkin(t){let n=this.json,r=this.nodeMap,i=n.nodes[r.get(t)],a=t.skeleton;if(a===void 0)return null;let o=t.skeleton.bones[0];if(o===void 0)return null;let s=[],c=new Float32Array(a.bones.length*16),l=new e.Matrix4;for(let e=0;e<a.bones.length;++e)s.push(r.get(a.bones[e])),l.copy(a.boneInverses[e]),l.multiply(t.bindMatrix).toArray(c,e*16);return n.skins===void 0&&(n.skins=[]),n.skins.push({inverseBindMatrices:this.processAccessor(new e.BufferAttribute(c,16)),joints:s,skeleton:r.get(o)}),i.skin=n.skins.length-1}processNode(e){let t=this.json,n=this.options,r=this.nodeMap;t.nodes||=[];let i={};if(n.trs){let t=e.quaternion.toArray(),n=e.position.toArray(),r=e.scale.toArray();$t(t,[0,0,0,1])||(i.rotation=t),$t(n,[0,0,0])||(i.translation=n),$t(r,[1,1,1])||(i.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),tn(e.matrix)===!1&&(i.matrix=e.matrix.elements);if(e.name!==``&&(i.name=String(e.name)),this.serializeUserData(e,i),e.isMesh||e.isLine||e.isPoints||e.isInstancedPoints){let t;e.isInstancedPoints&&(t=this.substituteInstancedPointsGeometry(e));let n=this.processMesh(e);t&&t(),n!==null&&(i.mesh=n)}else e.isCamera&&(i.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let t=[];for(let r=0,i=e.children.length;r<i;r++){let i=e.children[r];if(i.visible||n.onlyVisible===!1){let e=this.processNode(i);e!==null&&t.push(e)}}t.length>0&&(i.children=t)}this._invokeAll(function(t){t.writeNode&&t.writeNode(e,i)});let a=t.nodes.push(i)-1;return r.set(e,a),a}processScene(e){let t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};e.name!==``&&(r.name=e.name),t.scenes.push(r);let i=[];for(let t=0,r=e.children.length;t<r;t++){let r=e.children[t];if(r.visible||n.onlyVisible===!1){let e=this.processNode(r);e!==null&&i.push(e)}}i.length>0&&(r.nodes=i),this.serializeUserData(e,r)}processObjects(t){let n=new e.Scene;n.name=`AuxScene`;for(let e=0;e<t.length;e++)n.children.push(t[e]);this.processScene(n)}processInput(t){let n=this.options;t=t instanceof Array?t:[t],this._invokeAll(function(e){e.beforeParse&&e.beforeParse(t)});let r=[];for(let n=0;n<t.length;n++)t[n]instanceof e.Scene?this.processScene(t[n]):r.push(t[n]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let e=0;e<n.animations.length;++e)this.processAnimation(n.animations[e].clip,n.animations[e].mesh);this._invokeAll(function(e){e.afterParse&&e.afterParse(t)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}},cn=class{constructor(e){this.writer=e,this.name=`KHR_lights_punctual`}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn(`THREE.GLTFExporter: Only directional, point, and spot lights are supported.`,e);return}let n=this.writer,r=n.json,i=n.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type=`directional`:e.isPointLight?(a.type=`point`,e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type=`spot`,e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn(`THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2.`),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn(`THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.`),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0);let o=r.extensions[this.name].lights;o.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:o.length-1}}},ln=class{constructor(e){this.writer=e,this.name=`KHR_materials_unlit`}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},un=class{constructor(e){this.writer=e,this.name=`KHR_materials_pbrSpecularGlossiness`}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;let n=this.writer,r=n.extensionsUsed,i={};t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);let a=[1,1,1];if(e.specular.toArray(a,0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){let t={index:n.processTexture(e.specularMap)};n.applyTextureTransform(t,e.specularMap),i.specularGlossinessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0}};Ut.Utils={insertKeyframe:function(e,t){let n=.001,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),o=e.createInterpolant(new e.ValueBufferType(r)),s;if(e.times.length===0){i[0]=t;for(let e=0;e<r;e++)a[e]=0;s=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<n)return 0;i[0]=t,i.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,r),s=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<n)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),s=i.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<n)return c;if(e.times[c]<t&&e.times[c+1]>t){i.set(e.times.slice(0,c+1),0),i[c+1]=t,i.set(e.times.slice(c+1),c+2),a.set(e.values.slice(0,(c+1)*r),0),a.set(o.evaluate(t),(c+1)*r),a.set(e.values.slice((c+1)*r),(c+2)*r),s=c+1;break}}return e.times=i,e.values=a,s},mergeMorphTargetTracks:function(t,n){let r=[],i={},a=t.tracks;for(let t=0;t<a.length;++t){let o=a[t],s=e.PropertyBinding.parseTrackName(o.name),c=e.PropertyBinding.findNode(n,s.nodeName);if(s.propertyName!==`morphTargetInfluences`||s.propertyIndex===void 0){r.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error(`THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.`);console.warn(`THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.`),o=o.clone(),o.setInterpolation(e.InterpolateLinear)}let l=c.morphTargetInfluences.length,u=c.morphTargetDictionary[s.propertyIndex];if(u===void 0)throw Error(`THREE.GLTFExporter: Morph target name not found: `+s.propertyIndex);let d;if(i[c.uuid]===void 0){d=o.clone();let e=new d.ValueBufferType(l*d.times.length);for(let t=0;t<d.times.length;t++)e[t*l+u]=d.values[t];d.name=(s.nodeName||``)+`.morphTargetInfluences`,d.values=e,i[c.uuid]=d,r.push(d);continue}let f=o.createInterpolant(new o.ValueBufferType(1));d=i[c.uuid];for(let e=0;e<d.times.length;e++)d.values[e*l+u]=f.evaluate(d.times[e]);for(let e=0;e<o.times.length;e++){let t=this.insertKeyframe(d,o.times[e]);d.values[t*l+u]=o.values[e]}}return t.tracks=r,t}};var dn=function(e){let t=e;this.exportGLTF=e=>{let n=t.getRootRegion().getAllObjects(!0),r=[];n.forEach(e=>{e.animationClip&&r.push({clip:e.animationClip[0],mesh:e.getMorph()})});let i=new Ut,a={binary:e,animations:r};return new Promise((e,n)=>{i.parse(t.getThreeJSScene(),function(t){e(t)},a)})}},fn=function(){let e=this;this.parseGLTFObjects=(t,n,r,i)=>{let a=n;if(r!==0){if(t.type===`Object3D`){if(t.name!==``&&(n&&(a=n.findOrCreateChildFromPath(t.name)),a)){let e=a.getGroup();e.position.copy(t.position),e.rotation.copy(t.rotation),e.quaternion.copy(t.quaternion),e.matrixAutoUpdate=!0}}else{let e;if(t.type===`Mesh`?e=new Se:t.type===`LineSegments`?e=new Ye:t.type===`Points`&&(e=new Je),e){let r=!1,a=!1;t.geometry&&t.geometry.morphAttributes&&(r=!!t.geometry.morphAttributes.position,a=!!t.geometry.morphAttributes.color),e.setMesh(t.clone(),r,a);let o=e.getMorph();e.groupName=o.name,o.matrixAutoUpdate=!0,n.addZincObject(e),i!=null&&typeof i==`function`&&i(e)}}}r++,t.children.forEach(t=>{e.parseGLTFObjects(t,a,r,i)})},this.setCamera=e=>{e.viewAll();let t=e.getZincCameraControls(),n=t.getCurrentViewport();t.addViewport(`default`,n),t.setDefaultViewport(`default`)},this.load=(t,n,r,a,o,s)=>{let c=r.substring(0,r.lastIndexOf(`/`)+1),l=r.substring(r.lastIndexOf(`/`)+1,r.length);new i.GLTFLoader().setPath(c).load(l,function(r){console.log(r),e.parseGLTFObjects(r.scene,n,0,a),e.setCamera(t),o!=null&&typeof o==`function`&&o()})}},pn=/^[og]\s*(.+)?/,mn=/^mtllib /,hn=/^usemtl /,gn=/^usemap /,_n=new e.Vector3,vn=new e.Vector3,yn=new e.Vector3,bn=new e.Vector3,xn=new e.Vector3;function Sn(){let e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){let n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);let r={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;_n.fromArray(r,e),vn.fromArray(r,t),yn.fromArray(r,n),xn.subVectors(yn,vn),bn.subVectors(_n,vn),xn.cross(bn),xn.normalize(),i.push(xn.x,xn.y,xn.z),i.push(xn.x,xn.y,xn.z),i.push(xn.x,xn.y,xn.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){let r=this.parseVertexIndex(e[n],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type=`Line`;let n=this.vertices.length,r=this.uvs.length;for(let t=0,r=e.length;t<r;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],r))}};return e.startObject(``,!1),e}var Cn=class extends e.Loader{constructor(e){super(e),this.materials=null}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}setMaterials(e){return this.materials=e,this}parse(t){let n=new Sn;t.indexOf(`\r
|
|
555
|
+
@keyframes element-queries { 0% { visibility: inherit; } }`,document.getElementsByTagName(`head`)[0].appendChild(t),!0);for(var i=0,a=document.styleSheets.length;i<a;i++)try{document.styleSheets[i].href&&document.styleSheets[i].href.indexOf(`file://`)===0&&console.warn(`CssElementQueries: unable to parse local css files, `+document.styleSheets[i].href),_(document.styleSheets[i].cssRules||document.styleSheets[i].rules||document.styleSheets[i].cssText)}catch{}p()},this.findElementQueriesElements=function(e){d(e)},this.update=function(){this.init()}};t.update=function(){t.instance.update()},t.detach=function(e){e.elementQueriesSetupInformation?(e.elementQueriesSensor.detach(),delete e.elementQueriesSetupInformation,delete e.elementQueriesSensor):e.resizeSensorInstance&&(e.resizeSensorInstance.detach(),delete e.resizeSensorInstance)},t.init=function(){t.instance||=new t,t.instance.init()};var n=function(e){if(document.addEventListener)document.addEventListener(`DOMContentLoaded`,e,!1);else if(/KHTML|WebKit|iCab/i.test(navigator.userAgent))var t=setInterval(function(){/loaded|complete/i.test(document.readyState)&&(e(),clearInterval(t))},10);else window.onload=e};return t.findElementQueriesElements=function(e){t.instance.findElementQueriesElements(e)},t.listen=function(){n(t.init)},t})})),mue=m(((e,t)=>{t.exports={ResizeSensor:q5(),ElementQueries:pue()}}));function J5(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}let r=n.count-2,i=[];if(t===2)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),a.clearGroups(),a}return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,t),e}var hue=p((()=>{GY()}));function gue(e){let t=new Map,n=new Map,r=e.clone();return Y5(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function Y5(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)Y5(e.children[r],t.children[r],n)}var _ue=p((()=>{})),vue=h({GLTFLoader:()=>n7});function yue(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function X5(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function bue(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new uy({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function Z5(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Q5(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function xue(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function Sue(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function Cue(e){let t,n=e.extensions&&e.extensions[r7.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+$5(n.attributes):e.indices+`:`+$5(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+$5(e.targets[n]);return t}function $5(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function e7(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function wue(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function Tue(e,t,n){let r=t.attributes,i=new ch;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new B(t[0],t[1],t[2]),new B(a[0],a[1],a[2])),e.normalized){let t=e7(N7[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new B,t=new B;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=e7(N7[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new Bh;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function t7(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=L7[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return Jp.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Jp.workingColorSpace}" not supported.`),Q5(e,t),Tue(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:xue(e,t.targets,n)})}var n7,r7,i7,a7,o7,s7,c7,l7,u7,d7,f7,p7,m7,h7,g7,_7,v7,y7,b7,x7,S7,C7,w7,T7,E7,D7,O7,k7,A7,j7,M7,N7,P7,F7,I7,L7,R7,z7,B7,V7,H7,Eue=p((()=>{GY(),hue(),_ue(),n7=class extends Ry{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new s7(e)}),this.register(function(e){return new c7(e)}),this.register(function(e){return new _7(e)}),this.register(function(e){return new v7(e)}),this.register(function(e){return new y7(e)}),this.register(function(e){return new u7(e)}),this.register(function(e){return new d7(e)}),this.register(function(e){return new f7(e)}),this.register(function(e){return new p7(e)}),this.register(function(e){return new o7(e)}),this.register(function(e){return new m7(e)}),this.register(function(e){return new l7(e)}),this.register(function(e){return new g7(e)}),this.register(function(e){return new h7(e)}),this.register(function(e){return new i7(e)}),this.register(function(e){return new b7(e,r7.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new b7(e,r7.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new x7(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=Sb.extractUrlBase(e);a=Sb.resolveURL(t,this.path)}else a=Sb.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new Vy(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===S7){try{a[r7.KHR_BINARY_GLTF]=new T7(e)}catch(e){r&&r(e);return}i=JSON.parse(a[r7.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new H7(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case r7.KHR_MATERIALS_UNLIT:a[t]=new a7;break;case r7.KHR_DRACO_MESH_COMPRESSION:a[t]=new E7(i,this.dracoLoader);break;case r7.KHR_TEXTURE_TRANSFORM:a[t]=new D7;break;case r7.KHR_MESH_QUANTIZATION:a[t]=new O7;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},r7={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},i7=class{constructor(e){this.parser=e,this.name=r7.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new Um(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],ap);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new hb(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new fb(s),o.distance=c;break;case`spot`:o=new ub(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),Q5(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},a7=class{constructor(){this.name=r7.KHR_MATERIALS_UNLIT}getMaterialType(){return Eg}extendParams(e,t,n){let r=[];e.color=new Um(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ap),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,ip))}return Promise.all(r)}},o7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},s7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new z(e,e)}return Promise.all(r)}},c7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_DISPERSION}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},l7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},u7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_SHEEN}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new Um(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ap)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,ip)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},d7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},f7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_VOLUME}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new Um().setRGB(i[0],i[1],i[2],ap),Promise.all(r)}},p7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_IOR}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);return n===null?Promise.resolve():(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3),Promise.resolve())}},m7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_SPECULAR}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new Um().setRGB(i[0],i[1],i[2],ap),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,ip)),Promise.all(r)}},h7=class{constructor(e){this.parser=e,this.name=r7.EXT_MATERIALS_BUMP}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},g7=class{constructor(e){this.parser=e,this.name=r7.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return X5(this.parser,e,this.name)===null?null:dy}extendMaterialParams(e,t){let n=X5(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},_7=class{constructor(e){this.parser=e,this.name=r7.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},v7=class{constructor(e){this.parser=e,this.name=r7.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},y7=class{constructor(e){this.parser=e,this.name=r7.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},b7=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},x7=class{constructor(e){this.name=r7.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==M7.TRIANGLES&&e.mode!==M7.TRIANGLE_STRIP&&e.mode!==M7.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new lm,n=new B,a=new Vp,s=new B(1,1,1),c=new c_(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));for(let t in o)if(t===`_COLOR_0`){let e=o[t];c.instanceColor=new e_(e.array,e.itemSize,e.normalized)}else t!==`TRANSLATION`&&t!==`ROTATION`&&t!==`SCALE`&&e.geometry.setAttribute(t,o[t]);Im.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},S7=`glTF`,C7=12,w7={JSON:1313821514,BIN:5130562},T7=class{constructor(e){this.name=r7.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,C7),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==S7)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-C7,i=new DataView(e,C7),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===w7.JSON){let r=new Uint8Array(e,C7+a,t);this.content=n.decode(r)}else if(r===w7.BIN){let n=C7+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},E7=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=r7.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=L7[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=L7[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=N7[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,ap,n)})})}},D7=class{constructor(){this.name=r7.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0?e:(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e)}},O7=class{constructor(){this.name=r7.KHR_MESH_QUANTIZATION}},k7=class extends xy{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},A7=new Vp,j7=class extends k7{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return A7.fromArray(i).normalize().toArray(i),i}},M7={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},N7={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},P7={9728:Td,9729:Ad,9984:Ed,9985:jd,9986:Od,9987:Nd},F7={33071:Cd,33648:wd,10497:Sd},I7={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L7={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},R7={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},z7={CUBICSPLINE:void 0,LINEAR:Kf,STEP:Gf},B7={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},V7=new lm,H7=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new yue,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}this.textureLoader=typeof createImageBitmap>`u`||n&&r<17||i&&a<98?new Jy(this.options.manager):new jb(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Vy(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return Z5(i,a,r),Q5(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[r7.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(Sb.resolveURL(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=I7[r.type],t=N7[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new Dh(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=I7[r.type],o=N7[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new Yh(f,u/s),t.cache.add(n,c)),p=new Zh(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new Dh(f,a,d);if(r.sparse!==void 0){let t=I7.SCALAR,n=N7[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new Dh(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=P7[n.magFilter]||1006,t.minFilter=P7[n.minFilter]||1008,t.wrapS=F7[n.wrapS]||1e3,t.wrapT=F7[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new tm(e);t.needsUpdate=!0,n(t)}),t.load(Sb.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),Q5(e,a),e.userData.mimeType=a.mimeType||wue(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[r7.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[r7.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[r7.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new K_,$h.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new N_,$h.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return uy}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[r7.KHR_MATERIALS_UNLIT]){let e=r[r7.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Um(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],ap),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,ip)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||B7.OPAQUE;if(l===B7.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===B7.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==Eg&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new z(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==Eg&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==Eg){let e=i.emissiveFactor;o.emissive=new Um().setRGB(e[0],e[1],e[2],ap)}return i.emissiveTexture!==void 0&&a!==Eg&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,ip)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),Q5(n,i),t.associations.set(n,{materials:e}),i.extensions&&Z5(r,n,i),n})}createUniqueName(e){let t=hx.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[r7.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return t7(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=Cue(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[r7.KHR_DRACO_MESH_COMPRESSION]?i(o):t7(new Jh,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?bue(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===M7.TRIANGLES||u.mode===M7.TRIANGLE_STRIP||u.mode===M7.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new Jg(l,f):new Rg(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),u.mode===M7.TRIANGLE_STRIP?d.geometry=J5(d.geometry,1):u.mode===M7.TRIANGLE_FAN&&(d.geometry=J5(d.geometry,2));else if(u.mode===M7.LINES)d=new W_(l,f);else if(u.mode===M7.LINE_STRIP)d=new V_(l,f);else if(u.mode===M7.LINE_LOOP)d=new G_(l,f);else if(u.mode===M7.POINTS)d=new Z_(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&Sue(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),Q5(d,i),u.extensions&&Z5(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&Z5(r,c[0],i),c[0];let l=new Lm;i.extensions&&Z5(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new cb(Bp.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new pb(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Q5(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new lm;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new $g(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new Py(i,void 0,l);return Q5(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,V7)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new B().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new Yg:t.length>1?new Lm:t.length===1?t[0]:new Im,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),Q5(o,i),i.extensions&&Z5(n,o,i),i.matrix!==void 0){let e=new lm;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new Lm;n.name&&(i.name=r.createUniqueName(n.name)),Q5(i,n),n.extensions&&Z5(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(gue(n))}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof $h||e instanceof tm)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}R7[i.path]===R7.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(R7[i.path]){case R7.weights:l=ky;break;case R7.rotation:l=jy;break;case R7.translation:case R7.scale:l=Ny;break;default:switch(n.itemSize){case 1:l=ky;break;default:l=Ny}}let u=r.interpolation===void 0?Kf:z7[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+R7[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=e7(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof jy?j7:k7)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),Due=m((e=>{e.deflate=Ue,e.deflateSync=We,e.inflate=qe,e.inflateSync=Je,e.gzip=Ze,e.compress=Ze,e.gzipSync=Qe,e.compressSync=Qe,e.gunzip=tt,e.gunzipSync=nt,e.zlib=it,e.zlibSync=at,e.unzlib=ct,e.unzlibSync=lt,e.gzip=Ze,e.compress=Ze,e.decompress=dt,e.decompressSync=ft,e.strToU8=vt,e.strFromU8=yt,e.zip=Ot,e.zipSync=kt,e.unzip=Mt,e.unzipSync=Nt;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var ee=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],j=function(e,t,n){var r=Error(t||ee[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,j),!n)throw r;return r},M=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,ee=a*8;do{if(!b){g=D(e,_,1);var M=D(e,_+1,3);if(_+=3,!M){var N=k(_)+4,te=e[N-4]|e[N-3]<<8,ne=N+te;if(ne>a){p&&j(0);break}f&&h(v+te),n.set(e.subarray(N,ne),v),t.b=v+=te,t.p=_=ne*8,t.f=g;continue}if(M==1)b=C,x=T,S=9,w=5;else if(M==2){var re=D(e,_,31)+257,ie=D(e,_+10,15)+4,ae=re+D(e,_+5,31)+1;_+=14;for(var oe=new r(ae),se=new r(19),ce=0;ce<ie;++ce)se[c[ce]]=D(e,_+ce*3,7);_+=ie*3;for(var le=E(se),ue=(1<<le)-1,de=y(se,le,1),ce=0;ce<ae;){var fe=de[D(e,_,ue)];_+=fe&15;var N=fe>>4;if(N<16)oe[ce++]=N;else{var pe=0,me=0;for(N==16?(me=3+D(e,_,3),_+=2,pe=oe[ce-1]):N==17?(me=3+D(e,_,7),_+=3):N==18&&(me=11+D(e,_,127),_+=7);me--;)oe[ce++]=pe}}var he=oe.subarray(0,re),ge=oe.subarray(re);S=E(he),w=E(ge),b=y(he,S,1),x=y(ge,w,1)}else j(1);if(_>ee){p&&j(0);break}}f&&h(v+131072);for(var _e=(1<<S)-1,ve=(1<<w)-1,ye=_;;ye=_){var pe=b[O(e,_)&_e],be=pe>>4;if(_+=pe&15,_>ee){p&&j(0);break}if(pe||j(2),be<256)n[v++]=be;else if(be==256){ye=_,b=null;break}else{var P=be-254;if(be>264){var ce=be-257,xe=o[ce];P=D(e,_,(1<<xe)-1)+d[ce],_+=xe}var Se=x[O(e,_)&ve],Ce=Se>>4;Se||j(3),_+=Se&15;var ge=m[Ce];if(Ce>3){var xe=s[Ce];ge+=O(e,_)&(1<<xe)-1,_+=xe}if(_>ee){p&&j(0);break}f&&h(v+131072);var we=v+P;if(v<ge){var Te=l-ge,Ee=Math.min(ge,we);for(Te+v<0&&j(3);v<Ee;++v)n[v]=i[Te+v]}for(;v<we;++v)n[v]=n[v-ge]}}t.l=b,t.p=ye,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},N=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},te=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ne=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:le,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=re(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},re=function(e,t,n){return e.s==-1?Math.max(re(e.l,t,n+1),re(e.r,t,n+1)):t[e.s]=n},ie=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},ae=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},oe=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},se=function(e,t,n,r,a,l,u,d,f,p,m){N(t,m++,n),++a[256];for(var h=ne(a,15),g=h.t,_=h.l,v=ne(l,15),C=v.t,T=v.l,E=ie(g),D=E.c,O=E.n,k=ie(C),A=k.c,ee=k.n,j=new i(19),M=0;M<D.length;++M)++j[D[M]&31];for(var M=0;M<A.length;++M)++j[A[M]&31];for(var re=ne(j,7),se=re.t,ce=re.l,le=19;le>4&&!se[c[le-1]];--le);var ue=p+5<<3,de=ae(a,b)+ae(l,x)+u,fe=ae(a,g)+ae(l,C)+u+14+3*le+ae(j,se)+2*j[16]+3*j[17]+7*j[18];if(f>=0&&ue<=de&&ue<=fe)return oe(t,m,e.subarray(f,f+p));var pe,me,he,ge;if(N(t,m,1+(fe<de)),m+=2,fe<de){pe=y(g,_,0),me=g,he=y(C,T,0),ge=C;var _e=y(se,ce,0);N(t,m,O-257),N(t,m+5,ee-1),N(t,m+10,le-4),m+=14;for(var M=0;M<le;++M)N(t,m+3*M,se[c[M]]);m+=3*le;for(var ve=[D,A],ye=0;ye<2;++ye)for(var be=ve[ye],M=0;M<be.length;++M){var P=be[M]&31;N(t,m,_e[P]),m+=se[P],P>15&&(N(t,m,be[M]>>5&127),m+=be[M]>>12)}}else pe=S,me=b,he=w,ge=x;for(var M=0;M<d;++M){var xe=r[M];if(xe>255){var P=xe>>18&31;te(t,m,pe[P+257]),m+=me[P+257],P>7&&(N(t,m,xe>>23&31),m+=o[P]);var Se=xe&31;te(t,m,he[Se]),m+=ge[Se],Se>3&&(te(t,m,xe>>5&8191),m+=s[Se])}else te(t,m,pe[xe]),m+=me[xe]}return te(t,m,pe[256]),m+me[256]},ce=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),le=new r(0),ue=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=ce[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),ee=new i(32),j=0,M=0,N=u.i||0,te=0,ne=u.w||0,re=0;N+2<d;++N){var ie=E(N),ae=N&32767,le=C[ie];if(S[ae]=le,C[ie]=ae,ne<=N){var ue=d-N;if((j>7e3||te>24576)&&(ue>423||!g)){_=se(e,m,0,D,O,ee,M,te,re,N-re,_),te=j=M=0,re=N;for(var de=0;de<286;++de)O[de]=0;for(var de=0;de<30;++de)ee[de]=0}var fe=2,pe=0,me=b,he=ae-le&32767;if(ue>2&&ie==E(N-he))for(var ge=Math.min(y,ue)-1,_e=Math.min(32767,N),ve=Math.min(258,ue);he<=_e&&--me&&ae!=le;){if(e[N+fe]==e[N+fe-he]){for(var ye=0;ye<ve&&e[N+ye]==e[N+ye-he];++ye);if(ye>fe){if(fe=ye,pe=he,ye>ge)break;for(var be=Math.min(he,ye-2),P=0,de=0;de<be;++de){var xe=N-he+de&32767,Se=xe-S[xe]&32767;Se>P&&(P=Se,le=xe)}}}ae=le,le=S[ae],he+=ae-le&32767}if(pe){D[te++]=268435456|f[fe]<<18|h[pe];var Ce=f[fe]&31,we=h[pe]&31;M+=o[Ce]+s[we],++O[257+Ce],++ee[we],ne=N+fe,++j}else D[te++]=e[N],++O[e[N]]}}for(N=Math.max(N,ne);N<d;++N)D[te++]=e[N],++O[e[N]];_=se(e,m,g,D,O,ee,M,te,re,N-re,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=N,u.w=ne)}else{for(var N=u.w||0;N<d+g;N+=65535){var Te=N+65535;Te>=d&&(m[_/8|0]=g,Te=d),_=oe(m,_+1,e.subarray(N,Te))}u.i=d}return A(p,0,c+k(_)+l)},de=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),fe=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=de[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},pe=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},me=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ue(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},he=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ge=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},_e=[],ve=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},ye=function(e,t,r,i){if(!_e[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=ge(e[c],a,o);_e[r]={c:ge(e[s],a,o),e:o}}var l=he({},_e[r].e);return(0,n.default)(_e[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,ve(l),i)},be=function(){return[r,i,a,o,s,c,d,m,C,T,g,ee,y,E,D,O,k,A,j,M,Je,Te,Ee]},P=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,ce,le,y,N,te,ne,re,ie,ae,oe,se,k,A,ue,me,We,Te]},xe=function(){return[Pe,Le,Ne,fe,de]},Se=function(){return[Fe,Ie]},Ce=function(){return[Re,Ne,pe]},we=function(){return[ze]},Te=function(e){return postMessage(e,[e.buffer])},Ee=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},De=function(e,t,n,r,i,a){var o=ye(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Oe=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},ke=function(e,t,n,r,i,a,o){var s,c=ye(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||j(5),s&&t.ondata(j(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},Ae=function(e,t){return e[t]|e[t+1]<<8},je=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Me=function(e,t){return je(e,t)+je(e,t+4)*4294967296},Ne=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Pe=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Ne(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Fe=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&j(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ie=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Le=function(e){return 10+(e.filename?e.filename.length+1:0)},Re=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=pe();i.p(t.dictionary),Ne(e,2,i.d())}},ze=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&j(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&j(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Be(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var Ve=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(me(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||j(5),this.s.l&&j(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=le)},e.prototype.flush=function(e){if(this.ondata||j(5),this.s.l&&j(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=oe(t,this.s.r,le);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=Ve;var He=function(){function e(e,t){ke([P,function(){return[Oe,Ve]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ve(e.data))},6,1)}return e}();e.AsyncDeflate=He;function Ue(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P],function(e){return Te(We(e.data[0],e.data[1]))},0,n)}function We(e,t){return me(e,t||{},0,0)}var Ge=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||j(5),this.d&&j(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=M(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Ge;var Ke=function(){function e(e,t){ke([be,function(){return[Oe,Ge]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ge(e.data))},7,0)}return e}();e.AsyncInflate=Ke;function qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be],function(e){return Te(Je(e.data[0],Ee(e.data[1])))},1,n)}function Je(e,t){return M(e,{i:2},t&&t.out,t&&t.dictionary)}var Ye=function(){function e(e,t){this.c=fe(),this.l=0,this.v=1,Ve.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Ve.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=me(e,this.o,this.v&&Le(this.o),t&&8,this.s);this.v&&=(Pe(n,this.o),0),t&&(Ne(n,n.length-8,this.c.d()),Ne(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){Ve.prototype.flush.call(this,e)},e}();e.Gzip=Ye,e.Compress=Ye;var Xe=function(){function e(e,t){ke([P,xe,function(){return[Oe,Ve,Ye]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new Ye(e.data))},8,1)}return e}();e.AsyncGzip=Xe,e.AsyncCompress=Xe;function Ze(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P,xe,function(){return[Qe]}],function(e){return Te(Qe(e.data[0],e.data[1]))},2,n)}function Qe(e,t){t||={};var n=fe(),r=e.length;n.p(e);var i=me(e,t,Le(t),8),a=i.length;return Pe(i,t),Ne(i,a-8,n.d()),Ne(i,a-4,r),i}var $e=function(){function e(e,t){this.v=1,this.r=0,Ge.call(this,e,t)}return e.prototype.push=function(e,t){if(Ge.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?Fe(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Ge.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Ge.prototype.c.call(this,t)},e}();e.Gunzip=$e;var et=function(){function e(e,t){var n=this;ke([be,Se,function(){return[Oe,Ge,$e]}],this,Be.call(this,e,t),function(e){var t=new $e(e.data);t.onmember=function(e){return postMessage(e)},onmessage=Oe(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=et;function tt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be,Se,function(){return[nt]}],function(e){return Te(nt(e.data[0],e.data[1]))},3,n)}function nt(e,t){var n=Fe(e);return n+8>e.length&&j(6,`invalid gzip data`),M(e.subarray(n,-8),{i:2},t&&t.out||new r(Ie(e)),t&&t.dictionary)}var rt=function(){function e(e,t){this.c=pe(),this.v=1,Ve.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Ve.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=me(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(Re(n,this.o),0),t&&Ne(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){Ve.prototype.flush.call(this,e)},e}();e.Zlib=rt,e.AsyncZlib=function(){function e(e,t){ke([P,Ce,function(){return[Oe,Ve,rt]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new rt(e.data))},10,1)}return e}();function it(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[P,Ce,function(){return[at]}],function(e){return Te(at(e.data[0],e.data[1]))},4,n)}function at(e,t){t||={};var n=pe();n.p(e);var r=me(e,t,t.dictionary?6:2,4);return Re(r,t),Ne(r,r.length-4,n.d()),r}var ot=function(){function e(e,t){Ge.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Ge.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ze(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&j(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Ge.prototype.c.call(this,t)},e}();e.Unzlib=ot;var st=function(){function e(e,t){ke([be,we,function(){return[Oe,Ge,ot]}],this,Be.call(this,e,t),function(e){onmessage=Oe(new ot(e.data))},11,0)}return e}();e.AsyncUnzlib=st;function ct(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),De(e,t,[be,we,function(){return[lt]}],function(e){return Te(lt(e.data[0],Ee(e.data[1])))},5,n)}function lt(e,t){return M(e.subarray(ze(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var ut=function(){function e(e,t){this.o=Be.call(this,e,t)||{},this.G=$e,this.I=Ge,this.Z=ot}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||j(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=ut,e.AsyncDecompress=function(){function e(e,t){ut.call(this,e,t),this.queuedSize=0,this.G=et,this.I=Ke,this.Z=st}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,ut.prototype.push.call(this,e,t)},e}();function dt(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&j(7),e[0]==31&&e[1]==139&&e[2]==8?tt(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?qe(e,t,n):ct(e,t,n)}function ft(e,t){return e[0]==31&&e[1]==139&&e[2]==8?nt(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Je(e,t):lt(e,t)}var pt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=he(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],pt(o,s,n,i))}},mt=typeof TextEncoder<`u`&&new TextEncoder,ht=typeof TextDecoder<`u`&&new TextDecoder,gt=0;try{ht.decode(le,{stream:!0}),gt=1}catch{}var _t=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,gt?this.t=new TextDecoder:this.p=le}return e.prototype.push=function(e,t){if(this.ondata||j(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&j(8),this.t=null);return}this.p||j(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=_t(n),a=i.s,o=i.r;t?(o.length&&j(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||j(5),this.d&&j(4),this.ondata(vt(e),this.d=t||!1)},e}();function vt(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(mt)return mt.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function yt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(ht)return ht.decode(e);var i=_t(e),a=i.s,n=i.r;return n.length&&j(8),a}var bt=function(e){return e==1?3:e<6?2:+(e==9)},xt=function(e,t){return t+30+Ae(e,t+26)+Ae(e,t+28)},St=function(e,t,n){var r=Ae(e,t+28),i=Ae(e,t+30),a=yt(e.subarray(t+46,t+46+r),!(Ae(e,t+8)&2048)),o=t+46+r,s=Ct(e,o,i,n,je(e,t+20),je(e,t+24),je(e,t+42)),c=s[0],l=s[1],u=s[2];return[Ae(e,t+10),c,l,a,o+i+Ae(e,t+32),u]},Ct=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+Ae(e,t+2))if(Ae(e,t)==1)return[s?Me(e,t+4+8*c):i,c?Me(e,t+4):a,l?Me(e,t+4+8*(c+s)):o,1];r<2&&j(13)}return[i,a,o,0]},wt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&j(9),t+=r+4}return t},Tt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=wt(l);Ne(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&j(10),Ne(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Ne(e,t,n.crc),Ne(e,t+4,a<0?-a-2:a),Ne(e,t+8,n.size)),Ne(e,t+12,c),Ne(e,t+14,d),t+=16,o!=null&&(Ne(e,t,u),Ne(e,t+6,n.attrs),Ne(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Ne(e,t,+m),Ne(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Et=function(e,t,n,r,i){Ne(e,t,101010256),Ne(e,t+8,n),Ne(e,t+10,n),Ne(e,t+12,r),Ne(e,t+16,i)},Dt=function(){function e(e){this.filename=e,this.c=fe(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||j(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=Dt,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},Dt.call(this,e),this.d=new Ve(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=bt(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){Dt.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},Dt.call(this,e),this.d=new He(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=bt(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){Dt.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||j(5),this.d&2)this.ondata(j(4+(this.d&1)*8,0,1),null,!1);else{var n=vt(e.filename),i=n.length,a=e.comment,o=a&&vt(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+wt(e.extra)+30;i>65535&&this.ondata(j(11,0,1),null,!1);var l=new r(c);Tt(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=he(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Ne(o,0,134695760),Ne(o,4,e.crc),Ne(o,8,h),Ne(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(j(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+wt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];Tt(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+wt(o.extra)+(o.o?o.o.length:0),t+=o.b}Et(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function Ot(e,t,n){n||(n=t,t={}),typeof n!=`function`&&j(7);var i={};pt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){jt(function(){n(e,t)})};jt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;Tt(e,c,a,a.f,a.u,o);var d=30+a.f.length+wt(a.extra),f=c+d;e.set(a.c,f),Tt(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}Et(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=fe(),g=r.length;h.p(r);var _=vt(t),v=_.length,y=l.comment,b=y&&vt(y),x=b&&b.length,S=wt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=he(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(j(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,We(r,l))}catch(e){w(e,null)}else d.push(Ue(r,l,w))},g=0;g<l;++g)h(g);return f}function kt(e,t){t||={};var n={},i=[];pt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=vt(s),p=f.length,m=u.comment,h=m&&vt(m),g=h&&h.length,_=wt(u.extra);p>65535&&j(11);var v=d?We(l,u):l,y=v.length,b=fe();b.p(l),i.push(he(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];Tt(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+wt(f.extra);x.set(f.c,f.o+T),Tt(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return Et(x,a,i.length,C,S),x}var At=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=At,e.UnzipInflate=function(){function e(){var e=this;this.i=new Ge(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Ge(function(e,t){n.ondata(null,e,t)}):(this.i=new Ke(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:At},this.p=le}return e.prototype.push=function(e,t){var n=this;if(this.onfile||j(5),this.p||j(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=je(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=Ae(l,s+6),r=Ae(l,s+8),i=t&2048,a=t&8,f=Ae(l,s+26),p=Ae(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=je(l,s+18),_=je(l,s+22),v=yt(l.subarray(s+30,s+=30+f),!i),y=Ct(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||j(5),!b)w.ondata(null,le,!0);else{var e=n.o[r];e||w.ondata(j(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(le,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=le,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(je(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&j(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var jt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function Mt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&j(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){jt(function(){n(e,t)})};jt(function(){s=n});for(var c=e.length-22;je(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(j(13,0,1),null),a;var l=Ae(e,c+8);if(l){var u=l,d=je(e,c+16),f=je(e,c-20)==117853008;if(f){var p=je(e,c-12);f=je(e,p)==101075792,f&&(u=l=je(e,p+32),d=je(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=St(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=xt(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Je(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(qe(b,{size:p},y))}else y(j(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function Nt(e,t){for(var n={},i=e.length-22;je(e,i)!=101010256;--i)(!i||e.length-i>65558)&&j(13);var a=Ae(e,i+8);if(!a)return{};var o=je(e,i+16),s=je(e,i-20)==117853008;if(s){var c=je(e,i-12);s=je(e,c)==101075792,s&&(a=je(e,c+32),o=je(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=St(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=xt(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Je(e.subarray(v,v+p),{out:new r(m)}):j(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),U7=_(m(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r((WY(),v(xle)),(uue(),v(Yle)),(fue(),v(due)),mue(),(Eue(),v(vue)),Due()):typeof define==`function`&&define.amd?define([`three/webgpu`,`three-spritetext`,`three/tsl`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.THREE,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i,a){var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},p=(e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e));e=p(e,1),t=p(t,1);var m={name:`zincjs`,version:`2.4.1-beta.1`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,engines:{node:`^24.20.0`},directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,allowScripts:{"msw@2.14.6":!0},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`,webgpu:`^0.4.0`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.185.1`,"three-spritetext":`1.10.0`}},h=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,g=t.default.default||t.default;function _(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function v(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function y(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function b(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)y(e[t],t,o,n)}var x=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},S=function(t,n){if(n&&t&&t.morphAttributes&&t.morphAttributes.color){let r=t.morphAttributes.color,i=n.morphTargetInfluences,a=i.length,o=[];for(let e=0;e<a;e++)i[e]>0&&o.push([e,i[e]]);let s=0,c=0,l=0;if(o.length>=2){c=o[0][0],l=o[1][0];let e=o[0][1]+o[1][1];s=e>0?o[1][1]/e:0}else o.length==1&&(c=l=o[0][0]);let u=t.getAttribute(`morphColor0`),d=t.getAttribute(`morphColor1`);(!u||!d)&&(u=new e.Float32BufferAttribute(new Float32Array(r[0].array.length),r[0].itemSize),d=new e.Float32BufferAttribute(new Float32Array(r[0].array.length),r[0].itemSize),u.setUsage(e.DynamicDrawUsage),d.setUsage(e.DynamicDrawUsage),t.setAttribute(`morphColor0`,u),t.setAttribute(`morphColor1`,d)),u.array.set(r[c].array),u.needsUpdate=!0,d.array.set(r[l].array),d.needsUpdate=!0;let f=n.material&&n.material.userData&&n.material.userData.uniforms&&n.material.userData.uniforms.morphColorMix;f&&(f.value=s)}},C=e=>{let t=e.clone();return t.colorsNeedUpdate=!0,t.computeBoundingBox(),t.computeBoundingSphere(),e._video&&(t._video=e._video),t};function w(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var T=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=w(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=w(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function E(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function D(){let t=new Image;t.src=h;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function O(e,t,n,r,i,a){let o=new g(e,t,n,r,i,a);return o.canvasScale=4,o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!0,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=10001,o}function k(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function A(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}function ee(e,t){let n=e.array,r=0;for(let e=0;e<t.length;e++){let i=t[e];n[r++]=i.x,n[r++]=i.y,n[r++]=i.z}return e.needsUpdate=!0,e}var j={MeshBasicMaterial:e.MeshBasicNodeMaterial,MeshLambertMaterial:e.MeshLambertNodeMaterial,MeshPhongMaterial:e.MeshPhongNodeMaterial,MeshStandardMaterial:e.MeshStandardNodeMaterial,LineBasicMaterial:e.LineBasicNodeMaterial},M=t=>{let r=t;r.isNodeMaterial||(r=new(j[t.type]||e.MeshBasicNodeMaterial),r.copy(t));let i=(0,n.uniform)(0);return r.colorNode=(0,n.Fn)(()=>{let e=(0,n.attribute)(`morphColor0`,`vec3`),t=(0,n.attribute)(`morphColor1`,`vec3`),r=(0,n.mix)(e,t,i);return(0,n.vec4)(r.mul(n.materialColor),n.materialOpacity)})(),r.userData.uniforms={...r.userData.uniforms,morphColorMix:i},r},N=new e.Vector3,te=new e.Vector3,ne=new e.Matrix4,re=new e.Ray,ie=new e.Sphere,ae=new e.Vector3,oe=new e.Vector3,se=new e.Vector3,ce=new e.Vector3,le=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)N.fromBufferAttribute(n,e-1),te.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=N.distanceTo(te);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),ie.copy(r.boundingSphere),ie.applyMatrix4(i),ie.radius+=a,t.ray.intersectsSphere(ie)===!1)return;ne.copy(i).invert(),re.copy(t.ray).applyMatrix4(ne);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(ue(u,d,this,i,s,r,a),re.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(ue(u,d,this,i,s,a,a+1),re.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function ue(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(i&&s){ae.set(0,0,0),oe.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(se.fromBufferAttribute(d,a),ce.fromBufferAttribute(d,o),ae.addScaledVector(se.sub(e),u),oe.addScaledVector(ce.sub(t),u))}e.add(ae),t.add(oe)}}le.prototype.isLine=!0;var de=new e.Vector3,fe=new e.Vector3,pe=class extends le{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)de.fromBufferAttribute(n,e),fe.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+de.distanceTo(fe);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};pe.prototype.isLineSegments=!0;var me=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=C(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour,isLines:this._parent.isLines}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new pe(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=e=>{if(this._material&&this._material.userData&&this._material.userData.uniforms&&this._material.userData.uniforms.morphColorMix){if(e){let e=this.getCurrentMorph();S(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&S(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},he=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);he.colorSpace=e.SRGBColorSpace;var ge=[.02,.03,1],_e=new e.SpriteMaterial({map:he,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),ve=function(t){Object.getPrototypeOf(this)!==P.prototype&&Object.setPrototypeOf(ve.prototype,P.prototype),P.call(this),this.texture=he;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(_e),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(ge[0],ge[1],ge[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=O(e,.012,`black`,`Asap`,120,700),u.renderOrder=10001,this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},ye=0,be=function(){return`pr`+ye++},P=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new me(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=be(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};P.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},P.prototype.getDuration=function(){return this.duration},P.prototype.setRegion=function(e){this.region=e},P.prototype.getRegion=function(){return this.region},P.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},P.prototype.getGroup=function(){return this.group},P.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},P.prototype.checkTransparentMesh=function(){},P.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play(),this.mixer.update(0)))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.morphColour&&this.initiateMorphColor(),this.boundingBoxUpdateRequired=!0},P.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},P.prototype.setAnatomicalId=function(e){this.anatomicalId=e},P.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},P.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},P.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},P.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},P.prototype.getVisibility=function(){return this.visible},P.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},P.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},P.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},P.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},P.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},P.prototype.setColour=function(e){this._lod.setColour(e)},P.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},P.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},P.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},P.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},P.prototype.setMaterial=function(e){this._lod.setMaterial(e)},P.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},P.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},P.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(v(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},P.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},P.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},P.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new ve(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},P.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},P.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},P.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},P.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},P.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},P.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},P.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},P.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=E(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},P.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&A(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},P.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},P.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},P.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var xe=(t,n,r)=>{let i=C(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0)o=n||new e.MeshPhongMaterial({color:r.colour,vertexColors:!1,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.vertexColors=!1,o=M(o));else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide})}return new e.Mesh(i,o)},Se=function(){P.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=xe(e,t,n);this.videoHandler=r.geometry._video,this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour||this.videoHandler)}};Se.prototype=Object.create(P.prototype);var Ce=t.default.default||t.default,we=function(t,n){let r=t,i,a=1,o=500,s=.012;i=n?new Ce(r,s,n.getStyle()):new Ce(r,s),i.fontFace=`Asap`,i.fontSize=90,i.fontWeight=o,i.material.map.generateMipmaps=!0,i.material.map.anisotropy=4,i.material.minFilter=e.LinearMipmapLinearFilter,i.material.magFilter=e.LinearFilter,i.material.sizeAttenuation=!1,i.center.x=-.05,i.center.y=0,this.getPosition=()=>i?[i.position.x,i.position.y,i.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{i&&i.position.set(e,t,n)},this.setColour=e=>{e&&(i.color=e.getStyle())},this.setScale=e=>{i&&e>0&&i.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==i.material.depthTest&&(i.material.depthTest=e)},this.setSize=e=>{e>0&&(i.textHeight=s*e,a=e)},this.setFontWeight=e=>{e&&e!==o&&(i.fontWeight=e,o=e)},this.setText=e=>{if(e&&e!==i.text){if(i._canvas,i.material&&i.material.map&&i.material.map.dispose(),i._canvas){let e=i._canvas.getContext(`2d`);e&&e.clearRect(0,0,i._canvas.width,i._canvas.height),i._canvas.width=1,i._canvas.height=1}i.text=e,i.textHeight=s*a,r=e,i.material&&i.material.map&&(i.material.map.needsUpdate=!0)}},this.setVisibility=e=>{i.visible=e},this.dispose=()=>{},this.getSprite=()=>i,this.getString=()=>r},Te=function(t,n,r,i){P.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new we(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};Te.prototype=Object.create(P.prototype);function Ee(){}Ee.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(Ee.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=Ee.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`video`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var De=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){let r=e/t*n.video.duration;Number.isFinite(r)||(r=0),n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},Oe=e.BufferAttribute,ke=e.BufferGeometry,Ae=e.Color,je=e.DefaultLoadingManager,Me=e.FileLoader,Ne=e.Float32BufferAttribute,Pe=e.LoaderUtils;function Fe(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?je:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Fe.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:Pe.extractUrlBase(e),o=new Me(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){return e&1<<t}function n(e){let n=e.faces,r=0;if(e.uvs!==void 0)for(let t=0;t<e.uvs.length;t++)e.uvs[t].length&&r++;let i=[],a=[],o=0,s=n.length;for(;o<s;){let e=n[o++],s=t(e,0),c=t(e,1),l=t(e,3),u=t(e,4),d=t(e,5),f=t(e,6),p=t(e,7),m,h,g;if(s){let e=n[o],t=n[o+1],s=n[o+2],m=n[o+3];o+=4;let h=0;c&&(h=n[o++]),l&&(o+=r*4),u&&(o+=1),d&&(o+=4),f&&(o+=1),p&&(o+=4),i.push(e,t,m),a.push(h),i.push(t,s,m),a.push(h);continue}m=n[o++],h=n[o++],g=n[o++],h||=m,g||=h;let _=0;c&&(_=n[o++]),l&&(o+=r*3),u&&(o+=1),d&&(o+=3),f&&(o+=1),p&&(o+=3),i.push(m,h,g),a.push(_)}return{indices:i,materialIndices:a}}function r(e){let t=[],n,r;for(let i=0;i<e.length;i++)e[i]!==r&&(r=e[i],n!==void 0&&(n.count=i*3-n.start,t.push(n)),n={start:i*3,materialIndex:r});return n!==void 0&&(n.count=e.length*3-n.start,t.push(n)),t}function i(e,t){let n=new ke;n.setIndex(t),n.setAttribute(`position`,e),n.computeVertexNormals();let r=n.getAttribute(`normal`);return r.name=e.name,r}function a(e,t){let n=[];if(e.morphTargets!==void 0)for(let r=0,i=e.morphTargets.length;r<i;r++){let i=e.morphTargets[r].vertices,a=new Float32Array(i.length);for(let e=0,n=i.length;e<n;e++)a[e]=i[e]*t;let o=new Ne(a,3);o.name=e.morphTargets[r].name,n.push(o)}let r=[];if(e.morphNormals!==void 0){for(let t=0,i=e.morphNormals.length;t<i;t++)if(n[t]){let i=e.morphNormals[t].normals,a=new Ne(Float32Array.from(i),3);a.name=n[t].name,r[t]=a}}return{morphPositions:n,morphNormals:r}}function o(e){if(e.morphColors===void 0)return;let t=[];for(let n=0,r=e.morphColors.length;n<r;n++){let r=e.morphColors[n].colors,i=[];for(let e=0,t=r.length;e<t;e+=3){let t=new Ae(16755200);t.setRGB(r[e],r[e+1],r[e+2]),i.push(t)}let a=[];for(let e=0,t=i.length*3;e<t;e++){let t=x(i,e);a.push(t[0],t[1],t[2])}let o=new Ne(a,3);o.name=e.morphColors[n].name,t.push(o)}return t}return function(t,s){t.data!==void 0&&(t=t.data);let c=t.scale===void 0?1:1/t.scale,l=t.vertices,u=l.length/3,d=new Float32Array(l.length);for(let e=0,t=l.length;e<t;e++)d[e]=l[e]*c;let f=new ke;if(f.setAttribute(`position`,new Oe(d,3)),t.normals!==void 0&&t.normals.length>0&&f.setAttribute(`normal`,new Oe(Float32Array.from(t.normals),3)),t.uvs!==void 0&&(t.uvs[0]&&t.uvs[0].length>0&&f.setAttribute(`uv`,new Oe(Float32Array.from(t.uvs[0]),2)),t.uvs[1]&&t.uvs[1].length>0&&f.setAttribute(`uv2`,new Oe(Float32Array.from(t.uvs[1]),2))),t.colors!==void 0&&t.colors.length>0){let e=new Float32Array(t.colors.length*3);for(let n=0,r=t.colors.length;n<r;n++){let r=new Ae(t.colors[n]);e[n*3]=r.r,e[n*3+1]=r.g,e[n*3+2]=r.b}f.setAttribute(`color`,new Oe(e,3))}else{let e=new Float32Array(u*3).fill(1);f.setAttribute(`color`,new Oe(e,3))}let{indices:p,materialIndices:m}=n(t);p.length>0&&(f.setIndex(p),f.groups=r(m));let{morphPositions:h,morphNormals:g}=a(t,c);if(h.length>0){f.morphAttributes.position=h;let e=[];for(let t=0;t<h.length;t++)g[t]?e.push(g[t]):p.length>0&&e.push(i(h[t],p));e.length>0&&(f.morphAttributes.normal=e)}let _=o(t);if(_!==void 0&&(f.morphAttributes.color=_,f.morphAttributes.position===void 0)){let e=f.getAttribute(`position`);f.morphAttributes.position=_.map(t=>{let n=new Oe(e.array,e.itemSize);return n.name=t.name,n})}if(f.computeBoundingBox(),f.computeBoundingSphere(),t.materials===void 0||t.materials.length===0)return{geometry:f};var v=Ee.prototype.initMaterials(t.materials,s,`Anonymous`);if(t.materials[0].video){var y=s+t.materials[0].video;this.paramsString&&(y+=`?${this.paramsString}`),f._video=new De(y)}return v&&v.length>0&&(t.materials[0].singleSided?v[0].side=e.FrontSide:t.materials[0].flipSided?v[0].side=e.BackSide:v[0].side=e.DoubleSide,t.materials[0].specularCoef&&(v[0].shininess=Math.floor(t.materials[0].specularCoef/3))),{geometry:f,materials:v}}})()});var Ie=function(){P.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],ee=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Fe;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);re(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,re(v,b))};let j=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},M=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;ee.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=j(u,d,f,p,m,ee);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0,this.boundingBoxUpdateRequired=!0,this.morph.computeBoundingSphere()},N=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},te=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(M(e,t,c,u,d),s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];N(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ne=e=>{for(let e=0;e<u;e++){let n=new Te(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&c.length>0&&e&&this.showLabel(),M(a[0],n[0],r[0],i[0],o[0]),s!=null&&N(s[0]),this.ready=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new Te(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var re=(e,t)=>(n,r)=>{this.geometry.copy(n),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),r&&r[0]&&(this.morph.material=r[0]),ne(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(te(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,te()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&te()}this.updateMarker(t,n)}};Ie.prototype=Object.create(P.prototype);var Le=new e.Matrix4,Re=new e.Ray,ze=new e.Vector3,Be=class extends e.InstancedMesh{constructor(e,t,n){super(e,t,n),this.type=`InstancedPoints`,this.isInstancedPoints=!0,this.frustumCulled=!1,this.pointSize=10,this.sizePerPixel=1,this.pointPositions=new Float32Array}raycast(t,n){let r=this.matrixWorld,i=t.params.Points?t.params.Points.threshold:1,a=this.count,o=this.pointPositions;if(!a||!o||o.length<a*3)return;Le.copy(r).invert(),Re.copy(t.ray).applyMatrix4(Le);let s=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.pointSize*this.sizePerPixel,c=s*s;for(let i=0;i<a;i++){ze.fromArray(o,i*3);let a=Re.distanceSqToPoint(ze);if(a<c){let o=new e.Vector3;Re.closestPointToPoint(ze,o),o.applyMatrix4(r);let s=t.ray.origin.distanceTo(o);if(s<t.near||s>t.far)continue;n.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:i,face:null,object:this})}}}},Ve=new e.Vector2,He=t=>{let r=new e.MeshBasicNodeMaterial,i={pointSize:(0,n.uniform)(10),sizeAttenuation:(0,n.uniform)(0),viewportScale:(0,n.uniform)(1).onFrameUpdate(function({renderer:e}){let t=e.getSize(Ve);this.value=.5*t.y})};return r.vertexNode=(0,n.Fn)(()=>{let e=(0,n.attribute)(`instancePosition`,`vec3`),t=n.modelViewMatrix.mul((0,n.vec4)(e,1)),r=i.pointSize.mul(n.screenDPR),a=r.mul(i.viewportScale.div(t.z.negate()));r=(0,n.mix)(r,a,i.sizeAttenuation);let o=n.positionGeometry.xy.mul(r);o=o.div(n.viewportSize.div(2));let s=n.cameraProjectionMatrix.mul(t);return o=o.mul(s.w),(0,n.vec4)(s.xy.add(o),s.z,s.w)})(),r.colorNode=(0,n.Fn)(()=>{let e=(0,n.texture)(t,(0,n.uv)());return(0,n.vec4)(e.rgb.mul(n.materialColor),e.a.mul(n.materialOpacity))})(),r.userData.uniforms=i,r.size=i.pointSize.value,r.sizeAttenuation=!!i.sizeAttenuation.value,r},Ue=500,We=t=>{let n=new e.PlaneGeometry(1,1),r=new e.InstancedBufferAttribute(new Float32Array(t*3),3);return r.setUsage(e.DynamicDrawUsage),n.setAttribute(`instancePosition`,r),n},Ge=(e,t)=>{let n=e.getAttribute(`position`),r=[Float32Array.from(n.array)],i=e.morphAttributes.position;if(t&&i&&i.length>0){let t=e.morphTargetsRelative;i.forEach(e=>{if(t){let t=new Float32Array(n.array.length);for(let r=0;r<t.length;r++)t[r]=n.array[r]+e.array[r];r.push(t)}else r.push(Float32Array.from(e.array))})}return r},Ke=(e,t)=>{let n=e.morphAttributes.color;if(t&&n&&n.length>0){let t=e.getAttribute(`color`),r=[];return r.push(t?Float32Array.from(t.array):new Float32Array(n[0].array.length)),n.forEach(e=>{r.push(Float32Array.from(e.array))}),r}},qe=e=>{let t=e.getAttribute(`color`);return t?Float32Array.from(t.array):void 0},Je=function(){P.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0,o=[],s,c=!1,l=!1,u=new e.Color,d=()=>{let e=this.getMorph();if(!e||o.length===0)return;let t=e.count,n=o.length,r=0,i=0,a=1;if(n>1){let e=this.inbuildTime/this.duration*(n-1);r=Math.floor(e),i=Math.ceil(e),a=1-(e-r)}if(c){let n=o[r],s=o[i],c=e.pointPositions,l=t*3;for(let e=0;e<l;e++)c[e]=a*n[e]+(1-a)*s[e];let u=e.geometry.getAttribute(`instancePosition`);u.array.set(c.subarray(0,l)),u.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}if(l&&s){let n=s[Math.min(r,s.length-1)],o=s[Math.min(i,s.length-1)];for(let r=0;r<t;r++){let t=r*3;u.setRGB(a*n[t]+(1-a)*o[t],a*n[t+1]+(1-a)*o[t+1],a*n[t+2]+(1-a)*o[t+2]),e.setColorAt(r,u)}e.instanceColor.needsUpdate=!0}};this.createMesh=(e,t,n)=>{if(!e||!t)return;let r=C(e,n);o=Ge(r,n.localTimeEnabled),s=Ke(r,n.localMorphColour),c=o.length>1,l=!!s,this.timeEnabled=c,this.morphColour=l;let i=o[0].length/3,a=We(i),d=He(D());t.color&&d.color.copy(t.color),t.opacity!==void 0&&(d.opacity=t.opacity),d.transparent=!!t.transparent,d.alphaTest=t.alphaTest===void 0?.5:t.alphaTest;let f=new Be(a,d,i);f.count=i,f.pointPositions=new Float32Array(i*3),f.pointPositions.set(o[0]),f.userData=this,this.drawRange=i;let p=a.getAttribute(`instancePosition`);p.array.set(o[0]),p.needsUpdate=!0;let m=s?s[0]:qe(r);if(m)for(let e=0;e<i;e++)u.setRGB(m[e*3],m[e*3+1],m[e*3+2]),f.setColorAt(e,u);this.setMorph(f),r.dispose(),this.boundingBoxUpdateRequired=!0},this.setMesh=(e,t,n)=>{this.createMesh(e.geometry,e.material,{localTimeEnabled:t,localMorphColour:n});let r=this.getMorph();r&&(r.name=e.name)};let f=(o,s,c,l)=>{if(c){let u=new we(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},p=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(e,t,n)=>{if(e&&e.length>0){let r=this.getMorph(),i=this.drawRange;if(!r){i=0,this.drawRange=0;let e=We(Ue),t=He(D());t.color.set(n),t.alphaTest=.5,r=new Be(e,t,Ue),r.pointPositions=new Float32Array(Ue*3),r.count=0,r.userData=this,this.setMorph(r)}let a=r.geometry.getAttribute(`instancePosition`);e.forEach(e=>{this.drawRange<Ue&&(a.setXYZ(this.drawRange,e[0],e[1],e[2]),r.pointPositions[this.drawRange*3]=e[0],r.pointPositions[this.drawRange*3+1]=e[1],r.pointPositions[this.drawRange*3+2]=e[2],this.drawRange++)}),a.needsUpdate=!0,r.count=this.drawRange;let o=i+e.length,s=0;if(Array.isArray(t)&&t.length===e.length||typeof t==`string`)for(;i+s<o;){let n=typeof t==`string`?t:t[s];f(i+s,e[s],n,this._lod._material.color),s++}this.boundingBoxUpdateRequired=!0,this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.userData.uniforms.pointSize.value=e,this.morph.pointSize=e)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.userData.uniforms.sizeAttenuation.value=+!!e)},this.getVerticesByIndex=function(e){let t=this.getMorph();if(t&&e>=0&&this.drawRange>e)return[t.pointPositions[e*3],t.pointPositions[e*3+1],t.pointPositions[e*3+2]]},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`instancePosition`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a,e[0],e[1],e[2]),r.pointPositions[a*3]=e[0],r.pointPositions[a*3+1]=e[1],r.pointPositions[a*3+2]=e[2],o[0]&&(o[0][a*3]=e[0],o[0][a*3+1]=e[1],o[0][a*3+2]=e[2]),a++}),i.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){let t=this.getMorph();if(!t||0>e||e>=this.drawRange)return this.drawRange;let n=t.geometry.getAttribute(`instancePosition`),r=this.drawRange-1;return n.array.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.pointPositions.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.instanceColor&&(t.instanceColor.array.copyWithin(e*3,(e+1)*3,this.drawRange*3),t.instanceColor.needsUpdate=!0),n.needsUpdate=!0,this.drawRange=r,t.count=this.drawRange,p(e),this.boundingBoxUpdateRequired=!0,this.drawRange},this.setName=function(e){let n=this.groupName;Je.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&this.drawRange>0){this._b1.setFromArray(t.pointPositions.subarray(0,this.drawRange*3)),this._b1.getCenter(this._v1);let n=-1;for(let r=0;r<this.drawRange;r++){this._v2.fromArray(t.pointPositions,r*3);let i=this._v1.distanceTo(this._v2);(n===-1||i<n)&&(n=i,e=r)}}return e},this.getClosestVertex=function(t){let n=this.getMorph();this.closestVertexIndex===-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=new e.Vector3;return n&&this.closestVertexIndex>=0?(r.fromArray(n.pointPositions,this.closestVertexIndex*3),t?r.applyMatrix4(n.matrixWorld):r):(this.getBoundingBox(),r.copy(this.center),r)},this.getBoundingBox=function(){let e=this.getMorph();if(this.visible&&e&&e.visible&&this.drawRange>0)return this.boundingBoxUpdateRequired&&=(this._b1.setFromArray(e.pointPositions.subarray(0,this.drawRange*3)),this.cachedBoundingBox.copy(this._b1),e.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(e.matrixWorld),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox},this.isTimeVarying=()=>c||l,this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(c||l)&&d()},this.render=(e,t,n,r)=>{if(this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),this.visible&&this._lod.update(n,this.center),t===!0&&(c||l)){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,d()}this.updateMarker(t,r)}};Je.prototype=Object.create(P.prototype);var Ye=function(){P.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=C(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.vertexColors=!1,t=M(t));let i=new pe(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};Ye.prototype=Object.create(P.prototype);var Xe=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Xe.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Xe.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Xe.prototype.loadFromImages=async function(e){},Xe.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Xe.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ze=function(){Xe.call(this),this.isTextureArray=!0,this.imageData=void 0,this.setDataTexture=e=>{this.impl=e,console.log(`setDataTexture`,e),this.imageData=e.image.data},this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.Data3DTexture(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ze.prototype=Object.create(Xe.prototype);function Qe(){let t=new e.MeshBasicNodeMaterial({side:e.DoubleSide}),r=new Uint8Array(32),i=new e.Data3DTexture(r,2,2,2);i.image={data:r,width:2,height:2,depth:2},i.format=e.RGBAFormat,i.type=e.UnsignedByteType,i.minFilter=e.LinearFilter,i.magFilter=e.LinearFilter,i.generateMipmaps=!1,i.unpackAlignment=1,i.needsUpdate=!0;let a={brightness:(0,n.uniform)(0),contrast:(0,n.uniform)(1),depth:(0,n.uniform)(1),discardAlpha:(0,n.uniform)(!0),direction:(0,n.uniform)(1),flipY:(0,n.uniform)(!0),flipZ:(0,n.uniform)(!1),nChannels:(0,n.uniform)(1),maskEnabled:(0,n.uniform)(!1),slide:(0,n.uniform)(new e.Vector3(0,0,1)),time:(0,n.uniform)(0)},o=(0,n.varying)((0,n.vec3)(0),`vUw`);a.diffuse0=(0,n.texture3D)(i,o),a.diffuse1=(0,n.texture3D)(i,o),a.mask=(0,n.texture3D)(i,o);let s=(0,n.Fn)(()=>{let e=(0,n.vec3)(n.positionLocal).toVar();return(0,n.If)(a.direction.equal(1),()=>{e.assign((0,n.vec3)(a.slide.x,n.positionLocal.y,n.positionLocal.x))}),(0,n.If)(a.direction.equal(2),()=>{e.assign((0,n.vec3)(n.positionLocal.x,a.slide.y,n.positionLocal.y))}),(0,n.If)(a.direction.equal(3),()=>{e.assign((0,n.vec3)(n.positionLocal.x,n.positionLocal.y,a.slide.z))}),(0,n.If)(a.flipY,()=>{e.y.assign((0,n.float)(1).sub(e.y))}),(0,n.If)(a.flipZ,()=>{e.z.assign((0,n.float)(1).sub(e.z))}),o.assign((0,n.vec3)(e.x,e.y,e.z)),n.positionLocal}),c=(0,n.Fn)(()=>{let e=a.diffuse0.r,t=a.diffuse1.r,r=(0,n.mix)(e,t,a.time).toVar();(0,n.If)(a.maskEnabled.and(a.discardAlpha),()=>{let e=a.mask.r;(0,n.If)(e.equal(0),()=>{(0,n.Discard)()})});let i=(0,n.vec3)(r).add((0,n.vec3)(a.brightness)).sub((0,n.vec3)(.5)).mul(a.contrast).add((0,n.vec3)(.5));return(0,n.vec4)(i,1)});return t.positionNode=s(),t.colorNode=c(),t.userData.uniforms=a,t}var $e=function(e){P.call(this),this.isTexturePrimitive=!0,this.texture=e,this.textureList=[],this.texture&&this.textureList.push(this.texture),this.load=(e,t,n)=>{if(e&&e.images&&e.images.source){let n=new Ze,r=[];e.images.source.forEach(e=>{r.push(e)});let i=this;n.loadFromImages(r).then(()=>{i.texture=n,i.textureList.push(this.texture),i.initialise(e,t)})}},this.addTextureArray=e=>{this.textureList.length===0&&this.texture&&this.textureList.push(this.texture),e&&e.isTextureArray&&this.textureList.push(e)},this.initialise=(e,t)=>{t!=null&&typeof t==`function`&&t(this)}};$e.prototype=Object.create(P.prototype),$e.prototype.constructor=$e;var et=t=>{let n=t.image,r=n.width,i=n.height,a=n.depth,o=n.data,s=new e.Data3DTexture(o,r,i,a);return s.format=t.format,s.type=t.type,s.minFilter=t.minFilter,s.magFilter=t.magFilter,s.wrapS=t.wrapS,s.wrapT=t.wrapT,s.wrapR=t.wrapR,s.needsUpdate=!0,s},tt=function(t){$e.call(this,t),this.isTextureSlides=!0;let n=[],r={};this.morph=new e.Group,this.group=this.morph,this.morph.userData=this;let i,a=!0,o=!1,s=0,c=1,l=1,u,d=!1,f=!0,p=0,m=0,h=-.1;this.createSlides=e=>{e.forEach(e=>this.createSlide(e))};let g=(e,t)=>{let n=e.material.userData.uniforms;switch(e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.position.x=0,e.position.y=0,e.position.z=0,t.direction){case`x`:let r=-Math.PI/2;e.rotation.y=r,n.direction.value=1,n.slide.value.set(t.value,0,0),e.position.x=t.value;break;case`y`:e.rotation.x=Math.PI/2,n.direction.value=2,n.slide.value.set(0,t.value,0),e.position.y=t.value;break;case`z`:n.direction.value=3,n.slide.value.set(0,0,t.value),e.position.z=t.value}this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=e=>{e&&e.id&&e.id in r&&r[e.id]&&g(r[e.id],e)},this.createSlide=t=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&t&&t.direction&&t.value!==void 0){let i=new e.PlaneGeometry(1,1);i.translate(.5,.5,0);let p=Qe();p.userData.uniforms.brightness.value=s,p.userData.uniforms.contrast.value=c,p.userData.uniforms.diffuse0.value=et(this.texture.impl),p.userData.uniforms.diffuse1.value=et(this.texture.impl),p.userData.uniforms.discardAlpha.value=f,p.userData.uniforms.depth.value=this.texture.size.depth,p.userData.uniforms.flipY.value=a,p.userData.uniforms.flipZ.value=o,u&&(p.userData.uniforms.mask.value=u),p.userData.uniforms.maskEnabled.value=d,p.userData.uniforms.nChannels.value=l;let m=new e.Mesh(i,p);m.name=this.groupName,m.userData=this;let h={value:t.value,direction:t.direction,id:m.id};return n.push(h),g(m,h),r[m.id]=m,this.morph.add(m),this.boundingBoxUpdateRequired=!0,this.updateTimeTexture(),h}},this.getTextureSettings=()=>[...n],this.getTextureSettingsWithId=e=>{for(let t=0;t<n.length;t++)if(e===n[t].id)return{...n[t]}},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=e=>{e&&this.removeSlideWithId(e.id)},this.removeSlideWithId=e=>{if(this.morph&&e in r&&r[e]){if(this.morph.getObjectById(e)){let t=r[e];this.morph.remove(t),t.clear(),t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose(),this.boundingBoxUpdateRequired=!0}let t=n.findIndex(t=>t.id===e);t>-1&&n.splice(t,1)}},this.dispose=()=>{this.morph.children.forEach(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),$e.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0};let _=(e,t,n)=>{if(t)switch(t.direction.value){case 1:n.copy(t.slide.value),e.expandByPoint(n),n.setY(1),n.setZ(1),e.expandByPoint(n);break;case 2:n.copy(t.slide.value),e.expandByPoint(n),n.setX(1),n.setZ(1),e.expandByPoint(n);break;case 3:n.copy(t.slide.value),e.expandByPoint(n),n.setX(1),n.setY(1),e.expandByPoint(n)}};this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();let t=new e.Vector3(0,0,0);this.morph.children.forEach(e=>{_(this.cachedBoundingBox,e.material.userData.uniforms,t)}),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(t,n,r)=>{let i=new e.Matrix4;i.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,0);let a=new e.Quaternion().setFromRotationMatrix(i);this.morph.position.set(...n),this.morph.quaternion.copy(a),this.morph.scale.set(...r),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=e=>{this.morph.renderOrder=e},this.initialise=(e,t)=>{if(e){let n=e.locations;n&&n.length>0&&(this.applyTransformation(n[0].orientation,n[0].position,n[0].scale),`flipY`in n[0]&&(a=n[0].flipY),`flipZ`in n[0]&&(o=n[0].flipZ)),this.createSlides(e.settings.slides),t!=null&&typeof t==`function`&&t(this)}},this.showEdges=t=>{if(i)i.material.color=t;else{let n=new e.BoxGeometry(1,1,1);n.translate(.5,.5,.5);let r=new e.EdgesGeometry(n);i=new e.LineSegments(r,new e.LineBasicMaterial({color:t})),this.group.add(i)}i.visible=!0},this.setUniformsValue=(e,t)=>{this.morph.children.forEach(n=>{let r=n.material;if(r.userData.uniforms){let n=r.userData.uniforms;n[e].value=t}})},this.isAlphaPixelDiscarded=()=>f,this.discardAlphaPixel=e=>{f=e,this.setUniformsValue(`discardAlpha`,f)},this.getBrightness=()=>s,this.setBrightness=e=>{s=e,this.setUniformsValue(`brightness`,s)},this.getContrast=()=>c,this.setContrast=e=>{c>=0&&(c=e,this.setUniformsValue(`contrast`,c))},this.getNumberOfChannels=()=>l,this.setNumberOfChannels=e=>{l=e,this.setUniformsValue(`nChannels`,l)},this.getMask=()=>u,this.setMask=e=>{u=e,d=!!u,this.morph.children.forEach(e=>{let t=e.material;if(t.userData.uniforms){let e=t.userData.uniforms;u&&(e.mask.value=u)}}),this.setUniformsValue(`maskEnabled`,d)},this.hideEdges=()=>{i&&(i.visible=!1)},this.updateTimeTexture=()=>{let e=this.textureList.length-1,t=this.inbuildTime/this.duration;if(this.timeEnabled&&e>0&&h!==t){let n=t*e,r=Math.floor(n),i=Math.ceil(n),a=n-r;this.morph.children.forEach(e=>{let t=e.material;if(t.userData.uniforms){let e=t.userData.uniforms;p!==r&&(e.diffuse0.value.image.data=this.textureList[r].imageData,e.diffuse0.value.needsUpdate=!0),m!==i&&(e.diffuse1.value.image.data=this.textureList[i].imageData,e.diffuse1.value.needsUpdate=!0),e.time.value=a}}),p=r,m=i,h=t}},this.setMorphTime=e=>{let t=e;t=e>this.duration?this.duration:0>e?0:e,t!=this.inbuildTime&&(this.inbuildTime=t,this.updateTimeTexture())},this.render=(e,t,n)=>{if(t==1&&this.timeEnabled&&this.textureList.length>1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,this.updateTimeTexture()}}};tt.prototype=Object.create($e.prototype),tt.prototype.constructor=tt;var nt=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];let e=this;this.setFromObject=({nearPlane:t,farPlane:n,eyePosition:r,targetPosition:i,upVector:a})=>{e.nearPlane=t,e.farPlane=n,e.eyePosition=r,e.targetPosition=i,e.upVector=a}},rt=function(t,n,r,i){let a={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},o={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},s={NONE:-1,FREE:1,HORIZONTAL:2,VERTICAL:3},c={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},l={};l.MAIN=o.ROTATE,l.AUXILIARY=o.ZOOM,l.SECONDARY=o.PAN,this.cameraObject=t,this.domElement=n===void 0?document:n,this.renderer=r,this.scene=i,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;let u=6e3,d=!0,f=0,p,m,h=!1,g=500,_,v=`default`,y=a.DEFAULT,b,x,S,C=0,w=s.FREE;this._state=o.NONE;let T;this.targetTouchId=-1;let E,D=new e.Vector3,O=new e.Vector3,k=new e.Vector3,A=new e.Vector3,ee=new e.Vector3,j=new e.Vector3,M=new e.Vector3,N=new e.Vector3,te=new e.Sphere,ne=new e.Vector3,re=!1,ie,ae=0,oe={default:new nt};oe.default.nearPlane=.1,oe.default.farPlane=2e3,oe.default.eyePosition=[0,0,0],oe.default.targetPosition=[0,0,-1],oe.default.upVector=[0,1,0],this.cameraObject.target===void 0&&(this.cameraObject.target=new e.Vector3(...oe.default.targetPosition)),this.calculateMaxAllowedDistance=e=>{let t=e.getBoundingBox();if(t){t.getBoundingSphere(te),ae=te.radius*6;let e=0;this.cameraObject&&(e=this.cameraObject.position.distanceTo(te.center)),ae=e>ae?e*1.5:ae}else ae=0};let se=e=>{D.copy(this.cameraObject.position);let t=D.sub(this.cameraObject.target).length();this.cameraObject.near=Math.max(1e-4,t*.001),this.cameraObject.far=this.cameraObject.near*1e4};this.addViewport=(e,t)=>{e&&t&&(oe[e]=t)},this.setDefaultViewport=e=>e&&e in oe?(v=e,!0):!1,this.getDefaultViewport=()=>v,this.getViewportOfName=e=>oe[e],this.setCurrentViewport=e=>e in oe&&(this.setCurrentCameraSettings(oe[e]),!0),this.setRotationMode=e=>{switch(e){case`none`:w=s.NONE;break;case`horizontal`:w=s.HORIZONTAL;break;case`vertical`:w=s.VERTICAL;break;default:w=s.FREE}},this.onResize=()=>{E&&=void 0,ie&&ie.setCurrentCameraSettings(this.cameraObject,oe[v])},this.getVisibleHeightAtZDepth=e=>{let t=this.cameraObject.position.distanceTo(this.cameraObject.target);e<t?e-=t:e+=t;let n=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(n/2)*Math.abs(e)},this.calculateHeightPerPixelAtZeroDepth=e=>{let t=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=t/e,this.pixelHeight},this.getNDCFromDocumentCoords=(t,n,r)=>{ye(!1);let i=r||new e.Vector2,a=(t-E.left)/E.width*2-1,o=-((n-E.top)/E.height)*2+1;return i.set(a,o)},this.getRelativeCoordsFromNDC=(t,n,r)=>{ye(!1);let i=r||new e.Vector2;return i.x=(t+1)*E.width/2,i.y=(1-n)*E.height/2,i},this.setMouseButtonAction=(e,t)=>{l[e]=o[t]};let ce=(e,t)=>{e instanceof HTMLCanvasElement&&(e.tabIndex=t)},le=()=>{if(ae>0){let e=ne.distanceTo(te.center);return ae>e||this.cameraObject.position.distanceTo(te.center)>e}return!0},ue=e=>{ne.copy(this.cameraObject.position).add(e),le()&&(this.cameraObject.target.add(e),this.cameraObject.position.add(e),this.updateDirectionalLight())},de=e=>{ye(!1);let t;if(y===a.DEFAULT&&(t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e)),!t)e.button==0?this._state=e.ctrlKey?l.AUXILIARY:e.shiftKey?l.SECONDARY:l.MAIN:e.button==1?(e.preventDefault(),this._state=l.AUXILIARY):e.button==2&&(this._state=l.SECONDARY),this.pointer_x=e.clientX-E.left,this.pointer_y=e.clientY-E.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else{y=a.MINIMAP;let e=this.scene.getMinimapDiffFromNormalised(t.x,t.y);ue(e)}},fe=e=>{if(ye(!1),E){if(this.pointer_x=e.clientX-E.left,this.pointer_y=e.clientY-E.top,y===a.MINIMAP){let t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e);if(t){let e=this.scene.getMinimapDiffFromNormalised(t.x,t.y);ue(e)}}else this._state===o.NONE&&T!==void 0&&T.move(this,e.clientX,e.clientY,this.renderer)}},pe=e=>{this._state=o.NONE,y==a.MINIMAP&&(y=a.DEFAULT),T!==void 0&&this.pointer_x_start==e.clientX-E.left&&this.pointer_y_start==e.clientY-E.top&&T.pick(this,e.clientX,e.clientY,this.renderer)},me=e=>{this._state=o.NONE},he=e=>{ye(!1);let t=e.touches.length;if(t==1)this._state=o.TOUCH_ROTATE,this.pointer_x=e.touches[0].clientX-E?.left,this.pointer_y=e.touches[0].clientY-E?.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(t==2){this._state=o.TOUCH_ZOOM;let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(t*t+n*n)}else t==3&&(this._state=o.TOUCH_PAN,this.targetTouchId=e.touches[0].identifier,this.pointer_x=e.touches[0].clientX-E?.left,this.pointer_y=e.touches[0].clientY-E?.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ge=e=>{e.preventDefault(),e.stopPropagation();let t=e.touches.length;if(t==1)this.pointer_x=e.touches[0].clientX-E.left,this.pointer_y=e.touches[0].clientY-E.top;else if(t==2){if(this._state===o.TOUCH_ZOOM){let t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(t*t+n*n)}}else if(t==3&&this._state===o.TOUCH_PAN)for(let t=0;t<3;t++)e.touches[t].identifier==this.targetTouchId&&(this.pointer_x=e.touches[0].clientX-E.left,this.pointer_y=e.touches[0].clientY-E.top)},_e=e=>{let t=e.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=o.NONE,t==1&&T!==void 0&&this.pointer_x_start==e.touches[0].clientX-E.left&&this.pointer_y_start==e.touches[0].clientY-E.top&&T.pick(this.cameraObject,e.touches[0].clientX,e.touches[0].clientY,this.renderer)},ve=()=>{ye(!0)},ye=e=>{if(e||E===void 0){let e=new IntersectionObserver(t=>{for(let e of t)E=e.boundingClientRect;e.disconnect()});e.observe(this.domElement)}},be=e=>{ye(!1),this._state=o.SCROLL;let t=0;e.deltaY>0?t=this.zoomRate:e.deltaY<0&&(t=this.zoomRate*-1),C+=t,e.preventDefault(),e.stopImmediatePropagation()},P=e=>{ye(!1);let t=0;if(e.keyCode===c.EQUAL||e.keyCode===c.MINUS||e.keyCode===c.NUMPADADD||e.keyCode===c.NUMPADSUBTRACT){this._state=o.KEYBOARD_ZOOM;let n=1;e.shiftKey&&(n*=2),e.keyCode===c.EQUAL||e.keyCode===c.NUMPADADD?t=this.zoomRate*n*-1:(e.keyCode===c.MINUS||e.keyCode===c.NUMPADSUBTRACT)&&(t=this.zoomRate*n),C+=t}else(e.keyCode===c.ARROWLEFT||e.keyCode===c.ARROWUP||e.keyCode===c.ARROWRIGHT||e.keyCode===c.ARROWDOWN)&&(e.shiftKey?(this._state=o.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,t=this.rotateRate):(this._state=o.KEYBOARD_PAN,t=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,e.keyCode===c.ARROWLEFT?this.pointer_x-=t:e.keyCode===c.ARROWUP?this.pointer_y-=t:e.keyCode===c.ARROWRIGHT?this.pointer_x+=t:e.keyCode===c.ARROWDOWN&&(this.pointer_y+=t));Object.values(c).includes(e.keyCode)&&e.preventDefault()},xe=e=>{this._state=o.NONE},Se=()=>{if(this.cameraObject!==void 0){let e=E.height,t=this.cameraObject.position.distanceTo(this.cameraObject.target),n=0;this.cameraObject.far>this.cameraObject.near&&t>=this.cameraObject.near&&t<=this.cameraObject.far&&(n=(t-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),O.set(this.previous_pointer_x,e-this.previous_pointer_y,0),k.set(this.previous_pointer_x,e-this.previous_pointer_y,1),A.set(this.pointer_x,e-this.pointer_y,0),ee.set(this.pointer_x,e-this.pointer_y,1),O.unproject(this.cameraObject),k.unproject(this.cameraObject),A.unproject(this.cameraObject),ee.unproject(this.cameraObject),A.sub(O).multiplyScalar(1-n),ee.sub(k).multiplyScalar(n),A.add(ee).multiplyScalar(-.002),ue(A)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(e,t)=>{e.normalize(),M.copy(this.cameraObject.position).sub(this.cameraObject.target),N.copy(M),M.normalize(),.8<Math.abs(M.dot(e))&&M.copy(this.cameraObject.up),O.crossVectors(e,M).normalize(),k.crossVectors(e,O);let n=e.dot(N),r=O.dot(N),i=k.dot(N),a=e.dot(this.cameraObject.up),o=O.dot(this.cameraObject.up),s=k.dot(this.cameraObject.up),c=Math.cos(t),l=Math.sin(t);return A.set(c*O.x+l*k.x,c*O.y+l*k.y,c*O.z+l*k.z),ee.set(c*k.x-l*O.x,c*k.y-l*O.y,c*k.z-l*O.z),M.copy(this.cameraObject.target),M.x=M.x+e.x*n+A.x*r+ee.x*i,M.y=M.y+e.y*n+A.y*r+ee.y*i,M.z=M.z+e.z*n+A.z*r+ee.z*i,D.set(e.x*a+A.x*o+ee.x*s,e.y*a+A.y*o+ee.y*s,e.z*a+A.z*o+ee.z*s),{position:M,up:D}},this.rotateAboutLookAtpoint=(e,t)=>{let n=this.getVectorsFromRotateAboutLookAtPoints(e,t);this.cameraObject.position.copy(n.position),this.updateDirectionalLight(),this.cameraObject.up.copy(n.up)};let Ce=()=>{if(this.cameraObject!==void 0){let e=E?.width,t=E?.height;if(0<e&&0<t){let n=.25*(e+t),r=0,i=0;(w===s.FREE||w===s.HORIZONTAL)&&(r=this.pointer_x-this.previous_pointer_x),(w===s.FREE||w===s.VERTICAL)&&(i=this.previous_pointer_y-this.pointer_y);let a=Math.sqrt(r*r+i*i);if(a>0){let o=-i*1/a,c=r*1/a;if(w===s.FREE){let r=o*(this.pointer_x-.5*(e-1))+c*(.5*(t-1)-this.pointer_y);r>n?r=n:r<-n&&(r=-n)}let l=Math.acos(0/n)-.5*Math.PI,u=this.tumble_rate*a/n;D.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),O.copy(this.cameraObject.up).normalize(),k.copy(O).cross(D).normalize().multiplyScalar(o),O.multiplyScalar(c),j.addVectors(k,O).multiplyScalar(Math.cos(l)),D.multiplyScalar(Math.sin(l)),j.add(D),this.rotateAboutLookAtpoint(j,-u)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},we=()=>{let e=0;return this._state===o.ZOOM?e=this.previous_pointer_y-this.pointer_y:this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM?e=C:(e=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),e};this.changeZoomByScrollRateUnit=e=>{let t=e*this.zoomRate;this.changeZoomByValue(t)},this.changeZoomByValue=e=>{if(this.cameraObject!==void 0){let t=E.height,n=this.cameraObject.position.clone();n.sub(this.cameraObject.target);let r=n.length(),i=r*(1.5*e/t);r+i>.01&&(n.normalize(),ne.copy(this.cameraObject.position),ne.x+=n.x*i,ne.y+=n.y*i,ne.z+=n.z*i,le()&&(this.cameraObject.position.copy(ne),this.updateDirectionalLight(),se(i),re=!0))}};let Te=()=>{let e=we();this.changeZoomByValue(e),this._state===o.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(C=0,this._state=o.NONE)};this.setDirectionalLight=e=>{this.directionalLight=e},this.updateDirectionalLight=()=>{this.directionalLight!=0&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){d=!0,this.domElement&&this.domElement.addEventListener&&(ce(this.domElement,0),this.domElement.addEventListener(`mousedown`,de,!1),this.domElement.addEventListener(`mousemove`,fe,!1),this.domElement.addEventListener(`mouseup`,pe,!1),this.domElement.addEventListener(`mouseleave`,me,!1),this.domElement.addEventListener(`touchstart`,he,!1),this.domElement.addEventListener(`touchmove`,ge,!1),this.domElement.addEventListener(`touchend`,_e,!1),this.domElement.addEventListener(`wheel`,be,!1),this.domElement.addEventListener(`mouseenter`,ve,!1),this.domElement.addEventListener(`contextmenu`,e=>{e.preventDefault()},!1),this.domElement.addEventListener(`keydown`,P,!1),this.domElement.addEventListener(`keyup`,xe,!1))},this.disable=function(){d=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener(`mousedown`,de,!1),this.domElement.removeEventListener(`mousemove`,fe,!1),this.domElement.removeEventListener(`mouseup`,pe,!1),this.domElement.removeEventListener(`mouseleave`,me,!1),this.domElement.removeEventListener(`touchstart`,he,!1),this.domElement.removeEventListener(`touchmove`,ge,!1),this.domElement.removeEventListener(`touchend`,_e,!1),this.domElement.removeEventListener(`wheel`,be,!1),this.domElement.removeEventListener(`mouseenter`,ve,!1),this.domElement.removeEventListener(`contextmenu`,e=>{e.preventDefault()},!1),this.domElement.removeEventListener(`keydown`,P,!1),this.domElement.removeEventListener(`keyup`,xe,!1),ce(this.domElement,-1))},this.loadPath=e=>{p=e.CameraPath,m=e.NumberOfPoints},this.loadPathURL=(e,t)=>{let n=e;fetch(n).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{this.loadPath(e),t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Failed to load path asset from: ${n}`,e)})},this.setPathDuration=e=>{u=e,b&&b.setDuration(u),x&&x.setDuration(u)},this.getPlayRate=()=>g,this.setPlayRate=e=>{g=e};let Ee=e=>{let t=f+e;t>u&&(t-=u),f=t};this.getTime=()=>f,this.setTime=e=>{f=e>u?u:e<0?0:e},this.getNumberOfTimeFrame=()=>m,this.getCurrentTimeFrame=()=>{if(m>2){let e=f/u*(m-1),t=Math.floor(e),n=1-(e-t),r=Math.ceil(e);return t==r?t==m-1?[t-1,r,0]:[t,r+1,1]:[t,r,n]}if(m==1)return[0,0,0]},this.setCurrentTimeFrame=e=>{m>2&&(f=u*e/(m-1),f<0&&(f=0),f>u&&(f=u))};let De=e=>{if(y===a.PATH&&(Ee(e),p)){let e=this.getCurrentTimeFrame(),t=e[0],n=e[1],r=e[2],i=[p[t*3],p[t*3+1],p[t*3+2]],a=[p[n*3],p[n*3+1],p[n*3+2]],o=[];for(let e=0;e<i.length;e++)o.push(r*i[e]+(1-r)*a[e]);this.cameraObject.position.set(o[0],o[1],o[2]),this.cameraObject.target.set(a[0],a[1],a[2]),_&&this.cameraObject.lookAt(this.cameraObject.target),h&&(this.directionalLight.position.set(o[0],o[1],o[2]),this.directionalLight.target.position.set(a[0],a[1],a[2]))}};this.calculatePathNow=()=>{De(0)};let Oe=()=>{this._state===o.ROTATE||this._state===o.TOUCH_ROTATE||this._state===o.KEYBOARD_ROTATE?Ce():this._state===o.PAN||this._state===o.TOUCH_PAN||this._state===o.KEYBOARD_PAN?(Se(),ie.triggerCallback()):(this._state===o.ZOOM||this._state===o.TOUCH_ZOOM||this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(ie.zoom(we()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&(this._state=o.NONE),C=0,ie.triggerCallback())};this.update=e=>{let t=e*g,n=d,r=!0;return y===a.PATH?De(t):y===a.SMOOTH_CAMERA_TRANSITION&&b?(b.update(t),b.isTransitionCompleted()&&(y=a.DEFAULT),n=!1):y===a.ROTATE_CAMERA_TRANSITION&&x?(x.update(t),x.isTransitionCompleted()&&(y=a.DEFAULT),n=!1):y===a.AUTO_TUMBLE&&S?S.update(t):y===a.SYNC_CONTROL&&ie?(Oe(),n=!1):r=!1,n&&(this._state!==o.NONE&&(r=!0),this._state===o.ROTATE||this._state===o.TOUCH_ROTATE||this._state===o.KEYBOARD_ROTATE?Ce():this._state===o.PAN||this._state===o.TOUCH_PAN||this._state===o.KEYBOARD_PAN?Se():(this._state===o.ZOOM||this._state===o.TOUCH_ZOOM||this._state===o.SCROLL||this._state===o.KEYBOARD_ZOOM)&&Te(),this._state!==o.NONE&&y===a.AUTO_TUMBLE&&S&&S.stopOnCameraInput,this._state===o.SCROLL&&(this._state=o.NONE)),_?(r=!0,_.update()):this.cameraObject.lookAt(this.cameraObject.target),r||=re,re=!1,r},this.playPath=()=>{y=a.PATH},this.stopPath=()=>{y=a.DEFAULT},this.isPlayingPath=()=>y===a.PATH,this.enableDirectionalLightUpdateWithPath=e=>{h=e},this.enableDeviceOrientation=()=>{_||=new ut(this.cameraObject)},this.disableDeviceOrientation=()=>{_&&=(_.dispose(),void 0)},this.isDeviceOrientationEnabled=()=>!!_,this.resetView=()=>{let e=oe[v];this.cameraObject.near=e.nearPlane,this.cameraObject.far=e.farPlane,this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=e=>{e.nearPlane&&(this.cameraObject.near=e.nearPlane),e.farPlane&&(this.cameraObject.far=e.farPlane),e.eyePosition&&this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),e.targetPosition&&this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),e.upVector&&this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),re=!0},this.getViewportFromCentreAndRadius=(e,t,n,r,i,a)=>{D.copy(this.cameraObject.position),D.sub(this.cameraObject.target),D.normalize();let o=[e,t,n],s=r/Math.tan(i*Math.PI/360),c=[e+D.x*s,t+D.y*s,n+D.z*s],l=s+a,u=0;u=a>.95*s?.050000000000000044*s:s-a;let d=new nt;return d.nearPlane=u,d.farPlane=l,d.eyePosition=c,d.targetPosition=o,d.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],d},this.getViewportFromBoundingBox=(e,t)=>{let n=e.min.distanceTo(e.max)/2*t,r=(e.min.x+e.max.x)/2,i=(e.min.y+e.max.y)/2,a=(e.min.z+e.max.z)/2;return this.getViewportFromCentreAndRadius(r,i,a,n,40,n*4)},this.getCurrentViewport=()=>{let e=new nt;return e.nearPlane=this.cameraObject.near,e.farPlane=this.cameraObject.far,e.eyePosition[0]=this.cameraObject.position.x,e.eyePosition[1]=this.cameraObject.position.y,e.eyePosition[2]=this.cameraObject.position.z,e.targetPosition[0]=this.cameraObject.target.x,e.targetPosition[1]=this.cameraObject.target.y,e.targetPosition[2]=this.cameraObject.target.z,e.upVector[0]=this.cameraObject.up.x,e.upVector[1]=this.cameraObject.up.y,e.upVector[2]=this.cameraObject.up.z,e},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(e,t,n)=>{x??(b=new it(e,t,this,n))},this.rotateCameraTransition=(e,t,n)=>{b??(x=new at(e,t,this,n))},this.enableCameraTransition=()=>{b&&(y=a.SMOOTH_CAMERA_TRANSITION),x&&(y=a.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{y=a.DEFAULT},this.stopCameraTransition=()=>{y=a.DEFAULT,b=void 0,x=void 0},this.isTransitioningCamera=()=>y===a.SMOOTH_CAMERA_TRANSITION||y===a.ROTATE_CAMERA_TRANSITION,this.autoTumble=(e,t,n)=>{S=new st(e,t,n,this)},this.enableAutoTumble=()=>{y=a.AUTO_TUMBLE},this.stopAutoTumble=()=>{y=a.DEFAULT,S=void 0},this.updateAutoTumble=()=>{S&&(S.requireUpdate=!0)},this.isAutoTumble=()=>y===a.AUTO_TUMBLE,this.enableRaycaster=(e,t,n)=>{T??=new ot(e,this.scene,t,n,this.renderer)},this.disableRaycaster=()=>{T.disable(),T=void 0},this.isSyncControl=()=>currentMpde===a.SYNC_CONTROL,this.enableSyncControl=()=>(y=a.SYNC_CONTROL,ie||=new dt,ie.setCurrentCameraSettings(this.cameraObject,oe[v]),ie),this.disableSyncControl=()=>{y=a.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},it=function(e,t,n,r){let i=e.eyePosition,a=e.targetPosition,o=e.upVector,s=t.eyePosition,c=t.targetPosition,l=t.upVector,u=n,d=r,f=0,p=!1;u.near=Math.min(e.nearPlane,t.nearPlane),u.far=Math.max(e.farPlane,t.farPlane),u.cameraObject.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),this.setDuration=e=>{d=e};let m=e=>{let t=f+e;t>d&&(t=d),f=t},h=()=>{let e=f/d,t=[i[0]*(1-e)+s[0]*e,i[1]*(1-e)+s[1]*e,i[2]*(1-e)+s[2]*e],n=[a[0]*(1-e)+c[0]*e,a[1]*(1-e)+c[1]*e,a[2]*(1-e)+c[2]*e];o[0]*(1-e)+l[0]*e,o[1]*(1-e)+l[1]*e,o[2]*(1-e)+l[2]*e,u.cameraObject.position.set(t[0],t[1],t[2]),u.cameraObject.target.set(n[0],n[1],n[2])};this.update=e=>{this.enabled!==!1&&(m(e),h(),f==d&&(p=!0))},this.isTransitionCompleted=()=>p},at=function(e,t,n,r){let i=e,a=t,o=n,s=r,c=0;c/s;let l=!1;this.setDuration=e=>{s=e};let u=e=>{let t=c,n=c+e;n>s&&(n=s),c=n;let r=(c-t)/s*a;o.rotateAboutLookAtpoint(i,r)};this.update=e=>{this.enabled!==!1&&(u(e),c==s&&(l=!0))},this.isTransitionCompleted=()=>l},ot=function(t,n,r,i,a){let o=t,s=n,c=a,l=r,u=i,d=!0,f=new e.Raycaster;f.params.Line.threshold=.1,f.params.Points.threshold=1;let p=new e.Vector2,m=!1,h=new Date,g=!1,_=0,v=[],y={zincCamera:void 0,x:-1,y:-1},b;this.enable=()=>{d=!0},this.disable=()=>{d=!1},this.getIntersectsObject=e=>{if(s!==o){let t=o.getThreeJSScene();c.render(t,e.cameraObject)}let t=b||o.getPickableThreeJSObjects();return v.length=0,f.intersectObjects(t,!0,v)},this.setPickableObjects=e=>{e===void 0?b=void 0:(b=[],e.forEach(e=>{e.getGroup()&&e.getGroup().visible&&b.push(e.getGroup())}))},this.getIntersectsObjectWithOrigin=(e,t,n)=>(f.set(t,n),this.getIntersectsObject(e)),this.getIntersectsObjectWithCamera=(e,t,n)=>(e.getNDCFromDocumentCoords(t,n,p),f.setFromCamera(p,e.cameraObject),this.getIntersectsObject(e)),this.pick=(e,t,n)=>{if(d&&c&&o&&e&&l){this.getIntersectsObjectWithCamera(e,t,n);let r=v.length;for(let e=0;e<r;e++){let t=v[e].object?v[e].object.userData:void 0;if(t&&t.isMarkerCluster&&t.visible&&t.clusterIsVisible(v[e].object.clusterIndex)&&t.zoomToCluster(v[e].object.clusterIndex))return}l(v,t,n)}};let x=(e,t,n)=>{if(d&&c&&o&&e&&u){if(this.getIntersectsObjectWithCamera(e,t,n),h.setTime(Date.now()),v.length===0){if(g)return;g=!0}else g=!1;u(v,t,n)}};this.move=(e,t,n)=>{d&&c&&o&&e&&u&&(o.displayMarkers?x(e,t,n):(y.zincCamera=e,y.x=t,y.y=n,m||(_=h?Date.now()-h.getTime():250,_>=250?x(e,t,n):(m=!0,setTimeout(S(y),_)))))};let S=e=>function(){m=!1,x(e.zincCamera,e.x,e.y)}},st=function(t,n,r,i){let a=new e.Vector3,o=-n,s=i,c=t;this.stopOnCameraInput=r,this.requireUpdate=!0;let l=new e.Vector3,u=new e.Vector3,d=e=>{let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=.25*(Math.abs(e[0])*4+Math.abs(e[1])*4),r=-e[1]/t,i=e[0]/t,o=r*e[0]+i*-e[1];o>n?o=n:o<-n&&(o=-n);let c=Math.acos(o/n)-.5*Math.PI;a.copy(s.cameraObject.position).sub(s.cameraObject.target).normalize(),l.copy(s.cameraObject.up).normalize(),u.crossVectors(l,a).normalize().multiplyScalar(r),l.multiplyScalar(i),l.add(u).multiplyScalar(Math.cos(c)),a.multiplyScalar(Math.sin(c)).add(l)};this.update=e=>{this.enabled!==!1&&(this.requireUpdate&&=(d(c),!1),s.rotateAboutLookAtpoint(a,o*e/1e3))}},ct=function(){this.type=`StereoCamera`,this.aspect=1,this.cameraL=new e.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new e.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(ct.prototype,{update:(()=>{let t,n,r,i,a,o,s=new e.Matrix4,c=new e.Matrix4;return function(l){if(t!==l.focus||n!==l.fov||r!==l.aspect*this.aspect||i!==l.near||a!==l.far||o!==l.zoom){t=l.focus,n=l.fov,r=l.aspect*this.aspect,i=l.near,a=l.far,o=l.zoom;let u=l.projectionMatrix.clone(),d=.064/2,f=d*i/t,p=i*Math.tan(e.Math.DEG2RAD*n*.5)/l.zoom,m,h;c.elements[12]=-.032,s.elements[12]=d,m=-p*r+f,h=p*r+f,u.elements[0]=2*i/(h-m),u.elements[8]=(h+m)/(h-m),this.cameraL.projectionMatrix.copy(u),m=-p*r-f,h=p*r-f,u.elements[0]=2*i/(h-m),u.elements[8]=(h+m)/(h-m),this.cameraR.projectionMatrix.copy(u)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(s)}})()});var lt=function(e){let t=new ct;t.aspect=.5,this.setSize=(t,n)=>{e.setSize(t,n)},this.render=(n,r)=>{n.updateMatrixWorld(),r.parent===null&&r.updateMatrixWorld(),t.update(r);let i=e.getSize();e.setScissorTest(!0),e.clear(),e.setScissor(0,0,i.width/2,i.height),e.setViewport(0,0,i.width/2,i.height),e.render(n,t.cameraL),e.setScissor(i.width/2,0,i.width/2,i.height),e.setViewport(i.width/2,0,i.width/2,i.height),e.render(n,t.cameraR),e.setScissorTest(!1)}},ut=function(t){let n=this;this.object=t,this.object.rotation.reorder(`YXZ`),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;let r=e=>{n.deviceOrientation=e},i=()=>{typeof window<`u`&&(n.screenOrientation=window.orientation||0)},a=(()=>{let t=new e.Vector3(0,0,1),n=new e.Euler,r=new e.Quaternion,i=new e.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return(a,o,s,c,l)=>{let u=new e.Vector3(0,0,1);u.subVectors(a.target,a.position),n.set(s,o,-c,`YXZ`);let d=new e.Quaternion;d.setFromEuler(n),d.multiply(i),d.multiply(r.setFromAxisAngle(t,-l)),u.applyQuaternion(d),u.addVectors(a.position,u),a.lookAt(u)}})();this.connect=()=>{i(),typeof window<`u`&&(window.addEventListener(`orientationchange`,i,!1),window.addEventListener(`deviceorientation`,r,!1)),n.enabled=!0},this.disconnect=()=>{typeof window<`u`&&(window.removeEventListener(`orientationchange`,i,!1),window.removeEventListener(`deviceorientation`,r,!1)),n.enabled=!1},this.update=()=>{if(n.enabled===!1)return;let t=n.deviceOrientation.alpha?e.Math.degToRad(n.deviceOrientation.alpha):0,r=n.deviceOrientation.beta?e.Math.degToRad(n.deviceOrientation.beta):0,i=n.deviceOrientation.gamma?e.Math.degToRad(n.deviceOrientation.gamma):0,o=n.screenOrientation?e.Math.degToRad(n.screenOrientation):0;a(n.object,t,r,i,o)},this.dispose=function(){this.disconnect()},this.connect()},dt=function(){let t,n,r,i=new e.Vector3,a=new e.Vector3,o=new e.Vector3,s=new e.Vector3,c;this.setCurrentCameraSettings=(o,s)=>{this.near_plane_fly_debt,t=o.clone(),n=o,r=s,t.near=r.nearPlane,r.farPlane&&(t.far=r.farPlane),r.eyePosition&&t.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&t.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&(t.target=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),t.lookAt(t.target)),t.updateProjectionMatrix(),i.copy(t.position).project(t),a.copy(t.target).project(t)},this.getCurrentPosition=()=>(a.copy(n.target).project(t),[a.x,a.y]),this.zoom=e=>{let t=e*.002,r=Math.max(n.zoom-t,1);n.zoom=r,n.updateProjectionMatrix()},this.zoomToBox=(e,n)=>{e.getCenter(o),o.project(t),this.setCenterZoom([o.x,o.y],n)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:n.zoom}),this.setCenterZoom=(e,r)=>{o.set(e[0],e[1],a.z).unproject(t),s.copy(o).sub(n.target),n.target.copy(o),n.lookAt(n.target),n.position.add(s),n.zoom=r,n.updateProjectionMatrix()},this.setEventCallback=e=>{(e===void 0||typeof e==`function`)&&(c=e)},this.triggerCallback=()=>{c!==void 0&&typeof c==`function`&&c()}},ft=new e.TextureLoader().load(`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,165,0);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`);ft.colorSpace=e.SRGBColorSpace;var pt=[.02,.03,1],mt=new e.SpriteMaterial({map:ft,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),ht=function(t){P.call(this),this.texture=ft;let n=t;this.morph=new e.Group,this.group=this.morph,this.isMarkerCluster=!0;let r=!0,i=[];this.markers={};let a=new e.Vector2,o=new e.Vector2,s=Date.now();this.setSpriteSize=e=>{(void 0).scale.set(.015,.02,1),(void 0).scale.multiplyScalar(e)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};let c=t=>{let n=new e.Group,r=new e.Sprite(mt);return r.clusterIndex=t,r.center.set(.5,0),r.position.set(0,0,0),r.renderOrder=1e4,r.scale.set(pt[0],pt[1],pt[2]),r.userData=this,n.add(r),this.group.add(n),{group:n,marker:r,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},l=(e,t,n)=>{e.group.visible=!0,e.group.position.set(t.coords[0],t.coords[1],t.coords[2]),(e.label===void 0||n!==e.number)&&(e.label&&(e.group.remove(e.label),e.label.material.map.dispose(),e.label.material.dispose()),e.label=O(n,.012,`black`,`Asap`,120,700),e.label.renderOrder=10001,e.number=n,e.group.add(e.label)),e.min=t.min,e.max=t.max},u=e=>{let t=0;for(e.forEach(e=>{let n=e.members.length,r=0;n===1?e.members[0].setVisibility(!0):(e.members.forEach(e=>{r+=e.getNumber(),e.setVisibility(!1)}),i[t]||i.push(c(t)),l(i[t],e,r),t++)});t<i.length;t++)i[t].group.visible=!1},d=(e,t)=>{let n=!0,r={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]},i=0;for(let s in e)n?(a.set(e[s].ndc.x,e[s].ndc.y),this._b1.setFromPoints([e[s].morph.position]),n=!1,r.members.push(e[s]),r.coords=[e[s].morph.position.x,e[s].morph.position.y,e[s].morph.position.z],t.push(r),delete e[s]):(o.set(e[s].ndc.x,e[s].ndc.y),i=a.distanceTo(o),.1>i&&(r.members.push(e[s]),this._b1.expandByPoint(e[s].morph.position),delete e[s]));r.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],r.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],n!==!0&&d(e,t)};this.calculate=()=>{if(r&&Date.now()-s>500){let e=[];d({...this.markers},e),u(e),s=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>r,this.enable=()=>{r=!0,this.morph.visible=!0},this.disable=()=>{r=!1,this.morph.visible=!1;for(let e in this.markers)this.markers[e]?.isMarker&&this.markers[e].isEnabled()&&this.markers[e].setVisibility(!0)},this.zoomToCluster=e=>e!==void 0&&e>-1&&(this._v1.set(...i[e].min),this._v2.set(...i[e].max),Math.abs(this._v1.distanceTo(this._v2)>0))?(this._b1.set(this._v1,this._v2),n.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0):!1,this.clusterIsVisible=e=>e!==void 0&&e>-1&&i[e]?i[e].group?.visible:!1};ht.prototype=Object.create(P.prototype);var gt=function(t){let n=t;this.camera=new e.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;let r=new e.BufferGeometry;var i=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]);let a=new e.BufferAttribute(i,3);r.setAttribute(`position`,a);var o=new e.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new e.Mesh(r,o);let s=new e.Box3,c=new e.Vector3;this.getDiffFromNormalised=(t,n)=>{s.setFromBufferAttribute(a).getCenter(c);let r=c.clone().project(this.camera);return new e.Vector3(t,n,r.z).unproject(this.camera).sub(c)};let l=(t,r)=>{n.camera.near&&(this.camera.near=n.camera.near),r.farPlane&&(this.camera.far=r.farPlane),r.eyePosition&&this.camera.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&this.camera.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&this.camera.lookAt(new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2])),this.camera.zoom=1/t,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{let t=new e.Vector3().copy(n.camera.target).project(n.camera),r=new e.Vector3(-1,-1,t.z).unproject(n.camera),i=new e.Vector3(1,-1,t.z).unproject(n.camera),o=new e.Vector3(1,1,t.z).unproject(n.camera),s=[r,i,o,o,new e.Vector3(-1,1,t.z).unproject(n.camera),r];ee(a,s)},this.updateCamera=()=>{this.getBoundary();let e=n.getZincCameraControls(),t=n.getBoundingBox();if(t){let n=t.min.distanceTo(t.max),r=n/2,i=(t.min.x+t.max.x)/2,a=(t.min.y+t.max.y)/2,o=(t.min.z+t.max.z)/2,s=e.getViewportFromCentreAndRadius(i,a,o,r,40,r*4);l(n,s)}}},_t=new e.Box3,vt=new e.Vector3,yt=class extends e.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new e.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(t){let n;t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));let r=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceStart`,new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new e.InterleavedBufferAttribute(r,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let n;t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));let r=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceColorStart`,new e.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new e.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new e.Box3);let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;t!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(t),_t.setFromBufferAttribute(n),this.boundingBox.union(_t))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingBox===null&&this.computeBoundingBox();let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(t!==void 0&&n!==void 0){let e=this.boundingSphere.center;this.boundingBox.getCenter(e);let r=0;for(let i=0,a=t.count;i<a;i++)vt.fromBufferAttribute(t,i),r=Math.max(r,e.distanceToSquared(vt)),vt.fromBufferAttribute(n,i),r=Math.max(r,e.distanceToSquared(vt));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}},bt=new e.Vector3,xt=new e.Vector3,St=new e.Vector4,Ct=new e.Vector4,wt=new e.Vector4,Tt=new e.Vector3,Et=new e.Matrix4,Dt=new e.Line3,Ot=new e.Vector3,kt=new e.Box3,At=new e.Sphere,jt=new e.Vector4,Mt=new e.Vector4,Nt,Pt;function Ft(e,t,n){return jt.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),jt.multiplyScalar(1/jt.w),jt.x=Pt/n.width,jt.y=Pt/n.height,jt.applyMatrix4(e.projectionMatrixInverse),jt.multiplyScalar(1/jt.w),Math.abs(Math.max(jt.x,jt.y))}function It(t,n){let r=t.matrixWorld,i=t.geometry,a=i.attributes.instanceStart,o=i.attributes.instanceEnd,s=Math.min(i.instanceCount,a.count);for(let i=0,c=s;i<c;i++){Dt.start.fromBufferAttribute(a,i),Dt.end.fromBufferAttribute(o,i),Dt.applyMatrix4(r);let s=new e.Vector3,c=new e.Vector3;Nt.distanceSqToSegment(Dt.start,Dt.end,c,s),c.distanceTo(s)<Pt*.5&&n.push({point:c,pointOnLine:s,distance:Nt.origin.distanceTo(c),object:t,face:null,faceIndex:i,uv:null,uv1:null})}}function Lt(t,n,r){let i=n.projectionMatrix,a=t.matrixWorld,o=t._resolution,s=t.geometry,c=s.attributes.instanceStart,l=s.attributes.instanceEnd,u=Math.min(s.instanceCount,c.count),d=-n.near;Nt.at(1,wt),wt.w=1,wt.applyMatrix4(n.matrixWorldInverse),wt.applyMatrix4(i),wt.multiplyScalar(1/wt.w),wt.x*=o.x/2,wt.y*=o.y/2,wt.z=0,Tt.copy(wt),Et.multiplyMatrices(n.matrixWorldInverse,a);for(let n=0,s=u;n<s;n++){if(St.fromBufferAttribute(c,n),Ct.fromBufferAttribute(l,n),St.w=1,Ct.w=1,St.applyMatrix4(Et),Ct.applyMatrix4(Et),St.z>d&&Ct.z>d)continue;if(St.z>d){let e=St.z-Ct.z,t=(St.z-d)/e;St.lerp(Ct,t)}else if(Ct.z>d){let e=Ct.z-St.z,t=(Ct.z-d)/e;Ct.lerp(St,t)}St.applyMatrix4(i),Ct.applyMatrix4(i),St.multiplyScalar(1/St.w),Ct.multiplyScalar(1/Ct.w),St.x*=o.x/2,St.y*=o.y/2,Ct.x*=o.x/2,Ct.y*=o.y/2,Dt.start.copy(St),Dt.start.z=0,Dt.end.copy(Ct),Dt.end.z=0;let s=Dt.closestPointToPointParameter(Tt,!0);Dt.at(s,Ot);let u=e.MathUtils.lerp(St.z,Ct.z,s),f=u>=-1&&u<=1,p=Tt.distanceTo(Ot)<Pt*.5;if(f&&p){Dt.start.fromBufferAttribute(c,n),Dt.end.fromBufferAttribute(l,n),Dt.start.applyMatrix4(a),Dt.end.applyMatrix4(a);let i=new e.Vector3,o=new e.Vector3;Nt.distanceSqToSegment(Dt.start,Dt.end,o,i),r.push({point:o,pointOnLine:i,distance:Nt.origin.distanceTo(o),object:t,face:null,faceIndex:n,uv:null,uv1:null})}}}var Rt=class extends e.Mesh{constructor(t=new yt,n=new e.Line2NodeMaterial({color:Math.random()*16777215})){super(t,n),this.isLineSegments2=!0,this.type=`LineSegments2`,this._resolution=new e.Vector2}computeLineDistances(){let t=this.geometry,n=t.attributes.instanceStart,r=t.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let e=0,t=0,a=n.count;e<a;e++,t+=2)bt.fromBufferAttribute(n,e),xt.fromBufferAttribute(r,e),i[t]=t===0?0:i[t-1],i[t+1]=i[t]+bt.distanceTo(xt);let a=new e.InstancedInterleavedBuffer(i,2,1);return t.setAttribute(`instanceDistanceStart`,new e.InterleavedBufferAttribute(a,1,0)),t.setAttribute(`instanceDistanceEnd`,new e.InterleavedBufferAttribute(a,1,1)),this}onBeforeRender(e){e.getViewport(Mt),this._resolution.set(Mt.z,Mt.w)}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.`),n===!1&&(this._resolution.x===0||this._resolution.y===0))return;let i=e.params.Line2===void 0?0:e.params.Line2.threshold||0;Nt=e.ray;let a=this.matrixWorld,o=this.geometry;Pt=this.material.linewidth+i,o.boundingSphere===null&&o.computeBoundingSphere(),At.copy(o.boundingSphere).applyMatrix4(a);let s;if(s=n?Pt*.5:Ft(r,Math.max(r.near,At.distanceToPoint(Nt.origin)),this._resolution),At.radius+=s,Nt.intersectsSphere(At)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),kt.copy(o.boundingBox).applyMatrix4(a);let c;c=n?Pt*.5:Ft(r,Math.max(r.near,kt.distanceToPoint(Nt.origin)),this._resolution),kt.expandByScalar(c),Nt.intersectsBox(kt)!==!1&&(n?It(this,t):Lt(this,r,t))}},zt=function(){Ye.call(this),this.isLines2=!0;let t=Array(300);this.createLineSegment=(e,t,n)=>{if(e&&t){let r=new yt;r.setPositions(e),r.colorsNeedUpdate=!0;let i=new Rt(r,t);i.scale.set(1,1,1),i.computeLineDistances(),this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(e){if(e&&e.length){let n=this.getMorph();n||(this.drawRange=0);let r=this.drawRange*3;if(e.forEach(e=>{t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],this.drawRange++}),!n)for(;r<300;)t[r++]=e[0][0],t[r++]=e[0][1],t[r++]=e[0][2];n&&(n.geometry.setPositions(t),n.computeLineDistances(),n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0)}return t},this.getVerticesByFaceIndex=function(e){let t=e*2*3,n=this.getMorph();if(n&&this.drawRange*3>t){let e=n.geometry.getAttribute(`instanceStart`);return[[e.data.array[t],e.data.array[++t],e.data.array[++t]],[e.data.array[++t],e.data.array[++t],e.data.array[++t]]]}return[]},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=n*3;for(e.forEach(e=>{t[i++]=e[0],t[i++]=e[1],t[i++]=e[2]}),i=this.drawRange*3;i<300;)t[i++]=e[0][0],t[i++]=e[0][1],t[i++]=e[0][2];r.geometry.setPositions(t),r.computeLineDistances(),r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}return t},this.addLines=(n,r)=>{if(n&&n.length>0){if(this.addVertices(n),!this.getMorph()){let n=new e.Line2NodeMaterial({color:r,linewidth:1,vertexColors:!1,worldUnits:!1});this.createLineSegment(t,n,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};zt.prototype=Object.create(Ye.prototype),zt.prototype.constructor=zt;var Bt=0,Vt=function(){return`re`+Bt++},Ht=function(t,n){let r=t,i=new e.Group;i.matrixAutoUpdate=!1,i.userData=this;let a=[],o=``,s=[],c=n,l=new e.Matrix4,u=3e3;l.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=Vt(),this.hideAllPrimitives=()=>{a.forEach(e=>e.hideAllPrimitives()),s.forEach(e=>e.setVisibility(!1))},this.showAllPrimitives=()=>{a.forEach(e=>e.showAllPrimitives()),s.forEach(e=>e.setVisibility(!0))},this.setVisibility=e=>{e!=i.visible&&(i.visible=e,this.pickableUpdateRequired=!0)},this.getVisibility=()=>i.visible,this.getGroup=()=>i,this.setTransformation=e=>{l.set(...e),i.matrix.copy(l),i.updateMatrixWorld()},this.setName=e=>{e&&e!==``&&(o=e)},this.getName=()=>o,this.getParent=()=>r,this.getFullSeparatedPath=()=>{let e=[];if(o!==``){e.push(o);for(let t=r;t!==void 0;){let n=t.getName();n!==``&&e.unshift(n),t=t.getParent()}}return e},this.getFullPath=()=>{let e=this.getFullSeparatedPath();if(e.length>0){let t=e.shift();return e.forEach(e=>{t=t.concat(`/`,e)}),t}return``},this.createChild=e=>{let t=new Ht(this,c);return t.setName(e),a.push(t),i.add(t.getGroup()),t},this.getChildWithName=e=>{if(e){let t=e.toLowerCase();for(let e=0;e<a.length;e++)if(a[e].getName().toLowerCase()===t)return a[e]}},this.findChildFromSeparatedPath=e=>{if(e&&e.length>0&&e[0]===``&&e.shift(),e&&e.length>0){let t=this.getChildWithName(e[0]);return t?(e.shift(),t.findChildFromSeparatedPath(e)):void 0}return this},this.findChildFromPath=e=>{let t=e.split(`/`);return this.findChildFromSeparatedPath(t)},this.createChildFromSeparatedPath=e=>{if(e.length>0&&e[0]===``&&e.shift(),e.length>0){let t=this.getChildWithName(e[0]);return t||=this.createChild(e[0]),e.shift(),t.createChildFromSeparatedPath(e)}return this},this.createChildFromPath=e=>{let t=e.split(`/`);return this.createChildFromSeparatedPath(t)},this.findOrCreateChildFromPath=e=>{let t=this.findChildFromPath(e);return t||=this.createChildFromPath(e),t},this.addZincObject=e=>{e&&(e.setRegion(this),i.add(e.getGroup()),s.push(e),this.pickableUpdateRequired=!0,c&&c.triggerObjectAddedCallback(e))},this.removeZincObject=e=>{for(let t=0;t<s.length;t++)if(e===s[t]){i.remove(e.getGroup()),s.splice(t,1),c&&c.triggerObjectRemovedCallback(e),e.dispose(),this.pickableUpdateRequired=!0;return}},this.checkPickableUpdateRequred=e=>{if(this.pickableUpdateRequired)return!0;if(e){let t=!1;for(let n=0;n<a.length;n++)if(t=a[n].checkPickableUpdateRequred(e),t)return!0}return!1},this.getPickableThreeJSObjects=(e,t)=>(i.visible&&(s.forEach(t=>{if(t.isPickable&&t.getGroup()&&t.getGroup().visible){let n=t.marker;n&&n.isEnabled()&&e.push(n.getMorph()),e.push(t.getGroup())}}),t&&a.forEach(n=>{n.getPickableThreeJSObjects(e,t)}),this.pickableUpdateRequired=!1),e),this.setDuration=e=>{u=e,s.forEach(t=>t.setDuration(e)),a.forEach(t=>t.setDuration(e))},this.getDuration=()=>u,this.getBoundingBox=e=>{let t,n;return s.forEach(e=>{n=e.getBoundingBox(),n&&(t==null?t=n.clone():t.union(n))}),e&&a.forEach(r=>{n=r.getBoundingBox(e),n&&(t==null?t=n.clone():t.union(n))}),t},this.clear=e=>{e&&a.forEach(t=>t.clear(e)),s.forEach(e=>{i.remove(e.getGroup()),e.dispose()}),a=[],s=[]},this.objectIsInRegion=(e,t)=>{for(let t=0;t<s.length;t++)if(e===s[t])return!0;if(t){for(let n=0;n<a.length;n++)if(a[n].objectIsInRegion(e,t))return!0}return!1},this.forEachGeometry=(e,t)=>{s.forEach(t=>{t.isGeometry&&e(t)}),t&&a.forEach(n=>n.forEachGeometry(e,t))},this.forEachGlyphset=(e,t)=>{s.forEach(t=>{t.isGlyphset&&e(t)}),t&&a.forEach(n=>n.forEachGlyphset(e,t))},this.forEachPointset=(e,t)=>{s.forEach(t=>{t.isPointset&&e(t)}),t&&a.forEach(n=>n.forEachPointset(e,t))},this.forEachLine=(e,t)=>{s.forEach(t=>{t.isLines&&e(t)}),t&&a.forEach(n=>n.forEachLine(e,t))},this.findObjectsWithAnatomicalId=(e,t)=>{let n=[];return s.forEach(t=>{t.anatomicalId===e&&n.push(t)}),t&&a.forEach(r=>{let i=r.findObjectsWithAnatomicalId(e,t);n.push(...i)}),n},this.findObjectsWithGroupName=(e,t)=>{let n=[];return s.forEach(t=>{(t.groupName?t.groupName.toLowerCase():t.groupName)===(e&&e.toLowerCase())&&n.push(t)}),t&&a.forEach(r=>{let i=r.findObjectsWithGroupName(e,t);n.push(...i)}),n},this.findGeometriesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isGeometry),this.findPointsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isPointset),this.findGlyphsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isGlyphset),this.findLinesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter(e=>e.isLines),this.getAllObjects=e=>{let t=[...s];return e&&a.forEach(n=>{let r=n.getAllObjects(e);t.push(...r)}),t},this.getChildRegions=e=>{let t=[...a];return e&&a.forEach(n=>{let r=n.getChildRegions(e);t.push(...r)}),t},this.getCurrentTime=()=>{if(s[0]!=null)return s[0].getCurrentTime();for(let e=0;e<a.length;e++){let t=a[e].getCurrentTime();if(t!==-1)return t}return-1},this.setMorphTime=(e,t)=>{s.forEach(t=>{t.setMorphTime(e)}),t&&a.forEach(t=>{t.setMorphTime(e)})},this.isTimeVarying=()=>{for(let e=0;e<s.length;e++)if(s[e].isTimeVarying())return!0;for(let e=0;e<a.length;e++)if(a[e].isTimeVarying())return!0;return!1},this.renderGeometries=(e,t,n,r,i,a)=>{this.getAllObjects(a).forEach(a=>{a.render(e*t,n,r,i)}),i&&n===!1&&i.markerCluster?.markerUpdateRequired&&i.markerCluster.calculate()},this.createPoints=(e,t,n,r)=>{let i=!1,a=this.findObjectsWithGroupName(e,!1),o=a.findIndex(e=>e.isPointset),s=o>-1?a[o]:new Je;return s.addPoints(t,n,r),o===-1?(s.setName(e),this.addZincObject(s),i=!0):this.pickableUpdateRequired=!0,{zincObject:s,isNew:i}},this.createLines=(e,t,n)=>{let r=!1,i=this.findObjectsWithGroupName(e,!1),a=i.findIndex(e=>e.isLines),o=a>-1?i[a]:new zt;return o.addLines(t,n),a===-1?(o.setName(e),this.addZincObject(o),r=!0):this.pickableUpdateRequired=!0,{zincObject:o,isNew:r}},this.createGeometryFromThreeJSGeometry=(t,n,r,i,a,o)=>{let s=new Se,c=new e.MeshPhongMaterial({color:r,transparent:!0,opacity:i,side:e.DoubleSide});if(s.createMesh(n,c,{localTimeEnabled:!1,localMorphColour:!1}),s.getMorph())return s.setVisibility(!1),s.setName(t),s.setRenderOrder(o),this.addZincObject(s),s}},Ut=class{constructor(){this.pluginCallbacks=[],this.register(function(e){return new cn(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new un(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n){let r=new sn,i=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)i.push(this.pluginCallbacks[e](r));r.setPlugins(i),r.write(e,t,n)}},Wt={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},Gt={};Gt[e.NearestFilter]=Wt.NEAREST,Gt[e.NearestMipmapNearestFilter]=Wt.NEAREST_MIPMAP_NEAREST,Gt[e.NearestMipmapLinearFilter]=Wt.NEAREST_MIPMAP_LINEAR,Gt[e.LinearFilter]=Wt.LINEAR,Gt[e.LinearMipmapNearestFilter]=Wt.LINEAR_MIPMAP_NEAREST,Gt[e.LinearMipmapLinearFilter]=Wt.LINEAR_MIPMAP_LINEAR,Gt[e.ClampToEdgeWrapping]=Wt.CLAMP_TO_EDGE,Gt[e.RepeatWrapping]=Wt.REPEAT,Gt[e.MirroredRepeatWrapping]=Wt.MIRRORED_REPEAT;var Kt={scale:`scale`,position:`translation`,quaternion:`rotation`,morphTargetInfluences:`weights`},qt=12,Jt=1179937895,Yt=2,Xt=8,Zt=1313821514,Qt=5130562;function $t(e,t){return e.length===t.length&&e.every(function(e,n){return e===t[n]})}function en(e){if(window.TextEncoder!==void 0)return new TextEncoder().encode(e).buffer;let t=new Uint8Array(new ArrayBuffer(e.length));for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);t[n]=r>255?32:r}return t.buffer}function tn(e){return $t(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function nn(e,t,n){let r={min:Array(e.itemSize).fill(1/0),max:Array(e.itemSize).fill(-1/0)};for(let i=t;i<t+n;i++)for(let t=0;t<e.itemSize;t++){let n;e.itemSize>4?n=e.array[i*e.itemSize+t]:t===0?n=e.getX(i):t===1?n=e.getY(i):t===2?n=e.getZ(i):t===3&&(n=e.getW(i)),r.min[t]=Math.min(r.min[t],n),r.max[t]=Math.max(r.max[t],n)}return r}function rn(e){return Math.ceil(e/4)*4}function an(e,t=0){let n=rn(e.byteLength);if(n!==e.byteLength){let r=new Uint8Array(n);if(r.set(new Uint8Array(e)),t!==0)for(let i=e.byteLength;i<n;i++)r[i]=t;return r.buffer}return e}var on=null,sn=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:`2.0`,generator:`THREE.GLTFExporter`}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,n){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);let r=this;Promise.all(this.pending).then(function(){let e=r.buffers,n=r.json,i=r.options,a=r.extensionsUsed,o=new Blob(e,{type:`application/octet-stream`}),s=Object.keys(a);if(s.length>0&&(n.extensionsUsed=s),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=o.size),i.binary===!0){let e=new window.FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){let r=an(e.result),i=new DataView(new ArrayBuffer(Xt));i.setUint32(0,r.byteLength,!0),i.setUint32(4,Qt,!0);let a=an(en(JSON.stringify(n)),32),o=new DataView(new ArrayBuffer(Xt));o.setUint32(0,a.byteLength,!0),o.setUint32(4,Zt,!0);let s=new ArrayBuffer(qt),c=new DataView(s);c.setUint32(0,Jt,!0),c.setUint32(4,Yt,!0);let l=qt+o.byteLength+a.byteLength+i.byteLength+r.byteLength;c.setUint32(8,l,!0);let u=new Blob([s,o,a,i,r],{type:`application/octet-stream`}),d=new window.FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){let e=new window.FileReader;e.readAsDataURL(o),e.onloadend=function(){let r=e.result;n.buffers[0].uri=r,t(n)}}else t(n)})}serializeUserData(e,t){if(e.userData&&e.userData.isZincObject||Object.keys(e.userData).length===0)return;let n=this.options,r=this.extensionsUsed;try{let i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let e in i.gltfExtensions)t.extensions[e]=i.gltfExtensions[e],r[e]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(t){console.warn(`THREE.GLTFExporter: userData of '`+e.name+`' won't be serialized because of JSON.stringify error - `+t.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;let n=new e.Vector3;for(let e=0,r=t.count;e<r;e++)if(Math.abs(n.fromBufferAttribute(t,e).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){let n=this.cache;if(n.attributesNormalized.has(t))return n.attributesNormalized.get(t);let r=t.clone(),i=new e.Vector3;for(let e=0,t=r.count;e<t;e++)i.fromBufferAttribute(r,e),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),r.setXYZ(e,i.x,i.y,i.z);return n.attributesNormalized.set(t,r),r}applyTextureTransform(e,t){let n=!1,r={};(t.offset.x!==0||t.offset.y!==0)&&(r.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(r.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){let t=this.json,n=this.buffers;return t.buffers||=[{byteLength:0}],n.push(e),0}processBufferView(e,t,n,r,i){let a=this.json;a.bufferViews||=[];let o;o=t===Wt.UNSIGNED_BYTE?1:t===Wt.UNSIGNED_SHORT?2:4;let s=rn(r*e.itemSize*o),c=new DataView(new ArrayBuffer(s)),l=0;for(let i=n;i<n+r;i++)for(let n=0;n<e.itemSize;n++){let r;e.itemSize>4?r=e.array[i*e.itemSize+n]:n===0?r=e.getX(i):n===1?r=e.getY(i):n===2?r=e.getZ(i):n===3&&(r=e.getW(i)),t===Wt.FLOAT?c.setFloat32(l,r,!0):t===Wt.UNSIGNED_INT?c.setUint32(l,r,!0):t===Wt.UNSIGNED_SHORT?c.setUint16(l,r,!0):t===Wt.UNSIGNED_BYTE&&c.setUint8(l,r),l+=o}let u={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:s};return i!==void 0&&(u.target=i),i===Wt.ARRAY_BUFFER&&(u.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(u),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,n=t.json;return n.bufferViews||=[],new Promise(function(r){let i=new window.FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){let e=an(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,r){let i=this.options,a=this.json,o={1:`SCALAR`,2:`VEC2`,3:`VEC3`,4:`VEC4`,16:`MAT4`},s;if(e.array.constructor===Float32Array)s=Wt.FLOAT;else if(e.array.constructor===Uint32Array)s=Wt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)s=Wt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)s=Wt.UNSIGNED_BYTE;else throw Error(`THREE.GLTFExporter: Unsupported bufferAttribute component type.`);if(n===void 0&&(n=0),r===void 0&&(r=e.count),i.truncateDrawRange&&t!==void 0&&t.index===null){let i=n+r,a=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;n=Math.max(n,t.drawRange.start),r=Math.min(i,a)-n,r<0&&(r=0)}if(r===0)return null;let c=nn(e,n,r),l;t!==void 0&&(l=e===t.index?Wt.ELEMENT_ARRAY_BUFFER:Wt.ARRAY_BUFFER);let u=this.processBufferView(e,s,n,r,l),d={bufferView:u.id,byteOffset:u.byteOffset,componentType:s,count:r,max:c.max,min:c.min,type:o[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),a.accessors||=[],a.accessors.push(d)-1}processImage(t,n,r){let i=this,a=i.cache,o=i.json,s=i.options,c=i.pending;a.images.has(t)||a.images.set(t,{});let l=a.images.get(t),u=n===e.RGBAFormat?`image/png`:`image/jpeg`,d=u+`:flipY/`+r.toString();if(l[d]!==void 0)return l[d];o.images||=[];let f={mimeType:u};if(s.embedImages){let a=on||=document.createElement(`canvas`);a.width=Math.min(t.width,s.maxTextureSize),a.height=Math.min(t.height,s.maxTextureSize);let o=a.getContext(`2d`);if(r===!0&&(o.translate(0,a.height),o.scale(1,-1)),typeof HTMLImageElement<`u`&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&t instanceof OffscreenCanvas||typeof ImageBitmap<`u`&&t instanceof ImageBitmap)o.drawImage(t,0,0,a.width,a.height);else{n!==e.RGBAFormat&&n!==e.RGBFormat&&console.error(`GLTFExporter: Only RGB and RGBA formats are supported.`),(t.width>s.maxTextureSize||t.height>s.maxTextureSize)&&console.warn(`GLTFExporter: Image size is bigger than maxTextureSize`,t);let r=new Uint8ClampedArray(t.height*t.width*4);if(n===e.RGBAFormat)for(let e=0;e<r.length;e+=4)r[e+0]=t.data[e+0],r[e+1]=t.data[e+1],r[e+2]=t.data[e+2],r[e+3]=t.data[e+3];else for(let e=0,n=0;e<r.length;e+=4,n+=3)r[e+0]=t.data[n+0],r[e+1]=t.data[n+1],r[e+2]=t.data[n+2],r[e+3]=255;o.putImageData(new ImageData(r,t.width,t.height),0,0)}s.binary===!0?c.push(new Promise(function(e){a.toBlob(function(t){i.processBufferViewImage(t).then(function(t){f.bufferView=t,e()})},u)})):f.uri=a.toDataURL(u)}else f.uri=t.src;let p=o.images.push(f)-1;return l[d]=p,p}processSampler(e){let t=this.json;t.samplers||=[];let n={magFilter:Gt[e.magFilter],minFilter:Gt[e.minFilter],wrapS:Gt[e.wrapS],wrapT:Gt[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){let t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||=[];let r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(r.name=e.name),this._invokeAll(function(t){t.writeTexture&&t.writeTexture(e,r)});let i=n.textures.push(r)-1;return t.textures.set(e,i),i}processMaterial(t){let n=this.cache,r=this.json;if(n.materials.has(t))return n.materials.get(t);if(t.isShaderMaterial)return console.warn(`GLTFExporter: THREE.ShaderMaterial not supported.`),null;r.materials||=[];let i={pbrMetallicRoughness:{}};t.isMeshStandardMaterial!==!0&&t.isMeshBasicMaterial!==!0&&console.warn(`GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.`);let a=t.color.toArray().concat([t.opacity]);if($t(a,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),t.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=t.metalness,i.pbrMetallicRoughness.roughnessFactor=t.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),t.metalnessMap||t.roughnessMap){if(t.metalnessMap===t.roughnessMap){let e={index:this.processTexture(t.metalnessMap)};this.applyTextureTransform(e,t.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=e}else console.warn(`THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.`)}if(t.map){let e={index:this.processTexture(t.map)};this.applyTextureTransform(e,t.map),i.pbrMetallicRoughness.baseColorTexture=e}if(t.emissive){let e=t.emissive.clone().multiplyScalar(t.emissiveIntensity),n=Math.max(e.r,e.g,e.b);if(n>1&&(e.multiplyScalar(1/n),console.warn(`THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited`)),n>0&&(i.emissiveFactor=e.toArray()),t.emissiveMap){let e={index:this.processTexture(t.emissiveMap)};this.applyTextureTransform(e,t.emissiveMap),i.emissiveTexture=e}}if(t.normalMap){let e={index:this.processTexture(t.normalMap)};t.normalScale&&t.normalScale.x!==-1&&(t.normalScale.x!==t.normalScale.y&&console.warn(`THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X.`),e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),i.normalTexture=e}if(t.aoMap){let e={index:this.processTexture(t.aoMap),texCoord:1};t.aoMapIntensity!==1&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),i.occlusionTexture=e}t.transparent?i.alphaMode=`BLEND`:t.alphaTest>0&&(i.alphaMode=`MASK`,i.alphaCutoff=t.alphaTest),t.side===e.DoubleSide&&(i.doubleSided=!0),t.name!==``&&(i.name=t.name),this.serializeUserData(t,i),this._invokeAll(function(e){e.writeMaterial&&e.writeMaterial(t,i)});let o=r.materials.push(i)-1;return n.materials.set(t,o),o}substituteInstancedPointsGeometry(t){let n=t.count,r=new e.BufferGeometry;r.setAttribute(`position`,new e.BufferAttribute(t.pointPositions.slice(0,n*3),3)),t.instanceColor&&r.setAttribute(`color`,new e.BufferAttribute(t.instanceColor.array.slice(0,n*3),3));let i=t.geometry,a=t.isPoints;return t.geometry=r,t.isPoints=!0,function(){t.geometry=i,t.isPoints=a,r.dispose()}}processMesh(t){let n=this.cache,r=this.json,i=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,n=t.material.length;e<n;e++)i.push(t.material[e].uuid);else i.push(t.material.uuid);let a=i.join(`:`);if(n.meshes.has(a))return n.meshes.get(a);let o=t.geometry,s;if(s=t.isLineSegments?Wt.LINES:t.isLineLoop?Wt.LINE_LOOP:t.isLine?Wt.LINE_STRIP:t.isPoints?Wt.POINTS:t.material.wireframe?Wt.LINES:Wt.TRIANGLES,o.isBufferGeometry!==!0)throw Error(`THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.`);let c={},l={},u=[],d=[],f={uv:`TEXCOORD_0`,uv2:`TEXCOORD_1`,color:`COLOR_0`,skinWeight:`WEIGHTS_0`,skinIndex:`JOINTS_0`},p=o.getAttribute(`normal`);p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn(`THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.`),o.setAttribute(`normal`,this.createNormalizedNormalAttribute(p)));let m=null;for(let t in o.attributes){if(t.substr(0,5)===`morph`)continue;let r=o.attributes[t];if(t=f[t]||t.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t=`_`+t),n.attributes.has(this.getUID(r))){l[t]=n.attributes.get(this.getUID(r));continue}m=null;let i=r.array;t===`JOINTS_0`&&!(i instanceof Uint16Array)&&!(i instanceof Uint8Array)&&(console.warn(`GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.`),m=new e.BufferAttribute(new Uint16Array(i),r.itemSize,r.normalized));let a=this.processAccessor(m||r,o);a!==null&&(l[t]=a,n.attributes.set(this.getUID(r),a))}if(p!==void 0&&o.setAttribute(`normal`,p),Object.keys(l).length===0)return null;if(t.morphTargetInfluences!==void 0&&t.morphTargetInfluences.length>0){let e=[],r=[],i={};if(t.morphTargetDictionary!==void 0)for(let e in t.morphTargetDictionary)i[t.morphTargetDictionary[e]]=e;for(let a=0;a<t.morphTargetInfluences.length;++a){let s={},c=!1;for(let e in o.morphAttributes){if(e!==`position`&&e!==`normal`&&e!==`color`){c||=(console.warn(`GLTFExporter: Only POSITION and NORMAL morph are supported.`),!0);continue}let t=o.morphAttributes[e][a],r=e.toUpperCase();f[e]&&(r=f[e]);let i=o.attributes[e];if(n.attributes.has(this.getUID(t))){s[r]=n.attributes.get(this.getUID(t));continue}let l=i.clone();if(!o.morphTargetsRelative){if(i)for(let e=0,n=t.count;e<n;e++)i.count>e&&l.setXYZ(e,t.getX(e)-i.getX(e),t.getY(e)-i.getY(e),t.getZ(e)-i.getZ(e));else for(let e=0,n=t.count;e<n;e++)l.setXYZ(e,0,0,0)}s[r]=this.processAccessor(l,o),n.attributes.set(this.getUID(i),s[r])}d.push(s),e.push(t.morphTargetInfluences[a]),t.morphTargetDictionary!==void 0&&r.push(i[a])}c.weights=e,r.length>0&&(c.extras={},c.extras.targetNames=r)}let h=Array.isArray(t.material);if(h&&o.groups.length===0)return null;let g=h?t.material:[t.material],_=h?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,t=_.length;e<t;e++){let t={mode:s,attributes:l};if(this.serializeUserData(o,t),d.length>0&&(t.targets=d),o.index!==null){let r=this.getUID(o.index);(_[e].start!==void 0||_[e].count!==void 0)&&(r+=`:`+_[e].start+`:`+_[e].count),n.attributes.has(r)?t.indices=n.attributes.get(r):(t.indices=this.processAccessor(o.index,o,_[e].start,_[e].count),n.attributes.set(r,t.indices)),t.indices===null&&delete t.indices}let r=this.processMaterial(g[_[e].materialIndex]);r!==null&&(t.material=r),u.push(t)}c.primitives=u,r.meshes||=[],this._invokeAll(function(e){e.writeMesh&&e.writeMesh(t,c)});let v=r.meshes.push(c)-1;return n.meshes.set(a,v),v}processCamera(t){let n=this.json;n.cameras||=[];let r=t.isOrthographicCamera,i={type:r?`orthographic`:`perspective`};return r?i.orthographic={xmag:t.right*2,ymag:t.top*2,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:i.perspective={aspectRatio:t.aspect,yfov:e.MathUtils.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near},t.name!==``&&(i.name=t.type),n.cameras.push(i)-1}processAnimation(t,n){let r=this.json,i=this.nodeMap;r.animations||=[],t=Ut.Utils.mergeMorphTargetTracks(t.clone(),n);let a=t.tracks,o=[],s=[];for(let t=0;t<a.length;++t){let r=a[t],c=e.PropertyBinding.parseTrackName(r.name),l=e.PropertyBinding.findNode(n,c.nodeName),u=Kt[c.propertyName];if(c.objectName===`bones`&&(l=l.isSkinnedMesh===!0?l.skeleton.getBoneByName(c.objectIndex):void 0),!l||!u)return console.warn(`THREE.GLTFExporter: Could not export animation track "%s".`,r.name),null;let d=r.values.length/r.times.length;u===Kt.morphTargetInfluences&&(d/=l.morphTargetInfluences.length);let f;r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(f=`CUBICSPLINE`,d/=3):f=r.getInterpolation()===e.InterpolateDiscrete?`STEP`:`LINEAR`,s.push({input:this.processAccessor(new e.BufferAttribute(r.times,1)),output:this.processAccessor(new e.BufferAttribute(r.values,d)),interpolation:f}),o.push({sampler:s.length-1,target:{node:i.get(l),path:u}})}return r.animations.push({name:t.name||`clip_`+r.animations.length,samplers:s,channels:o}),r.animations.length-1}processSkin(t){let n=this.json,r=this.nodeMap,i=n.nodes[r.get(t)],a=t.skeleton;if(a===void 0)return null;let o=t.skeleton.bones[0];if(o===void 0)return null;let s=[],c=new Float32Array(a.bones.length*16),l=new e.Matrix4;for(let e=0;e<a.bones.length;++e)s.push(r.get(a.bones[e])),l.copy(a.boneInverses[e]),l.multiply(t.bindMatrix).toArray(c,e*16);return n.skins===void 0&&(n.skins=[]),n.skins.push({inverseBindMatrices:this.processAccessor(new e.BufferAttribute(c,16)),joints:s,skeleton:r.get(o)}),i.skin=n.skins.length-1}processNode(e){let t=this.json,n=this.options,r=this.nodeMap;t.nodes||=[];let i={};if(n.trs){let t=e.quaternion.toArray(),n=e.position.toArray(),r=e.scale.toArray();$t(t,[0,0,0,1])||(i.rotation=t),$t(n,[0,0,0])||(i.translation=n),$t(r,[1,1,1])||(i.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),tn(e.matrix)===!1&&(i.matrix=e.matrix.elements);if(e.name!==``&&(i.name=String(e.name)),this.serializeUserData(e,i),e.isMesh||e.isLine||e.isPoints||e.isInstancedPoints){let t;e.isInstancedPoints&&(t=this.substituteInstancedPointsGeometry(e));let n=this.processMesh(e);t&&t(),n!==null&&(i.mesh=n)}else e.isCamera&&(i.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let t=[];for(let r=0,i=e.children.length;r<i;r++){let i=e.children[r];if(i.visible||n.onlyVisible===!1){let e=this.processNode(i);e!==null&&t.push(e)}}t.length>0&&(i.children=t)}this._invokeAll(function(t){t.writeNode&&t.writeNode(e,i)});let a=t.nodes.push(i)-1;return r.set(e,a),a}processScene(e){let t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};e.name!==``&&(r.name=e.name),t.scenes.push(r);let i=[];for(let t=0,r=e.children.length;t<r;t++){let r=e.children[t];if(r.visible||n.onlyVisible===!1){let e=this.processNode(r);e!==null&&i.push(e)}}i.length>0&&(r.nodes=i),this.serializeUserData(e,r)}processObjects(t){let n=new e.Scene;n.name=`AuxScene`;for(let e=0;e<t.length;e++)n.children.push(t[e]);this.processScene(n)}processInput(t){let n=this.options;t=t instanceof Array?t:[t],this._invokeAll(function(e){e.beforeParse&&e.beforeParse(t)});let r=[];for(let n=0;n<t.length;n++)t[n]instanceof e.Scene?this.processScene(t[n]):r.push(t[n]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let e=0;e<n.animations.length;++e)this.processAnimation(n.animations[e].clip,n.animations[e].mesh);this._invokeAll(function(e){e.afterParse&&e.afterParse(t)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}},cn=class{constructor(e){this.writer=e,this.name=`KHR_lights_punctual`}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn(`THREE.GLTFExporter: Only directional, point, and spot lights are supported.`,e);return}let n=this.writer,r=n.json,i=n.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type=`directional`:e.isPointLight?(a.type=`point`,e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type=`spot`,e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn(`THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2.`),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn(`THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.`),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0);let o=r.extensions[this.name].lights;o.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:o.length-1}}},ln=class{constructor(e){this.writer=e,this.name=`KHR_materials_unlit`}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},un=class{constructor(e){this.writer=e,this.name=`KHR_materials_pbrSpecularGlossiness`}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;let n=this.writer,r=n.extensionsUsed,i={};t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);let a=[1,1,1];if(e.specular.toArray(a,0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){let t={index:n.processTexture(e.specularMap)};n.applyTextureTransform(t,e.specularMap),i.specularGlossinessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0}};Ut.Utils={insertKeyframe:function(e,t){let n=.001,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),o=e.createInterpolant(new e.ValueBufferType(r)),s;if(e.times.length===0){i[0]=t;for(let e=0;e<r;e++)a[e]=0;s=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<n)return 0;i[0]=t,i.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,r),s=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<n)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),s=i.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<n)return c;if(e.times[c]<t&&e.times[c+1]>t){i.set(e.times.slice(0,c+1),0),i[c+1]=t,i.set(e.times.slice(c+1),c+2),a.set(e.values.slice(0,(c+1)*r),0),a.set(o.evaluate(t),(c+1)*r),a.set(e.values.slice((c+1)*r),(c+2)*r),s=c+1;break}}return e.times=i,e.values=a,s},mergeMorphTargetTracks:function(t,n){let r=[],i={},a=t.tracks;for(let t=0;t<a.length;++t){let o=a[t],s=e.PropertyBinding.parseTrackName(o.name),c=e.PropertyBinding.findNode(n,s.nodeName);if(s.propertyName!==`morphTargetInfluences`||s.propertyIndex===void 0){r.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error(`THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.`);console.warn(`THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.`),o=o.clone(),o.setInterpolation(e.InterpolateLinear)}let l=c.morphTargetInfluences.length,u=c.morphTargetDictionary[s.propertyIndex];if(u===void 0)throw Error(`THREE.GLTFExporter: Morph target name not found: `+s.propertyIndex);let d;if(i[c.uuid]===void 0){d=o.clone();let e=new d.ValueBufferType(l*d.times.length);for(let t=0;t<d.times.length;t++)e[t*l+u]=d.values[t];d.name=(s.nodeName||``)+`.morphTargetInfluences`,d.values=e,i[c.uuid]=d,r.push(d);continue}let f=o.createInterpolant(new o.ValueBufferType(1));d=i[c.uuid];for(let e=0;e<d.times.length;e++)d.values[e*l+u]=f.evaluate(d.times[e]);for(let e=0;e<o.times.length;e++){let t=this.insertKeyframe(d,o.times[e]);d.values[t*l+u]=o.values[e]}}return t.tracks=r,t}};var dn=function(e){let t=e;this.exportGLTF=e=>{let n=t.getRootRegion().getAllObjects(!0),r=[];n.forEach(e=>{e.animationClip&&r.push({clip:e.animationClip[0],mesh:e.getMorph()})});let i=new Ut,a={binary:e,animations:r};return new Promise((e,n)=>{i.parse(t.getThreeJSScene(),function(t){e(t)},a)})}},fn=function(){let e=this;this.parseGLTFObjects=(t,n,r,i)=>{let a=n;if(r!==0){if(t.type===`Object3D`){if(t.name!==``&&(n&&(a=n.findOrCreateChildFromPath(t.name)),a)){let e=a.getGroup();e.position.copy(t.position),e.rotation.copy(t.rotation),e.quaternion.copy(t.quaternion),e.matrixAutoUpdate=!0}}else{let e;if(t.type===`Mesh`?e=new Se:t.type===`LineSegments`?e=new Ye:t.type===`Points`&&(e=new Je),e){let r=!1,a=!1;t.geometry&&t.geometry.morphAttributes&&(r=!!t.geometry.morphAttributes.position,a=!!t.geometry.morphAttributes.color),e.setMesh(t.clone(),r,a);let o=e.getMorph();e.groupName=o.name,o.matrixAutoUpdate=!0,n.addZincObject(e),i!=null&&typeof i==`function`&&i(e)}}}r++,t.children.forEach(t=>{e.parseGLTFObjects(t,a,r,i)})},this.setCamera=e=>{e.viewAll();let t=e.getZincCameraControls(),n=t.getCurrentViewport();t.addViewport(`default`,n),t.setDefaultViewport(`default`)},this.load=(t,n,r,a,o,s)=>{let c=r.substring(0,r.lastIndexOf(`/`)+1),l=r.substring(r.lastIndexOf(`/`)+1,r.length);new i.GLTFLoader().setPath(c).load(l,function(r){console.log(r),e.parseGLTFObjects(r.scene,n,0,a),e.setCamera(t),o!=null&&typeof o==`function`&&o()})}},pn=/^[og]\s*(.+)?/,mn=/^mtllib /,hn=/^usemtl /,gn=/^usemap /,_n=new e.Vector3,vn=new e.Vector3,yn=new e.Vector3,bn=new e.Vector3,xn=new e.Vector3;function Sn(){let e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){let n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);let r={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;_n.fromArray(r,e),vn.fromArray(r,t),yn.fromArray(r,n),xn.subVectors(yn,vn),bn.subVectors(_n,vn),xn.cross(bn),xn.normalize(),i.push(xn.x,xn.y,xn.z),i.push(xn.x,xn.y,xn.z),i.push(xn.x,xn.y,xn.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){let r=this.parseVertexIndex(e[n],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type=`Line`;let n=this.vertices.length,r=this.uvs.length;for(let t=0,r=e.length;t<r;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],r))}};return e.startObject(``,!1),e}var Cn=class extends e.Loader{constructor(e){super(e),this.materials=null}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}setMaterials(e){return this.materials=e,this}parse(t){let n=new Sn;t.indexOf(`\r
|
|
556
556
|
`)!==-1&&(t=t.replace(/\r\n/g,`
|
|
557
557
|
`)),t.indexOf(`\\
|
|
558
558
|
`)!==-1&&(t=t.replace(/\\\n/g,``));let r=t.split(`
|
|
559
|
-
`),i=``,a=``,o=0,s=[],c=typeof``.trimLeft==`function`;for(let e=0,t=r.length;e<t;e++)if(i=r[e],i=c?i.trimLeft():i.trim(),o=i.length,o!==0&&(a=i.charAt(0),a!==`#`)){if(a===`v`){let e=i.split(/\s+/);switch(e[0]){case`v`:n.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?n.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):n.colors.push(void 0,void 0,void 0);break;case`vn`:n.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:n.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if(a===`f`){let e=i.substr(1).trim().split(/\s+/),t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.length>0){let e=r.split(`/`);t.push(e)}}let r=t[0];for(let e=1,i=t.length-1;e<i;e++){let i=t[e],a=t[e+1];n.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a===`l`){let e=i.substring(1).trim().split(` `),t=[],r=[];if(i.indexOf(`/`)===-1)t=e;else for(let n=0,i=e.length;n<i;n++){let i=e[n].split(`/`);i[0]!==``&&t.push(i[0]),i[1]!==``&&r.push(i[1])}n.addLineGeometry(t,r)}else if(a===`p`){let e=i.substr(1).trim().split(` `);n.addPointGeometry(e)}else if((s=pn.exec(i))!==null){let e=(` `+s[0].substr(1).trim()).substr(1);n.startObject(e)}else if(hn.test(i))n.object.startMaterial(i.substring(7).trim(),n.materialLibraries);else if(mn.test(i))n.materialLibraries.push(i.substring(7).trim());else if(gn.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(s=i.split(` `),s.length>1){let e=s[1].trim().toLowerCase();n.object.smooth=e!==`0`&&e!==`off`}else n.object.smooth=!0;let e=n.object.currentMaterial();e&&(e.smooth=n.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}n.finalize();let l=new e.Group;if(l.materialLibraries=[].concat(n.materialLibraries),n.objects.length!==1||n.objects[0].geometry.vertices.length!==0)for(let t=0,r=n.objects.length;t<r;t++){let r=n.objects[t],i=r.geometry,a=r.materials,o=i.type===`Line`,s=i.type===`Points`,c=!1;if(i.vertices.length===0)continue;let u=new e.BufferGeometry;u.setAttribute(`position`,new e.Float32BufferAttribute(i.vertices,3)),i.normals.length>0&&u.setAttribute(`normal`,new e.Float32BufferAttribute(i.normals,3)),i.colors.length>0&&(c=!0,u.setAttribute(`color`,new e.Float32BufferAttribute(i.colors,3))),i.hasUVIndices===!0&&u.setAttribute(`uv`,new e.Float32BufferAttribute(i.uvs,2));let d=[];for(let t=0,r=a.length;t<r;t++){let r=a[t],i=r.name+`_`+r.smooth+`_`+c,l=n.materials[i];if(this.materials!==null){if(l=this.materials.create(r.name),o&&l&&!(l instanceof e.LineBasicMaterial)){let t=new e.LineBasicMaterial;e.Material.prototype.copy.call(t,l),t.color.copy(l.color),l=t}else if(s&&l&&!(l instanceof e.PointsMaterial)){let t=new e.PointsMaterial({size:10,sizeAttenuation:!1});e.Material.prototype.copy.call(t,l),t.color.copy(l.color),t.map=l.map,l=t}}l===void 0&&(l=o?new e.LineBasicMaterial:s?new e.PointsMaterial({size:1,sizeAttenuation:!1}):new e.MeshPhongMaterial,l.name=r.name,l.flatShading=!r.smooth,l.vertexColors=c,n.materials[i]=l),d.push(l)}let f;if(d.length>1){for(let e=0,t=a.length;e<t;e++){let t=a[e];u.addGroup(t.groupStart,t.groupCount,e)}f=o?new e.LineSegments(u,d):s?new e.Points(u,d):new e.Mesh(u,d)}else f=o?new e.LineSegments(u,d[0]):s?new e.Points(u,d[0]):new e.Mesh(u,d[0]);f.name=r.name,l.add(f)}else if(n.vertices.length>0){let t=new e.PointsMaterial({size:1,sizeAttenuation:!1}),r=new e.BufferGeometry;r.setAttribute(`position`,new e.Float32BufferAttribute(n.vertices,3)),n.colors.length>0&&n.colors[0]!==void 0&&(r.setAttribute(`color`,new e.Float32BufferAttribute(n.colors,3)),t.vertexColors=!0);let i=new e.Points(r,t);l.add(i)}return l}},wn=e.FileLoader,Tn=e=>{let t=(e,t)=>{e.metadata.number_of_vertices+=t.metadata.number_of_vertices,`labels`in e&&e.labels.push(...e.labels),[`axis1`,`axis2`,`axis3`,`colors`,`positions`,`scale`].forEach(n=>{n in e&&Object.keys(e[n]).forEach(r=>{let i=t[n][r].length;for(let a=0;a<i;a++)e[n][r].push(t[n][r][a])})})};if(e&&e.length>0)for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}},En=e=>{if(e&&e.length>0){if(e.length===1)return e[0];let t=T(e);return e.forEach(e=>e.dispose()),t}},Dn=function(e,t,n){let r=new wn,i=new Fe;r.crossOrigin=t;let a=e,o=n,s,c=!1,l=!1,u,d=[],f=e=>{let t=s[e.index];if(t){if(`GlyphGeometriesURL`in t)e.onLoad(t);else{let n=i.parse(t);e.onLoad(n.geometry,n.materials)}}else p(e,{responseURL:a})},p=e=>{e.onError&&(u||={responseURL:a},e.onError(u))};this.downloadCompleted=e=>{try{s=JSON.parse(e[0]),c=!1,l=!0,Array.isArray(s)?d.forEach(e=>f(e)):d.forEach(e=>p(e))}catch{d.forEach(e=>p(e))}};let m=()=>e=>{u=e,l=!0,c=!1,d.forEach(e=>{p(e)})},h=()=>e=>{d.forEach(t=>{t.onProgress&&t.onProgress(e)})};this.load=(e,t,n,i)=>{let g={index:e,onLoad:t,onProgress:n,onError:i};l?s?f(g):p(u):c?d.push(g):(d.push(g),c=!0,r.load(a,o,h,m))}},On=function(e,t,n){let r=[],i=e,a=t,o=0,s=n.isGlyphsets;this.itemDownloaded=(e,t)=>{if(r[e]=t,o++,o==i&&r.length>0){if(s){let e=r.map(e=>JSON.parse(e[0]));Tn(e),a(e[0])}else{let t=r[0][1],n=En(r.map(e=>e[0]));for(let t=1;t<i;t++)r[e][0].dispose(),r[e][1].forEach(e=>e.dispose());a(n,t)}}}},kn=function(){let e=0;this.crossOrigin=`Anonymous`;let t=new Fe,n=new wn;n.crossOrigin=`Anonymous`;let r=[],i={},a=(e,t,n,r,i)=>{let a=e.length,o=new On(a,t,i),c=0;e.forEach(e=>{let a=i?{...i}:{};a.msHandler=o,a.order=c,c++,s(e,t,n,r,a)})},o=(t,n,a,o,s)=>{let l=s?{...s}:{},u=i[t];if(!u){if(20>e){let n=new c(void 0,this,l);++e,u=new Dn(t,this.crossOrigin,n),i[t]=u}else r.push({url:t,onLoad:n,onProgress:a,onError:o,options:s})}u&&(l.isHandler=u,u.load(s.index,n,a,o))},s=(i,a,s,l,u)=>{if(u&&u.index!==void 0)o(i,a,s,l,u);else if(20>e){++e;let r=new c(a,this,u),o=new c(l,this,u);u.isGlyphsets?n.load(i,r,s,o):(t.crossOrigin=this.crossOrigin,t.load(i,r,s,o))}else r.push({url:i,onLoad:a,onProgress:s,onError:l,options:u})};this.load=(e,t,n,r,i)=>{Array.isArray(e)?a(e,t,n,r,i):s(e,t,n,r,i)},this.loadFromWaitingList=()=>{for(;20>e;){let e=r.shift();if(e)this.load(e.url,e.onLoad,e.onProgress,e.onError,e.options);else return}},this.itemRemainingCheck=()=>{if(r.length===0&&e===0)for(let e in i)i.hasOwnProperty(e)&&delete i[e]};let c=function(t,n,r){return(...i)=>{--e,r?.msHandler?r.msHandler.itemDownloaded(r.order,i):r?.isHandler?r.isHandler.downloadCompleted(i):t&&t(...i),n.loadFromWaitingList(),n.itemRemainingCheck()}};this.parse=e=>loader.parse(e)},An=class extends e.Loader{constructor(e){super(e)}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(t){function n(e){let t=new DataView(e);if(84+t.getUint32(80,!0)*50===t.byteLength)return!0;let n=[115,111,108,105,100];for(let e=0;e<5;e++)if(r(n,t,e))return!1;return!0}function r(e,t,n){for(let r=0,i=e.length;r<i;r++)if(e[r]!==t.getUint8(n+r,!1))return!1;return!0}function i(t){let n=new DataView(t),r=n.getUint32(80,!0),i,a,o,s=!1,c,l,u,d,f;for(let e=0;e<70;e++)n.getUint32(e,!1)==1129270351&&n.getUint8(e+4)==82&&n.getUint8(e+5)==61&&(s=!0,c=new Float32Array(r*3*3),l=n.getUint8(e+6)/255,u=n.getUint8(e+7)/255,d=n.getUint8(e+8)/255,f=n.getUint8(e+9)/255);let p=new e.BufferGeometry,m=new Float32Array(r*3*3),h=new Float32Array(r*3*3);for(let e=0;e<r;e++){let t=84+e*50,r=n.getFloat32(t,!0),f=n.getFloat32(t+4,!0),p=n.getFloat32(t+8,!0);if(s){let e=n.getUint16(t+48,!0);e&32768?(i=l,a=u,o=d):(i=(e&31)/31,a=(e>>5&31)/31,o=(e>>10&31)/31)}for(let l=1;l<=3;l++){let u=t+l*12,d=e*3*3+(l-1)*3;m[d]=n.getFloat32(u,!0),m[d+1]=n.getFloat32(u+4,!0),m[d+2]=n.getFloat32(u+8,!0),h[d]=r,h[d+1]=f,h[d+2]=p,s&&(c[d]=i,c[d+1]=a,c[d+2]=o)}}return p.setAttribute(`position`,new e.BufferAttribute(m,3)),p.setAttribute(`normal`,new e.BufferAttribute(h,3)),s&&(p.setAttribute(`color`,new e.BufferAttribute(c,3)),p.hasColors=!0,p.alpha=f),p}function a(t){let n=new e.BufferGeometry,r=/solid([\s\S]*?)endsolid/g,i=/facet([\s\S]*?)endfacet/g,a=0,o=`[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,s=RegExp(`vertex`+o+o+o,`g`),c=RegExp(`normal`+o+o+o,`g`),l=[],u=[],d=new e.Vector3,f,p=0,m=0,h=0;for(;(f=r.exec(t))!==null;){m=h;let e=f[0];for(;(f=i.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=c.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=s.exec(n))!==null;)l.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),u.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let t=m,r=h-m;n.addGroup(t,r,p),p++}return n.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),n.setAttribute(`normal`,new e.Float32BufferAttribute(u,3)),n}function o(t){return typeof t==`string`?t:e.LoaderUtils.decodeText(new Uint8Array(t))}function s(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t.buffer||t}return e}let c=s(t);return n(c)?i(c):a(o(t))}},jn=function(){P.call(this),this.isTubeLines=!0;let t={},n={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(n,a,o)=>{if(n&&a){t={geometryIn:n,materialIn:a,options:o};let s=i(r(n)),c=new e.MeshStandardMaterial({color:a.color}),l=new e.Mesh(s,c);this.setMesh(l,o.localTimeEnabled,o.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.setAlpha=function(e){let t=this.getMorph();t.material.opacity=e,t.material.transparent=e<1,t.material.depthWrite=e>.5},this.setWireframe=e=>{let t=this.getMorph();t.material.wireframe=e},this.setTubeLines=(e,a)=>{if(e&&a){let{geometryIn:o}=t,s=this.getMorph();s.geometry.dispose(),n=Object.assign(n,{radius:e,radialSegments:a}),s.geometry=i(r(o))}};let r=t=>{let n=t.getAttribute(`position`),r=[];for(let t=0;t<n.count;t++)r.push(new e.Vector3().fromBufferAttribute(n,t));return r},i=t=>{let{radius:r,radialSegments:i,smooth:a}=n,o;if(a){let n=new e.CatmullRomCurve3(t);o=new e.TubeGeometry(n,t.length,r,i,!1)}else{let n=[];for(let a=0;a+1<t.length;a+=2){let o=new e.LineCurve3(t[a],t[a+1]),s=new e.TubeGeometry(o,1,r,i,!1);n.push(s)}o=T(n,!0),n.forEach(e=>e.dispose())}return o}};jn.prototype=Object.create(P.prototype);var Mn=function(t){let n=t;this.toBeDownloaded=0,this.progressMap={};let r=!1,i=!1,a=new kn;this.getDownloadProgress=()=>{let e=0,t=0,n=!1;for(let r in this.progressMap){let i=this.progressMap[r];e+=i[1],t+=i[0],i[1]==0&&(n=!0)}return n&&(e=0),[e,t,i]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,i=!0,console.error(`There is an issue with external resource ${t?.responseURL?`: `+t?.responseURL:``}.`),e&&e({type:`Error`,xhr:t})};let o=(e,t)=>{let i=t.Default;if(t.Inline)n.setupMultipleViews(i,t.Entries);else{let a=[];for(let[n,r]of Object.entries(t.Entries))if(e){let t=_(r,e);a.push(new Promise((e,r)=>{fetch(t).then(e=>e.json()).then(t=>e({key:n,data:t})).catch(e=>r(e))}))}Promise.all(a).then(e=>{let t={};e.forEach(e=>{t[e.key]=e.data}),n.setupMultipleViews(i,t);let a=n.getZincCameraControls();a&&a.setCurrentViewport(i),r=!0})}};this.loadViewURL=(e,t)=>{this.toBeDownloaded+=1;let i=e;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{n.setupMultipleViews(`default`,{default:e}),n.resetView(),r=!0,--this.toBeDownloaded,t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Fetch failed for URL: ${i}`,e),this.onError(t)({responseURL:i})})},this.loadModelsURL=(e,t,n,r,i,o,s)=>{let c=t.length;this.toBeDownloaded+=c;for(let l=0;l<c;l++){let c=t[l],u=lr.defaultMaterialColor,d=lr.defaultOpacity;n!=null&&n[l]!=null&&(u=!!n[l]),r!=null&&r[l]!=null&&(d=r[l]);let f=0;i!=null&&i[l]!=null&&(f=!!i[l]);let p=!1;o!=null&&o[l]!=null&&(p=!!o[l]),a.load(c,m(e,u,d,f,p,void 0,void 0,void 0,void 0,s),this.onProgress(c),this.onError(s))}},this.loadFromViewURL=(e,t,r)=>{let i=t+`_view.json`;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(i=>{n.loadView(i);let a=[],o=t+`_`;for(let e=0;e<i.numberOfResources;e++){let t=o+(e+1)+`.json`;a.push(t)}this.loadModelsURL(e,a,i.colour,i.opacity,i.timeEnabled,i.morphColour,r)}).catch(e=>{console.error(`Failed to load view data from: ${i}`,e)})};let s=(t,r,i,o,s,c,l,u,d)=>(f,p)=>{let m=u?new jn:new Ye,h;p&&p[0]&&(h=new e.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(h.transparent=!0),h.opacity=p[0].opacity,h.vertexColors=p[0].vertexColors);let g={};if(g.localTimeEnabled=r,g.localMorphColour=i,m&&(m.createLineSegment(f,h,g),m.setName(o),m.setAnatomicalId(s),m.setRenderOrder(c),t.addZincObject(m),m.setDuration(n.getDuration()),l&&l.levels))for(let[e,t]of Object.entries(l.levels))m.addLOD(a,e,t.URL,t.Index,l.preload);--this.toBeDownloaded,f.dispose(),d!=null&&typeof d==`function`&&d(m)};this.loadLinesURL=(e,t,n,r,i,o,c)=>{let l=0;this.toBeDownloaded+=1;let u=c?.isInline?c.isInline:!1,d=c?.anatomicalId?c.anatomicalId:void 0,f=c&&`renderOrder`in c?c.renderOrder:void 0;n!=null&&(l=!!n);let p=0;r!=null&&(p=!!r);let m=c.tubeLines&&!l&&!p;if(u){let n=a.parse(t);s(e,l,p,i,d,f,c.lod,m,o)(n.geometry,n.materials)}else a.load(t,s(e,l,p,i,d,f,c.lod,m,o),this.onProgress(t),this.onError(o),c.loaderOptions)};let c=(e,t,r,i,a)=>o=>{let s=o;(typeof s==`string`||s instanceof String)&&(s=JSON.parse(o));let c=a&&a.isInline?a.isInline:void 0,l=a&&a.anatomicalId?a.anatomicalId:void 0,u=a?.displayLabels;u===void 0&&(u=!0);let d=a&&`renderOrder`in a?a.renderOrder:void 0,f=new Ie;f.setDuration(n.getDuration()),f.groupName=r,++this.toBeDownloaded,f.load(s,t,()=>{--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(f)},c,u),f.setAnatomicalId(l),f.setRenderOrder(d),e.addZincObject(f)};this.loadGlyphsetURL=(e,t,n,r,i,o)=>{o&&o.isInline&&o.isInline?c(e,n,r,i,o)(t):a.load(t,c(e,n,r,i,o),this.onProgress(t),this.onError(i),o.loaderOptions)};let l=(t,r,i,a,o,s,c)=>(l,u)=>{let d=new Je,f=new e.PointsMaterial({alphaTest:.05,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(f.transparent=!0),f.opacity=u[0].opacity,f.color=u[0].color,f.vertexColors=!1);let p={};p.localTimeEnabled=r,p.localMorphColour=i,d&&(d.createMesh(l,f,p),d.setName(a),d.setAnatomicalId(o),t.addZincObject(d),d.setDuration(n.getDuration()),d.setRenderOrder(s)),l.dispose(),--this.toBeDownloaded,c!=null&&typeof c==`function`&&c(d)};this.loadSTL=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=lr.defaultMaterialColor,a=lr.defaultOpacity,o=new An;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))},this.loadOBJ=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=lr.defaultMaterialColor,a=lr.defaultOpacity,o=new Cn;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))};let u=(e,t,n,r,i,o,s)=>{this.toBeDownloaded+=1;let c=lr.defaultMaterialColor,l=lr.defaultOpacity,u=0,d=s&&s.isInline?s.isInline:!1,f=s&&s.fileFormat?s.fileFormat:void 0,p=s&&s.anatomicalId?s.anatomicalId:void 0,h=s&&`renderOrder`in s?s.renderOrder:void 0;n!=null&&(u=!!n);let g=0;r!=null&&(g=!!r);let _=a;if(f!==void 0){if(f==`STL`)_=new An;else if(f==`OBJ`){_=new Cn,_.crossOrigin=`Anonymous`,_.load(t,objloader(e,c,l,u,g,i,p,o),this.onProgress(t),this.onError,s.loaderOptions);return}}if(d){let n=a.parse(t);m(e,c,l,u,g,i,p,h,s,o)(n.geometry,n.materials)}else _.crossOrigin=`Anonymous`,a.load(t,m(e,c,l,u,g,i,p,h,s,o),this.onProgress(t),this.onError(o),s.loaderOptions)},d=function(e,t,i){let a=0;return o=>{if(a+=1,o&&t!=null&&typeof t==`function`&&t(o),a==e&&(r===!1&&n.viewAll(),i!=null&&typeof i==`function`)){i();let e=n.getZincCameraControls();e&&e.calculateMaxAllowedDistance(n)}}};this.loadPointsetURL=(e,t,n,r,i,o,s)=>{let c=0;this.toBeDownloaded+=1,n!=null&&(c=!!n);let u=0;r!=null&&(u=!!r);let d=s&&s.isInline?s.isInline:!1,f=s&&s.anatomicalId?s.anatomicalId:void 0,p=s&&`renderOrder`in s?s.renderOrder:void 0;if(d){let n=a.parse(t);l(e,c,u,i,f,p,o)(n.geometry,n.materials)}else a.load(t,l(e,c,u,i,f,p,o),this.onProgress(t),this.onError(o),s.loaderOptions)};let f=(e,t,n,r,i,a)=>{let o=a&&a.isInline?a.isInline:void 0,s=a&&a.anatomicalId?a.anatomicalId:void 0,c=a&&`renderOrder`in a?a.renderOrder:void 0,l;if(n){if(t&&n.images&&n.images.source){let e=n.images.source;for(let r=0;r<e.length;r++){let i=_(e[r],t);n.images.source[r]=i}}n.type===`slides`&&(l=new tt),l&&(l.groupName=r,++this.toBeDownloaded,l.load(n,()=>{e.addZincObject(l),--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(l)},o),l.setAnatomicalId(s),l.setRenderOrder(c))}};this.loadTextureURL=(e,t,n,r,i)=>{if(i&&i.isInline&&i.isInline)f(e,void 0,t,n,r,i);else{let a=t;fetch(a).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(a).href;return e.json().then(e=>({textureData:e,referenceURL:t}))}).then(({textureData:t,referenceURL:a})=>{f(e,a,t,n,r,i)}).catch(e=>{console.error(`Fetch failed for texture URL: ${a}`,e)})}};let p=(e,t,r,i,a,o,s,c,l,u,d)=>{let f={};f.colour=r,f.opacity=i,f.localTimeEnabled=a,f.localMorphColour=o;let p=new Se;if(p.createMesh(t,c,f),p.getMorph())return p.setName(l),p.setRenderOrder(u),p.setAnatomicalId(d),e&&e.addZincObject(p),p.setDuration(n.getDuration()),s!=null&&typeof s==`function`&&s(p),p.videoHandler&&n.setVideoHandler(p.videoHandler),p},m=(e,t,n,r,i,o,s,c,l,u)=>(d,f)=>{let m;f&&f[0]&&(m=f[0]);let h=p(e,d,t,n,r,i,void 0,m,o,c,s);if(l.lod&&l.lod.levels)for(let[e,t]of Object.entries(l.lod.levels))h.addLOD(a,e,t.URL,t.Index,l.lod.preload);--this.toBeDownloaded,d.dispose(),u!=null&&typeof u==`function`&&u(h)},h=e=>{let[,t,n,r,i,a,o,s]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:n,weeks:r,days:i,hours:a,mins:o,secs:s}};this.loadSettings=e=>{if(e){if(e.Duration){let t=h(e.Duration);n.setDurationFromObject(t)}if(e.OriginalDuration){let t=h(e.OriginalDuration);n.setOriginalDurationFromObject(t)}if(e.TimeStamps)for(let t in e.TimeStamps){let r=h(e.TimeStamps[t]);n.addMetadataTimeStamp(t,r)}}};let g=(e,t,n,r,i)=>{if(n){let a,o=!1;n.URL?(a=n.URL,t&&(a=_(a,t))):n.Inline&&(a=n.Inline.URL,o=!0);let s={};if(n.LOD&&n.LOD.Levels){s.preload=!!n.LOD.Preload,s.levels={};for(let[e,r]of Object.entries(n.LOD.Levels))s.levels[e]={},s.levels[e].URL=_(r.URL,t),s.levels[e].Index=r.Index}let c=n.GroupName;(c===void 0||c===``)&&(c=`_Unnamed`);let l={loaderOptions:{index:n.Index},isInline:o,fileFormat:n.FileFormat,anatomicalId:n.AnatomicalId,compression:n.compression,tubeLines:n.tubeLines,lod:s,renderOrder:r};switch(n.Type){case`Surfaces`:u(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Glyph`:let r;o?r=n.Inline.GlyphGeometriesURL:(r=n.GlyphGeometriesURL,r=_(n.GlyphGeometriesURL,t)),l.displayLabels=n.DisplayLabels,l.displayLabels===void 0&&(l.displayLabels=!0),l.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(e,a,r,c,i,l);break;case`Points`:this.loadPointsetURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Lines`:this.loadLinesURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Texture`:this.loadTextureURL(e,a,c,i,l)}}},v=(e,t,i)=>{if(t){let a,o=!1;switch(t.URL?(a=t.URL,e&&(a=_(t.URL,e))):t.Inline&&(a=t.Inline.URL,o=!0),t.Type){case`View`:o?(n.setupMultipleViews(`default`,{default:a}),r=!0,i!=null&&typeof i==`function`&&i()):this.loadViewURL(a,i);break;case`Settings`:this.loadSettings(t)}}};this.loadGLTF=(e,t,r,i,a)=>{new fn().load(n,e,t,r,i,a)};let y=(e,t,n,r)=>{if(n.Primitives&&n.Primitives.forEach(n=>{let i=1;n.Order&&(i=n.Order),g(e,t,n,i,r)}),n.Transformation&&e.setTransformation(n.Transformation),n.Children)for(let[i,a]of Object.entries(n.Children)){let n=e.findOrCreateChildFromPath(i);n&&y(n,t,a,r)}},b=(e,t)=>{let n=e,r=t?.enabled?.include,i=t?.enabled?.exclude,a=t?.tubeLines;return(r?.length||i?.length)&&(r&&(n=e.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<r.length;t++)if(k(e.RegionPath,e.GroupName,r[t]))return!0;return!1})),i&&(n=n.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<i.length;t++)if(k(e.RegionPath,e.GroupName,i[t]))return!1;return!0}))),a&&n.forEach(e=>{e.Type===`Lines`&&(e.tubeLines=!0)}),n},x=(e,t)=>Array.isArray(e)?b(e,t):e,S=(e,t)=>{if(Array.isArray(e)){let n=0;for(let r=0;r<e.length;r++)e[r].Type&&(t&&e[r].Type===`View`||e[r].Type===`Surfaces`||e[r].Type===`Glyph`||e[r].Type===`Points`||e[r].Type===`Lines`||e[r].Type===`Texture`)&&n++;return n}return 0},C=e=>{let t=e.Primitives?S(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach(e=>{t+=C(e)}),t},w=e=>{if(Array.isArray(e))return S(e,!0);if(typeof e==`object`&&e&&e.Version===`2.0`)return C(e.Regions)},T=(e,t,n,r,i)=>{let a=e;n.RegionPath&&n.RegionPath!==``&&(a=e.findOrCreateChildFromPath(n.RegionPath)),g(a,t,n,r*2,i)},E=(e,t,n,r,i,a)=>{let o=x(t,a),s=w(o),c=new d(s,r,i);for(let e=0;e<t.length;e++)v(n,o[e],c);for(let r=0;r<t.length;r++)T(e,n,o[r],r,c)},D=(e,t,n,r,i)=>{let a=w(t),s=new d(a,r,i);t.Settings&&this.loadSettings(t.Settings),t.Views&&o(n,t.Views,n),t.Regions&&y(e,n,t.Regions,s)};this.loadMetadataURL=(e,t,i,a,o)=>{let s=t;fetch(s).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(s).href;return e.json().then(e=>({metadata:e,referenceURL:t}))}).then(({metadata:t,referenceURL:s})=>{n.resetMetadata(),n.resetDuration(),r=!1,Array.isArray(t)?E(e,t,s,i,a,o):typeof t==`object`&&t&&t.Version===`2.0`&&D(e,t,s,i,a)}).catch(e=>{console.error(`Fetch failed for URL: ${s}`,e)})}},Nn=0,Pn=function(){return`sc`+Nn++},Fn=function(){return{Duration:`6 secs`,OriginalDuration:`-`,TimeStamps:{}}},In=6e3,Ln=function(t,n){let r=t,i,a,o=new Mn(this),s,c={},l=0,u={},d=0,f=new e.Scene,p=new e.Scene,m=new Ht(void 0,this);f.add(m.getGroup());let h=new e.Group;f.add(h),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let g=6e3,_;this.sceneName=void 0;let v=!1,y;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:`top-right`,updateRequired:!0};let b={x:0,y:0},x=Fn(),S=new e.Vector2,C=[];this.forcePickableObjectsUpdate=!1,this.uuid=Pn();let w=new ht(this);w.disable(),f.add(w.group);let T={main:[],mini:[]},k=new e.Vector3(0,0,0),A=()=>r?r.clientWidth===void 0?r.width:r.clientWidth:0,ee=()=>r?r.clientHeight===void 0?r.height:r.clientHeight:0;this.getDownloadProgress=()=>o.getDownloadProgress(),this.onWindowResize=()=>{let e=ee();this.camera.aspect=A()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,_.onResize(),_.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),_.resetView()},this.changeZoomByScrollRateUnit=e=>{_.changeZoomByScrollRateUnit(e)},this.camera=new e.PerspectiveCamera(40,A()/ee(),0,10),this.ambient=new e.AmbientLight(16777215,.2),f.add(this.ambient),this.directionalLight=new e.DirectionalLight(16777215,.7*Math.PI),f.add(this.directionalLight),_=new rt(this.camera,n.domElement,n,this),_.setDirectionalLight(this.directionalLight),_.resetView(),s=new gt(this),this.loadView=e=>{let t=new nt;return t.setFromObject(e),_.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(let[e,n]of Object.entries(t)){let t=new nt;t.setFromObject(n),_.addViewport(e,t)}_.setDefaultViewport(e)},this.getBoundingBox=()=>m.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){let t=_.getViewportFromBoundingBox(e,1);_.setCurrentCameraSettings(t),_.calculateHeightPerPixelAtZeroDepth(ee()),w.markerUpdateRequired=!0}},this.viewAll=()=>{let e=this.getBoundingBox();this.viewAllWithBoundingBox(e),w.markerUpdateRequired=!0},this.forEachGeometry=e=>{m.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{m.forEachGlyphset(e,!0)},this.forEachPointset=e=>{m.forEachPointset(e,!0)},this.forEachLine=e=>{m.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>m.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>m.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>m.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>m.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>m.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>m.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n].getBoundingBox();r&&(t?t.union(r):t=r)}return t},this.vectorToScreenXY=e=>{e.project(this.camera);let t=A(),n=ee(),r=t/2,i=n/2;return e.x=e.x*r+r,e.y=-(e.y*i)+i,e},this.getObjectsScreenXY=t=>{if(t&&t.length>0){let n=this.getBoundingBoxOfZincObjects(t),r=new e.Vector3;return n.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{let t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(m.addZincObject(e),_&&_.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,n,r)=>{o.loadGlyphsetURL(m,e,t,n,r)},this.loadPointsetURL=(e,t,n,r,i)=>{o.loadPointsetURL(m,e,t,n,r,i)},this.loadLinesURL=(e,t,n,r,i)=>{o.loadLinesURL(m,e,t,n,r,i)},this.loadSTL=(e,t,n)=>{o.loadSTL(m,e,t,n)},this.loadOBJ=(e,t,n)=>{o.loadOBJ(m,e,t,n)},this.loadMetadataURL=(e,t,n,r)=>{o.loadMetadataURL(m,e,t,n,r)},this.loadModelsURL=(e,t,n,r,i,a)=>{o.loadModelsURL(m.urls,t,n,r,i,a)},this.loadViewURL=e=>{o.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{o.loadFromViewURL(e,t)},this.loadGLTF=(e,t,n,r)=>{o.loadGLTF(m,e,t,n,r)},this.updateDirectionalLight=()=>{_.updateDirectionalLight()},this.addObject=e=>{f.add(e)},this.removeObject=e=>{f.remove(e)},this.getCurrentTime=()=>{if(a!=null)return a.getCurrentTime(g);let e=m.getCurrentTime();return e===-1?0:e},this.setMorphsTime=e=>{a?.setMorphTime(e,g),m.setMorphTime(e,!0)},this.isTimeVarying=()=>a&&a.video&&!a.video.error?!0:m.isTimeVarying(),this.renderGeometries=(e,t,n)=>{let r={};if(r.camera=_,r.displayMarkers=this.displayMarkers,r.markerCluster=w,r.markersList=w.markers,r.ndcToBeUpdated=!1,n&&(r.markerCluster.markerUpdateRequired=!0),a){if(a.isReadyToPlay()){n?a.video.play():a.video.pause();let e=a.video.currentTime/a.getVideoDuration()*g;o.toBeDownloaded==0?(_.setTime(e),r.ndcToBeUpdated=_.update(0),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(ee()),m.setMorphTime(e,!0),m.renderGeometries(0,0,n,_,r,!0)):_.update(0)}}else o.toBeDownloaded==0?(r.ndcToBeUpdated=_.update(t),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(ee()),m.renderGeometries(e,t,n,_,r,!0)):_.update(0)},this.getThreeJSScene=()=>f,this.setVideoHandler=e=>{a||=e},this.setAdditionalScenesGroup=e=>{f.add(e)};let j=(e,t,n,r,i,a,o)=>{let s=0,c=0;return c=e.includes(`top`)?o-i-n:e.includes(`bottom`)?n:Math.floor((o-i)/2),s=e.includes(`left`)?t:e.includes(`right`)?a-t-r:Math.floor((a-r)/2),{x:s,y:c}},M=e=>{(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(S),this.minimapScissor.updateRequired&&(b=j(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,S.x,S.y),this.minimapScissor.updateRequired=!1),e.setScissor(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),s.updateCamera(),this.displayMiniAxes?e.render(p,s.camera):(f.add(s.mask),e.render(f,s.camera),f.remove(s.mask)),e.setScissorTest(!1),e.setViewport(0,0,S.x,S.y))};this.render=e=>{this.autoClearFlag&&e.clear(),v&&y?y.render(f,this.camera):(e.render(f,this.camera),M(e))},this.setInteractiveControlEnable=e=>{e==1?_.enable():_.disable()},this.getZincCameraControls=()=>_,this.getThreeJSScene=()=>f,this.setDuration=e=>{m.setDuration(e),g=e,_.setPathDuration(e),o.duration=e},this.getDuration=()=>g,this.setStereoEffectEnable=e=>{e==1&&(y||=new lt(n)),n.setSize(A(),ee()),this.camera.updateProjectionMatrix(),v=e},this.objectIsInScene=e=>m.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(t,n)=>{if(t){t.getCenter(k);let r=this.getZincCameraControls().getCurrentViewport(),i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(i,a).normalize(),s.subVectors(i,k).normalize();let c=new e.Vector3;c.crossVectors(o,s);let l=o.angleTo(s);n>0?(this.getZincCameraControls().rotateCameraTransition(c,l,n),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(c,l),w.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,n)=>{if(e){let r=this.getZincCameraControls().getCurrentViewport(),i=this.getZincCameraControls().getViewportFromBoundingBox(e,t);n>0&&(this.getZincCameraControls().cameraTransition(r,i,n),this.getZincCameraControls().enableCameraTransition()),w.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){let n=e.getBoundingBox();this.alignBoundingBoxToCameraView(n,t)}},this.setCameraTargetToObject=t=>{if(this.objectIsInScene(t)){let n=t.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();n.getCenter(k);let i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(a,i),s.addVectors(k,o),r.eyePosition[0]=s.x,r.eyePosition[1]=s.y,r.eyePosition[2]=s.z,r.targetPosition[0]=k.x,r.targetPosition[1]=k.y,r.targetPosition[2]=k.z,this.getZincCameraControls().setCurrentCameraSettings(r),w.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>v,this.removeZincObject=e=>{m.removeZincObject(e),_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{C.length=0,w.isEnabled&&C.push(w.group),m.getPickableThreeJSObjects(C,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||m.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),C),this.getNormalisedMinimapCoordinates=(t,n)=>{if(this.displayMinimap){let r=new e.Vector2;t.getSize(r);let i=r.y-n.clientY;if(b.x+this.minimapScissor.width>n.clientX&&n.clientX>b.x&&b.y+this.minimapScissor.height>i&&i>b.y)return{x:(n.clientX-b.x)/this.minimapScissor.width*2-1,y:(i-b.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>{if(s)return s.getDiffFromNormalised(e,t)},this.isWebGL2=()=>n.isWebGL2(),this.clearAll=()=>{w.clear(),m.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),o.toBeDwonloaded=0,_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{x.TimeStamps[e]=te(t)},this.getMetadataTag=e=>x[e],this.getMetadata=()=>x,this.setMetadataTag=(e,t)=>{x[e]=t},this.removeMetadataTag=e=>{delete x[e]},this.resetMetadata=()=>{x=Fn()},this.resetDuration=()=>{this.setDuration(In)};let N=e=>[...e.years?[`${e.years}years`]:[],...e.months?[`${e.months}months`]:[],...e.weeks?[`${e.weeks}weeks`]:[],...e.days?[`${e.days}days`]:[],...e.hours?[`${e.hours}hours`]:[],...e.mins?[`${e.mins}mins`]:[],...e.secs?[`${e.secs}secs`]:[]].join(` `),te=e=>e.years?e.years*31536e6:0+e.months?e.months*2592e6:0+e.weeks?e.weeks*6048e5:0+e.days?e.days*864e5:0+e.hours?e.hours*36e5:0+e.mins?e.mins*6e4:0+e.secs?e.secs*1e3:0;this.setDurationFromObject=e=>{let t=N(e),n=te(e);this.setMetadataTag(`Duration`,t),this.setDuration(n)},this.setOriginalDurationFromObject=e=>{let t=N(e);this.setMetadataTag(`OriginalDuration`,t)},this.exportGLTF=e=>new dn(this).exportGLTF(e),this.getRootRegion=()=>m,this.createLines=(e,t,n,r)=>{let i=m.findChildFromPath(e);return i===void 0&&(i=m.createChildFromPath(e)),i.createLines(t,n,r)},this.createPoints=(e,t,n,r,i)=>{let a=m.findChildFromPath(e);return a===void 0&&(a=m.createChildFromPath(e)),a.createPoints(t,n,r,i)},this.addZincObjectAddedCallbacks=e=>(l+=1,c[l]=e,l),this.addZincObjectRemovedCallbacks=e=>(d+=1,u[d]=e,d),this.removeZincObjectAddedCallbacks=e=>{e in l&&delete c[e]},this.removeZincObjectRemovedCallbacks=e=>{e in d&&delete u[e]},this.clearZincObjectAddedCallbacks=()=>{c={},l=0},this.clearZincObjectRemovedCallbacks=()=>{u={},d=0},this.triggerObjectAddedCallback=e=>{for(let t in c)c.hasOwnProperty(t)&&c[t](e)},this.triggerObjectRemovedCallback=e=>{for(let t in u)u.hasOwnProperty(t)&&u[t](e)},this.addTemporaryPoints=(e,t)=>{let n=We(e.length),r=He(D());r.color.set(t),r.size=15,r.userData.uniforms.pointSize.value=15,r.alphaTest=.5;let i=new Be(n,r,e.length);i.pointPositions=new Float32Array(e.length*3);let a=n.getAttribute(`instancePosition`);return e.forEach((e,t)=>{a.setXYZ(t,e[0],e[1],e[2]),i.pointPositions[t*3]=e[0],i.pointPositions[t*3+1]=e[1],i.pointPositions[t*3+2]=e[2]}),a.needsUpdate=!0,h.add(i),i},this.addTemporaryLines=(t,n)=>{let r=new pe(E(t.length,t),new e.LineBasicMaterial({color:n}));return h.add(r),r},this.enableFrustumDisplay=()=>{this.camera&&!i&&(i=new e.CameraHelper(this.camera),f.add(i))},this.disableFrustumDisplay=()=>{i&&=(f.remove(i),i.dispose(),void 0)},this.removeTemporaryPrimitive=e=>{h.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{let e=0;return h.children.forEach(t=>{t.geometry.dispose(),t.material.dispose(),e++}),h.clear(),e},this.addBoundingBoxPrimitive=(t,n,r,i,a,o=void 0)=>{let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();k.set(0,0,0);let l=k.subVectors(c.max,c.min),u=new e.BoxGeometry(l.x,l.y,l.z),d=s.createGeometryFromThreeJSGeometry(n,u,r,i,a,1e4);return l.addVectors(c.min,c.max).multiplyScalar(.5),d.setPosition(l.x,l.y,l.z),d},this.addSlicesPrimitive=(t,n,r,i,a,o=void 0)=>{if(n&&n.length>=3&&r&&r.length>=3){let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();k.set(0,0,0);let l=k.subVectors(c.max,c.min),u=[`x`,`y`,`z`],d=[],f=0;return u.forEach(t=>{let o;switch(t){case`x`:o=new e.PlaneGeometry(l.z,l.y),o.rotateY(Math.PI/2);break;case`y`:o=new e.PlaneGeometry(l.x,l.z),o.rotateX(Math.PI/2);break;case`z`:o=new e.PlaneGeometry(l.x,l.y)}let c=s.createGeometryFromThreeJSGeometry(n[f],o,r[f],i,a,10001);d.push(c),f++}),l.addVectors(c.min,c.max).multiplyScalar(.5),d.forEach(e=>{e.setPosition(l.x,l.y,l.z)}),d}},this.enableMarkerCluster=e=>{e?(w.markerUpdateRequired=!0,w.enable()):(w.markerUpdateRequired=!1,w.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,T.main&&(this.enableAxisDisplay(!1,!1),T.main.forEach(e=>{e.dispose&&e.dispose()})),T.mini&&(this.enableAxisDisplay(!1,!0),T.mini.forEach(e=>{e.dispose&&e.dispose()})),T={main:[],mini:[]}},this.createAxisDisplay=(t=!1)=>{this.destroyAxisDisplay();let n=[{name:`x`,dir:new e.Vector3(1,0,0),colour:`red`,hex:16733525},{name:`y`,dir:new e.Vector3(0,1,0),colour:`green`,hex:5635925},{name:`z`,dir:new e.Vector3(0,0,1),colour:`blue`,hex:5592575}],r=this.getBoundingBox(),i=r.min.distanceTo(r.max),a=new e.Vector3(0,0,0);t&&a.copy(r.min),n.forEach(t=>{let n=new e.ArrowHelper(t.dir,a,i,t.hex);T.main.push(n);let o=new e.ArrowHelper(t.dir,r.getCenter(k),i/2,t.hex);T.mini.push(o);let s=O(t.name,.036,t.colour,`Asap`,120,700),c=t.dir.clone().multiplyScalar(i).add(a);s.position.set(c.x,c.y,c.z),T.main.push(s)})},this.enableAxisDisplay=(e,t=!1)=>{t&&T?.mini?.length?(this.displayMiniAxes=e,T.mini.forEach(t=>{e?p.add(t):p.remove(t)})):!t&&T.main&&T.main.forEach(t=>{e?f.add(t):f.remove(t)})}},Rn=function(t){let n=t,i,a,o=new e.Clock(!1);this.playAnimation=!0;let s=1e3,c={},l=0,u={},d=0,f={},p=0,m={},h=0,g,_,v,y,b=[],x=[],S=new e.Group,C,w,T=!1,E=!1;this.getDrawingWidth=()=>n?n.clientWidth:C?C.clientWidth===void 0?Math.round(C.width):Math.round(C.clientWidth):0,this.getDrawingHeight=()=>n?n.clientHeight:C?C.clientHeight===void 0?Math.round(C.height):Math.round(C.clientHeight):0,this.onWindowResize=()=>{a.onWindowResize();let t=this.getDrawingWidth()||1,r=this.getDrawingHeight()||1;if(i!=null){let a;n?(a=n.getBoundingClientRect(),i.setSize(t,r)):C&&(C.getBoundingClientRect===void 0?i.setSize(t,r,!1):(a=C.getBoundingClientRect(),C.width=t,C.height=r,i.setSize(t,r,!1))),a&&(a.left,a.top);let o=new e.Vector2;i.getSize(o),o.x,o.y}},this.initialiseVisualisation=async t=>{if(!E){if(t||={},t.antialias===void 0){let e=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e=!0)}catch{e=!1}e?t.antialias=!1:t.antialias=!0}t.canvas&&(n=void 0,C=t.canvas),i=new e.WebGPURenderer(t),await i.init(),n!==void 0&&n.appendChild(i.domElement),i.setClearColor(16777215,1),C&&C.style&&(C.style.height=`100%`,C.style.width=`100%`);let r=i.domElement;r.addEventListener(`webglcontextlost`,D,!1),r.addEventListener(`webglcontextrestored`,O,!1),i.autoClear=!1;let a=this.createScene(`default`);this.setCurrentScene(a),E=!0}};let D=e=>{e.preventDefault();for(let e of Object.keys(c))f.hasOwnProperty(e)&&f[e].call()},O=e=>{e.preventDefault();for(let e of Object.keys(c))m.hasOwnProperty(e)&&m[e].call()};this.getCurrentScene=()=>a,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);let t=a;a=e,t&&t.setInteractiveControlEnable(!1),a.setInteractiveControlEnable(!0),a.setAdditionalScenesGroup(S),this.onWindowResize()}},this.getSceneByName=e=>b[e],this.createScene=e=>{if(b[e]==null){let t;return t=C?new Ln(C,i):new Ln(n,i),b[e]=t,t.sceneName=e,t}},this.resetView=()=>{a.resetView()},this.viewAll=()=>{if(a){let e=a.getBoundingBox();if(e){for(let t=0;t<x.length;t++){let n=x[t].getBoundingBox();n&&e.union(n)}a.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,n,r,i,o)=>{a.loadModelsURL(e,t,n,r,i,o)},this.loadViewURL=e=>{a.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{a.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{a.updateDirectionalLight()};let k=()=>{T?(g=requestAnimationFrame(k),this.render()):(cancelAnimationFrame(g),g=void 0)};this.stopAnimate=()=>{T&&=(o.stop(),!1)},this.animate=()=>{T||(o.start(),T=!0,k())},this.addContextLostCallbackFunction=e=>(p+=1,f[p]=e,p),this.removeContextLostCallbackFunction=e=>{e in f&&delete f[e]},this.addContextRestoredCallbackFunction=e=>(h+=1,m[h]=e,h),this.removeContextRestoredCallbackFunction=e=>{e in h&&delete h[e]},this.addPreRenderCallbackFunction=e=>(l+=1,c[l]=e,l),this.removePreRenderCallbackFunction=e=>{e in c&&delete c[e]},this.addPostRenderCallbackFunction=e=>(d+=1,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>s,this.setPlayRate=e=>{s=e},this.getCurrentTime=()=>a.getCurrentTime(),this.setMorphsTime=e=>{a.setMorphsTime(e)},this.getZincGeometryByID=e=>a.getZincGeometryByID(e),this.addToScene=e=>{a.addObject(e)},this.addToOrthoScene=t=>{if(v??=new e.Scene,_==null){let t=this.getDrawingWidth(),n=this.getDrawingHeight();_=new e.OrthographicCamera(-t/2,t/2,n/2,-n/2,1,10),_.position.z=10}v.add(t)};let A=t=>n=>{n.needsUpdate=!0;let r=new e.SpriteMaterial({map:n}),i=r.map.image.width,a=r.map.image.height;t.material=r,t.scale.set(i,a,1);let o=this.getDrawingWidth(),s=this.getDrawingHeight();t.position.set((o-i)/2,(-s+a)/2,1),this.addToOrthoScene(t)};this.addLogo=()=>{y=new e.Sprite,e.ImageUtils.loadTexture(`images/abi_big_logo_transparent_small.png`,void 0,A(y))},this.render=()=>{w||(n?n.clientWidth>0&&n.clientHeight>0&&(w=new r.ResizeSensor(n,this.onWindowResize)):C&&C.width>0&&C.height>0&&(w=new r.ResizeSensor(C,this.onWindowResize)));let e=o.getDelta();a.renderGeometries(s,e,this.playAnimation);for(let t=0;t<x.length;t++)x[t].renderGeometries(s,e,this.playAnimation);_!=null&&v!=null&&(i.clearDepth(),i.render(v,_));for(let e of Object.keys(c))c.hasOwnProperty(e)&&c[e].call();a.render(i);for(let e of Object.keys(u))u.hasOwnProperty(e)&&u[e].call()},this.forceContextLoss=()=>{},this.forceContextRestore=()=>{},this.getThreeJSRenderer=()=>i,this.isSceneActive=e=>{if(a===e)return!0;for(let t=0;t<x.length;t++)if(x[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(x.push(e),S.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(let t=0;t<x.length;t++)if(x[t]===e){x.splice(t,1),S.remove(e.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let e=0;e<x.length;e++)S.remove(x[e].getThreeJSScene());x.splice(0,x.length)},this.dispose=()=>{T&&cancelAnimationFrame(g);for(let e in b)b.hasOwnProperty(e)&&b[e].clearAll();b=[],x=[],S=new e.Group,this.stopAnimate(),c={},l=0,u={},u=0,f={},p=0,m={},h=0,_=void 0,v=void 0,y=void 0;let t=this.createScene(`default`);this.setCurrentScene(t),w=void 0,i?.dispose()},this.transitionScene=(e,t)=>{if(a){let n=a.getZincCameraControls(),r=e.getBoundingBox();if(r){let e=r.min.distanceTo(r.max)/2,i=(r.min.x+r.max.x)/2,a=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,s=n.getViewportFromCentreAndRadius(i,a,o,e,40,e*4),c=n.getCurrentViewport();n.cameraTransition(c,s,t),n.enableCameraTransition()}}},this.isWebGL2=()=>i?i.capabilities.isWebGL2:!1},zn=class{esize;ecode;edata;littleEndian;constructor(e,t,n,r){if(e%16!=0)throw Error(`This does not appear to be a NIFTI extension`);this.esize=e,this.ecode=t,this.edata=n,this.littleEndian=r}toArrayBuffer(){let e=new Uint8Array(this.esize),t=new Uint8Array(this.edata);e.set(t,8);let n=new DataView(e.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),e.buffer}},F=class e{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(e,t,n){var r=``,i,a;for(i=t;i<n;i+=1)a=e.getUint8(i),a!==0&&(r+=String.fromCharCode(a));return r}static getByteAt=function(e,t){return e.getUint8(t)};static getShortAt=function(e,t,n){return e.getInt16(t,n)};static getIntAt(e,t,n){return e.getInt32(t,n)}static getFloatAt(e,t,n){return e.getFloat32(t,n)}static getDoubleAt(e,t,n){return e.getFloat64(t,n)}static getInt64At(e,t,n){let r=e.getUint32(t,n),i=e.getInt32(t+4,n),a;return a=n?i*2**32+r:r*2**32+i,i<0&&(a+=-1*2**32*2**32),a}static getUint64At(e,t,n){let r=e.getUint32(t+(n?0:4),n),i=e.getUint32(t+(n?4:0),n);return n?i*2**32+r:r*2**32+i}static getExtensionsAt(t,n,r,i){let a=[],o=n;for(;o<i;){let n=r,s=e.getIntAt(t,o,r);if(!s)break;if(s+o>i&&(n=!n,s=e.getIntAt(t,o,n),s+o>i))throw Error(`This does not appear to be a valid NIFTI extension`);if(s%16!=0)throw Error(`This does not appear to be a NIFTI extension`);let c=e.getIntAt(t,o+4,n),l=t.buffer.slice(o+8,o+s),u=new zn(s,c,l,n);a.push(u),o+=s}return a}static toArrayBuffer(e){var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r;for(r=0;r<e.length;r+=1)n[r]=e[r];return t}static isString(e){return typeof e==`string`||e instanceof String}static formatNumber(t,n=void 0){let r;return r=e.isString(t)?Number(t):t,r=n?r.toPrecision(5):r.toPrecision(7),parseFloat(r)}static makeCRCTable(){let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}static crc32(t){e.crcTable||=e.makeCRCTable();let n=e.crcTable,r=-1;for(var i=0;i<t.byteLength;i++)r=r>>>8^n[(r^t.getUint8(i))&255];return(r^-1)>>>0}},Bn=class e{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description=``;aux_file=``;intent_name=``;qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic=`0`;isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var n=new DataView(t),r=F.getIntAt(n,0,this.littleEndian),i,a,o,s;if(r!==e.MAGIC_COOKIE&&(this.littleEndian=!0,r=F.getIntAt(n,0,this.littleEndian)),r!==e.MAGIC_COOKIE)throw Error(`This does not appear to be a NIFTI file!`);for(this.dim_info=F.getByteAt(n,39),i=0;i<8;i+=1)s=40+i*2,this.dims[i]=F.getShortAt(n,s,this.littleEndian);for(this.intent_p1=F.getFloatAt(n,56,this.littleEndian),this.intent_p2=F.getFloatAt(n,60,this.littleEndian),this.intent_p3=F.getFloatAt(n,64,this.littleEndian),this.intent_code=F.getShortAt(n,68,this.littleEndian),this.datatypeCode=F.getShortAt(n,70,this.littleEndian),this.numBitsPerVoxel=F.getShortAt(n,72,this.littleEndian),this.slice_start=F.getShortAt(n,74,this.littleEndian),i=0;i<8;i+=1)s=76+i*4,this.pixDims[i]=F.getFloatAt(n,s,this.littleEndian);if(this.vox_offset=F.getFloatAt(n,108,this.littleEndian),this.scl_slope=F.getFloatAt(n,112,this.littleEndian),this.scl_inter=F.getFloatAt(n,116,this.littleEndian),this.slice_end=F.getShortAt(n,120,this.littleEndian),this.slice_code=F.getByteAt(n,122),this.xyzt_units=F.getByteAt(n,123),this.cal_max=F.getFloatAt(n,124,this.littleEndian),this.cal_min=F.getFloatAt(n,128,this.littleEndian),this.slice_duration=F.getFloatAt(n,132,this.littleEndian),this.toffset=F.getFloatAt(n,136,this.littleEndian),this.description=F.getStringAt(n,148,228),this.aux_file=F.getStringAt(n,228,252),this.qform_code=F.getShortAt(n,252,this.littleEndian),this.sform_code=F.getShortAt(n,254,this.littleEndian),this.quatern_b=F.getFloatAt(n,256,this.littleEndian),this.quatern_c=F.getFloatAt(n,260,this.littleEndian),this.quatern_d=F.getFloatAt(n,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(this.quatern_b**2+this.quatern_c**2+this.quatern_d**2)),this.qoffset_x=F.getFloatAt(n,268,this.littleEndian),this.qoffset_y=F.getFloatAt(n,272,this.littleEndian),this.qoffset_z=F.getFloatAt(n,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){let e=this.quatern_a,t=this.quatern_b,n=this.quatern_c,r=this.quatern_d;for(this.qfac=this.pixDims[0]===0?1:this.pixDims[0],this.quatern_R=[[e*e+t*t-n*n-r*r,2*t*n-2*e*r,2*t*r+2*e*n],[2*t*n+2*e*r,e*e+n*n-t*t-r*r,2*n*r-2*e*t],[2*t*r-2*e*n,2*n*r+2*e*t,e*e+r*r-n*n-t*t]],a=0;a<3;a+=1)for(o=0;o<3;o+=1)this.affine[a][o]=this.quatern_R[a][o]*this.pixDims[o+1],o===2&&(this.affine[a][o]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(a=0;a<3;a+=1)for(o=0;o<4;o+=1)s=280+(a*4+o)*4,this.affine[a][o]=F.getFloatAt(n,s,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=F.getStringAt(n,328,344),this.magic=F.getStringAt(n,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,e.MAGIC_NUMBER2),n.byteLength>e.MAGIC_COOKIE){this.extensionFlag[0]=F.getByteAt(n,348),this.extensionFlag[1]=F.getByteAt(n,349),this.extensionFlag[2]=F.getByteAt(n,350),this.extensionFlag[3]=F.getByteAt(n,351);let e=!0;!this.isHDR&&this.vox_offset<=352&&(e=!1),n.byteLength<=368&&(e=!1),e&&this.extensionFlag[0]&&(this.extensions=F.getExtensionsAt(n,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var t=F.formatNumber,n=``;return n+=`Dim Info = `+this.dim_info+`
|
|
559
|
+
`),i=``,a=``,o=0,s=[],c=typeof``.trimLeft==`function`;for(let e=0,t=r.length;e<t;e++)if(i=r[e],i=c?i.trimLeft():i.trim(),o=i.length,o!==0&&(a=i.charAt(0),a!==`#`)){if(a===`v`){let e=i.split(/\s+/);switch(e[0]){case`v`:n.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?n.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):n.colors.push(void 0,void 0,void 0);break;case`vn`:n.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:n.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if(a===`f`){let e=i.substr(1).trim().split(/\s+/),t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.length>0){let e=r.split(`/`);t.push(e)}}let r=t[0];for(let e=1,i=t.length-1;e<i;e++){let i=t[e],a=t[e+1];n.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a===`l`){let e=i.substring(1).trim().split(` `),t=[],r=[];if(i.indexOf(`/`)===-1)t=e;else for(let n=0,i=e.length;n<i;n++){let i=e[n].split(`/`);i[0]!==``&&t.push(i[0]),i[1]!==``&&r.push(i[1])}n.addLineGeometry(t,r)}else if(a===`p`){let e=i.substr(1).trim().split(` `);n.addPointGeometry(e)}else if((s=pn.exec(i))!==null){let e=(` `+s[0].substr(1).trim()).substr(1);n.startObject(e)}else if(hn.test(i))n.object.startMaterial(i.substring(7).trim(),n.materialLibraries);else if(mn.test(i))n.materialLibraries.push(i.substring(7).trim());else if(gn.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(s=i.split(` `),s.length>1){let e=s[1].trim().toLowerCase();n.object.smooth=e!==`0`&&e!==`off`}else n.object.smooth=!0;let e=n.object.currentMaterial();e&&(e.smooth=n.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}n.finalize();let l=new e.Group;if(l.materialLibraries=[].concat(n.materialLibraries),n.objects.length!==1||n.objects[0].geometry.vertices.length!==0)for(let t=0,r=n.objects.length;t<r;t++){let r=n.objects[t],i=r.geometry,a=r.materials,o=i.type===`Line`,s=i.type===`Points`,c=!1;if(i.vertices.length===0)continue;let u=new e.BufferGeometry;u.setAttribute(`position`,new e.Float32BufferAttribute(i.vertices,3)),i.normals.length>0&&u.setAttribute(`normal`,new e.Float32BufferAttribute(i.normals,3)),i.colors.length>0&&(c=!0,u.setAttribute(`color`,new e.Float32BufferAttribute(i.colors,3))),i.hasUVIndices===!0&&u.setAttribute(`uv`,new e.Float32BufferAttribute(i.uvs,2));let d=[];for(let t=0,r=a.length;t<r;t++){let r=a[t],i=r.name+`_`+r.smooth+`_`+c,l=n.materials[i];if(this.materials!==null){if(l=this.materials.create(r.name),o&&l&&!(l instanceof e.LineBasicMaterial)){let t=new e.LineBasicMaterial;e.Material.prototype.copy.call(t,l),t.color.copy(l.color),l=t}else if(s&&l&&!(l instanceof e.PointsMaterial)){let t=new e.PointsMaterial({size:10,sizeAttenuation:!1});e.Material.prototype.copy.call(t,l),t.color.copy(l.color),t.map=l.map,l=t}}l===void 0&&(l=o?new e.LineBasicMaterial:s?new e.PointsMaterial({size:1,sizeAttenuation:!1}):new e.MeshPhongMaterial,l.name=r.name,l.flatShading=!r.smooth,l.vertexColors=c,n.materials[i]=l),d.push(l)}let f;if(d.length>1){for(let e=0,t=a.length;e<t;e++){let t=a[e];u.addGroup(t.groupStart,t.groupCount,e)}f=o?new e.LineSegments(u,d):s?new e.Points(u,d):new e.Mesh(u,d)}else f=o?new e.LineSegments(u,d[0]):s?new e.Points(u,d[0]):new e.Mesh(u,d[0]);f.name=r.name,l.add(f)}else if(n.vertices.length>0){let t=new e.PointsMaterial({size:1,sizeAttenuation:!1}),r=new e.BufferGeometry;r.setAttribute(`position`,new e.Float32BufferAttribute(n.vertices,3)),n.colors.length>0&&n.colors[0]!==void 0&&(r.setAttribute(`color`,new e.Float32BufferAttribute(n.colors,3)),t.vertexColors=!0);let i=new e.Points(r,t);l.add(i)}return l}},wn=e.FileLoader,Tn=e=>{let t=(e,t)=>{e.metadata.number_of_vertices+=t.metadata.number_of_vertices,`labels`in e&&e.labels.push(...e.labels),[`axis1`,`axis2`,`axis3`,`colors`,`positions`,`scale`].forEach(n=>{n in e&&Object.keys(e[n]).forEach(r=>{let i=t[n][r].length;for(let a=0;a<i;a++)e[n][r].push(t[n][r][a])})})};if(e&&e.length>0)for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}},En=e=>{if(e&&e.length>0){if(e.length===1)return e[0];let t=T(e);return e.forEach(e=>e.dispose()),t}},Dn=function(e,t,n){let r=new wn,i=new Fe;r.crossOrigin=t;let a=e,o=n,s,c=!1,l=!1,u,d=[],f=e=>{let t=s[e.index];if(t){if(`GlyphGeometriesURL`in t)e.onLoad(t);else{let n=i.parse(t);e.onLoad(n.geometry,n.materials)}}else p(e,{responseURL:a})},p=e=>{e.onError&&(u||={responseURL:a},e.onError(u))};this.downloadCompleted=e=>{try{s=JSON.parse(e[0]),c=!1,l=!0,Array.isArray(s)?d.forEach(e=>f(e)):d.forEach(e=>p(e))}catch{d.forEach(e=>p(e))}};let m=()=>e=>{u=e,l=!0,c=!1,d.forEach(e=>{p(e)})},h=()=>e=>{d.forEach(t=>{t.onProgress&&t.onProgress(e)})};this.load=(e,t,n,i)=>{let g={index:e,onLoad:t,onProgress:n,onError:i};l?s?f(g):p(u):c?d.push(g):(d.push(g),c=!0,r.load(a,o,h,m))}},On=function(e,t,n){let r=[],i=e,a=t,o=0,s=n.isGlyphsets;this.itemDownloaded=(e,t)=>{if(r[e]=t,o++,o==i&&r.length>0){if(s){let e=r.map(e=>JSON.parse(e[0]));Tn(e),a(e[0])}else{let t=r[0][1],n=En(r.map(e=>e[0]));for(let t=1;t<i;t++)r[e][0].dispose(),r[e][1].forEach(e=>e.dispose());a(n,t)}}}},kn=function(){let e=0;this.crossOrigin=`Anonymous`;let t=new Fe,n=new wn;n.crossOrigin=`Anonymous`;let r=[],i={},a=(e,t,n,r,i)=>{let a=e.length,o=new On(a,t,i),c=0;e.forEach(e=>{let a=i?{...i}:{};a.msHandler=o,a.order=c,c++,s(e,t,n,r,a)})},o=(t,n,a,o,s)=>{let l=s?{...s}:{},u=i[t];if(!u){if(20>e){let n=new c(void 0,this,l);++e,u=new Dn(t,this.crossOrigin,n),i[t]=u}else r.push({url:t,onLoad:n,onProgress:a,onError:o,options:s})}u&&(l.isHandler=u,u.load(s.index,n,a,o))},s=(i,a,s,l,u)=>{if(u&&u.index!==void 0)o(i,a,s,l,u);else if(20>e){++e;let r=new c(a,this,u),o=new c(l,this,u);u.isGlyphsets?n.load(i,r,s,o):(t.crossOrigin=this.crossOrigin,t.load(i,r,s,o))}else r.push({url:i,onLoad:a,onProgress:s,onError:l,options:u})};this.load=(e,t,n,r,i)=>{Array.isArray(e)?a(e,t,n,r,i):s(e,t,n,r,i)},this.loadFromWaitingList=()=>{for(;20>e;){let e=r.shift();if(e)this.load(e.url,e.onLoad,e.onProgress,e.onError,e.options);else return}},this.itemRemainingCheck=()=>{if(r.length===0&&e===0)for(let e in i)i.hasOwnProperty(e)&&delete i[e]};let c=function(t,n,r){return(...i)=>{--e,r?.msHandler?r.msHandler.itemDownloaded(r.order,i):r?.isHandler?r.isHandler.downloadCompleted(i):t&&t(...i),n.loadFromWaitingList(),n.itemRemainingCheck()}};this.parse=e=>loader.parse(e)},An=class extends e.Loader{constructor(e){super(e)}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(t){function n(e){let t=new DataView(e);if(84+t.getUint32(80,!0)*50===t.byteLength)return!0;let n=[115,111,108,105,100];for(let e=0;e<5;e++)if(r(n,t,e))return!1;return!0}function r(e,t,n){for(let r=0,i=e.length;r<i;r++)if(e[r]!==t.getUint8(n+r,!1))return!1;return!0}function i(t){let n=new DataView(t),r=n.getUint32(80,!0),i,a,o,s=!1,c,l,u,d,f;for(let e=0;e<70;e++)n.getUint32(e,!1)==1129270351&&n.getUint8(e+4)==82&&n.getUint8(e+5)==61&&(s=!0,c=new Float32Array(r*3*3),l=n.getUint8(e+6)/255,u=n.getUint8(e+7)/255,d=n.getUint8(e+8)/255,f=n.getUint8(e+9)/255);let p=new e.BufferGeometry,m=new Float32Array(r*3*3),h=new Float32Array(r*3*3);for(let e=0;e<r;e++){let t=84+e*50,r=n.getFloat32(t,!0),f=n.getFloat32(t+4,!0),p=n.getFloat32(t+8,!0);if(s){let e=n.getUint16(t+48,!0);e&32768?(i=l,a=u,o=d):(i=(e&31)/31,a=(e>>5&31)/31,o=(e>>10&31)/31)}for(let l=1;l<=3;l++){let u=t+l*12,d=e*3*3+(l-1)*3;m[d]=n.getFloat32(u,!0),m[d+1]=n.getFloat32(u+4,!0),m[d+2]=n.getFloat32(u+8,!0),h[d]=r,h[d+1]=f,h[d+2]=p,s&&(c[d]=i,c[d+1]=a,c[d+2]=o)}}return p.setAttribute(`position`,new e.BufferAttribute(m,3)),p.setAttribute(`normal`,new e.BufferAttribute(h,3)),s&&(p.setAttribute(`color`,new e.BufferAttribute(c,3)),p.hasColors=!0,p.alpha=f),p}function a(t){let n=new e.BufferGeometry,r=/solid([\s\S]*?)endsolid/g,i=/facet([\s\S]*?)endfacet/g,a=0,o=`[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,s=RegExp(`vertex`+o+o+o,`g`),c=RegExp(`normal`+o+o+o,`g`),l=[],u=[],d=new e.Vector3,f,p=0,m=0,h=0;for(;(f=r.exec(t))!==null;){m=h;let e=f[0];for(;(f=i.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=c.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=s.exec(n))!==null;)l.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),u.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let t=m,r=h-m;n.addGroup(t,r,p),p++}return n.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),n.setAttribute(`normal`,new e.Float32BufferAttribute(u,3)),n}function o(t){return typeof t==`string`?t:e.LoaderUtils.decodeText(new Uint8Array(t))}function s(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t.buffer||t}return e}let c=s(t);return n(c)?i(c):a(o(t))}},jn=function(){P.call(this),this.isTubeLines=!0;let t={},n={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(n,a,o)=>{if(n&&a){t={geometryIn:n,materialIn:a,options:o};let s=i(r(n)),c=new e.MeshStandardMaterial({color:a.color}),l=new e.Mesh(s,c);this.setMesh(l,o.localTimeEnabled,o.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.setAlpha=function(e){let t=this.getMorph();t.material.opacity=e,t.material.transparent=e<1,t.material.depthWrite=e>.5},this.setWireframe=e=>{let t=this.getMorph();t.material.wireframe=e},this.setTubeLines=(e,a)=>{if(e&&a){let{geometryIn:o}=t,s=this.getMorph();s.geometry.dispose(),n=Object.assign(n,{radius:e,radialSegments:a}),s.geometry=i(r(o))}};let r=t=>{let n=t.getAttribute(`position`),r=[];for(let t=0;t<n.count;t++)r.push(new e.Vector3().fromBufferAttribute(n,t));return r},i=t=>{let{radius:r,radialSegments:i,smooth:a}=n,o;if(a){let n=new e.CatmullRomCurve3(t);o=new e.TubeGeometry(n,t.length,r,i,!1)}else{let n=[];for(let a=0;a+1<t.length;a+=2){let o=new e.LineCurve3(t[a],t[a+1]),s=new e.TubeGeometry(o,1,r,i,!1);n.push(s)}o=T(n,!0),n.forEach(e=>e.dispose())}return o}};jn.prototype=Object.create(P.prototype);var Mn=function(t){let n=t;this.toBeDownloaded=0,this.progressMap={};let r=!1,i=!1,a=new kn;this.getDownloadProgress=()=>{let e=0,t=0,n=!1;for(let r in this.progressMap){let i=this.progressMap[r];e+=i[1],t+=i[0],i[1]==0&&(n=!0)}return n&&(e=0),[e,t,i]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,i=!0,console.error(`There is an issue with external resource ${t?.responseURL?`: `+t?.responseURL:``}.`),e&&e({type:`Error`,xhr:t})};let o=(e,t)=>{let i=t.Default;if(t.Inline)n.setupMultipleViews(i,t.Entries);else{let a=[];for(let[n,r]of Object.entries(t.Entries))if(e){let t=_(r,e);a.push(new Promise((e,r)=>{fetch(t).then(e=>e.json()).then(t=>e({key:n,data:t})).catch(e=>r(e))}))}Promise.all(a).then(e=>{let t={};e.forEach(e=>{t[e.key]=e.data}),n.setupMultipleViews(i,t);let a=n.getZincCameraControls();a&&a.setCurrentViewport(i),r=!0})}};this.loadViewURL=(e,t)=>{this.toBeDownloaded+=1;let i=e;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{n.setupMultipleViews(`default`,{default:e}),n.resetView(),r=!0,--this.toBeDownloaded,t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Fetch failed for URL: ${i}`,e),this.onError(t)({responseURL:i})})},this.loadModelsURL=(e,t,n,r,i,o,s)=>{let c=t.length;this.toBeDownloaded+=c;for(let l=0;l<c;l++){let c=t[l],u=lr.defaultMaterialColor,d=lr.defaultOpacity;n!=null&&n[l]!=null&&(u=!!n[l]),r!=null&&r[l]!=null&&(d=r[l]);let f=0;i!=null&&i[l]!=null&&(f=!!i[l]);let p=!1;o!=null&&o[l]!=null&&(p=!!o[l]),a.load(c,m(e,u,d,f,p,void 0,void 0,void 0,void 0,s),this.onProgress(c),this.onError(s))}},this.loadFromViewURL=(e,t,r)=>{let i=t+`_view.json`;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(i=>{n.loadView(i);let a=[],o=t+`_`;for(let e=0;e<i.numberOfResources;e++){let t=o+(e+1)+`.json`;a.push(t)}this.loadModelsURL(e,a,i.colour,i.opacity,i.timeEnabled,i.morphColour,r)}).catch(e=>{console.error(`Failed to load view data from: ${i}`,e)})};let s=(t,r,i,o,s,c,l,u,d)=>(f,p)=>{let m=u?new jn:new Ye,h;p&&p[0]&&(h=new e.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(h.transparent=!0),h.opacity=p[0].opacity,h.vertexColors=p[0].vertexColors);let g={};if(g.localTimeEnabled=r,g.localMorphColour=i,m&&(m.createLineSegment(f,h,g),m.setName(o),m.setAnatomicalId(s),m.setRenderOrder(c),t.addZincObject(m),m.setDuration(n.getDuration()),l&&l.levels))for(let[e,t]of Object.entries(l.levels))m.addLOD(a,e,t.URL,t.Index,l.preload);--this.toBeDownloaded,f.dispose(),d!=null&&typeof d==`function`&&d(m)};this.loadLinesURL=(e,t,n,r,i,o,c)=>{let l=0;this.toBeDownloaded+=1;let u=c?.isInline?c.isInline:!1,d=c?.anatomicalId?c.anatomicalId:void 0,f=c&&`renderOrder`in c?c.renderOrder:void 0;n!=null&&(l=!!n);let p=0;r!=null&&(p=!!r);let m=c.tubeLines&&!l&&!p;if(u){let n=a.parse(t);s(e,l,p,i,d,f,c.lod,m,o)(n.geometry,n.materials)}else a.load(t,s(e,l,p,i,d,f,c.lod,m,o),this.onProgress(t),this.onError(o),c.loaderOptions)};let c=(e,t,r,i,a)=>o=>{let s=o;(typeof s==`string`||s instanceof String)&&(s=JSON.parse(o));let c=a&&a.isInline?a.isInline:void 0,l=a&&a.anatomicalId?a.anatomicalId:void 0,u=a?.displayLabels;u===void 0&&(u=!0);let d=a&&`renderOrder`in a?a.renderOrder:void 0,f=new Ie;f.setDuration(n.getDuration()),f.groupName=r,++this.toBeDownloaded,f.load(s,t,()=>{--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(f)},c,u),f.setAnatomicalId(l),f.setRenderOrder(d),e.addZincObject(f)};this.loadGlyphsetURL=(e,t,n,r,i,o)=>{o&&o.isInline&&o.isInline?c(e,n,r,i,o)(t):a.load(t,c(e,n,r,i,o),this.onProgress(t),this.onError(i),o.loaderOptions)};let l=(t,r,i,a,o,s,c)=>(l,u)=>{let d=new Je,f=new e.PointsMaterial({alphaTest:.05,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(f.transparent=!0),f.opacity=u[0].opacity,f.color=u[0].color,f.vertexColors=!1);let p={};p.localTimeEnabled=r,p.localMorphColour=i,d&&(d.createMesh(l,f,p),d.setName(a),d.setAnatomicalId(o),t.addZincObject(d),d.setDuration(n.getDuration()),d.setRenderOrder(s)),l.dispose(),--this.toBeDownloaded,c!=null&&typeof c==`function`&&c(d)};this.loadSTL=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=lr.defaultMaterialColor,a=lr.defaultOpacity,o=new An;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))},this.loadOBJ=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=lr.defaultMaterialColor,a=lr.defaultOpacity,o=new Cn;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))};let u=(e,t,n,r,i,o,s)=>{this.toBeDownloaded+=1;let c=lr.defaultMaterialColor,l=lr.defaultOpacity,u=0,d=s&&s.isInline?s.isInline:!1,f=s&&s.fileFormat?s.fileFormat:void 0,p=s&&s.anatomicalId?s.anatomicalId:void 0,h=s&&`renderOrder`in s?s.renderOrder:void 0;n!=null&&(u=!!n);let g=0;r!=null&&(g=!!r);let _=a;if(f!==void 0){if(f==`STL`)_=new An;else if(f==`OBJ`){_=new Cn,_.crossOrigin=`Anonymous`,_.load(t,objloader(e,c,l,u,g,i,p,o),this.onProgress(t),this.onError,s.loaderOptions);return}}if(d){let n=a.parse(t);m(e,c,l,u,g,i,p,h,s,o)(n.geometry,n.materials)}else _.crossOrigin=`Anonymous`,a.load(t,m(e,c,l,u,g,i,p,h,s,o),this.onProgress(t),this.onError(o),s.loaderOptions)},d=function(e,t,i){let a=0;return o=>{if(a+=1,o&&t!=null&&typeof t==`function`&&t(o),a==e&&(r===!1&&n.viewAll(),i!=null&&typeof i==`function`)){i();let e=n.getZincCameraControls();e&&e.calculateMaxAllowedDistance(n)}}};this.loadPointsetURL=(e,t,n,r,i,o,s)=>{let c=0;this.toBeDownloaded+=1,n!=null&&(c=!!n);let u=0;r!=null&&(u=!!r);let d=s&&s.isInline?s.isInline:!1,f=s&&s.anatomicalId?s.anatomicalId:void 0,p=s&&`renderOrder`in s?s.renderOrder:void 0;if(d){let n=a.parse(t);l(e,c,u,i,f,p,o)(n.geometry,n.materials)}else a.load(t,l(e,c,u,i,f,p,o),this.onProgress(t),this.onError(o),s.loaderOptions)};let f=(e,t,n,r,i,a)=>{let o=a&&a.isInline?a.isInline:void 0,s=a&&a.anatomicalId?a.anatomicalId:void 0,c=a&&`renderOrder`in a?a.renderOrder:void 0,l;if(n){if(t&&n.images&&n.images.source){let e=n.images.source;for(let r=0;r<e.length;r++){let i=_(e[r],t);n.images.source[r]=i}}n.type===`slides`&&(l=new tt),l&&(l.groupName=r,++this.toBeDownloaded,l.load(n,()=>{e.addZincObject(l),--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(l)},o),l.setAnatomicalId(s),l.setRenderOrder(c))}};this.loadTextureURL=(e,t,n,r,i)=>{if(i&&i.isInline&&i.isInline)f(e,void 0,t,n,r,i);else{let a=t;fetch(a).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(a).href;return e.json().then(e=>({textureData:e,referenceURL:t}))}).then(({textureData:t,referenceURL:a})=>{f(e,a,t,n,r,i)}).catch(e=>{console.error(`Fetch failed for texture URL: ${a}`,e)})}};let p=(e,t,r,i,a,o,s,c,l,u,d)=>{let f={};f.colour=r,f.opacity=i,f.localTimeEnabled=a,f.localMorphColour=o;let p=new Se;if(p.createMesh(t,c,f),p.getMorph())return p.setName(l),p.setRenderOrder(u),p.setAnatomicalId(d),e&&e.addZincObject(p),p.setDuration(n.getDuration()),s!=null&&typeof s==`function`&&s(p),p.videoHandler&&n.setVideoHandler(p.videoHandler),p},m=(e,t,n,r,i,o,s,c,l,u)=>(d,f)=>{let m;f&&f[0]&&(m=f[0]);let h=p(e,d,t,n,r,i,void 0,m,o,c,s);if(l.lod&&l.lod.levels)for(let[e,t]of Object.entries(l.lod.levels))h.addLOD(a,e,t.URL,t.Index,l.lod.preload);--this.toBeDownloaded,d.dispose(),u!=null&&typeof u==`function`&&u(h)},h=e=>{let[,t,n,r,i,a,o,s]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:n,weeks:r,days:i,hours:a,mins:o,secs:s}};this.loadSettings=e=>{if(e){if(e.Duration){let t=h(e.Duration);n.setDurationFromObject(t)}if(e.OriginalDuration){let t=h(e.OriginalDuration);n.setOriginalDurationFromObject(t)}if(e.TimeStamps)for(let t in e.TimeStamps){let r=h(e.TimeStamps[t]);n.addMetadataTimeStamp(t,r)}}};let g=(e,t,n,r,i)=>{if(n){let a,o=!1;n.URL?(a=n.URL,t&&(a=_(a,t))):n.Inline&&(a=n.Inline.URL,o=!0);let s={};if(n.LOD&&n.LOD.Levels){s.preload=!!n.LOD.Preload,s.levels={};for(let[e,r]of Object.entries(n.LOD.Levels))s.levels[e]={},s.levels[e].URL=_(r.URL,t),s.levels[e].Index=r.Index}let c=n.GroupName;(c===void 0||c===``)&&(c=`_Unnamed`);let l={loaderOptions:{index:n.Index},isInline:o,fileFormat:n.FileFormat,anatomicalId:n.AnatomicalId,compression:n.compression,tubeLines:n.tubeLines,lod:s,renderOrder:r};switch(n.Type){case`Surfaces`:u(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Glyph`:let r;o?r=n.Inline.GlyphGeometriesURL:(r=n.GlyphGeometriesURL,r=_(n.GlyphGeometriesURL,t)),l.displayLabels=n.DisplayLabels,l.displayLabels===void 0&&(l.displayLabels=!0),l.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(e,a,r,c,i,l);break;case`Points`:this.loadPointsetURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Lines`:this.loadLinesURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Texture`:this.loadTextureURL(e,a,c,i,l)}}},v=(e,t,i)=>{if(t){let a,o=!1;switch(t.URL?(a=t.URL,e&&(a=_(t.URL,e))):t.Inline&&(a=t.Inline.URL,o=!0),t.Type){case`View`:o?(n.setupMultipleViews(`default`,{default:a}),r=!0,i!=null&&typeof i==`function`&&i()):this.loadViewURL(a,i);break;case`Settings`:this.loadSettings(t)}}};this.loadGLTF=(e,t,r,i,a)=>{new fn().load(n,e,t,r,i,a)};let y=(e,t,n,r)=>{if(n.Primitives&&n.Primitives.forEach(n=>{let i=1;n.Order&&(i=n.Order),g(e,t,n,i,r)}),n.Transformation&&e.setTransformation(n.Transformation),n.Children)for(let[i,a]of Object.entries(n.Children)){let n=e.findOrCreateChildFromPath(i);n&&y(n,t,a,r)}},b=(e,t)=>{let n=e,r=t?.enabled?.include,i=t?.enabled?.exclude,a=t?.tubeLines;return(r?.length||i?.length)&&(r&&(n=e.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<r.length;t++)if(k(e.RegionPath,e.GroupName,r[t]))return!0;return!1})),i&&(n=n.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<i.length;t++)if(k(e.RegionPath,e.GroupName,i[t]))return!1;return!0}))),a&&n.forEach(e=>{e.Type===`Lines`&&(e.tubeLines=!0)}),n},x=(e,t)=>Array.isArray(e)?b(e,t):e,S=(e,t)=>{if(Array.isArray(e)){let n=0;for(let r=0;r<e.length;r++)e[r].Type&&(t&&e[r].Type===`View`||e[r].Type===`Surfaces`||e[r].Type===`Glyph`||e[r].Type===`Points`||e[r].Type===`Lines`||e[r].Type===`Texture`)&&n++;return n}return 0},C=e=>{let t=e.Primitives?S(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach(e=>{t+=C(e)}),t},w=e=>{if(Array.isArray(e))return S(e,!0);if(typeof e==`object`&&e&&e.Version===`2.0`)return C(e.Regions)},T=(e,t,n,r,i)=>{let a=e;n.RegionPath&&n.RegionPath!==``&&(a=e.findOrCreateChildFromPath(n.RegionPath)),g(a,t,n,r*2,i)},E=(e,t,n,r,i,a)=>{let o=x(t,a),s=w(o),c=new d(s,r,i);for(let e=0;e<t.length;e++)v(n,o[e],c);for(let r=0;r<t.length;r++)T(e,n,o[r],r,c)},D=(e,t,n,r,i)=>{let a=w(t),s=new d(a,r,i);t.Settings&&this.loadSettings(t.Settings),t.Views&&o(n,t.Views,n),t.Regions&&y(e,n,t.Regions,s)};this.loadMetadataURL=(e,t,i,a,o)=>{let s=t;fetch(s).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(s).href;return e.json().then(e=>({metadata:e,referenceURL:t}))}).then(({metadata:t,referenceURL:s})=>{n.resetMetadata(),n.resetDuration(),r=!1,Array.isArray(t)?E(e,t,s,i,a,o):typeof t==`object`&&t&&t.Version===`2.0`&&D(e,t,s,i,a)}).catch(e=>{console.error(`Fetch failed for URL: ${s}`,e)})}},Nn=0,Pn=function(){return`sc`+Nn++},Fn=function(){return{Duration:`6 secs`,OriginalDuration:`-`,TimeStamps:{}}},In=6e3,Ln=function(t,n){let r=t,i,a,o=new Mn(this),s,c={},l=0,u={},d=0,f=new e.Scene,p=new e.Scene,m=new Ht(void 0,this);f.add(m.getGroup());let h=new e.Group;f.add(h),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let g=6e3,_;this.sceneName=void 0;let v=!1,y;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:`top-right`,updateRequired:!0};let b={x:0,y:0},x=Fn(),S=new e.Vector2,C=[];this.forcePickableObjectsUpdate=!1,this.uuid=Pn();let w=new ht(this);w.disable(),f.add(w.group);let T={main:[],mini:[]},k=new e.Vector3(0,0,0),A=()=>r?r.clientWidth===void 0?r.width:r.clientWidth:0,ee=()=>r?r.clientHeight===void 0?r.height:r.clientHeight:0;this.getDownloadProgress=()=>o.getDownloadProgress(),this.onWindowResize=()=>{let e=ee();this.camera.aspect=A()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,_.onResize(),_.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),_.resetView()},this.changeZoomByScrollRateUnit=e=>{_.changeZoomByScrollRateUnit(e)},this.camera=new e.PerspectiveCamera(40,A()/ee(),0,10),this.ambient=new e.AmbientLight(16777215,.2),f.add(this.ambient),this.directionalLight=new e.DirectionalLight(16777215,.7*Math.PI),f.add(this.directionalLight),_=new rt(this.camera,n.domElement,n,this),_.setDirectionalLight(this.directionalLight),_.resetView(),s=new gt(this),this.loadView=e=>{let t=new nt;return t.setFromObject(e),_.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(let[e,n]of Object.entries(t)){let t=new nt;t.setFromObject(n),_.addViewport(e,t)}_.setDefaultViewport(e)},this.getBoundingBox=()=>m.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){let t=_.getViewportFromBoundingBox(e,1);_.setCurrentCameraSettings(t),_.calculateHeightPerPixelAtZeroDepth(ee()),w.markerUpdateRequired=!0}},this.viewAll=()=>{let e=this.getBoundingBox();this.viewAllWithBoundingBox(e),w.markerUpdateRequired=!0},this.forEachGeometry=e=>{m.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{m.forEachGlyphset(e,!0)},this.forEachPointset=e=>{m.forEachPointset(e,!0)},this.forEachLine=e=>{m.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>m.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>m.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>m.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>m.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>m.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>m.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n].getBoundingBox();r&&(t?t.union(r):t=r)}return t},this.vectorToScreenXY=e=>{e.project(this.camera);let t=A(),n=ee(),r=t/2,i=n/2;return e.x=e.x*r+r,e.y=-(e.y*i)+i,e},this.getObjectsScreenXY=t=>{if(t&&t.length>0){let n=this.getBoundingBoxOfZincObjects(t),r=new e.Vector3;return n.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{let t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(m.addZincObject(e),_&&_.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,n,r)=>{o.loadGlyphsetURL(m,e,t,n,r)},this.loadPointsetURL=(e,t,n,r,i)=>{o.loadPointsetURL(m,e,t,n,r,i)},this.loadLinesURL=(e,t,n,r,i)=>{o.loadLinesURL(m,e,t,n,r,i)},this.loadSTL=(e,t,n)=>{o.loadSTL(m,e,t,n)},this.loadOBJ=(e,t,n)=>{o.loadOBJ(m,e,t,n)},this.loadMetadataURL=(e,t,n,r)=>{o.loadMetadataURL(m,e,t,n,r)},this.loadModelsURL=(e,t,n,r,i,a)=>{o.loadModelsURL(m.urls,t,n,r,i,a)},this.loadViewURL=e=>{o.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{o.loadFromViewURL(e,t)},this.loadGLTF=(e,t,n,r)=>{o.loadGLTF(m,e,t,n,r)},this.updateDirectionalLight=()=>{_.updateDirectionalLight()},this.addObject=e=>{f.add(e)},this.removeObject=e=>{f.remove(e)},this.getCurrentTime=()=>{if(a!=null)return a.getCurrentTime(g);let e=m.getCurrentTime();return e===-1?0:e},this.setMorphsTime=e=>{a?.setMorphTime(e,g),m.setMorphTime(e,!0)},this.isTimeVarying=()=>a&&a.video&&!a.video.error?!0:m.isTimeVarying(),this.renderGeometries=(e,t,n)=>{let r={};if(r.camera=_,r.displayMarkers=this.displayMarkers,r.markerCluster=w,r.markersList=w.markers,r.ndcToBeUpdated=!1,n&&(r.markerCluster.markerUpdateRequired=!0),a){if(a.isReadyToPlay()){n?a.video.play():a.video.pause();let e=a.video.currentTime/a.getVideoDuration()*g;o.toBeDownloaded==0?(_.setTime(e),r.ndcToBeUpdated=_.update(0),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(ee()),m.setMorphTime(e,!0),m.renderGeometries(0,0,n,_,r,!0)):_.update(0)}}else o.toBeDownloaded==0?(r.ndcToBeUpdated=_.update(t),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(ee()),m.renderGeometries(e,t,n,_,r,!0)):_.update(0)},this.getThreeJSScene=()=>f,this.setVideoHandler=e=>{a||=e},this.setAdditionalScenesGroup=e=>{f.add(e)};let j=(e,t,n,r,i,a,o)=>{let s=0,c=0;return c=e.includes(`top`)?o-i-n:e.includes(`bottom`)?n:Math.floor((o-i)/2),s=e.includes(`left`)?t:e.includes(`right`)?a-t-r:Math.floor((a-r)/2),{x:s,y:c}},M=e=>{(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(S),this.minimapScissor.updateRequired&&(b=j(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,S.x,S.y),this.minimapScissor.updateRequired=!1),e.setScissor(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),s.updateCamera(),this.displayMiniAxes?e.render(p,s.camera):(f.add(s.mask),e.render(f,s.camera),f.remove(s.mask)),e.setScissorTest(!1),e.setViewport(0,0,S.x,S.y))};this.render=e=>{this.autoClearFlag&&e.clear(),v&&y?y.render(f,this.camera):(e.render(f,this.camera),M(e))},this.setInteractiveControlEnable=e=>{e==1?_.enable():_.disable()},this.getZincCameraControls=()=>_,this.getThreeJSScene=()=>f,this.setDuration=e=>{m.setDuration(e),g=e,_.setPathDuration(e),o.duration=e},this.getDuration=()=>g,this.setStereoEffectEnable=e=>{e==1&&(y||=new lt(n)),n.setSize(A(),ee()),this.camera.updateProjectionMatrix(),v=e},this.objectIsInScene=e=>m.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(t,n)=>{if(t){t.getCenter(k);let r=this.getZincCameraControls().getCurrentViewport(),i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(i,a).normalize(),s.subVectors(i,k).normalize();let c=new e.Vector3;c.crossVectors(o,s);let l=o.angleTo(s);n>0?(this.getZincCameraControls().rotateCameraTransition(c,l,n),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(c,l),w.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,n)=>{if(e){let r=this.getZincCameraControls().getCurrentViewport(),i=this.getZincCameraControls().getViewportFromBoundingBox(e,t);n>0&&(this.getZincCameraControls().cameraTransition(r,i,n),this.getZincCameraControls().enableCameraTransition()),w.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){let n=e.getBoundingBox();this.alignBoundingBoxToCameraView(n,t)}},this.setCameraTargetToObject=t=>{if(this.objectIsInScene(t)){let n=t.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();n.getCenter(k);let i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(a,i),s.addVectors(k,o),r.eyePosition[0]=s.x,r.eyePosition[1]=s.y,r.eyePosition[2]=s.z,r.targetPosition[0]=k.x,r.targetPosition[1]=k.y,r.targetPosition[2]=k.z,this.getZincCameraControls().setCurrentCameraSettings(r),w.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>v,this.removeZincObject=e=>{m.removeZincObject(e),_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{C.length=0,w.isEnabled&&C.push(w.group),m.getPickableThreeJSObjects(C,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||m.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),C),this.getNormalisedMinimapCoordinates=(t,n)=>{if(this.displayMinimap){let r=new e.Vector2;t.getSize(r);let i=r.y-n.clientY;if(b.x+this.minimapScissor.width>n.clientX&&n.clientX>b.x&&b.y+this.minimapScissor.height>i&&i>b.y)return{x:(n.clientX-b.x)/this.minimapScissor.width*2-1,y:(i-b.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>{if(s)return s.getDiffFromNormalised(e,t)},this.isWebGL2=()=>n.isWebGL2(),this.clearAll=()=>{w.clear(),m.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),o.toBeDwonloaded=0,_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{x.TimeStamps[e]=te(t)},this.getMetadataTag=e=>x[e],this.getMetadata=()=>x,this.setMetadataTag=(e,t)=>{x[e]=t},this.removeMetadataTag=e=>{delete x[e]},this.resetMetadata=()=>{x=Fn()},this.resetDuration=()=>{this.setDuration(In)};let N=e=>[...e.years?[`${e.years}years`]:[],...e.months?[`${e.months}months`]:[],...e.weeks?[`${e.weeks}weeks`]:[],...e.days?[`${e.days}days`]:[],...e.hours?[`${e.hours}hours`]:[],...e.mins?[`${e.mins}mins`]:[],...e.secs?[`${e.secs}secs`]:[]].join(` `),te=e=>e.years?e.years*31536e6:0+e.months?e.months*2592e6:0+e.weeks?e.weeks*6048e5:0+e.days?e.days*864e5:0+e.hours?e.hours*36e5:0+e.mins?e.mins*6e4:0+e.secs?e.secs*1e3:0;this.setDurationFromObject=e=>{let t=N(e),n=te(e);this.setMetadataTag(`Duration`,t),this.setDuration(n)},this.setOriginalDurationFromObject=e=>{let t=N(e);this.setMetadataTag(`OriginalDuration`,t)},this.exportGLTF=e=>new dn(this).exportGLTF(e),this.getRootRegion=()=>m,this.createLines=(e,t,n,r)=>{let i=m.findChildFromPath(e);return i===void 0&&(i=m.createChildFromPath(e)),i.createLines(t,n,r)},this.createPoints=(e,t,n,r,i)=>{let a=m.findChildFromPath(e);return a===void 0&&(a=m.createChildFromPath(e)),a.createPoints(t,n,r,i)},this.addZincObjectAddedCallbacks=e=>(l+=1,c[l]=e,l),this.addZincObjectRemovedCallbacks=e=>(d+=1,u[d]=e,d),this.removeZincObjectAddedCallbacks=e=>{e in l&&delete c[e]},this.removeZincObjectRemovedCallbacks=e=>{e in d&&delete u[e]},this.clearZincObjectAddedCallbacks=()=>{c={},l=0},this.clearZincObjectRemovedCallbacks=()=>{u={},d=0},this.triggerObjectAddedCallback=e=>{for(let t in c)c.hasOwnProperty(t)&&c[t](e)},this.triggerObjectRemovedCallback=e=>{for(let t in u)u.hasOwnProperty(t)&&u[t](e)},this.addTemporaryPoints=(e,t)=>{let n=We(e.length),r=He(D());r.color.set(t),r.size=15,r.userData.uniforms.pointSize.value=15,r.alphaTest=.5;let i=new Be(n,r,e.length);i.pointPositions=new Float32Array(e.length*3);let a=n.getAttribute(`instancePosition`);return e.forEach((e,t)=>{a.setXYZ(t,e[0],e[1],e[2]),i.pointPositions[t*3]=e[0],i.pointPositions[t*3+1]=e[1],i.pointPositions[t*3+2]=e[2]}),a.needsUpdate=!0,h.add(i),i},this.addTemporaryLines=(t,n)=>{let r=new pe(E(t.length,t),new e.LineBasicMaterial({color:n}));return h.add(r),r},this.enableFrustumDisplay=()=>{this.camera&&!i&&(i=new e.CameraHelper(this.camera),f.add(i))},this.disableFrustumDisplay=()=>{i&&=(f.remove(i),i.dispose(),void 0)},this.removeTemporaryPrimitive=e=>{h.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{let e=0;return h.children.forEach(t=>{t.geometry.dispose(),t.material.dispose(),e++}),h.clear(),e},this.addBoundingBoxPrimitive=(t,n,r,i,a,o=void 0)=>{let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();k.set(0,0,0);let l=k.subVectors(c.max,c.min),u=new e.BoxGeometry(l.x,l.y,l.z),d=s.createGeometryFromThreeJSGeometry(n,u,r,i,a,1e4);return l.addVectors(c.min,c.max).multiplyScalar(.5),d.setPosition(l.x,l.y,l.z),d},this.addSlicesPrimitive=(t,n,r,i,a,o=void 0)=>{if(n&&n.length>=3&&r&&r.length>=3){let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();k.set(0,0,0);let l=k.subVectors(c.max,c.min),u=[`x`,`y`,`z`],d=[],f=0;return u.forEach(t=>{let o;switch(t){case`x`:o=new e.PlaneGeometry(l.z,l.y),o.rotateY(Math.PI/2);break;case`y`:o=new e.PlaneGeometry(l.x,l.z),o.rotateX(Math.PI/2);break;case`z`:o=new e.PlaneGeometry(l.x,l.y)}let c=s.createGeometryFromThreeJSGeometry(n[f],o,r[f],i,a,10001);d.push(c),f++}),l.addVectors(c.min,c.max).multiplyScalar(.5),d.forEach(e=>{e.setPosition(l.x,l.y,l.z)}),d}},this.enableMarkerCluster=e=>{e?(w.markerUpdateRequired=!0,w.enable()):(w.markerUpdateRequired=!1,w.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,T.main&&(this.enableAxisDisplay(!1,!1),T.main.forEach(e=>{e.dispose&&e.dispose()})),T.mini&&(this.enableAxisDisplay(!1,!0),T.mini.forEach(e=>{e.dispose&&e.dispose()})),T={main:[],mini:[]}},this.createAxisDisplay=(t=!1)=>{this.destroyAxisDisplay();let n=[{name:`x`,dir:new e.Vector3(1,0,0),colour:`red`,hex:16733525},{name:`y`,dir:new e.Vector3(0,1,0),colour:`green`,hex:5635925},{name:`z`,dir:new e.Vector3(0,0,1),colour:`blue`,hex:5592575}],r=this.getBoundingBox(),i=r.min.distanceTo(r.max),a=new e.Vector3(0,0,0);t&&a.copy(r.min),n.forEach(t=>{let n=new e.ArrowHelper(t.dir,a,i,t.hex);T.main.push(n);let o=new e.ArrowHelper(t.dir,r.getCenter(k),i/2,t.hex);T.mini.push(o);let s=O(t.name,.036,t.colour,`Asap`,120,700),c=t.dir.clone().multiplyScalar(i).add(a);s.position.set(c.x,c.y,c.z),T.main.push(s)})},this.enableAxisDisplay=(e,t=!1)=>{t&&T?.mini?.length?(this.displayMiniAxes=e,T.mini.forEach(t=>{e?p.add(t):p.remove(t)})):!t&&T.main&&T.main.forEach(t=>{e?f.add(t):f.remove(t)})}},Rn=function(t){let n=t,i,a,o=new e.Timer;this.playAnimation=!0;let s=1e3,c={},l=0,u={},d=0,f={},p=0,m={},h=0,g,_,v,y,b=[],x=[],S=new e.Group,C,w,T=!1,E=!1;this.getDrawingWidth=()=>n?n.clientWidth:C?C.clientWidth===void 0?Math.round(C.width):Math.round(C.clientWidth):0,this.getDrawingHeight=()=>n?n.clientHeight:C?C.clientHeight===void 0?Math.round(C.height):Math.round(C.clientHeight):0,this.onWindowResize=()=>{a.onWindowResize();let t=this.getDrawingWidth()||1,r=this.getDrawingHeight()||1;if(i!=null){let a;n?(a=n.getBoundingClientRect(),i.setSize(t,r)):C&&(C.getBoundingClientRect===void 0?i.setSize(t,r,!1):(a=C.getBoundingClientRect(),C.width=t,C.height=r,i.setSize(t,r,!1))),a&&(a.left,a.top);let o=new e.Vector2;i.getSize(o),o.x,o.y}},this.initialiseVisualisation=async t=>{if(!E){if(t||={},t.antialias===void 0){let e=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e=!0)}catch{e=!1}e?t.antialias=!1:t.antialias=!0}if(t.canvas&&(n=void 0,C=t.canvas),t.device===void 0&&t.requiredLimits===void 0&&typeof navigator<`u`&&navigator.gpu)try{let e=await navigator.gpu.requestAdapter({powerPreference:t.powerPreference});e&&(t.requiredLimits={maxTextureArrayLayers:e.limits.maxTextureArrayLayers})}catch{}i=new e.WebGPURenderer(t),await i.init(),n!==void 0&&n.appendChild(i.domElement),i.setClearColor(16777215,1),C&&C.style&&(C.style.height=`100%`,C.style.width=`100%`);let r=i.domElement;r.addEventListener(`webglcontextlost`,D,!1),r.addEventListener(`webglcontextrestored`,O,!1),i.autoClear=!1;let a=this.createScene(`default`);this.setCurrentScene(a),E=!0}};let D=e=>{e.preventDefault();for(let e of Object.keys(c))f.hasOwnProperty(e)&&f[e].call()},O=e=>{e.preventDefault();for(let e of Object.keys(c))m.hasOwnProperty(e)&&m[e].call()};this.getCurrentScene=()=>a,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);let t=a;a=e,t&&t.setInteractiveControlEnable(!1),a.setInteractiveControlEnable(!0),a.setAdditionalScenesGroup(S),this.onWindowResize()}},this.getSceneByName=e=>b[e],this.createScene=e=>{if(b[e]==null){let t;return t=C?new Ln(C,i):new Ln(n,i),b[e]=t,t.sceneName=e,t}},this.resetView=()=>{a.resetView()},this.viewAll=()=>{if(a){let e=a.getBoundingBox();if(e){for(let t=0;t<x.length;t++){let n=x[t].getBoundingBox();n&&e.union(n)}a.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,n,r,i,o)=>{a.loadModelsURL(e,t,n,r,i,o)},this.loadViewURL=e=>{a.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{a.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{a.updateDirectionalLight()};let k=()=>{T?(g=requestAnimationFrame(k),this.render()):(cancelAnimationFrame(g),g=void 0)};this.stopAnimate=()=>{T&&=!1},this.animate=()=>{T||(o.reset(),T=!0,k())},this.addContextLostCallbackFunction=e=>(p+=1,f[p]=e,p),this.removeContextLostCallbackFunction=e=>{e in f&&delete f[e]},this.addContextRestoredCallbackFunction=e=>(h+=1,m[h]=e,h),this.removeContextRestoredCallbackFunction=e=>{e in h&&delete h[e]},this.addPreRenderCallbackFunction=e=>(l+=1,c[l]=e,l),this.removePreRenderCallbackFunction=e=>{e in c&&delete c[e]},this.addPostRenderCallbackFunction=e=>(d+=1,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>s,this.setPlayRate=e=>{s=e},this.getCurrentTime=()=>a.getCurrentTime(),this.setMorphsTime=e=>{a.setMorphsTime(e)},this.getZincGeometryByID=e=>a.getZincGeometryByID(e),this.addToScene=e=>{a.addObject(e)},this.addToOrthoScene=t=>{if(v??=new e.Scene,_==null){let t=this.getDrawingWidth(),n=this.getDrawingHeight();_=new e.OrthographicCamera(-t/2,t/2,n/2,-n/2,1,10),_.position.z=10}v.add(t)};let A=t=>n=>{n.needsUpdate=!0;let r=new e.SpriteMaterial({map:n}),i=r.map.image.width,a=r.map.image.height;t.material=r,t.scale.set(i,a,1);let o=this.getDrawingWidth(),s=this.getDrawingHeight();t.position.set((o-i)/2,(-s+a)/2,1),this.addToOrthoScene(t)};this.addLogo=()=>{y=new e.Sprite,e.ImageUtils.loadTexture(`images/abi_big_logo_transparent_small.png`,void 0,A(y))},this.render=()=>{w||(n?n.clientWidth>0&&n.clientHeight>0&&(w=new r.ResizeSensor(n,this.onWindowResize)):C&&C.width>0&&C.height>0&&(w=new r.ResizeSensor(C,this.onWindowResize))),o.update();let e=o.getDelta();a.renderGeometries(s,e,this.playAnimation);for(let t=0;t<x.length;t++)x[t].renderGeometries(s,e,this.playAnimation);_!=null&&v!=null&&(i.clearDepth(),i.render(v,_));for(let e of Object.keys(c))c.hasOwnProperty(e)&&c[e].call();a.render(i);for(let e of Object.keys(u))u.hasOwnProperty(e)&&u[e].call()},this.forceContextLoss=()=>{},this.forceContextRestore=()=>{},this.getThreeJSRenderer=()=>i,this.isSceneActive=e=>{if(a===e)return!0;for(let t=0;t<x.length;t++)if(x[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(x.push(e),S.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(let t=0;t<x.length;t++)if(x[t]===e){x.splice(t,1),S.remove(e.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let e=0;e<x.length;e++)S.remove(x[e].getThreeJSScene());x.splice(0,x.length)},this.dispose=()=>{T&&cancelAnimationFrame(g);for(let e in b)b.hasOwnProperty(e)&&b[e].clearAll();b=[],x=[],S=new e.Group,this.stopAnimate(),c={},l=0,u={},u=0,f={},p=0,m={},h=0,_=void 0,v=void 0,y=void 0;let t=this.createScene(`default`);this.setCurrentScene(t),w=void 0,i?.dispose()},this.transitionScene=(e,t)=>{if(a){let n=a.getZincCameraControls(),r=e.getBoundingBox();if(r){let e=r.min.distanceTo(r.max)/2,i=(r.min.x+r.max.x)/2,a=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,s=n.getViewportFromCentreAndRadius(i,a,o,e,40,e*4),c=n.getCurrentViewport();n.cameraTransition(c,s,t),n.enableCameraTransition()}}},this.isWebGL2=()=>i?i.capabilities.isWebGL2:!1},zn=class{esize;ecode;edata;littleEndian;constructor(e,t,n,r){if(e%16!=0)throw Error(`This does not appear to be a NIFTI extension`);this.esize=e,this.ecode=t,this.edata=n,this.littleEndian=r}toArrayBuffer(){let e=new Uint8Array(this.esize),t=new Uint8Array(this.edata);e.set(t,8);let n=new DataView(e.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),e.buffer}},F=class e{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(e,t,n){var r=``,i,a;for(i=t;i<n;i+=1)a=e.getUint8(i),a!==0&&(r+=String.fromCharCode(a));return r}static getByteAt=function(e,t){return e.getUint8(t)};static getShortAt=function(e,t,n){return e.getInt16(t,n)};static getIntAt(e,t,n){return e.getInt32(t,n)}static getFloatAt(e,t,n){return e.getFloat32(t,n)}static getDoubleAt(e,t,n){return e.getFloat64(t,n)}static getInt64At(e,t,n){let r=e.getUint32(t,n),i=e.getInt32(t+4,n),a;return a=n?i*2**32+r:r*2**32+i,i<0&&(a+=-1*2**32*2**32),a}static getUint64At(e,t,n){let r=e.getUint32(t+(n?0:4),n),i=e.getUint32(t+(n?4:0),n);return n?i*2**32+r:r*2**32+i}static getExtensionsAt(t,n,r,i){let a=[],o=n;for(;o<i;){let n=r,s=e.getIntAt(t,o,r);if(!s)break;if(s+o>i&&(n=!n,s=e.getIntAt(t,o,n),s+o>i))throw Error(`This does not appear to be a valid NIFTI extension`);if(s%16!=0)throw Error(`This does not appear to be a NIFTI extension`);let c=e.getIntAt(t,o+4,n),l=t.buffer.slice(o+8,o+s),u=new zn(s,c,l,n);a.push(u),o+=s}return a}static toArrayBuffer(e){var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r;for(r=0;r<e.length;r+=1)n[r]=e[r];return t}static isString(e){return typeof e==`string`||e instanceof String}static formatNumber(t,n=void 0){let r;return r=e.isString(t)?Number(t):t,r=n?r.toPrecision(5):r.toPrecision(7),parseFloat(r)}static makeCRCTable(){let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}static crc32(t){e.crcTable||=e.makeCRCTable();let n=e.crcTable,r=-1;for(var i=0;i<t.byteLength;i++)r=r>>>8^n[(r^t.getUint8(i))&255];return(r^-1)>>>0}},Bn=class e{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description=``;aux_file=``;intent_name=``;qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic=`0`;isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var n=new DataView(t),r=F.getIntAt(n,0,this.littleEndian),i,a,o,s;if(r!==e.MAGIC_COOKIE&&(this.littleEndian=!0,r=F.getIntAt(n,0,this.littleEndian)),r!==e.MAGIC_COOKIE)throw Error(`This does not appear to be a NIFTI file!`);for(this.dim_info=F.getByteAt(n,39),i=0;i<8;i+=1)s=40+i*2,this.dims[i]=F.getShortAt(n,s,this.littleEndian);for(this.intent_p1=F.getFloatAt(n,56,this.littleEndian),this.intent_p2=F.getFloatAt(n,60,this.littleEndian),this.intent_p3=F.getFloatAt(n,64,this.littleEndian),this.intent_code=F.getShortAt(n,68,this.littleEndian),this.datatypeCode=F.getShortAt(n,70,this.littleEndian),this.numBitsPerVoxel=F.getShortAt(n,72,this.littleEndian),this.slice_start=F.getShortAt(n,74,this.littleEndian),i=0;i<8;i+=1)s=76+i*4,this.pixDims[i]=F.getFloatAt(n,s,this.littleEndian);if(this.vox_offset=F.getFloatAt(n,108,this.littleEndian),this.scl_slope=F.getFloatAt(n,112,this.littleEndian),this.scl_inter=F.getFloatAt(n,116,this.littleEndian),this.slice_end=F.getShortAt(n,120,this.littleEndian),this.slice_code=F.getByteAt(n,122),this.xyzt_units=F.getByteAt(n,123),this.cal_max=F.getFloatAt(n,124,this.littleEndian),this.cal_min=F.getFloatAt(n,128,this.littleEndian),this.slice_duration=F.getFloatAt(n,132,this.littleEndian),this.toffset=F.getFloatAt(n,136,this.littleEndian),this.description=F.getStringAt(n,148,228),this.aux_file=F.getStringAt(n,228,252),this.qform_code=F.getShortAt(n,252,this.littleEndian),this.sform_code=F.getShortAt(n,254,this.littleEndian),this.quatern_b=F.getFloatAt(n,256,this.littleEndian),this.quatern_c=F.getFloatAt(n,260,this.littleEndian),this.quatern_d=F.getFloatAt(n,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(this.quatern_b**2+this.quatern_c**2+this.quatern_d**2)),this.qoffset_x=F.getFloatAt(n,268,this.littleEndian),this.qoffset_y=F.getFloatAt(n,272,this.littleEndian),this.qoffset_z=F.getFloatAt(n,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){let e=this.quatern_a,t=this.quatern_b,n=this.quatern_c,r=this.quatern_d;for(this.qfac=this.pixDims[0]===0?1:this.pixDims[0],this.quatern_R=[[e*e+t*t-n*n-r*r,2*t*n-2*e*r,2*t*r+2*e*n],[2*t*n+2*e*r,e*e+n*n-t*t-r*r,2*n*r-2*e*t],[2*t*r-2*e*n,2*n*r+2*e*t,e*e+r*r-n*n-t*t]],a=0;a<3;a+=1)for(o=0;o<3;o+=1)this.affine[a][o]=this.quatern_R[a][o]*this.pixDims[o+1],o===2&&(this.affine[a][o]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(a=0;a<3;a+=1)for(o=0;o<4;o+=1)s=280+(a*4+o)*4,this.affine[a][o]=F.getFloatAt(n,s,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=F.getStringAt(n,328,344),this.magic=F.getStringAt(n,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,e.MAGIC_NUMBER2),n.byteLength>e.MAGIC_COOKIE){this.extensionFlag[0]=F.getByteAt(n,348),this.extensionFlag[1]=F.getByteAt(n,349),this.extensionFlag[2]=F.getByteAt(n,350),this.extensionFlag[3]=F.getByteAt(n,351);let e=!0;!this.isHDR&&this.vox_offset<=352&&(e=!1),n.byteLength<=368&&(e=!1),e&&this.extensionFlag[0]&&(this.extensions=F.getExtensionsAt(n,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var t=F.formatNumber,n=``;return n+=`Dim Info = `+this.dim_info+`
|
|
560
560
|
`,n+=`Image Dimensions (1-8): `+this.dims[0]+`, `+this.dims[1]+`, `+this.dims[2]+`, `+this.dims[3]+`, `+this.dims[4]+`, `+this.dims[5]+`, `+this.dims[6]+`, `+this.dims[7]+`
|
|
561
561
|
`,n+=`Intent Parameters (1-3): `+this.intent_p1+`, `+this.intent_p2+`, `+this.intent_p3+`
|
|
562
562
|
`,n+=`Intent Code = `+this.intent_code+`
|