109 lines
2.4 MiB
109 lines
2.4 MiB
/*!
|
||
* LMV v7.99.1
|
||
*
|
||
* Copyright 2024 Autodesk, Inc.
|
||
* All rights reserved.
|
||
*
|
||
* This computer source code and related instructions and comments are the
|
||
* unpublished confidential and proprietary information of Autodesk, Inc.
|
||
* and are protected under Federal copyright and state trade secret law.
|
||
* They may not be disclosed to, copied or used by any third party without
|
||
* the prior written consent of Autodesk, Inc.
|
||
*
|
||
* Autodesk Viewer SDK Usage Limitations:
|
||
*
|
||
* The Autodesk Viewer SDK JavaScript must be delivered from an
|
||
* Autodesk-hosted URL.
|
||
*/
|
||
var LMV;(()=>{var e,t,i={90002:e=>{e.exports="#if NUM_CUTPLANES > 0\n#ifdef LINE_CUTPLANE\nuniform vec4 cutplanes[NUM_CUTPLANES];\nuniform bool cutplanesHideInterior;\nbool checkHideInterior(vec3 worldPosition) {\n int insideCount = 0;\n for (int i=0; i<NUM_CUTPLANES; i++) {\n if (dot(vec4(worldPosition, 1.0), cutplanes[i]) < 0.0) {\n insideCount++;\n }\n }\n return insideCount != NUM_CUTPLANES;\n}\nbool checkInsideCutplanes(vec3 worldPosition) {\n if (cutplanesHideInterior) {\n return checkHideInterior(worldPosition);\n \n }\n for (int i=0; i<NUM_CUTPLANES; i++) {\n if (dot(vec4(worldPosition, 1.0), cutplanes[i]) > 0.0) {\n return false;\n }\n }\n return true;\n}\nbool checkCutPlanes(vec3 worldPosition) {\n if (!checkInsideCutplanes(vWorldPosition)) {\n #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n \n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n gl_FragDepth = 1.0;\n \n return true;\n #else\n discard;\n #endif\n }\n return false;\n}\n#else\nuniform vec4 cutplanes[NUM_CUTPLANES];\nuniform bool cutplanesHideInterior;\nvoid checkHideInterior(vec3 worldPosition) {\n int insideCount = 0;\n for (int i=0; i<NUM_CUTPLANES; i++) {\n if (dot(vec4(worldPosition, 1.0), cutplanes[i]) < 0.0) {\n insideCount++;\n }\n }\n if (insideCount == NUM_CUTPLANES) {\n discard;\n }\n}\nvoid checkCutPlanes(vec3 worldPosition) {\n if (cutplanesHideInterior) {\n checkHideInterior(worldPosition);\n return;\n }\n for (int i=0; i<NUM_CUTPLANES; i++) {\n if (dot(vec4(worldPosition, 1.0), cutplanes[i]) > 0.0) {\n discard;\n }\n }\n}\n#endif\n#endif\n"},92070:e=>{e.exports="uniform float point_size;"},96900:e=>{e.exports="\nuniform sampler2D tDepth;\nuniform vec4 projInfo;\nuniform float isOrtho;\nuniform mat4 worldMatrix_mainPass;\nvec3 reconstructCSPosition(vec2 fragCoords, float z) {\n return vec3((fragCoords * projInfo.xy + projInfo.zw) * mix(z, -1.0, isOrtho), z);\n}\nvec3 reconstructWorldPosition(vec2 fragCoords, vec2 screenUv) {\n float zCam = texture(tDepth, screenUv).z;\n vec3 csPos = reconstructCSPosition(fragCoords, zCam);\n return (worldMatrix_mainPass * vec4(csPos, 1.0)).xyz;\n}\n"},1081:e=>{e.exports="\nuniform float envRotationSin;\nuniform float envRotationCos;\nvec3 adjustLookupVector(in vec3 lookup) {\n return vec3(\n envRotationCos * lookup.x - envRotationSin * lookup.z,\n lookup.y,\n envRotationSin * lookup.x + envRotationCos * lookup.z);\n}\nvec3 RGBMDecode(in vec4 vRGBM, in float exposure) {\n vec3 ret = vRGBM.rgb * (vRGBM.a * 16.0);\n ret *= ret;\n ret *= exposure;\n return ret;\n}\nvec3 GammaDecode(in vec4 vRGBA, in float exposure) {\n return vRGBA.xyz * vRGBA.xyz * exposure;\n}\nvec3 sampleIrradianceMap(vec3 dirWorld, samplerCube irrMap, float exposure) {\n vec4 cubeColor4 = texture(irrMap, adjustLookupVector(dirWorld));\n#ifdef IRR_GAMMA\n vec3 indirectDiffuse = GammaDecode(cubeColor4, exposure);\n#elif defined(IRR_RGBM)\n vec3 indirectDiffuse = RGBMDecode(cubeColor4, exposure);\n#else\n vec3 indirectDiffuse = cubeColor4.xyz;\n#ifdef GAMMA_INPUT\n indirectDiffuse.xyz *= indirectDiffuse.xyz;\n#endif\n#endif\n return indirectDiffuse;\n}\n"},26750:e=>{e.exports="#ifdef HATCH_PATTERN\noutFragColor = calculateHatchPattern(hatchParams, gl_FragCoord.xy, outFragColor, hatchTintColor, hatchTintIntensity);\n#endif\n#ifdef MRT_NORMALS\noutNormal = vec4(geomNormal.x, geomNormal.y, depth, outFragColor.a < 1.0 ? 0.0 : 1.0);\n#endif\n#include <id_frag>\n"},40304:e=>{e.exports="float averageOfFloat3(in vec3 value) { \n const float oneThird = 1.0 / 3.0; \n return dot(value, vec3(oneThird, oneThird, oneThird)); \n} \n"},22826:e=>{e.exports="#ifdef HATCH_PATTERN\nuniform vec2 hatchParams;\nuniform vec3 hatchTintColor;\nuniform float hatchTintIntensity;\nfloat curveGaussian(float r, float invWidth) {\n float amt = clamp(r * invWidth, 0.0, 1.0);\n float exponent = amt * 3.5;\n return exp(-exponent*exponent);\n}\nvec4 calculateHatchPattern(vec2 hatchParams, vec2 coord, vec4 fragColor, vec3 hatchTintColor, float hatchTintIntensity ) {\n float hatchSlope = hatchParams.x;\n float hatchPeriod = hatchParams.y;\n if (abs(hatchSlope) <= 1.0) {\n float hatchPhase = coord.y - hatchSlope * coord.x;\n float dist = abs(mod((hatchPhase), (hatchPeriod)));\n if (dist < 1.0) {\n fragColor = vec4(0.0,0.0,0.0,1.0);\n } else {\n fragColor.xyz = mix(fragColor.xyz, hatchTintColor, hatchTintIntensity);\n }\n } else {\n float hatchPhase = - coord.y / hatchSlope + coord.x;\n float dist = abs(mod((hatchPhase), (hatchPeriod)));\n if (dist < 1.0) {\n fragColor = vec4(0.0,0.0,0.0,1.0);\n } else {\n fragColor.xyz = mix(fragColor.xyz, hatchTintColor, hatchTintIntensity);\n }\n }\n return fragColor;\n}\n#endif\n"},17028:e=>{e.exports="vec3 rgb2hsv(vec3 color)\n{\n float delta;\n float colorMax, colorMin;\n float h,s,v;\n vec3 hsv;\n colorMax = max(color.r,color.g);\n colorMax = max(colorMax,color.b);\n colorMin = min(color.r,color.g);\n colorMin = min(colorMin,color.b);\n v = colorMax;\n if(colorMax != 0.0)\n {\n s = (colorMax - colorMin)/colorMax;\n }\n else\n {\n s = 0.0;\n }\n if(s != 0.0)\n {\n delta = colorMax-colorMin;\n if (color.r == colorMax)\n {\n h = (color.g-color.b)/delta;\n }\n else if (color.g == colorMax)\n {\n h = 2.0 + (color.b-color.r) / delta;\n }\n else\n {\n h = 4.0 + (color.r-color.g)/delta;\n }\n h /= 6.0;\n if( h < 0.0)\n {\n h +=1.0;\n }\n }\n else\n {\n h = 0.0;\n }\n hsv = vec3(h,s,v);\n return hsv;\n}\nvec3 hsv2rgb(vec3 hsv)\n{\n vec3 color;\n float f,p,q,t;\n float h,s,v;\n float i,hi;\n {\n h = hsv.x*6.0;\n s = hsv.y;\n v = hsv.z;\n i = floor(h);\n f = h-i;\n p = v * (1.0 - s);\n q = v * (1.0 - (s * f));\n t = v * (1.0 - (s * (1.0 - f)));\n float r,g,b;\n if (i == 0.0)\n {\n r = v;\n g = t;\n b = p;\n }\n else if (i == 1.0)\n {\n r = q;\n g = v;\n b = p;\n }\n else if (i == 2.0)\n {\n r = p;\n g = v;\n b = t;\n }\n else if (i == 3.0)\n {\n r = p;\n g = q;\n b = v;\n }\n else if (i == 4.0)\n {\n r = t;\n g = p;\n b = v;\n }\n else\n {\n r = v;\n g = p;\n b = q;\n }\n color = vec3(r,g,b);\n }\n return color;\n}"},14804:e=>{e.exports="#if defined(MRT_NORMALS) || defined(MRT_ID_BUFFER)\n varying highp float depth;\n#endif\n#if defined(MRT_ID_BUFFER) || defined(ID_COLOR)\n #ifdef USE_VERTEX_ID\n varying vec3 vId;\n #elif defined(LINE_2D_SHADER)\n varying vec4 dbId;\n #else\n uniform vec3 dbId;\n #endif\n#endif\n#if defined(MRT_ID_BUFFER) || defined(MODEL_COLOR)\n uniform vec3 modelId;\n#endif\n#if defined(MRT_NORMALS)\n layout(location = 1) out vec4 outNormal;\n #if defined(MRT_ID_BUFFER)\n layout(location = 2) out vec4 outId;\n #if defined(MODEL_COLOR)\n layout(location = 3) out vec4 outModelId;\n #endif\n #endif\n#elif defined(MRT_ID_BUFFER)\n layout(location = 1) out vec4 outId;\n #if defined(MODEL_COLOR)\n layout(location = 2) out vec4 outModelId;\n #endif\n#endif"},31371:e=>{e.exports="#ifdef USE_VERTEX_ID\nin vec3 id;\nout vec3 vId;\n#endif\n"},11255:e=>{e.exports="\n#if defined(USE_VERTEX_ID) && (defined(MRT_ID_BUFFER) || defined(ID_COLOR))\n vec3 dbId = vId;\n#endif\n#ifdef MRT_ID_BUFFER\n #ifndef ENABLE_ID_DISCARD\n const float writeId = 1.0;\n #endif\n outId = vec4(dbId.rgb, writeId);\n #ifdef MODEL_COLOR\n outModelId = vec4(modelId.rgb, writeId);\n #endif\n#elif defined(ID_COLOR)\n #ifdef ENABLE_ID_DISCARD\n if (writeId==0.0) {\n discard;\n }\n #endif\n outFragColor = vec4(dbId.rgb, 1.0);\n#elif defined(MODEL_COLOR)\n #ifdef ENABLE_ID_DISCARD\n if (writeId==0.0) {\n discard;\n }\n #endif\n outFragColor = vec4(modelId.rgb, 1.0);\n#endif\n"},91952:e=>{e.exports="\n#ifdef USE_VERTEX_ID\nvId = id;\n#endif\n"},45631:e=>{e.exports="#if defined( IMPORTANTSAMPLING )\n#define SAMPLECOUNT 32\nvec2 Hammersley(int index)\n{\n float u = (float(index) + 0.5) / 32.0;\n float v = 0.5;\n float noise = texture(importantSamplingRandomMap, vec2(u, v), 0.0).r;\n return vec2(2.0 * PI * float(index/SAMPLECOUNT), noise);\n}\nvec3 ImportanceSampleAnisotropicGGX(int index, vec2 alpha, vec3 N, vec3 Tu, vec3 Tv)\n{\n vec2 uniformSample2D = Hammersley(index);\n float coef = sqrt(uniformSample2D.y / (1.0 - uniformSample2D.y));\n float sinSigma, cosSigma;\n sinSigma = sin(uniformSample2D.x);\n cosSigma = cos(uniformSample2D.x);\n vec3 H = coef * ((alpha.x * cosSigma) * Tu + (alpha.y * sinSigma) * Tv) + N;\n H = normalize(H);\n return H;\n}\nfloat ComputePDF(vec2 alpha, float NdotH, float HdotTu, float HdotTv, float VdotH)\n{\n float factor1 = HdotTu / alpha.x;\n float factor2 = HdotTv / alpha.y;\n float factor3 = factor1 * factor1 + factor2 * factor2 + NdotH * NdotH;\n float factor = factor3 * factor3 * alpha.x * alpha.y * VdotH * 4.0 * PI;\n if (factor > 0.0)\n {\n return (NdotH / factor);\n }\n else\n {\n return 0.0;\n }\n}\n#define INVFACESIZE 0.0078125\nfloat DirectionToSolidAngle(vec3 dir)\n{\n dir = abs(dir);\n float first = min(dir.x, dir.y);\n float temp = max(dir.x, dir.y);\n float second = min(temp, dir.z);\n float third = max(temp, dir.z);\n first /= third;\n second /= third;\n float u = (first+1.0)/2.0;\n float v = (second + 1.0) / 2.0;\n float solidAngle = texture(importantSamplingSolidAngleMap, vec2(u, v), 0.0).r * 0.000255;\n return solidAngle;\n}\nfloat Smith_GGX(float value)\n{\n return 2.0 / (1.0 + sqrt(1.0 + value));\n}\nvec2 RoughnessAnisotropyToAlpha(float roughness, float anisotropy)\n{\n float aspect = sqrt(1.0 - 0.9 * anisotropy);\n vec2 alpha = vec2(roughness * roughness / aspect, roughness * roughness * aspect);\n return alpha;\n}\nvec3 ImportanceSamplingSpecular(float angle, vec3 reflectance, float roughness, float anisotropy, vec3 V, vec3 N, vec3 Tu, vec3 Tv)\n{\n vec3 specular = vec3(0.0);\n float radAngle;\n if (anisotropy < 1e-10)\n {\n radAngle = 0.0;\n }\n else\n {\n radAngle = -PI * angle;\n }\n vec2 alpha = RoughnessAnisotropyToAlpha(roughness, anisotropy);\n float alpha2 = max(alpha.x * alpha.x, alpha.y * alpha.y);\n float NdotV = dot(N, V);\n float alpha2NV = aSqrd(alpha2, NdotV);\n vec2 sincosTheta;\n sincosTheta.x = sin(radAngle);\n sincosTheta.y = cos(radAngle);\n vec3 Tu1, Tv1;\n Tu1 = sincosTheta.y * Tu - sincosTheta.x * Tv;\n Tv1 = sincosTheta.x * Tu + sincosTheta.y * Tv;\n vec3 H;\n vec3 sampleLightIntensity;\n vec3 L;\n float effectiveSample = 0.0;\n for (int i = 0; i < SAMPLECOUNT; i++)\n {\n H = ImportanceSampleAnisotropicGGX(i, alpha, N, Tu1, Tv1);\n float VdotH = dot(V, H);\n L = 2.0 * VdotH * H - V;\n float NdotH = dot(N, H);\n float NdotL = dot(N, L);\n if (NdotL >= 0.0 && NdotV > 0.0 && NdotH > 0.0)\n {\n float alpha2NL = aSqrd(alpha2, NdotL);\n float HdotTu = dot(H, Tu1);\n float HdotTv = dot(H, Tv1);\n float pdf = ComputePDF(alpha, NdotH, HdotTu, HdotTv, VdotH);\n float mipmapLevel = 0.0;\n if (pdf > 0.0)\n {\n mipmapLevel = 0.3 * log2(1.0 / (float(SAMPLECOUNT) * pdf * DirectionToSolidAngle(L)));\n }\n mipmapLevel = clamp(mipmapLevel, 0.0, 4.0);\n L = normalize(L);\n sampleLightIntensity = sampleReflection(L, L, mipmapLevel).rgb;\n float G = Smith_GGX(alpha2NL) * Smith_GGX(alpha2NV);\n vec3 F = Fresnel_Schlick(reflectance, VdotH);\n float factor = G * VdotH / (NdotH * NdotV);\n if (factor >= 0.0)\n {\n specular += abs(sampleLightIntensity * F * factor);\n effectiveSample += 1.0;\n }\n }\n }\n if (effectiveSample > 0.0)\n {\n specular /= effectiveSample;\n }\n return specular;\n}\n#endif"},74490:e=>{e.exports="\n#ifdef USE_INSTANCING\nin vec3 instOffset;\nin vec4 instRotation;\nin vec3 instScaling;\nvec3 applyQuaternion(vec3 p, vec4 q) {\n return p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec3 getInstancePos(vec3 pos) {\n return instOffset + applyQuaternion(instScaling * pos, instRotation);\n}\nvec3 getInstanceNormal(vec3 normal) {\n return applyQuaternion(normal/instScaling, instRotation);\n}\n#else\nvec3 getInstancePos(vec3 pos) { return pos; }\nvec3 getInstanceNormal(vec3 normal) { return normal; }\n#endif\n"},53634:e=>{e.exports="\n#define LINE_2D_SHADER 1\n#define TAU 6.28318530718\n#define PI 3.14159265358979\n#define HALF_PI 1.57079632679\n#define PI_0_5 HALF_PI\n#define PI_1_5 4.71238898038\n#define ENABLE_ID_DISCARD\n#define VBB_GT_TRIANGLE_INDEXED 0.0\n#define VBB_GT_LINE_SEGMENT 1.0\n#define VBB_GT_ARC_CIRCULAR 2.0\n#define VBB_GT_ARC_ELLIPTICAL 3.0\n#define VBB_GT_TEX_QUAD 4.0\n#define VBB_GT_ONE_TRIANGLE 5.0\n#define VBB_GT_MSDF_TRIANGLE_INDEXED 6.0\n#define VBB_GT_LINE_SEGMENT_CAPPED 8.0\n#define VBB_GT_LINE_SEGMENT_CAPPED_START 9.0\n#define VBB_GT_LINE_SEGMENT_CAPPED_END 10.0\n#define VBB_GT_LINE_SEGMENT_MITER 11.0\n#define VBB_INSTANCED_FLAG 0.0\n#define VBB_SEG_START_RIGHT 0.0\n#define VBB_SEG_START_LEFT 1.0\n#define VBB_SEG_END_RIGHT 2.0\n#define VBB_SEG_END_LEFT 3.0\n#define LTSCALE 0.25\nvarying vec4 fsColor;\nvarying vec2 fsOffsetDirection;\nvarying vec4 fsMultipurpose;\nvarying float fsHalfWidth;\nvarying vec2 fsVpTC;\nvarying float fsGhosting;\n#ifdef LOADING_ANIMATION\nvarying float loadingProgress;\n#endif\n"},1179:e=>{e.exports="\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n#ifdef POLYGON_OFFSET\n uniform vec2 polygonOffset;\n const float epsilon7 = 0.0000001;\n#endif\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif"},40444:e=>{e.exports="\n#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n bool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n }\n#endif"},20990:e=>{e.exports="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n float logz_depth = vFragDepth;\n#ifdef POLYGON_OFFSET\n float factor = polygonOffset[0];\n float units = polygonOffset[1];\n#if __VERSION__ == 300 \n if (factor != 0.0) {\n float x = dFdx(logz_depth);\n float y = dFdy(logz_depth);\n float dz = sqrt(x * x + y * y);\n logz_depth += dz * factor;\n }\n#endif\n#endif\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( logz_depth ) * logDepthBufFC * 0.5;\n#endif"},13353:e=>{e.exports="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif"},72373:e=>{e.exports="#if defined(USE_SURFACE_NORMAL_MAP) || defined( USE_LAYERED_NORMAL_MAP ) || defined( USE_TILING_NORMAL )\nvoid heightMapTransform(\n sampler2D bumpTexture,\n vec2 uv,\n mat3 transform,\n vec2 bumpScale,\n inout vec3 T,\n inout vec3 B,\n inout vec3 N\n) {\n vec2 st = (transform * vec3(uv, 1.0)).xy;\n mat3 mtxTangent = mat3(T, B, N);\n T = normalize(mtxTangent * (transform * vec3(1.0, 0.0, 0.0)));\n B = normalize(mtxTangent * (transform * vec3(0.0, 1.0, 0.0)));\n const float oneThird = 1.0 / 3.0;\n vec3 avg = vec3(oneThird, oneThird, oneThird);\n vec2 offset = fwidth(st);\n float h0 = dot(texture(bumpTexture, st).xyz, avg);\n float hx = dot(texture(bumpTexture, st + vec2(offset.x, 0.0)).xyz, avg);\n float hy = dot(texture(bumpTexture, st + vec2(0.0, offset.y)).xyz, avg);\n vec2 diff = vec2(h0 - hx, h0 - hy) / offset;\n N = normalize(\n N + (\n diff.x * T * bumpScale.x +\n diff.y * B * bumpScale.y\n )\n );\n}\nvoid normalMapTransform(\n sampler2D bumpTexture,\n vec2 uv,\n mat3 transform,\n vec2 bumpScale,\n inout vec3 T,\n inout vec3 B,\n inout vec3 N\n) {\n vec2 st = (transform * vec3(uv, 1.0)).xy;\n vec3 mapN = 2.0 * texture(bumpTexture, st).xyz - 1.0;\n mapN.xy *= bumpScale.x;\n mapN.z *= bumpScale.y;\n vec3 v = vec3(mapN.y, -mapN.x, 0.0);\n float c = -mapN.z;\n mat3 skewV = mat3(\n 0.0, v.z, -v.y,\n -v.z, 0.0, v.x,\n v.y, -v.x, 0.0\n );\n mat3 rot = mat3(1.0) + skewV + skewV*skewV * 1.0/(1.0-c);\n N *= rot;\n T *= rot;\n B *= rot;\n}\n#endif\n"},1221:e=>{e.exports="vec3 orderedDithering(vec3 col) {\n const vec4 m0 = vec4( 1.0, 13.0, 4.0, 16.0);\n const vec4 m1 = vec4( 9.0, 5.0, 12.0, 8.0);\n const vec4 m2 = vec4( 3.0, 15.0, 2.0, 14.0);\n const vec4 m3 = vec4(11.0, 7.0, 10.0, 6.0);\n int i = int(gl_FragCoord.x) & 3;\n int j = int(gl_FragCoord.y) & 3;\n vec4 biasRow;\n if (i==0) biasRow = m0;\n else if (i==1) biasRow = m1;\n else if (i==2) biasRow = m2;\n else biasRow = m3;\n float bias;\n if (j==0) bias = biasRow.x;\n else if (j==1) bias = biasRow.y;\n else if (j==2) bias = biasRow.z;\n else bias = biasRow.w;\n return col + bias * (1.0 / (17.0 * 256.0));\n}\n"},35496:e=>{e.exports="\nvec4 packDepth( const in float depth ) {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);\n return enc;\n}\nfloat unpackDepth( const in vec4 rgba_depth ) {\n return dot( rgba_depth, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0) );\n}\n"},9641:e=>{e.exports="\n#define kPI 3.14159265358979\nvec2 encodeNormal (vec3 n) {\n return (vec2(atan(n.y,n.x)/kPI, n.z)+1.0)*0.5;\n}\nvec3 decodeNormal (vec2 enc) {\n vec2 ang = enc * 2.0 - 1.0;\n vec2 scth = vec2(sin(ang.x * kPI), cos(ang.x * kPI));\n vec2 scphi = vec2(sqrt(1.0 - ang.y * ang.y), ang.y);\n return vec3(scth.y * scphi.x, scth.x * scphi.x, scphi.y);\n}\n"},50433:e=>{e.exports="gl_PointSize = point_size;"},6147:e=>{e.exports="\nvec3 TransmitAdjust(vec3 transmission, vec3 f0) \n{ \n vec3 limit = max(1.0 - f0, 0.00001); \n return clamp(transmission, vec3(0.0, 0.0, 0.0), limit) / limit; \n} \nfloat ColorToIlluminance(in vec3 color) \n{ \n const vec3 rgb2grey = vec3(0.299, 0.587, 0.114); \n float illuminance = dot(rgb2grey, color); \n return illuminance; \n} \nvoid applyPrismGlazingOpacity(\n inout vec4 color,\n vec3 transmissionF,\n float transmissionAlpha,\n float NdotV,\n float glazingIlluminace) \n{\n const float third = 1.0/3.0; \n float transSurface = exp(-(transmissionAlpha + (transmissionAlpha < 0.0025 ? 0.0 : 0.25)) * NdotV * PI); \n float opacity = 1.0- dot((1.0 - transmissionF), vec3(third,third,third)) * transSurface * glazingIlluminace; \n opacity = clamp(opacity, 0.01, 0.99);\n color.a *= opacity;\n} \n"},77019:e=>{e.exports="void applyPrismTransparency(\n inout vec4 color,\n vec3 transparentColor,\n float transparentIor\n) {\n float fsLevel = max(max(color.r, color.g), color.b);\n color = vec4(color.rgb/fsLevel, fsLevel);\n float transLevel = min(min(transparentColor.r, transparentColor.g), transparentColor.b);\n transLevel = min( (1.0 - surface_roughness), transLevel );\n float transAlpha = (1.0 - transLevel) * 0.4 + surface_roughness * 0.55;\n vec3 tr_g_color = sqrt(transparentColor);\n vec4 transColor = vec4(0.5 * vec3(tr_g_color), transAlpha);\n float strength = 1.0 - (1.0 - fsLevel) * (1.0 - fsLevel);\n color = mix(transColor, color, strength);\n color.a = max(color.a, 0.05);\n if (transparentIor == 1.0 && tr_g_color == vec3(1.0)) {\n color.a = 0.0;\n }\n}"},76332:e=>{e.exports="#if defined( PRISMWOOD )\n#define ONE 0.00390625\nfloat GetIndexedValue(vec4 array, int index)\n{\n if (index == 0)\n return array[0];\n else if (index == 1)\n return array[1];\n else if (index == 2)\n return array[2];\n else if (index == 3)\n return array[3];\n else\n return 0.0;\n}\nint GetIndexedValue(ivec2 array, int index)\n{\n if (index == 0)\n return array[0];\n else if (index == 1)\n return array[1];\n else\n return 0;\n}\n#if defined( USE_WOOD_CURLY_DISTORTION_MAP )\nfloat SampleCurlyPattern(vec2 uv)\n{\n vec2 uv_wood_curly_distortion_map = (wood_curly_distortion_map_texMatrix * vec3(uv, 1.0)).xy;\n WOOD_CURLY_DISTORTION_CLAMP_TEST;\n vec3 curlyDistortion = texture(wood_curly_distortion_map, uv_wood_curly_distortion_map).xyz;\n if(wood_curly_distortion_map_invert) curlyDistortion = vec3(1.0) - curlyDistortion;\n return curlyDistortion.r;\n}\nvec3 DistortCurly(vec3 p)\n{\n if (!wood_curly_distortion_enable) return p;\n float r = length(p.xy);\n if (r < 0.00001) return p;\n const float INV_ANGLE_INTERVAL = 1.27323954;\n const float NUM_INTERVAL = 8.0;\n float theta = atan(p.y, p.x);\n if (theta < 0.0)\n theta += PI2;\n float intIdx = theta * INV_ANGLE_INTERVAL;\n int idx0 = int(mod(floor(intIdx), NUM_INTERVAL));\n int idx1 = int(mod(ceil(intIdx), NUM_INTERVAL));\n const vec4 HASH_TABLE1 = vec4(0.450572,0.114598, 0.886043, 0.315119);\n const vec4 HASH_TABLE2 = vec4(0.216133,0.306264, 0.685616, 0.317907);\n float offset0 = idx0 < 4 ? GetIndexedValue(HASH_TABLE1, idx0) : GetIndexedValue(HASH_TABLE2, idx0-4);\n float offset1 = idx1 < 4 ? GetIndexedValue(HASH_TABLE1, idx1) : GetIndexedValue(HASH_TABLE2, idx1-4);\n const float maxOffset = 100.0;\n offset0 = (offset0 - 0.5) * maxOffset;\n offset1 = (offset1 - 0.5) * maxOffset;\n vec2 uv0 = vec2(p.z + offset0, r);\n float shiftWeight0 = SampleCurlyPattern(uv0);\n vec2 uv1 = vec2(p.z + offset1, r);\n float shiftWeight1 = SampleCurlyPattern(uv1);\n float interpWeight = fract(intIdx);\n float shiftWeight = mix(shiftWeight0, shiftWeight1, interpWeight);\n const float INV_MIN_RADIUS = 2.0;\n float shiftWeightAdjust = smoothstep(0.0, 1.0, r * INV_MIN_RADIUS);\n r -= wood_curly_distortion_scale * (shiftWeight * shiftWeightAdjust);\n float thetaNew = atan(p.y, p.x);\n vec3 pNew = p;\n pNew.x = r * cos(thetaNew);\n pNew.y = r * sin(thetaNew);\n return pNew;\n}\n#endif\nvec3 un2sn(vec3 range)\n{\n return range * 2.0 - 1.0;\n}\nfloat inoise(vec3 p)\n{\n vec3 modp = mod(floor(p), 256.0);\n modp.xy = modp.xy * ONE;\n vec4 AA = texture(perm2DMap, vec2(modp.x, modp.y), 0.0) * 255.0;\n AA = AA + modp.z;\n AA = mod(floor(AA), 256.0);\n AA *= ONE;\n vec3 gradx1 = un2sn(texture(permGradMap,vec2(AA.x,0.0),0.0).xyz);\n vec3 grady1 = un2sn(texture(permGradMap,vec2(AA.y,0.0),0.0).xyz);\n vec3 gradz1 = un2sn(texture(permGradMap,vec2(AA.z,0.0),0.0).xyz);\n vec3 gradw1 = un2sn(texture(permGradMap,vec2(AA.w,0.0),0.0).xyz);\n vec3 gradx2 = un2sn(texture(permGradMap,vec2(AA.x + ONE,0.0),0.0).xyz);\n vec3 grady2 = un2sn(texture(permGradMap,vec2(AA.y + ONE,0.0),0.0).xyz);\n vec3 gradz2 = un2sn(texture(permGradMap,vec2(AA.z + ONE,0.0),0.0).xyz);\n vec3 gradw2 = un2sn(texture(permGradMap,vec2(AA.w + ONE,0.0),0.0).xyz);\n p -= floor(p);\n vec3 fadep = p * p * p * (p * (p * 6.0 - 15.0) + 10.0);\n return mix( mix( mix( dot(gradx1, p ),\n dot(gradz1, p + vec3(-1.0, 0.0, 0.0)), fadep.x),\n mix( dot(grady1, p + vec3(0.0, -1.0, 0.0)),\n dot(gradw1, p + vec3(-1.0, -1.0, 0.0)), fadep.x), fadep.y),\n mix( mix( dot(gradx2, p + vec3(0.0, 0.0, -1.0)),\n dot(gradz2, p + vec3(-1.0, 0.0, -1.0)), fadep.x),\n mix( dot(grady2, p + vec3(0.0, -1.0, -1.0)),\n dot(gradw2, p + vec3(-1.0, -1.0, -1.0)), fadep.x), fadep.y), fadep.z);\n}\nfloat inoise(float p)\n{\n float modp = mod(floor(p), 256.0);\n modp = (modp + 256.0) * ONE;\n float permx = texture(permutationMap, vec2(modp, 0.0), 0.0).r;\n float gradx = texture(gradientMap, vec2(permx, 0.0), 0.0).r*2.0-1.0;\n float permy = texture(permutationMap, vec2(modp + ONE, 0.0), 0.0).r;\n float grady = texture(gradientMap, vec2(permy, 0.0), 0.0).r*2.0-1.0;\n p -= floor(p);\n float fadep = p * p * p * (p * (p * 6.0 - 15.0) + 10.0);\n return mix(gradx * p, grady * (p - 1.0), fadep);\n}\nfloat multiband_inoise(vec3 p, int bands, vec4 w, vec4 f)\n{\n float noise = 0.0;\n for(int i = 0; i < 4; ++i)\n {\n if (i >= bands) break;\n noise += GetIndexedValue(w, i) * inoise(p * GetIndexedValue(f, i));\n }\n return noise;\n}\nfloat multiband_inoise(float p, int bands, vec4 w, vec4 f)\n{\n float noise = 0.0;\n for(int i = 0; i < 4; ++i)\n {\n if (i >= bands) break;\n noise += GetIndexedValue(w, i) * inoise(p * GetIndexedValue(f, i));\n }\n return noise;\n}\nvec3 Distort3DCosineRadialDir(vec3 p)\n{\n float radius = length(p.xy);\n if (radius < 0.00001) return p;\n vec2 theta = p.xy / radius;\n float radiusShift = 0.0;\n for (int i = 0; i < 4; ++i)\n {\n if (i >= wood_fiber_cosine_bands) break;\n radiusShift += GetIndexedValue(wood_fiber_cosine_weights, i) * cos(p.z * RECIPROCAL_PI2 * GetIndexedValue(wood_fiber_cosine_frequencies, i));\n }\n const float MIN_RADIUS = 1.5;\n float weight = clamp(radius / MIN_RADIUS, 0.0, 1.0);\n if(weight >= 0.5)\n weight = weight * weight * (3.0 - (weight + weight));\n p.xy += theta * radiusShift * weight;\n return p;\n}\nvec3 Distort3DPerlin(vec3 p)\n{\n vec3 pAniso = vec3(p.xy, p.z * wood_fiber_perlin_scale_z);\n p.xy += multiband_inoise(pAniso, wood_fiber_perlin_bands, wood_fiber_perlin_weights, wood_fiber_perlin_frequencies);\n return p;\n}\nvec3 Distort(vec3 p)\n{\n if(wood_fiber_cosine_enable)\n p = Distort3DCosineRadialDir(p);\n if(wood_fiber_perlin_enable)\n p = Distort3DPerlin(p);\n return p;\n}\nfloat DistortRadiusLength(float radiusLength)\n{\n radiusLength += multiband_inoise(radiusLength, wood_growth_perlin_bands, wood_growth_perlin_weights, wood_growth_perlin_frequencies);\n if (radiusLength < 0.0) radiusLength = 0.0;\n return radiusLength;\n}\nfloat ComputeEarlyWoodRatio(float radiusLength)\n{\n float fraction = mod(radiusLength, wood_ring_thickness) / wood_ring_thickness;\n if (fraction <= wood_ring_fraction.y)\n return 1.0;\n else if(fraction <= wood_ring_fraction.x)\n return (1.0 - (fraction - wood_ring_fraction.y) / wood_fall_rise.x);\n else if(fraction <= wood_ring_fraction.w)\n return 0.0;\n else\n return ((fraction - wood_ring_fraction.w) / wood_fall_rise.y);\n}\nvec3 DistortEarlyColor(vec3 earlyColor, float radiusLength)\n{\n float expValue = 1.0 + multiband_inoise(radiusLength,wood_earlycolor_perlin_bands,wood_earlycolor_perlin_weights,wood_earlycolor_perlin_frequencies);\n earlyColor = pow(abs(earlyColor), vec3(expValue));\n return earlyColor;\n}\nvec3 DistortLateColor(vec3 lateColor, float radiusLength)\n{\n float expValue = 1.0 + multiband_inoise(radiusLength,wood_latecolor_perlin_bands,wood_latecolor_perlin_weights,wood_latecolor_perlin_frequencies);\n lateColor = pow(abs(lateColor), vec3(expValue));\n return lateColor;\n}\nvec3 DistortDiffuseColor(vec3 diffAlbedo, vec3 p)\n{\n p.z *= wood_diffuse_perlin_scale_z;\n float expValue = 1.0 + multiband_inoise(p, wood_diffuse_perlin_bands, wood_diffuse_perlin_weights, wood_diffuse_perlin_frequencies);\n diffAlbedo = pow(abs(diffAlbedo), vec3(expValue));\n return diffAlbedo;\n}\nfloat LayerRoughnessVar(float roughness, float earlyWoodRatio)\n{\n return earlyWoodRatio * wood_groove_roughness + (1.0 - earlyWoodRatio) * roughness;\n}\nfloat hashword(vec2 k)\n{\n k = mod(k, vec2(256.0)) * ONE;\n float a = texture(permutationMap, vec2(k.x, 0.0)).x + k.y ;\n a = texture(permutationMap, vec2(a, 0.0)).x ;\n return a*255.0;\n}\nfloat wyvillsq(float rsq)\n{\n if (rsq >= 1.0) return 0.0;\n float tmp = 1.0 - rsq;\n return tmp*tmp*tmp;\n}\nfloat Weight2DNeighborImpulses(vec3 p, float woodWeight)\n{\n if(woodWeight <= 0.0) return 0.0;\n float poreRadius = wood_pore_radius * woodWeight;\n vec2 left = floor((p.xy - poreRadius) / wood_pore_cell_dim);\n vec2 right = floor((p.xy + poreRadius) / wood_pore_cell_dim);\n float weight = 0.0;\n float invRsq = 1.0 / (poreRadius * poreRadius);\n const float norm = 1.0 / 15.0;\n for (int j = 0; j <= 4; j++)\n {\n if (j > int(right.y - left.y)) continue;\n for (int i = 0; i <= 4; i++)\n {\n if (i > int(right.x - left.x)) continue;\n vec2 pij = vec2(float(i) + left.x,float(j) + left.y);\n float hRNum = hashword(pij);\n float impPosX = mod(hRNum, 16.0) * norm;\n float impPosY = floor(hRNum / 16.0) * norm;\n impPosX = (pij.x + impPosX)* wood_pore_cell_dim;\n impPosY = (pij.y + impPosY)* wood_pore_cell_dim;\n float dsq = (p.x - impPosX) * (p.x - impPosX) + (p.y - impPosY) * (p.y - impPosY);\n weight += wyvillsq(dsq * invRsq);\n }\n }\n return weight;\n}\nfloat Weight3DRayImpulses(vec3 p)\n{\n int segIdx = int(floor(p.z / wood_ray_seg_length_z));\n float factor = p.z / wood_ray_seg_length_z - float(segIdx);\n int segIdx1 = segIdx - 1;\n if ( factor > 0.5 )\n segIdx1 = segIdx + 1;\n float theta = atan(p.y, p.x);\n float sliceIdx = floor(((theta + PI) * RECIPROCAL_PI2) * wood_ray_num_slices);\n if ( sliceIdx == wood_ray_num_slices)\n sliceIdx-=1.0;\n ivec2 arrSegs = ivec2(segIdx, segIdx1);\n float weight = 0.0;\n const float norm = 1.0 / 15.0;\n float radialOffset = 5.0;\n float radialLength = length(p.xy);\n for (int seg = 0; seg < 2; seg++)\n {\n float hRNum = hashword(vec2(sliceIdx, GetIndexedValue(arrSegs, seg)));\n float rn1 = mod(hRNum,16.0) * norm;\n if (radialLength < radialOffset * rn1)\n continue;\n float rayTheta = rn1;\n rayTheta = ( ( sliceIdx + rayTheta ) / wood_ray_num_slices ) * ( 2.0 * PI ) - PI;\n float rayPosZ = (hRNum/16.0)* norm;\n rayPosZ = ( float(GetIndexedValue(arrSegs, seg)) + rayPosZ ) * wood_ray_seg_length_z;\n vec3 pt1 = vec3(0.0);\n vec3 pt2 = vec3(cos(rayTheta), sin(rayTheta), 0.0);\n vec3 p1 = p;\n p1.z -= rayPosZ;\n p1.z /= wood_ray_ellipse_z2x;\n vec3 v1 = pt2 - pt1;\n vec3 v2 = pt1 - p1;\n v2 = cross(v1, v2);\n float dist = length(v2) / length(v1);\n float invRsq = 1.0 / ( wood_ray_ellipse_radius_x * wood_ray_ellipse_radius_x);\n weight += wyvillsq( (dist * dist) * invRsq );\n }\n return weight;\n}\nvec3 DarkenColorWithPores(vec3 p, vec3 diffColor, float woodWeight)\n{\n float poresWeight = Weight2DNeighborImpulses(p, woodWeight);\n float a = wood_pore_color_power - 1.0;\n float b = 1.0;\n float y = a * poresWeight + b;\n return pow(abs(diffColor), vec3(y));\n}\nvec3 DarkenColorWithRays(vec3 p, vec3 diffColor)\n{\n float raysWeight = Weight3DRayImpulses(p);\n float a = wood_ray_color_power - 1.0;\n float b = 1.0;\n float y = a * raysWeight + b;\n return pow(abs(diffColor), vec3(y));\n}\nfloat ComputeWoodWeight(float earlyWoodRatio)\n{\n float woodWeight = 0.0;\n if (wood_pore_type == 0)\n woodWeight = 1.0;\n else if (wood_pore_type == 1)\n woodWeight = earlyWoodRatio;\n else if (wood_pore_type == 2)\n woodWeight = 1.0 - earlyWoodRatio;\n else\n woodWeight = -1.0;\n return woodWeight;\n}\n#if defined( PRISMWOODBUMP )\nfloat ComputeEarlyWoodRatioAA(float radiusLength, float invUnitExt)\n{\n float transPixels = min(wood_fall_rise.x, wood_fall_rise.y) * wood_ring_thickness * invUnitExt;\n float samplesf = clamp(4.0 / transPixels, 1.0, 4.0);\n int samples = int(samplesf);\n float inverseSamples = 1.0 / float(samples);\n vec2 rdelta = vec2(dFdx(radiusLength), dFdy(radiusLength)) * inverseSamples;\n float earlywoodRatio = 0.0;\n for (int i = 0; i < 4; ++i)\n {\n if (i >= samples) break;\n for (int j = 0; j < 4; ++j)\n {\n if (j >= samples) break;\n float r = radiusLength + dot(vec2(i, j), rdelta);\n earlywoodRatio += ComputeEarlyWoodRatio(r);\n }\n }\n return earlywoodRatio * (inverseSamples * inverseSamples);\n}\nfloat LatewoodDepthVariation(float invUnitExt)\n{\n float transPixels = min(wood_fall_rise.x, wood_fall_rise.y) * wood_ring_thickness * invUnitExt;\n return clamp(transPixels * 0.5, 0.0, 1.0);\n}\nfloat LatewoodHeightVariation(float earlyWoodRatio, float latewoodBumpDepth,\n float depthVar)\n{\n return ( 1.0 - earlyWoodRatio ) * latewoodBumpDepth * depthVar;\n}\nfloat PoreDepthVariation(float woodWeight, float invUnitExt)\n{\n float porePixels = woodWeight * wood_pore_radius * invUnitExt;\n return clamp(porePixels, 0.0, 1.0);\n}\nfloat PoreHeightVariation(float earlyWoodRatio, float poresWeight, float poreDepth,\n float depthVar)\n{\n return poresWeight * (-1.0 * poreDepth) * depthVar;\n}\nvoid ComputeTangents(vec3 normal, out vec3 u, out vec3 v)\n{\n float scale = normal.z < 0.0 ? -1.0 : 1.0;\n vec3 temp = scale * normal;\n float e = temp.z;\n float h = 1.0/(1.0 + e);\n float hvx = h * temp.y;\n float hvxy = hvx * -temp.x;\n u = vec3(e + hvx * temp.y, hvxy, -temp.x);\n v = vec3(hvxy, e + h * temp.x * temp.x, -temp.y);\n u *= scale;\n v *= scale;\n}\nvec3 WoodBumpHeight(float heightLeft, float heightRight, float heightBack, float heightFront)\n{\n const float epsilon = 0.001;\n float heightDeltaX = heightRight - heightLeft;\n vec3 Tu = vec3(2.0 * epsilon, 0.0, heightDeltaX);\n float heightDeltaY = heightFront - heightBack;\n vec3 Tv = vec3(0.0, 2.0 * epsilon, heightDeltaY);\n return cross(Tu, Tv);\n}\nvec3 SelectNormal(vec3 N, vec3 bumpN, vec3 V)\n{\n float bumpNdotV = dot(bumpN, V);\n if(bumpNdotV > 0.0)\n return bumpN;\n else return N;\n}\nfloat MinInverseUnitExtent(vec3 p)\n{\n return 1.0 / max(max(length(dFdx(p.xy)), length(dFdy(p.xy))), 0.000001);\n}\nfloat HeightVariation(vec3 pos)\n{\n vec3 p = Distort(pos);\n float radiusLength = length(p.xy);\n if (wood_growth_perlin_enable)\n radiusLength = DistortRadiusLength(radiusLength);\n float invUnitExt = MinInverseUnitExtent(p);\n float earlyWoodRatio = ComputeEarlyWoodRatioAA(radiusLength, invUnitExt);\n float woodWeight = ComputeWoodWeight(earlyWoodRatio);\n float poresWeight = Weight2DNeighborImpulses(p, woodWeight);\n float depthVar = PoreDepthVariation(woodWeight, invUnitExt);\n float poreHeightVariation = -1.0 * poresWeight * wood_pore_depth * depthVar;\n float latewoodHeightVariation = 0.0;\n if (wood_use_latewood_bump)\n {\n float latewoodDepthVar = LatewoodDepthVariation(invUnitExt);\n latewoodHeightVariation = (1.0 - earlyWoodRatio) * wood_latewood_bump_depth * latewoodDepthVar;\n }\n float sumHeightVariation = poreHeightVariation + latewoodHeightVariation;\n return sumHeightVariation;\n}\n#endif\nvec3 NoiseWood(vec3 p, inout float roughness)\n{\n p = Distort(p);\n float radiusLength = length(p.xy);\n if(wood_growth_perlin_enable)\n radiusLength = DistortRadiusLength(radiusLength);\n#if defined( PRISMWOODBUMP )\n float invUnitExt = MinInverseUnitExtent( p );\n float earlyWoodRatio = ComputeEarlyWoodRatioAA(radiusLength, invUnitExt);\n#else\n float earlyWoodRatio = ComputeEarlyWoodRatio(radiusLength);\n#endif\n vec3 earlyColor = wood_early_color;\n if (wood_earlycolor_perlin_enable)\n earlyColor = DistortEarlyColor(earlyColor, radiusLength);\n vec3 lateColor;\n if (wood_use_manual_late_color)\n lateColor = wood_manual_late_color;\n else\n lateColor = pow(abs(earlyColor), vec3(wood_late_color_power));\n if(wood_latecolor_perlin_enable)\n lateColor = DistortLateColor(lateColor, radiusLength);\n vec3 diffAlbedo = earlyWoodRatio * earlyColor + (1.0 - earlyWoodRatio) * lateColor;\n if(wood_diffuse_perlin_enable)\n diffAlbedo = DistortDiffuseColor(diffAlbedo, p);\n if (wood_use_pores)\n {\n float woodWeight = ComputeWoodWeight(earlyWoodRatio);\n diffAlbedo = DarkenColorWithPores(p, diffAlbedo, woodWeight);\n }\n if (wood_use_rays)\n diffAlbedo = DarkenColorWithRays(p, diffAlbedo);\n if(wood_use_groove_roughness)\n roughness = LayerRoughnessVar(roughness, earlyWoodRatio);\n return clamp(diffAlbedo, vec3(0.0), vec3(1.0));\n}\n#if defined(PRISMWOODBUMP)\nvoid getFinalWoodContext(\n inout vec3 N, vec3 V, inout vec3 Tu, inout vec3 Tv, vec3 p,\n vec3 geoNormal, vec3 tNormal, mat3 normalMatrix\n) {\n vec3 offsetTuLeft = p - 0.001 * Tu;\n vec3 offsetTuRight = p + 0.001 * Tu;\n vec3 offsetTvLeft = p - 0.001 * Tv;\n vec3 offsetTvRight = p + 0.001 * Tv;\n float heightVariationTuLeft = HeightVariation(offsetTuLeft);\n float heightVariationTuRight = HeightVariation(offsetTuRight);\n float heightVariationTvLeft = HeightVariation(offsetTvLeft);\n float heightVariationTvRight = HeightVariation(offsetTvRight);\n vec3 bumpHeight = WoodBumpHeight(heightVariationTuLeft, heightVariationTuRight, heightVariationTvLeft, heightVariationTvRight);\n vec3 newNormal = normalize(bumpHeight.x * Tu + bumpHeight.y * Tv + bumpHeight.z * vtNormal);\n vec3 newNormalView = normalize(vNormalMatrix * newNormal);\n vec3 selectedNormal = SelectNormal(geoNormal, newNormalView, V);\n ComputeTangents(selectedNormal, Tu, Tv);\n Tu = normalize(Tu);\n Tv = normalize(Tv);\n N = faceforward(selectedNormal, -V, selectedNormal);\n}\n#endif\n#endif\n"},25424:e=>{e.exports="\nuniform float shadowESMConstant;\nuniform float shadowMapRangeMin;\nuniform float shadowMapRangeSize;\n"},79317:e=>{e.exports="\n#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap;\nuniform vec2 shadowMapSize;\nuniform float shadowDarkness;\nuniform float shadowBias;\nuniform vec3 shadowLightDir;\nin vec4 vShadowCoord;\n#include <shadowmap_decl_common>\nfloat getShadowValue() {\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n vec3 shadowCoord = vShadowCoord.xyz / vShadowCoord.w;\n shadowCoord.xyz = 0.5 * (shadowCoord.xyz + vec3(1.0, 1.0, 1.0));\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n float shadowValue = 1.0;\n if (inFrustum) {\n shadowCoord.z = min(0.999, shadowCoord.z);\n shadowCoord.z -= shadowBias;\n#ifdef USE_HARD_SHADOWS\n vec4 rgbaDepth = texture( shadowMap, shadowCoord.xy );\n float fDepth = rgbaDepth.r;\n if ( fDepth < shadowCoord.z ) {\n shadowValue = 1.0 - shadowDarkness;\n }\n#else\n vec4 rgbaDepth = texture( shadowMap, shadowCoord.xy );\n float shadowMapValue = rgbaDepth.r;\n shadowValue = exp(-shadowESMConstant * shadowCoord.z) * shadowMapValue;\n shadowValue = min(shadowValue, 1.0);\n shadowValue = mix(1.0 - shadowDarkness, 1.0, shadowValue);\n#endif\n }\n return shadowValue;\n}\n#else\nfloat getShadowValue() { return 1.0; }\n#endif\nvec3 applyEnvShadow(vec3 colorWithoutShadow, vec3 worldNormal) {\n#if defined(USE_SHADOWMAP)\n float dp = dot(shadowLightDir, worldNormal);\n float dpValue = (dp + 1.0) / 2.0;\n dpValue = min(1.0, dpValue * 1.5);\n float sv = getShadowValue();\n vec3 result = colorWithoutShadow * min(sv, dpValue);\n return result;\n#else\n return colorWithoutShadow;\n#endif\n}\n"},30133:e=>{e.exports="\n#ifdef USE_SHADOWMAP\nout vec4 vShadowCoord;\nuniform mat4 shadowMatrix;\n#endif\n"},40947:e=>{e.exports="\n#ifdef USE_SHADOWMAP\n{\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vShadowCoord = shadowMatrix * worldPosition;\n}\n#endif\n"},15373:e=>{e.exports="#ifdef USE_THEMING\nuniform vec4 themingColor;\n#endif\n"},78148:e=>{e.exports="#ifdef USE_THEMING\noutFragColor.rgb = mix(outFragColor.rgb, themingColor.rgb, themingColor.a);\n#endif\n"},99607:e=>{e.exports="\nfloat luminance_post(vec3 rgb) {\n return dot(rgb, vec3(0.299, 0.587, 0.114));\n}\nfloat luminance_pre(vec3 rgb) {\n return dot(rgb, vec3(0.212671, 0.715160, 0.072169));\n}\nvec3 xyz2rgb(vec3 xyz) {\n vec3 R = vec3( 3.240479, -1.537150, -0.498535);\n vec3 G = vec3(-0.969256, 1.875992, 0.041556);\n vec3 B = vec3( 0.055648, -0.204043, 1.057311);\n vec3 rgb;\n rgb.b = dot(xyz, B);\n rgb.g = dot(xyz, G);\n rgb.r = dot(xyz, R);\n return rgb;\n}\nvec3 rgb2xyz(vec3 rgb) {\n vec3 X = vec3(0.412453, 0.35758, 0.180423);\n vec3 Y = vec3(0.212671, 0.71516, 0.0721688);\n vec3 Z = vec3(0.0193338, 0.119194, 0.950227);\n vec3 xyz;\n xyz.x = dot(rgb, X);\n xyz.y = dot(rgb, Y);\n xyz.z = dot(rgb, Z);\n return xyz;\n}\nvec3 xyz2xyY(vec3 xyz) {\n float sum = xyz.x + xyz.y + xyz.z;\n sum = 1.0 / sum;\n vec3 xyY;\n xyY.z = xyz.y;\n xyY.x = xyz.x * sum;\n xyY.y = xyz.y * sum;\n return xyY;\n}\nvec3 xyY2xyz(vec3 xyY) {\n float x = xyY.x;\n float y = xyY.y;\n float Y = xyY.z;\n vec3 xyz;\n xyz.y = Y;\n xyz.x = x * (Y / y);\n xyz.z = (1.0 - x - y) * (Y / y);\n return xyz;\n}\nfloat toneMapCanon_T(float x)\n{\n float xpow = pow(x, 1.60525727);\n float tmp = ((1.05542877*4.68037409)*xpow) / (4.68037409*xpow + 1.0);\n return clamp(tmp, 0.0, 1.0);\n}\nconst float Shift = 1.0 / 0.18;\nfloat toneMapCanonFilmic_NoGamma(float x) {\n x *= Shift;\n const float A = 0.2;\n const float B = 0.34;\n const float C = 0.002;\n const float D = 1.68;\n const float E = 0.0005;\n const float F = 0.252;\n const float scale = 1.0/0.833837;\n return (((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F) * scale;\n}\nvec3 toneMapCanonFilmic_WithGamma(vec3 x) {\n x *= Shift;\n const float A = 0.27;\n const float B = 0.29;\n const float C = 0.052;\n const float D = 0.2;\n const float F = 0.18;\n const float scale = 1.0/0.897105;\n return (((x*(A*x+C*B))/(x*(A*x+B)+D*F))) * scale;\n}\nvec3 toneMapCanonOGS_WithGamma_WithColorPerserving(vec3 x) {\n vec3 outColor = x.rgb;\n outColor = min(outColor, vec3(3.0));\n float inLum = luminance_pre(outColor);\n if (inLum > 0.0) {\n float outLum = toneMapCanon_T(inLum);\n outColor = outColor * (outLum / inLum);\n outColor = clamp(outColor, vec3(0.0), vec3(1.0));\n }\n float gamma = 1.0/2.2;\n outColor = pow(outColor, vec3(gamma));\n return outColor;\n}\n"},97713:e=>{e.exports="\n#ifdef WIDE_LINES\nin vec3 prev;\nin vec3 next;\nin float side;\nuniform vec2 view_size;\nvec2 to2d(vec4 i) {\n return i.xy / i.w;\n}\n#endif\n"},80862:e=>{e.exports="\n#ifdef WIDE_LINES\nvec4 mvpPosition = projectionMatrix * mvPosition; \nmat3 vectorMatrix = mat3(modelViewMatrix);\nvec2 _pos = to2d(mvpPosition) * view_size;\nvec2 _prev = to2d(projectionMatrix * vec4(mvPosition.xyz + vectorMatrix * (prev * 0.01), 1.0)) * view_size;\nvec2 _next = to2d(projectionMatrix * vec4(mvPosition.xyz - vectorMatrix * (next * 0.01), 1.0)) * view_size;\nvec2 dir1 = _pos - _next;\nvec2 dir2 = _prev - _pos;\ndir2 = (length(dir2) > 0.0000001) ? normalize(dir2) : vec2(0.0, 0.0);\ndir1 = (length(dir1) > 0.0000001) ? normalize(dir1) : dir2;\nvec2 dir_sharp = normalize(dir1 + dir2);\nvec2 dir = normalize(dir1 + dir_sharp);\nvec2 offset = vec2(-dir.y, dir.x);\nfloat len = 1.0 / cross(vec3(offset, 0), vec3(dir1, 0)).z;\noffset *= len;\noffset /= view_size;\noffset *= side;\noffset *= mvpPosition.w;\nmvpPosition.xy += offset;\ngl_Position = mvpPosition;\n#endif\n"},70984:e=>{e.exports="in vec3 vColor;\nin vec2 vUv;\nuniform samplerCube envMap;\nuniform vec3 uCamDir;\nuniform vec3 uCamUp;\nuniform vec2 uResolution;\nuniform float uHalfFovTan;\nuniform float opacity;\nuniform bool envMapBackground;\n#ifdef USE_BACKGROUND_TEXTURE\nuniform sampler2D backgroundTexture;\n#endif\n#include <env_sample>\nconst int bloomRange = 4;\n#include <ordered_dither>\nuniform float envMapExposure;\n#if TONEMAP_OUTPUT > 0\nuniform float exposureBias;\n#include <tonemap>\n#endif\nvec3 rayDir(in vec2 vUv) {\n vec3 A = (uResolution.x/uResolution.y)*normalize(cross(uCamDir,uCamUp)) * (uHalfFovTan * 2.0);\n vec3 B = normalize(uCamUp) * (uHalfFovTan * 2.0);\n vec3 C = normalize(uCamDir);\n vec3 ray = normalize( C + (2.0*vUv.x-1.0)*A + (2.0*vUv.y-1.0)*B );\n return ray;\n}\nvec3 getColor(in vec3 rd) {\n return RGBMDecode(texture(envMap, adjustLookupVector(rd)), envMapExposure);\n}\nvoid main() {\n vec3 rd = rayDir(vUv);\n vec3 outColor;\n float alpha = opacity;\n#ifdef USE_BACKGROUND_TEXTURE\n vec4 texel = texture(backgroundTexture, vUv);\n outColor = texel.rgb;\n alpha *= texel.a;\n#else\n if (envMapBackground) {\n outColor = getColor(rd);\n#if TONEMAP_OUTPUT == 1\n outColor = toneMapCanonOGS_WithGamma_WithColorPerserving(exposureBias * outColor);\n#elif TONEMAP_OUTPUT == 2\n outColor = toneMapCanonFilmic_WithGamma(exposureBias * outColor);\n#endif\n }\n else {\n outColor = vColor;\n }\n#endif\n outFragColor = vec4(orderedDithering(outColor), alpha);\n}\n"},8071:e=>{e.exports="uniform vec3 color1;\nuniform vec3 color2;\nout vec2 vUv;\nout vec3 vColor;\nvoid main() {\n if (uv.y == 0.0)\n vColor = color2;\n else\n vColor = color1;\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"},27608:e=>{e.exports="uniform vec3 diffuse;\nuniform float opacity;\n#if defined(DEPTH_OCCLUSION) && DEPTH_OCCLUSION == 1\nuniform sampler2D tDepthTest;\nuniform vec2 tDepthResolution;\nin float vDepthPositionZ;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#if NUM_CUTPLANES > 0\nin highp vec3 vWorldPosition;\n#endif\n#if defined( PARTICLE_UV )\nin highp vec4 vUVp;\n#endif\n#include <cutplanes>\n#include <id_decl_frag>\n#include <theming_decl_frag>\n#include <logdepthbuf_decl_frag>\nvoid main() {\n#if NUM_CUTPLANES > 0\n checkCutPlanes(vWorldPosition);\n#endif\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n#if defined( USE_MAP ) && defined ( PARTICLE_FRAGMENT )\n #if defined( PARTICLE_UV )\n vec2 uv3 = mix( vUVp.xy, vUVp.zw, gl_PointCoord );\n diffuseColor = texture( map, uv3);\n #else\n \tdiffuseColor = texture( map, gl_PointCoord );\n #endif\n#else\n #include <map_fragment>\n#endif\n#include <color_fragment>\n#include <alphamap_fragment>\n#include <alphatest_fragment>\n#include <specularmap_fragment>\n outgoingLight = diffuseColor.rgb;\n#if !defined ( PARTICLE_FRAGMENT )\n #include <lightmap_fragment>\n #include <envmap_fragment>\n#endif\n#include <linear_to_gamma_fragment>\n outFragColor = vec4( outgoingLight, diffuseColor.a );\n vec3 geomNormal = vec3(0.0,0.0,0.0);\n float depth = 0.0;\n#include <theming_frag>\n#if defined(DEPTH_OCCLUSION) && DEPTH_OCCLUSION == 1\n vec2 depthUV = gl_FragCoord.xy * tDepthResolution;\n float depthVal = texture(tDepthTest, depthUV).z;\n if(depthVal > vDepthPositionZ && depthVal != 0.) {\n discard;\n }\n#endif\n#include <final_frag>\n#include <logdepthbuf_frag>\n}\n"},21175:e=>{e.exports="#include <id_decl_vert>\n#include <decl_point_size>\n#include <common>\n#include <map_pars_vertex>\n#include <lightmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <wide_lines_decl>\n#include <pack_normals>\n#include <logdepthbuf_decl_vert>\n#ifdef USE_INSTANCING\n #include <instancing_decl_vert>\n#endif\n#if defined( PARTICLE_UV )\nin vec4 uvp;\nout highp vec4 vUVp;\n#endif\n#if defined (PARTICLE_FLAGS)\nin float pointScale;\n#endif\n#if NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\n#if defined(DEPTH_OCCLUSION) && DEPTH_OCCLUSION == 1\nout float vDepthPositionZ;\n#endif\nvoid main() {\n#ifdef USE_INSTANCING\n vec3 instancePosition = getInstancePos(position);\n #define position instancePosition\n#endif\n#if defined(USE_ENVMAP) && (defined(UNPACK_NORMALS) || defined(USE_INSTANCE))\n vec3 correctNormal;\n #ifdef UNPACK_NORMALS\n correctNormal = decodeNormal(normal);\n #else\n correctNormal = normal;\n #endif\n #ifdef USE_INSTANCING\n correctNormal = getInstanceNormal(correctNormal);\n #endif\n #define normal correctNormal\n#endif\n#include <map_vertex>\n#include <lightmap_vertex>\n#include <color_vertex>\n#ifdef USE_ENVMAP\n#include <defaultnormal_vertex>\n#endif\n#include <default_vertex>\n#include <wide_lines_vert>\n#include <worldpos_vertex>\n#if NUM_CUTPLANES > 0\n vec4 _worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = _worldPosition.xyz;\n#endif\n#if defined(DEPTH_OCCLUSION) && DEPTH_OCCLUSION == 1\n vec4 _vDepthPosition = modelViewMatrix * vec4( position, 1.0 );\n vDepthPositionZ = _vDepthPosition.z;\n#endif\n#if defined( PARTICLE_UV )\n vUVp = uvp;\n#endif\n#include <envmap_vertex>\n#include <id_vert>\n#include <point_size>\n#if defined (PARTICLE_FLAGS) \n gl_PointSize *= clamp(pointScale, 0.0, 2.0);\n#endif\n#include <logdepthbuf_vert>\n}\n"},66299:e=>{e.exports="uniform sampler2D tDiffuse;\nuniform sampler2D tAO;\nuniform int useAO;\nuniform float aoOpacity;\nuniform sampler2D tOverlay;\nuniform int useOverlay;\nuniform int useOverlayAlpha;\nuniform vec2 resolution;\nuniform vec4 objIDv4;\nuniform sampler2D tID;\nuniform vec4 edgeObjIDv4;\n#if defined(USE_MODEL_ID)\n#if defined(HIGHLIGHT_MODEL_ID_COUNT)\nuniform vec2 modelIDsv2v[HIGHLIGHT_MODEL_ID_COUNT];\n#else\nuniform vec2 modelIDv2;\n#endif\nuniform sampler2D tID2;\nuniform vec2 edgeModelIDv2;\n#endif\nuniform float highlightIntensity;\nuniform vec3 selectionColor;\nuniform float highlightFullModel;\nuniform vec3 highlightColor;\n#ifdef IS_2D\nuniform float expand2dSelection;\n#endif\nuniform sampler2D tCrossFadeTex0;\nuniform sampler2D tCrossFadeTex1;\nuniform float crossFadeOpacity0;\nuniform float crossFadeOpacity1;\nin vec2 vUv;\n#ifdef SPATIAL_FILTER\n#include <depth_texture>\n#endif\n#include <tonemap>\n#ifdef USE_IDBUFFER_SELECTION\nbool isSelection(vec2 vUv, float I, float J) {\n vec4 idAtPixel = texture(tID, vUv+resolution*vec2(I,J));\n if (idAtPixel.rgb == vec3(0.0))\n return false;\n#if defined(USE_MODEL_ID)\n vec4 modelAtPixel = texture(tID2, vUv+resolution*vec2(I,J));\n idAtPixel.a = modelAtPixel.b;\n vec4 idDelta = abs(idAtPixel.rgba - edgeObjIDv4.rgba);\n vec2 modelDelta = abs(modelAtPixel.rg - edgeModelIDv2.rg);\n#else\n vec4 idDelta = vec4(abs(idAtPixel.rgb - edgeObjIDv4.rgb), 0.0);\n vec2 modelDelta = vec2(0.0, 0.0);\n#endif\n if (max(max(modelDelta.r, modelDelta.g), max(max(idDelta.r, idDelta.g), max(idDelta.b, idDelta.a))) < 1e-3) {\n return true;\n } else {\n return false;\n }\n}\n#else\nbool isSelected(vec3 C) {\n float minS = min(selectionColor.r, min(selectionColor.g, selectionColor.b));\n float maxS = max(selectionColor.r, max(selectionColor.g, selectionColor.b));\n float satS = maxS - minS;\n float minC = min(C.r, min(C.g, C.b));\n float maxC = max(C.r, max(C.g, C.b));\n float satC = maxC - minC;\n if (satC < .01 || satS < .01)\n return false;\n vec3 S = (selectionColor - minS) / satS;\n vec3 H = (C - minC) / satC;\n vec3 D = H - S;\n float eps = .15;\n return (abs(D.r) + abs(D.g) + abs(D.b) < eps)\n || (maxC >= (1.0 - eps) && D.r >= -eps && D.g >= -eps && D.b >= -eps);\n}\n#define IS_SELECTION(C) isSelected((C).rgb)\n#endif\nvec4 overlayEdgeDetect(vec2 vUv) {\n#ifdef IS_2D\n#define MAX_ALPHA(c)\n#define SUM_ALPHA(c, w) sumAlpha += c.a * w; sumWeight += w;\n#else\n#define MAX_ALPHA(c) maxAlpha = max(maxAlpha, c.a);\n#define SUM_ALPHA(c, w) \n#endif\n#ifdef USE_IDBUFFER_SELECTION\n#define CHECK_EDGE_ALPHA(I, J, W) { vec4 c = texture( tOverlay, vUv+resolution*vec2((I),(J)) ); MAX_ALPHA(c) if (c.a > 0.0 && isSelection(vUv, I, J)) { hasEdge++; SUM_ALPHA(c, W) selectionPixel = c; } }\n#else\n#define CHECK_EDGE_ALPHA(I, J, W) { vec4 c = texture( tOverlay, vUv+resolution*vec2((I),(J)) ); MAX_ALPHA(c) if (c.a > 0.0 && IS_SELECTION(c)) { hasEdge++; SUM_ALPHA(c, W) selectionPixel = c; } }\n#endif\n#ifndef IS_2D\n#define CHECK_EDGE_SELECTION(I, J) { vec4 c = texture( tOverlay, vUv+resolution*vec2((I),(J)) ); MAX_ALPHA(c) if (c.a <= 0.0) hasEdge++; }\n#endif\n int hasEdge = 0;\n vec4 center = texture(tOverlay, vUv);\n vec4 selectionPixel = vec4(0.0);\n#ifdef IS_2D\n float sumAlpha = 0.0, sumWeight = 0.0;\n#else\n float maxAlpha = 0.0;\n bool paintOutline = false;\n#endif\n if (center.a <= 0.0) {\n CHECK_EDGE_ALPHA(-1.0,-1.0, 1.0);\n CHECK_EDGE_ALPHA( 0.0,-1.0, 2.0);\n CHECK_EDGE_ALPHA( 1.0,-1.0, 1.0);\n CHECK_EDGE_ALPHA(-1.0, 0.0, 2.0);\n CHECK_EDGE_ALPHA( 1.0, 0.0, 2.0);\n CHECK_EDGE_ALPHA(-1.0, 1.0, 1.0);\n CHECK_EDGE_ALPHA( 0.0, 1.0, 2.0);\n CHECK_EDGE_ALPHA( 1.0, 1.0, 1.0);\n if (hasEdge != 0) {\n#ifdef IS_2D\n center.a = -clamp(expand2dSelection - 1.0 + sumAlpha / sumWeight, 0.0, 1.0);\n center.rgb = center.a < 0.0 ? selectionPixel.rgb : center.rgb;\n#else\n center = selectionPixel;\n paintOutline = true;\n#endif\n }\n }\n#ifdef USE_IDBUFFER_SELECTION\n else if (center.a > 0.0 && isSelection(vUv, 0.0, 0.0)) {\n#else\n else if (center.a > 0.0 && IS_SELECTION(center)) {\n#endif\n#ifdef IS_2D\n center.a = -clamp(center.a + expand2dSelection, 0.0, 1.0);\n#else\n CHECK_EDGE_SELECTION(-1.0,-1.0);\n CHECK_EDGE_SELECTION( 0.0,-1.0);\n CHECK_EDGE_SELECTION( 1.0,-1.0);\n CHECK_EDGE_SELECTION(-1.0, 0.0);\n CHECK_EDGE_SELECTION( 1.0, 0.0);\n CHECK_EDGE_SELECTION(-1.0, 1.0);\n CHECK_EDGE_SELECTION( 0.0, 1.0);\n CHECK_EDGE_SELECTION( 1.0, 1.0);\n if (hasEdge != 0)\n paintOutline = true;\n else\n center.a = -center.a;\n#endif\n }\n#ifndef IS_2D\n if (paintOutline) {\n float maxComponent = max(center.r, max(center.g, center.b));\n center.rgb /= maxComponent;\n center.rgb = sqrt(center.rgb);\n center.a = 0.5 + 0.5 * maxAlpha * 0.125 * float(hasEdge);\n }\n#endif\n return center;\n}\n#ifdef SPATIAL_FILTER\nSPATIAL_FILTER\n#endif\nvec4 sampleColor() {\n return texture( tDiffuse, vUv );\n}\nfloat sampleAO() {\n return (useAO != 0) ? sqrt(texture(tAO, vUv).r) : 1.0;\n}\nvec3 applyCrossFade(vec3 srcColor, sampler2D fadeTex, float opacity, vec2 vUv) {\n vec4 blendCol = texture(fadeTex, vUv);\n return mix(srcColor.rgb, blendCol.rgb, blendCol.a * opacity);\n}\nvoid applyHighlighting(inout vec3 rgb, float filterValue) {\n#ifdef IS_2D\n rgb = mix(rgb, vec3(1.0,1.0,0.0), filterValue * highlightIntensity * 0.25);\n#else\n rgb += highlightColor * filterValue * highlightIntensity * 0.20;\n#endif\n}\n#ifdef USE_MODEL_ID\nfloat getModelIdDelta(vec2 a, vec2 b) {\n vec2 delta = abs(a-b);\n return max(delta.r, delta.g);\n}\nfloat getModelIdDelta(vec2 modelAtPixel) {\n \n#ifdef HIGHLIGHT_MODEL_ID_COUNT\n float delta = 1.0;\n for (int i=0; i<HIGHLIGHT_MODEL_ID_COUNT; i++) {\n delta = min(delta, getModelIdDelta(modelAtPixel, modelIDsv2v[i]));\n }\n return delta;\n#else\n return getModelIdDelta(modelAtPixel, modelIDv2.rg);\n#endif\n}\n#endif\nvoid main() {\n vec4 texel = sampleColor();\n float ao = sampleAO();\n #ifdef NUM_CROSSFADE_TARGETS\n #if (NUM_CROSSFADE_TARGETS > 1)\n #if (TARGET_FADE_MODE == 0)\n texel.rgb = applyCrossFade(texel.rgb, tCrossFadeTex0, crossFadeOpacity0, vUv);\n texel.rgb = applyCrossFade(texel.rgb, tCrossFadeTex1, crossFadeOpacity1, vUv);\n #else\n vec4 t0 = texture(tCrossFadeTex0, vUv);\n vec4 t1 = texture(tCrossFadeTex1, vUv);\n vec4 mixed = mix(t0, t1, crossFadeOpacity1);\n texel.rgb = mix(texel.rgb, mixed.rgb, mixed.a);\n float aoGamma = 1.0 + 3.0 * (1.0 - 2.0 * abs(crossFadeOpacity1 - 0.5));\n if (aoGamma == 0.0)\n aoGamma = 1.0;\n ao = pow(ao, 1.0 / aoGamma);\n #endif\n #else\n vec4 mixed = texture(tCrossFadeTex0, vUv);\n texel.rgb = mix(texel.rgb, mixed.rgb, mixed.a);\n #endif\n #else\n #endif\n ao = 1.0 - (1.0 - ao) * aoOpacity;\n texel.rgb *= ao;\n if (useOverlay != 0) {\n vec4 overlay = overlayEdgeDetect(vUv);\n if (overlay.a < 0.0) {\n overlay.a = -overlay.a;\n#ifdef IS_2D\n overlay.a *= 0.6;\n#else\n if (overlay.a >= 0.99) {\n overlay.a = 0.75;\n texel.rgb = vec3(luminance_post(texel.rgb));\n }\n#endif\n }\n#ifdef IS_2D\n texel.rgb = texel.rgb * (1.0 - overlay.a) + overlay.rgb;\n#else\n texel.rgb = texel.rgb * (1.0 - overlay.a) + sqrt(overlay.rgb * overlay.a);\n#endif\n if (useOverlayAlpha != 0) {\n texel.a += overlay.a * (1.0 - texel.a);\n }\n }\n if (objIDv4 != vec4(0.0)) {\n vec4 idAtPixel = texture(tID, vUv);\n #ifdef SPATIAL_FILTER\n vec3 worldPos = reconstructWorldPosition(gl_FragCoord.xy, vUv);\n float filterValue = (spatialFilter(worldPos) ? 1.0 : 0.0);\n if (idAtPixel != vec4(1,1,1,1)) {\n applyHighlighting(texel.rgb, filterValue);\n }\n #else\n #if defined(USE_MODEL_ID)\n vec4 modelAtPixel = texture(tID2, vUv);\n idAtPixel.a = modelAtPixel.b;\n vec4 idDelta = abs(idAtPixel.rgba - objIDv4.rgba) * (1.0 - highlightFullModel);\n float modelDelta = getModelIdDelta(modelAtPixel.rg);\n #else\n vec4 idDelta = vec4(abs(idAtPixel.rgb - objIDv4.rgb), 0.0);\n float modelDelta = 0.0;\n #endif\n if (max(modelDelta, max(max(idDelta.r, idDelta.g), max(idDelta.b, idDelta.a))) < 1e-3) {\n applyHighlighting(texel.rgb, 1.0);\n }\n #endif\n }\n outFragColor = texel;\n}\n"},91342:e=>{e.exports="\n#include <depth_texture>\nuniform sampler2D tDiffuse;\nuniform sampler2D tID;\nuniform vec2 resolution;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform sampler2D tFill;\nuniform sampler2D tPaper;\nuniform int style;\nuniform int idEdges;\nuniform int normalEdges;\nuniform int depthEdges;\nuniform float brightness;\nuniform float contrast;\nuniform int grayscale;\nuniform int preserveColor;\nuniform int outlineNoise;\nuniform float levels;\nuniform float repeats;\nuniform float rotation;\nuniform float outlineRadius;\nuniform sampler2D tGraphite1;\nuniform sampler2D tGraphite2;\nuniform sampler2D tGraphite3;\nuniform sampler2D tGraphite4;\nuniform sampler2D tGraphite5;\nuniform sampler2D tGraphite6;\nuniform sampler2D tGraphite7;\nuniform sampler2D tGraphite8;\nin vec2 vUv;\nvec4 recoverNZ(vec4 nrmz) {\n float z = sqrt(1.0 - dot(nrmz.xy, nrmz.xy));\n nrmz.w = -(nrmz.z + cameraNear) / (cameraFar - cameraNear);\n nrmz.z = z;\n return nrmz;\n}\n#include <tonemap>\n#include <hsv>\nvec3 quantize(vec3 c) {\n float L = max(c.r, max(c.g, c.b));\n c *= floor(L * (levels-1.0) + 0.5) / (L * (levels-1.0));\n return c;\n}\nvec3 quantizeRGB(vec3 c) {\n c *= c;\n c *= floor(c * levels * 0.9999) / (levels-1.0);\n return sqrt(c);\n}\nvec3 clampHue(vec3 c, float hues, float sats, float vals) {\n vec3 hsv = rgb2hsv(c);\n hsv.x = floor(hsv.x * hues + 0.5) / hues;\n hsv.y = floor(hsv.y * sats + 0.5) / sats;\n hsv.z = floor(hsv.z * vals + 0.5) / vals;\n vec3 col = hsv2rgb(hsv);\n return col;\n}\nvec3 reconstructCSFaceNormal(vec3 C) {\n return normalize(cross(dFdy(C), dFdx(C)));\n}\nvec3 getPosition(ivec2 ssP, float depth) {\n vec3 P;\n P = reconstructCSPosition(vec2(ssP) + vec2(0.5), depth);\n return P;\n}\nint isObjectEdge() {\n vec2 uv = vUv;\n if (outlineNoise == 1) {\n vec4 noise = texture(tGraphite7, vUv);\n uv = vUv + 0.02 * (noise.xy - vec2(0.25));\n }\n vec4 MM = texture(tID, uv);\n vec4 LL = texture(tID, uv + vec2(-outlineRadius, -outlineRadius) * resolution);\n if (MM != LL) return 1;\n vec4 LM = texture(tID, uv + vec2( 0.0, -outlineRadius) * resolution);\n if (MM != LM) return 1;\n vec4 LR = texture(tID, uv + vec2( outlineRadius, -outlineRadius) * resolution);\n if (MM != LR) return 1;\n vec4 ML = texture(tID, uv + vec2(-outlineRadius, 0.0) * resolution);\n if (MM != ML) return 1;\n vec4 MR = texture(tID, uv + vec2( outlineRadius, 0.0) * resolution);\n if (MM != MR) return 1;\n vec4 UL = texture(tID, uv + vec2(-outlineRadius, outlineRadius) * resolution);\n if (MM != UL) return 1;\n vec4 UM = texture(tID, uv + vec2( 0.0, outlineRadius) * resolution);\n if (MM != UM) return 1;\n vec4 UR = texture(tID, uv + vec2( outlineRadius, outlineRadius) * resolution);\n if (MM != UR) return 1;\n return (MM.x + MM.y + MM.z + MM.w) >= 4.0 ? 0 : -1;\n}\nfloat normalDiff(vec3 n1, vec3 n2) {\n float d = dot(n1.xyz, n2.xyz);\n return acos(clamp(d, -1.0, 1.0));\n}\nint isNormalDepthEdge() {\n ivec2 ssC = ivec2(gl_FragCoord.xy);\n vec2 uv = vUv;\n if (outlineNoise == 1) {\n vec4 noise = texture(tGraphite7, vUv);\n uv = vUv + 0.02 * (noise.xy - vec2(0.25));\n }\n vec4 MM = texture(tDepth, uv);\n vec4 LL = texture(tDepth, uv + vec2(-outlineRadius, -outlineRadius) * resolution);\n vec4 LM = texture(tDepth, uv + vec2( 0.0, -outlineRadius) * resolution);\n vec4 LR = texture(tDepth, uv + vec2( outlineRadius, -outlineRadius) * resolution);\n \n vec4 ML = texture(tDepth, uv + vec2(-outlineRadius, 0.0) * resolution);\n vec4 MR = texture(tDepth, uv + vec2( outlineRadius, 0.0) * resolution);\n vec4 UL = texture(tDepth, uv + vec2(-outlineRadius, outlineRadius) * resolution);\n vec4 UM = texture(tDepth, uv + vec2( 0.0, outlineRadius) * resolution);\n vec4 UR = texture(tDepth, uv + vec2( outlineRadius, outlineRadius) * resolution);\n LL = recoverNZ(LL);\n LM = recoverNZ(LM);\n LR = recoverNZ(LR);\n ML = recoverNZ(ML);\n MM = recoverNZ(MM);\n MR = recoverNZ(MR);\n UL = recoverNZ(UL);\n UM = recoverNZ(UM);\n UR = recoverNZ(UR);\n float dd = 0.0;\n if ( depthEdges == 1 ) {\n float G = (abs(UL.w - MM.w) + 2.0 * abs(UM.w - MM.w) + abs(UR.w - MM.w) + 2.0 * abs(ML.w - MM.w) + 2.0 * abs(MR.w - MM.w) + abs(LL.w - MM.w) + 2.0 * abs(LM.w - MM.w) + abs(LR.w - MM.w));\n dd = abs(dFdx(G)) + abs(dFdy(G));\n }\n float Gn = 0.0;\n if ( normalEdges == 1 ) {\n float pLL = normalDiff(LL.xyz, MM.xyz);\n float pLM = normalDiff(LM.xyz, MM.xyz);\n float pLR = normalDiff(LR.xyz, MM.xyz);\n float pML = normalDiff(ML.xyz, MM.xyz);\n float pMM = normalDiff(MM.xyz, MM.xyz);\n float pMR = normalDiff(MR.xyz, MM.xyz);\n float pUL = normalDiff(UL.xyz, MM.xyz);\n float pUM = normalDiff(UM.xyz, MM.xyz);\n float pUR = normalDiff(UR.xyz, MM.xyz);\n Gn = (abs(pUL - pMM) + 2.0 * abs(pUM - pMM) + abs(pUR - pMM) + 2.0 * abs(pML - pMM) + 2.0 * abs(pMR - pMM) + abs(pLL - pMM) + 2.0 * abs(pLM - pMM) + abs(pLR - pMM));\n }\n \n return (dd > 0.004 || Gn > 2.0) ? 1 : 0;\n}\nvec3 computeGraphite( vec3 color, vec2 loc ) {\n float lum = 0.299 * color.r + 0.587 * color.g + 0.114 * color.b;\n float offset;\n vec3 col1, col2;\n if ( lum > 6.0/7.0 ) {\n col1 = texture(tGraphite1, loc ).xyz;\n col2 = texture(tGraphite2, loc ).xyz;\n offset = 6.0/7.0;\n } else if ( lum > 5.0/7.0 ) {\n col1 = texture(tGraphite2, loc ).xyz;\n col2 = texture(tGraphite3, loc ).xyz;\n offset = 5.0/7.0;\n } else if ( lum > 4.0/7.0 ) {\n col1 = texture(tGraphite3, loc ).xyz;\n col2 = texture(tGraphite4, loc ).xyz;\n offset = 4.0/7.0;\n } else if ( lum > 3.0/7.0 ) {\n col1 = texture(tGraphite4, loc ).xyz;\n col2 = texture(tGraphite5, loc ).xyz;\n offset = 3.0/7.0;\n } else if ( lum > 2.0/7.0 ) {\n col1 = texture(tGraphite5, loc ).xyz;\n col2 = texture(tGraphite6, loc ).xyz;\n offset = 2.0/7.0;\n } else if ( lum > 1.0/7.0 ) {\n col1 = texture(tGraphite6, loc ).xyz;\n col2 = texture(tGraphite7, loc ).xyz;\n offset = 1.0/7.0;\n } else {\n col1 = texture(tGraphite7, loc ).xyz;\n col2 = texture(tGraphite8, loc ).xyz;\n offset = 0.0;\n }\n if ( col1.r == 0.0 && col2.r == 0.0 ) {\n return vec3(lum,lum,lum);\n }\n float t = (lum-offset)*7.0;\n return (col1 * t + col2 * (1.0 - t));\n}\nvec3 colorWithAdjustments() {\n vec3 sceneRGB = texture(tDiffuse, vUv).xyz;\n if ( brightness != 0.0 || contrast != 0.0) {\n if ( brightness < 0.0 )\n {\n sceneRGB = sceneRGB * (1.0 + brightness);\n }\n else\n {\n sceneRGB = sceneRGB + ((1.0 - sceneRGB) * brightness);\n }\n float slant = tan(( clamp(contrast,-1.0,1.0) + 1.0) * 3.141592/4.001);\n sceneRGB = (sceneRGB - 0.5) * slant + 0.5;\n if ( preserveColor == 1 )\n {\n float maxval = max( sceneRGB.r, sceneRGB.g );\n maxval = max( maxval, sceneRGB.b );\n if ( maxval > 1.0 )\n {\n sceneRGB /= maxval;\n }\n }\n sceneRGB = clamp(sceneRGB,0.0,1.0);\n }\n if ( grayscale == 1 ) {\n sceneRGB.rgb = vec3(luminance_post(sceneRGB.rgb));\n }\n return sceneRGB;\n}\nvoid main() {\n int foundEdge = 0;\n foundEdge = ( idEdges == 1 && isObjectEdge() == 1 ) ? 1 : 0;\n if ( foundEdge == 0 && (normalEdges == 1 || depthEdges == 1) ) {\n foundEdge = isNormalDepthEdge();\n }\n vec2 loc = vec2((vUv.x-0.5)*(resolution.y/resolution.x),vUv.y-0.5)*repeats;\n if ( style > 2 && rotation != 0.0 ) {\n float rot = 3.14159*rotation;\n float sinr = sin(rot);\n float cosr = cos(rot);\n loc = vec2(loc.x*cosr + -loc.y*sinr, loc.x*sinr + loc.y*cosr);\n }\n loc += vec2(0.5,0.5);\n vec3 color;\n if ( style == 2 ) {\n if ( foundEdge == 1 ) {\n outFragColor = vec4(0.0,0.0,0.0,1.0);\n } else {\n outFragColor = vec4(quantize(colorWithAdjustments()),1.0);\n }\n } else if ( style == 3 ) {\n color = colorWithAdjustments();\n vec3 graphColor = computeGraphite( color, loc );\n if ( foundEdge == 1 ) {\n outFragColor = vec4(0.16,0.16,0.16,1.0) + vec4(0.18 * graphColor,0.0);\n } else {\n outFragColor = vec4(graphColor,1.0);\n }\n return;\n } else if ( style == 4 ) {\n float fill = texture(tFill, loc ).r;\n float paperStrength = 0.3;\n vec3 paper = texture(tPaper, loc ).rgb;\n paper = paperStrength * paper + (1.0-paperStrength)*vec3(1.0,1.0,1.0);\n if ( foundEdge == 1 ) {\n outFragColor = 0.75 * vec4(paper * fill, 1.0);\n } else {\n fill = pow(fill,1.6);\n outFragColor = vec4(colorWithAdjustments() * (1.0 - fill) + paper * fill, 1.0);\n }\n } else {\n if ( foundEdge == 1 ) {\n outFragColor = vec4(0.0,0.0,0.0,1.0);\n } else {\n outFragColor = vec4(colorWithAdjustments(),1.0);\n }\n return; \n }\n}\n"},78551:e=>{e.exports="uniform sampler2D tDiffuse;\nin vec2 vUv;\nvoid main() {\n outFragColor = texture(tDiffuse, vUv);\n}\n"},94727:e=>{e.exports="\n#if NUM_CUTPLANES > 0\nin vec3 vWorldPosition;\n#endif\n#include <logdepthbuf_decl_frag>\n#define LINE_CUTPLANE\n#include <cutplanes>\nuniform vec4 color;\n#include <id_decl_frag>\nvoid main() {\n#include <logdepthbuf_frag>\n#if NUM_CUTPLANES > 0\n if (checkCutPlanes(vWorldPosition)) return;\n#endif\n outFragColor = color;\n#ifdef MRT_NORMALS\noutNormal = vec4(0.0);\n#endif\n#ifdef MRT_ID_BUFFER\n outId = vec4(0.0);\n #ifdef MODEL_COLOR\n outModelId = vec4(0.0);\n #endif\n#elif defined(ID_COLOR)\n outFragColor = vec4(0.0);\n#elif defined(MODEL_COLOR)\n outFragColor = vec4(0.0);\n#endif\n}\n"},9696:e=>{e.exports="\n#if NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\n#include <logdepthbuf_decl_vert>\n#include <instancing_decl_vert>\nvoid main() {\n vec3 instPos = getInstancePos(position);\n#if NUM_CUTPLANES > 0\n vec4 worldPosition = modelMatrix * vec4( instPos, 1.0 );\n vWorldPosition = worldPosition.xyz;\n#endif\n vec4 mvPosition = modelViewMatrix * vec4( instPos, 1.0 );\n vec4 p_Position = projectionMatrix * mvPosition;\n gl_Position = p_Position;\n#include <logdepthbuf_vert>\n}"},49248:e=>{e.exports="#define FXAA_EDGE_SHARPNESS (8.0)\n#define FXAA_EDGE_THRESHOLD (0.125)\n#define FXAA_EDGE_THRESHOLD_MIN (0.05)\n#define FXAA_RCP_FRAME_OPT (0.50)\n#define FXAA_RCP_FRAME_OPT2 (2.0)\nuniform sampler2D tDiffuse;\nuniform highp vec2 uResolution;\nin vec2 vPos;\nin vec4 vPosPos;\nfloat FxaaLuma(vec3 rgb) {\n return dot(rgb, vec3(0.299, 0.587, 0.114));\n}\nvoid main() {\n float lumaNw = FxaaLuma(texture(tDiffuse, vPosPos.xy).rgb);\n float lumaSw = FxaaLuma(texture(tDiffuse, vPosPos.xw).rgb);\n float lumaNe = FxaaLuma(texture(tDiffuse, vPosPos.zy).rgb) + 1.0/384.0;\n float lumaSe = FxaaLuma(texture(tDiffuse, vPosPos.zw).rgb);\n vec4 rgbaM = texture(tDiffuse, vPos.xy); \n float lumaM = FxaaLuma(rgbaM.rgb);\n float lumaMax = max(max(lumaNe, lumaSe), max(lumaNw, lumaSw));\n float lumaMin = min(min(lumaNe, lumaSe), min(lumaNw, lumaSw));\n float lumaMaxSubMinM = max(lumaMax, lumaM) - min(lumaMin, lumaM);\n float lumaMaxScaledClamped = max(FXAA_EDGE_THRESHOLD_MIN, lumaMax * FXAA_EDGE_THRESHOLD);\n if (lumaMaxSubMinM < lumaMaxScaledClamped) {\n outFragColor = rgbaM;\n return;\n }\n float dirSwMinusNe = lumaSw - lumaNe;\n float dirSeMinusNw = lumaSe - lumaNw;\n vec2 dir1 = normalize(vec2(dirSwMinusNe + dirSeMinusNw, dirSwMinusNe - dirSeMinusNw));\n vec3 rgbN1 = texture(tDiffuse, vPos.xy - dir1 * FXAA_RCP_FRAME_OPT*uResolution).rgb;\n vec3 rgbP1 = texture(tDiffuse, vPos.xy + dir1 * FXAA_RCP_FRAME_OPT*uResolution).rgb;\n float dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * FXAA_EDGE_SHARPNESS;\n vec2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);\n vec3 rgbN2 = texture(tDiffuse, vPos.xy - dir2 * FXAA_RCP_FRAME_OPT2*uResolution).rgb;\n vec3 rgbP2 = texture(tDiffuse, vPos.xy + dir2 * FXAA_RCP_FRAME_OPT2*uResolution).rgb;\n vec3 rgbA = rgbN1 + rgbP1;\n vec3 rgbB = ((rgbN2 + rgbP2) * 0.25) + (rgbA * 0.25);\n float lumaB = FxaaLuma(rgbB);\n float alpha = rgbaM.a;\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n outFragColor = vec4(rgbA * 0.5, rgbaM.a);\n else\n outFragColor = vec4(rgbB, rgbaM.a);\n}\n"},2303:e=>{e.exports="uniform vec2 uResolution;\nout vec2 vPos;\nout vec4 vPosPos;\nvoid main() {\n vPos = uv;\n vPosPos.xy = uv + vec2(-0.5, -0.5) * uResolution;\n vPosPos.zw = uv + vec2( 0.5, 0.5) * uResolution;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"},15201:e=>{e.exports="uniform sampler2D tDiffuse;\nuniform vec4 uColor;\nin vec2 vUv;\n#ifdef HORIZONTAL\n#define GET_UV(X) vec2(vUv.x + KERNEL_SCALE_H*(X), vUv.y)\n#else\n#define GET_UV(Y) vec2(vUv.x, vUv.y + KERNEL_SCALE_V*(Y))\n#endif\n#define PI 3.14159265358979\n#define SIGMA ((KERNEL_RADIUS+KERNEL_RADIUS+1.0) / 6.0)\n#define SIGMASQ2 (2.0 * SIGMA * SIGMA)\n#define GAUSSIAN(X) ( (1.0 / sqrt(PI * SIGMASQ2)) * exp(-(X)*(X)/SIGMASQ2) )\nvoid main() {\n vec4 texColSum = vec4(0.0);\n float gaussSum = 0.0;\n for (float x=-KERNEL_RADIUS; x<=KERNEL_RADIUS; x+=1.0) {\n float gauss = GAUSSIAN(x);\n vec4 texCol = texture(tDiffuse, GET_UV(x));\n#ifdef HAS_ALPHA\n texCol.rgb *= texCol.a;\n#endif\n texColSum += texCol * gauss;\n gaussSum += gauss;\n }\n#ifdef HAS_ALPHA\n texColSum.rgb /= (texColSum.a == 0.0 ? 0.0001 : texColSum.a);\n#endif\n#ifdef HORIZONTAL\n outFragColor = texColSum/gaussSum;\n#else\n outFragColor = texColSum/gaussSum * uColor;\n#endif\n}\n"},8102:e=>{e.exports="out vec2 vUv;\nvoid main() {\n#if defined(HORIZONTAL) && defined(FLIP_UV)\n vUv = vec2(uv.x, 1.0-uv.y);\n#else\n vUv = vec2(uv.x, uv.y);\n#endif\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"},99885:e=>{e.exports="uniform sampler2D tDiffuse;\nin vec2 vUv;\nvoid main() {\n vec4 texel = texture( tDiffuse, vUv );\n outFragColor = texel;\n}\n"},63694:e=>{e.exports="#define NUM_SAMPLES 29.0\n#define NUM_SPIRAL_TURNS 7.0\nuniform sampler2D tDepth;\nuniform vec3 worldSize;\nin vec2 vUv;\n#ifdef PRESET_2\n#define SAMPLE_RADIUS 0.3\n#define AO_GAMMA 1.0\n#define AO_INTENSITY 1.0\n#else\n#define SAMPLE_RADIUS 0.2\n#define AO_GAMMA 3.0\n#define AO_INTENSITY 0.8\n#endif\n#include <pack_depth>\n#define PI 3.14159265358979\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\nfloat getRandomAngle(vec2 pos) {\n return rand(pos) * (2.0 * PI);\n}\nvec2 tapLocation(float sampleNumber, float spinAngle, out float ssR){\n float alpha = float(sampleNumber + 0.5) * (1.0 / NUM_SAMPLES);\n float angle = alpha * (NUM_SPIRAL_TURNS * PI * 2.0) + spinAngle;\n ssR = alpha;\n return vec2(cos(angle), sin(angle));\n}\nvec2 sampleAO(vec2 unitDirection, float radius) {\n vec2 sampleOffset = unitDirection * radius;\n float idepth = unpackDepth(texture(tDepth, vUv + sampleOffset));\n float depth = 1.0 - idepth;\n if (depth < 1e-6) {\n if (radius == 0.0)\n return vec2(1.0, 1.0);\n else\n return vec2(0.0, 1.0);\n }\n vec3 dir = vec3(sampleOffset.x, depth, sampleOffset.y) * worldSize;\n float distance2 = dot(dir,dir);\n float idistance = 1.0 / sqrt(distance2);\n vec3 ndir = dir * idistance;\n#ifdef PRESET_2\n float importance = ndir.y * idistance;\n#else\n float importance = ndir.y / distance2;\n#endif\n vec2 ret;\n ret.x = (idepth == 0.0) ? 0.0 : importance;\n ret.y = importance;\n return ret;\n}\nvoid main() {\n vec2 sum = vec2(0.0);\n float angle = getRandomAngle(vUv);\n for (float i = 0.0; i<NUM_SAMPLES; i+= 1.0) {\n float ssR;\n vec2 uv = tapLocation(i, angle, ssR);\n sum += sampleAO(uv, ssR * SAMPLE_RADIUS);\n }\n float ao = sum.x / sum.y;\n outFragColor = packDepth(AO_INTENSITY * clamp(pow(ao, AO_GAMMA), 0.0, 0.9999));\n}\n"},12065:e=>{e.exports="uniform sampler2D tDepth;\nin vec2 vUv;\n#ifdef HORIZONTAL\n#define GET_UV(X) vec2(vUv.x + KERNEL_SCALE*(X), vUv.y)\n#else\n#define GET_UV(Y) vec2(vUv.x, vUv.y + KERNEL_SCALE*(Y))\n#endif\n#include <pack_depth>\n#define PI 3.14159265358979\n#define SIGMA ((2.0 * KERNEL_RADIUS+1.0) / 6.0)\n#define SIGMASQ2 (2.0 * SIGMA * SIGMA)\n#ifdef BOX\n#define KERNEL_VAL(X) 1.0\n#else\n#define KERNEL_VAL(X) ( (1.0 / sqrt(PI * SIGMASQ2)) * exp(-(X)*(X)/SIGMASQ2) )\n#endif\nvoid main() {\n float depthVal = 0.0;\n float sum = 0.0;\n for (float x=-KERNEL_RADIUS; x<=KERNEL_RADIUS; x+=1.0) {\n depthVal += unpackDepth(texture(tDepth, GET_UV(x))) * KERNEL_VAL(x);\n sum += KERNEL_VAL(x);\n }\n outFragColor = packDepth(depthVal/sum);\n}\n"},17797:e=>{e.exports="uniform sampler2D tDepth;\nuniform vec4 uShadowColor;\nin vec2 vUv;\n#include <pack_depth>\nvoid main() {\n float depthVal = unpackDepth(texture(tDepth, vUv));\n outFragColor = vec4(uShadowColor.rgb, uShadowColor.a * depthVal);\n}\n"},2647:e=>{e.exports="#include <pack_depth>\n#if NUM_CUTPLANES > 0\nin vec3 vWorldPosition;\n#endif\n#include <cutplanes>\nvoid main() {\n#if NUM_CUTPLANES > 0\n checkCutPlanes(vWorldPosition);\n#endif\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n depth = 1.0 - depth;\n outFragColor = packDepth(depth);\n}\n"},67312:e=>{e.exports="#if NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );;\n#if NUM_CUTPLANES > 0\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n#endif\n}\n"},4965:e=>{e.exports="#include <common>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <id_decl_frag>\n#include <theming_decl_frag>\n#include <logdepthbuf_decl_frag>\n#define ENABLE_ID_DISCARD\nuniform float opacity;\nuniform vec4 selectionColor;\n#if NUM_CUTPLANES>0\nin highp vec3 vWorldPosition;\n#endif\n#ifdef VIEWPORT_CLIPPING\nuniform highp vec4 viewportBounds;\nin vec4 vPosition;\n#endif\n#include <cutplanes>\nvoid main(){\n #if NUM_CUTPLANES>0\n checkCutPlanes(vWorldPosition);\n #endif\n \n #ifdef VIEWPORT_CLIPPING\n \n if (vPosition.x < viewportBounds.x || vPosition.x > viewportBounds.z || vPosition.y < viewportBounds.y || vPosition.y > viewportBounds.w) {\n discard;\n }\n #endif\n \n float depth = 0.;\n vec3 geomNormal = vec3(0.);\n vec3 outgoingLight = vec3(0.);\n vec4 diffuseColor = vec4(opacity);\n \n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n \n outgoingLight = diffuseColor.rgb;\n \n #include <linear_to_gamma_fragment>\n \n outFragColor = vec4(outgoingLight, diffuseColor.a);\n float writeId = 1.0;\n #ifdef GHOSTED \n writeId = 0.;\n outFragColor.a *= 0.1;\n #endif\n \n #include <theming_frag>\n outFragColor.rgb = mix(outFragColor.rgb, selectionColor.rgb, selectionColor.a);\n #include <final_frag>\n #include <logdepthbuf_frag>\n}\n"},86546:e=>{e.exports="#include <common>\n#include <logdepthbuf_decl_vert>\n#include <map_pars_vertex>\n#if NUM_CUTPLANES>0\nout vec3 vWorldPosition;\n#endif\n#ifdef VIEWPORT_CLIPPING\nuniform mat4 modelLocalMatrix;\nout vec4 vPosition;\n#endif\nvoid main(){\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n \n #if NUM_CUTPLANES>0\n vWorldPosition = (modelMatrix * vec4(position,1.)).xyz;\n #endif\n \n #ifdef VIEWPORT_CLIPPING\n vPosition = modelLocalMatrix * vec4(position.xy,0.,1.);\n #endif\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(position.xy,0.,1.);\n#include <logdepthbuf_vert>\n}\n"},24314:e=>{e.exports="\r\n\r\n#define LINE\r\n#include <line_decl_common>\r\n#include <id_decl_frag>\r\n#include <logdepthbuf_decl_frag>\r\n\r\nuniform highp float pixelsPerUnit;\r\nuniform highp float aaRange;\r\n\r\nuniform float opacity;\r\nuniform highp float viewportId;\r\nuniform highp float swap;\r\nuniform highp float grayscale;\r\n\r\n#ifdef HAS_RASTER_QUADS\r\nuniform sampler2D tRaster;\r\n#endif\r\n\r\n#ifdef HAS_LINESTYLES\r\nuniform sampler2D tLineStyle;\r\nuniform vec2 vLineStyleTexSize;\r\n#endif\r\n\r\n#ifdef VIEWPORT_CLIPPING\r\nuniform highp vec4 viewportBounds;\r\nin highp vec2 vPosition;\r\n#endif\r\n\r\n#ifdef IMAGE_UV_TEXTURE\r\nin highp vec2 vuv;\r\nuniform sampler2D tRaster;\r\n#endif\r\n\r\n\r\nfloat curveGaussian(float r, float invWidth) {\r\n float amt = clamp(r * invWidth, 0.0, 1.0);\r\n\r\n float exponent = amt * 2.0;\r\n\r\n return exp(-exponent*exponent);\r\n\r\n\r\n\r\n}\r\n\r\n#ifdef HAS_LINESTYLES\r\nfloat getLinePatternPixel(int i, int j) {\r\n\r\n return texture(tLineStyle, (vec2(i, j) + 0.5) / vLineStyleTexSize).x * 255.0;\r\n}\r\n\r\nfloat getPatternLength(int whichPattern) {\r\n float p1 = getLinePatternPixel(0, whichPattern);\r\n float p2 = getLinePatternPixel(1, whichPattern);\r\n return (p2 * 256.0 + p1);\r\n}\r\n#endif\r\n\r\n\r\nvoid fillLineSegment() {\r\n\r\n float radius = abs(fsHalfWidth);\r\n float parametricDistance = fsMultipurpose.x;\r\n float segmentLength = fsMultipurpose.y;\r\n float totalDistance = fsMultipurpose.z;\r\n\r\n#ifdef LOADING_ANIMATION\r\n float distFromStart = parametricDistance / segmentLength;\r\n if (loadingProgress < 1.0 && distFromStart > loadingProgress) {\r\n discard;\r\n }\r\n#endif\r\n\r\n\r\n#ifdef HAS_LINESTYLES\r\n int whichPattern = int(fsMultipurpose.w);\r\n\r\n if (whichPattern > 0) {\r\n const float TEX_TO_UNIT = 1.0 / 96.0;\r\n\r\n float patternScale;\r\n\r\n\r\n\r\n if (fsHalfWidth < 0.0) {\r\n patternScale = LTSCALE;\r\n } else {\r\n patternScale = LTSCALE * TEX_TO_UNIT * pixelsPerUnit;\r\n }\r\n\r\n float patLen = patternScale * getPatternLength(whichPattern);\r\n float phase = mod((totalDistance + parametricDistance) * pixelsPerUnit, patLen);\r\n\r\n bool onPixel = true;\r\n float radiusPixels = radius * pixelsPerUnit;\r\n\r\n for (int i=2; i<MAX_LINESTYLE_LENGTH; i+=2) {\r\n\r\n float on = getLinePatternPixel(i, whichPattern);\r\n if (on == 1.0) on = 0.0;\r\n on *= patternScale;\r\n\r\n onPixel = true;\r\n phase -= on;\r\n if (phase < 0.0) {\r\n break;\r\n }\r\n else if (phase <= radiusPixels) {\r\n onPixel = false;\r\n break;\r\n }\r\n\r\n float off = getLinePatternPixel(i+1, whichPattern);\r\n if (off <= 1.0) off = 0.0;\r\n off *= patternScale;\r\n\r\n onPixel = false;\r\n phase -= off;\r\n if (phase < -radiusPixels)\r\n discard;\r\n if (phase <= 0.0)\r\n break;\r\n }\r\n\r\n\r\n\r\n\r\n if (!onPixel && (abs(phase) <= radiusPixels)) {\r\n segmentLength = 0.0;\r\n parametricDistance = phase / pixelsPerUnit;\r\n }\r\n }\r\n#endif\r\n\r\n\r\n\r\n\r\n float dist;\r\n float offsetLength2 = dot(fsOffsetDirection, fsOffsetDirection);\r\n\r\n\r\n\r\n\r\n float ltz = max(0.0, sign(-parametricDistance));\r\n float gtsl = max(0.0, sign(parametricDistance - segmentLength));\r\n float d = (ltz + gtsl) * (parametricDistance - gtsl * segmentLength);\r\n dist = sqrt(max(0.0, offsetLength2 + d*d));\r\n\r\n\r\n\r\n\r\n float range = dist - radius;\r\n\r\n if (range > aaRange) {\r\n discard;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n outFragColor = fsColor;\r\n outFragColor.a *= curveGaussian(range+aaRange, pixelsPerUnit);\r\n}\r\n\r\n#ifdef HAS_CIRCLES\r\nvoid fillCircularArc() {\r\n\r\n float dist = length(fsOffsetDirection);\r\n vec2 angles = fsMultipurpose.xz;\r\n float radius = abs(fsMultipurpose.y);\r\n float range = abs(dist - radius);\r\n range -= fsHalfWidth;\r\n\r\n\r\n\r\n if (range > aaRange) {\r\n discard;\r\n }\r\n\r\n vec2 direction = fsOffsetDirection;\r\n float angle = atan(direction.y, direction.x);\r\n\r\n\r\n\r\n\r\n if (angles.x > angles.y) {\r\n\r\n if (angle > angles.x && angle < PI) {\r\n angle -= TAU;\r\n }\r\n angles.x -= TAU;\r\n\r\n\r\n\r\n if (angle < angles.x ) {\r\n angle += TAU;\r\n }\r\n }\r\n else if (angle < 0.0)\r\n angle += TAU;\r\n\r\n#ifdef LOADING_ANIMATION\r\n if ((angle - angles.x) / (angles.y - angles.x) > loadingProgress) {\r\n discard;\r\n }\r\n#endif\r\n\r\n\r\n if (angle > angles.x && angle < angles.y) {\r\n outFragColor = fsColor;\r\n outFragColor.a *= curveGaussian(range+aaRange, pixelsPerUnit);\r\n }\r\n else {\r\n discard;\r\n }\r\n\r\n}\r\n#endif\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n#ifdef HAS_ELLIPTICALS\r\n\r\n\r\n\r\n\r\n\r\n\r\nfloat EllipticalApprox(\r\n const int iters,\r\n inout float t0, inout float t1,\r\n const vec2 y, out vec2 x,\r\n const vec2 e, const vec2 ey, const vec2 esqr\r\n ) {\r\n vec2 r;\r\n for (int i = 0; i < 10; ++i) {\r\n if(i >= iters) break;\r\n\r\n float t = mix(t0, t1, 0.5);\r\n r = ey / (vec2(t) + esqr);\r\n\r\n vec2 rsq = r * r;\r\n float f = rsq.x + rsq.y - 1.0;\r\n\r\n if(f > 0.0) { t0 = t; } else { t1 = t; }\r\n }\r\n\r\n x = e * r;\r\n return distance(x, y);\r\n}\r\n\r\nfloat DistancePointEllipseSpecial (vec2 e, vec2 y, out vec2 x, float width, float aaRange) {\r\n float dist;\r\n\r\n\r\n vec2 esqr = e * e;\r\n vec2 ey = e * y;\r\n float t0 = -esqr[1] + ey[1];\r\n float t1 = -esqr[1] + length(ey);\r\n\r\n\r\n\r\n dist = EllipticalApprox(6, t0, t1, y, x, e, ey, esqr);\r\n\r\n\r\n if (dist > max(2.0 * (width + aaRange), e[0] * 0.05))\r\n return dist;\r\n\r\n\r\n dist = EllipticalApprox(6, t0, t1, y, x, e, ey, esqr);\r\n\r\n\r\n\r\n\r\n float ecc = 1.0 + 0.1 * e[0] / e[1];\r\n\r\n if (dist > max(ecc * (width + aaRange), e[0] * 0.001))\r\n return dist;\r\n if (dist < (width - aaRange) / ecc)\r\n return dist;\r\n\r\n\r\n\r\n\r\n dist = EllipticalApprox(10, t0, t1, y, x, e, ey, esqr);\r\n return dist;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\nfloat DistancePointEllipse(vec2 e, vec2 y, out vec2 locX, float width, float aaRange) {\r\n vec2 locE, locY;\r\n\r\n\r\n\r\n\r\n float diff = sign(e[0] - e[1]);\r\n vec2 swizzle = vec2(max(diff, 0.0), -min(diff, 0.0));\r\n locE.x = dot(e, swizzle.xy);\r\n locE.y = dot(e, swizzle.yx);\r\n locY.x = dot(y, swizzle.xy);\r\n locY.y = dot(y, swizzle.yx);\r\n\r\n\r\n vec2 refl = sign(locY);\r\n locY *= refl;\r\n\r\n vec2 x;\r\n float distance = DistancePointEllipseSpecial(locE, locY, x, width, aaRange);\r\n\r\n x *= refl;\r\n\r\n locX.x = dot(x, swizzle.xy);\r\n locX.y = dot(x, swizzle.yx);\r\n\r\n return distance;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\nvoid fillEllipticalArc() {\r\n vec2 angles = fsMultipurpose.xz;\r\n vec2 radii = abs(fsMultipurpose.yw);\r\n vec2 dir = fsOffsetDirection;\r\n\r\n\r\n\r\n\r\n vec2 pos;\r\n float range = DistancePointEllipse(radii, dir, pos, fsHalfWidth, aaRange);\r\n range -= fsHalfWidth;\r\n\r\n if (range > aaRange)\r\n discard;\r\n\r\n float ar = radii[0] / radii[1];\r\n\r\n\r\n\r\n\r\n float angle = atan(ar * pos.y, pos.x);\r\n\r\n\r\n\r\n\r\n if (angles.x > angles.y) {\r\n\r\n if (angle > angles.x && angle < PI) {\r\n angle -= TAU;\r\n }\r\n angles.x -= TAU;\r\n\r\n\r\n\r\n if (angle < angles.x ) {\r\n angle += TAU;\r\n }\r\n }\r\n else if (angle < 0.0)\r\n angle += TAU;\r\n\r\n#ifdef LOADING_ANIMATION\r\n if ((angle - angles.x) / (angles.y - angles.x) > loadingProgress) {\r\n discard;\r\n }\r\n#endif\r\n\r\n\r\n if (angle > angles.x && angle < angles.y) {\r\n outFragColor = fsColor;\r\n outFragColor.a *= curveGaussian(range+aaRange, pixelsPerUnit);\r\n }\r\n else {\r\n discard;\r\n }\r\n}\r\n#endif\r\n\r\n#ifdef HAS_RASTER_QUADS\r\n void fillTexQuad() {\r\n outFragColor = texture(tRaster, fsMultipurpose.xy);\r\n #ifdef LOADING_ANIMATION\r\n outFragColor.a *= loadingProgress;\r\n #endif\r\n }\r\n#endif\r\n\r\nvoid fillTriangle() {\r\n#ifdef IMAGE_UV_TEXTURE\r\n outFragColor = texture(tRaster, fract(vuv));\r\n#else\r\n outFragColor = fsColor;\r\n#endif\r\n\r\n#ifdef LOADING_ANIMATION\r\n outFragColor.a *= loadingProgress;\r\n#endif\r\n}\r\n\r\n#if NUM_CUTPLANES > 0\r\nin highp vec3 vWorldPosition;\r\n#endif\r\n\r\n#ifdef MSDF_TEXTURE_FONT\r\nin highp vec2 vuv;\r\nin float isMSDFQuards;\r\nuniform sampler2D tRaster;\r\nfloat median(float r, float g, float b) {\r\n return max(min(r, g), min(max(r, g), b));\r\n}\r\n\r\n#endif\r\n\r\n#define LINE_CUTPLANE\r\n#include <cutplanes>\r\n\r\nvoid main() {\r\n\r\n\r\n\r\n\r\n\r\n if (fsColor == vec4(0.0)) {\r\n discard;\r\n }\r\n\r\n\r\n#ifdef VIEWPORT_CLIPPING\r\n if(vPosition.x < viewportBounds.x || vPosition.x > viewportBounds.z || vPosition.y < viewportBounds.y || vPosition.y > viewportBounds.w) {\r\n discard;\r\n }\r\n#endif\r\n\r\n#ifdef MSDF_TEXTURE_FONT\r\n vec4 msdfColor = texture(tRaster, vuv);\r\n float dist = median(msdfColor.r, msdfColor.g, msdfColor.b);\r\n\r\n\r\n float delta = mix(0.25, 0.5, 1.0 - fwidth(dist));\r\n\r\n float sigDist = dist - delta;\r\n float msdfAlpha = clamp(sigDist/fwidth(sigDist) + delta, 0.0, 1.0);\r\n\r\n msdfAlpha = smoothstep(0., 1., msdfAlpha);\r\n outFragColor.a = mix(msdfAlpha, 1., 1.-isMSDFQuards);\r\n if (outFragColor.a < 0.0001) discard;\r\n\r\n#endif\r\n\r\n\r\n if (fsHalfWidth == 0.0) {\r\n#ifdef HAS_RASTER_QUADS\r\n if (fsMultipurpose.z != 0.0)\r\n fillTexQuad();\r\n else\r\n#endif\r\n fillTriangle();\r\n }\r\n else if (fsMultipurpose.y < 0.0) {\r\n#ifdef HAS_CIRCLES\r\n#ifdef HAS_ELLIPTICALS\r\n if (abs(fsMultipurpose.y) == fsMultipurpose.w)\r\n#endif\r\n fillCircularArc();\r\n#endif\r\n#ifdef HAS_ELLIPTICALS\r\n#ifdef HAS_CIRCLES\r\n else\r\n#endif\r\n fillEllipticalArc();\r\n#endif\r\n }\r\n else\r\n fillLineSegment();\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n float writeId = 1.0;\r\n \r\n outFragColor.a *= opacity;\r\n\r\n if (outFragColor.a == 0.0) {\r\n discard;\r\n }\r\n\r\n\r\n\r\n\r\n if (fsGhosting != 0.0 || \r\n ((viewportId != 0.0) && (abs(fsVpTC.x * 255.0 + fsVpTC.y) >= 0.5 && abs(fsVpTC.x * 255.0 + fsVpTC.y - viewportId) >= 0.5))) {\r\n\r\n writeId = 0.0;\r\n\r\n\r\n\r\n outFragColor.a *= ((swap == 1.0) ? 0.21 : 0.1);\r\n }\r\n\r\n#ifndef SELECTION_RENDERER\r\n\r\n if (grayscale != 0.0) {\r\n const vec3 rgb2grey = vec3(0.299, 0.587, 0.114);\r\n float gray = dot(outFragColor.rgb, rgb2grey);\r\n outFragColor.rgb = vec3(gray);\r\n }\r\n#endif\r\n\r\n#if NUM_CUTPLANES > 0\r\n if (checkCutPlanes(vWorldPosition)) return;\r\n#endif\r\n\r\n#ifdef MRT_NORMALS\r\n\r\n outNormal = vec4(0.0, 0.0, 0.0, 1.0);\r\n#endif\r\n\r\n#ifdef NO_ID_OUTPUT\r\n\r\n writeId = 0.0;\r\n#endif\r\n\r\n#include <id_frag>\r\n#include <logdepthbuf_frag>\r\n}\r\n"},49965:e=>{e.exports="\r\n\r\n#include <line_decl_common>\r\n#include <logdepthbuf_decl_vert>\r\n\r\nin vec2 fields1;\r\nin vec4 fields2;\r\nin vec4 flags4b;\r\nin vec4 layerVp4b;\r\n\r\n#ifdef HAS_ELLIPTICALS\r\nin vec3 extraParams;\r\n#endif\r\n\r\n#ifdef USE_INSTANCING\r\nin vec4 instFlags4b;\r\n#endif\r\n\r\n#ifdef MSDF_TEXTURE_FONT\r\nout highp vec2 vuv;\r\nout float isMSDFQuards;\r\n#endif\r\n\r\n#ifdef IMAGE_UV_TEXTURE\r\nout highp vec2 vuv;\r\n#endif\r\n\r\n#ifdef VIEWPORT_CLIPPING\r\nout vec2 vPosition;\r\n#endif\r\n\r\nuniform mat4 mvpMatrix;\r\n\r\nuniform float pixelsPerUnit;\r\nuniform float aaRange;\r\nuniform float viewportId;\r\nuniform float swap;\r\n\r\n\r\n\r\n\r\n\r\n#ifdef HAS_LAYERS\r\nuniform sampler2D tLayerMask;\r\n#endif\r\n\r\n#ifdef SELECTION_RENDERER\r\nuniform sampler2D tSelectionTexture;\r\nuniform vec2 vSelTexSize;\r\n#endif\r\n\r\n#ifdef SELECTION_RENDERER\r\nuniform vec4 selectionColor;\r\n#endif\r\n\r\n#ifdef LOADING_ANIMATION\r\nuniform float meshAnimTime;\r\n#endif\r\n\r\n#if NUM_CUTPLANES > 0\r\nout vec3 vWorldPosition;\r\n#endif\r\n\r\nout vec4 dbId;\r\n\r\n#ifdef UNPACK_POSITIONS\r\nuniform sampler2D tIdColor;\r\nuniform vec2 vIdColorTexSize;\r\nuniform vec4 unpackXform;\r\nin vec2 uvIdColor;\r\nfloat unpackLineWeight(float w) {\r\n if (w > 0.5) {\r\n return - (w - 0.5) * 1024.0;\r\n } else {\r\n return w * max(unpackXform.x, unpackXform.y) * 2.0;\r\n }\r\n}\r\nvec4 getVertexColor() {\r\n float u = (uvIdColor.x + 0.5) / vIdColorTexSize.x;\r\n return texture(tIdColor, vec2(u, 0.5));\r\n}\r\nvec4 getDbId() {\r\n float u = (uvIdColor.y + 0.5) / vIdColorTexSize.x;\r\n vec4 normDbId = texture(tIdColor, vec2(u, 0.5));\r\n return normDbId * 255.0;\r\n}\r\n#else\r\nin vec4 color4b;\r\nin vec4 dbId4b;\r\nvec4 unpackXform;\r\nfloat unpackLineWeight(float w) {\r\n return w;\r\n}\r\nvec4 getVertexColor() {\r\n return color4b;\r\n}\r\nvec4 getDbId() {\r\n return dbId4b;\r\n}\r\n#endif\r\n\r\n\r\nvec2 centralVertex;\r\nvec2 offsetPosition;\r\n\r\nvec2 cos_sin(const float angle) { return vec2(cos(angle), sin(angle)); }\r\n\r\nvoid min_max(inout vec2 minPt, inout vec2 maxPt, const vec2 p) {\r\n minPt = min(minPt, p);\r\n maxPt = max(maxPt, p);\r\n}\r\n\r\n#if defined(USE_INSTANCING)\r\nfloat getVertexId() { return instFlags4b.x; }\r\n#else\r\nfloat getVertexId() { return flags4b.x; }\r\n#endif\r\n\r\nbool isStartVertex() { return (getVertexId() < VBB_SEG_END_RIGHT); }\r\nbool isLeftVertex() { float id = getVertexId(); return ((id == VBB_SEG_END_LEFT || id == VBB_SEG_START_LEFT)); }\r\n\r\nstruct SegmentData { float angle, distAlong, distTotal, lineWidthHalf, lineType; };\r\nvoid decodeSegmentData(out SegmentData seg) {\r\n seg.angle = fields2.x * TAU - PI;\r\n seg.distAlong = fields2.y * max(unpackXform.x, unpackXform.y);\r\n seg.distTotal = fields2.w;\r\n seg.lineWidthHalf = unpackLineWeight(fields2.z);\r\n seg.lineType = flags4b.z;\r\n}\r\n\r\nvoid strokeLineSegment() {\r\n SegmentData seg; decodeSegmentData(seg);\r\n\r\n float isStartCapVertex = isStartVertex() ? -1.0 : 1.0;\r\n float isLeftSide = isLeftVertex( ) ? 1.0 : -1.0;\r\n\r\n\r\n float angleTransverse = seg.angle + isLeftSide * HALF_PI;\r\n float lwAdjustment = fsHalfWidth + aaRange;\r\n vec2 transverseOffset = cos_sin(angleTransverse) * lwAdjustment;\r\n offsetPosition.xy += transverseOffset;\r\n\r\n\r\n\r\n\r\n float distanceFromStart = max(isStartCapVertex, 0.0) * seg.distAlong;\r\n vec2 along = distanceFromStart * cos_sin(seg.angle);\r\n offsetPosition.xy += along;\r\n centralVertex.xy += along;\r\n\r\n\r\n vec2 moveOffset = isStartCapVertex * isLeftSide * vec2(-transverseOffset.y, transverseOffset.x);\r\n offsetPosition.xy -= moveOffset;\r\n centralVertex.xy -= moveOffset;\r\n\r\n\r\n\r\n\r\n fsMultipurpose.x = (isStartCapVertex * lwAdjustment) + distanceFromStart;\r\n fsMultipurpose.y = seg.distAlong;\r\n fsMultipurpose.z = seg.distTotal;\r\n fsMultipurpose.w = seg.lineType;\r\n\r\n if (seg.lineWidthHalf < 0.0)\r\n fsHalfWidth = -fsHalfWidth;\r\n}\r\n\r\n\r\n#ifdef HAS_TRIANGLE_GEOMS\r\nstruct TriangleData { vec2 p0, p1, p2; };\r\nvoid decodeTriangleData(out TriangleData tri) {\r\n\r\n tri.p1 = vec2(fields2.x, fields2.y) * unpackXform.xy + unpackXform.zw;\r\n tri.p2 = fields2.zw * unpackXform.xy + unpackXform.zw;\r\n}\r\n\r\nvoid strokeOneTriangle() {\r\n TriangleData tri; decodeTriangleData(tri);\r\n\r\n\r\n\r\n\r\n\r\n\r\n fsHalfWidth = 0.0;\r\n fsMultipurpose.z = 0.0;\r\n\r\n\r\n\r\n\r\n\r\n float vertexId = getVertexId();\r\n if (vertexId == VBB_SEG_END_RIGHT)\r\n offsetPosition.xy = tri.p1;\r\n else if (vertexId == VBB_SEG_END_LEFT)\r\n offsetPosition.xy = tri.p2;\r\n}\r\n#endif\r\n\r\n\r\n\r\n\r\n#ifdef HAS_RASTER_QUADS\r\nstruct TexQuadData { float angle; vec2 size; };\r\nvoid decodeTexQuadData(out TexQuadData quad) {\r\n quad.angle = fields2.x * TAU;\r\n quad.size = fields2.yz * max(unpackXform.x, unpackXform.y);\r\n}\r\n\r\nvoid strokeTexQuad() {\r\n TexQuadData quad; decodeTexQuadData(quad);\r\n\r\n vec2 corner = vec2(isLeftVertex() ? -1.0 : 1.0, isStartVertex() ? -1.0 : 1.0);\r\n\r\n vec2 p = 0.5 * corner * quad.size;\r\n vec2 rot = cos_sin(quad.angle);\r\n vec2 offset = vec2(p.x * rot.x - p.y * rot.y, p.x * rot.y + p.y * rot.x);\r\n\r\n offsetPosition.xy += offset;\r\n\r\n fsMultipurpose.xy = max(vec2(0.0), corner);\r\n\r\n\r\n fsMultipurpose.z = 1.0;\r\n fsHalfWidth = 0.0;\r\n}\r\n#endif\r\n\r\n#if defined(HAS_CIRCLES) || defined(HAS_ELLIPTICALS)\r\nstruct ArcData { vec2 c; float start, end, major, minor, tilt; };\r\nvoid decodeArcData(out ArcData arc) {\r\n arc.c = fields1.xy * unpackXform.xy + unpackXform.zw;\r\n arc.start = fields2.x * TAU;\r\n arc.end = fields2.y * TAU;\r\n arc.major = fields2.w * max(unpackXform.x, unpackXform.y);\r\n#if defined(HAS_ELLIPTICALS)\r\n arc.minor = extraParams.x;\r\n arc.tilt = extraParams.y * TAU;\r\n#endif\r\n}\r\n\r\nvoid strokeArc(const ArcData arc) {\r\n\r\n\r\n float isStart = isStartVertex() ? -1.0 : 1.0;\r\n float isLeft = isLeftVertex() ? -1.0 : 1.0;\r\n\r\n\r\n\r\n\r\n vec2 minPt;\r\n vec2 maxPt;\r\n\r\n vec2 angles = vec2(arc.start, arc.end);\r\n vec2 endsX = vec2(arc.c.x) + arc.major * cos(angles);\r\n vec2 endsY = vec2(arc.c.y) + arc.minor * sin(angles);\r\n minPt = maxPt = vec2(endsX.x, endsY.x);\r\n min_max(minPt, maxPt, vec2(endsX.y, endsY.y));\r\n\r\n if (arc.end > arc.start) {\r\n if (arc.start < PI_0_5 && arc.end > PI_0_5) {\r\n min_max(minPt, maxPt, vec2(arc.c.x, arc.c.y + arc.minor));\r\n }\r\n if (arc.start < PI && arc.end > PI) {\r\n min_max(minPt, maxPt, vec2(arc.c.x - arc.major, arc.c.y));\r\n }\r\n if (arc.start < PI_1_5 && arc.end > PI_1_5) {\r\n min_max(minPt, maxPt, vec2(arc.c.x, arc.c.y - arc.minor));\r\n }\r\n } else {\r\n\r\n min_max(minPt, maxPt, vec2(arc.c.x + arc.major, arc.c.y));\r\n\r\n\r\n\r\n if (arc.start < PI_0_5 || arc.end > PI_0_5) {\r\n min_max(minPt, maxPt, vec2(arc.c.x, arc.c.y + arc.minor));\r\n }\r\n if (arc.start < PI || arc.end > PI) {\r\n min_max(minPt, maxPt, vec2(arc.c.x - arc.major, arc.c.y));\r\n }\r\n if (arc.start < PI_1_5 || arc.end > PI_1_5) {\r\n min_max(minPt, maxPt, vec2(arc.c.x, arc.c.y - arc.minor));\r\n }\r\n }\r\n\r\n minPt -= fsHalfWidth + aaRange;\r\n maxPt += fsHalfWidth + aaRange;\r\n\r\n offsetPosition.x = (isStart < 0.0) ? minPt.x : maxPt.x;\r\n offsetPosition.y = (isLeft < 0.0) ? minPt.y : maxPt.y;\r\n\r\n\r\n\r\n\r\n\r\n fsMultipurpose.x = arc.start;\r\n fsMultipurpose.y = -arc.major;\r\n fsMultipurpose.z = arc.end;\r\n fsMultipurpose.w = arc.minor;\r\n}\r\n#endif\r\n\r\n#if defined(HAS_CIRCLES)\r\n\r\nvoid strokeCircularArc() {\r\n ArcData arc; decodeArcData(arc);\r\n\r\n float r = arc.major;\r\n if (r * pixelsPerUnit < 0.125)\r\n r = 0.25 * aaRange;\r\n arc.major = arc.minor = r;\r\n\r\n strokeArc(arc);\r\n}\r\n\r\n#endif\r\n\r\n#if defined(HAS_ELLIPTICALS)\r\nvoid strokeEllipticalArc() {\r\n ArcData arc; decodeArcData(arc);\r\n strokeArc(arc);\r\n}\r\n#endif\r\n\r\nstruct CommonAttribs { vec2 pos; vec4 color; vec2 layerTC, vpTC; float lineWidthHalf, geomType, ghosting; };\r\nvoid decodeCommonAttribs(out CommonAttribs attribs) {\r\n attribs.pos = fields1.xy * unpackXform.xy + unpackXform.zw;\r\n attribs.color = getVertexColor();\r\n attribs.geomType = flags4b.y;\r\n attribs.layerTC = layerVp4b.xy / 255.0;\r\n attribs.vpTC = layerVp4b.zw / 255.0;\r\n attribs.lineWidthHalf = unpackLineWeight(fields2.z);\r\n attribs.ghosting = flags4b.w;\r\n}\r\n\r\nvoid strokeIndexedTriangle() {\r\n\r\n fsHalfWidth = 0.0;\r\n fsMultipurpose.z = 0.0;\r\n}\r\n\r\n#ifdef SELECTION_RENDERER\r\nbool isSelected(const CommonAttribs attribs) {\r\n\r\n\r\n vec3 oid = getDbId().rgb;\r\n\r\n\r\n float id01 = oid.r + oid.g * 256.0;\r\n float t = (id01 + 0.5) * (1.0 / 4096.0);\r\n float flrt = floor(t);\r\n float texU = t - flrt;\r\n\r\n\r\n float id23 = oid.b * (65536.0 / 4096.0) + flrt;\r\n t = (id23 + 0.5) / vSelTexSize.y;\r\n float texV = fract(t);\r\n\r\n vec4 selBit = texture(tSelectionTexture, vec2(texU, texV));\r\n return selBit.r == 1.0;\r\n}\r\n#endif\r\n\r\nbool isLayerOff(const CommonAttribs attribs) {\r\n#ifdef HAS_LAYERS\r\n vec4 layerBit = texture(tLayerMask, attribs.layerTC);\r\n return (layerBit.r == 0.0);\r\n#else\r\n return false;\r\n#endif\r\n}\r\n\r\nvec4 getColor(const CommonAttribs attribs) {\r\n\r\n if (isLayerOff(attribs)) { return vec4(0.0); }\r\n\r\n#ifdef SELECTION_RENDERER\r\n if (isSelected(attribs)) { return selectionColor; }\r\n return vec4(0.0);\r\n#else\r\n return attribs.color;\r\n#endif\r\n}\r\n\r\n#ifdef GAMMA_INPUT\r\nvec4 inputToLinear(vec4 c) {\r\n return vec4(vec3(c*c), c.a);\r\n}\r\n#endif\r\n\r\nvoid main() {\r\n#ifndef UNPACK_POSITIONS\r\n unpackXform = vec4(1.0, 1.0, 0.0, 0.0);\r\n#endif\r\n\r\n CommonAttribs attribs; decodeCommonAttribs(attribs);\r\n#ifdef MSDF_TEXTURE_FONT\r\n vuv = fields2.xy;\r\n isMSDFQuards = 1.0 - abs(sign(attribs.geomType - VBB_GT_MSDF_TRIANGLE_INDEXED));\r\n#endif\r\n\r\n#ifdef IMAGE_UV_TEXTURE\r\n vuv = fields2.xy;\r\n#endif\r\n\r\n fsColor = getColor(attribs);\r\n\r\n #ifdef GAMMA_INPUT\r\n fsColor = inputToLinear(fsColor);\r\n #endif\r\n\r\n\r\n if (swap != 0.0 ) {\r\n\r\n if ( fsColor.r == 0.0 && fsColor.g == 0.0 && fsColor.b == 0.0 )\r\n fsColor.rgb = vec3(1.0,1.0,1.0);\r\n\r\n else if ( fsColor.r == 1.0 && fsColor.g == 1.0 && fsColor.b == 1.0 )\r\n fsColor.rgb = vec3(0.0,0.0,0.0);\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n centralVertex = offsetPosition = attribs.pos;\r\n\r\n float lineWeight = attribs.lineWidthHalf;\r\n if (lineWeight > 0.0) {\r\n\r\n\r\n if(lineWeight < 0.5 / pixelsPerUnit) {\r\n lineWeight = 0.5 / pixelsPerUnit;\r\n }\r\n }\r\n else {\r\n\r\n\r\n lineWeight = abs(lineWeight) / pixelsPerUnit;\r\n }\r\n\r\n fsHalfWidth = lineWeight;\r\n\r\n dbId = getDbId() / 255.0;\r\n\r\n fsVpTC = attribs.vpTC;\r\n fsGhosting = attribs.ghosting;\r\n\r\n if (attribs.geomType == VBB_GT_LINE_SEGMENT || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_START || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_END || attribs.geomType == VBB_GT_LINE_SEGMENT_MITER) strokeLineSegment();\r\n#ifdef HAS_CIRCLES\r\n else if (attribs.geomType == VBB_GT_ARC_CIRCULAR) strokeCircularArc();\r\n#endif\r\n#ifdef HAS_ELLIPTICALS\r\n else if (attribs.geomType == VBB_GT_ARC_ELLIPTICAL) strokeEllipticalArc();\r\n#endif\r\n#ifdef HAS_RASTER_QUADS\r\n else if (attribs.geomType == VBB_GT_TEX_QUAD) strokeTexQuad();\r\n#endif\r\n#ifdef HAS_TRIANGLE_GEOMS\r\n else if (attribs.geomType == VBB_GT_ONE_TRIANGLE) strokeOneTriangle();\r\n#endif\r\n else if (attribs.geomType == VBB_GT_TRIANGLE_INDEXED) strokeIndexedTriangle();\r\n\r\n\r\n\r\n fsOffsetDirection = offsetPosition - centralVertex;\r\n\r\n\r\n gl_Position = mvpMatrix * modelMatrix * vec4( offsetPosition.xy, 0.0, 1.0 );\r\n#include <logdepthbuf_vert>\r\n\r\n#ifdef LOADING_ANIMATION\r\n\r\n if (dbId.rgb == vec3(1.0)) {\r\n loadingProgress = 1.0;\r\n } else {\r\n loadingProgress = smoothstep(0.0, 1.0, meshAnimTime);\r\n }\r\n#endif\r\n\r\n#ifdef IMAGE_UV_TEXTURE\r\n fsHalfWidth = 0.0;\r\n#endif\r\n\r\n\r\n#if NUM_CUTPLANES > 0\r\n vec4 worldPosition = modelMatrix * vec4( offsetPosition.xy, 0.0, 1.0 );\r\n vWorldPosition = worldPosition.xyz;\r\n#endif\r\n\r\n#ifdef VIEWPORT_CLIPPING\r\n vPosition = offsetPosition.xy;\r\n#endif\r\n}\r\n"},65144:e=>{e.exports="\n#define LINE_SS\n#include <line_decl_common>\n#include <id_decl_frag>\n#include <logdepthbuf_decl_frag>\nuniform highp float aaRange;\nuniform float opacity;\nuniform highp float viewportId;\nuniform highp float swap;\nuniform highp float grayscale;\n#ifdef HAS_LINESTYLES\nuniform sampler2D tLineStyle;\nuniform vec2 vLineStyleTexSize;\nin highp float vPixelsPerUnit;\n#endif\n#ifdef VIEWPORT_CLIPPING\nuniform highp vec4 viewportBounds;\nin highp vec2 vPosition;\nuniform mat4 mvpMatrix;\nuniform mat4 modelMatrix;\n#endif\nfloat curveGaussian(float r, float width) {\n float amt = clamp(abs(r / (width * 1.0)), 0.0, 1.0);\n amt = max(amt - 0.0, 0.0);\n float exponent = amt * 2.0;\n return clamp(exp(-exponent*exponent), 0.0, 1.0);\n}\n#ifdef HAS_LINESTYLES\nfloat getLinePatternPixel(int i, int j) {\n return texture(tLineStyle, (vec2(i, j) + 0.5) / vLineStyleTexSize).x * 255.0;\n}\nfloat getPatternLength(int whichPattern) {\n float p1 = getLinePatternPixel(0, whichPattern);\n float p2 = getLinePatternPixel(1, whichPattern);\n return (p2 * 256.0 + p1);\n}\n#endif\nvoid fillLineSegment() {\n float radius = abs(fsHalfWidth);\n float parametricDistance = fsMultipurpose.x;\n float segmentLength = fsMultipurpose.y;\n float totalDistance = fsMultipurpose.z;\n#ifdef LOADING_ANIMATION\n float distFromStart = parametricDistance / segmentLength;\n if (loadingProgress < 1.0 && distFromStart > loadingProgress) {\n discard;\n }\n#endif\n#ifdef HAS_LINESTYLES\n int whichPattern = int(fsMultipurpose.w);\n float roundedEnd = fsMultipurpose.w;\n if (whichPattern > 0) {\n const float TEX_TO_UNIT = 1.0 / 96.0;\n float patternScale;\n if (fsHalfWidth < 0.0) {\n patternScale = LTSCALE;\n } else {\n patternScale = LTSCALE * TEX_TO_UNIT * vPixelsPerUnit;\n }\n float patLen = patternScale * getPatternLength(whichPattern);\n float phase = mod((totalDistance + parametricDistance), patLen);\n bool onPixel = true;\n float radiusPixels = radius + aaRange;\n for (int i=2; i<MAX_LINESTYLE_LENGTH; i+=2) {\n float on = getLinePatternPixel(i, whichPattern);\n if (on == 1.0) on = 0.0;\n on *= patternScale;\n onPixel = true;\n phase -= on;\n if (phase < 0.0) {\n break;\n }\n else if (phase <= radiusPixels) {\n onPixel = false;\n break;\n }\n float off = getLinePatternPixel(i+1, whichPattern);\n if (off <= 1.0) off = 0.0;\n off *= patternScale;\n onPixel = false;\n phase -= off;\n if (phase < -radiusPixels)\n discard;\n if (phase <= 0.0)\n break;\n }\n if (!onPixel && (abs(phase) <= radiusPixels)) {\n segmentLength = 0.0;\n parametricDistance = phase;\n }\n }\n#else\n float roundedEnd = fsMultipurpose.w;\n#endif\n float dist;\n float offsetLength2 = dot(fsOffsetDirection, fsOffsetDirection);\n float ltz = max(0.0, sign(-parametricDistance));\n float gtsl = max(0.0, sign(parametricDistance - segmentLength));\n float d = (ltz + gtsl) * (parametricDistance - gtsl * segmentLength);\n dist = sqrt(max(0.0, offsetLength2 + d*d));\n float range = dist - radius;\n if (roundedEnd<0.25) {\n float buttRange = max(-parametricDistance, parametricDistance - segmentLength);\n range = max(range, buttRange);\n }\n if (range > aaRange) {\n discard;\n }\n outFragColor = fsColor;\n if (range > -aaRange)\n outFragColor.a *= curveGaussian(range+aaRange, aaRange * 2.0);\n}\n#ifdef LOADING_ANIMATION\n void fillTriangle() { outFragColor = vec4(fsColor.rgb, fsColor.a * loadingProgress); }\n#else\n void fillTriangle() { outFragColor = fsColor; }\n#endif\n#if NUM_CUTPLANES > 0\nin highp vec3 vWorldPosition;\n#endif\n#define LINE_CUTPLANE\n#include <cutplanes>\nfloat getSide(vec2 a, vec2 b, vec2 c) {\n return sign((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));\n}\nvoid main() {\n if (fsColor == vec4(0.0)) {\n discard;\n }\n#ifdef VIEWPORT_CLIPPING\n vec2 bottomLeft = (mvpMatrix * modelMatrix * vec4(viewportBounds.xy, 0., 1.)).xy;\n vec2 bottomRight = (mvpMatrix * modelMatrix * vec4(viewportBounds.zy, 0., 1.)).xy;\n vec2 topRight = (mvpMatrix * modelMatrix * vec4(viewportBounds.zw, 0., 1.)).xy;\n vec2 topLeft = (mvpMatrix * modelMatrix * vec4(viewportBounds.xw, 0., 1.)).xy;\n float side = getSide(topLeft, topRight, bottomLeft);\n if (side * getSide(topRight, bottomRight, vPosition) < 0.0 ||\n side * getSide(bottomRight, bottomLeft, vPosition) < 0.0 ||\n side * getSide(bottomLeft, topLeft, vPosition) < 0.0 ||\n side * getSide(topLeft, topRight, vPosition) < 0.0) {\n discard;\n }\n#endif\n if (fsHalfWidth == 0.0) {\n fillTriangle();\n }\n else\n fillLineSegment();\n float writeId = 1.0;\n outFragColor.a *= opacity;\n if (outFragColor.a == 0.0) {\n discard;\n }\n if (fsGhosting != 0.0 || \n ((viewportId != 0.0) && (abs(fsVpTC.x * 255.0 + fsVpTC.y) >= 0.5 && abs(fsVpTC.x * 255.0 + fsVpTC.y - viewportId) >= 0.5))) {\n writeId = 0.0;\n outFragColor.a *= ((swap == 1.0) ? 0.21 : 0.1);\n }\n#ifndef SELECTION_RENDERER\n if (grayscale != 0.0) {\n const vec3 rgb2grey = vec3(0.299, 0.587, 0.114);\n float gray = dot(outFragColor.rgb, rgb2grey);\n outFragColor.rgb = vec3(gray);\n }\n#endif\n#if NUM_CUTPLANES > 0\n if (checkCutPlanes(vWorldPosition)) return;\n#endif\n#ifdef MRT_NORMALS\n outNormal = vec4(0.0, 0.0, 0.0, 1.0);\n#endif\n#ifdef NO_ID_OUTPUT\n writeId = 0.0;\n#endif\n#include <id_frag>\n#include <logdepthbuf_frag>\n}\n"},97431:e=>{e.exports="\n#include <line_decl_common>\n#include <logdepthbuf_decl_vert>\nin vec2 fields1;\nin vec4 fields2;\nin vec4 flags4b;\nin vec4 layerVp4b;\n#ifdef HAS_MITER_LINES\nin vec3 extraParams;\nuniform float miterLimit;\nuniform float miterScaleFactor;\nuniform float miterCP;\n#endif\n#ifdef USE_INSTANCING\nin vec4 instFlags4b;\n#endif\n#ifdef VIEWPORT_CLIPPING\nout vec2 vPosition;\n#endif\nuniform mat4 mvpMatrix;\nuniform float pixelsPerUnit;\nuniform float aaRange;\nuniform vec2 size;\nuniform float viewportId;\nuniform float swap;\nuniform vec3 cameraPos;\nuniform float tanHalfFov;\n#ifdef HAS_LINESTYLES\nout float vPixelsPerUnit;\n#endif\n#ifdef HAS_LAYERS\nuniform sampler2D tLayerMask;\n#endif\n#ifdef SELECTION_RENDERER\nuniform sampler2D tSelectionTexture;\nuniform vec2 vSelTexSize;\n#endif\n#ifdef SELECTION_RENDERER\nuniform vec4 selectionColor;\n#endif\n#ifdef LOADING_ANIMATION\nuniform float meshAnimTime;\n#endif\n#if NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\nout vec4 dbId;\n#ifdef UNPACK_POSITIONS\nuniform sampler2D tIdColor;\nuniform vec2 vIdColorTexSize;\nuniform vec4 unpackXform;\nin vec2 uvIdColor;\nfloat unpackLineWeight(float w) {\n if (w > 0.5) {\n return - (w - 0.5) * 1024.0;\n } else {\n return w * max(unpackXform.x, unpackXform.y) * 2.0;\n }\n}\nvec4 getVertexColor() {\n float u = (uvIdColor.x + 0.5) / vIdColorTexSize.x;\n return texture(tIdColor, vec2(u, 0.5));\n}\nvec4 getDbId() {\n float u = (uvIdColor.y + 0.5) / vIdColorTexSize.x;\n vec4 normDbId = texture(tIdColor, vec2(u, 0.5));\n return normDbId * 255.0;\n}\n#else\nin vec4 color4b;\nin vec4 dbId4b;\nvec4 unpackXform;\nfloat unpackLineWeight(float w) {\n return w;\n}\nvec4 getVertexColor() {\n return color4b;\n}\nvec4 getDbId() {\n return dbId4b;\n}\n#endif\nvec2 centralVertex;\nvec2 offsetPosition;\nvec2 offsetPosDepth;\nvec2 cos_sin(const float angle) { return vec2(cos(angle), sin(angle)); }\nvoid min_max(inout vec2 minPt, inout vec2 maxPt, const vec2 p) {\n minPt = min(minPt, p);\n maxPt = max(maxPt, p);\n}\n#if defined(USE_INSTANCING)\nfloat getVertexId() { return instFlags4b.x; }\n#else\nfloat getVertexId() { return flags4b.x; }\n#endif\nbool isStartVertex() { return (getVertexId() < VBB_SEG_END_RIGHT); }\nbool isLeftVertex() { float id = getVertexId(); return ((id == VBB_SEG_END_LEFT || id == VBB_SEG_START_LEFT)); }\nstruct SegmentData { float angle, distAlong, distTotal, lineWidthHalf, lineType; };\nvoid decodeSegmentData(out SegmentData seg) {\n seg.angle = fields2.x * TAU - PI;\n seg.distAlong = fields2.y * max(unpackXform.x, unpackXform.y);\n seg.distTotal = fields2.w;\n seg.lineWidthHalf = unpackLineWeight(fields2.z);\n seg.lineType = flags4b.z;\n}\nvoid strokeLineSegment(float geomType) {\n SegmentData seg; decodeSegmentData(seg);\n float isStartCapVertex = isStartVertex() ? -1.0 : 1.0;\n float isLeftSide = isLeftVertex( ) ? 1.0 : -1.0;\n vec4 startPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy, 0.0, 1.0));\n float distanceAlong = seg.distAlong;\n vec2 along = distanceAlong * cos_sin(seg.angle);\n vec4 endPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy + along, 0.0, 1.0));\n vec2 screenStart = startPosition.xy * 0.5 * size / startPosition.w;\n vec2 screenEnd = endPosition.xy * 0.5 * size / endPosition.w;\n float roundedEnd = 0.0;\n if (isStartCapVertex < 0.0) {\n offsetPosition = centralVertex = screenStart;\n offsetPosDepth = startPosition.zw;\n roundedEnd = (geomType == VBB_GT_LINE_SEGMENT || geomType == VBB_GT_LINE_SEGMENT_CAPPED_END) ? 0.5 : 0.0;\n } else {\n offsetPosition = centralVertex = screenEnd;\n offsetPosDepth = endPosition.zw;\n roundedEnd = (geomType == VBB_GT_LINE_SEGMENT || geomType == VBB_GT_LINE_SEGMENT_CAPPED_START) ? 0.5 : 0.0;\n }\n#ifdef HAS_LINESTYLES\n roundedEnd += seg.lineType;\n#endif\n vec2 screenDelta = screenEnd - screenStart;\n float screenAngle = (distanceAlong == 0.0) ? 0.0 : atan(screenDelta.y, screenDelta.x);\n float angleTransverse = screenAngle - isLeftSide * HALF_PI;\n float lwAdjustment = fsHalfWidth + aaRange;\n vec2 transverseDir = cos_sin(angleTransverse);\n offsetPosition += transverseDir * lwAdjustment;\n fsOffsetDirection = offsetPosition - centralVertex;\n float distanceFromStart = max(0.0, isStartCapVertex) * length(screenDelta);\n float segmentExtension = (roundedEnd > 0.0) ? lwAdjustment : aaRange;\n vec2 moveOffset = isStartCapVertex * isLeftSide * vec2(-transverseDir.y, transverseDir.x) * segmentExtension;\n offsetPosition += moveOffset;\n fsMultipurpose.x = (isStartCapVertex * segmentExtension) + distanceFromStart;\n fsMultipurpose.y = length(screenDelta);\n fsMultipurpose.z = seg.distTotal;\n fsMultipurpose.w = roundedEnd;\n if (seg.lineWidthHalf < 0.0)\n fsHalfWidth = -fsHalfWidth;\n gl_Position = vec4(2.0 * offsetPosition / size * offsetPosDepth.y, offsetPosDepth.xy);\n#include <logdepthbuf_vert>\n}\n#ifdef HAS_MITER_LINES\nstruct MiterSegmentData { float angle, distAlong, distAlongPN, anglePrev, angleNext, lineWidthHalf, lineType; };\nvoid decodeMiterSegment(out MiterSegmentData seg) {\n seg.angle = fields2.x * TAU - PI;\n seg.distAlong = fields2.y * max(unpackXform.x, unpackXform.y);\n seg.anglePrev = fields2.w * TAU - PI;\n seg.lineWidthHalf = unpackLineWeight(fields2.z);\n seg.lineType = flags4b.z;\n seg.angleNext = extraParams.x * TAU - PI;\n seg.distAlongPN = extraParams.y * max(unpackXform.x, unpackXform.y);\n}\nvoid strokeMiterLineSegment() {\n MiterSegmentData seg; decodeMiterSegment(seg);\n float isStartCapVertex = isStartVertex() ? -1.0 : 1.0;\n float isLeftSide = isLeftVertex( ) ? 1.0 : -1.0;\n float next = floor(seg.distAlongPN / miterCP);\n float prev = seg.distAlongPN - (next * miterCP);\n float distanceAlongNext = floor(next) / miterScaleFactor;\n float distanceAlongPrev = floor(prev) / miterScaleFactor;\n float distanceAlong = seg.distAlong;\n vec2 along = cos_sin(seg.anglePrev) * distanceAlongPrev;\n vec2 along2 = cos_sin(seg.angle) * distanceAlong;\n vec2 along3 = along2 + cos_sin(seg.angleNext) * distanceAlongNext;\n vec4 prevPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy - along , 0.0, 1.0));\n vec4 startPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy , 0.0, 1.0));\n vec4 endPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy + along2, 0.0, 1.0));\n vec4 nextPosition = (mvpMatrix * modelMatrix * vec4(centralVertex.xy + along3, 0.0, 1.0));\n vec2 screenPrev = prevPosition.xy * 0.5 * size / prevPosition.w;\n vec2 screenStart = startPosition.xy * 0.5 * size / startPosition.w;\n vec2 screenEnd = endPosition.xy * 0.5 * size / endPosition.w;\n vec2 screenNext = nextPosition.xy * 0.5 * size / nextPosition.w;\n if (isStartCapVertex < 0.0) {\n offsetPosition = centralVertex = screenStart;\n offsetPosDepth = startPosition.zw;\n } else {\n offsetPosition = centralVertex = screenEnd;\n offsetPosDepth = endPosition.zw;\n }\n vec2 screenDelta = screenEnd - screenStart;\n vec2 AB = normalize(screenStart.xy - screenPrev.xy);\n vec2 BC = normalize(screenDelta);\n vec2 CD = normalize(screenNext.xy - screenEnd.xy);\n vec2 a = screenPrev;\n vec2 b = screenStart;\n vec2 c = screenEnd;\n vec2 d = screenNext;\n vec2 p = (isStartCapVertex < 0.0) ? a : d;\n vec2 a2 = (isStartCapVertex < 0.0) ? a : c;\n vec2 b2 = (isStartCapVertex < 0.0) ? b : d;\n vec2 p2 = (isStartCapVertex < 0.0) ? c : b;\n vec2 PP = (isStartCapVertex < 0.0) ? AB : CD;\n vec2 normalBC = vec2(-BC.y, BC.x);\n vec2 normalPP = vec2(-PP.y, PP.x);\n float pIsLeftOfBC = ((c.x - b.x)*(p.y - b.y) - (c.y - b.y)*(p.x - b.x)) > 0.0 ? 1.0 : -1.0;\n vec2 bN = b + normalBC * fsHalfWidth * pIsLeftOfBC;\n vec2 cN = c + normalBC * fsHalfWidth * pIsLeftOfBC;\n vec2 pN = p + normalPP * fsHalfWidth * pIsLeftOfBC;\n float isPIntersecting = ((cN.x - bN.x)*(pN.y - bN.y) - (cN.y - bN.y)*(pN.x - bN.x)) * pIsLeftOfBC;\n float p2IsLeftOfPP = ((b2.x - a2.x)*(p2.y - a2.y) - (b2.y - a2.y)*(p2.x - a2.x)) > 0.0 ? 1.0 : -1.0;\n vec2 a2N = a2 + normalPP * fsHalfWidth * p2IsLeftOfPP;\n vec2 b2N = b2 + normalPP * fsHalfWidth * p2IsLeftOfPP;\n vec2 p2N = p2 + normalBC * fsHalfWidth * p2IsLeftOfPP;\n float isP2Intersecting = ((b2N.x - a2N.x)*(p2N.y - a2N.y) - (b2N.y - a2N.y)*(p2N.x - a2N.x)) * p2IsLeftOfPP;\n float tangentLength = (isStartCapVertex < 0.0) ? length(AB + BC) : length(BC + CD);\n vec2 tangent = (isStartCapVertex < 0.0) ? normalize(AB + BC) : normalize(BC + CD);\n vec2 miter = vec2(-tangent.y, tangent.x);\n vec2 normal = (isStartCapVertex < 0.0) ? vec2(-AB.y, AB.x) : vec2(-BC.y, BC.x);\n float miterLength = abs(1.0 / dot(miter, normal));\n vec2 moveOffset;\n float lwAdjustment = fsHalfWidth + aaRange;\n if (miterLength > miterLimit || min(isPIntersecting, isP2Intersecting) < 0.0) {\n moveOffset = isLeftSide * lwAdjustment * normalBC;\n } else {\n moveOffset = isLeftSide * miter * lwAdjustment * miterLength;\n }\n offsetPosition += moveOffset;\n float distanceFromStart = max(0.0, isStartCapVertex) * (length(screenDelta) + dot(moveOffset, BC));\n fsMultipurpose.x = distanceFromStart;\n fsMultipurpose.y = length(screenDelta) + dot(moveOffset, BC);\n fsMultipurpose.z = 0.0;\n#ifdef HAS_LINESTYLES\n fsMultipurpose.w = seg.lineType + 0.5;\n#else\n fsMultipurpose.w = 0.5;\n#endif\n if (seg.lineWidthHalf < 0.0)\n fsHalfWidth = -fsHalfWidth;\n fsOffsetDirection = offsetPosition - BC * dot(moveOffset, BC) - centralVertex;\n gl_Position = vec4(2.0 * offsetPosition / size * offsetPosDepth.y, offsetPosDepth.xy);\n#include <logdepthbuf_vert> \n}\n#endif\nstruct CommonAttribs { vec2 pos; vec4 color; vec2 layerTC, vpTC; float lineWidthHalf, geomType, ghosting; };\nvoid decodeCommonAttribs(out CommonAttribs attribs) {\n attribs.pos = fields1.xy * unpackXform.xy + unpackXform.zw;\n attribs.color = getVertexColor();\n attribs.geomType = flags4b.y;\n attribs.layerTC = layerVp4b.xy / 255.0;\n attribs.vpTC = layerVp4b.zw / 255.0;\n attribs.lineWidthHalf = unpackLineWeight(fields2.z);\n attribs.ghosting = flags4b.w;\n}\nvoid strokeIndexedTriangle() {\n fsHalfWidth = 0.0;\n fsMultipurpose.z = 0.0;\n gl_Position = (mvpMatrix * modelMatrix * vec4(centralVertex.xy, 0.0, 1.0));\n#include <logdepthbuf_vert> \n}\n#ifdef SELECTION_RENDERER\nbool isSelected(const CommonAttribs attribs) {\n vec3 oid = getDbId().rgb;\n float id01 = oid.r + oid.g * 256.0;\n float t = (id01 + 0.5) * (1.0 / 4096.0);\n float flrt = floor(t);\n float texU = t - flrt;\n float id23 = oid.b * (65536.0 / 4096.0) + flrt;\n t = (id23 + 0.5) / vSelTexSize.y;\n float texV = fract(t);\n vec4 selBit = texture(tSelectionTexture, vec2(texU, texV));\n return selBit.r == 1.0;\n}\n#endif\nbool isLayerOff(const CommonAttribs attribs) {\n#ifdef HAS_LAYERS\n vec4 layerBit = texture(tLayerMask, attribs.layerTC);\n return (layerBit.r == 0.0);\n#else\n return false;\n#endif\n}\nvec4 getColor(const CommonAttribs attribs) {\n if (isLayerOff(attribs)) { return vec4(0.0); }\n#ifdef SELECTION_RENDERER\n if (isSelected(attribs)) { return selectionColor; }\n return vec4(0.0);\n#else\n return attribs.color;\n#endif\n}\n#ifdef GAMMA_INPUT\nvec4 inputToLinear(vec4 c) {\n return vec4(vec3(c*c), c.a);\n}\n#endif\nvoid main() {\n#ifndef UNPACK_POSITIONS\n unpackXform = vec4(1.0, 1.0, 0.0, 0.0);\n#endif\n CommonAttribs attribs; decodeCommonAttribs(attribs);\n fsColor = getColor(attribs);\n #ifdef GAMMA_INPUT\n fsColor = inputToLinear(fsColor);\n #endif\n if (swap != 0.0 ) {\n if ( fsColor.r == 0.0 && fsColor.g == 0.0 && fsColor.b == 0.0 )\n fsColor.rgb = vec3(1.0,1.0,1.0);\n else if ( fsColor.r == 1.0 && fsColor.g == 1.0 && fsColor.b == 1.0 )\n fsColor.rgb = vec3(0.0,0.0,0.0);\n }\n centralVertex = offsetPosition = attribs.pos;\n float lineWeight = attribs.lineWidthHalf;\n float ppu = pixelsPerUnit;\n if (tanHalfFov > 0.0) {\n vec4 worldPos = modelMatrix * vec4(offsetPosition.xy, 0.0, 1.0);\n float distanceToCamera = length(cameraPos - worldPos.xyz);\n ppu = size.y / (2.0 * distanceToCamera * tanHalfFov);\n }\n#ifdef HAS_LINESTYLES\n vPixelsPerUnit = ppu;\n#endif\n if (lineWeight > 0.0) {\n lineWeight = max(0.5, lineWeight * ppu);\n }\n else {\n lineWeight = max(0.5, abs(lineWeight));\n }\n fsHalfWidth = lineWeight;\n dbId = dbId4b / 255.0;\n fsVpTC = attribs.vpTC;\n fsGhosting = attribs.ghosting;\n#ifdef LOADING_ANIMATION\n if (dbId.rgb == vec3(1.0)) {\n loadingProgress = 1.0;\n } else {\n loadingProgress = smoothstep(0.0, 1.0, meshAnimTime);\n }\n#endif\n if (attribs.geomType == VBB_GT_LINE_SEGMENT || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_START || attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_END) strokeLineSegment(attribs.geomType);\n#ifdef HAS_MITER_LINES\n else if (attribs.geomType == VBB_GT_LINE_SEGMENT_MITER) strokeMiterLineSegment();\n#endif\n else strokeIndexedTriangle();\n#if NUM_CUTPLANES > 0\n vec4 worldPosition = modelMatrix * vec4( offsetPosition.xy, 0.0, 1.0 );\n vWorldPosition = worldPosition.xyz;\n#endif\n#ifdef VIEWPORT_CLIPPING\n vPosition = gl_Position.xy;\n#endif\n}\n"},29126:e=>{e.exports="in highp vec3 vNormal;\nin highp float depth;\n#if NUM_CUTPLANES > 0\nin vec3 vWorldPosition;\n#endif\n#include <cutplanes>\n#include <logdepthbuf_decl_frag>\nvoid main() {\n#if NUM_CUTPLANES > 0\n checkCutPlanes(vWorldPosition);\n#endif\n vec3 n = vNormal;\n n = n * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n n = normalize( n );\n outFragColor = vec4(n.x, n.y, depth, 1.0);\n#include <logdepthbuf_frag>\n}\n"},47697:e=>{e.exports="out vec3 vNormal;\nout float depth;\n#if NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\n#include <pack_normals>\n#include <instancing_decl_vert>\n#include <logdepthbuf_decl_vert>\nvoid main() {\n#ifdef UNPACK_NORMALS\n vec3 objectNormal = decodeNormal(normal);\n#else\n vec3 objectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\n objectNormal = getInstanceNormal(objectNormal);\n vec3 instPos = getInstancePos(position);\n vec3 transformedNormal = normalMatrix * objectNormal;\n vNormal = normalize( transformedNormal );\n#if NUM_CUTPLANES > 0\n vec4 worldPosition = modelMatrix * vec4( instPos, 1.0 );\n vWorldPosition = worldPosition.xyz;\n#endif\n vec4 mvPosition = modelViewMatrix * vec4( instPos, 1.0 );\n depth = mvPosition.z;\n vec4 p_Position = projectionMatrix * mvPosition;\n gl_Position = p_Position;\n#include <logdepthbuf_vert>\n}\n"},73560:e=>{e.exports="uniform vec3 diffuse;\r\nuniform float opacity;\r\n\r\nuniform vec3 emissive;\r\nuniform vec3 specular;\r\nuniform float shininess;\r\n\r\n#include <logdepthbuf_decl_frag>\r\n\r\n#include <env_sample>\r\n\r\n#ifdef USE_COLOR\r\nin vec3 vColor;\r\n#endif\r\n\r\n#ifdef GAMMA_INPUT\r\nvec3 InputToLinear(vec3 c) {\r\n return c * c;\r\n}\r\nfloat InputToLinear(float c) {\r\n return c * c;\r\n}\r\n#else\r\nvec3 InputToLinear(vec3 c) {\r\n return c;\r\n}\r\nfloat InputToLinear(float c) {\r\n return c;\r\n}\r\n#endif\r\n\r\n#if defined( USE_MAP ) || defined( USE_SPECULARMAP )\r\nin vec2 vUv;\r\n#endif\r\n\r\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\r\nin vec2 vUvBump;\r\n#endif\r\n\r\n#if defined( USE_ALPHAMAP )\r\nin vec2 vUvAlpha;\r\n#endif\r\n\r\n#ifdef USE_MAP\r\nuniform sampler2D map;\r\n#endif\r\n\r\n#if TONEMAP_OUTPUT > 0\r\nuniform float exposureBias;\r\n#include <tonemap>\r\n#endif\r\n\r\n#if defined(IRR_RGBM) || defined(ENV_RGBM) || defined(ENV_GAMMA) || defined(IRR_GAMMA)\r\nuniform float envMapExposure;\r\n#endif\r\n\r\n#ifdef USE_FOG\r\nuniform vec3 fogColor;\r\nuniform float fogNear;\r\nuniform float fogFar;\r\n#endif\r\n#include <id_decl_frag>\r\n#include <theming_decl_frag>\r\n#include <shadowmap_decl_frag>\r\n\r\n#ifdef USE_ENVMAP\r\n\r\nuniform float reflMipIndex;\r\n\r\nuniform float reflectivity;\r\nuniform samplerCube envMap;\r\n\r\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\r\n\r\nuniform float refractionRatio;\r\n\r\n#endif\r\n\r\nvec3 sampleReflection(vec3 dir, float mipIndex) {\r\n\r\n vec3 adjDir = adjustLookupVector(dir);\r\n\r\n#ifdef ENV_GAMMA\r\n\r\n vec4 envTexColor = textureLod( envMap, adjDir, mipIndex );\r\n return GammaDecode(envTexColor, envMapExposure);\r\n\r\n#elif defined(ENV_RGBM)\r\n\r\n vec4 envTexColor = textureLod( envMap, adjDir, mipIndex );\r\n return RGBMDecode(envTexColor, envMapExposure);\r\n\r\n#else\r\n\r\n\r\n\r\n vec4 envTexColor = texture( envMap, adjDir );\r\n vec3 cubeColor = envTexColor.xyz;\r\n\r\n#ifdef GAMMA_INPUT\r\n cubeColor *= cubeColor;\r\n#endif\r\n\r\n return cubeColor;\r\n\r\n#endif\r\n\r\n}\r\n\r\n#endif\r\n\r\n\r\nuniform vec3 ambientLightColor;\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\r\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\r\n\r\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\r\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\r\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\r\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\r\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\r\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\r\n\r\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\r\n\r\n#endif\r\n\r\n#ifdef USE_IRRADIANCEMAP\r\nuniform samplerCube irradianceMap;\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0 || NUM_CUTPLANES > 0\r\nin highp vec3 vWorldPosition;\r\n#endif\r\n\r\nin highp vec3 vViewPosition;\r\n#ifndef FLAT_SHADED\r\nin highp vec3 vNormal;\r\n#endif\r\n\r\n#ifdef USE_BUMPMAP\r\n\r\nuniform sampler2D bumpMap;\r\nuniform float bumpScale;\r\n\r\n\r\n\r\n\r\n\r\n\r\nvec2 dHdxy_fwd() {\r\n\r\n vec2 dSTdx = dFdx( vUvBump );\r\n vec2 dSTdy = dFdy( vUvBump );\r\n\r\n float Hll = bumpScale * GET_BUMPMAP(vUvBump).x;\r\n float dBx = bumpScale * GET_BUMPMAP(vUvBump + dSTdx).x - Hll;\r\n float dBy = bumpScale * GET_BUMPMAP(vUvBump + dSTdy).x - Hll;\r\n\r\n return vec2( dBx, dBy );\r\n\r\n}\r\n\r\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\r\n\r\n vec3 vSigmaX = dFdx( surf_pos );\r\n vec3 vSigmaY = dFdy( surf_pos );\r\n vec3 vN = surf_norm;\r\n\r\n vec3 R1 = cross( vSigmaY, vN );\r\n vec3 R2 = cross( vN, vSigmaX );\r\n\r\n float fDet = dot( vSigmaX, R1 );\r\n\r\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\r\n return normalize( abs( fDet ) * surf_norm - vGrad );\r\n\r\n}\r\n\r\n#endif\r\n\r\n\r\n#ifdef USE_NORMALMAP\r\n\r\nuniform sampler2D normalMap;\r\nuniform vec2 normalScale;\r\n\r\n\r\n\r\n\r\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\r\n\r\n vec3 q0 = dFdx( eye_pos.xyz );\r\n vec3 q1 = dFdy( eye_pos.xyz );\r\n vec2 st0 = dFdx( vUvBump.st );\r\n vec2 st1 = dFdy( vUvBump.st );\r\n\r\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\r\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\r\n vec3 N = normalize( surf_norm );\r\n\r\n vec3 mapN = GET_NORMALMAP(vUvBump).xyz * 2.0 - 1.0;\r\n mapN.xy = normalScale * mapN.xy;\r\n mat3 tsn = mat3( S, T, N );\r\n return normalize( tsn * mapN );\r\n\r\n}\r\n\r\n#endif\r\n\r\n\r\n#ifdef USE_SPECULARMAP\r\nuniform sampler2D specularMap;\r\n#endif\r\n\r\n#ifdef USE_ALPHAMAP\r\nuniform sampler2D alphaMap;\r\n#endif\r\n\r\n#include <hatch_pattern>\r\n\r\nvec3 Schlick_v3(vec3 v, float cosHV) {\r\n float facing = max(1.0 - cosHV, 0.0);\r\n return v + (1.0 - v) * pow(facing, 5.0);\r\n}\r\n\r\nfloat Schlick_f(float v, float cosHV) {\r\n float facing = max(1.0 - cosHV, 0.0);\r\n return v + ( 1.0 - v ) * pow(facing, 5.0);\r\n}\r\n\r\n#include <cutplanes>\r\n\r\nvoid main() {\r\n\r\n#if NUM_CUTPLANES > 0\r\n checkCutPlanes(vWorldPosition);\r\n#endif\r\n\r\n outFragColor = vec4( vec3 ( 1.0 ), opacity );\r\n\r\n#ifdef USE_MAP\r\n vec4 texelColor = GET_MAP(vUv);\r\n#ifdef MAP_INVERT\r\n texelColor.xyz = 1.0-texelColor.xyz;\r\n#endif\r\n#ifdef GAMMA_INPUT\r\n texelColor.xyz *= texelColor.xyz;\r\n#endif\r\n outFragColor = outFragColor * texelColor;\r\n#endif\r\n\r\n#ifdef USE_ALPHAMAP\r\n vec4 texelAlpha = GET_ALPHAMAP(vUvAlpha);\r\n outFragColor.a *= texelAlpha.r;\r\n#endif\r\n\r\n#ifdef ALPHATEST\r\n if ( outFragColor.a < ALPHATEST ) discard;\r\n#endif\r\n\r\n float specularStrength;\r\n\r\n#ifdef USE_SPECULARMAP\r\n vec4 texelSpecular = GET_SPECULARMAP(vUv);\r\n specularStrength = texelSpecular.r;\r\n#else\r\n specularStrength = 1.0;\r\n#endif\r\n\r\n#ifndef FLAT_SHADED\r\n vec3 normal = normalize( vNormal );\r\n#ifdef DOUBLE_SIDED\r\n\r\n#endif\r\n#else\r\n vec3 fdx = dFdx( vViewPosition );\r\n vec3 fdy = dFdy( vViewPosition );\r\n vec3 normal = normalize( cross( fdx, fdy ) );\r\n#endif\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n vec3 viewDirection;\r\n if (projectionMatrix[3][3] == 0.0) {\r\n viewDirection = normalize( vViewPosition );\r\n } else {\r\n viewDirection = vec3(0.0, 0.0, 1.0);\r\n }\r\n normal = faceforward(normal, -viewDirection, normal);\r\n\r\n vec3 geomNormal = normal;\r\n\r\n#ifdef USE_NORMALMAP\r\n normal = perturbNormal2Arb( -vViewPosition, normal );\r\n#elif defined( USE_BUMPMAP )\r\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\r\n#endif\r\n\r\n vec3 totalDiffuse = vec3( 0.0 );\r\n vec3 totalSpecular = vec3( 0.0 );\r\n\r\n\r\n\r\n float shininessB = shininess * 4.0;\r\n\r\n#if MAX_POINT_LIGHTS > 0\r\n\r\n vec3 pointDiffuse = vec3( 0.0 );\r\n vec3 pointSpecular = vec3( 0.0 );\r\n\r\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\r\n\r\n float lDistance = 1.0;\r\n if ( pointLightDistance[ i ] > 0.0 )\r\n lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\r\n\r\n lVector = normalize( lVector );\r\n\r\n\r\n\r\n float dotProduct = dot( normal, lVector );\r\n\r\n float pointDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n\r\n pointDiffuse += InputToLinear(diffuse) * InputToLinear(pointLightColor[ i ]) * pointDiffuseWeight * lDistance;\r\n\r\n\r\n\r\n vec3 pointHalfVector = normalize( lVector + viewDirection );\r\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\r\n\r\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininessB ), 0.0 );\r\n float specularNormalization = shininessB * 0.125 + 0.25;\r\n vec3 schlick = Schlick_v3(InputToLinear(specular), dot( lVector, pointHalfVector ) );\r\n pointSpecular += schlick * InputToLinear(pointLightColor[ i ]) * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization ;\r\n\r\n }\r\n\r\n totalDiffuse += pointDiffuse;\r\n totalSpecular += pointSpecular;\r\n\r\n#endif\r\n\r\n#if MAX_SPOT_LIGHTS > 0\r\n\r\n vec3 spotDiffuse = vec3( 0.0 );\r\n vec3 spotSpecular = vec3( 0.0 );\r\n\r\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\r\n\r\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\r\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\r\n\r\n float lDistance = 1.0;\r\n if ( spotLightDistance[ i ] > 0.0 )\r\n lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\r\n\r\n lVector = normalize( lVector );\r\n\r\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\r\n\r\n if ( spotEffect > spotLightAngleCos[ i ] ) {\r\n\r\n spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\r\n\r\n\r\n\r\n float dotProduct = dot( normal, lVector );\r\n\r\n float spotDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n spotDiffuse += InputToLinear(diffuse) * InputToLinear(spotLightColor[ i ]) * spotDiffuseWeight * lDistance * spotEffect;\r\n\r\n\r\n\r\n vec3 spotHalfVector = normalize( lVector + viewDirection );\r\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\r\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininessB ), 0.0 );\r\n\r\n float specularNormalization = shininessB * 0.125 + 0.25;\r\n vec3 schlick = Schlick_v3(InputToLinear(specular), dot( lVector, spotHalfVector ) );\r\n spotSpecular += schlick * InputToLinear(spotLightColor[ i ]) * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\r\n }\r\n\r\n }\r\n\r\n totalDiffuse += spotDiffuse;\r\n totalSpecular += spotSpecular;\r\n\r\n#endif\r\n\r\n#if MAX_DIR_LIGHTS > 0\r\n\r\n vec3 dirDiffuse = vec3( 0.0 );\r\n vec3 dirSpecular = vec3( 0.0 );\r\n\r\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\r\n\r\n vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\r\n vec3 dirVector = normalize( lDirection.xyz );\r\n\r\n\r\n\r\n float dotProduct = dot( normal, dirVector );\r\n\r\n float dirDiffuseWeight = max( dotProduct, 0.0 );\r\n\r\n dirDiffuse += InputToLinear(diffuse) * InputToLinear(directionalLightColor[ i ]) * dirDiffuseWeight;\r\n\r\n\r\n\r\n vec3 dirHalfVector = normalize( dirVector + viewDirection );\r\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\r\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininessB ), 0.0 );\r\n\r\n float specularNormalization = shininessB * 0.125 + 0.25;\r\n vec3 schlick = Schlick_v3(InputToLinear(specular), dot( dirVector, dirHalfVector ));\r\n\r\n dirSpecular += schlick * InputToLinear(directionalLightColor[ i ]) * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\r\n\r\n }\r\n\r\n totalDiffuse += dirDiffuse;\r\n totalSpecular += dirSpecular;\r\n\r\n#endif\r\n\r\n\r\n\r\n#ifdef USE_IRRADIANCEMAP\r\n vec3 worldNormal = mat3(viewMatrixInverse) * normal;\r\n vec3 indirectDiffuse = sampleIrradianceMap(worldNormal, irradianceMap, envMapExposure);\r\n\r\n indirectDiffuse = applyEnvShadow(indirectDiffuse, worldNormal);\r\n\r\n totalDiffuse += InputToLinear(diffuse) * indirectDiffuse;\r\n#endif\r\n\r\n\r\n#ifdef METAL\r\n outFragColor.xyz = outFragColor.xyz * ( InputToLinear(emissive) + totalDiffuse + ambientLightColor * InputToLinear(diffuse) + totalSpecular );\r\n#else\r\n outFragColor.xyz = outFragColor.xyz * ( InputToLinear(emissive) + totalDiffuse + ambientLightColor * InputToLinear(diffuse) ) + totalSpecular;\r\n#endif\r\n\r\n\r\n\r\n#ifdef USE_COLOR\r\n outFragColor = outFragColor * vec4( vColor, 1.0 );\r\n#endif\r\n\r\n\r\n#if defined(USE_ENVMAP)\r\n\r\n vec3 reflectVec;\r\n\r\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\r\n\r\n#ifdef ENVMAP_MODE_REFLECTION\r\n reflectVec = reflect( -viewDirection, normal );\r\n#else \r\n reflectVec = refract( -viewDirection, normal, refractionRatio );\r\n#endif\r\n\r\n#else\r\n\r\n reflectVec = reflect( -viewDirection, normal );\r\n\r\n#endif\r\n\r\n reflectVec = mat3(viewMatrixInverse) * reflectVec;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n float reflectScale = 1.0;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n vec3 cubeColor = sampleReflection(reflectVec, reflMipIndex);\r\n\r\n cubeColor *= reflectScale;\r\n\r\n float facing = dot( viewDirection, normal );\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n if (facing < -1e-2 || reflectivity == 0.0)\r\n facing = 1.0;\r\n else\r\n facing = max(1e-6, facing);\r\n\r\n#ifdef USE_BUMPMAP\r\n\r\n\r\n\r\n facing = min(1.0, facing + bumpScale * 7.0);\r\n\r\n#endif\r\n\r\n vec3 schlickRefl;\r\n\r\n#ifdef METAL\r\n\r\n\r\n schlickRefl = InputToLinear(specular);\r\n\r\n#else\r\n\r\n\r\n schlickRefl = Schlick_v3(InputToLinear(specular), facing);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n outFragColor.a = mix(outFragColor.a, Schlick_f(outFragColor.a, facing), reflectivity);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n float invSchlick = pow(1.0 - facing * 0.5, 5.0);\r\n\r\n\r\n float norm_factor = (28.0 / 23.0) * (1.0 - invSchlick) * (1.0 - invSchlick);\r\n\r\n outFragColor.xyz *= norm_factor * (1.0 - InputToLinear(specular));\r\n\r\n#endif\r\n\r\n\r\n outFragColor.xyz += cubeColor.xyz * specularStrength * schlickRefl.xyz;\r\n\r\n#ifdef CLEARCOAT\r\n\r\n vec3 reflectVecClearcoat = reflect( -viewDirection, geomNormal );\r\n reflectVecClearcoat = mat3(viewMatrixInverse) * reflectVecClearcoat;\r\n\r\n vec3 cubeColorClearcoat = sampleReflection(reflectVecClearcoat, 0.0);\r\n\r\n\r\n float schlickClearcoat = Schlick_f(InputToLinear(reflectivity), facing);\r\n\r\n\r\n\r\n outFragColor.xyz = mix(outFragColor.xyz, cubeColorClearcoat * schlickClearcoat, 0.5);\r\n\r\n#endif\r\n\r\n\r\n\r\n\r\n#endif\r\n\r\n#if TONEMAP_OUTPUT == 1\r\n outFragColor.xyz = toneMapCanonOGS_WithGamma_WithColorPerserving(exposureBias * outFragColor.xyz);\r\n#elif TONEMAP_OUTPUT == 2\r\n outFragColor.xyz = toneMapCanonFilmic_WithGamma( exposureBias * outFragColor.xyz );\r\n#endif\r\n\r\n\r\n\r\n#ifdef USE_FOG\r\n float depth = gl_FragCoord.z / gl_FragCoord.w;\r\n float fogFactor = smoothstep( fogNear, fogFar, depth );\r\n outFragColor = mix( outFragColor, vec4( fogColor, outFragColor.w ), fogFactor );\r\n#endif\r\n#include <theming_frag>\r\n#include <final_frag>\r\n\r\n#include <logdepthbuf_frag>\r\n}\r\n"},77431:e=>{e.exports="out vec3 vViewPosition;\n#ifndef FLAT_SHADED\nout vec3 vNormal;\n#endif\n#if defined( USE_MAP ) || defined( USE_SPECULARMAP )\nout vec2 vUv;\nuniform mat3 texMatrix;\n#endif\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nout vec2 vUvBump;\nuniform mat3 texMatrixBump;\n#endif\n#if defined( USE_ALPHAMAP )\nout vec2 vUvAlpha;\nuniform mat3 texMatrixAlpha;\n#endif\n#if defined( USE_ENVMAP )\n#if ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nuniform float refractionRatio;\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || NUM_CUTPLANES > 0\nout vec3 vWorldPosition;\n#endif\n#ifdef USE_COLOR\nout vec3 vColor;\n#endif\n#ifdef MRT_NORMALS\nout float depth;\n#endif\n#include <logdepthbuf_decl_vert>\n#include <pack_normals>\n#include <instancing_decl_vert>\n#include <id_decl_vert>\n#include <wide_lines_decl>\n#include <shadowmap_decl_vert>\nvoid main() {\n#if defined( USE_MAP ) || defined( USE_SPECULARMAP )\n vUv = (texMatrix * vec3(uv, 1.0)).xy;\n#endif\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n vUvBump = (texMatrixBump * vec3(uv, 1.0)).xy;\n#endif\n#if defined( USE_ALPHAMAP )\n vUvAlpha = (texMatrixAlpha * vec3(uv, 1.0)).xy;\n#endif\n#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\n vColor = color * color;\n#else\n vColor = color;\n#endif\n#endif\n#ifdef UNPACK_NORMALS\n vec3 objectNormal = decodeNormal(normal);\n#else\n vec3 objectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\n objectNormal = getInstanceNormal(objectNormal);\n vec3 instPos = getInstancePos(position);\n vec3 transformedNormal = normalMatrix * objectNormal;\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n vec4 mvPosition = modelViewMatrix * vec4( instPos, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n#include <logdepthbuf_vert>\n \n#include <wide_lines_vert>\n vViewPosition = -mvPosition.xyz;\n#if MAX_SPOT_LIGHTS > 0 || NUM_CUTPLANES > 0\n vec4 worldPosition = modelMatrix * vec4( instPos, 1.0 );\n vWorldPosition = worldPosition.xyz;\n#endif\n#ifdef MRT_NORMALS\n depth = mvPosition.z;\n#endif\n#include <shadowmap_vert>\n#include <id_vert>\n}\n"},9893:e=>{e.exports="\n#define EDGE_SHARPNESS (3.0)\n#define SCALE (2)\n#define R (4)\n#define VALUE_TYPE float\n#define VALUE_COMPONENTS r\n#define VALUE_IS_KEY 0\n#define KEY_COMPONENTS gb\n#if __VERSION__ >= 330\nconst float gaussian[R + 1] =\nfloat[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970);\n#endif\nuniform sampler2D tDiffuse;\nuniform vec2 size;\nuniform vec2 resolution;\nuniform vec2 axis;\nuniform float radius;\n#define result outFragColor.VALUE_COMPONENTS\n#define keyPassThrough outFragColor.KEY_COMPONENTS\nfloat unpackKey(vec2 p) {\n return p.x + p.y * (1.0 / 255.0);\n}\nin vec2 vUv;\nvoid main() {\n# if __VERSION__ < 330\n float gaussian[R + 1];\n# if R == 3\n gaussian[0] = 0.153170; gaussian[1] = 0.144893; gaussian[2] = 0.122649; gaussian[3] = 0.092902;\n# elif R == 4\n gaussian[0] = 0.153170; gaussian[1] = 0.144893; gaussian[2] = 0.122649; gaussian[3] = 0.092902; gaussian[4] = 0.062970;\n# elif R == 6\n gaussian[0] = 0.111220; gaussian[1] = 0.107798; gaussian[2] = 0.098151; gaussian[3] = 0.083953; gaussian[4] = 0.067458; gaussian[5] = 0.050920; gaussian[6] = 0.036108;\n# endif\n# endif\n ivec2 axisi = ivec2(axis);\n ivec2 ssC = ivec2(gl_FragCoord.xy);\n vec4 temp = texture(tDiffuse, vUv);\n outFragColor.gb = temp.KEY_COMPONENTS;\n outFragColor.a = temp.a;\n VALUE_TYPE sum = temp.VALUE_COMPONENTS;\n if (temp.a == 0.0) {\n result = sum;\n return;\n }\n float key = unpackKey(keyPassThrough);\n float BASE = gaussian[0];\n float totalWeight = BASE;\n sum *= totalWeight;\n float scale = 1.5 / radius;\n int r = -4; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[4];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = -3; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[3];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = -2; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[2];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r=-1; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[1];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = 1; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[1];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = 2; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[2];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = 3; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[3];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n r = 4; {\n vec2 ssUV = vec2(ssC + axisi * (r * SCALE))*resolution;\n temp = texture(tDiffuse, ssUV);\n float tapKey = unpackKey(temp.KEY_COMPONENTS);\n VALUE_TYPE value = temp.VALUE_COMPONENTS;\n float weight = 0.3 + gaussian[4];\n float dz = tapKey - key;\n weight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n sum += value * weight;\n totalWeight += weight;\n }\n const float epsilon = 0.0001;\n result = sum / (totalWeight + epsilon);\n}\n"},78101:e=>{e.exports="\n#include <depth_texture>\nuniform float cameraNear;\nuniform float cameraFar;\nuniform vec2 size;\nuniform vec2 resolution;\nuniform float lumInfluence;\nin vec2 vUv;\n#define NUM_SAMPLES (17)\n#define LOG_MAX_OFFSET (3)\n#define NUM_SPIRAL_TURNS (5)\n#define MIN_RADIUS (3.0)\n#define TAU 6.28318530718\nuniform float projScale;\n#ifdef USE_MIPMAP\nuniform sampler2D tDepth_mip1;\nuniform sampler2D tDepth_mip2;\nuniform sampler2D tDepth_mip3;\nuniform sampler2D tDepth_mip4;\nuniform sampler2D tDepth_mip5;\n#endif\nuniform float radius;\nuniform float bias;\nuniform float intensity;\nvec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){\n float alpha = float(float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));\n float angle = alpha * (float(NUM_SPIRAL_TURNS) * TAU) + spinAngle;\n ssR = alpha;\n return vec2(cos(angle), sin(angle));\n}\nfloat CSZToKey(float z) {\n return clamp( (z+cameraNear) / (cameraNear-cameraFar), 0.0, 1.0);\n}\nvoid packKey(float key, out vec2 p) {\n float temp = floor(key * 255.0);\n p.x = temp * (1.0 / 255.0);\n p.y = key * 255.0 - temp;\n}\n#include <pack_depth>\nfloat unpackDepthNearFar( const in vec4 rgba_depth ) {\n float depth = unpackDepth( rgba_depth );\n if (depth == 0.0)\n return -cameraFar * 1.0e10;\n return depth * (cameraNear - cameraFar) - cameraNear;\n}\nvec3 reconstructCSFaceNormal(vec3 C) {\n return normalize(cross(dFdy(C), dFdx(C)));\n}\nvec3 reconstructNonUnitCSFaceNormal(vec3 C) {\n return cross(dFdy(C), dFdx(C));\n}\nvec3 getPosition(ivec2 ssP, float depth) {\n vec3 P;\n P = reconstructCSPosition(vec2(ssP) + vec2(0.5), depth);\n return P;\n}\nvec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {\n ivec2 ssP = ivec2(ssR * unitOffset) + ssC;\n vec3 P;\n#ifdef USE_MIPMAP\n int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL);\n if (mipLevel == 0) {\n P.z = texelFetch(tDepth, ssP, 0).z;\n if (P.z == 0.0) P.z = -cameraFar * 1.0e10;\n }\n else if (mipLevel == 1) {\n ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(tDepth_mip1, 0) - ivec2(1));\n P.z = unpackDepthNearFar(texelFetch(tDepth_mip1, mipP, 0));\n } else if (mipLevel == 2) {\n ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(tDepth_mip2, 0) - ivec2(1));\n P.z = unpackDepthNearFar(texelFetch(tDepth_mip2, mipP, 0));\n } else if (mipLevel == 3) {\n ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(tDepth_mip3, 0) - ivec2(1));\n P.z = unpackDepthNearFar(texelFetch(tDepth_mip3, mipP, 0));\n } else if (mipLevel == 4) {\n ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(tDepth_mip4, 0) - ivec2(1));\n P.z = unpackDepthNearFar(texelFetch(tDepth_mip4, mipP, 0));\n } else if (mipLevel == 5) {\n ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(tDepth_mip5, 0) - ivec2(1));\n P.z = unpackDepthNearFar(texelFetch(tDepth_mip5, mipP, 0));\n }\n#else\n P.z = texelFetch(tDepth, ssP, 0).z;\n if (P.z == 0.0) P.z = -cameraFar * 1.0e10;\n#endif\n P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);\n return P;\n}\nfloat sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in int tapIndex, in float randomPatternRotationAngle) {\n float ssR;\n vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);\n ssR = max(0.75, ssR * ssDiskRadius);\n vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);\n vec3 v = Q - C;\n float vv = dot(v, v);\n float vn = dot(v, n_C);\n const float epsilon = 0.001;\n float angAdjust = mix(1.0, max(0.0, 1.5 * n_C.z), 0.35);\n#define HIGH_QUALITY\n#ifdef HIGH_QUALITY\n float f = max(1.0 - vv / (radius * radius), 0.0); return angAdjust * f * max((vn - bias) / sqrt(epsilon + vv), 0.0);\n#else\n float f = max(radius * radius - vv, 0.0); return angAdjust * f * f * f * max((vn - bias) / (epsilon + vv), 0.0);\n#endif\n}\nconst bool useNoise = true;\nfloat getRandomAngle(vec2 pos) {\n float dt= dot(pos ,vec2(12.9898,78.233));\n return TAU * fract(sin(mod(dt,3.14)) * 43758.5453);\n}\nvoid main() {\n ivec2 ssC = ivec2(gl_FragCoord.xy);\n vec4 nrmz = texture(tDepth, vUv);\n if (nrmz.z == 0.0) {\n outFragColor.r = 1.0;\n outFragColor.a = 0.0;\n packKey(1.0, outFragColor.gb);\n return;\n }\n vec3 C = getPosition(ssC, nrmz.z);\n packKey(CSZToKey(C.z), outFragColor.gb);\n float ssDiskRadius = -projScale * radius / mix(C.z, -1.0, isOrtho);\n float A;\n if (ssDiskRadius <= MIN_RADIUS) {\n A = 1.0;\n } else {\n float sum = 0.0;\n float randomPatternRotationAngle = getRandomAngle(vUv);\n vec3 n_C = vec3(nrmz.x, nrmz.y, sqrt(1.0 - dot(nrmz.xy, nrmz.xy)));\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 0, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 1, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 2, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 3, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 4, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 5, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 6, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 7, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 8, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 9, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 10, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 11, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 12, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 13, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 14, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 15, randomPatternRotationAngle);\n sum += sampleAO(ssC, C, n_C, ssDiskRadius, 16, randomPatternRotationAngle);\n float intensityDivR6 = intensity / pow(radius, 6.0);\n#ifdef HIGH_QUALITY\n A = pow(max(0.0, 1.0 - sqrt(sum * (3.0 / float(NUM_SAMPLES)))), intensity);\n#else\n A = max(0.0, 1.0 - sum * intensityDivR6 * (5.0 / float(NUM_SAMPLES)));\n A = (pow(A, 0.2) + 1.2 * A*A*A*A) / 2.2;\n#endif\n if (abs(dFdx(C.z)) < 0.02) {\n A -= dFdx(A) * (mod(float(ssC.x), 2.0) - 0.5);\n }\n if (abs(dFdy(C.z)) < 0.02) {\n A -= dFdy(A) * (mod(float(ssC.y), 2.0) - 0.5);\n }\n A = mix(1.0, A, clamp(ssDiskRadius - MIN_RADIUS,0.0,1.0));\n }\n outFragColor.r = A;\n outFragColor.a = 1.0;\n}\n"},67020:e=>{e.exports="uniform sampler2D tDiffuse;\nuniform vec2 resolution;\nvoid main() {\n vec2 ssP = vec2(gl_FragCoord.xy);\n ssP = ssP * 2.0 + mod(ssP, 2.0);\n ssP = (ssP + 0.5) * resolution * 0.5;\n outFragColor = texture(tDiffuse, ssP);\n}\n"},18952:e=>{e.exports="uniform sampler2D tDiffuse;\nuniform vec2 resolution;\nuniform float cameraNear;\nuniform float cameraInvNearFar;\n#include <pack_depth>\nvoid main() {\n vec2 ssP = vec2(gl_FragCoord.xy);\n ssP = ssP * 2.0 + mod(ssP, 2.0);\n ssP = (ssP + 0.5) * resolution * 0.5;\n float depth = texture(tDiffuse, ssP).z;\n if (depth != 0.0)\n depth = (depth + cameraNear) * cameraInvNearFar;\n outFragColor = packDepth(depth);\n}\n"},44203:e=>{e.exports="out vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"},37787:e=>{e.exports="\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"},32968:e=>{e.exports="#include <shadowmap_decl_common>\nin float depth;\n#ifdef USE_SURFACE_CUTOUT_MAP\n#include <float3_average>\n#if defined( USE_SURFACE_CUTOUT_MAP )\n uniform sampler2D surface_cutout_map;\n uniform mat3 surface_cutout_map_texMatrix;\n uniform bool surface_cutout_map_invert;\n#endif\nin vec2 vUv;\n#else\n#ifdef USE_MAP\nin vec2 vUv;\nuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\nin vec2 vUvAlpha;\nuniform sampler2D alphaMap;\n#endif\n#endif\nuniform float shadowMinOpacity;\nvoid applyCutoutMaps() {\n float opacity = 1.0;\n#ifdef USE_SURFACE_CUTOUT_MAP\n #if defined( USE_SURFACE_CUTOUT_MAP )\n vec2 uv_surface_cutout_map = (surface_cutout_map_texMatrix * vec3(uv, 1.0)).xy;\n SURFACE_CUTOUT_CLAMP_TEST;\n vec3 opacity_v3 = texture(surface_cutout_map, uv_surface_cutout_map).xyz;\n if(surface_cutout_map_invert) opacity_v3 = vec3(1.0) - opacity_v3;\n opacity = average(opacity_v3);\n #else\n opacity = surface_cutout;\n #endif\n#else\n#ifdef USE_MAP\n opacity *= GET_MAP(vUv).a;\n#endif\n#ifdef USE_ALPHAMAP\n opacity *= GET_ALPHAMAP(vUvAlpha).r;\n#endif\n#endif\n#if defined(USE_SURFACE_CUTOUT_MAP) || defined(USE_MAP) || defined(USE_ALPHAMAP)\n if (opacity < shadowMinOpacity) discard;\n#endif\n}\nvoid main() {\n float normalizedLinearDepth = (depth - shadowMapRangeMin) / shadowMapRangeSize;\n float val = exp(shadowESMConstant * normalizedLinearDepth);\n#ifdef USE_HARD_SHADOWS\n val = normalizedLinearDepth;\n#endif\n applyCutoutMaps();\n outFragColor = vec4(val, 0, 0, 1);\n}\n"},77500:e=>{e.exports="#include <shadowmap_decl_frag>\nvoid main() {\n float shadowIntensity = 0.5 * (1.0 - getShadowValue());\n outFragColor = vec4(0.0, 0.0, 0.0, shadowIntensity);\n}\n"},54707:e=>{e.exports="#include <shadowmap_decl_vert>\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n#include <shadowmap_vert>\n}\n"},9063:e=>{e.exports="#include <shadowmap_decl_common>\nout float depth;\n#ifdef USE_SURFACE_CUTOUT_MAP\nout vec2 vUv;\n#else\n#ifdef USE_MAP\nout vec2 vUv;\nuniform mat3 texMatrix;\n#endif\n#ifdef USE_ALPHAMAP\nout vec2 vUvAlpha;\nuniform mat3 texMatrixAlpha;\n#endif\n#endif\nvoid passCutoutUVCoords() {\n#ifdef USE_SURFACE_CUTOUT_MAP\n vUv = uv;\n#else\n#ifdef USE_MAP\n vUv = (texMatrix * vec3(uv, 1.0)).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vUvAlpha = (texMatrixAlpha * vec3(uv, 1.0)).xy;\n#endif\n#endif\n}\nvoid main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vec4 p_Position = projectionMatrix * mvPosition;\n gl_Position = p_Position;\n depth = -mvPosition.z;\n passCutoutUVCoords();\n}\n"},88368:e=>{e.exports="#include <id_decl_frag>\n#include <logdepthbuf_decl_frag>\nuniform sampler2D sheetMap;\nuniform sampler2D idMap;\nuniform vec2 resolution;\nuniform vec3 modelIDv2;\nuniform float alphaTest;\nvoid main() {\n vec2 uv = vec2(gl_FragCoord.x * resolution.x, gl_FragCoord.y * resolution.y);\n vec4 c = texture(sheetMap, uv);\n if (c.a <= alphaTest)\n discard;\n \n outFragColor = c;\n vec4 dbId = texture(idMap, uv);\n#ifdef MRT_NORMALS\n outNormal = vec4(0.0, 0.0, 0.0, 1.0);\n#endif\n#ifdef MRT_ID_BUFFER\n outId = vec4(dbId.rgb, 1.0);\n #ifdef MODEL_COLOR\n outModelId = vec4(modelIDv2.rgb, 1.0);\n #endif\n#elif defined(ID_COLOR)\n outFragColor = vec4(dbId.rgb, 1.0);\n#elif defined(MODEL_COLOR)\n outFragColor = vec4(modelIDv2.rgb, 1.0);\n#endif\n#include <logdepthbuf_frag>\n}\n"},38383:e=>{e.exports="#include <logdepthbuf_decl_vert>\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n #include <logdepthbuf_vert>\n}"},6614:(e,t,i)=>{"use strict";i.r(t);var n=i(55270),r=i(82712),o=i(14813),s=i(87471),a=i(22767),l=i(19556),c=i(35922);function h(e,t){r.Extension.call(this,e,t),this.name="propertiesmanager",this._panel=null,this._onIsolateEvent=this._onIsolateEvent.bind(this),this._onSelectionChangeEvent=this._onSelectionChangeEvent.bind(this),this._onPrefChange=this._onPrefChange.bind(this),this._onContextMenu=this._onContextMenu.bind(this)}h.prototype=Object.create(r.Extension.prototype),h.prototype.constructor=h;var u=h.prototype;const d=Autodesk.Viewing.Private;u.load=function(){return this.viewer.addEventListener(l.ISOLATE_EVENT,this._onIsolateEvent),this.viewer.addEventListener(l.AGGREGATE_SELECTION_CHANGED_EVENT,this._onSelectionChangeEvent),this.viewer.prefs.addListeners(c.Prefs.OPEN_PROPERTIES_ON_SELECT,this._onPrefChange),this.viewer.registerContextMenuCallback(this.name,this._onContextMenu),!0},u.unload=function(){this.viewer.removeEventListener(l.ISOLATE_EVENT,this._onIsolateEvent),this.viewer.removeEventListener(l.AGGREGATE_SELECTION_CHANGED_EVENT,this._onSelectionChangeEvent),this.viewer.prefs.removeListeners(c.Prefs.OPEN_PROPERTIES_ON_SELECT,this._onPrefChange),this.viewer.unregisterContextMenuCallback(this.name),this.deactivate(),this.setPanel(null),this._toolbarButton&&(this.viewer.settingsTools.removeControl(this._toolbarButton),this.viewer.settingsTools.propertiesbutton=null,this._toolbarButton=null)},u.onToolbarCreated=function(){this.setDefaultPanel(),this._addToolbarButton()},u.activate=function(){return!!this._panel&&(this._panel.setVisible(!0),!0)},u.deactivate=function(){return this._panel&&this._panel.setVisible(!1),!0},u.isActive=function(){return!!this._panel&&this._panel.isVisible()},u.setPanel=function(e){return(e instanceof o.PropertyPanel||!e)&&(this._panel&&(this._panel.setVisible(!1),this.viewer.removePanel(this._panel),this._panel.uninitialize()),this._panel=e,e&&(this.viewer.addPanel(e),e.addVisibilityListener((e=>{e&&this.viewer.onPanelVisible(this._panel),this._toolbarButton.setState(e?a.Button.State.ACTIVE:a.Button.State.INACTIVE)}))),!0)},u.setDefaultPanel=function(){this.setPanel(new s.ViewerPropertyPanel(this.viewer))},u.getPanel=function(){return this._panel},u.getToolbarButton=function(){return this._toolbarButton},u._addToolbarButton=function(){if(!this._toolbarButton){var e=this._toolbarButton=new a.Button("toolbar-propertiesTool");e.setToolTip("Properties"),e.setIcon("adsk-icon-properties"),e.onClick=()=>{this._panel.setVisible(!this._panel.isVisible()),this._panel.isVisible()&&d.analytics.track("viewer.properties",{action:"View List",from:"Toolbar"})},e.setVisible(!this.viewer.prefs.get("openPropertiesOnSelect")),this.viewer.settingsTools.addControl(e,{index:1}),this.viewer.settingsTools.propertiesbutton=e}},u._onIsolateEvent=function(e){this._panel&&(this.viewer.prefs.get("openPropertiesOnSelect")||e.nodeIdArray[0]===e.model.getRootId())&&this._panel.setVisible(e.nodeIdArray.length>0||this.viewer.impl.selector.hasSelection())},u._onSelectionChangeEvent=function(e){if(!this.viewer.prefs.get("openPropertiesOnSelect"))return;let t=!1;for(let i=0;i<e.selections.length;++i)if(e.selections[i].dbIdArray.length>0){t=!0;break}t?this.activate():this.deactivate()},u._onPrefChange=function(e){this._toolbarButton&&this._toolbarButton.setVisible(!e)},u._onContextMenu=function(e,t){if(this.isActive())return;if(!t.hasSelected)return;const i={title:"Show Properties",target:()=>{this.activate(),d.analytics.track("viewer.properties",{action:"View List",from:"Contextual"})}};e.unshift(i)};var f=i(11337);function p(e,t){r.Extension.call(this,e,t),this.viewer=e,this.options=t,this.name="viewersettings"}p.prototype=Object.create(r.Extension.prototype),p.prototype.constructor=p;var m=p.prototype;m.activate=function(){this.activeStatus||(this.viewer.showViewer3dOptions(!0),this.viewer.getSettingsPanel(!0).selectTab(f.ViewerSettingTab.Performance),this.activeStatus=!0);return!0},m.deactivate=function(){return this.activeStatus&&(this.viewer.showViewer3dOptions(!1),this.activeStatus=!1),!0};var g=i(72738),v=i(55280);const y=Autodesk.Viewing.Private;function b(e,t){r.Extension.call(this,e,t),this.viewer=e,this.options=t,this.name="modelstructure",this._modelstructure=null,this._onLoadModel=this._onLoadModel.bind(this),this._onUnloadModel=this._onUnloadModel.bind(this)}b.prototype=Object.create(r.Extension.prototype),b.prototype.constructor=b;var x=b.prototype;x.load=function(){return this.viewer.addEventListener(l.MODEL_ADDED_EVENT,this._onLoadModel),this.viewer.addEventListener(l.MODEL_ROOT_LOADED_EVENT,this._onLoadModel),this.viewer.addEventListener(l.MODEL_UNLOADED_EVENT,this._onUnloadModel),this.viewer.addEventListener(l.MODEL_REMOVED_EVENT,this._onUnloadModel),!0},x.unload=function(){return this.deactivate(),this.setModelStructurePanel(null),this._structureButton&&(this.viewer.settingsTools.removeControl(this._structureButton),this.viewer.settingsTools.structurebutton=null,this._structureButton=null),this.viewer.removeEventListener(l.MODEL_ADDED_EVENT,this._onLoadModel),this.viewer.removeEventListener(l.MODEL_ROOT_LOADED_EVENT,this._onLoadModel),this.viewer.removeEventListener(l.MODEL_UNLOADED_EVENT,this._onUnloadModel),this.viewer.removeEventListener(l.MODEL_REMOVED_EVENT,this._onUnloadModel),!0},x.onToolbarCreated=function(){const e=new a.Button("toolbar-modelStructureTool");e.setToolTip("Model browser"),e.setIcon("adsk-icon-structure"),e.onClick=()=>{!this._modelstructure.isVisible()?this.activate():this.deactivate()};const t=this.viewer.settingsTools;t.addControl(e,{index:0}),t.structurebutton=e,this._structureButton=e,this.restoreDefaultPanel()},x.activate=function(){return!!this._modelstructure&&(this._modelstructure.setVisible(!0),y.analytics.track("viewer.model_browser",{action:"View List"}),!0)},x.deactivate=function(){return this._modelstructure&&this._modelstructure.setVisible(!1),!0},x.isActive=function(){return!!this._modelstructure&&this._modelstructure.isVisible()},x.setModelStructurePanel=function(e){if(e===this._modelstructure)return!1;if(this._modelstructure&&(this._modelstructure.setVisible(!1),this.viewer.removePanel(this._modelstructure),this._modelstructure.uninitialize()),this._modelstructure=e,this.viewer.modelstructure=e,!e)return!0;this.viewer.addPanel(this._modelstructure);for(var t=this.viewer.impl.modelQueue().getModels(),i=0;i<t.length;++i)this._modelstructure.addModel(t[i]);return this._modelstructure.addVisibilityListener((e=>{e&&this.viewer.onPanelVisible(this._modelstructure),this._structureButton.setState(e?a.Button.State.ACTIVE:a.Button.State.INACTIVE)})),!0},x.restoreDefaultPanel=function(){const e=this.viewer.config;var t={docStructureConfig:e.docStructureConfig,hideSearch:(0,v.isMobileDevice)(),excludeRoot:e.modelBrowserExcludeRoot,startCollapsed:e.modelBrowserStartCollapsed},i=e.defaultModelStructureTitle||"Browser",n=new g.ViewerModelStructurePanel({...t,...(0,g.generateDefaultViewerHandlerOptions)(this.viewer)},i);this.setModelStructurePanel(n)},x._onLoadModel=function(e){this._modelstructure&&this._modelstructure.addModel(e.model)},x._onUnloadModel=function(e){this._modelstructure&&this._modelstructure.unloadModel(e.model)};var _=i(36523),E=i(66277),S=i(28833),A=i(60687),w=i(38842),T=i(41129),M=i(88946),C="dolly",P="freeorbit",D="orbit",L="worldup",I="fittoview";function R(e,t){r.Extension.call(this,e,t),this.name="navtools",this.modes=["pan",C,P,D,"fov",L,I],this.onToolChanged=this.onToolChanged.bind(this),this.onNavigationModeChanged=this.onNavigationModeChanged.bind(this),this.navToolsConfig=t.navToolsConfig||{}}R.prototype=Object.create(r.Extension.prototype),R.prototype.constructor=R;var O=R.prototype;function N(e,t,i){return function(){e.isActive(i)?e.deactivate():e.activate(i)}}O.load=function(){var e=this.viewer,t=new S.FovTool(e);if(e.toolController.registerTool(t),!this.navToolsConfig.isAECCameraControls){var i=new A.WorldUpTool(e.impl,e);e.toolController.registerTool(i)}return this.initFocalLengthOverlay(),e.addEventListener(l.TOOL_CHANGE_EVENT,this.onToolChanged),e.addEventListener(l.NAVIGATION_MODE_CHANGED_EVENT,this.onNavigationModeChanged),!0},O.updateUI=function(e){e!==this.is3d&&(this._destroyUI(),this._createUI(e))},O.onToolbarCreated=function(){var e=!this.viewer.impl.is2d;this._createUI(e)},O.navActionDisplayMode=function(e){return this.viewer.navigation.isActionEnabled(e)?"block":"none"},O._createUI=function(e){var t=this.viewer.getToolbar().getControl(_.TOOLBAR.NAVTOOLSID);if(e){var i=new E.ComboButton("toolbar-orbitTools");i.setToolTip("Orbit"),i.setIcon("adsk-icon-orbit-constrained"),i.setDisplay(this.navActionDisplayMode("orbit")),this.createOrbitSubmenu(i),t.addControl(i),t.orbittoolsbutton=i,i.setState(a.Button.State.ACTIVE),t.returnToDefault=function(){i.setState(a.Button.State.ACTIVE)}}var n=new a.Button("toolbar-panTool");n.setToolTip("Pan"),n.setIcon("adsk-icon-pan"),n.onClick=N(this,0,"pan"),n.setDisplay(this.navActionDisplayMode("pan")),t.addControl(n),t.panbutton=n,e||(t.returnToDefault=function(){n.setState(a.Button.State.ACTIVE)},t.returnToDefault());var r=new a.Button("toolbar-zoomTool");if(r.setToolTip("Zoom"),r.setIcon("adsk-icon-zoom"),r.onClick=N(this,0,C),r.setDisplay(this.navActionDisplayMode("zoom")),t.addControl(r),t.dollybutton=r,this.navToolsConfig.isAECCameraControls)t.addControl(this.createFitViewButton(t));else{var o=new E.ComboButton("toolbar-cameraSubmenuTool");o.setToolTip("Camera interactions"),o.setIcon("adsk-icon-camera"),o.saveAsDefault(),this.createCameraSubmenu(o,e),t.addControl(o),t.camerabutton=o}this.is3d=e},O.createOrbitSubmenu=function(e){var t=this.viewer.getToolbar().getControl(_.TOOLBAR.NAVTOOLSID),i=new a.Button("toolbar-freeOrbitTool");i.setToolTip("Free orbit"),i.setIcon("adsk-icon-orbit-free"),i.onClick=N(this,0,P),e.addControl(i),t.freeorbitbutton=i;var n=new a.Button("toolbar-orbitTool");n.setToolTip("Orbit"),n.setIcon("adsk-icon-orbit-constrained"),n.onClick=N(this,0,D),e.addControl(n),t.orbitbutton=n,e.onClick=n.onClick},O.createFitViewButton=function(e,t){var i=this.viewer,n=new a.Button("toolbar-fitToViewTool");return n.setToolTip("Fit to view"),n.setIcon("adsk-icon-fit-to-view"),n.onClick=function(){i.impl.fitToView(i.impl.selector.getAggregateSelection());Autodesk.Viewing.Private.analytics.track("viewer.fit_to_view",{from:"UI"});var e=i.getDefaultNavigationToolName();i.setActiveNavigationTool(e),t&&t.restoreDefault()},n.setDisplay(this.navActionDisplayMode("gotoview")),e.fittoviewbutton=n,n},O.createCameraSubmenu=function(e,t){var i=this,n=this.viewer,r=n.getToolbar().getControl(_.TOOLBAR.NAVTOOLSID);if((0,v.isTouchDevice)()){var o=new a.Button("toolbar-homeTool");o.setToolTip("Home"),o.setIcon("adsk-icon-home"),o.onClick=function(){n.navigation.setRequestHomeView(!0);var t=n.getDefaultNavigationToolName();i.activate(t),e.restoreDefault()},o.setDisplay(this.navActionDisplayMode("gotoview")),e.addControl(o),r.homebutton=o}if(e.addControl(this.createFitViewButton(r,e)),t){var s=new a.Button("toolbar-focalLengthTool");s.setToolTip("Focal length"),s.setIcon("adsk-icon-fov"),s.onClick=N(this,0,"fov"),s.setDisplay(this.navActionDisplayMode("fov")),e.addControl(s),r.fovbutton=s}var l=new a.Button("toolbar-rollTool");l.setToolTip("Roll"),l.setIcon("adsk-icon-roll"),l.onClick=N(this,0,L),l.setDisplay(this.navActionDisplayMode("roll")),e.addControl(l),r.rollbutton=l},O.onToolChanged=function(e){if("fov"===e.toolName&&this.showFocalLengthOverlay(e.active),e.active)switch(e.toolName){case"dolly":this.handleAltRelease("dollybutton");break;case"pan":this.handleAltRelease("panbutton");break;case"worldup":this.handleAltRelease("rollbutton");break;case"fov":this.handleAltRelease("fovbutton")}},O.onNavigationModeChanged=function(e){if(this.viewer.getDefaultNavigationToolName()===e.id){var t=this.viewer.getToolbar();if(!t)return;var i=t.getControl(_.TOOLBAR.NAVTOOLSID);if(!i)return;i.returnToDefault&&i.returnToDefault()}},O.handleAltRelease=function(e){var t=this.viewer.getToolbar();if(t){var i=t.getControl(_.TOOLBAR.NAVTOOLSID),n=i&&i[e];n&&n.setState(a.Button.State.ACTIVE)}},O.initFocalLengthOverlay=function(){const e=this.getDocument();var t=this.focallength=e.createElement("div");t.classList.add("message-panel"),t.classList.add("docking-panel"),t.classList.add("focal-length"),t.classList.add("docking-panel-container-solid-color-b");var i=e.createElement("table"),n=e.createElement("tbody");i.appendChild(n),t.appendChild(i),this.viewer.container.appendChild(t);var r=n.insertRow(-1),o=r.insertCell(0);o.classList.add("name"),o.setAttribute("data-i18n","Focal Length"),o.textContent=w.A.t("Focal Length"),(o=r.insertCell(1)).classList.add("value"),o.textContent="",this.fovCell=o,t.style.visibility="hidden"},O.showFocalLengthOverlay=function(e){var t=this,i=this.viewer,n=0;function r(e){if(e){M.HudMessage.displayMessage(i.container,{msgTitleKey:"Orthographic View Set",messageKey:"The view is set to Orthographic",messageDefaultValue:"The view is set to Orthographic. Changing the focal length will switch to Perspective."})}else M.HudMessage.dismiss()}function o(e){e&&s(),t.focallength&&(t.focallength.style.visibility=e?"visible":"hidden")}function s(){var e=i.getFocalLength();n!==e&&(n=e,t.fovCell.textContent=e.toString()+" mm")}function a(){if(s(),"fov"===i.toolController.getActiveToolName()){var e=i.navigation.getCamera(),t=e&&!e.isPerspective;o(!t),r(t)}}var c=i.navigation.getCamera(),h=c&&!c.isPerspective;o(e&&!h),r(e&&h),e?i.addEventListener(l.CAMERA_CHANGE_EVENT,a):i.removeEventListener(l.CAMERA_CHANGE_EVENT,a)},O.unload=function(){return this._destroyUI(),!0},O._destroyUI=function(){var e=this.viewer,t=e.getToolbar();if(!t)return!0;var i=t.getControl(_.TOOLBAR.NAVTOOLSID);if(!i)return!0;function n(e){e&&(e.subMenu.removeEventListener(T.RadioButtonGroup.Event.ACTIVE_BUTTON_CHANGED,e.subMenuActiveButtonChangedHandler(i)),i.removeControl(e.getId()),e.onClick=null)}function r(e){e&&(i.removeControl(e.getId()),e.onClick=null)}return this.is3d&&(n(i.orbittoolsbutton),i.orbittoolsbutton=null,r(i.orbitbutton),i.orbitbutton=null,r(i.freeorbitbutton),i.freeorbitbutton=null,r(i.fovbutton),i.fovbutton=null),r(i.panbutton),i.panbutton=null,r(i.dollybutton),i.dollybutton=null,n(i.camerabutton),i.camerabutton=null,r(i.rollbutton),i.rollbutton=null,r(i.fittoviewbutton),i.fittoviewbutton=null,this.focallength&&(e.container.removeChild(this.focallength),this.focallength=null),e.removeEventListener(l.TOOL_CHANGE_EVENT,this.onToolChanged),this.onToolChanged=null,e.removeEventListener(l.NAVIGATION_MODE_CHANGED_EVENT,this.onNavigationModeChanged),this.onNavigationModeChanged=null,!0},O.activate=function(e){if(this.isActive(e))return!1;if(e===I)return this.viewer.impl.fitToView(this.viewer.impl.selector.getAggregateSelection()),!0;if(-1!=this.modes.indexOf(e)){const t=this.viewer.getDefaultNavigationToolName();return-1===this.modes.indexOf(t)&&this.viewer.activateDefaultNavigationTools(this.viewer.model.is2d()),this.viewer.setActiveNavigationTool(e),!0}return!1},O.deactivate=function(){return this.viewer.setActiveNavigationTool(),!0},O.isActive=function(e){return this.viewer.getActiveNavigationTool()===e};var F=i(74481);const U=Autodesk.Viewing.GlobalManagerMixin;class B extends F.ToolInterface{constructor(e){var t;super(),t=this,this.names=["explode"],this.viewer=e,this.setGlobalManager(this.viewer.globalManager),this.active=!1,this.activate=()=>{this.active=!0},this.deactivate=function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&t.setScale(0),t.active=!1},this.isActive=()=>this.active}setScale(e){let t=e,i=this.viewer.getExplodeOptions();return this.viewer.explode(t,i)}getScale(){return this.viewer.getExplodeScale()}setMagnitude(e){let t=this.viewer.getExplodeScale(),i=this.viewer.getExplodeOptions();return i.magnitude=e,this.viewer.explode(t,i)}getMagnitude(){return this.viewer.getExplodeOptions().magnitude}setDepthDampening(e){let t=this.viewer.getExplodeScale(),i=this.viewer.getExplodeOptions();return i.depthDampening=e,this.viewer.explode(t,i)}getDepthDampening(){return this.viewer.getExplodeOptions().depthDampening}}U.call(B.prototype);var k=i(8600),V=i(83081);class G{constructor(e){this.ext=e;const t=e.viewer,i=new a.Button("toolbar-explodeTool");i.setIcon("adsk-icon-explode"),i.setToolTip("Explode model"),t.modelTools.addControl(i);let n=(0,k.stringToDOM)('<div class="docking-panel docking-panel-container-solid-color-b explode-submenu"><input class="explode-slider" type="range" min="0" max="1" step="0.01" value="0"/></div>');const r=t.getToolbar().container.querySelector("#toolbar-explodeTool").parentNode;(0,v.isIOSDevice)()?n.classList.add("ios"):(0,v.isAndroidDevice)()&&n.classList.add("android"),r.appendChild(n),i.addEventListener(Autodesk.Viewing.UI.Control.Event.VISIBILITY_CHANGED,(function(e){e.isVisible?n.classList.add("visible"):n.classList.remove("visible")}));const o=n.querySelector(".explode-slider");o.addEventListener("input",(function(){e.setScale(o.value)})),n.onclick=function(e){e.stopPropagation()};var s=i.container.querySelector(".adsk-control-tooltip");i.onClick=function(){e.isActive()?e.deactivate():(e.activate(),V.logger.track({category:"tool_changed",name:"explode"}))},this._slider=o,this._explodeButton=i,this._explodeSubmenu=n,this._tooltip=s,t.explodeSlider=o,t.explodeSubmenu=n,this._onExplode=this._onExplode.bind(this)}activate(){this._explodeSubmenu.classList.add("visible"),this._explodeButton.setState(a.Button.State.ACTIVE),this._tooltip.style.display="none";let e=this.ext.getScale();this._slider.value=e,this.ext.viewer.addEventListener(l.EXPLODE_CHANGE_EVENT,this._onExplode)}deactivate(){this._explodeButton.setState(a.Button.State.INACTIVE),this._hideSlider(this),this.ext.viewer.removeEventListener(l.EXPLODE_CHANGE_EVENT,this._onExplode)}destroy(){const e=this.ext.viewer;this._slider&&(this._explodeButton&&this._explodeButton.removeFromParent(),this._slider=null,this._explodeButton=null,this._explodeSubmenu=null,this._tooltip=null,e.explodeSlider=null,e.explodeSubmenu=null)}setUIEnabled(e){this._explodeButton&&(e?(this._explodeButton.setState(Autodesk.Viewing.UI.Button.State.INACTIVE),this._wasActive&&this.ext.activate()):(this._wasActive=this.ext.isActive(),this._hideSlider(this),this._explodeButton.setState(Autodesk.Viewing.UI.Button.State.DISABLED)))}_hideSlider(){this._explodeSubmenu.classList.remove("visible"),this._tooltip.style.display=""}_onExplode(e){this._slider.value=e.scale}}var z=Autodesk.Viewing.Private;class H extends r.Extension{constructor(e,t){super(e,t),this.viewer=e,this.options=t,this.name="explode",this.tool=null,this.explodeUI=null}load(){return this.tool=new B(this.viewer),this.viewer.toolController.registerTool(this.tool,this.setActive.bind(this)),!0}unload(){return this.deactivate(),this.explodeUI&&(this.explodeUI.destroy(),this.explodeUI=null),this.viewer.toolController.deregisterTool(this.tool),this.tool=null,!0}onToolbarCreated(e){this.explodeUI=new G(this,e)}activate(){return!!this.isActive()||!!this.explodeUI&&(this.explodeUI.activate(),this.viewer.toolController.activateTool("explode"),!0)}deactivate(){return!this.isActive()||(!this.explodeUI||(this.explodeUI.deactivate(),this.viewer.toolController.deactivateTool("explode"),!0))}isActive(){return this.tool.isActive()}getScale(){return this.tool.getScale()}setScale(e){return this.tool.setScale(e)}getMagnitude(){return this.tool.getMagnitude()}setMagnitude(e){return this.tool.setMagnitude(e)}getDepthDampening(){return this.tool.getDepthDampening()}setDepthDampening(e){return this.tool.setDepthDampening(e)}setStrategy(e){e!==this.getStrategy()&&this.viewer.prefs.set(z.Prefs3D.EXPLODE_STRATEGY,e)}getStrategy(){return this.viewer.prefs.get(z.Prefs3D.EXPLODE_STRATEGY)}setUIEnabled(e){this.explodeUI.setUIEnabled(e),e||this.tool.deactivate(!1)}}function W(e,t){r.Extension.call(this,e,t),this.viewer=e,this.options=t,this.name="fullscreen"}W.prototype=Object.create(r.Extension.prototype),W.prototype.constructor=W;var j=W.prototype;function q(e,t){r.Extension.call(this,e,t),this.viewer=e,this.options=t,this.name="gohome"}j.activate=function(){return this.activeStatus||(this.viewer.nextScreenMode(),this.activeStatus=!0),!0},j.deactivate=function(){return this.activeStatus&&(this.viewer.escapeScreenMode(),this.activeStatus=!1),!0},q.prototype=Object.create(r.Extension.prototype),q.prototype.constructor=q;var X=q.prototype;X.activate=function(){return this.viewer.navigation.setRequestHomeView(!0),!0},X.deactivate=function(){return!1};var Y=i(17016);const K=Autodesk.Viewing,Q=['<div class="orbit-gizmo noselect">','<div class="outside"></div>','<div class="ring"></div>','<div class="layout-hor">','<div class="edgemark-area"><div class="edgemark"></div></div>',"</div>",'<div class="layout-mid">','<div class="layout-ver">','<div class="edgemark-area"><div class="edgemark"></div></div>',"</div>",'<div class="circle">','<div class="crosshair-area">','<div class="crosshair-v"></div>','<div class="crosshair-h"></div>',"</div>","</div>",'<div class="layout-ver">','<div class="edgemark-area"><div class="edgemark"></div></div>',"</div>","</div>",'<div class="layout-hor">','<div class="edgemark-area"><div class="edgemark"></div></div>',"</div>","</div>"].join("\n");function Z(){var e,t,i,n,r,o=["fusion orbit","fusion orbit constrained"],s=0,a=1,l=2,c=.005,h=.005,u=1,d={},f=(0,v.isTouchDevice)(),p=!1,m={buttons:[],src:void 0,x:0,y:0,dx:0,dy:0,firstMove:!0,mode:void 0},g=this;this.setViewer=function(e){this.viewer=e,this.navapi=e?e.navigation:null,e&&this.setGlobalManager(e.globalManager)};var y=function(e){m.buttons[e.touches?0:e.button]=!0,m.src=e.target.className,m.x=0,m.y=0,m.dx=0,m.dy=0,m.firstMove=!0,m.mode=void 0,"ring"===m.src?m.mode=l:"edgemark-area"===m.src&&("layout-ver"===e.target.parentNode.className?m.mode=s:"layout-hor"===e.target.parentNode.className&&(m.mode=a)),A(),e.stopPropagation()},b=function(e){m.buttons[e.touches?0:e.button]=!1,m.src=void 0},x=function(e){m.buttons[0]&&(_(e),E(),m.firstMove=!1)},_=function(e){var t=e.touches?e.touches[0].pageX:e.pageX,i=e.touches?e.touches[0].pageY:e.pageY;m.firstMove||(m.dx=t-m.x,m.dy=i-m.y),m.x=t,m.y=i},E=function(){switch(m.mode){case l:if(!g.navapi.isActionEnabled("roll"))return;break;case s:case a:if(!g.navapi.isActionEnabled("orbit"))return}var e=r.target.clone().sub(r.position).normalize(),t=e.clone().cross(r.up).normalize(),i=t.clone().cross(e).normalize();if(r.up.copy(i),m.mode===l){var o=new THREE.Vector3(m.x-d.center.x,m.y-d.center.y,0),f=new THREE.Vector3(m.dx,m.dy,0).add(o);o.normalize(),f.normalize();var p=o.clone().cross(f),v=Math.asin(p.z);r.up.applyAxisAngle(e,-v*u)}else{var y,b;m.mode===s?(b=-m.dx*c,n&&(r.up=Y.Navigation.snapToAxis(r.up.clone())),y=r.up):m.mode===a&&(b=-m.dy*h,n?(m.firstMove&&(r.up=Y.Navigation.snapToAxis(r.up.clone())),y=e.clone().cross(r.up).normalize()):y=t,r.up.applyAxisAngle(y,b));var x=g.navapi.getPivotPoint(),_=r.position.clone().sub(x);_.applyAxisAngle(y,b),r.position.addVectors(x,_);var E=r.target.clone().sub(x);E.applyAxisAngle(y,b),r.target.addVectors(x,E)}r.dirty=!0},S=function(e,t){var i=t||e.clone().sub(r.position).normalize();return new THREE.Plane(i,-i.x*e.x-i.y*e.y-i.z*e.z)},A=function(){var e=r.target.clone().sub(r.position).normalize(),t=S(r.position,e).distanceToPoint(r.pivot);r.pivot.copy(e).multiplyScalar(t).add(r.position)},w=function(e){e.touches||0!==e.button||A()},T=function(){p&&g.viewer.setActiveNavigationTool()},M=function(e,t){var i,n=g.viewer.impl.hitTest(e,t);if(n&&n.intersectPoint)i=n.intersectPoint;else{var o=g.viewer.impl.viewportToRay(g.viewer.impl.clientToViewport(e,t));i=new THREE.Vector3,o.intersectPlane(S(r.target),i)}var s=r.position.clone().sub(function(){var e=r.target.clone().sub(r.position).normalize(),t=g.viewer.impl.rayIntersect(new THREE.Ray(r.position,e));return t&&t.intersectPoint?t.intersectPoint:r.target}()).add(i);g.navapi.setRequestTransition(!0,s,i,r.fov)};this.register=function(){(e=(0,k.stringToDOM)(Q)).style.display="none",this.viewer.canvasWrap.insertBefore(e,this.viewer.canvasWrap.firstChild),(t=e.querySelector(".ring")).addEventListener("mousedown",y),Array.prototype.forEach.call(e.querySelectorAll(".edgemark-area"),(function(e){e.addEventListener("mousedown",y),f&&e.addEventListener("touchstart",y)})),this.addWindowEventListener("mouseup",b),this.addWindowEventListener("mousemove",x),(i=e.querySelector(".outside")).addEventListener("mousedown",T);var n=e.querySelector(".circle");n.addEventListener("mousedown",w),f&&(t.addEventListener("touchstart",y),this.addWindowEventListener("touchend",b),this.addWindowEventListener("touchmove",x),i.addEventListener("touchstart",T),n.addEventListener("touchstart",w)),r=this.viewer.impl.camera},this.deregister=function(){this.removeWindowEventListener("mouseup",b),this.removeWindowEventListener("mousemove",x),i.removeEventListener("mousedown",T),f&&(this.removeWindowEventListener("touchend",b),this.removeWindowEventListener("touchmove",x),i.removeEventListener("touchstart",T)),this.viewer.canvasWrap.removeChild(e),e=void 0,t=void 0,i=void 0},this.activate=function(t){e.style.display="",this.handleResize(),n="fusion orbit constrained"===t;var i=this.viewer.toolController.isToolActivated("hyperlink");i&&this.viewer.toolController.deactivateTool("hyperlink"),n?(this.viewer.setDefaultNavigationTool("orbit"),this.viewer.prefs.set("fusionOrbitConstrained",!0)):(this.viewer.setDefaultNavigationTool("freeorbit"),this.viewer.prefs.set("fusionOrbitConstrained",!1)),i&&this.viewer.toolController.activateTool("hyperlink"),this.viewer.navigation.setZoomTowardsPivot(!0)},this.deactivate=function(){e.style.display="none",this.viewer.navigation.setZoomTowardsPivot(this.viewer.prefs.get("zoomTowardsPivot"))},this.getNames=function(){return o},this.getName=function(){return o[0]},this.update=function(){return!1},this.handleSingleClick=function(e){return M(e.canvasX,e.canvasY),!0},this.handleDoubleClick=function(){return!0},this.handleSingleTap=function(e){return M(e.canvasX,e.canvasY),!0},this.handleDoubleTap=function(){return!1},this.handleKeyDown=function(){return!1},this.handleKeyUp=function(){return!1},this.handleWheelInput=function(){return!1},this.handleButtonDown=function(){return!1},this.handleButtonUp=function(){return!1},this.handleMouseMove=function(e){var t=this.viewer.impl.getCanvasBoundingClientRect(),n=(t.width>t.height?new THREE.Vector2(((e.canvasX+.5)/t.width*2-1)*t.width/t.height,-(e.canvasY+.5)/t.height*2+1):new THREE.Vector2((e.canvasX+.5)/t.width*2-1,(-(e.canvasY+.5)/t.height*2+1)*t.height/t.width)).length()>1.2;return p!==n&&(i.style.cursor=n?"":"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAt1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAzMzP6+vri4uISEhKKioqtra2dnZ2EhIR9fX10dHRkZGQdHR3t7e3Hx8e5ubm1tbWoqKhWVlZKSko4ODgICAjv7+/o6OjMzMyxsbFOTk4pKSkXFxcEBAT29vbW1tZ6enpISEgLCwvhzeX+AAAAGXRSTlMANRO0nHRJHfnskIxQRKh89syDVwTWZjEJxPFEswAAAOFJREFUKM+1j+lygkAQhIflEAJe0Rw9u4CCeKKoSTTX+z9XoMJWWeX+ssrvZ3f19DQ5zOw/0DUMQPlmQ72bE2adBp8/Rp3CQUi3ILx+bxj4fjDs9T1Bmo6bbPPN8aDU4bjJt4nb+de789kSFyxn826jW3ICLNZZKU8nWWbrBTCRVm04U8TpjquRFf1Go0d7l8aYOrUR7FGEFr1S9LGymwthgX2gE/Kl0cHPOtF2xOWZ5QpIC93RflW4InkDoPRXesd5LJIMQPzV7tCMa7f6BvhJL79AVDmYTNQ1NhnxbI/uwB8H5Bjd4zQPBAAAAABJRU5ErkJggg==), auto",p=n),!1},this.handleGesture=function(){return A(),!1},this.handleBlur=function(){return!1},this.handleResize=function(){var i=e.getBoundingClientRect();const n=this.getWindow();d.left=i.left+n.pageXOffset,d.top=i.top+n.pageYOffset,d.width=i.width,d.height=i.height,d.center={},d.center.x=d.left+d.width/2,d.center.y=d.top+d.height/2;var r=.8*(n.innerWidth>n.innerHeight?n.innerHeight:n.innerWidth);e.style.width=e.style.height=r+"px",e.style.top=e.style.left="calc(50% - "+r/2+"px)",t.style.borderWidth=.1*r+"px"}}K.GlobalManagerMixin.call(Z.prototype);const $="fusionfreeorbit",J="fusionorbit";function ee(e,t){r.Extension.call(this,e,t),this.name=J,this.modes=[J,$]}ee.prototype=Object.create(r.Extension.prototype),ee.prototype.constructor=ee;var te=ee.prototype;te.load=function(){var e=this.viewer;return this.tool=new Z,this.tool.setViewer(e),e.toolController.registerTool(this.tool),this._onToolChanged=this._onToolChanged.bind(this),!0},te._updateActiveState=function(e,t){this.activeStatus=e,this.mode=t},te._onToolChanged=function(e){if("fusion orbit constrained"===e.toolName||"fusion orbit"===e.toolName){const t=this._toolbar.getControl(_.TOOLBAR.NAVTOOLSID),i="fusion orbit"===e.toolName?t.freeorbitbutton:t.orbitbutton,n=e.active?a.Button.State.ACTIVE:a.Button.State.INACTIVE;i.setState(n),this._updateActiveState(!n)}},te.onToolbarCreated=async function(e){var t=this,i=this.viewer,n=e.getControl(_.TOOLBAR.NAVTOOLSID);n&&n.orbitbutton||await i.loadExtension("Autodesk.DefaultTools.NavTools",i.config),this._toolbar=e,this.viewer.addEventListener(Autodesk.Viewing.TOOL_CHANGE_EVENT,this._onToolChanged),this.classicBehavior={},this.classicBehavior.orbitOnClick=n.orbitbutton.onClick,this.classicBehavior.freeorbitOnClick=n.freeorbitbutton.onClick,this.classicBehavior.returnToDefault=n.returnToDefault,n.freeorbitbutton.onClick=function(){var e=n.freeorbitbutton.getState();e===a.Button.State.INACTIVE?t.activate($):e===a.Button.State.ACTIVE&&t.deactivate()},n.orbitbutton.onClick=function(){var e=n.orbitbutton.getState();e===a.Button.State.INACTIVE?t.activate(J):e===a.Button.State.ACTIVE&&t.deactivate()},n.returnToDefault=function(){n.orbittoolsbutton&&n.orbittoolsbutton.setState(a.Button.State.ACTIVE)},n.orbittoolsbutton.setState(a.Button.State.INACTIVE),i.prefs.get("fusionOrbitConstrained")?(n.orbittoolsbutton.onClick=n.orbitbutton.onClick,n.orbittoolsbutton.setIcon(n.orbitbutton.iconClass),i.setDefaultNavigationTool("orbit")):(n.orbittoolsbutton.onClick=n.freeorbitbutton.onClick,n.orbittoolsbutton.setIcon(n.freeorbitbutton.iconClass),i.setDefaultNavigationTool("freeorbit")),i.setActiveNavigationTool(),n.returnToDefault&&n.returnToDefault()},te.unload=function(){var e=this.viewer;if(e.removeEventListener(Autodesk.Viewing.TOOL_CHANGE_EVENT,this._onToolChanged),this.classicBehavior){var t=e.getToolbar().getControl(_.TOOLBAR.NAVTOOLSID);t&&(t.orbitbutton&&(t.orbitbutton.onClick=this.classicBehavior.orbitOnClick),t.freeorbitbutton&&(t.freeorbitbutton.onClick=this.classicBehavior.freeorbitOnClick),t.returnToDefault=this.classicBehavior.returnToDefault,t.orbittoolsbutton&&(t.orbitbutton?t.orbittoolsbutton.onClick=t.orbitbutton.onClick:t.orbittoolsbutton.onClick=null,t.orbittoolsbutton.setIcon("adsk-icon-orbit-constrained"),t.orbittoolsbutton.setState(a.Button.State.ACTIVE))),this.classicBehavior=null}return e.setActiveNavigationTool("orbit"),e.setDefaultNavigationTool("orbit"),e.toolController.deregisterTool(this.tool),this.tool.setViewer(null),this.tool=null,this._toolbar=null,!0},te.activate=function(e){if(!this.isActive(e)){switch(e){default:case J:this.viewer.setActiveNavigationTool("fusion orbit constrained"),this.mode=J;break;case $:this.viewer.setActiveNavigationTool("fusion orbit"),this.mode=$}return this.activeStatus=!0,!0}},te.deactivate=function(){return this.activeStatus&&(this.viewer.setActiveNavigationTool(),this.activeStatus=!1),!0},n.theExtensionManager.registerExtension("Autodesk.PropertiesManager",h),n.theExtensionManager.registerExtension("Autodesk.ViewerSettings",p),n.theExtensionManager.registerExtension("Autodesk.ModelStructure",b),n.theExtensionManager.registerExtension("Autodesk.DefaultTools.NavTools",R),n.theExtensionManager.registerExtension("Autodesk.Explode",H),n.theExtensionManager.registerExtension("Autodesk.FullScreen",W),n.theExtensionManager.registerExtension("Autodesk.GoHome",q),n.theExtensionManager.registerExtension("Autodesk.Viewing.FusionOrbit",ee)},15227:e=>{e.exports={externalExtensions:[{src:"./extensions/DeveloperTools/index.js",ids:["Autodesk.DeveloperTools.AABBoxAccuracyLogger","Autodesk.DeveloperTools.Benchmark","Autodesk.DeveloperTools.BoundingVolumeDebugger","Autodesk.DeveloperTools.CameraPathCapture","Autodesk.DeveloperTools.CameraPathRecorder","Autodesk.DeveloperTools.LocalStorageCamera","Autodesk.DeveloperTools.PixelDeviationTest","Autodesk.DeveloperTools.Shortcuts","Autodesk.DeveloperTools.StatisticsOverlay","Autodesk.DeveloperTools.TrackRenderTimings","Autodesk.DeveloperTools.WebGLDrawStatistics","Autodesk.DeveloperTools.WebGLFunctionIntrusion","Autodesk.DeveloperTools.WebGLObjectCounters","Autodesk.DeveloperTools.WebGLResourceSnapshot"]},{src:"./extensions/Wireframes/Wireframes.js",ids:["Autodesk.Viewing.Wireframes"]},{src:"./extensions/ZoomWindow/ZoomWindow.js",ids:["Autodesk.Viewing.ZoomWindow"]},{src:"./extensions/AEC/LibraryExports.js",ids:["Autodesk.AEC.LevelsExtension","Autodesk.AEC.HyperlinkExtension","Autodesk.AEC.DropMeExtension","Autodesk.AEC.CanvasBookmarkExtension","Autodesk.AEC.Minimap3DExtension","Autodesk.AEC.LocationsExtension","Autodesk.AEC.Hypermodeling","Autodesk.AEC.ViewportsExtension","Autodesk.AEC.DisciplinesExtension"]},{src:"./extensions/Pushpins/PushPinExtension.js",ids:["Autodesk.BIM360.Extension.PushPin"]},{src:"./extensions/Hyperlink/Hyperlink.js",ids:["Autodesk.Hyperlink"]},{src:"./extensions/Debug/Debug.js",ids:["Autodesk.Debug"]},{src:"./extensions/BimWalk/BimWalk.js",ids:["Autodesk.BimWalk"]},{src:"./extensions/Section/Section.js",ids:["Autodesk.Section"]},{src:"./extensions/SmartSection/index.js",ids:["Autodesk.SmartSection"]},{src:"./extensions/CompGeom/index.js",ids:["Autodesk.CompGeom"]},{src:"./extensions/Snapping/index.js",ids:["Autodesk.Snapping"]},{src:"./extensions/Beeline/Beeline.js",ids:["Autodesk.Beeline"]},{src:"./extensions/FirstPerson/FirstPerson.js",ids:["Autodesk.FirstPerson"]},{src:"./extensions/webVR/webVR.js",ids:["Autodesk.Viewing.WebVR"]},{src:"./extensions/CAM360/CAM360.js",ids:["Autodesk.CAM360"]},{src:"./extensions/FusionSim/FusionSim.js",ids:["Autodesk.Fusion360.Simulation"]},{src:"./extensions/OMV/OMV.js",ids:["Autodesk.OMV"]},{src:"./extensions/SplitScreen/SplitScreen.js",ids:["Autodesk.SplitScreen"]},{src:"./extensions/CrossFadeEffects/CrossFadeEffects.js",ids:["Autodesk.CrossFadeEffects"]},{src:"./extensions/Edit2D/Edit2D.js",ids:["Autodesk.Edit2D"]},{src:"./extensions/Edit3D/Edit3D.js",ids:["Autodesk.Edit3D"]},{src:"./extensions/VisualClusters/VisualClusters.js",ids:["Autodesk.VisualClusters"]},{src:"./extensions/Moldflow/Moldflow.js",ids:["Autodesk.Moldflow"]},{src:"./extensions/PixelCompare/PixelCompare.js",ids:["Autodesk.Viewing.PixelCompare"]},{src:"./extensions/ScalarisSimulation/ScalarisSimulation.js",ids:["Autodesk.Viewing.ScalarisSimulation"]},{src:"./extensions/Measure/Measure.js",ids:["Autodesk.Measure"]},{src:"./extensions/Markup/Markup.js",ids:["Autodesk.Viewing.MarkupsCore","Autodesk.Viewing.MarkupsGui"]},{src:"./extensions/PDF/index.js",ids:["Autodesk.PDF"]},{src:"./extensions/ReCap/index.js",ids:["Autodesk.ReCap"]},{src:"./extensions/Scalaris/index.js",ids:["Autodesk.Scalaris"]},{src:"./extensions/DocumentBrowser/index.js",ids:["Autodesk.DocumentBrowser"]},{src:"./extensions/Geolocation/index.js",ids:["Autodesk.Geolocation"]},{src:"./extensions/Fusion360/AnimationExtension.js",ids:["Autodesk.Fusion360.Animation"]},{src:"./extensions/NPR/index.js",ids:["Autodesk.NPR"]},{src:"./extensions/DOF/DOFExtension.js",ids:["Autodesk.DOF"]},{src:"./extensions/MSDF/index.js",ids:["Autodesk.MSDF"]},{src:"./extensions/MemoryLimited/MemoryLimited.js",ids:["Autodesk.MemoryLimited"]},{src:"./extensions/ViewCubeUi/ViewCubeUi.js",ids:["Autodesk.ViewCubeUi"]},{src:"./extensions/MemoryLimitedDebug/MemoryManager.js",ids:["Autodesk.Viewing.MemoryLimitedDebug"]},{src:"./extensions/BimMarkups/BimMarkups.js",ids:["Autodesk.BIM360.Markups"]},{src:"./extensions/Minimap2D/Minimap2D.js",ids:["Autodesk.BIM360.Minimap"]},{src:"./extensions/GestureDocumentNavigation/GestureDocumentNavigation.js",ids:["Autodesk.BIM360.GestureDocumentNavigation"]},{src:"./extensions/RollCamera/RollCamera.js",ids:["Autodesk.BIM360.RollCamera"]},{src:"./extensions/LayerManager/LayerManager.js",ids:["Autodesk.LayerManager"]},{src:"./extensions/SceneBuilder/sceneBuilder.js",ids:["Autodesk.Viewing.SceneBuilder"]},{src:"./extensions/Popout/index.js",ids:["Autodesk.Viewing.Popout"]},{src:"./extensions/ProfileUi/index.js",ids:["Autodesk.ProfileUi"]},{src:"./extensions/PropertySearch/PropertySearch.js",ids:["Autodesk.PropertySearch"]},{src:"./extensions/StandardSurface/index.js",ids:["Autodesk.StandardSurface"]},{src:"./extensions/MaterialConverterPrism/index.js",ids:["Autodesk.Viewing.MaterialConverterPrism"]},{src:"./extensions/DWF/index.js",ids:["Autodesk.DWF"]},{src:"./extensions/ModelsPanel/index.js",ids:["Autodesk.ModelsPanel"]},{src:"./extensions/ModelAlignment/index.js",ids:["Autodesk.ModelAlignment","Autodesk.SheetAlignment"],dependencies:["Autodesk.Edit3D"]},{src:"./extensions/ModelAlignmentService/ModelAlignmentService.js",ids:["Autodesk.ModelAlignmentService"]},{src:"./extensions/MixpanelProvider/index.js",ids:["Autodesk.Viewing.MixpanelExtension"]},{src:"./extensions/Crop/Crop.js",ids:["Autodesk.Crop"]},{src:"./extensions/DataVisualization/index.js",ids:["Autodesk.DataVisualization"]},{src:"./extensions/ExtensionsPanel/index.js",ids:["Autodesk.ExtensionsPanel"]},{src:"./extensions/StringExtractor/StringExtractor.js",ids:["Autodesk.StringExtractor"]},{src:"./extensions/ModelSheetTransition/ModelSheetTransition.js",ids:["Autodesk.ModelSheetTransition"]},{src:"./extensions/BoxSelection/BoxSelectionExtension.js",ids:["Autodesk.BoxSelection"]},{src:"./extensions/glTF/index.js",ids:["Autodesk.glTF"]},{src:"./extensions/PropertyQuery/index.js",ids:["Autodesk.PropertyQuery"]},{src:"./extensions/VaultPrintUI/index.js",ids:["Autodesk.Vault.Print"]},{src:"./extensions/VaultMarkupsUI/index.js",ids:["Autodesk.Vault.Markups"],dependencies:["Autodesk.BIM360.Markups"]},{src:"./extensions/DataExchange/DataExchange.js",ids:["Autodesk.DataExchange"]},{src:"./extensions/Multipage/Multipage.js",ids:["Autodesk.Multipage"]},{src:"./extensions/DynamicDimensions/DynamicDimensions.js",ids:["Autodesk.DynamicDimensions"]},{src:"./extensions/Filter/index.js",ids:["Autodesk.Filter"],buildConfig:"./extensions/Filter/webpack.config.js"},{src:"./extensions/CustomProperties/index.js",ids:["Autodesk.CustomProperties"]},{src:"./extensions/Grid/Grid.js",ids:["Autodesk.Grid"]},{src:"./extensions/DataPersistence/persistence.js",ids:["Autodesk.DataPersistence"]},{src:"./extensions/CADLabeling/index.js",ids:["Autodesk.CADLabeling"]}],getExtensionEntryKey:function(e){return e.src.split("/")[2]}}},95062:(e,t,i)=>{"use strict";i.r(t);var n=i(55270),r=i(15227);const o="min.js";r.externalExtensions.forEach((e=>{let t=(0,r.getExtensionEntryKey)(e),i=`extensions/${t}/${t}.${o}`,s=e.dependencies;e.ids.forEach((e=>{n.theExtensionManager.registerExternalExtension(e,i,s)}))})),n.theExtensionManager.registerExternalExtension("Autodesk.DiffTool",`extensions/DiffTool/DiffTool.${o}`)},85403:(e,t,i)=>{"use strict";i.r(t),i.d(t,{analytics:()=>o});var n=i(83081),r=i(75840);const o=new class{constructor(){this.providerMap={},this.instances=[],this.superProps={},this.shouldTrack=!0,this.trackCache=[],this.oneTimers={}}registerProvider(e){if(!e)return void n.logger.error("Undefined provider");if(!e.name)return void n.logger.error("missing provider name");const t=e.name.toLowerCase();this.isProviderRegistered(t)?n.logger.warn(`Provider with name ${e.name} already registered`):this.providerMap[t]=e;const i=this.createInstance(e.name,e.defaultOptions);this.instances.push(i),this.shouldTrack&&this.init(i),this.trackCache.length>0&&(this.trackCache.forEach((e=>{let{event:t,properties:i}=e;this.track(t,i)})),this.trackCache=[])}isProviderRegistered(e){var t;return("string"==typeof e?e:null===(t=e.name)||void 0===t?void 0:t.toLowerCase())in this.providerMap}init(e){e.initialized||(e.init(),e.register(this.superProps))}createInstance(e,t){const i=e&&e.toLowerCase();if(!(i in this.providerMap))return void n.logger.error(`Unknown ${e}`);const o=this.providerMap[i],s=new o(t);if(!(s instanceof r.AnalyticsProviderInterface))throw new Error("not an analytics provider");return o.instanceCount=o.instanceCount||0,s.name=`${i}-${o.instanceCount}`,o.instanceCount++,s}optIn(e){this.instances.forEach((e=>this.init(e))),this._callMethod("optIn",e),this.shouldTrack=!0}optOut(e){this._callMethod("optOut",e),this.shouldTrack=!1}hasOptedOut(){return this._callMethod("hasOptedOut")}getDistinctId(){return this._callMethod("getDistinctId")}track(e,t,i){if(this.shouldTrack){if(i){const i={event:e,properties:t};try{const e=JSON.stringify(i);if(this.oneTimers[e])return;this.oneTimers[e]=!0}catch(e){}}0===this.instances.length?this.trackCache.push({event:e,properties:t}):this._callMethod("track",e,t)}}identify(e){this._callMethod("identify",e)}_callMethod(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const n=t[0],r=t.slice(1,t.length);return this.instances.map((e=>({name:e.name,value:e[n](...r)})))}}},75840:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AnalyticsProviderInterface:()=>n});class n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}init(){}register(){}static get name(){return null}static get defaultOptions(){return{}}optIn(e){}optOut(e){}hasOptedOut(){}getDistinctId(){}track(e,t){}identify(e){}}},45775:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Animation:()=>r,interpolateCatmullRom:()=>o});var n=i(93263);function r(e,t,i){this.root=e,this.handler=i.animationHandler,this.data=this.handler.init(t),this.hierarchy=this.handler.parse(e),this.viewer=i.viewer,this.animator=i,this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.isPaused=!0,this.loop=!1,this.delta=.5,this.interpolationType=n.Y.LINEAR,this.setStartAndEndKeyTime()}function o(e,t){function i(e,t,i,n,r,o,s){var a=.5*(i-e),l=.5*(n-t);return(2*(t-i)+a+l)*s+(-3*(t-i)-2*a-l)*o+a*r+t}var n,r,o,s,a,l,c,h,u,d=[],f=[];return o=(n=(e.length-1)*t)-(r=Math.floor(n)),d[0]=0===r?r:r-1,d[1]=r,d[2]=r>e.length-2?r:r+1,d[3]=r>e.length-3?r:r+2,l=e[d[0]],c=e[d[1]],h=e[d[2]],u=e[d[3]],a=o*(s=o*o),f[0]=i(l[0],c[0],h[0],u[0],o,s,a),f[1]=i(l[1],c[1],h[1],u[1],o,s,a),f[2]=i(l[2],c[2],h[2],u[2],o,s,a),f}i(26206).GlobalManagerMixin.call(r.prototype),r.prototype.setStartAndEndKeyTime=function(){if(this.data.hierarchy.length>0){var e=this.data.hierarchy[0].keys;this.startKeyTime=e[0].time,this.endKeyTime=e[e.length-1].time}else this.startKeyTime=this.endKeyTime=0},r.prototype.keyTypes=[],r.prototype.defaultKey={},r.prototype.play=function(e){this.currentTime=void 0!==e?e:0,this.isPlaying=!0,this.isPaused=!1,this.reset(),this.handler.play(this)},r.prototype.pause=function(){!0===this.isPaused?this.handler.play(this):this.handler.stop(this),this.isPaused=!this.isPaused},r.prototype.stop=function(){this.isPlaying=!1,this.isPaused=!1,this.handler.stop(this)},r.prototype.goto=function(e){this.isPlaying||this.play(),this.isPaused||this.pause();var t=e-this.currentTime;this.update(t)},r.prototype.reset=function(){for(var e=0,t=this.hierarchy.length;e<t;e++){var i=this.hierarchy[e];void 0===i.animationCache&&(i.animationCache={}),void 0===i.animationCache[this.data.name]&&(i.animationCache[this.data.name]={prevKey:this.defaultKey,nextKey:this.defaultKey,originalMatrix:i.matrix});for(var n=i.animationCache[this.data.name],r=0;r<this.keyTypes.length;r++){for(var o=this.keyTypes[r],s=this.data.hierarchy[e].keys[0],a=this.getNextKeyWith(o,e,1);a.time<this.currentTime&&a.index>s.index;)s=a,a=this.getNextKeyWith(o,e,a.index+1);n.prevKey[o]=s,n.nextKey[o]=a}}this.setStartAndEndKeyTime()},r.prototype.getNextKeyWith=function(e,t,i){var r=this.data.hierarchy[t].keys;for(this.interpolationType===n.Y.CATMULLROM||this.interpolationType===n.Y.CATMULLROM_FORWARD?i=i<r.length-1?i:r.length-1:i%=r.length;i<r.length;i++)if(void 0!==r[i][e])return r[i];return this.data.hierarchy[t].keys[0]},r.prototype.getPrevKeyWith=function(e,t,i){var r=this.data.hierarchy[t].keys;for(i=this.interpolationType===n.Y.CATMULLROM||this.interpolationType===n.Y.CATMULLROM_FORWARD?i>0?i:0:i>=0?i:i+r.length;i>=0;i--)if(void 0!==r[i][e])return r[i];return this.data.hierarchy[t].keys[r.length-1]},r.prototype.isPlayingOutOfRange=function(){return!1===this.isPaused&&(this.currentTime<this.startKeyTime-this.delta||this.currentTime>this.endKeyTime+this.delta)},r.prototype.resetIfLooped=function(){!0===this.loop&&this.currentTime>this.endKeyTime&&(this.currentTime%=this.endKeyTime,this.reset())}},93263:(e,t,i)=>{"use strict";i.d(t,{Y:()=>n});const n={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2}},4369:(e,t,i)=>{"use strict";function n(){this.animations=[]}i.r(t),i.d(t,{KeyFrameAnimator:()=>m}),n.prototype.init=function(e){if(!0===e.initialized)return e;for(var t=0;t<e.hierarchy.length;t++){for(var i=0;i<e.hierarchy[t].keys.length;i++)if(e.hierarchy[t].keys[i].time<0&&(e.hierarchy[t].keys[i].time=0),void 0!==e.hierarchy[t].keys[i].rot&&!(e.hierarchy[t].keys[i].rot instanceof THREE.Quaternion)){var n=e.hierarchy[t].keys[i].rot;Array.isArray(n)||(n=[n._x,n._y,n._z,n._w]),e.hierarchy[t].keys[i].rot=(new THREE.Quaternion).fromArray(n)}for(let i=1;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].time===e.hierarchy[t].keys[i-1].time&&(e.hierarchy[t].keys.splice(i,1),i--);for(let i=0;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].index=i}return e.initialized=!0,e},n.prototype.parse=function(e){var t=[];return function e(t,i){if(i.push(t),t.children&&!(t instanceof THREE.Camera))for(var n=0;n<t.children.length;n++)e(t.children[n],i)}(e,t),t},n.prototype.play=function(e){-1===this.animations.indexOf(e)&&this.animations.push(e)},n.prototype.stop=function(e){var t=this.animations.indexOf(e);-1!==t&&this.animations.splice(t,1)},n.prototype.update=function(e){for(var t=0;t<this.animations.length;t++)this.animations[t].update(e)};var r,o,s,a=i(78567),l=i(72091),c=i(93263),h=i(45775);function u(e,t,i){h.Animation.call(this,e,t,i),this.followCam=!0}function d(e,t,i){let n;h.Animation.call(this,{},e,i),this.fragPointers=[],this.nodeChildren=[],this.nodeFragments=[];const r=this.viewer.model.getData().instanceTree;r.enumNodeChildren(t,(e=>{this.nodeChildren.push(e)}),!0),r.enumNodeFragments(e.id,(e=>{this.nodeFragments.push(e),n=this.viewer.getFragmentProxy(this.viewer.model,e),n&&(this.fragPointers.push(n),n.setMaterial(this.viewer.matman().cloneMaterial(n.getMaterial(),this.viewer.model)))}),!0),this.nodeId=t,this.epsilon=.1}function f(e,t,i){var n=this;null===e&&(e=function(e,t,i){var r=this.getDocument(),o=n.container=r.createElement("div"),s=e.name;o.id=s,o.style.cursor="pointer",o.style.visibility=i;var a=r.createElement("div");a.id=s+"-txt",a.style.cssText="display: none;position: absolute;z-index: 1;",o.appendChild(a);var c=r.createElement("img"),h=e.custom&&e.custom.att&&1===e.custom.att;c.src=h?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAABv1BMVEUAAAAAAAAAAAAAAAABAwEAAAAAAAAjSRkAAAAFDASJqnZhg1IqTyAjSRkpTx8hRxggRRcAAAAhRRcKFwgAAACau4R9mnFmiFUhSBgbOhMZNhIAAAAECQMgQxcAAAAAAAAAAAAHDwXB2q2jw4yfvoivyJ6fuI6mv5eSr4KAoWu2trZpiV3Nzc0wVSUhRxhNT01vb28AAAAgRBcAAAAAAAAAAAAhRxgeQBYAAAAAAAAAAAAfQRbP5MC0zqCqyJKpyJJBYje3z6WxyKOFpXF9nmkrTiG+wb5xkGVcf0xYfEg1WSpNTU0hRhgfQhYfQhZVVVVAQEAXMREcOhQcHBwSJw0AAAAAAAAWLxAVLQ8AAAAAAAAfQhYIEgYAAACbvn+DsGCGsmSUunaItGXc6dStypelxY2ZvX2Ntm2JtGnS48fB17G40aWNuWucxH6ny4mUvnPF27aPuHCEsGHV5czI3Lq52KGvzJqz1JmqyJOqzY6ew4OYwHiGs2OEsWHb29vL4LvM5bnD3q2+3KWkyoaLtWuKtmfOzs7IyMi21pyawXqPuG/g4ODX68fI4rTG4LCu0ZKszJKlx4qZwHuBnXR2iXENcZskAAAAXnRSTlMAEAIBCAsF6BUn+vPu7erjsZyBEwP99/TRk3JgRUQ1IxwO/v79/Pv6+fn09PPq08q7sqWDe2xrY01AMBj+/v7+/v37+fn59fXz8u/c1cbFxLWonZiIcm1lYVdSQT8de/EoFwAAAgVJREFUOMutklVz21AQRiNFlswYs+M6DTdN0kCDZWZmuAKDZFtgiO2YYm6TlOEHV53ptGs5j93Xc+a7e3d36P/W9prdZ/PZ17aPxphz3mR0x91G07wTG8TDo5R3HLGH3S6fGPdSo8Na/to6W2HZBEqwPCNULlu1BkFdQSyKx4qxOMoyDDJSRB/HnTcqWbSbTmVS6V3E57hvXicOBZd1gmfj6Z1kPrmTjrMMfRizumDA+k3UTcRSyWg0mkzFEgLNlU3rIIJcns0KqJjJq0I+U0SqUJlZJv8JugU3J/QnHEwu6MCMqPN1pq+H3sFxCgOC7RyT48Ev6qLUL/gmeJrJ/p0DzSnyxTtAGLMbv9dohv8zSbomSqUpOxB0AdNXsUbnGEEQmJzKq3JrLgCaJAzms5LI1enfVefEamc/YzYQYFB6/1xBUsQex3E9UZHkUvO6X48PwQjLTKEjVRVFqUqd8v6naQsMUCNcL8xTrVJZluXyl1K7OW1+7sL71x15cvVH43O7UGi3mmc8lkCE0ByMbvXazwueycbHxiXPrUdv3hLDGiF8au/d4sO7Novtnj9k0BO45uRGTp98f2JlK/RqYzN8TK8bGTjZLTXgfvDp6rMNA0ZADAOWHI6VTYwE4WAZjz/s3V5yvIxADosIPlh0BNXHSdA8LFIfDgE8WDg5hmmx9h/40fgXth2SDk3yjP4AAAAASUVORK5CYII=":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAABvFBMVEUAAAAAAAADAAAAAAAAAAACAAAAAAAAAAC5PznHVE8BAAAAAADbc27NXVeUDQaZDQaRBwAAAAAAAACHBgDuhoHVa2W9RD2QCAKYCAGPBgB0BQAAAAAAAACMBgAAAAADAAD2jonWb2n2jYjYbWfmeXPNzc3RYFqzODKfFA1RUVGKBgCVBwBvb2+WBwCBBgCFBgCWBwCLBgAAAAAAAACMBgCTBwByBQCTBwBbBACEBgAAAAAAAAAoAgBSBADgeHOoOzXmfnnofnjieHPGvr63t7e0tLTidW/ebmnba2XWZWDAT0qRHBfBSkRNTU2aFxGOBgBYTEsAAACNBgBAQEAAAABbBQAcHBxyBQBKBAAAAABfBAAAAAAAAAAsAgAkAgCJBgDZRT3MOTHQPDTVQjrlUkrjUEjRPjbOOjP/bGTvXFTqV0/fTETNOjL5Zl7eS0PzYFjxXlbiT0fUQTn0e3T7aGDWXFXbSEDTRj/PQTrOPjbb29vgamTxY1zoVE3STETTQjvSPzfOzs7IyMj5g3zzaWLXY13XYVrsXlbbU0zg4OD8lZD4gXq0eHXqd3HscWv2b2jrZmDQZWDdWVLkV1C5y9+5AAAAYHRSTlMAAgUBDggMEeDsIBj+8NHJxpxAEP754tDDtIFsYDkvI/78+/j08/DfycfHxbuvr5mTjYN0bWxkWVZTTDUjEfz8+/n59fT08vHw8PDw5NzV0Mq5uLWrm5iLfX1hV0g/ODZEwKduAAACAklEQVQ4y62SVXPbQBzEa1mWZYaY49ihBhtmKjMzw92JLLBsyxxT2mCZvnCVmU59VpO37Ms97G929nb+p05WXUvTE5GJ6aWuY+yFEdoVdAZd9MjCEYi5J0L3FZutSqVZdIYiPWaj/85j2yszAACGVyq7Lo+RIMZtxRaQOZaTwZZSLbrGLR2+aX54twVykpgVpRzgYbVGz5twYMPTV2ZkKZMupDOSzAiwfNazgQesDO9VASemU6lUWuQAgnyNXsEiiBlbEwE2W9CBQpbVAfRraIZoA5ZosII6EpB6MYrVpLxOQejowKsBL9UGSK+zCnnsF4omB7wkBkQHylDZ+rcDROD3hYcYQE0NHQhQ4f8uCQVG/XF9isJKLtI1TYBQQAgdPlqJzYcWMYBYd58/YJACD6UgpsTVA+51AhvKGgt9zQGN1xN4Dajs/vbtmBXf2mIP3/jGqiW9Q0nlGtn8tXBSnwGPWHYP5PcbLMs2JHFn+6p7WQ/ARTie3/rZm9+pZ+rfP/fawi8dhOFgqLlLX87dHOz/1D9ou/vsrcNiNgBrZzbf338yOXZvbDL2xm4ljCdn6j794cpswr/62p+wWy2m/042oQeMxudedK8mSdzGAy4/9vlm/STRtjGRTz9u3nnge2U3+O2h4o9GfXG7lcLKGWZY8ycduG3sQJCk0Tb+w3S0/Qemc4+eJchuZgAAAABJRU5ErkJggg==",c.id=s+"-img",c.style.cssText="display: block;position: absolute;z-index: 1;",o.appendChild(c),t.api.container.appendChild(o),o.addEventListener("click",(function(){a.style.display="none"===a.style.display?"block":"none"}));var u=new l.SphereGeometry(.01),d=new l.MeshPhongMaterial({color:32512,opacity:.6,transparent:!0}),f=new l.Mesh(u,d);return f.visible=!1,void 0===t.overlayScenes.annotation&&t.createOverlayScene("annotation"),t.addOverlay("annotation",f),f}.call(this,t,i.viewer,"hidden")),h.Animation.call(this,e,t,i),this.id=t.name,this.text="",this.state="hidden",this.epsilon=.1,this.viewer.api.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT,(function(t){n.updateText(e.position,n.text)}))}function p(e,t,i){this.viewer=i.viewer,null===e&&(e=this.createPolyline([])),h.Animation.call(this,e,t,i),this.epsilon=.1}function m(e,t){this.animations=[],this.viewer=e,this.setGlobalManager(e.globalManager),this.keys=[],this.isPlaying=!1,this.isPaused=!0,this.updateFlag=0,this.duration=t,this.currentTime=0,this.onPlayCallback=null,this.animationHandler=new n,this.areCameraAnimationsPaused=!1,this.UPDATE_SCENE=1,this.UPDATE_CAMERA=2,this.followCam=!0,this._speedMod=1,this._loops=!1}u.prototype=Object.create(h.Animation.prototype),u.prototype.constructor=u,u.prototype.keyTypes=["pos","up","target","fov","perspective"],u.prototype.defaultKey={pos:0,up:0,target:0,fov:0,perspective:0},u.prototype.setFollowCamera=function(e){this.followCam=e},u.prototype.update=(r=[],o=new l.Vector3,s=new l.Vector3,function(e){if(!1!==this.isPlaying&&(this.currentTime+=e*this.timeScale,this.resetIfLooped(),this.followCam&&!this.isPlayingOutOfRange())){for(var t=0,i=this.hierarchy.length;t<i;t++){for(var n=this.hierarchy[t],a=n.animationCache[this.data.name],l=0;l<this.keyTypes.length;l++){var u=this.keyTypes[l],d=a.prevKey[u],f=a.nextKey[u];if(f.time<=this.currentTime||d.time>=this.currentTime){for(d=this.data.hierarchy[t].keys[0],f=this.getNextKeyWith(u,t,1);f.time<this.currentTime&&f.index>d.index;)d=f,f=this.getNextKeyWith(u,t,f.index+1);a.prevKey[u]=d,a.nextKey[u]=f}var p=d[u],m=f[u];if(f.time!==d.time&&void 0!==p&&void 0!==m){var g,v=(this.currentTime-d.time)/(f.time-d.time);if(v<0&&(v=0),v>1&&(v=1),"pos"===u)g=n.position;else if("up"===u)g=n.up;else if("target"===u)g=n.target;else{if("fov"===u){n.setFov(p+(m-p)*v);continue}if("perspective"===u){(v>.5?m:p)?n.toPerspective():n.toOrthographic();continue}}if(this.interpolationType===c.Y.LINEAR)s.x=p[0]+(m[0]-p[0])*v,s.y=p[1]+(m[1]-p[1])*v,s.z=p[2]+(m[2]-p[2])*v,g.copy(s);else{r[0]=this.getPrevKeyWith(u,t,d.index-1)[u],r[1]=p,r[2]=m,r[3]=this.getNextKeyWith(u,t,f.index+1)[u],v=.33*v+.33;var y=(0,h.interpolateCatmullRom)(r,v);if(s.x=y[0],s.y=y[1],s.z=y[2],g.copy(s),this.interpolationType===c.Y.CATMULLROM_FORWARD){var b=(0,h.interpolateCatmullRom)(r,1.01*v);o.set(b[0],b[1],b[2]),o.sub(g),o.y=0,o.normalize();var x=Math.atan2(o.x,o.z);n.rotation.set(0,x,0)}}}}n.matrixAutoUpdate=!0,n.matrixWorldNeedsUpdate=!0}n.lookAt(n.target),this.animator.updateFlag|=this.animator.UPDATE_CAMERA}}),d.prototype=Object.create(h.Animation.prototype),d.prototype.constructor=d,d.prototype.keyTypes=["vis","opa"],d.prototype.defaultKey={viz:1,opa:1},d.prototype.getPrevAndNextKeys=function(e,t){let i=this.data.hierarchy[e].keys[0],n=this.getNextKeyWith(t,e,1);for(;n.time<this.currentTime&&n.index>i.index;)i=n,n=this.getNextKeyWith(t,e,n.index+1);return{prevKey:i,nextKey:n}},d.prototype.update=function(e){if(!1!==this.isPlaying&&(this.currentTime+=e*this.timeScale,this.resetIfLooped(),!this.isPlayingOutOfRange()))for(var t=0,i=this.hierarchy.length;t<i;t++){var n=this.hierarchy[t].animationCache[this.data.name],r=n.prevKey.vis,o=n.prevKey.vis,s=n.prevKey.opa,a=n.prevKey.opa;if(o.time<=this.currentTime||r.time>=this.currentTime){const{prevKey:e,nextKey:i}=this.getPrevAndNextKeys(t,"vis");r=e,o=i,n.prevKey.vis=r,n.nextKey.vis=o}if(a.time<=this.currentTime||s.time>=this.currentTime){const{prevKey:e,nextKey:i}=this.getPrevAndNextKeys(t,"opa");s=e,a=i,n.prevKey.opa=s,n.nextKey.opa=a}let e=r.vis,i=o.vis;if(void 0!==e&&void 0!==i&&r.time!==o.time){const t=Math.abs(this.currentTime-o.time)<this.epsilon?i:e;this.viewer.visibilityManager.setNodeOff(this.nodeId,!t,this.viewer.model,this.nodeChildren,this.nodeFragments)}if(e=s.opa,i=a.opa,void 0===e&&1===r.vis&&(e=1),void 0!==e&&void 0!==i&&s.time!==a.time){let t=(this.currentTime-s.time)/(a.time-s.time);t<0&&(t=0),t>1&&(t=1);const n=e+(i-e)*t;for(let e=0;e<this.fragPointers.length;++e){const t=this.fragPointers[e].getMaterial();t.transparent=1!==n,t.opacity=n}n>0&&this.viewer.visibilityManager.setNodeOff(this.nodeId,!1,this.viewer.model,this.nodeChildren,this.nodeFragments)}}},f.prototype=Object.create(h.Animation.prototype),f.prototype.constructor=f,f.prototype.keyTypes=["pos","text","vis"],f.prototype.defaultKey={pos:0,text:"",vis:1},f.prototype.stop=function(){h.Animation.prototype.stop.call(this),this.container.parentNode.removeChild(this.container),this.viewer.removeOverlay("annotation",this.root),this.root=null},f.prototype.updateText=function(e,t){var i=function(e,t,i){var n=e.clone(),r=new l.Matrix4;return t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),n.applyProjection(r),{x:(n.x+1)*i.width/2+i.offsetLeft-12,y:(1-n.y)*i.height/2+i.offsetTop+12}}(e,this.viewer.camera,this.viewer.canvas),n=this.getDocument(),r=n.getElementById(this.id+"-txt");r&&(r.innerHTML=t,r.style.left=i.x+"px",r.style.top=i.y+"px",this.text=t),(r=n.getElementById(this.id+"-img"))&&(r.style.left=i.x+"px",r.style.top=i.y-24+"px")},f.prototype.update=function(){var e=[],t=new l.Vector3,i=new l.Vector3;return function(n){if(!1!==this.isPlaying&&(this.currentTime+=n*this.timeScale,this.resetIfLooped(),!this.isPlayingOutOfRange())){var r=this.getDocument();if(this.isPaused&&this.currentTime<this.startKeyTime)(E=r.getElementById(this.id))&&(E.style.visibility=this.state);else for(var o=0,s=this.hierarchy.length;o<s;o++){for(var a=this.hierarchy[o],l=a.animationCache[this.data.name],u=0;u<this.keyTypes.length;u++){var d=this.keyTypes[u],f=l.prevKey[d],p=l.nextKey[d];if(p.time<=this.currentTime||f.time>=this.currentTime){for(f=this.data.hierarchy[o].keys[0],p=this.getNextKeyWith(d,o,1);p.time<this.currentTime&&p.index>f.index;)f=p,p=this.getNextKeyWith(d,o,p.index+1);l.prevKey[d]=f,l.nextKey[d]=p}var m=f[d],g=p[d];if(p.time!==f.time&&void 0!==m&&void 0!==g){var v=(this.currentTime-f.time)/(p.time-f.time);if(v<0&&(v=0),v>1&&(v=1),"pos"===d){if(this.interpolationType===c.Y.LINEAR)i.x=m[0]+(g[0]-m[0])*v,i.y=m[1]+(g[1]-m[1])*v,i.z=m[2]+(g[2]-m[2])*v,a.position.copy(i);else if(this.interpolationType===c.Y.CATMULLROM||this.interpolationType===c.Y.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",o,f.index-1).pos,e[1]=m,e[2]=g,e[3]=this.getNextKeyWith("pos",o,p.index+1).pos,v=.33*v+.33;var y=(0,h.interpolateCatmullRom)(e,v);if(i.x=y[0],i.y=y[1],i.z=y[2],a.position.copy(i),this.interpolationType===c.Y.CATMULLROM_FORWARD){var b=(0,h.interpolateCatmullRom)(e,1.01*v);t.set(b[0],b[1],b[2]),t.sub(vector),t.y=0,t.normalize();var x=Math.atan2(t.x,t.z);a.rotation.set(0,x,0)}}}else if("text"===d){var _=Math.abs(this.currentTime-p.time)<this.epsilon?g:m;this.updateText(a.position,_)}else if("vis"===d){var E;if(E=r.getElementById(this.id)){var S=Math.abs(this.currentTime-p.time)<this.epsilon?g:m;E.style.visibility=S?"visible":"hidden"}}}}a.matrixAutoUpdate=!0,a.matrixWorldNeedsUpdate=!0}}}}(),p.prototype=Object.create(h.Animation.prototype),p.prototype.constructor=p,p.prototype.keyTypes=["points","vis"],p.prototype.defaultKey={points:[],vis:1},p.prototype.stop=function(){h.Animation.prototype.stop.call(this),this.viewer.removeOverlay("polyline",this.root),this.root=null},p.prototype.update=function(){function e(e){e.root&&(e.viewer.removeOverlay("polyline",e.root),e.root=null)}return function(t){if(!1!==this.isPlaying&&(this.currentTime+=t*this.timeScale,this.resetIfLooped(),!this.isPlayingOutOfRange()))if(this.isPaused&&this.currentTime<this.startKeyTime)e(this);else for(var i=0,n=this.hierarchy.length;i<n;i++)for(var r=this.hierarchy[i].animationCache[this.data.name],o=0;o<this.keyTypes.length;o++){var s=this.keyTypes[o],a=r.prevKey[s],c=r.nextKey[s];if(c.time<=this.currentTime||a.time>=this.currentTime){for(a=this.data.hierarchy[i].keys[0],c=this.getNextKeyWith(s,i,1);c.time<this.currentTime&&c.index>a.index;)a=c,c=this.getNextKeyWith(s,i,c.index+1);r.prevKey[s]=a,r.nextKey[s]=c}var h=a[s],u=c[s];if(c.time!==a.time&&void 0!==h&&void 0!==u){var d=(this.currentTime-a.time)/(c.time-a.time);if(d<0&&(d=0),d>1&&(d=1),"points"===s){var f=d<.5?h:u;this.viewer.removeOverlay("polyline",this.root),this.root=null;for(var p=[],m=0;m<f.length;m++){var g=f[m].slice();if(0===m)g[0]=h[m][0]+(u[m][0]-h[m][0])*d,g[1]=h[m][1]+(u[m][1]-h[m][1])*d,g[2]=h[m][2]+(u[m][2]-h[m][2])*d;else if(m===f.length-1){var v=h.length-1,y=u.length-1;g[0]=h[v][0]+(u[y][0]-h[v][0])*d,g[1]=h[v][1]+(u[y][1]-h[v][1])*d,g[2]=h[v][2]+(u[y][2]-h[v][2])*d}var b=new l.Vector3(g[0],g[1],g[2]);p.push(b)}this.root=this.createPolyline(p)}else if("vis"===s){var x=Math.abs(this.currentTime-c.time)<this.epsilon?u:h;this.root.visible=x,x||e(this)}}}}}(),p.prototype.createPolyline=function(e){for(var t=new l.Geometry,i=0;i<e.length;i++)t.vertices.push(e[i]);t.computeLineDistances();var n=new l.LineDashedMaterial({color:0,dashSize:1,gapSize:.5,linewidth:1}),r=new l.Line(t,n,l.LineStrip);return void 0===this.viewer.overlayScenes.polyline&&this.viewer.createOverlayScene("polyline"),this.viewer.addOverlay("polyline",r),r},i(26206).GlobalManagerMixin.call(m.prototype),m.prototype.destroy=function(){this.stop(),this.viewer=null,this.keys=null,this.animations=null,this.isPlaying=!1,this.isPaused=!1,this.animationHandler=null},m.prototype.add=function(e){if(!(!e.hierarchy||e.hierarchy.length<1||!e.hierarchy[0].keys||e.hierarchy[0].keys.length<2)){var t=null,i=this;if("camera"===e.type?(t=new u(i.viewer.camera,e,i),i.animations.push(t)):"annotation"===e.type?(t=new f(null,e,i),i.animations.push(t)):"polyline"===e.type?(t=new p(null,e,i),i.animations.push(t)):"mesh"===e.type?i.viewer.model.getData().instanceTree.enumNodeFragments(e.id,(function(n){var r=i.viewer.getFragmentProxy(i.viewer.model,n);r&&(t=new a.MeshAnimation(r,e,i),i.animations.push(t))}),!0):"visibility"===e.type&&(t=new d(e,e.id,i),i.animations.push(t)),i.animations.forEach((e=>e.setGlobalManager(this.globalManager))),t){for(var n=0,r=e.hierarchy.length;n<r;n++)for(var o=e.hierarchy[n].keys,s=0;s<o.length;s++)void 0===o[s].xk&&i.keys.push(o[s].time);!function(e){e.sort((function(e,t){return e-t})),function(e,t,i){for(t=e.length;i=--t;)for(;i--;)e[t]!==e[i]||e.splice(i,1)}(e)}(i.keys)}this.updateFlag|=this.UPDATE_SCENE}},m.prototype.update=function(e){e*=this._speedMod,this.animationHandler.update(e);var t=this.updateFlag;return this.isPlaying&&!this.isPaused&&(this.currentTime+=e,this.currentTime=Math.min(this.currentTime,this.duration),this.onPlayCallback&&this.onPlayCallback(this.duration>0?this.currentTime/this.duration*100:0),this.currentTime>=this.duration&&(this._loops?this.play(0,this.onPlayCallback):this.pause()),t|=this.UPDATE_SCENE),this.updateFlag=0,t},m.prototype.play=function(e,t){if(this.onPlayCallback=t,this.currentTime>=this.duration&&this.goto(0),this.isPlaying)this.pause();else{for(var i=0;i<this.animations.length;i++){this.animations[i].play(e)}this.isPlaying=!0,this.isPaused=!1}},m.prototype.setFollowCamera=function(e){this.followCam=e;for(var t=0;t<this.animations.length;t++){var i=this.animations[t];i.setFollowCamera&&i.setFollowCamera(e)}},m.prototype.isFollowingCamera=function(){return this.followCam},m.prototype.setSpeedModifier=function(e){this._speedMod=e},m.prototype.getSpeedModifier=function(){return this._speedMod},m.prototype.setLooping=function(e){this._loops=e},m.prototype.isLooping=function(){return this._loops},m.prototype.pause=function(){for(var e=0;e<this.animations.length;e++){var t=this.animations[e];t.isPaused===this.isPaused&&t.pause()}this.isPaused=!this.isPaused,this.areCameraAnimationsPaused=this.isPaused},m.prototype.pauseCameraAnimations=function(){for(var e=0;e<this.animations.length;e++){var t=this.animations[e];t instanceof u&&t.pause()}this.areCameraAnimationsPaused=!this.areCameraAnimationsPaused},m.prototype.stop=function(){for(var e=0;e<this.animations.length;e++){this.animations[e].stop()}this.isPlaying=!1,this.isPaused=!1},m.prototype.goto=function(e){if(void 0!==e){for(var t=0;t<this.animations.length;t++){this.animations[t].goto(e)}this.isPlaying=!1,this.isPaused=!0,this.currentTime=e,this.updateFlag|=this.UPDATE_SCENE}},m.prototype.next=function(){var e=function(e,t){for(var i=-1,n=0;n<t.length;n++)if(t[n]>e){i=t[n];break}return i<0?t[t.length-1]:i}(this.currentTime,this.keys);this.goto(e)},m.prototype.prev=function(){var e=function(e,t){for(var i=-1,n=t.length-1;n>-1;n--)if(t[n]<e){i=t[n];break}return i<0?t[0]:i}(this.currentTime,this.keys);this.goto(e)}},78567:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MeshAnimation:()=>d});var n,r,o,s,a,l,c=i(72091),h=i(93263),u=i(45775);function d(e,t,i){u.Animation.call(this,e,t,i),this.localMatrix=new c.Matrix4,this.root.getAnimTransform(),this.relativeTransform=!t.custom||!t.custom.transform||"abs"!==t.custom.transform}d.prototype=Object.create(u.Animation.prototype),d.prototype.constructor=d,d.prototype.keyTypes=["pos","rot","scl"],d.prototype.defaultKey={pos:0,rot:0,scl:0},d.prototype.update=(n=[],r=new c.Vector3,o=new c.Vector3,s=new c.Quaternion,a=new c.Matrix4,l=new c.Matrix4,function(e){if(!1!==this.isPlaying&&(this.currentTime+=e*this.timeScale,this.resetIfLooped(),!this.isPlayingOutOfRange()))for(var t=0,i=this.hierarchy.length;t<i;t++){for(var c=this.hierarchy[t],d=c.animationCache[this.data.name],f=0;f<this.keyTypes.length;f++){var p=this.keyTypes[f],m=d.prevKey[p],g=d.nextKey[p];if(g.time<=this.currentTime||m.time>=this.currentTime){for(m=this.data.hierarchy[t].keys[0],g=this.getNextKeyWith(p,t,1);g.time<this.currentTime&&g.index>m.index;)m=g,g=this.getNextKeyWith(p,t,g.index+1);d.prevKey[p]=m,d.nextKey[p]=g}var v=m[p],y=g[p];if(g.time!==m.time&&void 0!==v&&void 0!==y){var b=(this.currentTime-m.time)/(g.time-m.time);if(b<0&&(b=0),b>1&&(b=1),"pos"===p)if(this.interpolationType===h.Y.LINEAR)o.x=v[0]+(y[0]-v[0])*b,o.y=v[1]+(y[1]-v[1])*b,o.z=v[2]+(y[2]-v[2])*b,c.position.copy(o);else{n[0]=this.getPrevKeyWith("pos",t,m.index-1).pos,n[1]=v,n[2]=y,n[3]=this.getNextKeyWith("pos",t,g.index+1).pos,b=.33*b+.33;var x=(0,u.interpolateCatmullRom)(n,b);if(o.x=x[0],o.y=x[1],o.z=x[2],c.position.copy(o),this.interpolationType===h.Y.CATMULLROM_FORWARD){var _=(0,u.interpolateCatmullRom)(n,1.01*b);r.set(_[0],_[1],_[2]),r.sub(vector),r.y=0,r.normalize();var E=Math.atan2(r.x,r.z);c.rotation.set(0,E,0)}}else"rot"===p?(s.slerpQuaternions(v,y,b),c.quaternion.copy(s)):"scl"===p&&(o.x=v[0]+(y[0]-v[0])*b,o.y=v[1]+(y[1]-v[1])*b,o.z=v[2]+(y[2]-v[2])*b,c.scale.copy(o))}}if(!this.relativeTransform){var S=a.compose(c.position,c.quaternion,c.scale),A=l;c.getOriginalWorldMatrix(A),A.invert(),a.multiplyMatrices(S,A).decompose(c.position,c.quaternion,c.scale)}c.updateAnimTransform()}})},56197:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AggregatedView:()=>E});var n=i(8600),r=i(55280),o=i(6684),s=i(38842);const a=Autodesk.Viewing,l=a.Private,c={BimWalk:"Autodesk.BimWalk",Bookmarks:"Autodesk.AEC.CanvasBookmarkExtension",Levels:"Autodesk.AEC.LevelsExtension",CrossFade:"Autodesk.CrossFadeEffects",Hyperlinks:"Autodesk.AEC.HyperlinkExtension",Minimap:"Autodesk.AEC.Minimap3DExtension",DropMe:"Autodesk.AEC.DropMeExtension",ZoomWindow:"Autodesk.Viewing.ZoomWindow",FusionOrbit:"Autodesk.Viewing.FusionOrbit",Disciplines:"Autodesk.AEC.DisciplinesExtension",DiffTool:"Autodesk.DiffTool",ModelStructure:"Autodesk.ModelStructure",ModelAlignment:"Autodesk.ModelAlignment",SheetAlignment:"Autodesk.SheetAlignment",ModelSheetTransition:"Autodesk.ModelSheetTransition"},h={ALIGNMENT_SERVICE_FAILED:"alignmentServiceFailure",ENVIRONMENT_CHANGED:"environmentChanged"},u={LocalStorage:()=>new Autodesk.ModelAlignmentService.AlignmentServiceLS},d=[c.ModelAlignment,c.SheetAlignment],f=e=>{return e instanceof a.BubbleNode?e.getModelKey():e instanceof a.Model?null===(t=e.getDocumentNode())||void 0===t?void 0:t.getModelKey():"string"==typeof e?e:void console.error("makeKey: Input must be key, model, or BubbleNode");var t},p=e=>isFinite(e.x)&&isFinite(e.y)&&isFinite(e.z),m=e=>{let t=e.getUpVector();return t&&(new THREE.Vector3).fromArray(t)},g=e=>p(e.position)&&p(e.target)&&p(e.up)&&isFinite(e.orthoScale),v=(e,t,i)=>{let n=0;const r=new THREE.Vector3;for(let o=0;o<e.length;o++){const s=e[o].getBoundingBox();if(i.intersectsBox(s)===Autodesk.Viewing.Private.FrustumIntersector.OUTSIDE)continue;const a=s.getSize(r).length;s.distanceToPoint(t)>50*a||n++}return n},y={enabled:!1,diffBubbles:void 0,primaryBubbles:void 0,diffBubbleLabel:void 0,primaryBubbleLabel:void 0,progressCallback:void 0,supportBubbles:void 0,refNames:void 0,customCompute:void 0},b=(e,t)=>{let i=e.getVisibleModels();i=i.filter((e=>{return t=e.getBoundingBox(),p(t.min)&&p(t.max);var t}));let n,r,o,s,a=e.impl.camera.clone(),l=new Autodesk.Viewing.Private.FrustumIntersector;const c=new THREE.Vector3;for(let e=0;e<i.length;e++){const t=i[e];n||(n=m(t));const h=t.getDefaultCamera();if(!h||!g(h))continue;const u=t.getBoundingBox();a.position.copy(h.position),a.target.copy(h.target),a.up.copy(h.up),a.isPerspective=h.isPerspective,a.near=u.distanceToPoint(a.position),a.far=a.near+u.getSize(c).length,a.updateMatrixWorld(),a.updateProjectionMatrix(),l.reset(a);const d=v(i,h.position,l);(!r||d>=o)&&(r=h,o=d,s=t)}r&&(r.pivot=r.target,r.worldup=n,r.fov=45,t&&t(r,s),e.autocam.sync(r),e.autocam.setHomeViewFrom(r))};class x{constructor(e){this.color=e,this.enabled=!0,this.active=!1}setEnabled(e,t){t!==this.enabled&&(this.enabled=t,this.active&&!t?(e.clearThemingColors(),this.active=!1):this.update(e))}update(e){if(this.active||!this.enabled)return;const t=e.myData.fragments.fragId2dbId;for(let i=0;i<t.length;i++){const n=t[i];e.setThemingColor(n,this.color)}this.active=!0}}const _=new Set;class E{constructor(){this.globalOffset=void 0,this.refPoint=void 0,this.modelItems={},this.resetOnNextModelAdd=!0,this.resetTriggeringBubble=null,this.memTracker=null,this.cameraInitialized=!1,this.is3D=void 0,this.pendingCamera=null,this.extensionLoaded={},this.loadersInProgress={},this.diff={...y},this.modelIsGhosted={},this.diffCache=[],this.onDiffDone=void 0,this.waitForFirstModel=!1,this.loadPendingPromises={},this.onLoad=[],this.onUnload=[],this.modelThemingStates={},a.getGlobal().LMV_MAIN_VIEW=this,this.pendingAlignmentFetches=[],Autodesk.Viewing.EventDispatcher.prototype.apply(this)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.useConsolidation=void 0===t.useConsolidation||t.useConsolidation,this.initViewerInstance(e,t),this.memTracker=new a.ModelMemoryTracker(this.viewer,t.memoryLimit),this.viewer.impl.showTransparencyWhenMoving(),t.useDynamicGlobalOffset&&(this.dynamicGlobalOffset=new o.DynamicGlobalOffset(this.viewer)),this.options=t,this._registerLmvEventListeners(),this._loadExtensions()}initViewerInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=t.viewerClass||(t.headlessViewer?a.Viewer3D:a.GuiViewer3D);let n=t.viewerConfig||{};n.disabledExtensions=n.disabledExtensions||{},n.disabledExtensions.hyperlink=!0,t.multiViewerFactory?this.viewer=t.multiViewerFactory.createViewer(e,t.viewerConfig,i):this.viewer=new i(e,t.viewerConfig),this.viewer.start(void 0,void 0,void 0,void 0,t.viewerStartOptions),t.propagateInputEventTypes&&(this.viewer.toolController.propagateInputEventTypes=t.propagateInputEventTypes,this.viewer.canvas.style.outline="none")}destroy(){var e;this.dynamicGlobalOffset=null,this.memTracker=null,this.modelItems=null,null===(e=this.viewer)||void 0===e||e.finish(),this.viewer=null,a.getGlobal().LMV_MAIN_VIEW=null}_onError(){console.error(...arguments)}reset(){this.hideAll(),this.pendingCamera=null,this.cameraInitialized=!1,this.resetOnNextModelAdd=!0,this._stopActiveTools(),this._unloadDiffTool(!0),this.refPoint=void 0,this.loadersInProgress={}}getModel(e){const t=this._getItem(e);return t&&t.model}getModelAndWait(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((i=>{const n=()=>{const t=this.getModel(e);if(t)return this.viewer.removeEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT,n),this.onLoad.splice(this.onLoad.indexOf(n),1),i(t)};if(!(t&&!this.isVisible(e))){const t=this.getModel(e);if(t)return i(t)}this.viewer.addEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT,n),this.onLoad.push(n)}))}isEmpty(){return!this.getVisibleNodes().length}_initForEnvironmentChange(e,t){if(this.areAllNodes2D()&&e.is3D()){let i;if(this.is3D=t,!t){const t=e=>e.visible&&e.node&&e.node.is2D();i=Object.values(this.modelItems).filter(t)[0],e=i.node}this._updateExtensions(e),this._updateRefPoint(e),t?(this.resetOnNextModelAdd=!0,this.resetTriggeringBubble=e):i.model&&(this._resetOnModeSwitch(i.model),this.viewer.impl.setUp2DMode(i.model,!1),this.viewer.getExtension("Autodesk.ViewCubeUi",(e=>e.displayViewCube(!1,!1)))),this.fireEvent({type:h.ENVIRONMENT_CHANGED,is3D:this.is3D})}}_needsReset(e){return!!this.resetOnNextModelAdd&&(!this.resetTriggeringBubble||this.resetTriggeringBubble===e)}async show(e,t){this.isEmpty()?this._initForFirstViewable(e):this._initForEnvironmentChange(e,!0);const i=e.getModelKey();let n,r=this.getModel(i);var o;r?(this.viewer.updateViewerStateForPdfReload(e),this.modelItems[i].visible=!0,this._showModel(r),n=Promise.resolve(r)):(n=null===(o=this.modelItems[i])||void 0===o?void 0:o.loadingPromise,n||(n=this.load(e,t)),this.modelItems[i].visible=!0);return this._updateModelTimestamps(),await this._consolidateVisibleModels(),n}hide(e){let t=this._getItem(e);t&&(!this.options.unloadUnfinishedModels||t.model&&t.model.isLoadDone()?t.model&&this.viewer.hideModel(t.model.id):this.unload(t.node),t.visible=!1,b(this.viewer,this.options.cameraValidator),this._updateUpVector(),this._cleanupModels(),this._initForEnvironmentChange(t.node,!1))}isVisible(e){const t=this._getItem(e);return t&&t.visible}hideAll(){for(let e in this.modelItems)this.hide(e)}getVisibleNodes(){let e=[];for(let t in this.modelItems){let i=this.modelItems[t];i.visible&&e.push(i.node)}return e}areAllNodes2D(){const e=this.getVisibleNodes();return!!e.length&&e.every((e=>!(e instanceof Autodesk.Viewing.BubbleNode)||e.is2D()))}isOtgManifestMissing(e){if(e.is2D())return!1;let t=e.getOtgGraphicsNode();if(t&&!t.error)return!1;if(t?this._onError(`Otg translation failed for viewable '${e.name()}'. Error:`,t.error):this._onError(`Otg node missing for viewable '${e.name()}'.`),this.onViewerNotification){const t=a.i18n.t("Model translation failed for view '%(viewableName)'",{viewableName:e.name()});this.onViewerNotification("error",t)}return!0}load(e){var t,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=f(e);let o=this.modelItems[r];if(o||(o={model:null,node:e,visible:!1,url:null,loadingPromise:null,error:!1},this.modelItems[r]=o),o.loadingPromise)return o.loadingPromise;if(o.model)return Promise.resolve(o.model);if(this.options.disableSvf&&this.isOtgManifestMissing(e))return o.error=!0,Promise.reject("OTG manifest missing");if(o.error)return Promise.reject("Model load failed already");if(e.is3D()){if(this.waitForFirstModel)return new Promise(((e,t)=>{this.loadPendingPromises[r]={resolve:e,reject:t}}));this.options.ignoreGlobalOffset||this.globalOffset||(this.waitForFirstModel=!0)}let s=e.getRootNode().getDocument();const l={globalOffset:this.globalOffset,applyRefPoint:!0,applyScaling:this.options.viewerUnits,isAEC:!0,loadAsHidden:!0,bubbleNode:e,disablePrecomputedNodeBoxes:!0,preserveView:!0,onFragmentListLoadProgress:()=>this._updateDiffLoadProgress(),disable3DModelLayers:!0,keepCurrentModels:!0,headlessViewer:this.options.headlessViewer,leafletOptions:{fitPaperSize:!0}},c=this._onModelLoaded.bind(this),h=t=>this._onModelLoadFailed(e,t),u=null===(t=(i=this.options).getCustomLoadOptions)||void 0===t?void 0:t.call(i,e);return u&&Object.assign(l,u),n&&Object.assign(l,n),l.bvhOptions=a.Viewer3D._getDefaultBVHOptions(Object.assign({useConsolidation:!0},l)),l.useConsolidation=!1,o.loadingPromise=new Promise(((t,i)=>{this._applyAlignmentService(e,l).then((()=>(this.viewer||i(),this.viewer.loadDocumentNode(s,e,l)))).then((e=>{this.viewer||i(),c(e),t(e)})).catch((e=>{h(e),i(e)}))})),o.loadingPromise}unloadUnderlayRaster(e){const t=this.viewer.getUnderlayRaster(e);t&&this.viewer.unloadModel(t)}unload(e){this.unloadUnderlayRaster(e),this.viewer.unloadDocumentNode(e);const t=this._getItem(e);t&&(t.loadingPromise&&this._onModelLoadEnded(t),t.model&&delete this.loadersInProgress[t.model.id]);let i=f(e);delete this.modelItems[i];const n=this.modelThemingStates[i];n&&(n.active=!1),this.onUnload.forEach((t=>t(e)))}unloadAll(e){let t=Object.keys(this.modelItems).slice();for(var i=0;i<t.length;i++){let n=t[i],r=this.modelItems[n];e&&!e(r)||this.unload(r.node)}}setCameraGlobal(e){this.pendingCamera={position:e.position&&(new THREE.Vector3).copy(e.position),target:e.target&&(new THREE.Vector3).copy(e.target),up:e.up&&(new THREE.Vector3).copy(e.up),fov:e.fov,isPerspective:e.isPerspective,ignoreGlobalOffset:e.ignoreGlobalOffset},this._applyPendingCameraWhenReady()}setCamera(e){this.viewer.impl.setViewFromCamera(e,!0),this.cameraInitialized=!0}startBimWalk(){this.bimWalkStartPending=!0,this._startBimWalkWhenReady()}stopBimWalk(){let e=this.viewer.getExtension(c.BimWalk);e&&e.isActive()&&e.deactivate(),this.bimWalkStartPending=!1}isBimWalkActive(){let e=this.viewer.getExtension("Autodesk.BimWalk");return e&&e.activeStatus||this.bimWalkStartPending}switchView(e,t){return this.reset(),this.setNodes(e,t)}setNodes(e,t){e=(e=e||[])instanceof a.BubbleNode?[e]:e,this.fetchAlignmentsForNodes(e);const i=e.filter((e=>!this.isVisible(e)));let n={};e.forEach((e=>{n[e.getModelKey()]=!0}));this.getVisibleNodes().filter((e=>void 0===n[e.getModelKey()])).forEach((e=>{this.hide(e)}));const r=i.map((e=>this.show(e)));return this._setDiff(t),Promise.all(r)}getFloorSelector(){return this.levelsExtension&&this.levelsExtension.floorSelector}setBookmarks(e){this.bookmarks=e,this._updateBookmarks()}isLoadDone(){for(let e in this.modelItems){const t=this.modelItems[e],i=t&&t.model,n=!i&&!t.error,r=i&&!i.isLoadDone(),o=i&&i.getPropertyDb()&&!i.getPropertyDb().isLoadDone(),s=l.TextureLoader.requestsInProgress()>0;if(n||r||o||s)return!1}return!0}waitForLoadDone(){return new Promise((e=>{this.isLoadDone()&&e();const t=()=>{this.isLoadDone()&&(this.viewer.removeEventListener(a.GEOMETRY_LOADED_EVENT,t),this.viewer.removeEventListener(a.OBJECT_TREE_CREATED_EVENT,t),this.viewer.removeEventListener(a.TEXTURES_LOADED_EVENT,t),this.onUnload.splice(this.onUnload.indexOf(t),1),e())};this.viewer.addEventListener(a.GEOMETRY_LOADED_EVENT,t),this.viewer.addEventListener(a.OBJECT_TREE_CREATED_EVENT,t),this.viewer.addEventListener(a.TEXTURES_LOADED_EVENT,t),this.onUnload.push(t)}))}setAlignmentService(e){this.alignmentService=e,d.forEach((e=>this._connectModelAlignment(e)))}async fetchAlignments(e){if(!this.isUsingAlignmentService())return;const t=(async()=>{const t=await this.getAlignmentService();await t.fetchItems(e)})();return this.pendingAlignmentFetches.push(t),await t}fetchAlignmentsForNodes(e){const t=null==e?void 0:e.filter((e=>e.is3D())),i=null==t?void 0:t.map((e=>e.getRootNode().urn()));this.fetchAlignments(i)}static findDiffSupportModel(e){if(!e.is2D())return null;const t=e.data.phaseNames,i=Array.isArray(t)?t[0]:t;return i?e.getMasterView(i):(console.warn(`A sheet node must have a phase name. Missing for sheet: ${e.name}`),null)}static findDiffSupportModels(e){e.supportBubbles.diff=E.findDiffSupportModel(e.diffBubbles[0]),e.supportBubbles.primary=E.findDiffSupportModel(e.primaryBubbles[0])}updateHomeCamera(){b(this.viewer,this.options.cameraValidator)}_setDiff(e){if(e){Object.assign(this.diff,e,{enabled:!0});const t=e.supportBubbles;if(t)if(t.autoDetect&&E.findDiffSupportModels(e),t.diff&&t.primary)this.load(t.primary),this.load(t.diff);else{const t=e.diffBubbles&&e.diffBubbles[0];t&&t.is2D()&&console.warn("Could not find support models for 2D diff."),this.diff.supportBubbles=null}!e.empty&&e.progressCallback&&this._signalDiffLoadProgress(0,!0),this.diffStartTime=performance.now()}else Object.assign(this.diff,y);this.diffNeedsUpdate=!0,this._updateDiff()}_updateUpVector(){let e;if(this.areAllNodes2D())e=new THREE.Vector3(0,1,0);else{const t=e=>e.visible&&e.node&&e.node.is3D(),i=Object.values(this.modelItems).filter(t)[0];e=i&&i.model?m(i.model):new THREE.Vector3(0,0,1)}this.viewer.navigation.setWorldUpVector(e,!1,!0)}_showModel(e){if(e.is3d()&&!e.hasGeometry()){const t=e.getDocumentNode().getRootNode().children[0].name();return void console.warn("Ignored model with empty geometry: ",t)}this.viewer.showModel(e.id,!0),b(this.viewer,this.options.cameraValidator),this._updateUpVector()}_resetOnModeSwitch(e){this.viewer.getExtension(c.ZoomWindow)&&this.viewer.unloadExtension(c.ZoomWindow),this.options.headlessViewer||this.viewer.createUI(e,!0);const t=this.viewer.setNavigationLock(!1);this.viewer.activateDefaultNavigationTools(!this.is3D),this.viewer.setNavigationLock(t),this.viewer.navigation.setIs2D(!this.is3D),this._loadExtension(c.ZoomWindow).catch((e=>this._onError(e))),this._startBimWalkWhenReady()}_onModelAdded(e){const t=e.model;if(this.cameraInitialized||this._initCamera(t),t.getData().underlayRaster)return;t.is3d()&&this.options.useDynamicGlobalOffset&&(t.setGlobalOffset(this.viewer.impl.camera.globalOffset),this.viewer.impl.onModelTransformChanged(t));const i=e.model.getDocumentNode();if(this._needsReset(i)&&(this.resetTriggeringBubble=null,this.resetOnNextModelAdd=!1,this._resetOnModeSwitch(t)),(e=>{const t=e.getData(),i=t.loadOptions.bubbleNode;if(e.is3d()&&t.metadata.stats&&!t.metadata.stats.num_fragments){const e=i.name(),t=i.getRootNode().children[0].name();console.warn(`Empty View "${e}" in model "${t}".`)}})(t),i){const e=i.getModelKey();delete this.modelIsGhosted[e],this._updateGhosting()}}async _onGeometryLoaded(e){await this._consolidateVisibleModels(),this._updateDiff(),this.loadersInProgress[e.model.id]=100}_onExtensionLoaded(e){const t=e.extensionId;this._startBimWalkWhenReady(),t===c.Levels&&(this.levelsExtension=this.viewer.getExtension(c.Levels)),t===c.Bookmarks&&this._updateBookmarks(),d.includes(t)&&this.alignmentService&&this._connectModelAlignment(t)}_registerLmvEventListeners(){this.viewer.addEventListener(a.GEOMETRY_LOADED_EVENT,this._onGeometryLoaded.bind(this)),this.viewer.addEventListener(a.MODEL_ADDED_EVENT,this._onModelAdded.bind(this)),this.viewer.addEventListener(a.EXTENSION_LOADED_EVENT,this._onExtensionLoaded.bind(this)),this.viewer.addEventListener(a.PROGRESS_UPDATE_EVENT,this._onProgressUpdate.bind(this)),this.viewer.addEventListener(a.MODEL_ROOT_LOADED_EVENT,this._updateDiff.bind(this))}async _consolidateVisibleModels(){if(this._cleanupModels(),(0,r.isMobileDevice)()&&!this.viewer.impl.useDeferredConsolidation)return;let e=(0,n.getParameterByName)("useConsolidation");if("false"===e||!1===this.options.useConsolidation&&"true"!==e)return;if(this.viewer.impl.isWebGPU())return t="Consolidation is currently not supported for WebGPU",void(_.has(t)||(console.warn(t),_.add(t)));var t;const i=this.viewer.getVisibleModels();for(let e=0;e<i.length;e++){const t=i[e];if(this.memTracker.memoryExceeded())return void l.logger.info("Memory limit exceeded. Skipping consolidation.");if(!(t&&t.isLoadDone()))return;if(t.is2d()||t.isSceneBuilder())return;t.isConsolidating()&&await t.getConsolidationPromise(),t.isConsolidated()||(await this.viewer.impl.consolidateModel(t),this._cleanupModels())}}_cleanupModels(){this._updateModelTimestamps();this.memTracker.cleanup((e=>{const t=e.getDocumentNode(),i=this._getItem(t);i&&i.visible||this.unload(t)}))}_updateModelTimestamps(){let e=this.viewer.getVisibleModels().slice();const t=this._getDiffSupportModels();this.diff.enabled&&t&&(t.diff&&e.push(t.diff),t.primary&&e.push(t.primary)),this.memTracker.updateModelTimestamps(e)}_stopActiveTools(){const e=this.viewer.getExtension("Autodesk.Section");e&&e.isActive()&&e.enableSectionTool(!1),this.stopBimWalk();const t=!this.options.headlessViewer&&this.viewer.getPropertyPanel(!1);t&&t.isVisible()&&t.setVisible(!1)}_onModelLoaded(e){let t=this._getItem(e);t&&(e.is3d()&&(this.options.useDynamicGlobalOffset?e.setGlobalOffset(this.viewer.impl.camera.globalOffset):this.waitForFirstModel&&!this.options.ignoreGlobalOffset&&(this.globalOffset=(new THREE.Vector3).copy(e.myData.globalOffset),this._onGlobalOffsetChanged())),t.model=e,t.visible&&this._showModel(t.model),this._updateModelTimestamps(),this._updateDiffLoadProgress(),this._updateModelTheming(e),this._onModelLoadEnded(t))}_onModelLoadFailed(e,t){this._onError(`Failed to load model: ${e.name()}. Error code: ${t}`);const i=this._getItem(e);i&&(i.error=!0,this._onModelLoadEnded(i))}_onModelLoadEnded(e){e.loadingPromise=null;const t=e.node;t.is3D()&&this.waitForFirstModel&&(this.waitForFirstModel=!1,Object.keys(this.loadPendingPromises).forEach((e=>{var t;const i=null===(t=this.modelItems[e])||void 0===t?void 0:t.node;if(!i)return;const{resolve:n,reject:r}=this.loadPendingPromises[e];this.load(i).then((e=>{n(e)})).catch((e=>{r(e)}))})),this.loadPendingPromises={}),this.onLoad.forEach((e=>e(t)))}_initCamera(e,t){this.viewer.impl.setViewFromFile(e,!t),this.options.cameraValidator&&this.options.cameraValidator(this.viewer.impl.camera,e),this.viewer.impl.controls.recordHomeView(),this.cameraInitialized=!0,this.pendingCamera&&this._applyPendingCameraWhenReady()}_getItem(e){var t;let i=f(e);return null===(t=this.modelItems)||void 0===t?void 0:t[i]}_updateRefPoint(e){if(this.options.useDynamicGlobalOffset)return;if(!(this.isEmpty()||this.areAllNodes2D())||!e.is3D()||this.options.ignoreGlobalOffset)return;const t=e.getAecModelData();if(!t)return;let i=t.refPointTransformation;if(!i)return;const n={x:i[9],y:i[10],z:0};if(this.isUsingAlignmentService()){var r;const t=e.getRootNode().urn(),i=null===(r=this.alignmentService)||void 0===r?void 0:r.getTransform(t);if(void 0===i)return;i&&(n.x=i.elements[12],n.y=i.elements[13])}if(this.refPoint=n,this.options.viewerUnits){const e=Autodesk.Viewing.Private.convertUnits("ft",this.options.viewerUnits,1,1);this.refPoint.x*=e,this.refPoint.y*=e,this.refPoint.z*=e}const o=this.globalOffset&&THREE.Vector3.prototype.distanceToSquared.call(this.refPoint,this.globalOffset);(!this.globalOffset||o>4e6)&&(this.globalOffset=(new THREE.Vector3).copy(this.refPoint),this.unloadAll((e=>e.model&&e.model.is3d())),this._onGlobalOffsetChanged())}_onGlobalOffsetChanged(){const e=this.viewer.getExtension(c.Bookmarks);e&&e.resetGlobalOffset(this.globalOffset)}_getDefaultExtensions(){return[{name:c.CrossFade,getLoadingCondition:()=>!a.isMobileDevice()},{name:c.Levels,getOptions:()=>this.viewer.config},{name:c.ModelStructure,getOptions:()=>this.viewer.config},{name:c.Hyperlinks,getOptions:()=>({loadViewableCb:(e,t)=>{this.onHyperlink?this.onHyperlink(e,t):this.switchView([e])}})},{name:c.Minimap,getLoadingCondition:()=>!this.options.disableMinimap,getOptions:()=>({trackUsage:this._trackMinimapUsage?this._trackMinimapUsage.bind(this):void 0})},{name:c.Bookmarks,getLoadingCondition:()=>this.is3D,getOptions:()=>({globalOffset:this.globalOffset,onBookmark:(e,t)=>{this.onBookmark?this.onBookmark(e,t):this.switchView([e]),t.isPerspective&&this.startBimWalk()},clusterfck:this.options.clusterfck,clusteringThreshold:110})},{name:c.DropMe,getLoadingCondition:()=>!1===this.is3D,getOptions:()=>({enableGuidance:!0,onDrop:this._handleDropMe.bind(this),getTransformForNode:this._getTransformForNode.bind(this),getMain3DView:this._findMain3DView.bind(this),onHandleViewIn3D:this._handleViewIn3D.bind(this)})}]}async _loadExtensions(){this.extensions=this.options.extensions||this._getDefaultExtensions();const e=[];return this.extensions.forEach((t=>{t.getLoadingCondition&&!t.getLoadingCondition(this)||(e.push(this._loadExtension(t.name,t.getOptions&&t.getOptions(this),t.onLoadedCB)),this.extensionLoaded[t.name]=!0)})),Promise.all(e)}async _loadExtension(e,t,i){if(this.viewer.impl.isWebGPU()&&["Autodesk.AEC.LevelsExtension","Autodesk.CrossFadeEffects","Autodesk.AEC.Minimap3DExtension","Autodesk.SheetAlignment"].includes(e))return void console.warn("Skipped extension because it does not support WebGPU yet: ",e);const n=this.options.extensionOptions,r=n&&n[e],o=Object.assign({},t,r),s=this.viewer.loadExtension(e,o);return i&&s.then((e=>{i(this,e)})).catch((e=>{i(this,null,e)})),s}_updateExtensions(e){const t=(e,t,i,n,r)=>{const o=this.extensionLoaded[e];!o&&i?this._loadExtension(e,t,n).catch((e=>this._onError(e))):o&&!i&&(r&&r(this),this.viewer.unloadExtension(e)),this.extensionLoaded[e]=i};this.extensions.forEach((i=>{i.getLoadingCondition&&t(i.name,i.getOptions&&i.getOptions(this),i.getLoadingCondition(this,e),i.onLoadedCB,i.onBeforeUnloadCB)}))}_initForFirstViewable(e){this.is3D!==e.is3D()&&(this.resetOnNextModelAdd||(this.reset(),this.resetTriggeringBubble=e),this.is3D=e.is3D()),this._updateExtensions(e),this._updateRefPoint(e)}_updateBookmarks(){let e=this.viewer.getExtension(c.Bookmarks);e&&e.resetBookmarks(this.bookmarks)}_applyPendingCameraWhenReady(){if(!this.cameraInitialized)return;let e=this.pendingCamera;this.pendingCamera=null;let t=this.viewer.impl.camera;e.position&&t.position.copy(e.position),e.target&&t.target.copy(e.target),e.up&&t.up.copy(e.up),e.fov&&(t.fov=e.fov),void 0!==e.isPerspective&&(t.isPerspective=e.isPerspective);const i=this.globalOffset||this.viewer.model.getData().globalOffset;!this.is3D||this.options.ignoreGlobalOffset||e.ignoreGlobalOffset||(t.position.sub(i),t.target.sub(i)),this.viewer.impl.syncCamera()}_findMain3DView(e){const t=e.getMasterViews();if(t[0])return t[0];const i=null==e?void 0:e.getRootNode();if(!i)return;const n=null==i?void 0:i.search(a.BubbleNode.MODEL_NODE),r=n.filter((e=>e.name().toLowerCase().startsWith("{3d")))[0];return r||n[0]}_handleDropMe(e,t,i,n,r){if(this.onDrop)this.onDrop(e,t,i,n);else if(n){if(this.switchView(n),e&&t){let i={position:e,target:e.clone().add(t),isPerspective:!0,ignoreGlobalOffset:r};this.setCameraGlobal(i)}}else console.warn("DropMe handler: Document does not contain a 3D view to switch to")}async _handleViewIn3D(e,t,i,n){if(i&&!this.options.ignoreGlobalOffset){const i=this.globalOffset||this.viewer.model.getData().globalOffset;e=e.clone().add(i),t=t.clone().add(i)}let r={position:e,target:t,isPerspective:!0};this.setCameraGlobal(r);const o=await this.viewer.getExtensionAsync(c.BimWalk);o.activate(),o.disableGravityUntilNextMove(),n&&n()}_startBimWalkWhenReady(){if(!this.bimWalkStartPending)return;let e=!this.resetOnNextModelAdd,t=this.viewer.getExtension(c.BimWalk),i=this.viewer.getExtension(c.FusionOrbit);e&&t&&i&&(t.activate(),this.bimWalkStartPending=!1)}_unloadDiffTool(e){this.viewer.getExtension(c.DiffTool)&&(e&&(this.diffCache.length=0),this.viewer.unloadExtension(c.DiffTool))}_onProgressUpdate(e){e.model&&e.state===a.ProgressState.LOADING&&(this.loadersInProgress[e.model.id]=e.percent,this._updateDiffLoadProgress())}_getDiffSupportModels(){if(this.diff.supportBubbles)return{diff:this.getModel(this.diff.supportBubbles.diff),primary:this.getModel(this.diff.supportBubbles.primary)}}_diffSupportModelsReady(){const e=this._getDiffSupportModels(),t=e.diff&&e.diff.isLoadDone(),i=e.primary&&e.primary.isLoadDone();return t&&i}_updateGhosting(){let e={};this.diff.enabled&&this.diffBubbles&&(e=this.diffBubbles.forEach((t=>e[t.getModelKey()])));for(let t in this.modelItems){let i=this.getModel(t);if(!i)continue;let n=this.diff.enabled&&!e[t];n!=!!this.modelIsGhosted[t]&&(i.setAllVisibility(!n),n?this.modelIsGhosted[t]=!0:delete this.modelIsGhosted[t])}this.viewer.refresh(!0)}getModels(e){return e.map((e=>this.getModel(e)))}setModelTheming(e){e=e||{};const t=this.modelThemingStates;this.modelThemingStates={};for(let i in e){let n=t[i];const r=e[i],o=this.getModel(i);if(n){!n.color.equals(r)&&(n.color.copy(r),n.active=!1)}else n=new x(r);this.modelThemingStates[i]=n,o&&this._updateModelTheming(o)}for(let i in t){const n=t[i],r=!e[i],o=this.getModel(i);r&&n.active&&o&&this.viewer.clearThemingColors(o)}}_signalDiffLoadProgress(e,t){if(t||e!==this._lastDiffLoadPercent){const t=a.i18n.t("Loading Model for Change Visualization");this.diff.progressCallback(e,t),this._lastDiffLoadPercent=e}}_updateDiffLoadProgress(){if(!this.diffNeedsUpdate||!this.diff.enabled||this.diff.empty||!this.diff.progressCallback)return;const e=this.getModels(this.diff.diffBubbles),t=this.getModels(this.diff.primaryBubbles),i=e.concat(t),n=this._getDiffSupportModels();n&&i.push(n.diff,n.primary);const r=i.filter(Boolean).length;if(r<i.length){const e=Math.floor(10*r/i.length);return void this._signalDiffLoadProgress(e)}if(!this.is3D){const e=(e,t)=>e+(0|this.loadersInProgress[t.id]),t=i.reduce(e,0),n=100*i.length,r=10+Math.floor(90*t/n);return void this._signalDiffLoadProgress(r)}const o=i.reduce(((e,t)=>e+t.getData().fragsLoadedNoGeom),0),s=i.reduce(((e,t)=>e+t.getData().metadata.stats.num_fragments),0),a=10+Math.floor(90*o/s);this._signalDiffLoadProgress(a)}_updateDiff(){if(!this.diffNeedsUpdate)return;if(this._updateGhosting(),this._updateDiffLoadProgress(),!this.diff.enabled)return this._unloadDiffTool(),void this._updateAllModelTheming();const e=this.getModels(this.diff.diffBubbles),t=this.getModels(this.diff.primaryBubbles);if(this.diff.customCompute){let i=t,n=e;const r=[this.diff.customCompute].flat();for(const e of r)[i,n]=e.init(i,n)}for(let i=0;i<e.length;i++){const n=e[i],r=t[i],o=n instanceof a.Model&&(n.isOTG()||n.isLoadDone()),s=r instanceof a.Model&&(r.isOTG()||r.isLoadDone());if(!o||!s)return;if(!n.getPropertyDb()||!r.getPropertyDb())return}let i;if(!!this.diff.supportBubbles){if(!this._diffSupportModelsReady())return;i=this._getDiffSupportModels()}const n=performance.now()-this.diffStartTime;console.log("Time for loading diff models: ",n),this._updateAllModelTheming(),this._setDiffModels(e,t,i)}_setDiffModels(e,t,i){if(this.diffNeedsUpdate=!1,!t.length)return void this._unloadDiffTool();const n=this.viewer.getExtension(c.DiffTool);if(n)n.replaceModels(e,t,i);else{const n={diffModels:e,primaryModels:t,supportModels:i,diffadp:!1,availableDiffModes:["overlay","sidebyside"],diffMode:"overlay",customCompute:this.diff.customCompute,versionA:this.diff.primaryBubbleLabel,versionB:this.diff.diffBubbleLabel,refNames:this.diff.refNames,mimeType:"application/vnd.autodesk.revit",hotReload:!0,diffCache:this.diffCache,useSplitScreenExtension:!0,showDetailsSection:!0,progress:(e,t)=>{this.diff.progressCallback&&(t!==Autodesk.DiffTool.DIFFTOOL_PROGRESS_STATES.LoadingPropDb?(100===e&&this.onDiffDone&&this.onDiffDone(),this.diff.progressCallback(e,a.i18n.t("Computing change visualization"))):this.diff.progressCallback(e,a.i18n.t("Loading element properties")))},excludeFromDiff:(e,t)=>this.levelsExtension&&!this.levelsExtension.floorSelector.isVisible(e,t),setNodesOff:e=>{const t=this.levelsExtension;t&&t.floorSelector._floorSelectorFilter.reApplyFilter(e)},hideModeSwitchButton:!0,externalUi:this.diff.externalUi,attachDetachViewerEventHandlers:this.diff.attachDetachViewerEventHandlers,onDiffModeChanged:this.diff.onDiffModeChanged,onInitialized:this.diff.onInitialized};this._loadExtension(c.DiffTool,n).catch((e=>this._onError(e)))}}_updateModelTheming(e){const t=f(e),i=this.modelThemingStates[t];if(!i)return;const n=!this.viewer.getExtension(c.DiffTool);i.setEnabled(e,n),i.update(e),this.viewer.impl.invalidate(!0)}_updateAllModelTheming(){for(let e in this.modelItems){let t=this.getModel(e);t&&this._updateModelTheming(t)}}async getAlignmentService(){return this.alignmentService||(this._alignmentServicePromise?await this._alignmentServicePromise:(this._alignmentServicePromise=this._initAlignmentService(),await this._alignmentServicePromise,this._alignmentServicePromise=null)),this.alignmentService}isUsingAlignmentService(){return this.options.createModelAlignmentService||this.alignmentService}async _initAlignmentService(){const e=this.options.createModelAlignmentService;if(!e)return;await this.viewer.loadExtension("Autodesk.ModelAlignmentService").then((async()=>{const t=await e();this.viewer&&this.setAlignmentService(t)}))}async _getTransformForNode(e){const t=await this.getAlignmentService();if(!t)return;await Promise.all(this.pendingAlignmentFetches);const i=e.getRootNode().urn(),n=e.is2D()?e.name():void 0;return await t.loadTransform(i,n)}async _applyAlignmentService(e,t){if(e.is2D())return;if(this.alignmentServiceFailed)return;const i=await this._getTransformForNode(e);this._checkAlignmentService()&&(!function(){l.analytics.track(...arguments)}("viewer.modelalignment.alignment_loaded",{hasAlignmentTransform:Boolean(i)}),i&&(t.applyRefPoint=!1,t.placementTransform=i,t.applyPlacementInModelUnits=!0))}_checkAlignmentService(){if(this.alignmentServiceFailed||!this.alignmentService)return!1;if(this.alignmentService.isWorking())return!0;const e=s.A.t("Failed to connect to alignment service: Model alignment support is temporarily unavaible. Models with alignment transforms may not appear correctly and alignment editing is disabled.");this.fireEvent({type:h.ALIGNMENT_SERVICE_FAILED,message:e}),l.logger.error("AggregatedView: Disabled alignment due to alignment service connection error."),this.alignmentServiceFailed=!0}_connectModelAlignment(e){const t=this.viewer.getExtension(e);t&&t.setAlignmentService(this.alignmentService)}}E.ExtNames=c,E.AlignmentServices=u,E.Events=h},65251:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CameraLS:()=>a});var n=i(26206);const r=e=>isFinite(e.x)&&isFinite(e.y)&&isFinite(e.z),o=e=>{const t=e.isPerspective||isFinite(e.orthoScale);return r(e.position)&&r(e.target)&&r(e.up)&&t};class s{constructor(){this.cacheObj={}}setItem(e,t){this.cacheObj[e]=t}getItem(e){return this.cacheObj[e]}}class a{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{useLocalStorage:!0};this.aggregatedView=e,this.options=t,this.key=void 0,this.options.useLocalStorage?this.cache=Autodesk.Viewing.Private.LocalStorage:this.cache=new s,this.unloadCb=this.saveCamera.bind(this),this.addWindowEventListener("beforeunload",this.unloadCb)}destroy(){this.unsetKey(),this.removeWindowEventListener("beforeunload",this.unloadCb)}setKey(e){this.key=e}unsetKey(){this.key=void 0}saveCamera(){if(!this.aggregatedView.cameraInitialized||!this.key)return;const e=this.aggregatedView.viewer.impl.camera;if(!o(e))return;const t=this.aggregatedView.isBimWalkActive(),i=this.aggregatedView.is3D?this.aggregatedView.globalOffset:void 0;this.saveStartCamera(this.key,this.aggregatedView.viewer.impl.camera,t,i)}saveStartCamera(e,t,i,n,r){const o=JSON.stringify({offset:n,position:t.position,target:t.target,up:t.up,orthoScale:t.orthoScale,isPerspective:t.isPerspective,fov:t.fov,startBimWalk:i,ignoreGlobalOffset:r});this.cache.setItem(e,o)}clearItem(e){this.cache.setItem(e)}loadCamera(){if(!this.key)return!1;let e;try{const t=this.cache.getItem(this.key);e=JSON.parse(t)}catch(e){}if(!(e&&e.position&&e.target&&e.up))return!1;const t=e=>new THREE.Vector3(parseFloat(e.x),parseFloat(e.y),parseFloat(e.z)),i={position:t(e.position),target:t(e.target),up:t(e.up),isPerspective:Boolean(e.isPerspective),fov:parseFloat(e.fov),ignoreGlobalOffset:Boolean(e.ignoreGlobalOffset)};if(e.orthoScale&&(i.orthoScale=parseFloat(e.orthoScale)),!o(i))return!1;const n=e.offset?t(e.offset):void 0;if(n){if(!r(n))return;i.position.add(n),i.target.add(n)}this.aggregatedView.setCameraGlobal(i),e.startBimWalk&&this.aggregatedView.startBimWalk()}}n.GlobalManagerMixin.call(a.prototype)},26940:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Document:()=>p});var n=i(99211),r=i(57480),o=i(8412),s=i(84045),a=i(55280),l=i(83081),c=i(11653),h=i(8600),u=(0,a.getGlobal)(),d=u;const f=Object.freeze({Raster:"Raster",Vector:"Vector"});function p(e,t,i){this.myPath=t,this.myData=e,e&&(this.docRoot=new n.BubbleNode(e),this.docRoot.setDocument(this)),this.myNumViews={},this.acmSessionId=i;var r=this;this.docRoot.traverse((function(e){if(e.isViewPreset()){const t=e.findParentGeom2Dor3D();if(t){let e=r.myNumViews[t.guid()]||0;r.myNumViews[t.guid()]=e+1}}}))}p.load=function(e,t,i,n){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const l=p.getDocumentPath(e);let d,f;function m(t){let i=e.split(":");i=i[1];const n=(0,h.fromUrlSafeBase64)(i);for(let e=0;e<t.length;e++)if(n.indexOf(t[e])>-1)return!0;return!1}if(e.startsWith("urn")&&m(["urn:adsk.wipprodanz","urn:adsk.wipstganz"])||o.endpoint.getApiFlavor().match(/APAC/i)){const e=o.endpoint.getApiFlavor(),t=(0,o.getEnv)();null!==t.match(/prod/i)?o.endpoint.setEndpointAndApi("https://cdn-apac.derivative.autodesk.com",e):null!==t.match(/stag/i)&&o.endpoint.setEndpointAndApi("https://cdn-apac-stg.derivative.autodesk.com",e)}if(e.startsWith("urn")&&m(["urn:adsk.wipemea","urn:adsk.wipbimemea"])){var g=o.endpoint.getApiFlavor(),v=(0,o.getEnv)(),y=g===o.endpoint.ENDPOINT_API_DERIVATIVE_SERVICE_V2&&!v.endsWith("EU"),b=v.endsWith("US")&&g===o.endpoint.ENDPOINT_API_D3S,x=g===o.endpoint.ENDPOINT_API_DERIVATIVE_STREAMING&&!g.endsWith("_EU");if(g+="_EU",y)o.endpoint.setEndpointAndApi(null,g);else if(b){v=v.replace("US","EU"),(0,o.setEnv)(v);var _=c.EnvironmentConfigurations[v];o.endpoint.setEndpointAndApi(_.ROOT,g)}else x&&o.endpoint.setEndpointAndApi(null,g)}function E(e){(o.endpoint.isSVF2Backend()||o.endpoint.isOtgBackend())&&(d=d?e.urn+","+d:e.urn);const n=new p(e,l,d);f=n.getGlobalMessages();if(n.docRoot.findAllViewables().length>0)t&&t(n,f);else{const e=r.ErrorCodes.BAD_DATA_NO_VIEWABLE_CONTENT;i&&i(e,"No viewable content",f)}}function S(e,t,n){if(401===e&&void 0===u.LMV_THIRD_PARTY_COOKIE)u.LMV_THIRD_PARTY_COOKIE=!1,(0,c.refreshRequestHeader)(c.token.accessToken),A();else if(i){var o="Error: "+e+" ("+t+")",s=(0,r.getErrorCode)(e);i(s,o,e,t,n)}}function A(){const e=!n||(o.endpoint.isSVF2Backend()||o.endpoint.isOtgBackend())&&!n["x-ads-acm-scopes"];if(!d&&!e)return n.oauth2AccessToken||(n.oauth2AccessToken=c.token.accessToken),void s.ViewingService.getACMSession(o.endpoint.getApiEndpoint(),n,(function(e){d=e,a.queryParams=d?"acmsession="+d:"",o.endpoint.setAcmSession(d),s.ViewingService.getManifest(o.endpoint.initLoadContext(a),l,E,S)}),i);const t=o.endpoint.initLoadContext(a);s.ViewingService.getManifest(t,l,E,S)}A()},p.getDocumentPath=function(e){if(-1===e.indexOf("urn:")){if(-1!==e.indexOf("://"))return e;var t=e;return"undefined"!=typeof window?(0!==t.indexOf("/")&&(t="/"+t),d.location.protocol+"//"+d.location.host+t):t}return e},p.requestThumbnailWithSecurity=function(e,t){var i={responseType:"blob",skipAssetCallback:!0,size:e.width,guid:e.guid,acmsession:e.acmsession},n="urn:"+e.urn,r=void 0;if(!(0,a.getGlobal)().USE_OTG_DS_PROXY){var l=(0,o.getEnv)();r=c.EnvironmentConfigurations[l].UPSTREAM;const e=(0,c.getUpstreamApiData)(l,o.endpoint.getApiFlavor());i.apiData=e}s.ViewingService.getThumbnail(o.endpoint.initLoadContext({endpoint:r}),n,(function(e){t(null,e)}),(function(){t("error",null)}),i)},p.prototype.getAcmSessionId=function(e){return this.acmSessionId?p.getAcmSessionId(e,this.acmSessionId):""},p.getAcmSessionId=function(e,t){if(!e)return"";let i=e.indexOf("urn:adsk.fluent")>=0;return(0,a.getGlobal)().USE_OTG_DS_PROXY||i||!o.endpoint.isSVF2Backend()&&!o.endpoint.isOtgBackend()?t:t.split(",")[1]||""},p.prototype.getPdfRenderingMode=function(){return this._pdfRenderingMode||f.Vector},p.prototype.setPdfRenderingMode=function(e){this._pdfRenderingMode=e},p.prototype.getFullPath=function(e){if(!e)return e;var t=e;if((0,o.isOffline)())-1==t.indexOf((0,o.getOfflineResourcePrefix)())&&(t=decodeURIComponent((0,o.getOfflineResourcePrefix)())+t.substr(t.indexOf("/")));else if(0===e.indexOf("urn")){if(0===e.indexOf("urn:adsk.fluent")||!o.endpoint.isSVF2Backend()&&!o.endpoint.isOtgBackend())t=o.endpoint.getItemApi(null,e),o.endpoint.ENDPOINT_API_MODEL_DERIVATIVE_V2===o.endpoint.getApiFlavor()&&(t=decodeURIComponent(t));else{const i=(0,o.getEnv)(),n=c.EnvironmentConfigurations[i],r=(0,a.getGlobal)().USE_OTG_DS_PROXY?null:n.UPSTREAM,s=(0,c.getUpstreamApiData)(i,o.endpoint.getApiFlavor());t=o.endpoint.getItemApi(r,e,s)}}else 0===e.indexOf("$file$")&&(t=this.myPath.replace("/bubble.json",e.replace("$file$","")));return t},p.prototype.getThumbnailOptions=function(e,t,i){var n=t||200,r=i||200,o=e.urn||this.myData.urn;return{urn:o,width:n,height:r,guid:e.guid,acmsession:this.getAcmSessionId(o)}},p.prototype.getThumbnailPath=function(e,t,i){var n=this.getThumbnailOptions(e,t,i),r=o.endpoint.getThumbnailApi(null,n.urn)+"?width="+n.width+"&height="+n.height;n.guid&&(r+="&guid="+n.guid),n.acmsession&&(r+="&acmsession="+n.acmsession);var s=o.endpoint.getQueryParams();return s&&(r+="&"+s),r},p.prototype.getLeafletZipParams=function(e,t){for(var i,n,r=t.search({role:"leaflet-zip"},!1),o=0;o<r.length;o++){n={};var s=(i=r[o]._raw()).urn;n.urnZip=this.getFullPath(s),n.centralDirOffset=i.central_dir_offset,n.centralDirLength=i.central_dir_length,n.centralDirEntries=i.central_dir_entries,n.zipMaxLevel=i.max_level-e.levelOffset,n.loadFromZip=!!(n.urnZip&&n.centralDirOffset&&n.centralDirLength&&n.centralDirEntries),n.fileTable={},e.zips||(e.zips=[]),e.zips.push(n)}e.zips.sort((function(e,t){return e.zipMaxLevel-t.zipMaxLevel}))},p.prototype.getLeafletParams=function(e,t,i){e.tileSize=i.tileSize?i.tileSize:512,e.texWidth=i.resolution[0],e.texHeight=i.resolution[1],e.paperWidth=i.paperWidth,e.paperHeight=i.paperHeight,e.paperUnits=i.paperUnits,e.urlPattern=i.urn,e.mime=i.mime,e.isLeaflet=!0,e.levelOffset=function(e){for(var t=1,i=0,n=0;n<20;n++){if((t*=2)>e)return i;i++}return l.logger.log("unexpected leaflet tileSize"),0}(e.tileSize),this.getLeafletZipParams(e,t),e.loadFromZip=e.zips&&e.zips[0].loadFromZip,e.zips&&(0,o.isOffline)()&&(0,a.isMobileDevice)()&&(e.zips=e.zips.slice(0,1),e.maxLevel=e.zips[0].zipMaxLevel)},p.prototype.derivePdfUrnHack=function(e,t){var i=e.parent.children.slice();i.sort(((e,t)=>e._raw().order-t._raw().order));let r;r=i.length<=75?i[i.length-1]:i[74];let o=r.search(n.BubbleNode.GEOMETRY_F2D_NODE)[0];if(o){var s=o.urn().indexOf("/"),a=o.urn().slice(0,s),l=e._raw().order,c=0|l%75,h=1+(0|l/75),u=a+`/output/${c}/${c}.pdf`;return t.page=h,t.isPdf=!0,console.log("pdf path",u),u}return null},p.prototype.getViewableUrn=function(e,t){let i;if(e instanceof n.BubbleNode)i=e;else{let t=this.docRoot.search(e);i=t.length>0?t[0]:new n.BubbleNode(e)}const r=()=>{const e=i.search(n.BubbleNode.GEOMETRY_F2D_NODE);if(e.length)return e[0].urn()},o=()=>{if(i.isRevitPdf()){const e=r();if(e)return e}var e=!0;const o=JSON.parse(localStorage.getItem("Autodesk.Viewing.Private.GuiViewer3D.SavedSettings.AEC"));o&&(e=o[Autodesk.Viewing.Private.Prefs2D.VECTOR_VIEWING]??!0);var s="true"===(0,h.getParameterByName)("vectorPdf")||(0,a.getGlobal)().LMV_VECTOR_PDF||this.myData&&this.myData.isVectorPDF||!!i.data.isVectorPDF,l="false"===(0,h.getParameterByName)("vectorPdf")||(0,a.getGlobal)().LMV_RASTER_PDF;s?e=!0:l&&(e=!1);var c=i.search(n.BubbleNode.PDF_PAGE_NODE),u=i.search(n.BubbleNode.LEAFLET_NODE);if(e&&u.length>0&&t&&(this.getLeafletParams(t,i,u[0]._raw()),t.tempRasterPath=u[0].urn()),e&&c.length)return t&&(t.isPdf=!0,t.page=c[0].data.page||1),this.setPdfRenderingMode(f.Vector),c[0].urn();if(u.length>0&&t){if(s){var d=this.derivePdfUrnHack(i,t);if(d)return this.setPdfRenderingMode(f.Vector),d}return this.getLeafletParams(t,i,u[0]._raw()),this.setPdfRenderingMode(f.Raster),u[0].urn()}};if(i.isGeometry()){if(i.is3D())return i.getViewableRootPath();if(i.is2D()){const e=o()||(()=>{const e=i.search(n.BubbleNode.IMAGE_NODE);if(e.length)return e[0].urn()})()||r();if(e)return e}}else if(i.isViewPreset()){var s=this.getViewGeometry(i,!0);if(s)return this.getViewableUrn(s,t)}return i.is3DTilesFormat()?this.myPath:""},p.prototype.getViewablePath=function(e,t){var i=this.getViewableUrn(e,t);return i?this.getFullPath(i):""},p.prototype.downloadAecModelData=function(e){const t=e?t=>{try{e(t)}catch(e){console.error("Document.downloadAecModelData() onFinished handler crashed",e)}return t}:e=>e;if(this.downloadAecModelDataPromise)return this.downloadAecModelDataPromise.then(t),this.downloadAecModelDataPromise;var i=this.docRoot.findViewableParent(),n=i&&i.data.aec_model_data;if(n)return t(n),Promise.resolve(n);var r=this.docRoot.search({role:"Autodesk.AEC.ModelData"})[0];if(!r)return t(),Promise.resolve(null);let a=r.getViewableRootPath();const l=this.getFullPath(a),h={headers:{}},u=this.getAcmSessionId(l);return-1!==l.indexOf(".api.autodesk.com")&&c.token.accessToken&&(h.headers.Authorization="Bearer "+c.token.accessToken),u&&(h.queryParams="acmsession="+u),this.downloadAecModelDataPromise=new Promise((e=>{var t=t=>{r.findViewableParent().data.aec_model_data=t,e(t)};s.ViewingService.getItem(o.endpoint.initLoadContext(h),l,(e=>t(e)),(()=>t()),{responseType:"json"})})).then((e=>(delete this.downloadAecModelDataPromise,e))).then(t),this.downloadAecModelDataPromise},p.getAecModelData=function(e){if(Array.isArray(e)){let t=new Map,i=e.map((e=>{let i=e.getDocument(),n=t.get(i);if(n)return n;{let e=i.downloadAecModelData();return t[i]=e,e}}));return Promise.all(i)}return e.getDocument().downloadAecModelData()},p.prototype.getRoot=function(){return this.docRoot},p.prototype.getPath=function(){return this.myPath},p.prototype.getViewGeometry=function(e){return e.findParentGeom2Dor3D()},p.prototype.getNumViews=function(e){var t=e.guid;return e instanceof n.BubbleNode&&(t=e.guid()),this.myNumViews[t]||0},p.prototype.getMessages=function(e,t){var i=[];if(!e)return i;for(var n=e;n&&(!t||n.parent);)n._raw().messages&&(i=i.concat(n._raw().messages)),n=n.parent;return i},p.prototype.getGlobalMessages=function(){var e=[],t=0,i=0;this.getRoot().traverse((function(n){var r=n._raw().messages||[];r.filter((function(e){return"error"===e.type})).length>0&&(t+=1),"inprogress"===n._raw().status&&(i+=1),e=e.concat(r)}));var n="translated";n=t>0?"failed":n,n=i>0?"processing":n;for(var r=e.length;r--;e[r].$translation=n);return e}},6684:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DynamicGlobalOffset:()=>a});const n=Autodesk.Viewing.Private;let r=null,o=null,s=null;class a{constructor(e){this.viewer=e,this.enabled=!1,this.onCameraChanged=this.onCameraChanged.bind(this);this.maxDistSq=1e8,this.setActive(!0)}setActive(e){e!=this.enabled&&(this.enabled=e,e?this.viewer.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT,this.onCameraChanged):this.viewer.removeEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT,this.onCameraChanged))}static updateModelMatrix(e,t,i){r=r||new n.LmvMatrix4(!0),o=o||new n.LmvMatrix4(!0),s=s||new n.LmvMatrix4(!0);const a=e.myData.placementWithOffset?r.copy(e.myData.placementWithOffset).invert():r.identity(),l=t?o.copy(t):o.identity();i&&(l.elements[12]-=i.x,l.elements[13]-=i.y,l.elements[14]-=i.z);const c=s.multiplyMatrices(l,a);e.setModelTransform(c)}onCameraChanged(){if(this.viewer.impl.is2d)return;if(this.blockEvents)return;const e=this.viewer.toolController.getTool("orbit");if(null!=e&&e.isDragging)return;if(this.viewer.impl.camera.position.lengthSq()<this.maxDistSq)return;this.blockEvents=!0;const t=this.viewer.impl.camera.getGlobalPosition();this.resetGlobalOffset(t),this.blockEvents=!1}resetGlobalOffset(e){this.viewer.getVisibleModels().forEach((t=>{t.setGlobalOffset(e),this.viewer.impl.onModelTransformChanged(t)})),this.viewer.impl.camera.setGlobalOffset(e),this.viewer.impl.syncCamera(),this.viewer.autocam&&this.viewer.autocam.onGlobalOffsetChanged(e),this.viewer.autocam.sync(this.viewer.impl.camera)}}},25004:(e,t,i)=>{"use strict";i.r(t),i.d(t,{EventDispatcher:()=>n});let n=function(){};n.prototype={constructor:n,apply:function(e){e.addEventListener=n.prototype.addEventListener,e.hasEventListener=n.prototype.hasEventListener,e.removeEventListener=n.prototype.removeEventListener,e.clearListeners=n.prototype.clearListeners,e.fireEvent=n.prototype.fireEvent,e.dispatchEvent=n.prototype.fireEvent,e.debugEvents=n.prototype.debugEvents},addEventListener:function(e,t,i){if(e){void 0===this.listeners&&(this.listeners={}),void 0===this.listeners[e]&&(this.listeners[e]=[]);for(var n=i&&i.priority||0,r=this.listeners[e].length,o=this.listeners[e].length-1;o>=0&&n>this.listeners[e][o].priority;o--)r--;this.listeners[e].splice(r,0,{callbackFn:t,once:!!i&&!!i.once,priority:n})}},hasEventListener:function(e,t){if(!e)return!1;if(void 0===this.listeners)return!1;var i=this.listeners[e];if(!i||0===i.length)return!1;for(var n=0,r=i.length;n<r;++n)if(i[n].callbackFn===t)return!0;return!1},removeEventListener:function(e,t){if(e)if(void 0!==this.listeners){var i=this.listeners[e];if(i)for(var n=0,r=i.length;n<r;++n)if(i[n].callbackFn===t){i.splice(n,1);break}}else this.listeners={}},clearListeners:function(){this.listeners=void 0},dispatchEvent:function(e){if(void 0!==this.listeners){if("string"==typeof e&&(e={type:e}),!e.target)try{e.target=this}catch(e){}if(!e.type)throw new Error("event type unknown.");if(this._doDebug&&console.log("Event: "+e.type),Array.isArray(this.listeners[e.type])){for(var t=this.listeners[e.type].slice(),i=[],n=0,r=t.length;n<r;++n)t[n].callbackFn.call(this,e),t[n].once&&i.push(t[n].callbackFn);for(var o=0;o<i.length;++o)this.removeEventListener(e.type,i[o])}}else this.listeners={}},debugEvents:function(e){this._doDebug=e}},n.prototype.fireEvent=n.prototype.dispatchEvent,"undefined"!=typeof Autodesk&&(Autodesk.Viewing.EventDispatcher=n)},19556:e=>{"use strict";var t=e.exports;t.ESCAPE_EVENT="escape",t.PROGRESS_UPDATE_EVENT="progress",t.FULLSCREEN_MODE_EVENT="fullScreenMode",t.NAVIGATION_MODE_CHANGED_EVENT="navmode",t.VIEWER_STATE_RESTORED_EVENT="viewerStateRestored",t.VIEWER_RESIZE_EVENT="viewerResize",t.VIEWER_INITIALIZED="viewerInitialized",t.VIEWER_UNINITIALIZED="viewerUninitialized",t.LOADER_LOAD_FILE_EVENT="loaderLoadFile",t.LOADER_LOAD_ERROR_EVENT="loaderLoadError",t.LOADER_REPAINT_REQUEST_EVENT="loaderRepaint",t.MODEL_ROOT_LOADED_EVENT="svfLoaded",t.GEOMETRY_LOADED_EVENT="geometryLoaded",t.TEXTURES_LOADED_EVENT="texturesLoaded",t.OBJECT_TREE_CREATED_EVENT="propertyDbLoaded",t.OBJECT_TREE_UNAVAILABLE_EVENT="propertyDbUnavailable",t.OBJECT_TREE_LOAD_PROGRESS_EVENT="propertyDbLoadProgress",t.MODEL_UNLOADED_EVENT="modelUnloaded",t.BEFORE_MODEL_UNLOAD_EVENT="beforeModelUnload",t.MODEL_ADDED_EVENT="modelAdded",t.MODEL_REMOVED_EVENT="modelRemoved",t.MODEL_LAYERS_LOADED_EVENT="modelLayersLoaded",t.MODEL_TRANSFORM_CHANGED_EVENT="modelTransformChanged",t.MODEL_PLACEMENT_CHANGED_EVENT="placementTransformChanged",t.MODEL_VIEWPORT_BOUNDS_CHANGED_EVENT="viewportBoundsChanged",t.MODEL_FRAGMENT_BOUNDING_BOXES_SET_EVENT="fragmentBoundingBoxesSet",t.EXTENSION_PRE_LOADED_EVENT="extensionPreLoaded",t.EXTENSION_LOADED_EVENT="extensionLoaded",t.EXTENSION_PRE_UNLOADED_EVENT="extensionPreUnloaded",t.EXTENSION_UNLOADED_EVENT="extensionUnloaded",t.EXTENSION_PRE_ACTIVATED_EVENT="extensionPreActivated",t.EXTENSION_ACTIVATED_EVENT="extensionActivated",t.EXTENSION_PRE_DEACTIVATED_EVENT="extensionPreDeactivated",t.EXTENSION_DEACTIVATED_EVENT="extensionDeactivated",t.SELECTION_CHANGED_EVENT="selection",t.AGGREGATE_SELECTION_CHANGED_EVENT="aggregateSelection",t.ISOLATE_EVENT="isolate",t.AGGREGATE_ISOLATION_CHANGED_EVENT="aggregateIsolation",t.HIDE_EVENT="hide",t.AGGREGATE_HIDDEN_CHANGED_EVENT="aggregateHidden",t.SHOW_EVENT="show",t.SHOW_PROPERTIES_EVENT="showProperties",t.SHOW_ALL_EVENT="showAll",t.HIDE_ALL_EVENT="hideAll",t.CAMERA_CHANGE_EVENT="cameraChanged",t.EXPLODE_CHANGE_EVENT="explodeChanged",t.FIT_TO_VIEW_EVENT="fitToView",t.AGGREGATE_FIT_TO_VIEW_EVENT="aggregateFitToView",t.CUTPLANES_CHANGE_EVENT="cutplanesChanged",t.TOOL_CHANGE_EVENT="toolChanged",t.RENDER_OPTION_CHANGED_EVENT="renderOptionChanged",t.FINAL_FRAME_RENDERED_CHANGED_EVENT="finalFrameRenderedChanged",t.RENDER_PRESENTED_EVENT="renderPresented",t.LAYER_VISIBILITY_CHANGED_EVENT="layerVisibility",t.PREF_CHANGED_EVENT="PrefChanged",t.PREF_RESET_EVENT="PrefReset",t.RESTORE_DEFAULT_SETTINGS_EVENT="restoreDefaultSettings",t.ANIMATION_READY_EVENT="animationReady",t.CAMERA_TRANSITION_COMPLETED="cameraTransitionCompleted",t.HYPERLINK_EVENT="hyperlink",t.HYPERLINK_NAVIGATE="hyperlink_navigate",t.LOAD_GEOMETRY_EVENT="load_geometry",t.LOAD_MISSING_GEOMETRY="loadMissingGeometry",t.WEBGL_CONTEXT_LOST_EVENT="webglcontextlost",t.WEBGL_CONTEXT_RESTORED_EVENT="webglcontextrestored",t.CANCEL_LEAFLET_SCREENSHOT="cancelLeafletScreenshot",t.SET_VIEW_EVENT="setView",t.RENDER_FIRST_PIXEL="renderFirstPixel",t.PROFILE_CHANGE_EVENT="profileChanged",t.RENDER_SCENE_PART="renderScenePart",t.OBJECT_UNDER_MOUSE_CHANGED="hoverObjectChanged",t.ANIM_ENDED="animEnded",t.TRANSITION_STARTED="transitionStarted",t.TRANSITION_ENDED="transitionEnded",t.FRAGMENTS_LOADED_EVENT="fragmentsLoaded",t.FRAGMENTS_UNLOADED_EVENT="fragmentsUnloaded",t.SCENE_UPDATED_EVENT="sceneUpdated",t.REFRESH_CUSTOM_PROPERTIES="refreshCustomProperties",t.REFRESH_CUSTOM_PROPERTIES_VALUES="refreshCustomPropertiesValues"},24840:(e,t,i)=>{"use strict";i.r(t),i.d(t,{EventUtils:()=>s});var n=i(55280);let r=!1,o=!1;class s{static isRightClick(e){if(!(e instanceof a(e).MouseEvent))return!1;let t=e.button;"buttons"in e&&(!o||1&e.buttons?2===t&&1&e.buttons&&(t=0,o=!0):(o=!1,t=0));return t===(r?0:2)}static isMiddleClick(e){return e instanceof a(e).MouseEvent&&1===e.button}static setUseLeftHandedInput(e){r=e}static async waitUntilTransitionEnded(e){if(e.navigation.getRequestTransition()||e.navigation.getTransitionActive())return new Promise((t=>{setTimeout((()=>{e.navigation.getRequestTransition()||e.navigation.getTransitionActive()?e.addEventListener(Autodesk.Viewing.CAMERA_TRANSITION_COMPLETED,t,{once:!0}):t()}))}))}static async waitUntilGeometryLoaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.model;if(!t||!t.isLoadDone())return new Promise((i=>{const n=r=>{t&&t!==r.model||(i(),e.removeEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT,n))};e.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT,n)}))}static async waitUntilModelAdded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.model;if(!t)return new Promise((i=>{const n=r=>{t&&t!==r.model||(i(),e.removeEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT,n))};e.addEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT,n)}))}}function a(e){const t=e.target&&e.target.ownerDocument;return t?t.defaultView||t.parentWindow:(0,n.getGlobal)()}Autodesk.Viewing.isRightClick=s.isRightClick,Autodesk.Viewing.isMiddleClick=s.isMiddleClick},82712:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Extension:()=>o});var n=i(16271),r=i(26206),o=function(e,t){this.viewer=e,r.GlobalManagerMixin.call(this),this.setGlobalManager(e.globalManager),this.options=t||{},this.id="",this.modes=[],this.mode="",this.name="",this.activeStatus=!1};o.prototype.load=function(){return!0},o.prototype.unload=function(){return!0},o.prototype.activate=function(e){return!0},o.prototype.deactivate=function(){return!0},o.prototype.setActive=function(e,t){e?this.activate(t):this.deactivate()},o.prototype.getName=function(){return this.name},o.prototype.getModes=function(){return this.modes},o.prototype.isActive=function(e){return e?this.activeStatus&&this.mode===e:this.activeStatus},o.prototype.getState=function(e){},o.prototype.restoreState=function(e,t){return!0},o.prototype.extendLocalization=function(e){return(0,n.extendLocalization)(e)},o.prototype.getCache=function(){this.viewer.extensionCache||(this.viewer.extensionCache={});var e=this.viewer.extensionCache[this.id];return e||(e=this.viewer.extensionCache[this.id]={}),e},o.prototype.onToolbarCreated=function(e){},"undefined"!=typeof Autodesk&&(Autodesk.Viewing.Extension=o)},55270:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ExtensionMixin:()=>c,theExtensionManager:()=>l});var n=i(83081),r=i(20268),o=i(19556),s=i(85403);const a=Autodesk.Viewing;const l=new class{constructor(){this.registeredExtensions=new Map}registerExtension(e,t){if(this.registeredExtensions.has(e)){const i=this.registeredExtensions.get(e);if(i.EXTENSION_CLASS)return!1;i.EXTENSION_CLASS=t}else this.registeredExtensions.set(e,{EXTENSION_CLASS:t});return!0}getExtensionClass(e){return this.registeredExtensions.has(e)?this.registeredExtensions.get(e).EXTENSION_CLASS:null}unregisterExtension(e){return!!this.registeredExtensions.has(e)&&(this.registeredExtensions.delete(e),!0)}registerExternalExtension(e,t,i){return!this.registeredExtensions.has(e)&&(this.registeredExtensions.set(e,{EXTENSION_CLASS:null,externalPathOrCallback:t,dependencies:i}),!0)}getExternalPath(e){return this.registeredExtensions.has(e)?this.registeredExtensions.get(e).externalPathOrCallback:null}getRegisteredExtensions(){return Array.from(this.registeredExtensions).map((e=>{let[t,i]=e;return{id:t,inMemory:!!i.EXTENSION_CLASS,isAsync:!!i.externalPathOrCallback}}))}downloadExtension(e){if(!this.registeredExtensions.has(e))return Promise.reject("Extension not found: "+e+". Has it been registered(1)?");const t=this.registeredExtensions.get(e);if(!t.externalPathOrCallback)return Promise.reject("Extension not found: "+e+". Has it been registered(2)?");if(t.downloadPromise)return t.downloadPromise;const i=(t.dependencies||[]).map((e=>this.downloadExtension(e))),n=Promise.all(i);return t.downloadPromise=n.then((()=>"string"==typeof t.externalPathOrCallback?r.theResourceLoader.loadScript(t.externalPathOrCallback,e):t.externalPathOrCallback())).then((()=>{if(delete t.downloadPromise,!t.EXTENSION_CLASS)throw new Error("Extension not found: "+e+". Has it been registered(3)?");return t.EXTENSION_CLASS})),t.downloadPromise}popuplateOptions(e){this.registeredExtensions.forEach((t=>{t.EXTENSION_CLASS.populateDefaultOptions(e)}))}isDownloading(e){return!!this.registeredExtensions.has(e)&&!!this.registeredExtensions.get(e).downloadPromise}isAvailable(e){return!!this.getExtensionClass(e)}},c=function(){};c.prototype={loadExtension:function(e,t){return this.loadedExtensions=this.loadedExtensions||{},l.isAvailable(e)?this.loadExtensionLocal(e,t):(this.loadExtensionPromises=this.loadExtensionPromises||{},e in this.loadExtensionPromises||(this.loadExtensionPromises[e]=l.downloadExtension(e).then((()=>{if(delete this.loadExtensionPromises[e],this.loadedExtensions){if(this.cancelledExtensions&&e in this.cancelledExtensions)throw delete this.cancelledExtensions[e],new Error(`Abort loadExtension('${e}') - extension has been unloaded`);return this.loadExtensionLocal(e,t)}n.logger.info(`Abort loadExtension('${e}') - teardown in progress`)}))),this.loadExtensionPromises[e])},getExtension:function(e,t){var i=this.loadedExtensions&&e in this.loadedExtensions?this.loadedExtensions[e]:null;return i&&t&&t(i),i},getExtensionAsync:function(e){let t=this.getExtension(e);return t?Promise.resolve(t):new Promise((i=>{this.addEventListener(o.EXTENSION_LOADED_EVENT,(function n(r){r.extensionId===e&&(this.removeEventListener(o.EXTENSION_LOADED_EVENT,n),t=this.getExtension(e),i(t))}))}))},unloadExtension:function(e){if(this.cancelledExtensions=this.cancelledExtensions||{},l.isDownloading(e))return this.cancelledExtensions[e]=!0,!1;let t=!1;const i=this.getExtension(e);return i?(t=i.unload(),n.logger.info("Extension unloaded: "+e),delete this.loadedExtensions[e],s.analytics.track("viewer.extensionManager.extensionUnloaded",{extensionId:e}),this.dispatchEvent({type:o.EXTENSION_UNLOADED_EVENT,extensionId:e})):n.logger.warn("Extension not found: "+e),t},loadExtensionLocal:function(e,t){const i=l.getExtensionClass(e);if(!i)return Promise.reject("Extension not found : "+e);let r=this.getExtension(e);if(r)return Promise.resolve(r);if(this.loadingExtensions&&e in this.loadingExtensions)return this.loadingExtensions[e];r=function(e){function t(t,i,n){const r=e[t];r?e[t]=function(){i&&i.call(e,...arguments);const t=r.call(e,...arguments);return n&&n.call(e,...arguments),t}:console.warn(t," not implemented in ",e)}return t("load",(function(){this.viewer.dispatchEvent({type:a.EXTENSION_PRE_LOADED_EVENT,extensionId:this.id})})),t("unload",(function(){this.viewer.dispatchEvent({type:a.EXTENSION_PRE_UNLOADED_EVENT,extensionId:this.id})})),t("activate",(function(e){this.viewer.dispatchEvent({type:a.EXTENSION_PRE_ACTIVATED_EVENT,extensionId:this.id,mode:e})}),(function(e){this.viewer.dispatchEvent({type:a.EXTENSION_ACTIVATED_EVENT,extensionId:this.id,mode:e}),s.analytics.track("viewer.extension.activate",{extensionId:this.id,mode:e})})),t("deactivate",(function(){this.viewer.dispatchEvent({type:a.EXTENSION_PRE_DEACTIVATED_EVENT,extensionId:this.id})}),(function(){this.viewer.dispatchEvent({type:a.EXTENSION_DEACTIVATED_EVENT,extensionId:this.id}),s.analytics.track("viewer.extension.deactivate",{extensionId:this.id})})),e}(new i(this,t)),r.id=e;const c=()=>Promise.reject("Extension failed to .load() : "+e),h=r.load();if(!h)return c();const u=()=>(this.loadedExtensions[e]=r,this.onPostExtensionLoad(r),n.logger.info("Extension loaded: "+e),s.analytics.track("viewer.extensionManager.extensionLoaded",{extensionId:e}),setImmediate((()=>{this.getExtension(e)&&this.dispatchEvent({type:o.EXTENSION_LOADED_EVENT,extensionId:e})})),Promise.resolve(r));return"function"==typeof h.then?(this.loadingExtensions=this.loadingExtensions||{},this.loadingExtensions[e]=h.then((e=>e?u():c())).finally((()=>{delete this.loadingExtensions[e]})),this.loadingExtensions[e]):u()},onPostExtensionLoad:function(e){},forEachExtension:function(e){const t=this.loadedExtensions||{};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&e(t[i])},apply:function(e){var t=c.prototype;e.loadExtension=t.loadExtension,e.getExtension=t.getExtension,e.getExtensionAsync=t.getExtensionAsync,e.unloadExtension=t.unloadExtension,e.loadExtensionLocal=t.loadExtensionLocal,e.forEachExtension=t.forEachExtension,e.onPostExtensionLoad=t.onPostExtensionLoad}}},19948:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FeatureFlags:()=>s,InternalFeatureFlags:()=>l,PublicFeatureFlags:()=>a});var n=i(35922),r=i(61183),o=i(11743);class s{static#e=new Map;static#t=!1;static _add(e,t){this.#t?console.warn("Feature flags cannot be added after initialization."):this.#e.has(e)?console.warn(`Feature flag '${e}' already exists.`):this.#e.set(e,{value:t,initializationCB:void 0,changeListener:void 0})}static _registerInitializationCallback(e,t){const i=this.#e.get(e);void 0!==i?i.initializationCB=t:console.warn(`Feature flag '${e}' not found; callback registration is skipped.`)}static _registerChangeListener(e,t){const i=this.#e.get(e);void 0!==i?i.changeListener=t:console.warn(`Feature flag '${e}' not found; callback registration is skipped.`)}static set(e,t){const i=this.#e.get(e);if(this.#t)console.warn(`Feature flag '${e}' is immutable and cannot be modified after initialization.`);else if(void 0===i)console.warn(`Feature flag '${e}' not found; modification is skipped.`);else{const e=i.value!==t;i.value!==t&&(i.value=t),void 0!==i.changeListener&&e&&i.changeListener(i.value)}}static isEnabled(e){const t=this.#e.get(e);return null==t?void 0:t.value}static _setInitializationData(e,t){const i=this.#e.get(e);void 0!==i?this.#t?console.warn(`Feature flag '${e}' has already been initialized. Ignoring initialization data.`):i.initializationData=t:console.warn(`Feature flag '${e}' not found; modification is skipped.`)}static async _initialize(){if(this.#t)return;this.#t=!0;const e=new o.Profile(Autodesk.Viewing.ProfileSettings.Default),t=new r.Preferences;e.apply(t);const i=new Array;for(const[,e]of this.#e){Object.freeze(e);const n=e.initializationCB;n&&i.push(n(e.value,{preferences:t,customInitializationData:e.initializationData}))}return Promise.all(i)}static print(){console.log("Feature Flags:"+(0===this.#e.size?" none":""));for(const[e,{value:t}]of this.#e)Object.values(l).includes(e)||console.log(` - ${e}: ${t}`)}}const a=Object.freeze({LargeModelExperienceOptOut:"HIDE_LARGE_MODEL_EXPERIENCE"});s._add(a.LargeModelExperienceOptOut,!1),s._registerInitializationCallback(a.LargeModelExperienceOptOut,((e,t)=>{var i;if(!e&&((null===(i=t.customInitializationData)||void 0===i?void 0:i.overridePreferenceValue)??t.preferences.get(n.Prefs3D.LARGE_MODEL_EXPERIENCE)))return Autodesk.Viewing.Private.useHLOD()}));const l=Object.freeze({OutOfCoreGpuMemoryManagement:"OUT_OF_CORE_GPU_MEMORY_MANAGEMENT",WebGPUBackend:"ENABLE_WEBGPU"});s._add(l.WebGPUBackend,!1),s._registerInitializationCallback(l.WebGPUBackend,(async(e,t)=>{var i;if(e&&((null===(i=t.customInitializationData)||void 0===i?void 0:i.overridePreferenceValue)??t.preferences.get(n.Prefs.WEBGPU)))return await Autodesk.Viewing.Private.useWebGPU()})),s._add(l.OutOfCoreGpuMemoryManagement,!1),s._registerInitializationCallback(l.OutOfCoreGpuMemoryManagement,((e,t)=>{var i;e&&((null===(i=t.customInitializationData)||void 0===i?void 0:i.overridePreferenceValue)??t.preferences.get(n.Prefs3D.OUT_OF_CORE_GPU_MEMORY_MANAGEMENT))&&Autodesk.Viewing.Private.enableOutOfCoreTileManager()}))},93228:(e,t,i)=>{"use strict";function n(e){this.viewer=e}i.r(t),i.d(t,{FileLoader:()=>n}),n.prototype.constructor=n,n.prototype.loadFile=function(e,t,i,n){return!1},n.prototype.is3d=function(){return!1}},54393:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FileLoaderManager:()=>r});const n={};let r={registerFileLoader:function(e,t,i,r){return n[e]?n[e].loader===i&&(n[e].count++,!0):(n[e]={loader:i,extensions:t,mimeType:r,count:1},!0)},getFileLoader:function(e){return n[e]?n[e].loader:null},getFileLoaderForExtension:function(e,t){e=e?e.toLowerCase():"";const i=new Array;for(const t in n){const r=n[t];if(r)for(let t=0;t<r.extensions.length;t++)r.extensions[t].toLowerCase()===e&&i.push(r.loader)}if(0===i.length)return null;if(t&&i.length>1)for(let e of i)if(e.acceptsMimeType&&e.acceptsMimeType(t))return e;return i[0]},unregisterFileLoader:function(e){return!!n[e]&&(n[e].count--,0===n[e].count&&delete n[e],!0)}}},8811:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GlobalManager:()=>r});const n=Autodesk.Viewing;class r{constructor(){this._window={inner:null,registeredEventListeners:new Map},this._document={inner:null,registeredEventListeners:new Map},this._window.inner=n.getGlobal(),this._document.inner=this._window.inner.document,this.addWindowEventListener=s.bind(this._window),this.removeWindowEventListener=a.bind(this._window),this.addDocumentEventListener=s.bind(this._document),this.removeDocumentEventListener=a.bind(this._document)}getWindow(){return this._window.inner}getDocument(){return this._document.inner}setWindow(e){if(e&&e!==this._window.inner){for(let[t,i]of this._window.registeredEventListeners.entries())for(let[n,r]of i.entries())e.addEventListener(t,n,...r),this._window.inner.removeEventListener(t,n,...r);for(let[t,i]of this._document.registeredEventListeners.entries())for(let[n,r]of i.entries())e.document.addEventListener(t,n,...r),this._document.inner.removeEventListener(t,n,...r);this._window.inner=e,this._document.inner=e.document}}}function o(e){return!!e.opener}function s(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];o(this.inner)||(this.registeredEventListeners.has(e)?this.registeredEventListeners.get(e).set(t,n):this.registeredEventListeners.set(e,new Map([[t,n]]))),this.inner.addEventListener(e,t,...n)}function a(e,t){o(this.inner)||this.registeredEventListeners.has(e)&&this.registeredEventListeners.get(e).has(t)&&this.registeredEventListeners.get(e).delete(t);for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];this.inner.removeEventListener(e,t,...n)}},26206:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GlobalManagerMixin:()=>o});var n=i(8811);const r=new n.GlobalManager;function o(){this.globalManager=r,this.setGlobalManager=function(e){this.globalManager=e,this.onSetGlobalManager(this.globalManager)},this.onSetGlobalManager=function(e){},this.getWindow=function(){return this.globalManager.getWindow()},this.getDocument=function(){return this.globalManager.getDocument()},this.setWindow=function(e){return this.globalManager.setWindow(e)},this.addWindowEventListener=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];this.globalManager.addWindowEventListener(e,t,...n)},this.removeWindowEventListener=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];this.globalManager.removeWindowEventListener(e,t,...n)},this.addDocumentEventListener=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];this.globalManager.addDocumentEventListener(e,t,...n)},this.removeDocumentEventListener=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];this.globalManager.removeDocumentEventListener(e,t,...n)}}Autodesk.Viewing.GlobalManager=n.GlobalManager,Autodesk.Viewing.GlobalManagerMixin=o},97005:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BackgroundPresets:()=>a,DefaultLightPreset:()=>r,DefaultLightPreset2d:()=>o,DefaultToneMapMethod:()=>s,LightPresets:()=>c,copyLightPreset:()=>u});var n=i(55280);let r=1,o=0,s=1,a={"Fusion Grey":[230,230,230,150,150,150],"Sky Blue":[226,244,255,156,172,180],Snow:[181,186,199,181,186,199],Midnight:[41,76,120,1,2,3],White:[255,255,255,255,255,255],AutoCADModel:[30,40,48,30,40,48],"Dark Grey":[51,51,51,51,51,51],"Dark Sky":[51,51,51,51,51,51],"Infinity Pool":[255,255,255,255,255,255],Tranquility:[0,84,166,0,84,166],"Grey Room":[129,129,129,129,129,129],"Photo Booth":[237,237,237,237,237,237],"RaaS SBS":[1,1,1,90,90,90],Plaza:[79,102,130,79,102,130],Field:[202,226,252,202,201,190],Boardwalk:[216,230,248,230,228,220],Custom:[230,230,230,150,150,150]};var l=a;let c=[{name:"Simple Grey",path:null,tonemap:0,E_bias:0,directLightColor:[1,.84,.67],ambientColor:[.2,.225,.25],lightMultiplier:1,bgColorGradient:l["Fusion Grey"],darkerFade:!1,rotation:0},{name:"Sharp Highlights",path:"SharpHighlights",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[.5,.5,.5],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[.5,-.2,-.06],bgColorGradient:l["Photo Booth"],darkerFade:!0,rotation:0},{name:"Dark Sky",path:"DarkSky",type:"logluv",tonemap:s,E_bias:-1,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:1,lightDirection:[.1,-.55,-1],bgColorGradient:l["Dark Sky"],darkerFade:!1,rotation:0},{name:"Grey Room",path:"GreyRoom",type:"logluv",tonemap:s,E_bias:-1,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:.5,lightDirection:[.1,-.55,-1],bgColorGradient:l["Grey Room"],darkerFade:!0,rotation:0},{name:"Photo Booth",path:"PhotoBooth",type:"logluv",tonemap:s,E_bias:0,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:.5,lightDirection:[.1,-.55,-1],bgColorGradient:l["Photo Booth"],darkerFade:!0,rotation:0},{name:"Tranquility",path:"TranquilityBlue",type:"logluv",tonemap:s,E_bias:-1,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:.5,lightDirection:[.1,-.55,-1],bgColorGradient:l.Tranquility,darkerFade:!1,rotation:0},{name:"Infinity Pool",path:"InfinityPool",type:"logluv",tonemap:s,E_bias:-1,directLightColor:[1,.84,.67],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:.5,lightDirection:[.1,-.55,-1],bgColorGradient:l["Infinity Pool"],darkerFade:!1,rotation:0},{name:"Simple White",path:null,tonemap:0,E_bias:0,directLightColor:[1,1,1],ambientColor:[.25,.25,.25],lightMultiplier:1,bgColorGradient:l.White,saoRadius:.06,saoIntensity:.15,darkerFade:!0,rotation:0},{name:"Riverbank",path:"riverbank",type:"logluv",tonemap:s,E_bias:-5.7,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Sky Blue"],darkerFade:!1,rotation:0},{name:"Contrast",path:"IDViz",type:"logluv",tonemap:s,E_bias:0,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l.Midnight,darkerFade:!1,rotation:0},{name:"Rim Highlights",path:"RimHighlights",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[.5,.5,.5],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[.35,-.35,-.5],bgColorGradient:l["Photo Booth"],darkerFade:!0,rotation:0},{name:"Cool Light",path:"CoolLight",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[-0,-.15,-.5],bgColorGradient:l["Fusion Grey"],darkerFade:!0,rotation:0},{name:"Warm Light",path:"WarmLight",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[-0,-.15,-.5],bgColorGradient:l["Fusion Grey"],darkerFade:!0,rotation:0},{name:"Soft Light",path:"SoftLight",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[-.5,-.5,0],bgColorGradient:l["Fusion Grey"],darkerFade:!0,rotation:0},{name:"Grid Light",path:"GridLight",type:"logluv",tonemap:s,E_bias:-9,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[-.5,-.6,0],bgColorGradient:l["Fusion Grey"],darkerFade:!0,rotation:0},{name:"Plaza",path:"Plaza",type:"logluv",tonemap:s,E_bias:-14,directLightColor:[.9,.9,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[-.2,-.18,.72],bgColorGradient:l.Plaza,darkerFade:!1,rotation:0},{name:"Snow Field",path:"SnowField",type:"logluv",tonemap:s,E_bias:-10.461343,directLightColor:[1,1,1],ambientColor:[.25/8,.25/8,.25/8],lightMultiplier:0,lightDirection:[0,-1,0],bgColorGradient:l.Snow,darkerFade:!1,rotation:0},{name:"Field",path:"field",type:"logluv",tonemap:s,E_bias:-2.9,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l.Field,useIrradianceAsBackground:!0,darkerFade:!0,rotation:0},{name:"Boardwalk",path:"boardwalk",type:"logluv",tonemap:s,E_bias:-7,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l.Boardwalk,useIrradianceAsBackground:!0,darkerFade:!1,rotation:0},{name:"Flat Shading",path:null,tonemap:0,E_bias:0,directLightColor:[0,0,0],ambientColor:[0,0,0],lightMultiplier:0,bgColorGradient:l["Fusion Grey"],darkerFade:!1,rotation:0}],h=[{name:"Harbor",path:"Harbor",type:"logluv",tonemap:s,E_bias:1.9,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Sky Blue"],useIrradianceAsBackground:!0,saoIntensity:.5,darkerFade:!1,rotation:0},{name:"Night",path:"Night",type:"logluv",tonemap:1,E_bias:4,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l.Midnight,useIrradianceAsBackground:!1,darkerFade:!1,rotation:0},{name:"Parking",path:"Parking",type:"logluv",tonemap:s,E_bias:2.8,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Sky Blue"],useIrradianceAsBackground:!1,saoIntensity:.5,darkerFade:!1,rotation:0},{name:"River Road",path:"RiverRoad",type:"logluv",tonemap:s,E_bias:0,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Fusion Grey"],useIrradianceAsBackground:!1,saoIntensity:.7,darkerFade:!1,rotation:0},{name:"Crossroads",path:"crossroads",type:"logluv",tonemap:s,E_bias:-5.5,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Sky Blue"],useIrradianceAsBackground:!0,darkerFade:!0,rotation:0},{name:"Seaport",path:"seaport",type:"logluv",tonemap:s,E_bias:-6.5,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["Sky Blue"],useIrradianceAsBackground:!0,darkerFade:!1,rotation:0},{name:"Glacier",path:"glacier",type:"logluv",tonemap:s,E_bias:0,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l.Midnight,darkerFade:!1,rotation:0},{name:"RaaS Test Env",path:"Reflection",type:"logluv",tonemap:2,E_bias:-1.5,directLightColor:[1,1,1],lightMultiplier:0,bgColorGradient:l["RaaS SBS"],darkerFade:!1,rotation:0},{name:"City Night",path:"CityNight",type:"logluv",tonemap:s,E_bias:1.6,directLightColor:[1,1,1],lightMultiplier:.2,bgColorGradient:l.Midnight,useIrradianceAsBackground:!1,darkerFade:!1,rotation:0}];function u(e,t){Object.assign(t,e),t.name=e.name+" (copy)"}(0,n.getGlobal)().ENABLE_DEBUG&&Array.prototype.push.apply(c,h)},94661:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LocalStorage:()=>a});var n,r=i(83081),o=(0,i(55280).getGlobal)();function s(){this.isSupported()||(this._data={})}s.prototype.getItem=function(e){return this.isSupported()?o.localStorage.getItem(e):Object.prototype.hasOwnProperty.call(this._data,e)?this._data[e]:null},s.prototype.setItem=function(e,t){if(this.isSupported())try{o.localStorage.setItem(e,t)}catch(e){r.logger.debug("avp.LocalStorage: Failed to setItem()")}else this._data[e]=String(t)},s.prototype.removeItem=function(e){this.isSupported()?o.localStorage.removeItem(e):delete this._data[e]},s.prototype.clear=function(){this.isSupported()?o.localStorage.clear():this._data={}},s.prototype.isSupported=function(){return void 0===n&&(n=(()=>{if("undefined"==typeof window)return!1;try{const e="lmv_viewer_test_localStorage",t=o.localStorage;return!!t&&(t.setItem(e,"1"),t.removeItem(e),!0)}catch(e){return!1}})()),n},s.prototype.getAllKeys=function(){return n?Object.keys(o.localStorage):Object.keys(this._data)};const a=new s},63764:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Model:()=>v});var n=i(25004),r=i(84045),o=i(55280),s=i(37365),a=i(54561),l=i(9478),c=i(42525),h=i(63841),u=i(27623),d=i(33398),f=i(18211);const p=f.hp.from&&f.hp.alloc&&f.hp.allocUnsafe&&f.hp.allocUnsafeSlow?f.hp.from:e=>new f.hp(e);let m=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(m=new Int32Array(m));const g=function(e,t){const i=(e,i)=>t(e,i)>>>0;return i.signed=t,i.unsigned=i,i.model=e,i}("crc-32",(function(e,t){f.hp.isBuffer(e)||(e=p(e));let i=0===t?0:~t;for(let t=0;t<e.length;t++){const n=e[t];i=m[255&(i^n)]^i>>>8}return~i}));class v extends l.RenderModel{myData;topology=null;topologyPromise=null;svfUUID=null;defaultCameraHash=null;loader=void 0;constructor(e){super(e),this.myData=e,n.EventDispatcher.prototype.apply(this);const t={};t.isSVF2=this.isSVF2(),t.isOTG=this.isOTG(),t.is2d=this.is2d(),super.setModelFormat(t)}initialize(){super.initialize();const e=new c.ModelIteratorLinear(this);this.addTraversalController("Linear",e)}getInstanceTree(){return this.myData?this.myData.instanceTree:null}getFuzzyBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=Boolean(e.ignoreTransforms),i=this.getFragmentList();if(!i||this.is2d())return this.getBoundingBox(t);var n=null;if(t){var r=new Array(6);const e=this.getData().placementWithOffset,t=e?e.clone().invert():void 0;n=function(e,n){i.getOriginalWorldBounds(e,r),n.min.fromArray(r),n.max.fromArray(r,3),t&&n.applyMatrix4(t)}}else n=function(e,t){i.getWorldBounds(e,t)};var o=e.center||function(){var t=new THREE.Box3,r=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Vector3,a=0;function l(i){if(!e.allowlist||e.allowlist.includes(i)){n(i,t),t.getCenter(r);var l=t.getSize(o).length();s.add(r.multiplyScalar(l)),a+=l}}for(var c=0;c<i.getCount();c++)l(c);return s.multiplyScalar(1/a),s}(),s=e.quantil||.75,a=new THREE.Box3,l=[];const c=new THREE.Vector3;for(let t=0;t<i.getCount();t++)if((!e.allowlist||e.allowlist.includes(t))&&(n(t,a),!a.isEmpty())){var h=a.distanceToPoint(o);0===h&&(h=o.distanceTo(a.getCenter(c))),l.push({fragId:t,distance:h})}l.sort((function(e,t){return e.distance-t.distance}));var u=new THREE.Box3;for(let e=0;e<l.length*s;e++){var d=l[e];n(d.fragId,a),u.union(a)}return u}getBoundingBox(e,t){return super.updateModelBBoxOriginal(this.getData().modelSpaceBBox),super.getModelBounds(e,t)}is2d(){return!(!this.myData||!this.myData.is2d)}is3d(){return!this.is2d()}isOTG(){return this.myData&&!!this.myData.isOTG}isSVF2(){const e=this.getDocumentNode();return!!e&&e.isSVF2()}isPdf(e){return!(!this.myData||!this.myData.isPdf||e&&this.isSmartPdf())}isRevitPdf(){var e;return!(null===(e=this.getDocumentNode())||void 0===e||!e.isRevitPdf())}isSmartPdf(){var e;return!(null===(e=this.getDocumentNode())||void 0===e||!e.isSmartPdf())}isLeaflet(){return!(!this.myData||!this.myData.isLeaflet)}isPageCoordinates(){var e;return this.is2d()&&(!this.isLeaflet()||(null===(e=this.loader)||void 0===e?void 0:e.isPageCoordinates()))}isSceneBuilder(){return!(!this.myData||!this.myData.isSceneBuilder)}getData(){return this.myData}setUUID(e){this.svfUUID=btoa(encodeURI((0,r.pathToURL)(e)))}getDocumentNode(){var e;return(null===(e=this.getData())||void 0===e||null===(e=e.loadOptions)||void 0===e?void 0:e.bubbleNode)??null}getRoot(){var e=this.getData();return e&&e.instanceTree?e.instanceTree.root:null}getRootId(){var e=this.getData();return e&&e.instanceTree&&e.instanceTree.getRootId()||0}getUnitData(e){return console.warn("Model.getUnitData is deprecated and will be removed in a future release, use Autodesk.Viewing.Private.getUnitData() instead."),(0,u.getUnitData)(e)}getUnitScale(){return(0,u.convertUnits)(this.getUnitString(),u.ModelUnits.METER,1,1)}getUnitString(){var e;if(this.is2d())e=this.getMetadata("page_dimensions","model_units",null)||this.getMetadata("page_dimensions","page_units",null);else{var t=this.getData();e=t&&t.overriddenUnits?t.overriddenUnits:t&&t.scalingUnit?t.scalingUnit:this.getMetadata("distance unit","value",null)}return(0,u.fixUnitString)(e)}getDisplayUnit(){var e;if(this.is2d())e=this.getMetadata("page_dimensions","model_units",null)||this.getMetadata("page_dimensions","page_units",null);else{var t=this.getData();e=t&&t.scalingUnit?t.scalingUnit:this.getMetadata("default display unit","value",null)||this.getMetadata("distance unit","value",null)}return(0,u.fixUnitString)(e)}getSourceFileUnits(){const e=this.getDocumentNode();return null==e?void 0:e.getSourceFileUnits()}getMetadata(e,t,i){var n=this.getData();if(n){var r=n.metadata;if(r){var o=r[e];if(void 0!==o){if(!t)return o;var s=o[t];if(void 0!==s)return s}}}return i}getDefaultCamera(){var e=this.getData();if(!e)return null;var t=null,i=e.cameras?e.cameras.length:0;if(0<i){var n=this.getMetadata("default camera","index",null);if(null!==n&&e.cameras[n])t=e.cameras[n];else{for(var r=0;r<i;r++){var o=e.cameras[r];if(o.isPerspective){t=o;break}}t||(t=e.cameras[0])}}var s=this.getModelTransform();if(t&&s){const e=h.UnifiedCamera.copyViewParams(t);return h.UnifiedCamera.transformViewParams(e,s),h.UnifiedCamera.adjustOrthoCamera(e,this.getBoundingBox()),e}return t}isAEC(){return!!this.getData().loadOptions.isAEC}hasPageShadow(){return this.getData().hasPageShadow}getUpVector(){return this.getMetadata("world up vector","XYZ",null)}getNorthVector(){return this.getMetadata("world north vector","XYZ",null)}getFrontVector(){return this.getMetadata("world front vector","XYZ",null)}geomPolyCount(){var e=this.getGeometryList();return e?e.geomPolyCount:null}instancePolyCount(){var e=this.getGeometryList();return e?e.instancePolyCount:null}isLoadDone(e){const t=this.getData(),i=!e||!1!==t.texLoadDone;return!!(t&&t.loadDone&&i)}isObjectTreeCreated(){return!!this.getData().instanceTree}getPropertyDb(){const e=this.getData();return e&&e.propDbLoader}async getPropertyHashes(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;function i(e,t,i,n){const r=(e+t+i+(n??"")).toUpperCase();return`p${g(r).toString(16).padStart(8,"0")}`}const n=this.getPropertyDb();if(void 0===n||!0!==n.isLoadDone())return;let r=await n.executeUserFunction("function userFunction(pdb) {\n const properties = new Set();\n pdb.enumAttributes((i, attribute, raw) => {\n properties.add([ attribute.name, attribute.category, attribute.dataType, attribute.dataTypeContext ]);\n });\n return Array.from(properties); }");void 0!==e&&e instanceof RegExp&&(r=r.filter((t=>e.test(t[0])))),void 0!==t&&t instanceof RegExp&&(r=r.filter((e=>t.test(e[1]))));for(const e of r){const t=i(e[0],e[1],e[2],e[3]);e.unshift(t),e.pop(),e.pop()}return r}getProperties(e,t,i){var n=this.getPropertyDb();!n||e<=0?i&&i():n.getProperties(e,t,i)}getProperties2(e,t,i,n){var r=this.getPropertyDb();!r||e<=0?i&&i():r.getProperties2(e,t,i,n)}getBulkProperties(e,t,i,n){Array.isArray(t)&&(t={propFilter:t});var r=(t=t||{}).propFilter||null,o=t.ignoreHidden||!1,s=this.getPropertyDb();s?s.getBulkProperties(e,r,i,n,o):n&&n()}getBulkProperties2(e,t,i,n){var r=this.getPropertyDb();r?r.getBulkProperties2(e,t,i,n):n&&n()}getPropertySetAsync(e,t){return new Promise(((i,n)=>{this.getPropertySet(e,i,n,t)}))}getPropertySet(e,t,i,n){var r=this.getPropertyDb();r||i&&i("Properties failed to load."),r.getPropertySet(e,n,(e=>{t(new d.PropertySet(e))}),i)}getExternalIdMapping(e,t){var i=this.getPropertyDb();i?i.getExternalIdMapping(e,t):t&&t()}getLayerToNodeIdMapping(e,t){var i=this.getPropertyDb();i?i.getLayerToNodeIdMapping(e,t):t&&t()}getObjectTree(e,t){const i=this.getData().instanceTree;if(i)e(i);else{var n=this.getPropertyDb();n?n.getObjectTree(e,t):t&&t()}}isObjectTreeLoaded(){var e=this.getPropertyDb();return!!e&&e.isObjectTreeLoaded()}search(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{searchHidden:!1};var o=this.getPropertyDb();o?o.searchProperties(e,n,t,i,r):i&&i()}findProperty(e){var t=this.getPropertyDb();return t?t.findProperty(e):Promise.reject("Model doesn't have any properties.")}static#i(e){var t=.001,i=e;if(Math.abs(i[0])<t)if(Math.abs(i[4])>t)for(var n=0;n<4;n++){var r=i[n];i[n]=i[n+4],i[n+4]=r}else for(let e=0;e<4;e++){const t=i[e];i[e]=i[e+8],i[e+8]=t}if(Math.abs(i[5])<t)for(let e=4;e<8;e++){const t=i[e];i[e]=i[e+4],i[e+4]=t}}static#n(e,t,i,n){var r,o,s,a,l,c,h=!1;s=n[i[i.length-1]].x,r=(a=n[i[i.length-1]].y)>=t;for(var u=0,d=i.length;u<d;++u)l=n[i[u]].x,r!=(o=(c=n[i[u]].y)>=t)&&(c-t)*(s-l)>=(l-e)*(a-c)==o&&(h=!h),r=o,s=l,a=c;return h}static#r(e,t,i,n){for(var r=!1,o=0;o<i.length;o++)v.#n(e,t,i[o],n)&&(r=!r);return r}getPageToModelTransform(e){var t,i=this.getData();if(i.pageToModelTransform)return i.pageToModelTransform;var n=i,r=n.metadata.page_dimensions,o=n.viewports&&n.viewports[e];if(!o)return new THREE.Matrix4;n.viewportTransforms||(n.viewportTransforms=new Array(n.viewports.length));var a=n.viewportTransforms[e];if(a)return a;var l=new s.LmvMatrix4(!0).set(r.logical_width/r.page_width,0,0,r.logical_offset_x,0,r.logical_height/r.page_height,0,r.logical_offset_y,0,0,1,0,0,0,0,1),c=(null===(t=o.transform)||void 0===t?void 0:t.slice())||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];v.#i(c);var h=new s.LmvMatrix4(!0);h.elements.set(c);var u=new s.LmvMatrix4(!0);return u.copy(h).invert(),u.multiply(l),n.viewportTransforms[e]=u,u}pageToModel(e,t,i,n){let r=this.getPageToModelTransform(i);function o(e){if(e){var t=(new THREE.Vector3).set(e.x,e.y,0).applyMatrix4(r);e.x=t.x,e.y=t.y,e.z=t.z}}n&&(r=r.clone().invert()),o(e),o(t)}pointInClip(e,t){for(var i=this.getData().clips,n=[],r=1;r<i.length;r++)if(r!==t){for(var o=[],s=[],a=i[r].contourCounts,l=i[r].points,c=0,h=[],u=0;u<a.length;u++){for(var d=0;d<a[u];d++)o.push(c),c++;s.push(o),o=[]}for(let e=0;e<l.length;e+=2){var f={x:l[e],y:l[e+1]};h.push(f)}v.#r(e.x,e.y,s,h)&&n.push(r)}return n}getClip(e){for(var t=this.getData().clips,i=[],n=[],r=t[e].contourCounts,o=t[e].points,s=0,a=[],l=0;l<r.length;l++){for(var c=0;c<r[l];c++)i.push(s),s++;n.push(i),i=[]}for(let e=0;e<o.length;e+=2){var h={x:o[e],y:o[e+1]};a.push(h)}return{contours:n,points:a}}getTopoIndex(e){var t=this.getData();if(t&&t.fragments){var i=t.fragments.topoIndexes;if(i)return i[e]}}getTopology(e){return this.topology?this.topology[e]:null}hasTopology(){return!!this.topology}fetchTopology(e){if(this.topology)return Promise.resolve(this.topology);var t=this.getData();if(!t.topologyPath)return Promise.reject({error:"no-topology"});var i=e||((0,o.isMobileDevice)()?20:100);if(t.topologySizeMB>i)return Promise.reject({error:"topology-too-big",limitMB:i,topologyMB:t.topologySizeMB});if(!this.topologyPromise){var n=this;this.topologyPromise=new Promise((function(e,t){n.loader.fetchTopologyFile(n.getData().topologyPath,(function(i){i&&i.topology?(n.topology=i.topology,e(i.topology)):t(i)}))}))}return this.topologyPromise}hasGeometry(){var e=this.getData();return!!e&&(!!e.isLeaflet||(!!e.isSceneBuilder||e.fragments.length>0))}getFragmentPointer(e){return e?new a.FragmentPointer(this.getFragmentList(),e):null}clone(){const e=new v(this.myData);return e.topology=this.topology,e.topologyPromise=this.topologyPromise,e.svfUUID=this.svfUUID,e.defaultCameraHash=this.defaultCameraHash,e.loader=this.loader,e.setInnerAttributes(this.getInnerAttributes()),e}getSeedUrn(){var e;return(null===(e=this.loader)||void 0===e?void 0:e.svfUrn)||""}isNodeExists(e){let t;const i=this.getInstanceTree();if(i)i.enumNodeChildren(e,(function(e){i.enumNodeFragments(e,(function(){t=!0}))}),!0);else{var n;null!==(n=this.getFragmentList().fragments.dbId2fragId)&&void 0!==n&&n[e]&&(t=!0)}return!!t}getModelKey(){const e=this.getDocumentNode();return e?e.getModelKey():this.getData().urn}dtor(){super.dtor(),this.#o()}#o(){const e=this.getInstanceTree();null==e||e.dtor(),this.myData=null,this.topology=null,this.topologyPromise=null}setFragmentBoundingBoxes(e,t){const i=this.getFragmentList().fragments,n=i.boxes,r=e.length/t;for(let i=0,o=0,s=0;i<r;i++,o+=t,s+=6)n[s+0]=e[o+0],n[s+1]=e[o+1],n[s+2]=e[o+2],n[s+3]=e[o+3],n[s+4]=e[o+4],n[s+5]=e[o+5];i.boxesLoaded=!0,this.visibleBoundsDirty=!0,this.fireEvent({type:Autodesk.Viewing.MODEL_FRAGMENT_BOUNDING_BOXES_SET_EVENT,model:this})}}},73674:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelLayers:()=>s});var n=i(83081),r=i(19556),o={name:"root",id:"root",isLayer:!1,children:[],childCount:0};function s(e){this.viewer=e,this.matman=e.matman(),this.model=null,this.root=null,this.initialized=!1,this.layerToIndex={},this.indexToLayer=[null],this.nodeToLayer=[]}var a=s.prototype;function l(e,t){var i=e.model,n=e.indexToLayer;if(i.is2d()){if(!i.getData().layerCount)return;var r=[];for(var o in e.layerToIndex)r.push(e.layerToIndex[o]);e.matman.setLayerVisible(r,t,i.id),e.viewer.invalidate(!0)}else{var s=[],a=t?e.viewer.visibilityManager.show:e.viewer.visibilityManager.hide;c(e,(function(e,r){n[r].visible!==t&&(s.push(e),1024===s.length&&(a(s,i),s.length=0))})),s.length>0&&a(s,i)}for(var l=n.length,h=1;h<l;++h){var u=n[h];u&&(u.visible=t)}}function c(e,t){var i=e.nodeToLayer;if(i&&i.length){var n=e.model.getData().instanceTree.nodeAccess;for(var r in n.dbIdToIndex){var o=i[n.dbIdToIndex[r]]||0;0!==o&&t(0|r,o)}}}function h(e,t){return"number"==typeof t?t:e.layerToIndex[t.name||t]||0}function u(e){return!e.layer.isLayer}function d(e,t){for(var i=0;i<e.length;++i){var n=e[i];t(n),n.children&&d(n.children,t)}}a.addModel=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.initialized&&(e.is2d()||!t)){var i=function(t){if(t){var i=this.model.getData().instanceTree;t.children=t.children||[];var r=function(e){if(!e)return[];var t=[],i=0;d(e,(e=>{t.push(e),e.isLayer&&(i=Math.max(i,0|e.index))}));for(var n=0;n<t.length;++n)t[n].isLayer||(t[n].index=++i);return t}(t.children);t.childCount=r.length,this.indexToLayer=new Array(t.childCount+1),this.indexToLayer[0]=null;for(var o=0;o<t.childCount;++o){var s=r[o],a=null==s.visible||s.visible;this.layerToIndex[s.name]=s.index,this.indexToLayer[s.index]={layer:s,visible:a}}if(!this.model.is2d()&&0!==t.childCount){this.nodeToLayer=t.childCount<=256?new Uint8Array(i.nodeAccess.getNumNodes()):new Uint16Array(i.nodeAccess.getNumNodes());var l=function(e){if(this.model){var t=this.model.getData().instanceTree;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i))for(var n=this.layerToIndex[i],r=e[i],o=0,s=r.length;o<s;++o){var a=t.nodeAccess.getIndex(r[o]);this.nodeToLayer[a]=n}}}.bind(this),c=function(){n.logger.warn("ModelLayers error: coudn't get layers from property database.")}.bind(this);e.getLayerToNodeIdMapping(l,c)}}}.bind(this),s=function(t){var i;this.root=t,this.initialized=!0;!this.activateLayerState("Initial")&&null!==(i=this.model)&&void 0!==i&&i.is2d()&&this.indexToLayer.forEach((e=>{e&&!e.visible&&this.setLayerVisible(e.layer,!1)})),this.viewer.api.dispatchEvent({type:r.MODEL_LAYERS_LOADED_EVENT,model:e,root:t})}.bind(this);this.model=e,(e.is2d()?function(e){var t=e.getData(),i=o;t&&t.layersRoot&&(i=t.layersRoot);return Promise.resolve(i)}(e):function(e){if(e.getData().loadOptions.skipPropertyDb)return Promise.resolve(null);var t=e.getPropertyDb();if(!t||e.getData().loadOptions.disable3DModelLayers)return Promise.resolve(o);return t.findLayers()}(e)).then((function(e){i(e),s(e)})).catch((function(e){n.logger.warn(e),s(o)}))}},a.removeModel=function(e){this.model===e&&(this.model=null,this.root=null,this.initialized=!1,this.layerToIndex={},this.indexToLayer=[null],this.nodeToLayer=[])},a.getRoot=function(){return this.initialized||n.logger.warn("Autodesk.Viewing.ModelLayers.getRoot couldn't peform action, layers are still being loaded"),this.root},a.showAllLayers=function(){this.initialized?l(this,!0):n.logger.warn("Autodesk.Viewing.ModelLayers.showAllLayers couldn't peform action, layers are still being loaded")},a.hideAllLayers=function(){this.initialized?l(this,!1):n.logger.warn("Autodesk.Viewing.ModelLayers.hideAllLayers couldn't peform action, layers are still being loaded")},a.isLayerVisible=function(e){if(!this.initialized)return n.logger.warn("Autodesk.Viewing.ModelLayers.isLayerVisible couldn't peform action, layers are still being loaded"),!1;let t=h(this,e);const i=this.indexToLayer[t];if(u(i)){const e=i.layer.children;for(var r=0;r<e.length;++r){let t=e[r].index;if(this.indexToLayer[t].visible)return!0}return!1}return i.visible},a.setLayerVisible=function(e,t){if(!this.initialized)return void n.logger.warn("Autodesk.Viewing.ModelLayers.setLayersVisible couldn't peform action, layers are still being loaded");var i=(e=Array.isArray(e)?e:[e]).map(function(e){return h(this,e)}.bind(this));const r=i.length;for(var o=0;o<r;++o){let e=i[o],t=this.indexToLayer[e];if(u(t)){t.layer.children.forEach((e=>{i.push(e.index)}))}}var s=this.model,a=this.indexToLayer;if(s.is2d())this.matman.setLayerVisible(i,t,s.id),this.viewer.invalidate(!0);else{var l=a.map((function(e){return!(null!==e&&-1!==i.indexOf(e.layer.index)&&e.visible!==t)})),d=[],f=t?this.viewer.visibilityManager.show:this.viewer.visibilityManager.hide;c(this,(function(e,t){l[t]||(d.push(e),1024===d.length&&(f(d,s),d.length=0))})),d.length>0&&f(d,s)}var p=i.length;for(let e=0;e<p;++e){const n=this.indexToLayer[i[e]];n&&(n.visible=t)}},a.getVisibleLayerIndices=function(){if(!this.initialized)return n.logger.warn("Autodesk.Viewing.ModelLayers.getVisibleLayerIndices couldn't peform action, layers are still being loaded"),[];for(var e=[],t=this.indexToLayer,i=t.length,r=1;r<i;++r){var o=t[r];o&&o.visible&&!u(o)&&e.push(o.layer.index)}return e},a.allLayersVisible=function(){if(!this.initialized)return!0;for(var e=this.indexToLayer,t=e.length,i=1;i<t;++i){var n=e[i];if(n&&!n.visible)return!1}return!0},a.activateLayerState=function(e){if(!this.initialized)return n.logger.warn("Autodesk.Viewing.ModelLayers.activateLayerState couldn't peform action, layers are still being loaded"),!1;if(!this.model||this.model.is3d()||!e)return!1;var t=this.model.getData().metadata,i=null==t?void 0:t.layer_states;if(!i)return!1;let r;for(r=0;r<i.length&&i[r].name!==e;r++);if(r>=i.length)return!1;var o=i[r].visible_layers,s={};if(o&&0<o.length)for(var a=0;a<o.length;a++)s[o[a]]=1;var l=[],c=[];for(var h in t.layers){var u=t.layers[h].name;h|=0,1===s[u]?l.push(h):c.push(h)}return this.setLayerVisible(l,!0),this.setLayerVisible(c,!1),!0},a.getLayerStates=function(){function e(e,t){var i=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(i.length!==n.length)return!1;for(var r=0;r<i.length;++r){var o=i[r];if(e[o]!==t[o])return!1}return!0}if(!this.initialized)return n.logger.warn("Autodesk.Viewing.ModelLayers.getLayerStates couldn't peform action, layers are still being loaded"),null;var t,i=this.model,r=i?i.getData().metadata:null,o=r?r.layers:null,s=r?r.layer_states:null;if(this.model.is3d()||!o||!s)return null;var a={},l={};for(var c in o)if(Object.prototype.hasOwnProperty.call(o,c)){var h=parseInt(c),u=o[c];a[t="string"==typeof u?u:u.name]=!0,this.isLayerVisible(h)&&(l[t]=!0)}for(var d=[],f=0;f<s.length;++f){var p=s[f],m=p.visible_layers,g={};if(!p.hidden){if(m&&0<m.length)for(var v=0;v<m.length;++v)t=m[v],Object.prototype.hasOwnProperty.call(a,t)&&(g[t]=!0);d.push({name:p.name,description:p.description,active:e(l,g)})}}return 0<d.length?d:null}},67259:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelMemoryTracker:()=>u,estimateMemUsage:()=>h});var n=i(57872);function r(e){return e&&e.byteLength||0}function o(e){return r(e.boxes)+r(e.transforms)+r(e.fragId2dbId)+r(e.geomDataIndexes)+r(e.materials)}function s(e){return r(e.geomids)+r(e.materialids)+r(e.vizflags)+(e.boxes!==e.fragments.boxes?r(e.boxes):0)+(e.transforms!==e.fragments.transforms?r(e.transforms):0)}function a(e){return r(e.nodes.nodesRaw?e.nodes.nodesRaw:e.nodes)+r(e.primitives)}var l=!1;function c(e){for(var t,i=Autodesk.Viewing.Private,n=0,c=0;c<e.length;c++){var h=e[c],u=h.getData();if(u){var d=h.getConsolidation();if(d&&(n+=d.byteSize),h.isLeaflet())l||(console.warn("Memory tracking not implemented for leaflets."),l=!0);else{if(!u.isOTG)n+=h.getGeometryList().geomMemory;var f=u.fragments;f&&(n+=o(f));var p=h.getFragmentList();p&&(n+=s(p));var m=u.bvh;m&&(n+=a(m));var g=u.instanceTree;g&&(n+=(t=void 0,r((t=g.nodeAccess).children)+r(t.nameSuffixes)+r(t.names)+r(t.nodeBoxes)+r(t.nodes)))}}}return isFinite(n)||i.logger.warn("Memory estimate result was not a number"),n}function h(e){var t=e.impl.geomCache(),i=t?t.byteSize:0,n=e.impl.modelQueue(),r=n.getModels(),o=n.getHiddenModels();return i+c(r)+c(o)}function u(e,t){var i=e,r=0,o=t;function s(e){var t;return e.lruTimestamp===r||(null===(t=e.getData())||void 0===t?void 0:t.loadOptions.keepHiddenModel)}this.updateModelTimestamps=function(e){r++;for(var t=0;t<e.length;t++){e[t].lruTimestamp=r}},this.memoryExceeded=function(){return h(i)>=this.getMemLimit()},this.getMemLimit=function(){return void 0!==o?o:n.MODEL_MEMORY_LIMIT},this.setMemLimit=function(e){o=e},this.cleanup=function(e){var t=e||i.impl.unloadModel.bind(i.impl);if(this.memoryExceeded()){for(var n=function(){for(var e=i.impl.modelQueue().getHiddenModels(),t=[],n=0;n<e.length;n++){var r=e[n];s(r)||t.push(r)}return t.sort((function(e,t){return e.lurTimestamp-t.lruTimestamp})),t}(),r=0;r<n.length;r++){var o=n[r];if((o.isConsolidated()||o.isConsolidating())&&(o.unconsolidate(!0),!this.memoryExceeded()))return}var a=i.impl.geomCache();for(r=0;r<n.length;r++)if(t(o=n[r]),a&&a.cleanup(),!this.memoryExceeded())return}}}},13002:(e,t,i)=>{"use strict";i.r(t),i.d(t,{OverlayManager:()=>n});class n{constructor(e){this.impl=e}dtor(){this.impl=null}addScene(e){return!!e&&(Object.prototype.hasOwnProperty.call(this.impl.overlayScenes,e)||this.impl.createOverlayScene(e),!0)}removeScene(e){return!!e&&(this.impl.removeOverlayScene(e),!0)}clearScene(e){this.impl.clearOverlay(e)}hasScene(e){return!!e&&Object.prototype.hasOwnProperty.call(this.impl.overlayScenes,e)}setSceneHiddenFromMainRender(e,t){this.impl.overlayScenes[e].hiddenFromMainRender=t}addMesh(e,t){return!!(e&&t&&Object.prototype.hasOwnProperty.call(this.impl.overlayScenes,t))&&(e=Array.isArray(e)?e:[e],this.impl.addMultipleOverlays(t,e),!0)}removeMesh(e,t){return!!(e&&t&&Object.prototype.hasOwnProperty.call(this.impl.overlayScenes,t))&&(e=Array.isArray(e)?e:[e],this.impl.removeMultipleOverlays(t,e),!0)}hasMesh(e,t){var i=this.impl.overlayScenes[t];if(!i)return!1;var n=i.scene.children;for(let t=0,i=n.length;t<i;++t)if(n[t]===e)return!0;return!1}}},35922:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Prefs:()=>o,Prefs2D:()=>r,Prefs3D:()=>n,VIEW_TYPES:()=>s});const n={VIEW_CUBE:"viewCube",VIEW_CUBE_COMPASS:"viewCubeCompass",VIEW_TYPE:"viewType",ALWAYS_USE_PIVOT:"alwaysUsePivot",ZOOM_TOWARDS_PIVOT:"zoomTowardsPivot",SELECTION_SETS_PIVOT:"selectionSetsPivot",REVERSE_HORIZONTAL_LOOK_DIRECTION:"reverseHorizontalLookDirection",REVERSE_VERTICAL_LOOK_DIRECTION:"reverseVerticalLookDirection",ORBIT_PAST_WORLD_POLES:"orbitPastWorldPoles",CLICK_TO_SET_COI:"clickToSetCOI",GHOSTING:"ghosting",OPTIMIZE_NAVIGATION:"optimizeNavigation",AMBIENT_SHADOWS:"ambientShadows",ANTIALIASING:"antialiasing",GROUND_SHADOW:"groundShadow",GROUND_REFLECTION:"groundReflection",LINE_RENDERING:"lineRendering",EDGE_RENDERING:"edgeRendering",LIGHT_PRESET:"lightPreset",ENV_MAP_BACKGROUND:"envMapBackground",FIRST_PERSON_TOOL_POPUP:"firstPersonToolPopup",BIM_WALK_TOOL_POPUP:"bimWalkToolPopup",BIM_WALK_NAVIGATOR_TYPE:"bimWalkNavigatorType",BIM_WALK_GRAVITY:"bimWalkGravity",DEFAULT_NAVIGATION_TOOL_3D:"defaultNavigationTool3D",SELECTION_MODE:"selectionMode",ENABLE_CUSTOM_ORBIT_TOOL_CURSOR:"enableCustomOrbitToolCursor",EXPLODE_STRATEGY:"explodeStrategy",FORCE_DOUBLE_SIDED:"forceDoubleSided",DISPLAY_SECTION_HATCHES:"displaySectionHatches",LARGE_MODEL_EXPERIENCE:"largeModelExperienceBeta",OUT_OF_CORE_GPU_MEMORY_MANAGEMENT:"outOfCoreGpuMemoryManagementBeta"},r={GRAYSCALE:"grayscale",SWAP_BLACK_AND_WHITE:"swapBlackAndWhite",LOADING_ANIMATION:"loadingAnimation",FORCE_PDF_CALIBRATION:"forcePDFCalibration",FORCE_LEAFLET_CALIBRATION:"forceLeafletCalibration",DISABLE_PDF_HIGHLIGHT:"disablePdfHighlight",USE_PDF_VIEWPORT_INFO:"usePdfViewportInfo",VECTOR_VIEWING:"vectorViewing"},o={WEBGPU:"webgpu",PROGRESSIVE_RENDERING:"progressiveRendering",OPEN_PROPERTIES_ON_SELECT:"openPropertiesOnSelect",POINT_RENDERING:"pointRendering",BACKGROUND_COLOR_PRESET:"backgroundColorPreset",REVERSE_MOUSE_ZOOM_DIR:"reverseMouseZoomDir",LEFT_HANDED_MOUSE_SETUP:"leftHandedMouseSetup",FUSION_ORBIT:"fusionOrbit",FUSION_ORBIT_CONSTRAINED:"fusionOrbitConstrained",WHEEL_SETS_PIVOT:"wheelSetsPivot",RESTORE_SESSION_MEASUREMENTS:"restoreMeasurements",DISPLAY_UNITS:"displayUnits",DISPLAY_UNITS_PRECISION:"displayUnitsPrecision",KEY_MAP_CMD:"keyMapCmd",ZOOM_DRAG_SPEED:"zoomDragSpeed",ZOOM_SCROLL_SPEED:"zoomScrollSpeed"},s={DEFAULT:0,ORTHOGRAPHIC:1,PERSPECTIVE:2,PERSPECTIVE_ORTHO_FACES:3}},61183:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Preferences:()=>l});var n=i(19556),r=i(83081),o=i(26206),s=i(26477),a=i(94661);class l{constructor(e){this.options={},this.storageCache={},"string"==typeof e&&(this.options={prefix:e}),this.options={...e},this.options.prefix||(this.options.prefix="Autodesk.Viewing.Preferences."),Object.prototype.hasOwnProperty.call(this.options,"localStorage")||(this.options.localStorage=!0),this.defaults={},this.callbacks={},this.tags={},this.useLocalStorage=this.options.localStorage&&a.LocalStorage.isSupported();return new Proxy(this,{get:function(e,t){return t in e?e[t]:e.storageCache[t]}})}setWebStorageKey(e){this.storageKey=e}_getPrefixedStorageKey(e,t){return t??this.hasTag(e,"shared-storage")?"___Shared":this.getLocalStoragePrefix()+this.storageKey}webStorage(e,t,i){if(this.useLocalStorage){if(this.hasTag(e,"no-storage"))return;const n=this._getPrefixedStorageKey(e,i);let o=a.LocalStorage.getItem(n);if(o=JSON.parse(o||"{}"),void 0!==t)t instanceof s.EnumType&&(t=t.toString()),o[e]=t,a.LocalStorage.setItem(n,JSON.stringify(o));else if(void 0!==(t=o[e]))try{"__enum"===(t=JSON.parse(t)).type&&(t=s.EnumType.deSerialize(t))}catch(e){r.logger.log("Preferences: Cannot deserialize value ="+t),t=void 0}return t}}getPrefFromLocalStorage(e){return this.webStorage(e)}setPrefInLocalStorage(e,t){return this.webStorage(e,t)}addPref(e,t,i){if("string"!=typeof e||"function"==typeof this.storageCache[e])return void r.logger.log("Preferences: invalid name="+e);t instanceof s.EnumType&&(t=t.clone()),this.tags[e]={},i&&(this.tags[e]["shared-storage"]=!0);const n=this.webStorage(e);this.storageCache[e]=void 0!==n?n:t}load(e){for(var t in this.defaults=e,this.defaults)Object.prototype.hasOwnProperty.call(this.defaults,t)&&this.addPref(t,this.defaults[t])}addTags(e,t){if(!t||!e)return!1;t=Array.isArray(t)?t:[t];for(var i=0;i<t.length;++i)this.tag(t[i],e);return!0}tag(e,t){if(e){t?Array.isArray(t)||(t=[t]):t=Object.keys(this.defaults);for(var i=0;i<t.length;++i)this.tags[t[i]]&&(this.tags[t[i]][e]=!0)}}untag(e,t){if(e){t?Array.isArray(t)||(t=[t]):t=Object.keys(this.defaults);for(var i=0;i<t.length;++i)this.tags[t[i]]&&(this.tags[t[i]][e]=!1)}}hasTag(e,t){var i=this.tags[e];return!!i&&!0===i[t]}add(e,t,i,o){return!Object.prototype.hasOwnProperty.call(this.defaults,e)||o?(this.setDefault(e,t),this.addPref(e,t,null==i?void 0:i.includes("shared-storage")),this.addTags(e,i),o&&this.dispatchEvent(e,n.PREF_CHANGED_EVENT),!0):(r.logger.log("Preferences: "+e+" already exists"),!1)}setDefault(e,t){e&&null!=t&&(t instanceof s.EnumType?this.defaults[e]=t.clone():this.defaults[e]=t)}remove(e,t){return!!Object.prototype.hasOwnProperty.call(this.defaults,e)&&(delete this.defaults[e],delete this.tags[e],this.storageCache&&delete this.storageCache[e],t&&this.deleteFromWebStorage(e),!0)}deleteFromWebStorage(e){if(this.useLocalStorage){const t=this._getPrefixedStorageKey(e);let i=a.LocalStorage.getItem(t);i=JSON.parse(i||"{}"),delete i[e],a.LocalStorage.setItem(t,JSON.stringify(i))}}clearWebStorage(){const e=this.getLocalStoragePrefix();if(this.useLocalStorage)for(let t of a.LocalStorage.getAllKeys())-1!==t.indexOf(e)&&a.LocalStorage.removeItem(t)}reset(e,t){for(var i in e&&void 0===t&&(t=!0),this.defaults)if(Object.prototype.hasOwnProperty.call(this.defaults,i)){if(e){var r=!!this.tags[i][e];if(t&&!r||!t&&r)continue}this.set(i,this.defaults[i],!1)&&this.dispatchEvent(i,n.PREF_RESET_EVENT),this.deleteFromWebStorage(i)}}getLocalStoragePrefix(){return this.options.prefix}get(e){return this.storageCache[e]instanceof s.EnumType?this.storageCache[e].value:this.storageCache[e]}set(e,t,i){const r=t instanceof s.EnumType?t.value:t;function o(e,t){const i=e=>"object"==typeof e?JSON.stringify(e):e;return i(e)===i(t)}if(!o(this.get(e),r)){this.storageCache[e]instanceof s.EnumType?this.storageCache[e].value=r:t instanceof s.EnumType?this.storageCache[e]=t.clone():this.storageCache[e]=r;const a=this.defaults[e]instanceof s.EnumType?this.defaults[e].value:this.defaults[e];return o(this.get(e),a)?this.deleteFromWebStorage(e):this.webStorage(e,this.storageCache[e]),(void 0===i||i)&&this.dispatchEvent(e,n.PREF_CHANGED_EVENT),!0}return!1}dispatchEvent(e,t){}addListeners(e,t,i){this.callbacks[e]||(this.callbacks[e]=[]),i||(i=t),this.callbacks[e].push({changed:t,reset:i})}removeListeners(e,t,i){if(void 0!==this.callbacks[e])if(t||i){i||(i=t);for(let n=0;n<this.callbacks[e].length;++n)if(this.callbacks[e][n].changed===t&&this.callbacks[e][n].reset===i){this.callbacks[e].splice(n,1);break}}else delete this.callbacks[e]}clearListeners(){this.callbacks={}}setUseLocalStorage(e){this.useLocalStorage=!!e}}o.GlobalManagerMixin.call(l.prototype)},11743:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Profile:()=>o});var n=i(35922),r=i(94661);function o(e){if(!e)return;const t=Autodesk.Viewing,i=t.ProfileSettings.Default;let o=[];if(this.name=Object.prototype.hasOwnProperty.call(e,"name")?e.name:"Custom",this.label=e.label,this.description=e.description,this.storageVersion="2.0",this.persistent=Array.isArray(e.persistent)?e.persistent:i.persistent,this.sharedStorage=Array.isArray(e.sharedStorage)?e.sharedStorage:i.sharedStorage,this.settings=Object.assign({},i.settings),Object.prototype.hasOwnProperty.call(e,"settings")){const t=e.settings;o=Object.keys(t),this.settings=Object.assign(this.settings,t)}let s=[],a=[];if(Object.prototype.hasOwnProperty.call(e,"extensions")){const t=e.extensions.load,i=e.extensions.unload;s=t?t.slice():s,a=i?i.slice():a}this.extensions={load:s,unload:a},this.apply=function(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return!1;const s=e.getLocalStoragePrefix()+"StorageVersion",a="Autodesk.Viewing.ProfileName";!e.useLocalStorage||r.LocalStorage.getItem(s)||!r.LocalStorage.getItem(a)||(()=>{const t={},i=r.LocalStorage.getItem(a),n=e.getLocalStoragePrefix();for(let e of r.LocalStorage.getAllKeys())if(-1!==e.indexOf(n))try{t[e.split(".").pop()]=JSON.parse(r.LocalStorage.getItem(e)),r.LocalStorage.removeItem(e)}catch{console.log(`Cound't convert preference to new format: ${e}`)}r.LocalStorage.setItem(n+i,JSON.stringify(t)),r.LocalStorage.removeItem(a)})();const l=e.getLocalStoragePrefix()+"StorageVersion";r.LocalStorage.setItem(l,this.storageVersion);const c=e.getLocalStoragePrefix()+"CurrentProfile";r.LocalStorage.setItem(c,this.name),e.setWebStorageKey(this.name);const h=this.settings,u=[t.ProfileSettings.Default.name,t.ProfileSettings.AEC.name],d=Object.values(n.Prefs3D),f=Object.values(n.Prefs2D);for(let t in h)if(Object.prototype.hasOwnProperty.call(h,t)){var p,m,g;const n=h[t],r=-1!==o.indexOf(t)&&-1===u.indexOf(this.name)?["ignore-producer"]:[];-1!==d.indexOf(t)?r.push("3d"):-1!==f.indexOf(t)?r.push("2d"):(r.push("2d"),r.push("3d"));let s=(null===(p=this.sharedStorage)||void 0===p||null===(m=(g=p).indexOf)||void 0===m?void 0:m.call(g,t))>=0;s&&r.push("shared-storage"),-1!==this.persistent.indexOf(t)||s||r.push("no-storage");const a=e.webStorage(t,void 0,s),l=e.get(t);if(void 0!==a){a!=l&&(e.add(t,a,r,!0),e.setDefault(t,n));continue}if(void 0!==l){e.addTags(t,r),l!==n&&i&&e.set(t,n);continue}e.add(t,n,r,!0)}return!0}}},53625:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ProfileManager:()=>o});var n=i(83081),r=i(11743);class o{constructor(){this.registered={};const e=Autodesk.Viewing.ProfileSettings;this.PROFILE_DEFAULT=new r.Profile(e.Default),this.registerProfile("default",this.PROFILE_DEFAULT),this.PROFILE_AEC=new r.Profile(e.AEC),this.registerProfile("rvt",this.PROFILE_AEC),this.registerProfile("ifc",this.PROFILE_AEC),this.PROFILE_NAVIS=new r.Profile(e.Navis),this.registerProfile("nwc",this.PROFILE_NAVIS),this.registerProfile("nwd",this.PROFILE_NAVIS),this.PROFILE_FLUENT=new r.Profile(e.Fluent),this.registerProfile("fluent",this.PROFILE_FLUENT)}registerProfile(e,t){t?(e=e||"default",this.registered[e]=t instanceof r.Profile?t:new r.Profile(t)):n.logger.log("ProfileManager: missing profileSettings when registering a profile.")}unregisterProfile(e){e?delete this.registered[e]:n.logger.log("ProfileManager: missing fileExt when unregistering a profile.")}getProfiles(){return Object.assign({},this.registered)}getProfileOrDefault(e){if(!e)return n.logger.log("ProfileManager: missing fileExt for getProfile. Returning the default Profile."),this.registered.default;const t=this.registered[e];return t||(n.logger.log(`ProfileManager: No profile registered for ${e}. Returning the default Profile.`),this.registered.default)}}},26477:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DefaultSettings:()=>u,EnumType:()=>c,ProfileSettings:()=>v});var n=i(35922),r=i(83081),o=i(63430),s=i(55280),a=i(97005),l=i(13202);class c{constructor(e,t){if(!Array.isArray(e)||0===e.length)throw new Error(`Invalid ${e}`);this.values=new Set(e),this.current=e.includes(t)?t:e[0]}get value(){return this.current}set value(e){this.values.has(e)&&(this.current=e)}clone(){return c.deSerialize(JSON.parse(this.toString()))}toString(){return JSON.stringify({type:"__enum",values:Array.from(this.values),current:this.current})}static deSerialize(e){if("__enum"===e.type)return new c(e.values,e.current)}}const h={};h[n.Prefs3D.AMBIENT_SHADOWS]=!0,h[n.Prefs3D.ANTIALIASING]=!(0,s.isMobileDevice)(),h[n.Prefs3D.GROUND_SHADOW]=!0,h[n.Prefs3D.GROUND_REFLECTION]=!1,h[n.Prefs3D.GHOSTING]=!0,h[n.Prefs3D.VIEW_CUBE]=!(0,s.isMobileDevice)(),h[n.Prefs3D.VIEW_CUBE_COMPASS]=!1,h[n.Prefs3D.VIEW_TYPE]=n.VIEW_TYPES.DEFAULT,h[n.Prefs3D.LINE_RENDERING]=!0,h[n.Prefs3D.LIGHT_PRESET]=a.DefaultLightPreset,h[n.Prefs3D.EDGE_RENDERING]=!1,h[n.Prefs3D.REVERSE_HORIZONTAL_LOOK_DIRECTION]=!1,h[n.Prefs3D.REVERSE_VERTICAL_LOOK_DIRECTION]=!1,h[n.Prefs3D.ALWAYS_USE_PIVOT]=!1,h[n.Prefs3D.ZOOM_TOWARDS_PIVOT]=!1,h[n.Prefs3D.ORBIT_PAST_WORLD_POLES]=!0,h[n.Prefs3D.CLICK_TO_SET_COI]=!1,h[n.Prefs3D.OPTIMIZE_NAVIGATION]=(0,s.isMobileDevice)(),h[n.Prefs3D.ENV_MAP_BACKGROUND]=!1,h[n.Prefs3D.FIRST_PERSON_TOOL_POPUP]=!0,h[n.Prefs3D.BIM_WALK_TOOL_POPUP]=!0,h[n.Prefs3D.BIM_WALK_NAVIGATOR_TYPE]="default",h[n.Prefs3D.BIM_WALK_GRAVITY]=!0,h[n.Prefs3D.DEFAULT_NAVIGATION_TOOL_3D]="default",h[n.Prefs3D.SELECTION_MODE]=o.SelectionMode.LEAF_OBJECT,h[n.Prefs3D.ENABLE_CUSTOM_ORBIT_TOOL_CURSOR]=!0,h[n.Prefs3D.EXPLODE_STRATEGY]="hierarchy",h[n.Prefs3D.SELECTION_SETS_PIVOT]=!1,h[n.Prefs3D.FORCE_DOUBLE_SIDED]=!1,h[n.Prefs3D.DISPLAY_SECTION_HATCHES]=!0,h[n.Prefs3D.LARGE_MODEL_EXPERIENCE]=!1,h[n.Prefs3D.OUT_OF_CORE_GPU_MEMORY_MANAGEMENT]=!1,h[n.Prefs2D.GRAYSCALE]=!1,h[n.Prefs2D.SWAP_BLACK_AND_WHITE]=!1,h[n.Prefs2D.LOADING_ANIMATION]=!1,h[n.Prefs2D.FORCE_PDF_CALIBRATION]=!1,h[n.Prefs2D.FORCE_LEAFLET_CALIBRATION]=!0,h[n.Prefs2D.DISABLE_PDF_HIGHLIGHT]=!1,h[n.Prefs2D.USE_PDF_VIEWPORT_INFO]=!1,h[n.Prefs2D.VECTOR_VIEWING]=!0,h[n.Prefs.WEBGPU]=!1,h[n.Prefs.PROGRESSIVE_RENDERING]=!0,h[n.Prefs.OPEN_PROPERTIES_ON_SELECT]=!1,h[n.Prefs.POINT_RENDERING]=!0,h[n.Prefs.BACKGROUND_COLOR_PRESET]=null,h[n.Prefs.REVERSE_MOUSE_ZOOM_DIR]=!1,h[n.Prefs.LEFT_HANDED_MOUSE_SETUP]=!1,h[n.Prefs.FUSION_ORBIT]=!0,h[n.Prefs.FUSION_ORBIT_CONSTRAINED]=!0,h[n.Prefs.WHEEL_SETS_PIVOT]=!1,h[n.Prefs.RESTORE_SESSION_MEASUREMENTS]=!0,h[n.Prefs.DISPLAY_UNITS]=new c(l.displayUnitsEnum),h[n.Prefs.DISPLAY_UNITS_PRECISION]=new c(l.displayUnitsPrecisionEnum),h[n.Prefs.KEY_MAP_CMD]=!0;const u=h,d={name:"Default",label:"Manufacturing (Default)",description:"Default Viewer settings"};d.settings=h,d.persistent=[n.Prefs3D.ALWAYS_USE_PIVOT,n.Prefs3D.ZOOM_TOWARDS_PIVOT,n.Prefs3D.REVERSE_HORIZONTAL_LOOK_DIRECTION,n.Prefs3D.REVERSE_VERTICAL_LOOK_DIRECTION,n.Prefs3D.ORBIT_PAST_WORLD_POLES,n.Prefs3D.CLICK_TO_SET_COI,n.Prefs3D.GHOSTING,n.Prefs3D.OPTIMIZE_NAVIGATION,n.Prefs3D.AMBIENT_SHADOWS,n.Prefs3D.ANTIALIASING,n.Prefs3D.GROUND_SHADOW,n.Prefs3D.GROUND_REFLECTION,n.Prefs3D.FIRST_PERSON_TOOL_POPUP,n.Prefs3D.BIM_WALK_TOOL_POPUP,n.Prefs3D.BIM_WALK_GRAVITY,n.Prefs3D.VIEW_TYPE,n.Prefs3D.SELECTION_MODE,n.Prefs2D.SWAP_BLACK_AND_WHITE,n.Prefs2D.VECTOR_VIEWING,n.Prefs2D.LOADING_ANIMATION,n.Prefs.OPEN_PROPERTIES_ON_SELECT,n.Prefs.REVERSE_MOUSE_ZOOM_DIR,n.Prefs.LEFT_HANDED_MOUSE_SETUP,n.Prefs.WHEEL_SETS_PIVOT,n.Prefs.KEY_MAP_CMD,n.Prefs.DISPLAY_UNITS,n.Prefs.DISPLAY_UNITS_PRECISION],d.sharedStorage=[n.Prefs3D.LARGE_MODEL_EXPERIENCE,n.Prefs3D.OUT_OF_CORE_GPU_MEMORY_MANAGEMENT,n.Prefs.WEBGPU],d.extensions={load:[],unload:[]};const f=g(d);f.name="AEC",f.label="Construction (AEC)",f.description="A common set of preferences designed for the Construction industry",f.settings[n.Prefs.REVERSE_MOUSE_ZOOM_DIR]=!0,f.settings[n.Prefs2D.VECTOR_VIEWING]=!0,f.settings[n.Prefs3D.EDGE_RENDERING]=!(0,s.isMobileDevice)(),f.settings[n.Prefs3D.LIGHT_PRESET]=(0,s.getGlobal)().DefaultLightPresetAec||"Boardwalk",f.settings[n.Prefs3D.ENV_MAP_BACKGROUND]=!0,f.settings[n.Prefs3D.VIEW_CUBE_COMPASS]=!0,f.settings[n.Prefs3D.SELECTION_SETS_PIVOT]=!0,f.extensions={load:[],unload:[]};const p=g(f);p.name="Fluent",p.label="Design Collaboration",p.description="User experience that matches Design Collaboration",p.settings[n.Prefs.WHEEL_SETS_PIVOT]=!0,p.settings[n.Prefs.RESTORE_SESSION_MEASUREMENTS]=!1,p.settings[n.Prefs2D.FORCE_PDF_CALIBRATION]=!0,p.settings[n.Prefs3D.ALWAYS_USE_PIVOT]=!0,p.settings[n.Prefs3D.ENABLE_CUSTOM_ORBIT_TOOL_CURSOR]=!1,p.extensions={load:[],unload:[]},p.persistent.splice(p.persistent.indexOf(n.Prefs3D.VIEW_TYPE),1);const m=g(f);function g(e){var t;e||(r.logger.log("ProfileSettings.clone: missing profileSettings, using DefaultProfileSettings..."),e=d);const i={};return i.settings=Object.assign({},e.settings),i.extensions={},Object.prototype.hasOwnProperty.call(e,"extensions")?(i.extensions.load=Object.prototype.hasOwnProperty.call(e.extensions,"load")?e.extensions.load.slice():[],i.extensions.unload=Object.prototype.hasOwnProperty.call(e.extensions,"unload")?e.extensions.unload.slice():[]):i.extensions={load:[],unload:[]},i.persistent=e.persistent.slice(),i.sharedStorage=null===(t=e.sharedStorage)||void 0===t?void 0:t.slice(),i}m.name="Navis",m.label="Navisworks",m.description="Provides a user experience similar to Autodesk Navisworks desktop application",m.settings[n.Prefs3D.BIM_WALK_TOOL_POPUP]=!1,m.settings[n.Prefs3D.BIM_WALK_NAVIGATOR_TYPE]="aec",m.settings[n.Prefs3D.DEFAULT_NAVIGATION_TOOL_3D]="extractor_defined";const v={Default:d,AEC:f,Fluent:p,Navis:m,clone:g}},28441:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ProgressState:()=>n});let n={ROOT_LOADED:0,LOADING:1,RENDERING:2,OPTIMIZING:3}},33398:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PropertySet:()=>r});var n=i(8022);class r{constructor(e){this.map=e}forEach(e){if(e)for(let t in this.map){if("__selected_dbIds__"===t)continue;e(t,this.map[t])}}getAggregation(e){if(!e)return null;if("string"==typeof e&&(e=this.map[e]),0===e.length)return null;const t=e[0].type;if(!(0,n.hA)(t))return null;const i={average:0,count:0,max:0,median:0,min:0,mode:[],range:0,sum:0},r=e.map((e=>Number(e.displayValue)));r.sort(((e,t)=>e-t));const o={};let s=0,a=0;r.forEach((e=>{a+=e,Object.prototype.hasOwnProperty.call(o,e)?o[e]++:o[e]=1,s=Math.max(s,o[e]),i.sum+=e})),i.count=r.length,i.average=a/i.count,i.max=r[i.count-1],i.min=r[0];const l=Math.ceil(i.count/2);i.median=i.count%2&&i.count>1?(r[l]+r[l-1])/2:r[l-1];for(let e in o)o[e]===s&&i.mode.push(Number(e));return i.range=i.max-i.min,i.sum=function(e,t){var i=t.displayValue.toString().split(".");if(1===i.length)return e;const n=e.toString().split(".");if(1===n.length)return e;const r=n[1];let o=i[1];if(r===o)return e;o=o.match(/\d+/);const s=o&&o[0]&&o[0].length||t.precision||0;return Number(e.toFixed(s))}(i.sum,e[0]),i}getValue2PropertiesMap(e){if(!e)return null;if("string"==typeof e&&(e=this.map[e]),!e||0===e.length)return null;const t={};return e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e.displayValue)||(t[e.displayValue]=[]),t[e.displayValue].push(e.parentName)})),t}getValidIds(e,t){const i=Object.keys(this.map),n=[];for(let r=0;r<i.length;r++){const o=i[r];if(e){if(-1!==o.indexOf(e)){n.push(o);continue}}if(t){const e=o.split("/");if(e.length>=2&&e[0]===t){n.push(o);continue}}}return n}getDbIds(){return this.map.__selected_dbIds__}getVisibleKeys(){const e=[];return this.forEach(((t,i)=>{i[0].hidden||e.push(t)})),e}getKeysWithCategories(){const e=[];return this.forEach(((t,i)=>{const n=!!i[0].hidden;i[0].displayCategory&&!n&&e.push(t)})),e}merge(e){if(!(e instanceof r))return this;const t=e.map;for(let e in t){const i=t[e];if(!Object.prototype.hasOwnProperty.call(this.map,e)){this.map[e]=i;continue}const n=this.map[e];if("__selected_dbIds__"!==e)for(let e=0;e<i.length;e++){const t=i[e];let r=!0;for(let e=0;e<n.length;e++){const i=n[e];t.displayValue!==i.displayValue||t.dbId!==i.dbId||(r=!1)}r&&n.push(t)}else this.map[e]=[...n,...i]}return this}}},92037:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AppScreenModeDelegate:()=>u,ApplicationScreenModeDelegate:()=>d,NullScreenModeDelegate:()=>f,ScreenMode:()=>c,ScreenModeDelegate:()=>h,ScreenModeMixin:()=>p});var n=i(55280),r=i(19556),o=i(83081),s=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","MSFullscreenChange"];function a(e,t){for(var i=0;i<s.length;++i)t.addDocumentEventListener(s[i],e,!1)}function l(e,t){for(var i=0;i<s.length;++i)t.removeDocumentEventListener(s[i],e,!1)}const c={kNormal:0,kFullBrowser:1,kFullScreen:2};function h(e){this.viewer=e,this.bindFullscreenEventListener=this.fullscreenEventListener.bind(this),this.getMode()===c.kFullScreen&&a(this.bindFullscreenEventListener,this.viewer.globalManager)}function u(e){h.call(this,e)}h.prototype.uninitialize=function(){l(this.bindFullscreenEventListener,this.viewer.globalManager),this.viewer=null},h.prototype.isModeSupported=function(e){return!0},h.prototype.setMode=function(e){var t=this.getMode();return!(e===t||!this.isModeSupported(e))&&(this.doScreenModeChange(t,e),this.onScreenModeChanged(t,e),!0)},h.prototype.getMode=function(){throw"Implement getMode() in derived class"},h.prototype.getNextMode=function(){var e,t=this.getMode(),i=c;return t===i.kNormal&&this.isModeSupported(i.kFullBrowser)?e=i.kFullBrowser:t===i.kNormal&&this.isModeSupported(i.kFullScreen)||t===i.kFullBrowser&&this.isModeSupported(i.kFullScreen)?e=i.kFullScreen:t===i.kFullBrowser&&this.isModeSupported(i.kNormal)||t===i.kFullScreen&&this.isModeSupported(i.kNormal)?e=i.kNormal:t===i.kFullScreen&&this.isModeSupported(i.kFullBrowser)&&(e=i.kFullBrowser),e},h.prototype.getEscapeMode=function(){return this.getMode()!==c.kNormal?c.kNormal:void 0},h.prototype.fullscreenEventListener=function(){var e=this.viewer.globalManager.getDocument();(0,n.inFullscreen)(e)?this.viewer.resize():(this.doScreenModeChange(c.kFullScreen,c.kNormal),this.onScreenModeChanged(c.kFullScreen,c.kNormal))},h.prototype.doScreenModeChange=function(e,t){throw"Implement doScreenModeChange() in derived class"},h.prototype.onScreenModeChanged=function(e,t){e===c.kFullScreen?l(this.bindFullscreenEventListener,this.viewer.globalManager):t===c.kFullScreen&&a(this.bindFullscreenEventListener,this.viewer.globalManager),this.viewer.resize(),this.viewer.dispatchEvent({type:r.FULLSCREEN_MODE_EVENT,mode:t})},u.prototype=Object.create(h.prototype),u.prototype.constructor=u,u.prototype.isModeSupported=function(e){return e!==c.kFullBrowser},u.prototype.getMode=function(){var e=this.viewer.globalManager.getDocument();return(0,n.inFullscreen)(e)?c.kFullScreen:c.kNormal},u.prototype.doScreenModeChange=function(e,t){var i=this.viewer.container;if(t===c.kNormal){i.classList.remove("viewer-fill-browser");var r=this.viewer.globalManager.getDocument();(0,n.exitFullscreen)(r)}else t===c.kFullScreen&&(i.classList.add("viewer-fill-browser"),(0,n.launchFullscreen)(i))};let d=u;function f(e){h.call(this,e)}function p(){}f.prototype=Object.create(h.prototype),f.prototype.constructor=h,f.prototype.isModeSupported=function(){return!1},f.prototype.getMode=function(){return c.kNormal},p.prototype={setScreenModeDelegate:function(e){this.screenModeDelegate&&(this.screenModeDelegate.uninitialize(),this.screenModeDelegate=null),this.screenModeDelegateClass=e||(null===e?f:u)},getScreenModeDelegate:function(){return this.screenModeDelegate||(this.screenModeDelegate=new this.screenModeDelegateClass(this)),this.screenModeDelegate},isScreenModeSupported:function(e){return this.getScreenModeDelegate().isModeSupported(e)},canChangeScreenMode:function(){return this.isScreenModeSupported(Autodesk.Viewing.ScreenMode.kNormal)},setScreenMode:function(e){var t={category:"screen_mode",value:e};return o.logger.track(t),this.getScreenModeDelegate().setMode(e)},getScreenMode:function(){return this.getScreenModeDelegate().getMode()},nextScreenMode:function(){var e=this.getScreenModeDelegate().getNextMode();return void 0!==e&&this.setScreenMode(e)},escapeScreenMode:function(){var e=this.getScreenModeDelegate().getEscapeMode();return void 0!==e&&this.setScreenMode(e)},apply:function(e){var t=p.prototype;e.setScreenModeDelegate=t.setScreenModeDelegate,e.getScreenModeDelegate=t.getScreenModeDelegate,e.isScreenModeSupported=t.isScreenModeSupported,e.canChangeScreenMode=t.canChangeScreenMode,e.setScreenMode=t.setScreenMode,e.getScreenMode=t.getScreenMode,e.nextScreenMode=t.nextScreenMode,e.escapeScreenMode=t.escapeScreenMode}}},18817:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ScreenShot:()=>x});var n=i(57872),r=i(4897),o=i(88190),s=i(55280),a=i(8879),l=i(68747),c=i(12153),h=i(24528),u=i(72091),d=i(19556),f=i(71211);const p=(e,t,i,d,p)=>{let m=p.getMaterials(),g=p.glrenderer(),v=p.renderer(),y=p.modelQueue(),b=[],x=(d=d||{}).models||y.getModels();for(let e=0;e<x.length;e++){let t=x[e].getIterator();if(!t||!t.getGeomScenes)continue;let i=t.getGeomScenes();for(let e=0;e<i.length;e++){let t=i[e];t&&b.push(t)}}let _=d.camera||p.camera;_===p.camera&&(_=_.clone()),_.isUnifiedCamera&&_.updateCameraMatrices(),_.clientWidth=e,_.clientHeight=t;const E=new r.FrustumIntersector,S=d.excludeCutPlanes?[]:m.getCutPlanes(),A=!d.excludeCutplanes&&m.cutplanesHideInterior>0;let w,T;E.reset(_,S,A),E.areaCullThreshold=n.PIXEL_CULLING_THRESHOLD,g.pushViewport(),g.setPixelRatio(1),d.renderContext?w=d.renderContext:(w=new o.RenderContext,w.init(g,e,t,{offscreen:!0})),p.isSheetRendererNeeded()&&(T=d.sheetRenderer?d.sheetRenderer:new f.A(p,w,g,m)),m.addOverrideMaterial("normalsMaterial_screenshot",w.getDepthMaterial()),m.addOverrideMaterial("edgeMaterial_screenshot",w.getEdgeMaterial());let M=d.renderConfig||v.getConfig();w.applyConfig(M),w.beginScene(p.scene,_,p.noLights,!0),g.popViewport(),g.setPixelRatio();let C,P=0,D={stop:()=>{C&&((0,s.getGlobal)().clearTimeout(C),R())},finished:()=>!!C},L=-1,I=[];for(let e=0;e<x.length;e++){let t=x[e];if(t.isLeaflet()){let e=t.getIterator();I.push({iter:e,viewId:e.registerView(),ready:!1})}}const R=()=>{I.forEach((e=>e.iter.unregisterView(e.viewId))),I.length=0};let O=d.fragOptions,N=O?[]:void 0;const F=e=>{if(!(!!O&&e instanceof a.RenderBatch))return;let t=e.frags;e.forEachNoMesh((function(e,i){N[i]=t.vizflags[e];let n=O.isFragOff&&O.isFragOff(e);void 0!==n&&t.setFlagFragment(e,l.MeshFlags.MESH_HIDE,n);let r=O.isFragVisible&&O.isFragVisible(e);void 0!==r&&t.setFlagFragment(e,l.MeshFlags.MESH_VISIBLE,r)}))},U=e=>{if(!(!!O&&e instanceof a.RenderBatch))return;let t=e.frags;e.forEachNoMesh((function(e,i){let n=N[i],r=!!(n&l.MeshFlags.MESH_HIDE),o=!!(n&l.MeshFlags.MESH_VISIBLE);t.setFlagFragment(e,l.MeshFlags.MESH_HIDE,r),t.setFlagFragment(e,l.MeshFlags.MESH_VISIBLE,o)}))},B=(()=>{let e;if(d.models){e=new u.Box3;for(let t=0;t<x.length;t++){let i=x[t];e.union(i.getBoundingBox())}}else e=p.getVisibleBounds();let t=Object.prototype.hasOwnProperty.call(d,"is2d")?d.is2d:p.is2d,i=w.settings.deviceHeight,n=d.excludeCutPlanes?void 0:m.getCutPlanesRaw(),r=n&&n[0],o=x[0]&&x[0].getBoundingBox();return c.SceneMath.getPixelsPerUnit(_,t,e,i,r,o)})();let k=[],V=null;const G=e=>{d.excludeThemingColors&&e instanceof a.RenderBatch&&(e.frags.is2d||(V=e.frags.db2ThemingColor,e.frags.db2ThemingColor=k))},z=e=>{V&&(e.frags.db2ThemingColor=V,V=null)};let H=new u.Vector4(0,0,-1,-1e20),W=[],j=null;const q=()=>{if(!(()=>{let e=!0;for(let t=0;t<I.length;t++){let i=I[t];i.ready||(i.ready=i.iter.reset(E,_,i.viewId)),e=e&&i.ready}if(e=e||d.dontWaitForLeafletTiles,e)for(let e=0;e<I.length;e++){let t=I[e],i=t.iter.getScene(t.viewId);b.push(i)}return e})())return void(C=(0,s.getGlobal)().setTimeout(q,0));let n=performance.now();g.pushViewport(),g.setPixelRatio(1),g.setViewport(0,0,e,t);let r=p.getPixelsPerUnit(p.camera,p.getVisibleBounds());var o,l;(m.updatePixelScale(B,e,t,_),d.excludeCutPlanes)?(()=>{j=m.getCutPlanes();let e=j.length;if(W.length!==e){W.length=e;for(let t=0;t<e;t++)W[t]=H}v.toggleTwoSided(m.setCutPlanes(W))})():null===(o=(l=p.api).syncCutPlanes)||void 0===o||o.call(l);for(d.beforeRender&&d.beforeRender();P<b.length;){let e=b[P];const t=x.find((t=>{var i;return t.id===(null===(i=e.frags)||void 0===i?void 0:i.modelId)}));if(null!=t&&t.is2d()){const e=t.getModelToViewerTransform(),i=e?e.getMaxScaleOnAxis():1;if(!p.is2d||1!==i){const e=t.getVisibleBounds(),n=w.settings.deviceWidth,r=w.settings.deviceHeight,o=c.SceneMath.getPixelsPerUnit(_,!0,e,r,null,e);m.updatePixelScaleForModel(t,o,n,r,i,_)}}if(F(e),G(e),e instanceof a.RenderBatch&&e.applyVisibility(h.RenderFlags.RENDER_NORMAL,E),T&&e.frags.is2d?T.renderScenePart(e,!0,!0,!1,w):(w.renderScenePart(e,!0,!0,!1,!1),(e.frags&&!e.frags.areAllVisible()&&p.showGhosting||O)&&(e instanceof a.RenderBatch&&e.applyVisibility(h.RenderFlags.RENDER_HIDDEN,E),v.setEdgeColor(p.edgeColorGhosted),e.overrideMaterial=p.fadeMaterial,w.renderScenePart(e,!0,!0,!1,!1),v.setEdgeColor(p.edgeColorMain),e.overrideMaterial=null)),z(e),U(e),P++,performance.now()-n>20)break}if(g.popViewport(),g.setPixelRatio(),m.updatePixelScale(r,v.settings.deviceWidth,v.settings.deviceHeight,_),d.excludeCutPlanes&&v.toggleTwoSided(m.setCutPlanes(j)),d.afterRender&&d.afterRender(),P===b.length?(()=>{R();let e=w.getColorTarget();if(M.aoEnabled||M.antialias)M.aoEnabled&&w.computeSSAO(),e=w.getNamedTarget("overlay"),w.getBlendPass().uniforms.tOverlay.value=null,w.setOffscreenTarget(e),w.presentBuffer();else{let e=p.lightsOn?p.lights:p.no_lights;if(d.overlayScenes){const t=d.overlayScenes??p.overlayScenes;w.renderOverlays(t,e)}}if(d.returnAsTarget){const t=d.extraTargets?d.extraTargets.map((e=>w.getNamedTarget(e))):void 0;return void i(w,e,_,T,t)}var t;d.sheetRenderer||(null===(t=T)||void 0===t||t.destroy(),T=null),w.targetToCanvas(e).canvas.toBlob((function(e){let t=(0,s.getGlobal)().URL.createObjectURL(e);i&&(i(t),d.renderContext||w.cleanup())}))})():C=(0,s.getGlobal)().setTimeout(q,0),d.onProgress){let e=Math.floor(100*P/b.length);e!==L&&(L=e,d.onProgress(e))}};return q(),D},m=(e,t,i,n,r)=>{var{fullPage:o,bounds:a,getCropBounds:l,margin:c,overlayRenderer:h,overlayRendererExtraOptions:d}=r;o&&(a=e.impl.getVisibleBounds());const f=e.impl.getCanvasBoundingClientRect().width;let m=e.navigation.getCamera();a&&(m=b(e,a,c));const y=g(e,m);try{if(o){const e=y.getSize(new u.Vector3),n=f/Math.max(e.x,e.y);t=Math.floor(t*n),i=Math.floor(i*n)}const r=r=>{if(o){const e=t/f;y.min.x*=e,y.min.y*=e,y.max.x*=e,y.max.y*=e,v(r,y,n)}else if(l){const t=l(e,m,a);v(r,t,n)}else r.toBlob((e=>{const r=(0,s.getGlobal)().URL.createObjectURL(e);n(r,t,i)}))},c=e.impl.selector.getSelection();return e.clearSelection(),p(t,i,((n,o,s)=>{if(e.impl.selector.setSelection(c),h){h(e,{width:t,height:i,ctx:n,target:o,screenshotCamera:s,onRenderDone:r},d)}else{const{canvas:e}=n.targetToCanvas(o);r(e)}}),{returnAsTarget:!0,camera:m},e.impl)}catch(e){console.error("getScreenShot error: "+e),n(null)}},g=(e,t)=>{const i=e.impl.getVisibleBounds(void 0,void 0,void 0,!0),n=e.worldToClient(i.min,t),r=e.worldToClient(i.max,t);return(new u.Box3).setFromPoints([n,r])},v=(e,t,i)=>{const n=(0,s.getGlobal)().document.createElement("canvas"),r=n.getContext("2d"),o=t.getSize(new u.Vector3),a=Math.min(Math.floor(o.x),e.width),l=Math.min(Math.floor(o.y),e.height);n.width=a,n.height=l;const c=Math.max(Math.floor(t.min.x),0),h=Math.max(Math.floor(t.min.y),0),d=a,f=l;r.drawImage(e,c,h,d,f,0,0,a,l),n.toBlob((e=>{var t=(0,s.getGlobal)().URL.createObjectURL(e);i(t,a,l)}),"image/png")},y=(e,t,i,n)=>{const r=(0,s.getGlobal)().document.createElement("canvas"),o=r.getContext("2d"),a=new Image;r.width=t,r.height=i,a.src=e,a.onload=function(){o.drawImage(a,0,0,t,i);const e=r.toDataURL("image/png");n(e)}},b=(e,t,i)=>{i=i||e.navigation.FIT_TO_VIEW_HORIZONTAL_MARGIN;const n={horizontal:e.navigation.FIT_TO_VIEW_HORIZONTAL_MARGIN,vertical:e.navigation.FIT_TO_VIEW_VERTICAL_MARGIN};e.navigation.FIT_TO_VIEW_HORIZONTAL_MARGIN=i,e.navigation.FIT_TO_VIEW_VERTICAL_MARGIN=i;const r=e.getState({viewport:!0});e.navigation.fitBounds(!0,t,!1,!0);const o=e.navigation.getCamera().clone();return e.restoreState(r,void 0,!0),e.navigation.FIT_TO_VIEW_HORIZONTAL_MARGIN=n.horizontal,e.navigation.FIT_TO_VIEW_VERTICAL_MARGIN=n.vertical,e.impl.updateNearFarValues(o,t),o};let x={getScreenShotLegacy:function(e,t,i,n,r){var o=e.impl,a=o.renderer(),l=a.settings.logicalWidth,c=a.settings.logicalHeight,h=o.progressiveRender,f=o.glrenderer().getPixelRatio();t&&i||(t=l,i=c),o.progressiveRender=!1,o.resize(t/f,i/f,!0),o.tick(performance.now());var p=new u.WebGLRenderTarget(t,i,{minFilter:u.LinearFilter,magFilter:u.LinearFilter,format:u.RGBFormat,type:u.UnsignedByteType});const m=a.getOffscreenTarget();function g(){var e=a.targetToCanvas(p||a.getColorTarget());function t(){o.progressiveRender=h,o.resize(l,c,!0),e.canvas.toBlob((function(e){var t=(0,s.getGlobal)().URL.createObjectURL(e);n?n(t):(0,s.getGlobal)().open(t)}),"image/png")}p&&(p.dispose(),p=void 0,o.glrenderer().setRenderTarget(null)),r?r(e.ctx,t):t()}if(a.setOffscreenTarget(p),a.presentBuffer(),a.setOffscreenTarget(m),e.model.isLeaflet()){var v=!1;const t=function(){v=!0,o.progressiveRender=h,o.resize(l,c,!0),p&&p.dispose()};e.addEventListener(d.CANCEL_LEAFLET_SCREENSHOT,t,{once:!0}),o.invalidate(!0),e.model.getIterator().callWhenRefined((function(){v||(e.removeEventListener(d.CANCEL_LEAFLET_SCREENSHOT,t),g())}))}else g()},getScreenShot:p,getScreenShotWithBounds:m,getScreenShotAtScreenSize:(e,t,i)=>{const n=e.impl.getCanvasBoundingClientRect(),r=Math.floor(n.width),o=Math.floor(n.height);m(e,r,o,((e,i,n)=>{e?y(e,i,n,(e=>{t(e,i,n)})):t(null)}),i)},getSceneClientBounds:g,cropImage:v,blobToImage:y,makeBoundsSquare:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=e.getSize(new u.Vector3),n=Math.max(i.x,i.y,t);e.expandByVector(new u.Vector3((n-i.x)/2,(n-i.y)/2,0))},getCameraWithFitBounds:b}},82976:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Thumbnails:()=>l});var n=i(94661),r=i(8412),o=i(84045),s=i(55280),a=i(11653);let l={getUrlForBubbleNode:function(e,t){if(!e)return Promise.reject(new Error("Missing instance of BubbleNode"));var i=e.findParentGeom2Dor3D();if(!i)return Promise.reject(new Error("No thumbnail available."));const l=(t=t||{}).size||200,c=e.getRootNode();return(c.data.isVectorPDF||i.data.isVectorPDF)&&c.data.getPDF?new Promise((t=>{let i=e.data,r=c.data.getPDF(),o=l,a=l,h=`${i.guid}/thumbnail/${o}x${a}`;!function(e,t,i,r,o,a){var l=n.LocalStorage.getItem(o);l?a(l):e.getPage(t).then((e=>{var t=(0,s.getGlobal)().document.createElement("canvas");t.width=i,t.height=r;var l=t.getContext("2d"),c={scale:1},h=e.getViewport(c),u=Math.min(t.width/h.width,t.height/h.height);e.render({canvasContext:l,viewport:e.getViewport({scale:u})}).promise.then((()=>{e.cleanup(),t.toBlob((e=>{var t=new FileReader;t.readAsDataURL(e),t.onloadend=function(){n.LocalStorage.setItem(o,t.result),a(t.result)}}),"image/png")}))}))}(r,i.page,o,a,h,t)})):new Promise(((t,i)=>{var n={urn:c.urn(),width:l,height:l,guid:encodeURIComponent(e.guid()),acmsession:r.endpoint.getAcmSession()},h={responseType:"blob",skipAssetCallback:!0,size:l,guid:n.guid,acmsession:n.acmSession};let u="urn:"+n.urn;e.data.thumbnailUrn&&(u=c.getDocument().getFullPath(e.data.thumbnailUrn));var d=void 0;if(!(0,s.getGlobal)().USE_OTG_DS_PROXY){var f=(0,r.getEnv)();d=a.EnvironmentConfigurations[f].UPSTREAM;const e=(0,a.getUpstreamApiData)(f,r.endpoint.getApiFlavor());h.apiData=e}o.ViewingService.getThumbnail((0,r.initLoadContext)({endpoint:d}),u,(e=>{var i=new FileReader;i.onload=e=>{var i=e.target.result;t(i)},i.readAsDataURL(e)}),(()=>{i(new Error("Thumbnail is unavailable."))}),h)}))}}},91735:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Viewer3D:()=>ee,waitForCompleteLoad:()=>te});var n=i(72091),r=i(55280),o=i(83081),s=i(11743),a=i(35922),l=i(26477),c=i(13202),h=i(53625),u=i(8600),d=i(57872),f=i(57480),p=i(25004),m=i(24840),g=i(92037),v=i(55270),y=i(75109),b=i(17016),x=i(83464),_=i(40723),E=i(68793),S=i(55855),A=i(38842),w=i(19556),T=i(54393),M=i(13e3),C=i(21174),P=i(23261),D=i(43719),L=i(55066),I=i(99211),R=i(32431),O=i(49930),N=i(26206);const F=416,U=1e3;class B{constructor(e){this.viewer=e,this.setGlobalManager(this.viewer.globalManager),this.domElement=null,this._step=this._step.bind(this),this._maskId="mask"+Date.now()}createDom(e){const t=this.getDocument();this.domElement=t.createElement("div"),this.domElement.className="forge-spinner",this._initTransform="translate(-50%, -50%) scale(0.5)",this.domElement.style.transform=this._initTransform.slice();var i=this._createSvgElement("svg");i.setAttribute("width","242"),i.setAttribute("height","242"),i.setAttribute("viewBox","0 0 72 72"),i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.domElement.appendChild(i);var n=this._createWheelPointData(10,72,6.75);this._createMask(n);var r=this._createSvgElement("polygon");r.setAttribute("mask",`url(#${this._maskId})`),i.appendChild(r),this._addPoints(n.outerPoints,r),this._createSegments(n);var o=t.createElement("img");return o.src=Autodesk.Viewing.Private.getResourceUrl("res/ui/powered-by-autodesk-blk-rgb.png"),this._onResize=this._onResize.bind(this),o.onload=()=>{this._onResize(),this._initResize=!0,this.viewer.addEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT,this._onResize)},this.domElement.appendChild(o),e&&e.appendChild(this.domElement),this.domElement.style.display="none",this.domElement}_createSvgElement(e){return this.getDocument().createElementNS("http://www.w3.org/2000/svg",e)}_getSvg(){return null==this?void 0:this.domElement.getElementsByTagNameNS("http://www.w3.org/2000/svg","svg")[0]}_createMask(e){const t=this._getSvg(),i=this._createSvgElement("defs"),n=this._createSvgElement("mask");n.id=this._maskId,i.appendChild(n),t.appendChild(i);const r=this._createSvgElement("polygon");r.style.opacity=.15,r.style.fill="#FFF",n.appendChild(r),this._addPoints(e.outerPoints,r);const o=this._createSvgElement("polygon");n.appendChild(o),this._addPoints(e.innerPoints,o)}_step(e){this.startTime||(this.startTime=e);const t=(e-this.startTime)%U;this._setSegmentOpacities(t);const i=this.getWindow();this._animId=i.requestAnimationFrame(this._step)}_stop(){if(this._animId){this.getWindow().cancelAnimationFrame(this._animId),this._animId=null}}_setSegmentOpacities(e){this.segments.forEach(((t,i)=>{const n=Math.abs(i-this.segments.length)-1;t.style.opacity=this._getSegmentOpacity(n,e)}))}_getSegmentOpacity(e,t){const i=e*(U/this.segments.length);return i+F>U&&t<F?-1*((t+U-i)/F-1):t<i||t>i+F?0:Math.abs((t-i)/F-1)}_getSegments(){return Array.from(this.domElement.querySelectorAll(".segment"))}_addPoints(e,t){for(let i of e){const e=this._getSvg().createSVGPoint();e.x=i[0],e.y=i[1],t.points.appendItem(e)}}_createWheelPointData(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;const n=t/2,r=t/2,o=t/2,s={outerPoints:[],innerPoints:[]};for(let t=1;t<=e;t++)s.outerPoints.push([r+n*Math.cos(2*t*Math.PI/e),o+n*Math.sin(2*t*Math.PI/e)]),s.innerPoints.push([r+(n-i)*Math.cos(2*t*Math.PI/e),o+(n-i)*Math.sin(2*t*Math.PI/e)]);return s}_createSegments(e){const{outerPoints:t,innerPoints:i}=e,n=this._getSvg(),r=(e,t)=>{var i=this._createSvgElement("polygon");i.classList.add("segment"),i.classList.add(t),this._addPoints(e,i),n.appendChild(i)};for(let e=t.length-1;e>=0;--e){let n=t[e],o=t[e-1],s=i[e],a=i[e-1];0===e&&(o=t[t.length-1],a=i[t.length-1]),r([n,o,s],"light-blue"),r([s,a,o],"dark-blue")}}_fadeOut(){let e=1;const t=setInterval((()=>{var i;null!==(i=this.domElement)&&void 0!==i&&i.style?(e<=.1&&(clearInterval(t),this.domElement.style.display="none"),this.domElement.style.opacity=e,e-=.1*e):clearInterval(t)}),1)}show(){this.domElement&&(this.domElement.style.display="block",this.domElement.style.opacity=1,this.segments=this._getSegments(),this._step(1))}hide(){if(this.domElement){this._hide=e=>{this._stop(),e.model.is3d()?this._fadeOut():(this.domElement.style.opacity=0,this.domElement.style.display="none")};var e=this.viewer.impl.modelQueue().getModels();0===e.length?this.viewer.addEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT,this._hide,{once:!0}):this._hide({model:e[0]})}}destroy(){var e;this._stop(),null!==(e=this.domElement)&&void 0!==e&&e.parentElement&&this.domElement.parentElement.removeChild(this.domElement),this.domElement=null,this.viewer.removeEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT,this._onResize)}_onResize(){var e;if(this._initResize)return void(this._initResize=!1);const t=this.domElement;if(!t)return;if("none"==t.style.display)return;const i=t.parentElement;if(!i)return;const n=i.getBoundingClientRect(),r=t.getBoundingClientRect(),o=Math.max(r.width/n.width,(r.height+350)/n.height),s=null===(e=this.domElement)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.transform;if(s)if(o>.8){const e=/[-+]?scale\(\d*\.\d+|\d+\)/,t=e.exec(s);if(t.length>0){const i=t[0].split("scale(")[1],n=Number((i/o).toFixed(4)),r=s.replace(e,`scale(${n}`);r!=this.domElement.style.transform&&n<=.5&&n>.2&&(this.domElement.style.transform=r)}}else this.domElement.style.transform!=this._initTransform&&(this.domElement.style.transform=this._initTransform)}}N.GlobalManagerMixin.call(B.prototype);class k{constructor(){this.domElement=null}createDom(e){var t=this.getDocument(),i=t.createElement("div");i.className="spinner",e&&e.appendChild(i);for(var n=1;n<=3;n++){var r=t.createElement("div");r.className="bounce"+n,i.appendChild(r)}return this.domElement=i,this.hide(),i}show(){this.domElement&&(this.domElement.style.display="block")}hide(){this.domElement&&(this.domElement.style.display="None")}destroy(){this.domElement=null}}N.GlobalManagerMixin.call(k.prototype);var V=i(12153),G=i(18817);const z=Object.freeze({pdf:"Autodesk.PDF",scalaris:"Autodesk.Scalaris",dwf:"Autodesk.DWF",dwfx:"Autodesk.DWF",rcp:"Autodesk.ReCap",gltf:"Autodesk.glTF",glb:"Autodesk.glTF"});var H=i(13002),W=i(8811),j=i(97005),q=i(1979),X=i(85403),Y=i(8412);var K=i(61183);class Q extends K.Preferences{constructor(e,t){super(t),this.viewer=e,this.setGlobalManager(e.globalManager),e.addEventListener(w.PREF_CHANGED_EVENT,(e=>{var t=this.callbacks[e.name];t&&t.forEach((t=>{var i=t.changed;i&&"function"==typeof i&&i(e.value)}))})),e.addEventListener(w.PREF_RESET_EVENT,(e=>{var t=this.callbacks[e.name];t&&t.forEach((t=>{var i=t.reset;i&&"function"==typeof i&&i(e.value)}))}));const i={[a.Prefs3D.VIEW_CUBE]:function(t){e.getExtension("Autodesk.ViewCubeUi",(function(e){e.displayViewCube(t)}))},[a.Prefs3D.ALWAYS_USE_PIVOT]:e.setUsePivotAlways.bind(e),[a.Prefs3D.ORBIT_PAST_WORLD_POLES]:e.setOrbitPastWorldPoles.bind(e),[a.Prefs3D.ZOOM_TOWARDS_PIVOT]:e.setZoomTowardsPivot.bind(e),[a.Prefs.REVERSE_MOUSE_ZOOM_DIR]:e.setReverseZoomDirection.bind(e),[a.Prefs.LEFT_HANDED_MOUSE_SETUP]:e.setUseLeftHandedInput.bind(e),[a.Prefs3D.CLICK_TO_SET_COI]:e.setClickToSetCOI.bind(e),[a.Prefs.ZOOM_DRAG_SPEED]:function(t){var i;const n=e.toolController.getTool("dolly");null==n||null===(i=n.setDollyDragScale)||void 0===i||i.call(n,t)},[a.Prefs.ZOOM_SCROLL_SPEED]:t=>{var i;const n=e.toolController.getTool("dolly");null==n||null===(i=n.setDollyScrollScale)||void 0===i||i.call(n,t)},[a.Prefs3D.ANTIALIASING]:t=>e.setQualityLevel(this.get("ambientShadows"),t),[a.Prefs3D.AMBIENT_SHADOWS]:t=>e.setQualityLevel(t,e.prefs.get("antialiasing")),[a.Prefs3D.GROUND_SHADOW]:e.setGroundShadow.bind(e),[a.Prefs3D.GROUND_REFLECTION]:e.setGroundReflection.bind(e),[a.Prefs2D.SWAP_BLACK_AND_WHITE]:e.setSwapBlackAndWhite.bind(e),[a.Prefs3D.OPTIMIZE_NAVIGATION]:e.setOptimizeNavigation.bind(e),[a.Prefs.PROGRESSIVE_RENDERING]:e.setProgressiveRendering.bind(e),[a.Prefs.GHOSTING]:e.setGhosting.bind(e),[a.Prefs3D.LINE_RENDERING]:t=>e.hideLines(!t),[a.Prefs.POINT_RENDERING]:t=>e.hidePoints(!t),[a.Prefs3D.EDGE_RENDERING]:e.setDisplayEdges.bind(e),[a.Prefs3D.ENV_MAP_BACKGROUND]:e.setEnvMapBackground.bind(e),[a.Prefs3D.LIGHT_PRESET]:e.setLightPreset.bind(e)};Object.keys(i).forEach((e=>{this.addListeners(e,i[e])}))}dispatchEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w.PREF_CHANGED_EVENT;const i=this.get(e);this.viewer.dispatchEvent({type:t,name:e,value:i})}}const Z=Autodesk.Viewing;var $=0;const J=["markups-svg","pushpin-container"];function ee(e,t){if(this.setGlobalManager(new W.GlobalManager),e){if(this.clientContainer=e,this.container=this.getDocument().createElement("div"),this.container.classList.add("adsk-viewing-viewer"),this.container.style.height="100%",this.container.style.width="100%",this.container.style.overflow="hidden",this.container.classList.add((0,r.isTouchDevice)()?"touch":"notouch"),this.clientContainer.appendChild(this.container),this.config=t||{},this.contextMenu=null,this.contextMenuCallbacks={},this.started=!1,this.theme=this.config.theme||"dark-theme",this.container.classList.add(this.theme),this.containerLayerOrder=this.config.containerLayerOrder||J,(0,r.isChrome)()&&this.container.classList.add("quality-text"),"CANVAS"===this.container.nodeName)throw"Viewer must be initialized on a div [temporary]";if(this.canvasWrap=this.getDocument().createElement("div"),this.canvasWrap.classList.add("canvas-wrap"),this.canvas=this.getDocument().createElement("canvas"),this.canvas.tabIndex=0,this.canvas.setAttribute("data-viewer-canvas","true"),this.canvasWrap.appendChild(this.canvas),this.container.appendChild(this.canvasWrap),!(0,r.isPhoneFormFactor)()&&!Z.Private.DISABLE_FORGE_LOGO&&!Z.Private.DISABLE_FORGE_CANVAS_LOGO){const e=this.getDocument();this._forgeLogo=e.createElement("div"),this._forgeLogo.classList.add("forge-logo-canvas");const t=e.createElement("img");t.src=Autodesk.Viewing.Private.getResourceUrl("res/ui/powered-by-autodesk-oneline-blk-rgb.png"),this._forgeLogo.appendChild(t),this._forgeLogo.style.display="none",this.container.appendChild(this._forgeLogo)}this.canvas.viewer=this}var i=t&&t.localStoragePrefix||"Autodesk.Viewing.Private.GuiViewer3D.SavedSettings.";i.endsWith(".")||(i+=".");var n={prefix:i,localStorage:!(0,r.isNodeJS)()};this._displayEdges=null,this._setDoubleSided=null,this.prefs=new Q(this,n),this.profile=null,this.profileManager=new h.ProfileManager,this._hotkeyManager=new y.HotkeyManager,this.extensionCache=null,this.running=!1,this._pushedTool="",this._defaultNavigationTool="",this.id=$++,this.impl=new L.Viewer3DImpl(this.canvas,this),this.overlays=new H.OverlayManager(this.impl),this._loadingSpinner=Z.Private.DISABLE_FORGE_LOGO?new k:new B(this),this._loadingSpinner.setGlobalManager(this.globalManager),this.trackADPTimer=[],this._curAvDocument=null,this._curManifest=null,this._curOptions=null,this._isPdfModelWithVectorAndRasterRepr=!1}function te(e,t){return new Promise(((i,n)=>{var r=0;function o(t){2===r&&i({viewer:e,model:t})}e.addEventListener(w.GEOMETRY_LOADED_EVENT,(function i(s){s.model.getData().loadOptions.bubbleNode===e._curOptions.bubbleNode&&(e.removeEventListener(w.GEOMETRY_LOADED_EVENT,i),r++,t.skipPropertyDb?o(s.model):s.model.getProperties(1,(()=>o(s.model)),(e=>n(e))))})),e.addEventListener(w.TEXTURES_LOADED_EVENT,(function t(i){i.model.getData().loadOptions.bubbleNode===e._curOptions.bubbleNode&&(e.removeEventListener(w.TEXTURES_LOADED_EVENT,t),r++,o(i.model))}))}))}p.EventDispatcher.prototype.apply(ee.prototype),g.ScreenModeMixin.prototype.apply(ee.prototype),v.ExtensionMixin.prototype.apply(ee.prototype),N.GlobalManagerMixin.call(ee.prototype),ee.prototype.constructor=ee,Object.defineProperty(ee.prototype,"model",{get:function(){var e;return null===(e=this.impl)||void 0===e?void 0:e.model},set:function(){throw"Do not set viewer.model"}}),ee.ViewerCount=0,ee.kDefaultCanvasConfig={click:{onObject:["selectOnly"],offObject:["deselectAll"]},clickAlt:{onObject:["setCOI"],offObject:["setCOI"]},clickCtrl:{onObject:["selectToggle"]},clickShift:{onObject:["selectToggle"]},disableSpinner:!1,disableMouseWheel:!1,disableTwoFingerSwipe:!1},Object.defineProperty(ee.prototype,"scene",{get:function(){return this.impl.scene},set:function(){throw"Do not set viewer.scene"}}),Object.defineProperty(ee.prototype,"sceneAfter",{get:function(){return this.impl.sceneAfter},set:function(){throw"Do not set viewer.sceneAfter"}}),ee.createHeadlessViewer=function(){var e=new ee;return e.impl.initialize(),e.impl.setLightPreset(0),e},ee._getDefaultBVHOptions=function(e){let t;return d.USE_HLOD?t={consolidation:{frags_per_leaf_node:65535,frags_per_inner_node:65535,frags_per_leaf_node_transparent:512,frags_per_inner_node_transparent:0,max_polys_per_node:3e6,max_size_ratio:6,sortFuncType:Z.Private.BVHSortFuncType.DIAMETER,per_tile_consolidation:!0,max_drawcalls_per_node:30,want_sort:!0},isWeakDevice:(0,r.isMobileDevice)()}:e.useConsolidation&&(t={},R.Consolidation.applyBVHDefaults(t)),t},ee.prototype.start=function(e,t,i,n,r){if(this.started)return 0;this.started=!0;var o=this,s=o.initialize(r);return 0!==s?(n&&setTimeout((function(){n(s)}),0),s):(setTimeout((function(){o.setUp(o.config)}),0),e&&this.loadModel(e,t,i,n),0)},ee.prototype.startWithDocumentNode=function(e,t,i){var n=this;return new Promise((function(r,o){if(n.started)return 0;n.started=!0;var s=n.initialize();0===s?(setTimeout((function(){n.setUp(n.config)}),0),n.loadDocumentNode(e,t,i).then(r).catch(o)):setTimeout((function(){o(s)}),0)}))},ee.prototype.registerUniversalHotkeys=function(){var e,t,i,n=this;e=function(){return n.navigation.setRequestFitToView(!0),X.analytics.track("viewer.fit_to_view",{from:"Keyboard"}),!0},n._hotkeyManager.pushHotkeys("Autodesk.FitToView",[{keycodes:[O.KeyCode.f],onPress:e}]),e=function(){return n.navigation.setRequestHomeView(!0),!0},n._hotkeyManager.pushHotkeys("Autodesk.Home",[{keycodes:[O.KeyCode.h],onPress:e},{keycodes:[O.KeyCode.HOME],onPress:e}]),t=function(){return n.objectContextMenu&&n.objectContextMenu.hide()||n.dispatchEvent({type:w.ESCAPE_EVENT}),!0},n._hotkeyManager.pushHotkeys("Autodesk.Escape",[{keycodes:[O.KeyCode.ESCAPE],onRelease:t}]),e=function(){return i=n.getActiveNavigationTool(),n.setActiveNavigationTool("pan")},t=function(){return n.setActiveNavigationTool(i)};var r=[{keycodes:[O.KeyCode.SHIFT],onPress:e,onRelease:t},{keycodes:[O.KeyCode.SPACE],onPress:e,onRelease:t}];n._hotkeyManager.pushHotkeys("Autodesk.Pan",r,{tryUntilSuccess:!0})},ee.prototype.createControls=function(){var e=this,t=e.impl;return e.navigation=new b.Navigation(t.camera),e.__initAutoCam(t),e.utilities=new _.ViewingUtilities(t,e.autocam,e.navigation),e.clickHandler=new E.DefaultHandler(t,e.navigation,e.utilities),e.toolController=new x.ToolController(t,e,e.autocam,e.utilities,e.clickHandler),e.toolController.registerTool(new S.GestureHandler(e)),e.toolController.registerTool(e._hotkeyManager),e.toolController.activateTool(e._hotkeyManager.getName()),e.registerUniversalHotkeys(),e.toolController.registerTool(new P.OrbitDollyPanTool(t,e,this.config.navToolsConfig),(e=>{e||this.setActiveNavigationTool()})),e.toolController.setModalityMap({section:{explode:!1,pan:!1,dolly:!1},explode:{section:!1,pan:!1,dolly:!1},measure:{"box-selection":!1},calibration:{"box-selection":!1},orbit:{},dolly:{},pan:{},fov:{},bimwalk:{},"box-selection":{measure:!1,calibration:!1}}),e.toolController},ee.prototype.initialize=function(e){this.setScreenModeDelegate(this.config?this.config.screenModeDelegate:void 0);var t=this.getDimensions();if(this.canvas.width=t.width,this.canvas.height=t.height,(0,r.isIOSDevice)()&&this.getWindow().devicePixelRatio&&(this.canvas.width/=this.getWindow().devicePixelRatio,this.canvas.height/=this.getWindow().devicePixelRatio),this.impl.initialize(e),!this.impl.glrenderer()){var i=function(){if(Z.getGlobal().WebGLRenderingContext){for(var e=Z.getGlobal().document.createElement("canvas"),t=["webgl","experimental-webgl","moz-webgl","webkit-3d"],i=!1,n=0;n<4;n++)try{if((i=e.getContext(t[n]))&&"function"==typeof i.getParameter)return 1}catch(e){}return 0}return-1}();if(i<=0)return-1===i?f.ErrorCodes.BROWSER_WEBGL_NOT_SUPPORTED:f.ErrorCodes.BROWSER_WEBGL_DISABLED}var n,o=this;(0,r.isIOSDevice)()?this.onResizeCallback=function(){clearTimeout(n),n=setTimeout(o.resize.bind(o),500)}:this.onResizeCallback=function(){var e=o.impl.camera.clientWidth,t=o.impl.camera.clientHeight,i=o.container.clientWidth,n=o.container.clientHeight;e===i&&t===n||o.resize()};this.addWindowEventListener("resize",this.onResizeCallback),this.onPixelRatioChanged=()=>{var e;if(null===(e=o.impl)||void 0===e||!e.glrenderer())return;const t=o.getWindow().devicePixelRatio;matchMedia(`(resolution: ${t}dppx)`).addEventListener("change",o.onPixelRatioChanged,{once:!0}),o.impl.glrenderer().setPixelRatio(t),o.resize()},this.onPixelRatioChanged(),this.onScrollCallback=function(){o.impl.canvasBoundingclientRectDirty=!0},this.addWindowEventListener("scroll",this.onScrollCallback),this.initContextMenu(),this.localize(),this.impl.controls=this.createControls(),this.initializePrefListeners(),this.setDefaultNavigationTool("orbit"),this.impl.controls&&this.impl.controls.setAutocam(this.autocam);var s=this.config&&this.config.canvasConfig?this.config.canvasConfig:ee.kDefaultCanvasConfig;this.setCanvasClickBehavior(s),s.disableSpinner||(this.loadSpinner=this._loadingSpinner.createDom(this.container)),this.viewerState=new C.ViewerState(this),this.config&&Object.prototype.hasOwnProperty.call(this.config,"startOnInitialize")&&!this.config.startOnInitialize||this.run();const a=Z.getGlobal();return a.NOP_VIEWER||(a.NOP_VIEWER=this),a.NOP_VIEWERS=a.NOP_VIEWERS||[],a.NOP_VIEWERS.push(this),this.addEventListener(w.MODEL_ADDED_EVENT,(function(e){o.onModelAdded(e.model,e.preserveTools)})),this.addEventListener(w.GEOMETRY_LOADED_EVENT,(function(e){var t;e.model.is2d()&&!e.model.isLeaflet()&&o.navigation.setMinimumLineWidth(null===(t=e.model.loader)||void 0===t||null===(t=t.svf)||void 0===t?void 0:t.minLineWidth);const i=e.model.getGeometryList();e.model.hasEdges=!1;for(let t=0;t<(null==i?void 0:i.getCount());t++){const n=i.getGeometry(t);if(n&&(n.isLine||n.iblines)){e.model.hasEdges=!0;break}}})),this.addEventListener(w.FRAGMENTS_LOADED_EVENT,(async function(e){(e.model.isConsolidated()||e.model.isConsolidating())&&(e.model.unconsolidate(!0,!0),await this.impl.consolidateModel(e.model)),this.impl.invalidate(!0,!0)})),this.addEventListener(w.FRAGMENTS_UNLOADED_EVENT,(async function(e){e.model.isConsolidated()||e.model.isConsolidating()?(e.model.unconsolidate(!0,!0),await this.impl.consolidateModel(e.model)):e.model.chooseMemoryTypes(),this.impl.invalidate(!0,!0)})),this.dispatchEvent(w.VIEWER_INITIALIZED),this.trackADPSettingsOptions(),this.trackADPExtensionsLoaded(),ee.ViewerCount++,0},ee.prototype.setUp=function(e){var t;if(this.config=e||{},this.config.extensions=this.config.extensions||[],Array.isArray(this.config.extensions))for(var i=this.config.extensions,n=0;n<i.length;++n)this.loadExtension(i[n],this.config);"fedramp"===(null===(t=this.config.region)||void 0===t?void 0:t.toLowerCase())||this.loadExtension("Autodesk.Viewing.MixpanelExtension"),"true"===(0,u.getParameterByName)("lmv_viewer_debug")&&this.loadExtension("Autodesk.Debug",this.config);var r=this.config.canvasConfig||ee.kDefaultCanvasConfig;this.setCanvasClickBehavior(r),this._onAggregatedSelectionChanged=this._onAggregatedSelectionChanged.bind(this),this.addEventListener(w.AGGREGATE_SELECTION_CHANGED_EVENT,this._onAggregatedSelectionChanged)},ee.prototype.tearDown=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.clearSelection(),this.removeEventListener(w.AGGREGATE_SELECTION_CHANGED_EVENT,this._onAggregatedSelectionChanged),this.loadedExtensions){for(var t in this.loadedExtensions)try{this.unloadExtension(t)}catch(e){o.logger.error("Failed to unload extension: "+t,e,(0,f.errorCodeString)(f.ErrorCodes.VIEWER_INTERNAL_ERROR)),o.logger.track({category:"error_unload_extension",extensionId:t,error_message:e.message,call_stack:e.stack})}this.loadedExtensions=null}for(this.toolController&&(this.toolController.enableMouseButtons(!1),this.toolController.deactivateTool("gestures")),o.logger.reportRuntimeStats(!0),this._loadingSpinner.show(),this.liveReviewClient&&(this.liveReviewClient.destroy(),this.liveReviewClient=null);this.trackADPTimer.length>0;)clearTimeout(this.trackADPTimer.pop());e&&this.impl.unloadCurrentModel(),this.impl.setCutPlaneSet("__set_view",void 0)},ee.prototype._onAggregatedSelectionChanged=function(){if(this.navigation.getSelectionSetsPivot()){const e=this.impl.selector.getAggregateSelection();if(e.length){const t=this.impl.get3DBounds(e);this.utilities.setPivotPoint(t.getCenter(new n.Vector3),!0,!0),this.utilities.pivotActive(this.navigation.getPivotSetFlag(),!0)}}},ee.prototype.run=function(){this.running||(this.resize(),this.running=!0,this.impl.run())},ee.prototype.localize=function(){A.A.localize()},ee.prototype.__initAutoCam=function(e){var t=this,i=e.camera;i.pivot||(i.pivot=new n.Vector3(0,0,0)),i.target||(i.target=new n.Vector3(0,0,0)),i.worldup||(i.worldup=i.up.clone()),t.autocamCamera=i.clone(),t.autocamCamera.target=i.target.clone(),t.autocamCamera.pivot=i.pivot.clone(),t.autocamCamera.worldup=i.worldup.clone(),t.autocam=new D.Autocam(t.autocamCamera,t.navigation,t.canvas),t.autocam.setGlobalManager(this.globalManager),t.autocam.registerCallbackCameraChanged((function(e){t.autocamCamera.isPerspective!==i.isPerspective&&(t.autocamCamera.isPerspective?t.navigation.toPerspective():t.navigation.toOrthographic()),t.navigation.setVerticalFov(t.autocamCamera.fov,!1),t.navigation.setView(t.autocamCamera.position,t.autocamCamera.target),t.navigation.setPivotPoint(t.autocamCamera.pivot),t.navigation.setCameraUpVector(t.autocamCamera.up),e&&t.navigation.setWorldUpVector(t.autocamCamera.worldup),t.impl.syncCamera(e)})),t.autocam.registerCallbackPivotDisplay((function(e){t.utilities?t.utilities.pivotActive(e,!1):t.impl.controls.pivotActive(e,!1)})),t.autocam.registerCallbackTransitionCompleted((function(){t.fireEvent({type:w.CAMERA_TRANSITION_COMPLETED})})),t.addEventListener("cameraChanged",(function(e){var i=e.camera;t.autocam.sync(i)})),t.autocam.sync(i)},ee.prototype.uninitialize=function(){var e;this.removeWindowEventListener("resize",this.onResizeCallback,!1),this.onResizeCallback=null,this.removeWindowEventListener("scroll",this.onScrollCallback),this.onScrollCallback=null,this.canvas?this.canvas.removeEventListener("mousedown",this.onMouseDown):this.container&&this.container.removeEventListener("mousedown",this.onMouseDown),this.onMouseDown=null,this.canvas?this.canvas.removeEventListener("mouseup",this.onMouseUp):this.container&&this.container.removeEventListener("mouseup",this.onMouseUp),this.onMouseUp=null,this.canvas.parentNode.removeChild(this.canvas),this.canvas.viewer=null,L.InitParametersSetting.canvas===this.canvas&&(L.InitParametersSetting.canvas=null),this.canvas=null,this.canvasWrap=null,this.viewerState=null,o.logger.reportRuntimeStats(),o.logger.track({category:"viewer_destroy"},!0),this.toolController&&(this.toolController.uninitialize(),this.toolController=null,this.clickHandler=null,this.utilities=null),this.navigation&&(this.navigation.uninitialize(),this.navigation=null),this.impl&&(this.impl.dtor(),this.impl=null),this.overlays&&(this.overlays.dtor(),this.overlays=null),this.loadSpinner=null,this._loadingSpinner.destroy(),this._loadingSpinner=null,this.prefs&&this.prefs.clearListeners(),this.prefs=null,this.profile=null,this.profileManager=null,this.autocam.dtor(),this.autocam=null,this.autocamCamera=null,this._hotkeyManager.popHotkeys("Autodesk.FitToView"),this._hotkeyManager.popHotkeys("Autodesk.Home"),this._hotkeyManager.popHotkeys("Autodesk.Escape"),this._hotkeyManager.popHotkeys("Autodesk.Pan"),this._hotkeyManager.popHotkeys("Autodesk.Orbit"),this._hotkeyManager=null,ee.ViewerCount--,0===ee.ViewerCount&&(0,M.clearPropertyWorkerCache)(),this.onDefaultContextMenu&&(this.container.removeEventListener("contextmenu",this.onDefaultContextMenu,!1),this.onDefaultContextMenu=null),this.screenModeDelegate&&(this.screenModeDelegate.uninitialize(),this.screenModeDelegate=null),this._displayEdges&&(this.removeEventListener(w.GEOMETRY_LOADED_EVENT,this._displayEdges),this._displayEdges=null),this._setDoubleSided&&(this.removeEventListener(w.MODEL_ADDED_EVENT,this._setDoubleSided),this._setDoubleSided=null),this.extensionCache=null,this.clientContainer=null,this.config=null,this.contextMenu=null,this.contextMenuCallbacks=null,this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null,this._forgeLogo=null,this.dispatchEvent(w.VIEWER_UNINITIALIZED),this.listeners={};const t=Z.getGlobal();t.NOP_VIEWER===this&&(t.NOP_VIEWER=null);const i=null===(e=t.NOP_VIEWERS)||void 0===e?void 0:e.indexOf(this);-1!==i&&(t.NOP_VIEWERS.splice(i,1),0===t.NOP_VIEWERS.length&&(t.NOP_VIEWERS=null)),o.logger.log("viewer destroy")},ee.prototype.finish=function(){this.tearDown(),this.uninitialize()},ee.prototype.setLoadHeuristics=function(e){var t=e.bubbleNode;if(t){var i=t.findViewableParent();if(i){var n=i.name();e.fileExt=n.slice(n.length-3).toLowerCase();void 0===e.isAEC&&-1!==["rvt","nwd","nwc","ifc"].indexOf(e.fileExt)&&(e.isAEC=!0)}}if(e.isAEC){if(void 0===e.useConsolidation){let t=(0,u.getParameterByName)("useConsolidation")||"";e.useConsolidation="true"===t||"false"!==t&&void 0}void 0===e.useConsolidation&&(e.useConsolidation=!(0,r.isMobileDevice)()&&!(0,r.isNodeJS)()),void 0===e.createWireframe&&(e.createWireframe=!(0,r.isMobileDevice)()),void 0===e.disablePrecomputedNodeBoxes&&(e.disablePrecomputedNodeBoxes=!0)}else void 0===e.createWireframe&&(e.createWireframe=!(0,r.isMobileDevice)()&&this.prefs.get("edgeRendering"));e.bvhOptions||(e.bvhOptions=ee._getDefaultBVHOptions(e))},ee.prototype.trackADPSettingsOptions=function(){var e=this;this.trackADPTimer.push(setTimeout((function(){if(e.prefs){var t={category:"settingOptionsStatus",switchSheetColorWhiteToBlack:e.prefs.get("swapBlackAndWhite"),leftHandedMouseSetup:e.prefs.get("leftHandedMouseSetup"),openPropertiesOnSelect:e.prefs.get("openPropertiesOnSelect"),orbitPastWorldPoles:e.prefs.get("orbitPastWorldPoles"),reverseMouseZoomDirection:e.prefs.get("reverseMouseZoomDir"),fusionStyleOrbit:e.prefs.get("fusionOrbit"),setPivotWithLeftMouseButton:e.prefs.get("clickToSetCOI"),zoomTowardPivot:e.prefs.get("zoomTowardsPivot"),viewCubeActsOnPivot:e.prefs.get("alwaysUsePivot"),showViewCube:e.prefs.get("viewCube"),environmentImageVisible:e.prefs.get("envMapBackground"),displayEdges:e.prefs.get("edgeRendering"),displayPoints:e.prefs.get("pointRendering"),displayLines:e.prefs.get("lineRendering"),ghostHiddenObjects:e.prefs.get("ghosting"),groundReflection:e.prefs.get("groundReflection"),groundShadow:e.prefs.get("groundShadow"),ambientShadows:e.prefs.get("ambientShadows"),antiAliasing:e.prefs.get("antialiasing"),progressiveModelDisplay:e.prefs.get("progressiveRendering"),smoothNavigation:e.prefs.get("optimizeNavigation")};o.logger.track(t)}}),3e4))},ee.prototype.trackADPExtensionsLoaded=function(){var e=this,t={category:"loaded_extensions"};this.trackADPTimer.push(setTimeout((function(){if(e.loadedExtensions)for(var i in e.loadedExtensions)t[i]=i;o.logger.track(t)}),3e4))},ee.prototype.activateDefaultNavigationTools=function(e){if(!(0,r.isNodeJS)()){var t=e?"pan":"orbit";this.setDefaultNavigationTool(t),this.setActiveNavigationTool(t),this.toolController&&(this.toolController.enableMouseButtons(!0),this.toolController.activateTool("gestures"))}},ee.prototype.registerDimensionSpecificHotkeys=function(e){if(this._hotkeyManager)if(e)this._hotkeyManager.popHotkeys("Autodesk.Orbit");else{var t,i=this,n=[{keycodes:[O.KeyCode.ALT],onPress:function(){return t=i.getActiveNavigationTool(),i.setActiveNavigationTool("orbit")},onRelease:function(){return i.setActiveNavigationTool(t)}}];this._hotkeyManager.pushHotkeys("Autodesk.Orbit",n,{tryUntilSuccess:!0})}},ee.prototype.onModelAdded=function(e,t){var i;e.is2d()&&!e.isLeaflet()&&this.navigation.setMinimumLineWidth(null===(i=e.loader)||void 0===i||null===(i=i.svf)||void 0===i?void 0:i.minLineWidth);1===this.impl.modelQueue().getModels().length&&this.initializeFirstModelPresets(e,t)},ee.prototype.initializeFirstModelPresets=function(e,t,i){if(e.is2d()&&this.activateLayerState("Initial"),i||e.getData().loadOptions.preserveView||(this.setActiveNavigationTool(),this.impl.setViewFromFile(e,!0),this.toolController.recordHomeView()),this.registerDimensionSpecificHotkeys(e.is2d()),t||this.activateDefaultNavigationTools(e.is2d()),this.navigation.setIs2D(this.impl.modelQueue().areAll2D()),e.isLeaflet()){var n=e.getData();this.navigation.setConstraints2D(n.bbox,n.maxPixelPerUnit)}else this.navigation.setConstraints2D()},ee.prototype.loadModel=async function(e,t,i,n,s){var h,d,p=this,m=p.impl._reserveLoadingFile();if(void 0===(t=t||{}).skipPropertyDb){var g=(0,u.getParameterByName)("skipPropertyDb")||"";t.skipPropertyDb="true"===g||"false"!==g&&void 0}function v(e,t,i){p._loadingSpinner.hide(),n&&n(e,t,i)}var y=e.toLowerCase().match(/\.([a-z0-9]+)(\?|$)/),b=y?y[1]:null,x=this.config&&this.config.loaderExtensions&&this.config.loaderExtensions[b]||b in z&&z[b];if(x&&!this.isExtensionLoaded(x))try{await this.loadExtension(x,this.config)}catch(e){return p.impl._removeLoadingFile(m),n&&n(f.ErrorCodes.VIEWER_INTERNAL_ERROR,e.toString()),!1}let _;if(_=t&&t.fileLoader?t.fileLoader:T.FileLoaderManager.getFileLoaderForExtension(b,t.mimeType),!_)return p.impl._removeLoadingFile(m),o.logger.error("File extension not supported:"+b,(0,f.errorCodeString)(f.ErrorCodes.UNSUPORTED_FILE_EXTENSION)),v(f.ErrorCodes.UNSUPORTED_FILE_EXTENSION,"File extension not supported",0),!1;this.setLoadHeuristics(t),this.impl.hasModels()||this._loadingSpinner.show(),"function"==typeof _.getExistingInstance&&(d=_.getExistingInstance(e,t,this.config)),d||(d=new _(this.impl,this.config)),p.impl._addLoadingFile(m,d);var E=d.loadFile(e,t,(function(e,n){if(p.impl){if(p.impl._removeLoadingFile(d),e)return p.dispatchEvent({type:w.LOADER_LOAD_ERROR_EVENT,error:e,loader:d}),void v(e.code,e.msg,e.args);n.getData().underlayRaster=t.underlayRaster&&n.getLeaflet(),t.loadAsHidden?p.impl.modelQueue().addHiddenModel(n):p.impl.addModel(n),n.loader&&n.loader.notifiesFirstPixel&&p._loadingSpinner instanceof k?p.addEventListener(w.RENDER_FIRST_PIXEL,(function(){p._loadingSpinner.hide()}),{once:!0}):p._loadingSpinner.hide(),!(0,r.isNodeJS)()&&p._forgeLogo&&(p._forgeLogo.style.display="block"),i&&i(n)}}),s);if(E||p.impl._removeLoadingFile(d),this.fireEvent({type:w.LOADER_LOAD_FILE_EVENT,loader:d}),t.skipPrefs)void 0===this.prefs.get(a.Prefs.DISPLAY_UNITS)&&this.prefs.set(a.Prefs.DISPLAY_UNITS,new l.EnumType(c.displayUnitsEnum)),void 0===this.prefs.get(a.Prefs.DISPLAY_UNITS_PRECISION)&&this.prefs.set(a.Prefs.DISPLAY_UNITS_PRECISION,new l.EnumType(c.displayUnitsPrecisionEnum));else if(!(0,r.isNodeJS)()&&!this.profile){let e=this.chooseProfile(t);this.setProfile(e,!1)}t.pdfRenderingMode=this._curOptions&&this._curOptions.enableVectorRasterSwitch&&(null===(h=this._curAvDocument)||void 0===h?void 0:h.getPdfRenderingMode());const S=function(e,t,i,n){const{bubbleNode:r,pdfRenderingMode:o}=n,s={url:e,lmvFileExtension:t,returnValue:i};if(r){s.isOtg=r.isOtg()&&Y.endpoint.isOtgBackend(),s.isSVF2=r.isSVF2()&&Y.endpoint.isSVF2Backend(),s.geometrySize=r.data.size||0,s.viewable_type=r.is2D()?"2d":"3d";const e=r.findViewableParent();try{var a;const t=e&&e.name(),i=t&&t.lastIndexOf("."),n=i>=0&&t.substring(i+1),l=null===(a=r.data)||void 0===a||null===(a=a.extractor)||void 0===a?void 0:a.includes("pdf");n?(s.seedFileExt=n.toLowerCase(),"pdf"===n.toLowerCase()&&o&&(s.pdf_rendering_mode=o)):l&&o&&(s.pdf_rendering_mode=o)}catch(e){}}return s}(e,b,E,t);return X.analytics.track("viewer.model.load",S),E},ee.prototype.isLoadDone=function(){let{geometry:e=!0,propDb:t=!0,textures:i=!0,hidden:n=!1,onlyModels:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!r){if(!this.started)return!0;if(this.impl._hasLoadingFile())return!1}if(i&&Autodesk.Viewing.Private.TextureLoader.requestsInProgress()>0)return!1;const o=n=>{if(!n)return!1;const r=!t||!n.getPropertyDb()||n.getPropertyDb().isLoadDone();return(e||i?n.isLoadDone():n.modelRootLoaded)&&r};return r?Array.isArray(r)?r.every(o):o(r):this.getVisibleModels().every(o)&&(!n||this.getHiddenModels().every(o))},ee.prototype.waitForLoadDone=function(e){return new Promise(((t,i)=>{var{geometry:n=!0,propDb:r=!0,textures:o=!0,hidden:s=!1,onlyModels:a}=e||{};const l={geometry:n=n||o,propDb:r,textures:o,hidden:s,onlyModels:a},c=()=>this.started&&(this.impl._hasLoadingFile()||this.impl.modelQueue().getModels().length>0||this.impl.modelQueue().getHiddenModels().length>0);var h,u=!a&&c();if(u&&this.isLoadDone(l))return void t();const d=()=>{(u=u||c())&&this.isLoadDone(l)&&(h(),t())},f=e=>{h();const t=new Error("Error loading model");t.loader=e.loader,t.error=e.error,i(t)};h=()=>{n&&this.removeEventListener(w.GEOMETRY_LOADED_EVENT,d),r&&(this.removeEventListener(w.OBJECT_TREE_CREATED_EVENT,d),this.removeEventListener(w.OBJECT_TREE_UNAVAILABLE_EVENT,d)),o&&this.removeEventListener(w.TEXTURES_LOADED_EVENT,d),this.removeEventListener(w.LOADER_LOAD_FILE_EVENT,d),this.removeEventListener(w.MODEL_ADDED_EVENT,d),this.removeEventListener(w.MODEL_REMOVED_EVENT,d),this.removeEventListener(w.LOADER_LOAD_ERROR_EVENT,f),this.removeEventListener(w.MODEL_ROOT_LOADED_EVENT,d),this.removeEventListener(w.VIEWER_UNINITIALIZED,t)},n&&this.addEventListener(w.GEOMETRY_LOADED_EVENT,d),r&&(this.addEventListener(w.OBJECT_TREE_CREATED_EVENT,d),this.addEventListener(w.OBJECT_TREE_UNAVAILABLE_EVENT,d)),o&&this.addEventListener(w.TEXTURES_LOADED_EVENT,d),this.addEventListener(w.LOADER_LOAD_FILE_EVENT,d),this.addEventListener(w.MODEL_ADDED_EVENT,d),this.addEventListener(w.MODEL_REMOVED_EVENT,d),this.addEventListener(w.LOADER_LOAD_ERROR_EVENT,f),this.addEventListener(w.MODEL_ROOT_LOADED_EVENT,d,{priority:-1e6}),this.addEventListener(w.VIEWER_UNINITIALIZED,(()=>i(new Error("Promise reject because viewer finished"))))}))},ee.prototype.unloadModel=function(e){e||(e=this.model),this.impl.unloadModel(e)},ee.prototype.updateViewerStateForPdfReload=function(e){this._curAvDocument=e.getDocument(),this._curManifest=e},ee.prototype.loadDocumentNode=function(e,t){var i;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._curAvDocument=e,this._curManifest=t;const r=n.leafletOptions||{};let o=e.getViewableUrn(t,r),s=t.findPropertyDbPath();o=e.getFullPath(o),s=e.getFullPath(s);const a=e.getAcmSessionId(o),l=Object.assign({sharedPropertyDbPath:s,acmSessionId:a,bubbleNode:t,applyRefPoint:!1,loadOptions:r,page:r.page||1},n);this._curOptions=l;var c=t.search(I.BubbleNode.PDF_PAGE_NODE),h=t.search(I.BubbleNode.LEAFLET_NODE);this._curOptions.enableVectorRasterSwitch=n.enableVectorRasterSwitch&&c.length>0&&h.length>0;const u="pdf"===t.getInputFileType(),d=null===(i=t.data)||void 0===i||null===(i=i.extractor)||void 0===i?void 0:i.includes("pdf");if(this._isPdfModelWithVectorAndRasterRepr=(u||d)&&c.length>0&&h.length>0,r.tempRasterPath&&(l.loadOptions.tempRasterPath=r.tempRasterPath),!l.keepCurrentModels&&this.impl.hasModels()){let e=this.config;this.tearDown(),this.setUp(e)}const f=t.findParentGeom2Dor3D(),p=null==f?void 0:f.extensions();Array.isArray(p)&&p.forEach((e=>{this.loadExtension(e,this.config)}));const m=r.isPdf?this.loadExtension("Autodesk.PDF",this.config):Promise.resolve(),g=!l.disableUnderlayRaster&&r.tempRasterPath,v=g?this._loadTempRasterModel(e,l,t):Promise.resolve();return m.then((()=>v)).then((e=>new Promise(((i,n)=>{g&&e&&e!==this.getUnderlayRaster(t)?n("load canceled"):this.loadModel(o,l,(e=>{l.loadAsHidden||l.preserveView||"view"!==t.type()||this.setView(t,{skipTransition:!0}),i(e)}),n)}))))},ee.prototype.unloadDocumentNode=function(e){let t=this.impl.findModel(e,!0);if(t)return this.impl.unloadModel(t),!0;if(!this.impl.loaders)return!1;for(let t=0;t<this.impl.loaders.length;t++){let i=this.impl.loaders[t];if((i.options&&i.options.bubbleNode)===e)return i.dtor(),this.impl.loaders.splice(t,1),!0}return!1},ee.prototype._loadTempRasterModel=function(e,t,i){return new Promise(((n,r)=>{if(t.loadAsHidden)return n();t.underlayRaster=!0,t.loadOptions.fitPaperSize=!0;const o=e=>{var t,n;const r=e.getDocumentNode();return r&&(null===(t=r.getDocument())||void 0===t?void 0:t.getPath())===(null===(n=i.getDocument())||void 0===n?void 0:n.getPath())&&r.guid()===i.guid()&&!e.isLeaflet()},s=e=>{let{model:t}=e;o(t)&&(2===this.getVisibleModels().length&&this.initializeFirstModelPresets(t,!1,!0),this.removeEventListener(w.MODEL_ADDED_EVENT,s))};this.addEventListener(w.MODEL_ADDED_EVENT,s);const a=e=>{let{model:t}=e;o(t)&&(t.changePaperVisibility(!0),this.removeEventListener(w.MODEL_REMOVED_EVENT,a),this.removeEventListener(w.MODEL_ADDED_EVENT,s),this.removeEventListener(w.GEOMETRY_LOADED_EVENT,c))};let l;this.addEventListener(w.MODEL_REMOVED_EVENT,a);const c=e=>{let{model:t}=e;o(t)&&(t.changePaperVisibility(!0),this.removeEventListener(w.MODEL_REMOVED_EVENT,a),l&&(this.unloadModel(l),l=null),this.removeEventListener(w.GEOMETRY_LOADED_EVENT,c))};this.addEventListener(w.GEOMETRY_LOADED_EVENT,c);const h=e.getFullPath(t.loadOptions.tempRasterPath);this.loadModel(h,t,(e=>{t.loadOptions.fitPaperSize=void 0,t.underlayRaster=void 0,t.hideBackground=!0,l=e,n(e)}),(e=>{if(t.loadOptions.fitPaperSize=void 0,t.underlayRaster=void 0,e===f.ErrorCodes.LOAD_CANCELED)return r("load canceled");n()}))}))},ee.prototype.getDimensions=function(){if(this.container){var e={};return this.getScreenMode()===g.ScreenMode.kFullScreen?(e.width=screen.width,e.height=screen.height):e=this.container.getBoundingClientRect(),{width:e.width,height:e.height}}return null},ee.prototype.resize=function(){this.container.clientWidth>0&&this.container.clientHeight>0&&this.impl.resize(this.container.clientWidth,this.container.clientHeight)},ee.prototype.getHotkeyManager=function(){return this._hotkeyManager},ee.prototype.getCamera=function(){return this.impl.camera},ee.prototype.getState=function(e){return this.viewerState.getState(e)},ee.prototype.restoreState=function(e,t,i){var n=this.viewerState.restoreState(e,t,i);return n&&this.dispatchEvent({type:w.VIEWER_STATE_RESTORED_EVENT,value:n}),n},ee.prototype.getViewpointCamData=function(e){const t=e.position,i=e.target,n=e.up,r=e.isPerspective?0:1;return[t.x,t.y,t.z,i.x,i.y,i.z,n.x,n.y,n.z,e.aspect,e.fov*(Math.PI/180),e.orthoScale,r]},ee.prototype.setView=function(e,t){var i,r;if(!(e&&e instanceof I.BubbleNode))return!1;const o=e.findParentGeom2Dor3D();let s=o&&this.impl.findModel(o,!0)||this.model;if(!s)return!1;let a,l=!!t&&t.skipTransition,c=!t||t.useExactCamera,h=!!t&&t.skipViewpointExtra;if(e.getViewBox())return this.setViewFromViewBox(e.getViewBox(),e.name(),l),this.dispatchEvent({type:w.SET_VIEW_EVENT,view:e}),!0;let u,d,f,p=null===(i=s.loader)||void 0===i?void 0:i.svf,m=e.data.isViewpoint&&p?null===(r=p.viewpoints)||void 0===r?void 0:r[e.data.entry]:null,g=e.data.camera,v=s.isOTG(),y=!1;if(this.showAll(),!h&&m){const e=m.camera;g=this.getViewpointCamData(e);const t=p.overrideSets[m.overrideSet];if(t){const{defaultMaterialIndex:e,materialOverrides:i,flagOverrides:n,defaultFlags:r}=t,o=s.getFragmentList(),a=o.fragments.length;if(o.materialIdMapOriginal||o.storeOriginalMaterials(),(e||i)&&(y=s.isConsolidated()||s.isConsolidating(),y&&s.unconsolidate(!1,!0)),e){const t=v?p.getMaterialHash(e):this.impl.matman()._getMaterialHash(s,e),i=this.impl.matman()._materials[t];if(i)for(let e=0;e<a;e++)this.model.getFragmentList().setMaterial(e,i)}if(i){e||s.getFragmentList().restoreOriginalMaterials();for(let e=0;e<i.length;e++){const t=i[e].dbId,n=i[e].materialIndex;if(!Number.isFinite(t)||!Number.isFinite(n))continue;const r=v?p.getMaterialHash(n):this.impl.matman()._getMaterialHash(s,n),o=this.impl.matman()._materials[r];o&&s.getInstanceTree().enumNodeFragments(t,(e=>{s.getFragmentList().setMaterial(e,o)}),!0)}}if(r&&(1===r?this.hideAll():2===r&&this.showAll()),n)if(0===n.length)this.showAll();else for(let e=0;e<n.length;e++){const{flags:t,dbId:i}=n[e];Number.isFinite(t)&&Number.isFinite(i)&&(1===t?this.hide(i,s):2===t&&this.show(i,s))}y&&this.impl.consolidateModel(s).then((()=>{this.impl.invalidate(!0,!0)}))}}if(a=this.getCameraFromViewArray(g,s),!a)return!1;this.impl.setViewFromCamera(a,l,c);const b=m??e.data;u=b.sectionPlane,d=b.sectionBox,f=b.sectionBoxTransform;const x=s.getModelToViewerTransform();if(u){let e=[];for(let t=0;t<u.length;t+=4){const i=new n.Plane(new n.Vector3(u[t+0],u[t+1],u[t+2]),u[t+3]);x&&i.applyMatrix4(x),e.push(new n.Vector4(i.normal.x,i.normal.y,i.normal.z,i.constant))}this.impl.setCutPlaneSet("__set_view",e)}else if(d&&f){let t;if(e.data.isViewpoint){const e=new n.Box3;e.set(d.min,d.max);const i=e.max.clone().sub(e.min),r=(new n.Matrix4).compose(e.getCenter(),new n.Quaternion(f.x,f.y,f.z,f.w),new n.Vector3(i.x,i.y,i.z)),o=(new n.Matrix4).copy(x).multiply(r);t=V.SceneMath.box2CutPlanes(new n.Box3(new n.Vector3(-.5,-.5,-.5),new n.Vector3(.5,.5,.5)),o)}else{const e=(new n.Matrix4).fromArray([f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]]);let i=new n.Vector3(d[0],d[1],d[2]),r=new n.Vector3(d[3],d[4],d[5]),o=new n.Box3(i,r);const s=new n.Matrix4;x&&s.copy(x),s.multiply(e),t=V.SceneMath.box2CutPlanes(o,s)}this.impl.setCutPlaneSet("__set_view",t)}else this.impl.setCutPlaneSet("__set_view",void 0);return this.dispatchEvent({type:w.SET_VIEW_EVENT,view:e}),!0},ee.prototype.setViewType=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setViewType is not applicable to 2D"):this.prefs.set(a.Prefs3D.VIEW_TYPE,e)},ee.prototype.setViewFromArray=function(e){var t=this.getCameraFromViewArray(e);this.impl.setViewFromCamera(t,!1,!0)},ee.prototype.getCameraFromViewArray=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.model;const i=null==t?void 0:t.getModelToViewerTransform();return I.BubbleNode.readCameraFromArray(e,i)},ee.prototype.getViewArrayFromCamera=function(){var e=this.model?this.model.getData().globalOffset:{x:0,y:0,z:0};return this.impl.getViewArrayFromCamera(e)},ee.prototype.setViewFromViewBox=function(e,t,i){var n=this.model;if(!n||n.is2d()){if(t&&t.length){var r,s=n.getData().metadata.views||[];for(r=0;r<s.length&&s[r].name!=t;r++);if(r<s.length){var a=s[r].layer_state;a&&this.activateLayerState(a)}}this.impl.setViewFromViewBox(this.model,e,t,i)}else o.logger.warn("Viewer3D.setViewFromViewBox is not applicable to 3D")},ee.prototype.activateLayerState=function(e){this.impl.layers.activateLayerState(e),this.dispatchEvent({type:w.LAYER_VISIBILITY_CHANGED_EVENT})},ee.prototype.getLayerStates=function(){return this.impl.layers.getLayerStates()},ee.prototype.setViewFromFile=function(e){this.setActiveNavigationTool(),this.impl.setViewFromFile(e||this.model)},ee.prototype.getProperties=function(e,t,i){this.model?this.model.getProperties(e,t,i):i&&i(f.ErrorCodes.BAD_DATA,"Properties failed to load since model does not exist")},ee.prototype.getObjectTree=function(e,t){this.model?this.model.getObjectTree(e,t):t&&t(f.ErrorCodes.BAD_DATA,"ObjectTree failed to load since model does not exist")},ee.prototype.setCanvasClickBehavior=function(e){if(Object.prototype.hasOwnProperty.call(this.impl.controls,"setClickBehavior")&&this.impl.controls.setClickBehavior(e),this.clickHandler&&this.clickHandler.setClickBehavior(e),e&&e.disableMouseWheel&&this.toolController.setMouseWheelInputEnabled(!1),e&&e.disableTwoFingerSwipe){var t=this.toolController.getTool("gestures");t&&t.disableTwoFingerSwipe()}},ee.prototype.search=function(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{searchHidden:!1};this.searchText=e,this.model?this.model.search(e,t,i,n,r):i&&i(f.ErrorCodes.BAD_DATA,"Search failed since model does not exist")},ee.prototype.getHiddenNodes=function(e){return e=e||this.model,this.impl.visibilityManager.getHiddenNodes(e)},ee.prototype.getIsolatedNodes=function(e){return(e=e||this.model)&&e.is2d()?(o.logger.warn("Viewer3D.getIsolatedNodes is not yet implemented for 2D"),[]):this.impl.visibilityManager.getIsolatedNodes(e)},ee.prototype.isolate=function(e,t){(t=t||this.model)&&this.impl.visibilityManager.isolate(e,t)},ee.prototype.setBackgroundColor=function(e,t,i,n,r,o){this.impl.setClearColors(e,t,i,n,r,o)},ee.prototype.setBackgroundOpacity=function(e){this.impl.setClearAlpha(e)},ee.prototype.toggleSelect=function(e,t,i){(t=t||this.model)&&t.is2d()?o.logger.warn("Viewer3D.toggleSelect is not yet implemented for 2D"):this.impl.selector.toggleSelection(e,t,i)},ee.prototype.select=function(e,t,i){"number"==typeof e&&(e=[e]),t=t||this.model,this.impl.selector.setSelection(e,t,i)},ee.prototype.clearSelection=function(){this.impl.selector.clearSelection()},ee.prototype.getSelectionVisibility=function(){return this.impl.selector.getSelectionVisibility()},ee.prototype.getSelectionCount=function(){return this.impl.selector.getSelectionLength()},ee.prototype.setSelectionMode=function(e){this.prefs.set(a.Prefs3D.SELECTION_MODE,e)},ee.prototype.getSelection=function(){return this.impl.selector.getSelection()},ee.prototype.lockSelection=function(e,t,i){i=i||this.model,this.impl.selector.lockSelection(e,t,i)},ee.prototype.unlockSelection=function(e,t){this.impl.selector.unlockSelection(e,t)},ee.prototype.isSelectionLocked=function(e,t){return this.impl.selector.isNodeSelectionLocked(e,t)},ee.prototype.getAggregateSelection=function(e){var t=this.impl.selector.getAggregateSelection();if(e)for(var i=0;i<t.length;i++)for(var n=0;n<t[i].selection.length;n++)e(t[i].model,t[i].selection[n]);return t},ee.prototype.setAggregateSelection=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.impl.selector.setAggregateSelection(e,t)},ee.prototype.getAggregateIsolation=function(){return this.impl.visibilityManager.getAggregateIsolatedNodes()},ee.prototype.setAggregateIsolation=function(e){this.impl.visibilityManager.aggregateIsolate(e)},ee.prototype.getAggregateHiddenNodes=function(){return this.impl.visibilityManager.getAggregateHiddenNodes()},ee.prototype.hide=function(e,t){t=t||this.model,this.impl.visibilityManager.hide(e,t)},ee.prototype.show=function(e,t){t=t||this.model,this.impl.visibilityManager.show(e,t)},ee.prototype.showAll=function(){this.impl.visibilityManager.aggregateIsolate([]),this.impl.layers.showAllLayers(),this.fireEvent({type:w.SHOW_ALL_EVENT})},ee.prototype.hideAll=function(){this.getVisibleModels().forEach((e=>{this.hide(e.getRootId(),e)})),this.fireEvent({type:w.HIDE_ALL_EVENT})},ee.prototype.toggleVisibility=function(e,t){this.impl.visibilityManager.toggleVisibility(e,t)},ee.prototype.areAllVisible=function(){return this.impl.isWholeModelVisible(this.model)},ee.prototype.isNodeVisible=function(e,t){return t=t||this.model,this.impl.isNodeVisible(e,t)},ee.prototype.lockVisible=function(e,t,i){i=i||this.model,this.impl.visibilityManager.lockNodeVisible(e,t,i)},ee.prototype.toggleLockVisible=function(e,t){this.impl.visibilityManager.toggleVisibleLocked(e,t)},ee.prototype.isVisibleLocked=function(e,t){return this.impl.visibilityManager.isNodeVisibleLocked(e,t)},ee.prototype.explode=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.model&&(this.model.is2d()?o.logger.warn("Viewer3D.explode is not applicable to 2D"):this.impl.explode(e,t)&&o.logger.track({name:"explode_count",aggregate:"count"}))},ee.prototype.getExplodeScale=function(){return this.model&&this.model.is2d()?(o.logger.warn("Viewer3D.getExplodeScale is not applicable to 2D"),0):this.impl.getExplodeScale()},ee.prototype.getExplodeOptions=function(){return this.model&&this.model.is2d()?(o.logger.warn("Viewer3D.getExplodeOptions is not applicable to 2D"),0):this.impl.getExplodeOptions()},ee.prototype.lockExplode=function(e,t,i){return(i=i||this.model)&&i.is2d()?(o.logger.warn("Viewer3D.lockExplode is not applicable to 2D"),0):this.impl.lockExplode(e,t,i)},ee.prototype.isExplodeLocked=function(e,t){return(t=t||this.model)&&t.is2d()?(o.logger.warn("Viewer3D.isExplodeLocked is not applicable to 2D"),0):this.impl.isExplodeLocked(e,t)},ee.prototype.toggleLockExplode=function(e,t){return(t=t||this.model)&&t.is2d()?(o.logger.warn("Viewer3D.toggleLockExplode is not applicable to 2D"),0):this.impl.lockExplode(e,!this.isExplodeLocked(e,t),t)},ee.prototype.setQualityLevel=function(e,t){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setQualityLevel is not applicable to 2D"):(this.prefs.set(a.Prefs3D.AMBIENT_SHADOWS,e),this.prefs.set(a.Prefs3D.ANTIALIASING,t))},ee.prototype.setGhosting=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGhosting is not applicable to 2D"):this.prefs.set(a.Prefs3D.GHOSTING,e)},ee.prototype.setGroundShadow=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundShadow is not applicable to 2D"):this.prefs.set(a.Prefs3D.GROUND_SHADOW,e)},ee.prototype.setGroundReflection=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundReflection is not applicable to 2D"):this.prefs.set(a.Prefs3D.GROUND_REFLECTION,e)},ee.prototype.setEnvMapBackground=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setEnvMapBackground is not applicable to 2D"):this.prefs.set(a.Prefs3D.ENV_MAP_BACKGROUND,e)},ee.prototype.setFirstPersonToolPopup=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setFirstPersonToolPopup is not applicable to 2D"):this.prefs.set(a.Prefs3D.FIRST_PERSON_TOOL_POPUP,e)},ee.prototype.getFirstPersonToolPopup=function(){if(!this.model||!this.model.is2d())return this.prefs.get("firstPersonToolPopup");o.logger.warn("Viewer3D.getFirstPersonToolPopup is not applicable to 2D")},ee.prototype.setBimWalkToolPopup=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setBimWalkToolPopup is not applicable to 2D"):this.prefs.set(a.Prefs3D.BIM_WALK_TOOL_POPUP,e)},ee.prototype.getBimWalkToolPopup=function(){if(!this.model||!this.model.is2d())return this.prefs.get("bimWalkToolPopup");o.logger.warn("Viewer3D.getBimWalkToolPopup is not applicable to 2D")},ee.prototype.setProgressiveRendering=function(e){this.prefs.set(a.Prefs.PROGRESSIVE_RENDERING,e)},ee.prototype.setGrayscale=function(e){this.model&&this.model.is3d()?o.logger.warn("Viewer3D.setGrayscale is not applicable to 3D"):this.prefs.set(a.Prefs2D.GRAYSCALE,e)},ee.prototype.setSwapBlackAndWhite=function(e){this.model&&this.model.is3d()?o.logger.warn("Viewer3D.setSwapBlackAndWhite is not applicable to 3D"):this.prefs.set(a.Prefs2D.SWAP_BLACK_AND_WHITE,e)},ee.prototype.setOptimizeNavigation=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setOptimizeNaviation is not applicable to 2D"):this.prefs.set(a.Prefs3D.OPTIMIZE_NAVIGATION,e)},ee.prototype.initializePrefListeners=function(){var e=this;this.prefs.addListeners(a.Prefs.KEY_MAP_CMD,(e=>{this.impl.toggleCmdMapping(e,this.toolController)})),this.prefs.addListeners(a.Prefs3D.ANTIALIASING,(e=>{const t=this.prefs.get(a.Prefs3D.AMBIENT_SHADOWS);this.impl.togglePostProcess(t,e)})),this.prefs.addListeners(a.Prefs3D.AMBIENT_SHADOWS,(e=>{const t=this.prefs.get(a.Prefs3D.ANTIALIASING);this.impl.togglePostProcess(e,t)})),this.prefs.addListeners(a.Prefs3D.GROUND_SHADOW,(e=>{this.impl.toggleGroundShadow(e)})),this.prefs.addListeners(a.Prefs3D.GROUND_REFLECTION,(e=>{this.impl.toggleGroundReflection(e)})),this.prefs.addListeners(a.Prefs3D.ENV_MAP_BACKGROUND,(e=>{this.impl.toggleEnvMapBackground(e)})),this.prefs.addListeners(a.Prefs.PROGRESSIVE_RENDERING,(e=>{this.impl.toggleProgressive(e)})),this.prefs.addListeners(a.Prefs3D.VIEW_TYPE,(e=>{const t=this.prefs.get(a.Prefs3D.VIEW_TYPE),i=this.impl.getModelCamera(this.model);if(i){const e=i.isPerspective;if(!isNaN(e)){const i=e?a.VIEW_TYPES.PERSPECTIVE:a.VIEW_TYPES.ORTHOGRAPHIC;this.prefs.setDefault(a.Prefs3D.VIEW_TYPE,i),t===a.VIEW_TYPES.DEFAULT&&(this.prefs[a.Prefs3D.VIEW_TYPE]=i)}}this.autocam.setViewType(e)})),this.prefs.addListeners(a.Prefs2D.GRAYSCALE,(e=>{this.impl.toggleGrayscale(e)})),this.prefs.addListeners(a.Prefs2D.SWAP_BLACK_AND_WHITE,(e=>{this.impl.toggleSwapBlackAndWhite(e)})),this.isFirstLoad=!0,this.prefs.addListeners(a.Prefs2D.VECTOR_VIEWING,(e=>{!this.isFirstLoad&&this._curAvDocument&&this._curManifest&&this._curOptions&&this._isPdfModelWithVectorAndRasterRepr&&new Promise((e=>setTimeout(e,200))).then((()=>{this.unloadDocumentNode(this._curManifest);const e={};e.enableVectorRasterSwitch=this._curOptions.enableVectorRasterSwitch,this.loadDocumentNode(this._curAvDocument,this._curManifest,e)})),this.isFirstLoad=!1})),this.prefs.addListeners(a.Prefs3D.OPTIMIZE_NAVIGATION,(e=>{this.impl.setOptimizeNavigation(e)})),this.prefs.addListeners(a.Prefs3D.GHOSTING,(e=>{this.impl.toggleGhosting(e)})),this.prefs.addListeners(a.Prefs3D.LINE_RENDERING,(e=>{this.impl.hideLines(!e)})),this.prefs.addListeners(a.Prefs.POINT_RENDERING,(e=>{this.impl.hidePoints(!e)})),this.prefs.addListeners(a.Prefs3D.EDGE_RENDERING,(e=>{this._displayEdges=()=>{this.impl.setDisplayEdges(e)},e||this.model&&this.model.isLoadDone()?this._displayEdges():this.addEventListener(w.GEOMETRY_LOADED_EVENT,this._displayEdges)})),this.prefs.addListeners(a.Prefs3D.LIGHT_PRESET,(e=>{let t=!1;if("string"==typeof e){for(var i=e,n=-1,r=0;r<j.LightPresets.length;r++)if(j.LightPresets[r].name===i){n=r;break}-1===n&&(o.logger.warn("Invalid Prefs3D.LIGHT_PRESET: "+e),o.logger.warn("Setting to default light preset."),t=!0),e=n}this.impl.setLightPreset(e,t)})),this.prefs.addListeners(a.Prefs3D.ALWAYS_USE_PIVOT,(e=>{this.navigation.setUsePivotAlways(e)})),this.prefs.addListeners(a.Prefs.REVERSE_MOUSE_ZOOM_DIR,(e=>{this.navigation.setReverseZoomDirection(e)})),this.prefs.addListeners(a.Prefs3D.REVERSE_HORIZONTAL_LOOK_DIRECTION,(e=>{this.navigation.setReverseHorizontalLookDirection(e)})),this.prefs.addListeners(a.Prefs3D.REVERSE_VERTICAL_LOOK_DIRECTION,(e=>{this.navigation.setReverseVerticalLookDirection(e)})),this.prefs.addListeners(a.Prefs3D.ZOOM_TOWARDS_PIVOT,(e=>{this.navigation.setZoomTowardsPivot(e)})),this.prefs.addListeners(a.Prefs3D.SELECTION_SETS_PIVOT,(e=>{this.navigation.setSelectionSetsPivot(e)})),this.prefs.addListeners(a.Prefs3D.ORBIT_PAST_WORLD_POLES,(e=>{this.navigation.setOrbitPastWorldPoles(e)})),this.prefs.addListeners(a.Prefs.LEFT_HANDED_MOUSE_SETUP,(e=>{this.navigation.setUseLeftHandedInput(e),m.EventUtils.setUseLeftHandedInput(e)})),this.prefs.addListeners(a.Prefs.WHEEL_SETS_PIVOT,(e=>{this.navigation.setWheelSetsPivot(e)})),this.prefs.addListeners(a.Prefs3D.SELECTION_MODE,(e=>{this.impl.selector.setSelectionMode(e)})),this.prefs.addListeners(a.Prefs.BACKGROUND_COLOR_PRESET,(e=>{if(e)try{var t=JSON.parse(e);this.impl.setClearColors(t[0],t[1],t[2],t[3],t[4],t[5])}catch(e){o.logger.warn("Invalid Prefs.BACKGROUND_COLOR_PRESET: "+t)}})),this.prefs.addListeners(a.Prefs3D.EXPLODE_STRATEGY,(e=>{q.L.setStrategy(e)&&this.impl.refreshExplode()})),this.prefs.addListeners(a.Prefs2D.LOADING_ANIMATION,(e=>{this.impl.onLoadingAnimationChanged(e)}));const t={};this.prefs.addListeners(a.Prefs3D.FORCE_DOUBLE_SIDED,(i=>{this._setDoubleSided=function(n){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=n.model,s=function(e){return"boolean"==typeof i?i:!!i[e.id]}(o);const a=o.getData();Object.prototype.hasOwnProperty.call(t,o.id)||(t[o.id]=!!a.doubleSided);const l=s||!!a.doubleSided;l!==t[o.id]&&(e.impl.setDoubleSided(l,o,r),t[o.id]=l)};var n=this.impl.modelQueue().getModels();0===n.length?this.addEventListener(w.MODEL_ADDED_EVENT,this._setDoubleSided):(n.forEach((e=>{this._setDoubleSided({model:e},!1)})),this.impl.sceneUpdated())}))},ee.prototype.setNavigationLock=function(e){const t=this.navigation.getIsLocked();return t!==e&&(this.navigation.setIsLocked(e),this.dispatchEvent({type:w.NAVIGATION_MODE_CHANGED_EVENT,id:this.getActiveNavigationTool()})),t},ee.prototype.getNavigationLock=function(){return this.navigation.getIsLocked()},ee.prototype.setNavigationLockSettings=function(e){this.navigation.setLockSettings(e),this.dispatchEvent({type:w.NAVIGATION_MODE_CHANGED_EVENT,id:this.getActiveNavigationTool()})},ee.prototype.getNavigationLockSettings=function(){return this.navigation.getLockSettings()},ee.prototype.setActiveNavigationTool=function(e){if(e===this._pushedTool||!e&&!this._pushedTool)return!0;if(this._pushedTool){if(!this.impl.controls.deactivateTool(this._pushedTool))return!1;this.impl.controls.setToolActiveName(this.getDefaultNavigationToolName()),this._pushedTool=null}return(!e||e===this.getDefaultNavigationToolName())&&null===this._pushedTool?(this.dispatchEvent({type:w.NAVIGATION_MODE_CHANGED_EVENT,id:this.getDefaultNavigationToolName()}),!0):!!this.impl.controls.activateTool(e)&&(this._pushedTool=e,this.dispatchEvent({type:w.NAVIGATION_MODE_CHANGED_EVENT,id:this._pushedTool}),!0)},ee.prototype.getActiveNavigationTool=function(){return this._pushedTool?this._pushedTool:this._defaultNavigationTool},ee.prototype.setDefaultNavigationTool=function(e){this._defaultNavigationTool&&this.impl.controls.deactivateTool(this._defaultNavigationTool);var t=this._pushedTool;this._pushedTool=null,t&&this.impl.controls.deactivateTool(t),this.impl.controls.activateTool(e),this._defaultNavigationTool=e,t&&(this.impl.controls.activateTool(t),this._pushedTool=t)},ee.prototype.getDefaultNavigationToolName=function(){return this._defaultNavigationTool},ee.prototype.getFOV=function(){return this.navigation.getVerticalFov()},ee.prototype.setFOV=function(e){this.navigation.setVerticalFov(e,!0)},ee.prototype.getFocalLength=function(){return this.navigation.getFocalLength()},ee.prototype.setFocalLength=function(e){this.navigation.setFocalLength(e,!0)},ee.prototype.hideLines=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.hideLines is not applicable to 2D"):this.prefs.set(a.Prefs3D.LINE_RENDERING,!e)},ee.prototype.hidePoints=function(e){this.prefs.set(a.Prefs.POINT_RENDERING,!e)},ee.prototype.setDisplayEdges=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setDisplayEdges is not applicable to 2D"):this.prefs.set(a.Prefs3D.EDGE_RENDERING,e)},ee.prototype.applyCamera=function(e,t){this.impl.setViewFromCamera(e,!0),t&&this.fitToView()},ee.prototype.fitToView=function(e,t,i){var n=[];e&&(e.length>0&&e[0].model?n=e:e.length>0&&n.push({model:t||this.model,selection:e})),this.impl.fitToView(n,i)},ee.prototype.setClickConfig=function(e,t,i){var n=this.clickHandler?this.clickHandler.getClickBehavior():this.impl.controls.getClickBehavior();if(e in n){var r=n[e];if(t in r)return r[t]=i,!0}return!1},ee.prototype.getClickConfig=function(e,t){var i=this.clickHandler?this.clickHandler.getClickBehavior():this.impl.controls.getClickBehavior();if(e in i){var n=i[e];if(t in n)return n[t]}return null},ee.prototype.setClickToSetCOI=function(e,t){!1!==t&&this.prefs.set(a.Prefs3D.CLICK_TO_SET_COI,e);var i=this.getClickConfig("click","onObject");e?-1===i.indexOf("setCOI")&&this.setClickConfig("click","onObject",["setCOI"]):i.indexOf("setCOI")>=0&&this.setClickConfig("click","onObject",["selectOnly"])},ee.prototype.setProfile=function(e,t){if(!e)return!1;this.profile=e,this.profile.apply(this.prefs,t);const i=this.profile.extensions&&this.profile.extensions.unload||[],n=this.profile.extensions&&this.profile.extensions.load||[];i.forEach((e=>{this.isExtensionLoaded(e)&&this.unloadExtension(e)})),n.forEach((e=>{this.isExtensionLoaded(e)||this.loadExtension(e,this.config)})),this.dispatchEvent({type:Autodesk.Viewing.PROFILE_CHANGE_EVENT,profile:e})},ee.prototype.initSettings=function(e){if(!this.profile){const t=new s.Profile(e);this.setProfile(t)}},ee.prototype.setLightPreset=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setLightPreset is not applicable to 2D"):this.prefs.set(a.Prefs3D.LIGHT_PRESET,e)},ee.prototype.setUsePivotAlways=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setUsePivotAlways is not applicable to 2D"):this.prefs.set(a.Prefs3D.ALWAYS_USE_PIVOT,e)},ee.prototype.setReverseZoomDirection=function(e){this.prefs.set(a.Prefs.REVERSE_MOUSE_ZOOM_DIR,e)},ee.prototype.setReverseHorizontalLookDirection=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setReverseHorizontalLookDirection is not applicable to 2D"):this.prefs.set(a.Prefs3D.REVERSE_HORIZONTAL_LOOK_DIRECTION,e)},ee.prototype.setReverseVerticalLookDirection=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setReverseVerticalLookDirection is not applicable to 2D"):this.prefs.set(a.Prefs3D.REVERSE_VERTICAL_LOOK_DIRECTION,e)},ee.prototype.setZoomTowardsPivot=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setZoomTowardsPivot is not applicable to 2D"):this.prefs.set(a.Prefs3D.ZOOM_TOWARDS_PIVOT,e)},ee.prototype.setOrbitPastWorldPoles=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setOrbitPastWorldPoles is not applicable to 2D"):this.prefs.set(a.Prefs3D.ORBIT_PAST_WORLD_POLES,e)},ee.prototype.setUseLeftHandedInput=function(e){this.prefs.set(a.Prefs.LEFT_HANDED_MOUSE_SETUP,e)},ee.prototype.setDisplayUnits=function(e){this.prefs.set(a.Prefs.DISPLAY_UNITS,e)},ee.prototype.setDisplayUnitsPrecision=function(e){null==e&&(e=""),this.prefs.set(a.Prefs.DISPLAY_UNITS_PRECISION,e)},ee.prototype.setLayerVisible=function(e,t,i){var n=this.impl.layers;null===e?t?n.showAllLayers():n.hideAllLayers():(Array.isArray(e)||(e=[e]),i&&n.hideAllLayers(),this.impl.setLayerVisible(e,t)),this.dispatchEvent({type:w.LAYER_VISIBILITY_CHANGED_EVENT})},ee.prototype.isLayerVisible=function(e){return!!(e&&e.isLayer&&this.impl.isLayerVisible(e))},ee.prototype.anyLayerHidden=function(){for(var e=this.impl.getLayersRoot(),t=e&&e.children,i=t?t.length:0,n=0;n<i;++n)if(!this.impl.layers.isLayerVisible(t[n]))return!0;return!1},ee.prototype.allLayersHidden=function(){for(var e=this.impl.getLayersRoot(),t=e&&e.children,i=t?t.length:0,n=0;n<i;++n)if(this.impl.layers.isLayerVisible(t[n]))return!1;return!0},ee.prototype.hideHiddenObjects=function(){let e=this.impl.model;this.impl.handleInitialVisibility(e),X.analytics.track("viewer.hideHiddenObjects",{})},ee.prototype.setGroundShadowColor=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundShadowColor is not applicable to 2D"):this.impl.setGroundShadowColor(e)},ee.prototype.setGroundShadowAlpha=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundShadowAlpha is not applicable to 2D"):this.impl.setGroundShadowAlpha(e)},ee.prototype.setGroundReflectionColor=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundReflectionColor is not applicable to 2D"):this.impl.setGroundReflectionColor(e)},ee.prototype.setGroundReflectionAlpha=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.setGroundReflectionAlpha is not applicable to 2D"):this.impl.setGroundReflectionAlpha(e)},ee.prototype.getCutPlanes=function(){return this.model&&this.model.is2d()?(o.logger.warn("Viewer3D.getCutPlanes is not applicable to 2D"),[]):this.impl.getCutPlanes()},ee.prototype.setCutPlanes=function(e){this.model&&this.model.is2d()?o.logger.warn("Viewer3D.getCutPlanes is not applicable to 2D"):this.impl.setCutPlaneSet("__set_view",e)},ee.prototype.getScreenShot=function(e,t,i,n){return G.ScreenShot.getScreenShotLegacy(this,e,t,i,n)},ee.prototype.setContextMenu=function(e){this.contextMenu&&this.contextMenu.hide(),this.contextMenu=e||null},ee.prototype.setDefaultContextMenu=function(){var e=Autodesk.Viewing.Extensions;return!(!e||!e.ViewerObjectContextMenu)&&(this.setContextMenu(new e.ViewerObjectContextMenu(this)),!0)},ee.prototype.triggerContextMenu=function(e){return this.config&&this.config.onTriggerContextMenuCallback&&this.config.onTriggerContextMenuCallback(e),!!this.contextMenu&&(this.contextMenu.show(e),!0)},ee.prototype.triggerSelectionChanged=function(e){this.config&&this.config.onTriggerSelectionChangedCallback&&this.config.onTriggerSelectionChangedCallback(e)},ee.prototype.triggerDoubleTapCallback=function(e){this.config&&this.config.onTriggerDoubleTapCallback&&this.config.onTriggerDoubleTapCallback(e)},ee.prototype.triggerSingleTapCallback=function(e){this.config&&this.config.onTriggerSingleTapCallback&&this.config.onTriggerSingleTapCallback(e)},ee.prototype.triggerSwipeCallback=function(e){this.config&&this.config.onTriggerSwipeCallback&&this.config.onTriggerSwipeCallback(e)},ee.prototype.initContextMenu=function(){(!this.config||!Object.prototype.hasOwnProperty.call(this.config,"disableBrowserContextMenu")||this.config.disableBrowserContextMenu)&&(this.onDefaultContextMenu=function(e){e.preventDefault()},this.container.addEventListener("contextmenu",this.onDefaultContextMenu,!1));var e=this,t=this.canvas||this.container;this.onMouseDown=function(t){m.EventUtils.isRightClick(t)&&(e.startX=t.clientX,e.startY=t.clientY)},t.addEventListener("mousedown",this.onMouseDown),this.onMouseUp=function(t){if(m.EventUtils.isRightClick(t)&&t.clientX===e.startX&&t.clientY===e.startY){if(this.viewer.impl.isRightBtnSelectionEnabled()){const e=this.viewer.impl.clientToViewport(t.clientX,t.clientY),i=this.viewer.impl.hitTestViewport(e,!1),n=null==i?void 0:i.dbId,r=this.viewer.getSelection();if(void 0!==n&&!r.includes(n))return;if(void 0===n&&r.length)return}e.triggerContextMenu(t)}return!0},t.addEventListener("mouseup",this.onMouseUp,!1)},ee.prototype.registerContextMenuCallback=function(e,t){this.contextMenuCallbacks[e]=t},ee.prototype.unregisterContextMenuCallback=function(e){return e in this.contextMenuCallbacks&&(delete this.contextMenuCallbacks[e],!0)},ee.prototype.runContextMenuCallbacks=function(e,t){for(var i in this.contextMenuCallbacks)Object.prototype.hasOwnProperty.call(this.contextMenuCallbacks,i)&&this.contextMenuCallbacks[i](e,t)},ee.prototype.setModelUnits=function(e){this.model&&(this.model.getData().overriddenUnits=e)},ee.prototype.worldToClient=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.impl.camera;return this.impl.worldToClient(e,t)},ee.prototype.clientToWorld=function(e,t,i,n,r){return this.impl.clientToWorld(e,t,i,n,r)},ee.prototype.modelHasTopology=function(){return!(!this.model||!this.model.hasTopology())},ee.prototype.setSelectionColor=function(e,t){this.impl.setSelectionColor(e,t)},ee.prototype.set2dSelectionColor=function(e,t){this.impl.set2dSelectionColor(e,t)},ee.prototype.setTheme=function(e){for(var t=this.container.classList,i=0;i<t.length;++i){-1!==t[i].indexOf("-theme")&&t.remove(t[i--])}t.add(e)},ee.prototype.setThemingColor=function(e,t,i,n){(i=i||this.model).setThemingColor(e,t,n),this.impl.invalidate(!0)},ee.prototype.clearThemingColors=function(e){(e=e||this.model).clearThemingColors(),this.impl.invalidate(!0)},ee.prototype.setMaterialsToDefaults=function(e){const t=(e||this.model).getFragmentList();if(!t)return;const i=e.isConsolidated()||e.isConsolidating();i&&e.unconsolidate(!1,!0),t.restoreOriginalMaterials(),i&&this.impl.consolidateModel(e).then((()=>{this.impl.invalidate(!0,!0)}))},ee.prototype.transferModel=function(e,t){var i,n=this.impl.findModel(e);if(n){var r=[];this.getAggregateSelection((function(t,i){t.id==e&&r.push(i)}));var o=this.impl.visibilityManager.getIsolatedNodes(n),s=this.impl.visibilityManager.getHiddenNodes(n),a=this.impl.matman().exportModelMaterials(n);this.impl.unloadModel(n,!0),null===(i=n.getFragmentList())||void 0===i||i.dispose(this.impl.glrenderer()),n.isAEC()&&n.is3d()&&t.impl.setLightPresetForAec(),t.impl.setRenderingPrefsFor2D(n.is2d()),t.impl.addModel(n),t.impl.matman().importModelMaterials(a,e),t._loadingSpinner.hide(),n.loader&&n.loader.viewer3DImpl===this.impl&&(n.loader.viewer3DImpl=t.impl),n.getData().loadDone&&t.impl.onLoadComplete(n),t.impl.selector.setSelection(r,n),0!=o.length?t.impl.visibilityManager.isolate(o,n):0!=s.length&&t.impl.visibilityManager.hide(s,n)}},ee.prototype.hideModel=function(e){var t=this.impl.modelQueue();return!!(e="number"==typeof e?t.findModel(e):e)&&(this.impl.removeModel(e),t.addHiddenModel(e),!0)},ee.prototype.showModel=function(e,t){var i=this.impl.modelQueue();return!!(e="number"==typeof e?i.findHiddenModel(e):e)&&(i.removeHiddenModel(e),this.impl.addModel(e,t),!0)},ee.prototype.getVisibleModels=function(){return this.impl.modelQueue().getModels().slice()},ee.prototype.getHiddenModels=function(){return this.impl.modelQueue().getHiddenModels().slice()},ee.prototype.getAllModels=function(){return this.impl.modelQueue().getAllModels().slice()},ee.prototype.getFirstModel=function(){return this.impl.is2d?this.impl.get2DModels()[0]:this.impl.get3DModels()[0]},ee.prototype.getUnderlayRaster=function(e){return this.getAllModels().find((t=>{var i,n;const r=t.getDocumentNode();return r&&(null===(i=r.getDocument())||void 0===i?void 0:i.getPath())===(null===(n=e.getDocument())||void 0===n?void 0:n.getPath())&&r.guid()===e.guid()&&t.getData().underlayRaster}))},ee.prototype.restoreDefaultSettings=function(){var e=this.model,t=e.is2d()?"2d":"3d";this.prefs.reset(t),this.impl.setupLighting(e),e.isAEC()&&e.is3d()&&this.impl.setLightPresetForAec(),this.impl.setRenderingPrefsFor2D(!e.is3d()),this.fireEvent({type:w.RESTORE_DEFAULT_SETTINGS_EVENT})},ee.prototype.disableHighlight=function(e){this.impl.disableHighlight(e)},ee.prototype.disableSelection=function(e){e&&this.clearSelection(),this.impl.disableSelection(e)},ee.prototype.isHighlightDisabled=function(){return this.impl.selector.highlightDisabled},ee.prototype.isHighlightPaused=function(){return this.impl.selector.highlightPaused},ee.prototype.isHighlightActive=function(){return!(this.impl.selector.highlightDisabled||this.impl.selector.highlightPaused)},ee.prototype.isSelectionDisabled=function(){return this.impl.selector.selectionDisabled},ee.prototype.activateExtension=function(e,t){return this.loadedExtensions&&e in this.loadedExtensions?this.loadedExtensions[e].activate(t):(o.logger.warn("Extension is not loaded or doesn't exist"),!1)},ee.prototype.deactivateExtension=function(e){return this.loadedExtensions&&e in this.loadedExtensions?this.loadedExtensions[e].deactivate():(o.logger.warn("Extension is not loaded or doesn't exist"),!1)},ee.prototype.isExtensionActive=function(e,t){return this.loadedExtensions&&e in this.loadedExtensions?this.loadedExtensions[e].isActive(t):(o.logger.warn("Extension is not loaded or doesn't exist"),!1)},ee.prototype.isExtensionLoaded=function(e){return this.loadedExtensions&&e in this.loadedExtensions},ee.prototype.getLoadedExtensions=function(){return this.loadedExtensions||[]},ee.prototype.getExtensionModes=function(e){return this.loadedExtensions&&e in this.loadedExtensions?this.loadedExtensions[e].getModes():(console.warn("Extension is not loaded or doesn't exist"),[])},ee.prototype.reorderElements=function(e){var t=e.getAttribute("layer-order-id"),i=this.containerLayerOrder.indexOf(t),n=null;if(-1!==i)for(var r=i+1;r<this.containerLayerOrder.length&&!n;r++)n=this.container.querySelector('[layer-order-id="'+this.containerLayerOrder[r]+'"]');n?this.container.insertBefore(e,n):this.container.appendChild(e)},ee.prototype.appendOrderedElementToViewer=function(e){var t=this.container.querySelector('[layer-order-id="'+e+'"]');if(t)return t;var i=this.getDocument().createElement("div");return i.setAttribute("layer-order-id",e),this.reorderElements(i),i},ee.prototype.hitTest=function(e,t,i){return this.impl.hitTest(e,t,i)},ee.prototype.refresh=function(e){this.impl.invalidate(e,!1,!e,!e)},ee.prototype.chooseProfile=function(e){let t=this.profileManager.PROFILE_DEFAULT;return this.config&&this.config.profileSettings?t=new s.Profile(this.config.profileSettings):e&&e.useFileProfile?t=this.profileManager.getProfileOrDefault(e.fileExt):e.isAEC&&(t=this.profileManager.PROFILE_AEC),t}},55066:(e,t,i)=>{"use strict";i.r(t),i.d(t,{InitParametersSetting:()=>J,Viewer3DImpl:()=>te,createRenderer:()=>ee});var n=i(55280),r=i(18817),o=i(28441),s=i(47263),a=i(88190),l=i(62612),c=i(27579),h=i(13843),u=i(97005),d=i(65802),f=i(19356),p=i(83081),m=i(90255),g=i(45383),v=i(24528),y=i(22267),b=i(15371),x=i(19129),_=i(14859),E=i(73674),S=i(54561),A=i(12360),w=i(8600),T=i(26217),M=i(36411),C=i(81760),P=i(38749),D=i(72091),L=i(63841),I=i(19556),R=i(17016),O=i(18310),N=i(99211),F=i(12153),U=i(26206),B=i(35922),k=i(71211),V=i(25004),G=i(53870);class z{_callbacks;_numberOfTotalDrawCalls;_numberOfInjections;constructor(){this._callbacks=new Array,this._numberOfTotalDrawCalls=0,this._numberOfInjections=0,this.counters={drawArrays:0,drawArraysInstanced:0,drawElements:0,drawElementsInstanced:0,total:0}}initialize(e){e instanceof WebGL2RenderingContext?(this.#s(e),this.#a(e)):console.debug("Draw calls cannot be intruded and counted: Valid context object expected, given",e)}uninitialize(){}resetCounters(){for(const e of this._callbacks)e.continuous?e.callCountOnLastInvocation-=this.counters.total:e.callCountOnLastInvocation=0;this.counters.drawArrays=0,this.counters.drawArraysInstanced=0,this.counters.drawElements=0,this.counters.drawElementsInstanced=0,this.counters.total=0}inject(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];Number.isInteger(t)&&t<0?console.warn("After-draw-call callback injection ignored. Number of calls ignored before invocation must be a positive number, given",t):this._callbacks.push({callback:e,numberOfCallsIgnoreBeforeInvocation:t,callCountOnLastInvocation:0,continuous:i})}#l(e,t){if(void 0!==e)return function(){e.apply(this,arguments),t.apply(this)}}#c(){if(++this.counters.total,++this._numberOfTotalDrawCalls,0!==this._callbacks.length)for(const e of this._callbacks)this.counters.total-e.callCountOnLastInvocation<=e.numberOfCallsIgnoreBeforeInvocation||(e.callback(),e.callCountOnLastInvocation=this.counters.total,++this._numberOfInjections)}#s(e){e.drawArrays=this.#l(e.drawArrays,(()=>{++this.counters.drawArrays,this.#c()})),e.drawArraysInstanced=this.#l(e.drawArraysInstanced,(()=>{++this.counters.drawArraysInstanced,this.#c()})),e.drawElements=this.#l(e.drawElements,(()=>{++this.counters.drawElements,this.#c()})),e.drawElementsInstanced=this.#l(e.drawElementsInstanced,(()=>{++this.counters.drawElementsInstanced,this.#c()})),e.drawRangeElements=this.#l(e.drawRangeElements,(()=>{++this.counters.drawElements,this.#c()}))}#a(e){}}const H={WEBGL_CONTEXT_LOST:"webglcontextlost",WEBGL_CONTEXT_RESTORED:"webglcontextrestored"};class W extends G.WebGLRenderer{static DEFAULT_NUM_DRAW_CALLS_TO_INJECT_FLUSH_AFTER_IOS=1e3;_drawCallIntrusion;#h;#u;#d;constructor(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(i),null===(e=i.canvas)||void 0===e||e.addEventListener("webglcontextlost",(()=>{this.fireEvent({type:H.WEBGL_CONTEXT_LOST})})),null===(t=i.canvas)||void 0===t||t.addEventListener("webglcontextrestored",(()=>{this.fireEvent({type:H.WEBGL_CONTEXT_RESTORED})})),this.refCount=0;const r=parseInt((0,n.getIOSVersion)(),10);if((0,n.isIOSDevice)()&&r>=15){this._drawCallIntrusion=new z,this._drawCallIntrusion.initialize(this.getContext());const e=W.DEFAULT_NUM_DRAW_CALLS_TO_INJECT_FLUSH_AFTER_IOS-1;this._drawCallIntrusion.inject((()=>{this.getContext().flush()}),e,!0),console.debug(e<1?"LMVRenderer: Additional context flushes will be invoked after every draw call.":`LMVRenderer: Additional context flushes will be invoked after ${e+1} subsequent draw calls.`)}else this._drawCallIntrusion=void 0;this.#h=[],this.loadingAnimationDuration=-1,this.highResTimeStamp=-1,this.#u=this.render,this.#d=this.setRenderTarget,this.render=W.prototype.render.bind(this),this.setRenderTarget=W.prototype.setRenderTarget.bind(this)}supportsMRT(){return console.warn("LMVRenderer: .supportsMRT() has been deprecated. It always returns true."),!0}updateTimestamp(e){return this.highResTimeStamp=e}getLoadingAnimationDuration(){return this.loadingAnimationDuration}setLoadingAnimationDuration(e){return this.loadingAnimationDuration=e}clearBlend(){this.state.setBlending(D.NoBlending)}isWebGL2(){return console.warn("LMVRenderer: .isWebGL2() has been deprecated. It always returns true."),!0}render(e,t,i){this.#u(e,t,!1,i)}notifyFinalFrameRendered(e){void 0!==this._drawCallIntrusion&&this._drawCallIntrusion.resetCounters()}setRenderTarget(e){this.#d(e)}}V.EventDispatcher.prototype.apply(W.prototype),W.Events=H;var j=i(44745),q=i(57480);function X(){var e,t,i,r,o,s={},a=0,l=0,c=0,h=0,u=1,d=!1,f=!1,m={},g={},v=[0,0],y=1,b=1,x=!1,_=0,E=0,S=0,A=!1,w=0,T=[.42,0,1,1],M=!0,C={antialias:!0,sao:!1,useHdrTarget:!1,haveTwoSided:!1,customPresentPass:!1,envMapBg:!1,numIdTargets:3,renderEdges:!1,copyDepth:!1},P={},L=!1,I=null;function R(e,t){if(e&&t){t.length=0;for(let i=0;i<e.length;i++)t[i]=e[i]}}function O(t,i,n){i=i||0;const r=function(t){return t!==E&&(E=t,-1===t&&(t=0),e.getBlendSettings().setHighlightObjectId(t),!0)}(t),o=function(t){return t!==S&&(S=t,e.getBlendSettings().setHighlightModelId(t),!0)}(i);if(r||o)return A=!0,e.getBlendSettings().setHighlightIntensity(0),_=performance.now(),!0}function N(t){e.getBlendSettings().setGlowFlag(t),w=t}this.settings=C,this.isWeakDevice=function(){return x},this.init=function(t,i,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t.initSync(i,s),x=(0,n.isMobileDevice)(),r=i,o=s,e=t,f=!!a.offscreen},this.setDepthMaterialOffset=function(e,t,i){},this.setUserFinalPass=function(e){I=e},this.overlayUpdate=function(){if(A)return A=!1,!0;if(0===w&&(0===E||-1===E))return!1;var t=e.getBlendSettings().getHighlightIntensity(),i=1;if(M){var n=.004*(performance.now()-_);n=Math.min(n,1),i=function(e,t){var i=3*e[1],n=3*(e[3]-e[1])-i;return(((1-i-n)*t+n)*t+i)*t}(T,n)}return t!==i&&(e.getBlendSettings().setHighlightIntensity(i),!0)},this.setRollOverFadeEnabled=function(e){M=e},this.beginScene=function(o,a,l,c){if(t=a,i=l,s={},!L&&r)this.initPostPipeline(C.sao,C.antialias),L=!0;else if(!r)return void(d||(0,n.isNodeJS)()||(p.logger.error("Rendering to a canvas that was resized to zero. If you see this message you may be accidentally leaking a viewer instance.",(0,q.errorCodeString)(q.ErrorCodes.VIEWER_INTERNAL_ERROR)),d=!0));c&&(e.getEnvMapPass().setCamera(t,y),e.renderBackground(C.envMapBg),e.clearMainTargets()),C.sao||e.getBlendSettings().setAOEnabled(!1),e.beginScene(t,i),e.renderScenePart(o,C.renderEdges)},this.renderScenePart=function(t,i,n,r){s={},e.renderScenePart(t,C.renderEdges)},this.clearAllOverlays=function(){e.clearOverlayTargets()},this.renderOverlays=function(i,n){let r=!1;e.clearOverlayTargets();for(let o in i){let s=i[o],a=s.scene,l=s.camera?s.camera:t;a.children.length&&(r||(r=!0),e.renderOverlay(a,l,s.materialPre,s.materialPost,C.renderEdges,s.edgeColor,n))}e.getBlendSettings().setUseOverlay(r)},this.computeSSAO=function(i){!i&&C.sao?(e.getSAO().run(t),e.getBlendSettings().setAOEnabled(!0)):e.getBlendSettings().setAOEnabled(!1)},this.getFinalTarget=function(){return null},this.presentBuffer=function(t,i){e.present(C.antialias,i,t||I)},this.composeFinalFrame=function(t,i,n){e&&(this.computeSSAO(t),i||this.presentBuffer(void 0,n))},this.cleanup=function(){e&&e.cleanup(),s={},m={},g={}},this.setSize=function(t,i,n,s){if(r=t,o=i,C.logicalWidth=t,C.logicalHeight=i,0===t&&0===i||!e)this.cleanup();else{var a=0|t*e.getPixelRatio(),l=0|i*e.getPixelRatio();C.deviceWidth=a,C.deviceHeight=l,s||(f?e.setViewport(0,0,t,i):e.setSize(t,i))}},this.getMaxAnisotropy=function(){return e?e.getMaxAnisotropy():0},this.mrtFlags=function(){return{mrtNormals:!0,mrtIdBuffer:!0}},this.getAntialiasing=function(){return C.antialias},this.initPostPipeline=function(e,t){C.sao=e,C.antialias=t,this.setSize(r,o)},this.setClearColors=function(t,i){i||(i=t),e.getGradientPass().setClearColors(t.x,t.y,t.z,i.x,i.y,i.z)},this.useOverlayAlpha=function(e){b=e},this.setClearAlpha=function(e){y=e},this.setAOEnabled=function(t){C.sao=t,P.sao=C.sao,e.getBlendSettings().setAOEnabled(t),this.setSize(r,o,!1,!0)},this.setAOOptions=function(t,i,n){let r;if(void 0!==t){let e=this.getUnitScale();t/=e,r=.01/e}e.getSAO().setAOOptions(t,r,i),void 0!==n&&e.getBlendSettings().setAOBias(n)},this.getAOEnabled=function(){return C.sao},this.getAORadius=function(){return console.log("getAORadius TODO"),0},this.getAOIntensity=function(){return console.log("getAOIntensity TODO"),0},this.getAOBias=function(){return console.log("getAOBias TODO"),0},this.setCubeMap=function(t){e.getEnvMapPass().setCubeMap(t),t||this.toggleEnvMapBackground(!1)},this.setEnvRotation=function(t){c=t,e.getEnvMapPass().setEnvRotation(t)},this.getEnvRotation=function(){return c},this.setEnvExposure=function(t){e.getEnvMapPass().setEnvExposure(t),a=t},this.setTonemapExposureBias=function(t){l=t,e.getEnvMapPass().setExposureBias(t)},this.getExposureBias=function(){return l},this.setCamera=function(e){t=e},this.setTonemapMethod=function(t){h=t,e.gammaInput=0!==t,e.getEnvMapPass().setTonemapMethod(t)},this.getToneMapMethod=function(){return h},this.toggleTwoSided=function(e){C.haveTwoSided=e},this.toggleEdges=function(e){C.renderEdges=e,P.renderEdges=e},this.toggleEnvMapBackground=function(e){C.envMapBg=e},this.idAtPixel=function(e,t,i){return this.idAtPixels(e,t,1,i)},this.idAtPixels=function(t,i,n,r){n%2==0&&(n+=1);let o=e.getRenderTargets(),a=o.getTargetSize();const l=.5*(t+1)*a[0]-.5*(n-1)|0,c=.5*(1-i)*a[1]-.5*(n-1)|0;if(s[n]&&l===s[n][4]&&c===s[n][5])return R(s[n],r),s[n][0];const h=4*n*n;m[h]||(m[h]=new Uint8Array(h));const u=m[h];let d;return g[h]||(g[h]=new Uint8Array(h)),d=g[h],o.readIdTargetPixelsSyncOrFail(l,c,n,n,[u,d]),function(t,i,n,r,o,a){let l,c=0,h=0,u=0,d=-1,f=e.getRenderTargets().getTargetSize();s[n]=[-1,-1,null,null,t,i];for(let e=0;e<n*n;e++){const e=c+(n-1)/2,a=h+(n-1)/2;if(e>=0&&e<=n&&a>=0&&a<=n){const c=4*(e+a*n);if(l=r[c+3]<<24|r[c+2]<<16|r[c+1]<<8|r[c],s[n][0]=l,o){let e=o[c+1]<<8|o[c];s[n][1]=e<<16>>16}if(s[n][2]=2*(t+e)/f[0]-1,s[n][3]=-(2*(i+a)/f[1]-1),-1!==l)break}if(c==h||c<0&&c==-h||c>0&&c==1-h){const e=u;u=-d,d=e}c+=u,h+=d}return R(s[n],a),l}(l,c,n,u,d,r)},this.rolloverObjectViewport=function(e,t){this.idAtPixel(e,t,v),this.rolloverObjectId(v[0],null,v[1])},this.rolloverObjectId=function(e,t,i){return N(0),O(e,i)},this.rollOverModelId=function(e){return N(0),O(1,e)},this.setRollOverHighlightColor=function(t){e.getBlendSettings().setRolloverHighlightColor(t)},this.setDbIdForEdgeDetection=function(t,i){e.getBlendSettings().setEdgeHighlightObjectId(t,i)},this.setGlowFlagAndColor=function(t,i,n){t?(O(0,0),t!==w&&(N(t),_=performance.now())):N(0),e.getBlendSettings().setGlowOptions(i,n||0)},this.setEdgeColor=function(e){},this.setSelectionColor=function(t){var i=new D.Color(t);i.r=Math.pow(i.r,2),i.g=Math.pow(i.g,2),i.b=Math.pow(i.b,2),e.getBlendSettings().setSelectionColor(i),C.selectionColor=t},this.setUnitScale=function(t){let i=u/t;u=t,e.getSAO().setUnitScale(i)},this.getUnitScale=function(){return u},this.getColorTarget=function(){},this.getCurrentFramebuffer=function(){return e.getCurrentFramebuffer()},this.setCutPlanes=function(t){e.getIBL().setCutPlanes(t)},this.getConfig=function(){let t=e.getGradientPass().getClearColors();return{renderEdges:C.renderEdges,envMapBackground:C.envMapBg,envMap:e.getEnvMapPass().getCubeMap(),envExposure:a,toneMapExposureBias:l,envRotation:this.getEnvRotation(),tonemapMethod:h,clearColorTop:new D.Vector3(t[0],t[1],t[2]),clearColorBottom:new D.Vector3(t[3],t[4],t[5]),clearAlpha:y,useOverlayAlpha:b,aoEnabled:this.getAOEnabled(),aoRadius:this.getAORadius(),aoIntensity:this.getAOIntensity(),twoSided:C.haveTwoSided,unitScale:this.getUnitScale(),antialias:this.getAntialiasing(),selectionColor:C.selectionColor}},this.applyConfig=function(e){this.toggleEdges(e.renderEdges),this.toggleEnvMapBackground(e.envMapBackground),this.setCubeMap(e.envMap),this.setEnvExposure(e.envExposure),this.setTonemapExposureBias(e.toneMapExposureBias),this.setEnvRotation(e.envRotation),this.setTonemapMethod(e.tonemapMethod),this.toggleTwoSided(e.twoSided),this.setEdgeColor(e.edgeColor),this.setUnitScale(e.unitScale),e.clearColor?this.setClearColors(e.clearColor):this.setClearColors(e.clearColorTop,e.clearColorBottom),this.setClearAlpha(e.clearAlpha),this.useOverlayAlpha(e.useOverlayAlpha);var t=e.aoEnabled!=this.getAOEnabled(),i=e.antialias!=this.getAntialiasing();(t||i)&&this.initPostPipeline(e.aoEnabled,e.antialias)},this.enter2DMode=function(e,t){P.sao=C.sao,P.antialias=C.antialias,P.renderEdges=C.renderEdges,P.selectionColor=C.selectionColor,this.setSelectionColor(t),C.renderEdges=!1,this.initPostPipeline(!1,!1)},this.exit2DMode=function(){C.renderEdges=P.renderEdges,P.selectionColor&&this.setSelectionColor(P.selectionColor),this.initPostPipeline(P.sao,P.antialias)}}var Y=i(57872),K=i(40508),Q=null,Z=(0,n.getGlobal)().ENABLE_DEBUG,$=(0,n.getGlobal)().ENABLE_DEBUG_RCS;let J={canvas:null,antialias:!1,alpha:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!0,stencil:!1,depth:!1,logarithmicDepthBuffer:!1};function ee(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,n.isNodeJS)())return;var i=Object.assign({},J,t);let r;i.canvas=e;try{if((0,Y.IsUsingWebGPU)()){const e=(0,K.cS)();r=new j.Renderer(e,i)}else r=new W(i)}catch(e){return null}return r.name="MainRenderer",!r.getContext||r.getContext&&!r.getContext()?null:(r.autoClear=!1,r.sortObjects=!1,r)}function te(e,t){var i=this;this.setGlobalManager(t.globalManager);var U,V,G,z,H,j,q=1e3/15,K=1e3/30,J=1,te=-1,ie=-1,ne=-1,re=null,oe="y";let se;var ae,le,ce,he,ue,de,fe,pe,me=null,ge=null,ve=null,ye=!1,be=!1,xe=!1,_e={type:I.PROGRESS_UPDATE_EVENT,state:o.ProgressState.LOADING,percent:0},Ee=!1,Se=!1,Ae=!1,we=0,Te={magnitude:4,depthDampening:0},Me=0,Ce=1e3/60,Pe=0,De=!0,Le=!1,Ie=!1,Re=null,Oe=null;this.edgeColorMain=new D.Vector4(0,0,0,.3),this.edgeColorGhosted=new D.Vector4(0,0,0,.1);var Ne,Fe,Ue,Be=(0,n.getGlobal)(),ke=!1,Ve=e=>{var t=e.model;this.canvas&&t&&t.getData()&&t.getData().stdSurfMats&&t.getData().stdSurfMats.materials&&this.api.loadExtension("Autodesk.StandardSurface").then((e=>{e&&e.processModel(t)}))},Ge=e=>e.model.modelRootLoaded=!0,ze=e=>{null!=e&&e.model&&!pe.findModel(e.model.id)||this.invalidate(!1,!0)},He={},We=!1,je="",qe=!0,Xe=!1;function Ye(e){var t;const n=null===(t=e.frags)||void 0===t?void 0:t.is2d;var r=Ne.phase,o=!0,s=r==v.RenderFlags.RENDER_NORMAL,a=le.settings.idbuffer&&r!=v.RenderFlags.RENDER_HIDDEN,l=r==v.RenderFlags.RENDER_HIDDEN?i.edgeColorGhosted:i.edgeColorMain;le.setEdgeColor(l),r!=v.RenderFlags.RENDER_HIDDEN||e.ignoreFadeMaterial?r==v.RenderFlags.RENDER_HIGHLIGHTED&&(e.overrideMaterial=i.highlightMaterial):e.overrideMaterial=i.fadeMaterial;const c={type:I.RENDER_SCENE_PART,scene:e,wantColor:o,wantSAO:s,wantID:a,context:le};if(i.api.dispatchEvent(c),!i.is2d&&n)i.getSheetRenderer().renderScenePart(e,o,s,a);else{const t=Xe&&!i.is2d&&r==v.RenderFlags.RENDER_HIDDEN;t&&(e.edgesOnly=!0),le.renderScenePart(e,o,s,a),t&&(e.edgesOnly=void 0)}e.overrideMaterial=null}function Ke(e){if(!G)return;i.canvasBoundingclientRectDirty=!0,i.camera.aspect=z/H,i.camera.clientWidth=z,i.camera.clientHeight=H;const t=i.getWindow().devicePixelRatio;i.glrenderer().getPixelRatio()!==t&&i.glrenderer().setPixelRatio(t),le.setSize(z,H),i.controls.handleResize(),fe&&fe.setSize(z,H),ce&&ce.setSize(),i.invalidate(!0,!0,!0),G=!1,e||i.api.dispatchEvent({type:I.VIEWER_RESIZE_EVENT,width:z,height:H})}function Qe(){var e;if((de.enabled||fe)&&!i.is2d&&(e=i.model&&!i.model.isLoadDone()?i.model.getData().bbox:i.getVisibleBounds(!0,!1,void 0,void 0))){var t=i.camera,n=e.clone(),r=new D.Vector3(1,0,0),o=ge.clone();t.worldUpTransform&&(n.applyMatrix4(t.worldUpTransform),r.applyMatrix4(t.worldUpTransform),o.applyMatrix4(t.worldUpTransform)),n.min.y-=.005*(n.max.y-n.min.y),he&&he.expandByGroundShadow(n,o);var s=n.getSize(new D.Vector3),a=n.getCenter(new D.Vector3);if(he||(s.x*=1.25,s.z*=1.25,s.x=s.z=Math.max(s.x,s.z)),t.worldUpTransform){var l=t.worldUpTransform.clone().invert();a.applyMatrix4(l)}if(de.setTransform(a,s,t.worldup,r),fe){var c=(new D.Vector3).subVectors(a,t.worldup.clone().multiplyScalar(s.y/2));fe.setTransform(c,t.worldup,s)}he&&he.setGroundShadowTransform(a,s,t.worldup,r)}}function Ze(){he&&(he.state=y.SHADOWMAP_NEEDS_UPDATE)}this.useDeferredConsolidation=!1,e&&(this.interval=setInterval((function(){De||Pe<60||i.track({name:"fps",value:Number(i.fps().toFixed(2)),aggregate:"last"})}),3e4)),this.api=t,this.canvas=e,this.loader=null,this.canvasBoundingclientRectDirty=!0,this.nearRadius=0,this.defaultLoadingAnimationDuration=300,this.lastTime2dGeometryCreated=0,this.maxModelDistance=0,this.initialize=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(U=new D.Vector3(0,1,0),pe=new s.RenderScene,(Xe=(0,Y.IsUsingWebGPU)())&&console.warn("Using WebGPU renderer. Note that this option is experimental and still under development."),(ae=t.glrenderer||ee(e,t.webglInitParams))||(0,n.isNodeJS)()){ae&&(this.onWebGLcontextLost=this.onWebGLcontextLost.bind(this),this.onWebGLcontextRestored=this.onWebGLcontextRestored.bind(this),ae.addEventListener(W.Events.WEBGL_CONTEXT_LOST,this.onWebGLcontextLost),ae.refCount++,t.enableContextRestore&&(ae.enableContextRestore=!0,ae.addEventListener(W.Events.WEBGL_CONTEXT_RESTORED,this.onWebGLcontextRestored))),(le=t.renderer||(Xe?new X:new a.RenderContext)).init(ae,e?e.clientWidth:0,e?e.clientHeight:0,t),se=t.materialManager||new l.MaterialManager(ae),se.refCount++,this.useDeferredConsolidation=t&&void 0!==t.useDeferredConsolidation?!!t.useDeferredConsolidation:Y.USE_DEFERRED_CONSOLIDATION,this.camera=new L.UnifiedCamera(e?e.clientWidth:512,e?e.clientHeight:512),this.lightsOn=!1,this.lights=[],this.no_lights=[],Re=(new D.Color).setRGB(1,1,1),Oe=(new D.Color).setRGB(1,1,1),this.cameraChangedEvent={type:I.CAMERA_CHANGE_EVENT,camera:this.camera},me=new D.Vector3(1,1,1),ge=(new D.Vector3).copy(me),ve=new D.Vector3(-1,0,1),this.scene=new D.Scene,this.sceneAfter=new D.Scene,this.sceneAfter.sortObjects=!1,this.overlayScenes={},Et(),this.createOverlayScene("selection_points",null,null),this.selectionMeshes={},this.fadeMaterial=new D.MeshPhongMaterial({color:16777215,opacity:.1,reflectivity:0,transparent:!0,depthWrite:!1}),this.fadeMaterial.packedNormals=!0,se.addInstancingSupport(this.fadeMaterial),se.addMaterial("__fadeMaterial__",this.fadeMaterial,!0),this.setSelectionColor(6724095),se.togglePolygonOffset(!0),le.setDepthMaterialOffset(se.getPolygonOffsetOn(),se.getPolygonOffsetFactor(),se.getPolygonOffsetUnits()),this.progressiveRender=!0,this.swapBlackAndWhite=!1,this.targetFrameBudget=K,this.frameDisplayRate=5,(0,n.isMobileDevice)()&&(q*=2,K*=2,this.targetFrameBudget/=2,this.frameDisplayRate/=2),this.interruptBudget=1e10,this.controls={update:function(){this.camera.lookAt(this.camera.target),this.camera.updateProjectionMatrix(),this.camera.dirty=!1},handleResize:function(){},recordHomeView:function(){},uninitialize:function(){},isToolActivated:function(){return!1}},this.selector=new c.MultiModelSelector(this),this.visibilityManager=new h.MultiModelVisibilityManager(this),this.showGhosting=!0,this.showOverlaysWhileMoving=!0,this.skipAOWhenMoving=!1,this.keyFrameAnimator=null,this.zoomBoundsChanged=!0;var i=u.LightPresets[u.DefaultLightPreset].bgColorGradient;this.setClearColors(i[0],i[1],i[2],i[3],i[4],i[5]),(de=Xe?ae.getGroundShadowPass():new d.GroundShadow(ae)).enabled=!0,Ne=new it,Xe||(se.addMaterialNonHDR("groundShadowDepthMaterial",de.getDepthMaterial()),se.addOverrideMaterial("normalsMaterial",le.getDepthMaterial()),se.addOverrideMaterial("edgeMaterial",le.getEdgeMaterial())),le.beginScene(this.scene,this.camera,this.noLights,!0),le.composeFinalFrame(!0),this.api.addEventListener(I.MODEL_ROOT_LOADED_EVENT,Ve),this.api.addEventListener(I.MODEL_ROOT_LOADED_EVENT,Ge),this.api.addEventListener(I.LOADER_REPAINT_REQUEST_EVENT,ze)}},this.getSheetRenderer=function(){return ce||(ce=new k.A(i,le,ae,se)),ce},this.isSheetRendererNeeded=function(){return!i.is2d&&this.get2DModels().length>0},this.get2DModels=function(){return pe.getModels().filter((e=>e.is2d()))},this.get3DModels=function(){return pe.getModels().filter((e=>e.is3d()))},this.renderGroundShadow=function(e){he?he.state==y.SHADOWMAP_VALID&&he.renderGroundShadow(i.camera,e||le.getColorTarget()):(de.renderShadow(i.camera,e||le.getColorTarget()),de.rendered=!0)};var $e,Je,et,tt={NOTHING_DRAWN:0,MODEL_DRAWN:1,BACKGROUND_DRAWN:2,OVERLAY_DRAWN:4,REFLECTION_DRAWN:8,ALL_DRAWN:15};function it(){this.highResTimeStamp=-1,this.screenDrawn=tt.NOTHING_DRAWN,this.screenHasChanged=!1,this.frameBudget=0,this._usedFrameTime=0,this.frameTimeScalingFactorAvg=1,this.frameRemaining=0,this.phase=v.RenderFlags.RENDER_NORMAL,this.signalProgressByRendering=!1,this.tickCount=0,this.beginFrameAvg=0,this.lastBeginFrameTimeStamp=0,this.RENDERMODE_FULL=0,this.RENDERMODE_PROGRESSIVE=1,this.RENDERMODE_SILENT=2,this.renderType=this.RENDERMODE_FULL,this.INITIAL_GROUND_SHADOW=.2,this.cmdListActive=!1,this.cmdIndex=0,this.continueExecution=!0,this.encounteredAlwaysDo=!1,this.finishedFullRender=!0,this.groundShadowInPost=!1,this.drawOverlay=!1,this.cmdIsOpen=!1,this.allocArraySize=0,this.cmdListLength=0,this.cmdList=[],this.paramList=[],this.CMD_NORMAL_SEQUENCE=0,this.CMD_DO_AFTER=1,this.CMD_ALWAYS_DO=2,this.isActive=function(){return this.cmdListActive},this.setFrame=function(e){this.frameBudget=e},this.beginCommandSet=function(){this.cmdListActive=!0,this.cmdIndex=0,this.cmdListLength=0,this.encounteredAlwaysDo=!1,this.tickCount=0,this.screenDrawn=tt.NOTHING_DRAWN,this.screenHasChanged=!1},this.endCommandSet=function(){this.cmdIsOpen&&(this.cmdIsOpen=!1,this.cmdListLength++)},this._internalSetParam=function(e,t){this.paramList[this.cmdIndex][e]=t},this.addCommand=function(e,t){for(this.cmdIsOpen&&this.cmdListLength++,this.cmdIsOpen=!0;this.allocArraySize<=this.cmdListLength;)this.cmdList[this.cmdListLength]={},this.paramList[this.cmdListLength]={},this.allocArraySize++;return this.cmdList[this.cmdListLength]=e,this.paramList[this.cmdListLength].executionLevel=t||this.CMD_NORMAL_SEQUENCE,this.encounteredAlwaysDo=this.encounteredAlwaysDo||t===this.CMD_ALWAYS_DO,this.cmdListLength},this.setParam=function(e,t){this.cmdIsOpen?this.paramList[this.cmdListLength][e]=t:Z&&p.logger.error("ERROR: cannot set param when no command is open!")},this.getParam=function(e){return Z&&void 0===this.paramList[this.cmdIndex][e]&&p.logger.error("ERROR: parameter "+e+" was never set for this command! Go fix it."),this.paramList[this.cmdIndex][e]},this.executeCommandList=function(){if(!Ne.cmdListActive)return Ne.lastBeginFrameTimeStamp=0,!0;var e;if(this.tickCount>0&&(Ne.lastBeginFrameTimeStamp=0),this.frameRemaining=this.frameBudget,Z&&this.cmdIsOpen&&p.logger.error("ERROR: should call endCommandSet before executing"),this.continueExecution=!0,$&&(0===this.tickCount&&console.log("==================="),console.log("Running commands for "+(Ne.renderType===Ne.RENDERMODE_PROGRESSIVE?"progressive":Ne.renderType===Ne.RENDERMODE_FULL?"full":"silent")+" render, for tick count "+this.tickCount)),this.encounteredAlwaysDo)for(var t=0;t<this.cmdIndex;)this.paramList[t].executionLevel>=Ne.CMD_ALWAYS_DO&&($&&console.log(" ALWAYS DO command "+t+": "+this.cmdList[t].name),this.cmdList[t]()),t++;for(;this.cmdIndex<this.cmdListLength;)(this.continueExecution||this.paramList[this.cmdIndex].executionLevel>=Ne.CMD_DO_AFTER)&&($&&console.log(" command "+this.cmdIndex+": "+this.cmdList[this.cmdIndex].name+" and "+Ne.frameRemaining+" frame budget remaining"),this.cmdList[this.cmdIndex]()&&($&&console.log(" >>> out of tick time with "+Ne.frameRemaining),e=this.cmdIndex,this.continueExecution=!1)),this.cmdIndex++;return Ne._usedFrameTime=Ne.frameBudget-Ne.frameRemaining,this.continueExecution?this.cmdListActive=!1:this.cmdIndex=e,this.tickCount++,!this.continueExecution}}function nt(){if(Ne.renderType===Ne.RENDERMODE_PROGRESSIVE)if(Ne.getParam("GenerateGroundShadow.afterBeauty")){if(Ne.frameRemaining=de.prepareGroundShadow(i.modelQueue(),0,Ne.frameRemaining),de.getStatus()==b.GroundFlags.GROUND_RENDERED){if(Ne.getParam("GenerateGroundShadow.signalRedraw"))return i.requestSilentRender(),$&&console.log(" $$$$ SIGNAL FULL GROUND SHADOW REDRAW"),!0;Ne.groundShadowInPost=!0}}else 0===Ne.tickCount&&de.prepareGroundShadow(i.modelQueue(),10,Y.USE_HLOD?3:void 0);else Ne.frameRemaining=de.prepareGroundShadow(i.modelQueue(),0,Ne.frameRemaining);return Ne.frameRemaining<0&&de.getStatus()===b.GroundFlags.GROUND_UNFINISHED}function rt(){return de.getStatus()!==b.GroundFlags.GROUND_UNFINISHED&&i.renderGroundShadow(),!1}function ot(){return Ne.renderType===Ne.RENDERMODE_PROGRESSIVE?Ne.getParam("GenerateGroundReflection.afterBeauty")?(Ne.frameRemaining=fe.prepareGroundReflection(de,i,!1,0,Ne.frameRemaining),fe.getStatus()==b.GroundFlags.GROUND_RENDERED&&(Ne.screenDrawn|=tt.REFLECTION_DRAWN,Ne.groundShadowInPost&&se.hasTransparentMaterial()&&i.requestDeferredSilentRender())):0===Ne.tickCount&&fe.prepareGroundReflection(de,i,!0,10,Y.USE_HLOD?5:void 0):Ne.frameRemaining=fe.prepareGroundReflection(de,i,!1,0,Ne.frameRemaining),Ne.frameRemaining<0&&fe.getStatus()===b.GroundFlags.GROUND_UNFINISHED}function st(){if(he.state===y.SHADOWMAP_NEEDS_UPDATE)Ne.frameRemaining=he.startUpdate(pe,Ne.frameRemaining,i.camera,ge,se);else if(he.state==y.SHADOWMAP_INCOMPLETE&&(Ne.frameRemaining=he.continueUpdate(pe,Ne.frameRemaining,se),he.state==y.SHADOWMAP_VALID))return i.requestSilentRender(),$&&console.log(" $$$$ SIGNAL FULL SHADOW MAP REDRAW"),!0;return Ne.frameRemaining<0&&he.state!==y.SHADOWMAP_VALID}function at(){he.state=y.SHADOWMAP_NEEDS_UPDATE}function lt(){if(Ne.signalProgressByRendering&&i.signalProgress(0,o.ProgressState.RENDERING),Ne.renderType===Ne.RENDERMODE_PROGRESSIVE){if(Ne.lastBeginFrameTimeStamp>0){var e=Ne.highResTimeStamp-Ne.lastBeginFrameTimeStamp;if(Y.USE_HLOD){const t=Ne._usedFrameTime&&!pe.isDone()?Ne._usedFrameTime/e:1;Ne.frameTimeScalingFactorAvg=.9*Ne.frameTimeScalingFactorAvg+.1*t}else Ne.beginFrameAvg=.75*Ne.beginFrameAvg+.25*e}Ne.lastBeginFrameTimeStamp=Ne.highResTimeStamp,i._updateTargetFrameBudget()}var t=Ne.getParam("BeginScene.clear");return le.beginScene(i.scene,i.camera,i.lightsOn?i.lights:i.no_lights,t),t&&(Ne.screenDrawn|=tt.BACKGROUND_DRAWN),Ne.getParam("BeginScene.signalCameraChanged")&&i.api.dispatchEvent(i.cameraChangedEvent),!1}function ct(){return Ne.phase=Ne.getParam("BeginPhase.phase"),$&&console.log(" render phase is now "+Ne.phase),pe.reset(i.camera,Ne.phase,Ne.getParam("BeginPhase.moved"),se.getCutPlanes(),We),!1}function ht(){return pe.isEmpty()||pe.isDone()||(Ne.screenDrawn|=tt.MODEL_DRAWN,Ne.frameRemaining=pe.renderSome(Ye,Ne.frameRemaining,Ne.frameTimeScalingFactorAvg),Xe&&ae.flushCommandQueue(),Ne.signalProgressByRendering&&(i.signalProgress(100*pe.getRenderProgress(),o.ProgressState.RENDERING),$&&console.log(" %%% percent done "+100*pe.getRenderProgress()))),!pe.isDone()}function ut(){return Ne.phase=v.RenderFlags.RENDER_FINISHED,le.renderScenePart(i.sceneAfter,!0,!0,!0),!1}function dt(){return Ne.phase=v.RenderFlags.RENDER_FINISHED,!1}function ft(){i.signalProgress(100,o.ProgressState.RENDERING)}function pt(){return i.isOverlayDirty()&&(i.clearOverlayDirtyFlag(),Ne.drawOverlay=!0),Ne.drawOverlay&&(!pe.isEmpty()&&pe.isDone()||i.showOverlaysWhileMoving?(i.renderOverlays(),Ne.screenDrawn|=tt.OVERLAY_DRAWN):(le.clearAllOverlays(),Ne.drawOverlay=!1)),!1}function mt(){Ne.screenDrawn|=tt.ALL_DRAWN}function gt(){if(Ne.screenDrawn&&(Ne.phase===v.RenderFlags.RENDER_FINISHED||Ne.tickCount%i.frameDisplayRate==0)){var e=!Ne.getParam("PostAndPresent.performAO")||(Ne.screenDrawn&(tt.BACKGROUND_DRAWN|tt.MODEL_DRAWN))==tt.BACKGROUND_DRAWN;le.composeFinalFrame(e),Ne.screenHasChanged=!0,Ne.screenDrawn=tt.NOTHING_DRAWN,t=Ne.highResTimeStamp,Pe++,Me<=t&&Me>0&&(Ce=.8*Ce+.2*(t-Me)),i.fpsCallback&&i.fpsCallback(i.fps()),i.api.dispatchEvent({type:I.RENDER_PRESENTED_EVENT})}var t;return!1}function vt(){return Z&&!1===le.getAOEnabled()&&p.logger.error("AO should be on at this point!"),le.setAOEnabled(!1),!1}function yt(){return Z&&!0===le.getAOEnabled()&&p.logger.error("AO should be off at this point!"),le.setAOEnabled(!0),!1}function bt(){return i.requestSilentRender(),!1}function xt(){return Ne.finishedFullRender=!0,!1}this.tick=function(e){e||(e=0),Ne.highResTimeStamp=e,ae.updateTimestamp(e);var t=se.updateMaterials();i.invalidate(t.needsClear,t.needsRender,t.overlayDirty);const n=function(e){if(i.keyFrameAnimator){var t=Me>0?(e-Me)/1e3:0,n=i.keyFrameAnimator.update(t);if(n&&(i.sceneUpdated(!0),n&i.keyFrameAnimator.UPDATE_CAMERA))return!0}return!1}(e),r=i.controls.update(e),o=pe&&pe.update(e),s=r||n||ue||o;ue=!1;var a=G;Ke(),ye||(ye=s),xe||(xe=s);var l=!1,c=le.overlayUpdate();xe?function(){for(var e in i.selectionMeshes){var t=i.selectionMeshes[e];if(t.model){var n,r=t.model.getFragmentList();t.geometry===(null===(n=r)||void 0===n?void 0:n.getGeometry(t.fragId))&&r.getWorldMatrix(t.fragId,t.matrix)}}}():c&&!xe&&(xe=l=!0),this.isLoadingAnimationEnabled()&&Me-i.lastTime2dGeometryCreated<=ae.getLoadingAnimationDuration()&&(be=!0);var h=i.model&&i.model.loader&&i.model.loader.pagingProxy&&i.model.loader.pagingProxy.getMemoryInfo();Ne.signalProgressByRendering=i.model&&i.model.isLoadDone()&&!i.model.isLeaflet()&&!h,Ee&&(Qe(),de.setDirty(),Ee=!1,1)&&(ye=!0);var u=ye,d=pe.frameResumePossible();if(ye=ye||!d,Ae=Ae||Se&&!Ne.cmdListActive,ye||be||xe||Ae)if(Ne.drawOverlay=xe||ye||be,ye||be||Ae){var f,p=u?x.ResetFlags.RESET_RELOAD:x.ResetFlags.RESET_NORMAL;ye||be?(i.progressiveRender?(Ne.renderType=Ne.RENDERMODE_PROGRESSIVE,f=i.targetFrameBudget):(Ne.renderType=Ne.RENDERMODE_FULL,f=i.interruptBudget),ye&&(Se=Ae=!1)):(Ne.renderType=Ne.RENDERMODE_SILENT,f=i.targetFrameBudget,ye=!0,p=x.ResetFlags.RESET_REDRAW,Se=Ae=!1),i.skipCameraUpdate||i.updateCameraMatrices(),Ne.setFrame(f),Ne.finishedFullRender=!1,Ne.beginCommandSet();var m=de.enabled&&!i.is2d&&!De,g=!!fe&&!i.is2d&&!De,b=s||a,_=s&&i.skipAOWhenMoving&&le.getAOEnabled();Ne.addCommand(lt),Ne.setParam("BeginScene.signalCameraChanged",b),Ne.setParam("BeginScene.clear",ye),_&&Ne.addCommand(vt,Ne.CMD_ALWAYS_DO),pe&&(he&&he.state!==y.SHADOWMAP_VALID&&Ne.addCommand(st),m&&(Ne.addCommand(nt),Ne.setParam("GenerateGroundShadow.afterBeauty",!1),Ne.setParam("GenerateGroundShadow.signalRedraw",!1)),g?(fe.setDirty(),Ne.addCommand(ot),Ne.setParam("GenerateGroundReflection.afterBeauty",!1)):m&&ye&&Ne.addCommand(rt),pe.hasHighlighted()&&(Ne.addCommand(ct),Ne.setParam("BeginPhase.phase",v.RenderFlags.RENDER_HIGHLIGHTED),Ne.setParam("BeginPhase.moved",p),p=!1,Ne.addCommand(ht)),Ne.addCommand(ct),Ne.setParam("BeginPhase.phase",v.RenderFlags.RENDER_NORMAL),Ne.setParam("BeginPhase.moved",p),p=!1,Ne.addCommand(ht),!pe.areAllVisible()&&i.showGhosting&&(g&&Ne.renderType===Ne.RENDERMODE_PROGRESSIVE||(Ne.addCommand(ct),Ne.setParam("BeginPhase.phase",v.RenderFlags.RENDER_HIDDEN),Ne.setParam("BeginPhase.moved",p),Ne.addCommand(ht))),Ne.addCommand(ut),Ne.signalProgressByRendering&&Ne.addCommand(ft)),Ne.addCommand(pt,Ne.renderType===Ne.RENDERMODE_PROGRESSIVE?Ne.CMD_DO_AFTER:Ne.CMD_NORMAL_SEQUENCE),Ne.addCommand(gt,Ne.renderType===Ne.RENDERMODE_PROGRESSIVE?Ne.CMD_DO_AFTER:Ne.CMD_NORMAL_SEQUENCE),Ne.setParam("PostAndPresent.performAO",le.getAOEnabled()&&!_),Ne.renderType===Ne.RENDERMODE_PROGRESSIVE&&pe&&(he&&he.state!==y.SHADOWMAP_VALID&&(Ne.addCommand(at),Ne.addCommand(st)),m&&(Ne.addCommand(nt),Ne.setParam("GenerateGroundShadow.afterBeauty",!0),Ne.setParam("GenerateGroundShadow.signalRedraw",!g),Ne.signalProgressByRendering&&Ne.addCommand(ft)),g&&(Ne.groundShadowInPost=!1,Ne.addCommand(ot),Ne.setParam("GenerateGroundReflection.afterBeauty",!0),!pe.areAllVisible()&&i.showGhosting&&(Ne.addCommand(ct),Ne.setParam("BeginPhase.phase",v.RenderFlags.RENDER_HIDDEN),Ne.setParam("BeginPhase.moved",p),Ne.addCommand(ht)),Ne.addCommand(dt),Ne.addCommand(gt),Ne.setParam("PostAndPresent.performAO",le.getAOEnabled()&&!_),Ne.signalProgressByRendering&&Ne.addCommand(ft))),_&&(Ne.addCommand(yt,Ne.CMD_ALWAYS_DO),Ne.addCommand(bt)),Ne.addCommand(xt),Ne.endCommandSet(),ye=!1,be=!1,this.clearOverlayDirtyFlag()}else Ne.finishedFullRender&&(Ne.beginCommandSet(),$&&console.log("=====\nOVERLAY DIRTY"),l?Ne.addCommand(mt):Ne.addCommand(pt,!0),Ne.addCommand(gt,!0),Ne.setParam("PostAndPresent.performAO",le.getAOEnabled()),Ne.signalProgressByRendering&&Ne.addCommand(ft),Ne.endCommandSet(),this.clearOverlayDirtyFlag());Ue=Ne.cmdListActive,i.onBeforeRender&&i.onBeforeRender(Ue),Ne.executeCommandList(),Ue!==qe&&(Ue||Xe||i.glrenderer().notifyFinalFrameRendered(),i.api.dispatchEvent({type:I.FINAL_FRAME_RENDERED_CHANGED_EVENT,value:{finalFrame:!Ue}}),qe=Ue),Me=Ne.highResTimeStamp},this.setLmvDisplay=function(e){Be=e},this.run=function(){j=!0,V=0,setTimeout((function(){j&&function e(t){V=Be.requestAnimationFrame(e),i.tick(t)}()}),1)},this.stop=function(){i.getWindow().cancelAnimationFrame(V),j=!1},this.toggleProgressive=function(e){this.progressiveRender=e,ye=!0},this.updateClearColors=function(){let e=this.clearColorTop,t=this.clearColorBottom;if(this.is2d&&this.swapBlackAndWhite){const i=e=>1===e.x&&1===e.y&&1===e.z,n=e=>0===e.x&&0===e.y&&0===e.z,r=e=>i(e)?new D.Vector3(0,0,0):n(e)?new D.Vector3(1,1,1):e;e=r(e),t=t&&r(t)}le.setClearColors(e,t)},this.toggleSwapBlackAndWhite=function(e){this.swapBlackAndWhite=e,this.updateClearColors(),ye=!0},this.toggleGrayscale=function(e){se.setGrayscale(e),ye=!0},this.toggleGhosting=function(e){this.showGhosting=e,ye=!0},this.toggleOverlaysWhileMoving=function(e){this.showOverlaysWhileMoving=e},this.togglePostProcess=function(e,t){le.initPostPipeline(e,t),this.fireRenderOptionChanged(),ye=!0},this.toggleCmdMapping=function(e,t){t.keyMapCmd=e},this.toggleGroundShadow=function(e){de.enabled!==e&&(de.enabled=e,de.clear(),e&&de.setDirty(),Qe(),this.fireRenderOptionChanged(),this.invalidate(!0,!1,!1))},this.isGroundShadowEnabled=function(){return de&&de.enabled},this.setGroundShadowColor=function(e){de.enabled&&(de.setColor(e),this.invalidate(!0,!1,!1))},this.setGroundShadowAlpha=function(e){de.enabled&&(de.setAlpha(e),this.invalidate(!0,!1,!1))},this.setRightBtnSelection=function(e){ke=e},this.isRightBtnSelectionEnabled=function(){return ke},this.toggleGroundReflection=function(e){e&&fe||!e&&!fe||(e?((fe=new _.GroundReflection(ae,this.canvas.clientWidth,this.canvas.clientHeight,{clearPass:le.getClearPass()})).setClearColors(this.clearColorTop,this.clearColorBottom,(0,n.isMobileDevice)()),fe.toggleEnvMapBackground(Le),fe.setEnvRotation(le.getEnvRotation()),Qe()):(fe.cleanup(),fe=void 0),this.fireRenderOptionChanged(),this.invalidate(!0,!1,!1))},this.setGroundReflectionColor=function(e){fe&&(fe.setColor(e),this.invalidate(!0,!1,!1))},this.setGroundReflectionAlpha=function(e){fe&&(fe.setAlpha(e),this.invalidate(!0,!1,!1))},this.toggleEnvMapBackground=function(e){Le=e,le.toggleEnvMapBackground(e),fe&&fe.toggleEnvMapBackground(e),this.invalidate(!0,!0,!1)},this.isEnvMapBackground=function(){return Le},this.setOptimizeNavigation=function(e){this.skipAOWhenMoving=e},this.getOverlayScenesToRender=function(){const e={};for(const[t,i]of Object.entries(this.overlayScenes))i.hiddenFromMainRender||(e[t]=i);return e},this.renderOverlays=function(){!function(){for(var e in i.selectionMeshes){var t=i.selectionMeshes[e];t.model&&t.model.isConsolidated()&&(t.model.updateRenderProxy(t,t.fragId),t.geometry||i.highlightFragment(t.model,t.fragId,!1))}}();var e,t=this.lightsOn;t||this.toggleLights(!0,!0),this.dir_light1&&(e=this.dir_light1.intensity,this.dir_light1.intensity=1);const n=this.getOverlayScenesToRender();le.renderOverlays(n,this.lightsOn?this.lights:this.no_lights),t||this.toggleLights(!1,!0),this.dir_light1&&(this.dir_light1.intensity=e)},this.setLayerVisible=function(e,t){this.layers.setLayerVisible(e,t)},this.isLayerVisible=function(e){return this.layers.isLayerVisible(e)},this.getVisibleLayerIndices=function(){return this.layers.getVisibleLayerIndices()},this.setNearRadius=function(e,t){this.nearRadius!==e&&(this.nearRadius=e,t&&this.invalidate(!0))},this.getNearRadius=function(){return this.nearRadius},this.updateNearFarValues=function(e,t){if(t.isEmpty())p.logger.warn("Calculating near-far values based on empty worldBox (infinity) will result in incorrect values - Better to keep previous values instead.");else{if(et||($e=new D.Matrix4,Je=new D.Matrix4,et=new D.Box3),$e.compose(e.position,e.quaternion,e.scale),Je.copy($e).invert(),et.copy(t),fe){var i=new D.Vector3;i.multiplyVectors(et.max,e.worldup);var n=new D.Vector3;n.multiplyVectors(et.min,e.worldup),i.sub(n),i.x>=0?et.min.x-=i.x:et.max.x-=i.x,i.y>=0?et.min.y-=i.y:et.max.y-=i.y,i.z>=0?et.min.z-=i.z:et.max.z-=i.z}he&&he.groundShapeBox&&et.union(he.groundShapeBox),et.applyMatrix4(Je);var r=1e-5*(et.max.z-et.min.z),o=.5*(et.max.y-et.min.y),s=-(et.max.z+r)-o,a=-(et.min.z-r)+o;if(e.isPerspective){this.nearRadius>0?(s=Math.max(s,Math.min(this.nearRadius,1e-4*Math.abs(a-s))),a=Math.min(a,1e4*s)):(s=Math.max(s,Math.min(1,1e-4*Math.abs(a-s))),a<0&&(a=1e-4),s=Math.max(s,1e-5*a));const i=Math.sqrt(F.SceneMath.pointToBoxDistance2(e.position,t)),n=Math.max(1,i);s=Math.min(s,n)}a=Math.max(a,s),e.near=s,e.far=a,e.updateCameraMatrices()}},this.getPixelsPerUnit=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.model;var n=le.settings.deviceHeight,r=se.getCutPlanesRaw()[0],o=i?i.getBoundingBox():t;return F.SceneMath.getPixelsPerUnit(e,this.is2d,t,n,r,o)},this.updateCameraMatrices=function(){const e=this.camera;e.worldup&&this.setWorldUp(e.worldup);const t=this.getVisibleBounds(!0,xe);this.updateNearFarValues(e,t),this.maxModelDistance&&this._applyMaxModelDistanceToNearFar();const i=this.getPixelsPerUnit(e,t),n=le.settings.deviceWidth,r=le.settings.deviceHeight;this.is2d?(se.updatePixelScale(i,n,r,e),se.updateSwapBlackAndWhite(this.swapBlackAndWhite)):se.updatePixelScale(i,n,r,e),Xe&&ae.getMainPass().updatePixelScale(i,e);this.get2DModels().forEach((t=>{const i=t.getModelToViewerTransform(),o=i?i.getMaxScaleOnAxis():1;if(!this.is2d||1!==o){const i=t.getVisibleBounds(),s=F.SceneMath.getPixelsPerUnit(e,!0,i,r,null,i);se.updatePixelScaleForModel(t,s,n,r,o,e)}}))},this.initLights=function(){Ie||(this.dir_light1=new D.DirectionalLight(Re,1),this.dir_light1.position.copy(ve),this.amb_light=new D.AmbientLight(Oe),this.lights=[this.dir_light1,this.amb_light],this.camera.add(this.dir_light1),this.camera.add(this.dir_light1.target),Ie=!0)};function _t(){if((0,n.isMobileDevice)())return;var e=pe.getModels().length;let t=le.mrtFlags();e>1&&t.mrtIdBuffer<2&&(le.setIdTargetCount(2)&&se.toggleMRTSetting(le.mrtFlags()))}this.toggleLights=function(e,t){this.amb_light&&(this.lightsOn=e,function(e,t,i,n){var r,o,s=u.LightPresets[te],a=s&&s.ambientColor,l=s&&s.directLightColor;a=(null===(r=a)||void 0===r?void 0:r.slice(0))??Oe.toArray(),l=(null===(o=l)||void 0===o?void 0:o.slice(0))??Re.toArray(),i?(n&&e?e.color.setRGB(.5*l[0],.5*l[1],.5*l[2]):e&&e.color.setRGB(a[0],a[1],a[2]),t&&t.color.setRGB(l[0],l[1],l[2])):e&&n&&e.color.setRGB(a[0],a[1],a[2])}(this.amb_light,this.dir_light1,e,t))},this.syncCamera=function(e){this.camera.updateCameraMatrices(),e&&this.setWorldUp(this.api.navigation.getWorldUpVector()),ue=!0},this.getModelCamera=function(e){if(!e)return;let t;const i=e.getDefaultCamera();return t=i||L.UnifiedCamera.getViewParamsFromBox(e.getBoundingBox(),e.is2d(),this.camera.aspect,this.camera.up,this.camera.fov),t},this.setViewFromFile=function(e,t){if(e){var i=this.getModelCamera(e),n=e.getMetadata("navigation hint","value",null),r=this.controls.isToolActivated("freeorbit")||t&&"Freeorbit"===n;this.setViewFromCamera(i,t,r)}},this.adjustOrthoCamera=function(e){var t=this.getVisibleBounds();L.UnifiedCamera.adjustOrthoCamera(e,t)},this.setViewFromCamera=function(e,t,i){this.adjustOrthoCamera(e);var n,r=this.model?this.model.getUpVector():null;n=r?(new D.Vector3).fromArray(r):i?e.up.clone():R.Navigation.snapToAxis(e.up.clone());const o=e.target.clone().sub(e.position).normalize().distanceTo(n.clone().negate())<1e-6;i?this.api.prefs&&this.api.prefs.set("fusionOrbitConstrained",n.equals(e.up)):o||(e.up=n);var s=this.api.navigation;if(s){var a=this.camera;if(t)a.up.copy(e.up),a.position.copy(e.position),a.target.copy(e.target),e.isPerspective?a.fov=e.fov:(a.saveFov=e.fov,a.fov=L.UnifiedCamera.ORTHO_FOV),a.isPerspective=e.isPerspective,a.orthoScale=e.orthoScale,a.dirty=!0,s.setWorldUpVector(i||o?n:a.up),s.setView(a.position,a.target),s.setPivotPoint(a.target),this.syncCamera(!0);else if(a.isPerspective=e.isPerspective,e.isPerspective||(a.saveFov=e.fov,e.fov=L.UnifiedCamera.ORTHO_FOV),i)s.setRequestTransitionWithUp(!0,e.position,e.target,e.fov,e.up,n);else{var l=this.getVisibleBounds();if(!l.containsPoint(e.target)){var c=l.getCenter(new D.Vector3).distanceTo(e.position),h=e.target.clone().sub(e.position).normalize().multiplyScalar(c);e.target.copy(e.position.clone().add(h))}var u=s.computeOrthogonalUp(e.position,e.target);s.setRequestTransitionWithUp(!0,e.position,e.target,e.fov,u,n)}}ue=!0},this.getViewArrayFromCamera=function(e){var t,i=e||{x:0,y:0,z:0},n=this.camera,r=this.model.getUpVector();t=r?(new D.Vector3).fromArray(r):R.Navigation.snapToAxis(n.up.clone());var o=this.api.navigation.getPivotPoint();return[n.position.x+i.x,n.position.y+i.y,n.position.z+i.z,o.x+i.x,o.y+i.y,o.z+i.z,t.x,t.y,t.z,n.aspect,D.Math.degToRad(n.fov),n.orthoScale,n.isPerspective?0:1]},this.setViewFromViewBox=function(e,t,i,n){if(!e.is2d())return;var r={},o=e.getBoundingBox(),s={width:t[2]-t[0],height:t[3]-t[1]};s.aspect=s.width/s.height,s.centerX=t[0]+s.width/2,s.centerY=t[1]+s.height/2;var a=this.camera.aspect;a>s.aspect?r.orthoScale=s.height:r.orthoScale=s.width/a;const l=o.getCenter(new D.Vector3);r.isPerspective=!1,r.position=new D.Vector3(s.centerX,s.centerY,l.z+r.orthoScale),r.target=new D.Vector3(s.centerX,s.centerY,l.z),r.target.y+=1e-6*s.height,r.up=new D.Vector3(0,0,1),this.setViewFromCamera(r,n,!1)},this.setWorldUp=function(e){if(!U.equals(e)){U.copy(e);var t=Math.abs(e.x);oe="x",Math.abs(e.y)>t&&(oe="y",t=Math.abs(e.y)),Math.abs(e.z)>t&&(oe="z");var n,r,o,s,a=new D.Vector3(0,1,0);i.camera.worldUpTransform=(n=a,r=e,o=(new D.Vector3).crossVectors(r,n).normalize(),s=Math.acos(n.dot(r)),(new D.Matrix4).makeRotationAxis(o,s)),this.sceneUpdated(!1)}},this.setUp2DMode=function(e,t){const n=e.getData();null!=n&&n.layerCount&&se.initLayersTexture(n.layerCount,n.layersMap,e.id);const r=se.create2DMaterial(null,{},!0,!1,(function(){i.invalidate(!1,!0,!1)})),o=se.findMaterial(null,r);if(!t){this.is2d&&le.exit2DMode(),le.enter2DMode(o,se.get2dSelectionColor()),this.is2d||this.saveLightPreset(),this.is2d=!0,this.setLightPreset(u.DefaultLightPreset2d),this.setRenderingPrefsFor2D(!0);const t=e.getData();if(null!=t&&t.hidePaper){var s=t.bgColor,a=s>>16&255,l=s>>8&255,c=255&s;this.setClearColors(a,l,c,a,l,c)}}},this.addModel=function(e,t){if(e){var i=!!this.model,n=e.is2d();this.model||e.getData().underlayRaster||(this.model=e,le.setUnitScale(e.getUnitScale())),this.layers||(this.layers=new E.ModelLayers(this)),e.getData().underlayRaster||this.layers.addModel(e,!0),pe.addModel(e),this.selector.addModel(e),this.visibilityManager.addModel(e),Xe&&ae.addModel(e),this._setModelPreferences(e),n?this.setUp2DMode(e,i):this.is2d?(this.is2d=void 0,le.exit2DMode()):ne>=0&&(ie=ne),this.updateClearColors(),this.setupLighting(e),_t(),this.fireRenderOptionChanged(),this.invalidate(!0),this.api.fireEvent({type:I.MODEL_ADDED_EVENT,model:e,preserveTools:t,isOverlay:i})}},this._setModelPreferences=function(e){e.hideLines(!this.api.prefs.get("lineRendering")),e.hidePoints(!this.api.prefs.get("pointRendering")),e.selector.setSelectionMode(this.api.prefs.get(B.Prefs3D.SELECTION_MODE))},this.setupLighting=function(e){e=e||this.model,(0,n.isNodeJS)()||!e||e.is2d()||(this.setLightPresetFromFile(e)||(ie>=0?(this.setLightPreset(ie,!0,re),ie=-1,re=null):this.setLightPreset(te,!1)),Xe||this.setAOHeuristics(e))},this.getSvfMaterialId=function(e){return this.model.getFragmentList().getSvfMaterialId(e)},this.getMaterials=function(){return se},this.setupMesh=function(e,t,i,n){const r={geometry:t,matrix:n};return i&&(r.material=this.matman().setupMaterial(e,t,i)),r.isLine=t.isLines,r.isWideLine=t.isWideLines,r.isPoint=t.isPoints,r.is2d=t.is2d,e.is2d()&&(r.geometry.creationTime=Me,this.lastTime2dGeometryCreated=Me),r},this.selection2dOverlayName=function(e){return se._getMaterialHash(e,"selection2d")},this.init2dSelection=function(e){var t=this.selection2dOverlayName(e);if(this.overlayScenes[t])return;var n=se.initSelectionTexture(e.getData().maxObjectNumber,e.id);const r=e.getFragmentList(),o=e.getDoNotCut();let s;if(null!=r&&r.viewBounds){const e=r.viewBounds;s=new D.Vector4(e.min.x,e.min.y,e.max.x,e.max.y)}var a=se.create2DMaterial(e,{doNotCut:o,viewportBounds:s},!1,n,(function(){i.invalidate(!1,!0,!1)})),l=se.findMaterial(e,a);this.createOverlayScene(t,l)},this.onLoadComplete=function(e){De=!1,this.signalProgress(100,o.ProgressState.LOADING,e),this.modelVisible(e.id)&&((de&&de.enabled||fe)&&this.sceneUpdated(!1,!0),this.invalidate(!!fe,!0,!1)),e.is2d()&&this.init2dSelection(e);var t=e.getGeometryList();t&&t.printStats(),e.hasGeometry()?se.hasTransparentMaterial()&&this.requestSilentRender():p.logger.warn("Loaded model has no geometry."),this.api.dispatchEvent({type:I.GEOMETRY_LOADED_EVENT,model:e})},this.onTextureLoadComplete=function(e){this.api.dispatchEvent({type:I.TEXTURES_LOADED_EVENT,model:e}),this.requestSilentRender()},this.signalProgress=function(e,t,i){_e.percent===e&&_e.state===t&&i&&_e.model&&_e.model.id===i.id||(_e.percent=e,_e.state=t,i&&(_e.model=i),this.api.dispatchEvent(_e))},this.resize=function(e,t,i){G=!0,z=e,H=t,i&&Ke(!0)},this.unloadModel=function(e,t){if(this.api.dispatchEvent({type:I.BEFORE_MODEL_UNLOAD_EVENT,model:e}),this.removeModel(e)||pe.removeHiddenModel(e)){var i,n;if(!t)if(e.dtor(),se.cleanup(e),e.loader)null===(i=(n=e.loader).dtor)||void 0===i||i.call(n),e.loader=null;e.is2d()&&this.overlayScenes[e.id]&&this.removeOverlayScene(this.selection2dOverlayName(e)),_e.model===e&&(_e.model=null),this.api.dispatchEvent({type:I.MODEL_UNLOADED_EVENT,model:e})}},this._reserveLoadingFile=function(){this.loaders||(this.loaders=[]);var e={dtor:function(){}};return this.loaders.push(e),e},this._hasLoadingFile=function(){return this.loaders&&this.loaders.length>0},this._addLoadingFile=function(e,t){if(this.loaders){var i=this.loaders.indexOf(e);i>=0&&(this.loaders[i]=t)}},this._removeLoadingFile=function(e){if(this.loaders){var t=this.loaders.indexOf(e);t>=0&&this.loaders.splice(t,1)}},this.removeModel=function(e){return!!pe.removeModel(e)&&(this.keyFrameAnimator&&(this.keyFrameAnimator.destroy(),this.keyFrameAnimator=null),this.selector.removeModel(e),this.visibilityManager.removeModel(e),this.layers.removeModel(e),Xe&&ae.removeModel(e),e===this.model&&(this.model=null,pe.isEmpty()||(this.model=pe.getModels()[0])),_t(),this.invalidate(!0,!0,!0),this.api.fireEvent({type:I.MODEL_REMOVED_EVENT,model:e}),!0)},this.cancelLoad=function(e){if(this.loaders)for(var t=0;t<this.loaders.length;t++){var i=this.loaders[t];if(i.currentLoadPath===e){i.dtor(),this.loaders.splice(t,1);break}}},this.unloadCurrentModel=function(){this.model&&(this.is2d?(this.is2d=void 0,this.removeOverlayScene(this.selection2dOverlayName(this.model)),le.exit2DMode()):ie=te,this.model.is3d()&&(ne=te),le.beginScene(this.scene,this.camera,this.lightsOn?this.lights:this.no_lights,!0),le.composeFinalFrame(!0)),this.loaders&&(this.loaders.forEach((function(e){e.dtor()})),this.loaders=[]);for(var e=pe.getAllModels(),t=e.length-1;t>=0;t--)this.unloadModel(e[t]);this.model=null};var Et=function(){var e,t,n;i.selectionMaterialBase=new D.MeshPhongMaterial({specular:526344,opacity:1,transparent:!1}),i.selectionMaterialTop=new D.MeshPhongMaterial({specular:526344,opacity:.15,transparent:!0}),i.selectionMaterialTop.packedNormals=!0,i.selectionMaterialBase.packedNormals=!0,e="selection",t=i.selectionMaterialBase,n=i.selectionMaterialTop,t.depthWrite=!1,t.depthTest=!0,t.side=D.DoubleSide,n.depthWrite=!1,n.depthTest=!0,n.side=D.DoubleSide,se.addInstancingSupport(t),se.addInstancingSupport(n),i.createOverlayScene(e,t,n),i.highlightMaterial=new D.MeshPhongMaterial({specular:526344,opacity:1,transparent:!1}),i.highlightMaterial.packedNormals=!0,i.highlightMaterial.disableTheming=!0,se.addInstancingSupport(i.highlightMaterial),se.addMaterial("__highlightMaterial__",i.highlightMaterial,!0)};this.createOverlayScene=function(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];t&&se.addOverrideMaterial(e+"_pre",t),i&&se.addOverrideMaterial(e+"_post",i);var a=new D.Scene;return a.__lights=this.scene.__lights,this.overlayScenes[e]={scene:a,camera:n,materialName:e,materialPre:t,materialPost:i,needIdTarget:r,needSeparateDepth:o,hiddenFromMainRender:s}},this.removeOverlayScene=function(e){if(this.overlayScenes[e]){var t=this.overlayScenes[e];t.materialPre&&se.removeMaterial(t.materialName+"_pre"),t.materialPost&&se.removeMaterial(t.materialName+"_post"),delete this.overlayScenes[e],this.invalidate(!1,!1,!0)}},this.addOverlay=function(e,t){this.overlayScenes[e]&&t&&(this.overlayScenes[e].scene.add(t),this.invalidate(!1,!1,!0))},this.addMultipleOverlays=function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&this.addOverlay(e,t[i])},this.removeOverlay=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.overlayScenes[e]&&t&&(this.overlayScenes[e].scene.remove(t),i&&t.geometry&&t.geometry.dispose(),this.invalidate(!1,!1,!0))},this.removeMultipleOverlays=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.removeOverlay(e,t[n],i)},this.clearOverlay=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.overlayScenes[e]){var i,n,r=this.overlayScenes[e].scene;for(n=r.children.length-1;n>=0;--n)(i=r.children[n])&&(r.remove(i),t&&i.geometry&&i.geometry.dispose());this.invalidate(!1,!1,!0)}},this.setClearColors=function(e,t,i,r,o,s){this.clearColorTop=new D.Vector3(e/255,t/255,i/255),this.clearColorBottom=new D.Vector3(r/255,o/255,s/255),this.updateClearColors(),fe&&fe.setClearColors(this.clearColorTop,this.clearColorBottom,(0,n.isMobileDevice)()),ye=!0,this.fireRenderOptionChanged()},this.setClearAlpha=function(e){le.setClearAlpha(e)};var St=new D.Box3;function At(e,t,i){t.updateMatrixWorld(!0),t.traverse((function(t){var n=t.geometry;const r=t.model&&"number"==typeof t.fragId;if(!r||n.boundingBox)void 0!==n&&t.visible&&(n.boundingBox||n.computeBoundingBox(),St.copy(n.boundingBox),St.applyMatrix4(t.matrixWorld),i&&!i(St)||e.union(St));else{const n=r&&t.model.getFragmentList();n&&(n.getWorldBounds(t.fragId,St),i&&!i(St)||e.union(St))}}))}var wt,Tt=new D.Box3;this.getVisibleBounds=function(e,t,n,r){var o=new D.Box3;return pe.isEmpty()||(At(o,this.scene,n),o=pe.getVisibleBounds(e,n,r).union(o),t&&(o=function(e){Tt.makeEmpty();var t=i.overlayScenes;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&At(Tt,t[n].scene,e);return At(Tt,i.scene,e),At(Tt,i.sceneAfter,e),Tt}(n).union(o))),o},this.getFitBounds=function(e){var t;return e||null===this.selector||(t=this.selector.getSelectionBounds()),t&&!t.isEmpty()||(t=this.getVisibleBounds()).isEmpty()&&this.model.is2d()&&(t=this.model.getBoundingBox()),t},this.getRenderProxy=function(e,t){var i;return null===(i=e.getFragmentList())||void 0===i?void 0:i.getVizmesh(t)},this.getLayersRoot=function(){return this.layers.getRoot()},this.getFragmentProxy=function(e,t){return new S.FragmentPointer(e.getFragmentList(),t)},this.getRenderProxyCount=function(e){return e.getFragmentList().getCount()},this.getRenderProxyDbIds=function(e,t){return e.getFragmentList().getDbIds(t)},this.isWholeModelVisible=function(){return!pe||pe.areAllVisible()},this.isNodeVisible=function(e,t){return this.visibilityManager.isNodeVisible(t,e)},this.highlightObjectNode=function(e,t,i,n){t=e.reverseMapDbIdFor2D(t),e.is2d()&&(se.highlightObject2D(t,i,e.id),this.invalidate(!1,!1,!0)),this.renderer().setDbIdForEdgeDetection(i&&!n?t:0,i?e.id:0);var r=this,o=e.getData().instanceTree;if(o&&!e.is2d())if(e.useIdBufferSelection){var s=e.getData().fragments.dbId2fragId[t];r.highlightFragment(e,s,i,n)}else o.enumNodeFragments(t,(function(t){r.highlightFragment(e,t,i,n)}),!1);else{let o=t;if(e.is2d()&&e.getData().fragments&&(o=e.getData().fragments.dbId2fragId[t]),Array.isArray(o))for(var a=0;a<o.length;a++)r.highlightFragment(e,o[a],i,n);else r.highlightFragment(e,o,i,n)}},this.highlightFragment=function(e,t,i,n){if(e.isLeaflet())return e.getIterator().highlightSelection(i,this.highlightMaterial.color),void this.invalidate(!0);var r=this.getRenderProxy(e,t);if(r){var o=!n||r.is2d||r.isPoint,s=e.id+":"+t;if(o){var a="selection";if(e.is2d()&&(a=this.selection2dOverlayName(e)),r.isPoint&&(a+="_points"),i)if(r.is2d&&Object.prototype.hasOwnProperty.call(this.selectionMeshes,s))++this.selectionMeshes[s]._lmv_highlightCount;else{var l;if(!r||!r.geometry)return;if(r.isPoint){var c=r.material.clone();c.color=this.selectionMaterialBase.color,c.needsUpdate=!0,c.defines&&r.geometry.attributes.pointScale&&(c.defines.PARTICLE_FLAGS=1),l=new D.Mesh(r.geometry,c)}else l=new D.Mesh(r.geometry,r.material);l.matrix.copy(r.matrixWorld),l.matrixAutoUpdate=!1,l.matrixWorldNeedsUpdate=!0,l.frustumCulled=!1,l.model=e,l.fragId=t,l._lmv_highlightCount=1,this.addOverlay(a,l),this.selectionMeshes[s]=l}else if(Object.prototype.hasOwnProperty.call(this.selectionMeshes,s)){var h=this.selectionMeshes[s];--h._lmv_highlightCount<=0&&(this.removeOverlay(a,h),delete this.selectionMeshes[s])}}o&&i||e.setHighlighted(t,i)&&this.invalidate(!0)}},this.explode=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=Object.keys(t);for(let e of i)Object.prototype.hasOwnProperty.call(Te,e)||p.logger.warn(`Property "${e}" is not part of Explode options.`);const n=(()=>{for(let e of i)if(Object.prototype.hasOwnProperty.call(Te,e)&&t[e]!=Te[e])return!1;return!0})();return((e=Number(e))!=we||!n)&&(we=e,i.filter((e=>Object.prototype.hasOwnProperty.call(Te,e))).forEach((e=>Te[e]=t[e])),this.refreshExplode(),this.api.dispatchEvent({type:I.EXPLODE_CHANGE_EVENT,scale:e,options:t}),!0)},this.refreshExplode=function(){pe.explode(we,Te),this.sceneUpdated(!0)},this.getExplodeScale=function(){return we},this.getExplodeOptions=function(){return{...Te}},this.lockExplode=function(e,t,i){const n=(i=i||this.model).getData().instanceTree;if(!n)return!1;const r=function(e,i){return n.enumNodeChildren(i,(function(i){e=n.lockNodeExplode(i,t)||e}),!0),e};let o;return o=Array.isArray(e)?e.reduce(r,!1):r(!1,e),o&&we>0&&(pe.explode(we),this.sceneUpdated(!0)),o},this.isExplodeLocked=function(e,t){const i=(t=t||this.model).getData().instanceTree;return i&&i.isNodeExplodeLocked(e)},this.setGhostingBrightness=function(e){var t=new D.Color(e?1052688:16777215);function i(e){e.color=t}i(this.fadeMaterial),this.fadeMaterial.variants&&this.fadeMaterial.variants.forEach(i),Xe&&ae.getMainPass().setGhostingBrightness(e)},this.loadCubeMapFromColors=function(e,t){var i=(0,A.CreateCubeMapFromColors)(e,t);return i.isBgColor=!0,se.setReflectionMap(i),i},this.loadCubeMap=function(e,t){this._reflectionMapPath=e;return m.TextureLoader.loadCubeMap(e,t,(function(t){e===i._reflectionMapPath&&se&&(se.setReflectionMap(t),Xe&&ae.getIBL().setReflectionMap(t),i.invalidate(!0),t?u.LightPresets[te].useIrradianceAsBackground||le.setCubeMap(t):i.loadCubeMapFromColors(i.clearColorTop,i.clearColorBottom))}))},this.loadIrradianceMap=function(e,t){this._irradianceMapPath=e;return m.TextureLoader.loadCubeMap(e,t,(function(t){e===i._irradianceMapPath&&se&&(se.setIrradianceMap(t),Xe&&ae.getIBL().setIrradianceMap(t),i.invalidate(!0),u.LightPresets[te].useIrradianceAsBackground&&le.setCubeMap(t))}))},this.setCurrentLightPreset=function(e){te=e},this.setLightPreset=function(e,t,i){var r;if((0,n.isNodeJS)()&&(e=0),this.initLights(),te===e&&!t)return void(i&&i());if((e<0||u.LightPresets.length<=e)&&(e=u.DefaultLightPreset),te=e,pe.isEmpty())return ie=te,void(re=i);var o=u.LightPresets[e],s=o.bgColorGradient;if(s||(s=u.BackgroundPresets.Custom),this.setClearColors(s[0],s[1],s[2],s[3],s[4],s[5]),void 0!==o.useIrradianceAsBackground&&(this.api.prefs.hasTag("envMapBackground","ignore-producer")?p.logger.debug("setLightPreset(): envMapBackground is locked. No changes."):(this.api.prefs.tag("no-storage","envMapBackground"),this.api.setEnvMapBackground(o.useIrradianceAsBackground))),o.path){var a="res/environments/"+o.path,l=(0,w.getResourceUrl)(a+"_mipdrop."+(o.type||"")+".dds"),c=(0,w.getResourceUrl)(a+"_irr."+(o.type||"")+".dds");this.loadIrradianceMap(c,o.E_bias),this.loadCubeMap(l,o.E_bias),se.setEnvExposure(-o.E_bias),Xe&&ae.getIBL().setEnvExposure(-o.E_bias),le.setEnvExposure(-o.E_bias),this.setTonemapExposureBias(o.E_bias),this.setTonemapMethod(o.tonemap),this.setGhostingBrightness(o.darkerFade)}else{var h=this.loadCubeMapFromColors(this.clearColorTop,this.clearColorBottom);le.setCubeMap(h),se.setIrradianceMap(null),Xe&&ae.getIBL().setIrradianceMap(),se.setEnvExposure(-o.E_bias||0),Xe&&ae.getIBL().setEnvExposure(-o.E_bias),le.setEnvExposure(-o.E_bias||0),this.setTonemapExposureBias(o.E_bias||0),this.setTonemapMethod(o.tonemap||0),this.setGhostingBrightness(o.darkerFade),le.toggleEnvMapBackground(Le),this.invalidate(!0)}const d=null===(r=pe)||void 0===r?void 0:r.getModels().filter((e=>{var t;const i=null==e?void 0:e.getDocumentNode(),n=(null==i?void 0:i.getInputFileType())||(null==i||null===(t=i.getRootNode())||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)||"";return["dwfx","dwf"].includes(n.toLowerCase())}));d.length>0&&d.forEach((e=>{se.forEachInModel(e,!1,(e=>{e.emissiveOrig||(e.emissiveOrig=e.emissive),e.emissive=e.emissiveOrig.clone().multiplyScalar(Math.pow(2,-o.E_bias))}))}));var f=T.SAOShader.uniforms.radius.value,m=T.SAOShader.uniforms.intensity.value,g=void 0;Xe&&(f=8,m=1,g=.25),Object.prototype.hasOwnProperty.call(o,"saoRadius")&&(f=o.saoRadius),Object.prototype.hasOwnProperty.call(o,"saoIntensity")&&(m=o.saoIntensity),Xe?le.setAOOptions(f,m,g):le.setAOOptions(f,m);var v=1;null!==o.lightMultiplier&&void 0!==o.lightMultiplier&&(v=o.lightMultiplier),ge.copy(me),o.lightDirection&&ge.fromArray(o.lightDirection).negate(),he&&Ze(),this.dir_light1&&(this.dir_light1.intensity=v,o.lightDirection?this.dir_light1.position.set(-o.lightDirection[0],-o.lightDirection[1],-o.lightDirection[2]):this.dir_light1.position.copy(ve)),se.setEnvRotation(o.rotation||0),le.setEnvRotation(o.rotation||0),fe&&fe.setEnvRotation(o.rotation||0),this.toggleLights(0!==v),this.invalidate(!0,!1,!0),this.fireRenderOptionChanged(),i&&i()},this.setLightPresetFromFile=function(e){if(!e||e.is2d())return!1;let t;var i=e.getMetadata("renderEnvironmentGroundReflection","value",null);t=this.api.prefs.hasTag(B.Prefs3D.GROUND_REFLECTION,"ignore-producer"),null===i||t||(this.api.prefs.tag("no-storage",B.Prefs3D.GROUND_REFLECTION),this.api.setGroundReflection(i));var r=e.getMetadata("renderEnvironmentGroundShadow","value",null);t=this.api.prefs.hasTag(B.Prefs3D.GROUND_SHADOW,"ignore-producer"),null===r||t||(this.api.prefs.tag("no-storage",B.Prefs3D.GROUND_SHADOW),this.api.setGroundShadow(r));var o=e.getMetadata("renderEnvironmentAmbientShadows","value",null);t=this.api.prefs.hasTag(B.Prefs3D.AMBIENT_SHADOWS,"ignore-producer"),null===o||t||(this.api.prefs.tag("no-storage",B.Prefs3D.AMBIENT_SHADOWS),this.api.setQualityLevel(o,le.getAntialiasing()));var s=e.getMetadata("renderEnvironmentDisplayLines","value",null);t=this.api.prefs.hasTag(B.Prefs3D.LINE_RENDERING,"ignore-producer"),null===s||t||(this.api.prefs.tag("no-storage",B.Prefs3D.LINE_RENDERING),this.api.hideLines(!s));var a=e.getMetadata("renderEnvironmentDisplayPoints","value",null);t=this.api.prefs.hasTag(B.Prefs.POINT_RENDERING,"ignore-producer"),null===a||t||(this.api.prefs.tag("no-storage",B.Prefs.POINT_RENDERING),this.api.hidePoints(!a));var l=e.getMetadata("renderEnvironmentDisplayEdges","value",null);t=this.api.prefs.hasTag(B.Prefs3D.EDGE_RENDERING,"ignore-producer"),null===l||t||(this.api.prefs.tag("no-storage",B.Prefs3D.EDGE_RENDERING),this.api.setDisplayEdges(!(0,n.isMobileDevice)()&&!!l));var c=e.getMetadata("renderEnvironmentStyle","value",null),h=u.LightPresets.filter((function(e){return e.name===c}))[0];if(t=this.api.prefs.hasTag(B.Prefs3D.LIGHT_PRESET,"ignore-producer"),h&&!t){this.api.prefs.tag("no-storage",B.Prefs3D.LIGHT_PRESET);var d=Q;d||(d=Q={},u.LightPresets.push(d)),(0,u.copyLightPreset)(h,d),d.name="Custom Model defined";var f=e.getMetadata("renderEnvironmentExposureBias","value",null),p=e.getMetadata("renderEnvironmentExposureBase","value",null);null!==f&&null!==p&&(d.E_bias=f+p);var m=e.getMetadata("renderEnvironmentBackgroundColor","value",null);t=this.api.prefs.hasTag(B.Prefs.BACKGROUND_COLOR_PRESET,"ignore-producer"),m&&!t&&(d.bgColorGradient=[255*m[0],255*m[1],255*m[2],255*m[0],255*m[1],255*m[2]]);var g=e.getMetadata("renderEnvironmentRotation","value",null);null!==g&&(d.rotation=g);var v=u.LightPresets.indexOf(d);this.setLightPreset(v,!0)}var y=e.getMetadata("renderEnvironmentBackgroundFromEnvironment","value",null);return t=this.api.prefs.hasTag(B.Prefs3D.ENV_MAP_BACKGROUND,"ignore-producer"),null===y||t||(this.api.prefs.tag("no-storage",B.Prefs3D.ENV_MAP_BACKGROUND),this.api.setEnvMapBackground(y)),h},this.setLightPresetForAec=function(){for(var e=(0,n.getGlobal)().DefaultLightPresetAec||"Boardwalk",t=-1,i=0;i<u.LightPresets.length;i++)if(u.LightPresets[i].name===e){t=i;break}return t>=0&&(this.api.prefs.hasTag("lightPreset","ignore-producer")?p.logger.debug("setLightPresetForAec(): lightPreset is locked. No changes."):(this.api.prefs.tag("no-storage","lightPreset"),this.setLightPreset(t,!0,function(){this.api.prefs.tag("ignore-producer","envMapBackground")}.bind(this)),this.saveLightPreset())),this.api.prefs.hasTag("edgeRendering","ignore-producer")?p.logger.debug("setLightPresetForAec(): edgeRendering is locked. No changes."):(this.api.prefs.tag("no-storage","edgeRendering"),this.api.setDisplayEdges(!(0,n.isMobileDevice)())),!0},this.setAOHeuristics=function(e){var t=e.getUnitScale(),i=e.getMetadata("renderEnvironmentAmbientShadows","radius",void 0),n=e.getMetadata("renderEnvironmentAmbientShadows","intensity",void 0),r=e.getMetadata("renderEnvironmentAmbientShadows","opacity",void 0);if(void 0!==i||void 0!==n||void 0!==r)le.setAOOptions(i/t,n,r);else if(e.isAEC()){t>.3?le.setAOOptions(4/t,1,.625):le.setAOOptions(.25/t,1,.625)}else{var o=e.getData().bbox.getSize(new D.Vector3).length();le.setAOOptions(Math.min(10,.05*o))}},this.setTonemapMethod=function(e){e!=le.getToneMapMethod()&&(le.setTonemapMethod(e),se.setTonemapMethod(e),Xe&&ae.getIBL().setTonemapMethod(e),this.fireRenderOptionChanged(),this.invalidate(!0))},this.setTonemapExposureBias=function(e){e!=le.getExposureBias()&&(le.setTonemapExposureBias(e),Xe&&ae.getIBL().setExposureBias(e),se.setTonemapExposureBias(e),this.fireRenderOptionChanged(),this.invalidate(!0))},this.setRenderingPrefsFor2D=function(e){if(!(0,n.isNodeJS)()){var t=!e&&!!this.api.prefs.get("envMapBackground");this.toggleEnvMapBackground(t)}},this.dtor=function(){var e;this.stop(),this.api.removeEventListener(I.MODEL_ROOT_LOADED_EVENT,Ve),this.api.removeEventListener(I.MODEL_ROOT_LOADED_EVENT,Ge),this.api.removeEventListener(I.LOADER_REPAINT_REQUEST_EVENT,ze),this.unloadCurrentModel(),this.controls=null,this.canvas=null,clearInterval(this.interval),this.loader=null,this.selector.dtor(),this.selector=null,this.model=null,this.layers=null,this.visibilityManager=null,Fe&&(Fe.removeViewer(this.api),Fe=null),pe=null,null===(e=le)||void 0===e||e.cleanup(),le=null,se.refCount--,0===se.refCount&&se.dtor(),se=null,ae&&(ae.refCount--,0===ae.refCount&&(ae.domElement=null,ae.context=null),ae.removeEventListener(W.Events.WEBGL_CONTEXT_LOST,this.onWebGLcontextLost),ae.removeEventListener(W.Events.WEBGL_CONTEXT_RESTORED,this.onWebGLcontextRestored),ae=null)},this.hideLines=function(e){pe&&!pe.isEmpty()&&(pe.hideLines(e),this.sceneUpdated(!0))},this.hidePoints=function(e){pe&&!pe.isEmpty()&&(pe.hidePoints(e),this.sceneUpdated(!0))},this.setDisplayEdges=function(e){le.toggleEdges(e);var t=e;e||(t=!(!this.model||!this.model.getData().hasLines)),se.togglePolygonOffset(t),le.setDepthMaterialOffset(se.getPolygonOffsetOn(),se.getPolygonOffsetFactor(),se.getPolygonOffsetUnits()),this.invalidate(!0)},this.setDoubleSided=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if((t=t||this.model).is2d())return;t.getData()&&(this.matman().setDoubleSided(e,t),i&&this.sceneUpdated())},this.getAllCutPlanes=function(){var e=void 0;for(var t in He){var i=He[t];i&&i.length&&(e=e?t===je?i.concat(e):e.concat(i):i)}return e},this.setCutplanesHideInterior=function(e){We=Boolean(e)},this.cutplanesHideInteriorEnabled=function(){return We},this.updateCutPlanes=function(){var e=this.getAllCutPlanes();this.setCutPlanes(e)},this.setCutPlaneSet=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(He[e]=t?t.slice():void 0,i)this.updateCutPlanes();else{var n=this.getAllCutPlanes();this.setCutPlanesInScene(n)}},this.setCutPlaneSetFor2DRendering=function(e){je=e,this.updateCutPlanes()},this.getCutPlaneSet=function(e){return He[e]||[]},this.getCutPlaneSets=function(){var e=[];for(var t in He){var i=He[t];i&&i.length&&e.push(t)}return e},this.getCutPlanes=function(){return se.getCutPlanes()},this.setCutPlanesInScene=function(e){le.toggleTwoSided(se.setCutPlanes(e,We?1:0)),Xe&&le.setCutPlanes(e),this.sceneUpdated()},this.setCutPlanes=function(e){this.setCutPlanesInScene(e),this.api.dispatchEvent({type:I.CUTPLANES_CHANGE_EVENT,planes:e})},this.fireRenderOptionChanged=function(){se.toggleMRTSetting(le.mrtFlags()),this.api.dispatchEvent({type:I.RENDER_OPTION_CHANGED_EVENT})},this.viewportToRay=function(e,t){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.camera).viewportToRay(e,t)},this.rayIntersect=function(e,t,i,n,r){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if(o.ignore2dModelsOn3d){const e=this.get3DModels().map((e=>e.id));n=n?n.filter((t=>e.includes(t))):e}var s=pe.rayIntersect(e.origin,e.direction,t,i,n,r,(e=>{const t=(new D.Vector3).copy(e);t.project(this.camera);const i=[];return le.idAtPixel(t.x,t.y,i),i}),o),a=[this.scene,this.sceneAfter];const l=new D.Vector3;for(let t=0;t<a.length;t++){let i=a[t];if(i.children.length){var c=new D.Raycaster(e.origin,e.direction,this.camera.near,this.camera.far);At(Tt,i),c.params.Line.threshold=Math.min(1,.5*Tt.getSize(l).length()*.001);var h=r||[];if(M.VBIntersector.intersectObject(i,c,h,!0),h.length){const e=h[0];(!s||e.distance<s.distance)&&(void 0!==e.modelId&&(e.model=this.findModel(e.modelId)),s=e)}}}return s?(void 0===s.dbId&&void 0!==s.fragId&&(s.dbId=s.model.getFragmentList().getDbIds(s.fragId),s.model.getData().instanceTree||(s.dbId=s.fragId)),s.intersectPoint=s.point,s):null},this.castRayViewport=function(e,t,i,n,r,o){return wt=wt||new D.Ray,pe?(this.viewportToRay(e,wt),this.rayIntersect(wt,t,i,n,r,o)):{}},this.getCanvasBoundingClientRect=function(){return this.canvasBoundingclientRectDirty&&(this.canvasBoundingclientRectDirty=!1,this.boundingClientRect=this.canvas.getBoundingClientRect()),this.boundingClientRect},this.clientToViewport=function(e,t){var i=this.getCanvasBoundingClientRect();return new D.Vector3((e+.5)/i.width*2-1,-(t+.5)/i.height*2+1,1)},this.viewportToClient=function(e,t){var i=this.getCanvasBoundingClientRect();return new D.Vector3(.5*(e+1)*i.width-.5,-.5*(t-1)*i.height-.5,0)},this.castRay=function(e,t,i,n){return this.castRayViewport(this.clientToViewport(e,t),i,void 0,void 0,void 0,n)},this.intersectGroundViewport=function(e){var t="z";this.is2d||(t=oe);var i=this.model&&this.model.getBoundingBox();return F.SceneMath.intersectGroundViewport(e,this.camera,t,i)},this.intersectGround=function(e,t){return this.intersectGroundViewport(this.clientToViewport(e,t))},this._2dHitTestViewport=function(e,t,i){const n=[0,0],r=le.idAtPixels(e.x,e.y,t,n);if(r<i)return null;const o=pe.findModel(n[1])||this.model;if(!o)return null;const s=this.intersectGroundViewport(e),a=o.getData().fragments,l=a?a.dbId2fragId[r]:-1;return{intersectPoint:s,dbId:o.remapDbIdFor2D(r),fragId:l,model:o}};const Mt=e=>t=>{if(!(t&&t.object&&t.object.isLine))return!0;const n=1/i.camera.pixelsPerUnitAtDistance(t.distance),r=e*n;return t.distanceToRay<r};function Ct(e,t,i,n){var r=e.getFragmentList().getGeometry(t);new C.VertexBufferReader(r).enumGeomsForVisibleLayer(i,n)}function Pt(e,t,i,n){var r=e.getFragmentList().getGeometry(t);new C.VertexBufferReader(r).enumGeomsForObject(i,n)}this.hitTestViewport=function(e,t,i,r,o,s){let a;if(this.is2d){const t=(0,n.isMobileDevice)()?45:5;a=this._2dHitTestViewport(e,t,1)}else a=this.castRayViewport(e,t,i,r,o,s);return a},this.hitTest=function(e,t,n,r,o,s){return i.hitTestViewport(this.clientToViewport(e,t),n,r,o,void 0,s)},this.hitBoxTestViewport=function(e,t,i){const n=[],r=[];le.idsAtPixelsBox(e.x,e.y,t,i,r);for(let e=0;e<r.length;e++){const t=pe.findModel(r[e][1])||this.model;if(t){const i=t.remapDbIdFor2D(r[e][0]);n.push({dbId:i,model:t})}}return n},this.snappingHitTestViewport=function(e,t){let i;const r=(0,n.isMobileDevice)()?45:17;if(this.is2d)if(this.model&&this.model.isLeaflet()){i={intersectPoint:this.intersectGroundViewport(e)}}else i=this._2dHitTestViewport(e,r,0);else{const n=[],o=le.idAtPixels(e.x,e.y,r,n);n[2]&&n[3]&&(e.setX(n[2]),e.setY(n[3]));const s={filter:Mt(r)};i=this.castRayViewport(e,t,o>0?[o]:null,void 0,void 0,s)}return i},this.snappingHitTest=function(e,t,i){return this.snappingHitTestViewport(this.clientToViewport(e,t),i)},this.clearHighlight=function(){le.rolloverObjectId(-1),this.invalidate(!1,!1,!0)},this.rollOverIdChanged=function(){this.api.fireEvent({type:I.OBJECT_UNDER_MOUSE_CHANGED,dbId:le.getRollOverDbId(),modelId:le.getRollOverModelId()}),this.invalidate(!1,!1,!0)},this.rolloverObjectViewport=function(e){if(!this.model)return;if(this.is2d&&this.model&&(this.model.isLeaflet()||this.model.isPdf(!0)&&this.api.prefs.get(B.Prefs2D.DISABLE_PDF_HIGHLIGHT)))return;const t=[],i=le.idAtPixel(e.x,e.y,t);if(this.selector&&this.selector.isNodeSelectionLocked(i,this.model))return void this.clearHighlight();const n=t[1],r=this.findModel(n);null!=r&&r.isLeaflet()?le.rollOverModelId(n)&&this.rollOverIdChanged():le.rolloverObjectViewport(e.x,e.y)&&this.rollOverIdChanged()},this.rolloverObject=function(e,t){this.selector.highlightPaused||this.selector.highlightDisabled||this.rolloverObjectViewport(this.clientToViewport(e,t))},this.pauseHighlight=function(e){this.selector.highlightPaused=e,e&&this.clearHighlight()},this.disableHighlight=function(e){this.selector.highlightDisabled=e,e&&this.clearHighlight()},this.disableSelection=function(e){this.selector.selectionDisabled=e},this.cancelLeafletScreenshot=function(){i.api.dispatchEvent({type:I.CANCEL_LEAFLET_SCREENSHOT})},this.getScreenShotProgressive=function(e,t,i,n){return r.ScreenShot.getScreenShot(e,t,i,n,this)},this.modelQueue=function(){return pe},this._getRcs=function(){return Ne},this.glrenderer=function(){return ae},this.renderer=function(){return le},this.setGeomCache=function(e){(Fe=e).addViewer(i.api)},this.geomCache=function(){return!Fe&&(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.setGeomCache(new f.OtgResourceCache(i.api.config)),Fe},this.shadowMaps=function(){return he},this.worldUp=function(){return U},this.worldUpName=function(){return oe},this.setUserRenderContext=function(e,t){le=e||new a.RenderContext,t||(le.init(ae,this.canvas.clientWidth,this.canvas.clientHeight),le.setClearColors(this.clearColorTop,this.clearColorBottom)),this.invalidate(!0),this.sceneUpdated(!1)},this.setUserGroundShadow=function(e){var t=de;return de=e,t},this.invalidate=function(e,t,i){ye||(ye=e),be||(be=t),xe||(xe=i)},this.isOverlayDirty=function(){return xe},this.clearOverlayDirtyFlag=function(){xe=!1},this.sceneUpdated=function(e,t,i){this.invalidate(!t,!1,!t),pe&&e&&(pe.invalidateVisibleBounds(),this.zoomBoundsChanged=!0),Ee=!0,Ze(),i||this.api.fireEvent({type:I.SCENE_UPDATED_EVENT,objectsMoved:e})},this.requestSilentRender=function(){Se=Ae=!0},this.requestDeferredSilentRender=function(){Se=!0},this.currentLightPreset=function(){return te},this.saveLightPreset=function(){ie=te},this.matman=function(){return se},this.fps=function(){return 1e3/Ce},this.setFPSTargets=function(e,t,i){q=1e3/i,J=1,K=1e3/t,this._updateTargetFrameBudget()},this._updateTargetFrameBudget=function(){var e;Y.USE_HLOD?this.targetFrameBudget=((null===(e=Ne)||void 0===e?void 0:e.frameTimeScalingFactorAvg)??1)*K:Ne.beginFrameAvg<K&&Ne.frameBudget<q?i.targetFrameBudget+=1:Ne.beginFrameAvg>K&&Ne.frameBudget>J&&(this.targetFrameBudget*=.75+.25*K/Ne.beginFrameAvg);this.targetFrameBudget=Math.min(Math.max(this.targetFrameBudget,J),q)},this.track=function(e){p.logger.track(e)},this.worldToClient=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.camera;var i=new D.Vector4(e.x,e.y,e.z,1);return i.applyMatrix4(t.matrixWorldInverse),i.applyMatrix4(t.projectionMatrix),i.w>0&&(i.x/=i.w,i.y/=i.w,i.z/=i.w),this.viewportToClient(i.x,i.y)},this.clientToWorld=function(e,t,i,n,r){var o=null;if(this.is2d){var s=this.model,a=null==s?void 0:s.getData(),l=this.intersectGround(e,t);l?(l.z=0,(n||a.hidePaper||a.bbox.containsPoint(l))&&(o={point:l,model:s})):n&&(o={point:this.camera.position.clone(),model:s})}else(o=this.hitTest(e,t,i,void 0,void 0,{ignore2dModelsOn3d:r}))&&(o.point=o.intersectPoint);return o},this.set2dSelectionColor=function(e,t){this.matman().set2dSelectionColor(e,t),this.invalidate(!1,!1,!0)},this.setSelectionColor=function(e,t){t=t||O.SelectionType.MIXED;var i=new D.Color(e);i.multiplyScalar(.5);var n=function(t){t.color.set(e),t.emissive.set(i),t.variants&&t.variants.forEach(n)};switch(t){default:case O.SelectionType.MIXED:n(this.selectionMaterialBase),n(this.selectionMaterialTop),le.setSelectionColor(e),n(this.highlightMaterial),this.invalidate(!0);break;case O.SelectionType.REGULAR:n(this.highlightMaterial),this.invalidate(!0);break;case O.SelectionType.OVERLAYED:n(this.selectionMaterialBase),n(this.selectionMaterialTop),le.setSelectionColor(e),this.invalidate(!1,!1,!0)}},this.updateViewportId=function(e){se.updateViewportId(e),this.invalidate(!0)},this.findModel=function(e,t){let i;if("number"==typeof e)i=t=>t.id==e;else if(e instanceof N.BubbleNode)i=t=>t.getDocumentNode()==e;else{if(!e)return null;i=e}let n=pe.getModels().find(i);return t&&!n&&(n=pe.getHiddenModels().find(i)),n},this.getFrameRate=function(){return this.frameDisplayRate},this.setFrameRate=function(e){this.frameDisplayRate=e<1?1:e},this.setShadowLightDirection=function(e){ge.copy(e),Ze(),this.invalidate(!0,!1,!1),Qe()},this.getShadowLightDirection=function(e){var t=e||new D.Vector3;return t.copy(ge),t},this.toggleShadows=function(e){!!he!=!!e&&(e?he=new y.ShadowMaps(ae):(he.cleanup(se),he=null),Qe(),this.invalidate(!0,!0,!1))},this.showTransparencyWhenMoving=function(e){pe.enableNonResumableFrames=e},this.fitToView=function(e,t){(t=!!t,0===e.length)&&(e=pe.getModels().map((function(e){return{model:e,selection:[]}})));if(0===e.length)return!1;for(var i=0,n=0;n<e.length;++n){var r=e[n].model;if(!r)return!1;r.is2d()&&i++}return!!(i===e.length?this._fitToView2d(e,t):this._fitToView3d(e,t))&&(1===pe.getModels().length&&this.api.dispatchEvent({type:I.FIT_TO_VIEW_EVENT,nodeIdArray:e[0].selection,immediate:t,model:e[0].model}),this.api.dispatchEvent({type:I.AGGREGATE_FIT_TO_VIEW_EVENT,selection:e,immediate:t}),!0)},this._fitToView2d=function(e,t){e.length>1&&p.logger.warn("fitToView() doesn't support multiple 2D models. Using the first one...");var i=e[0].model,n=e[0].selection,r=new D.Box3,o=new P.BoundsCallback(r);if(n&&0!==n.length)this.computeSelectionBounds(n,i,o);else if(this.api.anyLayerHidden())for(var s=i.getData().fragments,a=this.getVisibleLayerIndices(),l=0;l<s.length;l++)Ct(i,l,a,o);else r=this.getFitBounds(!0);return!r.isEmpty()&&(this.api.navigation.fitBounds(t,r),!0)},this.computeSelectionBounds=function(e,t,i){var n;i||(i=new P.BoundsCallback(new D.Box3));var r=null===(n=t.getData().fragments)||void 0===n?void 0:n.dbId2fragId;if(r){for(var o=0;o<e.length;o++){var s=t.reverseMapDbIdFor2D(e[o]),a=r[s];if(Array.isArray(a))for(var l=0;l<a.length;l++)Pt(t,a[l],s,i);else"number"==typeof a&&Pt(t,a,s,i)}i.bounds.applyMatrix4(t.getPlacementTransform())}else i.bounds.copy(t.getBoundingBox());return i.bounds},this.get3DBounds=function(e){for(var t=!1,i=0;i<e.length;++i)if(e[i].selection.length>0){t=!0;break}var n=new D.Box3,r=new D.Box3;if(t)for(var o=0;o<e.length;++o){var s=e[o].selection;if(0!==s.length){var a=e[o].model,l=a.getInstanceTree(),c=a.getFragmentList();if(l)for(var h=0;h<s.length;++h){var u=parseInt(s[h]);l.enumNodeFragments(u,(function(e){c.getWorldBounds(e,r),n.union(r)}),!0)}}}else n.union(this.getVisibleBounds(!1,!1));return n},this.onModelTransformChanged=function(e){if(this.sceneUpdated(),e.isConsolidated())for(var t in i.selectionMeshes){var n=i.selectionMeshes[t];n.model===e&&(n.needsUpdate=!0)}this.invalidate(!0,!0,!0),this.api.fireEvent({type:I.MODEL_TRANSFORM_CHANGED_EVENT,model:e,matrix:e.getModelTransform()})},this.setPlacementTransform=function(e,t){e.setPlacementTransform(t),this.api.fireEvent({type:I.MODEL_PLACEMENT_CHANGED_EVENT,model:e,matrix:e.getPlacementTransform()}),this.onModelTransformChanged(e)},this._fitToView3d=function(e,t){const i=this.get3DBounds(e);return!i.isEmpty()&&(this.api.navigation.fitBounds(t,i),!0)},this.onWebGLcontextLost=function(){ae.enableContextRestore&&(this._reconsolidateOnRestore=(0,g.fX)(this.api)),this.stop(),this.api.fireEvent({type:I.WEBGL_CONTEXT_LOST_EVENT})},this.onWebGLcontextRestored=async function(){await(0,g.v8)(this.api,this._reconsolidateOnRestore),this._reconsolidateOnRestore=null,le.clearAllOverlays(),de.setDirty(),fe&&fe.setDirty(),this.invalidate(!0,!0,!0),this.run(),this.api.fireEvent({type:I.WEBGL_CONTEXT_RESTORED_EVENT})},this.modelVisible=function(e){return!!pe.findModel(e)},this.handleInitialVisibility=function(e){p.logger.info("Hiding objects that are marked as 'hidden'. This can take up to minutes depending on model size ...");var t=this;e.visibilityManager&&e.getObjectTree((i=>setTimeout((()=>function(i){var n=e.getFragmentList();if(!n||n.areAllVisible())return;var r=[];if(!i)return;i.enumNodeChildren(e.getRootId(),(function(e){i.enumNodeFragments(e,(function(e){return n.isFragVisible(e)}),!0)||i.isNodeHidden(e)||i.isNodeOff(e)||r.push(e)}),!0),p.logger.info("Hiding "+r.length+" objects ...");let o=0;if(r.length>0){const i=r.length-1;for(let n=0;n<r.length;++n)t.visibilityManager.setVisibilityOnNode(r[n],!1,e,n!==i,!1),o=Math.round(n/r.length*100),o>0&&o%10==0&&p.logger.info(o+"%")}p.logger.info("Done hiding objects.")}(i)))))},this.changePaperVisibility=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(e.is3d())return void(null==n||n());const o=e.getFragmentList();if(!o)return void(null==n||n());if(e.paperVisibilityAnim&&(e.paperVisibilityAnim.stop(),e.paperVisibilityAnim=null),!i||!r)return e.changePaperVisibility(t),this.invalidate(!0),void(null==n||n());const s=void 0!==o.dbIdOpacity[-1]?o.dbIdOpacity[-1]:t?0:1,a=t?1:0,l=r;e.paperVisibilityAnim=Autodesk.Viewing.Private.fadeValue(s,a,l,(e=>{e=Autodesk.Viewing.Private.smootherStep(e),o.setObject2DOpacity(-1,e),this.invalidate(!0)}),(()=>{e.paperVisibilityAnim=null,null==n||n()}))},this._signalNoMeshes=function(){pe.isEmpty()&&(this._geometryAvailable=0)},this._signalMeshAvailable=function(){0===this._geometryAvailable&&(this._geometryAvailable=1,this.api.fireEvent({type:I.RENDER_FIRST_PIXEL}))},this.hasModels=function(){return!pe.isEmpty()},this.onLoadingAnimationChanged=function(e){Xe||(ae.setLoadingAnimationDuration(e?this.defaultLoadingAnimationDuration:-1),this.invalidate(!1,!0,!1))},this.isLoadingAnimationEnabled=function(){return this.api.prefs.get(B.Prefs2D.LOADING_ANIMATION)&&(!this.model||this.model.is2d())},this.setMaxModelDistance=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e5;this.maxModelDistance=e},this._applyMaxModelDistanceToNearFar=function(){var e=this.camera;if(e.far<=e.near+this.maxModelDistance)return null;const t=e.near+this.maxModelDistance;const i=this.getVisibleBounds(!0,xe,(function(i){return F.SceneMath.pointToBoxDistance2(e.position,i)<t*t}));this.updateNearFarValues(e,i)},this.consolidateModel=function(e,t){return e.consolidateAsync(se,t,ae,this.useDeferredConsolidation)},this.setDoNotCut=function(e,t){e.setDoNotCut(se,t)},this.setViewportBounds=function(e,t){e.setViewportBounds(se,t),this.invalidate(!0),this.api.fireEvent({type:I.MODEL_VIEWPORT_BOUNDS_CHANGED_EVENT,model:e,bounds:t})},this.isWebGPU=function(){return Xe}}te.prototype.constructor=te,U.GlobalManagerMixin.call(te.prototype)},21174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewerState:()=>s});var n=i(83081),r=i(97005),o=i(12153);function s(e){var t=!0;this.getVisibleModel=function(t){const i=e.getVisibleModels();for(let e=0;e<i.length;++e){const n=i[e];if(this.getSeedUrn(n)===t)return n}},this.createObjectSets=function(t){var i=t.objectSet;Array.isArray(i)||(t.objectSet=i=[]);for(var n=e.getVisibleModels(),r=0;r<n.length;r++){var o=n[r],s=this.getSeedUrn(o),a=this.getSelectedNodes(o);i[r]={id:a,idType:"lmv"},n.length>1&&(i[r].seedUrn=s),o.is2d()?(i[r].isolated=this.getVisibleLayers2d(o),i[r].allLayers=this.areAllLayersVisible(o),i[r].hidden=[]):(i[r].isolated=e.getIsolatedNodes(o),i[r].hidden=e.getHiddenNodes(o),i[r].explodeScale=e.getExplodeScale(),i[r].explodeOptions=e.getExplodeOptions())}},this.getState=function(i){var n=e.navigation,r={};r.seedURN=this.getSeedUrn(),this.createObjectSets(r);var o=r.viewport;o||(o=r.viewport={});var s=n.getCamera().isPerspective;o.name="",o.eye=n.getPosition().toArray(),o.target=n.getTarget().toArray(),o.up=n.getCameraUpVector().toArray(),o.worldUpVector=n.getWorldUpVector().toArray(),o.pivotPoint=n.getPivotPoint().toArray(),o.distanceToOrbit=n.getPivotPlaneDistance(),o.aspectRatio=this.getAspectRatio(),o.projection=s?"perspective":"orthographic",o.isOrthographic=!s,r.autocam={sceneUpDirection:e.autocam.sceneUpDirection.clone(),sceneFrontDirection:e.autocam.sceneFrontDirection.clone(),cubeFront:e.autocam.cubeFront.clone()},s?o.fieldOfView=n.getVerticalFov():o.orthographicHeight=this.getOrthographicHeight();var a=r.renderOptions;if(a||(a=r.renderOptions={}),a.environment=this.getEnvironmentName(),a.ambientOcclusion={enabled:e.impl.renderer().getAOEnabled(),radius:e.impl.renderer().getAORadius(),intensity:e.impl.renderer().getAOIntensity()},a.toneMap={method:e.impl.renderer().getToneMapMethod(),exposure:e.impl.renderer().getExposureBias(),lightMultiplier:this.getToneMapIntensity()},a.appearance={ghostHidden:e.impl.showGhosting,ambientShadow:e.prefs.get("ambientShadows"),antiAliasing:e.impl.renderer().settings.antialias,progressiveDisplay:e.prefs.get("progressiveRendering"),swapBlackAndWhite:e.prefs.get("swapBlackAndWhite"),displayLines:e.prefs.get("lineRendering"),displayPoints:e.prefs.get("pointRendering")},!e.impl.is2d)for(var l=r.cutplanes=[],c=e.impl.getCutPlaneSet("__set_view"),h=0;h<c.length;h++)l.push(c[h].toArray());for(var u in e.loadedExtensions){var d=e.loadedExtensions[u];d.getState&&d.getState(r)}return i&&i!==t&&this.applyFilter(r,i),r},this.restoreObjectSet=function(t){var i=t.objectSet;if(Array.isArray(i)&&0!==i.length){for(var n=[],r=[],o=[],s=e.model,a=0;a<i.length;++a){var l=i[a];if("lmv"===l.idType){var c=l.seedUrn;if(!c||(s=this.getVisibleModel(c))){var h=l.id;if(h&&(h=this.toIntArray(h),o.push({model:s,ids:h})),s.is2d()){var u=l.isolated;if(Array.isArray(u)&&u.length>0){e.setLayerVisible(null,!1);for(var d=0;d<u.length;++d)u[d]=parseInt(u[d]);e.impl.setLayerVisible(u,!0)}else l.allLayers||e.setLayerVisible(null,!1)}else{var f=l.isolated||[],p=l.hidden||[];f=this.toIntArray(f),n.push({model:s,ids:f}),0===f.length&&p.length>0&&(p=this.toIntArray(p),r.push({model:s,ids:p}))}if("explodeScale"in l){var m=parseFloat(l.explodeScale),g=l.explodeOptions;e.explode&&e.explode(m,g)}}}}o.length>0&&e.impl.selector.setAggregateSelection(o),n.length>0&&e.impl.visibilityManager.aggregateIsolate(n,{hideLoadedModels:!1}),r.length>0&&e.impl.visibilityManager.aggregateHide(r)}},this.restoreState=function(i,r,o){if(!i)return n.logger.warn("restoreState has no viewer state to restore from."),!1;if(!e||!e.model)return n.logger.warn("restoreState has no viewer or model to restore."),!1;r&&r!==t&&(i=JSON.parse(JSON.stringify(i)),this.applyFilter(i,r));var s=e.navigation,a=!e.impl.is2d;this.restoreObjectSet(i);const l=i.autocam;if(l){const t=e.autocam;t.sceneUpDirection.copy(l.sceneUpDirection),t.sceneFrontDirection.copy(l.sceneFrontDirection),t.cubeFront.copy(l.cubeFront),t.camera.worldup.copy(l.sceneUpDirection),t.cameraChangedCallback(!0)}var c=i.viewport;if(c){var h=this.getVector3FromArray(c.eye,s.getPosition()),u=this.getVector3FromArray(c.up,s.getCameraUpVector()),d=this.getVector3FromArray(c.target,s.getTarget()),f="fieldOfView"in c?parseFloat(c.fieldOfView):s.getVerticalFov(),p=this.getVector3FromArray(c.worldUpVector,null);if(!p){const t=e.getFirstModel(),i=null==t?void 0:t.getUpVector();p=i?(new THREE.Vector3).fromArray(i):new THREE.Vector3(0,1,0)}var m=this.getVector3FromArray(c.pivotPoint,s.getPivotPoint()),g=s.getCamera().isPerspective;"isOrthographic"in c&&(g=!c.isOrthographic);var v=this.getOrthographicHeight();"orthographicHeight"in c&&(v=Number(c.orthographicHeight));var y={position:h,target:d,up:u,worldup:p,aspect:e.impl.camera.aspect,fov:f,orthoScale:v,isPerspective:g,pivot:m};this.restoreCameraState(y,o)}var b=i.renderOptions;if(b){var x=e.impl.renderer(),_=e.prefs,E=_.get("ambientShadows"),S=_.get("antialiasing"),A=b.ambientOcclusion;if(A){"enabled"in A&&(E=A.enabled);var w="radius"in A?A.radius:null,T="intensity"in A?A.intensity:null;null!==w&&null!==T&&(w===x.getAORadius()&&T===x.getAOIntensity()||(x.setAOOptions(w,T),x.composeFinalFrame()))}if("environment"in b){var M=this.getLightPresetIndex(b.environment);-1!==M&&M!==_.get("lightPreset")&&a&&e.setLightPreset(M)}var C=b.toneMap;if(C){var P=!1,D="exposure"in C?C.exposure:null,L="lightMultiplier"in C?C.lightMultiplier:null;null!==D&&D!==x.getExposureBias()&&(x.setTonemapExposureBias(D),P=!0),null!==L&&e.impl.dir_light1&&L!==this.getToneMapIntensity()&&(e.impl.dir_light1.intensity=Math.pow(2,L),P=!0),P&&e.impl.invalidate(!0)}var I=b.appearance;I&&("antiAliasing"in I&&(S=I.antiAliasing),"progressiveDisplay"in I&&I.progressiveDisplay!==_.get("progressiveRendering")&&e.setProgressiveRendering(I.progressiveDisplay),"swapBlackAndWhite"in I&&I.swapBlackAndWhite!==_.get("swapBlackAndWhite")&&e.setSwapBlackAndWhite(I.swapBlackAndWhite),"ghostHidden"in I&&I.ghostHidden!==_.get("ghosting")&&a&&e.setGhosting(I.ghostHidden),"displayLines"in I&&I.displayLines!==_.get("lineRendering")&&e.hideLines(!I.displayLines),"displayPoints"in I&&I.displayPoints!==_.get("pointRendering")&&e.hidePoints(!I.displayPoints)),a&&E!==_.get("ambientShadows")&&S!==_.get("antialiasing")&&e.setQualityLevel(E,S)}if(Array.isArray(i.cutplanes)&&a){for(var R=[],O=0;O<i.cutplanes.length;O++){var N=i.cutplanes[O];Array.isArray(N)&&N.length>=4&&R.push(new THREE.Vector4(N[0],N[1],N[2],N[3]))}!function(t,i){if(e.getExtension("Autodesk.AEC.LevelsExtension")&&void 0===t.floorGuid){const e=i.length;if(3===e||8===e){const t=i[e-2],n=i[e-1];0===t.x&&0===t.y&&-1===t.z&&0===n.x&&0===n.y&&1===n.z&&i.splice(-2,2)}}}(i,R),e.impl.setCutPlaneSet("__set_view",R)}for(var F in e.loadedExtensions){var U=e.loadedExtensions[F];U.restoreState&&U.restoreState(i,o)}return!0},this.getEnvironmentName=function(){var t=r.LightPresets[e.impl.currentLightPreset()];return t?t.name:"none"},this.restoreCameraState=function(t,i){e.impl.adjustOrthoCamera(t);var n=e.navigation;i?(t.isPerspective?n.toPerspective():n.toOrthographic(),n.setCameraUpVector(t.up),n.setWorldUpVector(t.worldup),n.setView(t.position,t.target),n.setPivotPoint(t.pivot),n.setVerticalFov(t.fov,!1),e.impl.syncCamera(!0)):(e.impl.camera.isPerspective=t.isPerspective,n.setRequestTransitionWithUp(!0,t.position,t.target,t.fov,t.up,t.worldup,t.pivot))},this.areEqual=function(e,t,i){var n,r,o,s;function a(e,t){if(t=t||[],(e=e||[]).length!==t.length)return!1;for(var i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}function l(e,t,i){return t=t||[],(e=e||[]).length===t.length&&(0!==e.length&&(c(e[0],t[0],i)||c(e[1],t[1],i)||c(e[2],t[2],i)))}function c(e,t,i){var n=e?parseFloat(e):null,r=e?parseFloat(t):null;return"number"===typeof n&&"number"===typeof r?Math.abs(e-t)<i:(e=e||null)===(t=t||null)}var h=e,u=t,d=1e-9;if(i&&!0!==i&&(h=this.applyFilter(h,i),u=this.applyFilter(u,i)),h.seedURN!==u.seedURN)return!1;var f=h.objectSet||[],p=u.objectSet||[];if(f.length!==p.length)return!1;var m=f[0]||{},g=p[0]||{};if(!(m.idType===g.idType&&c(m.explodeScale,g.explodeScale,d)&&c(null===(n=m.explodeOptions)||void 0===n?void 0:n.magnitude,null===(r=g.explodeOptions)||void 0===r?void 0:r.magnitude,d)&&c(null===(o=m.explodeOptions)||void 0===o?void 0:o.depthDampening,null===(s=g.explodeOptions)||void 0===s?void 0:s.depthDampening,d)&&a(m.id,g.id)&&a(m.isolated,g.isolated)&&a(m.hidden,g.hidden)))return!1;var v=h.viewport||{},y=u.viewport||{};return!!(v.name===y.name&&v.projection===y.projection&&v.isOrthographic===y.isOrthographic&&c(v.distanceToOrbit,y.distanceToOrbit,d)&&c(v.fieldOfView,y.fieldOfView,d)&&c(v.orthographicHeight,y.orthographicHeight,d)&&l(v.eye,y.eye,d)&&l(v.target,y.target,d)&&l(v.up,y.up,d)&&l(v.worldUpVector,y.worldUpVector,d)&&l(v.pivotPoint,y.pivotPoint,d))},this.toIntArray=function(e){var t=[];if(Array.isArray(e))for(var i=0,n=e.length;i<n;++i)t.push(parseInt(e[i]));return t},this.getVector3FromArray=function(e,t){return e instanceof Array&&e.length>2?(e[0]=parseFloat(e[0]),e[1]=parseFloat(e[1]),e[2]=parseFloat(e[2]),(new THREE.Vector3).fromArray(e)):t},this.getSelectedNodes=function(t){return(t=t||e.model).selector?t.selector.getSelection():[]},this.getVisibleLayers2d=function(t){return t&&t!==e.model?(n.logger.warn("[getVisibleLayers2d] multiple models not yet supported."),[]):e.impl.getVisibleLayerIndices()},this.areAllLayersVisible=function(t){return t&&t!==e.model?(n.logger.warn("[areAllLayersVisible] multiple models not yet supported."),!0):e.impl.layers.allLayersVisible()},this.getAspectRatio=function(){var t=e.navigation.getScreenViewport();return t.width/t.height},this.getOrthographicHeight=function(){var t=e.navigation.getCamera();return t.isPerspective?0:Math.abs(2*t.orthographicCamera.top)},this.getSeedUrn=function(t){var i;return(null===(i=t=t||e.model)||void 0===i?void 0:i.getSeedUrn())||""},this.getToneMapIntensity=function(){var t=0;return e.impl.dir_light1&&(t=0!=e.impl.dir_light1.intensity?Math.log(e.impl.dir_light1.intensity)/Math.log(2):-1e-20),t},this.getLightPresetIndex=function(e){for(var t=0;t<r.LightPresets.length;t++)if(r.LightPresets[t].name===e)return t;return-1},this.applyFilter=function(e,t){if(!0!==t)for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=t[i];void 0===r?delete e[i]:"boolean"==typeof r?!1===r&&delete e[i]:r instanceof Object?e[i]instanceof Object?this.applyFilter(e[i],t[i]):n.logger.warn("[applyFilter] A - Invalid filter Object for key ["+i+"]"):n.logger.warn("[applyFilter] B - Invalid filter value for key ["+i+"]")}},this.normalizeCoordinates=function(t){var i=t.viewport;if(i){if(i.normalized)return void n.logger.warn("invalid normalization of state.viewport. Ignoring command.");i.normalized=!0;if(a(i,o.SceneMath.getNormalizingMatrix(e.model)),"orthographicHeight"in i){var r=e.model.myData.bbox,s=r.max.y-r.min.y,l=i.orthographicHeight/s;i.orthographicHeight=l}}},this.denormalizeCoordinates=function(t){var i=t.viewport;if(i){if(!i.normalized)return void n.logger.warn("invalid denormalization of state.viewport. Ignoring command.");delete i.normalized;if(a(i,o.SceneMath.getNormalizingMatrix(e.model).clone().invert()),"orthographicHeight"in i){var r=e.model.myData.bbox,s=r.max.y-r.min.y,l=i.orthographicHeight*s;i.orthographicHeight=l}}}}function a(e,t){var i=new THREE.Vector3(e.eye[0],e.eye[1],e.eye[2]),n=new THREE.Vector3(e.pivotPoint[0],e.pivotPoint[1],e.pivotPoint[2]),r=new THREE.Vector3(e.target[0],e.target[1],e.target[2]);i.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t),e.eye[0]=i.x,e.eye[1]=i.y,e.eye[2]=i.z,e.pivotPoint[0]=n.x,e.pivotPoint[1]=n.y,e.pivotPoint[2]=n.z,e.target[0]=r.x,e.target[1]=r.y,e.target[2]=r.z}s.prototype.constructor=s},99211:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BubbleNode:()=>r});let n=1;class r{static MODEL_NODE={role:"3d",type:"geometry"};static GEOMETRY_SVF_NODE={role:"graphics",mime:"application/autodesk-svf"};static SHEET_NODE={role:"2d",type:"geometry"};static LEAFLET_NODE={role:"leaflet"};static PDF_PAGE_NODE={role:"pdf-page"};static IMAGE_NODE={role:"image"};static GEOMETRY_F2D_NODE={role:"graphics",mime:"application/autodesk-f2d"};static VIEWABLE_NODE={role:"viewable"};static AEC_MODEL_DATA={role:"Autodesk.AEC.ModelData"};static MASTER_VIEW_NODE={name:"08f99ae5-b8be-4f8d-881b-128675723c10"};parent=void 0;id=void 0;data=void 0;isLeaf=!1;children=[];sharedPropertyDbPath=void 0;lodNode=void 0;lmvDocument=void 0;constructor(e,t){this.parent=t,this.id=n++,this.data=e,this.isLeaf="geometry"===e.type&&("3d"===e.role||"2d"===e.role||"lod"===e.role),this.children=new Array;this.#f().forEach((e=>{const t=new r(e,this);this.children.push(t);const i="application/autodesk-db"==(n=e).mime&&n.urn?0===n.urn.indexOf("urn:adsk.objects:os.object")?n.urn.substr(0,n.urn.lastIndexOf("%2F")+3):n.urn.substr(0,n.urn.lastIndexOf("/")+1):null;var n;i&&(this.sharedPropertyDbPath=i),"lod"===e.role&&(this.lodNode=t)})),this.children.length>1&&this.children.sort(((e,t)=>Object.prototype.hasOwnProperty.call(e.data,"order")&&Object.prototype.hasOwnProperty.call(t.data,"order")?e.data.order-t.data.order:0))}#f(){return this.is3DTilesFormat()?[]:Array.isArray(this.data.children)?this.data.children:Array.isArray(this.data.derivatives)?this.data.derivatives:new Array}setDocument(e){this.lmvDocument=e}getDocument(){let e=this;for(;e.parent;)e=e.parent;return e.lmvDocument}isOtg(){return!!this._getOtgManifest()}_getOtgManifest(){if("undefined"!=typeof DISABLE_OTG&&DISABLE_OTG)return null;const e=this.findViewableParent();if(!e)return null;return e.data.otg_manifest}isSVF2(){var e,t=this._getOtgManifest();return Boolean("cacheable"===(null==t||null===(e=t.paths)||void 0===e?void 0:e.pharos_type))}getOtgGraphicsNode(){if(this.isViewPreset())return this.findParentGeom2Dor3D().getOtgGraphicsNode();const e=this._getOtgManifest();return e&&e.views&&e.views[this.guid()]}getPropertyDbManifest(){var e,t=this._getOtgManifest();if(t&&t.pdb_manifest){var i=t.pdb_manifest;e={propertydb:{},isOtg:!0};for(var n=0;n<i.assets.length;n++){var r,o=i.assets[n];r=o.isShared?t.paths.shared_root+i.pdb_shared_rel_path:t.paths.version_root+i.pdb_version_rel_path,e.propertydb[o.tag]=[{path:r+o.uri,isShared:o.isShared}]}this.getOtgGraphicsNode()||(e.needsDbIdRemap=!0)}else{let t=this.findPropertyDbPath();null===t&&(console.warn("Missing property database entry in manifest."),t=""),0===t.indexOf("$file$")&&(console.warn("Bubble local path given for shared property DB files. Assuming that sharedPropertyDbPath is specified correctly by loadDocumentNode()."),t="");const i=this.getDocument();i&&0===t.indexOf("urn")&&(t=i.getFullPath(t)),e={propertydb:{attrs:[{path:t+"objects_attrs.json.gz"}],values:[{path:t+"objects_vals.json.gz"}],avs:[{path:t+"objects_avs.json.gz"}],offsets:[{path:t+"objects_offs.json.gz"}],ids:[{path:t+"objects_ids.json.gz"}]}}}return e}getRootNode(){return this.parent?this.parent.getRootNode():this}isForgeManifest(){return"manifest"===this.getRootNode().data.type}is3DTilesFormat(){return!!this.data.asset}findPropertyDbPath(){if(this.is3DTilesFormat())return null;const e=this._getOtgManifest(),t=e&&e.pdb_manifest;if(t&&t.assets&&t.assets.length){return e.paths.version_root+e.pdb_manifest.pdb_version_rel_path}return e&&console.warn("Unexpected: OTG manifest exists, but it has no property database manifest."),this.sharedPropertyDbPath?this.sharedPropertyDbPath:this.parent?this.parent.findPropertyDbPath():null}_raw(){return this.data}name(){return this.data.name||""}guid(){return this.data.guid}type(){return this.data.type}extensions(){if(this.data.extensions)return Array.isArray(this.data.extensions)?this.data.extensions:[this.data.extensions]}urn(e){let t=this.data.urn;if(!e)return t;let i=this.parent;for(;!t&&i;)t=i.data.urn,i=i.parent;return t}lineageUrn(e){const t=this.getRootNode().urn();let i=r.parseLineageUrnFromEncodedUrn(t);return e&&(i=Autodesk.Viewing.toUrlSafeBase64(i)),i}static parseLineageUrnFromEncodedUrn(e){if(!e)return null;const t=e.split("/");let i=null;for(let e=t.length-1;e>=0;e--){var n;try{i=Autodesk.Viewing.fromUrlSafeBase64(t[e])}catch(e){}if(-1!=(null===(n=i)||void 0===n?void 0:n.indexOf("file:")))break;i=null}return r.parseLineageUrnFromDecodedUrn(i)}static parseLineageUrnFromDecodedUrn(e){if(!e)return null;const t=(e=e.replace("fs.file:vf.","dm.lineage:")).indexOf("?version");return-1===t?e:e.substring(0,t)}isGeomLeaf(){return this.isLeaf}isViewable(){if("viewable"===this.data.role)return!0;return!("svf"!==this.data.outputType)}getLodNode(){return this.lodNode}isGeometry(){return"geometry"===this.data.type}isViewPreset(){return"view"===this.data.type}is2D(){return"2d"===this.data.role}is3D(){return"3d"===this.data.role}is2DGeom(){return this.isGeometry()&&this.is2D()}is3DGeom(){return this.isGeometry()&&this.is3D()}useAsDefault(){return!0===this.data.useAsDefault}getDefaultGeometry(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.is3DTilesFormat())return this;let i=[];if(e){const e=this.search(r.MASTER_VIEW_NODE);e.length&&(i=e[0].search({type:"geometry"}))}0==i.length&&(i=this.search({type:"geometry"})),t&&i.sort((function(e,t){return t.data.size-e.data.size}));for(let e=0;e<i.length;++e)if(i[e].useAsDefault())return i[e];return i[0]}getPlacementTransform(){return console.warn("BubbleNode.getPlacementTransform is deprecated. Sheet placement information is stored in AECModelData.json"),null}getHash(){return console.warn("BubbleNode.getHash is deprecated and will be removed in a future release."),null}getViewBox(){return this.data.viewbox}isMetadata(){if(this.data.role){if(-1!==this.data.role.indexOf("Autodesk.CloudPlatform.DesignDescription"))return!0;if("Autodesk.CloudPlatform.PropertyDatabase"===this.data.role)return!0}return!1}findViewableParent(){let e=null,t=this;for(;t;)t.isViewable()&&(e=t),t=t.parent;if(!e&&!this.parent&&this.children)for(let t=0;t<this.children.length;t++){const i=this.children[t];if(i.isViewable()){e=i;break}}return e}findParentGeom2Dor3D(e){let t=this;for(;t&&!t.is2DGeom()&&!t.is3DGeom();)t=t.parent;if(!t&&this.isViewPreset()){t=this.findGeometryFromSiblings()[0],e&&e.fallbackParent&&(t=e.fallbackParent)}return t}findGeometryFromSiblings(){const e=this.parent;if(!e)return[];const t=[];for(let i=0,n=e.children.length;i<n;++i){const n=e.children[i];if(n===this)continue;let r;n.traverse((e=>{if(e.isGeometry()&&(e.is2D()||e.is3D()))return r=e,!0})),r&&t.push(r)}return t}findAllViewables(){if(this.is3DTilesFormat())return this.data.root.children;let e=[];this.isForgeManifest()&&(e=this.search({outputType:"svf"}));const t=this.search({role:"viewable"});return e.concat(t)}getViewableRootPath(e){var t=this.getOtgGraphicsNode();if(t&&t.urn&&!t.error)return this._getOtgManifest().paths.version_root+t.urn;if(!this.isGeomLeaf())return this.urn();if(this.is2D()){if(!e){var i=this.search({role:"leaflet"});if(i&&i.length)return i[0].urn()}const t=this.search(r.PDF_PAGE_NODE);if(null!=t&&t.length)return t[0].urn()}var n=this.is2D()?"application/autodesk-f2d":"application/autodesk-svf",o=this.search({mime:n});return o&&o.length?o[0].urn():null}getNamedViews(){var e=this.search({type:"view"});return e=e.filter((function(e){return!!e.data.name&&!!Array.isArray(e.data.camera)}))}findByGuid(e){var t=null;return this.traverse((function(i){if(i.data.guid===e)return t=i,!0})),t}search(e){const t=[];return this.traverse((function(i){let n=!0;for(let t in e)if(!Object.prototype.hasOwnProperty.call(i.data,t)||i.data[t]!==e[t]){n=!1;break}n&&t.push(i)})),t}traverse(e){if(e(this))return!0;if(this.children)for(let t=0;t<this.children.length;t++)if(this.children[t].traverse(e))return!0;return!1}getShallowCopySource(e){if(!this.isViewable())return console.error("getShallowCopySource must be called with a viewable node."),null;e||(e=this.parent.urn());var t=this.urn();return t!==e&&(t?(console.log(`Redirecting shallow copied URN ${e} to ${t}`),e=t):console.warn(`Unexpected: manifest viewable node does not have a urn property.\n${JSON.stringify(this._raw())}`)),e}getAecModelData(){const e=this.findViewableParent();if(!e)return null;if(!e.data.aec_model_data){var t=this.getRootNode().search({role:"Autodesk.AEC.ModelData"})[0];return Boolean(t)&&console.warn("Use Document.getAecModelData(bubbleNode) instead of BubbleNode.getAecModelData(), or make sure Document.downloadAecModelData is loaded before using this API"),null}return e.data.aec_model_data}extractRefPointTransform(){var e=this.getAecModelData();return e&&e.refPointTransformation&&r.readMatrixFromArray12(e.refPointTransformation)}extractCamera(){if(this.data.camera)return r.readCameraFromArray(this.data.camera);var e=this.isGeometry()&&this.search({type:"view"})[0];return e?e.extractCamera():null}getLevel(){const e=this.data.levelNumber;return Array.isArray(e)?e[0]:e}getLevelName(){return this.data.levelName||this.getLevel()}isSheet(){let e=this.parent;for(;e;){if("Sheets"===e.name())return!0;e=e.parent}return!1}isMasterView(){const e=r.MASTER_VIEW_NODE.name;let t=this;for(;t;){if(t.name()===e)return!0;t=t.parent}return!1}getModelName(){const e=this.getRootNode().children[0];return null==e?void 0:e.name()}getInputFileType(){var e;const t=null===(e=this.getRootNode().children)||void 0===e?void 0:e[0];return null==t?void 0:t.data.inputFileType}isRevitPdf(){return!(!this.data.isVectorPDF||"rvt"!==this.getInputFileType())}isSmartPdf(){return!(!this.data.isVectorPDF||"pdf"===this.getInputFileType())}getModelKey(){const e=`${this.getViewableRootPath()}${this.originModel}${this.guid()}`;return decodeURIComponent(e)}static readCameraFromArray(e,t){if(!Array.isArray(e))return null;if(t&&!t.elements){t instanceof THREE.Vector3||(t=(new THREE.Vector3).copy(t));var i=new THREE.Matrix4;i.setPosition(t),t=i}const n={position:new THREE.Vector3(e[0],e[1],e[2]),target:new THREE.Vector3(e[3],e[4],e[5]),up:new THREE.Vector3(e[6],e[7],e[8]),aspect:e[9],fov:THREE.Math.radToDeg(e[10]),orthoScale:e[11],isPerspective:!e[12]};return t&&(n.position.applyMatrix4(t),n.target.applyMatrix4(t),n.up.transformDirection(t)),0===e[10]&&1===e[11]&&1===e[12]&&(n.orthoScale=n.position.distanceTo(n.target)),n}static readMatrixFromArray12(e){return(new THREE.Matrix4).fromArray([e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,e[9],e[10],e[11],1])}getSourceFileUnits(){return this.data.units}getMasterViews(){const e=this.getRootNode().search({name:"08f99ae5-b8be-4f8d-881b-128675723c10"});return e&&e.length>0&&e[0].children||[]}getMasterView(e){return this.getMasterViews().find((t=>t.data.phaseNames===e))}get3DModelNodes(){return this.search(r.MODEL_NODE)}getSheetNodes(){return this.search(r.SHEET_NODE)}}},55280:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ObjectAssign:()=>L,disableDocumentTouchSafari:()=>R,enableDocumentTouchSafari:()=>O,exitFullscreen:()=>d,fullscreenElement:()=>p,getAndroidVersion:()=>y,getGlobal:()=>r.getGlobal,getIOSVersion:()=>v,inFullscreen:()=>f,isAndroidDevice:()=>S,isBrowser:()=>a,isChrome:()=>C,isFirefox:()=>M,isFullscreenAvailable:()=>m,isFullscreenEnabled:()=>g,isIE11:()=>c,isIE11Only:()=>h,isIOSDevice:()=>_,isMac:()=>P,isMobileDevice:()=>A,isNodeJS:()=>l,isPhoneFormFactor:()=>w,isSafari:()=>T,isTouchDevice:()=>b,isWindows:()=>D,launchFullscreen:()=>u,touchStartToClick:()=>N});var n,r=i(38685);const o=(0,r.getGlobal)(),s=o&&o.document,a="undefined"!=typeof navigator,l=function(){return!a};let c=a&&!!navigator.userAgent.match(/Edge|Trident\/7\./),h=a&&!!navigator.userAgent.match(/Trident\/7\./);function u(e,t){e.requestFullscreen?e.requestFullscreen(t):e.mozRequestFullScreen?e.mozRequestFullScreen(t):e.webkitRequestFullscreen?e.webkitRequestFullscreen(t):e.msRequestFullscreen&&e.msRequestFullscreen(t)}function d(e){f(e)&&(e.exitFullscreen?e.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.msExitFullscreen&&e.msExitFullscreen())}function f(e){return"webkitIsFullScreen"in e?!!e.webkitIsFullScreen:"fullscreenElement"in e?!!e.fullscreenElement:"mozFullScreenElement"in e?!!e.mozFullScreenElement:"msFullscreenElement"in e?!!e.msFullscreenElement:!!e.querySelector(".viewer-fill-browser")}function p(e){return e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||e.msFullscreenElement}function m(e){return e.requestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen||e.msRequestFullscreen}function g(e){return e.fullscreenEnabled||e.webkitFullscreenEnabled||e.mozFullScreenEnabled||e.msFullscreenEnabled}function v(e){var t=(e=e||navigator.userAgent).match(/OS ((\d+)_(\d+)(_(\d+))?) like Mac OS X/);return!t&&_()&&(t=e.match(/\/((\d+)\.(\d+)(\.\d)?) Safari\//)),t?t[1].replace("_","."):""}function y(e){var t=(e=e||navigator.userAgent).match(/Android\s([0-9\.]*)/);return!!t&&t[1]}function b(){return"undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0)}const x=a&&(/ip(ad|hone|od)/.test(navigator.userAgent.toLowerCase())||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/^ip(ad|hone|od)$/.test(null===(n=navigator.platform)||void 0===n?void 0:n.toLowerCase()));function _(){return x}const E=a&&-1!==navigator.userAgent.toLowerCase().indexOf("android");function S(){return E}function A(){return!!a&&(_()||S())}function w(){return A()&&(o.matchMedia("(max-width: 750px)").matches||o.matchMedia("(max-height: 750px)").matches)}function T(){if(!a)return!1;var e=navigator.userAgent.toLowerCase();return-1!==e.indexOf("safari")&&-1===e.indexOf("chrome")}function M(){return!!a&&-1!==navigator.userAgent.toLowerCase().indexOf("firefox")}function C(){return!!a&&-1!==navigator.userAgent.toLowerCase().indexOf("chrome")}function P(){return!!a&&(-1!==navigator.userAgent.toLowerCase().indexOf("mac os")&&!_())}function D(){if(!a)return!1;var e=navigator.userAgent.toLowerCase();return-1!==e.indexOf("win32")||-1!==e.indexOf("windows")}function L(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function I(e){var t=o.hasOwnProperty("pageXOffset")?o.pageXOffset:s.documentElement.scrollLeft,i=o.hasOwnProperty("pageYOffset")?o.pageYOffset:s.documentElement.scrollTop,n=void 0===e.pageX?e.changedTouches[0].pageX:e.pageX,r=void 0===e.pageY?e.changedTouches[0].pageY:e.pageY,a=s.elementFromPoint(n-t,r-i);return!a||"CANVAS"!==a.nodeName||("true"!==a.getAttribute("data-viewer-canvas")||(e.preventDefault(),!1))}function R(){A()&&T()&&(s.documentElement.addEventListener("touchstart",I,!0),s.documentElement.addEventListener("touchmove",I,!0),s.documentElement.addEventListener("touchcanceled",I,!0),s.documentElement.addEventListener("touchend",I,!0))}function O(){A()&&T()&&(s.documentElement.removeEventListener("touchstart",I,!0),s.documentElement.removeEventListener("touchmove",I,!0),s.documentElement.removeEventListener("touchcanceled",I,!0),s.documentElement.removeEventListener("touchend",I,!0))}function N(e){e.target.className&&(e.target.className.indexOf("fullscreen")>-1||e.target.className.indexOf("webvr")>-1)||(e.preventDefault(),e.stopPropagation(),e.target.click())}},11653:(e,t,i)=>{"use strict";i.r(t),i.d(t,{EnvironmentConfigurations:()=>j,Initializer:()=>ie,getUpstreamApiData:()=>q,getWebGLHelpLink:()=>v,initializeAuth:()=>J,initializeEnvironmentVariable:()=>X,initializeLogger:()=>ee,initializeResourceRoot:()=>Y,initializeServiceEndPoints:()=>K,refreshCookie:()=>Q,refreshRequestHeader:()=>Z,refreshToken:()=>$,shutdown:()=>ne,token:()=>m});var n=i(8600),r=i(83081),o=i(8412),s=i(55280),a=i(7756),l=i(84045),c=i(16271),h=i(85403),u=i(19948),d=(0,s.getGlobal)();const f=d;var p={accessToken:null,getAccessToken:null,tokenRefreshInterval:null};let m=p,g=null;function v(){return g}var y={local:{RTC:["https://rtc-dev.api.autodesk.com:443","https://lmv.autodesk.com:443"]},dev:{RTC:["https://rtc-dev.api.autodesk.com:443","https://lmv.autodesk.com:443"]},stg:{RTC:["https://rtc-stg.api.autodesk.com:443","https://lmv.autodesk.com:443"]},prod:{RTC:["https://rtc.api.autodesk.com:443","https://lmv.autodesk.com:443"]}},b="",x="";if((0,s.getGlobal)().location){var _=(0,s.getGlobal)().location;x=_.protocol+"//"+_.hostname,b=_.protocol+"//"+_.host}var E={local:"",dev:"https://developer-dev.api.autodesk.com",stg:"https://developer-stg.api.autodesk.com",prod:"https://developer.api.autodesk.com"},S="https://us.otgs-dev.autodesk.com",A="https://us.otgs-stg.autodesk.com",w="https://us.otgs.autodesk.com",T="https://eu.otgs-stg.autodesk.com",M="https://eu.otgs.autodesk.com",C="https://cdn-dev.derivative.autodesk.com",P="https://cdn-dev.derivative.autodesk.com/regions/eu",D="https://cdn-stg.derivative.autodesk.com",L="https://cdn-stg.derivative.autodesk.com/regions/eu",I="https://cdn.derivative.autodesk.com",R="https://cdn.derivative.autodesk.com/regions/eu",O="https://cdn-dev.derivative.autodesk.com",N="https://cdn-stg.derivative.autodesk.com",F="https://cdn.derivative.autodesk.com",U="https://cdn-stg-fips.derivative.autodesk.com",B="https://cdn-fips.derivative.autodesk.com",k="https://api-stg.afg.us.autodesk.com",V="https://api.afg.us.autodesk.com",G="derivativeV2",z="derivativeV2_EU",H="derivativeV2_APAC",W="derivativeV2_Fedramp";let j=Object.freeze({Local:{ROOT:"",LMV:y.local},Development:{ROOT:O,LMV:y.dev,bubbleManifest:!0},Staging:{ROOT:N,LMV:y.stg,bubbleManifest:!0},Production:{ROOT:F,LMV:y.prod,bubbleManifest:!0},AutodeskDevelopment:{ROOT:O,LMV:y.dev},AutodeskStaging:{ROOT:N,LMV:y.stg},AutodeskProduction:{ROOT:F,LMV:y.prod},AutodeskDevelopment2:{ROOT:O,LMV:y.dev,UPSTREAM:E.dev,UPSTREAM_API_DATA:G},AutodeskStaging2:{ROOT:N,LMV:y.stg,UPSTREAM:E.stg,UPSTREAM_API_DATA:G},AutodeskProduction2:{ROOT:F,LMV:y.prod,UPSTREAM:E.prod,UPSTREAM_API_DATA:G},FluentLocal:{ROOT:b,LMV:b},FluentDev:{ROOT:S,LMV:y.dev,UPSTREAM:E.stg,UPSTREAM_API_DATA:G},FluentStaging:{ROOT:A,LMV:y.stg,UPSTREAM:E.stg,UPSTREAM_API_DATA:G},FluentProduction:{ROOT:w,LMV:y.prod,UPSTREAM:E.prod,UPSTREAM_API_DATA:G},FluentStagingEU:{ROOT:T,LMV:y.stg,UPSTREAM:E.stg,UPSTREAM_API_DATA:z},FluentProductionEU:{ROOT:M,LMV:y.prod,UPSTREAM:E.prod,UPSTREAM_API_DATA:z},MD20DevUS:{ROOT:C,LMV:y.dev,UPSTREAM:E.dev,UPSTREAM_API_DATA:G},MD20DevEU:{ROOT:P,LMV:y.dev,UPSTREAM:E.dev,UPSTREAM_API_DATA:z},MD20StgUS:{ROOT:D,LMV:y.stg,UPSTREAM:E.stg,UPSTREAM_API_DATA:G},MD20StgEU:{ROOT:L,LMV:y.stg,UPSTREAM:E.stg,UPSTREAM_API_DATA:z},MD20ProdUS:{ROOT:I,LMV:y.prod,UPSTREAM:E.prod,UPSTREAM_API_DATA:G},MD20ProdEU:{ROOT:R,LMV:y.prod,UPSTREAM:E.prod,UPSTREAM_API_DATA:z},D3SLocalUS:{ROOT:b,LMV:b,UPSTREAM:b,UPSTREAM_API_DATA:G},D3SLocalEU:{ROOT:b,LMV:b,UPSTREAM:b,UPSTREAM_API_DATA:z},D3SLocalAPAC:{ROOT:b,LMV:b,UPSTREAM:b,UPSTREAM_API_DATA:H},Test:{ROOT:`${x}:3000`,LMV:y.dev},FedrampStaging2:{ROOT:U,LMV:y.stg,UPSTREAM:k,UPSTREAM_API_DATA:W},FedrampProduction2:{ROOT:B,LMV:y.prod,UPSTREAM:V,UPSTREAM_API_DATA:W}});function q(e,t){return e.endsWith("EU")?j[e].UPSTREAM_API_DATA:t.endsWith("_EU")?j[e].UPSTREAM_API_DATA+"_EU":t.endsWith("_APAC")?j[e].UPSTREAM_API_DATA+"_APAC":j[e].UPSTREAM_API_DATA}function X(e){var t;if(e&&e.env&&(t=e.env),t||(t=(0,n.getParameterByName)("env")),(0,o.setOfflineResourcePrefix)(e&&e.offlineResourcePrefix||""),(0,o.setOffline)(e&&"true"===e.offline),!t)switch(f.location.hostname){case"developer-dev.api.autodesk.com":t="AutodeskDevelopment";break;case"developer-stg.api.autodesk.com":t="AutodeskStaging";break;case"developer.api.autodesk.com":default:t="AutodeskProduction";break;case"localhost.autodesk.com":case"":case"127.0.0.1":t="Local"}(0,o.setEnv)(t),"undefined"!=typeof window&&r.logger.info("Host name : "+window.location.hostname),r.logger.info("Environment initialized as : "+t)}function Y(e){if(e.lmvResourceRoot)d.LMV_RESOURCE_ROOT=e.lmvResourceRoot;else{var t,i,r=["viewer3D.js","viewer3D.min.js","viewerCE.js","viewerCE.min.js"];e&&Object.prototype.hasOwnProperty.call(e,"libraryName")&&r.push(e.libraryName);var o=!1;for(let e=0;e<r.length;e++){var s=(0,n.getScript)(r[e]),a=(i=s?s.src:"").indexOf(r[e]);if(a>=0){t=i.substr(0,a),(i.indexOf("&v=",a)>0||i.indexOf("?v=",a)>0)&&(o=!0);break}}if(d.LMV_RESOURCE_ROOT=t||d.LMV_RESOURCE_ROOT,o){var l=!1,c=["dev","stg","prod"];for(let e=0;e<c.length;++e){var h=E[c[e]];if(-1!==d.LMV_RESOURCE_ROOT.indexOf(h)){l=!0;break}}l&&(d.LMV_RESOURCE_ROOT+=d.LMV_VIEWER_VERSION+"/")}}}function K(e){var t=e.endpoint;t||(t=j[(0,o.getEnv)()].ROOT);var i=e.api||t.ENDPOINT_API_DERIVATIVE_SERVICE_V2;if(o.endpoint.setEndpointAndApi(t,i),void 0!==e.escapeOssObjects&&o.endpoint.setEscapeOssObjects(e.escapeOssObjects),!(0,s.isNodeJS)())return Y(e),Promise.resolve()}function Q(e,t,i){t=t||function(){},l.ViewingService.rawGet(o.endpoint.getApiEndpoint(),null,"/auth/settoken",t,i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},withCredentials:!0,postData:"access-token="+e})}function Z(e){e?o.endpoint.HTTP_REQUEST_HEADERS.Authorization="Bearer "+e:delete o.endpoint.HTTP_REQUEST_HEADERS.Authorization}function $(e,t,i){if(p.accessToken=e,o.endpoint.getUseCookie()){Q(e,t,(function(t){r.logger.warn("Failed to set token in cookie. Will use header instead."),o.endpoint.setUseCookie(!1),Z(e),i&&i(t)}))}else Z(e),t&&t()}function J(e,t){var i,s=t?t.shouldInitializeAuth:void 0;void 0===s&&(s="false"!==(0,n.getParameterByName)("auth").toLowerCase());if(s||Z(null),"Local"==(0,o.getEnv)()||!s)return setTimeout(e,0),void o.endpoint.setUseCredentials(void 0!==t.useCredentials&&t.useCredentials);o.endpoint.setUseCredentials(void 0===t.useCredentials||t.useCredentials),o.endpoint.setUseCookie(t.useCookie),p.tokenRefreshInterval&&(clearTimeout(p.tokenRefreshInterval),p.tokenRefreshInterval=null),t&&t.getAccessToken?(p.getAccessToken=t.getAccessToken,i=t.getAccessToken((function n(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3599;if(i=r,p.tokenRefreshInterval?$(i):$(i,e,e),"number"!=typeof o){const e=new Date(o);o=Boolean(+e)&&e.toISOString()===o?(e-Date.now())/1e3:3599}var s=o-((null==t?void 0:t.tokenExpirationBuffer)||5);s<=0&&(s=o),p.tokenRefreshInterval=setTimeout((function(){t.getAccessToken(n)}),1e3*s)})),"string"==typeof i&&i&&$(i,e)):t&&t.accessToken?$(i=t.accessToken,e):((i=(0,n.getParameterByName)("accessToken"))||r.logger.error("No access token is provided, but authorization requested. This is a problem."),$(i,e))}function ee(e){r.logger.initialize(e);var t=(0,n.getParameterByName)("logLevel");t&&r.logger.setLevel(parseInt(t))}function te(e){e&&"Local"===e.env||o.endpoint.getCdnRedirectUrl()&&l.ViewingService.rawGet(o.endpoint.getCdnRedirectUrl(),null,null,(function(e){e&&e.length&&(o.endpoint.setCdnUrl(e),r.logger.info("CDN_ROOT is: "+e))}),(function(){}),{withCredentials:!1,responseType:"text"})}function ie(e,t){if((0,s.isNodeJS)())return X(e),K(e),ee(e),te(e),void J(t,e);e.webGLHelpLink&&(g=e.webGLHelpLink),X(e);var i=K(e);ee(e),te(e);const n=(0,c.initializeLocalization)(e);(0,s.disableDocumentTouchSafari)(),function(e){const t=!(-1!==["Production","fluent"].indexOf("Production"));(e.optOutTrackingByDefault||t)&&(h.analytics.shouldTrack=!1);const i=e.productId?e.productId:"Local"===(0,o.getEnv)()?"Local":"NOT_SET";h.analytics.superProps={productId:i,lmvBuildType:d.LMV_BUILD_TYPE,lmvViewerVersion:d.LMV_VIEWER_VERSION}}(e),(0,a.initWorkerScript)();const r=u.FeatureFlags._initialize();var l=function(e){return new Promise((t=>{J(t,e)}))}(e);return Promise.all([i,l,r,n]).then(t)}function ne(){r.logger.shutdown(),Autodesk.Viewing.Private.shutdownPropWorker()}},83293:(e,t,i)=>{"use strict";i.d(t,{z:()=>u});var n=i(42759),r=new ArrayBuffer(8),o=new Uint8Array(r),s=new Uint16Array(r),a=new Int32Array(r),l=new Uint32Array(r),c=new Float32Array(r),h=new Float64Array(r);function u(e){this.buffer=e,this.offset=0,this.byteLength=e.length}u.prototype.seek=function(e){this.offset=e},u.prototype.getBytes=function(e){var t=new Uint8Array(this.buffer.buffer,this.offset,e);return this.offset+=e,t},u.prototype.getVarints=function(){var e,t=0,i=0;do{t|=(127&(e=this.buffer[this.offset++]))<<i,i+=7}while(128&e);return t},u.prototype.getUint8=function(){return this.buffer[this.offset++]},u.prototype.getUint16=function(){return o[0]=this.buffer[this.offset++],o[1]=this.buffer[this.offset++],s[0]},u.prototype.getInt16=function(){var e=this.getUint16();return e>32767&&(e|=4294901760),e},u.prototype.getInt32=function(){var e=this.buffer,t=o,i=this.offset;return t[0]=e[i],t[1]=e[i+1],t[2]=e[i+2],t[3]=e[i+3],this.offset+=4,a[0]},u.prototype.getUint32=function(){var e=this.buffer,t=o,i=this.offset;return t[0]=e[i],t[1]=e[i+1],t[2]=e[i+2],t[3]=e[i+3],this.offset+=4,l[0]},u.prototype.getFloat32=function(){var e=this.buffer,t=o,i=this.offset;return t[0]=e[i],t[1]=e[i+1],t[2]=e[i+2],t[3]=e[i+3],this.offset+=4,c[0]},u.prototype.getIndicesArray=function(e,t,i){for(var n=this.buffer,r=new Uint8Array(e,t,2*i),o=this.offset,s=0,a=2*i;s<a;s+=2)r[s]=n[o],r[s+1]=n[o+1],o+=4;this.offset=o},u.prototype.getVector3Array=function(e,t,i,n){var r=this.buffer,o=this.offset,s=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(3===n&&0===i){var a=12*t;s.set(r.subarray(o,o+a)),this.offset+=a}else{n*=4;for(var l=4*i,c=0;c<t;c++){for(var h=0;h<12;h++)s[l+h]=r[o++];l+=n}this.offset=o}},u.prototype.getVector2Array=function(e,t,i,n){var r=this.buffer,o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=this.offset;n*=4;for(var a=4*i,l=0;l<t;l++){for(var c=0;c<8;c++)o[a+c]=r[s++];a+=n}this.offset=s},u.prototype.getVector4=function(e,t){for(var i=this.buffer,n=o,r=this.offset,s=c,a=0;a<4;a++)n[0]=i[r],n[1]=i[r+1],n[2]=i[r+2],n[3]=i[r+3],e[t+a]=s[0],r+=4;this.offset=r},u.prototype.getFloat64=function(){for(var e=this.buffer,t=o,i=this.offset,n=0;n<8;n++)t[n]=e[i+n];return this.offset+=8,h[0]},u.prototype.getString=function(e){var t=(0,n.xH)(this.buffer,this.offset,e);return this.offset+=e,t},u.prototype.reset=function(e){this.buffer=e,this.offset=0,this.byteLength=e.length}},46014:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PropertyDatabase:()=>s});var n=i(42759);function r(e,t){let i,n=0,r=e.length-1;for(;n<=r;){if(i=(n+r)/2|0,t===e[i])return i;t<e[i]?r=i-1:n=i+1}return-1}var o=i(8022);function s(e){var t,i,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_=this,E=!1,S=!1;let A={};for(var w in e.attrs){"pdb version 2"===(t=(0,n.TN)(e.attrs[w]))[0]&&(E=!0);for(var T=1;T<t.length;T++){if("Layer"===t[T][0])y=T;switch(t[T][1]){case"__parent__":d=T;break;case"__child__":u=T;break;case"__name__":f=T;break;case"__instanceof__":p=T;break;case"__viewable_in__":m=T;break;case"__externalref__":g=T;break;case"__node_flags__":v=T}E&&t[T][2]===o.jQ.DbKey&&(t[T][6]=t[T][6]|o.mH.afDirectStorage)}break}for(let t in e.avs){let i=e.avs[t];i[0]==="[".charCodeAt(0)?s=(0,n.GB)(e.avs[t],0):(s=i,S=!0),delete e.avs;break}for(let t in e.offsets){let r=e.offsets[t];r[0]==="[".charCodeAt(0)?(i=(0,n.GB)(r,1))[i.length-1]=s.length/2:i=new Int32Array(r.buffer,r.byteOffset,r.byteLength/4),delete e.offsets;break}for(let t in e.values){a=e.values[t],l=(0,n.Pd)(a);break}this.setIdsBlob=function(e){c=e,h=(0,n.Pd)(e)};for(let t in e.ids){this.setIdsBlob(e.ids[t]);break}function M(e){for(var t={},i=0,n=e.length;i<n;i++){var r=e[i];Array.isArray(r)||(r=[r]);for(var o=0;o<r.length;o++){var s=r[o],a=t[s];void 0===a?t[s]=i:Array.isArray(a)?a.push(i):t[s]=[a,i]}}return t}this.getObjectCount=function(){return i.length-1},this.getValueAt=function(e){return(0,n.$d)(a,l[e])},this.getIntValueAt=function(e){return(0,n._f)(a,l[e])},this.getIdAt=function(e){return(0,n.$d)(c,h[e])},this.externalIdsLoaded=function(){return Boolean(c)},this.getAttrValue=function(e,i,n){var r=t[e];return r[6]&o.mH.afDirectStorage&&r[2]===o.jQ.DbKey?i:n?this.getIntValueAt(i):this.getValueAt(i)},this._getObjectProperty=function(e,i){var n=t[e],r=n[5]?n[5]:n[0],o=this.attributeHidden(e);return{displayName:r,displayValue:_.getAttrValue(e,i),displayCategory:n[1],attributeName:n[0],type:n[2],units:n[3],hidden:o,precision:n[7]||0}},this.getObjectProperties=function(e,i,n,r,o){var s={dbId:e,properties:[]},a=!1,l=i&&-1!==i.indexOf("externalId"),c=this.externalIdsLoaded();l&&!c&&console.error("Requesting externalID requires loading of the externalID table");var h=c&&(!i||l);if(h&&(s.externalId=this.getIdAt(e),i&&1===i.length))return s;var u=null;if(this.enumObjectProperties(e,(function(e,l){if(e!=p){var c=t[e];if(!(i&&-1===i.indexOf(c[0])&&-1===i.indexOf(c[5])||o&&-1===o.indexOf(c[1])||r&&(r.indexOf(c[0])>-1||r.indexOf(c[5])>-1)))if(e==f){var h=_.getAttrValue(e,l);a=!0,s.name=h}else{var d=_.attributeHidden(e);if(n&&d)return;var m=_._getObjectProperty(e,l);s.properties.push(m)}}else{var g=_.getObjectProperties(_.getAttrValue(e,l),i,!0,r,o);g&&g.properties&&(u=g)}})),u){var d={},m=s.properties;for(let e=0;e<m.length;e++)d[m[e].displayName]=1;s.name||(s.name=u.name);var g=u.properties;for(let e=0;e<g.length;e++)Object.prototype.hasOwnProperty.call(d,g[e].displayName)||m.push(g[e])}return o&&!s.properties.length?null:!i||s.properties.length||h||a?s:null},this.getExternalIdMapping=function(e){var t={};if(h&&"length"in h)for(var i=1,n=h.length;i<n;++i){var r=this.getIdAt(i);e&&!0!==e[r]||(t[r]=i)}return t},this.findRootNodes=function(){var e=[],t=[];return this.enumObjects((function(i){var n=!1,r=!1,o=!1;_.enumObjectProperties(i,(function(e,t){e==d?_.getAttrValue(e,t,!0)&&(r=!0):e==u?n=!0:e==f&&(o=!0)})),o&&!r&&(n?e.push(i):t.push(i))})),e.length>0?e:t},this.nodeHasChild=function(e){let t=!1;return this.enumObjectProperties(e,(function(e){if(e===u)return t=!0,!0})),t},this.getNodeNameAndChildren=function(e,t){var i,n,r=e.dbId;if(this.enumObjectProperties(r,(function(r,o){var s;if(r===d);else if(r!=u||t)r===f?e.name=_.getAttrValue(r,o):r===v?e.flags=_.getAttrValue(r,o,!0):r===p&&(n=o);else if((s=_.getAttrValue(r,o,!0))!==e.dbId){var a={dbId:s,parent:e.dbId};i?i.push(a):i=[a]}})),(!e.name||!e.flags)&&n){const t=_.getAttrValue(p,n,!0);let i=A[t];i||(A[t]=i={dbId:t,name:null,flags:null},_.getNodeNameAndChildren(i,!0)),i.name&&!e.name&&(e.name=i.name),"number"!=typeof e.flags&&"number"==typeof i.flags&&(e.flags=i.flags)}return i},this.buildDbIdToFragMap=M;this.buildObjectTree=function(e,t,i,n){var r;t&&(r=M(t)),b={},x=0;var o=this.buildObjectTreeRec(e,0,r,0,i,n);return x>0&&console.warn("Property database integrity not guaranteed ("+x+")."),b=null,A={},o},this.buildObjectTreeRec=function(e,t,i,n,r,o){if(b[e])return x++,0;b[e]=t||e,n>r[0]&&(r[0]=n);var s,a={dbId:e},l=this.getNodeNameAndChildren(a),c=[];if(l)for(var h=0;h<l.length;h++){this.buildObjectTreeRec(l[h].dbId,e,i,n+1,r,o)&&c.push(l[h].dbId)}if(i){var u=i[e];void 0!==u&&(s=Array.isArray(u)?u:[u])}var d=a.flags||0;void 0===d&&(d=s&&s.length?6:(c.length,0));var f=c.length+(s?s.length:0);return f&&o.setNode(e,t,a.name,d,c,s),f},this.getSearchTerms=function(e){for(var t=(e=e.toLowerCase()).match(/"[^"]+"|[^\s]+/g)||[],i=t.length;i--;)t[i]=t[i].replace(/"/g,"");var n=[];for(i=0;i<t.length;i++)t[i].length>1&&n.push(t[i]);return n},this.bruteForceSearch=function(e,i,n){const o=this.getSearchTerms(e);if(0===o.length)return[];var s=[];const a=null==n?void 0:n.searchHidden,c=null==n?void 0:n.includeInherited,h={};for(let e=0;e<o.length;e++){for(var u=[],d=[],f=0,m=l.length;f<m;f++){var g=this.getValueAt(f);null!==g&&(-1!==g.toString().toLowerCase().indexOf(o[e])&&d.push(f))}0!==d.length?(d.sort((function(e,t){return e-t})),this.enumObjects((function(e){_.enumObjectProperties(e,(function(n,o){if(c&&n===p){const t=parseInt(_.getAttrValue(n,o));h[t]=h[t]||[],h[t].push(e)}if(!a&&_.attributeHidden(n))return;if(-1!==r(d,o)){if(i&&i.length&&-1===i.indexOf(t[n][0]))return;return u.push(e),!0}}))})),s.push(u)):s.push(u)}const v=(e,t)=>{const i=new Set(e);for(let n=0;n<e.length;++n){const r=e[n];if(!(r in t))continue;const o=t[r];for(let t=0;t<o.length;++t){const n=o[t];i.has(n)||(e.push(n),i.add(n))}}};if(1===s.length)return c&&v(s[0],h),s[0];var y={},b=s[0];for(let e=0;e<b.length;e++)y[b[e]]=1;for(let e=1;e<s.length;e++){b=s[e];var x={};for(let e=0;e<b.length;e++)1===y[b[e]]&&(x[b[e]]=1);y=x}u=[];for(let e in y)u.push(parseInt(e));return c&&v(u,h),u},this.bruteForceFind=function(e){var i=[];return this.enumObjects((function(n){var r=!1;_.enumObjectProperties(n,(function(i){var n=t[i],o=n[0],s=n[5];if(o===e||s===e)return r=!0,!0})),r&&i.push(n)})),i},this.getLayerToNodeIdMapping=function(){var e={};return this.enumObjects((function(t){_.enumObjectProperties(t,(function(i,n){if(i==y){var r=_.getAttrValue(i,n);return Array.isArray(e[r])||(e[r]=[]),e[r].push(t),!0}}))})),e},this.getAttributeDef=function(e){var i=t[e];return{name:i[0],category:i[1],dataType:i[2],dataTypeContext:i[3],description:i[4],displayName:i[5],flags:i[6],precision:i.length>7?i[7]:0}},this.enumAttributes=function(e){for(var i=1;i<t.length&&!e(i,this.getAttributeDef(i),t[i]);i++);},this.enumObjectProperties=S?function(e,t){let n=i[e],r=i[e+1],o=s,a=0;for(;n<r;){let e=o[n++],i=127&e,r=7;for(;128&e;)e=o[n++],i|=(127&e)<<r,r+=7;for(a+=i,e=o[n++],i=127&e,r=7;128&e;)e=o[n++],i|=(127&e)<<r,r+=7;if(t(a,i))break}}:function(e,t){let n=2*i[e],r=2*i[e+1];for(let e=n;e<r;e+=2){if(t(s[e],s[e+1]))break}};let C={};function P(e,t,n){let r=i[e],o=i[e+1],a=s,l=[],c=[];n=n||{};let h=0;for(;r<o;){let e=a[r++],i=127&e,o=7;for(;128&e;)e=a[r++],i|=(127&e)<<o,o+=7;for(h+=i,e=a[r++],i=127&e,o=7;128&e;)e=a[r++],i|=(127&e)<<o,o+=7;if(h===p){let e=_.getAttrValue(h,i);c.push(e)}else t&&!t[h]||(n[h]=i,l.push(h),l.push(i))}for(let e=0;e<c.length;e++){let i=c[e],r=C[i];r||(C[i]=r=P(i));for(let e=0;e<r.length;e+=2){let i=r[e],o=r[e+1];t&&!t[i]||(n[i]||_.attributeHidden(i)||(n[i]=o,l.push(i),l.push(o)))}}return l}this.getPropertiesSubsetWithInheritance=S?P:function(e,t,n){let r=2*i[e],o=2*i[e+1],a=[],l=[];n=n||{};for(let e=r;e<o;e+=2){let i=s[e],r=s[e+1];if(i===p){let e=_.getAttrValue(i,r);l.push(e)}else t&&!t[i]||(n[i]=r,a.push(i),a.push(r))}for(let e=0;e<l.length;e++){let i=l[e],r=C[i];r||(C[i]=r=P(i));for(let e=0;e<r.length;e+=2){let i=r[e],o=r[e+1];t&&!t[i]||(n[i]||_.attributeHidden(i)||(n[i]=o,a.push(i),a.push(o)))}}return a},this.findLayers=function(){var e={name:"root",id:1,index:1,children:[],isLayer:!1,childCount:0};if(void 0===y)return e;var t=[],i=this;return this.enumObjects((function(e){i.enumObjectProperties(e,(function(e,n){if(e===y){var r=i.getValueAt(n);return r&&-1===t.indexOf(r)&&t.push(r),!0}}))})),t.sort((function(e,t){return e.localeCompare(t,void 0,{sensitivity:"base",numeric:!0})})),e.childCount=t.length,e.children=t.map((function(e,t){return{name:e,index:t+1,id:t+1,isLayer:!0}})),e},this.enumObjects=function(e,t,n){var r=i.length-1;t="number"==typeof t?Math.max(t,1):1,n="number"==typeof n?Math.min(r,n):r;for(var o=t;o<n&&!e(o);o++);},this.getAttrChild=function(){return u},this.getAttrParent=function(){return d},this.getAttrName=function(){return f},this.getAttrLayers=function(){return y},this.getAttrInstanceOf=function(){return p},this.getAttrViewableIn=function(){return m},this.getAttrXref=function(){return g},this.getAttrNodeFlags=function(){return v},this.attributeHidden=function(e){return 1&t[e][6]||e==d||e==u||e==m||e==g},this._attributeIsBlacklisted=function(e){var i=t[e],n=i[0],r=i[1];return!(!Object.prototype.hasOwnProperty.call(o.vl,r)||-1===o.vl[r].indexOf(n))||!(!Object.prototype.hasOwnProperty.call(o.qz,r)||-1===o.qz[r].indexOf(n))},this._ignoreAttribute=function(e,i){var n=t[i],r=n[0],o=n[1];return e[o]&&e[o].has(r)},this.findParent=function(e){let t=null;return _.enumObjectProperties(e,(function(e,i){e===d&&(t=_.getAttrValue(e,i,!0))})),t},this._getAttributeAndValueIds=function(e,t,i){let n=this.getPropertiesSubsetWithInheritance(e),r=i&&Object.keys(i).length>=1;for(let e=0;e<n.length;e+=2){let o=n[e];this._attributeIsBlacklisted(o)||this.attributeHidden(o)||(r&&this._ignoreAttribute(i,o)||t.push({attrId:o,valId:n[e+1]}))}t.sort((function(e,t){return e.attrId-t.attrId}))},this.findDifferences=function(e,t,i){var n={changedIds:[]},r=t&&t.dbIds,o=t&&t.listPropChanges;o&&(n.propChanges=[]);let s=t&&t.propertyFilter||{};var a=this,l=e,c=[],h=[],u={result:[],dbId:-1},d={result:[],dbId:-1},f=function(e){var t=0,i=0;if(c.length=0,h.length=0,a._getAttributeAndValueIds(e,c,s,!0,u),l._getAttributeAndValueIds(e,h,s,!0,d),c.length&&h.length){for(var r=!1,f=void 0;t<c.length&&i<h.length;){var p=c[t],m=h[i],g=p&&p.attrId,v=p&&p.valId,y=m&&m.attrId,b=m&&m.valId;if(g!==y||v!==b){if(r=!0,!o)break;var x=void 0===y||y>g,E=void 0;void 0===g||g>y?((E=l._getObjectProperty(y,b)).displayValueB=E.displayValue,E.displayValue=void 0,i++):x?((E=a._getObjectProperty(g,v)).displayValueB=void 0,t++):((E=a._getObjectProperty(g,v)).displayValueB=_.getAttrValue(y,b),t++,i++),f||(f=[]),f.push(E)}else t++,i++}r&&(n.changedIds.push(e),o&&n.propChanges.push(f))}},p=-1,m=function(e,t){var n=Math.floor(100*e/t);n!=p&&(i&&i(n),p=n)};if(r)for(var g=0;g<r.length;g++){f(r[g]),m(g,r.length)}else{var v=Math.min(a.getObjectCount(),this.getObjectCount());for(let e=1;e<v;e++)f(e),m(e,v)}return n},this.numberOfAttributes=function(){var e;return(null===(e=t)||void 0===e?void 0:e.length)??0},this.numberOfValues=function(){var e;return(null===(e=l)||void 0===e?void 0:e.length)??0},this.dtor=function(){t=null,i=null,s=null,a=null,l=null,c=null,h=null,u=0,d=0,f=0,p=0,m=0,g=0,v=0}}},8022:(e,t,i)=>{"use strict";i.d(t,{hA:()=>a,jQ:()=>n,mH:()=>r,qz:()=>o,vl:()=>s});var n={Unknown:0,Boolean:1,Integer:2,Double:3,Float:4,BLOB:10,DbKey:11,String:20,LocalizableString:21,DateTime:22,GeoLocation:23,Position:24},r={afHidden:1,afDontIndex:2,afDirectStorage:4,afReadOnly:8},o={Dimensions:["Perimeter","Volume","Area","Length","Width","Height"]},s={Item:["Source File"]};const a=e=>[n.Integer,n.Double,n.Float].includes(e)},42759:(e,t,i)=>{"use strict";function n(e,t,i){var n,r,o,s,a,l;for(n="",o=i,r=0;r<o;)switch((s=e[t+r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(s);break;case 12:case 13:a=e[t+r++],n+=String.fromCharCode((31&s)<<6|63&a);break;case 14:a=e[t+r++],l=e[t+r++],n+=String.fromCharCode((15&s)<<12|(63&a)<<6|63&l)}return n}function r(e,t,i){var n,r,o,s=i||0;if(r=e.length,t)for(n=0;n<r;n++)(o=e.charCodeAt(n))>=1&&o<=127?t[s++]=o:o>2047?(t[s++]=224|o>>12&15,t[s++]=128|o>>6&63,t[s++]=128|63&o):(t[s++]=192|o>>6&31,t[s++]=128|63&o);else for(n=0;n<r;n++)(o=e.charCodeAt(n))>=1&&o<=127?s++:s+=o>2047?3:2;return s-(i||0)}i.d(t,{$d:()=>c,GB:()=>u,Pd:()=>d,TN:()=>l,WC:()=>r,_f:()=>h,jI:()=>n,xH:()=>a});var o=!0,s=1048576;function a(e,t,i){if(void 0===t&&(t=0),void 0===i&&(i=e.length),o)return i>s?function(e,t,i){var n,r,o,s,a,l,c,h;for(n="",a=[],o=i,l=0,r=0;r<o;){switch((s=e[t+r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a.push(String.fromCharCode(s));break;case 12:case 13:c=e[t+r++],a.push(String.fromCharCode((31&s)<<6|63&c));break;case 14:c=e[t+r++],h=e[t+r++],a.push(String.fromCharCode((15&s)<<12|(63&c)<<6|63&h))}(++l>=32768||r>=o)&&(n+=a.join(""),a.length=0,l=0)}return n}(e,t,i):n(e,t,i);for(var r="",a=t,l=t+i;a<l;a++)r+=String.fromCharCode(e[a]);return decodeURIComponent(escape(r))}function l(e){var t=a(e,0,e.length);return t=t.replace(/\u000e/gi,""),JSON.parse(t)}function c(e,t){if(void 0===t)return"";for(var i=t;i<e.length-1;){var n=e[i];if(44==n&&(10==e[i+1]||13==e[i+1]))break;if(10==n||13==n)break;i++}var r=a(e,t,i-t);try{return JSON.parse(r)}catch(e){return console.error("Error parsing property blob to JSON : "+r),r}}function h(e,t){var i=0,n=t;for(34==e[n]&&n++;n<e.length-1;){var r=e[n];if(44==r&&(10==e[n+1]||13==e[n+1]))break;if(10==r||13==r||34==r)break;r>=48&&r<=57&&(i=10*i+(r-48)),n++}return i}function u(e,t){for(var i=0,n=0,r=e.length;n<r;n++)44==e[n]&&i++;i++;var o=new Uint32Array(i+(t?1:0));n=0;for(var s=e.length;91!=e[n]&&n<s;)n++;if(n==e.length)return null;n++;var a=!1;i=0;for(var l=0;n<s;){var c=e[n];c>=48&&c<=57?(l=10*l+(c-48),a=!0):44==c||93==c?a&&(o[i++]=l,a=!1,l=0):(a=!1,l=0),n++}return o}function d(e){for(var t=0,i=e.length-1,n=0;n<i;n++)44!=e[n]||10!=e[n+1]&&13!=e[n+1]||t++;if(!t)return null;t++;var r=new Uint32Array(t);for(n=0,t=0;91!=e[n]&&n<i;)n++;n++,r[t++]=n;for(var o=!1;n<i;)10==e[n]||13==e[n]?o=!0:o&&(o=!1,r[t++]=n),n++;return r}},30514:(e,t,i)=>{"use strict";i.r(t),i.d(t,{VBB_MITER_SEGMENT_CP:()=>a,VBB_MITER_SEGMENT_LIMIT:()=>o,VBB_MITER_SEGMENT_SCALE_FACTOR:()=>s,VertexBufferBuilder:()=>l});var n=2*Math.PI,r=[0,1,3,0,3,2];const o=6,s=1023,a=65536;function l(e,t,i,n){var r=t||65536;this.FULL_COUNT=0|(i||32767),this.useInstancing=e,this.useCompactBuffers=n,this.stride=10,this.allocVcount=4*(this.useInstancing?r/4:r),this.vb=new ArrayBuffer(this.stride*this.allocVcount),this.vbf=new Float32Array(this.vb),this.vbi=new Int32Array(this.vb),this.ib=this.useInstancing?null:new Uint16Array(r),this.minLineWidth=Number.MAX_VALUE,this.reset(0)}l.FORCE_BUTT_CAPS_FOR_TESTING=!1,l.prototype.reset=function(e){this.vcount=e,this.icount=0,this.minx=this.miny=1/0,this.maxx=this.maxy=-1/0,this.dbIds={},this.lastDbId=null,this.colors={},this.numEllipticals=0,this.numCirculars=0,this.numTriangleGeoms=0,this.numMiterLines=0,this.hasLineStyles=!1,this.changeTracking={},this.stride=10},l.prototype.expandStride=function(){var e=this.stride;if(!(e>=12)){for(var t=this.stride+2,i=new ArrayBuffer(t*this.allocVcount),n=new Uint8Array(this.vb),r=new Uint8Array(i),o=0,s=this.vcount;o<s;o++)for(var a=o*e*4,l=o*t*4,c=0;c<4*e;c++)r[l+c]=n[a+c];this.vb=i,this.vbf=new Float32Array(i),this.vbi=new Int32Array(i),this.stride=t}},l.prototype.addToBounds=function(e,t){e<this.minx&&(this.minx=e),e>this.maxx&&(this.maxx=e),t<this.miny&&(this.miny=t),t>this.maxy&&(this.maxy=t)},l.prototype.addToBoundsWithLineWidth=function(e,t,i,n,r){if(r<0)return this.addToBounds(e,t),void this.addToBounds(i,n);const o=[Math.min(e,i)-.5*r,Math.max(e,i)+.5*r],s=[Math.min(t,n)-.5*r,Math.max(t,n)+.5*r];this.addToBounds(o[0],s[0]),this.addToBounds(o[1],s[1])};var c=new Int32Array(1);function h(e){return c[0]=e,c[0]}l.prototype.trackChanges=function(e,t,i,n,r,o){if(i!==this.lastDbId&&(this.dbIds[h(i)]=1,this.lastDbId=i),o&&(this.hasLineStyles=!0),this.useCompactBuffers){var s=this.changeTracking;a("geomType",e),a("color",t),a("dbId",i),a("layerId",n),a("viewportId",r),a("linePattern",o),this.colors[h(t)]=1}function a(t,i){void 0===s[t]?s[t]=e:s[t]===i&&(s[t+"Varies"]=!0)}},l.prototype.setCommonVertexAttribs=function(e,t,i,n,r,o,s,a){this.trackChanges(i,n,r,o,s,a),t&=255,i&=255,a&=255,o&=65535,s&=65535,this.vbi[e+8]=t|i<<8|a<<16,this.vbi[e+6]=n,this.vbi[e+7]=r,this.vbi[e+9]=o|s<<16},l.prototype.addVertexTriangleGeom=function(e,t,i,n,r,o,s,a,l,c){for(var h=this.vcount,u=this.vbf,d=this.useInstancing?1:4,f=0;f<d;f++){var p=(h+f)*this.stride;u[p]=e,u[p+1]=t,u[p+2]=i,u[p+3]=n,u[p+4]=r,u[p+5]=o,this.setCommonVertexAttribs(p,0+f,5,s,a,l,c,0),this.vcount++}return h},l.prototype.addVertexLine=function(e,t,i,r,o,s,a,c,h,u,d,f,p){var m=this.vcount,g=this.vbf;c>=0&&s>0&&r>0&&(this.minLineWidth=Math.min(this.minLineWidth,s)),l.FORCE_BUTT_CAPS_FOR_TESTING&&(f=!0,p=!0);var v=1;f&&p?v=8:f?v=9:p&&(v=10);for(var y=this.useInstancing?1:4,b=0;b<y;b++){var x=(m+b)*this.stride;g[x]=e,g[x+1]=t,g[x+2]=(i+Math.PI)/n,g[x+3]=r,g[x+4]=.5*s,g[x+5]=o,this.setCommonVertexAttribs(x,0+b,v,a,c,h,u,d),this.vcount++}return m},l.prototype.addVertexMiterLine=function(e,t,i,r,o,s,a,l,c,h,u,d,f){var p=this.vcount,m=this.vbf;h>=0&&l>0&&(this.minLineWidth=Math.min(this.minLineWidth,l));for(var g=this.useInstancing?1:4,v=0;v<g;v++){var y=(p+v)*this.stride;m[y]=e,m[y+1]=t,m[y+2]=(i+Math.PI)/n,m[y+3]=s,m[y+4]=.5*l,m[y+5]=(r+Math.PI)/n,m[y+10]=(o+Math.PI)/n,m[y+11]=a,this.setCommonVertexAttribs(y,0+v,11,c,h,u,d,f),this.vcount++}return p},l.prototype.addVertexTexQuad=function(e,t,i,r,o,s,a,l,c){for(var h=this.vcount,u=this.vbf,d=this.useInstancing?1:4,f=0;f<d;f++){var p=(h+f)*this.stride;u[p]=e,u[p+1]=t,u[p+2]=o/n,u[p+3]=i,u[p+4]=r,this.setCommonVertexAttribs(p,0+f,4,s,a,l,c,0),this.vcount++}return h},l.prototype.addVertexArc=function(e,t,i,r,o,s,a,l,c,h,u,d){for(var f=this.vcount,p=this.vbf,m=o==s?2:3,g=this.useInstancing?1:4,v=0;v<g;v++){var y=(f+v)*this.stride;p[y]=e,p[y+1]=t,p[y+2]=i/n,p[y+3]=r/n,p[y+4]=.5*l,p[y+5]=o,3===m&&(p[y+10]=s,p[y+11]=a),this.setCommonVertexAttribs(y,0+v,m,c,h,u,d,0),this.vcount++}return f},l.prototype.addVertex=function(e,t,i,n,r,o){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;if(!this.useInstancing){var a=this.vcount,l=this.stride*a,c=this.vbf;return c[l]=e,c[l+1]=t,this.setCommonVertexAttribs(l,0,s,i,n,r,o,0),this.vcount++,a}},l.prototype.addVertexPolytriangle=function(e,t,i,n,r,o){this.useInstancing||(this.addVertex(e,t,i,n,r,o),this.addToBounds(e,t))},l.prototype.addVertexMSDFPolytriangle=function(e,t,i,n,r,o,s,a){this.addVertexTexPolytriangle(e,t,i,n,r,o,s,a,6)},l.prototype.addIndices=function(e,t){if(!this.useInstancing){var i=this.ib,n=this.icount;if(n+e.length>=i.length){var r=new Uint16Array(2*Math.max(e.length,i.length));for(let e=0;e<n;++e)r[e]=i[e];this.ib=i=r}for(let r=0;r<e.length;++r)i[n+r]=t+e[r];this.icount+=e.length}},l.prototype.finalizeQuad=function(e){this.useInstancing||this.addIndices(r,e)},l.prototype.addSegment=function(e,t,i,n,r,o,s,a,l,c,h,u,d){var f=i-e,p=n-t,m=f||p?Math.atan2(p,f):0,g=f||p?Math.sqrt(f*f+p*p):0,v=this.addVertexLine(e,t,m,g,r,o,s,a,l,c,h,u,d);this.finalizeQuad(v),this.addToBoundsWithLineWidth(e,t,i,n,o)},l.prototype.addMiterSegment=function(e,t,i,n,r,o,l,c,h,u,d,f,p,m,g,v,y){if(this.useCompactBuffers)this.addSegment(i,n,r,o,h,u,d,f,p,m,g,v,y);else{this.numMiterLines++,this.expandStride();var b=r-i,x=o-n,_=b||x?Math.atan2(x,b):0,E=b||x?Math.sqrt(b*b+x*x):0,S=i-e,A=n-t,w=S||A?Math.atan2(A,S):_,T=S||A?Math.sqrt(S*S+A*A):1,M=l-r,C=c-o,P=M||C?Math.atan2(C,M):_,D=M||C?Math.sqrt(M*M+C*C):1,L=Math.floor(Math.min(64,T)*s),I=Math.floor(Math.min(64,D)*s)*a+L,R=this.addVertexMiterLine(i,n,_,w,P,E,I,u,d,f,p,m,g);this.finalizeQuad(R),this.addToBoundsWithLineWidth(i,n,r,o,u)}},l.prototype.addTriangleGeom=function(e,t,i,n,r,o,s,a,l,c){this.numTriangleGeoms++;var h=this.addVertexTriangleGeom(e,t,i,n,r,o,s,a,l,c);this.finalizeQuad(h),this.addToBounds(e,t),this.addToBounds(i,n),this.addToBounds(r,o)},l.prototype.addArc=function(e,t,i,r,o,s,a,l,c,h,d,f){o==s?this.numCirculars++:(this.numEllipticals++,this.expandStride());var p=u(i,r);i=p.start,r=p.end,0==i&&0==r&&(r=n);{var m=Math.abs(i-r);if(m>1e-4&&Math.abs(m-n)>1e-4){var g=e+o*Math.cos(i),v=t+s*Math.sin(i);this.addSegment(g,v,g,v,0,l,c,h,d,f);var y=e+o*Math.cos(r),b=t+s*Math.sin(r);this.addSegment(y,b,y,b,0,l,c,h,d,f)}else this.addToBoundsWithLineWidth(e-o,t-s,e+o,t+s,l);const a=33554431;var x=this.addVertexLine(e,t,0,1e-4,0,0,a,h,d,f);this.finalizeQuad(x)}var _=this.addVertexArc(e,t,i,r,o,s,a,l,c,h,d,f);this.finalizeQuad(_)},l.prototype.addTexturedQuad=function(e,t,i,n,r,o,s,a,l){var c=this.addVertexTexQuad(e,t,i,n,r,o,s,a,l);this.finalizeQuad(c);var h=.5*Math.cos(r),u=.5*Math.sin(r),d=Math.abs(i*h)+Math.abs(n*u),f=Math.abs(i*u)+Math.abs(n*h);this.addToBounds(e-d,t-f),this.addToBounds(e+d,t+f)},l.prototype.addVertexImagePolytriangle=function(e,t,i,n,r,o,s,a){return this.addVertexTexPolytriangle(e,t,i,n,r,o,s,a,7)},l.prototype.addVertexTexPolytriangle=function(e,t,i,n,r,o,s,a,l){if(this.useInstancing)return;let c=this.vcount,h=this.vbf;this.addVertex(e,t,r,o,s,a,l),h[c*this.stride+2]=i,h[c*this.stride+3]=n,this.addToBounds(e,t)},l.prototype.isFull=function(e){e=e||3;var t=this.useInstancing?4:1;return this.vcount*t+e>this.FULL_COUNT},l.prototype.makeCompactVertexLayout=function(){var e=Object.keys(this.colors),t=Object.keys(this.dbIds);if(10!==this.stride)return null;var i=e.length+t.length;if(e.length+t.length>65536)return null;var n=new Int32Array(i+1);n[0]=0;var r=1;for(let t=0;t<e.length;t++,r++)n[r]=parseInt(e[t]),this.colors[e[t]]=r;for(let e=0;e<t.length;e++,r++)n[r]=parseInt(t[e]),this.dbIds[t[e]]=r;var o=new ArrayBuffer(24*this.vcount),s=new Int32Array(o),a=new Uint16Array(o),l=this.maxx-this.minx||1,c=this.maxy-this.miny||1,h=this.minx,u=this.miny,d=Math.max(l,c);function f(e){return 0|Math.round((e-h)/l*65535)}function p(e){return 0|Math.round((e-u)/c*65535)}function m(e){return 0|Math.round(e/d*65535)}function g(e){return 0|65535*e}function v(e){return e<0?32768+32767*Math.min(1,-e/1024):e?0|Math.round(e/d*32767)||1:e}for(var y=0;y<this.vcount;y++){var b=this.stride*y,x=6*y,_=2*x;switch(this.vbi[b+8]>>8&255){case 0:a[_]=f(this.vbf[b]),a[_+1]=p(this.vbf[b+1]);break;case 1:case 8:case 9:case 10:a[_]=f(this.vbf[b]),a[_+1]=p(this.vbf[b+1]),a[_+2]=g(this.vbf[b+2]),a[_+3]=m(this.vbf[b+3]),a[_+4]=v(this.vbf[b+4]);break;case 2:a[_]=f(this.vbf[b]),a[_+1]=p(this.vbf[b+1]),a[_+2]=g(this.vbf[b+2]),a[_+3]=g(this.vbf[b+3]),a[_+4]=v(this.vbf[b+4]),a[_+5]=m(this.vbf[b+5]);break;case 3:case 11:break;case 4:a[_]=f(this.vbf[b]),a[_+1]=p(this.vbf[b+1]),a[_+2]=g(this.vbf[b+2]),a[_+3]=m(this.vbf[b+3]),a[_+4]=m(this.vbf[b+4]);break;case 5:a[_]=f(this.vbf[b]),a[_+1]=p(this.vbf[b+1]),a[_+2]=f(this.vbf[b+2]),a[_+3]=p(this.vbf[b+3]),a[_+4]=f(this.vbf[b+4]),a[_+5]=p(this.vbf[b+5]);break;default:console.error("Unknown geometry type")}a[_+6]=this.colors[this.vbi[b+6]]||0,a[_+7]=this.dbIds[this.vbi[b+7]]||0,s[x+4]=this.vbi[b+8],s[x+5]=this.vbi[b+9]}var E={};E.vb=new Float32Array(o),E.vbstride=6;var S=this.useInstancing?1:0;return E.vblayout={fields1:{offset:0,itemSize:2,bytesPerItem:2,divisor:S,normalized:!0},fields2:{offset:1,itemSize:4,bytesPerItem:2,divisor:S,normalized:!0},uvIdColor:{offset:3,itemSize:2,bytesPerItem:2,divisor:S,normalized:!1},flags4b:{offset:4,itemSize:4,bytesPerItem:1,divisor:S,normalized:!1},layerVp4b:{offset:5,itemSize:4,bytesPerItem:1,divisor:S,normalized:!1}},E.unpackXform={x:l,y:c,z:h,w:u},E.texData=n,E},l.prototype.makeWideVertexLayout=function(){var e={};e.vb=new Float32Array(this.vb.slice(0,this.vcount*this.stride*4)),e.vbstride=this.stride;var t=this.useInstancing?1:0;return e.vblayout={fields1:{offset:0,itemSize:2,bytesPerItem:4,divisor:t,normalized:!1},fields2:{offset:2,itemSize:4,bytesPerItem:4,divisor:t,normalized:!1},color4b:{offset:6,itemSize:4,bytesPerItem:1,divisor:t,normalized:!0},dbId4b:{offset:7,itemSize:4,bytesPerItem:1,divisor:t,normalized:!1},flags4b:{offset:8,itemSize:4,bytesPerItem:1,divisor:t,normalized:!1},layerVp4b:{offset:9,itemSize:4,bytesPerItem:1,divisor:t,normalized:!1}},e.vblayout.extraParams={offset:this.stride-2,itemSize:2,bytesPerItem:4,divisor:t,normalized:!1},e},l.prototype.toMesh=function(){var e=null;if(this.useCompactBuffers&&(e=this.makeCompactVertexLayout()),e||(e=this.makeWideVertexLayout()),this.useInstancing){e.numInstances=this.vcount;var t=new Int32Array([0,1,2,3]);e.vblayout.instFlags4b={offset:0,itemSize:4,bytesPerItem:1,divisor:0,normalized:!1},e.vblayout.instFlags4b.array=t.buffer,e.indices=new Uint16Array(r)}else e.indices=new Uint16Array(this.ib.buffer.slice(0,2*this.icount));e.dbIds=this.dbIds;var i=this.maxx-this.minx,n=this.maxy-this.miny,o=Math.max(i,n);return e.boundingBox={min:{x:this.minx,y:this.miny,z:.001*-o},max:{x:this.maxx,y:this.maxy,z:.001*o}},e.boundingSphere={center:{x:.5*(this.minx+this.maxx),y:.5*(this.miny+this.maxy),z:0},radius:.5*Math.sqrt(i*i+n*n)},e};var u=function(e,t){function i(){function i(e,t){return Math.abs(e-t)<.001}i(e,0)&&(e=0),i(t,0)&&(t=0),i(e,n)&&(e=n),i(t,n)&&(t=n)}if(i(),e>t)for(;e>n;)e-=n,t-=n;else for(;t>n;)e-=n,t-=n;return i(),e<0&&t>0&&(e+=n),{start:e,end:t}}},93509:(e,t,i)=>{"use strict";i.r(t),i.d(t,{F2D:()=>m,F2dDataType:()=>u,F2dSemanticType:()=>d,F2dShadowRatio:()=>f,restoreSignBitFromLSB:()=>p});var n=i(30514),r=i(21706),o=i(96118);const s=function(e,t){t.min.x<e.min.x&&(e.min.x=t.min.x),t.min.y<e.min.y&&(e.min.y=t.min.y),t.min.z<e.min.z&&(e.min.z=t.min.z),t.max.x>e.max.x&&(e.max.x=t.max.x),t.max.y>e.max.y&&(e.max.y=t.max.y),t.max.z>e.max.z&&(e.max.z=t.max.z)};var a=i(83293),l=i(83081),c=i(57480),h=16383,u={dt_object:0,dt_void:1,dt_byte:2,dt_int:3,dt_float:4,dt_double:5,dt_varint:6,dt_point_varint:7,dt_byte_array:32,dt_int_array:33,dt_float_array:34,dt_double_array:35,dt_varint_array:36,dt_point_varint_array:37,dt_arc:38,dt_circle:39,dt_circular_arc:40,dt_string:63,dt_last_data_type:127},d={st_object_member:0,st_fill:1,st_fill_off:2,st_clip_off:3,st_layer:4,st_link:5,st_line_weight:6,st_miter_angle:7,st_miter_length:8,st_line_pattern_ref:9,st_back_color:10,st_color:11,st_markup:12,st_object_id:13,st_markup_id:14,st_reset_rel_offset:15,st_font_ref:16,st_begin_object:32,st_clip:33,st_line_caps:34,st_line_join:35,st_line_pattern_def:36,st_font_def:37,st_viewport:38,st_sheet:42,st_arc:43,st_polyline:44,st_raster:45,st_text:46,st_polytriangle:47,st_dot:48,st_end_object:63,st_last_semantic_type:127};const f=.0075;function p(e){return 1&e?-(e>>>1):e>>>1}function m(e,t,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(this.metadata=e,this.scaleX=1,this.scaleY=1,this.bbox={min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},this.is2d=!0,this.layersMap={},this.fontDefs={},this.fontCount=0,this.fontId=0,this.manifestAvailable=!1,this.geomMetricsSum=0,this.objectMemberQueue=[],this.propertydb={attrs:[],avs:[],ids:[],values:[],offsets:[],viewables:[]},e){var s=e.page_dimensions;this.paperWidth=s.page_width,this.paperHeight=s.page_height,this.scaleX=this.paperWidth/s.plot_width,this.scaleY=this.paperHeight/s.plot_height,this.hidePaper=s.hide_paper;var a=this.paperWidth,l=this.paperHeight;this.bbox.max.x=a,this.bbox.max.y=l;var c=e.page_dimensions||{};if(isFinite(c.paper_rotation)&&0!==c.paper_rotation){var u=c.paper_rotation*Math.PI/180,d=Math.cos(u),f=Math.sin(u),p=a*d,m=a*f,g=-l*f,v=l*d;this.bbox.min.x=Math.min(0,p,g,p+g),this.bbox.max.x=Math.max(0,p,g,p+g),this.bbox.min.y=Math.min(0,m,v,m+v),this.bbox.max.y=Math.max(0,m,v,m+v)}isFinite(c.paper_offset_x)&&0!==c.paper_offset_x&&(this.bbox.min.x+=c.paper_offset_x,this.bbox.max.x+=c.paper_offset_x),isFinite(c.paper_offset_y)&&0!==c.paper_offset_y&&(this.bbox.min.y+=c.paper_offset_y,this.bbox.max.y+=c.paper_offset_y);var y=0;for(var b in this.layersMap[0]=y++,e.layers){var x=parseInt(b);this.layersMap[x]=y++}if(this.layerCount=y,this.createLayerGroups(e.layers),e.geom_metrics){var _=Object.keys(e.geom_metrics).map((function(t){return e.geom_metrics[t]}));this.geomMetricsSum=_.reduce(((e,t)=>e+t))}}this.hidePaper=this.hidePaper||o.modelSpace,this.noShadow=!!o.noShadow,this.hasPageShadow=!1,this.opCount=0,this.excludeTextGeometry=o.excludeTextGeometry,this.extendStringsFetching=o.extendStringsFetching,this.fontFaces=[],this.fontFamilies=[],this.viewports=[{}],this.currentVpId=0,this.viewports[0].geom_metrics=this.currentGeomMetrics={arcs:0,circles:0,circ_arcs:0,viewports:0,clips:0,colors:0,db_ids:0,dots:0,fills:0,layers:0,line_caps:0,line_joins:0,line_patterns:0,line_pat_refs:0,plines:0,pline_points:0,line_weights:0,links:0,miters:0,ptris:0,ptri_indices:0,ptri_points:0,rasters:0,texts:0,strings:[]},this.clips=[0],this.strings=[],this.stringDbIds=[],this.stringBoxes=[],this.extendStringsFetching&&(this.stringCharWidths=[],this.stringAngles=[],this.stringPositions=[],this.stringHeights=[]),this.currentStringNumber=-1,this.currentStringBox=new r.LmvBox3,this.linkBoxes=[],this.currentLinkBox=new r.LmvBox3,this.objectNumber=0,this.currentFakeId=-2,this.imageNumber=0,this.linkNumber=0,this.maxObjectNumber=0,this.objectStack=[],this.objectNameStack=[],this.parseObjState={polyTriangle:{},viewport:{},clip:{},raster:{},text:{},fontDef:{},uknown:{}},this.layer=0,this.bgColor="number"==typeof o.bgColor?o.bgColor:4294967295,this.contrastColor=this.color=this.fillColor=4278190080,this.hidePaper&&(this.contrastColor=4294967040),this.isMobile=o&&!!o.isMobile;var E=this.isMobile,S=this.isMobile;if(this.max_vcount=this.isMobile?h:void 0,this.currentVbb=new n.VertexBufferBuilder(E,void 0,this.max_vcount,S),this.meshes=[],this.numCircles=this.numEllipses=this.numPolylines=this.numLineSegs=0,this.numPolytriangles=this.numTriangles=0,this.error=!1,this.offsetX=0,this.offsetY=0,t){this.manifestAvailable=!0,this.imageId2URI={};for(var A=t.assets,w=0,T=A.length;w<T;++w){var M=A[w];if(-1!==M.mime.indexOf("image/")){var C=M.id;C=C.substr(0,C.indexOf(".")),this.imageId2URI[C]=i+M.URI}"Autodesk.CloudPlatform.PropertyAttributes"===M.type&&this.propertydb.attrs.push({path:M.URI}),"Autodesk.CloudPlatform.PropertyValues"===M.type&&this.propertydb.values.push({path:M.URI}),"Autodesk.CloudPlatform.PropertyIDs"===M.type&&this.propertydb.ids.push({path:M.URI}),"Autodesk.CloudPlatform.PropertyViewables"===M.type&&this.propertydb.viewables.push({path:M.URI}),"Autodesk.CloudPlatform.PropertyOffsets"===M.type&&-1===M.id.indexOf("rcv")&&this.propertydb.offsets.push({path:M.URI}),"Autodesk.CloudPlatform.PropertyAVs"===M.type&&this.propertydb.avs.push({path:M.URI})}}}m.prototype.load=function(e,t){if(t instanceof Uint8Array||(t=new Uint8Array(t)),this.data=t,this.parse(),this.stringBoxes.length){var i=new Float32Array(this.stringBoxes.length);i.set(this.stringBoxes),this.stringBoxes=i}e.loadDoneCB(!0)},m.prototype.loadFrames=function(e){this.loadContext=e;var t=e.data;if(t)t instanceof Uint8Array||(t=new Uint8Array(t)),this.data=t;else if(e.finalFrame&&(this.data=null,this.stringBoxes.length)){var i=new Float32Array(this.stringBoxes.length);i.set(this.stringBoxes),this.stringBoxes=i}this.parseFrames(e.finalFrame),e.loadDoneCB(!0)},m.prototype.pushMesh=function(e){this.meshes.push(e),e.material={skipEllipticals:!this.currentVbb.numEllipticals,skipCircles:!this.currentVbb.numCirculars,skipTriangleGeoms:!this.currentVbb.numTriangleGeoms,skipMiterLines:!this.currentVbb.numMiterLines,useInstancing:this.currentVbb.useInstancing,unpackPositions:!!e.unpackXform},this.currentImage&&(e.material.image=this.currentImage,e.material.image.name=this.imageNumber++,this.currentImage=null)},m.prototype.flushBuffer=function(e,t){if(this.currentVbb.vcount||t){var i=t;if(i=i||this.currentVbb.isFull(e)){if(this.currentVbb.vcount){var n=this.currentVbb.toMesh();s(this.bbox,n.boundingBox),this.pushMesh(n),this.currentVbb.reset(0)}this.loadContext&&this.loadContext.loadDoneCB(!0,t)}}},m.prototype.tx=function(e){return this.sx(e)},m.prototype.ty=function(e){return this.sy(e)},m.prototype.sx=function(e){return e*this.scaleX},m.prototype.sy=function(e){return e*this.scaleY},m.prototype.invertColor=function(e){var t=e>>16&255,i=e>>8&255,n=255&e;return(e>>24&255)<<24|(t=255-t)<<16|(i=255-i)<<8|(n=255-n)},m.prototype.mapColor=function(e,t){if(!this.hidePaper||0!==this.bgColor)return e;var i=255&e;return i<127||i===(65280&e)>>8&&i===(16711680&e)>>16&&t&&(e&=1442840575),e},m.prototype.parsePointPositions=function(){var e=this.stream.getVarints(),t=this.stream.getVarints();return e=p(e),t=p(t),e+=this.offsetX,t+=this.offsetY,this.offsetX=e,this.offsetY=t,[this.tx(e),this.ty(t)]},m.prototype.parserAssert=function(e,t,i){return e!=t&&(l.logger.warn("Expect "+t+"; actual type is "+e+"; in function "+i),this.error=!0,!0)},m.prototype.unhandledTypeWarning=function(e,t){l.logger.warn("Unhandled semantic type : "+t+" in function "+e)},m.prototype.parseObject=function(){var e=this.stream.getVarints();switch(this.objectStack.push(e),e){case d.st_sheet:this.objectNameStack.push("sheet"),this.objectMemberQueue.unshift("paperColor");break;case d.st_viewport:this.objectNameStack.push("viewport"),this.objectMemberQueue.unshift("units","transform");break;case d.st_clip:this.objectNameStack.push("clip"),this.objectMemberQueue.unshift("contourCounts","points","indices");break;case d.st_polytriangle:this.objectNameStack.push("polyTriangle"),this.objectMemberQueue.unshift("points","indices","colors");break;case d.st_raster:this.objectNameStack.push("raster"),this.objectMemberQueue.unshift("position","width","height","imageId");break;case d.st_text:this.currentStringNumber=this.strings.length,0===this.objectNumber&&(this.objectNumber=this.currentFakeId--),this.currentStringBox.makeEmpty(),this.objectNameStack.push("text"),this.objectMemberQueue.unshift("string","position","height","widthScale","rotation","oblique","charWidths");break;case d.st_font_def:this.objectNameStack.push("fontDef"),this.objectMemberQueue.unshift("name","fullName","flags","spacing","panose");break;case d.st_end_object:if(this.objectStack.pop(),this.objectStack.length){switch(this.objectStack.pop()){case d.st_polytriangle:this.actOnPolyTriangle();break;case d.st_viewport:this.actOnViewport();break;case d.st_clip:this.actOnClip();break;case d.st_raster:this.actOnRaster();break;case d.st_text:this.actOnText();break;case d.st_font_def:this.actOnFontDef()}var t=this.objectNameStack.pop(),i=this.parseObjState[t];for(var n in i)i[n]=null}else this.parserAssert(0,1,"parseEndObject (Stack Empty)");this.objectMemberQueue.length=0;break;default:this.objectNameStack.push("unknown"),this.error=!0,this.unhandledTypeWarning("parseObject",e)}},m.prototype.initSheet=function(e){if(!this.hidePaper&&(this.bgColor=e,this.metadata)){var t=this.paperWidth,i=this.paperHeight,n={x:0,y:0},r={x:t,y:0},o={x:0,y:i},s=this.metadata.page_dimensions||{};if(isFinite(s.paper_rotation)&&0!==s.paper_rotation){var a=s.paper_rotation*Math.PI/180,l=Math.cos(a),c=Math.sin(a);r.y=t*c,r.x=t*l,o.x=-i*c,o.y=i*l}isFinite(s.paper_offset_x)&&0!==s.paper_offset_x&&(n.x=s.paper_offset_x),isFinite(s.paper_offset_y)&&0!==s.paper_offset_y&&(n.y=s.paper_offset_y);var h=this.currentVbb,u=[n.x,n.y,n.x+r.x,n.y+r.y,n.x+r.x+o.x,n.y+r.y+o.y,n.x+o.x,n.y+o.y],d=[e,e,e,e],p=[0,1,2,0,2,3];if(!this.noShadow){var m=t*f,g={x:r.x*m/t,y:r.y*m/t},v={x:o.x*m/i,y:o.y*m/i},y={x:n.x+g.x,y:n.y+g.y},b={x:n.x+r.x,y:n.y+r.y},x=4283782485;u=u.concat([y.x-v.x,y.y-v.y,y.x-v.x+r.x,y.y-v.y+r.y,y.x+r.x,y.y+r.y,y.x,y.y,b.x,b.y,b.x+g.x,b.y+g.y,b.x+g.x-v.x+o.x,b.y+g.y-v.y+o.y,b.x-v.x+o.x,b.y-v.y+o.y]),d=d.concat([x,x,x,x,x,x,x,x]),p=p.concat([4,5,6,4,6,7,8,9,10,8,10,11]),this.hasPageShadow=!0}this.addPolyTriangle(u,d,p,4294967295,-1,0,!1),h.addSegment(n.x,n.y,n.x+r.x,n.y+r.y,0,1e-6,4278190080,-1,0,this.currentVpId),h.addSegment(n.x+r.x,n.y+r.y,n.x+r.x+o.x,n.y+r.y+o.y,0,1e-6,4278190080,-1,0,this.currentVpId),h.addSegment(n.x+r.x+o.x,n.y+r.y+o.y,n.x+o.x,n.y+o.y,0,1e-6,4278190080,-1,0,this.currentVpId),h.addSegment(n.x+o.x,n.y+o.y,n.x,n.y,0,1e-6,4278190080,-1,0,this.currentVpId)}},m.prototype.setObjectMember=function(e){if(!this.objectMemberQueue.length)return l.logger.warn("Unexpected object member. "+e+" on object "+this.objectNameStack[this.objectNameStack.length-1]),!1;var t=this.objectMemberQueue.shift(),i=this.objectNameStack[this.objectNameStack.length-1];return"sheet"==i&&"paperColor"==t?(this.initSheet(e),!0):!!i&&(this.parseObjState[i][t]=e,!0)},m.prototype.parseString=function(){var e=this.stream,t=e.getVarints(),i=e.getVarints(),n=e.getString(i);if(t===d.st_object_member){if(this.setObjectMember(n))return}else l.logger.info("Unexpected opcode semantic type for string.");return n},m.prototype.actOnFontDef=function(){var e=this.parseObjState.fontDef;this.fontDefs[++this.fontCount]=e,this.fontId=this.fontCount},m.prototype.parsePoint=function(){var e=this.stream.getVarints(),t=this.parsePointPositions();if(e===d.st_object_member){if(this.setObjectMember(t))return}else l.logger.info("Unexpected opcode semantic type for point.");return t},m.prototype.parsePointsArray=function(){var e=this.stream,t=e.getVarints(),i=e.getVarints();if(i){i/=2;for(var n,r=[],o=0;o<i;++o)n=this.parsePointPositions(),r.push(n[0]),r.push(n[1]);switch(t){case d.st_polyline:return void this.actOnPolylinePointsArray(r);case d.st_dot:return void this.actOnDot(r);case d.st_object_member:if(this.setObjectMember(r))return;break;default:l.logger.info("Unexpected opcode semantic type for points array.")}return r}},m.prototype.parseIntArray=function(){for(var e=this.stream,t=e.getVarints(),i=e.getVarints(),n=[],r=0;r<i;++r)n.push(e.getUint32());if(t===d.st_object_member){if(this.setObjectMember(n))return}else this.unhandledTypeWarning("parseIntArray",t);return n},m.prototype.parseDoubleArray=function(){for(var e=this.stream,t=e.getVarints(),i=e.getVarints(),n=[],r=0;r<i;++r)n.push(e.getFloat64());if(t===d.st_object_member){if(this.setObjectMember(n))return}else this.unhandledTypeWarning("parseDoubleArray",t);return n},m.prototype.parseByteArray=function(){for(var e=this.stream,t=e.getVarints(),i=e.getVarints(),n=[],r=0;r<i;++r)n.push(e.getUint8());if(t===d.st_object_member){if(this.setObjectMember(n))return}else this.unhandledTypeWarning("parseByteArray",t);return n},m.prototype.parseVarintArray=function(){for(var e=this.stream,t=e.getVarints(),i=[],n=e.getVarints(),r=0;r<n;++r)i.push(e.getVarints());if(t===d.st_object_member){if(this.setObjectMember(i))return}else this.unhandledTypeWarning("parseVarIntArray",t);return i},m.prototype.parseInt=function(){var e=this.stream,t=e.getVarints(),i=e.getUint32();switch(t){case d.st_color:this.color=this.mapColor(i,!1),this.currentGeomMetrics.colors++;break;case d.st_fill:this.fill=!0,this.fillColor=this.mapColor(i,!0),this.currentGeomMetrics.fills++;break;case d.st_object_member:if(this.setObjectMember(i))return;default:this.unhandledTypeWarning("parseInt",t)}return i},m.prototype.parseVoid=function(){var e=this.stream.getVarints();if(e===d.st_fill_off)this.fill=!1,this.currentGeomMetrics.fills++;else this.unhandledTypeWarning("parseVoid",e)},m.prototype.parseVarint=function(){var e=this.stream,t=e.getVarints(),i=e.getVarints();switch(t){case d.st_line_weight:this.lineWeight=this.tx(i),this.currentGeomMetrics.line_weights++;break;case d.st_line_caps:this.currentGeomMetrics.line_caps++;break;case d.st_line_join:this.currentGeomMetrics.line_joins++;break;case d.st_object_id:case d.st_markup_id:this.objectNumber=i,this.maxObjectNumber=Math.max(this.maxObjectNumber,i),this.currentGeomMetrics.db_ids++;break;case d.st_link:this.linkNumber&&(this.linkBoxes[this.linkNumber]=this.currentLinkBox.clone(),this.currentLinkBox.makeEmpty()),this.linkNumber=i;break;case d.st_layer:this.currentGeomMetrics.layers++,this.layer=this.layersMap[i];break;case d.st_font_ref:this.fontId=i;break;case d.st_object_member:if(this.setObjectMember(i))return}return i},m.prototype.parseFloat=function(){var e=this.stream,t=e.getVarints(),i=e.getFloat32();switch(t){case d.st_miter_angle:case d.st_miter_length:break;case d.st_object_member:if(this.setObjectMember(i))return}return i},m.prototype.parseCircularArc=function(){var e=this.stream,t=e.getVarints();if(!this.parserAssert(t,d.st_arc,"parseCircularArc")){var i=this.parsePointPositions(),n=e.getVarints(),r=e.getFloat32(),o=e.getFloat32();this.actOnCircularArc(i[0],i[1],r,o,this.sx(n))}},m.prototype.parseCircle=function(){var e=this.stream,t=e.getVarints();if(!this.parserAssert(t,d.st_arc,"parseCircle")){var i=this.parsePointPositions(),n=e.getVarints();this.actOnCompleteCircle(i[0],i[1],this.sx(n))}},m.prototype.parseArc=function(){var e=this.stream,t=e.getVarints();if(!this.parserAssert(t,d.st_arc,"parseArc")){var i=this.parsePointPositions(),n=e.getVarints(),r=e.getVarints(),o=e.getFloat32(),s=e.getFloat32(),a=e.getFloat32();this.actOnArc(i[0],i[1],s,a,this.sx(n),this.sy(r),o)}},m.prototype.parseDataType=function(){var e=this.stream.getVarints();switch(e){case u.dt_void:this.parseVoid();break;case u.dt_int:this.parseInt();break;case u.dt_object:this.parseObject();break;case u.dt_varint:this.parseVarint();break;case u.dt_point_varint:this.parsePoint();break;case u.dt_float:this.parseFloat();break;case u.dt_point_varint_array:this.parsePointsArray();break;case u.dt_circular_arc:this.parseCircularArc();break;case u.dt_circle:this.parseCircle();break;case u.dt_arc:this.parseArc();break;case u.dt_int_array:this.parseIntArray();break;case u.dt_varint_array:this.parseVarintArray();break;case u.dt_byte_array:this.parseByteArray();break;case u.dt_string:this.parseString();break;case u.dt_double_array:this.parseDoubleArray();break;default:this.error=!0,l.logger.info("Data type not supported yet: "+e)}},m.prototype.readHeader=function(){var e=this.stream=new a.z(this.data),t=e.getString(3);if("F2D"!==t)return l.logger.error("Invalid F2D header : "+t,(0,c.errorCodeString)(c.ErrorCodes.BAD_DATA)),!1;var i=e.getString(2);if("01"!==i)return l.logger.error("Only support f2d major version 1; actual version is : "+i,(0,c.errorCodeString)(c.ErrorCodes.BAD_DATA)),!1;if("."!==e.getString(1))return l.logger.error("Invalid version delimiter.",(0,c.errorCodeString)(c.ErrorCodes.BAD_DATA)),!1;e.getString(2);return!0},m.prototype.parse=function(){if(this.readHeader()){for(var e=this.stream;e.offset<e.byteLength&&(this.parseDataType(),!this.error);)this.opCount++;this.linkNumber&&(this.linkBoxes[this.linkNumber]=this.currentLinkBox.clone(),this.currentLinkBox.makeEmpty()),this.flushBuffer(0,!0),this.currentVbb=null,this.stream=null,this.data=null,l.logger.info("F2d parse: data types count : "+this.opCount)}},m.prototype.parseFrames=function(e){if(this.data)for(var t=this.stream=new a.z(this.data);t.offset<t.byteLength&&(this.parseDataType(),!this.error);)this.opCount++;else e||l.logger.warn("Unexpected F2D parse state: If there is no data, we only expect a flush command, but flush was false.");e&&this.flushBuffer(0,!0),this.stream=null,this.data=null},m.prototype.actOnPolylinePointsArray=function(e){this.flushBuffer();for(var t=e.length/2,i=0,n=e[0],r=e[1],o=1;o<t;++o){var s=e[2*o],a=e[2*o+1];this.currentVbb.addSegment(n,r,s,a,i,this.lineWeight,this.color,this.objectNumber,this.layer,this.currentVpId),i+=Math.sqrt((s-n)*(s-n)+(a-r)*(a-r)),n=s,r=a}this.numPolylines++,this.numLineSegs+=t-1,this.currentGeomMetrics.plines++,this.currentGeomMetrics.pline_points+=t-1},m.prototype.actOnDot=function(e){this.currentGeomMetrics.dots++;var t=e[0],i=e[1];this.actOnCompleteCircle(t,i,this.sx(1),!0)},m.prototype.actOnCompleteCircle=function(e,t,i,n){this.flushBuffer(),this.numCircles++,n||this.currentGeomMetrics.circles++,this.fill?this.currentVbb.addSegment(e,t,e,t,0,2*i,this.color,this.objectNumber,this.layer,this.currentVpId):this.currentVbb.addArc(e,t,0,2*Math.PI,i,i,0,this.lineWeight,this.color,this.objectNumber,this.layer,this.currentVpId)},m.prototype.actOnCircularArc=function(e,t,i,n,r){this.numCircles++,this.currentGeomMetrics.circ_arcs++,this.flushBuffer(),this.currentVbb.addArc(e,t,i,n,r,r,0,this.lineWeight,this.color,this.objectNumber,this.layer,this.currentVpId)},m.prototype.actOnArc=function(e,t,i,n,r,o,s){this.numEllipses++,this.currentGeomMetrics.arcs++,this.flushBuffer(),this.currentVbb.addArc(e,t,i,n,r,o,s,this.lineWeight,this.color,this.objectNumber,this.layer,this.currentVpId)},m.prototype.actOnRaster=function(){if(this.manifestAvailable){this.flushBuffer(4,!0);var e=this.parseObjState.raster,t=e.position,i=e.imageId,n=this.imageId2URI[i],r=this.sx(e.width),o=this.sy(e.height),s=t[0]+.5*r,a=t[1]-.5*o;this.currentVbb.addTexturedQuad(s,a,r,o,0,4278255615,this.objectNumber,this.layer,this.currentVpId),this.currentImage={dataURI:n},this.flushBuffer(0,!0),this.currentGeomMetrics.rasters++}},m.prototype.actOnClip=function(){var e=this.parseObjState.clip;this.parseObjState.clip={},this.clips.push(e),this.currentGeomMetrics.clips++},m.prototype.actOnText=function(){this.strings[this.currentStringNumber]=this.parseObjState.text.string,this.currentGeomMetrics.texts++,this.currentGeomMetrics.strings.push(this.parseObjState.text.string),this.stringDbIds[this.currentStringNumber]=this.objectNumber,this.stringBoxes.push(this.currentStringBox.min.x,this.currentStringBox.min.y,this.currentStringBox.max.x,this.currentStringBox.max.y),this.extendStringsFetching&&(this.stringCharWidths.push(this.parseObjState.text.charWidths),this.stringAngles.push(this.parseObjState.text.rotation),this.stringPositions.push(this.parseObjState.text.position),this.stringHeights.push(this.parseObjState.text.height)),this.currentStringBox.makeEmpty(),this.currentStringNumber=-1,this.objectNumber<-1&&(this.objectNumber=0)};var g=new o.LmvVector3;m.prototype.addPolyTriangle=function(e,t,i,n,r,o,s){var a=this,c=null,h=-1;function u(e,t){if(e>t){var i=e;e=t,t=i}if(c[e]){var n=c[e],r=n.lastIndexOf(t);-1==r?n.push(t):n[r]=-1}else c[e]=[t]}function f(i,s){if(i>s){var u=i;i=s,s=u}var d=c[i];d&&(-1!=d.indexOf(s)&&(a.flushBuffer(4),a.currentVbb.addSegment(e[2*i],e[2*i+1],e[2*s],e[2*s+1],0,h,a.mapColor(t?t[i]:n,!0),r,o,a.currentVpId),t&&t[i]!=t[s]&&l.logger.warn("Gouraud triangle encountered. Will have incorrect antialiasing.")))}if(this.objectStack[this.objectStack.length-1]==d.st_text&&(h=-.5),s){c=new Array(e.length/2);for(let e=0,t=i.length;e<t;e+=3){let t=i[e],n=i[e+1],r=i[e+2];u(t,n),u(n,r),u(r,t)}}if(-1!==this.currentStringNumber||this.linkNumber){let t=e.length/2;for(let i=0;i<t;++i)g.set(e[2*i],e[2*i+1],0),-1!==this.currentStringNumber&&this.currentStringBox.expandByPoint(g),this.linkNumber&&this.currentLinkBox.expandByPoint(g)}if(this.currentVbb.useInstancing){let a=i.length;for(let l=0;l<a;l+=3){let a=i[l],c=i[l+1],h=i[l+2];this.flushBuffer(4),this.currentVbb.addTriangleGeom(e[2*a],e[2*a+1],e[2*c],e[2*c+1],e[2*h],e[2*h+1],this.mapColor(t?t[a]:n,!0),r,o,this.currentVpId),s&&(f(a,c),f(c,h),f(h,a))}}else{var p=e.length/2;this.flushBuffer(p);for(var m=this.currentVbb,v=m.vcount,y=0;y<p;++y){var b=e[2*y],x=e[2*y+1];m.addVertexPolytriangle(b,x,this.mapColor(t?t[y]:n,!0),r,o,this.currentVpId)}m.addIndices(i,v),s&&function(){for(var i=0,s=c.length;i<s;i++){var u=c[i];if(u)for(var d=0;d<u.length;d++){var f=u[d];-1!=f&&(a.flushBuffer(4),a.currentVbb.addSegment(e[2*i],e[2*i+1],e[2*f],e[2*f+1],0,h,a.mapColor(t?t[i]:n,!0),r,o,a.currentVpId),t&&t[i]!=t[f]&&l.logger.warn("Gouraud triangle encountered. Will have incorrect antialiasing."))}}}()}},m.prototype.actOnPolyTriangle=function(){var e=this.parseObjState.polyTriangle;this.parseObjState.polyTriangle={};var t=e.points,i=e.indices,n=e.colors;if(t&&i){if(this.objectStack[this.objectStack.length-1]==d.st_text){if(this.excludeTextGeometry)return}else this.currentGeomMetrics.ptris++,this.currentGeomMetrics.ptri_points+=t.length/2,this.currentGeomMetrics.ptri_indices+=i.length;this.numPolytriangles++,this.numTriangles+=i.length/3,this.addPolyTriangle(t,n,i,this.color,this.objectNumber,this.layer,!0)}else l.logger.warn("Malformed polytriangle.")},m.prototype.actOnViewport=function(){var e=this.parseObjState.viewport;this.parseObjState.viewport={},e.geom_metrics=this.currentGeomMetrics={arcs:0,circles:0,circ_arcs:0,viewports:0,clips:0,colors:0,db_ids:0,dots:0,fills:0,layers:0,line_caps:0,line_joins:0,line_patterns:0,line_pat_refs:0,plines:0,pline_points:0,line_weights:0,links:0,miters:0,ptris:0,ptri_indices:0,ptri_points:0,rasters:0,texts:0,strings:[]},this.viewports.push(e),this.currentVpId=this.viewports.length-1},m.prototype.createLayerGroups=function(e){var t=this.layersRoot={name:"root",id:"root",childrenByName:{},isLayer:!1},i=0,n=0;for(var r in e){var o=parseInt(r),s=e[r],a="string"==typeof s?s:s.name;a||(a=r);var l=a.split("|"),c=t;if(l.length>1)for(var h=0;h<l.length-1;++h){var u=l[h],d=c.childrenByName[u];d||(d={name:u,id:"group-"+i++,childrenByName:{},isLayer:!1},c.childrenByName[u]=d),c=d}c.childrenByName[a]={name:a,index:o,id:n++,childrenByName:{},isLayer:!0}}!function e(t){var i=Object.keys(t.childrenByName).map((function(e){return t.childrenByName[e]}));if(delete t.childrenByName,i.length){t.children=i,t.childCount=0;for(var n=0;n<i.length;++n)t.childCount+=e(i[n]);i.sort((function(e,t){return e.isLayer&&!t.isLayer?-1:!e.isLayer&&t.isLayer?1:e.name.localeCompare(t.name,void 0,{sensitivity:"base",numeric:!0})}))}return t.isLayer?1:t.childCount}(this.layersRoot)}},35982:e=>{const t=new Array(256);for(let e=0;e<256;e++){let i=e.toString(16);1===i.length&&(i="0"+i),t[e]=i}var i=new Array(20),n=new Array(10);e.exports={binToPackedString:function(e,t,i){for(var r=20===i?n:[],o=0;o<i;o+=2){var s=e[t+o],a=e[t+o+1];r[o/2]=a<<8|s}return String.fromCharCode.apply(null,r)},bin16ToPackedString:function(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3],e[t+4],e[t+5],e[t+6],e[t+7],e[t+8],e[t+9])},unpackHexString:function(e){for(var n=10===e.length?i:[],r=0;r<e.length;r++){var o=e.charCodeAt(r);n[2*r]=t[255&o],n[2*r+1]=t[o>>8&255]}return n.join("")},packedToBin:function(e,t,i){for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[i+2*n]=255&r,t[i+2*n+1]=r>>8&255}}}},58536:(e,t,i)=>{"use strict";i.r(t),i.d(t,{readLmvBufferGeom:()=>L,serializeLmvBufferGeom:()=>C});var n=i(55280),r=i(83293),o=i(21706);const s={Index:0,IndexEdges:1,Position:2,Normal:3,TextureUV:4,Color:5},a=0,l=1,c=2,h=3,u=4,d=5,f=6,p=7,m=8,g=9,v=10,y={TRIANGLES:0,LINES:1,POINTS:2,WIDE_LINES:3},b={position:s.Position,normal:s.Normal,index:s.Index,indexlines:s.IndexEdges,color:s.Color},x={};x[s.Position]="position",x[s.Normal]="normal",x[s.Index]="index",x[s.IndexEdges]="indexlines",x[s.Color]="color",x[s.TextureUV]="uv";const _={};function E(e){var t=[];for(let i=0;i<e.length;i+=2)t.push([e[i],e[i+1]]);for(const e of t)if(e[0]>e[1]){var i=e[0];e[0]=e[1],e[1]=i}t.sort((function(e,t){return e[0]-t[0]}));var n=t[0],r=0;e[r]=n[0],e[r+1]=n[1]-n[0],r+=2;for(let i=1;i<t.length;i++,r+=2)n=t[i],e[r]=n[0]-t[i-1][0],e[r+1]=n[1]-n[0]}function S(e){if(e.length){e[1]+=e[0],e[2]+=e[0];for(var t=3;t<e.length;t+=3)e[t]+=e[t-3],e[t+1]+=e[t],e[t+2]+=e[t]}}function A(e){if(e.length){e[1]+=e[0];for(var t=2;t<e.length;t+=2)e[t]+=e[t-2],e[t+1]+=e[t]}}function w(e){var t=x[e];return t||(console.error("Unknown vertex attribute"),s.TextureUV)}function T(){}function M(e){this.buffer=e,this.readOffset=0,this.meshFlag=0,this.numBuffers=0,this.numAttributes=0,this.bufferOffsets=[],this.attributes=[],this.buffers=[]}function C(e){var t=new T;if(!e.vb)return console.error("Unexpected non-interleaved vertex buffer"),null;const i=e.vb,n=e.vbstride,r=e.ib,o=e.iblines,a=[i.byteLength,r.byteLength];o&&a.push(o.byteLength);var l,c,h=Object.keys(e.attributes),u=0;e.isLines&&(u|=y.LINES),e.isWideLines&&(u|=y.WIDE_LINES),e.isPoints&&(u|=y.POINTS),t.beginHeader(u,h.length,a);for(var d=0;d<h.length;d++){var f=e.attributes[h[d]],p=(l=h[d],c=void 0,void 0!==(c=b[l])?c:(0===l.indexOf("uv")||console.warn("Unknown attribute name"),s.TextureUV));"index"===h[d]?t.addAttribute(p,f,0,1):"indexlines"===h[d]?t.addAttribute(p,f,0,2):t.addAttribute(p,f,n,0)}t.endHeader();var m=Buffer.from(i.buffer,i.byteOffset,i.byteLength);return t.addBuffer(m),e.isLines?E(r):function(e){var t,i,n=[];for(let t=0;t<e.length;t+=3)n.push([e[t],e[t+1],e[t+2]]);for(r of n)for(;r[0]>r[1]||r[0]>r[2];)i=void 0,i=(t=r)[0],t[0]=t[1],t[1]=t[2],t[2]=i;n.sort((function(e,t){return e[0]-t[0]}));var r=n[0],o=0;e[o]=r[0],e[o+1]=r[1]-r[0],e[o+2]=r[2]-r[0],o+=3;for(let t=1;t<n.length;t++,o+=3)r=n[t],e[o]=r[0]-n[t-1][0],e[o+1]=r[1]-r[0],e[o+2]=r[2]-r[0]}(r),m=Buffer.from(r.buffer,r.byteOffset,r.byteLength),t.addBuffer(m),o&&(E(o),m=Buffer.from(o.buffer,o.byteOffset,o.byteLength),t.addBuffer(m)),t.end()}_[a]=1,_[l]=2,_[c]=1,_[h]=2,_[u]=1,_[d]=2,_[f]=1,_[p]=2,_[m]=4,_[g]=4,_[v]=4,T.prototype.beginHeader=function(e,t,i){var n=8,r=i.length;for(n+=4*(r-1),n+=5*t;n%4!=0;)n++;var o=0;for(let e=0;e<i.length;e++)o+=i[e];this.buffer=Buffer.alloc(n+o),this.writeOffset=0;for(let e=0;e<4;e++)this.writeOffset=this.buffer.writeUInt8("OTG0".charCodeAt(e),this.writeOffset);this.writeOffset=this.buffer.writeUInt16LE(e,this.writeOffset),this.writeOffset=this.buffer.writeUInt8(r,this.writeOffset),this.writeOffset=this.buffer.writeUInt8(t,this.writeOffset);var s=i[0];for(let e=1;e<i.length;e++)this.writeOffset=this.buffer.writeUInt32LE(s,this.writeOffset),s+=i[e]},T.prototype.addAttribute=function(e,t,i,n){this.writeOffset=this.buffer.writeUInt8(e,this.writeOffset),e===s.Index||e===s.IndexEdges?(this.writeOffset=this.buffer.writeUInt8(function(e){var t=h,i=e.bytesPerItem||2;return 1===i?t=c:2===i?t=h:4===i&&(t=v),t<<4|15&e.itemSize}(t),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(4*(t.itemOffset||0),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(4*(i||0),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(n,this.writeOffset)):(this.writeOffset=this.buffer.writeUInt8(function(e){var t=m,i=e.bytesPerItem||4;return 1===i?t=e.normalized?f:c:2===i&&(t=e.normalized?p:h),t<<4|15&e.itemSize}(t),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(4*(t.itemOffset||0),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(4*(i||0),this.writeOffset),this.writeOffset=this.buffer.writeUInt8(n,this.writeOffset))},T.prototype.endHeader=function(){for(;this.writeOffset%4!=0;)this.writeOffset=this.buffer.writeUInt8(0,this.writeOffset)},T.prototype.addBuffer=function(e){e.copy(this.buffer,this.writeOffset),this.writeOffset+=e.length},T.prototype.end=function(){return this.writeOffset!==this.buffer.length&&console.error("Incorrect encoding buffer size"),this.buffer},M.prototype.readNodeJS=function(){if("OTG0"!==this.buffer.toString("ascii",0,4))return console.error("Invalid OTG header"),!1;if(this.readOffset=4,this.meshFlag=this.buffer.readUInt16LE(this.readOffset),this.readOffset+=2,this.numBuffers=this.buffer.readUInt8(this.readOffset),this.readOffset++,this.numAttributes=this.buffer.readUInt8(this.readOffset),this.readOffset++,this.numBuffers){this.bufferOffsets.push(0);for(var e=1;e<this.numBuffers;e++){var t=this.buffer.readUInt32LE(this.readOffset);this.readOffset+=4,this.bufferOffsets.push(t)}}for(let e=0;e<this.numAttributes;e++){var i={};i.name=this.buffer.readUInt8(this.readOffset),this.readOffset++;var n=this.buffer.readUInt8(this.readOffset);this.readOffset++,i.itemSize=15&n,i.type=n>>4,i.bytesPerItem=_[i.type],i.normalized=i.type===u||i.type===d||i.type===f||i.type===p,i.itemOffset=this.buffer.readUInt8(this.readOffset)/4,this.readOffset++,i.itemStride=this.buffer.readUInt8(this.readOffset)/4,this.readOffset++,i.bufferIndex=this.buffer.readUInt8(this.readOffset),this.readOffset++,this.attributes.push(i)}for(;this.readOffset%4!=0;)this.readOffset++;for(let e=0;e<this.bufferOffsets.length;e++){var r,o=this.readOffset+this.bufferOffsets[e];r=e<this.bufferOffsets.length-1?this.readOffset+this.bufferOffsets[e+1]:this.buffer.length,this.buffers.push(this.buffer.slice(o,r))}return!0},M.prototype.readWeb=function(){var e=new r.z(this.buffer);if("OTG0"!==e.getString(4))return console.error("Invalid OTG header"),!1;if(this.meshFlag=e.getUint16(),this.numBuffers=e.getUint8(),this.numAttributes=e.getUint8(),this.numBuffers){this.bufferOffsets.push(0);for(let i=1;i<this.numBuffers;i++){var t=e.getUint32();this.bufferOffsets.push(t)}}for(let t=0;t<this.numAttributes;t++){var i={};i.name=e.getUint8();var n=e.getUint8();i.itemSize=15&n,i.type=n>>4,i.bytesPerItem=_[i.type],i.normalized=i.type===u||i.type===d||i.type===f||i.type===p,i.itemOffset=e.getUint8()/4,i.itemStride=e.getUint8()/4,i.bufferIndex=e.getUint8(),this.attributes.push(i)}for(;e.offset%4!=0;)e.offset++;for(let t=0;t<this.bufferOffsets.length;t++){var o,s=e.offset+this.bufferOffsets[t];o=t<this.bufferOffsets.length-1?e.offset+this.bufferOffsets[t+1]:e.byteLength,this.buffers.push(this.buffer.subarray(s,o))}return!0},M.prototype.read=function(){return(0,n.isNodeJS)()&&this.buffer instanceof Buffer?this.readNodeJS():this.readWeb()};var P=new o.LmvBox3;P.min.x=-.5,P.min.y=-.5,P.min.z=-.5,P.max.x=.5,P.max.y=.5,P.max.z=.5;var D={center:{x:0,y:0,z:0},radius:Math.sqrt(.75)};function L(e,t){var i=new M(e);if(!i.read())return console.error("Failed to parse OTG geometry"),null;var n={vblayout:{},vb:new Float32Array(i.buffers[0].buffer,i.buffers[0].byteOffset,i.buffers[0].byteLength/4),isLines:(3&i.meshFlag)===y.LINES,isWideLines:(3&i.meshFlag)===y.WIDE_LINES,isPoints:(3&i.meshFlag)===y.POINTS,boundingBox:P,boundingSphere:D};let r=0;for(var o=0;o<i.attributes.length;o++){var a=i.attributes[o];if(a.name===s.Index){var l=i.buffers[1];1===a.bytesPerItem?n.indices=l:2===a.bytesPerItem?n.indices=new Uint16Array(l.buffer,l.byteOffset,l.byteLength/a.bytesPerItem):4===a.bytesPerItem&&(n.indices=new Uint32Array(l.buffer,l.byteOffset,l.byteLength/a.bytesPerItem)),n.isLines?A(n.indices):S(n.indices)}else if(a.name===s.IndexEdges){if(!t){var c=i.buffers[2];1===a.bytesPerItem?n.iblines=c:2===a.bytesPerItem?n.iblines=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/a.bytesPerItem):4===a.bytesPerItem&&(n.iblines=new Uint32Array(c.buffer,c.byteOffset,c.byteLength/a.bytesPerItem)),A(n.iblines)}}else{var h=w(a.name);"uv"===h&&(r++,r>1&&(h+=r.toString())),n.vbstride?n.vbstride!==a.itemStride&&console.error("Unexpected vertex buffer stride mismatch."):n.vbstride=a.itemStride,a.itemOffset>=a.itemStride||(n.vblayout[h]={bytesPerItem:a.bytesPerItem,offset:a.itemOffset,normalized:a.normalized,itemSize:a.itemSize})}}return{mesh:n,packId:0,meshIndex:0}}},87816:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Empty2DModelLoader:()=>n});class n{constructor(e){this.viewer3DImpl=e}loadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;const r=t.width||100,o=t.height||100;n&&n(),this.svf={is2d:!0,viewports:[],layersMap:{0:0},layerCount:1,bbox:new THREE.Box3(new THREE.Vector3(0,0,0),new THREE.Vector3(r,o,0)),fragments:{length:1,fragId2dbId:[0],dbId2fragId:{},transforms:new Float32Array(12),boxes:[0,0,0,r,o,0]},loadOptions:{bubbleNode:new Autodesk.Viewing.BubbleNode({urn:"Dummy_urn",guid:"Dummy_guid"})},metadata:{page_dimensions:{page_width:r,page_height:o,logical_width:r,logical_height:o,logical_offset_x:0,logical_offset_y:0,page_units:"inch"}},strings:[],stringDbIds:[],loadDone:!0};const s=new Autodesk.Viewing.Model(this.svf);s.initialize(),s.loader=this,this.model=s,i(null,s),this.viewer3DImpl.api.dispatchEvent({type:Autodesk.Viewing.MODEL_ROOT_LOADED_EVENT,svf:this.svf,model:s}),this.viewer3DImpl.onLoadComplete(s)}dtor(){}is2d(){return!0}is3d(){return!1}}},47261:(e,t,i)=>{"use strict";i.r(t),i.d(t,{F2DLoader:()=>x,OUTPUT_TYPE:()=>b});var n=i(83081),r=i(77201),o=i(22040),s=i(57480),a=i(28441),l=i(54393),c=i(84045),h=i(7756),u=i(13e3),d=i(55280),f=i(19556),p=i(90255),m=i(8412),g=i(63764),v=i(72091);const y=Autodesk.Viewing.Private,b={GEOMETRY:"geometry",VERTEX_BUFFER:"vertexBuffer"};function x(e){this.viewer3DImpl=e,this.loading=!1,this.tmpMatrix=new v.Matrix4,this.logger=n.logger,this.loadTime=0}x.prototype.dtor=function(){this.streamingWorker&&(this.streamingWorker.terminate(),this.streamingWorker=null,n.logger.debug("F2D loader dtor: on streaming worker.")),this.parsingWorker&&(this.parsingWorker.terminate(),this.parsingWorker=null,n.logger.debug("F2D loader dtor: on parsing worker.")),this.svf&&this.svf.propDbLoader&&(this.svf.propDbLoader.dtor(),this.svf.propDbLoader=null),this.viewer3DImpl=null,this.loading=!1,this.tmpMatrix=null,this.logger=null,this.loadTime=0,this.svf=null,this.model=null,this.options=null},x.prototype.isValid=function(){return!!this.viewer3DImpl},x.prototype.loadFile=function(e,t,i,r){if(!this.viewer3DImpl)return n.logger.log("F2D loader was already destructed. So no longer usable."),!1;if(this.loading)return n.logger.log("Loading of F2D already in progress. Ignoring new request."),!1;this.loading=!0;var o=e.indexOf("urn:");if(-1!=o){var s=(e=decodeURIComponent(e)).substr(o,e.substr(o).indexOf("/"));n.logger.log("Extracted URN: "+s);var a=s.lastIndexOf(":");this.svfUrn=s.substr(a+1)}else this.svfUrn=e;return this.sharedDbPath=t.sharedPropertyDbPath,this.currentLoadPath=e,this.acmSessionId=t.acmSessionId,this.queryParams="",this.acmSessionId&&(this.queryParams="acmsession="+this.acmSessionId),this.options=t,this.options.placementTransform?this.modelScale=this.options.modelScale||this.options.placementTransform.getMaxScaleOnAxis():this.modelScale=this.options.modelScale||1,this.isf2d=!0,this.loadFydoCB(e,t,i,r),!0},x.prototype.loadFydoCB=function(e,t,i,r){this.t0=Date.now();var o=(0,c.pathToURL)(e);this.streamingWorker=(0,h.createWorker)("F2DStreamWorker",!0),this.parsingWorker=(0,h.createWorker)("F2DParseWorker");var l=this,u=!0,p=function(){l.parsingWorker.terminate(),l.parsingWorker=null};this.streamingWorker.addEventListener("message",(function(e){var c;l.isValid()&&(u&&r&&(u=!1,r()),e.data&&"F2DBLOB"==e.data.type?(c={operation:"PARSE_F2D",data:e.data.buffer,metadata:e.data.metadata,manifest:e.data.manifest,basePath:e.data.basePath,f2dLoadOptions:{modelSpace:t.modelSpace,bgColor:t.bgColor,noShadow:t.noShadow,isMobile:(0,d.isMobileDevice)(),excludeTextGeometry:t.excludeTextGeometry,outputType:t.outputType||b.VERTEX_BUFFER,extendStringsFetching:t.extendStringsFetching},url:o},l.parsingWorker.doOperation(c,[c.data]),l.streamingWorker.terminate(),l.streamingWorker=null):e.data&&"F2DSTREAM"==e.data.type?(c={operation:"PARSE_F2D_FRAME",data:e.data.frames,url:o,f2dLoadOptions:{modelSpace:t.modelSpace,bgColor:t.bgColor,noShadow:t.noShadow,isMobile:(0,d.isMobileDevice)(),excludeTextGeometry:t.excludeTextGeometry,outputType:t.outputType||b.VERTEX_BUFFER,extendStringsFetching:t.extendStringsFetching}},e.data.metadata&&(c.metadata=e.data.metadata,c.manifest=e.data.manifest),e.data.finalFrame&&(c.finalFrame=!0,l.streamingWorker.terminate(),l.streamingWorker=null,l.fileMemorySize/=2),e.data.progress&&l.viewer3DImpl.signalProgress(100*e.data.progress,a.ProgressState.LOADING),l.parsingWorker.doOperation(c,c.data?[c.data]:void 0)):e.data&&"F2DAssetURL"==e.data.type||e.data&&e.data.progress||(e.data&&e.data.debug?n.logger.debug(e.data.message):e.data&&e.data.error?(l.loading=!1,l.streamingWorker.terminate(),l.streamingWorker=null,i&&i(e.data.error)):(n.logger.error("F2D download failed.",(0,s.errorCodeString)(s.ErrorCodes.NETWORK_FAILURE)),l.loading=!1,l.streamingWorker.terminate(),l.streamingWorker=null)))}),!1);var g=t.outputType===b.GEOMETRY?function(e){if(l.isValid()&&(u&&r&&(u=!1,r()),e.data&&e.data.f2d)){l.svf=e.data.f2d;const t=e.data.f2d.geometry;p(),n.logger.info("Num polylines: "+t.numPolylines),n.logger.info("Line segments: "+t.numLineSegs),n.logger.info("Circular arcs: "+t.numCircles),n.logger.info("Ellipitcal arcs:"+t.numEllipses),l.onModelRootLoadDone(l.svf),i&&i(null,l.model),l.viewer3DImpl.api.dispatchEvent({type:f.MODEL_ROOT_LOADED_EVENT,svf:l.svf,model:l.model}),l.onGeomLoadDone()}}:function(e){var t,o;if(l.isValid())if(u&&r&&(u=!1,r()),e.data&&e.data.f2d){for(t=l.svf=e.data.f2d,p(),n.logger.info("Num polylines: "+t.numPolylines),n.logger.info("Line segments: "+t.numLineSegs),n.logger.info("Circular arcs: "+t.numCircles),n.logger.info("Ellipitcal arcs:"+t.numEllipses),n.logger.info("Plain triangles:"+t.numTriangles),n.logger.info("Total # of op codes generated by fydo.parse: "+t.opCount),l.onModelRootLoadDone(l.svf),i&&i(null,l.model),l.viewer3DImpl.api.dispatchEvent({type:f.MODEL_ROOT_LOADED_EVENT,svf:l.svf,model:l.model}),o=0;o<t.meshes.length;o++)l.processReceivedMesh2D(t.meshes[o],o);t.meshes=null,l.onGeomLoadDone(),l.loading=!1}else if(e.data&&e.data.f2dframe){var a=0;if(e.data.meshes){var c=e.data.bbox;l.svf.bbox=(new v.Box3).copy(c),l.svf.modelSpaceBBox=l.svf.bbox.clone(),l.svf.placementTransform&&l.svf.bbox.applyMatrix4(l.svf.placementTransform),a=e.data.baseIndex}else l.svf=e.data.f2dframe,a=e.data.baseIndex;if((t=l.svf).fragments&&t.fragments.initialized||(l.onModelRootLoadDone(t),i&&i(null,l.model),l.viewer3DImpl.api.dispatchEvent({type:f.MODEL_ROOT_LOADED_EVENT,svf:t,model:l.model})),e.data.meshes&&e.data.meshes.length)for(o=0;o<e.data.meshes.length;o++)l.processReceivedMesh2D(e.data.meshes[o],a+o);if(e.data.finalFrame){var h=e.data.cumulativeProps;for(var d in h)t[d]=h[d];p(),l.onGeomLoadDone(),l.loading=!1}}else e.data&&e.data.progress||(e.data&&e.data.debug?n.logger.debug(e.data.message):e.data&&e.data.error?(l.loading=!1,p(),n.logger.error("Error while processing F2d: "+JSON.stringify(e.data.error.args)),i&&i(e.data.error)):(n.logger.error("F2D download failed.",(0,s.errorCodeString)(s.ErrorCodes.NETWORK_FAILURE)),l.loading=!1,p()))};this.parsingWorker.addEventListener("message",g,!1);var y={operation:"STREAM_F2D",url:o,objectIds:t.ids,queryParams:this.queryParams};return this.streamingWorker.doOperation(m.endpoint.initLoadContext(y)),!0},x.prototype.processReceivedMesh=function(e){var t=e.packId+":"+e.meshIndex,i=this.svf,s=i.fragments,a=s.mesh2frag[t];if(void 0===a)return void n.logger.warn("Mesh "+t+" was not referenced by any fragments.");Array.isArray(a)||(a=[a]);var l=e.mesh;l.dbIds[-1]&&this.options.hideBackground&&this.model.changePaperVisibility(!1);const c=r.BufferGeometryUtils.meshToGeometry(e);if(c.unpackXform=l.unpackXform,l.texData){var h=new v.DataTexture(new Uint8Array(l.texData.buffer),l.texData.length,1,v.RGBAFormat,v.UnsignedByteType,v.UVMapping,v.ClampToEdgeWrapping,v.ClampToEdgeWrapping,v.NearestFilter,v.NearestFilter,0);h.generateMipmaps=!1,h.flipY=!1,h.needsUpdate=!0,c.tIdColor=h,c.vIdColorTexSize=new v.Vector2(l.texData.length,1)}var u=a.length,d=this.model;d.getGeometryList().addGeometry(c,u,e.meshIndex+1);const p=(0,o.getPolygonCount)(c);for(var m=0;m<a.length;m++){var g=0|a[m];d.getFragmentList().getOriginalWorldMatrix(g,this.tmpMatrix),this.options.placementTransform&&(this.tmpMatrix=(new v.Matrix4).multiplyMatrices(this.options.placementTransform,this.tmpMatrix));var y=s.materials[g].toString();s.polygonCounts&&(s.polygonCounts[g]=p);var b=this.viewer3DImpl.setupMesh(this.model,c,y,this.tmpMatrix);d.activateFragment(g,b)}s.mesh2frag[t]=null,s.numLoaded+=a.length;var x=s.numLoaded;i.geomPolyCount>i.nextRepaintPolys&&(i.numRepaints++,i.nextRepaintPolys+=1e4*Math.pow(1.5,i.numRepaints),this.viewer3DImpl.api.dispatchEvent({type:f.LOADER_REPAINT_REQUEST_EVENT,loader:this,model:this.model})),x%20==0&&this.viewer3DImpl.api.dispatchEvent({type:f.LOADER_REPAINT_REQUEST_EVENT,loader:this,model:this.model})},x.prototype.processReceivedMesh2D=function(e,t){t>=this.bufferCount&&(this.bufferCount=t+1);var i={mesh:e,is2d:!0,packId:"0",meshIndex:t},n="0:"+t,r=this.svf.fragments;if(!r.fragId2dbId[t]){var o=Object.keys(i.mesh.dbIds).map((function(e){return parseInt(e)}));r.fragId2dbId[t]=o;for(var s=0;s<o.length;s++){var a=o[s],l=r.dbId2fragId[a];Array.isArray(l)?l.push(t):r.dbId2fragId[a]=void 0!==l?[l,t]:t}const n=this.model.getFragmentList();if(e.material.modelScale=this.modelScale,e.material.opacity=this.options.opacity,e.material.doNotCut=this.options.doNotCut||(null==n?void 0:n.getDoNotCut()),null!=n&&n.viewBounds){const t=n.viewBounds;e.material.viewportBounds=new v.Vector4(t.min.x,t.min.y,t.max.x,t.max.y)}var c=this.viewer3DImpl,h=this;r.materials[t]=this.viewer3DImpl.matman().create2DMaterial(this.model,e.material,!1,!1,(function(e,t){var i=t.getData();null==i||!i.loadDone||i.texLoadDone||p.TextureLoader.requestsInProgress()||(i.texLoadDone=!0,c.onTextureLoadComplete(t)),(0,d.isMobileDevice)()&&p.TextureLoader.requestsInProgress()||c.api.dispatchEvent({type:f.LOADER_REPAINT_REQUEST_EVENT,loader:h,model:t})})),r.length++}r.mesh2frag[n]=t,this.processReceivedMesh(i)},x.prototype.onModelRootLoadDone=function(e){var t,i;e.fragments={},e.fragments.mesh2frag={},e.fragments.materials=[],e.fragments.fragId2dbId=[],e.fragments.dbId2fragId={},e.fragments.length=0,e.fragments.initialized=!0,e.fragments.numLoaded=0,e.nextRepaintPolys=1e4,e.numRepaints=0,e.urn=this.svfUrn,e.acmSessionId=this.acmSessionId,e.basePath="";var r=this.currentLoadPath.lastIndexOf("/");-1!==r&&(e.basePath=this.currentLoadPath.substr(0,r+1)),e.placementTransform=null===(t=this.options.placementTransform)||void 0===t?void 0:t.clone(),e.placementWithOffset=null===(i=this.options.placementTransform)||void 0===i?void 0:i.clone(),e.loadOptions=this.options,e.texLoadDone=!1;var o=Date.now();n.logger.log("F2D load: "+(o-this.t0)),this.t1=o,e.bbox=(new v.Box3).copy(e.bbox),e.modelSpaceBBox=e.bbox.clone(),e.placementTransform&&e.bbox.applyMatrix4(e.placementTransform);var s=this.model=new g.Model(e);s.loader=this,s.initialize(),this.options.skipPropertyDb||(this.svf.propDbLoader=new u.PropDbLoader(this.sharedDbPath,this.model,this.viewer3DImpl.api)),n.logger.log("scene bounds: "+JSON.stringify(e.bbox));var l={category:"metadata_load_stats",urn:e.urn,layers:e.layerCount};n.logger.track(l),this.viewer3DImpl.setDoNotCut(s,!!this.options.doNotCut),this.viewer3DImpl.signalProgress(5,a.ProgressState.ROOT_LOADED,this.model)},x.prototype.onGeomLoadDone=function(){this.svf.loadDone=!0,this.svf.fragments.entityIndexes=null,this.svf.fragments.mesh2frag=null;var e=Date.now(),t="Fragments load time: "+(e-this.t1);this.loadTime+=e-this.t0,p.TextureLoader.loadModelTextures(this.model,this.viewer3DImpl),this.options.skipPropertyDb||this.loadPropertyDb(),n.logger.log(t);var i={category:"model_load_stats",is_f2d:!0,has_prism:this.viewer3DImpl.matman().hasPrism,load_time:this.loadTime,geometry_size:this.model.getGeometryList().geomMemory,meshes_count:this.model.getGeometryList().getCount(),urn:this.svfUrn};n.logger.track(i,!0);var r=this.model.getGeometryList();const o={load_time:this.loadTime,polygons:r.geomPolyCount,fragments:this.model.getFragmentList().getCount(),mem_usage:r.gpuMeshMemory,viewable_type:"2d",url:this.currentLoadPath,urn:this.svfUrn};y.analytics.track("viewer.model.loaded",o),this.currentLoadPath=null,this.isf2d=void 0,this.viewer3DImpl.onLoadComplete(this.model)},x.prototype.loadPropertyDb=function(){this.svf.propDbLoader&&this.svf.propDbLoader.load()},x.prototype.is3d=function(){return!1},l.FileLoaderManager.registerFileLoader("f2d",["f2d"],x)},14564:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LeafletLoader:()=>m});var n=i(28441),r=i(57480),o=i(83081),s=i(84045),a=i(47712),l=i(90255),c=i(54393),h=i(63764),u=i(8412),d=i(19556),f=i(72091);const p=Autodesk.Viewing.Private;function m(e){var t=e;this.isLeafletLoader=!0,this.loading=!1;var i=function(e,t){var i=[80,75,1,2],n=t;if(e[n++]!==i[0]||e[n++]!==i[1]||e[n++]!==i[2]||e[n++]!==i[3])return o.logger.error("invalid file header signature"),null;var r={};return r.version=e[n++],r.os=e[n++],r.needVersion=e[n++]|e[n++]<<8,r.flags=e[n++]|e[n++]<<8,r.compression=e[n++]|e[n++]<<8,r.time=e[n++]|e[n++]<<8,r.date=e[n++]|e[n++]<<8,r.crc32=(e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24)>>>0,r.compressedSize=(e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24)>>>0,r.plainSize=(e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24)>>>0,r.fileNameLength=e[n++]|e[n++]<<8,r.extraFieldLength=e[n++]|e[n++]<<8,r.fileCommentLength=e[n++]|e[n++]<<8,r.diskNumberStart=e[n++]|e[n++]<<8,r.internalFileAttributes=e[n++]|e[n++]<<8,r.externalFileAttributes=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24,r.relativeOffset=(e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24)>>>0,r.filename=String.fromCharCode.apply(null,e.slice(n,n+=r.fileNameLength)),r.extraField=e.slice(n,n+=r.extraFieldLength),r.comment=e.slice(n,n+r.fileCommentLength),r.length=n-t,r},c=function(e){var t=function(e){var t=[80,75,3,4],i=0;if(e[i++]!==t[0]||e[i++]!==t[1]||e[i++]!==t[2]||e[i++]!==t[3])return o.logger.error("invalid local file header signature"),null;var n={};return n.needVersion=e[i++]|e[i++]<<8,n.flags=e[i++]|e[i++]<<8,n.compression=e[i++]|e[i++]<<8,n.time=e[i++]|e[i++]<<8,n.date=e[i++]|e[i++]<<8,n.crc32=(e[i++]|e[i++]<<8|e[i++]<<16|e[i++]<<24)>>>0,n.compressedSize=(e[i++]|e[i++]<<8|e[i++]<<16|e[i++]<<24)>>>0,n.plainSize=(e[i++]|e[i++]<<8|e[i++]<<16|e[i++]<<24)>>>0,n.fileNameLength=e[i++]|e[i++]<<8,n.extraFieldLength=e[i++]|e[i++]<<8,n.filename=String.fromCharCode.apply(null,e.slice(i,i+=n.fileNameLength)),n.extraField=e.slice(i,i+=n.extraFieldLength),n.length=i,n}(e);if(!t)return null;var i=t.length,n=t.compressedSize;return e.slice(i,i+n)};this.continueLoadFile=function(e,i,s,l,c,u){var m,g,v=this;if(!v.loading)return void s({code:r.ErrorCodes.LOAD_CANCELED,msg:"Load canceled"},null);null!==(m=i.loadOptions)&&void 0!==m&&m.loadFromZip?g="{z}/{x}_{y}."+i.loadOptions.mime.split("/")[1]:g=e;c.initFromLoadOptions(g,i.loadOptions,u,i);let y=null;l&&l(),!c.valid()&&c.initForSimpleImage(e),c.onRootLoaded=function(){if(!v.loading)return void s({code:r.ErrorCodes.LOAD_CANCELED,msg:"Load canceled"},null);var a=new function(r){var o;this.bbox=new f.Box3,this.basePath=e,this.is2d=!0,this.urn=null===(o=i.bubbleNode)||void 0===o?void 0:o.getRootNode().urn();var s=r&&r.paperWidth>=0?r.paperWidth:c.texWidth,a=r&&r.paperHeight>=0?r.paperHeight:c.texHeight;this.pageToModelTransform=c.getPageToModelTransform(s,a),this.metadata={},this.metadata.page_dimensions={};var l=this.metadata.page_dimensions;l.page_width=s,l.page_height=a,l.page_units=r&&r.paperUnits,this.loadDone=!0,this.isLeaflet=!0,t.signalProgress(100,n.ProgressState.LOADING),c.texWidth>0&&(this.maxPixelPerUnit=c.texWidth/c.getQuadWidth(),c.isSimpleImage&&(this.maxPixelPerUnit*=10))}(i.loadOptions);a.loadOptions=i,a.bbox.copy(c.getBBox()),a.modelSpaceBBox=a.bbox.clone(),i.placementTransform&&(a.placementTransform=i.placementTransform.clone(),a.placementWithOffset=i.placementTransform.clone(),a.bbox.applyMatrix4(i.placementTransform));const l=new h.Model(a);return l.addTraversalController("Custom",y),l.loader=v,t.api.dispatchEvent({type:d.MODEL_ROOT_LOADED_EVENT,svf:a,model:l}),y.callWhenRefined((function(){var e,t=Date.now();a.loadTime=t-v.t0,o.logger.log("SVF load: "+a.loadTime),p.analytics.track("viewer.model.loaded",{load_time:a.loadTime,total_raster_pixels:null===(e=a.loadOptions.bubbleNode)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.totalRasterPixels,viewable_type:"2d",url:a.basePath,urn:a.urn})})),s(null,l),v.loading=!1,l.id},c.onDone=s,c.getPixelRatio=t.glrenderer().getPixelRatio,c.maxAnisotropy=t.glrenderer().getMaxAnisotropy(),c.placementTransform=i.placementTransform,y=new a.ModelIteratorTexQuad(c,t.getMaterials()),y.requestRootTile()},this.loadFile=function(e,t,n,h){if(this.loading)return o.logger.log("Loading of Leaflet already in progress. Ignoring new request."),!1;var d=this;this.loading=!0,this.options=t,this.t0=Date.now();var p=new a.TexQuadConfig,m=null,g=t.acmSessionId;if(t.loadOptions&&t.loadOptions.loadFromZip){m=function(e,t,i){for(var n,r=e.split("/")[0]-p.levelOffset,o=0;o<p.zips.length;o++)if(r<=p.zips[o].zipMaxLevel){n=p.zips[o];break}if(!n)return i("Failed loading texture - tile's level doesn't exists."),!1;var s=n.fileTable[e];if(!s)return i("Failed loading texture - entry does not exist inside fileTable."),!1;var a={extractImage:c},h=s.relativeOffset,u=s.relativeOffset+s.contentSize;n.rawData?a.rawData=n.rawData.slice(h,u):a.range={min:h,max:u},l.TextureLoader.loadTextureWithSecurity(n.urnZip,f.UVMapping,t,i,g,!0,a)};t.loadOptions.zips.forEach((function(a){var l=a.centralDirOffset,c=a.centralDirLength,f=a.centralDirEntries;!function(e,t,i,n,r,o){var a=null,l={};(0,u.isOffline)()||(t&&(a="acmsession="+t),l.range={min:i,max:n+i});var c=(0,u.initLoadContext)({queryParams:a});s.ViewingService.getItem(c,e,r,o,l)}(a.urnZip,g,l,c,(function(r){(0,u.isOffline)()&&(a.rawData=r,r=r.slice(l,l+c));var o=function(e,t,n){for(var r,o=0,s={},a=null,l=0;l<n;++l){if(!(r=i(e,o)))return null;a&&(a.contentSize=r.relativeOffset-a.relativeOffset),o+=r.length,s[r.filename]=r,a=r}return a.contentSize=t-a.relativeOffset,s}(r,l,f);if(!o)return n("Failed parsing central directory of the zip.",null),!1;a.fileTable=o,t.loadOptions.zips.every((function(e){return Object.keys(e.fileTable).length>0}))&&d.continueLoadFile(e,t,n,h,p,m)}),(function(e){o.logger.error("Zip download failed: "+e.statusText,(0,r.errorCodeString)(r.ErrorCodes.NETWORK_FAILURE)),n("Zip download failed: "+e.statusText,null)}))}))}else m=function(e,t,i){l.TextureLoader.loadTextureWithSecurity(e,f.UVMapping,t,i,g,!0)},this.continueLoadFile(e,t,n,h,p,m);return!0},this.dtor=function(){this.loading=!1}}m.prototype.is3d=function(){return!1},m.prototype.isPageCoordinates=function(){var e;return!(null===(e=this.options)||void 0===e||null===(e=e.loadOptions)||void 0===e||!e.fitPaperSize)},c.FileLoaderManager.registerFileLoader("Leaflet",["jpeg","jpg","png"],m)},91496:(e,t,i)=>{"use strict";i.r(t),i.d(t,{OtgLoader:()=>ve});var n=i(37365),r=i(21706),o=i(83081),s=i(90255),a=i(75468),l=i(68747),c=i(13e3),h=i(7756),u=i(8412),d=i(84045),f=i(96118);function p(e){switch(e){case"meter":case"meters":case"m":default:return 1;case"feet and inches":case"foot":case"feet":case"ft":return.3048;case"inch":case"inches":case"in":return.0254;case"centimeter":case"centimeters":case"cm":return.01;case"millimeter":case"millimeters":case"mm":return.001}}function m(e,t){if(e.metadata){var i=e.metadata["world bounding box"],o=new f.LmvVector3(i.minXYZ[0],i.minXYZ[1],i.minXYZ[2]),s=new f.LmvVector3(i.maxXYZ[0],i.maxXYZ[1],i.maxXYZ[2]);e.bbox=new r.LmvBox3(o,s),e.modelSpaceBBox=e.bbox.clone();var a=function(e,t){var i=e.metadata["custom values"];if(e.placementTransform=t.placementTransform,t.applyScaling){var r="m";e.metadata["distance unit"]&&(r=e.metadata["distance unit"].value),e.scalingUnit=r,"object"==typeof t.applyScaling?(t.applyScaling.from&&(r=t.applyScaling.from),t.applyScaling.to&&(e.scalingUnit=t.applyScaling.to)):e.scalingUnit=t.applyScaling;var o=p(r)/p(e.scalingUnit);if(1!=o){var s=new n.LmvMatrix4(!0),a=new n.LmvMatrix4(!0);a.elements[0]=o,a.elements[5]=o,a.elements[10]=o,t.placementTransform&&s.copy(t.placementTransform),t.applyPlacementInModelUnits?t.placementTransform=a.multiply(s):t.placementTransform=s.multiply(a),e.placementTransform=t.placementTransform,e.scalingFactor=o}}if(i&&i.refPointTransform){e.refPointTransform=new n.LmvMatrix4(!0);var l=e.refPointTransform.elements,c=i.refPointTransform;l[0]=c[0],l[1]=c[1],l[2]=c[2],l[4]=c[3],l[5]=c[4],l[6]=c[5],l[8]=c[6],l[9]=c[7],l[10]=c[8],l[12]=c[9],l[13]=c[10],l[14]=c[11]}else{var h=e.metadata.georeference,u=h&&h.refPointLMV,d=0;if(i&&Object.prototype.hasOwnProperty.call(i,"angleToTrueNorth")&&(d=Math.PI/180*i.angleToTrueNorth),u||d){var f=new n.LmvMatrix4(!0),m=f.elements;m[0]=m[5]=Math.cos(d),m[1]=-Math.sin(d),m[4]=Math.sin(d);var g=new n.LmvMatrix4(!0);m=g.elements,u&&(m[12]=-u[0],m[13]=-u[1],m[14]=-u[2]),e.refPointTransform=f.multiply(g)}}if(t.applyRefPoint&&e.refPointTransform){var v=new n.LmvMatrix4(!0);t.placementTransform&&v.copy(t.placementTransform),v.multiply(e.refPointTransform),e.placementTransform=t.placementTransform=v}else!t.applyRefPoint&&t.placementTransform&&(e.placementTransform=new n.LmvMatrix4(!0).copy(t.placementTransform));return e.placementTransform&&function(e){for(var t=e.elements,i=0;i<4;i++)for(var n=0;n<4;n++)if(i===n){if(1!==t[4*i+n])return!1}else if(0!==t[4*i+n])return!1;return!0}(e.placementTransform)&&(e.placementTransform=null),e.placementTransform}(e,t);a&&!e.bbox.isEmpty()&&e.bbox.applyMatrix4(a),t.globalOffset?e.globalOffset=t.globalOffset:e.globalOffset=e.bbox.getCenter(new f.LmvVector3),function(e,t){var i=e.globalOffset;if(i.x||i.y||i.z){if(t){var r=new n.LmvMatrix4(!0);r.copy(t),(t=r).elements[12]-=i.x,t.elements[13]-=i.y,t.elements[14]-=i.z}else(t=new n.LmvMatrix4(!0)).makeTranslation(-i.x,-i.y,-i.z);e.placementWithOffset=t}else e.placementWithOffset=t}(e,a),e.bbox.isEmpty()||(e.bbox.min.sub(e.globalOffset),e.bbox.max.sub(e.globalOffset)),Object.prototype.hasOwnProperty.call(e.metadata,"double sided geometry")&&e.metadata["double sided geometry"].value&&(e.doubleSided=!0)}}function g(e,t){e[0]-=t.x,e[1]-=t.y,e[2]-=t.z}function v(e,t){if(t&&(t.transformPoint(e.position),t.transformPoint(e.target),t.transformDirection(e.up),isFinite(e.orthoScale))){const i=t.getMaxScaleOnAxis();e.orthoScale*=i}}var y=i(35982),b=i(10149);function x(e,t){let i,n,r,s,a,l,c=0;let h,u,d=new Array,f=0,p=new Uint8Array(4),m=0,g=0;this.onData=function(v){for(v&&(h?d.push(v):(h=v,f=0));h;){let v=Math.min(p.length-m,h.length-f);if(v>0&&(p.set(h.subarray(f,f+v),m),f+=v,m+=v),c)if(u>0)m===p.length&&(u=0,r=new Uint8Array(1024*i),s=new Float32Array(r.buffer),a=new Uint32Array(r.buffer),l=new Uint16Array(r.buffer),p=r,m=0);else{for(;g+i<=m;){if(!e(this,g,c))return;g+=i,c++}m===p.length&&(g=0,m=0)}else m===p.length&&(i=p[1]<<8|p[0],i||(i=t||0),i||o.logger.error("Unknown byte stride."),i%4&&o.logger.error("Expected byte size to be multiple of 4, but got "+i),n=p[3]<<8|p[2],u=i-4,p=new Uint8Array(u),m=0,c++);f===h.length&&(h=d.shift(),f=0)}},this.flush=function(){this.onData(null),v(),m%i>0&&o.logger.warn("unexpected extra bytes at end of stream")},this.idata=function(){return a},this.i16data=function(){return l},this.fdata=function(){return s},this.bdata=function(){return r},this.version=function(){return n},this.byteStride=function(){return i};let v=()=>null;this.done=new Promise((e=>v=e))}var _,E,S,A,w,T=i(83293);function M(e){var t=this.stream=new T.z(e),i=t.getInt32();this.type=t.getString(i),this.version=t.getInt32(),this.types=null,this.entryOffsets=[];var n=t.offset;t.seek(t.byteLength-8);var r=t.getUint32();this.typesOffset=t.getUint32(),t.seek(this.typesOffset);var o=this.readU32V();this.types=[];for(var s=0;s<o;++s)this.types.push({entryClass:this.readString(),entryType:this.readString(),version:this.readU32V()});t.seek(r);var a=this.readU32V(),l=this.entryOffsets;for(let e=0;e<a;++e)l.push(t.getUint32());t.seek(n)}M.prototype.readVarint=function(){var e,t=0,i=0;do{t|=(127&(e=this.stream.getUint8()))<<i,i+=7}while(128&e);return t},M.prototype.readU32V=M.prototype.readVarint,M.prototype.readU16=function(){return this.stream.getUint16()},M.prototype.readU8=function(){return this.stream.getUint8()},M.prototype.readString=function(){return this.stream.getString(this.readU32V())},M.prototype.readVector3f=function(){var e=this.stream;return{x:e.getFloat32(),y:e.getFloat32(),z:e.getFloat32()}},M.prototype.readF32=function(){return this.stream.getFloat32()},M.prototype.readF64=function(){return this.stream.getFloat64()},M.prototype.readVector3d=(_={x:0,y:0,z:0},function(){var e=this.stream;return _.x=e.getFloat64(),_.y=e.getFloat64(),_.z=e.getFloat64(),_}),M.prototype.readQuaternionf=(E={x:0,y:0,z:0,w:0},function(){var e=this.stream;return E.x=e.getFloat32(),E.y=e.getFloat32(),E.z=e.getFloat32(),E.w=e.getFloat32(),E}),M.prototype.readMatrix3f=(S=new n.LmvMatrix4,function(e){e||(e=S);var t=this.stream;e.identity();for(var i=0;i<3;++i)for(var n=0;n<3;++n)e.elements[4*i+n]=t.getFloat32();return e}),M.prototype.readTransform=(A={x:1,y:1,z:1},w=new n.LmvMatrix4(!0),function(e,t,i,r,o,s){var a,l,c=this.stream;switch(c.getUint8()){case 4:w.identity();break;case 0:a=this.readVector3d(),w.makeTranslation(a.x,a.y,a.z);break;case 1:l=this.readQuaternionf(),a=this.readVector3d(),A.x=1,A.y=1,A.z=1,w.compose(a,l,A);break;case 2:var h=c.getFloat32();l=this.readQuaternionf(),a=this.readVector3d(),A.x=h,A.y=h,A.z=h,w.compose(a,l,A);break;case 3:this.readMatrix3f(w),a=this.readVector3d(),w.setPosition(a)}if(s&&(s[0]=w.elements[12],s[1]=w.elements[13],s[2]=w.elements[14]),r&&w.multiplyMatrices(r,w),o&&(w.elements[12]-=o.x,w.elements[13]-=o.y,w.elements[14]-=o.z),void 0===e)return(new n.LmvMatrix4).copy(w);var u=w.elements;t&&(t[i+0]=u[0],t[i+1]=u[1],t[i+2]=u[2],t[i+3]=u[4],t[i+4]=u[5],t[i+5]=u[6],t[i+6]=u[8],t[i+7]=u[9],t[i+8]=u[10],t[i+9]=u[12],t[i+10]=u[13],t[i+11]=u[14])}),M.prototype.getEntryCounts=function(){return this.entryOffsets.length},M.prototype.seekToEntry=function(e){if(e>=this.getEntryCounts())return null;this.stream.seek(this.entryOffsets[e]);var t=this.stream.getUint32();return t>=this.types.length?null:this.types[t]},M.prototype.readPathID=function(){let e,t=this.stream;if(this.version<2){let i=t.getUint16();if(!i)return null;if(t.getUint16(),1==i)return"";e=t.getUint16();for(let n=2;n<i;++n)e+="/"+t.getUint16()}else{let t=this.readU32V();if(!t)return null;if(this.readU32V(),1==t)return"";e=this.readU32V();for(let i=2;i<t;++i)e+="/"+this.readU32V()}return e};const C=1,P=2,D=4,L=8,I=16,R=32;function O(e,t,i){if(!e.seekToEntry(i))return null;const n={},r=e.readVarint();if(r&C){n.cameraEntry=e.readVarint();const i={definition:n.cameraEntry};n.camera=function(e,t){var i=t.definition,n=e.seekToEntry(i);if(!n)return null;if(n.version>2)return null;var r=e.stream,o={isPerspective:!r.getUint8(),position:e.readVector3f(),target:e.readVector3f(),up:e.readVector3f(),aspect:r.getFloat32(),fov:r.getFloat32()*(180/Math.PI)};return n.version<2&&(r.getFloat32(),r.getFloat32()),o.orthoScale=r.getFloat32(),o}(t,i)}if(r&P&&(n.cameraTransform=e.readTransform(),n.camera&&n.cameraTransform&&v(n.camera,n.cameraTransform)),r&D&&(n.renderMode=e.readU8()),r&L&&(n.primitiveDisplayFlags=e.readU8()),r&R&&(n.overrideSet=e.readVarint()),r&I)if(n.clipPlaneMode=e.readU8(),0===n.clipPlaneMode){n.sectionCount=e.readU8(),n.clipData={},n.sectionPlane=[];for(let t=0;t<n.sectionCount;t++){const t=Object.assign({},e.readVector3f()),i=e.readF64();n.sectionPlane.push(-t.x,-t.y,-t.z,i)}}else{n.clipData={};const t=Object.assign({},e.readVector3d()),i=Object.assign({},e.readVector3d()),r=Object.assign({},e.readQuaternionf());n.sectionBox={min:t,max:i},n.sectionBoxTransform=r,n.isFromViewpoint=!0}return n}const N=1,F=2,U=4,B=8;function k(e,t){const i=e.readVarint();let n=0;for(let r=0;r<i;++r){n+=e.readVarint(),t(n)}}function V(e,t){if(!e.seekToEntry(t))return null;const i={},n=e.stream.getUint32();if(n&N&&(i.defaultMaterialIndex=e.readVarint(),i.defaultMaterialFlags=e.readU8()),n&F&&(i.defaultFlags=e.readVarint()),n&U){i.materialOverrides=[];const t=e.readVarint();for(let n=0;n<t;++n){let t=e.readVarint();k(e,(function(e){i.materialOverrides.push({dbId:e,materialIndex:t})}))}}if(n&B){i.flagOverrides=[];const t=e.readVarint();for(let n=0;n<t;++n){let t=e.readVarint();k(e,(function(e){i.flagOverrides.push({dbId:e,flags:t})}))}}return i}const G={NI_Inner:0,NI_Leaf:1};function z(e){const t=e.readString();let i=function(e){let t="";for(let i=0;i<16;i++)t+=e.readU8();return t}(e);const n=e.readU8();if(n===G.NI_Leaf){return{name:t,entry:e.readVarint(),uuid:i}}if(n===G.NI_Inner){const i=e.readVarint(),n=[];for(let t=0;t<i;t++){const t=z(e);n.push(t)}return{name:t,children:n}}return{}}function H(e){return e.seekToEntry&&e.seekToEntry(0),z(e)}const W="urn:adsk.fluent:",j="$otg_cdn$";function q(){this.materials=null,this.fragments=null,this.geompacks=[],this.propertydb={attrs:[],avs:[],ids:[],values:[],offsets:[],dbid:[]},this.bbox=null,this.animations=null,this.globalOffset={x:0,y:0,z:0},this.pendingRequests=0,this.initialLoadProgress=0,this.viewpointProgress=0,this.materialIdToHash=[],this.abortController=new AbortController,this.viewpoints=[],this.overrideSets=[],this.extraMatHashes={}}q.prototype.getMaterialHash=function(e){var t;if(null===(t=this.materialHashes)||void 0===t||!t.hashes)return null;var i=this.materialHashes.hashes[e];return null!=i&&i.length?(this.materialIdToHash[e]=i,i):null},q.prototype.getExtraMaterialHashes=function(){var e;let t=new Set;null===(e=this.overrideSets)||void 0===e||e.forEach((e=>{const{defaultMaterialIndex:i,materialOverrides:n}=e;i&&t.add(i),null==n||n.forEach((e=>{t.add(e.materialIndex)}))}));const i=[...t].filter((e=>!this.materialIdToHash[e]));i.length&&(this.needExtraMaterials=!0);for(const e of i){const t=this.getMaterialHash(e);t&&(this.extraMatHashes[e]=t)}},q.prototype.getGeometryHash=function(e){var t;if(null===(t=this.geomMetadata)||void 0===t||!t.hashes)return null;var i=this.geomMetadata.hashes[e];return null!=i&&i.length?i:null},q.prototype.initEmptyLists=function(e){var t=this,i=t.fragments={};i.length=t.metadata.stats.num_fragments,i.numLoaded=0,i.boxes=e.fragmentTransformsDouble?new Float64Array(6*i.length):new Float32Array(6*i.length),i.transforms=e.fragmentTransformsDouble?new Float64Array(12*i.length):new Float32Array(12*i.length),i.materials=(0,b.z)(i.length,t.metadata.stats.num_materials),i.geomDataIndexes=(0,b.z)(i.length,t.metadata.stats.num_geoms),i.fragId2dbId=new Int32Array(i.length),i.visibilityFlags=new Uint8Array(i.length),i.topoIndexes=null,e.buildDbId2FragIdMap&&(i.dbId2fragId={}),t.geomMetadata={hashes:null,byteStride:0,version:0,numLoaded:0,hashToIndex:new Map},t.materialHashes={hashes:null,byteStride:0,version:0,numLoaded:0},t.materials={name:"LMVTK Simple Materials",version:"1.0",scene:{SceneUnit:8215,YIsUp:0},materials:{}}},q.prototype.loadAsyncResource=function(e,t,i,n){var r=this;this.pendingRequests++,t=(0,d.pathToURL)(t,e.basePath),d.ViewingService.getItem(e,t,(function(e){r.pendingRequests--,n(e)}),e.onFailureCallback,{responseType:i||"arraybuffer"})},q.prototype.loadAsyncProgressive=function(e,t,i,n,r){var o=this;t=(0,d.pathToURL)(t,e.basePath),d.ViewingService.getItem(e,t,(function(){o.postLoad(e,n)}),r||e.onFailureCallback,{responseType:"arraybuffer",ondata:function(e){i.onData(e)},abortSignal:o.abortController.signal,useFetch:!0})},q.prototype.loadMetadata=function(e,t){var i=this;this.loadAsyncResource(e,t,"json",(function(r){i.metadata=r,i.manifest=i.metadata.manifest,i.numGeoms=i.metadata.stats.num_geoms,i.processViewPointData(e),i.processMetadata(e),i.initEmptyLists(e);var o=i.metadata.manifest,s=o.shared_assets.pdb;for(let e in s)i.propertydb[e]&&i.propertydb[e].push({path:s[e],isShared:!0});var a=o.assets.pdb;for(let e in a)i.propertydb[e]&&i.propertydb[e].push({path:a[e],isShared:!1});o.assets.animations&&i.loadAsyncResource(e,o.assets.animations,"json",(function(e){i.animations=e,function(e){if(e.animations){var t=e.animations.animations;if(t)for(var i=e.globalOffset,r=(new n.LmvMatrix4).makeTranslation(i.x,i.y,i.z),o=(new n.LmvMatrix4).makeTranslation(-i.x,-i.y,-i.z),s=new n.LmvMatrix4,a=new n.LmvMatrix4,l=0;l<t.length;l++){var c=t[l];if(c.hierarchy)for(var h=0;h<c.hierarchy.length;h++){var u=c.hierarchy[h].keys;if(u)for(var d=0;d<u.length;d++){var f=u[d].pos;if(f){var p=i,m=u[d].rot;m&&(s.makeRotationFromQuaternion({x:m[0],y:m[1],z:m[2],w:m[3]}),a.multiplyMatrices(r,s).multiply(o),p={x:a.elements[12],y:a.elements[13],z:a.elements[14]}),g(f,p)}var v=u[d].target;v&&g(v,i);var y=u[d].points;if(y)for(var b=0;b<y.length;b++)g(y[b],i)}}}}}(i)})),o.assets.topology&&i.loadAsyncResource(e,t,"json",(function(e){i.topology=e})),e.onLoaderEvent("otg_root"),i.postLoad(e,"metadata")}))},q.prototype.addDbIdReference=function(e,t){const i=this.fragments;let n=i.dbId2fragId[t];void 0===n?i.dbId2fragId[t]=e:"number"==typeof n?i.dbId2fragId[t]=[n,e]:n.push(e)},q.prototype.loadFragmentList=function(e,t){var i=this,r=new f.LmvVector3,o=new f.LmvVector3,s={x:0,y:0,z:0,w:1},a=new n.LmvMatrix4(!0),c={x:0,y:0,z:0};let h=new x((function(t,n,h){if(h-=1,!i.metadata)return!1;var u=t.idata(),d=t.fdata();n/=4;var f,p=i.fragments,m=p.geomDataIndexes[h]=u[n],g=p.materials[h]=u[n+1],v=p.fragId2dbId[h]=u[n+2],y=u[n+3];if(e.buildDbId2FragIdMap&&i.addDbIdReference(h,v),m>i.geomMetadata.numLoaded||g>i.materialHashes.numLoaded)return!1;f=!i.dbIdFilter||i.dbIdFilter[v]?1&y?l.MeshFlags.MESH_HIDE:0:l.MeshFlags.MESH_NOTLOADED,p.visibilityFlags[h]=f;var b=i.metadata.fragmentTransformsOffset||c,x=n+4;r.set(d[x+0]+b.x,d[x+1]+b.y,d[x+2]+b.z),s.x=d[x+3],s.y=d[x+4],s.z=d[x+5],s.w=d[x+6],o.set(d[x+7],d[x+8],d[x+9]),a.compose(r,s,o),i.placementWithOffset&&a.multiplyMatrices(i.placementWithOffset,a);var _=a.elements,E=p.transforms,S=12*h;if(E[S+0]=_[0],E[S+1]=_[1],E[S+2]=_[2],E[S+3]=_[4],E[S+4]=_[5],E[S+5]=_[6],E[S+6]=_[8],E[S+7]=_[9],E[S+8]=_[10],E[S+9]=_[12],E[S+10]=_[13],E[S+11]=_[14],!p.boxesLoaded){let e=p.boxes,t=6*h;for(let i=0;i<3;i++){let n=Math.abs(_[i]);n+=Math.abs(_[i+4]),n+=Math.abs(_[i+8]),n*=.5;let r=_[12+i];e[t+i]=r-n,e[t+i+3]=r+n}}return p.numLoaded=h+1,e.onLoaderEvent("fragment",h),!0}));return this.loadAsyncProgressive(e,t,h,"all_fragments"),h},q.prototype.handleHashListRequestFailures=function(e){this.metadata&&(this.geomHashListFailure&&this.metadata.stats.num_geoms>0&&e.onFailureCallback.apply(e,this.geomHashListFailure),this.matHashListFailure&&this.metadata.stats.num_materials>0&&e.onFailureCallback.apply(e,this.matHashListFailure),this.geomHashListFailure=null,this.matHashListFailure=null)},q.prototype.loadGeometryHashList=function(e,t){var i=this;let n=new x((function(e,t,n){return!!i.metadata&&(i.geomMetadata.hashes||(i.geomMetadata.hashes=new Array(i.numGeoms+1),i.geomMetadata.byteStride=e.byteStride(),i.geomMetadata.version=e.version()),i.geomMetadata.hashes[n]=(0,y.bin16ToPackedString)(e.i16data(),t/2),i.geomMetadata.numLoaded=n,!0)}),20);return this.loadAsyncProgressive(e,t,n,"geometry_ptrs",(function(){i.geomHashListFailure=arguments,i.handleHashListRequestFailures(e),i.postLoad(e,"geometry_ptrs",n)})),n},q.prototype.loadMaterialHashList=function(e,t){var i=this;let n=new x((function(e,t,n){return!!i.metadata&&(i.materialHashes.hashes||(i.numMaterials=i.metadata.stats.num_materials,i.materialHashes.hashes=new Array(i.numMaterials+1),i.materialHashes.byteStride=e.byteStride(),i.materialHashes.version=e.version()),i.materialHashes.hashes[n]=(0,y.bin16ToPackedString)(e.i16data(),t/2),i.materialHashes.numLoaded=n,!0)}),20);return this.loadAsyncProgressive(e,t,n,"material_ptrs",(function(){i.matHashListFailure=arguments,i.handleHashListRequestFailures(e),i.postLoad(e,"material_ptrs",n)})),n},q.prototype.processMetadata=function(e){var t=this,i=t.metadata;m(t,e);var n=t.placementWithOffset;if(i.cameras){t.cameras=i.cameras;for(var r=0;r<t.cameras.length;r++){var o=t.cameras[r];o.position=new f.LmvVector3(o.position.x,o.position.y,o.position.z),o.target=new f.LmvVector3(o.target.x,o.target.y,o.target.z),o.up=new f.LmvVector3(o.up.x,o.up.y,o.up.z),n&&v(o,n)}}},q.prototype.beginLoad=function(e,t){this.loadMetadata(e,t);let i=e.objectIds;if(i){this.dbIdFilter={};for(let e=0,t=i.length;e<t;e++)this.dbIdFilter[i[e]]=1}this.materialsCtx=this.loadMaterialHashList(e,"materials_ptrs.hl"),this.geometryCtx=this.loadGeometryHashList(e,"geometry_ptrs.hl"),this.fragmentsCtx=this.loadFragmentList(e,"fragments.fl")},q.prototype.makeSharedResourcePath=function(e,t,i){if(10===i.length&&(i=(0,y.unpackHexString)(i)),e){let o=this.manifest.shared_assets.global_sharding||0,s=i,a="";o&&(a="/"+i.slice(0,o),s=i.slice(o));var n=this.manifest.shared_assets[t];if(0===n.indexOf(W)||0===n.indexOf(j))n=n.slice(n.indexOf("/"));else{var r=n.split("/");n="/"+(r[r.length-1]||r[r.length-2])+"/"}return e+a+n+s}{let e=this.manifest.shared_assets.global_sharding||2,n=i,r="";return e&&(r="/"+i.slice(0,e)+"/",n=i.slice(e)),(0,d.pathToURL)(this.basePath)+this.manifest.shared_assets[t]+r+n}},q.prototype.postLoad=function(e,t){t&&this.initialLoadProgress++,4===this.initialLoadProgress?(this.materialsCtx.flush(),this.geometryCtx.flush(),this.fragmentsCtx.flush(),this.materialsCtx=null,this.geometryCtx=null,this.fragmentsCtx=null,this.fragments.numLoaded<this.metadata.stats.num_fragments&&o.logger.warn("Fragments actually loaded fewer than expected."),e.onLoaderEvent("all_fragments")):"metadata"===t&&(this.materialsCtx.onData(null),this.geometryCtx.onData(null),this.fragmentsCtx.onData(null))},q.prototype.processViewPointData=function(e){var t=this;const i=t.manifest.assets.viewpoints;i?("camera_definitions"in i&&t.loadCameraDefinition(e,i.camera_definitions),"override_sets"in i&&t.loadOverrideSets(e,i.override_sets),"viewpoint_tree"in i&&t.loadViewpointTree(e,i.viewpoint_tree),"viewpoints"in i&&t.loadViewpoints(e,i.viewpoints)):e.onOperationComplete()},q.prototype.postLoadViewpointData=async function(e){this.viewpointProgress++,4===this.viewpointProgress&&(this.materialsCtx&&await this.materialsCtx.done,this.processViewpoints(),this.getExtraMaterialHashes(),e.onLoaderEvent("viewpointData"))},q.prototype.loadCameraDefinition=function(e,t){let i=this;i.loadAsyncResource(e,t,null,(function(t){i.cameraDef=new M(t),i.postLoadViewpointData(e)}))},q.prototype.loadOverrideSets=function(e,t){let i=this;i.loadAsyncResource(e,t,null,(function(t){if(i.overrideSetsPack=new M(t),i.overrideSetsPack){for(let e=0,t=i.overrideSetsPack.getEntryCounts();e<t;e++){const t=V(i.overrideSetsPack,e);t&&i.overrideSets.push(t)}i.overrideSetsPack=null,i.postLoadViewpointData(e)}}))},q.prototype.loadViewpointTree=function(e,t){let i=this;i.loadAsyncResource(e,t,null,(function(t){if(i.viewpointTreePack=new M(t),i.viewpointTreePack){const t=H(i.viewpointTreePack);i.viewpointTreeRoot=t,function(){const e=i.viewpointTreeRoot;if(e&&(e.name=e.name||"Saved Viewpoints"),null==e||!e.children)return;let t=0;function n(e){if(e.children){for(let t=0;t<e.children.length;t++)n(e.children[t]);e.type="folder",e.role="viewable",e.guid=t+++""}else isNaN(e.entry)||(e.order=t,e.type="view",e.role="3d",e.guid=t+++"",e.isViewpoint=!0)}for(let t=0;t<e.children.length;t++)n(e.children[t])}(),i.viewpointTreePack=null,i.postLoadViewpointData(e)}}))},q.prototype.loadViewpoints=function(e,t){let i=this;i.loadAsyncResource(e,t,null,(function(t){i.viewpointsDefPack=new M(t),i.postLoadViewpointData(e)}))},q.prototype.processViewpoints=function(){if(this.viewpointsDefPack&&this.cameraDef){for(let e=0,t=this.viewpointsDefPack.getEntryCounts();e<t;e++){const t=O(this.viewpointsDefPack,this.cameraDef,e);t&&this.viewpoints.push(t)}this.viewpointsDefPack=null,this.cameraDef=null}},q.prototype.abort=function(){this.abortController.abort()};var X=i(54393),Y=i(63764),K=i(99211),Q=i(19556),Z=i(28441),$=i(55280),J=i(19356),ee=(i(65782),i(42759)),te=i(57872),ie=i(72091);const ne=new ie.Box3;class re{static _buildNotCondition(e){const t=this._parse(e);return(e,i)=>!t(e,i)}static _buildOrCondition(e){const t=new Array;if(e instanceof Array)for(let i=0;i<e.length;++i)t.push(this._parse(e[i]));return(e,i)=>{for(const n of t)if(n(e,i))return!0;return!1}}static _buildAndCondition(e){const t=new Array;if(e instanceof Array)for(let i=0;i<e.length;++i)t.push(this._parse(e[i]));return(e,i)=>{let n=!0;for(const r of t)n&=r(e,i);return n}}static _buildEnclosesClause(e){const t=e[0];let i;for(i in t)break;const n=new ie.Box3;[n.min.x,n.min.y,n.min.z,n.max.x,n.max.y,n.max.z]=t[i];const r=e.length>1&&"number"==typeof e[2]?e[2]:1e-8;return 0!==r&&n.expandByScalar(r),(e,t)=>(e.getFragmentList().getWorldBounds(t,ne),n.containsBox(ne))}static _buildIntersectsClause(e){const t=e[0];let i;for(i in t)break;const n=new ie.Box3;return[n.min.x,n.min.y,n.min.z,n.max.x,n.max.y,n.max.z]=t[i],(e,t)=>(e.getFragmentList().getWorldBounds(t,ne),n.intersectsBox(ne))}static _buildExtentClause(e){return(t,i)=>{const n=new ie.Box3;t.getFragmentList().getWorldBounds(i,n);const r=new ie.Vector3;n.getSize(r);return r.x*r.y*r.z>e}}static _parse(e){let t;for(t in e)break;switch(t){case"$not":return this._buildNotCondition(e[t]);case"$or":return this._buildOrCondition(e[t]);case"$and":return this._buildAndCondition(e[t]);case"$encloses":return this._buildEnclosesClause(e[t]);case"$intersects":return this._buildIntersectsClause(e[t]);case"$extent":return this._buildExtentClause(e[t]);default:return void console.warn("Spatial Query Parser: condition type not supported, given",t)}}static parse(e){return this._parse(e)}}class oe{_source;_predicate;static validate(e){return!0}fromString(e){if(this._source!==e){if(this._predicate=void 0,void 0!==e&&0!==e.length)return oe.validate(e)?void(this._source=e):(console.warn("Validation of spatial query failed, given:",e),void(this._source=void 0));this._source=void 0}}fromObject(e){if(void 0===e||0===Object.keys(e).length)return this._source=void 0,void(this._predicate=void 0);const t=JSON.stringify(e);this.fromString(t)}isEmpty(){return void 0===this._source}isReady(){return!!this._predicate}initialize(){if(this.isEmpty()||this.isReady())return;const e=JSON.parse(this._source,((e,t)=>"number"==typeof t?parseFloat(t):t));this._predicate=re.parse(e)}get isFragmentPassing(){return this._predicate}}const se=/(?<quote>["'])\?(.*?)\k<quote>/g;class ae{_source;_fragmentIDs;_extension;_initializing=!1;static validate(e){return!0}static async preprocessAttributeLookups(e,t,i){const n=await e.getAttributeDefinitions(t)||new Array,r=i.matchAll(se);for(const e of r){const t=e[2].trim();let r=n.filter((e=>e.name===t)).map((t=>`${e[0][0]}s.props.${t.propertyHash}${e[0][0]}`));if(1===r.length)i=i.replace(e[0],r[0]);else console.error(`Expected unique property from hash lookup, found ${r.length}, given`,e[2]),i=i.replace(e[0],'"s.props.unresolved"')}return i}fromString(e){if(this._source!==e){if(this._fragmentIDs=void 0,void 0!==e&&0!==e.length)return ae.validate(e)?void(this._source=e):(console.warn("Validation of property query failed, given:",e),void(this._source=void 0));this._source=void 0}}fromObject(e){if(void 0===e||0===Object.keys(e).length)return this._source=void 0,void(this._fragmentIDs=void 0);const t=JSON.stringify(e);this.fromString(t)}fromDbIDs(e,t){if(void 0===e||void 0===t)return void(this._fragmentIDs=void 0);const i=e.getInstanceTree(),n=new Array;t.forEach((e=>i.enumNodeFragments(e,(e=>{n.push(e)}),!0))),this._fragmentIDs=new Set(n)}isEmpty(){return void 0===this._source}isReady(){return!!this._fragmentIDs}isInitializing(){return this._initializing}async initialize(e){var t;if(this.isEmpty()||this.isReady())return;if(this._initializing=!0,void 0===this._extension){const t=e.loader.viewer3DImpl.api;this._extension=await t.loadExtension("Autodesk.Filter")}if(void 0===this._extension)return void console.warn("Expected loading Autodesk.Filter extension to succeed.");const i=await ae.preprocessAttributeLookups(this._extension,e,this._source),n=JSON.parse(i,((e,t)=>"number"==typeof t?parseFloat(t):t)),r=await this._extension.getModelIdsWithFilter(e,n,void 0,void 0,!1),o=null===(t=r.ids)||void 0===t?void 0:t.concat(r.ids2??[]);this.fromDbIDs(e,o),this._initializing=!1}isFragmentPassing(e,t){return this._fragmentIDs.has(t)}}class le{_asyncInit;_match;_initializing=!1;_initialized=!1;fromObjects(e,t){this._asyncInit===e&&this._match===t||(this._asyncInit=e,this._match=t,this._initialized=!1)}isEmpty(){return void 0===this._match}isReady(){return!(void 0!==this._asyncInit)||!this._initializing&&this._initialized}needsInitializing(){return!(void 0!==this._asyncInit&&(this._initializing||this._initialized))}isInitializing(){return this._initializing}async initialize(e){if(!this.needsInitializing())return;this._initializing=!0;const t=e.loader.viewer3DImpl.api;await this._asyncInit(e,t),this._initializing=!1,this._initialized=!0}isFragmentPassing(e,t){return this._match(e,t)}}const ce=Object.freeze({FRAGMENT_LIST_READY:1,BOUNDING_VOLUME_HIERARCHY_READY:2,PROPERTIES_READY:4}),he=Object.freeze({ON_FRAGMENT_READY:"immediate",ON_FRAGMENT_LIST_READY:"fast",ON_BOUNDING_VOLUME_HIERARCHY_READY:"exact"}),ue=he.ON_BOUNDING_VOLUME_HIERARCHY_READY,de=Object.freeze({ANY:0,ALL:1}),fe=de.ALL;class pe{_model;_rootCondition=fe;_active=!1;_spatialQuery=new oe;_spatialQueryLoadTimeBehavior=ue;_propertyQuery=new ae;_lambdaQuery=new le;_state=0;constructor(e){this.evaluate=e,this._state=0,this._isFragmentPassingImpl=this._isFragmentPassing_true}onModelRootReady(e){this._model=e}onFragmentReady(e){this._isFragmentPassingImpl===this._isFragmentPassing_spatial&&this.evaluate(e)}onFragmentListReady(){this.update(ce.FRAGMENT_LIST_READY)}onBoundingVolumeHierarchyReady(){this.update(ce.BOUNDING_VOLUME_HIERARCHY_READY)}onPropertiesReady(){this.update(ce.PROPERTIES_READY)}setRootCondition(e){void 0!==e&&this._rootCondition!==e&&(this._rootCondition=e)}setSpatialQueryBehavior(e){void 0!==e&&this._spatialQueryLoadTimeBehavior!==e&&(this._spatialQueryLoadTimeBehavior=e)}setSpatialQuery(e){this._spatialQuery.fromObject(e),this._active||=!this._spatialQuery.isEmpty()}setPropertyQuery(e){this._propertyQuery.fromObject(e),this._active||=!this._propertyQuery.isEmpty()}setLambdaQuery(e,t){this._lambdaQuery.fromObjects(e,t),this._active||=!this._lambdaQuery.isEmpty()}prepare(e){var t,i,n,r,o,s;this.setSpatialQuery(null===(t=e.filter)||void 0===t?void 0:t.spatial_query),this.setPropertyQuery(null===(i=e.filter)||void 0===i?void 0:i.property_query),this.setLambdaQuery(null===(n=e.filter)||void 0===n?void 0:n.asyncInit,null===(r=e.filter)||void 0===r?void 0:r.match);switch(null===(o=e.filter)||void 0===o?void 0:o.root_condition){case"or":this.setRootCondition(de.ANY);break;case"and":this.setRootCondition(de.ALL);break;default:this.setRootCondition(fe)}const a=null===(s=e.filter)||void 0===s?void 0:s.spatial_behavior;switch(a){case he.ON_FRAGMENT_READY:case he.ON_FRAGMENT_LIST_READY:case he.ON_BOUNDING_VOLUME_HIERARCHY_READY:this.setSpatialQueryBehavior(a);break;default:this.setSpatialQueryBehavior(ue)}const l=!this._spatialQuery.isEmpty(),c=this._propertyQuery.isEmpty(),h=this._rootCondition===de.ANY||c,u=this._spatialQueryLoadTimeBehavior===he.ON_FRAGMENT_READY;l&&u&&h&&(this._spatialQuery.initialize(),this._isFragmentPassingImpl=this._isFragmentPassing_spatial)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&this._state&e)return;this._state|=e;if(this._spatialQuery.isEmpty()&&this._propertyQuery.isEmpty()&&this._lambdaQuery.isEmpty()){if(this._isFragmentPassingImpl=this._isFragmentPassing_true,!this._active)return;return void this.evaluate()}this._state|=void 0!==e?e:0;const i=!this._lambdaQuery.isEmpty(),n=!this._lambdaQuery.needsInitializing()||!!(this._state&ce.FRAGMENT_LIST_READY);let r=!i;switch(this._spatialQueryLoadTimeBehavior){case he.ON_FRAGMENT_READY:r&&=!0;break;case he.ON_FRAGMENT_LIST_READY:r&&=!!(this._state&ce.FRAGMENT_LIST_READY);break;case he.ON_BOUNDING_VOLUME_HIERARCHY_READY:r&&=!!(this._state&ce.BOUNDING_VOLUME_HIERARCHY_READY)}const s=!i&&!!(this._state&ce.FRAGMENT_LIST_READY)&&!!(this._state&ce.PROPERTIES_READY),a=!this._spatialQuery.isEmpty();a&&r&&!this._spatialQuery.isReady()?(this._spatialQuery.initialize(),t=!0):!a||i||r||(t=!1);const l=!this._propertyQuery.isEmpty();if(l&&s&&!this._propertyQuery.isReady()&&!this._propertyQuery.isInitializing()){const e=this;return void this._propertyQuery.initialize(this._model).then((()=>e.update(void 0,!0)))}if(!l||i||s&&!this._propertyQuery.isInitializing()||(t=!1),i&&n&&!this._lambdaQuery.isReady()&&!this._lambdaQuery.isInitializing()){const e=this;return void this._lambdaQuery.initialize(this._model).catch((e=>{o.logger.warn("Filter initialization failed, falling back to load the whole model",e),this.setLambdaQuery(void 0)})).then((()=>e.update(void 0,!0)))}if(i&&n&&this._lambdaQuery.isReady())console.warn("Lambda queries are currently disabled."),this._isFragmentPassingImpl=this._isFragmentPassing_lambda,t=!0;else{const e=a&&r&&this._spatialQuery.isReady(),t=l&&s&&this._propertyQuery.isReady();switch(this._rootCondition|a<<1|e<<2|l<<3|t<<4){case 6:case 14:case 7:this._isFragmentPassingImpl=this._isFragmentPassing_spatial;break;case 24:case 26:case 25:this._isFragmentPassingImpl=this._isFragmentPassing_property;break;case 30:this._isFragmentPassingImpl=this._isFragmentPassing_any;break;case 31:this._isFragmentPassingImpl=this._isFragmentPassing_all;break;default:this._isFragmentPassingImpl=this._isFragmentPassing_false}}this._isFragmentPassingImpl!==this._isFragmentPassing_false&&t&&this.evaluate()}evaluate(){throw new TypeError("Method expected to be replaced.")}_isFragmentPassing_true(){return!0}_isFragmentPassing_false(){return!1}_isFragmentPassing_spatial(e){return this._spatialQuery.isFragmentPassing(this._model,e)}_isFragmentPassing_property(e){return this._propertyQuery.isFragmentPassing(this._model,e)}_isFragmentPassing_all(e){return this._spatialQuery.isFragmentPassing(this._model,e)&&this._propertyQuery.isFragmentPassing(this._model,e)}_isFragmentPassing_any(e){return this._spatialQuery.isFragmentPassing(this._model,e)||this._propertyQuery.isFragmentPassing(this._model,e)}_isFragmentPassing_lambda(e){return this._lambdaQuery.isFragmentPassing(this._model,e)}_isFragmentPassingImpl(e){throw new TypeError("This method must be set to a specific evaluation.")}isFragmentPassing(e){if(this._isFragmentPassingImpl===this._isFragmentPassing_true||this._isFragmentPassingImpl===this._isFragmentPassing_false||this._isFragmentPassingImpl===this._isFragmentPassing_lambda)return this._isFragmentPassingImpl(e);return this._isFragmentPassingImpl(e)}get isActive(){return this._active}}const me=Autodesk.Viewing,ge=Autodesk.Viewing.Private;function ve(e){this.viewer3DImpl=e,this.loading=!1,this.tmpMatrix=new n.LmvMatrix4,this.tmpBox=new r.LmvBox3,this.logger=o.logger,this.loadTime=0,this.pendingMaterials=new Map,this.pendingMeshes=new Array,this.pendingRequests=0,this.operationsDone=0,this.viewpointMatHashes=new Set,this.notifiesFirstPixel=!0,this._selectiveLoadingController=new pe(ve.prototype.evaluate.bind(this)),this._lineageUrn=null}function ye(e){var t="",i=e.lastIndexOf("/");return-1!=i&&(t=e.substr(0,i+1)),t}function be(e){return e.acmSessionId?"acmsession="+e.acmSessionId:""}function xe(e,t,i){var n={basePath:t,objectIds:e.ids,globalOffset:e.globalOffset,fragmentTransformsDouble:e.fragmentTransformsDouble,placementTransform:e.placementTransform,applyRefPoint:e.applyRefPoint,queryParams:i,bvhOptions:e.bvhOptions||{isWeakDevice:(0,$.isMobileDevice)()},applyScaling:e.applyScaling,applyPlacementInModelUnits:e.applyPlacementInModelUnits,loadInstanceTree:e.loadInstanceTree};return(0,u.initLoadContext)(n)}function _e(e){return Math.floor(100*e.fragsLoaded/e.metadata.stats.num_fragments)}ve.prototype.dtor=function(){this.bvhWorker&&(this.bvhWorker.terminate(),this.bvhWorker=null,o.logger.debug("SVF loader dtor: on svf worker.")),this.svf&&(this.svf.loadDone||console.log("stopping load before it was complete"),this.svf.abort(),this.svf.propDbLoader&&(this.svf.propDbLoader.dtor(),this.svf.propDbLoader=null)),this.viewer3DImpl.geomCache()&&this.model&&(this.loading&&this.viewer3DImpl.geomCache().cancelRequests(this.svf.geomMetadata.hashToIndex.keys()),this.pendingRequests=0,this.removeMeshReceiveListener()),this.viewer3DImpl=null,this.model=null,this.svf=null,this.logger=null,this.tmpMatrix=null,this.loading=!1,this.loadTime=0},ve.prototype.isValid=function(){return null!=this.viewer3DImpl},ve.prototype.removeMeshReceiveListener=function(){this.meshReceivedListener&&(this.viewer3DImpl.geomCache().loaderRemoved(),this.viewer3DImpl.geomCache().removeEventListener(J.MESH_RECEIVE_EVENT,this.meshReceivedListener),this.viewer3DImpl.geomCache().removeEventListener(J.MESH_FAILED_EVENT,this.meshFailedListener),this.viewer3DImpl.geomCache().removeEventListener(J.MATERIAL_RECEIVE_EVENT,this.materialReceiveListener),this.viewer3DImpl.geomCache().removeEventListener(J.MATERIAL_FAILED_EVENT,this.materialReceiveListener),this.meshReceivedListener=null,this.meshFailedListener=null)},ve.prototype.loadFile=function(e,t,i,n){if(!this.viewer3DImpl)return o.logger.log("SVF loader was already destructed. So no longer usable."),!1;if(this.viewer3DImpl._signalNoMeshes(),this.loading)return o.logger.log("Loading of SVF already in progress. Ignoring new request."),!1;if(this.loading=!0,t.acmSessionId)this.svfUrn=t.acmSessionId.split(",")[0];else{console.warn("DEPRECATED: Automatic derivation of URN will be removed in a future release. Please set the acmSessionId parameter when loading OTG data.");var r=e.indexOf(W);if(-1===r&&(r=e.indexOf(j)),-1!==r){var s=e.split("/"),a=s[1]+"?version="+s[2],l=me.toUrlSafeBase64(a);this.svfUrn=l}}return this.sharedDbPath=t.sharedPropertyDbPath,this.currentLoadPath=e,this.basePath=ye(e),this.acmSessionId=t.acmSessionId,this.options=t,this.queryParams=be(t),this.loadContext=xe(t,this.basePath,this.queryParams),this.loadContext.raiseError=function(e,t,n){i&&i({code:e,msg:t,args:n})},this.loadContext.onFailureCallback=d.ViewingService.defaultFailureCallback.bind(this.loadContext),this.viewer3DImpl.isWebGPU()&&(this.loadContext.buildDbId2FragIdMap=!0),this._selectiveLoadingController.prepare(t),this.loadModelRoot(this.loadContext,i),n&&n(),!0},ve.prototype._requestRepaint=function(){var e;null!==(e=this.viewer3DImpl)&&void 0!==e&&e.modelVisible(this.model.id)&&this.viewer3DImpl.api.dispatchEvent({type:me.LOADER_REPAINT_REQUEST_EVENT,loader:this,model:this.model})},ve.prototype.loadModelRoot=function(e,t){this.t0=(new Date).getTime(),this.firstPixelTimestamp=null;var i=this;i.viewer3DImpl.geomCache();var n=this.svf=new q;return n.basePath=e.basePath,e.onLoaderEvent=function(e,r){if(i.svf){if("otg_root"===e){i.onModelRootLoadDone(n),t&&t(null,i.model),i.makeBVHInWorker();var s=i.viewer3DImpl.geomCache();s||o.logger.error("geomCache is required for loading OTG models."),s.loaderAdded(i.options.acmSessionId,i._lineageUrn),i.meshReceivedListener=e=>i.onMeshReceived(e.geom),i.meshFailedListener=e=>i.onMeshError(e.hash),s.addEventListener(J.MESH_RECEIVE_EVENT,i.meshReceivedListener),s.addEventListener(J.MESH_FAILED_EVENT,i.meshFailedListener),i.materialReceiveListener=function(e){e.material&&e.material.length?i.onMaterialLoaded((0,ee.TN)(e.material),e.hash):i.onMaterialLoaded(null,e.hash)},s.addEventListener(J.MATERIAL_RECEIVE_EVENT,i.materialReceiveListener),s.addEventListener(J.MATERIAL_FAILED_EVENT,i.materialReceiveListener),i.svf.loadDone=!1}else if("fragment"===e){if(!i.options.skipMeshLoad){const e=r;i._selectiveLoadingController.isActive?i._selectiveLoadingController.onFragmentReady(e):i.tryToActivateFragment(e,"fragment")}i.options.onFragmentListLoadProgress&&i.trackFragmentListLoadProgress()}else if("all_fragments"===e)i.options.skipPropertyDb||(i.loadPropertyDb(),i._selectiveLoadingController.onPropertiesReady()),i.fragmentDataLoaded=!0,i._selectiveLoadingController.onFragmentListReady(),i.viewer3DImpl.api.fireEvent({type:Q.MODEL_ROOT_LOADED_EVENT,svf:n,model:i.model}),i.options.skipMeshLoad||!i.svf.fragments.length?i.onGeomLoadDone():i.onOperationComplete();else if("viewpointData"===e){if(i.svf.needExtraMaterials){Object.values(i.svf.extraMatHashes).forEach((e=>i.viewpointMatHashes.add(e))),i.tryToLoadExtraMaterials()}else i.onOperationComplete();i.svf.viewpointTreeRoot&&i.options.addViews&&i.options.addViews(i.svf.viewpointTreeRoot,i.model)}}else console.error("load callback called after load was aborted")},e.onOperationComplete=function(){i.onOperationComplete()},this.svf.beginLoad(this.loadContext,(0,d.pathToURL)(this.currentLoadPath)),!0},ve.prototype.makeBVHInWorker=function(){var e=this;e.bvhWorker=(0,h.createWorker)("OtgBvhWorker");e.bvhWorker.addEventListener("message",(function(t){console.log("Received BVH from worker");var i=t.data.bvh;e.model&&(e.svf.bvh=i,e.model.setBVH(new a.NodeArray(i.nodes,i.useLeanNodes),i.primitives,e.options.bvhOptions),e.model.setFragmentBoundingBoxes(t.data.boxes,t.data.boxStride),e._selectiveLoadingController.onBoundingVolumeHierarchyReady(),e._requestRepaint()),e.bvhWorker.terminate(),e.bvhWorker=null,e.onOperationComplete()}));var t=Object.assign({},e.loadContext);t.operation="LOAD_OTG_BVH",t.raiseError=null,t.onFailureCallback=null,t.onLoaderEvent=null,t.onOperationComplete=null,t.fragments_extra=(0,d.pathToURL)(e.basePath)+e.svf.manifest.assets.fragments_extra,t.placementTransform=e.svf.placementTransform,t.placementWithOffset=e.svf.placementWithOffset,t.fragmentTransformsOffset=e.svf.metadata.fragmentTransformsOffset,t.globalOffset=e.svf.globalOffset,te.USE_HLOD&&(t.wantSort=!0),t.fragments_extra?e.bvhWorker.doOperation(t):e.onOperationComplete()},ve.prototype.tryToActivateFragment=function(e,t){var i=this.svf,n=this.model;if(!n)return;const r=i.fragments.visibilityFlags[e],o=r&l.MeshFlags.MESH_NOTLOADED||this._selectiveLoadingController.isActive&&!this._selectiveLoadingController.isFragmentPassing(e),s=!!(r&l.MeshFlags.MESH_HIDE),a=i.loadOptions.skipHiddenFragments??!1;if(o||s&&a)return n.getFragmentList().setFlagFragment(e,l.MeshFlags.MESH_NOTLOADED,!0),n.getFragmentList().setFragOff(e,!0),void this.trackGeomLoadProgress(i,e,!1);s&&(n.getFragmentList().setFlagFragment(e,l.MeshFlags.MESH_HIDE,!1),n.getFragmentList().setFlagFragment(e,l.MeshFlags.MESH_VISIBLE,!1));var c=!1,h=i.fragments.materials[e],u=i.getMaterialHash(h),d=this.findOrLoadMaterial(n,u);d||("fragment"===t&&(this.pendingMaterials.get(u).push(e),this.pendingRequests++),"material"!==t&&(c=!0));var f=i.fragments.geomDataIndexes[e];if(0!==f){var p=n.getGeometryList().getGeometry(f);if(p?"fragment"===t&&n.getGeometryList().addInstance(f):("fragment"===t&&this.loadGeometry(f,e),c=!0),!c){n.getFragmentList().getOriginalWorldMatrix(e,this.tmpMatrix);var m=this.viewer3DImpl.setupMesh(n,p,u,this.tmpMatrix);m.geomId=f,n.activateFragment(e,m,!!i.placementTransform),this.viewer3DImpl.geomCache().updateGeomImportance(n,e),this.trackGeomLoadProgress(i,e,!1)}}else(d||"material"===t)&&this.trackGeomLoadProgress(i,e,!1)},ve.prototype.tryToLoadExtraMaterials=function(){var e=this.svf,t=this.model;if(t&&!e.extraMaterialLoaded){e.extraMaterialLoaded=!0;for(const i of Object.values(e.extraMatHashes))this.findOrLoadMaterial(t,i)}},ve.prototype.onModelRootLoadDone=function(e){var t;e.isOTG=!0,e.geomMetadata.hashToIndex=new Map,e.failedFrags={},e.failedMeshes={},e.failedMaterials={},e.fragsLoaded=0,e.fragsLoadedNoGeom=0,e.nextRepaintPolys=0,e.numRepaints=0,e.urn=this.svfUrn,e.acmSessionId=this.acmSessionId,e.basePath=this.basePath,e.loadOptions=this.options||{};var i=Date.now();o.logger.log("SVF load: "+(i-this.t0));var n=this.model=new Y.Model(e);n.loader=this,n.initialize(),this._selectiveLoadingController.onModelRootReady(n),this.t1=i,o.logger.log("scene bounds: "+JSON.stringify(e.bbox));var r={category:"metadata_load_stats",urn:e.urn,has_topology:!!e.topology,has_animations:!!e.animations,materials:e.metadata.stats.num_materials,is_mobile:(0,$.isMobileDevice)()};o.logger.track(r),this.viewer3DImpl.signalProgress(5,Z.ProgressState.ROOT_LOADED,this.model),e.handleHashListRequestFailures(this.loadContext),e.propDbLoader=new c.PropDbLoader(this.sharedDbPath,this.model,this.viewer3DImpl.api),this._lineageUrn=null===(t=n.getDocumentNode())||void 0===t?void 0:t.lineageUrn(),this._lineageUrn||(this._lineageUrn=K.BubbleNode.parseLineageUrnFromDecodedUrn(Autodesk.Viewing.fromUrlSafeBase64(e.urn)))},ve.prototype.trackGeomLoadProgress=function(e,t,i){if(i){if(e.failedFrags[t])return void console.log("Double fail",t);e.failedFrags[t]=1}var n=_e(e);e.fragsLoaded++;var r=_e(e);r>n&&this.viewer3DImpl.signalProgress(r,Z.ProgressState.LOADING,this.model),this.model.getGeometryList().geomPolyCount>e.nextRepaintPolys&&(this.firstPixelTimestamp||(this.firstPixelTimestamp=Date.now()),e.numRepaints++,e.nextRepaintPolys+=1e5*Math.pow(1.5,e.numRepaints),this._requestRepaint()),e.fragsLoaded===e.metadata.stats.num_fragments&&this.onOperationComplete(),this.trackOnDemandLoadProgress()},ve.prototype.trackFragmentListLoadProgress=function(){var e=this.svf;function t(e){return Math.floor(100*e.fragsLoadedNoGeom/e.metadata.stats.num_fragments)}var i=t(e);e.fragsLoadedNoGeom++;var n=t(e);n>i&&this.options.onFragmentListLoadProgress(this.model,n)},ve.prototype.onOperationComplete=function(){this.operationsDone++,4===this.operationsDone&&this.onGeomLoadDone()},ve.prototype.onMaterialLoaded=async function(e,t,i){if(this.loading){var n=this.pendingMaterials.get(t);if(n){var r=this.viewer3DImpl.matman();if(e){e.hash=t;try{var o=await r.convertSharedMaterial(this.model,e,t);s.TextureLoader.loadMaterialTextures(this.model,o,this.viewer3DImpl),r.hasTwoSidedMaterials()&&this.viewer3DImpl.renderer().toggleTwoSided(!0)}catch(e){this.svf.failedMaterials[t]=1}}else this.svf.failedMaterials[t]=1;for(var a=0;a<n.length;a++)this.pendingRequests--,this.tryToActivateFragment(n[a],"material");this.pendingMaterials.delete(t),this.viewpointMatHashes.has(t)&&(this.viewpointMatHashes.delete(t),0===this.viewpointMatHashes.size&&this.onOperationComplete())}}},ve.prototype.findOrLoadMaterial=function(e,t){if(this.pendingMaterials.has(t))return!1;var i=this.svf;if(this.viewer3DImpl.matman().findMaterial(e,t))return!0;this.pendingMaterials.set(t,[]);var n=i.makeSharedResourcePath(this.loadContext.otg_cdn,"materials",t);return this.viewer3DImpl.geomCache().requestMaterial(n,void 0,t,void 0,this.queryParams,this._lineageUrn),!1},ve.prototype.loadGeometry=function(e,t){var i=this.svf;++this.pendingRequests;var n=this.pendingMeshes[e];if(n)return void n.push(t);this.pendingMeshes[e]=[t];var r=i.getGeometryHash(e);i.geomMetadata.hashToIndex.set(r,e);var o=i.makeSharedResourcePath(this.loadContext.otg_cdn,"geometry",r);this.viewer3DImpl.geomCache().requestGeometry(o,void 0,r,void 0,this.queryParams,this._lineageUrn)},ve.prototype.onMeshError=function(e){this.svf.failedMeshes[e]=1;var t=this.svf.geomMetadata.hashToIndex.get(e),i=this.pendingMeshes[t];if(i){for(var n=0;n<i.length;n++)this.trackGeomLoadProgress(this.svf,i[n],!0),this.pendingRequests--;this.svf.geomMetadata.hashToIndex.delete(e),this.pendingMeshes[t]=null}},ve.prototype.onMeshReceived=function(e){var t=this.model;if(t){var i=t.getGeometryList(),n=this.svf.geomMetadata.hashToIndex.get(e.hash);if(void 0!==n){var r=i.hasGeometry(n),o=this.pendingMeshes[n];if(!r){i.addGeometry(e,o&&o.length||1,n,this.viewer3DImpl.geomCache()),!this.svf.loadDone||this.options.onDemandLoading||this._selectiveLoadingController.isActive||console.error("Geometry received after load was done"),this.viewer3DImpl._signalMeshAvailable(),this.svf.geomMetadata.hashToIndex.delete(e.hash),this.pendingMeshes[n]=null;for(var s=0;s<o.length;s++)this.pendingRequests--,this.tryToActivateFragment(o[s],"geom")}}}else console.warn("Received geometry after loader was done. Possibly leaked event listener?",e.hash)},ve.prototype.onGeomLoadDone=async function(){if(this.options.onDemandLoading||this._selectiveLoadingController.isActive||this.removeMeshReceiveListener(),this.svf.loadDone=!0,s.TextureLoader.loadModelTextures(this.model,this.viewer3DImpl),this.options.skipMeshLoad)return this.currentLoadPath=null,void this.viewer3DImpl.onLoadComplete(this.model);this.svf.fragments.entityIndexes=null,this.pendingMeshes=new Array,this.options.onDemandLoading||this._selectiveLoadingController.isActive||(this.svf.geomMetadata.hashes=null);var e=Date.now(),t="Fragments load time: "+(e-this.t1);this.loadTime=e-this.t0;var i=this.firstPixelTimestamp-this.t0;t+=" (first pixel time: "+i+")",o.logger.log(t),this.options.useConsolidation&&await this.viewer3DImpl.consolidateModel(this.model,this.options.consolidationMemoryLimit);var n={category:"model_load_stats",is_f2d:!1,has_prism:this.viewer3DImpl.matman().hasPrism,load_time:this.loadTime,geometry_size:this.model.getGeometryList().geomMemory,meshes_count:this.svf.metadata.stats.num_geoms,fragments_count:this.svf.metadata.stats.num_fragments,urn:this.svfUrn};i>0&&(n.first_pixel_time=i),o.logger.track(n,!0);const r=this.model.getGeometryList(),a={load_time:this.loadTime,polygons:r.geomPolyCount,fragments:this.model.getFragmentList().getCount(),mem_usage:r.gpuMeshMemory,time_to_first_pixel:this.firstPixelTimestamp-this.t0,viewable_type:"3d",url:this.currentLoadPath,urn:this.svfUrn};ge.analytics.track("viewer.model.loaded",a),this.currentLoadPath=null,this.viewer3DImpl.onLoadComplete(this.model)},ve.prototype.loadPropertyDb=function(){this.svf.propDbLoader.load()},ve.prototype.is3d=function(){return!0},ve.loadOnlyOtgRoot=function(e,t){const i=ye(e),n=xe(t,i,be(t)),r=new q;r.basePath=i;const o=(0,d.pathToURL)(e);return new Promise(((e,t)=>{n.onFailureCallback=()=>e(null),r.loadAsyncResource(n,o,"json",(function(t){r.metadata=t,r.manifest=t.manifest,r.numGeoms=r.metadata.stats.num_geoms,r.processMetadata(n),e(r)}))}))},ve.prototype.waitForFragmentData=async function(){if(this.fragmentDataLoaded)return!0;const e=this.viewer3DImpl.api;return new Promise((t=>{const i=()=>{e.removeEventListener(me.MODEL_ROOT_LOADED_EVENT,n),e.removeEventListener(me.MODEL_UNLOADED_EVENT,r)},n=e=>{e.model.loader===this&&(i(),t(!0))},r=e=>{e.model.loader===this&&(i(),t(!1))};e.addEventListener(me.MODEL_ROOT_LOADED_EVENT,n),e.addEventListener(me.MODEL_UNLOADED_EVENT,r)}))},ve.prototype.trackOnDemandLoadProgress=function(){this.svf.loadDone&&!1===this.fragLoadingInProgress&&0===this.pendingRequests&&this.viewer3DImpl.api.dispatchEvent({type:me.FRAGMENTS_LOADED_EVENT,loader:this,model:this.model})},ve.prototype.evaluate=function(e){if(!this.model||this.options.skipMeshLoad)return;if(void 0!==e)return void this.tryToActivateFragment(e,"fragment");const t=this.model.getFragmentList().fragments.length;for(let e=0;e<t;++e)this.tryToActivateFragment(e,"fragment")},ve.prototype.loadFragments=function(e){if(!this.svf.loadDone)return o.logger.warn("Trying to call loadFragments while model is not fully loaded yet."),0;this.svf.nextRepaintPolys=0,this.svf.numRepaints=0;let t=0;const i=this.model.getFragmentList();this.fragLoadingInProgress=!0;for(const n of e)i.isFlagSet(n,ge.MeshFlags.MESH_NOTLOADED)&&(i.setFlagFragment(n,ge.MeshFlags.MESH_NOTLOADED,!1),i.setFragOff(n,!1),i.setVisibility(n,!0),this.tryToActivateFragment(n,"fragment"),++t);return this.fragLoadingInProgress=!1,t&&this.trackOnDemandLoadProgress(),t},ve.prototype.isFragLoaded=function(e){return!(this.svf.fragments.visibilityFlags[e]&l.MeshFlags.MESH_NOTLOADED||this._selectiveLoadingController.isActive&&!this._selectiveLoadingController.isFragmentPassing(e))},ve.prototype.getLoadedDbIds=function(){const e=new Set;for(let t=0;t<this.svf.fragments.length;t++){const i=this.svf.fragments.fragId2dbId[t];this.isFragLoaded(t)&&e.add(i)}return e},X.FileLoaderManager.registerFileLoader("json",["json"],ve)},19356:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MATERIAL_FAILED_EVENT:()=>I,MATERIAL_RECEIVE_EVENT:()=>L,MESH_FAILED_EVENT:()=>D,MESH_RECEIVE_EVENT:()=>P,OtgResourceCache:()=>W});var n=i(55280),r=i(77201),o=i(7756),s=i(8412),a=i(25004),l=i(8600),c=i(96118),h=i(21706),u=i(4897),d=i(12153);function f(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i&&Math.abs(e.z-t.z)<i}function p(e,t){return t.importance-e.importance}var m=new h.LmvBox3;function g(e,t,i){var n=function(e,t,i){var n=6*t;return i.min.y=e[n+1],i.min.z=e[n+2],i.min.x=e[n+0],i.max.x=e[n+3],i.max.y=e[n+4],i.max.z=e[n+5],i}(t,e,m),r=i.intersectsBox(n);if(r===u.OUTSIDE)return 0;var o=r===u.CONTAINS,s=i.projectedBoxArea(n,o),a=d.SceneMath.pointToBoxDistance2(i.eye,n);return s/(a=Math.max(a,.01))}class v{constructor(){this.viewers=[],this.waitingTasks=[],this.waitingTasksHead=0,this.urgentHashes={},this.prevNumTasks=0,this.fullSortDone=!1,this.lastCamPos={},this.lastCamTarget={},this.lastVisibleModelIds={}}addViewer(e){this.viewers.push(e),this.lastCamPos[e.id]=new c.LmvVector3,this.lastCamTarget[e.id]=new c.LmvVector3,this.lastVisibleModelIds[e.id]=[]}removeViewer(e){const t=this.viewers.indexOf(e);-1!==t&&(delete this.lastCamPos[e.id],delete this.lastCamTarget[e.id],delete this.lastVisibleModelIds[e.id],this.viewers.splice(t,1))}checkCameraChanged(){for(var e=!1,t=0;t<this.viewers.length;t++){var i=this.viewers[t],n=i.impl.camera,r=n.position,o=n.target;f(this.lastCamPos[i.id],r,.01)&&f(this.lastCamTarget[i.id],o,.01)||(this.lastCamPos[i.id].copy(r),this.lastCamTarget[i.id].copy(o),e=!0)}return e}checkModelsChanged(){for(var e=!1,t=0;t<this.viewers.length;t++){var i=this.viewers[t],n=i.impl.modelQueue().getModels();n.length!==this.lastVisibleModelIds[i.id].length&&(this.lastVisibleModelIds[i.id].length=n.length,e=!0);for(var r=0;r<n.length;r++){var o=this.lastVisibleModelIds[i.id][r],s=n[r].id;o!==s&&(this.lastVisibleModelIds[i.id][r]=s,e=!0)}}return e}validateRequestPriorities(){var e=this.checkCameraChanged(),t=this.checkModelsChanged();if(e||t)for(var i=this.waitingTasksHead;i<this.waitingTasks.length;i++)this.waitingTasks[i].importanceNeedsUpdate=!0}updateRequestPriorities(){var e=performance.now();this.validateRequestPriorities();var t={},i=[];for(let e=0;e<this.viewers.length;e++){let o=this.viewers[e];var n=o.impl.modelQueue(),r=n.frustum();i=i.concat(n.getModels()),r.reset(o.impl.camera),t[o.id]=r}var o=!1,s=0===this.prevNumTasks||this.waitingTasks.length-this.prevNumTasks>3e3||!this.fullSortDone;this.fullSortDone=!s,this.prevNumTasks=this.waitingTasks.length;for(let n=this.waitingTasksHead;n<this.waitingTasks.length;n++){var a=this.waitingTasks[n];if(a.importanceNeedsUpdate)if(this.urgentHashes[a.hash])a.importance=1/0;else{if(n%10==0)if(performance.now()-e>10){o=!0;break}a.importanceNeedsUpdate=!1,a.importance=0;var l=0,c=a.hash;for(const e of i)if(e.isOTG()){var h=e.myData.geomMetadata.hashToIndex.get(c);if(h){var u=e.loader.pendingMeshes[h];if(u){var d=e.myData.fragments.boxes;for(const i of this.viewers)if(-1!==i.impl.modelQueue().getModels().indexOf(e))for(const e of u)l+=g(e,d,t[i.id])}}}if(a.importance=l,!s){for(var f=n;f>this.waitingTasksHead&&l>this.waitingTasks[f-1].importance;)this.waitingTasks[f]=this.waitingTasks[f-1],f--;this.waitingTasks[f]=a}}}return s&&!o&&(this._sortTasks(),this.fullSortDone=!0),!o}makeUrgent(e){var t=0;for(var i in e)!0===e[i]&&(this.urgentHashes[i]=!0,t++);if(0===t)return 0;for(var n=this.waitingTasksHead;n<this.waitingTasks.length;n++){var r=this.waitingTasks[n];this.urgentHashes[r.hash]&&(r.importance=1/0)}return this._sortTasks(),t}_removeGarbage(){this.waitingTasks.splice(0,this.waitingTasksHead),this.waitingTasksHead=0}_sortTasks(){this._removeGarbage(),this.waitingTasks.sort(p)}removeUrgent(e){delete this.urgentHashes[e]}filterTasks(e){const t=[];for(let i=this.waitingTasksHead;i<this.waitingTasks.length;i++){const n=this.waitingTasks[i];e(n.hash)&&t.push(n)}this.waitingTasks=t,this.waitingTasksHead=0}addTask(e){this.waitingTasks.push(e)}takeTask(){return this.waitingTasksHead>1e4&&this._removeGarbage(),this.waitingTasks[this.waitingTasksHead++]}isEmpty(){return this.waitCount()<=0}waitCount(){return this.waitingTasks.length-this.waitingTasksHead}}const y="otg",b="otg-content",x="otg-lru";class _{constructor(e){this.db=null,this.readTransaction=null,this.loaded=!1,this.opening=!1,this.dbDisabled=this._isDbDisabled(e),!(0,n.isNodeJS)()&&this.dbDisabled&&console.log("IndexedDb disabled"),this.storeName=b,this.storeNameTimestamp=x,this.bothStoreNames=[this.storeName,this.storeNameTimestamp],this.pendingTimestampUpdates={},this.pendingTimestampCount=0,this.pendingStores=[],this._pendingCallbacks=[]}_isDbDisabled(e){return e||(0,n.isNodeJS)()||(0,n.isSafari)()||(0,n.isMobileDevice)()||"undefined"==typeof indexedDB}notifyPendingCallbacks(e){this._pendingCallbacks.forEach((t=>t(e,this.db))),this._pendingCallbacks=[]}open(e){if(this.dbDisabled)return void(e&&e());if(this.loaded)return void(e&&e(null,this.db));if(e&&this._pendingCallbacks.push(e),this.opening)return;this.opening=!0;let t=indexedDB.open(y,1);t.onerror=e=>{console.error("Failed to open or create cache database."),this.dbDisabled=!0,this.notifyPendingCallbacks(e)},t.onsuccess=e=>{this.opening=!1,this.db=e.target.result,this.db.onerror=function(e){console.error("Database error",e)},this.loaded=!0,this.notifyPendingCallbacks()},t.onupgradeneeded=e=>{console.log("Db upgrade",this.storeName);let t=e.target.result;t.createObjectStore(b),t.createObjectStore(x).createIndex(x+"-index","t",{unique:!1})}}deleteOld(e){if(!this.db)return void e();if(this.deleteInProgress)return;this.deleteInProgress=!0;let t=IDBKeyRange.upperBound(Date.now()-3e5,!0),i=[];this.db.transaction([this.storeNameTimestamp]).objectStore(this.storeNameTimestamp).index(this.storeNameTimestamp+"-index").openCursor(t).onsuccess=t=>{let n=t.target.result;if(n&&i.length<200)return i.push(n.primaryKey),void n.continue();if(i.length){console.log("Deleting old objects.",i.length);let t=this.db.transaction(this.bothStoreNames,"readwrite");t.oncomplete=t=>{this.deleteInProgress=!1,console.log("Delete done"),e&&e()},t.onerror=e=>{this.deleteInProgress=!1,console.error("Transaction error.",e)},t.onabort=e=>{this.deleteInProgress=!1;let t=e.target.error;console.log("Failed to delete cached objects",t)};let n=t.objectStore(this.storeName),r=t.objectStore(this.storeNameTimestamp);for(let e=0;e<i.length;e++)n.delete(i[e]),r.delete(i[e])}}}flush(e){if(this.pendingStores.length){if(!this.writeTransaction){let t=this.db.transaction(this.bothStoreNames,"readwrite");e&&(t.oncomplete=t=>{e()}),t.onerror=t=>{console.error("Transaction error.",t),e&&e(t.target.error)},t.onabort=t=>{"QuotaExceededError"===t.target.error.name&&this.deleteOld((()=>{})),e&&e(t.target.error)},this.writeTransaction=t}for(var t=0;t<this.pendingStores.length;t+=2){var i=this.pendingStores[t],n=this.pendingStores[t+1];this.writeTransaction.objectStore(this.storeName).put(n,i).onerror=e=>{console.error("Object store error.",e)},this.writeTransaction.objectStore(this.storeNameTimestamp).put({t:Date.now()},i)}this.pendingStores=[],this.writeTransaction=null}else e&&e()}store(e,t,i){this.db?(t=t.slice(),this.pendingStores.push(e),this.pendingStores.push(t),this.pendingStores.length<200||this.deleteInProgress?i&&i():this.flush(i)):i&&i()}flushTimestamps(e){let t=this.db.transaction([this.storeNameTimestamp],"readwrite");e&&(t.oncomplete=t=>{e()}),t.onerror=t=>{console.error("Transaction error.",t),e&&e(t.target.error)},t.onabort=t=>{"QuotaExceededError"===t.target.error.name&&(console.log("Quota exceeded"),this.deleteOld((()=>{}))),e&&e(t.target.error)};let i=t.objectStore(this.storeNameTimestamp);for(let e in this.pendingTimestampUpdates)i.put({t:this.pendingTimestampUpdates[e]},e);this.pendingTimestampUpdates={},this.pendingTimestampCount=0}_createReadTransaction(){let e=this.readTransaction=this.db.transaction(this.storeName);e.oncomplete=e=>{this.readTransaction=null},e.onerror=e=>{console.error("Transaction error.",e),this.readTransaction=null},e.onabort=e=>{console.warn("Transaction abort",e),this.readTransaction=null}}get(e,t){if(this.opening)return console.error("Tried to get IndexedDb resource while database was still opening"),void t(-1,null);if(!this.db)return void t(-1,null);let i;this.readTransaction||this._createReadTransaction();try{i=this.readTransaction.objectStore(this.storeName).get(e)}catch(t){this._createReadTransaction(),i=this.readTransaction.objectStore(this.storeName).get(e)}i.onsuccess=i=>{if(!i.target.result)return void t(-1,null);let n=i.target.result;t(null,n),this.pendingTimestampUpdates[e]=Date.now(),this.pendingTimestampCount++},i.onerror=e=>{t(e.target.errorCode)}}flushStoresAndTimestamps(){this.db&&this.flush((e=>{e||this.flushTimestamps()}))}size(e){if(!this.db)return void e();let t=0,i=0,n=this.db.transaction([this.storeName]).objectStore(this.storeName).openCursor();n.onsuccess=n=>{let r=n.target.result;if(r){let e=r.value;t+=e.length,i++,r.continue()}else e(null,{size:t,items:i})},n.onerror=function(t){e(t)}}estimateCachedHashCount(e){if(this.opening)return console.error("Tried to get IndexedDb resource while database was still opening"),void e(void 0);if(!this.db)return void e(void 0);let t,i=this.db.transaction(this.storeNameTimestamp);try{t=i.objectStore(this.storeNameTimestamp).openKeyCursor()}catch(t){return void e(void 0)}let n=2;const r=1e3;t.onsuccess=t=>{const o=t.target.result;if(o)if(--n>0)o.advance(999);else{const t=o.key.charCodeAt(0);e(65536e3/t),i.abort()}else e(2==n?0:1==n?r:void 0)},t.onerror=t=>{e(void 0)}}readAllCachedHashes(e){if(this.opening)return console.error("Tried to get IndexedDb resource while database was still opening"),void e([]);if(!this.db)return void e([]);let t,i=this.db.transaction(this.storeNameTimestamp);try{t=i.objectStore(this.storeNameTimestamp).getAllKeys()}catch(t){return void e([])}t.onsuccess=t=>{e(t.target.result)},t.onerror=t=>{e([])}}}var E=i(83081);const S=0,A=1,w={ws:{min:2,max:16},size:{min:500,max:4096}};class T{static FALLBACK_FLIGHT=3e3;static MIN_FLIGHT=1500;static MAX_FLIGHT=3e4;#p;CWND_DEVIATION=30;BETA=.8;FAST_CONVERGENCE=.7;wMax=0;lastReductionTs=performance.now();SCALING=.25;cwnd=0;initialAssetEstimate;#m=0;#g=1e3;#v=new M(1e3);#y=new M(20);wasReset=!1;#b=w.ws.min;#x={count:0,totalBytes:0};constructor(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>null;this.onFlightSizeUpdated=n,this.onConnectionCountUpdated=r,this.#m=e,this.#x.totalBytes=i,this.#x.count=Math.round(i/t),this.initialAssetEstimate=t,this.wMax=this.#x.totalBytes,this.cwnd=this.wMax*this.BETA,this.#_()}hasCongestionEvent(){if(this.#v.count<3)return!1;const e=this.#v.tail.data,t=this.#v.head.data;if(this.cwnd<e.receivedBytes)return!1;if(e.receivedBytes/(t.receivedBytes||1)<1)return!0;const i=this.deviation(this.cwnd,t.cwnd),n=this.deviation(e.receivedBytes,t.receivedBytes);return Math.abs(i-n)>this.CWND_DEVIATION}shouldTimeout(){if(this.#y.count<this.#y.MAX_SIZE/2)return!1;let e=this.#y.tail||this.#y.head,t=0;for(;e&&t++<this.#y.MAX_SIZE/2;){if(e.data.receivedCount>0)return!1;e=e.prev}return t>=this.#y.MAX_SIZE/2}getMode(){return this.cwnd>this.wMax?A:S}#_(){if(this.shouldTimeout())return this.onFlightSizeUpdated(T.FALLBACK_FLIGHT),clearInterval(this.#p),void this.#E();const e=this.#S();let t=0,i=0,n=0;for(let{data:e}of this.#y){if(3==t++)break;i+=e.receivedBytes,n+=e.receivedCount}const r=Math.round(i/n||e.fragmentSize);let o;const s=e=>e/1e6,a=Math.cbrt(s(this.wMax)*(1-this.BETA)/this.SCALING),l=(performance.now()-this.lastReductionTs)/1e3;if(o=this.cwnd=1e6*(this.SCALING*Math.pow(l-a,3)+s(this.wMax)),this.hasCongestionEvent()){const e=this.getMode()===A?this.BETA:this.FAST_CONVERGENCE;this.lastReductionTs=performance.now(),this.wMax=this.#v.tail.prev.data.receivedBytes,this.#v.clear(),o=e*this.wMax}let c=Math.round(o/r);this.#m=c=Math.min(T.MAX_FLIGHT,Math.max(T.MIN_FLIGHT,c)),E.logger.debug(`${this.#v.head?"Increase":"Congestion"}: CWND=${(o/1e6).toFixed(2)}Mb RX=${(e.receivedBytes/1e6).toFixed(2)}Mb FLIGHT=${c} ( Average Size: ${r} )`),this.onFlightSizeUpdated(c),this.updateConnectionCount()}updateConnectionCount(){const{ws:e,size:t}=w;let i=1;let n=0;for(let{data:e}of this.#y){if(++n>6)break;i=Math.max(e.fragmentSize,i,t.min)}if(i>t.max)return;const r=(t.max-t.min)/(e.max-e.min),o=Math.round((t.max-i)/r);let s=0;for(let{data:e}of this.#y)if(6==++s||e.fragmentSize>i)break;let a=e.min+Math.round(o*Math.pow(s/6,3));a>this.#b&&(this.#b=a,this.onConnectionCountUpdated(a),E.logger.debug(`Updating connection count: ${a}`))}#E(){let e=0,t=0;for(let{data:i}of this.#y)t++<this.#y.MAX_SIZE/2||(e+=i.cwnd);const i=e/this.#y.count;this.wMax=i*(1-this.BETA+1),this.cwnd=i,this.#v.clear(),this.#y.clear(),this.wasReset=!0}#S(){var e;const t={fragmentSize:this.#x.count&&this.#x.totalBytes?this.#x.totalBytes/this.#x.count:(null===(e=this.#v.tail||this.#v.head)||void 0===e?void 0:e.data.fragmentSize)||this.initialAssetEstimate,receivedCount:this.#x.count,receivedBytes:this.#x.totalBytes,cwnd:this.cwnd};return this.#v.onReceived(t),this.#y.onReceived(t),this.#x.count=0,this.#x.totalBytes=0,t}onResourceReceived(e,t){this.#x.totalBytes+=t,this.#x.count+=e,this.wasReset&&(this.wasReset=!1,this.lastReductionTs=performance.now(),this.#p=setInterval((()=>{this.#_()}),this.#g))}deviation(e,t){return Math.abs(e-t)/((e+t)/2)*100}static createAndStart(e,t,i,n,r){const o=new T(e,t,i,n,r);return o.#p=setInterval((()=>{o.#_()}),o.#g),o}}class M{MAX_SIZE=2e3;#A=0;totalBytes=0;head;tail;get count(){return this.#A}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e,t)=>this.count>this.MAX_SIZE;this.MAX_SIZE=e,this.trimEval=t}clear(){this.#A=0,this.totalBytes=0,this.head=null,this.tail=null}onReceived(e,t){this.addNode(new C(e),t)}addNode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;for(0===this.#A?this.head=e:1===this.#A?(this.tail=e,this.head.setNext(e)):(this.tail.setNext(e),this.tail=e),this.#A+=t;this.trimEval(this.head,this.tail);){var i;const e=this.head.next;this.head.unlink(),this.totalBytes-=this.head.size,this.#A-=(null===(i=this.head.data)||void 0===i?void 0:i.count)||1,this.head=e}this.totalBytes+=e.size}}M.prototype[Symbol.iterator]=function*(){let e=this.tail;for(;e;)yield e,e=e.prev};class C{data;size=0;prev;next;timestamp;constructor(e){this.data=e,e.size&&(this.size=e.size),this.timestamp=Date.now()}setNext(e){return this.next=e,e&&(this.next.prev=this),this}setPrev(e){return this.prev=e,e&&(this.prev.next=this),this}unlink(){var e,t;null===(e=this.prev)||void 0===e||e.setNext(this.next),null===(t=this.next)||void 0===t||t.setPrev(this.prev),this.prev=null,this.next=null}}var P="meshReceived",D="meshFailed",L="materialReceived",I="materialFailed";let R=Autodesk.Viewing.Private,O="false"!==(0,l.getParameterByName)("useOPFS")&&!1!==(0,n.getGlobal)().USE_OPFS;const N=(0,l.getParameterByName)("useAdaptiveStreaming")||(0,n.getGlobal)().USE_ADAPTIVE_STREAMING,F="false"!==N&&!1!==N,U="true"===(0,l.getParameterByName)("disableIndexedDb").toLowerCase()||(0,n.getGlobal)().DISABLE_INDEXED_DB,B="true"===(0,l.getParameterByName)("disableWebSocket").toLowerCase()||(0,n.getGlobal)().DISABLE_WEBSOCKET;let k=U||O||!(0,n.isChrome)();const V={dummy_value:"error"},G={dummy_value:"error"};function z(e){var t=(0,s.initLoadContext)(e);return t.disableIndexedDb=U,t.disableWebSocket=B,t}function H(e,t){return e.importance-t.importance}function W(e){var t,i=new Map,s=new Map,a=new Map,l="OPFS"===(null==e||null===(t=e.cache)||void 0===t?void 0:t.type);(O||l)&&(O=!0,k=!0);var c=(0,o.createWorker)("OtgLoadWorker");c.addEventListener("message",q);for(var h=(0,n.isMobileDevice)()?2:4,u=[],d=[],f=0;f<h;f++){u.push((0,o.createWorker)("OtgDecodeWorker")),u[f].addEventListener("message",q);const e=new MessageChannel;u[f].doOperation({operation:"INSTALL_INPUT_PORT",port:e.port2},[e.port2]),d.push(e.port1)}const p=z({operation:"INIT_WORKER_OTG",ports:d,useOpfs:O,clearIndexedDbIfItsLarge:l});let g,y,b=d.slice();c.doOperation(p,b),this.initialized=!0,this.bandwidthOptimizer=()=>{if(g||y||(y=Date.now()),g||this.requestsReceived<2*S)return g;const e=this.byteSize/this.requestsReceived*.9,t=this.byteSize/((Date.now()-y)/1e3);return F&&(g=T.createAndStart(E+x,e,t,(e=>S=e),(e=>{w.waitingTasks.length/(this.requestsSent+w.waitingTasks.length)*100>5&&c.doOperation({operation:"SET_OTGWS_COUNT",count:e})}))),g},this.byteSize=0,this.refCount=0,this.cachedHashesDb=void 0,this.cachedHashes=null,this.cachedHashesPending=!1,this.cachedHashesEstimate=void 0,this.cachedHashesEstimatePending=!1,this.fromCacheCount=0,this.fromRemoteCount=0,this.requestsSent=0,this.requestsReceived=0;var x=0,E=0;var S=F?T.MIN_FLIGHT:T.FALLBACK_FLIGHT,A=void 0,w=new v,M=this,C=1048576;this._maxMemory=100*C,this._minCleanup=50*C;var N=new Map,B=[];function W(e,t){return!e.cachedHashes||e.cachedHashes.has(t)}function q(e){var t,n,o;if(e.data.event&&e.data.properties)return void R.analytics.track(e.data.event,e.data.properties);if(w.isEmpty()||A||(A=setTimeout(Y,0)),e.data.error){var l=e.data.error,c=l.args.hash;return"m"===l.args.resourceType?(x--,s.set(c,G),M.fireEvent({type:I,hash:c}),console.error("Error loading material.",l.msg,l.args)):(E--,i.set(c,V),M.fireEvent({type:D,hash:c}),console.error("Error loading mesh.",l.msg,l.args)),a.delete(l.hash),void M.requestsReceived++}let h=0;if(e.data.materials)for(let t=0;t<e.data.materials.length;t++){const i=e.data.hashes[t],n=e.data.materials[t];x--,M.requestsReceived++,s.set(i,n),M.fireEvent({type:L,material:n,hash:i}),h+=n.byteLength,a.delete(i)}else if(e.data.mdatas){const t=e.data.mdatas;for(var u=0;u<t.length;u++){E--,M.requestsReceived++;var d=t[u];if(d.hash&&d.mesh){var f=r.BufferGeometryUtils.meshToGeometry(d);M.addGeometry(d.hash,f),M.cleanup(),M.fireEvent({type:P,geom:f}),a.delete(d.hash),d.fromCache?++M.fromCacheCount:++M.fromRemoteCount,h+=f.byteSize}}}null===(t=M.bandwidthOptimizer())||void 0===t||t.onResourceReceived((null===(n=e.data.materials)||void 0===n?void 0:n.length)||(null===(o=e.data.mdatas)||void 0===o?void 0:o.length),h),M._handleCache()}function Y(){var e=S-(E+x);if(e<=.01*S)A=setTimeout(Y,30);else{w.updateRequestPriorities();for(var t=0,i=null;!w.isEmpty()&&t<e;){var n=w.takeTask();i?(i.urls.push(n.url),i.hashes.push(n.hash),i.lineageUrns.push(n.lineageUrn),i.couldBeInCache.push(W(M,n.hash))):i={operation:"LOAD_CDN_RESOURCE_OTG",type:"g",urls:[n.url],lineageUrns:[n.lineageUrn],hashes:[n.hash],queryParams:n.queryParams,couldBeInCache:[W(M,n.hash)]},t++}i&&(c.doOperation(z(i)),E+=i.urls.length,M.requestsSent+=i.urls.length),A=void 0}}this._numActiveLoaders=0,this.addViewer=function(e){B.push(e),w.addViewer(e)},this.removeViewer=function(e){const t=B.indexOf(e);-1!==t&&(w.removeViewer(e),B.splice(t,1)),0===B.length&&this.dtor()},this.dtor=function(){B=[],c.terminate(),c=null;for(const e of u)e.terminate();u=[],this.cleanup(!0),i=null,s=null,this._clearHashCache(),this.initialized=!1},this._loadHashCache=function(){this.cachedHashesPending||(this.cachedHashesPending=!0,this.cachedHashesDb.open((()=>{this.cachedHashesDb.readAllCachedHashes((e=>{this.cachedHashes=new Set(e),this.cachedHashesPending=!1})),this.cachedHashesDb=void 0})))},this._clearHashCache=function(){this.cachedHashes=null},this._getHashCacheEstimate=function(){this.cachedHashesEstimatePending||(this.cachedHashesDb=new _(U,!1),this.cachedHashesDb.open(null),this.cachedHashesEstimatePending=!0,this.cachedHashesDb.open((()=>{this.cachedHashesDb.estimateCachedHashCount((e=>{this.cachedHashesEstimate=e,this.cachedHashesEstimatePending=void 0===e}))})))},this._handleCache=function(){if(this.cachedHashes||k)return;const e=this.fromCacheCount+this.fromRemoteCount;if(e<200)return;const t=w.waitCount()*this.fromRemoteCount/e;null!=this.cachedHashesEstimate?this.cachedHashesEstimate<50*t&&this._loadHashCache():t>1e3&&this._getHashCacheEstimate()},this.loaderAdded=function(e,t){this._numActiveLoaders++;var i={operation:"ADD_MODEL_OTG",modelUrn:e,lineageUrn:t,useOpfs:O};c.doOperation(z(i)),this.fromCacheCount=0,this.fromRemoteCount=0},this.loaderRemoved=function(){if(this._numActiveLoaders--,0===this._numActiveLoaders){this._clearHashCache();c.doOperation({operation:"FLUSH_CACHE_AND_DISCONNECT_OTG"})}},this.requestGeometry=function(e,t,r,o,s,l){var c=i.get(r);if(c!==V)if(c)(0,n.isNodeJS)()?setImmediate((()=>this.fireEvent({type:P,geom:c}))):this.fireEvent({type:P,geom:c});else{var h=a.get(r);if(h&&h.refcount)return h.importanceNeedsUpdate=!0,void h.refcount++;var u={operation:"LOAD_CDN_RESOURCE_OTG",type:"g",url:e,lineageUrn:l,hash:r,queryParams:s,importance:0,importanceNeedsUpdate:!0,refcount:1};w.addTask(u),a.set(r,u),A||(A=setTimeout(Y,0))}else(0,n.isNodeJS)()?setImmediate((()=>this.fireEvent({type:D,hash:r}))):this.fireEvent({type:D,hash:r})},this.requestMaterial=function(e,t,i,n,r,o){var l=s.get(i);if(l!==G)if(l)setImmediate((()=>this.fireEvent({type:L,material:l,hash:i})));else{var h=a.get(i);if(h&&h.refcount)h.refcount++;else{var u={operation:"LOAD_CDN_RESOURCE_OTG",type:"m",urls:[e],lineageUrns:[o],hashes:[i],queryParams:r,refcount:1,couldBeInCache:[W(this,i)]};a.set(i,u),c.doOperation(z(u)),x++,this.requestsSent++}}else setImmediate((()=>this.fireEvent({type:I,error:l,hash:i,repeated:!0})))},this.cancelRequests=function(e){for(var t of e){var i=a.get(t);i&&i.refcount--}w.filterTasks((e=>{const t=a.get(e),i=t&&t.refcount;return i||a.delete(e),i}))},this.updateGeomImportance=function(e,t){return function(e,t){var i=e.getFragmentList(),n=i.getGeometry(t);if(i.getWorldBounds(t,m),n){var r,o,s,a,l=n.importance||0,c=2*((o=(r=m).max.x-r.min.x)*(s=r.max.y-r.min.y)+s*(a=r.max.z-r.min.z)+a*o);n.importance=Math.max(l,c)}}(e,t)},this.cleanup=function(e){if(!(0===N.size||!e&&this.byteSize<this._maxMemory)){var t=[];for(let e of N.values())t.push(e);t.sort(H);for(var n=e?0:this._maxMemory-this._minCleanup,r=0;r<t.length&&this.byteSize>=n;r++){var o=t[r];i.delete(o.hash),N.delete(o.id),this.byteSize-=o.byteSize,o.dispose()}}},this.waitForGeometry=function(e,t){var n=0,r=w.makeUrgent(e);if(0===r&&e)t(e);else{Y(),this.addEventListener(P,a),this.addEventListener(D,l);for(let t in e){var o=i.get(t);o&&s(t,o)}}function s(i,o){w.removeUrgent(i),!0!=!e[i]&&(e[i]=o,++n<r||(M.removeEventListener(P,a),M.removeEventListener(D,l),t(e)))}function a(e){s(e.geom.hash,e.geom)}function l(e){s(e.hash,void 0)}},this.getGeometry=function(e){return i.get(e)},this.addGeometry=function(e,t){if(i.set(e,t),M.byteSize+=t.byteSize,Object.prototype.hasOwnProperty.call(t,"_modelRefCount"))return;t._modelRefCount=0;const n=Object.getPrototypeOf(t);Object.prototype.hasOwnProperty.call(n,"modelRefCount")||(Object.defineProperty(n,"modelRefCount",{get:j}),n.setModelRefCount=X)},this.setGeomRefCount=function(e,t){if(0===e._modelRefCount&&t>=1){N.get(e.id)&&N.delete(e.id)}else 0===t&&N.set(e.id,e);e._modelRefCount=t},this.addMaterialData=function(e,t){s.set(e,t)},this.clearOpfsCache=function(){c.doOperation({operation:"CLEAR_OPFS_CACHE"})},this.reportLoadingState=function(){console.log("OtgResourceCache:",{sent:this.requestsSent,received:this.requestsReceived});c.doOperation({operation:"REPORT_LOADING_STATE"})}}function j(){return this._modelRefCount}a.EventDispatcher.prototype.apply(W.prototype);let q=!1;function X(e,t){t?t.setGeomRefCount(this,e):(q||(console.warn("geometry_setModelRefCount: geomCache is not defined"),q=!0),this._modelRefCount=1)}},13e3:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PropDbLoader:()=>T,clearPropertyWorkerCache:()=>_,getPropWorker:()=>b,shutdownPropWorker:()=>x});var n,r=i(83081),o=i(84045),s=i(57480),a=i(19556),l=i(8412),c=i(41428),h=i(65435),u=i(7756),d=i(25004),f="GET_PROPERTIES",p="UNLOAD_PROPERTYDB",m=1,g={};function v(e){var t=e.data;if(t&&t.debug)r.logger.debug(t.message);else{var i=t&&t.cbId&&g[t.cbId];i&&(t.progress?i[2]&&i[2](t.progress):(t.error?i[1]&&i[1](t.error):i[0]&&i[0](t.result),delete g[t.cbId]))}}function y(e,t,i){var n=m++;return g[n]=[e,t,i],n}function b(){return n}function x(){n&&(n.terminate(),n=void 0)}function _(){n&&n.doOperation({operation:p,clearCaches:!0})}var E=0,S=1,A=2,w=3,T=function(e,t,i){var n,s;this.eventTarget=i||new d.EventDispatcher,this.model=t,this.svf=t&&t.getData(),this.dbPath="",this.sharedDbPath=!1;const a=this.svf&&this.svf.loadOptions.bubbleNode&&this.svf.loadOptions.bubbleNode.findViewableParent()._getOtgManifest(),l=a&&this.svf&&this.svf.is2d;if(this.svf&&!l&&this.svf.propertydb&&this.svf.propertydb.avs.length){for(var c in this.dbFiles=this.svf.propertydb,this.dbFiles)this.dbFiles[c][0]&&(this.dbFiles[c][0].path=this.dbFiles[c][0].path.replace(/\\/g,"/"));var h=(0,o.pathToURL)(this.svf.basePath);if(e){var u=o.ViewingService.simplifyPath(h+this.svf.propertydb.avs[0].path);if((u=u.slice(0,u.lastIndexOf("/")+1))===e){var f={};for(let t in this.dbFiles){var p=this.dbFiles[t][0],m=p.path;0===(m=o.ViewingService.simplifyPath(h+m)).indexOf(e)&&(m=m.slice(e.length)),f[t]=[{path:m,isShared:p.isShared}]}this.dbFiles=f,this.dbPath=e,this.sharedDbPath=!0}else this.dbPath=h,this.sharedDbPath=!1}else this.dbPath=h,this.sharedDbPath=!1}else{if(this.sharedDbPath=!0,this.svf&&this.svf.loadOptions.bubbleNode){this.dbPath=e;let t=this.svf.loadOptions.bubbleNode.getPropertyDbManifest();this.dbFiles=t.propertydb,this.needsDbIdRemap=t.needsDbIdRemap}else r.logger.warn("Deprecated shared property database initialization without bubbleNode in Model load options."),this.dbPath=e,this.dbFiles={attrs:[],avs:[],ids:[],values:[],offsets:[]};r.logger.log("Using shared db path "+e)}a&&(this.needsDbIdRemap=this.svf.loadOptions.needsDbIdRemap||this.needsDbIdRemap),this.queryParams="";let g=null===(n=this.model)||void 0===n||null===(n=n.getDocumentNode())||void 0===n||null===(n=n.getDocument())||void 0===n?void 0:n.getAcmSessionId(this.dbPath);g=g||(null===(s=this.svf)||void 0===s?void 0:s.acmSessionId),this.svf&&g&&(this.queryParams="acmsession="+g),this.loadProgress=0,this.cbId=void 0,this.idLoadState=E,this.waitingForExternalIds=[]};T.prototype.dtor=function(){this.asyncPropertyOperation({operation:p},(function(){}),(function(){}));var e,t=Boolean(this.cbId),i=this.instanceTree||this.propertyDbError;t&&!i&&(e=this.cbId,delete g[e],this.propertyDbError={propDbWasUnloaded:!0},this.eventTarget.dispatchEvent({type:a.OBJECT_TREE_UNAVAILABLE_EVENT,svf:this.svf,model:this.model,target:this})),this.model=null,this.svf=null},T.prototype.processLoadResult=function(e){if(e.instanceTreeStorage){var t=new h.InstanceTreeAccess(e.instanceTreeStorage,e.rootId,e.instanceBoxes);this.instanceTree=new c.InstanceTree(t,e.objectCount,e.maxTreeDepth),this.svf&&((i=this).svf.instanceTree=i.instanceTree,this.instanceTree.setFragmentList(this.model.getFragmentList()))}var i;e.objectCount&&(this.hasObjectProperties=e.objectCount,this.svf&&(this.svf.hasObjectProperties=e.objectCount)),e.dbidOldToNew&&this.model.setDbIdRemap(e.dbidOldToNew),this.onLoadProgress(100),this.eventTarget.dispatchEvent({type:a.OBJECT_TREE_CREATED_EVENT,svf:this.svf,model:this.model,target:this})},T.prototype.processLoadError=function(e){var t=this;t.propertyDbError=e,t.onLoadProgress(100),t.eventTarget.dispatchEvent({type:a.OBJECT_TREE_UNAVAILABLE_EVENT,svf:t.svf,model:t.model,target:t})},T.prototype.load=function(e){var t=this;e=T.prototype.useCustomProperties?Object.assign({useCustomProperties:!0},e):e||{},n||(n=(0,u.createWorker)("PropWorker",!0)).addEventListener("message",v);this.cbId=y((function(e){t.processLoadResult(e)}),(function(e){t.processLoadError(e)}),(function(e){t.onLoadProgress(e.percent)}));var i=this.svf&&this.svf.loadOptions,r=!(i&&i.disablePrecomputedNodeBoxes),o=!(!i||!i.skipExternalIds);let s;o||(this.idLoadState=S),s=this.svf&&this.svf.instanceTree&&this.svf.instanceBoxes?"CREATE_TREE":"LOAD_PROPERTYDB";var a={operation:s,dbPath:this.dbPath,sharedDbPath:this.sharedDbPath,propertydb:this.dbFiles,fragToDbId:this.svf&&this.svf.fragments.fragId2dbId,fragBoxes:r&&this.svf&&this.svf.fragments.boxes,needsDbIdRemap:this.needsDbIdRemap,is2d:this.svf&&this.svf.is2d,cbId:this.cbId,queryParams:this.queryParams,skipExternalIds:o,gltfTree:this.svf.instanceTree,dbToFragId:this.svf&&this.svf.fragments.dbToFragId,...e};n.doOperation((0,l.initLoadContext)(a))},T.prototype.asyncPropertyOperation=function(e,t,i,r){const o=this;if(e.dbPath=this.dbPath,o.instanceTree||o.hasObjectProperties)e.cbId=y(t,i,r),n.doOperation(e);else if(o.propertyDbError)i&&i(o.propertyDbError);else{const n=function(l){o.model===l.model&&(o.eventTarget.removeEventListener(a.OBJECT_TREE_CREATED_EVENT,n),o.eventTarget.removeEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,n),o.instanceTree||o.hasObjectProperties||o.propertyDbError?o.asyncPropertyOperation(e,t,i,r):i&&i({code:s.ErrorCodes.UNKNOWN_FAILURE,msg:"Failed to load properties"}))};o.eventTarget.addEventListener(a.OBJECT_TREE_CREATED_EVENT,n),o.eventTarget.addEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,n)}},T.prototype.getProperties=function(e,t,i){this.idLoadState===E&&r.logger.warn("Calling getProperties() will cause loading of the potentially large externalIDs file. Use getProperties2() to avoid this warning."),this.getProperties2(e,t,i,{needsExternalId:!0})},T.prototype.getProperties2=function(e,t,i,n){const r=()=>{this.asyncPropertyOperation({operation:f,dbId:e,gltfTree:this.svf&&this.svf.instanceTreeBackup},t,i)};n&&n.needsExternalId?this.loadExternalIds().then(r).catch(i):r()},T.prototype.getBulkProperties=function(e,t,i,n,o){const s={ignoreHidden:o,propFilter:t,needsExternalId:!t||t.includes("externalId")};s.needsExternalId&&this.idLoadState===E&&r.logger.warn("Calling getProperties() will cause loading of the potentially large externalIDs file. Use getProperties2() to avoid this warning."),this.getBulkProperties2(e,s,i,n)},T.prototype.getBulkProperties2=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;const r=()=>{this.asyncPropertyOperation({operation:f,dbIds:e,propFilter:t.propFilter,categoryFilter:t.categoryFilter,ignoreHidden:t.ignoreHidden},i,n)};t&&t.needsExternalId?this.loadExternalIds().then(r).catch(n):r()},T.prototype.getPropertySet=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;const r=()=>{this.asyncPropertyOperation({operation:"GET_PROPERTY_SET",dbIds:e,propFilter:t.propFilter,ignoreHidden:t.ignoreHidden,fileType:t.fileType},i,n)};t&&t.needsExternalId?this.loadExternalIds().then(r).catch(n):r()},T.prototype.searchProperties=function(e,t,i,n,r){this.asyncPropertyOperation({operation:"SEARCH_PROPERTIES",searchText:e,attributeNames:t,searchOptions:r},i,n)},T.prototype.findProperty=function(e){var t=this;return new Promise((function(i,n){t.asyncPropertyOperation({operation:"FIND_PROPERTY",propertyName:e},i,n)}))},T.prototype.diffProperties=function(e,t,i,n,r){this.asyncPropertyOperation({operation:"DIFF_PROPERTIES",dbPath2:e,diffOptions:n},t,i,r)},T.prototype.findLayers=function(){var e=this;return new Promise((function(t,i){e.asyncPropertyOperation({operation:"FIND_LAYERS"},t,i)}))},T.prototype.getExternalIdMapping=function(e,t,i){return this.loadExternalIds().then((()=>{this.asyncPropertyOperation({operation:"BUILD_EXTERNAL_ID_MAPPING",extIdFilter:i},e,t)}))},T.prototype.getLayerToNodeIdMapping=function(e,t){this.asyncPropertyOperation({operation:"BUILD_LAYER_TO_NODE_ID_MAPPING"},e,t)},T.prototype.executeUserFunction=function(e,t){if("function"==typeof e)e=e.toString();else if("string"!=typeof e)return Promise.reject("Expected Function or string.");let i;try{i=new Blob([e],{type:"application/javascript"})}catch(t){let n=new BlobBuilder;n.append(e),i=n.getBlob()}let n=URL.createObjectURL(i);return new Promise(((e,i)=>{this.asyncPropertyOperation({operation:"USER_FUNCTION",userFunction:n,userData:t},e,i)}))},T.prototype.isObjectTreeLoaded=function(){return!!this.instanceTree},T.prototype.getObjectTree=function(e,t){var i=this;if(i.instanceTree)e(i.instanceTree);else if(i.propertyDbError)t&&t(i.propertyDbError);else if("hasObjectProperties"in i)i.svf&&i.svf.is2d&&t?t("F2D files do not have an InstanceTree."):e(null);else{var n=function(){i.eventTarget.removeEventListener(a.OBJECT_TREE_CREATED_EVENT,n),i.eventTarget.removeEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,n),i.getObjectTree(e,t)};i.eventTarget.addEventListener(a.OBJECT_TREE_CREATED_EVENT,n),i.eventTarget.addEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,n)}},T.prototype.onLoadProgress=function(e){this.eventTarget.dispatchEvent({type:a.OBJECT_TREE_LOAD_PROGRESS_EVENT,percent:e,svf:this.svf,model:this.model,target:this}),this.loadProgress=e},T.prototype.getLoadProgress=function(){return this.loadProgress},T.prototype.isLoadDone=function(){return 100==this.loadProgress},T.prototype.loadExternalIds=function(){switch(this.idLoadState){case S:return Promise.resolve();case w:return Promise.reject();case E:{this.idLoadState=A;const e=()=>{this.idLoadState=S,this.waitingForExternalIds.forEach((e=>e.resolve()))},t=()=>{this.idLoadState=w,this.waitingForExternalIds.forEach((e=>e.reject()))},i={operation:"LOAD_EXTERNAL_IDS",idsFile:this.dbFiles.ids[0],queryParams:this.queryParams};(0,l.initLoadContext)(i),this.asyncPropertyOperation(i,e,t);break}}return new Promise(((e,t)=>{this.waitingForExternalIds.push({resolve:e,reject:t})}))},T.prototype.refreshCustomProperties=function(e){return new Promise(((t,i)=>{e.operation="REFRESH_CUSTOM_PROPERTIES",e.cbId=y(t,i),e.dbPath=this.dbPath,n.doOperation(e)}))},T.prototype.applyCustomProperties=function(e){return new Promise(((t,i)=>{e.operation="APPLY_CUSTOM_PROPERTIES",e.cbId=y(t,i),e.dbPath=this.dbPath,n.doOperation(e)}))},T.prototype.refreshCustomPropertiesValues=function(e){return new Promise(((t,i)=>{e.operation="REFRESH_CUSTOM_PROPERTIES_VALUES",e.dbPath=this.dbPath;e.cbId=y((r=>{if(this.instanceTree||"hasObjectProperties"in this)t(r);else{const r=this.eventTarget,o=()=>{r.removeEventListener(a.OBJECT_TREE_CREATED_EVENT,o),r.removeEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,o),e.cbId=y(t,i),n.doOperation(e)};r.addEventListener(a.OBJECT_TREE_CREATED_EVENT,o),r.addEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,o)}}),i),n.doOperation(e)}))},T.prototype.setCustomPropertiesValues=function(e){return new Promise(((t,i)=>{e.operation="SET_CUSTOM_PROPERTIES_VALUES",e.dbPath=this.dbPath;e.cbId=y((r=>{if(this.instanceTree||"hasObjectProperties"in this)t(r);else{const r=this.eventTarget,o=()=>{r.removeEventListener(a.OBJECT_TREE_CREATED_EVENT,o),r.removeEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,o),e.cbId=y(t,i),n.doOperation(e)};r.addEventListener(a.OBJECT_TREE_CREATED_EVENT,o),r.addEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,o)}}),i),n.doOperation(e)}))},T.prototype.useCustomProperties=!1},5968:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SvfLoader:()=>w});var n=i(55280),r=i(83081),o=i(37365),s=i(57480),a=i(75468),l=i(68747),c=i(22040),h=i(68630),u=i(84045),d=i(77201),f=i(13e3),p=i(90255),m=i(7756),g=i(19556),v=i(63764),y=i(72091),b=i(54393),x=i(8412),_=i(28441);const E=Autodesk.Viewing,S=E.Private;var A=(0,n.isNodeJS)()?10:(0,n.isMobileDevice)()?2:6,w=function(e){this.viewer3DImpl=e,this.next_pack=0,this.loading=!1,this.loadedPacksCount=0,this.tmpMatrix=new y.Matrix4,this.tmpBox=new y.Box3,this.fetchingTopology=!1,this.loadTime=0,this.notifiesFirstPixel=!0};w.prototype.dtor=function(){if(this.svfWorker&&(this.svfWorker.terminate(),this.svfWorker=null,r.logger.debug("SVF loader dtor: on svf worker.")),this.pack_workers){for(var e=0;e<this.pack_workers.length;e++)this.pack_workers[e].terminate();this.pack_workers=null,r.logger.debug("SVF loader dtor: on geom worker.")}this.svf&&this.svf.propDbLoader&&(this.svf.propDbLoader.dtor(),this.svf.propDbLoader=null),this.tmpMatrix=null,this.tmpBox=null,this.svf=null,this.model=null,this.next_pack=0,this.loading=!1,this.loadedPacksCount=0,this.loadTime=0,this.viewer3DImpl=null},w.prototype.createWorker=m.createWorker,w.prototype.startWorkers=function(){for(var e=this.svf,t=Math.min(e.geompacks.length,E.NUM_WORKER_THREADS||A),i=0;i<t;i++){var r=e.geompacks[this.next_pack++];r.loading=!0,(0,n.isNodeJS)()?this.loadGeometryPack(r.id,r.uri):(e=>{setTimeout((()=>{this.loadGeometryPack(e.id,e.uri)}),200*i)})(r)}},w.prototype.createModel=function(e){var t=this.model=new v.Model(e);return t.loader=this,t.initialize(),t},w.prototype.isValid=function(){return this.viewer3DImpl},w.prototype.loadFile=function(e,t,i,n){if(!this.viewer3DImpl)return r.logger.log("SVF loader was already destructed. So no longer usable."),!1;if(this.loading)return r.logger.log("Loading of SVF already in progress. Ignoring new request."),!1;this.loading=!0;var o=e.indexOf("urn:");if(-1!=o){var s=(e=decodeURIComponent(e)).substr(o,e.substr(o).indexOf("/"));r.logger.log("Extracted URN: "+s);var a=s.lastIndexOf(":");this.svfUrn=s.substr(a+1)}else this.svfUrn=e;this.sharedDbPath=t.sharedPropertyDbPath,this.currentLoadPath=e;var l=this.currentLoadPath.lastIndexOf("/");return-1!=l&&(this.basePath=this.currentLoadPath.substr(0,l+1)),this.acmSessionId=t.acmSessionId,this.queryParams="",this.acmSessionId&&(this.queryParams="acmsession="+this.acmSessionId),this.options=t,this.loadSvfCB(e,t,i,n),!0},w.prototype.loadSvfCB=function(e,t,i,o){this.t0=(new Date).getTime(),this.firstPixelTimestamp=null,this.failedToLoadSomeGeometryPacks=null,this.failedToLoadPacksCount=0;var l=!0,c=this,h={url:(0,u.pathToURL)(e),basePath:this.currentLoadPath,objectIds:t.ids,globalOffset:t.globalOffset,fragmentTransformsDouble:t.fragmentTransformsDouble,placementTransform:t.placementTransform,applyRefPoint:t.applyRefPoint,queryParams:this.queryParams,bvhOptions:t.bvhOptions||{isWeakDevice:(0,n.isMobileDevice)()},applyScaling:t.applyScaling,applyPlacementInModelUnits:t.applyPlacementInModelUnits,loadInstanceTree:t.loadInstanceTree};this.viewer3DImpl._signalNoMeshes();var d=this.svfWorker=this.createWorker();return d.addEventListener("message",(async function(e){var t=function(){d.terminate(),c.svfWorker=null,d=null};if(l&&o&&(l=!1,o()),e.data&&e.data.manifest)c.interceptManifest(e.data.manifest),h.operation="LOAD_SVF_CONTD",h.manifest=e.data.manifest,d.doOperation(h);else if(e.data&&e.data.svf){var n=c.svf=e.data.svf;c.failedToLoadSomeGeometryPacks&&(i&&i(c.failedToLoadSomeGeometryPacks),c.failedToLoadSomeGeometryPacks=null),await c.onModelRootLoadDone(n),i&&i(null,c.model),c.svf.viewpointTreeRoot&&c.options.addViews&&c.options.addViews(c.svf.viewpointTreeRoot,c.model),c.viewer3DImpl.api.dispatchEvent({type:g.MODEL_ROOT_LOADED_EVENT,svf:n,model:c.model}),n.loadDone=!1;var u=!1;n.metadata&&n.metadata.gltf&&(u=!0),u||(0==n.geompacks.length?c.onGeomLoadDone():c.startWorkers()),1==e.data.progress&&(c.loading=!1,t()),n.fragments.polygonCounts||(n.fragments.polygonCounts=new Int32Array(n.fragments.length)),e.data.bvh&&(n.bvh=e.data.bvh,c.model.setBVH(new a.NodeArray(n.bvh.nodes,n.bvh.useLeanNodes),n.bvh.primitives,c.options.bvhOptions),c.viewer3DImpl.api.dispatchEvent({type:g.LOADER_REPAINT_REQUEST_EVENT,loader:c,model:c.model}))}else e.data&&e.data.bvh?(c.svf&&!c.svf.bvh&&(c.svf.bvh=e.data.bvh,c.model.setBVH(new a.NodeArray(c.svf.bvh.nodes,c.svf.bvh.useLeanNodes),c.svf.bvh.primitives,c.options.bvhOptions),c.viewer3DImpl.api.dispatchEvent({type:g.LOADER_REPAINT_REQUEST_EVENT,loader:c,model:c.model})),c.loading=!1,t()):e.data&&e.data.mesh?(c.processReceivedMesh(e.data),1===e.data.progress&&(c.onGeomLoadDone(),c.loading=!1,t())):e.data&&e.data.progress?1==e.data.progress&&(c.loading=!1,t()):e.data&&e.data.error?(c.loading=!1,t(),r.logger.error("Error while processing SVF: "+JSON.stringify(e.data.error.args)),i&&i(e.data.error,null)):e.data&&e.data.debug?r.logger.debug(e.data.message):(r.logger.error("SVF download failed.",(0,s.errorCodeString)(s.ErrorCodes.NETWORK_FAILURE)),c.loading=!1,t())})),h.operation="LOAD_SVF",h.interceptManifest=!!this.interceptManifest,d.doOperation((0,x.initLoadContext)(h)),!0},w.prototype.loadGeometryPack=function(e,t){var i,n,o,s,a=this;if(this.svf&&this.isValid()){var l=this.pack_workers;if(l||(l=this.pack_workers=[]),l.length<(E.NUM_WORKER_THREADS||A)){var c=!0;for(o=0;o<l.length;o++)if(0===l[o].queued){c=!1;break}if(c){var h=this.createWorker();h.addEventListener("message",(function(e){if(e.data&&e.data.meshes){for(var t=e.data.meshes,i=0;i<t.length;i++){var n=t[i];if(n){var o={packId:e.data.packId,meshIndex:i,mesh:n};a.processReceivedMesh(o)}}if(e.data.progress>=1){a.pack_workers[e.data.workerId].queued-=1,a.loadedPacksCount++,a.viewer3DImpl.signalProgress(100*a.loadedPacksCount/a.svf.geompacks.length,_.ProgressState.LOADING,a.model);var l=!0;for(s=0;s<a.pack_workers.length;s++)if(0!=a.pack_workers[s].queued){l=!1;break}if(l){for(s=0;s<a.pack_workers.length;s++)a.pack_workers[s].terminate();a.pack_workers=null}a.loadedPacksCount+a.failedToLoadPacksCount==a.svf.geompacks.length&&a.onGeomLoadDone()}}else if(e.data&&e.data.progress){if(a.pack_workers[e.data.workerId].queued-=1,a.next_pack<a.svf.geompacks.length){var c=null;if(!c||c.loading)for(;a.next_pack<a.svf.geompacks.length&&(c=a.svf.geompacks[a.next_pack++]).loading;);c&&!c.loading?(c.loading=!0,a.loadGeometryPack(c.id,c.uri)):a.svf.fragments.packIds=null}}else e.data&&e.data.debug?r.logger.debug(e.data.message):e.data&&e.data.error?(++a.failedToLoadPacksCount,a.failedToLoadSomeGeometryPacks={code:e.data.error.code,msg:e.data.error.msg}):a.pack_workers[e.data.workerId].queued-=2})),h.queued=0,l.push(h)}}var d=0,f=l[0].queued;for(o=1;o<l.length;o++)l[o].queued<f&&(d=o,f=l[o].queued);(i=l[d]).queued+=2,n=d;var p={operation:"LOAD_GEOMETRY",url:(0,u.pathToURL)(this.svf.basePath+t),packId:parseInt(e),workerId:n,createWireframe:this.options.createWireframe||this.model.getMetadata("renderEnvironmentDisplayEdges","value",!1),packNormals:this.options.packNormals,queryParams:this.queryParams};i.doOperation((0,x.initLoadContext)(p))}},w.prototype.processReceivedMesh=function(e){var t=e.packId+":"+e.meshIndex,i=this.svf,n=i.fragments,o=this.model,s=n.mesh2frag[t];if(void 0===s)return void r.logger.warn("Mesh "+t+" was not referenced by any fragments.");Array.isArray(s)||(s=[s]);const a=o.getFragmentList().getGeometryId(s[0]),h=(0,d.meshToGeometry)(e);void 0!==e.packId&&(h.packId=e.packId),void 0!==e.meshIndex&&(h.meshIndex=e.meshIndex);const u=o.getGeometryList().addGeometry(h,s.length,a),f=(0,c.getPolygonCount)(h);for(var m=0;m<s.length;m++){var v=0|s[m];if(i.loadOptions.skipHiddenFragments)if(!(n.visibilityFlags[v]&l.MeshFlags.MESH_VISIBLE))continue;o.getFragmentList().getOriginalWorldMatrix(v,this.tmpMatrix);var y=n.materials[v].toString(),b=this.viewer3DImpl.matman().findMaterial(o,y);b&&!b.texturesLoaded&&p.TextureLoader.loadMaterialTextures(o,b,this.viewer3DImpl),n.polygonCounts&&(n.polygonCounts[v]=f);var x=this.viewer3DImpl.setupMesh(this.model,h,y,this.tmpMatrix);o.activateFragment(v,x,!!i.placementTransform)}return this.options.onMeshReceived&&this.options.onMeshReceived(this.model,u,s),n.mesh2frag[t]=null,n.numLoaded+=s.length,this.viewer3DImpl._signalMeshAvailable(),o.getGeometryList().geomPolyCount>i.nextRepaintPolys&&(this.firstPixelTimestamp=this.firstPixelTimestamp||Date.now(),i.numRepaints++,i.nextRepaintPolys+=1e4*Math.pow(1.5,i.numRepaints),this.viewer3DImpl.api.dispatchEvent({type:g.LOADER_REPAINT_REQUEST_EVENT,loader:this,model:this.model})),u},w.prototype.setupCamera=function(e){return e.position=(new y.Vector3).copy(e.position),e.target=(new y.Vector3).copy(e.target),e.up=(new y.Vector3).copy(e.up),isFinite(e.position.x+e.position.y+e.position.z+e.target.x+e.target.y+e.target.z+e.up.x+e.up.y+e.up.z)||(e.target=this.svf.bbox.getCenter(new y.Vector3),e.position.copy(e.target),e.position.z+=this.svf.bbox.max.z-this.svf.bbox.min.z,e.up.set(0,1,0)),isFinite(e.aspect)||(e.aspect=1),isFinite(e.fov)||(e.fov=90),isFinite(e.orthoScale)||(e.orthoScale=1),e},w.prototype.onModelRootLoadDone=async function(e){e.fragments.numLoaded=0,e.nextRepaintPolys=0,e.numRepaints=0,e.urn=this.svfUrn,e.acmSessionId=this.acmSessionId,e.basePath=this.basePath,e.loadOptions=this.options,e.verylargebbox&&this.viewer3DImpl.setNearRadius(this.options.nearRadius||1);var t=Date.now();r.logger.log("SVF load: "+(t-this.t0));var i=this.createModel(e);this.options.skipPropertyDb||this.loadPropertyDb();var s=await this.convertMaterials(i);if(this.viewer3DImpl.matman().hasTwoSidedMaterials()&&this.viewer3DImpl.renderer().toggleTwoSided(!0),this.t1=t,e.bbox=(new y.Box3).copy(e.bbox),e.refPointTransform&&(e.refPointTransform=new o.LmvMatrix4(!0).copy(e.refPointTransform)),e.placementTransform&&(e.placementTransform=new o.LmvMatrix4(!0).copy(e.placementTransform)),e.placementWithOffset&&(e.placementWithOffset=new o.LmvMatrix4(!0).copy(e.placementWithOffset)),e.cameras)for(var a=0;a<e.cameras.length;a++)this.setupCamera(e.cameras[a]);r.logger.log("scene bounds: "+JSON.stringify(e.bbox));var l={category:"metadata_load_stats",urn:e.urn,has_topology:!!e.topologyPath,has_animations:!!e.animations,cameras:e.cameras?e.cameras.length:0,lights:e.lights?e.lights.length:0,materials:s,is_mobile:(0,n.isMobileDevice)()};r.logger.track(l),this.viewer3DImpl.signalProgress(5,_.ProgressState.ROOT_LOADED,this.model)},w.prototype.convertMaterials=async function(e){var t,i=this.viewer3DImpl.matman(),n=e.getData(),r=0;if(!n.materials)return r;if(n.gltfMaterials){var o=n.materials.materials;for(t in o){var s=o[t],a=h.MaterialConverter.convertMaterialGltf(s,n),l=i._getMaterialHash(e,t);i.addMaterial(l,a,!1),r++}return r}var c=n.materials.materials,u=n.proteinMaterials?n.proteinMaterials.materials:null;for(t in c){var d=u&&u[t]&&h.MaterialConverter.isPrismMaterial(u[t])?u[t]:c[t];await i.convertOneMaterial(e,d,i._getMaterialHash(e,t)),r++}return r},w.prototype.makeBVH=function(e){var t=performance.now(),i=e.materials?e.materials.materials:null;e.bvh=new a.BVHBuilder(e.fragments,i),e.bvh.build(this.options.bvhOptions||{isWeakDevice:(0,n.isMobileDevice)()});var o=performance.now();r.logger.log("BVH build time: "+(o-t))},w.prototype.onGeomLoadDone=async function(){this.svf.loadDone=!0,p.TextureLoader.loadModelTextures(this.model,this.viewer3DImpl),this.svf.fragments.entityIndexes=null,this.svf.fragments.mesh2frag=null,this.svf.fragments.visibilityFlags=null;var e=Date.now(),t="Fragments load time: "+(e-this.t1);this.loadTime=e-this.t0;var i=this.firstPixelTimestamp-this.t0;t+=" (first pixel time: "+i+")",this.svf.bvh&&!this.svf.placementTransform||(this.makeBVH(this.svf),this.model.setBVH(this.svf.bvh.nodes,this.svf.bvh.primitives,this.options.bvhOptions)),r.logger.log(t),this.options.useConsolidation&&await this.viewer3DImpl.consolidateModel(this.model,this.options.consolidationMemoryLimit);var n={category:"model_load_stats",is_f2d:!1,has_prism:this.viewer3DImpl.matman().hasPrism,load_time:this.loadTime,geometry_size:this.model.getGeometryList().geomMemory,meshes_count:this.model.getGeometryList().getCount(),fragments_count:this.model.getFragmentList().getCount(),urn:this.svfUrn};i>0&&(n.first_pixel_time=i),r.logger.track(n,!0);const o=this.model.getGeometryList(),s={load_time:this.loadTime,polygons:o.geomPolyCount,fragments:this.model.getFragmentList().getCount(),mem_usage:o.gpuMeshMemory,viewable_type:"3d",url:this.currentLoadPath,urn:this.svfUrn};S.analytics.track("viewer.model.loaded",s),this.currentLoadPath=null,this.viewer3DImpl.onLoadComplete(this.model)},w.prototype.loadPropertyDb=function(){this.svf.propDbLoader=new f.PropDbLoader(this.sharedDbPath,this.model,this.viewer3DImpl.api),this.svf.propDbLoader.load()},w.prototype.fetchTopologyFile=function(e,t){if(!this.fetchingTopology){this.fetchingTopology=!0;var i=this.createWorker();i.addEventListener("message",(function(e){if(e.data["status-topology"])return n=(new Date).getTime(),s=Math.round((n-l)/1e3),void r.logger.log("Topology file downloaded. ("+s+" seconds). Processing...");var a=e.data["fetch-topology"];a&&(o=(new Date).getTime(),s=Math.round((o-n)/1e3),a.topology?r.logger.log("Topology file processed successfully! ("+s+" seconds)."):r.logger.log("Topology file processed, but an error ocurred. ("+s+" seconds)."),t(a),c.fetchingTopology=!1,i.terminate(),i=null)}));var n,o,s,a={path:e,queryParams:this.queryParams},l=(new Date).getTime();r.logger.log("Fetching topology file..."),a.operation="FETCH_TOPOLOGY",i.doOperation((0,x.initLoadContext)(a));var c=this}},w.prototype.is3d=function(){return!0},b.FileLoaderManager.registerFileLoader("svf",["svf"],w)},90255:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TextureLoader:()=>M});var n=i(84045),r=i(55280),o=i(57480),s=i(68630),a=i(12360),l=i(83081),c=i(72091),h=i(8412),u=i(9341),d=function(e){this.manager=void 0!==e?e:c.DefaultLoadingManager,this._parser=d.parse};d.prototype=Object.create(c.CompressedTextureLoader.prototype),d.prototype.constructor=d,d.parse=function(e,t){var i=new Uint32Array(e,0,13),n={buffer:e,header:i,loadMipmaps:t};if(55727696===i[0])return d._parseV3(n);if(559044176===i[11])return d._parseV2(n);throw new Error("[THREE.PVRLoader] Unknown PVR format")},d._parseV3=function(e){var t,i,n=e.header,r=n[12],o=n[2],s=n[6],a=n[7],l=(n[9],n[10]),h=n[11];switch(o){case 0:t=2,i=c.RGB_PVRTC_2BPPV1_Format;break;case 1:t=2,i=c.RGBA_PVRTC_2BPPV1_Format;break;case 2:t=4,i=c.RGB_PVRTC_4BPPV1_Format;break;case 3:t=4,i=c.RGBA_PVRTC_4BPPV1_Format;break;default:throw new Error("pvrtc - unsupported PVR format "+o)}return e.dataPtr=52+r,e.bpp=t,e.format=i,e.width=a,e.height=s,e.numSurfaces=l,e.numMipmaps=h,e.isCubemap=6===l,d._extract(e)},d._parseV2=function(e){var t,i=e.header,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=(i[5],i[6]),h=(i[7],i[8],i[9],i[10]),u=(i[11],i[12]),f=255&a,p=h>0;if(25===f)t=p?c.RGBA_PVRTC_4BPPV1_Format:c.RGB_PVRTC_4BPPV1_Format,l=4;else{if(24!==f)throw new Error("pvrtc - unknown format "+f);t=p?c.RGBA_PVRTC_2BPPV1_Format:c.RGB_PVRTC_2BPPV1_Format,l=2}return e.dataPtr=n,e.bpp=l,e.format=t,e.width=o,e.height=r,e.numSurfaces=u,e.numMipmaps=s+1,e.isCubemap=6===u,d._extract(e)},d._extract=function(e){var t,i={mipmaps:[],width:e.width,height:e.height,format:e.format,mipmapCount:e.numMipmaps,isCubemap:e.isCubemap},n=e.buffer,r=e.dataPtr,o=e.bpp,s=e.numSurfaces,a=0,l=0,c=0,h=0,u=0;2===o?(l=8,c=4):(l=4,c=4),t=l*c*o/8,i.mipmaps.length=e.numMipmaps*s;for(var d=0;d<e.numMipmaps;){var f=e.width>>d,p=e.height>>d;(h=f/l)<2&&(h=2),(u=p/c)<2&&(u=2),a=h*u*t;for(var m=0;m<s;m++){var g={data:new Uint8Array(n,r,a),width:f,height:p};i.mipmaps[m*e.numMipmaps+d]=g,r+=a}d++}return i};const f=i(51436);let p=(0,r.getGlobal)(),m=p.document,g=new f;g.max=(0,r.isMobileDevice)()?4:6;let v=0,y=(0,r.isMobileDevice)()?32:1/0;y*=1048576;let b=0,x=1/0;const _=(e,t,i,n)=>{c.ImageUtils.loadTexture(e,t,i,n)};function E(e,t,i,s,a,f,y){var b=h.endpoint.getUseCredentials(),E=h.endpoint.getUseCookie();b&&E?c.ImageUtils.crossOrigin="use-credentials":h.endpoint.getUseCredentials()?c.ImageUtils.crossOrigin="anonymous":c.ImageUtils.crossOrigin="";var S="";b&&a&&(S="acmsession="+a),y&&y.queryParams&&(S=S?S+"&":"",S+=y.queryParams);const A=h.endpoint.initLoadContext({queryParams:S});e.startsWith("blob:")&&(A.queryParams=void 0),v++,g.go((function(a){var h=function(e,t){v--,t&&s?s(t):i(e),a()},g=f?h:function(e){function t(t){e&&(e.image=t),v--,i(e),a()}e&&e.image?function(e,t){let i,n,r=e.width,s=e.height;if(r&r-1||s&s-1){for(i=1;1.5*i<r;)i*=2;for(n=1;1.5*n<s;)n*=2}else{if(r*s<=x)return void t(e);i=r,n=s}for(;i*n>x;)i=Math.max(i/2,1),n=Math.max(n/2,1);let a=m.createElement("canvas"),c=a.getContext("2d");a.width=i,a.height=n,c.drawImage(e,0,0,i,n);const h=new Image;h.src=a.toDataURL(),h.onload=function(){t(h)},h.onerror=function(e){l.logger.error(e,(0,o.errorCodeString)(o.ErrorCodes.UNKNOWN_FAILURE)),t(null)}}(e.image,t):t()},S=function(e){v--,l.logger.error("Texture load error",e),i(null),a()};if((0,r.isNodeJS)())return void function(e,t,i,r,s){var a=new c.DataTexture(void 0,i);function h(e){s&&s.extractImage&&(e=s.extractImage(e)),a.image={data:e,width:void 0,height:void 0},a.needsUpdate=!0,r&&r(a)}function u(e,t){var i="Error: "+e+" ("+t+")";l.logger.error(i,(0,o.errorCodeString)(o.ErrorCodes.NETWORK_SERVER_ERROR)),r&&r(null,{msg:t,args:e})}n.ViewingService.getItem(t,e,h,u)}(e,A,t,h,y);const w=A.queryParams?`?${A.queryParams}`:"";let T=`${e}${w}`;if(e.toLocaleLowerCase().endsWith(".dds"))(0,r.isIOSDevice)()?(T=`${e.slice(0,e.length-4)}.pvr${w}`,(new d).load(T,h,S)):(new u.DDSLoader).load(T,h,S);else if(b&&!E||y&&(y.rawData||y.extractImage))!function(e,t,i,r,s){var a=new c.Texture(void 0,i);function h(e){s&&s.extractImage&&(e=s.extractImage(e));var t,i,n=new Image;a.image=n,n.onload=function(){a.needsUpdate=!0,r&&r(a),p.URL.revokeObjectURL(n.src),n.onload=null,n.onerror=null},n.onerror=function(e){l.logger.error(e,(0,o.errorCodeString)(o.ErrorCodes.UNKNOWN_FAILURE)),r&&r(null),n.onload=null,n.onerror=null},n.src=(t=new Uint8Array(e),i=new Blob([t],{type:"image/jpeg"}),(p.URL||p.webkitURL).createObjectURL(i))}function u(e,t){var i="Error: "+e+" ("+t+")";l.logger.error(i,(0,o.errorCodeString)(o.ErrorCodes.NETWORK_SERVER_ERROR)),r&&r(null,{msg:t,args:e})}s&&s.rawData?h(s.rawData):n.ViewingService.getItem(t,e,h,u,s)}(e,A,t,g,y);else if(e.startsWith("data:"))_(e,t,g,S);else{/(\w+):\/\//gi.exec(e)&&!/^(https?|file|blob:\w+):\/\//gi.test(e)?Autodesk.Viewing.Private.ViewingService.rawGet("","",e,(function(i){let n=/\.(\w+)$/gi.exec(e);n=n?n[1]:"png";var r,o,s=`data:image/${n};base64, `+(r=i,o=Array.prototype.map.call(r,(function(e){return String.fromCharCode(e)})).join(""),btoa(o));_(s,t,g,S)}),console.error):_(T,t,g,S)}}))}function S(e,t,i){var r=t.getData();let o;return e.startsWith("embed:")?o=r.loadedBuffers[e.charAt(e.length-1)]:(e=e.replace(/\\/g,"/"),o=t.isOTG()?function(e){var t=h.endpoint.initLoadContext({});return r.makeSharedResourcePath(t.otg_cdn,"textures",e)}(e):function(e){for(var t=null,i=0;i<r.manifest.assets.length;++i){var o=r.manifest.assets[i];if(o.id.toLowerCase()==e.toLowerCase()){let e=o.URI;-1===e.indexOf("://")&&(e=r.basePath+e),t=(0,n.pathToURL)(e);break}}return t||(t=(0,n.pathToURL)(r.basePath+e)),t}(e)),E(o,c.UVMapping,i,null,r.acmSessionId)}function A(e,t,i){if(t.textureMaps&&!t.texturesLoaded){t.texturesLoaded=!0;var n=e.getData(),r=t.textureMaps;for(var o in r){var a=r[o];if(!i.matman().loadTextureFromCache(e,t,a,o))S(a.uri,e,function(r){return function(o){if(o){var a=n.materials.scene.SceneUnit,l=i.renderer()?i.renderer().getMaxAnisotropy():0;(r.converter||s.MaterialConverter.convertTexture)(r,o,a,l)}var c=i.matman();c&&(c.setTextureInCache(e,t,r,o),n.loadOptions.onTextureReceived&&n.loadOptions.onTextureReceived(c,r,o,!w()),!w()&&i&&n.loadDone&&!n.texLoadDone&&(n.texLoadDone=!0,i.onTextureLoadComplete(e)))}}(a))}}}function w(){return v}function T(e){e>=0&&(b=e,x=Math.max(16384,y/(4*b)))}const M={loadTextureWithSecurity:E,loadMaterialTextures:A,loadModelTextures:function(e,t){var i=t.matman(),n=i._getModelHash(e),r=e.isOTG(),o=0;if(r)o=e.getData().metadata.stats.num_textures||0;else for(let e in i._materials){if(-1===e.indexOf(n))continue;let t=i._materials[e];t.textureMaps&&(o+=Object.keys(t.textureMaps).length)}T(o);for(let o in i._materials){if(!r&&-1===o.indexOf(n))continue;A(e,i._materials[o],t)}var s=e.getData();!w()&&t&&s.loadDone&&!s.texLoadDone&&(s.texLoadDone=!0,t.onTextureLoadComplete(e))},loadCubeMap:function(e,t,i){var n,r=function(n){n?(n.mapping=c.CubeReflectionMapping,n.LogLuv=-1!==e.indexOf("logluv"),n.RGBM=-1!==e.indexOf("rgbm"),(0,a.DecodeEnvMap)(n,t,!1/*!isMobileDevice()*/,i)):i&&i(n)};return c.ImageUtils.crossOrigin="",Array.isArray(e)?(n=c.ImageUtils.loadTextureCube(e,c.CubeReflectionMapping,r)).format=c.RGBFormat:"string"==typeof e?-1!==e.toLowerCase().indexOf(".dds")?(n=(new u.DDSLoader).load(e,r)).mipmaps=n.mipmaps||[]:(n=_(e,c.SphericalReflectionMapping,i)).format=c.RGBFormat:e?i&&i(e):i&&i(null),n},requestsInProgress:w,calculateTextureSize:function(e){var t=4;switch(e.format){case c.AlphaFormat:t=1;break;case c.RGBFormat:t=3;break;case c.LuminanceFormat:t=1;break;case c.LuminanceAlphaFormat:t=2}switch(e.type){case c.ShortType:case c.UnsignedShortType:case c.HalfFloatType:t*=2;break;case c.IntType:case c.UnsignedIntType:case c.FloatType:t*=4;break;case c.UnsignedShort4444Type:case c.UnsignedShort5551Type:case c.UnsignedShort565Type:t=2}var i=t*e.image.width;return i+=e.unpackAlignment-1,i-=i%e.unpackAlignment,e.image.height*i},imageToCanvas:function(e,t,i){let n=e.width,r=e.height,o=m.createElement("canvas"),s=o.getContext("2d");return s.globalCompositeOperation="copy",o.width=n,o.height=r,t&&(s.fillStyle=i||"#FFFFFF",s.fillRect(0,0,n,r)),s.drawImage(e,0,0,n,r),o}}},7756:(e,t,i)=>{const{isNodeJS:n}=i(55280);var r,o,s,a,l=i(8600).getResourceUrl;n()?(a=i(86059).MainWorker,e.exports={createWorker:function(){return new a},initWorkerScript:function(){}}):(r=Autodesk.Viewing.Private,o=r.LMV_WORKER_URL||"src/file-loaders/workers/MainWorker-web.js",s=null,e.exports={createWorker:function(e,t){if(!s){const e=new URL(l(o),document.baseURI).href,t=new Blob([`\n try {\n importScripts("${e}");\n } catch (e) {\n console.warn("Failed to import worker script. Could be a network failure or just the worker closing." + e);\n }\n `],{type:"application/javascript"});s=URL.createObjectURL(t)}let i=new Worker(s,{name:e});return i.doOperation=i.postMessage,!0===t&&r.ViewingService.forwardProtocolHandlerToWorker(i),i},initWorkerScript:function(){fetch(l(o))}})},82076:(e,t,i)=>{"use strict";i.r(t),i.d(t,{loadWasmWorker:()=>o});const{getResourceUrl:n}=i(8600),{getGlobal:r}=i(55280);function o(e){const t={},i=n("wasm.worker.js");return new Promise(((t,s)=>{(function(e){const t=Autodesk.Viewing.Private;return new Promise((function(i){if(t.ENABLE_INLINE_WORKER){let t=new XMLHttpRequest;t.open("GET",e,!0),t.withCredentials=!1,t.onload=function(){let e,n=r();n.URL=n.URL||n.webkitURL;try{e=new Blob([t.responseText],{type:"application/javascript"})}catch(i){let n=new BlobBuilder;n.append(t.responseText),e=n.getBlob()}i(URL.createObjectURL(e))},t.send()}else i(e)}))})(i).then((function(i){const r=new Worker(i),a={},l=n(e);r.postMessage({eventType:"INITIALIZE",eventData:l}),r.addEventListener("message",(function(e){if("INITIALIZED"===e.data.eventType){e.data.eventData.forEach((e=>{a[e]=function(){return o(e,r,(t=>{t.postMessage({eventData:{method:e,arguments:Array.from(arguments)}})}))}}));const i="getBuffer";return a[i]=function(){return o(i,r,(e=>{e.postMessage({eventType:"GET_BUFFER"})}))},void t(a)}})),r.addEventListener("error",(function(e){s(e)}))}))}));function o(e,i,n){return new Promise(((r,o)=>{const s=function(e,i){let n,r;t&&Object.prototype.hasOwnProperty.call(t,e)?(n=t[e][0],r=n.inUse):(t[e]=[],r=!0);r&&(n={channel:new MessageChannel,inUse:!1},t[e].push(n),i.postMessage({eventType:"SET_CHANNEL_PORT",eventData:{method:e,port:n.channel.port2}},[n.channel.port2]));return n}(e,i),a=s.channel;s.inUse=!0,n(a.port1),a.port1.onmessage=function(i){s.inUse=!1;const n=i.data.eventType,a=i.data.eventData;"ERROR"===n?o(a):r(a),function(e,t){for(let i=1;i<t.length;i++){if(t[i].channel===e.channel)return t.splice(i,1),!0}}(s,t[e])}}))}}},57480:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ErrorCodes:()=>n,errorCodeString:()=>r,getErrorCode:()=>o});const n={UNKNOWN_FAILURE:1,BAD_DATA:2,NETWORK_FAILURE:3,NETWORK_ACCESS_DENIED:4,NETWORK_FILE_NOT_FOUND:5,NETWORK_SERVER_ERROR:6,NETWORK_UNHANDLED_RESPONSE_CODE:7,BROWSER_WEBGL_NOT_SUPPORTED:8,BAD_DATA_NO_VIEWABLE_CONTENT:9,BROWSER_WEBGL_DISABLED:10,BAD_DATA_MODEL_IS_EMPTY:11,UNSUPORTED_FILE_EXTENSION:13,VIEWER_INTERNAL_ERROR:14,WEBGL_LOST_CONTEXT:15,LOAD_CANCELED:16};function r(e){return"ErrorCode:"+e+"."}function o(e){return 403===e||401===e?n.NETWORK_ACCESS_DENIED:404===e?n.NETWORK_FILE_NOT_FOUND:e>=500?n.NETWORK_SERVER_ERROR:n.NETWORK_UNHANDLED_RESPONSE_CODE}},84045:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewingService:()=>z,pathToURL:()=>j,textToArrayBuffer:()=>q});i(74423),i(69479),i(28845),i(17656),i(55105),i(7467),i(10586),i(71517),i(93777),i(14190),i(12359),i(86097),i(39172),i(57019),i(17273),i(81723),i(27415),i(19929),i(37583),i(55122),i(16385),i(20230),i(57268),i(79733),i(58179),i(30456),i(74017),i(79310),i(83062),i(96369),i(15637),i(2848),i(24842),i(24746),i(33454),i(6660),i(15941),i(82101),i(2917),i(47628),i(65186),i(42978),i(72527),i(79852),i(42376),i(40617),i(73067),i(66820),i(8288),i(25509),i(65223),i(60321),i(41927),i(11632),i(64377),i(49522),i(66771),i(12516),i(68931),i(52514),i(35694),i(52774),i(23283),i(49536),i(21926),i(94483),i(16215),i(78898),i(74176),i(43275),i(42793),i(77208),i(67348),i(26957),i(79732),i(83742),i(56422),i(82451),i(46270),i(59848);var n=i(83081),r=i(57480),o=i(42759),s=i(8412),a=i(55280),l=i(84406),c=Uint8Array,h=Uint16Array,u=Int32Array,d=new c([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]),f=new c([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]),p=new c([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),m=function(e,t){for(var i=new h(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var r=new u(i[30]);for(n=1;n<30;++n)for(var o=i[n];o<i[n+1];++o)r[o]=o-i[n]<<5|n;return{b:i,r}},g=m(d,2),v=g.b,y=g.r;v[28]=258,y[258]=28;for(var b=m(f,0),x=b.b,_=(b.r,new h(32768)),E=0;E<32768;++E){var S=(43690&E)>>1|(21845&E)<<1;S=(61680&(S=(52428&S)>>2|(13107&S)<<2))>>4|(3855&S)<<4,_[E]=((65280&S)>>8|(255&S)<<8)>>1}var A=function(e,t,i){for(var n=e.length,r=0,o=new h(t);r<n;++r)e[r]&&++o[e[r]-1];var s,a=new h(t);for(r=1;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(i){s=new h(1<<t);var l=15-t;for(r=0;r<n;++r)if(e[r])for(var c=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[_[d]>>l]=c}else for(s=new h(n),r=0;r<n;++r)e[r]&&(s[r]=_[a[e[r]-1]++]>>15-e[r]);return s},w=new c(288);for(E=0;E<144;++E)w[E]=8;for(E=144;E<256;++E)w[E]=9;for(E=256;E<280;++E)w[E]=7;for(E=280;E<288;++E)w[E]=8;var T=new c(32);for(E=0;E<32;++E)T[E]=5;var M=A(w,9,1),C=A(T,5,1),P=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},D=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&i},L=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},I=function(e){return(e+7)/8|0},R=function(e,t,i){return(null==t||t<0)&&(t=0),(null==i||i>e.length)&&(i=e.length),new c(e.subarray(t,i))},O=["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"],N=function(e,t,i){var n=new Error(t||O[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,N),!i)throw n;return n},F=function(e,t,i,n){var r=e.length,o=n?n.length:0;if(!r||t.f&&!t.l)return i||new c(0);var s=!i,a=s||2!=t.i,l=t.i;s&&(i=new c(3*r));var h=function(e){var t=i.length;if(e>t){var n=new c(Math.max(2*t,e));n.set(i),i=n}},u=t.f||0,m=t.p||0,g=t.b||0,y=t.l,b=t.d,_=t.m,E=t.n,S=8*r;do{if(!y){u=D(e,m,1);var w=D(e,m+1,3);if(m+=3,!w){var T=e[(j=I(m)+4)-4]|e[j-3]<<8,O=j+T;if(O>r){l&&N(0);break}a&&h(g+T),i.set(e.subarray(j,O),g),t.b=g+=T,t.p=m=8*O,t.f=u;continue}if(1==w)y=M,b=C,_=9,E=5;else if(2==w){var F=D(e,m,31)+257,U=D(e,m+10,15)+4,B=F+D(e,m+5,31)+1;m+=14;for(var k=new c(B),V=new c(19),G=0;G<U;++G)V[p[G]]=D(e,m+3*G,7);m+=3*U;var z=P(V),H=(1<<z)-1,W=A(V,z,1);for(G=0;G<B;){var j,q=W[D(e,m,H)];if(m+=15&q,(j=q>>4)<16)k[G++]=j;else{var X=0,Y=0;for(16==j?(Y=3+D(e,m,3),m+=2,X=k[G-1]):17==j?(Y=3+D(e,m,7),m+=3):18==j&&(Y=11+D(e,m,127),m+=7);Y--;)k[G++]=X}}var K=k.subarray(0,F),Q=k.subarray(F);_=P(K),E=P(Q),y=A(K,_,1),b=A(Q,E,1)}else N(1);if(m>S){l&&N(0);break}}a&&h(g+131072);for(var Z=(1<<_)-1,$=(1<<E)-1,J=m;;J=m){var ee=(X=y[L(e,m)&Z])>>4;if((m+=15&X)>S){l&&N(0);break}if(X||N(2),ee<256)i[g++]=ee;else{if(256==ee){J=m,y=null;break}var te=ee-254;if(ee>264){var ie=d[G=ee-257];te=D(e,m,(1<<ie)-1)+v[G],m+=ie}var ne=b[L(e,m)&$],re=ne>>4;ne||N(3),m+=15≠Q=x[re];if(re>3){ie=f[re];Q+=L(e,m)&(1<<ie)-1,m+=ie}if(m>S){l&&N(0);break}a&&h(g+131072);var oe=g+te;if(g<Q){var se=o-Q,ae=Math.min(Q,oe);for(se+g<0&&N(3);g<ae;++g)i[g]=n[se+g]}for(;g<oe;++g)i[g]=i[g-Q]}}t.l=y,t.p=J,t.b=g,t.f=u,y&&(u=1,t.m=_,t.d=b,t.n=E)}while(!u);return g!=i.length&&s?R(i,0,g):i.subarray(0,g)},U=new c(0),B=function(e){31==e[0]&&139==e[1]&&8==e[2]||N(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[i++]);return i+(2&t)},k=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0};function V(e,t){var i=B(e);return i+8>e.length&&N(6,"invalid gzip data"),F(e.subarray(i,-8),{i:2},t&&t.out||new c(k(e)),t&&t.dictionary)}var G="undefined"!=typeof TextDecoder&&new TextDecoder;try{G.decode(U,{stream:!0}),1}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;let z={WORKER_REGISTER_FILE_PORT:"REGISTER_FILE_PORT",WORKER_READ_FILE:"READ_FILE"};var H=!1;function W(e){var t=e.split("/");if(0==t.length)return e;for(var i=[],n=0;n<t.length;++n){var r=t[n];"."!==r&&(".."===r&&i.length?i.pop():i.push(r))}return 0==i.length?"":i.join("/")}function j(e,t){if(-1!==e.indexOf("://")||0===e.indexOf("urn:"))return e;if(t)return t+e;if("undefined"==typeof window)return e;const i=(0,a.getGlobal)();var n=i.location.pathname,r=n.lastIndexOf("/");return n=n.substr(0,r+1),i.location.protocol+"//"+i.location.host+n+e}function q(e,t){for(var i=e.length-t,n=new ArrayBuffer(i),r=new Uint8Array(n,0),o=0,s=t;o<i;o++,s++)r[o]=255&e.charCodeAt(s);return r}function X(e,t){return-1===t.indexOf("file://")&&(-1!==t.indexOf("://")||(!!e||void 0))}if(z.simplifyPath=W,z.OSS_PREFIX="urn:adsk.objects:os.object:",z.generateUrl=function(e,t,i,n,r,o){if(i=i||"",(0,a.isNodeJS)()&&!X(e,i))return i;var l=(i=W(i)).indexOf("urn:"),c=i.indexOf("?");if(i=-1!=l?-1!==c?i.slice(0,l)+encodeURIComponent(i.slice(l,c))+i.slice(c):i.slice(0,l)+encodeURIComponent(i.slice(l)):encodeURI(i),r&&z.isOSSUrl(i)){var h=i.indexOf("/objects/")+9,u=i.substring(h);i=i.substring(0,h)+encodeURIComponent(u)}if(!t||0!==decodeURIComponent(i).indexOf("urn:"))return X(null,i)?i:e+i;switch("items"!==t&&(i=i.substr(6)),t){case"items":return s.endpoint.getItemApi(e,i,n);case"bubbles":return s.endpoint.getManifestApi(e,i,n);case"thumbnails":return s.endpoint.getThumbnailApi(e,i,n);case"properties":return s.endpoint.getPropertyQueryApi(e,i,n,o)}},(0,a.isNodeJS)())!function(){var e=i(39709),t=i(90315),o=i(9631),s=i(50684),a=i(18215);let l=new o.Agent({keepAlive:!0,keepAliveMsecs:100,maxSockets:10}),c=new s.Agent({keepAlive:!0,keepAliveMsecs:100,maxSockets:10});var h=new o.Agent({maxSockets:10});z.rawGet=function(i,u,d,f,p,m){if(m=m||{},X(i,d=z.generateUrl(i,u,d,void 0,m.escapeOssObjects))){if(m.queryParams){var g=-1===d.indexOf("?")?"?":"&";d=d+g+m.queryParams}var v=a.parse(d),y={host:v.hostname,port:v.port,method:m.method||"GET",path:v.path,headers:{},retryCount:0,agent:"https:"===v.protocol?l:c};if(y.host.endsWith(".api.autodesk.com")&&(y.path.startsWith("/derivativeservice")||y.path.startsWith("/modelderivative"))&&(y.agent=h),m.headers)for(var b in m.headers)y.headers[b]=m.headers[b];y.headers["accept-encoding"]||(y.headers["accept-encoding"]="gzip, deflate"),m.range&&(y.headers.Range="bytes="+m.range.min+"-"+m.range.max),m.ondata&&(m.responseType="arraybuffer");var x=("https:"===v.protocol?o:s).request(y,(function(e){var i=!(e.statusCode>=200&&e.statusCode<400),o=e;!i&&function(e,t){return!!("gzip"===e.headers["content-encoding"]||t.endsWith(".json.gz")||t.endsWith("FragmentList.pack")||t.endsWith("LightList.bin")||t.endsWith("CameraList.bin")||t.endsWith("CameraDefinitions.bin")||t.endsWith("LightDefinitions.bin"))}(e,v.pathname)&&(o=e.pipe(t.createGunzip())),"json"!==m.responseType&&"text"!==m.responseType&&m.responseType||o.setEncoding("utf8");var s=[],a=(Buffer.allocUnsafe(65536),0);o.on("data",(function(e){s.push(e),m.ondata&&m.ondata(e)})),o.on("end",(function(){if(e.statusCode>=200&&e.statusCode<400){if("json"===m.responseType){var i=JSON.parse(s.join(""));return void f(i)}if("text"===m.responseType||""===m.responseType){var o=s.join("");return void f(o)}var l=Buffer.concat(s);if(31===l[0]&&139===l[1]){n.logger.warn("An LMV resource ("+d+") was double compressed, or Content-Encoding header missing");try{l=t.gunzipSync(l),a=l.length}catch(e){p(r.ErrorCodes.BAD_DATA,"Malformed data received when requesting file",{url:d,exception:e.toString(),stack:e.stack})}}200===x.status&&m.range&&(l=new Uint8Array(l,m.range.min,m.range.max-m.range.min)),f(l,a)}else p&&p(e.statusCode,e.statusMessage,{url:d})}))}));x.on("error",(function(e){p&&p(e.code,e.message,{url:d})})),m.postData&&x.write(m.postData),x.end()}else!function(i,n,r,o){function s(e){if("json"===o.responseType)try{return JSON.parse(e.toString("utf8"))}catch(e){r(e)}return e}0===i.indexOf("file://")&&(i=i.substr(7)),e.readFile(i,(function(e,a){e?r(0,0,{httpStatusText:e,url:i}):31===a[0]&&139===a[1]?t.gunzip(a,null,(function(e,t){e?r(0,0,{httpStatusText:e,url:i}):(t=s(t),o.ondata&&o.ondata(t),n(t))})):(a=s(a),o.ondata&&o.ondata(a),n(a))}))}(d,f,p,m)}}();else{var Y=new(i(51436));Y.max=25;var K={},Q={},Z={};z.registerProtocolPort=function(e,t){/^(http(s)?|file):/gi.test(e)?console.warn("http(s) or file protocol were not allowed to be handled"):t?(K[e]=t,t.onmessage=function(e){var t=e.data.url;if(Q[t]){var i=Q[t];if(e.data.error)i.onFailureWrapped(r.ErrorCodes.BAD_DATA,"Malformed data received when requesting file",{url:t,exception:e.data.error.message,stack:e.data.error.stack});else{var n=e.data.buffer;if(Q[t]=void 0,31===n[0]&&139===n[1]&&t.match(/(.f2d|.gz)$/gi))try{n=V(n),i.options&&i.options.ondata&&i.options.ondata(n),i.onSuccessWrapped(n)}catch(e){i.onFailureWrapped(r.ErrorCodes.BAD_DATA,"Malformed data received when requesting file",{url:t,exception:e.toString(),stack:e.stack})}else i.onSuccessWrapped(n)}}else if(Z[t]){var o=[];e.data&&e.data.buffer&&e.data.buffer.buffer instanceof ArrayBuffer&&o.push(e.data.buffer.buffer),Z[t].postMessage(e.data,o),Z[t]=void 0}}):K[e]&&K[e]instanceof MessagePort&&(K[e].onmessage=void 0,K[e]=void 0)},z.handlerProtocol=function(e,t,i,n,r){var o=K[e];Q[t]={onSuccessWrapped:i,onFailureWrapped:n,options:r},o.postMessage({operation:z.WORKER_READ_FILE,url:t})},z.forwardProtocolHandlerToWorker=function(e){var t={},i=new MessageChannel;for(var n in i.port1.onmessage=function(e){var t=new URL(e.data.url);K[t.protocol].postMessage(e.data),Z[t]=i.port1},K)K[n]instanceof MessagePort&&(t[n]=i.port2);e.doOperation({operation:z.WORKER_REGISTER_FILE_PORT,protocolPortMap:t},[i.port2])},z.rawGet=function(e,t,i,r,o,s){Y.go((a=>{let l=function(){a();for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];o&&o.apply(o,t)},c=function(){a();for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r&&r.apply(r,t)};var h=/^(\w+:)\/\//gi.exec(i);if(h&&2==h.length&&K[h[1]])z.handlerProtocol(h[1],i,c,l,s);else{let r=z._rawGet;null!=s&&s.useFetch&&(r=z._rawGetFetch),r(e,t,i,c,(function(){const r=arguments.length<=0?void 0:arguments[0];let o="get"===((null==s?void 0:s.method)||(null!=s&&s.noBody?"HEAD":"GET")).toLowerCase()&&(0===r||429===r||r>=500);if((arguments.length<=2?void 0:arguments[2]).aborted&&(o=!1),o){const o=arguments.length<=3?void 0:arguments[3];let a=100,h=5,u=!1;if(429!==r&&503!==r||null==o||!o.getResponseHeader("Retry-After")?0===r&&(u=3,h=2):u=o.getResponseHeader("Retry-After"),u){const e=Number(u);a=!isNaN(e)&&1e3*e||Date.parse(u)-(new Date).getTime(),a=a>100?a:100}z._retryRequest(e,t,i,s,a,h).then((e=>{n.logger.warn(`request ${i} successful after retries.`),c(...e)})).catch((e=>{n.logger.warn(`request ${i} unsuccessful after retries.`),l(...e)}))}else l(...arguments)}),s)}}))},z._retryRequest=function(e,t,i,r,o,s){const a={delayFirstAttempt:!0,startingDelay:o,numOfAttempts:4,retry:(e,t)=>{let[i,r,{url:o}]=e;return n.logger.warn(`request ${o} failed with status ${i} ${r}. Attempt ${t}`),!0},timeMultiple:s};return(0,l.backOff)((()=>new Promise(((n,o)=>{let s=z._rawGet;null!=r&&r.useFetch&&(s=z._rawGetFetch),s(e,t,i,(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n(t)}),(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return o(t)}),r)}))),a)},z.isOSSUrl=function(e){return!!e&&-1!==e.indexOf("/oss/v2/buckets")},z.getSignedS3DownloadUrl=function(e){return new Promise((t=>{const i=e.indexOf("?acmsession=");-1!==i&&(e=e.substring(0,i)),e+="/signeds3download?useCdn=true";const n=new XMLHttpRequest;n.open("GET",e),n.setRequestHeader("Authorization",s.endpoint.HTTP_REQUEST_HEADERS.Authorization),n.responseType="json",n.send();const r=()=>{t(null)};n.onload=e=>{const i=e.currentTarget.response;t(i.url)},n.onerror=r,n.ontimeout=r,n.onabort=r}))},z._rawGet=async function(e,t,i,s,a,l){l=l||{},i=z.generateUrl(e,t,i,l.apiData,l.escapeOssObjects,l.guid);let c=!1;if(z.isOSSUrl(i)){const e=await z.getSignedS3DownloadUrl(i);e?(i=e,c=!0):console.warn("Failed getting signed URL - Fallback to direct OSS resource.")}if(l.queryParams&&!c){var h=-1===i.indexOf("?")?"?":"&";i=i+h+l.queryParams}var u=new XMLHttpRequest;function d(e){a&&a(u.status,u.statusText,{url:i},u)}function f(e){if("json"===l.responseType)try{if(e instanceof Uint8Array)return(0,o.TN)(e);if("string"==typeof e)return JSON.parse(e)}catch(e){}return e}function p(e){if(u.status>=200&&u.status<400)if(u.response&&u.response instanceof ArrayBuffer){var t;if(31===(t=200===u.status&&l.range?new Uint8Array(u.response,l.range.min,l.range.max-l.range.min):new Uint8Array(u.response))[0]&&139===t[1]){H||(H=!0,n.logger.warn("An LMV resource ("+i+") was not uncompressed by the browser. This hurts performance. Check the Content-Encoding header returned by the server and check whether you're getting double-compressed streams. The warning prints only once but it's likely the problem affects multiple resources."));try{t=V(t)}catch(e){a(r.ErrorCodes.BAD_DATA,"Malformed data received when requesting file",{url:i,exception:e.toString(),stack:e.stack},u)}}s&&s(f(t))}else{var o=u.response;o||l.responseType&&"text"!==l.responseType||(o=u.responseText),s&&s(f(o))}else d()}try{var m=!Object.prototype.hasOwnProperty.call(l,"asynchronous")||l.asynchronous;if(u.open(l.method||(l.noBody?"HEAD":"GET"),i,m),Object.prototype.hasOwnProperty.call(l,"responseType")&&(u.responseType=l.responseType),l.range&&u.setRequestHeader("Range","bytes="+l.range.min+"-"+l.range.max),!c&&(u.withCredentials=!0,Object.prototype.hasOwnProperty.call(l,"withCredentials")&&(u.withCredentials=l.withCredentials),l.headers))for(var g in l.headers)u.setRequestHeader(g,l.headers[g]),"authorization"===g.toLocaleLowerCase()&&(u.withCredentials=!1);m&&(u.onload=p,u.onerror=d,u.ontimeout=d,u.onabort=function(e){a&&a(u.status,"request was aborted",{url:i,aborted:!0},u)},l.ondata&&(u.overrideMimeType("text/plain; charset=x-user-defined"),l._dlProgress={streamOffset:0},u.onreadystatechange=function(){if(u.readyState>2&&200===u.status&&l.ondata){var e=u.responseText;if(l._dlProgress.streamOffset>=e.length)return;var t=q(e,l._dlProgress.streamOffset);l._dlProgress.streamOffset=e.length,l.ondata(t)}})),u.send(l.postData),m||p()}catch(e){a(u.status,u.statusText,{url:i,exception:e},u)}},z._rawGetFetch=async function(e,t,i,n,r,o){o=o||{},i=z.generateUrl(e,t,i,o.apiData,o.escapeOssObjects,o.guid);let s=!1;if(z.isOSSUrl(i)){const e=await z.getSignedS3DownloadUrl(i);e?(i=e,s=!0):console.warn("Failed getting signed URL - Fallback to direct OSS resource.")}if(o.queryParams&&!s){var a=-1===i.indexOf("?")?"?":"&";i=i+a+o.queryParams}var l,c=new Request(i);function h(e){return{getResponseHeader:t=>{var i;return null==e||null===(i=e.headers)||void 0===i?void 0:i.get(t)}}}try{const e={method:o.method||(o.noBody?"HEAD":"GET"),body:o.postData,headers:o.headers||{},signal:o.abortSignal};if(o.range&&(e.headers.Range="bytes="+o.range.min+"-"+o.range.max),!s&&(e.credentials="include",Object.prototype.hasOwnProperty.call(o,"withCredentials")&&!1===o.withCredentials&&(e.credentials="omit"),o.headers))for(var u in o.headers)"authorization"===u.toLocaleLowerCase()&&(e.credentials="omit");if(!(l=await fetch(c,e)).ok){let e=await l.text();return void r(l.status,e,{url:i},h(l))}if(o.ondata){const e=l.body.getReader();for(;;){let{done:t,value:i}=await e.read();if(t)return void(n&&n(null));o.ondata(i)}}else{let e;o.responseType&&"text"!==o.responseType?"json"===o.responseType?e=await l.json():(e=await l.arrayBuffer(),200===c.status&&o.range&&(e=new Uint8Array(e,o.range.min,o.range.max-o.range.min))):e=await l.text(),n&&n(e)}}catch(e){"AbortError"===e.name?r(0,"request was aborted",{url:i,aborted:!0},h(l)):l?r(l.status,l.statusText,{url:i,exception:e},h(l)):r(0,"network error",{url:i,exception:e})}}}function $(e,t){Object.prototype.hasOwnProperty.call(t,"responseType")||(t.responseType="arraybuffer"),Object.prototype.hasOwnProperty.call(t,"withCredentials")||(t.withCredentials=!!e.auth),t.headers=e.headers,t.queryParams=e.queryParams,t.endpoint=e.endpoint,t.escapeOssObjects=e.escapeOssObjects}z.defaultFailureCallback=function(e,t,i){403==e?this.raiseError(r.ErrorCodes.NETWORK_ACCESS_DENIED,"Access denied to remote resource",{url:i.url,httpStatus:e,httpStatusText:t}):404==e?this.raiseError(r.ErrorCodes.NETWORK_FILE_NOT_FOUND,"Remote resource not found",{url:i.url,httpStatus:e,httpStatusText:t}):0===e&&i.aborted?this.raiseError(r.ErrorCodes.LOAD_CANCELED,"Request aborted",{url:i.url,httpStatus:e,httpStatusText:t}):e>=500&&e<600?this.raiseError(r.ErrorCodes.NETWORK_SERVER_ERROR,"Server error when accessing resource",{url:i.url,httpStatus:e,httpStatusText:t}):i.exception?this.raiseError(r.ErrorCodes.NETWORK_FAILURE,"Network failure",{url:i.url,exception:i.exception.toString(),stack:i.exception.stack}):this.raiseError(r.ErrorCodes.NETWORK_UNHANDLED_RESPONSE_CODE,"Unhandled response code from server",{url:i.url,httpStatus:e,httpStatusText:t,data:i})},z.getItem=function(e,t,i,n,r){if($(e,r=r||{}),r.range&&!e.supportsRangeRequests){let e="start="+r.range.min+"&end="+r.range.max;r.queryParams?r.queryParams+="&"+e:r.queryParams=e,r.range=void 0}z.rawGet(e.endpoint,"items",t,i,n,r)},z.getManifest=function(e,t,i,n,r){r=r||{},Object.prototype.hasOwnProperty.call(r,"responseType")||(r.responseType="json"),$(e,r),z.rawGet(e.endpoint,"bubbles",t,i,n,r)},z.getProperties=function(e,t,i,n,r,o){const s={};$(e,s),s.responseType="json",s.guid=i,s.method="POST",s.postData=JSON.stringify(n),s.headers["Content-Type"]="application/json",s.headers.accept="application/json",s.headers["Access-Control-Allow-Origin"]="*",z.rawGet(e.endpoint,"properties",t,r,o,s)},z.getThumbnail=function(e,t,i,n,r){$(e,r=r||{});var o=r.queryParams||"",s=[];if(-1===o.indexOf("guid=")&&r.guid&&s.push("guid="+encodeURIComponent(r.guid)),-1===o.indexOf("role=")){var a=r.role||"rendered";s.push("role="+a)}if(-1===o.indexOf("width=")){let e=r.size||400;s.push("width="+e)}if(-1===o.indexOf("height=")){let e=r.size||400;s.push("height="+e)}-1===o.indexOf("acmsession=")&&r.acmsession&&s.push("acmsession="+r.acmsession);var l=s.join("&");r.queryParams?r.queryParams=r.queryParams+"&"+l:r.queryParams=l,z.rawGet(e.endpoint,"thumbnails",t,i,n,r)},z.getACMSession=function(e,t,i,r){const o={numOfAttempts:4,timeMultiple:5,retry:(e,t)=>(n.logger.warn(`acmsession request failed. Attempt #${t}`),!0)};(0,l.backOff)((()=>new Promise(((i,n)=>{z._getACMSession(e,t,i,n)}))),o).then((function(){return i(...arguments)})).catch((function(){return r(...arguments)}))},z._getACMSession=function(e,t,i,n){var r,o={};for(var s in t)"oauth2AccessToken"===s?r=t[s]:-1!==s.indexOf("x-ads-acm")&&(o[s]=t[s]);o.application="autodesk";var a=new XMLHttpRequest;a.open("POST",e+"/oss-ext/v2/acmsessions",!0),a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Authorization","Bearer "+r),a.responseType="json",a.onload=function(){if(200===a.status&&a.response){var e="string"==typeof a.response?JSON.parse(a.response):a.response;e&&e.acmsession?i(e.acmsession):n(a.status,"Can't get acm session from response.")}else n(a.status)},a.onerror=n,a.ontimeout=n,a.send(JSON.stringify(o)),delete o.application}},8412:(e,t,i)=>{"use strict";i.r(t),i.d(t,{endpoint:()=>A,getEnv:()=>g,getOfflineResourcePrefix:()=>S,initLoadContext:()=>w,isOffline:()=>b,setEnv:()=>v,setOffline:()=>x,setOfflineResourcePrefix:()=>E});var n=i(55280),r=i(8600);const o=(0,n.getGlobal)();var s={},a=null;s.ENDPOINT_API_DERIVATIVE_SERVICE_V2="derivativeV2",s.ENDPOINT_API_MODEL_DERIVATIVE_V2="modelDerivativeV2",s.ENDPOINT_API_FLUENT="fluent",s.ENDPOINT_API_D3S="D3S",s.ENDPOINT_API_DERIVATIVE_STREAMING="streamingV2";var l,c={derivativeV2:{baseURL:"/derivativeservice/v2",itemURL:"/derivativeservice/v2/derivatives/:derivativeurn",manifestURL:"/derivativeservice/v2/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",propertyQueryURL:"/modelderivative/v2/designdata/:urn/metadata/:guid/properties:query"},derivativeV2_EU:{baseURL:"/derivativeservice/v2/regions/eu",itemURL:"/derivativeservice/v2/regions/eu/derivatives/:derivativeurn",manifestURL:"/derivativeservice/v2/regions/eu/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/regions/eu/thumbnails/:urn"},derivativeV2_APAC:{baseURL:"/derivativeservice/v2/regions/apac",itemURL:"/derivativeservice/v2/regions/apac/derivatives/:derivativeurn",manifestURL:"/derivativeservice/v2/regions/apac/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/regions/apac/thumbnails/:urn"},derivativeV2_Fedramp:{baseURL:"/derivativeservice/v2",itemURL:"/derivativeservice/v2/derivatives/:derivativeurn",manifestURL:"/derivativeservice/v2/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn"},modelDerivativeV2:{baseURL:"/modelderivative/v2/",itemURL:"/modelderivative/v2/designdata/:urn/manifest/:derivativeurn",manifestURL:"/modelderivative/v2/designdata/:urn/manifest",thumbnailsURL:"/modelderivative/v2/designdata/:urn/thumbnail",propertyQueryURL:"/modelderivative/v2/designdata/:urn/metadata/:guid/properties:query"},fluent:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},D3S:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},D3S_EU:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/regions/eu/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},D3S_APAC:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/regions/APAC/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},streamingV2:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},streamingV2_EU:{baseURL:"/regions/eu/modeldata",itemURL:"/regions/eu/modeldata/file/:derivativeurn",manifestURL:"/regions/eu/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/regions/eu/thumbnails/:urn",cdnURL:"/regions/eu/cdn",cdnWS:"/regions/eu/cdnws"},streamingV2_APAC:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"},streamingV2_Fedramp:{baseURL:"/modeldata",itemURL:"/modeldata/file/:derivativeurn",manifestURL:"/modeldata/manifest/:urn",thumbnailsURL:"/derivativeservice/v2/thumbnails/:urn",cdnURL:"/cdn",cdnWS:"/cdnws"}},h="",u=s.ENDPOINT_API_DERIVATIVE_SERVICE_V2,d=!1,f=!1,p="",m=!1;function g(){return l}function v(e){l=e,e.startsWith("MD20")&&console.warn(`env=${e} is deprecated and will be removed in a future release. Use Autodesk{env}2 instead, where env=Development, Staging, or Production`)}s.HTTP_REQUEST_HEADERS={},s.queryParams={},s.setEndpointAndApi=function(e,t){null!=e&&(h=e),t&&(u=t,t.startsWith("D3S")&&console.warn(`api=${t} is deprecated and will be removed in a future release. Use streamingV2 or streamingV2_EU (europe region) instead`))},s.getEndpointAndApi=function(){return h+c[u].baseURL},s.getApiEndpoint=function(){return h},s.getApiFlavor=function(){return u},s.getCdnUrl=function(){return a||(h?h+c[u].cdnURL:void 0)},s.getCdnWebSocketEndpoint=function(){return h+(c[u].cdnWS||"")},s.setCdnUrl=function(e){a=e},s.getCdnRedirectUrl=function(){var e=c[u].cdnRedirectURL;return e?h+e:null},s.setAcmSession=function(e){p=e},s.getAcmSession=function(){return p},s.getManifestApi=function(e,t,i){var n=e||h;return t=t||"",n=(n+=c[i=i||u].manifestURL).replace(":urn",t)},s.getItemApi=function(e,t,i){var n=i||u,r=(e||h)+c[n].itemURL;t=t||"";var o=decodeURIComponent(t);if(-1!==r.indexOf(":urn")){var a=o.split("/")[0]||"";a=(a=a.split(":"))[a.length-1]||"",r=r.replace(":urn",a)}return n===s.ENDPOINT_API_MODEL_DERIVATIVE_V2&&(t=encodeURIComponent(o)),r=r.replace(":derivativeurn",t)},s.getThumbnailApi=function(e,t,i){return((e||h)+c[i||u].thumbnailsURL).replace(":urn",t||"")},s.getPropertyQueryApi=function(e,t,i,n){let r=(e||h)+c[i||u].propertyQueryURL;return r=r.replace(":urn",t||""),r.replace(":guid",n||"")},s.getUseCredentials=function(){return d},s.getDomainParam=function(){return console.warn("getDomainParam is deprecated, switch to getQueryParams instead."),this.getUseCredentials()&&!(0,n.isNodeJS)()?"domain="+encodeURIComponent(o.location.origin):""},s.addQueryParam=function(e,t){this.queryParams[e]=t},s.deleteQueryParam=function(e){delete this.queryParams[e]},s.getQueryParams=function(e){let t=this.getUseCredentials()&&!(0,n.isNodeJS)()?"domain="+encodeURIComponent(o.location.origin):"";(0,r.getParameterByName)("bypassds")&&(t=t?t+"&bypassds=1":"bypassds=1");let i=[];for(let e in this.queryParams)i.push(encodeURIComponent(e)+"="+encodeURIComponent(this.queryParams[e]));return i.length&&(t?t+="&"+i.join("&"):t=i.join("&")),t&&e&&(e.queryParams?e.queryParams+="&"+t:e.queryParams=t),t},s.setUseCredentials=function(e){d=e},s.setUseCookie=function(e){f=e},s.getUseCookie=function(){return f},s.isOtgBackend=function(){return this.getApiFlavor()===this.ENDPOINT_API_FLUENT},s.isSVF2Backend=function(){let e=this.getApiFlavor();return e.startsWith(this.ENDPOINT_API_D3S)||e.startsWith(this.ENDPOINT_API_DERIVATIVE_STREAMING)},s.setEscapeOssObjects=function(e){m=e},s.getEscapeOssObjects=function(){return m},s.initLoadContext=function(e){for(var t in(e=e||{}).auth=this.getUseCredentials(),e.endpoint||(e.endpoint=this.getApiEndpoint()),e.api||(e.api=this.getApiFlavor()),e.headers||(e.headers={}),this.HTTP_REQUEST_HEADERS)e.headers[t]=this.HTTP_REQUEST_HEADERS[t];return e.api,this.ENDPOINT_API_FLUENT,this.getQueryParams(e),e.otg_cdn=a||this.getCdnUrl(),e.otg_ws=this.getCdnWebSocketEndpoint(),e.escapeOssObjects=this.getEscapeOssObjects(),e};var y=!1;function b(){return y}function x(e){y=e}var _="";function E(e){_=e}function S(){return _}let A=s,w=s.initLoadContext.bind(s)},38685:(e,t,i)=>{"use strict";function n(e){return e[e.LMV_APP_NAMESPACE]=e[e.LMV_APP_NAMESPACE]||{}}function r(){const e="undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:i.g;return e.USE_LMV_APP_NAMESPACES?(e.globalProxy||(e.globalProxy=new Proxy({},{get(t,i){let n=e[i];return"function"==typeof n?function(e,t){return new Proxy(t,{get:(e,t)=>e[t],apply:(t,i,n)=>t.call(e||i,...n)})}(e,n):n},set:(t,i,r)=>(Object.prototype.hasOwnProperty.call(e,i)?e[i]!==r&&(e[i]=r):(n(e)[i]=r,Object.defineProperty(e,i,{get:()=>n(e)[i],set:t=>{n(e)[i]=t}})),!0)})),e.globalProxy):e}i.r(t),i.d(t,{getGlobal:()=>r})},16271:(e,t,i)=>{"use strict";i.r(t),i.d(t,{extendLocalization:()=>w,initializeLocalization:()=>M,setLanguage:()=>T});var n=i(55280);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var o=[],s=o.forEach,a=o.slice;function l(e){return s.call(a.call(arguments,1),(function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])})),e}function c(){return"function"==typeof XMLHttpRequest||"object"===("undefined"==typeof XMLHttpRequest?"undefined":r(XMLHttpRequest))}var h,u,d,f=i(85178),p=i.t(f,2);function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}"function"==typeof fetch&&(h="undefined"!=typeof global&&global.fetch?global.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),c()&&("undefined"!=typeof global&&global.XMLHttpRequest?u=global.XMLHttpRequest:"undefined"!=typeof window&&window.XMLHttpRequest&&(u=window.XMLHttpRequest)),"function"==typeof ActiveXObject&&("undefined"!=typeof global&&global.ActiveXObject?d=global.ActiveXObject:"undefined"!=typeof window&&window.ActiveXObject&&(d=window.ActiveXObject)),h||!p||u||d||(h=f||p),"function"!=typeof h&&(h=void 0);var g=function(e,t){if(t&&"object"===m(t)){var i="";for(var n in t)i+="&"+encodeURIComponent(n)+"="+encodeURIComponent(t[n]);if(!i)return e;e=e+(-1!==e.indexOf("?")?"&":"?")+i.slice(1)}return e},v=function(e,t,i){h(e,t).then((function(e){if(!e.ok)return i(e.statusText||"Error",{status:e.status});e.text().then((function(t){i(null,{status:e.status,data:t})})).catch(i)})).catch(i)},y=!1;const b=function(e,t,i,n){return"function"==typeof i&&(n=i,i=void 0),n=n||function(){},h?function(e,t,i,n){e.queryStringParams&&(t=g(t,e.queryStringParams));var r=l({},"function"==typeof e.customHeaders?e.customHeaders():e.customHeaders);i&&(r["Content-Type"]="application/json");var o="function"==typeof e.requestOptions?e.requestOptions(i):e.requestOptions,s=l({method:i?"POST":"GET",body:i?e.stringify(i):void 0,headers:r},y?{}:o);try{v(t,s,n)}catch(e){if(!o||0===Object.keys(o).length||!e.message||e.message.indexOf("not implemented")<0)return n(e);try{Object.keys(o).forEach((function(e){delete s[e]})),v(t,s,n),y=!0}catch(e){n(e)}}}(e,t,i,n):c()||"function"==typeof ActiveXObject?function(e,t,i,n){i&&"object"===m(i)&&(i=g("",i).slice(1)),e.queryStringParams&&(t=g(t,e.queryStringParams));try{var r;(r=u?new u:new d("MSXML2.XMLHTTP.3.0")).open(i?"POST":"GET",t,1),e.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=!!e.withCredentials,i&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.overrideMimeType&&r.overrideMimeType("application/json");var o=e.customHeaders;if(o="function"==typeof o?o():o)for(var s in o)r.setRequestHeader(s,o[s]);r.onreadystatechange=function(){r.readyState>3&&n(r.status>=400?r.statusText:null,{status:r.status,data:r.responseText})},r.send(i)}catch(e){console&&console.log(e)}}(e,t,i,n):void n(new Error("No fetch and no xhr implementation found!"))};function x(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var _=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:function(e){return JSON.parse(e)},stringify:JSON.stringify,parsePayload:function(e,t,i){return function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}({},t,i||"")},request:b,reloadInterval:"undefined"==typeof window&&36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},E=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.services=t,this.options=i,this.allOptions=n,this.type="backend",this.init(t,i,n)}var t,i,n;return t=e,i=[{key:"init",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=l(i,this.options||{},_()),this.allOptions=n,this.services&&this.options.reloadInterval&&setInterval((function(){return t.reload()}),this.options.reloadInterval)}},{key:"readMulti",value:function(e,t,i){this._readAny(e,e,t,t,i)}},{key:"read",value:function(e,t,i){this._readAny([e],e,[t],t,i)}},{key:"_readAny",value:function(e,t,i,n,r){var o,s=this,a=this.options.loadPath;"function"==typeof this.options.loadPath&&(a=this.options.loadPath(e,i)),(a=function(e){return!!e&&"function"==typeof e.then}(o=a)?o:Promise.resolve(o)).then((function(o){if(!o)return r(null,{});var a=s.services.interpolator.interpolate(o,{lng:e.join("+"),ns:i.join("+")});s.loadUrl(a,r,t,n)}))}},{key:"loadUrl",value:function(e,t,i,n){var r=this;this.options.request(this.options,e,void 0,(function(o,s){if(s&&(s.status>=500&&s.status<600||!s.status))return t("failed loading "+e+"; status code: "+s.status,!0);if(s&&s.status>=400&&s.status<500)return t("failed loading "+e+"; status code: "+s.status,!1);if(!s&&o&&o.message&&o.message.indexOf("Failed to fetch")>-1)return t("failed loading "+e+": "+o.message,!0);if(o)return t(o,!1);var a,l;try{a="string"==typeof s.data?r.options.parse(s.data,i,n):s.data}catch(t){l="failed parsing "+e+" to json"}if(l)return t(l,!1);t(null,a)}))}},{key:"create",value:function(e,t,i,n,r){var o=this;if(this.options.addPath){"string"==typeof e&&(e=[e]);var s=this.options.parsePayload(t,i,n),a=0,l=[],c=[];e.forEach((function(i){var n=o.options.addPath;"function"==typeof o.options.addPath&&(n=o.options.addPath(i,t));var h=o.services.interpolator.interpolate(n,{lng:i,ns:t});o.options.request(o.options,h,s,(function(t,i){a+=1,l.push(t),c.push(i),a===e.length&&r&&r(l,c)}))}))}}},{key:"reload",value:function(){var e=this,t=this.services,i=t.backendConnector,n=t.languageUtils,r=t.logger,o=i.language;if(!o||"cimode"!==o.toLowerCase()){var s=[],a=function(e){n.toResolveHierarchy(e).forEach((function(e){s.indexOf(e)<0&&s.push(e)}))};a(o),this.allOptions.preload&&this.allOptions.preload.forEach((function(e){return a(e)})),s.forEach((function(t){e.allOptions.ns.forEach((function(e){i.read(t,e,"read",null,null,(function(n,o){n&&r.warn("loading namespace ".concat(e," for language ").concat(t," failed"),n),!n&&o&&r.log("loaded namespace ".concat(e," for language ").concat(t),o),i.loaded("".concat(t,"|").concat(e),n,o)}))}))}))}}}],i&&x(t.prototype,i),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();E.type="backend";const S=E;var A=i(77427),w=function(e){return null!==e&&"object"==typeof e&&(Object.keys(e).forEach((function(t){Autodesk.Viewing.i18n.addResourceBundle(t,"allstrings",e[t],!0,!0)})),!0)},T=function(e,t){return(0,n.getGlobal)().LOCALIZATION_REL_PATH="res/locales/"+e+"/",Autodesk.Viewing.i18n.changeLanguage(e).then((()=>Autodesk.Viewing.i18n.reloadResources())).then((()=>{t&&t()}))},M=function(e){const t=(0,n.getGlobal)(),i=t&&t.document;Autodesk.Viewing.i18n.localize=function(e){var t=e||i;Array.prototype.forEach.call(t.querySelectorAll("[data-i18n]"),(function(e){var t=e.getAttribute("data-i18n"),i=[null,t],n=i[0],r=i[1],o=Autodesk.Viewing.i18n.translate(r);o?n?e.setAttribute(n,o):e.placeholder?e.placeholder=o:e.textContent=o:n?e.setAttribute(n,r):e.textContent=r}))};var r=e&&e.language||navigator.language;return r=A.Lang.getSupported(r),Autodesk.Viewing.i18n.use(S).init({lng:r,backend:{loadPath:Autodesk.Viewing.Private.getResourceUrl("res/locales/%(lng)/%(ns).json")},ns:"allstrings",defaultNS:"allstrings",fallbackLng:"en",debug:!1,useCookie:!1,interpolation:{prefix:"%(",suffix:")",escapeValue:!1}}),T(r)}},77427:e=>{"use strict";let t=new function(){this.names=[{symbol:"en",label:"English"},{symbol:"zh-Hans",label:"Chinese Simplified"},{symbol:"zh-Hant",label:"Chinese Traditional"},{symbol:"zh-HK",label:"Hong Kong Traditional"},{symbol:"ja",label:"Japanese"},{symbol:"cs",label:"Czech"},{symbol:"ko",label:"Korean"},{symbol:"pl",label:"Polish"},{symbol:"ru",label:"Russian"},{symbol:"fr",label:"French"},{symbol:"fr-CA",label:"Canadian French"},{symbol:"de",label:"German"},{symbol:"it",label:"Italian"},{symbol:"nl",label:"Dutch"},{symbol:"es",label:"Spanish"},{symbol:"pt-PT",label:"Portuguese Portugal"},{symbol:"pt-BR",label:"Portuguese Brazil"},{symbol:"tr",label:"Turkish"},{symbol:"sv",label:"Swedish"},{symbol:"da",label:"Danish"},{symbol:"no",label:"Norwegian"},{symbol:"en-GB",label:"British English"}],this.isSupported=function(e){for(var t=0;t<this.names.length;++t)if(this.names[t].symbol===e)return!0;return!1},this.getSupported=function(e){const t=e.split("-");if(e=t[0].toLowerCase(),t.length>1){let i=t[1].toUpperCase();i.length>2&&(i=i[0]+i.substring(1).toLowerCase()),e+="-"+i}return this.isSupported(e)||(e=e.indexOf("zh-CN")>-1?"zh-Hans":e.indexOf("zh-TW")>-1?"zh-Hant":t.length>1&&this.isSupported(t[0].toLowerCase())?t[0]:"en"),e},this.getLanguages=function(){return this.names.slice()}};e.exports={Lang:t}},8600:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DISABLE_FORGE_CANVAS_LOGO:()=>l,DISABLE_FORGE_LOGO:()=>a,fromUrlSafeBase64:()=>y,getHtmlTemplate:()=>u,getParameterByName:()=>p,getParameterByNameFromPath:()=>m,getResourceUrl:()=>f,getScript:()=>c,injectCSS:()=>h,isExperimentalFlagEnabled:()=>d,stringToDOM:()=>g,toUrlSafeBase64:()=>v});var n=i(55280),r=(0,n.getGlobal)(),o=r,s=o&&o.document;r.LOCALIZATION_REL_PATH="",r.LMV_VIEWER_VERSION="7.99.1",r.LMV_BUILD_TYPE="Production",r.LMV_RESOURCE_ROOT="",r.LMV_IS_FLUENT_BUILD=!1,r.USE_OTG_DS_PROXY=!1,r.LMV_THIRD_PARTY_COOKIE=!(0,n.isNodeJS)()&&void 0,"v"===r.LMV_VIEWER_VERSION.charAt(0)&&(r.LMV_VIEWER_VERSION=r.LMV_VIEWER_VERSION.substr(1)),r.LMV_VECTOR_PDF=!1,r.LMV_RASTER_PDF=!0;let a=!1,l=!0;function c(e){e=e.toLowerCase();var t=s.getElementsByTagName("SCRIPT");if(t&&t.length>0)for(var i=0;i<t.length;++i)if(t[i].src&&-1!==t[i].src.toLowerCase().indexOf(e))return t[i];return null}function h(e,t,i){for(var n=e.indexOf("://")>0?e:f(e),r=s.getElementsByTagName("link"),o=0,a=r.length;o<a;o++)if(r[o].href===n)return void(t&&t());var l=s.createElement("link");l.setAttribute("rel","stylesheet"),l.setAttribute("type","text/css"),l.setAttribute("href",n),t&&(l.onload=t),i&&(l.onerror=i),s.head.appendChild(l)}function u(e,t){var i=e.indexOf("://")>0?e:f(e),n=new XMLHttpRequest;function r(e){t(e,null)}n.onload=function(e){var i=e.currentTarget.responseText;t(null,i)},n.onerror=r,n.ontimeout=r,n.open("GET",i,!0),n.send()}function d(e,t){return!(!t||!Array.isArray(t.experimental))&&-1!==t.experimental.indexOf(e)}function f(e){return r.LMV_RESOURCE_ROOT+e}function p(e){return"undefined"==typeof window?"":m(e,o.location.href)}function m(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null==i?"":decodeURIComponent(i[1].replace(/\+/g," "))}function g(e){var t=s.createElement("div");return t.innerHTML=e,t.firstChild}function v(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function y(e){for(e=(e=e.replace(/-/g,"+")).replace(/_/g,"/");e.length%4;)e+="=";return(0,n.isNodeJS)()?Buffer.from(e,"base64").toString():atob(e)}},1581:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AlertBox:()=>r});var n=i(38842);function r(){}r.instances=[],r.displayError=function(e,t,i,o,s,a){var l=e.ownerDocument,c=l.createElement("div");c.className="alert-box error",e.appendChild(c);var h=o;h||(h="img-item-not-found");var u=l.createElement("div");u.className="alert-box-image "+h,c.appendChild(u);var d=l.createElement("div");d.className="alert-box-msg",c.appendChild(d);var f=i;f||(f=n.A.t("Error Occurred",{defaultValue:"Error Occurred"}));var p=l.createElement("div");p.className="alert-box-title",p.textContent=f,p.setAttribute("data-i18n",f),d.appendChild(p);var m=l.createElement("div");if(m.className="alert-box-text",m.textContent=t,m.setAttribute("data-i18n",t),d.appendChild(m),s){var g=l.createElement("div");g.className="alert-box-content",d.appendChild(g);var v=l.createElement("ul");v.className="alert-box-content";for(var y=0;y<s.length;y++){var b=s[y];if(b){var x=l.createElement("li"),_=this.extractList(b);if(_.list.length){var E=this.generateListElement(list,l);v.appendChild(E)}x.innerHTML=_.msg,x.setAttribute("data-i18n",_.msg),v.appendChild(x)}}g.appendChild(v)}var S=l.createElement("div");S.className="alert-box-ok",S.textContent=n.A.t("OK",{defaultValue:"OK"});var A={alertBox:c,container:e,tag:a};S.addEventListener("click",(function(t){c.style.visibility="hidden",e.removeChild(c),r.instances.splice(r.instances.indexOf(A),1)})),c.appendChild(S),c.style.visibility="visible",r.instances.push(A)},r.displayErrors=function(e,t,i){var o=e.ownerDocument,s=o.createElement("div");s.className="alert-box errors",e.appendChild(s);var a=t;a||(a="img-item-not-found");var l=o.createElement("div");l.className="alert-box-image "+a,s.appendChild(l);var c=o.createElement("div");c.className="alert-box-msg errors",s.appendChild(c);for(var h=0;h<i.length;h++){var u=i[h].header;u||(u=n.A.t("Error",{defaultValue:"Error"}));var d=o.createElement("div");d.className="alert-box-title errors",d.textContent=u,c.appendChild(d);var f=o.createElement("div");f.className="alert-box-text errors";var p=i[h].msg;if((_=this.extractList(p)).list.length){var m=o.createElement("div"),g=this.generateListElement(_.list,o);m.appendChild(g),f.textContent=_.msg,f.appendChild(m)}else f.textContent=p;if(c.appendChild(f),i[h].hints){var v=o.createElement("ul");v.className="alert-box-content";for(var y=i[h].hints,b=0;b<y.length;b++){var x=y[b];if(x){var _,E=o.createElement("li");if(v.appendChild(E),(_=this.extractList(x)).list.length){g=this.generateListElement(_.list,o);v.appendChild(g)}E.innerHTML=_.msg}}c.appendChild(v)}}var S=o.createElement("div");S.className="alert-box-ok",S.textContent=n.A.t("OK",{defaultValue:"OK"});var A={alertBox:s,container:e};S.addEventListener("click",(function(t){s.style.visibility="hidden",e.removeChild(s),r.instances.splice(r.instances.indexOf(A),1)})),s.appendChild(S),s.style.visibility="visible",r.instances.push(A)},r.extractList=function(e){var t={msg:e,list:[]};if(e&&-1!=e.indexOf("<ul>")){var i=e.split("<ul>");t.msg=i[0],i=i[1].split("</ul>"),t.list=i[0].split(", "),1===t.list.length&&(t.list=i[0].split(","))}return t},r.generateListElement=function(e,t){for(var i=t.createElement("ul"),n=0;n<e.length;n++){var r=t.createElement("li");r.textContent=e[n],r.setAttribute("data-i18n",e[n]),i.appendChild(r)}return i},r.dismissByTag=function(e){var t=r.instances.findIndex((t=>t&&t.tag===e));if(-1==t)return!1;var i=r.instances[t];return i.alertBox.style.visibility="hidden",i.container.removeChild(i.alertBox),r.instances.splice(t,1),!0},r.dismiss=function(){if(r.instances.length>0){var e=r.instances.pop();return e.alertBox.style.visibility="hidden",e.container.removeChild(e.alertBox),!0}return!1}},86022:(e,t,i)=>{"use strict";i.r(t),i.d(t,{OptionButton:()=>u,OptionCheckbox:()=>c,OptionDropDown:()=>d,OptionLabel:()=>h,OptionRow:()=>p,OptionSlider:()=>l,ResizeFooter:()=>f,SimpleList:()=>m});var n=i(25004),r=i(38842),o=i(55280),s=i(26206);const a=i(41944);function l(e,t,i,n,o){var s=this;this.tbody=n;var a=o&&o.insertAtIndex?o.insertAtIndex:-1;this.hideStepper=o&&o.hideStepper;var l=o&&o.hideCaption;this.sliderRow=this.tbody.insertRow(a),this.sliderRow.classList.add("switch-slider-row");var c=this.getDocument(),h=this.sliderRow.insertCell(0);function u(e){e.target!=s.stepperElement&&(s.stepperElement.value=s.sliderElement.value),s.fireChangeEvent()}this.caption=c.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e),l&&(this.caption.style.display="none"),h.appendChild(this.caption),h=this.sliderRow.insertCell(1),this.sliderElement=c.createElement("input"),this.sliderElement.type="range",this.sliderElement.id=e+"_slider",this.sliderElement.min=t,this.sliderElement.max=i,this.sliderElement.style.width="85%",h.appendChild(this.sliderElement),h=this.sliderRow.insertCell(2),this.stepperElement=c.createElement("input"),this.stepperElement.type="number",this.stepperElement.id=e+"_stepper",this.stepperElement.min=t,this.stepperElement.max=i,this.stepperElement.step=1,this.stepperElement.style.width="64px",this.hideStepper&&(this.stepperElement.style.display="none"),h.appendChild(this.stepperElement),this.blockEvent=!1,this.stepperElement.addEventListener("change",(function(e){e.target!=s.sliderElement&&(s.sliderElement.value=s.stepperElement.value),s.fireChangeEvent()}),!1),this.sliderElement.addEventListener("change",u,!1),this.sliderElement.addEventListener("input",u,!1)}function c(e,t,i,n,s,l){var c=this;this.tbody=t;var h=l&&l.insertAtIndex?l.insertAtIndex:-1;this.sliderRow=this.tbody.insertRow(h),this.sliderRow.classList.add("switch-slider-row");var u=this.getDocument(),d=this.sliderRow.insertCell(0);if(this.caption=u.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e,null==l?void 0:l.i18nOptions),d.appendChild(this.caption),l&&!0===l.betaLabel){let e=u.createElement("div");e.setAttribute("data-i18n","BETA"),e.textContent=r.A.t("BETA",null==l?void 0:l.i18nOptions),e.classList.add("switch-slider-row-beta-label"),this.caption.appendChild(e)}d=this.sliderRow.insertCell(1),n&&(this.description=u.createElement("div"),this.description.setAttribute("data-i18n",n),this.description.textContent=r.A.t(n,null==l?void 0:l.i18nOptions),d.appendChild(this.description),d=this.sliderRow.insertCell(2));var f=u.createElement("label");f.classList.add("switch"),this.checkElement=u.createElement("input"),this.checkElement.type="checkbox",this.checkElement.id=e+"_check",this.checkElement.checked=i,f.appendChild(this.checkElement);var p=u.createElement("div");p.classList.add("slider"),f.appendChild(p),d.appendChild(f),this.blockEvent=!1,this.checked=i,this.checkElement.addEventListener("change",(function(e){c.fireChangeEvent()}),!1),(0,o.isTouchDevice)()&&(this.sliderRowHammer=new a.Manager(this.sliderRow,{recognizers:[[a.Tap]],handlePointerEventMouse:!1,inputClass:a.TouchInput}),this.sliderRowHammer.on("tap",(function(e){e.preventDefault(),e.target.click()}))),this.checkElement.addEventListener("click",(function(e){e.stopPropagation()}),!1),this.sliderRow.addEventListener("click",(function(e){c.checkElement.disabled||(c.checkElement.checked=!c.checkElement.checked,c.fireChangeEvent())}),!1),s&&this.setGlobalManager(s)}function h(e,t,i,n){this.tbody=t;var o=n&&n.insertAtIndex?n.insertAtIndex:-1;this.sliderRow=this.tbody.insertRow(o);var s=this.getDocument(),a=this.sliderRow.insertCell(0);this.caption=s.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e),a.appendChild(this.caption),a.colSpan="3",this.blockEvent=!1,this.removeFromParent=function(){this.tbody.removeChild(this.sliderRow),this.tbody=null,this.sliderRow=null,this.caption=null}}function u(e,t,i,n){this.tbody=t;var o=n&&n.insertAtIndex?n.insertAtIndex:-1;this.sliderRow=this.tbody.insertRow(o),this.sliderRow.insertCell();var s=this.sliderRow.insertCell();this.sliderRow.insertCell();var a=this.getDocument();this.caption=a.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e),this.caption.classList.add("adsk-button"),this.caption.classList.add("table-button"),s.appendChild(this.caption),this.removeFromParent=function(){this.tbody.removeChild(this.sliderRow),this._onClick&&(this.caption.removeEventListener("click",this._onClick),this._onClick=null),this.tbody=null,this.sliderRow=null,this.caption=null},this.setOnClick=function(e){this._onClick=e,this.caption.addEventListener("click",e,!1)}}function d(e,t,i,n,o,s,a){var l=this;this.tbody=t;var c=a&&a.insertAtIndex?a.insertAtIndex:-1;this.sliderRow=this.tbody.insertRow(c);var h=this.getDocument();this.dropdownElement=h.createElement("select"),this.dropdownElement.id=e+"_dropdown",this.dropdownElement.classList.add("option-drop-down");for(var u=0;u<i.length;u++){var d=h.createElement("option");d.value=u,d.setAttribute("data-i18n",i[u]),d.textContent=r.A.t(i[u]),this.dropdownElement.add(d)}this.selectedIndex=this.dropdownElement.selectedIndex=n;var f=this.sliderRow.insertCell(0);this.caption=h.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e),f.appendChild(this.caption),o?(f.colSpan="2",this.sliderRow=this.tbody.insertRow(c),(f=this.sliderRow.insertCell(0)).appendChild(this.dropdownElement),f.colSpan="2",this.dropdownElement.classList.add("tabcell")):(f=this.sliderRow.insertCell(1)).appendChild(this.dropdownElement),f.style.paddingLeft=(a&&void 0!==a.paddingLeft?a.paddingLeft:5)+"px",f.style.paddingRight=(a&&void 0!==a.paddingRight?a.paddingRight:5)+"px",this.blockEvent=!1,this.dropdownElement.addEventListener("change",(function(e){l.fireChangeEvent()}),!1)}function f(e,t,i){this.resizeCallback=t;var n=this.getDocument(),r=n.createElement("div");r.classList.add("docking-panel-footer");var o=n.createElement("div");o.classList.add("docking-panel-footer-resizer"),r.appendChild(o);var s=!1,a=e.getBoundingClientRect(),l={x:0,y:0},c=n.createElement("div");c.classList.add("adsk-viewing-viewer"),c.classList.add("docking-panel-resize-overlay");var h=function(t){s=!0,a=e.getBoundingClientRect(),this.getDocument().body.appendChild(c),this.addDocumentEventListener("touchmove",d),this.addDocumentEventListener("touchcancel",u),this.addDocumentEventListener("touchend",u),this.addDocumentEventListener("mousemove",d),this.addDocumentEventListener("mouseup",u),t.preventDefault(),t.stopPropagation()};h=h.bind(this);var u=function(e){var t=this.getDocument();t.body.contains(c)&&(t.body.removeChild(c),this.removeDocumentEventListener("touchmove",d),this.removeDocumentEventListener("touchcancel",u),this.removeDocumentEventListener("touchend",u),this.removeDocumentEventListener("mousemove",d),this.removeDocumentEventListener("mouseup",u),e.preventDefault(),e.stopPropagation())};u=u.bind(this);var d=function(t){"touchmove"===t.type&&(t.canvasX=t.touches[0].screenX,t.canvasY=t.touches[0].screenY),s&&(s=!1,l.x=t.canvasX||t.clientX,l.y=t.canvasY||t.clientY);var i=(t.canvasX||t.clientX)-l.x,n=(t.canvasY||t.clientY)-l.y,r=parseInt(a.width+i),o=parseInt(a.height+n);e.style.width=r+"px",e.style.height=o+"px",this.resizeCallback&&this.resizeCallback(r,o),t.preventDefault(),t.stopPropagation()};d=d.bind(this),o.addEventListener("touchstart",h),o.addEventListener("mousedown",h),e.style.resize="none",e.appendChild(r),this.footer=r,this.resizer=o}function p(e,t,i,n,o){this.tbody=t;var s=o&&o.insertAtIndex?o.insertAtIndex:-1;this.sliderRow=this.tbody.insertRow(s),this.sliderRow.classList.add("switch-slider-row");var a=this.getDocument(),l=this.sliderRow.insertCell(0);this.caption=a.createElement("div"),this.caption.setAttribute("data-i18n",e),this.caption.textContent=r.A.t(e),l.appendChild(this.caption),l=this.sliderRow.insertCell(1),i&&(this.description=a.createElement("div"),this.description.setAttribute("data-i18n",i),this.description.textContent=r.A.t(i),l.appendChild(this.description),l=this.sliderRow.insertCell(2))}l.prototype.constructor=l,n.EventDispatcher.prototype.apply(l.prototype),l.prototype.fireChangeEvent=function(){if(!this.blockEvent){this.value=this.sliderElement.value;var e=new CustomEvent("change",{detail:{target:this,value:this.sliderElement.value}});this.dispatchEvent(e)}},l.prototype.setValue=function(e){this.blockEvent=!0,this.value=e,this.sliderElement.value=e,this.stepperElement.value=e,this.blockEvent=!1},l.prototype.setDisabled=function(e){this.sliderElement.disabled=e,this.stepperElement.disabled=e,this.caption.disabled=e},s.GlobalManagerMixin.call(l.prototype),c.prototype.constructor=c,n.EventDispatcher.prototype.apply(c.prototype),s.GlobalManagerMixin.call(c.prototype),c.prototype.fireChangeEvent=function(){if(!this.blockEvent){this.checked=this.checkElement.checked;var e=new CustomEvent("change",{detail:{target:this,value:this.checkElement.checked}});this.dispatchEvent(e)}},c.prototype.setChecked=function(e){this.checkElement.checked!=e&&(this.checkElement.checked=e,this.fireChangeEvent())},c.prototype.setValue=function(e){this.blockEvent=!0,this.checked=e,this.checkElement.checked=e,this.blockEvent=!1},c.prototype.getValue=function(){return this.checkElement.checked},c.prototype.setDisabled=function(e){this.checkElement.disabled=e,this.caption.disabled=e},c.prototype.setVisibility=function(e){this.sliderRow.style.display=e?"table-row":"none"},s.GlobalManagerMixin.call(h.prototype),s.GlobalManagerMixin.call(u.prototype),d.prototype.constructor=d,n.EventDispatcher.prototype.apply(d.prototype),d.prototype.setSelectedIndex=function(e){this.blockEvent=!0,this.selectedIndex=this.dropdownElement.selectedIndex=e,this.blockEvent=!1},d.prototype.setSelectedValue=function(e){this.blockEvent=!0,this.dropdownElement.selectedValue=e,this.selectedIndex=this.dropdownElement.selectedIndex,this.blockEvent=!1},d.prototype.fireChangeEvent=function(){if(!this.blockEvent){this.selectedIndex=this.dropdownElement.selectedIndex;var e=new CustomEvent("change",{detail:{target:this,value:this.selectedIndex}});this.dispatchEvent(e)}},d.prototype.setDisabled=function(e){this.dropdownElement.disabled=e,this.caption.disabled=e},s.GlobalManagerMixin.call(d.prototype),s.GlobalManagerMixin.call(f.prototype),s.GlobalManagerMixin.call(p.prototype);class m{constructor(e,t,i){this._parentDiv=e,this._renderRowFn=t,this._onClickFn=i,this._onRowClick=this._onRowClick.bind(this);const n=this.getDocument(),r=n.createElement("div");r.classList.add("settings-container"),this._parentDiv.appendChild(r),this._myContainer=r,this._myContainer.addEventListener("click",this._onRowClick,{capture:!0});const o=n.createElement("div");o.classList.add("settings-table"),this._rowsContainer=o,r.appendChild(o)}setData(e,t){this._removeAllRows(),this._items=e;for(let t=0;t<e.length;++t)this._addRow(t);this._updateSelection(t)}removeFromParent(){this._myContainer.removeEventListener("click",this._onRowClick,{capture:!0}),this._removeAllRows(),this._parentDiv.removeChild(this._myContainer),this._parentDiv=null,this._myContainer=null,this._rowsContainer=null,this._onClickFn=null,this._items=null}_addRow(e){const t=this._items[e],i=this.getDocument(),n=i.createElement("div");this._renderRowFn(n,t,{domDocument:i}),n.setAttribute("data-index",e),this._rowsContainer.appendChild(n)}_removeAllRows(){for(var e=this._rowsContainer.children;e.length;)this._rowsContainer.removeChild(e[0])}_updateSelection(e){const t=this._rowsContainer.children;for(let i=0;i<t.length;i++){const n=t[i];i===e?n.classList.add("border-select"):n.classList.remove("border-select")}}_onRowClick(e){for(var t,i=e.target;i!==this._myContainer&&!(t=i.getAttribute("data-index"));)i=i.parentNode;if(t){var n=parseInt(t);this._onClickFn(n)}}}s.GlobalManagerMixin.call(m.prototype)},26452:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ContextMenu:()=>l});var n=i(55280),r=i(83081),o=i(38842),s=i(26206),a=i(24840);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.viewer=e,this.setGlobalManager(e.globalManager),this.menus=[],this.container=null,this.open=!1,this._onDOMevent=this._onDOMevent.bind(this),this.onHide=t.onHide}l.prototype.constructor=l,s.GlobalManagerMixin.call(l.prototype),l.prototype.show=function(e,t){var i=this.viewer.container.getBoundingClientRect();Array.isArray(e.changedPointers)&&e.changedPointers.length>0&&(e.clientX=e.changedPointers[0].clientX,e.clientY=e.changedPointers[0].clientY);var n=e.clientX-i.left,r=e.clientY-i.top;this.open||(this.showMenu(t,n,r),this.open=!0),this._startX=e.clientX,this._startY=e.clientY},l.prototype.showMenu=function(e,t,i,o){var s,a=[],l=this.getDocument(),c=l.createElement("div");c.style.left="0",c.style.top="0",c.style.width="100%",c.style.height="100%",c.style.position="absolute",c.style.zIndex="10";var h=l.createElement("div");h.classList.add("menu"),h.classList.add("docking-panel"),h.classList.add("docking-panel-container-solid-color-a"),c.appendChild(h),this.viewer.container.appendChild(c),this.container=c,this.menus.push(h);let u=!1;for(var d=0;d<e.length;++d){var f=e[d],p=f.title,m=f.target,g=f.icon,v=f.shortcut,y=f.divider;let t=Array.isArray(m);t&&!e.isChild?u=!0:t=!1,y?(s=this.createDivider(),h.appendChild(s)):(s=this.createMenuItem(p,g,v,t),h.appendChild(s),"function"==typeof m?this.addCallbackToMenuItem(s,m):t?a.push({menuItem:s,target:m}):r.logger.warn("Invalid context menu option:",p,m))}if(!u){const e=h.children;for(let t=0;t<e.length;t++){const i=e[t],n=i.getElementsByClassName("menu-item-expand");n.length>0&&i.removeChild(n[0])}}var b=h.getBoundingClientRect(),x=b.width,_=b.height,E=this.viewer.container.getBoundingClientRect(),S=E.width,A=E.height;(o=!!o||(0,n.isTouchDevice)()&&!this.viewer.navigation.getUseLeftHandedInput())&&(t-=x),t<0&&(t=0),S<t+x&&(t=S-x)<0&&(t=0),i<0&&(i=0),A<i+_&&(i=A-_)<0&&(i=0),h.style.top=Math.round(i)+"px",h.style.left=Math.round(t)+"px";const w=(e,t)=>{const i=e.getElementsByClassName("menu-item-expand");e.removeChild(i[0]);const n=e.getElementsByClassName("menu-item-icon");n.length>0&&e.insertBefore(n[0],e.childNodes[e.length-1]),this.setMenuExpand(e,!0,t)};let T=!1;for(d=0;d<a.length;++d){var M=a[d];const e=(s=M.menuItem).getBoundingClientRect(),n=this.viewer.container.getBoundingClientRect(),r=e.right-e.left;T=n.right-e.right<r||o,T&&w(s,!0),t=Math.round((T?e.left:e.right)-n.left),i=Math.round(e.top-n.top),this.addSubmenuCallbackToMenuItem(s,M.target,t,i,T)}if(a.length>0&&T){const e=h.children;for(let t=0;t<e.length;t++){const i=e[t];i.children.length>2&&-1!==i.children[2].className.indexOf("menu-item-expand")&&w(i,!1)}}this.container.addEventListener("touchend",this._onDOMevent),this.container.addEventListener("mousedown",this._onDOMevent),this.container.addEventListener("mouseup",this._onDOMevent),(0,n.isTouchDevice)()||this.container.addEventListener("mousemove",this._onDOMevent)},l.prototype._onDOMevent=function(e){switch(e.type){case"touchend":this._isContextMenu(e)||this.hide();break;case"mousedown":this._startX=e.clientX,this._startY=e.clientY;break;case"mouseup":this._isContextMenu(e)||(this.hide(),a.EventUtils.isRightClick(e)&&e.clientX===this._startX&&e.clientY===this._startY&&this.viewer.triggerContextMenu(e));break;case"mousemove":{if(!this.currentItem||this.menus.length<2)break;const t=this._isInside(e,this.currentItem),i=this._isInside(e,this.menus[1]);t||i?this.currentItem.backgroundColor&&(this.currentItem.style.backgroundColor=this.currentItem.backgroundColor):(this.hideMenu(this.menus[1]),this.currentItem.style.backgroundColor=null,this.currentItem=null);break}}},l.prototype.createMenuItem=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=this.getDocument().createElement("div");return r.className="menu-item",i=i||"",this.setMenuItemIcon(r,t),this.setMenuItemText(r,e),this.setMenuExpand(r,!1,n),this.setMenuItemShortcut(r,i),r},l.prototype.createDivider=function(){var e=this.getDocument(),t=e.createElement("div");t.className="menu-divider-container";var i=e.createElement("div");return i.className="menu-divider",t.appendChild(i),t},l.prototype.setMenuItemIcon=function(e,t){var i=this.getDocument().createElement("div");i.classList.add("menu-item-icon"),t&&i.classList.add(t),e.appendChild(i)},l.prototype.setMenuItemText=function(e,t){var i=this.getDocument().createElement("div");i.classList.add("menu-item-text"),i.setAttribute("data-i18n",t),i.textContent=o.A.t(t),e.appendChild(i)},l.prototype.setMenuItemShortcut=function(e,t){var i=this.getDocument().createElement("div");i.classList.add("menu-item-shortcut"),i.textContent=t,e.appendChild(i)},l.prototype.setMenuExpand=function(e,t,i){var n=this.getDocument().createElement("div");n.classList.add("menu-item-expand"),t?(n.style.transform="scale(-1)",e.insertBefore(n,e.childNodes[0])):e.appendChild(n);const r=0|i;n.style.opacity=r},l.prototype.addCallbackToMenuItem=function(e,t){var i=this;e.addEventListener("click",(function(e){return i.hide(),t(),e.preventDefault(),!1}),!1)},l.prototype.addSubmenuCallbackToMenuItem=function(e,t,i,r,o){var s=this;t.isChild=!0,(0,n.isTouchDevice)()?e.addEventListener("click",(function(){s.open=!0,s.currentItem=e,s.showMenu(t,i,r,o)}),!1):e.addEventListener("mouseenter",(function(){s.open=!0,s.currentItem=e;const n=s.getWindow().getComputedStyle(s.currentItem).getPropertyValue("background-color");s.currentItem.backgroundColor=n,s.showMenu(t,i,r,o)}),!1)},l.prototype.hideMenu=function(e){const t=e=>{e.removeEventListener("touchend",this._onDOMevent),e.removeEventListener("mousedown",this._onDOMevent),e.removeEventListener("mouseup",this._onDOMevent),(0,n.isTouchDevice)()||e.removeEventListener("mousemove",this._onDOMevent),e.parentNode.removeChild(e)};e&&-1!==this.menus.indexOf(e)&&e.parentNode&&(t(e.parentNode),this.menus.splice(this.menus.indexOf(e),1)),0===this.menus.length?(this.open=!1,this.container=null):1===this.menus.length&&(this.container=this.menus[0].parentNode)},l.prototype.hide=function(){if(this.open){for(;this.menus.length>0;)this.hideMenu(this.menus[0]);return this.onHide&&this.onHide(),!0}return!1},l.prototype._isContextMenu=function(e){for(let i=0;i<this.menus.length;i++){const n=this.menus[i];for(var t=e.target;t!==this.container;){if(t===n)return!0;t=t.parentNode}}return!1},l.prototype._isInside=function(e,t){var i=this.viewer.container.getBoundingClientRect();Array.isArray(e.changedPointers)&&e.changedPointers.length>0&&(e.clientX=e.changedPointers[0].clientX,e.clientY=e.changedPointers[0].clientY);var n=Math.ceil(e.clientX-i.left),r=Math.ceil(e.clientY-i.top);const o=t.getBoundingClientRect(),s=Math.floor(o.top-i.top)-1,a=Math.floor(o.left-i.left)-1,l=Math.ceil(o.bottom-i.top),c=Math.ceil(o.right-i.left);return r>=s&&r<=l&&n>=a&&n<=c}},82024:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DataTable:()=>o});var n=i(8939);const r=Autodesk.Viewing.UI;function o(e){if(!(e instanceof r.DockingPanel))throw new Error("Invalid docking panel");this.dockingPanel=e;let t=this.dockingPanel.getDocument();this.datatableDiv=t.createElement("div"),this.datatableDiv.setAttribute("id","datatable"),this.datatableDiv.setAttribute("class","datatable"),e.container.appendChild(this.datatableDiv),e.footerInstance&&(e.footerInstance.resizeCallback=this._fitHeaderColumns.bind(this)),this.groupedByColumn=!1,this.aggregated=!1}o.prototype._createColumns=function(e){let t=this.dockingPanel.getDocument();var i=t.createElement("div");i.setAttribute("id","columnArea"),i.setAttribute("class","clusterize-headers");var n='<table id="headersArea"><thead><tr id ="columnRow"></tr></thead></table>';i.innerHTML=n,this.datatableDiv.appendChild(i);var r=i.querySelector("tr");e.forEach((function(e){var i=t.createElement("th");i.appendChild(t.createTextNode(e)),r.appendChild(i)})),n=this.datatableDiv.querySelector("table"),this._makeTableSortable(n)},o.prototype._createRows=function(){var e=this.dockingPanel.getDocument().createElement("div");e.innerHTML='<div id="scrollArea" class="clusterize-scroll"><table id="bodyArea" class="table-striped"><tbody id="contentArea" class="clusterize-content"><tr class="clusterize-no-data"><td>Loading data…</td></tr></tbody></table></div>',this.datatableDiv.appendChild(e)},o.prototype.setData=function(e,t){if(t.length!==e[0].length)throw new Error("Column length should be same as the row length");this._createColumns(t),this._createRows();var i=this;this.rowData=e,this.clusterize=new n({rows:this.rowData.map((function(e){return"<tr>"+e.map((function(e){return"<td>"+e+"</td>"})).join(" ")+"</tr>"})),scrollId:"scrollArea",contentId:"contentArea",callbacks:{clusterChanged:function(){i._fitHeaderColumns(),i._syncHeaderWidth(),i.groupedByColumn&&i._updateClusterGroup()}}}),this.datatableDiv.querySelector(".clusterize-scroll").addEventListener("scroll",(function(){var e=this.scrollLeft;r(e)}));var r=function(e){i.datatableDiv.querySelector("#headersArea").style.setProperty("margin-left",-e+"px")}},o.prototype.destroyTable=function(){this.clusterize.destroy(!0),this.clusterize=null,this.rowData=null,this.groupedByColumn=!1},o.prototype._makeTableSortable=function(e){var t,i=this,n=e.tHead;if(n&&n.rows[0]&&(n=n.rows[0].cells),n)for(t=n.length;--t>=0;)!function(e){var t=1;n[e].addEventListener("click",(function(){i._sortTable(e,t=1-t)}))}(t)},o.prototype._sortTable=function(e,t){var i=this.rowData;this.sortFunction||this.restoreDefaultSortFunction();var n=this.sortFunction&&this.sortFunction.bind(this),r=(i=i.sort(n(e,t))).map((function(e){return"<tr>"+e.map((function(e){return"<td>"+e+"</td>"})).join(" ")+"</tr>"}));this.clusterize.update(r);var o=this.datatableDiv.querySelector("#bodyArea");o.classList.contains("table-striped")||o.classList.add("table-striped")},o.prototype.setSortFunction=function(e){this.sortFunction=e},o.prototype.getSortFunction=function(){return this.sortFunction},o.prototype.restoreDefaultSortFunction=function(){this.sortFunction=function(e,t){return t=-(+t||-1),function(i,n){return t*i[e].localeCompare(n[e])}}},o.prototype.getGroupByColumn=function(e){var t=this.rowData,i={};for(let r=0;r<t.length;r++){var n=t[r][e];i[n]||(i[n]=[]),i[n].push(r)}return i},o.prototype.groupByColumn=function(e){var t=this.rowData,i={};for(let r=0;r<t.length;r++){let o=t[r];var n=o[e];if(i[n]||(i[n]=[]),i[n].length>0)o="<tr class= 'subrow'>"+o.map((function(e){return"<td>"+e+"</td>"})).join(" ")+"</tr>";else{const e=o.length;o="<tr class= 'parentrow'>"+o.map((function(t,i){return e===i+1?"<td>"+t+'<span value="click"></span></td>':"<td>"+t+"</td>"})).join(" ")+"</tr>"}i[n].push(o)}var r=[];for(let e in i){var o=i[e];for(let e=0;e<o.length;e++){let t=o[e];r.push(t)}}this.clusterize.update(r);var s=this.datatableDiv.querySelector("#bodyArea");s.classList.contains("table-striped")&&s.classList.remove("table-striped"),this.datatableDiv.querySelectorAll(".subrow").forEach((e=>{this._slideDown(e),e.style.fontSize="14px"}));var a=this._fitHeaderColumns.bind(this),l=this._expandContent.bind(this);this.datatableDiv.querySelectorAll("span").forEach((e=>{e.addEventListener("click",(function(e){l(this,e),a()}))})),this._fitHeaderColumns(),this.groupedByColumn||(this.groupedByColumn=!0)},o.prototype._updateClusterGroup=function(){var e=this._fitHeaderColumns.bind(this),t=this._expandContent.bind(this);this.datatableDiv.querySelectorAll("span").forEach((i=>{i.addEventListener("click",(function(i){t(this,i),e()}))})),this.datatableDiv.querySelectorAll(".subrow").forEach((e=>{this._slideDown(e),e.style.fontSize="14px"}))},o.prototype._expandContent=function(e){var t=!1;"collapsed"===e.className&&(t=!0);var i=t?14:0,n=e.closest("tr"),r=this._nextUntil(n,":not(.subrow)");for(let e=0;e<r.length;e++)this._slideToggle(r[e],500),r[e].style.fontSize=i+"px";e.classList.toggle("collapsed")},o.prototype._nextUntil=function(e,t,i){var n=[];for(e=e.nextElementSibling;e&&!e.matches(t);)!i||e.matches(i)?(n.push(e),e=e.nextElementSibling):e=e.nextElementSibling;return n},o.prototype._slideToggle=function(e,t){return"none"===this.dockingPanel.getWindow().getComputedStyle(e).display?this._slideDown(e,t):this._slideUp(e,t)},o.prototype._slideUp=function(e,t){e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.boxSizing="border-box",e.style.height=e.offsetHeight+"px",e.offsetHeight,e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.style.display="none",e.style.removeProperty("height"),e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")},o.prototype._slideDown=function(e,t){let i=this.dockingPanel.getWindow();e.style.removeProperty("display");let n=i.getComputedStyle(e).display;"none"===n&&(n="block"),e.style.display=n;e.style.overflow="hidden",e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0,e.style.marginTop=0,e.style.marginBottom=0,e.offsetHeight,e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=t+"ms",e.style.height="21pxpx",e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),i.setTimeout((()=>{e.style.removeProperty("height"),e.style.removeProperty("overflow"),e.style.removeProperty("transition-duration"),e.style.removeProperty("transition-property")}),t)},o.prototype.getAggregate=function(e,t){var i,n=this.rowData,r=null;switch(e){case"MIN":r=function(){var e=n[0][t];for(let i=1;i<n.length;i++)e>n[i][t]&&(e=n[i][t]);return e||0}();break;case"MAX":r=function(){var e=n[0][t];for(let i=1;i<n.length;i++)e<n[i][t]&&(e=n[i][t]);return e||0}();break;case"SUM":r=o();break;case"AVG":i=o()/n.length,r=(i=parseFloat(i))||0;break;case"COUNT":r=n.length}return r;function o(){var e=0;for(let i=0;i<n.length;i++)e+=parseFloat(n[i][t]);return e||0}},o.prototype.aggregate=function(e,t){var i=this.datatableDiv.querySelector(".clusterize-content").querySelector("tr:not(.clusterize-extra-row):not(.first)");if(!i)return;for(var n=[],r=0;r<i.children.length;r++)n.push(i.children[r].clientWidth);var o=this.getAggregate(e,t);let s=this.dockingPanel.getDocument();if(!this.aggregated){var a=s.createElement("div");a.setAttribute("id","aggregate"),a.setAttribute("class","aggregate-headers");a.innerHTML='<table id="aggregateArea"><tbody></tbody></table>',this.datatableDiv.appendChild(a)}for(var l=this.datatableDiv.querySelector("#aggregateArea"),c=0;c<l.rows.length;c++){if(l.rows[c].cells[t].innerText.indexOf(e)>-1)return}for(var h=0;h<l.rows.length;h++){var u=l.rows[h].cells[t];if(0===u.innerText.length)return u.appendChild(s.createTextNode(e+": ")),void u.appendChild(s.createTextNode(o))}for(var d=l.insertRow(l.rows.length),f=0;f<n.length;f++){var p=s.createElement("td");d.appendChild(p),p.style.setProperty("min-width",n[f]+"px","important"),f===t&&(p.appendChild(s.createTextNode(e+": ")),p.appendChild(s.createTextNode(o)))}this.aggregated=!0},o.prototype.clearAggregates=function(){for(var e=this.datatableDiv.querySelectorAll(".aggregate-headers"),t=0;t<e.length;t++)e[t].parentNode.removeChild(e[t])},o.prototype._fitHeaderColumns=function(){var e=this.datatableDiv.querySelector(".clusterize-content"),t=this.datatableDiv.querySelector("#headersArea"),i=e.querySelector("tr:not(.clusterize-extra-row):not(.first)");if(i){for(var n=[],r=[],o=0;o<i.children.length;o++)r.push(i.children[o].clientWidth);if(r.toString()!=n.toString()){for(var s=t.querySelector("tr"),a=0;a<s.children.length;a++)s.children[a].style.setProperty("clientWidth",r[a]+"px","important"),s.children[a].style.setProperty("min-width",r[a]+"px","important");if(this.aggregated)for(var l=this.datatableDiv.querySelector("#aggregateArea"),c=0;c<l.rows.length;c++)for(var h=l.rows[c],u=0;u<h.children.length;u++)h.children[u].style.setProperty("clientWidth",r[u]+"px","important"),h.children[u].style.setProperty("min-width",r[u]+"px","important");n=r}}},o.prototype._syncHeaderWidth=function(){var e=this.datatableDiv.querySelector(".clusterize-content"),t=this.datatableDiv.querySelector("#headersArea");t.style.setProperty("clientWidth",e.width),t.style.setProperty("min-idth",e.width)}},96551:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DockingPanel:()=>o});var n=i(38842),r=i(86022);function o(e,t,i,n){this.kMinWdth=100,this.kMinHeight=100,this.visibilityCallbacks=[],this.movedSinceLastClick=!1,this.movedSinceCreate=!1,this.parentContainer=e;var r=this.getDocument();this.container=r.createElement("div"),this.container.id=t,this.container.lastWidth="",this.container.dockRight=!1,this.container.dockBottom=!1,this.titleLabel=i,n=n||{},Object.prototype.hasOwnProperty.call(n,"localizeTitle")||(n.localizeTitle=!0),Object.prototype.hasOwnProperty.call(n,"addFooter")||(n.addFooter=!0),this.options=n,this.container.classList.add("docking-panel"),e.appendChild(this.container),this.listeners=[],this.initialize(),this.setVisible(!1)}i(26206).GlobalManagerMixin.call(o.prototype),o.prototype.onSetGlobalManager=function(e){this.footerInstance&&this.footerInstance.setGlobalManager(e)},o.prototype.initialize=function(){this.title=this.createTitleBar(this.titleLabel||this.container.id),this.container.appendChild(this.title),this.initializeMoveHandlers(this.title),this.setTitle(this.titleLabel||this.container.id,this.options),this.closer=this.createCloseButton(),this.container.appendChild(this.closer),this.options.addFooter&&(this.footer=this.createFooter(),this.container.appendChild(this.footer))},o.prototype.uninitialize=function(){for(var e=0;e<this.listeners.length;++e){var t=this.listeners[e];t.target.removeEventListener(t.eventId,t.callback)}this.listeners=[],this.visibilityCallbacks=[],this.parentContainer.removeChild(this.container),this.parentContainer=null,this.container=null,this.title=null,this.closer=null},o.prototype.addVisibilityListener=function(e){this.visibilityCallbacks.push(e)},o.prototype.setVisible=function(e){if(e){var t=this.getContainerBoundingRect();if(this.container.dockRight){var i=t.width,n=300,r=this.container.lastWidth||this.container.style.width;r||(r=this.container.getBoundingClientRect().width),r&&(n=parseInt(r)),this.container.style.left=i-n+"px"}if(this.container.dockBottom){var o=t.height,s=300,a=this.container.lastHeight||this.container.style.height;a||(a=this.container.getBoundingClientRect().height),a&&(s=parseInt(a));var l=o-s;this.container.style.top=l>0?l+"px":0}this.container.style.maxHeight=t.height+"px",this.container.style.maxWidth=t.width+"px",this.container.style.display="block",this.bringToFront()}else this.container.lastWidth=this.container.style.width,this.container.lastHeight=this.container.style.height,this.container.style.display="none";for(var c=0;c<this.visibilityCallbacks.length;c++)this.visibilityCallbacks[c](e)},o.prototype.isVisible=function(){return"block"===this.container.style.display},o.prototype.visibilityChanged=function(){},o.prototype.initializeMoveHandlers=function(e){var t,i,n,r,o,s,a,l,c=this.container,h=this;function u(e){var u=c.style.minWidth?parseInt(c.style.minWidth):h.kMinWdth,d=c.style.minHeight?parseInt(c.style.minHeight):h.kMinHeight,f=h.getContainerBoundingRect();c.style.maxWidth&&parseInt(c.style.width)>parseInt(c.style.maxWidth)&&(c.style.width=c.style.maxWidth),c.style.maxHeight&&parseInt(c.style.height)>parseInt(c.style.maxHeight)&&(c.style.height=c.style.maxHeight),parseInt(c.style.width)<u&&(c.style.width=u+"px"),parseInt(c.style.height)<d&&(c.style.height=d+"px"),"touchmove"===e.type&&(e.screenX=e.touches[0].screenX,e.screenY=e.touches[0].screenY),a+=e.screenX-n,l+=e.screenY-r,t=o+a,i=s+l;var p=parseInt(c.style.width),m=parseInt(c.style.height);isNaN(p)&&(p=h.container.getBoundingClientRect().width),isNaN(m)&&(m=h.container.getBoundingClientRect().height),t<5&&(t=0),i<5&&(i=0),c.dockRight=!1,c.dockBottom=!1,f.width-5<t+p&&(t=f.width-p,c.dockRight=!0),f.height-5<i+m&&(i=f.height-m,c.dockBottom=!0),c.style.left=t+"px",c.style.top=i+"px",c.style.maxWidth=f.width-t+"px",c.style.maxHeight=f.height-i+"px",n=e.screenX,r=e.screenY,h.onMove(e,t,i)}function d(e){h.removeWindowEventListener("mousemove",u),h.removeWindowEventListener("mouseup",d),h.removeWindowEventListener("touchmove",u),h.removeWindowEventListener("touchend",d),h.onEndMove(e,t,i)}function f(e){"touchstart"===e.type&&(e.screenX=e.touches[0].screenX,e.screenY=e.touches[0].screenY),n=e.screenX,r=e.screenY,a=0,l=0,o=h.container.offsetLeft,s=h.container.offsetTop,h.addWindowEventListener("mousemove",u,!1),h.addWindowEventListener("mouseup",d,!1),h.addWindowEventListener("touchmove",u,!1),h.addWindowEventListener("touchend",d,!1),e.preventDefault(),h.onStartMove(e,o,s)}h.addEventListener(e,"mousedown",f),h.addEventListener(e,"touchstart",f)},o.prototype.initializeCloseHandler=function(e){var t=this;t.addEventListener(e,"click",(function(){t.setVisible(!1)}),!1)},o.prototype.createScrollContainer=function(e){var t=this.getDocument().createElement("div"),i=t.classList;return i.add("docking-panel-scroll"),i.add("docking-panel-container-solid-color-a"),i.add(e&&e.left?"left":"right"),e&&e.heightAdjustment&&(t.style.height="calc(100% - "+e.heightAdjustment+"px)"),e&&e.marginTop&&(t.style.marginTop=e.marginTop+"px"),t.id=this.container.id+"-scroll-container",this.container.appendChild(t),this.scrollContainer=t,this.scrollEaseCurve=e&&e.scrollEaseCurve||[0,0,.29,1],this.scrollEaseSpeed=e&&e.scrollEaseSpeed||.003,t},o.prototype.createTitleBar=function(e){var t=this.getDocument().createElement("div");t.classList.add("docking-panel-title"),t.textContent=e;var i=this;return i.addEventListener(t,"click",(function(e){i.movedSinceLastClick||i.onTitleClick(e),i.movedSinceLastClick=!1})),i.addEventListener(t,"mousedown",(function(){i.bringToFront()})),i.addEventListener(t,"dblclick",(function(e){i.onTitleDoubleClick(e)})),t},o.prototype.createFooter=function(){var e=new r.ResizeFooter(this.container);return e.setGlobalManager(this.globalManager),this.footerInstance=e,this.container.style.resize="none",e.footer},o.prototype.setTitle=function(e,t){t&&t.localizeTitle?(this.title.setAttribute("data-i18n",e),e=n.A.t(e,t.i18nOpts)):this.title.removeAttribute("data-i18n"),this.title.textContent=e},o.prototype.createCloseButton=function(){var e=this.getDocument().createElement("div");return e.className="docking-panel-close",this.initializeCloseHandler(e),e},o.prototype.onStartMove=function(){},o.prototype.onEndMove=function(){},o.prototype.onMove=function(){this.movedSinceLastClick=!0,this.movedSinceCreate=!0},o.prototype.onTitleClick=function(){},o.prototype.onTitleDoubleClick=function(){},o.prototype.addEventListener=function(e,t,i){e.addEventListener(t,i),this.listeners.push({target:e,eventId:t,callback:i})},o.prototype.removeEventListener=function(e,t,i){for(var n=0;n<this.listeners.length;++n){var r=this.listeners[n];if(r.target===e&&r.eventId===t&&r.callback===i)return e.removeEventListener(t,i),this.listeners.splice(n,1),!0}return!1},o.prototype.getContentSize=function(){return{height:this.container.clientHeight,width:this.container.clientWidth}},o.prototype.resizeToContent=function(e){if(this.isVisible()){var t=this.getContentSize().height,i=this.container.getBoundingClientRect(),n=this.getContainerBoundingRect(),r=this.container.querySelector(".docking-panel-footer");r&&(t+=r.getBoundingClientRect().height);var o=n.height;o-=i.top-n.top+75,e&&void 0!==e.maxHeight&&(o=Math.min(o,e.maxHeight)),t>o&&(t=o),this.container.style.maxHeight=o.toString()+"px",this.container.style.height=t.toString()+"px"}},o.prototype.getContainerBoundingRect=function(){return this.parentContainer.getBoundingClientRect()},o.prototype.animateScroll=function(e,t,i){var n=this.scrollEaseCurve,r=this.scrollEaseSpeed,o=this.scrollContainer;var s=performance.now();requestAnimationFrame((function a(l){var c=(l-s)*r;c=Math.min(c,1);var h=function(e,t){var i=3*e[1],n=3*(e[3]-e[1])-i;return(((1-i-n)*t+n)*t+i)*t}(n,c),u=e+(t-e)*h;o.scrollTop=u,i&&i(u),c<1&&requestAnimationFrame(a)}))},o.prototype.onViewerResize=function(e,t,i,n,r,o){var s=this.container,a=s.getBoundingClientRect(),l=a.width,c=a.height;if(!l||!c)return!1;var h=a.top,u=a.bottom,d=a.left,f=a.right;return r<l&&(l=Math.round(r),s.style.width=l+"px"),o<c&&(c=Math.round(o),s.style.height=c+"px"),(n<f||s.dockRight)&&(d=Math.round(n-l-i),s.style.left=d+"px"),(t<u||s.dockBottom)&&((h=Math.round(t-c-e))<0&&(h=0),s.style.top=h+"px"),s.style.maxWidth=Math.round(r)+"px",s.style.maxHeight=Math.round(o)+"px",!0},o.prototype.bringToFront=function(){var e=this.scrollContainer?this.scrollContainer.scrollTop:0;this.parentContainer.appendChild(this.container),this.scrollContainer&&(this.scrollContainer.scrollTop=e)}},91904:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ErrorHandler:()=>l});var n=i(1581),r=i(83081),o=i(38842),s=i(11653),a={1:{img:"img-reload","globalized-msg":"Viewer-UnknownFailure","default-msg":"<title> Sorry </title><message>We seem to have some technical difficulties and couldn't complete your request.</message><hint>Try loading the item again. </hint><hint>Please verify your Internet connection, and refresh the browser to see if that fixes the problem.</hint>"},2:{img:"img-unsupported","globalized-msg":"Viewer-BadData","default-msg":"<title> Sorry </title><message>The item you are trying to view was not processed completely. </message><hint>Try loading the item again.</hint><hint>Please upload the file again to see if that fixes the issue.</hint>"},3:{img:"img-reload","globalized-msg":"Viewer-NetworkError","default-msg":"<title> Sorry </title><message>We seem to have some technical difficulties and couldn't complete your request.</message><hint> Try loading the item again.</hint><hint> Please verify your Internet connection, and refresh the browser to see if that fixes the problem.</hint>"},4:{img:"img-unlock","globalized-msg":"Viewer-AccessDenied","default-msg":"<title> No access </title><message>Sorry. You don’t have the required privileges to access this item.</message><hint> Please contact the author</hint>"},5:{img:"img-item-not-found","globalized-msg":"Viewer-FileNotFound","default-msg":'<title> Sorry </title><message>We can’t display the item you are looking for. It may not have been processed yet. It may have been moved, deleted, or you may be using a corrupt file or unsupported file format.</message><hint> Try loading the item again.</hint><hint> Please upload the file again to see if that fixes the issue.</hint><hint> <a href="http://help.autodesk.com/view/ADSK360/ENU/?guid=GUID-488804D0-B0B0-4413-8741-4F5EE0FACC4A" target="_blank">See a list of supported formats.</a></hint>'},6:{img:"img-reload","globalized-msg":"Viewer-ServerError","default-msg":"<title> Sorry </title><message>We seem to have some technical difficulties and couldn't complete your request.</message><hint> Try loading the item again.</hint><hint> Please verify your Internet connection, and refresh the browser to see if that fixes the problem.</hint>"},7:{img:"img-reload","globalized-msg":"Viewer-UnhandledResponseCode","default-msg":"<title> Network problem </title><message>Sorry. We seem to have some technical difficulties and couldn't complete your request.</message><hint> Try loading the item again.</hint><hint> Please verify your Internet connection, and refresh the browser to see if that fixes the problem.</hint>"},8:{img:"img-unsupported","globalized-msg":"Viewer-WebGlNotSupported","default-msg":'<title>Sorry</title><message>We can\'t show this item because this browser doesn\'t support WebGL.</message><hint>Try Google Chrome, Mozilla Firefox, or another browser that supports WebGL 3D graphics.</hint><hint>For more information, see the <a href="WEBGL_HELP" target="_blank">A360 browser reqirements.</a></hint>'},9:{img:"img-item-not-found","globalized-msg":"Viewer-NoViewable","default-msg":"<title> No viewable content </title><message>There’s nothing to display for this item. It may not have been processed or it may not have content we can display.</message><hint> Please contact the author.</hint><hint> Please upload the file again to see if that fixes the issue.</hint>"},10:{img:"img-unsupported","globalized-msg":"Viewer-WebGlDisabled","default-msg":'<title>Sorry</title><message>We can\'t show this item because WebGL is disabled on this device.</message><hint> For more information see the <a href="WEBGL_HELP" target="_blank">A360 Help.</a></hint>'},11:{img:"img-item-not-found","globalized-msg":"Viewer-ModeIsEmpty","default-msg":"<title>Model is empty</title><message>Model is empty, there is no geometry for the viewer to show.</message><hint> Please contact the author.</hint><hint> Please upload the file again to see if that fixes the issue.</hint>"},13:{img:"img-unsupported","globalized-msg":"Viewer-FileExtNotSupported","default-msg":{title:"Sorry",message:"The file extension loaded into the Viewer is not supported",hints:["Try a different file"]}},15:{img:"img-unsupported","globalized-msg":"Viewer-WebGlContextLost","default-msg":{title:"WebGL context lost",message:"Unable to recover from software mode. Please restart your browser and reload the Viewer.",hints:["If you continue to encounter this issue when viewing this model, we recommend switching to a different browser."]}}};function l(){}l.prototype.constructor=l,l.reportError=function(e,t,i,c,h,u){if(l.currentError=null,l.currentErrors=null,t){var d={category:"error",code:t,message:i,httpStatusCode:c,httpStatusText:h};r.logger.track(d,!0),l.currentError=[e,t,i,u];var f=a[t];if(f){(b={defaultValue:""}).defaultValue=f["default-msg"];var p=f.img,m=f["globalized-msg"],g=this.parseErrorString(m,b);if(t===Autodesk.Viewing.ErrorCodes.BROWSER_WEBGL_DISABLED||t===Autodesk.Viewing.ErrorCodes.BROWSER_WEBGL_NOT_SUPPORTED)for(var v=(0,s.getWebGLHelpLink)()||"http://www.autodesk.com/a360-browsers",y=0;y<g.hints.length;y++){-1!==g.hints[y].indexOf('href="WEBGL_HELP"')&&(g.hints[y]=g.hints[y].replace('href="WEBGL_HELP"','href="'+v+'"'))}n.AlertBox.displayError(e,g.msg,g.header,p,g.hints)}else{p="img-unsupported";var b={defaultValue:"",interpolationPrefix:"{",interpolationSuffix:"}"};this.parseArguments(i,b),(g=this.parseErrorString(t,b)).header||(g.header="warning"===u?o.A.t("header-warning"):""),n.AlertBox.displayError(e,g.msg,g.header,p,g.hints,t)}}},l.reportErrors=function(e,t){if(l.currentError=null,l.currentErrors=null,t){l.currentErrors=[e,t];for(var i={defaultValue:"",interpolationPrefix:"{",interpolationSuffix:"}"},s=[],a=0;a<t.length;a++)if(t[a].code){this.parseArguments(t[a].message,i);var c=this.parseErrorString(t[a].code,i);c.header||(c.header="warning"===t[0].type?o.A.t("header-warning",{defaultValue:"Warning"}):""),s.push(c);var h={category:"error",code:t[a].code,message:t[a].message};r.logger.track(h,!0)}if(s.length){n.AlertBox.displayErrors(e,"img-unsupported",s)}}},l.parseArguments=function(e,t){if(e)if("string"==typeof e)t.defaultValue=e;else{t.defaultValue=e[0];for(var i=1;i<e.length;i++){t[(i-1).toString()]=e[i]}}},l.parseErrorString=function(e,t){var i={msg:null,msgList:null,header:null,hints:null};if(!e)return i;if("object"==typeof t.defaultValue){var n=t.defaultValue;return i.header=n.title,i.msg=n.message,i.hints=n.hints.concat(),i}var r=o.A.t(e,t);if(!r)return i;if(-1!=r.indexOf("<title>")){var s=r.split("<title>")[1].split("</title>");i.header=s[0],r=s[1]}if(r&&-1!=r.indexOf("<message>")){s=r.split("<message>")[1].split("</message>");i.msg=s[0],r=s[1]}else i.msg=r;if(r&&-1!=r.indexOf("<hint>")){i.hints=[];for(var a=r.split("<hint>"),l=0;l<a.length;l++){var c=a[l].split("</hint")[0];i.hints.push(c)}}return i},l.localize=function(){if(n.AlertBox.instances.length>0)if(n.AlertBox.dismiss(),l.currentError){var e=l.currentError.shift(),t=l.currentError;l.reportError(e,t[0],t[1],t[2])}else{e=l.currentErrors.shift();var i=l.currentErrors[0];l.reportErrors(e,i)}},l.dismissError=function(e){return n.AlertBox.dismissByTag(e)}},66316:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GuiViewer3D:()=>D});var n=i(19556),r=i(35922),o=i(91735),s=i(55280),a=i(57480),l=i(16271),c=i(38842),h=i(77427),u=i(8600),d=i(83081),f=i(4746),p=i(1581),m=i(22767),g=i(37463),v=i(91904),y=i(36523),b=i(88946),x=i(42440),_=i(47898),E=i(94589),S=i(92037),A=i(41129),w=i(4355);function T(e,t){null!=t&&t.globalManager&&this.setGlobalManager(t.globalManager),w.ToolBar.call(this,e,t),this.onToolbarUpdated=(null==t?void 0:t.onToolbarUpdated)||function(){},this.screenModeDelegate=null==t?void 0:t.screenModeDelegate,this.navigation=null==t?void 0:t.navigation,this.onClickViewerOption=(null==t?void 0:t.onClickViewerOption)||function(){},this.onClickRenderOptions=(null==t?void 0:t.onClickRenderOptions)||function(){},this.onClickFullScreen=(null==t?void 0:t.onClickFullScreen)||function(){},this.navTools=new A.RadioButtonGroup(y.TOOLBAR.NAVTOOLSID),this.modelTools=new g.ControlGroup(y.TOOLBAR.MODELTOOLSID),this.settingsTools=new g.ControlGroup(y.TOOLBAR.SETTINGSTOOLSID),this.addControl(this.navTools),this.addControl(this.modelTools),this.addControl(this.settingsTools)}i(26206).GlobalManagerMixin.call(T.prototype),T.prototype=Object.create(w.ToolBar.prototype),T.prototype.constructor=T,T.prototype.initRenderOptionsButton=function(){this.settingsTools&&!this.renderOptionsButton&&(this.renderOptionsButton=new m.Button("toolbar-renderOptionsTool"),this.renderOptionsButton.setToolTip("Rendering options"),this.renderOptionsButton.setIcon("adsk-icon-settings-render"),this.renderOptionsButton.onClick=this.onClickRenderOptions,this.settingsTools.addControl(this.renderOptionsButton))},T.prototype.initSettingsOptionsButton=function(){var e=new m.Button("toolbar-settingsTool");this.viewerOptionButton=e,e.setIcon("adsk-icon-settings"),e.setToolTip("Settings"),this.viewerOptionButton.onClick=this.onClickViewerOption,this.settingsTools.addControl(e)},T.prototype.initModelTools=function(){if(!this.settingsTools.fullscreenbutton){var e=new m.Button("toolbar-fullscreenTool",{collapsible:!1});e.setToolTip("Full screen"),e.setIcon("adsk-icon-fullscreen"),e.onClick=this.onClickFullScreen,this.settingsTools.addControl(e),this.settingsTools.fullscreenbutton=e,this.updateFullscreenButton(this.screenModeDelegate.getMode())}},T.prototype.updateFullscreenButton=function(e){var t="adsk-icon-fullscreen";switch(e){case S.ScreenMode.kNormal:this.screenModeDelegate.isModeSupported(S.ScreenMode.kFullBrowser)||(t="adsk-icon-fullscreen");break;case S.ScreenMode.kFullBrowser:t=this.screenModeDelegate.isModeSupported(S.ScreenMode.kFullScreen)?"adsk-icon-fullscreen":"adsk-icon-fullscreen-exit";break;case S.ScreenMode.kFullScreen:t="adsk-icon-fullscreen-exit"}this.settingsTools.fullscreenbutton.setIcon(t)},T.prototype.updateToolbarButtons=function(e,t){var i,n,r;r=e>310,(n=this.modelTools.getControl("toolbar-explodeTool"))&&n.setVisible(r),r=e>380?"block":"none",(n=this.modelTools.getControl("toolbar-collaborateTool"))&&n.setDisplay(r),r=e>515?"block":"none";var o=this.navTools.getControl("toolbar-cameraSubmenuTool");o&&(o.setDisplay(r),(n=o.subMenu.getControl("toolbar-homeTool"))&&n.setDisplay(this.navigation.isActionEnabled("gotoview")?"block":"none"),(n=o.subMenu.getControl("toolbar-fitToViewTool"))&&n.setDisplay(this.navigation.isActionEnabled("gotoview")?"block":"none"),(n=o.subMenu.getControl("toolbar-focalLengthTool"))&&n.setDisplay(this.navigation.isActionEnabled("fov")?"block":"none"),(n=o.subMenu.getControl("toolbar-rollTool"))&&n.setDisplay(this.navigation.isActionEnabled("roll")?"block":"none")),r=e>700?"block":"none",(n=this.modelTools.getControl("toolbar-measureTool"))&&n.setDisplay(r),(n=this.modelTools.getControl("toolbar-sectionTool"))&&n.setDisplay(r),r=e>740?"block":"none",(n=this.navTools.getControl("toolbar-beelineTool"))&&n.setDisplay(this.navigation.isActionEnabled("walk")?r:"none"),(n=this.navTools.getControl("toolbar-firstPersonTool"))&&n.setDisplay(this.navigation.isActionEnabled("walk")?r:"none"),(n=this.navTools.getControl("toolbar-zoomTool"))&&n.setDisplay(this.navigation.isActionEnabled("zoom")?r:"none"),(n=this.navTools.getControl("toolbar-panTool"))&&n.setDisplay(this.navigation.isActionEnabled("pan")?r:"none"),(n=this.navTools.getControl("toolbar-orbitTools"))&&n.setDisplay(this.navigation.isActionEnabled("orbit")?r:"none"),null===(i=this.onToolbarUpdated)||void 0===i||i.call(this,e,t)},T.prototype.registerCustomizeToolbarCB=function(e){this.onToolbarUpdated=e};var M=i(11337),C=i(28441),P=i(57872);function D(e,t){t||(t={}),t.startOnInitialize=!1,o.Viewer3D.call(this,e,t),this.toolbar=null,this.dockingPanels=[],this.onFullScreenModeEvent=this.onFullScreenModeEvent.bind(this),this.onProgressBarUpdate=this.onProgressBarUpdate.bind(this),this.progressInModelLoad=!1,this.progressInModelOptimizing=!1}D.prototype=Object.create(o.Viewer3D.prototype),D.prototype.constructor=D,D.prototype.initialize=function(e){var t=o.Viewer3D.prototype.initialize.call(this,e);if(t>0)return v.ErrorHandler.reportError(this.container,t),t;var i=this;if(this.toolController){var r=new f.HotGestureTool(this);this.toolController.registerTool(r),this.toolController.activateTool(r.getName())}return this.addEventListener(n.FULLSCREEN_MODE_EVENT,this.onFullScreenModeEvent),this.contextMenu||this.setDefaultContextMenu(),this.progressbar=new x.ProgressBar(this.container,P.USE_HLOD),this.addEventListener(n.PROGRESS_UPDATE_EVENT,this.onProgressBarUpdate),this.addEventListener(n.VIEWER_RESIZE_EVENT,(function(e){var t;i.resizePanels(),null===(t=i.toolbar)||void 0===t||t.updateToolbarButtons(e.width,e.height)})),this.addEventListener(n.NAVIGATION_MODE_CHANGED_EVENT,(function(){var e;null===(e=i.toolbar)||void 0===e||e.updateToolbarButtons(i.container.clientWidth,i.container.clientHeight)})),this.initEscapeHandlers(),this.localize(),this.addEventListener(n.WEBGL_CONTEXT_LOST_EVENT,function(){for(var e=this.container,t=e.childElementCount,i=0;i<t;++i)e.children[i].classList.add("hide-while-context-lost");v.ErrorHandler.reportError(this.container,a.ErrorCodes.WEBGL_LOST_CONTEXT),this.localize()}.bind(this)),this.addEventListener(n.WEBGL_CONTEXT_RESTORED_EVENT,function(){for(var e=this.container,t=e.childElementCount,i=0;i<t;++i)e.children[i].classList.remove("hide-while-context-lost");v.ErrorHandler.dismissError(a.ErrorCodes.WEBGL_CONTEXT_LOST_EVENT)}.bind(this)),this.run(),0},D.prototype.uninitialize=function(){this.viewerSettingsPanel&&(this.viewerSettingsPanel.uninitialize(),this.viewerSettingsPanel=null),this.renderoptions&&(this.renderoptions.uninitialize(),this.renderoptions=null),this.viewerOptionButton&&(this.viewerOptionButton=null),this.removeEventListener(n.FULLSCREEN_MODE_EVENT,this.onFullScreenModeEvent),this.removeEventListener(n.PROGRESS_UPDATE_EVENT,this.onProgressBarUpdate),this.progressbar=null,this.debugMenu=null,this.modelStats=null,this.toolbar=null,o.Viewer3D.prototype.uninitialize.call(this)},D.prototype.setUp=function(e){e||(e={}),e.startOnInitialize=!1,o.Viewer3D.prototype.setUp.call(this,e)},D.prototype.tearDown=function(e){o.Viewer3D.prototype.tearDown.call(this,e),this.toolbar&&(this.toolbar.container.parentNode.removeChild(this.toolbar.container),this.toolbar=null),this.viewerSettingsPanel&&this.setSettingsPanel(null),this.renderoptions&&(this.removePanel(this.renderoptions),this.renderoptions.uninitialize(),this.renderoptions=null),this.debugMenu=null,this.removeEventListener(n.GEOMETRY_LOADED_EVENT,this.checkGeometry),this.checkGeometry=null},D.prototype.onPostExtensionLoad=function(e){var t,i=this.getToolbar();i&&e.onToolbarCreated&&e.onToolbarCreated(i),null===(t=this.toolbar)||void 0===t||t.updateToolbarButtons(this.container.clientWidth,this.container.clientHeight)},D.prototype.loadModel=function(e,t,i,n,r){var s=this;t={...t,addViews:function(e,t){var i,n;let r=null===(i=t.getDocumentNode())||void 0===i?void 0:i.getNamedViews();function o(e,t,i){if(e.children)for(let t=e.children.length-1;t>=0;t--)o(e.children[t],e,t);else{let n=r.find((t=>t.data.name==e.name));n&&(n.data.isViewpoint=!0,n.data.entry=e.entry,t.children.splice(i,1))}}if(r){var s;let t=null===(s=e.children)||void 0===s?void 0:s.length;for(;t--;)o(e.children[t],e,t)}let a=null===(n=t.getDocumentNode())||void 0===n?void 0:n.getRootNode();if(a){const t=new Autodesk.Viewing.BubbleNode(e);t.parent=a.children[0],a.children[0].children.push(t)}}};var l=o.Viewer3D.prototype.loadModel.call(this,e,t,(function(e){setTimeout((function(){t&&(t.loadAsHidden||t.headlessViewer)||function(e){s.running?s.createUI(e):d.logger.error("createUI expects the viewer to be running.",(0,a.errorCodeString)(a.ErrorCodes.VIEWER_INTERNAL_ERROR))}(e),i&&(i.call(i,e),i=null)}),0)}),(function(e){e!==a.ErrorCodes.LOAD_CANCELED?v.ErrorHandler.reportError(s.container,e):d.logger.warn("A load was canceled"),n&&n.apply(n,arguments)}),r);return l},D.prototype.createUI=function(e,t){if(this.model!==e&&!t)return;var i=this;const r=this._createToolbar();this.checkGeometry=function(e){setTimeout((function(){if(i.impl&&!i.impl.is2d&&e.model&&!e.model.hasGeometry()){var t=a.ErrorCodes.BAD_DATA_MODEL_IS_EMPTY;v.ErrorHandler.reportError(i.container,t,"Model is empty"),i._loadingSpinner.hide()}}),0)};var o=this.config.disabledExtensions||{};const l=e=>-1===(this.profile&&this.profile.extensions.unload?this.profile.extensions.unload:[]).indexOf(e);this.initModelTools(e),(0,s.getGlobal)().ENABLE_DEBUG&&this.initDebugTools(),"true"===(0,u.getParameterByName)("lmv_viewer_debug")&&this.loadExtension("Autodesk.Debug",this.config);var c=function(e){i.getExtension(e)&&i.unloadExtension(e)};e.is2d()&&(c("Autodesk.BimWalk"),c("Autodesk.Section"),c("Autodesk.Viewing.FusionOrbit"),c("Autodesk.Explode")),o.measure||c("Autodesk.Measure"),r&&(this.dispatchEvent({type:y.TOOLBAR_CREATED_EVENT}),this.forEachExtension((e=>{e.onToolbarCreated&&e.onToolbarCreated(this.toolbar)})));var h="Autodesk.DefaultTools.NavTools",d=this.getExtension(h);d?d.updateUI(e.is3d()):this.loadExtension(h,i.config),this.resize(),e.is2d()?(this.setDefaultNavigationTool("pan"),this.setClickToSetCOI(!1,!1),setTimeout((function(){if(!i.impl)return;const e={viewcube:"Autodesk.ViewCubeUi",measure:"Autodesk.Measure",hyperlink:"Autodesk.Hyperlink",layerManager:"Autodesk.LayerManager",propertiesPanel:"Autodesk.PropertiesManager"};(0,s.isMobileDevice)()||(e.boxSelection="Autodesk.BoxSelection");for(let t in e){const n=e[t];!o[t]&&l(n)&&i.loadExtension(n,i.config)}}),0)):(-1===this.getDefaultNavigationToolName().indexOf("orbit")&&this.setDefaultNavigationTool("orbit"),setTimeout((function(){if(!i.impl)return;const e={viewcube:"Autodesk.ViewCubeUi",explode:"Autodesk.Explode",bimwalk:"Autodesk.BimWalk",fusionOrbit:"Autodesk.Viewing.FusionOrbit",measure:"Autodesk.Measure",section:"Autodesk.Section",layerManager:"Autodesk.LayerManager",modelBrowser:"Autodesk.ModelStructure",propertiesPanel:"Autodesk.PropertiesManager"};(0,s.isMobileDevice)()||(e.boxSelection="Autodesk.BoxSelection");for(let t in e){const n=e[t];!o[t]&&l(n)&&i.loadExtension(n,i.config)}!o.scalarisSimulation&&l("Autodesk.Viewing.ScalarisSimulation")&&i.model&&i.model.isScalaris&&i.loadExtension("Autodesk.Viewing.ScalarisSimulation",i.config)}),0),e.isLoadDone()?this.checkGeometry({model:e}):this.addEventListener(n.GEOMETRY_LOADED_EVENT,this.checkGeometry,{once:!0}))},D.prototype.onFullScreenModeEvent=function(e){this.resizePanels(),this.toolbar.updateFullscreenButton(e.mode)},D.prototype.onProgressBarUpdate=function(e){if(e.state==C.ProgressState.ROOT_LOADED||e.state==C.ProgressState.LOADING)this.progressInModelLoad=e.percent<100;else if(e.state==C.ProgressState.OPTIMIZING)this.progressInModelOptimizing=e.percent<100;else if(this.progressInModelLoad||this.progressInModelOptimizing)return;e.percent>=0&&this.progressbar.setPercent(e.percent,e.state)},D.prototype.addOptionToggle=function(e,t,i,n,r){var o=r?this.prefs[r]:null;i="boolean"==typeof o?o:i;let a=this.getDocument();var l=a.createElement("li");l.className="toolbar-submenu-listitem";var h=a.createElement("input");h.className="toolbar-submenu-checkbox",h.type="checkbox",h.id=t,l.appendChild(h);var u=a.createElement("label");return u.setAttribute("for",t),u.setAttribute("data-i18n",t),u.textContent=c.A.t(t),l.appendChild(u),e.appendChild(l),h.checked=i,h.addEventListener("touchstart",s.touchStartToClick),u.addEventListener("touchstart",s.touchStartToClick),l.addEventListener("touchstart",s.touchStartToClick),h.addEventListener("click",(function(e){n(h.checked),e.stopPropagation()})),u.addEventListener("click",(function(e){e.stopPropagation()})),l.addEventListener("click",(function(e){e.stopPropagation(),h.checked=!h.checked,n(h.checked)})),r&&this.prefs.addListeners(r,(function(e){h.checked=e}),(function(e){h.checked=e,n(e)})),h},D.prototype.addOptionList=function(e,t,i,n,r,o){var s=this.prefs[o];n="number"==typeof s?s:n;let a=this.getDocument();var l=a.createElement("select");l.className="option-drop-down",l.id="selectMenu_"+t;for(var h=0;h<i.length;h++){var u=a.createElement("option");u.value=h,u.setAttribute("data-i18n",i[h]),u.textContent=c.A.t(i[h]),l.add(u)}var d=a.createElement("li");d.className="toolbar-submenu-select";var f=a.createElement("div");return f.className="toolbar-submenu-selectlabel",f.setAttribute("for",t),f.setAttribute("data-i18n",t),f.textContent=c.A.t(t),d.appendChild(f),d.appendChild(l),e.appendChild(d),l.selectedIndex=n,l.onchange=function(e){var t=e.target.selectedIndex;r(t),e.stopPropagation()},l.addEventListener("touchstart",(function(e){e.stopPropagation()})),l.addEventListener("click",(function(e){e.stopPropagation()})),o&&this.prefs.addListeners(o,(function(e){l.selectedIndex=e}),(function(e){l.selectedIndex=e,r(e)})),l},D.prototype.showViewer3dOptions=function(e){var t=this.getSettingsPanel(!0);e&&t.isVisible()&&t.setVisible(!1),t.setVisible(e)},D.prototype.showRenderingOptions=function(e){e&&this._createRenderingOptionsPanel(),this.renderoptions&&this.renderoptions.setVisible(e)},D.prototype._createRenderingOptionsPanel=function(){this.renderoptions||this.model.is2d()||(this.renderoptions=new _.RenderOptionsPanel(this),this.addPanel(this.renderoptions),this.toolbar.initRenderOptionsButton())},D.prototype.showLayerManager=function(){d.logger.warn('viewer.showLayerManager() is now handled the extension "Autodesk.LayerManager" and will be removed in version 8.0.0.')},D.prototype.initHotkeys=function(){d.logger.warn("viewer.initHotkeys() has been deprecated and will be removed in version 8.0.0.")},D.prototype.setModelStructurePanel=function(e){d.logger.warn('viewer.setModelStructurePanel() is deprecated and will be removed in v8.0.0 - Use extension "Autodesk.ModelStructure".');var t=this.getExtension("Autodesk.ModelStructure");return!!t&&t.setModelStructurePanel(e)},D.prototype.setLayersPanel=function(){d.logger.warn('viewer.setLayersPanel() is now handled the extension "Autodesk.LayerManager" and will be removed in version 8.0.0.')},D.prototype.setPropertyPanel=function(e){d.logger.warn('viewer.setPropertyPanel() is now handled by extension "Autodesk.PropertiesManager" and will be removed in version 8.0.0.');var t=this.getExtension("Autodesk.PropertiesManager");return!!t&&t.setPanel(e)},D.prototype.getPropertyPanel=function(e){d.logger.warn('viewer.getPropertyPanel() is now handled the extension "Autodesk.PropertiesManager" and will be removed in version 8.0.0.');var t=this.getExtension("Autodesk.PropertiesManager");return!t&&e&&(this.loadExtension("Autodesk.PropertiesManager"),t=this.getExtension("Autodesk.PropertiesManager")),t?t.getPanel():null},D.prototype.setSettingsPanel=function(e){var t=this;return(e instanceof E.SettingsPanel||!e)&&(this.viewerSettingsPanel&&(this.viewerSettingsPanel.setVisible(!1),this.removePanel(this.viewerSettingsPanel),this.viewerSettingsPanel.uninitialize()),this.viewerSettingsPanel=e,e&&(this.addPanel(e),e.addVisibilityListener((function(i){var n;i&&t.onPanelVisible(e,t),null===(n=t.toolbar)||void 0===n||n.viewerOptionButton.setState(i?m.Button.State.ACTIVE:m.Button.State.INACTIVE)}))),!0)},D.prototype.getSettingsPanel=function(e,t){return!this.viewerSettingsPanel&&e&&this.createSettingsPanel(t||this.model),this.viewerSettingsPanel},D.prototype.createSettingsPanel=function(e){var t=new M.ViewerSettingsPanel(this,e);this.setSettingsPanel(t),t.syncUI(),this.toolbar.initSettingsOptionsButton(),this.dispatchEvent({type:y.SETTINGS_PANEL_CREATED_EVENT})},D.prototype.initModelTools=function(e){this.createSettingsPanel(e),(0,s.getGlobal)().ENABLE_DEBUG&&this._createRenderingOptionsPanel(),this.canChangeScreenMode()&&(0,s.isFullscreenEnabled)(this.getDocument())&&(this.toolbar.initModelTools(),this.toolbar.updateFullscreenButton(this.getScreenMode()))},D.prototype.setPropertiesOnSelect=function(e){d.logger.warn('viewer.setPropertiesOnSelect() is now handled by viewer.prefs.set("openPropertiesOnSelect", <boolean>) and will be removed in version 8.0.0.'),this.prefs.set(r.Prefs.OPEN_PROPERTIES_ON_SELECT,e)},D.prototype.addDivider=function(e){var t=this.getDocument().createElement("li");return t.className="toolbar-submenu-horizontal-divider",e.appendChild(t),t},D.prototype.initDebugTools=function(){if(this.debugMenu)return!1;var e=new g.ControlGroup("debugTools");this.debugMenu=e;var t=new m.Button("toolbar-debugTool");return t.setIcon("adsk-icon-bug"),e.addControl(t),this.debugMenu.debugSubMenuButton=t,this.createDebugSubmenu(this.debugMenu.debugSubMenuButton),this.toolbar.addControl(e),!0},D.prototype.removeDebugTools=function(){this.debugMenu&&(this.debugMenu.removeFromParent(),this.debugMenu=null)},D.prototype.createDebugSubmenu=function(e){var t=this,i=this.getDocument().createElement("div");i.id="toolbar-debugToolSubmenu",i.classList.add("toolbar-submenu"),i.classList.add("toolbar-settings-sub-menu"),i.classList.add("adsk-hidden"),this.debugMenu.subMenu=i,this.debugMenu.subMenu.style.minWidth="180px",this.container.appendChild(i),this.initModelStats(),this.addDivider(i),this.addDivider(i);var n=h.Lang.getLanguages(),r=n.map((function(e){return e.label})),o=n.map((function(e){return e.symbol}));function a(){t.localize()}var c=t.selectedLanguage?t.selectedLanguage:0;this.addOptionList(i,"Language",r,c,(function(e){var i=o[e];t.selectedLanguage=e,(0,l.setLanguage)(i,a)}),null).parentNode.style.paddingBottom="15px",this.addDivider(this.debugMenu.subMenu);this.addOptionList(i,"Error",["UNKNOWN FAILURE","BAD DATA","NETWORK ERROR","NETWORK ACCESS DENIED","NETWORK FILE NOT FOUND","NETWORK SERVER ERROR","NETWORK UNHANDLED RESPONSE CODE","BROWSER WEBGL NOT SUPPORTED","BAD DATA NO VIEWABLE CONTENT"],0,(function(e){var i=e+1;v.ErrorHandler.reportError(t.container,i,"")}),null).parentNode.style.paddingBottom="15px";var u=i.getBoundingClientRect();this.debugMenu.subMenu.style.width=u.width+"px",this.container.removeChild(i),e.container.appendChild(i);var d=u.left+u.width,f=this.container.getBoundingClientRect().right;if(d>f){var p=-(d-f+10)+"px";this.debugMenu.subMenu.style.left=p}e.onMouseOver=function(){i.classList.remove("adsk-hidden")},e.onMouseOut=function(){i.classList.add("adsk-hidden")},(0,s.isTouchDevice)()&&(e.onClick=function(){i.classList.toggle("adsk-hidden")})},D.prototype.initModelStats=function(){var e=this;function t(){var t=e.model;const i=e=>(e/1e3).toFixed(2)+"s",n=t.loader.t1?i(t.loader.t1-t.loader.t0):"-",r=t.loader.firstPixelTimestamp?i(t.loader.firstPixelTimestamp-t.loader.t0):"-",o=t.loader.loadTime?i(t.loader.loadTime):"...";t&&(e.modelStats.innerHTML=`\n Geometry Polygons: ${t.getGeometryList().geomPolyCount.toLocaleString()}<br>\n Instance Polygons: ${t.getGeometryList().instancePolyCount.toLocaleString()}<br>\n Fragments: ${t.getFragmentList().getCount().toLocaleString()}<br>\n Geometries: ${t.getGeometryList().getCount().toLocaleString()}<br>\n <br>\n Root data loaded: ${n}<br>\n First pixel drawn: ${r}<br>\n Geometries loaded: ${o}<br>\n `)}this.addOptionToggle(this.debugMenu.subMenu,"Model statistics",!1,(function(i){i&&!e.modelStats&&(!function(){let i=e.getDocument();e.modelStats=i.createElement("div"),e.modelStats.className="statspanel",e.container.appendChild(e.modelStats),e.addEventListener(n.PROGRESS_UPDATE_EVENT,t),e.addEventListener(n.GEOMETRY_LOADED_EVENT,t),e.fpsDisplay=i.createElement("div"),e.fpsDisplay.className="fps",e.container.appendChild(e.fpsDisplay)}(),t()),e.modelStats.style.visibility=i?"visible":"hidden",e.fpsDisplay.style.visibility=i?"visible":"hidden",e.impl.fpsCallback=i?function(t){e.fpsDisplay.textContent=""+(0|t)}:null}))},D.prototype.initEscapeHandlers=function(){var e=this;this.addEventListener(n.ESCAPE_EVENT,(function(){if(!e.contextMenu||!e.contextMenu.hide())if(e.renderoptions&&e.renderoptions.isVisible())e.renderoptions.setVisible(!1);else if(e.impl.selector.hasSelection())e.clearSelection();else{if(e.getActiveNavigationTool()!==e.getDefaultNavigationToolName())return e.toolController&&e.toolController.setIsLocked(!1),e.setActiveNavigationTool(),void b.HudMessage.dismiss();if(e.areAllVisible()){if(!p.AlertBox.dismiss()){for(var t=0;t<e.dockingPanels.length;++t){var i=e.dockingPanels[t];if("none"!==i.container.style.display&&""!==i.container.style.display)return void i.setVisible(!1)}e.escapeScreenMode()}}else e.showAll()}}))},D.prototype.getToolbar=function(){return this.toolbar},D.prototype._createToolbar=function(){if(this.toolbar)return!1;const e=this;if(this.toolbar=new T("guiviewer3d-toolbar",{globalManager:this.globalManager,navigation:this.navigation,screenModeDelegate:this.getScreenModeDelegate(),onClickFullScreen:e.nextScreenMode.bind(e),onClickRenderOptions:()=>{var e=this.renderoptions&&this.renderoptions.isVisible();this.renderoptions.setVisible(!e)},onClickViewerOption:()=>{e.getSettingsPanel(!0).isVisible()?e.showViewer3dOptions(!1):e.showViewer3dOptions(!0)}}),this._forgeLogo){const e=this._forgeLogo.getBoundingClientRect();this.toolbar.container.style.bottom=`${e.height+10}px`}return this.container.appendChild(this.toolbar.container),this.toolbar.updateToolbarButtons(this.container.clientWidth,this.container.clientHeight,this.navigation),!0},D.prototype.showModelStructurePanel=function(e){d.logger.warn('viewer.showModelStructurePanel() is deprecated and will be removed in v8.0.0 - Use extension "Autodesk.ModelStructure".'),e?this.activateExtension("Autodesk.ModelStructure"):this.deactivateExtension("Autodesk.ModelStructure")},D.prototype.onPanelVisible=function(e){this.dockingPanels.splice(this.dockingPanels.indexOf(e),1),this.dockingPanels.splice(0,0,e)},D.prototype.localize=function(){this.debugMenu&&this.debugMenu.debugSubMenuButton&&(this.debugMenu.debugSubMenuButton.container.removeChild(this.debugMenu.subMenu),this.createDebugSubmenu(this.debugMenu.debugSubMenuButton)),v.ErrorHandler.localize(),o.Viewer3D.prototype.localize.call(this)},D.prototype.addPanel=function(e){return-1===this.dockingPanels.indexOf(e)&&(this.dockingPanels.push(e),!0)},D.prototype.removePanel=function(e){var t=this.dockingPanels.indexOf(e);return t>-1&&(this.dockingPanels.splice(t,1),!0)},D.prototype.resizePanels=function(e){e=e||{};var t=this.toolbar?this.toolbar.getDimensions().height:0,i=this.getDimensions(),n=i.height;e.dimensions&&e.dimensions.height?n=e.dimensions.height:e.dimensions={height:i.height,width:i.width},e.dimensions.height=n-t;var r=e?e.dockingPanels:null;r||(r=this.dockingPanels);var o,s,a=this.container.getBoundingClientRect(),l=a.top,c=a.bottom,h=a.left,u=a.right;e&&e.dimensions?(o=e.dimensions.width,c=l+(s=e.dimensions.height)):(o=a.width,s=a.height);for(var d=0;d<r.length;++d)r[d].onViewerResize(l,c,h,u,o,s)},D.prototype.initExplodeSlider=function(){d.logger.warn('viewer.initExplodeSlider() has been replaced by extension "Autodesk.Explode". initExplodeSlier() will be removed in version 7.0.0.')},D.prototype.registerCustomizeToolbarCB=function(e){var t,i;null===(t=this.toolbar)||void 0===t||t.registerCustomizeToolbarCB(e.bind(null,this)),null===(i=this.toolbar)||void 0===i||i.updateToolbarButtons(this.container.clientWidth,this.container.clientHeight)},Object.defineProperty(D.prototype,"navTools",{get(){var e;return null===(e=this.toolbar)||void 0===e?void 0:e.navTools}}),Object.defineProperty(D.prototype,"modelTools",{get(){var e;return null===(e=this.toolbar)||void 0===e?void 0:e.modelTools}}),Object.defineProperty(D.prototype,"settingsTools",{get(){var e;return null===(e=this.toolbar)||void 0===e?void 0:e.settingsTools}}),Object.defineProperty(D.prototype,"updateFullscreenButton",{get(){var e;return null===(e=this.toolbar)||void 0===e?void 0:e.updateFullscreenButton.bind(this)}}),Autodesk.Viewing.Private.GuiViewer3D=D},36523:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SETTINGS_PANEL_CREATED_EVENT:()=>r,TOOLBAR:()=>s,TOOLBAR_CREATED_EVENT:()=>n,VIEW_CUBE_CREATED_EVENT:()=>o});const n="toolbarCreated",r="settingsPanelCreated",o="viewCubeCreated",s={NAVTOOLSID:"navTools",MODELTOOLSID:"modelTools",SETTINGSTOOLSID:"settingsTools",MEASURETOOLSID:"measureTools"}},88946:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HudMessage:()=>r});var n=i(38842);function r(){}r.instances=[],r.displayMessage=function(e,t,i,o,s){let a=e.ownerDocument,l=a.defaultView||a.parentWindow;function c(e){var t=l.getComputedStyle(e),i=parseInt(t["margin-top"]),n=parseInt(t["margin-bottom"]);return e.getBoundingClientRect().height+i+n}function h(e,t,i){var n=l.getComputedStyle(e,null);if(!Array.isArray(t))return n[t];for(var r=i||{},o=0;o<t.length;o++){var s=t[o];r[s]=n[s]}return r}if(!(r.instances.length>0)){var u=t.msgTitleKey,d=t.msgTitleDefaultValue||u,f=t.messageKey,p=t.messageDefaultValue||f,m=t.buttonText,g=t.checkboxChecked||!1,v=t.position||"center",y=a.createElement("div");if(y.classList.add("docking-panel"),y.classList.add("hud"),"top"===v&&y.classList.add("top"),e.appendChild(y),u){var b,x=a.createElement("div");x.classList.add("docking-panel-title"),x.classList.add("docking-panel-delimiter-shadow"),x.textContent=n.A.t(u,{defaultValue:d}),x.setAttribute("data-i18n",u),y.appendChild(x),i&&((b=a.createElement("div")).classList.add("docking-panel-close"),b.addEventListener("click",(function(e){r.dismiss(),i&&i(e)})),y.appendChild(b));var _=h(x,["width","font-size"]),E=function(e){var t=e.textContent,i=a.createElement("span");h(e,["font-size","font-weight","text-transform","padding","white-space","font-family"],i.style),i.textContent=t,i.style.position="absolute",i.style.top="10000px",i.style.left="-10000px",a.body.appendChild(i);var n=i.offsetWidth;return a.body.removeChild(i),n}(x),S=parseFloat(_["font-size"]),A=b?parseFloat(h(b,"width")):0,w=parseFloat(_.width)-A;x.style["font-size"]=E>w?w/E*S+"px":`${S}px`}var T=a.createElement("div");T.classList.add("hud-client"),T.classList.add("docking-panel-container-solid-color-b"),y.appendChild(T);var M=a.createElement("div");M.className="hud-message",M.textContent=n.A.t(f,{defaultValue:p}),M.setAttribute("data-i18n",p),T.appendChild(M);var C=c(M);if(o){var P=a.createElement("div");P.classList.add("docking-panel-primary-button"),P.classList.add("hud-button"),P.textContent=n.A.t(m,{defaultValue:m}),P.setAttribute("data-i18n",m),P.addEventListener("click",o),T.appendChild(P),C+=c(P)}if(s){var D=a.createElement("div"),L=a.createElement("input");L.className="hud-checkbox",L.type="checkbox",L.checked=g,D.appendChild(L);var I="Do not show this message again",R=a.createElement("label");R.setAttribute("for",I),R.setAttribute("data-i18n",I),R.textContent=n.A.t(I,{defaultValue:I}),D.appendChild(R),L.addEventListener("change",s),T.appendChild(D),C+=c(s)}T.style.height=C+"px",y.style.height=C+(x?c(x):0)+"px";var O={hudMessage:y,container:e};r.instances.push(O)}},r.dismiss=function(){if(r.instances.length>0){var e=r.instances.pop();return e.hudMessage.style.visibility="hidden",e.container.removeChild(e.hudMessage),!0}return!1}},98087:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LoadingSpinner:()=>r});var n=i(38842);function r(e){this.parentDiv=e;var t=this.getDocument();this.container=t.createElement("div"),this.container.innerHTML=['<div class="path">','<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">','<path d="M2.5,50a47.5,47.5 0 1,0 95,0a47.5,47.5 0 1,0 -95,0" vector-effect="non-scaling-stroke"/>','<path d="M 2.5 50 A 47.5 47.5 0 0 1 47.5 2.5" vector-effect="non-scaling-stroke"/>',"</svg>","</div>",'<div class="message" data-i18n="Spinner Loading">LOADING</div>'].join(""),this.container.className="loading-spinner"}i(26206).GlobalManagerMixin.call(r.prototype),r.prototype.addClass=function(e){this.container.classList.add(e)},r.prototype.attachToDom=function(){return!this.container.parentNode&&(n.A.localize(this.container),this.parentDiv.appendChild(this.container),!0)},r.prototype.removeFromDom=function(){return!!this.container.parentNode&&(this.container.parentNode.removeChild(this.container),!0)},r.prototype.setVisible=function(e){e?this.attachToDom():this.removeFromDom()}},99587:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelStructurePanel:()=>p});var n=i(96551),r=i(76948),o=i(87241),s=i(83081),a=i(8600),l=i(38842),c=-1,h=-2;const u=-1e10;function d(e,t){o.TreeDelegate.call(this),this.panel=e,this.model=t;let i=this.getDocument();this.modelDiv=i.createElement("div"),this.modelDiv.classList.add("model-div"),this.modelDiv.setAttribute("lmv-modelId",t.id),this.instanceTree=null,this.rootId=c,this.state=1}function f(e){var t=function(e){var t=e.getData();if(t&&t.loadOptions&&t.loadOptions.modelNameOverride)return t.loadOptions.modelNameOverride;return""}(e);if(t)return t;if(!e.getData())return"";var i=e.getDocumentNode();return i?i.getModelName():"Model"}function p(e,t,i,r){n.DockingPanel.call(this,e,t,i,r),this.container.classList.add("model-structure-panel"),(r=r||{}).heightAdjustment||(r.heightAdjustment=40),r.marginTop||(r.marginTop=0),r.left=!0,this.createScrollContainer(r),this.onScroll=this.onScroll.bind(this),this.scrollContainer.addEventListener("scroll",this.onScroll),this.scrollContainer.style["overflow-x"]="hidden",this.options=r,this.tree=null,this._pendingModels=[],this.uiCreated=!1;var o=this;this.addVisibilityListener((function(e){e&&(o.uiCreated||o.createUI(),o.resizeToContent())}))}d.prototype=Object.create(o.TreeDelegate.prototype),d.prototype.constructor=d,d.prototype.isLoading=function(){return 1===this.state},d.prototype.isAvailable=function(){return 2===this.state},d.prototype.isNotAvailable=function(){return 3===this.state},d.prototype.isControlId=function(e){return e===c||e===h},d.prototype.getControlIdCss=function(e){return null},d.prototype.getRootId=function(){return this.rootId},d.prototype.getTreeNodeId=function(e){return"object"==typeof e?(s.logger.warn("Object used instead of dbId. Fix it."),e.dbId):e},d.prototype.getTreeNodeIndex=function(e){return this.instanceTree.nodeAccess.dbIdToIndex[e]},d.prototype.getTreeNodeLabel=function(e){if(e===c){var t=f(this.model);return l.A.t("Loading model",{name:t})}return e===h||e===this.getRootId()?t=f(this.model):e==u?"Object 0":this.instanceTree.getNodeName(e,!0)||"Object "+e},d.prototype.getTreeNodeClass=function(e){return e===c||e===h?"message-unexpected":""},d.prototype.getTreeNodeParentId=function(e){if(e===u)return 0;let t=this.instanceTree.nodeAccess.getParentId(e);return 0===t?u:t},d.prototype.getTreeNodeCount=function(){return this.instanceTree.nodeAccess.getNumNodes()},d.prototype.getTreeNodeClientHeight=function(e){return 36},d.prototype.getTreeNodeDepthOffset=function(e,t){return 13+25*t},d.prototype.isTreeNodeGroup=function(e){return!this.isControlId(e)&&this.instanceTree.getChildCount(e)>0},d.prototype.shouldCreateTreeNode=function(e){return!0},d.prototype.createTreeNode=function(e,t){let i=this,n=i.getDocument(),r=function(){var e=function(){i.removeDocumentEventListener("mouseup",e),this.classList.remove("highlight")}.bind(t);t.classList.add("highlight"),i.addDocumentEventListener("mouseup",e)};if(t.addEventListener("mousedown",r),console.log("Event listener added"),t._mouseDownListener=r,!this.isControlId(e)){var s=n.createElement("div");s.dbId=e,s.classList.add("visibility");let i=function(e){e.preventDefault(),e.stopPropagation()};s.addEventListener("mousedown",i),s._mouseDownListener=i;let r=function(e){e.preventDefault(),e.stopPropagation();var t=parseInt(e.target.dbId);this.panel.onEyeIcon(t,this.model)}.bind(this);s.addEventListener("click",r),s._clickListener=r,t.appendChild(s)}if(e===c){var l=n.createElement("img");l.src=(0,a.getResourceUrl)("res/ui/spinner.png"),l.style.animation="loading-spinner-perpetual-motion 1s infinite linear",l.style.float="right",l.style.marginRight="5px",l.style.width="20px",t.appendChild(l)}var u={localize:e===c||e===h};o.TreeDelegate.prototype.createTreeNode.call(this,e,t,u)},d.prototype.onTreeNodeRightClick=function(e,t,i){this.isControlId(t)||this.panel.onTreeNodeRightClick(e,t,this.model,i)},d.prototype.onTreeNodeClick=function(e,t,i){this.isControlId(t)||this.panel.onTreeNodeClick(e,t,this.model,i)},d.prototype.onTreeNodeDoubleClick=function(e,t,i){},d.prototype.onTreeNodeIconClick=function(e,t,i){if(this.isTreeNodeGroup(t)){var n=e.isCollapsed(this,t);e.setCollapsed(this,t,!n)}},d.prototype.onTreeNodeReized=function(e){},d.prototype.forEachChild=function(e,t,i){this.isControlId(e)||this.instanceTree.enumNodeChildren(e,t,i)},d.prototype.setInstanceTree=function(e){this.instanceTree=e,this.state=e?2:3,this.rootId=e?e.getRootId():h,function(e){var t=e.instanceTree;if(!t)return;var i,n=e.rootId,r=t.getNodeName(n),o=0,s=0;t.enumNodeChildren(n,(function(e){s||(i=t.getNodeName(e),o=e),s++})),e.hasDoubleRoot=1===s&&r===i,e.rootId=e.hasDoubleRoot?o:n}(this)},d.prototype.clean=function(){for(var e,t=this.modelDiv;e=t.lastChild;)t.removeChild(e)},d.prototype.dtor=function(){this.model=null},p.prototype=Object.create(n.DockingPanel.prototype),p.prototype.constructor=p,p.prototype.uninitialize=function(){var e;this.scrollContainer.addEventListener("scroll",this.onScroll),this.scrollContainer.parentNode.removeChild(this.scrollContainer),null===(e=this.tree)||void 0===e||e.destroy(),n.DockingPanel.prototype.uninitialize.call(this)},p.prototype.addModel=function(e){if(e)if(this.uiCreated)this.createTreeUI(e);else{if(-1!==this._pendingModels.indexOf(e))return;this._pendingModels.push(e)}},p.prototype.unloadModel=function(e){if(e)if(this.uiCreated)this.removeTreeUI(e);else{var t=this._pendingModels.indexOf(e);if(-1===t)return;this._pendingModels.splice(t,1)}},p.prototype.createUI=function(){if(!this.uiCreated){var e,t="";if(this.options&&this.options.defaultTitle?(t=this.options.defaultTitle,e=void 0===this.options.localizeTitle||!!this.options.localizeTitle):(t=this.modelTitle,e=!1),t||(t="Browser",e=!0),this.setTitle(t,{localizeTitle:e}),this.uiCreated=!0,this.tree=new r.TreeOnDemand(this.scrollContainer,this.options),this.tree.setGlobalManager(this.globalManager),0!==this._pendingModels.length){for(var i=0;i<this._pendingModels.length;++i)this.createTreeUI(this._pendingModels[i]);this._pendingModels=[]}}},p.prototype.createTreeUI=function(e){if(this.tree.getDelegate(e.id))return!1;var t=new d(this,e);t.setGlobalManager(this.globalManager),this.tree.pushDelegate(t);var i=this;return e.getObjectTree((function(e){i.setInstanceTree(t,e)}),(function(){i.setInstanceTree(t,null)})),!0},p.prototype.setInstanceTree=function(e,t){this.tree.setInstanceTree(e,t)},p.prototype.removeTreeUI=function(e){this.tree.removeDelegate(e.id)&&(this.scrollContainer.scrollTop=0,this.onScroll())},p.prototype.onScroll=function(){this.tree.setScroll(this.scrollContainer.scrollTop)},p.prototype.getNodeLabel=function(e){return this.myDelegate.getNodeLabel(e)},p.prototype.onTreeNodeClick=function(){throw new Error("Method must be overriden.")},p.prototype.onTreeNodeRightClick=function(){throw new Error("Method must be overriden.")},p.prototype.onTitleClick=function(){},p.prototype.onTitleDoubleClick=function(){}},16969:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ObjectContextMenu:()=>o});var n=i(26452),r=i(26206);function o(e){this.viewer=e,this.setGlobalManager(e.globalManager),this.contextMenu=new n.ContextMenu(e)}o.prototype.constructor=o,r.GlobalManagerMixin.call(o.prototype),o.prototype.show=function(e){const t=this.viewer.getSelectionCount(),i=this.viewer.getSelectionVisibility(),n=this.viewer.impl.getCanvasBoundingClientRect(),r=n.width,o=n.height,s=e.clientX-n.left,a=e.clientY-n.top,l={event:e,numSelected:t,hasSelected:0<t,hasVisible:i.hasVisible,hasHidden:i.hasHidden,canvasX:s,canvasY:a,normalizedX:s/r*2-1,normalizedY:(o-a)/o*2-1},c=this.buildMenu(e,l);this.viewer.runContextMenuCallbacks(c,l),c&&0<c.length&&this.contextMenu.show(e,c)},o.prototype.hide=function(){return this.contextMenu.hide()},o.prototype.buildMenu=function(){return null}},42440:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ProgressBar:()=>r});var n=i(38842);function r(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.ownerDocument;this.bg=i.createElement("div"),this.bg.className="progressbg",this.fg=i.createElement("div"),this.fg.className="progressfg",this.bg.appendChild(this.fg),e.appendChild(this.bg),this.lastValue=-1,this.fg.style.transform="scale(0, 1)",this.labels=[],this.showLabel=t,this.registerLabel(e,"ProgressLoading"),this.registerLabel(e,"ProgressLoading"),this.registerLabel(e,"ProgressRendering"),this.registerLabel(e,"ProgressOptimizing")}r.prototype.registerLabel=function(e,t){const i=e.ownerDocument.createElement("div");i.className="progresslb",i.style.opacity="0",i.setAttribute("data-i18n",t),i.textContent=n.A.t(t),this.labels.push(i),e.appendChild(i)},r.prototype.setPercent=function(e,t){e!=this.lastValue&&(this.lastValue=e,e>=100?(this.bg.style.opacity="0",this.labels.forEach((e=>e.style.opacity="0"))):(this.bg.style.opacity="1",this.fg.style.transform=`scale(${e/100}, 1)`,this.showLabel&&this.labels.forEach(((e,i)=>e.style.opacity=t===i?"1":"0"))))},r.prototype.setStyle=function(e){!this.fg.classList.contains(e)&&this.fg.classList.add(e)},r.prototype.removeStyle=function(e){this.fg.classList.contains(e)&&this.fg.classList.remove(e)}},14813:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PropertyPanel:()=>c});var n=i(96551),r=i(87241),o=i(55266),s=i(27623),a=i(38842),l=i(8022);function c(e,t,i,s){n.DockingPanel.call(this,e,t,i,s),this.title.classList.add("docking-panel-delimiter-shadow"),this.container.classList.add("property-panel"),this.container.dockRight=!0,this.createScrollContainer({left:!1,heightAdjustment:70,marginTop:0}),this.highlightableElements={};var a=this;var l=function(){var e=new r.TreeDelegate;function t(e){return"category"===e.type}return e.setGlobalManager(a.globalManager),e.getTreeNodeId=function(e){return e.name+(Object.prototype.hasOwnProperty.call(e,"value")?e.value:"")+(Object.prototype.hasOwnProperty.call(e,"category")?e.category:"")},e.getTreeNodeClass=function(e){return t(e)?a.getCategoryClass(e):a.getPropertyClass(e)},e.isTreeNodeGroup=function(e){return t(e)},e.onTreeNodeClick=function(e,i,n){t(i)?a.onCategoryClick(i,n):a.onPropertyClick(i,n)},e.onTreeNodeRightClick=function(e,i,n){t(i)?a.onCategoryRightClick(i,n):a.onPropertyRightClick(i,n)},e.onTreeNodeDoubleClick=function(e,i,n){t(i)?a.onCategoryDoubleClick(i,n):a.onPropertyDoubleClick(i,n)},e.onTreeNodeIconClick=function(e,i,n){t(i)?a.onCategoryIconClick(i,n):a.onPropertyIconClick(i,n)},e.createTreeNode=function(e,i,n){var r=null;(r=t(e)?a.displayCategory(e,i,n):a.displayProperty(e,i,n))&&(a.highlightableElements[this.getTreeNodeId(e)]=r)},e}();this.tree=new o.Tree(l,null,this.scrollContainer,{}),this.tree.setGlobalManager(this.globalManager)}function h(e){e=String(e);var t=' target="blank" class="propertyLink" ';return[{pattern:/\b(?:https?|ftp):\/\/[a-z0-9-+&@#/%?=~_|()!:,.;]*[a-z0-9-+&@#/%=~_|()]/gim,value:"<a"+t+'href="$&">$&</a>'},{pattern:/(^|[^/])(www\.[\S]+(\b|$))/gim,value:"$1<a"+t+'href="http://$2">$2</a>'}].reduce((function(e,t){return e.replace(t.pattern,t.value)}),e)}c.prototype=Object.create(n.DockingPanel.prototype),c.prototype.constructor=c,c.prototype.setAggregatedProperties=function(e){this.removeAllProperties();const t=Autodesk.Viewing.Private,i=this.viewer.prefs.get(t.Prefs.DISPLAY_UNITS);let n=this.viewer.prefs.get(t.Prefs.DISPLAY_UNITS_PRECISION);const r=Object.prototype.hasOwnProperty.call(e.map,"Name")?e.map.Name.map((e=>e.displayValue)):[];function o(e,t){const r=Number(e);e=isNaN(r)?e:r;var o="number"==typeof n?n:t.precision||(0,s.calculatePrecision)(e),a=(0,s.convertToDisplayUnits)(e,t.type,t.units,i);return(0,s.formatValueWithUnits)(a.displayValue,a.displayUnits,t.type,o)}const c=e.getValue2PropertiesMap("Name");if(c){const e=Object.keys(c);if(1===e.length){const t=e[0],i={name:"aggregate-name"};this.tree.createElement_({name:"Name",value:t,type:"property",category:"",css:i},this.tree.myRootContainer)}else{const e={name:"Name",type:"category",value:"Varies"},t=this.tree.createElement_(e,this.tree.myRootContainer);this.setCategoryCollapsed(e,!0);for(let e in c)this.tree.createElement_({name:e,value:"",type:"property",category:"Name"},t)}}let h=e.getKeysWithCategories().length>0;e.forEach(((t,i)=>{if("Name"===t)return;const n=e.getAggregation(t),s=e.getValue2PropertiesMap(t);if(!n&&!s)return;const c=i[0];if(c.hidden)return;const u=!!c.displayCategory;let d,f="";if(u)f=c.displayCategory,d=this.tree.getElementForNode({name:f}),d=d||this.tree.createElement_({name:f,type:"category"},this.tree.myRootContainer);else if(h){if(f="Other",d=this.tree.getElementForNode({name:f}),!d){let e=f;d=this.tree.createElement_({name:e,type:"category"},this.tree.myRootContainer);const t=d.children[0].children[1];t.setAttribute("data-i18n",e),e=a.A.t(e),t.textContent=e,t.title=e}}else d=this.tree.myRootContainer;const p=Object.keys(s);if(1===p.length){let e=p[0];return e=(0,l.hA)(i[0].type)?o(Number(e),c):e,void(d=this.tree.createElement_({name:c.displayName,value:e,type:"property",category:f,css:{name:"aggregate-name"}},d))}const m={name:c.displayName,value:"Varies",type:"category",category:f};if(d=this.tree.createElement_(m,d),this.setCategoryCollapsed(m,!0),f=c.displayName,(u||h)&&d.classList.add("indented"),n){const e={};for(let t in n){if("count"===t){e[t]=n[t];continue}if("mode"===t){e[t]=n[t].map((e=>o(e,c))).join(", ");continue}const i=n[t];e[t]=o(i,c)}this.tree.createElement_({map:e,default:"sum",type:"property",category:f},d)}const g=[];for(let e in s){const t=o(e,c),i=s[e];for(let e=0;e<i.length;++e){const t=r.indexOf(i[e]);t>-1&&r.splice(t,1)}g.push({name:i,value:t,type:"property",category:f})}r.length>0&&this.tree.createElement_({name:r,value:"--",type:"property",category:f},d),g.forEach((e=>{this.tree.createElement_(e,d)}))}))},c.prototype.setProperties=function(e){this.removeAllProperties();var t=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(!o.hidden){var n=e[r].displayCategory;n&&"string"==typeof n&&""!==n?t.push(o):i.push(o)}}if(t.length+i.length===0)return void this.showNoProperties();i[0]&&"Name"===i[0].displayName&&(this.addProperty(i[0].displayName,i[0].displayValue),i.shift());const r=Autodesk.Viewing.Private,o=this.viewer.prefs.get(r.Prefs.DISPLAY_UNITS);let a=this.viewer.prefs.get(r.Prefs.DISPLAY_UNITS_PRECISION);for(let e=0;e<t.length;e++){let i=t[e],n="number"==typeof a?a:i.precision||(0,s.calculatePrecision)(i.displayValue),r=(0,s.convertToDisplayUnits)(i.displayValue,i.type,i.units,o),l=(0,s.formatValueWithUnits)(r.displayValue,r.displayUnits,i.type,n);this.addProperty(i.displayName,l,i.displayCategory)}for(var l=t.length>0,c=0;c<i.length;c++){let e=i[c],t="number"==typeof a?a:e.precision||(0,s.calculatePrecision)(e.displayValue),n=(0,s.convertToDisplayUnits)(e.displayValue,e.type,e.units,o),r=(0,s.formatValueWithUnits)(n.displayValue,n.displayUnits,e.type,t);this.addProperty(e.displayName,r,l?"Other":"",l?{localizeCategory:!0}:{})}},c.prototype.showNoProperties=function(){this.removeAllProperties();var e=this.tree.myRootContainer,t=this.getDocument().createElement("div");t.className="no-properties";var i="No properties to display";t.setAttribute("data-i18n",i),t.textContent=a.A.t(i),e.appendChild(t)},c.prototype.showDefaultProperties=function(){this.showNoProperties(),this.resizeToContent()},c.prototype.areDefaultPropertiesShown=function(){return!this.hasProperties()},c.prototype.addProperty=function(e,t,i,n){if(this.tree.getElementForNode({name:e,value:t,category:i}))return!1;var r=null,o={name:e,value:t,type:"property"};return i?((r=this.tree.getElementForNode({name:i}))||(r=this.tree.createElement_({name:i,type:"category"},this.tree.myRootContainer,n&&n.localizeCategory?{localize:!0}:null)),o.category=i):r=this.tree.myRootContainer,this.tree.createElement_(o,r,n&&n.localizeProperty?{localize:!0}:null),!0},c.prototype.hasProperties=function(){for(var e in this.highlightableElements)return!0;return!1},c.prototype.removeProperty=function(e,t,i){var n={name:e,value:t,category:i},r=this.tree.getElementForNode(n);return!!r&&(delete this.highlightableElements[this.tree.delegate().getTreeNodeId(n)],r.parentNode.removeChild(r),!0)},c.prototype.removeAllProperties=function(){this.highlightableElements={},this.tree.clear()},c.prototype.setCategoryCollapsed=function(e,t){var i=this.tree.delegate().getTreeNodeId(e);this.tree.setCollapsed(i,t)},c.prototype.isCategoryCollapsed=function(e){var t=this.tree.delegate().getTreeNodeId(e);return this.tree.isCollapsed(t)},c.prototype.getContentSize=function(){var e=this.tree.myRootContainer;return{height:e.clientHeight+55,width:e.clientWidth}},c.prototype.highlight=function(e){function t(t){var i=t.innerHTML,n=i.replace(/(<highlight>|<\/highlight>)/gim,"");if(i!==n&&(t.innerHTML=n),e&&""!==e){var r=new RegExp("(\\b"+e+"\\b)","gim"),o=n.replace(r,"<highlight>$1</highlight>");t.innerHTML=o}}for(var i in this.highlightableElements)for(var n=this.highlightableElements[i],r=0;r<n.length;++r)t(n[r])},c.prototype.displayCategory=function(e,t,i){var n=this.getDocument(),r=n.createElement("div"),o=e.name;i&&i.localize&&(r.setAttribute("data-i18n",o),o=a.A.t(o)),r.textContent=o,r.title=o,r.className="category-name",t.appendChild(r);const s=[r];if(e.value){var l=n.createElement("div");l.textContent=e.value;var c=e.value;l.title=c,c=h(c),l.innerHTML=c,l.className="category-value",t.appendChild(l),s.push(l)}return s},c.prototype.displayProperty=function(e,t,i){var n,r=this.getDocument(),o=r.createElement("div");if(o.className="separator",e.map){n=r.createElement("select");for(let t in e.map){var s=r.createElement("option");s.value=t,t=t.charAt(0).toUpperCase()+t.slice(1),s.setAttribute("data-i18n",t),s.textContent=a.A.t(t),n.add(s)}n.value=e.default,e.value=e.map[e.default],n.className="property-drop-down",o.innerText="="}else{n=r.createElement("div");var l=e.name;i&&i.localize&&(n.setAttribute("data-i18n",l),l=a.A.t(l)),n.textContent=l,n.title=l,n.className="property-name"}var c=r.createElement("div");c.textContent=e.value;var u=e.value;c.title=u,u=h(u),c.innerHTML=u,c.className="property-value",e.map&&n.addEventListener("change",(t=>{const i=t.target.value,n=e.map[i];c.title=n,c.innerHTML=n}),!1);const d=e.css;return d&&(d.name&&n.classList.add(d.name),d.value&&c.classList.add(d.value)),t.appendChild(n),t.appendChild(o),t.appendChild(c),[n,c]},c.prototype.getCategoryClass=function(){return"category"},c.prototype.getPropertyClass=function(){return"property"},c.prototype.onCategoryClick=function(e){this.setCategoryCollapsed(e,!this.isCategoryCollapsed(e))},c.prototype.onPropertyClick=function(){},c.prototype.onCategoryIconClick=function(e){this.setCategoryCollapsed(e,!this.isCategoryCollapsed(e))},c.prototype.onPropertyIconClick=function(){},c.prototype.onCategoryDoubleClick=function(){},c.prototype.onPropertyDoubleClick=function(){},c.prototype.onCategoryRightClick=function(){},c.prototype.onPropertyRightClick=function(){}},47898:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderOptionsPanel:()=>a});var n=i(96551),r=i(19556),o=i(86022),s=i(97005);function a(e){var t=this;this.viewer=e,this.setGlobalManager(e.globalManager),n.DockingPanel.call(this,e.container,"RenderOptionsPanel","Rendering Options");let i=this.getDocument();this.table=i.createElement("table"),this.table.className="adsk-lmv-tftable",this.tbody=i.createElement("tbody"),this.table.appendChild(this.tbody),this.createScrollContainer({heightAdjustment:70}),this.scrollContainer.appendChild(this.table),this.container.style.width="320px",this.container.style.top="260px",this.container.style.left="220px",this.container.style.height="460px",this.container.dockRight=!0,this.saoToggle=new o.OptionCheckbox("AO Enabled",this.tbody,!0),this.saoToggle.setGlobalManager(this.globalManager),this.addEventListener(this.saoToggle,"change",(function(i){var n=t.saoToggle.checked;e.prefs.set("ambientShadows",n),e.setQualityLevel(n,e.impl.renderer().settings.antialias)})),this.saoRadius=new o.OptionSlider("AO Radius",0,200,this.tbody),this.saoRadius.setGlobalManager(this.globalManager),this.saoRadius.setValue(10),this.saoRadius.sliderElement.step=this.saoRadius.stepperElement.step=.01,this.addEventListener(this.saoRadius,"change",(function(i){e.impl.renderer().setAOOptions(parseFloat(t.saoRadius.value),parseFloat(t.saoIntensity.value)),e.impl.renderer().composeFinalFrame()})),this.saoIntensity=new o.OptionSlider("AO Intensity",0,3,this.tbody),this.saoIntensity.setGlobalManager(this.globalManager),this.saoIntensity.setValue(.4),this.saoIntensity.sliderElement.step=this.saoIntensity.stepperElement.step=.01,this.addEventListener(this.saoIntensity,"change",(function(i){e.impl.renderer().setAOOptions(parseFloat(t.saoRadius.value),parseFloat(t.saoIntensity.value)),e.impl.renderer().composeFinalFrame()})),this.groundShadowAlpha=new o.OptionSlider("Shadow Alpha",0,2,this.tbody),this.groundShadowAlpha.setGlobalManager(this.globalManager),this.groundShadowAlpha.setValue(1),this.groundShadowAlpha.sliderElement.step=this.groundShadowAlpha.stepperElement.step=.1,this.addEventListener(this.groundShadowAlpha,"change",(function(i){e.setGroundShadowAlpha(parseFloat(t.groundShadowAlpha.value))})),this.groundShadowColor=new o.OptionCheckbox("Shadow Color",this.tbody),this.groundShadowColor.setGlobalManager(this.globalManager),this.groundShadowColor.checkElement.value="#000000",this.groundShadowColor.checkElement.type="color",this.addEventListener(this.groundShadowColor,"change",(function(i){var n=t.groundShadowColor.checkElement.value;e.setGroundShadowColor(new THREE.Color(parseInt(n.substr(1,7),16)))})),this.groundReflectionAlpha=new o.OptionSlider("Reflection Alpha",0,2,this.tbody),this.groundReflectionAlpha.setGlobalManager(this.globalManager),this.groundReflectionAlpha.setValue(1),this.groundReflectionAlpha.sliderElement.step=this.groundReflectionAlpha.stepperElement.step=.1,this.addEventListener(this.groundReflectionAlpha,"change",(function(i){e.setGroundReflectionAlpha(parseFloat(t.groundReflectionAlpha.value))})),this.groundReflectionColor=new o.OptionCheckbox("Reflection Color",this.tbody),this.groundReflectionColor.setGlobalManager(this.globalManager),this.groundReflectionColor.checkElement.value="#000000",this.groundReflectionColor.checkElement.type="color",this.addEventListener(this.groundReflectionColor,"change",(function(i){var n=t.groundReflectionColor.checkElement.value;e.setGroundReflectionColor(new THREE.Color(parseInt(n.substr(1,7),16)))}));for(var a=[],l=0;l<s.LightPresets.length;l++)a.push(s.LightPresets[l].name);this.envSelect=new o.OptionDropDown("Environment",this.tbody,a,e.impl.currentLightPreset()),this.envSelect.setGlobalManager(this.globalManager),this.addEventListener(this.envSelect,"change",(function(i){var n=t.envSelect.selectedIndex;e.setLightPreset(n)}));var c=e.impl.renderer().getToneMapMethod();this.toneMapMethod=new o.OptionDropDown("Tonemap Method",this.tbody,["None","Canon-Lum","Canon-RGB"],c),this.toneMapMethod.setGlobalManager(this.globalManager),this.addEventListener(this.toneMapMethod,"change",(function(){var i=t.toneMapMethod.selectedIndex;e.impl.setTonemapMethod(i)})),this.exposureBias=new o.OptionSlider("Exposure Bias",-30,30,this.tbody),this.exposureBias.setGlobalManager(this.globalManager),this.exposureBias.setValue(e.impl.renderer().getExposureBias()),this.exposureBias.sliderElement.step=this.exposureBias.stepperElement.step=.1,this.addEventListener(this.exposureBias,"change",(function(i){e.impl.setTonemapExposureBias(t.exposureBias.value,t.whiteScale.value)})),this.exposureBias.setDisabled(0==c),this.whiteScale=new o.OptionSlider("Light Intensity",-5,20,this.tbody),this.whiteScale.setGlobalManager(this.globalManager);var h=0;e.impl.dir_light1&&(h=0!=e.impl.dir_light1.intensity?Math.log(e.impl.dir_light1.intensity)/Math.log(2):-1e-20),this.whiteScale.setValue(h),this.whiteScale.sliderElement.step=this.whiteScale.stepperElement.step=.1,this.addEventListener(this.whiteScale,"change",(function(i){e.impl.dir_light1.intensity=Math.pow(2,t.whiteScale.value),e.impl.setTonemapExposureBias(t.exposureBias.value,t.whiteScale.value)})),this.fovAngle=new o.OptionSlider("FOV-degrees",6.88,100,this.tbody),this.fovAngle.setGlobalManager(this.globalManager),this.fovAngle.setValue(e.getFOV()),this.addEventListener(this.fovAngle,"change",(function(i){e.setFOV(parseFloat(t.fovAngle.value))})),this.frameRate=new o.OptionSlider("Frame rate",1,100,this.tbody),this.frameRate.setGlobalManager(this.globalManager),this.frameRate.setValue(e.impl.getFrameRate()),this.frameRate.sliderElement.step=this.frameRate.stepperElement.step=1,this.addEventListener(this.frameRate,"change",(function(i){e.impl.setFrameRate(t.frameRate.value)})),this.addEventListener(this.viewer,r.CAMERA_CHANGE_EVENT,(function(i){var n=parseFloat(t.fovAngle.value),r=e.getFOV();n!=r&&t.fovAngle.setValue(r)})),this.addEventListener(this.viewer,r.RENDER_OPTION_CHANGED_EVENT,(function(e){t.syncUI()})),this.addEventListener(this.viewer,r.VIEWER_STATE_RESTORED_EVENT,(function(e){t.syncUI()})),this.addVisibilityListener((function(e){e&&t.resizeToContent()}))}a.prototype=Object.create(n.DockingPanel.prototype),a.prototype.constructor=a,a.prototype.getContentSize=function(){return{height:this.table.clientHeight+75,width:this.table.clientWidth}},a.prototype.syncUI=function(){var e=this.viewer.impl,t=0;e.dir_light1&&(t=0!=e.dir_light1.intensity?Math.log(e.dir_light1.intensity)/Math.log(2):-1e-20),this.whiteScale.setValue(t),this.exposureBias.setValue(e.renderer().getExposureBias());var i=e.renderer().getToneMapMethod();this.toneMapMethod.setSelectedIndex(i),this.envSelect.setSelectedIndex(e.currentLightPreset()),this.exposureBias.setDisabled(0==i),this.saoToggle.setValue(e.renderer().getAOEnabled()),this.saoRadius.setDisabled(!e.renderer().getAOEnabled()),this.saoIntensity.setDisabled(!e.renderer().getAOEnabled()),this.saoRadius.setValue(e.renderer().getAORadius()),this.saoIntensity.setValue(e.renderer().getAOIntensity()),this.groundShadowAlpha.setDisabled(!this.viewer.prefs.get("groundShadow")),this.groundShadowColor.setDisabled(!this.viewer.prefs.get("groundShadow")),this.groundReflectionAlpha.setDisabled(!this.viewer.prefs.get("groundReflection")),this.groundReflectionColor.setDisabled(!this.viewer.prefs.get("groundReflection")),this.fovAngle.setValue(this.viewer.getFOV())},a.prototype.uninitialize=function(){n.DockingPanel.prototype.uninitialize.call(this),this.table=null,this.tbody=null,this.saoToggle=null,this.saoRadius=null,this.saoIntensity=null,this.groundShadowAlpha=null,this.envSelect=null,this.toneMapMethod=null,this.exposureBias=null,this.whiteScale=null,this.fovAngle=null,this.viewer=null}},94589:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SettingsPanel:()=>l});var n=i(96551),r=i(38842),o=i(55280),s=i(86022);const a=40;function l(e,t,i,r){n.DockingPanel.call(this,e,t,i,r),this.panelTabs=[],this.tabIdToIndex={},this.controls={},this.controlIdCount=0,this.shown=!1;var o=this,s=r&&void 0!==r.width?r.width:340;this.container.style.maxWidth="800px",this.container.style.minWidth=s+"px",this.container.style.top="10px",this.container.style.left=e.offsetWidth/2-170+"px",this.container.style.position="absolute";var l=this.getDocument();this.tabContainer=l.createElement("div"),this.tabContainer.classList.add("docking-panel-container-solid-color-b"),this.tabContainer.classList.add("settings-tabs"),this.tabContainer.classList.add("docking-panel-delimiter-shadow"),this.container.appendChild(this.tabContainer),this.tabs=l.createElement("ul"),this.tabContainer.appendChild(this.tabs),this.heightAdjustment=r&&r.heightAdjustment?r.heightAdjustment:179,r&&r.hideTabBar&&(this.heightAdjustment-=a,this.tabContainer.style.display="none",this.tabContainer.style.height=0),this.createScrollContainer({left:!1,heightAdjustment:this.heightAdjustment,marginTop:0}),this.tablesContainer=l.createElement("div"),this.tablesContainer.classList.add("settings-tabs-tables-container"),r&&r.hideTabBar&&(this.scrollContainer.style.top=90-a+"px"),this.scrollContainer.appendChild(this.tablesContainer),this.mouseOver=!1,this.addEventListener(this.container,"mouseover",(function(e){var t=e.toElement||e.relatedTarget;if(o.mouseOver)return!0;for(var i=o.getWindow();t&&t.parentNode&&t.parentNode!=i;){if(t.parentNode==this||t==this){t.preventDefault&&t.preventDefault(),o.mouseOver=!0;for(var n=0;n<o.panelTabs.length;n++)o.panelTabs[n].classList.remove("selectedmouseout");return!0}t=t.parentNode}})),this.addEventListener(this.container,"mouseout",(function(e){var t=e.toElement||e.relatedTarget;if(o.mouseOver){for(var i=o.getWindow();t&&t.parentNode&&t.parentNode!=i;){if(t.parentNode==this||t==this)return t.preventDefault&&t.preventDefault(),!1;t=t.parentNode}o.mouseOver=!1;for(var n=0;n<o.panelTabs.length;n++)o.panelTabs[n].classList.contains("tabselected")&&o.panelTabs[n].classList.add("selectedmouseout")}})),this.expandID=function(e){return t+"-"+e}}l.prototype=Object.create(n.DockingPanel.prototype),l.prototype.constructor=l,l.prototype.setVisible=function(e){e&&(this.container.style.display="block",this.shown||(this.resizeToContent(),this.container.style.left=this.parentContainer.offsetWidth/2-this.container.getBoundingClientRect().width/2+"px"),this.shown=!0),n.DockingPanel.prototype.setVisible.call(this,e)},l.prototype.addTab=function(e,t,i){var n=this;if(void 0!==this.tabIdToIndex[e])return!1;var s=i&&void 0!==i.className?i.className:null,a=i&&void 0!==i.width?i.width:200,l=i&&void 0!==i.index?i.index:this.panelTabs.length;var c=this.getDocument(),h=c.createElement("li");h._id=e,h.id=this.expandID(h._id),h.classList.add(s);var u=c.createElement("a"),d=c.createElement("span");d.setAttribute("data-i18n",t),d.textContent=r.A.t(t),u.appendChild(d),h.appendChild(u),this.tabs.appendChild(h);var f=c.createElement("table");f._id=e+"-table",f.id=this.expandID(f._id),f.classList.add("settings-table"),f.classList.add("adsk-lmv-tftable"),f.classList.add(s);var p=c.createElement("tbody");return p.style.display="table",p.style.width="100%",f.appendChild(p),this.tablesContainer.appendChild(f),this.addEventListener(h,"touchstart",o.touchStartToClick),this.addEventListener(h,"click",(function(){n.selectTab(e)})),this.panelTabs.push(h),this.tabIdToIndex[e]=l,a>(this.container.style.minWidth?parseInt(this.container.style.minWidth):0)&&(this.container.style.minWidth=a+"px"),!0},l.prototype.removeTab=function(e){var t=this.tabIdToIndex[e];if(!t)return!1;this.panelTabs.splice(t,1);var i=this.getDocument().getElementById(this.expandID(e));this.tabs.removeChild(i),this.tabIdToIndex={};for(var n=this.panelTabs.length,r=0;r<n;r++){var s=this.panelTabs[r];this.tabIdToIndex[s._id]=r,this.removeEventListener(s,"touchstart",o.touchStartToClick)}return!0},l.prototype.resizeTabs=function(){for(var e=this.tabs.getElementsByTagName("li"),t=100/e.length,i=0;i<e.length;i++)e[i].style.width=t+"%"},l.prototype.hasTab=function(e){var t=this.tabIdToIndex[e];return void 0!==this.panelTabs[t]},l.prototype.selectTab=function(e){if(this.isTabSelected(e))return!1;for(var t=this.getDocument(),i=this.panelTabs.length,n=0;n<i;n++){var r=this.panelTabs[n],o=t.getElementById(this.expandID(r._id+"-table"));e===r._id?(r.classList.add("tabselected"),o.classList.add("settings-selected-table"),this.mouseOver||r.classList.add("selectedmouseout")):(r.classList.remove("tabselected"),o.classList.remove("settings-selected-table"),this.mouseOver||this.panelTabs[n].classList.remove("selectedmouseout"))}return this.scrollContainer.scrollTop=0,!0},l.prototype.isTabSelected=function(e){var t=this.tabIdToIndex[e],i=this.panelTabs[t];return i&&i.classList.contains("tabselected")},l.prototype.getSelectedTabId=function(){for(var e in this.tabIdToIndex)if(this.isTabSelected(e))return e;return null},l.prototype.addLabel=function(e,t){var i,n=this.tabIdToIndex[e];if(-1===n)return!1;i=this.tablesContainer.childNodes[n];var r=new s.OptionLabel(t,i.tBodies[0]);return r.setGlobalManager(this.globalManager),r.sliderRow.classList.add("logical-group"),r},l.prototype.addButton=function(e,t){var i=this.tabIdToIndex[e];if(void 0===i)return null;var n=this.tablesContainer.childNodes[i],r=new s.OptionButton(t,n.tBodies[0]);return r.setGlobalManager(this.globalManager),this.addControl(e,r)},l.prototype.addCheckbox=function(e,t,i,n,r,o){var a=this.tabIdToIndex[e];if(void 0===a)return null;var l=this.tablesContainer.childNodes[a],c=new s.OptionCheckbox(t,l.tBodies[0],i,r,this.globalManager,o);return c.changeListener=function(e){var t=e.detail.target.checked;n(t)},this.addEventListener(c,"change",c.changeListener),this.addControl(e,c)},l.prototype.addRow=function(e,t,i,n){if(void 0===this.tabIdToIndex[e])return null;var r=this.getDocument().getElementById(this.expandID(e+"-table")),o=new s.OptionRow(t,r.tBodies[0],i,n);return o.setGlobalManager(this.globalManager),this.addControl(e,o)},l.prototype.addSlider=function(e,t,i,n,r,o,a){if(void 0===this.tabIdToIndex[e])return null;var l=this.getDocument().getElementById(this.expandID(e+"-table")),c=new s.OptionSlider(t,i,n,l.tBodies[0],a);c.setGlobalManager(this.globalManager),c.setValue(r);var h=1;return a&&a.step&&(h=a.step),c.sliderElement.step=c.stepperElement.step=h,this.addEventListener(c,"change",(function(e){o(e)})),this.addControl(e,c)},l.prototype.addSliderV2=function(e,t,i,n,r,o,s,a){(a=a||{}).hideStepper=!0,a.hideCaption=!0;const l=[];return l.push(this.addRow(e,t,i,a)),l.push(this.addSlider(e,t,n,r,o,s,a)),l},l.prototype.addDropDownMenu=function(e,t,i,n,r,o){if(void 0===this.tabIdToIndex[e])return null;var a=this.getDocument().getElementById(this.expandID(e+"-table")),l=new s.OptionDropDown(t,a.tBodies[0],i,n,null,this.globalManager,o);return l.setGlobalManager(this.globalManager),this.addEventListener(l,"change",(function(e){r(e)})),this.addControl(e,l)},l.prototype.addControl=function(e,t,i){if(void 0===this.tabIdToIndex[e])return null;if(!Object.prototype.hasOwnProperty.call(t,"sliderRow")){var n=i&&i.insertAtIndex?i.insertAtIndex:-1,o=i&&i.caption?i.caption:null,s=this.getDocument(),a=s.getElementById(this.expandID(e+"-table"));n>a.length&&(n=-1);var l=a.tBodies[0].insertRow(n),c=l.insertCell(0);if(o){var h=s.createElement("div");h.setAttribute("data-i18n",o),h.textContent=r.A.t(o),c.appendChild(h),c=l.insertCell(1)}else c.colSpan=3;c.appendChild(t),t.sliderRow=l,t.tbody=a.tBodies[0]}var u=this.expandID("adsk_settings_control_id_"+this.controlIdCount.toString());return this.controlIdCount=this.controlIdCount+1,this.controls[u]=t,t.parent=this,u},l.prototype.removeButton=function(e){return this.removeControl(e)},l.prototype.removeCheckbox=function(e){return this.removeControl(e)},l.prototype.removeSlider=function(e){return this.removeControl(e)},l.prototype.removeDropdownMenu=function(e){return this.removeControl(e)},l.prototype.removeControl=function(e){var t;if("object"==typeof e&&e.tbody){for(var i in t=e,this.controls)if(this.controls[i]===t){e=i;break}}else t=this.controls[e];if(void 0===t)return!1;if(t.removeFromParent)t.removeFromParent();else{var n=t.tbody,r=t.sliderRow.rowIndex;n.deleteRow(r)}return delete this.controls[e],t.parent=void 0,!0},l.prototype.getControl=function(e){return this.controls[e]||null},l.prototype.getContentSize=function(){for(var e=this.heightAdjustment,t=0,i=this.getDocument(),n=0;n<this.panelTabs.length;n++){var r=this.panelTabs[n],o=i.getElementById(this.expandID(r._id+"-table")),s=o?o.clientHeight:0;t=Math.max(t,s)}return{height:e+t,width:this.container.clientWidth}},l.prototype.sizeToContent=function(e){var t=this.getContentSize().height+this.heightAdjustment,i=e.clientHeight-this.heightAdjustment,n=Math.min(t,i);this.container.style.height=parseInt(n)+"px"},l.prototype.addSimpleList=function(e,t,i){var n=new s.SimpleList(e,t,i);return n.setGlobalManager(this.globalManager),n},l.prototype.removeSimpleList=function(e){return!!e&&(e.removeFromParent(),!0)}},55266:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Tree:()=>a});var n=i(55280),r=i(55855),o=i(26206);const s=i(41944);function a(e,t,i,n){this.myDelegate=e,this.mySelectedNodes=[],this.myOptions=n||{},this.parentContainer=i;this.groupClassName=this.myOptions.groupClassName||"expanded",this.leafClassName=this.myOptions.leafClassName||"expanded",this.selectedClassName=this.myOptions.selectedClassName||"selected",this.myGroupNodes=[],this.nodeToElement={},this.nodeIdToNode={};var r=this.myRootContainer=this.createHtmlElement_(i,"div","treeview"),o=this.rootElem=this.createElement_(t,r,n,0);this.setInputHandlers_(),n&&n.excludeRoot&&o.classList.add("exclude")}a.prototype.constructor=a,o.GlobalManagerMixin.call(a.prototype),a.prototype.destroy=function(){this.myDelegate=null,this.parentContainer&&(this.parentContainer.removeChild(this.myRootContainer),this.myRootContainer=null,this.parentContainer=null)},a.prototype.show=function(e){var t=this.myRootContainer;t.style.display=e?"block":"none"},a.prototype.getRootContainer=function(){return this.myRootContainer},a.prototype.getElementForNode=function(e){return"number"!=typeof e&&"string"!=typeof e&&(e=this.myDelegate.getTreeNodeId(e)),this.nodeToElement[e]},a.prototype.delegate=function(){return this.myDelegate},a.prototype.isCollapsed=function(e){return this.hasClass(e,"collapsed")},a.prototype.setCollapsed=function(e,t,i){t?(this.addClass(e,"collapsed",i),this.removeClass(e,"expanded",i)):(this.addClass(e,"expanded",i),this.removeClass(e,"collapsed",i))},a.prototype.setAllCollapsed=function(e){var t,i;e?(t=function(e){return e.classList.contains("expanded")},i=function(e){e.classList.add("collapsed"),e.classList.remove("expanded")}):(t=function(e){return e.classList.contains("collapsed")},i=function(e){e.classList.add("expanded"),e.classList.remove("collapsed")});for(var n=0;n<this.myGroupNodes.length;++n){var r=this.myGroupNodes[n];t(r)&&i(r)}},a.prototype.addToSelection=function(e){var t=this;function i(e){return-1===t.mySelectedNodes.indexOf(e)&&(t.mySelectedNodes.push(e),!0)}for(var n=e.length,r=0;r<n;++r){var o=e[r];i(o)&&this.addClass(o,this.selectedClassName)}},a.prototype.removeFromSelection=function(e){var t=this;function i(e){var i=t.mySelectedNodes.indexOf(e);return-1!==i&&(t.mySelectedNodes.splice(i,1),!0)}for(var n=e.length-1;n>=0;--n){var r=e[n];i(r)&&this.removeClass(r,this.selectedClassName)}},a.prototype.setSelection=function(e){return this.removeFromSelection(this.mySelectedNodes),this.addToSelection(e),this.mySelectedNodes},a.prototype.getSelection=function(){return this.mySelectedNodes.concat()},a.prototype.clearSelection=function(){this.removeFromSelection(this.mySelectedNodes)},a.prototype.isSelected=function(e){return this.hasClass(e,this.selectedClassName)},a.prototype.scrollTo=function(e){var t=this.getElementForNode(e);if(t){var i=t.offsetTop;for(t=t.parentNode;t&&t!=this.myRootContainer;)i+=t.offsetTop,t=t.parentNode;var n=this.myRootContainer.parentNode;this.myDelegate.getScrollContainer()&&(n=this.myDelegate.getScrollContainer()),n.scrollTop=i}},a.prototype.addClass=function(e,t,i){var n=this.getElementForNode(e);if(n){if(i){n=n.parentNode;for(var r=this.myOptions.excludeRoot?this.rootElem:this.myRootContainer;n&&n!==r;)n.classList.add(t),n=n.parentNode}else n.classList.add(t);return!0}return!1},a.prototype.removeClass=function(e,t,i){var n=this.getElementForNode(e);if(n){if(i){n=n.parentNode;for(var r=this.myOptions.excludeRoot?this.rootElem:this.myRootContainer;n&&n!==r;)n.classList.remove(t),n=n.parentNode}else n.classList.remove(t);return!0}return!1},a.prototype.hasClass=function(e,t){return this.getElementForNode(e).classList.contains(t)},a.prototype.clear=function(){for(var e=this.myRootContainer;e.hasChildNodes();)e.removeChild(e.lastChild);this.nodeToElement={},this.nodeIdToNode={}},a.prototype.createElement_=function(e,t,i,n){if(null==e)return null;if(!this.myDelegate.shouldCreateTreeNode(e))return null;var r,o=this;function s(t,r,s,a){var l=o.createHtmlElement_(t,r,s),c=o.myDelegate.getTreeNodeId(a);l.setAttribute("lmv-nodeId",c);var h=o.createHtmlElement_(l,"lmvheader"),u=o.createHtmlElement_(h,"icon");return u.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()}),!1),u.addEventListener("click",(function(t){o.myDelegate.onTreeNodeIconClick(o,e,t),t.stopPropagation(),t.preventDefault()}),!1),o.myDelegate.createTreeNode(e,h,i,r,n),l}var a=this.myDelegate.getTreeNodeId(e),l=o.myOptions.excludeRoot?1:0;o.myDelegate.isTreeNodeGroup(e)?(r=s(t,"group",o.groupClassName,e),o.nodeToElement[a]=r,o.nodeIdToNode[a]=e,n==l&&(r.style.left="0px"),o.myGroupNodes.push(r),o.myDelegate.forEachChild(e,(function(e){o.createElement_(e,r,i,n+1)}))):(r=s(t,"leaf",o.leafClassName,e),o.nodeToElement[a]=r,o.nodeIdToNode[a]=e,n==l&&(r.style.marginLeft="0px"));var c=o.myDelegate.getTreeNodeClass(e);return c&&r.classList.add(c),r},a.prototype.setInputHandlers_=function(){var e=this,t=this.myRootContainer,i=null,o=function(n){var r=null,o=!1;do{n&&n!==t?n.hasAttribute("lmv-nodeId")?(r=n,o=!0):n=n.parentElement:(r=null,o=!0)}while(!o);if(r){var s=r.getAttribute("lmv-nodeId");return e.nodeIdToNode[s]||i}return i};(0,n.isTouchDevice)()&&(this.hammer=new s.Manager(t,{recognizers:[r.GestureRecognizers.doubletap,r.GestureRecognizers.press],handlePointerEventMouse:!1,inputClass:s.TouchInput}),this.hammer.on("doubletap",(function(t){var n=o(t.target);n!==i&&e.myDelegate.onTreeNodeDoubleClick(e,n,t)})),this.hammer.on("press",(function(t){var n=o(t.target);n!==i&&e.myDelegate.onTreeNodeRightClick(e,n,t)}))),t.addEventListener("click",(function(t){var n=o(t.target);n!==i&&(e.myDelegate.onTreeNodeClick(e,n,t),t.stopPropagation(),t.target.classList.contains("propertyLink")||t.preventDefault())}),!1),t.addEventListener("dblclick",(function(t){var n=o(t.target);n!==i&&(e.myDelegate.onTreeNodeDoubleClick(e,n,t),t.stopPropagation(),t.preventDefault())}),!1),t.addEventListener("contextmenu",(function(t){var n=o(t.target);n!==i&&(e.myDelegate.onTreeNodeRightClick(e,n,t),t.stopPropagation(),t.preventDefault())}),!1),t.addEventListener("mouseover",(function(t){var n=o(t.target);n!==i&&(e.myDelegate.onTreeNodeHover(e,n,t),t.stopPropagation(),t.preventDefault())}),!1),t.addEventListener("mouseout",(function(t){var i=t.toElement||t.relatedTarget;if(o(t.target)!=o(i)){e.myDelegate.onTreeNodeHover(e,-1,t),t.stopPropagation(),t.preventDefault()}}),!1)},a.prototype.createHtmlElement_=function(e,t,i){var n=this.getDocument().createElement(t);return e.appendChild(n),i&&(n.className=i),n},a.prototype.iterate=function(e,t){if(null!=e&&this.myDelegate.shouldCreateTreeNode(e)){var i=this.getElementForNode(e);if(i){t(e,i);var n=this;this.myDelegate.forEachChild(e,(function(e){n.iterate(e,t)}))}}}},87241:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TreeDelegate:()=>r});var n=i(38842);function r(){}i(26206).GlobalManagerMixin.call(r.prototype),r.prototype.constructor=r,r.prototype.isTreeNodeGroup=function(e){throw"isTreeNodeGroup is not implemented."},r.prototype.getTreeNodeId=function(e){throw"getTreeNodeId is not implemented."},r.prototype.getTreeNodeIndex=function(e){throw"getTreeNodeIndex is not implemented."},r.prototype.getTreeNodeParentId=function(e){throw"getTreeNodeParentId is not implemented."},r.prototype.getTreeNodeLabel=function(e){return e.name},r.prototype.getTreeNodeCount=function(){throw"getTreeNodeCount is not implemented."},r.prototype.shouldCreateTreeNode=function(e){return!0},r.prototype.forEachChild=function(e,t){for(var i=e.children?e.children.length:0,n=0;n<i;++n){t(e.children[n])}},r.prototype.createTreeNode=function(e,t,i,r,o){var s=this.getDocument().createElement("label");t.appendChild(s);var a=this.getTreeNodeLabel(e);return i&&i.localize&&(s.setAttribute("data-i18n",a),a=n.A.t(a)),s.textContent=a,s},r.prototype.onTreeNodeClick=function(e,t,i){},r.prototype.onTreeNodeIconClick=function(e,t,i){e.delegate().isTreeNodeGroup(t)&&e.setCollapsed(t,!e.isCollapsed(t))},r.prototype.onTreeNodeDoubleClick=function(e,t,i){},r.prototype.onTreeNodeRightClick=function(e,t,i){},r.prototype.onTreeNodeReized=function(e){},r.prototype.getTreeNodeClass=function(e){return""},r.prototype.getTreeNodeParentMaxSize=function(e){return{width:0,height:0}},r.prototype.getTreeNodeClientHeight=function(e){return 0},r.prototype.getTreeNodeDepthOffset=function(e,t){return 0},r.prototype.onTreeNodeHover=function(e,t,i){},r.prototype.getScrollContainer=function(){return null},r.prototype.dtor=function(){}},76948:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TreeOnDemand:()=>u});var n=i(55280),r=i(55855),o=i(98087),s=i(38842),a=i(26206);const l=i(41944);var c=150,h=300;function u(e,t){this.dirty=!1,this.nextFrameId=0,this.scrollY=0,this.delegates=[],this.idToDelegate={},this.options=t;var i=this.getDocument();this.rootContainer=i.createElement("div"),this.rootContainer.classList.add("docking-panel-container-gradient"),this.rootContainer.classList.add("treeview"),this.rootContainer.classList.add("on-demand"),e.appendChild(this.rootContainer),this.paddingDiv=i.createElement("div"),this.paddingDiv.style.border=0,this.paddingDiv.style.margin=0,this.paddingDiv.style.padding=0,this.sizedDiv=e.parentNode,this.nodeCssTable=[[],["group"],["leaf"]],this.cssStringToNodeCssTable={"":0,group:1,leaf:2},this.nodeIndexToNodeCssTables={};for(var s=[],a=c,h=0;h<a;++h){var u=_(i);s[h]=u}this.elementsPool=s,this.elementsUsed=0,this.spinner=new o.LoadingSpinner(e),this.spinner.setGlobalManager(this.globalManager),this.spinner.addClass("tree-loading-spinner");var d=(0,n.isTouchDevice)();d&&(this.hammer=new l.Manager(this.rootContainer,{recognizers:[r.GestureRecognizers.doubletap,r.GestureRecognizers.press],handlePointerEventMouse:!1,inputClass:l.TouchInput}));for(h=0;h<a;++h){u=s[h];d&&(this.hammer.on("doubletap",E.bind(this)),this.hammer.on("press",S.bind(this))),u.addEventListener("click",A.bind(this)),u.addEventListener("dblclick",w.bind(this)),u.addEventListener("contextmenu",T.bind(this)),u.icon.addEventListener("click",M.bind(this)),u.icon.addEventListener("mousedown",C.bind(this))}m(this)}var d=u.prototype;function f(e){if(e.dirty=!1,function(e){for(var t=e.elementsUsed,i=e.elementsPool,n=0;n<t;++n){var r=i[n];r.setAttribute("lmv-nodeId",""),r.className="";var o=r.header,s=o.childNodes.length-1;o._mouseDownListener&&(o.removeEventListener("mousedown",o._mouseDownListener),o._mouseDownListener=null);for(var a=0;a<s;++a)o.removeChild(o.lastChild);o.lastChild._mouseDownListener&&(o.lastChild.removeEventListener("mousedown",o.lastChild._mouseDownListener),o.lastChild._mouseDownListener=null),o.lastChild._clickListener&&(o.lastChild.removeEventListener("click",o.lastChild._clickListener),o.lastChild._clickListener=null)}e.clear()}(e),e.displayNoProperties(!1),0!==e.delegates.length)if(1===e.delegates.length&&e.delegates[0].isLoading())e.spinner.setVisible(!0);else{if(1===e.delegates.length&&e.delegates[0].isNotAvailable())return e.spinner.setVisible(!1),void e.displayNoProperties(!0);e.spinner.setVisible(!1),function(e){var t=e.rootContainer,i=function(e){return{width:0|e.sizedDiv.clientWidth,height:0|e.sizedDiv.clientHeight}}(e),n=i.height,r=0,o=0,s=!0;t.appendChild(e.paddingDiv);var a=e.delegates.slice(0),l=e.isExcludeRoot();for(;a.length;){var c=a.shift();let i={};const C=c.model.isOTG();if(C){const e=c.model.loader.getLoadedDbIds();i=c.instanceTree.nodeAccess.dbIdToIndexFiltered((t=>e.has(t)))}var u=c.modelDiv;t.appendChild(u);for(var d=[c.getRootId()],f={curr:l?-1:0,popIds:[]};d.length&&s;){if(r>e.scrollY+n+h){s=!1;break}if(e.elementsUsed===e.elementsPool.length){s=!1;break}var m=d.shift();if(!C||i[m]){var g=r+(T=-1===f.curr?0:c.getTreeNodeClientHeight(m));if(T>0&&g+h>=e.scrollY){var v=e.elementsPool[e.elementsUsed++];v.setAttribute("lmv-nodeId",m),c.createTreeNode(m,v.header);var y=c.getTreeNodeClass(m);y&&v.classList.add(y);var x=b(e,c,m);if(x)for(var _=x.length,E=0;E<_;++E)v.classList.add(x[E]);var S=c.getTreeNodeDepthOffset(m,f.curr);v.header.style.paddingLeft=S+"px",u.appendChild(v)}if(g+h<e.scrollY&&(o=g),r=g,(M=p(e,c,m,0===T))&&M.length>0){f.curr++;for(var A=M[M.length-1],w=f.popIds.length-1;w>=0&&f.popIds[w]===m;)f.popIds[w--]=A;f.popIds.push(A),d=M.concat(d)}for(;f.popIds.length>0&&m===f.popIds[f.popIds.length-1];)f.popIds.pop(),f.curr--}else for(;f.popIds.length>0&&m===f.popIds[f.popIds.length-1];)f.popIds.pop(),f.curr--}for(e.paddingDiv.style.height=o+"px";d.length;){var T,M;m=d.shift();r=g=r+(T=-1===f.curr?0:c.getTreeNodeClientHeight(m)),(M=p(e,c,m))&&M.length&&(d=M.concat(d))}}t.style.height=r+"px"}(e)}else e.spinner.setVisible(!1)}function p(e,t,i,n){if(!t.isTreeNodeGroup(i))return null;if(!n&&e.isCollapsed(t,i))return null;var r=[];return t.forEachChild(i,(function(e){r.push(e)})),r}function m(e,t){e.dirty&&!t||(t?f(e):(e.dirty=!0,e.nextFrameId=requestAnimationFrame((function(){f(e)}))))}function g(e,t){return"number"!=typeof t&&"string"!=typeof t?e.threeDelegate.getTreeNodeId(0|t):t}function v(e,t){for(var i=null;t&&t!==e.rootContainer;){if(t.hasAttribute("lmv-nodeId")){i=t;break}t=t.parentElement}if(!i)return null;var n=i.getAttribute("lmv-nodeId");return parseFloat(n)}function y(e,t){for(var i=null;t&&t!==e.rootContainer;){if(t.hasAttribute("lmv-modelId")){i=t;break}t=t.parentElement}if(!i)return null;var n=i.getAttribute("lmv-modelId");return parseInt(n)}function b(e,t,i){if(t.isControlId(i))return t.getControlIdCss(i);var n=t.getTreeNodeIndex(i);return e.nodeCssTable[e.nodeIndexToNodeCssTables[t.model.id][n]]}function x(e,t,i,n){var r=n.join(" "),o=e.cssStringToNodeCssTable[r]||e.nodeCssTable.length;o===e.nodeCssTable.length&&(e.nodeCssTable.push(n),e.cssStringToNodeCssTable[r]=o);var s=t.getTreeNodeIndex(i);e.nodeIndexToNodeCssTables[t.model.id][s]=o}function _(e,t,i){var n=e.createElement("lmvheader"),r=e.createElement("icon");n.appendChild(r);var o=e.createElement("div");return o.header=n,o.icon=r,o.appendChild(n),o}function E(e){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&n.onTreeNodeDoubleClick(this,t,e)}}function S(e){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&n.onTreeNodeRightClick(this,t,e)}}function A(e){if(!e.target.classList.contains("group")&&!e.target.classList.contains("leaf")){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&(n.onTreeNodeClick(this,t,e),e.stopPropagation(),e.preventDefault())}}}function w(e){if(!e.target.classList.contains("group")&&!e.target.classList.contains("leaf")){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&(n.onTreeNodeDoubleClick(this,t,e),e.stopPropagation(),e.preventDefault())}}}function T(e){if(!e.target.classList.contains("group")&&!e.target.classList.contains("leaf")){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&(n.onTreeNodeRightClick(this,t,e),e.stopPropagation(),e.preventDefault())}}}function M(e){var t=v(this,e.target);if(t){var i=y(this,e.target),n=this.getDelegate(i);n&&(n.onTreeNodeIconClick(this,t,e),e.stopPropagation(),e.preventDefault())}}function C(e){e.stopPropagation(),e.preventDefault()}d.constructor=u,a.GlobalManagerMixin.call(d),d.pushDelegate=function(e){this.delegates.push(e),this.idToDelegate[e.model.id]=e,m(this)},d.removeDelegate=function(e){for(var t=0;t<this.delegates.length;++t){var i=this.delegates[t];if(i.model.id===e)return this.delegates.splice(t,1),delete this.idToDelegate[e],delete this.nodeIndexToNodeCssTables[e],i.dtor(),m(this),!0}return!1},d.setInstanceTree=function(e,t){if(e.setInstanceTree(t),m(this),t){var i=new Uint8Array(e.getTreeNodeCount()),n=e.instanceTree.getRootId();e.forEachChild(n,(function(t){var n=e.getTreeNodeIndex(t);i[n]=e.isTreeNodeGroup(t)?1:2}),!0);var r=e.model.id;this.nodeIndexToNodeCssTables[r]=i;var o=0,s=0;t.enumNodeChildren(n,(function(e){s||(o=e),s++})),this.setAllCollapsed(e,!0);var a=this.options.excludeRoot,l=this.options.startCollapsed;a?(this.setCollapsed(e,n,!1),l||this.setCollapsed(e,o,!1)):l||this.setCollapsed(e,e.rootId,!1),m(this,!0)}},d.show=function(e){this.rootContainer.style.display=block},d.getRootContainer=function(){return this.rootContainer},d.getDelegate=function(e){return this.idToDelegate[parseInt(e)]},d.isCollapsed=function(e,t){var i=b(this,e,t);return i&&-1!==i.indexOf("collapsed")},d.setCollapsed=function(e,t,i,n){i?(this.addClass(e,t,"collapsed",n),this.removeClass(e,t,"expanded",n)):(this.addClass(e,t,"expanded",n),this.removeClass(e,t,"collapsed",n))},d.setAllCollapsed=function(e,t){var i=function(t){this.addClass(e,t,"collapsed",!1),this.removeClass(e,t,"expanded",!1)}.bind(this),n=e.instanceTree.getRootId();this.iterate(e,n,(function(t){return e.isTreeNodeGroup(t)&&i(t),!0}))},d.addToSelection=function(e,t){for(var i=t.length,n=0;n<i;++n)this.addClass(e,t[n],"selected",!1);m(this)},d.removeFromSelection=function(e,t){for(var i=t.length,n=0;n<i;++n)this.removeClass(e,t[n],"selected",!1);m(this)},d.setSelection=function(e,t){return this.clearSelection(e),this.addToSelection(e,t),this.selectedNodes},d.clearSelection=function(e){var t=[],i=function(i){var n=b(this,e,i);n&&-1!==n.indexOf("selected")&&(t[0]=i,this.removeFromSelection(e,t))}.bind(this),n=e.instanceTree.getRootId();e.forEachChild(n,i,!0)},d.isSelected=function(e){var t=b(this,delegate,e);return t&&-1!==t.indexOf("selected")},d.scrollTo=function(e,t){var i=this.getDelegate(t.id);if(!i||!i.isNotAvailable()){var n=!1,r=[],o=function(t,i){if(!(n=n||e===t)){r.push(i.getTreeNodeClientHeight(t));var s=r.length,a=i.isTreeNodeGroup(t)&&-1!==b(this,i,t).indexOf("expanded");i.forEachChild(t,(function(e){o(e,i)})),a||n||r.length>s&&r.splice(s)}}.bind(this);this.setCollapsed(i,e,!1,!0);var s=i.getRootId();if(o(s,i),!n)return-1;for(var a=0,l=r.length,c=this.isExcludeRoot()?1:0;c<l;++c)a+=r[c];if(1===this.delegates.length)return m(this,!0),a;for(c=0;c<this.delegates.length;++c){var h=this.delegates[c];if(h===i)break;r=[],e=-1,n=!1,s=h.getRootId(),o(s,h),l=r.length;for(var u=0,d=0;d<l;++d)u+=r[d];a+=u}return m(this,!0),a}},d.addClass=function(e,t,i,n){function r(t,i,n){var r=b(t,e,i);r&&(-1===r.indexOf(n)&&((r=r.slice(0)).push(n),r.sort(),x(t,e,i,r)))}if(n)for(var o=e.getTreeNodeParentId(g(this,t));o;)r(this,o,i),o=e.getTreeNodeParentId(o);else r(this,t,i);return m(this),!0},d.removeClass=function(e,t,i,n){function r(t,i,n){var r=b(t,e,i);if(r){var o=r.indexOf(n);-1!==o&&((r=r.slice(0)).splice(o,1),x(t,e,i,r))}}if(n)for(var o=e.getTreeNodeParentId(g(this,t));o;)r(this,o,i),o=e.getTreeNodeParentId(o);else r(this,t,i);return m(this),!0},d.hasClass=function(e,t){return 1!==b(this,delegate,e).indexOf(t)},d.clear=function(){for(var e,t=this.rootContainer;e=t.lastChild;)t.removeChild(e);for(var i=0;i<this.delegates.length;++i)this.delegates[i].clean();this.elementsUsed=0},d.iterate=function(e,t,i){null!=t&&e.shouldCreateTreeNode(t)&&i(t)&&e.forEachChild(t,function(t){this.iterate(e,t,i)}.bind(this))},d.forEachDelegate=function(e){for(var t=0;t<this.delegates.length;++t)e(this.delegates[t])},d.destroy=function(){this.clear(),cancelAnimationFrame(this.nextFrameId),this.rootContainer.parentNode.removeChild(this.rootContainer),this.rootContainer=null,this.rootId=-1,this.nodeCssTable=null,this.nodeIndexToNodeCssTables=null,this.cssStringToNodeCssTable=null,this.elementsPool=null,this.elementsUsed=-1,this.scrollY=-1,this.hammer&&(this.hammer.destroy(),this.hammer=null)},d.setScroll=function(e){Math.abs(this.scrollY-e)>h&&(this.scrollY=e,m(this))},d.displayNoProperties=function(e){var t=this.getDocument();if(e){if(!this.divNoProps){this.divNoProps=t.createElement("div");var i="Model Browser is not available";this.divNoProps.innerText=s.A.t(i),this.divNoProps.setAttribute("data-i18n",i),this.divNoProps.classList.add("lmv-no-properties")}if(!this.divNoProps.parentNode)this.rootContainer.parentNode.appendChild(this.divNoProps)}else this.divNoProps&&this.divNoProps.parentNode&&this.divNoProps.parentNode.removeChild(this.divNoProps)},d.isExcludeRoot=function(){return 1===this.delegates.length&&this.options.excludeRoot},d.getDelegateCount=function(){return this.delegates.length}},72738:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewerModelStructurePanel:()=>d,generateDefaultViewerHandlerOptions:()=>c});var n=i(99587),r=i(11674),o=i(19556),s=i(77995),a=i(83081),l=i(81215);const c=e=>({onSearchSelected:function(t){var i=t.id,n=e.impl.findModel(t.modelId);e.setAggregateIsolation([{model:n,ids:[i]}])},onVisibilityIconClick:function(t,i){e.toggleVisibility(t,i)},onCreateUI:function(t){e.resizePanels&&e.resizePanels({dockingPanels:[t]}),t.scrollContainer.addEventListener("contextmenu",function(t){e.contextMenu.show(t)}.bind(t))},onIsolate:function(t,i){if(e.setAggregateIsolation([{model:i,ids:[t]}]),e.fitToView([t],i,!1),i){var n={type:o.SHOW_PROPERTIES_EVENT,dbId:t,model:i};e.dispatchEvent(n)}},onToggleMultipleOverlayedSelection:function(t){e.impl.selector.setAggregateSelection(t.map((t=>({model:e.impl.findModel(parseInt(t.modelId)),ids:t.ids}))));var i=e.getAggregateSelection();e.fitToView(i)},onToggleOverlayedSelection:function(t,i,n){n?e.select([],void 0,i):(e.select(t,i),e.fitToView([t],i,!1))},onTreeNodeRightClick:function(t){e.contextMenu.show(t)},onSelectOnly:function(t,i){e.select(t,i)},onDeselectAll:function(){e.clearSelection()},onSelectToggle:function(t,i){e.toggleSelect(t,i)},onShowAll:function(){e.showAll()},onFocus:function(){e.fitToView()},onHide:function(t,i){e.hide(t,i)},onShow:function(t,i){e.show(t,i)},onToggleVisibility:function(t,i){e.toggleVisibility(t,i)},getAggregateIsolation:e.getAggregateIsolation.bind(e),getAggregateHiddenNodes:e.getAggregateHiddenNodes.bind(e),getAggregateSelection:e.getAggregateSelection.bind(e),globalManager:e.globalManager,container:e.container,removeEventListener:e.removeEventListener.bind(e),addEventListener:e.addEventListener.bind(e)}),h=Autodesk.Viewing.Private;var u={click:{onObject:["isolate"]},clickShift:{onObject:["toggleMultipleOverlayedSelection"]},clickCtrl:{onObject:["toggleVisibility"]}};function d(e,t,i){let o={...i}||{},l=t;e instanceof Autodesk.Viewing.GuiViewer3D||e instanceof Autodesk.Viewing.Viewer3D?(a.logger.warn("Deprecated use of Viewer as parameter. Use options callbacks instead"),o={...o,...c(e)}):o={...e},this.visible=!1,this._trackNodeClick=!0,o.defaultTitle="Model",o.excludeRoot=void 0===o.excludeRoot||o.excludeRoot,o.startCollapsed=void 0!==o.startCollapsed&&o.startCollapsed,o.scrollEaseCurve=o.scrollEaseCurve||[0,0,.29,1],o.scrollEaseSpeed=void 0!==o.scrollEaseSpeed?o.scrollEaseSpeed:.003,o.addFooter=void 0===o.addFooter||o.addFooter,this.clickConfig=o&&o.docStructureConfig?o.docStructureConfig:u,this.isMac=-1!==navigator.userAgent.search("Mac OS"),o.hideSearch?(o.heightAdjustment=70,n.ModelStructurePanel.call(this,o.container,o.container.id+"ViewerModelStructurePanel",l,o),this.scrollContainer.classList.add("no-search")):(o.heightAdjustment=104,n.ModelStructurePanel.call(this,o.container,o.container.id+"ViewerModelStructurePanel",l,o),this.searchbox=new s.Searchbox(o.container.id+"ViewerModelStructurePanel-Searchbox",o.container,{excludeRoot:o.excludeRoot,searchFunction:f.bind(this)}),this.searchbox.setGlobalManager(this.globalManager),o.onSearchSelected&&this.searchbox.addEventListener(r.j,o.onSearchSelected),this.container.appendChild(this.searchbox.container)),this.setGlobalManager(o.globalManager),this._ignoreScroll=!1,this.selectedNodes={},this.onViewerSelect=this.onViewerSelect.bind(this),this.onViewerIsolate=this.onViewerIsolate.bind(this),this.onViewerHide=this.onViewerHide.bind(this),this.onViewerShow=this.onViewerShow.bind(this)}function f(e){var t=this.tree,i=e.toLowerCase(),n=[];return t.forEachDelegate((function(e){var r=e.getRootId(),o=[];t.iterate(e,r,(function(t){var n=e.instanceTree&&e.instanceTree.getNodeName(t);return n&&-1!==n.toLowerCase().indexOf(i)&&o.push(t),!0})),n.push({ids:o,delegate:e})})),h.analytics.track("viewer.model_browser",{from:"Panel",action:"Search"}),n}d.prototype=Object.create(n.ModelStructurePanel.prototype),d.prototype.constructor=d,l.ViewerPanelMixin.call(d.prototype),d.prototype.uninitialize=function(){var e,t,i,r,s,a,l,c;null===(e=(t=this.options).removeEventListener)||void 0===e||e.call(t,o.AGGREGATE_SELECTION_CHANGED_EVENT,this.onViewerSelect),null===(i=(r=this.options).removeEventListener)||void 0===i||i.call(r,o.AGGREGATE_ISOLATION_CHANGED_EVENT,this.onViewerIsolate),null===(s=(a=this.options).removeEventListener)||void 0===s||s.call(a,o.HIDE_EVENT,this.onViewerHide),null===(l=(c=this.options).removeEventListener)||void 0===l||l.call(c,o.SHOW_EVENT,this.onViewerShow),this.searchResults&&(this.searchResults.uninitialize(),this.searchResults=null),n.ModelStructurePanel.prototype.uninitialize.call(this)},d.prototype.resizeToContent=function(){var e=this.scrollContainer,t=this.tree?this.tree.getRootContainer():null;if(e&&t){var i="calc(100% + "+e.scrollLeft+"px)";t.style.width=i}},d.prototype.createUI=function(){var e,t,i,r,s,a,l,c,h,u;if(!this.uiCreated){n.ModelStructurePanel.prototype.createUI.call(this),this.scrollContainer.classList.remove("left");var d=function(){this.visible&&this.resizeToContent(),requestAnimationFrame(d)}.bind(this);d(),null===(e=(t=this.options).onCreateUI)||void 0===e||e.call(t,this);var f=this.options,p=f.maxHeight?f.maxHeight:"calc("+this.container.style.maxHeight+" - 30px)";this.container.style.top="10px",this.container.style.left="10px",this.container.style.height=p,this.container.style.maxHeight=p,null===(i=(r=this.options).addEventListener)||void 0===i||i.call(r,o.AGGREGATE_SELECTION_CHANGED_EVENT,this.onViewerSelect),null===(s=(a=this.options).addEventListener)||void 0===s||s.call(a,o.AGGREGATE_ISOLATION_CHANGED_EVENT,this.onViewerIsolate),null===(l=(c=this.options).addEventListener)||void 0===l||l.call(c,o.HIDE_EVENT,this.onViewerHide),null===(h=(u=this.options).addEventListener)||void 0===h||h.call(u,o.SHOW_EVENT,this.onViewerShow)}},d.prototype.onViewerSelect=function(e){this.setSelection(e.selections),this._ignoreScroll||this.scrollToSelection(e.selections),this._ignoreScroll=!1},d.prototype.onViewerIsolate=function(e){this.setIsolation(e.isolation)},d.prototype.onViewerHide=function(e){this.setHidden(e.nodeIdArray.slice(),e.model,!0)},d.prototype.onViewerShow=function(e){this.setHidden(e.nodeIdArray.slice(),e.model,!1)},d.prototype.setVisible=function(e){n.ModelStructurePanel.prototype.setVisible.call(this,e),this.visible!==e&&(this.visible=e,this.visible&&this.sync())},d.prototype.sync=function(){var e,t,i,n,r,o,s=(null===(e=(t=this.options).getAggregateIsolation)||void 0===e?void 0:e.call(t))||[],a=(null===(i=(n=this.options).getAggregateHiddenNodes)||void 0===i?void 0:i.call(n))||[],l=(null===(r=(o=this.options).getAggregateSelection)||void 0===r?void 0:r.call(o))||[];if(this.setIsolation(s),0===s.length)for(var c=0;c<a.length;++c){var h=a[c].model,u=a[c].ids;this.setHidden(u,h,!0)}this.setSelection(l),this.scrollToSelection(l)},d.prototype.removeTreeUI=function(e){delete this.selectedNodes[e.id],n.ModelStructurePanel.prototype.removeTreeUI.call(this,e)},d.prototype.setHidden=function(e,t,i){for(var n=this.tree,r=n.getDelegate(t.id),o=i?function(e){return n.addClass(r,e,"dim",!1),n.removeClass(r,e,"visible",!1),!0}:function(e){return n.removeClass(r,e,"dim",!1),n.addClass(r,e,"visible",!1),!0},s=0;s<e.length;++s)n.iterate(r,e[s],o)},d.prototype.setIsolation=function(e){var t=this.tree;if(0!==e.length){var i=[];e.length&&this.tree.forEachDelegate(function(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].model===t.model){n=r;break}-1===n&&i.push(t)}.bind(this));for(let i=0;i<e.length;++i){const r=e[i].model,o=r.getData().instanceTree;if(!o)continue;const s=o.getRootId(),a=t.getDelegate(r.id);t.iterate(a,s,(function(e){return t.removeClass(a,e,"dim",!1),t.removeClass(a,e,"visible",!1),!0}));var n=e[i].ids;0!==n.length&&(1===n.length&&n[0]===s||(this.setHidden([s],r,!0),this.setHidden(n,r,!1)))}for(let e=0;e<i.length;++e){const n=i[e],r=n.model,o=n.instanceTree;if(!o)continue;const s=o.getRootId();t.iterate(n,s,(function(e){return t.removeClass(n,e,"dim",!1),t.removeClass(n,e,"visible",!1),!0})),this.setHidden([s],r,!0)}}else t.forEachDelegate(function(e){var i=e.model,n=e.instanceTree;if(n){var r=n.getRootId();t.iterate(e,r,(function(i){return t.removeClass(e,i,"dim",!1),t.removeClass(e,i,"visible",!1),!0})),this.setHidden([r],i,!1)}}.bind(this))},d.prototype.setSelection=function(e){var t,i,n,r,o,s,a,l=this.tree;for(var c in this.selectedNodes)if(o=this.selectedNodes[c],(s=l.getDelegate(c))&&(a=s.instanceTree)){for(i=0;i<o.length;++i)for(n=a.getNodeParentId(o[t]);n;)l.removeClass(s,n,"ancestor-selected"),n=a.getNodeParentId(n);l.clearSelection(s)}for(this.selectedNodes={},t=0;t<e.length;++t)if(r=e[t].model,o=e[t].dbIdArray||e[t].selection,(s=l.getDelegate(r.id))&&(a=s.instanceTree)){for(i=0;i<o.length;++i)for(n=a.getNodeParentId(o[t]);n;)l.addClass(s,n,"ancestor-selected"),n=a.getNodeParentId(n);l.setSelection(s,o),this.selectedNodes[r.id]=o.concat()}},d.prototype.scrollToSelection=function(e){var t=e[0];if(t){var i=t.model,n=t.dbIdArray||t.selection,r=this.tree.scrollTo(n[0],i),o=this.scrollContainer.scrollTop;this.scrollContainer.scrollTop=r;var s=this.scrollContainer.scrollTop;this.scrollContainer.scrollTop=o,this.options.scrollEaseSpeed>0?this.animateScroll(o,s,function(e){this.tree.setScroll(e)}.bind(this)):(this.scrollContainer.scrollTop=s,this.tree.setScroll(s))}},d.prototype.onEyeIcon=function(e,t){var i,n;null===(i=(n=this.options).onVisibilityIconClick)||void 0===i||i.call(n,e,t),h.analytics.track("viewer.model_browser",{from:"Panel",action:"Toggle Visibility"})},d.prototype.onTreeNodeClick=function(e,t,i,n){if(this._trackNodeClick&&(a.logger.track({category:"node_selected",name:"model_browser_tool"}),this._trackNodeClick=!1),!this.isMac||!n.ctrlKey){var r="click";this.ctrlDown(n)&&(r+="Ctrl"),n.shiftKey&&(r+="Shift"),n.altKey&&(r+="Alt");var o=["toggleOverlayedSelection"],s=this.clickConfig[r];s&&(o=s.onObject),h.analytics.track("viewer.model_browser",{from:"Panel",action:"Select"}),this.handleAction(o,t,i)}},d.prototype.onTreeNodeRightClick=function(e,t,i,n){if(this.isMac&&n.ctrlKey&&0===n.button)return this.clickConfig&&this.clickConfig.clickCtrl&&this.handleAction(this.clickConfig.clickCtrl.onObject,t,i),null;this.options.onTreeNodeRightClick&&this.options.onTreeNodeRightClick(n)},d.prototype.handleAction=function(e,t,i){var n,r,o,s,a,l,c,h,u,d,f,p,m,g,v,y;for(var b in e)switch(e[b]){case"toggleOverlayedSelection":this.toggleOverlayedSelection(t,i);break;case"toggleMultipleOverlayedSelection":this.toggleMultipleOverlayedSelection(t,i);break;case"selectOnly":this.options.onSelectOnly&&this.options.onSelectOnly(t,i);break;case"deselectAll":null===(n=(r=this.options).onDeselectAll)||void 0===n||n.call(r,t,i);break;case"selectToggle":null===(o=(s=this.options).onSelectToggle)||void 0===o||o.call(s,t,i);break;case"isolate":null===(a=(l=this.options).onIsolate)||void 0===a||a.call(l,t,i);break;case"showAll":null===(c=(h=this.options).onShowAll)||void 0===c||c.call(h,t,i);break;case"focus":null===(u=(d=this.options).onFocus)||void 0===u||u.call(d,t,i);break;case"hide":null===(f=(p=this.options).onHide)||void 0===f||f.call(p,t,i);break;case"show":null===(m=(g=this.options).onShow)||void 0===m||m.call(g,t,i);break;case"toggleVisibility":null===(v=(y=this.options).onToggleVisibility)||void 0===v||v.call(y,t,i)}},d.prototype.toggleOverlayedSelection=function(e,t){var i,n,r=this.selectedNodes[t.id],o=r?r.indexOf(e):-1;this._ignoreScroll=!0,null===(i=(n=this.options).onToggleOverlayedSelection)||void 0===i||i.call(n,e,t,-1!==o)},d.prototype.toggleMultipleOverlayedSelection=function(e,t){var i=this.selectedNodes[t.id],n=i?i.indexOf(e):-1;if(-1===n?(i||(i=this.selectedNodes[t.id]=[]),i.push(e)):i.splice(n,1),this.options.onToggleMultipleOverlayedSelection){var r=[];for(var o in this.selectedNodes)if(Object.prototype.hasOwnProperty.call(this.selectedNodes,o)){var s=this.selectedNodes[o];r.push({modelId:o,ids:s})}this.options.onToggleMultipleOverlayedSelection(r)}this._ignoreScroll=!0},d.prototype.ctrlDown=function(e){return this.isMac&&e.metaKey||!this.isMac&&e.ctrlKey}},23611:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewerObjectContextMenu:()=>o});var n=i(16969),r=i(83081);function o(e){n.ObjectContextMenu.call(this,e)}o.prototype=Object.create(n.ObjectContextMenu.prototype),o.prototype.constructor=o,o.prototype.buildMenu=function(e,t){if(!this.viewer.model)return;var i=this,n=[],o=this.viewer.navigation,s=this.viewer.model.is2d();const a=Autodesk.Viewing.Private.analytics;t.hasSelected&&(n.push({title:"Isolate",target:function(){var e=i.viewer.getAggregateSelection();i.viewer.clearSelection(),i.viewer.impl.visibilityManager.aggregateIsolate(e),r.logger.track({name:"isolate_count",aggregate:"count"}),a.track("viewer.object.visibility",{action:"Isolate"})}}),t.hasVisible&&n.push({title:"Hide Selected",target:function(){const e=i.viewer.impl.selector.getAggregateSelection();i.viewer.clearSelection(),i.viewer.impl.visibilityManager.aggregateHide(e),a.track("viewer.object.visibility",{action:"Hide Selected"})}}),t.hasHidden&&n.push({title:"Show Selected",target:function(){var e=i.viewer.getSelection();i.viewer.clearSelection(),i.viewer.show(e),a.track("viewer.object.visibility",{action:"Show Selected"})}})),s&&n.push({title:"Show All Layers",target:function(){i.viewer.setLayerVisible(null,!0),a.track("viewer.object.visibility",{action:"Show All Layers"})}}),n.push({title:"Show All Objects",target:function(){i.viewer.showAll(),r.logger.track({name:"showall",aggregate:"count"}),a.track("viewer.object.visibility",{action:"Show All Objects"})}});var l=i.viewer.getAggregateSelection();if(!s&&1===l.length&&o.isActionEnabled("gotoview")&&n.push({title:"Focus",target:function(){if((l=i.viewer.getAggregateSelection()).length>0){var e=l[0];i.viewer.fitToView(e.selection,e.model)}else 0===l.length&&i.viewer.fitToView();r.logger.track({name:"fittoview",aggregate:"count"})}}),!s){var c=this.viewer.impl.getCanvasBoundingClientRect(),h=e.clientX-c.left,u=e.clientY-c.top,d=this.viewer.clientToWorld(h,u,!1);d&&n.push({title:"Pivot",target:()=>{this.viewer.navigation.setPivotPoint(d.point)}})}return t.hasSelected&&n.push({title:"Clear Selection",target:function(){i.viewer.clearSelection(),r.logger.track({name:"clearselection",aggregate:"count"})}}),n}},81215:(e,t,i)=>{"use strict";function n(){this.getContainerBoundingRect=function(){var e=this.parentContainer.getBoundingClientRect(),t={height:0,width:0,left:0,bottom:0,right:0,top:0},i=this.getDocument().getElementsByClassName("toolbar-menu");return i&&i.length>0&&(t=i[0].getBoundingClientRect()),{height:e.height-t.height,width:e.width,left:e.left,bottom:e.bottom-t.height,right:e.right,top:e.top}}}i.r(t),i.d(t,{ViewerPanelMixin:()=>n})},87471:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewerPropertyPanel:()=>l});var n=i(14813),r=i(81215),o=i(19556),s=i(96551),a=i(83081);function l(e){this.viewer=e,this.setGlobalManager(e.globalManager),this.currentNodeIds=[],this.currentModel=null,this.currentSelections=[],this.isDirty=!0,this.propertyNodeId=null,this.normalTitle="Properties",this.loadingTitle="Object Properties Loading",this._viewDbId=null,this.onProperties=this.onProperties.bind(this),this.onPropertySet=this.onPropertySet.bind(this),this.onPropError=this.onPropError.bind(this),this.setPropertiesIntoUI=this.setPropertiesIntoUI.bind(this),this.setAggregatedPropertiesIntoUI=this.setAggregatedPropertiesIntoUI.bind(this),this._onDisplayUnitPreferenceChanged=this._onDisplayUnitPreferenceChanged.bind(this),n.PropertyPanel.call(this,e.container,"ViewerPropertyPanel",this.loadingTitle)}function c(e){var t=e.getDocumentNode(),i=t&&t.findViewableParent();return!(!i||-1===i.name().toLocaleLowerCase().indexOf(".sld"))}l.prototype=Object.create(n.PropertyPanel.prototype),l.prototype.constructor=l,r.ViewerPanelMixin.call(l.prototype),l.prototype._onDisplayUnitPreferenceChanged=function(){this.isDirty=!0;const e=this.currentModel?this.currentModel.getRootId():null;if(null!==this.propertyNodeId&&this.propertyNodeId!==e){const e={model:this.currentModel};e.selection=Array.isArray(this.propertyNodeId)?this.propertyNodeId:[this.propertyNodeId],this.requestAggregatedNodeProperties(e)}else this.requestProperties()},l.prototype.initialize=function(){n.PropertyPanel.prototype.initialize.call(this);var e=this;this.viewer.prefs.addListeners(Autodesk.Viewing.Private.Prefs.DISPLAY_UNITS,this._onDisplayUnitPreferenceChanged),this.viewer.prefs.addListeners(Autodesk.Viewing.Private.Prefs.DISPLAY_UNITS_PRECISION,this._onDisplayUnitPreferenceChanged),e.addEventListener(e.viewer,o.AGGREGATE_SELECTION_CHANGED_EVENT,(function(t){t.selections&&t.selections.length?(e.currentNodeIds=t.selections[0].dbIdArray,e.currentModel=t.selections[0].model,e.currentSelections=[],t.selections.forEach((t=>{e.currentSelections.push({model:t.model,selection:t.dbIdArray})}))):e.resetCurrentModel(),e.isDirty=!0,e.requestProperties()})),e.addEventListener(e.viewer,o.SHOW_PROPERTIES_EVENT,(function(t){t&&t.dbId&&(e.currentModel=t.model,e.requestAggregatedNodeProperties({model:t.model,selection:[t.dbId]}))})),e.addEventListener(e.viewer,o.HIDE_EVENT,(function(t){e.isDirty=!0,e.requestProperties()})),e.addEventListener(e.viewer,o.OBJECT_TREE_CREATED_EVENT,(function(t){e.currentModel===t.model&&(e.isDirty=!0,e.requestProperties())})),e.addEventListener(e.viewer,o.SHOW_EVENT,(function(t){e.isDirty=!0,e.requestProperties()})),e.viewer.addEventListener(o.MODEL_UNLOADED_EVENT,(function(t){t.model===e.currentModel&&e.resetCurrentModel()}));var t=this.viewer.getAggregateSelection();t.length?(this.currentModel=t[0].model,this.currentNodeIds=t[0].selection,this.currentSelections=t):this.resetCurrentModel()},l.prototype.resetCurrentModel=function(){var e=this.viewer?this.viewer.getVisibleModels():[];this.currentModel=1===e.length?e[0]:null,this.currentNodeIds=[],this.currentSelections=[]},l.prototype.setTitle=function(e,t){e||(e="Object Properties",(t=t||{}).localizeTitle=!0),n.PropertyPanel.prototype.setTitle.call(this,e,t)},l.prototype.setVisible=function(e){s.DockingPanel.prototype.setVisible.call(this,e),this.requestProperties()},l.prototype.visibilityChanged=function(){s.DockingPanel.prototype.visibilityChanged.call(this),this.isVisible()&&this.requestProperties()},l.prototype.requestProperties=function(){this.isVisible()&&this.isDirty&&(this.currentSelections.length>0?this.requestAggregatedNodeProperties(this.currentSelections):this.showDefaultProperties(),this.isDirty=!1)},l.prototype.onProperties=function(e){if(!this.viewer||!this.currentModel)return;if(e.dbId!==this.propertyNodeId)return;var t,i=[],n=e.properties;if(n)for(var r=0,o=n.length;r<o;++r){var s=n[r];"__internalref__"===s.displayCategory&&i.push(s.displayValue)}const a=this.currentModel;t=a.is3d()&&c(a)&&i.length>0?function(e,t,i){return new Promise((function(n,r){e.getBulkProperties2(t,{ignoreHidden:!0},(function(e){for(var t=0,r=e.length;t<r;++t)for(var o=e[t],s=0,a=o.properties.length;s<a;++s){for(var l=o.properties[s],c=!0,h=0,u=i.properties.length;h<u;++h)i.properties[h].displayName===l.displayName&&(c=!1,h=u);c&&i.properties.push(l)}n(i)}))}))}(a,i,e):Promise.resolve(e),t.then(this.setPropertiesIntoUI).catch((()=>{this.setProperties([]),this.highlight(""),this.resizeToContent(),this.respositionPanel()}))},l.prototype.onPropertySet=function(e){if(!this.viewer||!this.currentModel)return;if(0===e.getVisibleKeys().length)return this.onPropError(),this.resizeToContent(),void this.respositionPanel();const t=e.map,i=[];let n;e.getValidIds(null,"__internalref__").forEach((e=>{t[e].forEach((e=>{i.includes(e.displayValue)||i.push(e.displayValue)}))}));const r=this.currentModel;n=r.is3d()&&c(r)&&i.length>0?function(e,t,i){return new Promise(((n,r)=>{e.getPropertySet(t,(e=>{n(i.merge(e))}),r,{ignoreHidden:!0})}))}(r,i,e):Promise.resolve(e),n.then(this.setAggregatedPropertiesIntoUI).catch((e=>{a.logger.error(e),this.setProperties([]),this.highlight(""),this.resizeToContent(),this.respositionPanel()}))},l.prototype.setAggregatedPropertiesIntoUI=function(e){const t=e.getDbIds().length;if(1===t){let t=Object.prototype.hasOwnProperty.call(e.map,"Name"),i=t?e.map.Name[0]:this.normalTitle;"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"displayValue")&&(t=!0,i=i.displayValue),this.setTitle(i,{localizeTitle:!t})}else this.setTitle("Properties %(value)",{localizeTitle:!0,i18nOpts:{value:`(${t})`}});this.setAggregatedProperties(e),this.highlight(this.viewer.searchText),this.resizeToContent(),this.respositionPanel()},l.prototype.setPropertiesIntoUI=function(e){var t=e.name||this.normalTitle,i=!e.name;this.setTitle(t,{localizeTitle:i}),"name"in e&&e.properties&&e.properties.splice(0,0,{displayName:"Name",displayValue:e.name,displayCategory:null,attributeName:"Name",type:20,units:null,hidden:!1,precision:0}),this.setProperties(e.properties),this.highlight(this.viewer.searchText),this.resizeToContent(),this.respositionPanel()},l.prototype.onPropError=function(){this.setTitle(this.normalTitle,{localizeTitle:!0}),this.showNoProperties()},l.prototype.requestAggregatedNodeProperties=function(e){var t;1===(e=Array.isArray(e)?e:[e]).length&&1===(null===(t=e[0].selection)||void 0===t?void 0:t.length)&&(this.propertyNodeId=e[0].selection[0]);const i=[];e.forEach((e=>{var t,n;i.push(e.model.getPropertySetAsync(e.selection,{fileType:null===(t=e.model.getData())||void 0===t||null===(t=t.loadOptions)||void 0===t?void 0:t.fileExt,needsExternalId:null===(n=e.model.getData())||void 0===n||null===(n=n.loadOptions)||void 0===n?void 0:n.needsExternalId}))})),Promise.all(i).then((e=>{const t=e[0];for(let i=1;i<e.length;i++)t.merge(e[i]);this.onPropertySet(t)})).catch(this.onPropError)},l.prototype.requestNodeProperties=function(e){const t=this.currentModel;this.propertyNodeId=e;const i=Array.isArray(e);(i?t.getPropertySet.bind(t):t.getProperties2.bind(t))(e,(e=>{this.viewer&&t===this.currentModel&&(i?this.onPropertySet(e):this.onProperties(e))}),this.onPropError)},l.prototype.setNodeProperties=l.prototype.requestNodeProperties,l.prototype.requestViewProperties=function(e){if(null!==this._viewDbId){const e={model:this.currentModel,selection:[this._viewDbId]};return void this.requestAggregatedNodeProperties(e)}const t=this.currentModel,i=t.getRootId();this.propertyNodeId=i,t.getPropertySet([i],(n=>{if(!this.viewer)return;if(t!==this.currentModel)return;this._viewDbId=i;const r=e.name(),o=e.isSheet(),s=[],a=[],l=n.getValidIds("Sheet"),c=n.getValidIds("View");l.forEach((e=>{n.map[e].forEach((e=>{a.push(e.displayValue)}))})),c.forEach((e=>{n.map[e].forEach((e=>{s.push(e.displayValue)}))}));const h=o?a:s;if(0!==h.length){var u=this;t.getBulkProperties2(h,{propFilter:["name","dbId"],ignoreHidden:!0},(function(e){const s=[];for(let t=0;t<e.length;++t)if(-1!==r.indexOf(e[t].name)){const i=e[t].dbId;if(!o)return u._viewDbId=i,void u.requestAggregatedNodeProperties({model:u.currentModel,selection:[i]});s.push(i)}0!==s.length?function(e,t,i){return new Promise((function(n,r){i=i||e.myData.metadata.title,e.getBulkProperties2(t,{ignoreHidden:!0},(function(e){for(var t=0,r=e.length;t<r;++t){var o=e[t];if(o.name&&-1!==i.indexOf(o.name))for(var s=0,a=o.properties.length;s<a;++s){var l=o.properties[s];if("Sheet Number"===l.displayName&&-1!==i.indexOf(l.displayValue))return n(o)}}return n(null)}))}))}(t,s,r).then((function(e){e&&e.dbId&&e.dbId!==i?(u._viewDbId=e.dbId,u.requestAggregatedNodeProperties({model:u.currentModel,selection:[e.dbId]})):u.onPropertySet(n)})):u.onPropertySet(n)}))}else this.onPropertySet(n)}),this.onPropError)},l.prototype.respositionPanel=function(){if(this.isVisible()){var e=this.viewer.toolController,t=e.lastClickX,i=e.lastClickY,n=this.container.getBoundingClientRect(),r=n.left,o=n.top,s=n.width,a=n.height,l=this.viewer.impl.getCanvasBoundingClientRect(),c=l.left,h=l.top,u=l.width,d=l.height;r<=t&&t<r+s&&o<=i&&i<o+a&&(t<r+s/2&&t+s<c+u?(this.container.style.left=Math.round(t-c)+"px",this.container.dockRight=!1):c<=t-s?(this.container.style.left=Math.round(t-c-s)+"px",this.container.dockRight=!1):t+s<c+u?(this.container.style.left=Math.round(t-c)+"px",this.container.dockRight=!1):i+a<h+d?(this.container.style.top=Math.round(i-h)+"px",this.container.dockBottom=!1):h<=i-a&&(this.container.style.top=Math.round(i-h-a)+"px",this.container.dockBottom=!1))}},l.prototype.showDefaultProperties=function(){var e=this.currentModel?this.currentModel.getRootId():null;if(e){const t=this.currentModel.getDocumentNode();t&&!t.isMasterView()?this.requestViewProperties(t):this.requestAggregatedNodeProperties({model:this.currentModel,selection:[e]})}else this.propertyNodeId=null,this.setTitle(this.normalTitle,{localizeTitle:!0}),n.PropertyPanel.prototype.showDefaultProperties.call(this)},l.prototype.areDefaultPropertiesShown=function(){if(!this.currentModel)return!1;var e=this.currentModel.getRootId();return this.propertyNodeId===e},l.prototype.uninitialize=function(){n.PropertyPanel.prototype.uninitialize.call(this),this.viewer.prefs.removeListeners(Autodesk.Viewing.Private.Prefs.DISPLAY_UNITS,this._onDisplayUnitPreferenceChanged),this.viewer.prefs.removeListeners(Autodesk.Viewing.Private.Prefs.DISPLAY_UNITS_PRECISION,this._onDisplayUnitPreferenceChanged),this.viewer=null,this._viewDbId=null,this.currentModel=null,this.currentSelections=[],this.propertyNodeId=null,this.currentNodeIds=null},l.prototype.onCategoryClick=function(e,t){n.PropertyPanel.prototype.onCategoryClick.call(this,e,t),this.resizeToContent()},l.prototype.onCategoryIconClick=function(e,t){n.PropertyPanel.prototype.onCategoryIconClick.call(this,e,t),this.resizeToContent()}},11337:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewerSettingTab:()=>A,ViewerSettingsPanel:()=>T});var n=i(94589),r=i(19556),o=i(19948),s=i(83081),a=i(97005),l=i(38842),c=i(55280),h=i(81215),u=i(26206);class d{constructor(e,t){this._width=e||60,this._height=t||60}createThumbnail(e,t){return new Promise((t=>{var i=this.getDocument().createElement("canvas");i.width=this._width,i.height=this._height;var n=i.getContext("2d"),r=n.createLinearGradient(0,0,0,i.height),o=e.bgColorGradient,s=f(o[0],o[1],o[2]),a=f(o[3],o[4],o[5]);r.addColorStop(0,s),r.addColorStop(1,a),n.fillStyle=r,n.fillRect(0,0,i.width,i.height),i.toBlob((function(e){var i=URL.createObjectURL(e);t(i)}))}))}}function f(e,t,i){return e=parseInt(e),t=parseInt(t),i=parseInt(i),"#"+p(e)+p(t)+p(i)}function p(e){if(0===e)return"00";for(var t="",i=e>255?255:e;0!==i;){var n=i%16;i=i/16|0,t=m[n.toString()]+t}return t.length>1?t:"0"+t}u.GlobalManagerMixin.call(d.prototype);const m={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};var g=i(38221),v=i.n(g),y=i(35922),b=i(26477),x=i(13202);const _=Autodesk.Viewing,E=_.Private;let S=0,A={Navigation:"navigationtab",Configuration:"performancetab",Appearance:"appearance",Environment:"environment"};var w=0;function T(e,t){var i,o,a;let l={...e};if(this.viewer=null,e instanceof Autodesk.Viewing.GuiViewer3D||e instanceof Autodesk.Viewing.Viewer3D){const t=e;l={preferences:t.prefs,globalManager:t.globalManager,addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t),container:t.container,version:t.config.viewerVersion,onRestoreDefaults:t.restoreDefaultSettings.bind(t),detectIfModelsHaveEdge:D.bind(this),loadExtension:t.loadExtension.bind(this),unloadExtension:t.unloadExtension.bind(this),width:400,heightAdjustment:110},this.viewer=t}this.options=l,this.preferences=l.preferences,this.is3dMode=!t.is2d();const c="pdf"===(null===(i=t.getDocumentNode())||void 0===i?void 0:i.getInputFileType()),h=null===(o=t.getDocumentNode())||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.extractor)||void 0===o?void 0:o.includes("pdf");this.isPdfFile=c||h,this.enableVectorRasterSwitch=null==e||null===(a=e._curOptions)||void 0===a?void 0:a.enableVectorRasterSwitch,this.visible=!1,this._externalButtonIds=[],this._externalButtonsLabel=null,n.SettingsPanel.call(this,this.options.container,"ViewerSettingsPanel"+S+++"-"+w++,"Settings",l),this.container.classList.add("viewer-settings-panel"),this.setGlobalManager(this.options.globalManager),this.addTab(A.Configuration,"Configuration",{className:"performance"}),this.addTab(A.Navigation,"Navigation",{className:"navigation"}),this.addTab(A.Appearance,"Appearance",{className:"appearance"}),this.is3dMode?this.addTab(A.Environment,"Environment",{className:"environment"}):this.container.classList.add("for-2d-model"),this.createRestoreDefaultSettingsButton(),this.modelPreferenceCount=0,this.createNavigationPanel(),this.createConfigurationPanel(),this.createAppearancePanel(),this.modelPreferenceCount&&s.logger.log("Model locked ("+this.modelPreferenceCount+") render settings in UI."),this.selectTab(A.Configuration),this.footer=this.createFooter(),this.createVersionLabel(this.footer),this.syncUI=this.syncUI.bind(this),this.options.addEventListener(r.RESTORE_DEFAULT_SETTINGS_EVENT,this.syncUI),this.options.addEventListener(r.VIEWER_STATE_RESTORED_EVENT,this.syncUI),this.updateEdgeToggle=this.updateEdgeToggle.bind(this),this.options.addEventListener(r.GEOMETRY_LOADED_EVENT,this.updateEdgeToggle),this.sendAnalyticsDebounced=v()(P,500)}function M(e,t,i){e.createThumbnail(i).then((e=>{t.src=e,t.onload=function(){URL.revokeObjectURL(e)}}))}function C(e,t,i){const n={i18nOptions:{nsSeparator:!1,keySeparator:!1},betaLabel:!0};i&&(_.FeatureFlags.isEnabled(o.PublicFeatureFlags.LargeModelExperienceOptOut)||(e.largeModelExperienceChkBoxId=e.addCheckbox(t,"Large model experience","Improves your overall experience viewing large models. The changes will take effect on the next page load.",!1,void 0,y.Prefs3D.LARGE_MODEL_EXPERIENCE,n)),_.FeatureFlags.isEnabled(o.InternalFeatureFlags.OutOfCoreGpuMemoryManagement)&&(e.outOfCoreGpuMemoryManagementChkBoxId=e.addCheckbox(t,"Out Of Core GPU Memory Management","Dynamically manages the GPU Memory based on your viewpoint. The changes will take effect on the next page load.",!1,void 0,y.Prefs3D.OUT_OF_CORE_GPU_MEMORY_MANAGEMENT,n))),_.FeatureFlags.isEnabled(o.InternalFeatureFlags.WebGPUBackend)&&(e.webgpuChkBoxId=e.addCheckbox(t,"WebGPU Graphics","Use WebGPU for rendering (requires page reload). Not all features are supported, may cause instabilities.",!1,void 0,y.Prefs.WEBGPU,n))}function P(e,t){E.analytics.track("viewer.settings.changed",{setting_name:e,setting_value:t})}function D(){if(!this.is3dMode)return!1;let e=!1;const t=this.viewer.impl.modelQueue().getModels();for(let i=0;i<t.length;i++){if(t[i].hasEdges){e=!0;break}}return e}T.prototype=Object.create(n.SettingsPanel.prototype),T.prototype.constructor=T,h.ViewerPanelMixin.call(T.prototype),T.prototype.uninitialize=function(){var e,t,i,o,s,a;this._onBgEnvironmentChange&&this._onBgEnvironmentReset&&(this.preferences.removeListeners(E.Prefs3D.LIGHT_PRESET,this._onBgEnvironmentChange,this._onBgEnvironmentReset),this._onBgEnvironmentChange=null,this._onBgEnvironmentReset=null),null===(e=(t=this.options).removeEventListener)||void 0===e||e.call(t,r.RESTORE_DEFAULT_SETTINGS_EVENT,this.syncUI),null===(i=(o=this.options).removeEventListener)||void 0===i||i.call(o,r.VIEWER_STATE_RESTORED_EVENT,this.syncUI),null===(s=(a=this.options).removeEventListener)||void 0===s||s.call(a,r.GEOMETRY_LOADED_EVENT,this.updateEdgeToggle),n.SettingsPanel.prototype.uninitialize.call(this),this.envSelect=null},T.prototype.setVisible=function(e){this.visible=e,n.SettingsPanel.prototype.setVisible.call(this,e),e&&this.sizeToContent(),e&&this.createEnvironmentPanel()},T.prototype.addCheckbox=function(e,t,i,r,o,s,a){const{preferences:l}=this;var c=l[s];r="boolean"==typeof c?c:r;var h=n.SettingsPanel.prototype.addCheckbox.call(this,e,t,r,(function(e){s&&(l.set(s,e),E.analytics.track("viewer.settings.changed",{setting_name:s,setting_value:e})),o&&o(e)}),i,a),u=this.getControl(h);return u.saveKey=s,s?l.addListeners(s,(function(e){u.setValue(e)}),(function(e){u.setValue(e),o&&o(e)})):u.sliderRow.classList.add("logical-group"),l.hasTag(s,"no-storage")&&(u.sliderRow.classList.add("no-storage"),this.modelPreferenceCount++),h},T.prototype.addDropDownMenu=function(e,t,i,r,o,s,a){const{preferences:l}=this;s&&(o=r.indexOf(l.get(s)));const c=n.SettingsPanel.prototype.addDropDownMenu.call(this,e,t,i,o,(function(e){s&&("displayUnits"==s?l.set(s,new b.EnumType(x.displayUnitsEnum,r[e.detail.value])):"displayUnitsPrecision"==s?l.set(s,new b.EnumType(x.displayUnitsPrecisionEnum,r[e.detail.value])):l.set(s,r[e.detail.value]),E.analytics.track("viewer.settings.changed",{setting_name:s,setting_value:r[e.detail.value]}))}),a),h=this.getControl(c);return s?l.addListeners(s,(function(e){h.setSelectedIndex(r.indexOf(e))}),(function(e){h.setSelectedIndex(r.indexOf(e))})):h.sliderRow.classList.add("logical-group"),l.hasTag(s,"no-storage")&&(h.sliderRow.classList.add("no-storage"),this.modelPreferenceCount++),c},T.prototype.addSliderV2=function(e,t,i,r,o,s,a,l){const{preferences:c}=this;var h=c.get(l);s="number"==typeof h?h:s,l&&!Object.prototype.hasOwnProperty.call(c,l)&&c.add(l,s,["2d","3d"]);var u=n.SettingsPanel.prototype.addSliderV2.call(this,e,t,i,r,o,s,(function(e){var t="number"==typeof e?e:Number(e.detail.value);l&&c.set(l,t)}),a),d=this.getControl(u[1]);return d.saveKey=l,l?c.addListeners(l,(function(e){d.setValue(e)})):d.sliderRow.classList.add("logical-group"),c.hasTag(l,"no-storage")&&(d.sliderRow.classList.add("no-storage"),this.modelPreferenceCount++),u},T.prototype.addGrid=function(e,t,i,n){const{preferences:r}=this;var o=e,s=this.getDocument(),a=s.createElement("div");a.classList.add("environments-container"),o.appendChild(a);var c=s.createElement("div");c.classList.add("environments-lighting-table"),a.appendChild(c);var h=new d(42,26);h.setGlobalManager(this.globalManager);for(var u=0;u<t.length;u++){let e=t[u];var f=s.createElement("div");f.classList.add("settings-environment-cell"),f.index=u;var p=s.createElement("img");p.classList.add("settings-environment-image"),M(h,p,e),f.appendChild(p);var m=s.createElement("span");m.textContent=l.A.t(e.name),m.classList.add("settings-environment-name"),m.setAttribute("data-i18n",e.name),f.appendChild(m),f.addEventListener("click",(function(){r.set(n,this.index)})),c.appendChild(f)}return this.preferences.addListeners(n,i),c},T.prototype.updateEnvironmentSelection=function(){if(this.is3dMode&&this.envTabCreated){var e=this.preferences.get("lightPreset");if("string"==typeof e){e=a.LightPresets.map((e=>e.name)).indexOf(e)}for(var t=this.gridTable.querySelectorAll(".settings-environment-cell"),i=0;i<t.length;i++)t[i].index===e?t[i].classList.add("border-select"):t[i].classList.remove("border-select")}},T.prototype.removeCheckbox=function(e){return this.preferences.removeListeners(e.saveKey),this.removeEventListener(e,"change",e.changeListener),n.SettingsPanel.prototype.removeCheckbox.call(this,e)},T.prototype.createNavigationPanel=function(){var e=A.Navigation;function t(){return this.addSliderV2(e,"Drag Speed","Changes sensitivity of mouse movement with the zoom tool",5,300,this.options.initialZoomDragSpeed,{step:5},y.Prefs.ZOOM_DRAG_SPEED)[1]}function i(){return this.addSliderV2(e,"Scroll Speed","Changes sensitivity of the mouse scroll wheel when zooming",.1,3,this.options.initialZoomScrollScale,{step:.1},y.Prefs.ZOOM_SCROLL_SPEED)[1]}this.is3dMode&&(this.addLabel(e,"ViewCube"),this.addCheckbox(e,"Show ViewCube","Toggles availability of the ViewCube navigation control",!0,void 0,y.Prefs3D.VIEW_CUBE),(0,c.isMobileDevice)()||this.addCheckbox(e,"ViewCube acts on pivot","When enabled, the ViewCube orbits the view around the active pivot point When disabled, it orbits around the center of the view",!1,void 0,y.Prefs3D.ALWAYS_USE_PIVOT),this.addLabel(e,"Orbit"),this.addCheckbox(e,"Fusion style orbit","Enables Fusion-style orbit overlay and gives the ability to lock orbit axis",!1,(e=>{e?this.options.loadExtension("Autodesk.Viewing.FusionOrbit",null):this.options.unloadExtension("Autodesk.Viewing.FusionOrbit",null)}),y.Prefs.FUSION_ORBIT),this.addCheckbox(e,"Orbit past world poles","Allows view rotation to continue past the model’s North Pole",!0,void 0,y.Prefs3D.ORBIT_PAST_WORLD_POLES),this.addLabel(e,"Zoom"),(0,c.isMobileDevice)()||(this.addCheckbox(e,"Zoom towards pivot","When disabled, zooming operations are centered at the current cursor location",!1,void 0,y.Prefs3D.ZOOM_TOWARDS_PIVOT),this.addCheckbox(e,"Reverse mouse zoom direction","Toggles direction of zooming in and out",!1,void 0,y.Prefs.REVERSE_MOUSE_ZOOM_DIR),this.scrollSpeed=i.call(this)),this.dragSpeed=t.call(this),this.addLabel(e,"Mouse"),(0,c.isMobileDevice)()||(this.addCheckbox(e,"Left handed mouse setup","Swaps the buttons on the mouse",!1,void 0,y.Prefs.LEFT_HANDED_MOUSE_SETUP),this.addCheckbox(e,"Set pivot with left mouse button","Change left-click behavior to set new pivot point (overrides select object)",!1,void 0,y.Prefs3D.CLICK_TO_SET_COI)),this.addCheckbox(e,"Open properties on select","Always show properties upon selecting object",!0,void 0,y.Prefs.OPEN_PROPERTIES_ON_SELECT)),this.is3dMode||(this.addLabel(e,"Zoom"),this.addCheckbox(e,"Reverse mouse zoom direction","Toggles direction of zooming in and out",!1,void 0,y.Prefs.REVERSE_MOUSE_ZOOM_DIR),(0,c.isMobileDevice)()||(this.scrollSpeed=i.call(this)),this.dragSpeed=t.call(this),this.addLabel(e,"Mouse"),this.addCheckbox(e,"Open properties on select","Always show properties upon selecting object",!0,void 0,y.Prefs.OPEN_PROPERTIES_ON_SELECT),(0,c.isMobileDevice)()||this.addCheckbox(e,"Left handed mouse setup","Swaps the buttons on the mouse",!1,void 0,y.Prefs.LEFT_HANDED_MOUSE_SETUP))},T.prototype.addConfigButton=function(e,t){if(!t)throw new Error("Must register a function callback.");this._externalButtonsLabel||(this._externalButtonsLabel=this.addLabel(A.Configuration,"More"));var i=this.addButton(A.Configuration,e);return this.getControl(i).setOnClick((()=>{this.setVisible(!1),t()})),this._externalButtonIds.push(i),i},T.prototype.removeConfigButton=function(e){var t=this._externalButtonIds.indexOf(e);if(-1===t)return!1;var i=this.getControl(e);return!!i&&(this.removeControl(i),this._externalButtonIds.splice(t,1),0===this._externalButtonIds.length&&null!==this._externalButtonsLabel&&(this._externalButtonsLabel.removeFromParent(),this._externalButtonsLabel=null),!0)},T.prototype.updateEdgeToggle=function(){const e=document.getElementById(this.edgeCheckboxName+"_check");if(!e)return;if(!this.is3dMode)return;this.options.detectIfModelsHaveEdge()?e.disabled=!1:(e.disabled=!0,e.checked=!1)},T.prototype.createConfigurationPanel=function(){var e=A.Configuration;this.is3dMode?(this.addLabel(e,"Performance Optimization"),this.optimizeNavigationhkBoxId=this.addCheckbox(e,"Disable shadow effect","Provides faster response(but degrades quality) while navigating",(0,c.isMobileDevice)(),void 0,y.Prefs3D.OPTIMIZE_NAVIGATION),this.progressiveRenderChkBoxId=this.addCheckbox(e,"Progressive display","Shows incremental updates of the view and allows for more responsive interaction with the model (some elements may flicker) This improves perceived waiting time",!0,void 0,y.Prefs.PROGRESSIVE_RENDERING),C(this,e,this.is3dMode),this.addLabel(e,"Display"),this.ghosthiddenChkBoxId=this.addCheckbox(e,"Ghost hidden objects","Leave hidden objects slightly visible",!0,void 0,y.Prefs3D.GHOSTING),this.displayLinesId=this.addCheckbox(e,"Display Lines","Toggles display of line objects",!0,void 0,y.Prefs3D.LINE_RENDERING),this.displayPointsId=this.addCheckbox(e,"Display Points","Toggles display of point objects",!0,void 0,y.Prefs.POINT_RENDERING),this.edgeCheckboxName="Display edges",this.displayEdgesId=this.addCheckbox(e,this.edgeCheckboxName,"Shows outline of model surfaces",!1,(e=>{this.getControl(this.displayEdgesId).setValue(e),this.updateEdgeToggle()}),y.Prefs3D.EDGE_RENDERING),this.updateEdgeToggle(),this.displaySectionHatchesId=this.addCheckbox(e,"Display Section Hatches","Shows hatch pattern for section planes this does not apply to section boxes",!0,null,E.Prefs3D.DISPLAY_SECTION_HATCHES)):(this.addLabel(e,"Performance Optimization"),this.progressiveRenderChkBoxId=this.addCheckbox(e,"Progressive display","Shows incremental updates of the view and allows for more responsive interaction with the model (some elements may flicker) This improves perceived waiting time",!0,void 0,y.Prefs.PROGRESSIVE_RENDERING),C(this,e,this.is3dMode),this.isPdfFile&&this.enableVectorRasterSwitch&&(this.vectorViewingChkBoxId=this.addCheckbox(e,"Vector Viewing","Provides increased zooming, snapping and access to PDF vector data. If turned off, all PDFs will be rasterized.",!0,void 0,y.Prefs2D.VECTOR_VIEWING)),this.addLabel(e,"Display")),this.displayUnitsId=this.addDropDownMenu(e,"Display Units",E.displayUnits,E.displayUnitsEnum,null,E.Prefs.DISPLAY_UNITS),this.displayUnitsPrecisionId=this.addDropDownMenu(e,"Precision",E.displayUnitsPrecision,E.displayUnitsPrecisionEnum,null,E.Prefs.DISPLAY_UNITS_PRECISION),this.is3dMode&&this._addSelectionModeOption()},T.prototype._addSelectionModeOption=function(){const e=A.Configuration;this.addLabel(e,"Selection");const t=[],i=[];let n=0;for(let e in Autodesk.Viewing.SelectionMode)t[n]=e,i[n]=Autodesk.Viewing.SelectionMode[e],n++;const r=t.map((e=>e.split("_").map((e=>e.charAt(0)+e.slice(1).toLowerCase())).join(" ")));this.selectionModeId=this.addDropDownMenu(e,"Selection Mode",r,i,null,E.Prefs3D.SELECTION_MODE)},T.prototype.createAppearancePanel=function(){var e=A.Appearance;this.is3dMode?(this.addLabel(e,"Visual Quality Optimization"),this.antialiasingChkBoxId=this.addCheckbox(e,"Anti-aliasing","Remove jagged edges from lines",!0,void 0,y.Prefs3D.ANTIALIASING),this.ambientshadowsChkBoxId=this.addCheckbox(e,"Ambient shadows","Improve shading of occluded surfaces",!0,void 0,y.Prefs3D.AMBIENT_SHADOWS),this.groundShadowChkBoxId=this.addCheckbox(e,"Ground shadow","Add simulated ground surface shadows",!0,void 0,y.Prefs3D.GROUND_SHADOW),this.groundReflectionChkBoxId=this.addCheckbox(e,"Ground reflection","Add simulated ground surface reflections",!1,void 0,y.Prefs3D.GROUND_REFLECTION)):(this.addLabel(e,"Existing behavior"),this.swapBlackAndWhiteChkBoxId=this.addCheckbox(e,"2D Sheet Color","Switch sheet color white to black",!0,void 0,y.Prefs2D.SWAP_BLACK_AND_WHITE),this.loadingAnimationChkBoxId=this.addCheckbox(e,"Loading Animation","Animate lines during loading",!0,void 0,y.Prefs2D.LOADING_ANIMATION))},T.prototype.createEnvironmentPanel=function(){if(this.is3dMode&&!this.envTabCreated){this.envTabCreated=!0;var e=A.Environment,t=this.tablesContainer.childNodes[3];this.gridTable=t,this.addLabel(e,"Environment"),this.envMapBackgroundChkBoxId=this.addCheckbox(e,"Environment Image Visible","Shows lighting environment as background",!0,void 0,y.Prefs3D.ENV_MAP_BACKGROUND);var i=t.tBodies[0].insertRow(-1).insertCell(0),n=this.getDocument();this.caption=n.createElement("div"),this.caption.setAttribute("data-i18n","Environments and Lighting Selection"),this.caption.textContent=l.A.t("Environments and Lighting Selection"),this.caption.classList.add("settings-row-title"),i.appendChild(this.caption),i.colSpan="3",this.envSelect=this.addGrid(t,a.LightPresets,this.updateEnvironmentSelection.bind(this),E.Prefs3D.LIGHT_PRESET),this.updateEnvironmentSelection(),this.envSelect.classList.add("with-environment")}},T.prototype.createVersionLabel=function(e){if(e){var t=this.getDocument();this.versionDiv=t.createElement("div"),this.versionDiv.textContent=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:LMV_VIEWER_VERSION;"@"===e.charAt(0)&&(e="0.0.0");return"v"+e}(this.options.version),this.versionDiv.className="docking-panel-version-label",this.addEventListener(this.versionDiv,"click",(e=>{e.shiftKey&&navigator.clipboard.writeText(this.versionDiv.textContent)})),e.appendChild(this.versionDiv)}},T.prototype.createRestoreDefaultSettingsButton=function(){var e=this.getDocument();this.restoreDiv=e.createElement("div"),this.restoreDiv.classList.add("docking-panel-container-solid-color-b"),this.restoreDiv.classList.add("restore-defaults-container"),this.restoreButton=e.createElement("div"),this.restoreButton.className="docking-panel-tertiary-button",this.restoreButton.setAttribute("data-i18n","Restore all default settings"),this.restoreButton.textContent=l.A.t("Restore all default settings"),this.restoreDiv.appendChild(this.restoreButton),this.addEventListener(this.restoreDiv,"touchstart",c.touchStartToClick),this.addEventListener(this.restoreDiv,"click",(()=>{var e,t;null===(e=(t=this.options).onRestoreDefaults)||void 0===e||e.call(t),E.analytics.track("viewer.settings.default")}),!1),this.scrollContainer.appendChild(this.restoreDiv)},T.prototype.selectTab=function(e){n.SettingsPanel.prototype.selectTab.call(this,e),this.sizeToContent()},T.prototype.sizeToContent=function(){n.SettingsPanel.prototype.sizeToContent.call(this,this.options.container)},T.prototype.onViewerResize=function(e,t,i,n,r,o){this.sizeToContent()},T.prototype.syncUI=function(){var e=this.preferences;this.setControlValue(this.antialiasingChkBoxId,e.get("antialiasing")),this.setControlValue(this.ambientshadowsChkBoxId,e.get("ambientShadows")),this.setControlValue(this.groundShadowChkBoxId,e.get("groundShadow")),this.setControlValue(this.groundReflectionChkBoxId,e.get("groundReflection")),this.setControlValue(this.envMapBackgroundChkBoxId,e.get("envMapBackground")),this.setControlValue(this.progressiveRenderChkBoxId,e.get("progressiveRendering")),this.setControlValue(this.largeModelExperienceChkBoxId,e.get(y.Prefs3D.LARGE_MODEL_EXPERIENCE)),this.setControlValue(this.outOfCoreGpuMemoryManagementChkBoxId,e.get(y.Prefs3D.OUT_OF_CORE_GPU_MEMORY_MANAGEMENT)),this.setControlValue(this.webGPUChkBoxId,e.get(y.Prefs.WEBGPU)),this.setControlValue(this.swapBlackAndWhiteChkBoxId,e.get("swapBlackAndWhite")),this.setControlValue(this.vectorViewingChkBoxId,e.get(E.Prefs2D.VECTOR_VIEWING)),this.setControlValue(this.loadingAnimationChkBoxId,e.get("loadingAnimation")),this.setControlValue(this.ghosthiddenChkBoxId,e.get("ghosting")),this.setControlValue(this.displayLinesId,e.get("lineRendering")),this.setControlValue(this.displayPointsId,e.get("pointRendering")),this.setControlValue(this.displayEdgesId,e.get("edgeRendering")),this.setControlValue(this.displaySectionHatchesId,e.get("displaySectionHatches")),this.setControlValue(this.scrollSpeed,e.get("zoomScrollSpeed")),this.setControlValue(this.dragSpeed,e.get("zoomDragSpeed")),this.updateEnvironmentSelection()},T.prototype.setControlValue=function(e,t){var i=this.getControl(e);i&&i.setValue(t)}},23619:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Browser:()=>c,BrowserDelegate:()=>l});var n=i(26940),r=i(57480),o=i(83081);let s=(0,i(55280).getGlobal)(),a=s.document;function l(){}function c(e,t,i){this.myDelegate=e,this.mySelectedIds=[];var n="browserview";this.myRootContainerId=i+"-"+n,this.idToElement={},this.myRootContainer=a.createElement("div"),this.myRootContainer.id=this.myRootContainerId,this.myRootContainer.classList.add(n),a.getElementById(i).appendChild(this.myRootContainer),this.createElements(t,this.myRootContainer)}l.prototype.constructor=l,l.prototype.getNodeId=function(e){throw"getId is not implemented."},l.prototype.getNodeLabel=function(e){return e.name},l.prototype.getNodeClass=function(e){return""},l.prototype.hasThumbnail=function(e){return!1},l.prototype.getThumbnailOptions=function(e){return null},l.prototype.getThumbnail=function(e){return null},l.prototype.onNodeClick=function(e,t,i){},l.prototype.onNodeHover=function(e,t,i){},l.prototype.selectItem=function(e){},l.prototype.deselectItem=function(e){},l.prototype.hasContent=function(e){return!1},l.prototype.addContent=function(e,t){},c.prototype.constructor=c,c.prototype.show=function(e){e?(this.myRootContainer.classList.remove("browserHidden"),this.myRootContainer.classList.add("browserVisible"),this.myRootContainer.style.display="block"):(this.myRootContainer.classList.remove("browserVisible"),this.myRootContainer.classList.add("browserHidden"),this.myRootContainer.style.display="none")},c.prototype.getRootContainer=function(){return this.myRootContainer},c.prototype.delegate=function(){return this.myDelegate},c.prototype.addToSelection=function(e){var t=this;function i(e){return-1==t.mySelectedIds.indexOf(e)&&(t.mySelectedIds.push(e),!0)}for(var n=0,r=e.length;n<r;++n){var o=e[n];if(i(o)){var s=t.idToElement[o];void 0===s?t.myDelegate.selectItem(o):s.classList.add("selected")}}},c.prototype.removeFromSelection=function(e){var t=this;function i(e){var i=t.mySelectedIds.indexOf(e);return-1!=i&&(t.mySelectedIds.splice(i,1),!0)}for(var n=e.length-1;n>=0;--n){var r=e[n];if(i(r)){var o=this.idToElement[r];void 0===o?t.myDelegate.deselectItem(r):o.classList.remove("selected")}}},c.prototype.setSelection=function(e){return this.removeFromSelection(this.mySelectedIds),this.addToSelection(e),this.mySelectedIds},c.prototype.clearSelection=function(){this.removeFromSelection(this.mySelectedIds)},c.prototype.createElements=function(e,t){if(e)for(var i=0;i<e.length;i++){var n=e[i];this.createElement(n,t)}},c.prototype.createElement=function(e,t){var i=this,l=i.myDelegate.getNodeId(e),c=a.createElement("item");t.appendChild(c),this.idToElement[l]=c,c.onmouseover=function(){i.myDelegate.onNodeHover(i,e)},c.onclick=function(t){i.myRootContainer.querySelector(".flipped").removeClass("flipped"),i.myDelegate.onNodeClick(i,e,t)};var h=a.createElement("div");h.classList.add("card"),c.appendChild(h);var u=a.createElement("div");u.classList.add("browserElement"),h.appendChild(u);var d=i.myDelegate.getNodeLabel(e),f=a.createElement("label");f.innerHTML=d,u.appendChild(f),f.onclick=function(t){i.myDelegate.onNodeClick(i,e,t)};var p=i.myDelegate.getThumbnail(e);if(p){var m=a.createElement("img");m.classList.add("thumb");var g=i.myDelegate.getThumbnailOptions(e);n.Document.requestThumbnailWithSecurity(g,(function(e,t){e?o.logger.error("Failed to load thumbnail: "+p,(0,r.errorCodeString)(r.ErrorCodes.NETWORK_FAILURE)):(m.src=s.URL.createObjectURL(t),m.onload=function(){s.URL.revokeObjectURL(m.src)})})),u.appendChild(m),m.onclick=function(t){i.myDelegate.onNodeClick(i,e,t)}}i.myDelegate.hasContent(e)&&i.myDelegate.addContent(e,h),c.classList.add(i.myDelegate.getNodeClass(e))}},22767:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Button:()=>a});var n,r,o=i(60618),s=i(55280);function a(e,t){o.Control.call(this,e,t);var i=this;this._state=a.State.INACTIVE;var n=this.getDocument();this.icon=n.createElement("div"),this.icon.classList.add("adsk-button-icon"),this.container.appendChild(this.icon),this.container.addEventListener("click",(function(e){i.getState()!==a.State.DISABLED&&(i.dispatchEvent(a.Event.CLICK),i.onClick&&i.onClick(e)),e.stopPropagation()})),(0,s.isTouchDevice)()?this.container.addEventListener("touchstart",s.touchStartToClick):(this.container.addEventListener("mouseover",(function(e){i.onMouseOver(e)})),this.container.addEventListener("mouseout",(function(e){i.onMouseOut(e)}))),this.addClass("adsk-button"),this.addClass(a.StateToClassMap[this._state])}a.Event={VISIBILITY_CHANGED:o.Control.Event.VISIBILITY_CHANGED,COLLAPSED_CHANGED:o.Control.Event.COLLAPSED_CHANGED,STATE_CHANGED:"Button.StateChanged",CLICK:"click"},a.State={ACTIVE:0,INACTIVE:1,DISABLED:2},a.StateToClassMap=(n=a.State,(r={})[n.ACTIVE]="active",r[n.INACTIVE]="inactive",r[n.DISABLED]="disabled",r),a.prototype=Object.create(o.Control.prototype),a.prototype.constructor=a,a.prototype.setState=function(e){if(e===this._state)return!1;this.removeClass(a.StateToClassMap[this._state]),this.addClass(a.StateToClassMap[e]),this._state=e;var t={type:a.Event.STATE_CHANGED,state:e};return this.dispatchEvent(t),!0},a.prototype.setIcon=function(e){this.iconClass&&this.icon.classList.remove(this.iconClass),this.iconClass=e,this.icon.classList.add(e)},a.prototype.getState=function(){return this._state},a.prototype.onClick=function(e){},a.prototype.onMouseOver=function(e){},a.prototype.onMouseOut=function(e){}},66277:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ComboButton:()=>s});var n=i(22767),r=i(41129),o=i(8600);function s(e,t){n.Button.call(this,e,t),this.arrowButton=new n.Button(e+"arrow"),this.arrowButton.addClass("adsk-button-arrow"),this.arrowButton.removeClass("adsk-button"),this.subMenu=new r.RadioButtonGroup(e+"SubMenu"),this.subMenu.addClass("toolbar-vertical-group"),this.subMenu.setVisible(!1),this.container.insertBefore(this.subMenu.container,this.container.firstChild),this.container.insertBefore(this.arrowButton.container,this.container.firstChild);var i=this;this.arrowButton.onClick=function(){i.subMenu.setVisible(!i.subMenu.isVisible())},this.toggleFlyoutVisible=function(){i.subMenu.setVisible(!i.subMenu.isVisible())},this.onClick=function(){i.subMenu.setVisible(!i.subMenu.isVisible())},this.subMenuActiveButtonChangedHandler=function(e){e.isActiveButton?(i.setIcon(e.target.getActiveButton().iconClass),i.setToolTip(e.target.getActiveButton().getToolTip()),i.setState(n.Button.State.ACTIVE),i.onClick=e.button.onClick):i.setState(n.Button.State.INACTIVE)},this.subMenu.addEventListener(r.RadioButtonGroup.Event.ACTIVE_BUTTON_CHANGED,this.subMenuActiveButtonChangedHandler);var s=(0,o.stringToDOM)('<div class="clickoff" style="position:fixed; top:0; left:0; width:100vw; height:100vh;"></div>');this.subMenu.container.insertBefore(s,this.subMenu.container.firstChild),s.addEventListener("click",(function(e){i.subMenu.setVisible(!1),e.stopPropagation()}))}s.prototype=Object.create(n.Button.prototype),s.prototype.constructor=s,s.prototype.addControl=function(e){this.subMenu.addControl(e),e.addEventListener(n.Button.Event.CLICK,this.toggleFlyoutVisible)},s.prototype.removeControl=function(e){this.subMenu.removeControl(e),e.removeEventListener(n.Button.Event.CLICK,this.toggleFlyoutVisible)},s.prototype.setState=function(e){if(e===n.Button.State.INACTIVE){var t=this.subMenu.getActiveButton();t&&t.setState(n.Button.State.INACTIVE)}n.Button.prototype.setState.call(this,e)},s.prototype.saveAsDefault=function(){this.defaultState={},this._toolTipElement&&this._toolTipElement.getAttribute("tooltipText")&&(this.defaultState.tooltip=this._toolTipElement.getAttribute("tooltipText")),this.defaultState.icon=this.iconClass,this.defaultState.onClick=this.onClick},s.prototype.restoreDefault=function(){this.defaultState&&(this.defaultState.tooltip&&this.setToolTip(this.defaultState.tooltip),this.defaultState.icon&&this.setIcon(this.defaultState.icon),this.onClick=this.defaultState.onClick,this.setState(n.Button.State.INACTIVE))}},60618:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Control:()=>r});var n=i(25004);function r(e,t){this._id=e,this._isCollapsible=!t||t.collapsible,this._toolTipElement=null,this._listeners={},this.container=this.getDocument().createElement("div"),this.container.id=e,this.addClass("adsk-control")}i(26206).GlobalManagerMixin.call(r.prototype),r.Event={VISIBILITY_CHANGED:"Control.VisibilityChanged",COLLAPSED_CHANGED:"Control.CollapsedChanged"},n.EventDispatcher.prototype.apply(r.prototype),r.prototype.constructor=r,r.prototype.container=null,r.prototype.getId=function(){return this._id},r.prototype.setVisible=function(e){if(!this.container.classList.contains("adsk-hidden")===e)return!1;e?this.container.classList.remove("adsk-hidden"):this.container.classList.add("adsk-hidden");var t={type:r.Event.VISIBILITY_CHANGED,target:this,controlId:this._id,isVisible:e};return this.dispatchEvent(t),!0},r.prototype.isVisible=function(){return!this.container.classList.contains("adsk-hidden")},r.prototype.setToolTip=function(e){return(!this._toolTipElement||this._toolTipElement.getAttribute("tooltipText")!==e)&&(this._toolTipElement||(this._toolTipElement=this.getDocument().createElement("div"),this._toolTipElement.id=this._id+"-tooltip",this._toolTipElement.classList.add("adsk-control-tooltip"),this.container.appendChild(this._toolTipElement)),this._toolTipElement.setAttribute("data-i18n",e),this._toolTipElement.setAttribute("tooltipText",e),this._toolTipElement.textContent=Autodesk.Viewing.i18n.translate(e,{defaultValue:e}),!0)},r.prototype.getToolTip=function(){return this._toolTipElement&&this._toolTipElement.getAttribute("tooltipText")},r.prototype.setCollapsed=function(e){if(!this._isCollapsible||this.isCollapsed()===e)return!1;e?this.container.classList.add("collapsed"):this.container.classList.remove("collapsed");var t={type:r.Event.COLLAPSED_CHANGED,isCollapsed:e};return this.dispatchEvent(t),!0},r.prototype.isCollapsed=function(){return!!this.container.classList.contains("collapsed")},r.prototype.isCollapsible=function(){return this._isCollapsible},r.prototype.addClass=function(e){this.container.classList.add(e)},r.prototype.removeClass=function(e){this.container.classList.remove(e)},r.prototype.getPosition=function(){var e=this.container.getBoundingClientRect();return{top:e.top,left:e.left}},r.prototype.getDimensions=function(){var e=this.container.getBoundingClientRect();return{width:e.width,height:e.height}},r.prototype.setDisplay=function(e){this.container.style.display=e},r.prototype.removeFromParent=function(){return!!this.parent&&this.parent.removeControl(this)}},37463:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ControlGroup:()=>r});var n=i(60618);function r(e,t){n.Control.call(this,e,t);var i=this;this._controls=[],this.addClass("adsk-control-group"),this.handleChildSizeChanged=function(e){var t={type:r.Event.SIZE_CHANGED,childEvent:e};i.dispatchEvent(t)}}r.Event={VISIBILITY_CHANGED:n.Control.Event.VISIBILITY_CHANGED,COLLAPSED_CHANGED:n.Control.Event.COLLAPSED_CHANGED,SIZE_CHANGED:"ControlGroup.SizeChanged",CONTROL_ADDED:"ControlGroup.ControlAdded",CONTROL_REMOVED:"ControlGroup.ControlRemoved"},r.prototype=Object.create(n.Control.prototype),r.prototype.constructor=r,r.prototype.addControl=function(e,t){e.setGlobalManager(this.globalManager);var i=t&&void 0!==t.index?t.index:this._controls.length;if(null!==this.getControl(e.getId()))return!1;var o={type:r.Event.CONTROL_ADDED,control:e,index:i};return i<this._controls.length?(this.container.insertBefore(e.container,this._controls[i].container),this._controls.splice(i,0,e)):(this.container.appendChild(e.container),this._controls.push(e)),e.addEventListener(n.Control.Event.VISIBILITY_CHANGED,this.handleChildSizeChanged),e.addEventListener(n.Control.Event.COLLAPSED_CHANGED,this.handleChildSizeChanged),e instanceof r&&e.addEventListener(r.Event.SIZE_CHANGED,this.handleChildSizeChanged),e.parent=this,this.dispatchEvent(o),this.dispatchEvent(r.Event.SIZE_CHANGED),!0},r.prototype.indexOf=function(e){for(var t=0;t<this._controls.length;t++){var i=this._controls[t];if(i===e||"string"==typeof e&&e===i.getId())return t}return-1},r.prototype.removeControl=function(e){var t="string"==typeof e?this.getControl(e):e;if(!t)return!1;var i=this._controls.indexOf(t);if(-1===i)return!1;this._controls.splice(i,1),this.container.removeChild(t.container);var o={type:r.Event.CONTROL_REMOVED,control:t,index:i};return t.removeEventListener(n.Control.Event.VISIBILITY_CHANGED,this.handleChildSizeChanged),t.removeEventListener(n.Control.Event.COLLAPSED_CHANGED,this.handleChildSizeChanged),t instanceof r&&t.removeEventListener(r.Event.SIZE_CHANGED,this.handleChildSizeChanged),t.parent=void 0,this.dispatchEvent(o),this.dispatchEvent(r.Event.SIZE_CHANGED),!0},r.prototype.getControl=function(e){for(var t=0;t<this._controls.length;t++)if(e===this._controls[t].getId())return this._controls[t];return null},r.prototype.getControlId=function(e){return e<0||e>=this._controls.length?null:this._controls[e].getId()},r.prototype.getNumberOfControls=function(){return this._controls.length},r.prototype.setCollapsed=function(e){if(!this._isCollapsible)return!1;var t=!1;return this._controls.forEach((function(i){i.isCollapsible()&&i.setCollapsed(e)&&(t=!0)})),t&&(e?this.container.classList.add("collapsed"):this.container.classList.remove("collapsed"),this.dispatchEvent({type:r.Event.COLLAPSED_CHANGED,isCollapsed:e})),t}},25360:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Filterbox:()=>o});var n=i(60618),r=i(38842);function o(e,t){this._id=e,this._listeners={},this._options=t||{},this._filterFunction=this._options.filterFunction||function(){};var i=this.getDocument();this.container=i.createElement("div"),this.container.id=e,this.addClass("adsk-control"),this.addClass("adsk-filterbox"),this.addClass("empty");var n=i.createElement("input");n.classList.add("filter-box"),n.classList.add("docking-panel-delimiter-shadow"),n.type="search",n.placeholder=r.A.t("Enter filter term"),n.setAttribute("data-i18n","Enter filter term"),n.incremental="incremental",n.autosave=this.container.id+"filter",this.container.appendChild(n),this.filterbox=n;var o=this,s=function(e){0===(e=e.trim()).length?o.container.classList.add("empty"):o.container.classList.remove("empty"),o._filterFunction&&o._filterFunction(e)},a=i.createElement("div");a.className="filter-box-icon",this.container.insertBefore(a,n.nextSibling);var l=i.createElement("div");l.className="filter-box-close",l.addEventListener("click",(function(){o.filterbox.value="",o.addClass("empty")})),this.container.appendChild(l),n.addEventListener("keydown",(function(e){var t=o.getWindow();13===(e=e||t.event).keyCode&&o.filterbox.blur()})),n.addEventListener("input",(function(){s(this.value)})),n.addEventListener("change",(function(){s(this.value)})),n.addEventListener("focus",(function(){a.classList.add("focused")})),n.addEventListener("blur",(function(){a.classList.remove("focused")}))}o.prototype=Object.create(n.Control.prototype),o.prototype.constructor=o},41129:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RadioButtonGroup:()=>s});var n=i(37463),r=i(22767),o=i(60618);function s(e,t){n.ControlGroup.call(this,e,t);var i=this;this._activeButton=null,this._handleButtonStateChange=function(e){var t=r.Button.State;e.state===t.ACTIVE?(i._activeButton=e.target,i.dispatchEvent({type:s.Event.ACTIVE_BUTTON_CHANGED,button:e.target,isActiveButton:!0}),i._controls.forEach((function(i){i!==e.target&&i.getState()!==t.DISABLED&&i.setState(t.INACTIVE)}))):e.target===i._activeButton&&(i._activeButton=null,i.dispatchEvent({type:s.Event.ACTIVE_BUTTON_CHANGED,button:e.target,isActiveButton:!1}))}}s.Event={ACTIVE_BUTTON_CHANGED:"RadioButtonGroup.ActiveButtonChanged",VISIBILITY_CHANGED:o.Control.Event.VISIBILITY_CHANGED,COLLAPSED_CHANGED:o.Control.Event.COLLAPSED_CHANGED,CONTROL_ADDED:n.ControlGroup.Event.CONTROL_ADDED,CONTROL_REMOVED:n.ControlGroup.Event.CONTROL_REMOVED,SIZE_CHANGED:n.ControlGroup.Event.SIZE_CHANGED},s.prototype=Object.create(n.ControlGroup.prototype),s.prototype.constructor=s,s.prototype.addControl=function(e,t){return e instanceof r.Button&&(!!n.ControlGroup.prototype.addControl.call(this,e,t)&&(e.addEventListener(r.Button.Event.STATE_CHANGED,this._handleButtonStateChange),!0))},s.prototype.removeControl=function(e){var t="string"==typeof e?this.getControl(e):e;return!(null===t||!n.ControlGroup.prototype.removeControl.call(this,t))&&(t.removeEventListener(r.Button.Event.STATE_CHANGED,this._handleButtonStateChange),!0)},s.prototype.getActiveButton=function(){return this._activeButton}},11674:(e,t,i)=>{"use strict";i.d(t,{j:()=>n});let n="search-selected"},77995:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Searchbox:()=>S});var n=i(60618),r=i(11674),o=i(83081),s=i(25004),a=i(86022),l=i(26206),c=50,h=150,u=100;function d(e,t,i){let n=i;this.excludeRoot=t,(n instanceof Autodesk.Viewing.GuiViewer3D||n instanceof Autodesk.Viewing.Viewer3D)&&(o.logger.warn("Deprecated use of Viewer as parameter. Provide container instead"),n=i.container),this.results=[],this.resultCount=0,this.selectedIndex=-1;let r=this.getDocument();this.container=r.createElement("div"),this.container.classList.add("docking-panel"),this.container.classList.add("adsk-search-results"),this.container.results=r.createElement("div"),this.container.results.classList.add("docking-panel-scroll"),this.container.results.classList.add("docking-panel-container-solid-color-b"),this.container.results.addEventListener("scroll",p.bind(this)),this.container.appendChild(this.container.results),e.insertBefore(this.container,e.firstChild),this.scrollingContainer=r.createElement("div"),this.scrollingContainer.classList.add("adsk-search-results-scrolling-panel"),this.scrollingContainer.addEventListener("click",f.bind(this)),this.container.results.appendChild(this.scrollingContainer),this.footer=new a.ResizeFooter(this.container,function(){var e=this.container.getBoundingClientRect(),t=n.getBoundingClientRect();t.right<e.right&&(this.container.style.width=t.right-e.left+"px"),t.bottom<e.bottom&&(this.container.style.height=t.bottom-e.top+"px")}.bind(this)),this.footer.setGlobalManager(this.globalManager),this.divNoResults=function(e){var t=e.createElement("div"),i=e.createElement("div"),n=e.createElement("div");t.classList.add("no-results-container"),t.style.display="none";var r="No Results";i.setAttribute("data-i18n",r),i.textContent=Autodesk.Viewing.i18n.translate(r),i.classList.add("no-results-title");var o="Try another term";return n.setAttribute("data-i18n",o),n.textContent=Autodesk.Viewing.i18n.translate(o),n.classList.add("no-results-description"),t.appendChild(i),t.appendChild(n),t.domTitle=i,t.domMessage=n,t}(r),this.scrollingContainer.appendChild(this.divNoResults),this.scrollY=0,this.dirty=!1,this.nextFrameId=0,this.it={init:function(e){return this.isDone=!1,this.results=e,this.indexRs=0,this.indexId=-1,this},done:function(){return this.isDone},next:function(){if(this.isDone)return this;for(this.indexId++;this.results.length!==this.indexRs&&this.indexId===this.results[this.indexRs].ids.length;)this.indexId=0,this.indexRs++;return this.isDone=this.indexRs===this.results.length,this},id:function(){return this.results[this.indexRs].ids[this.indexId]},delegate:function(){return this.results[this.indexRs].delegate}},this.elementsPool=[],this.elementsUsed=0;for(var s=0;s<h;++s)this.elementsPool[s]=y(r);this.setVisible(!1)}function f(e){var t=e.target,i=this._getNodeAndModelIds(t);i&&(this.fireEvent({type:r.j,id:i.nodeId,modelId:i.modelId}),e.preventDefault())}function p(){var e=this.container.results.scrollTop;Math.abs(this.scrollY-e)>=u&&(this.scrollY=e,m(this))}function m(e,t){e.dirty&&!t||(t?g(e):(e.dirty=!0,e.nextFrameId=requestAnimationFrame((function(){g(e)}))))}function g(e){e.dirty=!1,function(e){for(var t=e.elementsUsed,i=e.elementsPool,n=0;n<t;++n){b(i[n])}e.elementsUsed=0}(e),0!==e.resultCount?(e.setDisplayNoResults(!1),function(e){var t=e.container.results,i=0,n=t.clientHeight,r=e.scrollY,o=e.it.init(e.results),s=Math.max(0,e.scrollY-u),a=0|Math.floor(s/c),l=0;i=a*c;for(;a;)a--,l++,o.next();var h=e.elementsPool[e.elementsUsed++];h.style.height=i+"px",e.scrollingContainer.appendChild(h);var d=!0;for(;d;){if(o.next(),o.done()){d=!1;break}if(i>r+n+u){d=!1;break}if(e.elementsUsed===e.elementsPool.length){d=!1;break}var f=o.id(),p=o.delegate(),m=i+c,g=e.elementsPool[e.elementsUsed++];v(f,p,g,e,l===e.selectedIndex),e.scrollingContainer.appendChild(g),i=m,l++}var y=e.resultCount*c;e.scrollingContainer.style.height=y+"px"}(e)):e.setDisplayNoResults(!0)}function v(e,t,i,n,r){i.classList.add("search-result"),r?i.classList.add("selected"):i.classList.remove("selected"),i.setAttribute("lmv-nodeId",e),i.setAttribute("lmv-modelId",t.model.id),i.style.height=c+"px";var o=t.instanceTree.getNodeName(e),s=n.searchString,a=o.toLowerCase().indexOf(s.toLowerCase()),l=o.substr(0,a),h=o.substr(a,s.length),u=o.substr(a+s.length);i.domPrefix.innerText=l,i.domMatch.innerText=h,i.domSufix.innerText=u;var d=function(e,t,i){var n=[],r=t.getRootId(),o=i.isRootExcluded(),s=t.instanceTree,a=e,l=!1;for(;a&&!l&&(a!==r||(l=!0,!o));){var c=s.getNodeName(a);n.unshift(c),a=s.getNodeParentId(a)}return n}(e,t,n);i.domPath.innerText=d.join(" > ")}function y(e){var t=e.createElement("div"),i=e.createElement("div"),n=e.createElement("span"),r=e.createElement("span"),o=e.createElement("span"),s=e.createElement("span");return i.classList.add("search-result-container"),r.classList.add("search-match"),s.classList.add("search-path"),i.appendChild(n),i.appendChild(r),i.appendChild(o),i.appendChild(s),t.appendChild(i),t.domPrefix=n,t.domMatch=r,t.domSufix=o,t.domPath=s,t.domContainer=i,t}function b(e){e.setAttribute("lmv-nodeId",""),e.setAttribute("lmv-modelId",""),e.domPrefix.innerText="",e.domMatch.innerText="",e.domSufix.innerText="",e.domPath.innerText="",e.style.height="0"}function x(e,t){e.scrollTop+e.clientHeight<(t+1)*c&&(e.scrollTop+=(t+1)*c-(e.scrollTop+e.clientHeight)),e.scrollTop/c>t&&(e.scrollTop=t*c)}d.prototype.constructor=d,s.EventDispatcher.prototype.apply(d.prototype),l.GlobalManagerMixin.call(d.prototype),d.prototype.setPosition=function(e,t){this.container.style.left=e+"px",this.container.style.top=t+"px"},d.prototype.setMinWidth=function(e){this.container.style.width=e+"px"},d.prototype.setMaxWidth=function(e){this.container.style.maxHeight=e+"px"},d.prototype.setVisible=function(e){this.container.style.display=e?"":"none"},d.prototype.setResults=function(e,t){this.searchString=e,this.results=t,this.resultCount=function(e){for(var t=0,i=0;i<e.length;++i){t+=e[i].ids.length}return t}(t),this.selectedIndex=0==this.resultCount?-1:0,this.container.style.height=this.resultCount*c+20+"px",this.container.results.scrollTop=0,this.scrollY=0,0===this.resultCount?this.container.classList.add("no-content"):this.container.classList.remove("no-content"),m(this)},d.prototype.getSelection=function(){var e=this.scrollingContainer.querySelector(".selected");if(!e)return null;var t=this._getNodeAndModelIds(e);return t||null},d.prototype.isRootExcluded=function(){return!(this.results&&this.results.length>1)&&(!(this.modelCount>1)&&this.excludeRoot)},d.prototype.uninitialize=function(){this.setVisible(!1),this.container=null,this.container.parentNode&&this.container.parentNode.removeChild(this.container),cancelAnimationFrame(this.nextFrameId),this.clearListeners()},d.prototype.setDisplayNoResults=function(e){this.divNoResults.style.display=e?"":"none"},d.prototype.selectNext=function(){0!==this.resultCount&&(this.selectedIndex=Math.min(this.resultCount-1,this.selectedIndex+1),x(this.container.results,this.selectedIndex),m(this))},d.prototype.selectPrevious=function(){0!==this.resultCount&&(this.selectedIndex=Math.max(0,this.selectedIndex-1),x(this.container.results,this.selectedIndex),m(this))},d.prototype._getNodeAndModelIds=function(e){for(;!e.hasAttribute("lmv-nodeId");)if(!(e=e.parentNode)||e===this.scrollingContainer)return;return{nodeId:parseInt(e.getAttribute("lmv-nodeId")),modelId:parseInt(e.getAttribute("lmv-modelId"))}};var _=i(38842);const E=i(38221);function S(e,t,i){this._id=e,this._listeners={},this._options=i||{},this._searchFunction=this._options.searchFunction||function(){};var n=this.getDocument();this.container=n.createElement("div"),this.container.id=e,this.addClass("adsk-control"),this.addClass("adsk-searchbox"),this.addClass("empty");var s=n.createElement("input");s.classList.add("search-box"),s.classList.add("docking-panel-delimiter-shadow"),s.type="search",s.results=[],s.placeholder=_.A.t("Search"),s.setAttribute("data-i18n","Search"),s.incremental="incremental",s.autosave=this.container.id+"search_autosave",this.container.insertBefore(s,this.scrollContainer),this.searchbox=s;var a=function(){u.searchbox.value="",u.addClass("empty")},l=function(){u.searchbox.classList.remove("searching"),u.searchResults.setVisible(!1)},c=n.createElement("div");c.className="search-box-icon",this.container.insertBefore(c,s.nextSibling);var h=n.createElement("div");h.className="search-box-close",h.addEventListener("click",(function(){a(),l()})),this.container.appendChild(h),this.searchResults=new d(this.container,i.excludeRoot,t),this.searchResults.addEventListener(r.j,(function(e){a(),l(),u.fireEvent(e)}));var u=this,f=!0;s.addEventListener("keydown",(function(e){var t=u.getWindow();if(38===(e=e||t.event).keyCode&&(u.searchResults.selectPrevious(),e.preventDefault()),40===e.keyCode&&(u.searchResults.selectNext(),e.preventDefault()),13===e.keyCode){var i=u.searchResults.getSelection();if(!i)return!1;a(),l(),u.fireEvent({type:S.Events.ON_SEARCH_SELECTED,id:i.nodeId,modelId:i.modelId}),e.preventDefault()}}));var p=E((()=>{if(0===s.value.length)return u.container.classList.add("empty"),void l();u.container.classList.remove("empty"),s.value.length<3||function(){var e=s.value.trim();if(0!==e.length){f&&(o.logger.track({category:"search_node",name:"model_browser_tool"}),f=!1),s.classList.add("searching");var t=u._searchFunction(e);u.searchResults.setResults(e,t),u.searchResults.setVisible(!0)}else l()}()}),800);s.addEventListener("input",(function(){p()})),s.addEventListener("change",(function(e){var t=u.getDocument();e.target===t.activeElement&&p()})),s.addEventListener("focus",(function(){c.classList.add("focused")})),s.addEventListener("blur",(function(){c.classList.remove("focused")}))}S.prototype=Object.create(n.Control.prototype),S.prototype.constructor=S,S.Events={ON_SEARCH_SELECTED:r.j}},857:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SplitViewLayout:()=>l});const n={down:{pointer:"pointerdown",mouse:"mousedown",touch:"touchstart"},up:{pointer:"pointerup",mouse:"mouseup",touch:"touchend"},move:{pointer:"pointermove",mouse:"mousemove",touch:"touchmove"}};function r(e,t,i){const r=(arguments.length>3&&void 0!==arguments[3]&&arguments[3]?"remove":"add")+"EventListener",o=function(e){const t=[];return Autodesk.Viewing.isMobileDevice()||t.push(n[e].mouse),Autodesk.Viewing.isTouchDevice()&&t.push(n[e].touch),t}(t);for(const t of o)e[r](t,i)}class o{constructor(e,t){this.container=e,this.isDragging=!1,this.resizeHandlerElement=null,this.onMoveCB=t,this.panelSizeThreshold=20,this.margin=16,this.initResizeHandlerElement()}onDown(e){this.isDragging=!0,e.preventDefault()}onUp(e){this.isDragging=!1}onMove(e){if(this.isDragging){"touchmove"===e.type&&(e.pageX=e.touches[0].pageX,e.pageY=e.touches[0].pageY);const t=this.container.getBoundingClientRect(),i=this.getTargetWidthPercentage(e,t);this.panelSizeThreshold<i&&i<100-this.panelSizeThreshold&&this.onMoveCB(i)}}getTargetWidthPercentage(e,t){}initResizeHandlerElement(){this.resizeHandlerElement=document.createElement("div"),this.handlerSplitLine=document.createElement("div"),this.resizeHandlerElement.appendChild(this.handlerSplitLine),r(this.resizeHandlerElement,"down",this.onDown.bind(this)),this.onUpBinded=this.onUp.bind(this),this.onMoveBinded=this.onMove.bind(this),r(document,"move",this.onMoveBinded),r(document,"up",this.onUpBinded),this.resizeHandlerElement.className="resize-handler",this.handlerSplitLine.className="resize-handler-center-mark"}setPosition(e){}terminate(){this.resizeHandlerElement.parentNode.removeChild(this.resizeHandlerElement),this.resizeHandlerElement=null,r(document,"up",this.onUpBinded,!0),r(document,"move",this.onMoveBinded,!0)}}class s extends o{initResizeHandlerElement(){super.initResizeHandlerElement(),this.resizeHandlerElement.classList.add("vertical"),this.handlerSplitLine.classList.add("vertical"),this.resizeHandlerElement.style.width=`${this.margin}px`}getTargetWidthPercentage(e,t){return(e.pageX-t.left)/t.width*100}setPosition(e){this.resizeHandlerElement.style.left=`calc(${e}% - ${this.margin/2}px)`}}class a extends o{initResizeHandlerElement(){super.initResizeHandlerElement(),this.resizeHandlerElement.classList.add("horizontal"),this.handlerSplitLine.classList.add("horizontal"),this.resizeHandlerElement.style.height=`${this.margin}px`}getTargetWidthPercentage(e,t){return(e.pageY-t.top)/t.height*100}setPosition(e){this.resizeHandlerElement.style.top=`calc(${e}% - ${this.margin/2}px)`}}class l{constructor(e){this._splitType=e||l.SplitType.Vertical,this.onResizeHandlerMove=this.onResizeHandlerMove.bind(this)}createSplitViewLayout(e,t,i){if(this.targetContainer=e,this.splitViewContainer=document.createElement("div"),this.splitViewContainer.classList.add("split-view-container"),this.targetContainer.parentNode.replaceChild(this.splitViewContainer,this.targetContainer),this.firstViewerContainer=this.wrapViewerContainer(t),this._splitType===l.SplitType.Vertical)this._resizeHandler=new s(this.splitViewContainer,this.onResizeHandlerMove);else{if(this._splitType!==l.SplitType.Horizontal)return void console.error("unknown splitType");this._resizeHandler=new a(this.splitViewContainer,this.onResizeHandlerMove)}this._resizeHandler&&this.splitViewContainer.appendChild(this._resizeHandler.resizeHandlerElement),this.secondViewerContainer=this.wrapViewerContainer(i),this.onResizeHandlerMove(50)}wrapViewerContainer(e){const t=document.createElement("div");return t.className="split-view-viewer-container",e&&t.appendChild(e),this.splitViewContainer.appendChild(t),t}restoreMainViewer(){this._resizeHandler&&(this._resizeHandler.terminate(),this._resizeHandler=null),this.splitViewContainer&&(this.splitViewContainer.parentNode.replaceChild(this.targetContainer,this.splitViewContainer),this.splitViewContainer=null,this.targetContainer=null,this.firstViewerContainer=null,this.secondViewerContainer=null)}onResizeHandlerMove(e){this._resizeHandler&&this._resizeHandler.setPosition(e),this._splitType===l.SplitType.Vertical?(this.firstViewerContainer.style.width=`${e}%`,this.secondViewerContainer.style.width=100-e+"%",this.secondViewerContainer.style.left=`${e}%`):this._splitType===l.SplitType.Horizontal&&(this.firstViewerContainer.style.height=`${e}%`,this.secondViewerContainer.style.height=100-e+"%",this.secondViewerContainer.style.top=`${e}%`)}}l.SplitType={Vertical:"vertical",Horizontal:"horizontal"}},4355:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ToolBar:()=>o});var n=i(37463),r=i(60618);function o(e,t){n.ControlGroup.call(this,e,t),this.removeClass("adsk-control-group"),this.addClass("adsk-toolbar"),t&&t.alignVertically&&this.addClass("adsk-toolbar-vertical")}o.Event={VISIBILITY_CHANGED:r.Control.Event.VISIBILITY_CHANGED,COLLAPSED_CHANGED:r.Control.Event.COLLAPSED_CHANGED,CONTROL_ADDED:n.ControlGroup.Event.CONTROL_ADDED,CONTROL_REMOVED:n.ControlGroup.Event.CONTROL_REMOVED,SIZE_CHANGED:n.ControlGroup.Event.SIZE_CHANGED},o.prototype=Object.create(n.ControlGroup.prototype),o.prototype.constructor=o},10902:(e,t,i)=>{"use strict";i.r(t)},72980:(e,t,i)=>{function n(t,i){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e.exports[n]=t[n],i&&(e.exports[i][n]=t[n]))}i(74423),i(69479),i(28845),i(17656),i(55105),i(7467),i(10586),i(71517),i(93777),i(14190),i(12359),i(86097),i(39172),i(57019),i(17273),i(81723),i(27415),i(19929),i(37583),i(55122),i(16385),i(20230),i(57268),i(79733),i(58179),i(30456),i(74017),i(79310),i(83062),i(96369),i(15637),i(2848),i(24842),i(24746),i(33454),i(6660),i(15941),i(82101),i(2917),i(47628),i(65186),i(42978),i(72527),i(79852),i(42376),i(40617),i(73067),i(66820),i(8288),i(25509),i(65223),i(60321),i(41927),i(11632),i(64377),i(49522),i(66771),i(12516),i(68931),i(52514),i(35694),i(52774),i(23283),i(49536),i(21926),i(94483),i(16215),i(78898),i(74176),i(43275),i(42793),i(77208),i(67348),i(26957),i(79732),i(83742),i(56422),i(82451),i(46270),i(59848),e.exports.Autodesk=i(54679).Autodesk;var r=Object.assign||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])};e.exports.THREE=i(72091),e.exports.av={},e.exports.avp={},e.exports.avu={},e.exports.ave={},n({Hammer:i(41944)},"av"),n(i(55280),"av"),n(i(55280),"avp"),n(i(8600),"avp"),n(i(8600),"av"),n(i(75840),"avp"),n(i(85403),"avp"),n(i(11653),"avp"),n(i(11653),"av"),n(i(20268),"avp");const o=i(38842).A;o.translate=o.t.bind(o),o.localize=()=>{},n({i18n:o},"av"),n(i(16271),"avp"),n(i(77427),"avp"),n(i(83081),"avp"),n(i(57872),"avp"),n(i(14859),"avp"),n(i(65802),"avp"),n(i(61453),"avp"),n(i(94998),"avp"),n(i(25618),"avp"),n(i(12360),"avp"),n(i(30130),"avp"),n(i(26217),"avp"),n(i(68449),"avp"),n(i(31320),"avp"),n(i(48717),"avp"),n(i(34423),"avp"),n(i(97011),"avp"),n(i(89024),"avp"),n(i(2179),"avp"),n(i(46890),"avp"),n(i(60012),"avp"),n(i(22267),"avp"),n(i(36771),"avp"),n(i(68630),"avp"),n(i(62612),"avp"),n(i(88190),"avp"),n(i(53870),"avp"),n(i(44745),"avp"),n(i(5732),"avp"),n(i(41007),"avp"),n(i(98233),"avp"),n(i(15371),"avp"),n(i(68747),"avp"),n(i(24528),"avp"),n(i(19129),"avp"),n(i(96118),"avp"),n(i(37365),"avp"),n(i(21706),"avp"),n(i(69511),"avp"),n(i(81760),"avp"),n(i(38749),"avp"),n(i(65672),"avp"),n(i(36411),"avp"),n(i(86639),"avp"),n(i(8879),"avp"),n(i(42525),"avp"),n(i(72474),"avp"),n(i(34845),"avp"),n(i(70101),"avp"),n(i(77201),"avp"),n(i(22040),"avp"),n(i(47263),"avp"),n(i(71082),"avp"),n(i(9478),"avp"),n(i(4897),"avp"),n(i(94549),"avp"),n(i(54561),"avp"),n(i(63430),"av"),n(i(41428),"avp"),n(i(65435),"avp"),n(i(75468),"avp"),n(i(12153),"avp"),n(i(65782),"avp"),n(i(76731),"avp"),n(i(47712),"avp"),n(i(90824),"avp"),n(i(81422),"avp"),n(i(23936),"avp"),n(i(32431),"avp"),n(i(1433),"avp"),n(i(30514),"avp"),n(i(58536),"avp"),n(i(93509),"avp"),n(i(46014),"avp"),n(i(57480),"av"),n(i(8412),"av"),n(i(84045),"avp"),n(i(9341),"avp"),n(i(22201),"avp"),n(i(54393),"av"),n(i(99211),"av"),n(i(25004),"av"),n(i(82712),"av"),n(i(55270),"av"),n(i(93228),"av"),n(i(19556),"av"),n(i(24840),"av"),n(i(92037),"av"),n(i(97005),"avp"),n(i(73674),"avp"),n(i(94661),"avp"),n(i(63764),"av"),n(i(26940),"av"),n(i(61183),"avp"),n(i(35922),"avp"),n(i(11743),"av"),n(i(26477),"av"),n(i(91735),"av"),n(i(55066),"avp"),n(i(21174),"avp"),n(i(67259),"av"),n(i(18817),"av"),n(i(82976),"av"),n(i(56197),"av"),n(i(13002),"av"),n(i(65251),"av"),n(i(53625),"av"),n(i(6684),"av"),n(i(33398),"av");const s=i(19948);n({FeatureFlags:s.FeatureFlags,PublicFeatureFlags:s.PublicFeatureFlags},"av"),n({InternalFeatureFlags:s.InternalFeatureFlags},"avp"),n(i(27623),"avp"),e.exports.av.ModelUnits=i(27623).ModelUnits,n(i(54386),"avp"),n(i(80152),"av"),n(i(13202),"avp");var a=e.exports.av.MeasureCommon={};r(a,i(97010)),a.MeasurementTypes=i(65918).S,a.MeasurementTypesToAnalytics=i(65918).z,a.SnapType=i(17070).h,a.Events=i(23482).G,a.Measurement=i(63795).D,a.SnapResult=i(12182).e,n(i(8811),"av"),n(i(26206),"av"),n(i(45775),"avp"),n(i(4369),"avp"),n(i(78567),"avp"),n(i(17016),"av"),n(i(63841),"av"),n(i(27579),"avp"),n(i(18310),"av"),n(i(13843),"avp"),n(i(49930),"av"),n(i(83464),"av"),n(i(75109),"av"),n(i(68793),"av"),n(i(40723),"av"),n(i(55855),"av"),n(i(74481),"av"),n(i(23261),"av"),n(i(4746),"av"),n(i(28833),"av"),n(i(60687),"av"),n(i(43719),"av"),n(i(2312),"avp"),n(i(5968),"avp"),n(i(47261),"avp"),n(i(14564),"avp"),n(i(13e3),"avp"),n(i(90255),"avp"),n(i(91496),"avp"),n(i(19356),"avp"),n(i(87816),"avp"),n(i(7756),"avp"),n(i(28441),"av"),n(i(32937),"av"),n(i(82076),"avp"),n(i(16613),"avp"),i(10902),n(i(98087),"avu"),n(i(55266),"avu"),n(i(87241),"avu"),n(i(76948),"avu"),n(i(86022),"avp"),n(i(82024),"avu"),n(i(96551),"avu"),n(i(26452),"avp"),n(i(23619),"avp"),n(i(1581),"avp"),n(i(91904),"avp"),n(i(99587),"avu"),n(i(14813),"avu"),n(i(16969),"avu"),n(i(42440),"avp"),n(i(81215),"ave"),n(i(60618),"avu"),n(i(37463),"avu"),n(i(22767),"avu"),n(i(41129),"avu"),n(i(66277),"avu"),n(i(4355),"avu"),n(i(88946),"avp"),n(i(94589),"avu"),n(i(25360),"avu"),n(i(77995),"avu"),n(i(47898),"avp"),n(i(72738),"ave"),n(i(87471),"ave"),n(i(11337),"ave"),n(i(23611),"ave"),n(i(36523),"av"),n(i(66316),"av"),n(i(857),"avu"),n(i(6614),"av"),n(i(82800),"av"),n(i(14561),"av"),n(i(88728),"av"),n(i(95062),"avp"),n(i(97705),"av"),i(63526).E(e.exports)},88728:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CrossViewerInteractionCommon:()=>r});var n=i(19556);const r={onSelectionChanged:{eventName:n.AGGREGATE_SELECTION_CHANGED_EVENT,cb:(e,t,i)=>{const n=e.getAggregateSelection();if(t.impl.model)if(n.length>0)for(let e=0;e<n.length;e++){const i=n[e],r=i.model,o=i.selection;for(let e=0;e<t.impl.modelQueue().getModels().length;e++){const i=t.impl.modelQueue().getModels()[e];i&&i.getDocumentNode()&&r.getDocumentNode()&&i.getDocumentNode().originModel===r.getDocumentNode().originModel?(t.impl.is2d?t.select(o,i):(t.showAll(),t.select(o,i),t.isolate(o,i)),t.fitToView(o)):!t.impl.is2d&&i.visibilityManager&&i.visibilityManager.setAllVisibility(!1)}}else t.clearSelection(),t.impl.is2d||t.showAll()}}}},14561:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createLeechViewer:()=>a});var n=i(88190);function r(e){Autodesk.Viewing.Private.RenderContext.call(this),this.originalInit=this.init.bind(this),this.init=function(t,i,n){var r;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.canvas=e,this.ctx2D=this.canvas.getContext("2d");const s=!0!==(null===(r=o.webglInitParams)||void 0===r?void 0:r.alpha),a=Object.assign({},o,{offscreen:!0,removeAlphaInOutput:s});this.originalInit(t,i,n,a),this.glrenderer=t;const l=this.glrenderer.getPixelRatio();this.setSize(i/l,n/l)},this.renderToCanvas=function(){this.ctx2D&&(this.getOffscreenTarget()||0!=this.widthWithPixelRatio&&0!=this.heightWithPixelRatio&&(this.ctx2D.clearRect(0,0,this.widthWithPixelRatio,this.heightWithPixelRatio),this.ctx2D.drawImage(this.glrenderer.domElement,0,this.glrenderer.domElement.height-this.heightWithPixelRatio,this.widthWithPixelRatio,this.heightWithPixelRatio,0,0,this.widthWithPixelRatio,this.heightWithPixelRatio)))},this.originalSetSize=this.setSize.bind(this),this.setSize=function(e,t,i,n){if(!n){const i=this.glrenderer.getPixelRatio();this.width=e,this.height=t,this.widthWithPixelRatio=e*i,this.heightWithPixelRatio=t*i,this.canvas.width=this.widthWithPixelRatio,this.canvas.height=this.heightWithPixelRatio,this.canvas.style.width=`${this.width}px`,this.canvas.style.height=`${this.height}px`}this.prepareViewport(i,n),this.restoreViewport()},this.prepareViewport=function(e,t){this.glrenderer.pushViewport();const i=this.glrenderer.getPixelRatio(),n=this.glrenderer.domElement.width/i,r=this.glrenderer.domElement.height/i;(n<this.width||r<this.height)&&this.glrenderer.setSize(Math.max(this.width,n),Math.max(this.height,r)),this.originalSetSize(this.width,this.height,e,t)},this.restoreViewport=function(){this.glrenderer.popViewport()}}r.prototype=Object.create(n.RenderContext.prototype),r.prototype.constructor=r;var o=i(97005);const s=new Map;function a(e,t,i,n){if(s.has(n)){return new(s.get(n))(e,t,i)}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;this.sharedResources=i,this.resizeObserver=null,n.call(this,e,t),Autodesk.Viewing.Private.IsUsingWebGPU()||(this.renderContext=new r(this.canvas),this.sharedResources.mrtFlags?this.renderContext.mrtFlags=this.sharedResources.mrtFlags:this.sharedResources.mrtFlags=this.renderContext.mrtFlags)}a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.initialize=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={glrenderer:this.sharedResources.glrenderer,materialManager:this.sharedResources.materialManager,renderer:this.renderContext},i=Object.assign({},e,t),r=n.prototype.initialize.call(this,i);return this.overrideAPIs(),this.sharedResources.geomCache&&this.sharedResources.geomCache.initialized&&this.impl.setGeomCache(this.sharedResources.geomCache),this.resizeObserver=new ResizeObserver((e=>{const t=e[0].contentRect,i=Math.floor(t.width),n=Math.floor(t.height);i&&n&&(this.impl.resize(i,n,!0),this.dispatchEvent({type:Autodesk.Viewing.VIEWER_RESIZE_EVENT,width:i,height:n}),this.impl.tick(performance.now()))})),this.resizeObserver.observe(this.container),r},a.prototype.uninitialize=function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.originalLoadDocumentNode=null,this.loadDocumentNode=n.prototype.loadDocumentNode,n.prototype.uninitialize.call(this)},a.prototype.overrideAPIs=function(){var e=this;if(!this.impl.isWebGPU()){const e=this.impl.tick.bind(this.impl);this.impl.tick=()=>{if(!this.impl||!this.impl.glrenderer())return;this.impl.renderer().prepareViewport(),this.restoreViewerState();const t=performance.now();e(t),this.impl.renderer().restoreViewport()},this.addEventListener(Autodesk.Viewing.RENDER_PRESENTED_EVENT,(()=>{this.renderContext.renderToCanvas()}),{priority:-1e3})}const t=this.impl.setLightPreset.bind(this.impl);this.impl.setLightPreset=(e,i,n)=>{if(this.impl.is2d){this.impl.initLights();const t=Autodesk.Viewing.Private.LightPresets[e].bgColorGradient;this.setBackgroundColor(...t),this.impl.setCurrentLightPreset(e);const i=this.impl.loadCubeMapFromColors(this.impl.clearColorTop,this.impl.clearColorBottom);this.impl.renderer().setCubeMap(i)}else t(e,i,n)};const i=this.toolController.__invokeStack.bind(this.toolController);this.toolController.__invokeStack=function(){return e.restoreViewerState(),i(...arguments)};const n=this.impl.unloadModel.bind(this.impl);this.impl.unloadModel=(e,t)=>{const i=e.leechViewerKey;let r=!1;const o=this.sharedResources.loadedModels[i];return o&&(o.usedByViewersCounter--,r=t||o.forceKeepResources||o.usedByViewersCounter>0,r||delete this.sharedResources.loadedModels[i]),n(e,t=t||r)},this.originalLoadDocumentNode=this.loadDocumentNode.bind(this),this.loadDocumentNode=function(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,o)=>{const s=function(e,t){let i=e.getModelKey();return i+=".ref:"+!!t.applyRefPoint,i+=".g:"+(t.globalOffset?[t.globalOffset.x,t.globalOffset.y,t.globalOffset.z]:[0,0,0]).toString(),t.placementTransform&&(i+=".p:"+t.placementTransform.toArray().toString()),t.customHash&&(i+=".h:"+t.customHash),i}(i,n),a=e.sharedResources.loadedModels[s];if(a){const t=e.onModelLoaded(a.model,n);r(t)}else e.originalLoadDocumentNode(t,i,n).then((t=>{t.leechViewerKey=s,e.sharedResources.loadedModels[s]={model:t,usedByViewersCounter:1,loadingViewer:e},r(t)})).catch(o)}))};const r=this.impl.geomCache.bind(this.impl);this.impl.geomCache=()=>(this.sharedResources.geomCache&&this.sharedResources.geomCache.initialized||(this.sharedResources.geomCache=r()),this.sharedResources.geomCache)},a.prototype.setViewerProfile=function(e,t){if(t.loadAsHidden)return;t.isAEC=e.isAEC();const i=this.chooseProfile(t);delete i.settings.lineRendering,delete i.settings.pointRendering,this.setProfile(i)},a.prototype.setViewerLight=function(e,t){if(!t.loadAsHidden)if(this.impl.is2d){this.impl.setLightPreset(o.DefaultLightPreset2d);const e=this.impl.clearColorTop.clone().multiplyScalar(255),i=this.impl.clearColorBottom.clone().multiplyScalar(255);t.isAEC?this.impl.setLightPresetForAec():this.impl.setLightPreset(o.DefaultLightPreset),this.impl.toggleEnvMapBackground(!1),this.setBackgroundColor(e.x,e.y,e.z,i.x,i.y,i.z)}else this.impl.toggleEnvMapBackground(this.profile.settings.envMapBackground)},a.prototype.cleanViewerBeforeLoadModel=function(e){if(!e.keepCurrentModels&&this.impl.hasModels()){let e=this.config;this.tearDown(),this.setUp(e)}!this.impl.hasModels()&&this._loadingSpinner&&this._loadingSpinner.show()};const l=new THREE.Vector4(0,0,-1,-1e20);function c(e){const t=!e,i=e&&!e.isLoadDone(),n=e&&e.getPropertyDb()&&!e.getPropertyDb().isLoadDone();return!(t||i||n)}return a.prototype.syncCutPlanes=function(){const e=this.impl.getAllCutPlanes()||[l],t=this.impl.matman(),i=Math.max(e.length,t._cutplanes.length);t._cutplanes.length=0;let n=0;for(;n<e.length;n++)t._cutplanes.push(e[n].clone());for(;n<i;n++)t._cutplanes.push(l);t.forEach((e=>{e.doNotCut||(e.cutplanes=t._cutplanes)}),!1,!0)},a.prototype.restoreViewerState=function(){this.sharedResources.lastRenderedViewer!==this&&(this.syncCutPlanes(),this.impl.is2d&&this.impl.updateCameraMatrices(),this.sharedResources.lastRenderedViewer=this)},a.prototype.onModelLoaded=function(e,t){const i=e.leechViewerKey;this.sharedResources.loadedModels[i].forceKeepResources=!0,this.cleanViewerBeforeLoadModel(t);const n=this.cloneModelToViewer(e);return this.addModelToViewer(n,t),delete this.sharedResources.loadedModels[i].forceKeepResources,n},a.prototype.addModelToViewer=function(e,t){this.impl.modelQueue().addHiddenModel(e),t.loadAsHidden||(this.setViewerProfile(e,t),this.showModel(e),this.setViewerLight(e,t),!t.headlessViewer&&this.createUI&&this.createUI(e)),this._loadingSpinner&&this._loadingSpinner.hide()},a.prototype.cloneModelToViewer=function(e){const t=e.clone(),i=e.leechViewerKey;t.leechViewerKey=i;const n=this.sharedResources.loadedModels[i];n.usedByViewersCounter++;const r=n.loadingViewer,o=()=>this.impl.invalidate(!1,!0,!1);return r.addEventListener(Autodesk.Viewing.LOADER_REPAINT_REQUEST_EVENT,o,{priority:-1e3}),function(e,t){return new Promise((i=>{c(t)&&i();const n=()=>{c(t)&&(e.removeEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT,n),e.removeEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT,n),i())};e.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT,n),e.addEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT,n)}))}(r,t).then((()=>{setTimeout((()=>{t.setInnerAttributes(e.getInnerAttributes()),this.impl.onLoadComplete(t)}),1),r.removeEventListener(Autodesk.Viewing.LOADER_REPAINT_REQUEST_EVENT,o)})),t},s.set(n,a),new a(e,t,i,n)}},82800:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MultiViewerFactory:()=>o});var n=i(14561),r=i(62612);class o{constructor(){if(this.sharedResources={loadedModels:{}},!Autodesk.Viewing.Private.IsUsingWebGPU()){const e=Autodesk.Viewing.Private.createRenderer(void 0,{alpha:!0}),t=new r.MaterialManager(e);this.sharedResources={...this.sharedResources,glrenderer:e,materialManager:t}}}createViewer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Autodesk.Viewing.Viewer3D;return(0,n.createLeechViewer)(e,t,this.sharedResources,i)}destroy(){this.sharedResources=null}}},83081:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LogLevels:()=>l,Logger:()=>c,logger:()=>f,setLogger:()=>p});var n=i(55280),r=i(8412),o=i(85403);const s=(0,n.getGlobal)(),a=s,l={DEBUG:5,LOG:4,INFO:3,WARNING:2,ERROR:1,NONE:0};function c(){this.runtimeStats={},this.level=-1,this.setLevel(l.ERROR),this._reportError=this._reportError.bind(this)}function h(e,t){let i;"string"==typeof t?i={message:t}:"object"==typeof t&&(i=t),o.analytics.track(e,i)}function u(){return"undefined"!=typeof window?encodeURI(a.location.href):""}function d(){}c.prototype.initialize=function(e){if(e.eventCallback&&(this.callback=e.eventCallback),this.sessionId=e.sessionId,!this.sessionId){var t=Date.now()+"";this.sessionId=parseFloat((1e4*Math.random()|0)+""+t.substring(4))}"number"==typeof e.logLevel&&this.setLevel(e.logLevel),this.environmentInfo={touch:(0,n.isTouchDevice)(),env:(0,r.getEnv)(),referer:u(),version:s.LMV_VIEWER_VERSION,build_type:s.LMV_BUILD_TYPE};var i={category:"viewer_start",touch:this.environmentInfo.touch,env:this.environmentInfo.env,referer:this.environmentInfo.referer,version:this.environmentInfo.version,build_type:this.environmentInfo.build_type};this.track(i);var o=this;this.interval=setInterval((function(){o.reportRuntimeStats()}),6e4)},c.prototype.shutdown=function(){clearInterval(this.interval),this.interval=void 0},c.prototype.track=function(e){this.updateRuntimeStats(e),!(0,r.isOffline)()&&this.sessionId&&(this.callback&&(e.timestamp=Date.now(),e.sessionId=this.sessionId,this.callback(e)),"error"===(null==e?void 0:e.category)&&h("viewer.error.tracked",e))},c.prototype.updateRuntimeStats=function(e){if(Object.prototype.hasOwnProperty.call(e,"aggregate"))switch(e.aggregate){case"count":this.runtimeStats[e.name]>0?this.runtimeStats[e.name]++:this.runtimeStats[e.name]=1,this.runtimeStats._nonempty=!0;break;case"last":this.runtimeStats[e.name]=e.value,this.runtimeStats._nonempty=!0;break;default:this.warn("unknown log aggregate type")}},c.prototype.reportRuntimeStats=function(){this.runtimeStats._nonempty&&(delete this.runtimeStats._nonempty,this.runtimeStats.category="misc_stats",this.track(this.runtimeStats),this.runtimeStats={})},c.prototype.setLevel=function(e){this.level!==e&&(this.level=e,this.debug=e>=l.DEBUG?console.log:d,this.log=e>=l.LOG?console.log:d,this.info=e>=l.INFO?console.info:d,this.warn=e>=l.WARNING?console.warn:d,this.error=e>=l.ERROR?this._reportError:d)},c.prototype._reportError=function(){console.error.apply(console,arguments);const e=Array.prototype.slice.call(arguments).join(" ");this.callback&&this.callback({category:"error",message:e}),h("viewer.error.logged",e)};let f=new c;function p(e){f=e}},13202:(e,t,i)=>{"use strict";i.r(t),i.d(t,{displayUnits:()=>s,displayUnitsEnum:()=>a,displayUnitsPrecision:()=>l,displayUnitsPrecisionEnum:()=>c,getUnitEnum:()=>u});var n=i(38842);const r=[{name:"File units",type:""},{name:"Millimeters",type:"mm",matches:["millimeter","millimeters"]},{name:"Centimeters",type:"cm",matches:["centimeter","centimeters"]},{name:"Meters",type:"m"},{name:"Inches",type:"in",matches:["inch","inches"]},{name:"Feet",type:"ft",matches:["foot"]},{name:"Feet and fractional inches",type:"ft-and-fractional-in"},{name:"Feet and decimal inches",type:"ft-and-decimal-in"},{name:"Decimal inches",type:"decimal-in"},{name:"Decimal feet",type:"decimal-ft"},{name:"Fractional inches",type:"fractional-in"},{name:"Meters and centimeters",type:"m-and-cm"},{name:"Points",type:"pt",matches:["point","points"]}],o=[{name:"File precision",value:""},{name:"0 (1)",value:0},{name:"0.1 (1/2)",value:1},{name:"0.01 (1/4)",value:2},{name:"0.001 (1/8)",value:3},{name:"0.0001 (1/16)",value:4},{name:"0.00001 (1/32)",value:5},{name:"0.000001 (1/64)",value:6}],s=r.map((e=>e.name)),a=r.map((e=>e.type)),l=o.map((e=>e.name)),c=o.map((e=>e.value));r.forEach((e=>{if(e.matches){const t=e.matches.map((e=>n.A.t(e)));e.matches=e.matches.concat(t)}}));const h=new Set(a);function u(e){if(e=e&&e.toLocaleLowerCase(),h.has(e))return e;for(let t in r){const i=r[t],n=i.matches;if(n&&n.indexOf(e)>-1)return i.type}return null}},97010:(e,t,i)=>{"use strict";i.r(t),i.d(t,{EPSILON:()=>a,angleVectorToVector:()=>w,calculateDistance:()=>h,computeResult:()=>g,correctPerpendicularPicks:()=>c,createCommonOverlay:()=>D,getCircularArcRadius:()=>y,getEndPointsInEdge:()=>A,getFaceArea:()=>v,getSnapResultPosition:()=>l,inverseProject:()=>x,isEqualVectors:()=>S,isParallel:()=>M,isPerpendicular:()=>C,nearestPointInPointToLine:()=>_,nearestPointInPointToSegment:()=>E,nearestVertexInVertexToEdge:()=>P,project:()=>b,safeToggle:()=>L});var n=i(72091),r=i(17070),o=i(65918),s=i(27623);const a=1e-4;function l(e,t){if(!e)return null;if(e.isPerpendicular)return e.intersectPoint;switch(e.geomType){case r.h.SNAP_VERTEX:case r.h.RASTER_PIXEL:case r.h.SNAP_MIDPOINT:case r.h.SNAP_CIRCLE_CENTER:return e.getGeometry();case r.h.SNAP_EDGE:var i=A(e.getGeometry()),n=i[0].clone(),o=i[1].clone();return _(e.intersectPoint,n,o);case r.h.SNAP_FACE:return T(e.intersectPoint,e.getGeometry().vertices[0],e.faceNormal);case r.h.SNAP_CIRCULARARC:if(t&&t.model&&t.model.is2d()){var s=e.snapPoint;return e.geomType=r.h.SNAP_VERTEX,e.geomVertex=s,s}return e.circularArcCenter;case r.h.SNAP_CURVEDEDGE:return P(e.intersectPoint,e.getGeometry());case r.h.SNAP_CURVEDFACE:return e.intersectPoint;case r.h.SNAP_INTERSECTION:return e.snapPoint;default:return null}}function c(e,t,i,o){if(!(e&&t&&e.getGeometry()&&t.getGeometry()))return!1;var s=l(e,i);if(o&&i)if(t.geomType===r.h.SNAP_EDGE){var a=new n.Vector3,c=new n.Vector3,h=t.getGeometry();if(a.subVectors(t.intersectPoint,s).normalize(),c.subVectors(h.vertices[0],h.vertices[1]).normalize(),C(a,c,.05))if(f=E(s,h.vertices[0],h.vertices[1],!0))return o.onMouseMove(b(f,i))&&o.setPerpendicular(!0),t.geomVertex=f,t.intersectPoint=f,!0}else if(t.geomType===r.h.SNAP_FACE){var u=new n.Vector3,d=t.getGeometry();if(u.subVectors(t.intersectPoint,s).normalize(),M(t.faceNormal,u,.05)){var f=T(s,d.vertices[0],t.faceNormal);return o.onMouseMove(b(f,i))&&o.setPerpendicular(!0),t.geomVertex=f,t.intersectPoint=f,!0}}}function h(e,t,i,n){var r;if(!(e&&t&&e.getGeometry()&&t.getGeometry()))return null;var s=l(e,n),c=l(t,n);if(!s||!c)return null;if(S(s,c,a))return null;let h;n.model.is2d()&&(s=s.clone(),c=c.clone(),e.viewportIndex2d=n.model.isPdf?e.viewportIndex2d:e.viewportIndex2d||e.id,n.model.pageToModel(s,c,e.viewportIndex2d));const u=e.viewportIndex2d,d=null==n||null===(r=n.model)||void 0===r||null===(r=r.getData())||void 0===r?void 0:r.viewports;var f;d&&void 0!==u&&(h=null===(f=d[u])||void 0===f?void 0:f.units);if(i){i=p(i);var g=s.distanceTo(c);return{distanceXYZ:m(g,i),distanceX:m(g=Math.abs(s.x-c.x),i),distanceY:m(g=Math.abs(s.y-c.y),i),distanceZ:0,type:o.S.MEASUREMENT_DISTANCE,units:h}}return{distanceXYZ:s.distanceTo(c),distanceX:Math.abs(s.x-c.x),distanceY:Math.abs(s.y-c.y),distanceZ:Math.abs(s.z-c.z),type:o.S.MEASUREMENT_DISTANCE,units:h}}function u(e,t){if(e.is3d())return 0;if(e.isPdf())return 0;var i=e.getMetadata("page_dimensions","page_width",null),r=e.getMetadata("page_dimensions","logical_width",null),o=e.getMetadata("page_dimensions","page_height",null),s=e.getMetadata("page_dimensions","logical_height",null);if(!(i&&r&&o&&s))return 0;var a=i/r,l=o/s,c=new n.Vector3(0,0,0),h=new n.Vector3(a,l,0);return e.pageToModel(c,h,t),c.distanceTo(h)}function d(e,t){var i=[];for(var r in e)if(e.hasOwnProperty(r)){var o=l(e[r],t);o&&i.push(o)}if(3!==i.length||function(e){for(var t=0;t<e.length;t++)for(var i=0;i<e.length;i++)if(t!==i&&S(e[t],e[i],a))return!0;return!1}(i))return null;var s=new n.Vector3,c=new n.Vector3;return s.subVectors(i[0],i[1]),c.subVectors(i[2],i[1]),w(s,c)}function f(e,t,i,r){if(!(e&&t&&e.getGeometry()&&t.getGeometry()))return null;if(!e.circularArcRadius)return null;var o=l(e,r).clone(),s=l(t,r).clone();const c=e.circularArcCenter;var h=c instanceof n.Vector3?c.clone():new n.Vector3(c.x,c.y,c.z);if(!o||!s)return null;if(S(o,s,a))return 0;r.model.is2d()&&(r.model.pageToModel(o,s,e.viewportIndex2d),r.model.pageToModel(h,null,e.viewportIndex2d));var u=function(){var e=new n.Vector3,t=new n.Vector3;e.subVectors(o,h),t.subVectors(s,h);var i=e.length()*t.length(),r=e.dot(t);return Math.acos(r/i)*e.length()}();return i?m(u,i=p(i)):u}function p(e){var t=Math.log(e)/Math.log(10),i=Math.floor(t);return 1<e/Math.pow(10,i)&&i++,Math.pow(10,i)}function m(e,t){return Math.floor(e/t+.5)*t}function g(e,t,i,n){switch(t){case o.S.MEASUREMENT_DISTANCE:return h(s=e[1],e[2],u(i.model,s.viewportIndex2d),i);case o.S.MEASUREMENT_ANGLE:var r=d(e,i);return r?{angle:n&&n.angleOuter?360-r:r,type:t}:null;case o.S.MEASUREMENT_AREA:return function(e,t){var i,n=[];for(var r in e)if(e.hasOwnProperty(r)){var s=l(e[r],t);s&&n.push(s.clone())}var a=l(e[1],t);a&&n.push(a.clone());for(var c=0;c<n.length;c+=2)t.model.pageToModel(n[c],n[c+1],e[1].viewportIndex2d);var h=0,u=0;for(c=0;c<n.length-1;c++)h+=n[c].x*n[c+1].y,u+=n[c].y*n[c+1].x;var d=Math.abs((h-u)/2);let f;const p=e[1].viewportIndex2d,m=null==t||null===(i=t.model)||void 0===i||null===(i=i.getData())||void 0===i?void 0:i.viewports;var g;return m&&Number.isInteger(p)&&(f=null===(g=m[p])||void 0===g?void 0:g.units),{area:d,type:o.S.MEASUREMENT_AREA,units:f}}(e,i);case o.S.MEASUREMENT_ARC:var s;return{arc:f(s=e[1],e[2],u(i.model,s.viewportIndex2d),i),type:t};case o.S.MEASUREMENT_LOCATION:return{location:l(e[1],i),type:t};default:return null}}function v(e,t,i,r,o,a){var l=0,c=new n.Vector3,h=new n.Vector3;const u=i.vertices.length;for(var d=0;d<u;d+=3){const e=i.vertices[d],t=i.vertices[d+1],n=i.vertices[d+2];c.subVectors(t,e),h.subVectors(n,e),l+=c.length()*h.length()*Math.sin(c.angleTo(h))/2}return l=(0,s.convertUnits)(e.model.getUnitString(),r,a,l,"square"),r?(0,s.formatValueWithUnits)(l,r+"^2",3,o):(0,s.formatValueWithUnits)(l,null,3,o)}function y(e,t,i,n,r,o){var a=i.radius;if(a){if(e.model.is2d()){var l=i.center.clone();const n=i.vertices[0].clone();e.model.pageToModel(l,n,t.getPick(1).viewportIndex2d),a=l.distanceTo(n)}return a=(0,s.convertUnits)(e.model.getUnitString(),n,o,a),(0,s.formatValueWithUnits)(a,n,3,r)}}function b(e,t,i){var r=t.navigation.getCamera(),o=t.navigation.getScreenViewport(),s=new n.Vector3(e.x,e.y,e.z);return s=s.project(r),i=i||0,new n.Vector2(Math.round((s.x+1)/2*o.width)+i,Math.round((1-s.y)/2*o.height)+i)}function x(e,t){var i=t.navigation.getCamera(),r=t.navigation.getScreenViewport(),o=new n.Vector3;return o.x=e.x/r.width*2-1,o.y=-(e.y/r.height*2-1),o.z=0,o=o.unproject(i)}function _(e,t,i){var r,o=new n.Vector3,s=new n.Vector3;return o.subVectors(t,e),s.subVectors(i,t),r=o.dot(s),o.subVectors(i,t),r=-r/o.dot(o),o.subVectors(i,t),o.multiplyScalar(r),o.add(t)}function E(e,t,i,r){var o,s,a=new n.Vector3,l=new n.Vector3;return a.subVectors(t,e),l.subVectors(i,t),s=a.dot(l),a.subVectors(i,t),(s=-s/a.dot(a))<0?o=r?null:t:s>1?o=r?null:i:(a.subVectors(i,t),a.multiplyScalar(s),o=a.add(t)),o}function S(e,t,i){return!(!e||!t)&&(Math.abs(e.x-t.x)<=i&&Math.abs(e.y-t.y)<=i&&Math.abs(e.z-t.z)<=i)}function A(e){var t=[];const i=e.vertices,n=i.length;for(var r=0;r<n;++r){var o=!1;const e=i[r];for(var s=0;s<n;++s){const t=i[s];if(s!==r&&t.equals(e)){o=!0;break}}o||t.push(e)}return t.length<2&&(t[0]=i[0],t[1]=i[1]),t}function w(e,t){return 180*e.angleTo(t)/Math.PI}function T(e,t,i){var r=new n.Vector3,o=i.clone(),s=new n.Vector3;s.subVectors(e,t);var a=-o.dot(s)/o.dot(o);return r.addVectors(e,o.multiplyScalar(a)),r}function M(e,t,i){return i=i||a,1-Math.abs(e.dot(t))<i}function C(e,t,i){return i=i||a,Math.abs(e.dot(t))<i}function P(e,t){for(var i,n=Number.MAX_VALUE,r=0;r<t.vertices.length;r++){const s=t.vertices[r];var o=e.distanceTo(s);n>o&&(i=s,n=o)}return i}function D(e,t){e.impl.overlayScenes[t]||e.impl.createOverlayScene(t)}function L(e,t,i){(e.classList.contains(t)&&!i||!e.classList.contains(t)&&i)&&e.classList.toggle(t,i)}},23482:(e,t,i)=>{"use strict";i.d(t,{G:()=>n});var n={MEASUREMENT_CHANGED_EVENT:"measurement-changed",MEASUREMENT_COMPLETED_EVENT:"measurement-completed",UNITS_CALIBRATION_STARTS_EVENT:"units_calibration_starts_event",FINISHED_CALIBRATION_FOR_DIMENSION_EVENT:"finished_calibration_for_dimension_event",CALIBRATION_REQUIRED_EVENT:"calibration-required",OPEN_CALIBRATION_PANEL_EVENT:"open-calibration-panel",CLOSE_CALIBRATION_PANEL_EVENT:"close-calibration-panel",CLEAR_CALIBRATION_SIZE_EVENT:"clear-calibration-size",FINISHED_CALIBRATION:"finished-calibration",DISPLAY_UNITS_CHANGED:"display-units-changed",PRECISION_CHANGED:"precision-changed",MEASUREMENT_MODE_ENTER:"measure-mode-enter",MEASUREMENT_MODE_LEAVE:"measure-mode-leave",DELETE_MEASUREMENT:"delete-measurement",SELECT_MEASUREMENT:"select-measurement",MEASURE_TOOL_ACTIVE:"measure-tool-active"}},63795:(e,t,i)=>{"use strict";i.d(t,{D:()=>s});var n=i(12182),r=i(65918),o=i(97010);function s(e,t,i){this.measurementType=e,this.id=t,this.picks=[],this.closedArea=!1,this.isRestored=!1,this.options=i,this.resetMeasureValues()}s.prototype.clone=function(){var e;const t=new s(this.measurementType,this.id,this.options);return t.closedArea=this.closedArea,t.isRestored=this.isRestored,t.picks=this.clonePicks(),t.angle=this.angle,t.distanceX=this.distanceX,t.distanceY=this.distanceY,t.distanceZ=this.distanceZ,t.distanceXYZ=this.distanceXYZ,t.arc=this.arc,t.location=null===(e=this.location)||void 0===e?void 0:e.clone(),t.result=Object.assign({},this.result),t},s.prototype.resetMeasureValues=function(){this.angle=0,this.distanceX=0,this.distanceY=0,this.distanceZ=0,this.distanceXYZ=0,this.arc=0,this.location=null,this.result=null},s.prototype.setPick=function(e,t){var i=this.picks[e]=t;return i.id=parseInt(e),i},s.prototype.getPick=function(e){var t=this.picks[e];return t||(t=this.setPick(e,new n.e)),t},s.prototype.clonePicks=function(e){var t=[];for(var i in this.picks)if(Object.prototype.hasOwnProperty.call(this.picks,i)){var n=this.picks[i];t.push(n.clone())}return t},s.prototype.countPicks=function(){return Object.keys(this.picks).length},s.prototype.getMaxNumberOfPicks=function(){switch(this.measurementType){case r.S.MEASUREMENT_DISTANCE:case r.S.MEASUREMENT_LOCATION:case r.S.MEASUREMENT_CALLOUT:case r.S.MEASUREMENT_ARC:return 2;case r.S.MEASUREMENT_ANGLE:return 3;case r.S.MEASUREMENT_AREA:return this.closedArea?this.countPicks():Number.MAX_VALUE-1}},s.prototype.hasPick=function(e){return this.picks[e]&&!this.picks[e].isEmpty()||this.isRestored},s.prototype.isComplete=function(){var e=this.countPicks()===this.getMaxNumberOfPicks();for(var t in this.picks)if(Object.prototype.hasOwnProperty.call(this.picks,t)&&!(e=e&&this.hasPick(t)))break;return e},s.prototype.isEmpty=function(){var e=!0;for(var t in this.picks)if(Object.prototype.hasOwnProperty.call(this.picks,t)&&!(e=e&&!this.hasPick(t)))break;return e},s.prototype.clearPick=function(e){this.picks[e]&&this.picks[e].clear(),this.resetMeasureValues()},s.prototype.clearAllPicks=function(){for(var e in this.picks)Object.prototype.hasOwnProperty.call(this.picks,e)&&this.clearPick(e)},s.prototype.hasEqualPicks=function(e,t){if(!e||!t)return!1;if(e.geomType===t.geomType){var i=(0,o.getSnapResultPosition)(e),n=(0,o.getSnapResultPosition)(t);return(0,o.isEqualVectors)(i,n,o.EPSILON)}return!1},s.prototype.computeResult=function(e,t){if(this.resetMeasureValues(),!t.model)return this.result=null,!1;var i=this.result=(0,o.computeResult)(e,this.measurementType,t,this.options);if(null===i)return!this.isComplete();switch(i.type){case r.S.MEASUREMENT_DISTANCE:return this.distanceXYZ=i.distanceXYZ,this.distanceX=i.distanceX,this.distanceY=i.distanceY,this.distanceZ=i.distanceZ,!0;case r.S.MEASUREMENT_ANGLE:return this.angle=isNaN(i.angle)?0:i.angle,!0;case r.S.MEASUREMENT_AREA:return this.area=i.area,!0;case r.S.MEASUREMENT_ARC:return this.arc=i.arc,!0;case r.S.MEASUREMENT_LOCATION:return this.location=i.location,!0;case r.S.MEASUREMENT_CALLOUT:return!0;default:return!1}},s.prototype.getGeometry=function(e){return{type:this.picks[e].geomType,geometry:this.picks[e].getGeometry()}},s.prototype.attachIndicator=function(e,t,i){this.indicator=new i(e,this,t),this.indicator.init()}},65918:(e,t,i)=>{"use strict";i.d(t,{S:()=>n,z:()=>r});var n={MEASUREMENT_DISTANCE:1,MEASUREMENT_ANGLE:2,MEASUREMENT_AREA:3,CALIBRATION:4,MEASUREMENT_CALLOUT:5,MEASUREMENT_LOCATION:6,MEASUREMENT_ARC:7},r={[n.MEASUREMENT_DISTANCE]:"Distance",[n.MEASUREMENT_ANGLE]:"Angle",[n.MEASUREMENT_AREA]:"Area",[n.CALIBRATION]:"Calibration",[n.MEASUREMENT_CALLOUT]:"Callout",[n.MEASUREMENT_LOCATION]:"Location",[n.MEASUREMENT_ARC]:"Arc"}},80152:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PDFUtils:()=>a});var n=i(12153);function r(e){var t,i;const n=null===(t=e.impl)||void 0===t||null===(t=t.model)||void 0===t?void 0:t.getDocumentNode(),r=null==n||null===(i=n.search(Autodesk.Viewing.BubbleNode.LEAFLET_NODE)[0])||void 0===i?void 0:i._raw();if(!r)return null;const o={};return new Autodesk.Viewing.Document(n.getRootNode()._raw(),"").getLeafletParams(o,n,r),o}function o(e){const t=new Autodesk.Viewing.Private.TexQuadConfig,i=r(e);if(!i)return null;t.initFromLoadOptions(null,i);return t.getBBox()}function s(e){const t=o(e);if(!t)return null;return n.SceneMath.getNormalizingMatrix(null,t)}var a={leafletToPdfWorld:function(e,t){const i=s(e);if(!i)return null;let r;if(t.applyMatrix4(i),e.model.isLeaflet()){const t=e.model.getMetadata("page_dimensions"),i=new THREE.Box3(new THREE.Vector3,new THREE.Vector3(t.page_width,t.page_height,0));r=n.SceneMath.getNormalizingMatrix(void 0,i)}else r=n.SceneMath.getNormalizingMatrix(e.model);return t.applyMatrix4(r.invert()),t},pdfToLeafletWorld:function(e,t){const i=n.SceneMath.getNormalizingMatrix(e.model);t.applyMatrix4(i);let r=s(e);return r?(t.applyMatrix4(r.invert()),t):null},getLeafletLoadOptions:r,getLeafletBoundingBox:o,getLeafletNormalizingMatrix:s}},12182:(e,t,i)=>{"use strict";i.d(t,{e:()=>r});var n=i(17070);function r(){this.clear()}r.prototype.clear=function(){this.geomType=null,this.modelId=null,this.fragId=null,this.fragPos=null,this.snapNode=null,this.geomVertex=null,this.geomEdge=null,this.geomFace=null,this.radius=null,this.intersectPoint=null,this.faceNormal=null,this.viewportIndex2d=null,this.circularArcCenter=null,this.circularArcRadius=null,this.fromTopology=!1,this.isPerpendicular=!1,this.snapPoint=null},r.prototype.copyTo=function(e){e.modelId=this.modelId,e.fragId=this.fragId,e.fragPos=this.fragPos,e.snapNode=this.snapNode,e.geomVertex=this.geomVertex,e.geomFace=this.geomFace,e.geomEdge=this.geomEdge,e.radius=this.radius,e.geomType=this.geomType,e.intersectPoint=this.intersectPoint,e.faceNormal=this.faceNormal,e.viewportIndex2d=this.viewportIndex2d,e.circularArcCenter=this.circularArcCenter,e.circularArcRadius=this.circularArcRadius,e.fromTopology=this.fromTopology,e.isPerpendicular=this.isPerpendicular,e.snapPoint=this.snapPoint},r.prototype.clone=function(){var e=new r;return this.copyTo(e),e},r.prototype.isEmpty=function(){return!this.getGeometry()};let o=null,s=null,a=null;const l=(e,t)=>(s=s||new THREE.Vector3,a=a||new THREE.Vector3,s.set(0,0,0),a.set(e,0,0),s.applyMatrix4(t),a.applyMatrix4(t),s.distanceTo(a));r.prototype.applyMatrix4=function(e){if(this.geomEdge&&this.geomEdge.applyMatrix4(e),this.geomFace&&this.geomFace.applyMatrix4(e),this.geomVertex&&this.geomVertex.applyMatrix4(e),this.intersectPoint&&this.intersectPoint.applyMatrix4(e),this.circularArcCenter&&this.circularArcCenter.applyMatrix4(e),this.snapPoint&&this.snapPoint.applyMatrix4(e),this.faceNormal){o=o||new THREE.Matrix4;const t=o.getNormalMatrix(e);this.faceNormal.applyMatrix4(t)}this.radius=l(this.radius,e),this.circularArcRadius=l(this.circularArcRadius,e)},r.prototype.getFace=function(){return this.geomFace},r.prototype.getEdge=function(){return this.geomEdge},r.prototype.getVertex=function(){return this.geomVertex},r.prototype.getGeometry=function(){switch(this.geomType){case n.h.SNAP_VERTEX:case n.h.SNAP_MIDPOINT:case n.h.SNAP_INTERSECTION:case n.h.SNAP_CIRCLE_CENTER:case n.h.RASTER_PIXEL:return this.geomVertex;case n.h.SNAP_EDGE:return this.geomEdge;case n.h.SNAP_FACE:return this.geomFace;case n.h.SNAP_CIRCULARARC:case n.h.SNAP_CURVEDEDGE:return this.geomEdge;case n.h.SNAP_CURVEDFACE:return this.geomFace}return null},r.prototype.setGeometry=function(e,t){switch(e){case n.h.SNAP_VERTEX:case n.h.SNAP_MIDPOINT:case n.h.SNAP_INTERSECTION:case n.h.SNAP_CIRCLE_CENTER:case n.h.RASTER_PIXEL:this.geomVertex=t;break;case n.h.SNAP_EDGE:this.geomEdge=t;break;case n.h.SNAP_FACE:this.geomFace=t;break;case n.h.SNAP_CIRCULARARC:case n.h.SNAP_CURVEDEDGE:this.geomEdge=t;break;case n.h.SNAP_CURVEDFACE:this.geomFace=t;break;default:return}this.geomType=e}},17070:(e,t,i)=>{"use strict";i.d(t,{h:()=>n});var n={SNAP_VERTEX:0,SNAP_MIDPOINT:1,SNAP_CIRCLE_CENTER:2,SNAP_EDGE:3,SNAP_FACE:4,SNAP_CIRCULARARC:5,SNAP_CURVEDEDGE:6,SNAP_CURVEDFACE:7,RASTER_PIXEL:8,SNAP_INTERSECTION:9}},27623:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelUnits:()=>s,calculatePrecision:()=>x,convertToDisplayUnits:()=>_,convertUnits:()=>b,fixUnitString:()=>v,formatValueWithUnits:()=>g,getMainUnit:()=>E,getUnitData:()=>y});var n=i(38842),r=i(13202);const o=i(92467);var s={METER:"m",CENTIMETER:"cm",MILLIMETER:"mm",FOOT:"ft",INCH:"in",POINT:"pt"};const a={[s.METER]:1,[s.CENTIMETER]:.01,[s.MILLIMETER]:.001,[s.FOOT]:.3048,[s.INCH]:.0254,[s.POINT]:.0254/72};function l(e){let t="";return 2===e?t=String.fromCharCode(178):3===e&&(t=String.fromCharCode(179)),t}function c(e){var t=0<=e?Math.floor(e):Math.ceil(e);return{intPart:t,fracPart:e-t}}function h(e,t,i){var n="";return i&&0===e&&(n+="-"),n+=0<t?e.toFixed(t):e.toFixed(0)}function u(e,t,i,n){for(var r,o,s="",a=1,l=e<0,u=0;u<t;++u)a*=2;e>0?e+=.5/a:e-=.5/a,i?o=e:(s+=h(r=c(e/12).intPart,0,l)+n.feet+" ",(o=e-12*r)<0&&(o=-o));var d=c(o).intPart,f=c((o-d)*a).intPart;if(0!==f&&0===d||(s+=h(d,0)),0!==f){for(d<0&&f<0&&(f=-f);f%2==0;)f/=2,a/=2;0!==d&&(s+="-"),s+=h(f,0)+"/"+h(a,0)}return s+=n.inches}function d(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;var n="";e<0&&(n="-",e=Math.abs(e));var r=c(e),o=r.intPart,s=r.fracPart*Math.pow(100,i);const a=l(i);let u=h(o,0),d=h(s,t);return d.startsWith(Math.pow(100,i).toString())&&(u=h(o+1,0),d=h(0,t)),n+u+` m${a} `+d+` cm${a}`}function f(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;var r="";e<0&&(r="-",e=Math.abs(e));var o=c(e),s=o.intPart,a=o.fracPart*Math.pow(12,n);const u=l(n);let d=h(s,0),f=h(a,t);return f.startsWith(Math.pow(12,n).toString())&&(d=h(s+1,0),f=h(0,t)),r+d+i.feet+u+" "+f+i.inches+u}const p={feetFractionalInches:"ft-and-fractional-in",fractionalInches:"fractional-in",feet:"feet",inches:"inches",stationingFeet:"feet"};function m(e){if(!e||!e.startsWith("autodesk.unit.unit:"))return e;let t=e.split(":")[1].split("-")[0],i=o.unit[t];if(!i)return console.warn("Failed to find Forge unit schema for",e),e;{let e=p[t];if(e)return e;if(!i.symbols)return console.warn("Unit without symbols.",i),"";if(i.defaultSymbol&&i.symbols[i.defaultSymbol])return i.symbols[i.defaultSymbol];for(let e in i.symbols)return i.symbols[e]}}function g(e,t,i,r,o){var s;null==r&&(r=3);const a=(o=o||{}).preferLetters?{feet:" ft",inches:" in"}:{feet:"'",inches:'"'};t=m(t);try{if(1===i)s=n.A.t(e?"Yes":"No");else if(24===i){var c=e.split(" ");s=[];for(var p=0;p<c.length;++p)s.push(g(parseFloat(c[p]),t,3,r));s=s.join(", ")}else if(2!==i&&3!==i||!isNaN(e))if("ft-and-fractional-in"===t)s=u(12*e,r,!1,a);else if("ft-and-fractional-in^2"===t)s=o.noMixedArea?h(e,r)+" ft"+l(2):u(12*e,r,!1,a)+" "+l(2);else if("ft-and-fractional-in^3"===t)s=o.noMixedVolume?h(e,r)+" ft"+l(3):u(12*e,r,!1,a)+" "+l(3);else if("ft-and-decimal-in"===t)s=f(e,r,a);else if("ft-and-decimal-in^2"===t)s=o.noMixedArea?h(e,r)+" ft"+l(2):f(e,r,a,2);else if("ft-and-decimal-in^3"===t)s=o.noMixedVolume?h(e,r)+" ft"+l(3):f(e,r,a,3);else if("decimal-in"===t||"in"===t||"inch"===t||"inches"===t)s=h(e,r)+a.inches;else if("decimal-in^2"===t||"in^2"===t||"inch^2"===t)s=h(e,r)+" in"+l(2);else if("decimal-in^3"===t||"in^3"===t||"inch^3"===t)s=h(e,r)+" in"+l(3);else if("decimal-in-sq"===t||"fractional-in-sq"===t)s=h(e,r)+" sq. in";else if("decimal-ft"===t||"ft"===t||"feet"===t||"foot"===t)s=h(e,r)+a.feet;else if("decimal-ft^2"===t||"ft^2"===t||"feet^2"===t||"foot^2"===t)s=h(e,r)+" ft"+l(2);else if("decimal-ft^3"===t||"ft^3"===t||"feet^3"===t||"foot^3"===t)s=h(e,r)+" ft"+l(3);else if("decimal-ft-sq"===t||"ft-and-fractional-in-sq"===t||"ft-and-decimal-in-sq"===t)s=h(e,r)+" sq. ft";else if("fractional-in"===t)s=u(e,r,!0,a);else if("fractional-in^2"===t)s=u(e,r,!0,a)+l(2);else if("fractional-in^3"===t)s=u(e,r,!0,a)+l(3);else if("m-and-cm"===t)s=d(e,r);else if("m-and-cm^2"===t)s=o.noMixedArea?h(e,r)+" m"+l(2):d(e,r,2);else if("m-and-cm^3"===t)s=o.noMixedVolume?h(e,r)+" m"+l(3):d(e,r,3);else if(t&&t.text){s=function(e,t){const i=t.space?" ":"";return"Prefix"===t.placement?t.text+i+e:e+i+t.text}(3===i?h(e,r):e,t)}else 3===i&&t?(t=(t=t.replace("^2",l(2))).replace("^3",l(3)),s=h(e,r)+" "+t):s=t?e+" "+t:3===i?h(e,r):e;else s="NaN"}catch(i){s=t?e+" "+t:e}return s}function v(e){var t;switch(e=null===(t=e)||void 0===t?void 0:t.toLowerCase()){case"meter":case"meters":case"m":return s.METER;case"foot":case"feet":case"ft":return s.FOOT;case"feet and inches":case"inch":case"inches":case"in":return s.INCH;case"centimeter":case"centimeters":case"cm":return s.CENTIMETER;case"millimeter":case"millimeters":case"mm":return s.MILLIMETER;case"point":case"points":case"pt":return s.POINT;default:return e}}function y(e){let t=v(e);return{unitString:t,unitScale:a[t]||1}}function b(e,t,i,n,r,o){if(i=i||1,o=o||72,(e=v(e))===(t=v(t))&&1===i)return n;const l=s,c=a;var h=1;switch(t){case l.MILLIMETER:h=1/c[l.MILLIMETER];break;case l.CENTIMETER:h=1/c[l.CENTIMETER];break;case l.METER:h=1;break;case l.INCH:h=1/c[l.INCH];break;case l.FOOT:case"ft-and-fractional-in":case"ft-and-decimal-in":h=1/c[l.FOOT];break;case"decimal-in":h=1/c[l.INCH];break;case"decimal-ft":h=1/c[l.FOOT];break;case"fractional-in":h=1/c[l.INCH];break;case"m-and-cm":h=1;break;case l.POINT:h=1/c[l.INCH]*o}var u=1;switch(e){case l.MILLIMETER:u=c[l.MILLIMETER];break;case l.CENTIMETER:u=c[l.CENTIMETER];break;case l.METER:u=c[l.METER];break;case l.INCH:u=c[l.INCH];break;case l.FOOT:case"ft-and-fractional-in":case"ft-and-decimal-in":u=c[l.FOOT];break;case"decimal-in":u=c[l.INCH];break;case"decimal-ft":u=c[l.FOOT];break;case"fractional-in":u=c[l.INCH];break;case"m-and-cm":u=1;break;case l.POINT:u=c[l.INCH]/o}return"square"===r?n?n*Math.pow(h*u*i,2):0:"cube"===r?n?n*Math.pow(h*u*i,3):0:n?n*h*u*i:0}function x(e){if(!e)return 0;var t=e.toString().split(".")[1];if(!t){var i=e.toString().split("/")[1],n=i&&i.match(/\d+/);if(n){var r=parseFloat(n);if(r&&!isNaN(r))return Math.floor(Math.log2(r))}return 0}return(t=t.match(/\d+/))&&t[0]&&t[0].length||0}function _(e,t,i,n){if(!i||!n)return{displayValue:e,displayUnits:i};let o=i,s=n;const a=m(o);let l;if("object"==typeof a&&"text"in a&&(o=a.text),o&&(o=o.replace(/²$/,"^2").replace(/³$/,"^3")),/\^2$/.test(o)?(o=o.replace("^2",""),s+="^2",l="square"):/\^3$/.test(o)&&(o=o.replace("^3",""),s+="^3",l="cube"),o=(0,r.getUnitEnum)(o),null===o)return{displayValue:e,displayUnits:i};if(2===t||3===t){return{displayValue:b(o,n,1,e,l,null),displayUnits:s}}if(24===t){return{displayValue:e.split(" ").map((e=>b(o,n,1,e,l,null))).join(" "),displayUnits:s}}return{displayValue:e,displayUnits:i}}function E(e){switch(e){case"decimal-ft":case"ft-and-fractional-in":case"ft-and-decimal-in":return"ft";case"decimal-in":case"fractional-in":return"in";case"m-and-cm":return"m"}return e}},54386:(e,t,i)=>{"use strict";i.r(t),i.d(t,{UnitParser:()=>n});var n={};function r(e,t,i,n){if(!e)return NaN;var r,o=(e=e.toString()).trim();if(0==o.length)return NaN;var s=i.join("| *"),a=n.join("| *");if(r=o.match(new RegExp("^([+-]?\\d+)(?: *)/(?: *)(\\d+)(?: *)(?:"+a+") *$")))return parseFloat(r[1])/parseFloat(r[2])/t;if(r=o.match(new RegExp("^([+-]?\\d+)(?: *)/(?: *)(\\d+)(?: *)(?:"+s+")? *$")))return parseFloat(r[1])/parseFloat(r[2]);var l;if(!(r=o.match(/^[+-]? *(?:\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?/i)))return NaN;if(l=parseFloat(r[0].replace(/ */g,"")),0==(o=(o=o.slice(r[0].length)).replace("-"," ")).length||isNaN(l))return l;var c=Math.sign(l);return 0===c&&(c=1),o.match(new RegExp("^(?: *)(?:"+a+") *$","i"))?l/t:(r=o.match(new RegExp("^ +(\\d+)(?: *)/(?: *)(\\d+)(?: *)(?:"+a+") *$","i")))?(l+c*parseFloat(r[1])/parseFloat(r[2]))/t:(r=o.match(new RegExp("^(?: *)(?:"+s+"|-| +-?) *","i")))?0==(o=o.slice(r[0].length).trim()).length?r[0].match(/-/)?NaN:l:(r=o.match(new RegExp("^(\\d+(?:\\.\\d*)?)(?: *)(?:"+a+")? *$")))?l+c*parseFloat(r[1])/t:(r=o.match(new RegExp("^(\\d+)(?: *)/(?: *)(\\d+)(?: *)(?:"+a+")? *$")))?l+c*(parseFloat(r[1])/parseFloat(r[2]))/t:(r=o.match(new RegExp("^(\\d+) +(\\d+)(?: *)/(?: *)(\\d+)(?: *)(?:"+a+")? *$")))?l+c*(parseFloat(r[1])+parseFloat(r[2])/parseFloat(r[3]))/t:NaN:NaN}n.parseFeet=function(e){return r(e,12,["ft","feet","'","`","‘","’"],["in","inch",'\\"',"''","``","‘‘","’’"])},n.parseMeter=function(e){return r(e,100,["m","meter"],["cm","centimeter"])},n.parseNumber=function(e,t){switch(t){case"ft":case"decimal-ft":case"ft-and-fractional-in":case"ft-and-decimal-in":case"decimal-in":case"fractional-in":return n.parseFeet(e);default:return n.parseMeter(e)}},n.parsePositiveNumber=function(e,t){var i=n.parseNumber(e,t);return i>=0?i:NaN}},32937:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MobileCallbacks:()=>r});const n=(0,i(55280).getGlobal)();function r(){this.ios=n.webkit,this.android=n.JSINTERFACE,this.iosSend=function(e,t){return n.webkit.messageHandlers.callbackHandler.postMessage({command:e,data:t})},this.androidSend=n.JSINTERFACE}var o=r.prototype;o.animationReady=function(){this.ios?this.iosSend("animationReady"):this.android&&this.androidSend.animationReady()},o.onSelectionChanged=function(e){this.ios?this.iosSend("selectionChanged",e):this.android&&this.androidSend.onSelectionChanged(e)},o.onLongTap=function(e,t){this.ios?this.iosSend("onLongTap",[e,t]):this.android&&this.androidSend.onLongTap(e,t)},o.onSingleTap=function(e,t){this.ios?this.iosSend("onSingleTap",[e,t]):this.android&&this.androidSend.onSingleTap(e,t)},o.onDoubleTap=function(e,t){this.ios?this.iosSend("onDoubleTap",[e,t]):this.android&&this.androidSend.onDoubleTap(e,t)},o.setRTCSession=function(e){this.ios?this.iosSend("setRTCSession",{id:e}):this.android&&this.androidSend.setRTCSessionID(e)},o.putProperties=function(e,t){this.ios?this.iosSend("putProperties",{name:e,value:t}):this.android&&this.androidSend.putProperties(e,t)},o.onPropertyRetrievedSuccess=function(){this.ios?this.iosSend("onPropertyRetrievedSuccess"):this.android&&this.androidSend.onPropertyRetrievedSuccess()},o.onPropertyRetrievedFailOrEmptyProperties=function(){this.ios?this.iosSend("onPropertyRetrievedFailOrEmptyProperties"):this.android&&this.androidSend.onPropertyRetrievedFailOrEmptyProperties()},o.resetAnimationStatus=function(){this.ios?this.iosSend("resetAnimationStatus"):this.android&&this.androidSend.resetAnimationStatus()},o.setPauseUI=function(){this.ios?this.iosSend("setPauseUI"):this.android&&this.androidSend.setToPaused()},o.getDeviceAvailableMemory=function(){return this.ios?this.iosSend("getDeviceAvailableMemory"):this.android?this.androidSend.getDeviceAvailableMemory():void 0},o.onDeviceMemoryInsufficient=function(){return this.ios?this.iosSend("onDeviceMemoryInsufficient"):this.android?this.androidSend.onDeviceMemoryInsufficient():void 0},o.updateAnimationTime=function(e){this.ios?this.iosSend("updateAnimationTime",e):this.android&&this.androidSend.updateAnimationTime(e)},o.setLoadingProgress=function(e,t){this.ios?this.iosSend("setLoadingProgress",{state:e,progress:t}):this.android&&this.androidSend.setLoadingProgress(e,t)},o.objectTreeCreated=function(){this.ios?this.iosSend("objectTreeCreated"):this.android&&this.androidSend.objectTreeCreated()},o.geometryLoaded=function(){this.ios?this.iosSend("geometryLoaded"):this.android&&this.androidSend.geometryLoaded()},o.putSheets=function(e,t){this.ios?this.iosSend("putSheets",[e,t]):this.android&&this.androidSend.putSheets(e,t)},o.putAllSheets=function(e){this.ios?this.iosSend("putAllSheets",e):this.android&&this.androidSend.putAllSheets(e)},o.hideLoadingView=function(){this.android&&this.androidSend.hideLoadingView()},o.instanceTree=function(e){this.ios?this.iosSend("instanceTree",e):this.android&&this.androidSend.instanceTree(e)},o.loadSheetFailed=function(){this.ios?this.iosSend("loadSheetFailed"):this.android&&this.androidSend.loadSheetFailed()},o.sheetSelected=function(e){this.ios?this.iosSend("sheetSelected",e):this.android&&this.androidSend.sheetSelected(e)},"undefined"!=typeof window&&(n.MobileCallbacks=r)},54679:(e,t,i)=>{const{getGlobal:n}=i(38685);function r(e){for(var t=n(),i=e.split("."),r=0;r<i.length;++r)t[i[r]]=t[i[r]]||{},t=t[i[r]];return t}r("Autodesk.Viewing.Private"),r("Autodesk.Viewing.Extensions"),r("Autodesk.Extensions"),r("Autodesk.Viewing.Shaders"),r("Autodesk.Viewing.UI"),r("Autodesk.LMVTK"),Autodesk.Viewing.getGlobal=n,Autodesk.Viewing.AutodeskNamespace=r,n().AutodeskNamespace=r;var o=n().Autodesk.Viewing.Private;o.LMV_WORKER_URL="lmvworker.min.js",o.ENABLE_DEBUG=o.ENABLE_DEBUG||!1,n().ENABLE_DEBUG=o.ENABLE_DEBUG,o.ENABLE_INLINE_WORKER=!0,e.exports.Autodesk=n().Autodesk},63526:(e,t,i)=>{"use strict";function n(e){var t=Autodesk.Viewing,i=t.Private,n=t.UI,r=t.Extensions;for(let i in e.av)t[i]=e.av[i];for(let t in e.avp)i[t]=e.avp[t];for(let t in e.avu)n[t]=e.avu[t];for(let t in e.ave)r[t]=e.ave[t];t.getGlobal().THREE=e.THREE,t.getGlobal().LMV=e,i.isRightClick=t.isRightClick,i.isMiddleClick=t.isMiddleClick}i.d(t,{E:()=>n})},20268:(e,t,i)=>{"use strict";i.r(t),i.d(t,{loadDependency:()=>a,theResourceLoader:()=>s});var n=i(8600);const r=(0,i(55280).getGlobal)(),o=r.document;const s=new class{constructor(){this.loadPromises={}}getResourceUrl(e){return e.indexOf("://")>0?e:(0,n.getResourceUrl)(e)}loadScriptIntoDom(e,t,i){const n=o.createElement("SCRIPT");n.src=e;const r=function(){n.onerror=null,n.onload=null};n.onload=function(){r(),t()},n.onerror=function(t){r(),i&&i(new Error(`Error loading script ${e}, with error ${t}`))},o.head.appendChild(n)}loadScript(e,t){if(t&&void 0!==r[t])return Promise.resolve();const i=(e=this.getResourceUrl(e)).toLowerCase();if(i in this.loadPromises)return this.loadPromises[i];const o=(0,n.getScript)(e);return this.loadPromises[i]=o?Promise.resolve():new Promise(((t,i)=>{this.loadScriptIntoDom(e,t,i)})),this.loadPromises[i]}_getLink(e){const t=o.getElementsByTagName("link");for(let i=0,n=t.length;i<n;i++)if(t[i].href===e)return t[i];return null}};function a(e,t,i,n){s.loadScript(t,e).then((()=>{i&&i()})).catch((e=>{n&&n(e)}))}Object.freeze(s)},97705:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SearchManager:()=>r});class n{constructor(e){this.viewer=e}search(e){return new Promise(((e,t)=>{}))}getProviderId(){return"Search Provider Id"}}class r{constructor(e){this.viewer=e,this.searchProviders=new Map}addSearchProvider(e){this.searchProviders.has(e)||this.searchProviders.set(e,new e(this.viewer))}search(e){return new Promise(((t,i)=>{const n=this.prepareSearchInput(e),r=[];this.searchProviders.forEach((e=>{const t=e.search(n),i=e.getProviderId();t.id=i,r.push(t)})),Promise.all(r).then((e=>{const i={};e.forEach(((e,t)=>{const n=r[t].id;i[n]=e})),t(i)})).catch(i)}))}removeAllProviders(){this.searchProviders.clear()}removeProvider(e){this.searchProviders.delete(e)}prepareSearchInput(e){return e.toLowerCase()}}const o=AutodeskNamespace("Autodesk.Viewing.Search");o.SearchManager=r,o.ModelPartsSearchProvider=class extends n{constructor(e){super(e)}search(e){return new Promise(((t,i)=>{const n=this.viewer.getVisibleModels(),r=[];0===n.length&&t(r);for(let t=0;t<n.length;t++){const i=n[t],o=[],s=i.getInstanceTree();i.getObjectTree((t=>{t.enumNodeChildren(t.getRootId(),(t=>{const i=s&&s.getNodeName(t);i&&-1!==i.toLowerCase().indexOf(e)&&o.push(t)}),!0)})),r.push({ids:o,model:i})}t(r)}))}getProviderId(){return"ModelPartsSearchProvider"}},o.PropertiesSearchProvider=class extends n{constructor(e){super(e)}search(e){return new Promise(((t,i)=>{const n=this.viewer.getVisibleModels(),r=[];0===n.length&&t(r);for(let o=0;o<n.length;o++){const s=n[o];s.search(e,(e=>{r.push({ids:e,model:s}),r.length===n.length&&t(r)}),i)}}))}getProviderId(){return"PropertiesSearchProvider"}},o.TextSearchProvider=class extends n{constructor(e){super(e),e.loadExtension("Autodesk.StringExtractor")}search(e){return new Promise((t=>{this.viewer.getExtensionAsync("Autodesk.StringExtractor").then((i=>i.getDocumentStrings().then((i=>{const n=[],r=this.viewer.impl.get2DModels();for(let t=0;t<r.length;t++){const o=r[t].id,s=!r[t].isLeaflet(),a=i[o];if(!a)continue;const l=a.strings,c=this.searchStrings(l,e,o,s);n.push({modelId:o,searchResult:c})}t(n)}))))}))}searchStrings(e,t,i,n){let r=[];if(n)for(let n=0;n<e.length;n++){let o=0;const s=[];for(;-1!==o;)o=e[n].string.toLowerCase().indexOf(t,o),-1!==o&&(s.push(o),o+=1);if(s.length>0){const o=this.splitOccurrences(e[n],s,t,i);r=r.concat(o)}}else for(let i=0;i<e.length;i++)-1!==e[i].string.toLowerCase().indexOf(t)&&r.push(e[i]);return r}splitOccurrences(e,t,i,n){const r=this.viewer.impl.findModel(n),o=[];let s=1/72;const a=r.getData();function l(t,i){const n=e.stringCharWidths.slice(t,i);if(!n.length)return 0;return n.reduce(((e,t)=>e+t))}if(r){const n=a.metadata.page_dimensions.page_units;s*=Autodesk.Viewing.Private.convertUnits(Autodesk.Viewing.Private.ModelUnits.INCH,n,1,1);const c=a.scaleX,h=(r.getData().scaleY||s)*e.stringHeight;for(let n=0;n<t.length;n++){const r={string:i};let a=l(0,t[n]),u=l(t[n],t[n]+i.length);if(e.stringWidth){const t=l(0,e.string.length),i=e.stringWidth/t*s;a*=i,u*=i}else a*=c,u*=c;const d=e.angle||0,f=Math.cos(d)*a,p=Math.sin(d)*a;let m=e.stringPosition[0]+f,g=e.stringPosition[1]+p,v=m+u,y=g+h;const b=new THREE.Vector2(m,g),x=new THREE.Vector2(v,y),_=new THREE.Box2(b,x);r.boundingBox=_,r.angle=e.angle,o.push(r)}}return o}getProviderId(){return"TextSearchProvider"}}},68793:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DefaultHandler:()=>r});i(72091);var n=i(55280);function r(e,t,i){this.clickConfig=null,this.getNames=function(){return["default"]},this.getName=function(){return this.getNames()[0]},this.setClickBehavior=function(e){this.clickConfig=e},this.getClickBehavior=function(){return this.clickConfig},this.activate=function(e){},this.deactivate=function(e){},this.handleAction=function(t,n,r){for(var o=0;o<t.length;++o)switch(t[o]){case"selectOnly":e.selector&&n&&e.selector.setSelection([n.dbId],n.model,void 0,r);break;case"deselectAll":e.selector&&e.selector.setSelection([]);break;case"selectToggle":e.selector&&n&&e.selector.toggleSelection(n.dbId,n.model);break;case"isolate":n&&e.isolate(n.dbId);break;case"showAll":e.showAll();break;case"setCOI":n&&n.intersectPoint&&(i.setPivotPoint(n.intersectPoint,!0,!0),i.pivotActive(!0,!0));break;case"hide":n&&e.hide(n.dbId);break;case"show":n&&e.show(n.dbId);break;case"toggleVisibility":n&&e.toggleVisibility(n.dbId);break;case"focus":e.selector&&(n?e.selector.setSelection([n.dbId],n.model):e.selector.setSelection([]),i.fitToView())}},this.handleSingleClick=function(t,r){if((0,n.isMobileDevice)())return!1;const o=e.isRightBtnSelectionEnabled();var s=t.ctrlKey||t.metaKey,a=t.shiftKey,l=t.altKey;if(0===r||2===r&&o){var c=e.clientToViewport(t.canvasX,t.canvasY),h="click";s&&(h+="Ctrl"),a&&(h+="Shift"),l&&(h+="Alt");var u=(d=e.hitTestViewport(c,!1))?"onObject":"offObject";if(this.clickConfig&&this.clickConfig[h]&&this.clickConfig[h][u])return this.handleAction(this.clickConfig[h][u],d,r),!0}else if(1===r&&a&&!l&&!s){var d;c=e.clientToViewport(t.canvasX,t.canvasY);if((d=e.hitTestViewport(c,!1))&&d.intersectPoint)return i.setPivotPoint(d.intersectPoint,!0,!0),i.pivotActive(!0,!0),!0}return!1},this.handleDoubleClick=function(n,r){if(e.selector&&0===r){var o=e.clientToViewport(n.canvasX,n.canvasY),s=e.hitTestViewport(o,!1);return s?e.selector.setSelection([s.dbId],s.model):e.selector.clearSelection(),i.fitToView(),!0}return 1===r&&(t.fitBounds(!1,i.getBoundingBox(!0)),t.setPivotSetFlag(!1),!0)},this.handleSingleTap=function(i){if(i.clientX=i.pointers[0].clientX,i.clientY=i.pointers[0].clientY,e.api.triggerSingleTapCallback(i),i.hasOwnProperty("pointers")&&2===i.pointers.length)return t.setRequestHomeView(!0),!0;if(e.selector&&!e.selector.selectionDisabled){var n=e.clientToViewport(i.canvasX,i.canvasY),r=e.hitTestViewport(n,!1);return r?(e.selector.setSelection([r.dbId],r.model),e.api.triggerSelectionChanged([r.dbId])):(e.selector.clearSelection(),e.api.triggerSelectionChanged(null)),!0}return!1},this.handleDoubleTap=function(t){t.clientX=t.pointers[0].clientX,t.clientY=t.pointers[0].clientY,e.api.triggerDoubleTapCallback(t);var n=this.handleSingleTap(t,0);return i.fitToView(),n},this.handlePressHold=function(t){return"press"===t.type&&(t.clientX=t.pointers[0].clientX,t.clientY=t.pointers[0].clientY,e.api.triggerContextMenu(t))},this.handleGesture=function(t){return!!t.type.includes("swipe")&&(t.clientX=t.pointers[0].clientX,t.clientY=t.pointers[0].clientY,e.api.triggerSwipeCallback(t))}}},28833:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FovTool:()=>r});var n=i(72091);function r(e){var t=.001,i=e.navigation,r=i.getCamera(),o=["fov"],s=!1,a=0,l=null,c=null,h=!1,u=0,d=-5,f=-1,p=d,m=new n.Vector3,g=new n.Vector3,v=new n.Vector3,y=null;function b(e){return e<0&&e>-3?-3:e>0&&e<3?3:e}this.getNames=function(){return o},this.getName=function(){return o[0]},this.activate=function(e){u=0},this.deactivate=function(e){p=d},this.getCursor=function(){return 0!==u&&p===d?null:"url(data:image/x-icon;base64,AAACAAEAGBgAAAAAAACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAYAkAABMLAAATCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAACEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnAwMD/yEhIf8AAABmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAGknJyf/goKC/8/Pz/8aGhr/AAAALQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AAAA/wAAAAAAAAAAAAAAAAAAAAAAAABTFBQU/2lpaf/MzMz///////////+Wlpb/AAAAlgAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAAAAAAOAAAAKFTU1P/t7e3////////////8PDw////////////AQEB/wAAAAEAAAAAAAAAFAAAAH0KCgr/AAAAYwAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAjCwsL/6Ghof/t7e3///////Dw8P9MTEz/LS0t//Pz8///////Ghoa/wAAABoAAAANDQ0N/319ff+rq6v/Y2Nj/wAAAK8AAABGAAAA////////////AAAA/wAAAF0hISH/jIyM////////////sLCw/xEREf8AAACHAAAArKysrP//////V1dX/wAAAFcAAABSUlJS//f39///////8PDw/6+vr/86Ojr/LS0t////////////FRUV/1xcXP/Gxsb/+Pj4//Hx8f9MTEz/AAAAsAAAAEcAAAAAAAAAZ2dnZ///////pKSk/wAAAKQAAACtra2t///////////////////////m5ub/kZGR/wAAAP8AAAD/q6ur//Hx8f//////vb29/x0dHf8AAACIAAAAAAAAAAAAAAAAAAAAOjo6Ov//////5+fn/wAAAOcAAADd3d3d////////////////////////////+/v7/9bW1v/i4uL//v7+//Pz8/9hYWH/AAAAvQAAAFQAAAAAAAAAAAAAAAAAAAAAAAAAJycnJ//6+vr//////wMDA/8AAADv7+/v/////////////////////////////////////////////////7y8vP8ODg7/AAAAKwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJiYmJv/6+vr//////wkJCf8AAADv7+/v//////////////////////////////////f39//9/f3//////+np6f+UlJT/GBgY/wAAAH0AAAACAAAAAAAAAAAAAAAAAAAAKSkpKf///////v7+/w0NDf8AAADd3d3d////////////////////////////29vb/39/f/+Xl5f/5+fn////////////5ubm/1RUVP8CAgL/AAAAPwAAAAAAAAAAAAAAOTk5Of//////8PDw/wgICP8AAAChoaGh/////////////////+np6f+YmJj/QkJC/wAAAP8AAAD/UFBQ/7e3t//39/f///////////+oqKj/EBAQ/wAAAIgAAAAAAAAAZ2dnZ///////29vb/wEBAf8AAAA4NTU1/9zc3P/t7e3/tbW1/01NTf8AAACYAAAA////////////AwMD/wsLC/9oaGj/y8vL////////////8fHx/zg4OP8AAACWAAAApaWlpf//////n5+f/wAAAJ8AAAAAAAAAczg4OP9LS0v/EhIS/wAAAE0AAAAAAAAA////////////FRUV/wAAABUAAABoJSUl/4GBgf/i4uL///////////9+fn7/Pz8///b29v//////SkpK/wAAAEoAAAAAAAAAAAAAADgAAABLAAAAEgAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAAAAAAJQAAAIE8PDz/np6e//z8/P/////////////////8/Pz/CQkJ/wAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAAAAAAAAAAAAAAAAA8DAwM/09PT/+7u7v///////////+QkJD/AAAAkwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////Dw8P/wAAAA8AAAAAAAAAAAAAAAAAAAAAAAAADAAAAFIYGBj/aGho/729vf8WFhb/AAAAJwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////FRUV/wAAABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAQEB/w8PD/8AAABUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////DAwM/wAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlgAAAP8AAAD/AAAAlgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8x/h/nO/4fw1D+HwFy/h4BRu4YAHOGEABkAAAAXAAAIFwAAOBnAAHgIAAD4GUAAOB4AABgXAAAIGMAAABtggAAVMYYAHT+HgE7/g8BcP4Pw2/+D+dc/h//XP///2c=), auto"},this.getMotionDelta=function(e){var i=g.x-m.x,n=g.y-m.y,r=g.z-m.z;Math.abs(i)<t&&(i=0),Math.abs(n)<t&&(n=0),Math.abs(r)<t&&(r=0),e.set(i,n,r)},this.stepMotionDelta=function(e,t){t?(m.x+=.6*e.x,m.y+=.6*e.y,m.z+=.6*e.z):m.copy(g)},this.getAccumulatedWheelDelta=function(){var e=Date.now(),t=0;return c&&e-c>100?(t=b(a),a=0,l=null,c=null,h=!1):l&&e-l>100&&(h?Math.abs(a)>=3&&(t=a,a=0):(t=b(a),h=!0,a=0)),t},this.update=function(){var e=!1,t=p>d;if(p>d){this.controller.setIsLocked(!0),this.getMotionDelta(v);var n=v.x,o=v.y,a=v.z;if(0!==n||0!==o||0!==a)if(t=!0,p>=0)o=-o,0!==(a=Math.abs(n)>Math.abs(o)?n:o)&&(a*=-1,i.setVerticalFov(i.getVerticalFov()*(1+a),!0));else{var l=this.getAccumulatedWheelDelta()/3;0!==l&&i.setFocalLength(i.getFocalLength()+l,!0)}this.stepMotionDelta(v,!0),p===f&&Math.abs(a)<1e-5&&(this.interactionEnd(f),e=!0)}return t?this.utilities.pivotActive(i.getPivotSetFlag(),!0):this.utilities.pivotUpdate(),!s&&(e||p>d)&&(p>f&&m.copy(g),p=d,this.controller.setIsLocked(!1)),r.dirty},this.interactionStart=function(e,t){(t||e>p)&&(p=e,s=!0),i.toPerspective()},this.interactionEnd=function(e){e===p&&(e!==f&&this.utilities.pivotActive(!1),s=!1)},this.handleWheelInput=function(e){if(p>f)return!1;i.getReverseZoomDirection()&&(e*=-1),g.z+=e,a+=e;var t=Date.now();return l||(l=t),c=t,0!=e&&this.interactionStart(f),!0},this.handleGesture=function(e){switch(e.type){case"dragstart":return this.handleButtonDown(e,0);case"dragmove":return this.handleMouseMove(e);case"dragend":return this.handleButtonUp(e,0);case"drag3start":return y="drag",this.handleButtonDown(e,0);case"drag3move":return"drag"===y&&this.handleMouseMove(e);case"drag3end":return"drag"===y&&this.handleButtonUp(e,0),y=null,!1}return!1},this.handleButtonDown=function(e,t){return u+=1<<t,2!==t&&(m.x=.5*(e.normalizedX+1),m.y=1-.5*(e.normalizedY+1),g.copy(m),this.interactionStart(t),!0)},this.handleButtonUp=function(e,t){return u-=1<<t,2!==t&&(g.x=.5*(e.normalizedX+1),g.y=1-.5*(e.normalizedY+1),this.interactionEnd(t),!0)},this.handleMouseMove=function(e){return g.x=.5*(e.normalizedX+1),g.y=1-.5*(e.normalizedY+1),p>f},this.handleBlur=function(e){return this.interactionEnd(p),!1}}},55855:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GestureHandler:()=>s,GestureRecognizers:()=>o});var n=i(55280);let r;(0,n.isNodeJS)()||(r=i(41944));const o={};function s(e){var t=e.navigation,i=["gestures"],s=this,a=!0,l=!1,c=!0,h=null,u=!1,d=(0,n.isTouchDevice)();t.setIsTouchDevice(d),d&&((h=new r.Manager(e.canvasWrap,{recognizers:[o.drag,o.doubletap,o.doubletap2,o.singletap,o.singletap2,o.press,o.drag3,o.swipe,o.pan,o.pinch,o.rotate],handlePointerEventMouse:!1,inputClass:r.TouchInput})).get("pinch").recognizeWith([h.get("drag")]),e.canvasWrap.addEventListener("touchstart",this.onTouchStart,!1)),this.onTouchStart=function(e){e.preventDefault()},this.getNames=function(){return i},this.getName=function(){return i[0]},this.isActive=function(){return u},this.__clientToCanvasCoords=function(t){var i,n,r=e.impl.getCanvasBoundingClientRect(),o=r.width,s=r.height;t.hasOwnProperty("center")?(i=t.center.x-r.left,n=t.center.y-r.top):(i=t.pointers[0].clientX-r.left,n=t.pointers[0].clientY-r.top),t.canvasX=i,t.canvasY=n,t.normalizedX=i/o*2-1,t.normalizedY=(s-n)/s*2-1},this.distributeGesture=function(e){s.__clientToCanvasCoords(e),s.controller.distributeEvent("handleGesture",e)&&e.preventDefault()},this.onSingleTap=function(e){s.__clientToCanvasCoords(e),s.controller.distributeEvent("handleSingleTap",e)&&e.preventDefault()},this.onDoubleTap=function(e){s.__clientToCanvasCoords(e),s.controller.distributeEvent("handleDoubleTap",e)&&e.preventDefault()},this.onPressHold=function(e){s.__clientToCanvasCoords(e),s.controller.distributeEvent("handlePressHold",e)&&e.preventDefault()},this.onHammerInput=function(e){s.setMouseDisabledWhenTouching(e)},this.setMouseDisabledWhenTouching=function(e){e.isFirst&&!l?(a=s.controller.enableMouseButtons(!1),l=!0):e.isFinal&&setTimeout((function(){s.controller.enableMouseButtons(a),l=!1}),10)},this.activate=function(e){h&&!u&&(h.on("dragstart dragmove dragend",this.distributeGesture),h.on("singletap",this.onSingleTap),h.on("singletap2",this.onSingleTap),h.on("doubletap",this.onDoubleTap),h.on("doubletap2",this.onDoubleTap),h.on("press pressup",this.onPressHold),h.on("drag3start drag3move drag3end",this.distributeGesture),h.on("swipeleft swiperight swipeup swipedown",this.distributeGesture),c&&(h.on("panstart panmove panend",this.distributeGesture),h.on("pinchstart pinchmove pinchend",this.distributeGesture),h.on("rotatestart rotatemove rotateend",this.distributeGesture)),h.on("hammer.input",this.onHammerInput),h.get("doubletap2").recognizeWith("doubletap"),h.get("singletap2").recognizeWith("singletap"),h.get("singletap").requireFailure("doubletap"),h.get("swipe").recognizeWith("drag")),u=!0},this.deactivate=function(e){h&&u&&(h.off("dragstart dragmove dragend",this.distributeGesture),h.off("singletap",this.onSingleTap),h.off("singletap2",this.onSingleTap),h.off("doubletap",this.onDoubleTap),h.off("doubletap2",this.onDoubleTap),h.off("press pressup",this.onPressHold),h.off("drag3start drag3move drag3end",this.distributeGesture),h.off("swipeleft swiperight swipeup swipedown",this.distributeGesture),c&&(h.off("panstart panmove panend",this.distributeGesture),h.off("pinchstart pinchmove pinchend",this.distributeGesture),h.off("rotatestart rotatemove rotateend",this.distributeGesture)),h.off("hammer.input",this.onHammerInput)),u=!1},this.update=function(){return!1},this.handleBlur=function(e){return!1},this.disableTwoFingerSwipe=function(){c=!1,h&&(h.remove(r.Pan),h.remove(r.Pinch),h.remove(r.Rotate),h.off("panstart panmove panend",this.distributeGesture),h.off("pinchstart pinchmove pinchend",this.distributeGesture),h.off("rotatestart rotatemove rotateend",this.distributeGesture))},this.setGestureParameter=function(e,t,i){const n=h&&h.get(e);return!!n&&(n.options[t]=i,!0)},this.restoreGestureParameterDefault=function(e,t){const i=h&&h.get(e);if(!i)return!1;const n=o[e][1];return i.options[t]=n.hasOwnProperty(t)?n[t]:i.defaults[t],!0}}r&&function(){if(!o.singletap){var e=o;e.singletap=[r.Tap,{event:"singletap",threshold:7,time:400}],e.singletap2=[r.Tap,{event:"singletap2",pointers:2,threshold:7,time:400}],e.press=[r.Press,{event:"press",time:500,threshold:50}],e.doubletap=[r.Tap,{event:"doubletap",taps:2,interval:300,threshold:6,posThreshold:30}],e.doubletap2=[r.Tap,{event:"doubletap2",pointers:2,taps:2,interval:300,threshold:6,posThreshold:40}],e.swipe=[r.Swipe,{event:"swipe",pointers:1,threshold:200,velocity:1.7}],e.drag=[r.Pan,{event:"drag",pointers:1}],e.drag3=[r.Pan,{event:"drag3",pointers:3,threshold:15}],e.pan=[r.Pan,{event:"pan",pointers:2,threshold:20}],e.pinch=[r.Pinch,{event:"pinch",pointers:2,enable:!0,threshold:.05}],e.rotate=[r.Rotate,{event:"rotate",pointers:2,enable:!0,threshold:7}]}}()},4746:(e,t,i)=>{"use strict";function n(e){var t=["hottouch"],i={SHIFT:0,ALT:0,CONTROL:0},n=null,r=null,o=!1,s=!1,a=null,l=16,c=17,h=18;this.active=!1,this.getNames=function(){return t},this.getName=function(){return t[0]},this.activate=function(e){this.active=!0},this.deactivate=function(e){this.active=!1},this.isActive=function(){return this.active},this.__checkStart=function(){a&&(this.controller.distributeEvent("handleGesture",a),a=null)},this.update=function(){if(this.controller.getIsLocked())return!1;var t=e.getActiveNavigationTool(),i=!1===o&&!0===s;if(i||!0===o&&!1===s){var a=i?"worldup":"fov";if(t===a)return!1;if(t===n)return e.setActiveNavigationTool(a),n=a,this.__checkStart(),!1;r=t,e.setActiveNavigationTool(a),n=a,this.__checkStart()}else n&&(e.setActiveNavigationTool(r),n=null,r=null);return!1},this.resetKeys=function(){i.SHIFT=0,i.CONTROL=0,i.ALT=0},this.updateModifierState=function(e){i.CONTROL=e.ctrlKey?1:0,i.SHIFT=e.shiftKey?1:0,i.ALT=e.altKey?1:0},this.handleGesture=function(t){if(t===a)return!1;switch(t.type){case"drag3start":e.navigation.isActionEnabled("fov")&&(a=t,o=!0);break;case"drag3move":case"rotatemove":break;case"drag3end":o=!1;break;case"rotatestart":e.navigation.isActionEnabled("roll")&&(a=t,s=!0);break;case"rotateend":s=!1}return!1},this.handleKeyDown=function(e,t){switch(this.updateModifierState(e),t){case l:i.SHIFT=1;break;case c:i.CONTROL=1;break;case h:i.ALT=1}return!1},this.handleKeyUp=function(e,t){switch(this.updateModifierState(e),t){case l:i.SHIFT=0;break;case c:i.CONTROL=0;break;case h:i.ALT=0}return!1},this.handleButtonDown=function(e,t){return this.updateModifierState(e),!1},this.handleButtonUp=function(e,t){return this.updateModifierState(e),!1},this.handleMouseMove=function(e){return this.updateModifierState(e),!1},this.handleBlur=function(e){return this.resetKeys(),!1}}i.r(t),i.d(t,{HotGestureTool:()=>n})},75109:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HotkeyManager:()=>r});const n=function(e,t){return e-t};function r(){var e=[],t=[],i=[],r=[],o=["hotkeys"];this.getNames=function(){return o},this.getName=function(){return o[0]},this.pushHotkeys=function(t,i,r){if(e.some((function(e){return e.id===t})))return!1;for(var o=0;o<i.length;o++)e.push({id:t,keys:i[o].keycodes.sort(n).join(),onPress:i[o].onPress,onRelease:i[o].onRelease,options:r||{}});return!0},this.popHotkeys=function(t){for(var i=!1,n=e.length-1;n>=0;n--)e[n].id===t&&(e.splice(n,1),i=!0);return i};const s=function(){var e,n=t.join();for(e=0;e<r.length;)r[e].keys===n?r.splice(e,1):e++;for(e=0;e<i.length;)i[e].keys!==n?i.splice(e,1):e++};this.handleKeyDown=function(n,o){if(-1===t.indexOf(o)){for(var a=t.join(),l=t.slice(0),c=0;c<t.length&&t[c]<o;)c++;t.splice(c,0,o);var h=t.join(),u=t.slice(0);s();var d,f=[],p=[];for(c=e.length-1;c>=0;c--)(d=e[c]).keys===a&&d.onRelease?f.unshift(d):d.keys===h&&d.onPress&&p.unshift(d);for(c=f.length-1;c>=0&&!(d=f[c]).onRelease(l);c--)d.options.tryUntilSuccess&&r.unshift(d);for(c=p.length-1;c>=0&&!(d=p[c]).onPress(u);c--)d.options.tryUntilSuccess&&i.unshift(d)}},this.handleKeyUp=function(n,o){var a=t.join(),l=t.slice(0),c=t.indexOf(o);c>-1&&t.splice(c,1);var h=t.join(),u=t.slice(0);s();var d,f=[],p=[];for(c=e.length-1;c>=0;c--)(d=e[c]).keys===a&&d.onRelease?f.unshift(d):d.keys===h&&d.onPress&&p.unshift(d);for(c=f.length-1;c>=0&&!(d=f[c]).onRelease(l);c--)d.options.tryUntilSuccess&&r.unshift(d);for(c=p.length-1;c>=0&&!(d=p[c]).onPress(u);c--)d.options.tryUntilSuccess&&i.unshift(d)},this.update=function(){var e,t;for(t=0;t<r.length;)!0===(e=r[t]).onRelease(e.keys.split())?r.splice(t,1):t++;for(t=0;t<i.length;)!0===(e=i[t]).onPress(e.keys.split())?i.splice(t,1):t++;return!1},this.handleBlur=function(){for(var e=t.length-1;e>=0;e--)this.handleKeyUp(null,t[e])},this.activate=function(){},this.deactivate=function(){}}},49930:(e,t,i)=>{"use strict";i.r(t),i.d(t,{KeyCode:()=>n});const n={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CONTROL:17,ALT:18,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,ZERO:48,SEMICOLONMOZ:59,EQUALSMOZ:61,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,LCOMMAND:91,RCOMMAND:93,PLUS:107,PLUSMOZ:171,DASHMOZ:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,DASHMOZNEW:173,SEMICOLON:186,EQUALS:187,COMMA:188,DASH:189,PERIOD:190,SLASH:191,LBRACKET:219,RBRACKET:221,SINGLEQUOTE:222,COMMANDMOZ:224}},17016:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Navigation:()=>a});var n=i(72091),r=i(83081),o=i(25004);const s={TRANSITION_ACTIVE_FLAG_CHANGED:"transitionActiveFlagChanged"};function a(e){var t=6.88,i=1e-6;this.__options={dollyToPivot:!1,orbitPastPoles:!0,reverseDolly:!1,reverseHorizontalLook:!1,reverseVerticalLook:!1,useLeftHandedInput:!1,usePivotAlways:!1,lockNavigation:!1},this.__lockSettings={orbit:!1,pan:!1,zoom:!1,roll:!1,fov:!1,gotoview:!1,walk:!1},this.FIT_TO_VIEW_VERTICAL_MARGIN=.05,this.FIT_TO_VIEW_VERTICAL_OFFSET=0,this.FIT_TO_VIEW_HORIZONTAL_MARGIN=.05,this.FIT_TO_VIEW_HORIZONTAL_OFFSET=0,this.__pivotIsSetFlag=!1,this.__fitToViewRequested=!1,this.__homeViewRequested=!1,this.__transitionActive=!1,this.__destinationView=null,this.__is2D=!1,this.__isTouchDevice=!1,this.__kEpsilon=i,this.__minDistance=1e-5;var r=void 0,o=void 0,s=2,a=200,l=null,c={left:0,top:0,width:1,height:1},h=Number.MAX_VALUE;this.uninitialize=function(){this.setCamera(null)},this.setMinimumLineWidth=function(e){h=e||Number.MAX_VALUE},this.setCamera=function(e){e!==l&&(l=e,e&&(Object.prototype.hasOwnProperty.call(e,"target")||(e.target=new n.Vector3(0,0,0)),Object.prototype.hasOwnProperty.call(e,"pivot")||(e.pivot=new n.Vector3(0,0,0)),e.worldup=e.up.clone(),e.dirty=!0))},this.getCamera=function(){return l},this.setScreenViewport=function(e){c=e},this.getScreenViewport=function(){return c},this.__setUp=function(e){if(e&&l&&0!==e.clone().normalize().sub(l.worldup).lengthSq())return l.worldup.copy(e).normalize(),l.dirty=!0,!0;return!1},this.__getUp=function(){return l?l.worldup:new n.Vector3(0,1,0)},this.setView=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(!l)return;e&&t&&(l.position.copy(e),l.target.copy(t),null!=i&&l.up.copy(i),l.dirty=!0)},this.orientCameraUp=function(e){l&&(this.isActionEnabled("roll")||e)&&(l.up.copy(this.getAlignedUpVector()),l.dirty=!0)},this.getPivotPoint=function(){return l?l.pivot.clone():new n.Vector3(0,0,0)},this.setPivotPoint=function(e){l&&e&&l.pivot.copy(e)},this.getPosition=function(){return l?l.position.clone():new n.Vector3(0,0,1)},this.setPosition=function(e){l&&e&&(l.position.copy(e),l.dirty=!0)},this.setTarget=function(e){l&&e&&(l.target.copy(e),l.dirty=!0)},this.getTarget=function(){return l?l.target.clone():new n.Vector3(0,0,0)},this.getEyeVector=function(){return l?l.target.clone().sub(l.position):new n.Vector3(0,0,-1)},this.getEyeToCenterOfBoundsVec=function(e){return l?e.getCenter(new n.Vector3).sub(l.position):new n.Vector3(0,0,-1)},this.getFovMin=function(){return t},this.getFovMax=function(){return 100},this.setZoomInLimitFactor=function(e){a=e},this.getZoomInLimitFactor=function(){return a},this.setZoomOutLimitFactor=function(e){s=e},this.getZoomOutLimitFactor=function(){return s},this.isPointVisible=function(e){return(new n.Frustum).setFromProjectionMatrix(l.projectionMatrix.clone().multiply(l.matrixWorldInverse)).containsPoint(e)},this.setVerticalFov=function(e,r){if((!l||l.isPerspective)&&(e<t?e=t:e>100&&(e=100),l&&this.isActionEnabled("fov"))){if(Math.abs(l.fov-e)<=i)return;if(r){var o=this.__pivotIsSetFlag&&this.isPointVisible(this.getPivotPoint()),s=this.getPosition(),a=this.getEyeVector(),c=n.Math.degToRad(l.fov),h=n.Math.degToRad(e),u=o?this.getPivotPlaneDistance():a.length(),d=u*Math.tan(.5*c)/Math.tan(.5*h),f=a.normalize().multiplyScalar(u-d);this.setPosition(s.add(f)),o&&this.setTarget(this.getTarget().add(f))}l.setFov(e),l.dirty=!0}},this.applyRotation=(e,t,i,n)=>{e.sub(i),e.applyAxisAngle(n,t),e.add(i)},this.getSignedAngle=(e,t,i)=>{var n=e.angleTo(t),r=e.clone().cross(t).normalize();return n*(i.dot(r)>0?1:-1)},this.computeFit=function(t,i,r,o,s){if(!o||o.isEmpty())return{position:t,target:i};s=void 0===s?1:s;for(var a=o.getCenter(new n.Vector3),l=o.getSize(new n.Vector3),c=t.clone().sub(i).normalize(),h=Math.tan(n.Math.degToRad(.5*r)),u=0,d=this.computeOrthogonalUp(t,i),f=c.clone().cross(d).normalize(),p=new n.Vector3,m=0===l.z?4:8,g=0;g<m;g++){p.set(1&g?.5*l.x:-.5*l.x,2&g?.5*l.y:-.5*l.y,4&g?.5*l.z:-.5*l.z);var v=0;e.isPerspective&&(v=p.dot(c));var y=Math.abs(p.dot(d)),b=Math.abs(p.dot(f)),x=v+(1+2*this.FIT_TO_VIEW_VERTICAL_MARGIN/(1-2*this.FIT_TO_VIEW_VERTICAL_MARGIN))*y/h;u<x&&(u=x),u<(x=v+(1+2*this.FIT_TO_VIEW_HORIZONTAL_MARGIN/(1-2*this.FIT_TO_VIEW_HORIZONTAL_MARGIN))*b/(s*h))&&(u=x)}return a.add(d.multiplyScalar(-u*this.FIT_TO_VIEW_VERTICAL_OFFSET)),a.add(f.multiplyScalar(u*this.FIT_TO_VIEW_HORIZONTAL_OFFSET)),c.multiplyScalar(u),{position:a.clone().add(c),target:a}},this.computeOrthogonalUp=function(e,t){var i=this.__getUp(),n=t.clone().sub(e);if(0===n.lengthSq())return n.copy(i);var r=n.clone().cross(i);return 0===r.lengthSq()&&(i.z>i.y?n.y-=1e-4:n.z-=1e-4,r.crossVectors(n,i)),r.cross(n).normalize()},this.fitBounds=function(e,t,i,n){const r=this.getTarget(),o=this.getPosition();if(!this.isActionEnabled("gotoview")&&!n||!t||t.isEmpty())return{position:o,target:r};const s=this.getVerticalFov();i||(t=this.rotateBoundsToCamera(t,o,r));const a=this.computeFit(o,r,s,t,l.aspect),c=i?this.computeOrthogonalUp(o,r):l.up;return e?(l.up.copy(c),this.setView(a.position,a.target)):this.setRequestTransitionWithUp(!0,a.position,a.target,s,c),this.setPivotPoint(a.target),this.setPivotSetFlag(!0),a},this.rotateBoundsToCamera=function(e,t,i){const r=(e=e.clone()).getCenter(new n.Vector3),o=t.clone().sub(i).normalize(),s=this.getSignedAngle(this.getCameraUpVector(),this.getAlignedUpVector(),o);return this.applyRotation(e.min,s,r,o),this.applyRotation(e.max,s,r,o),e.setFromPoints([e.min.clone(),e.max.clone()]),e},this.computeOverviewDistance=function(e){var t=e.getSize(new n.Vector3);if(this.__is2D){var i=l.aspect,r=t.x/i,o=t.y;return Math.max(r,o)}var s=this.getVerticalFov(),a=t.length();return 0===a&&(a=2),l.isPerspective?.5*a/Math.tan(n.Math.degToRad(.5*s)):a},this.applyDollyConstraint=function(e,t){if(!(r||o||s)||!this.__is2D)return e;var i=e;if(r&&s&&t&&e>1){var n,c=l.isPerspective?this.getEyeToCenterOfBoundsVec(t):this.getEyeVector();n=r?s*this.computeOverviewDistance(r):s*this.computeOverviewDistance(t);var u=Math.abs(n/c.length());u=Math.max(u,1),i=Math.min(i,u)}if(o||a&&t){var d=(o?l.clientHeight/o:Math.min(h,this.computeOverviewDistance(t)/a))/-this.getEyeVector().z;d=Math.min(d,1),i=Math.max(i,d)}return i},this.applyPanningConstraint2D=function(e){if(this.__is2D&&r){var t=l.position.x+e.x,i=l.position.y+e.y;t=n.Math.clamp(t,r.min.x,r.max.x),i=n.Math.clamp(i,r.min.y,r.max.y);var o=t-l.position.x,s=i-l.position.y,a=Math.min(e.x,0),c=Math.min(e.y,0),h=Math.max(e.x,0),u=Math.max(e.y,0);o=n.Math.clamp(o,a,h),s=n.Math.clamp(s,c,u),e.x=o,e.y=s}},this.updateCamera=function(){l&&(l.updateProjectionMatrix(),this.orient(l,l.target,l.position,l.up),l.dirty=!1)},this.setCamera(e),this.setConstraints2D=function(e,t){r=e,o=t},this.getConstrains2D=function(){return{maxViewRegion:r,maxPixelPerUnit:o}}}a.prototype.constructor=a,a.prototype.setIs2D=function(e){this.__is2D=!!e},a.prototype.getIs2D=function(){return this.__is2D},a.prototype.setIsTouchDevice=function(e){this.__isTouchDevice=!!e},a.prototype.getIsTouchDevice=function(){return this.__isTouchDevice},a.prototype.orient=function(){var e,t,i,r;return function(o,s,a,l){e||(e=new n.Matrix4,t=new n.Vector3,i=new n.Vector3,r=new n.Vector3);var c=e.elements;r.subVectors(a,s).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(l,r).normalize(),0===t.lengthSq()&&(l.z>l.y?r.y-=1e-4:r.z+=1e-4,t.crossVectors(l,r).normalize()),i.crossVectors(r,t),c[0]=t.x,c[4]=i.x,c[8]=r.x,c[1]=t.y,c[5]=i.y,c[9]=r.y,c[2]=t.z,c[6]=i.z,c[10]=r.z,o.setRotationFromMatrix(e)}}(),a.prototype.fov2fl=function(e){var t=n.Math.degToRad(e);return t<=0&&(t=1e-4),Math.round(12/Math.tan(.5*t))},a.prototype.fl2fov=function(e){e<=0&&(e=1e-4);var t=2*Math.atan(12/e);return n.Math.radToDeg(t)},a.prototype.setCameraUpVector=function(e,t){if(this.isActionEnabled("roll")||t){var i=this.getCamera();i.up.copy(e),i.dirty=!0}},a.prototype.getCameraUpVector=function(){var e=this.getCameraRightVector(!1),t=this.getEyeVector();return e.cross(t).normalize()},a.prototype.getAlignedUpVector=function(){var e=this.getCameraRightVector(!0),t=this.getEyeVector();return e.cross(t).normalize()},a.prototype.getCameraRightVector=function(e){var t=new n.Vector3,i=e?this.getWorldUpVector():this.getCamera().up,r=this.getEyeVector();return t.crossVectors(r,i),0===t.lengthSq()&&(Math.abs(r.z)>=Math.abs(r.y)?i.set(0,1,0):i.set(0,0,1),t.crossVectors(r,i)),t.normalize()},a.prototype.setWorldUpVector=function(e,t,i){(this.isActionEnabled("roll")||i)&&(this.__setUp(e),t&&this.orientCameraUp(i))},a.prototype.getWorldUpVector=function(){return this.__getUp().clone()},a.prototype.getWorldRightVector=function(){var e=new n.Vector3;return e.copy(this.__getUp()),Math.abs(e.z)<=Math.abs(e.y)?e.set(e.y,-e.x,0):e.z>=0?e.set(e.z,0,-e.x):e.set(-e.z,0,e.x),e.normalize()},a.prototype.getVerticalFov=function(){return this.getCamera().fov},a.prototype.getHorizontalFov=function(){var e=this.getScreenViewport();return this.getCamera().fov*(e.width/e.height)},a.prototype.getFocalLength=function(){return this.fov2fl(this.getVerticalFov())},a.prototype.setFocalLength=function(e,t){this.setVerticalFov(this.fl2fov(e),t)},a.prototype.setReverseZoomDirection=function(e){this.__options.reverseDolly=!!e},a.prototype.setReverseHorizontalLookDirection=function(e){this.getIs2D()?r.logger.warn("Autodesk.Viewing.Navigation.setReverseHorizontalLookDirection is not applicable to 2D"):this.__options.reverseHorizontalLookDirection=!!e},a.prototype.setReverseVerticalLookDirection=function(e){this.getIs2D()?r.logger.warn("Autodesk.Viewing.Navigation.setReverseVerticalLookDirection is not applicable to 2D"):this.__options.reverseVerticalLookDirection=!!e},a.prototype.getReverseZoomDirection=function(){return this.__options.reverseDolly},a.prototype.getReverseHorizontalLookDirection=function(){return this.getIs2D()?(r.logger.warn("Autodesk.Viewing.Navigation.getReverseHorizontalLookDirection is not applicable to 2D"),!1):this.__options.reverseHorizontalLookDirection},a.prototype.getReverseVerticalLookDirection=function(){return this.getIs2D()?(r.logger.warn("Autodesk.Viewing.Navigation.getReverseVerticalLookDirection is not applicable to 2D"),!1):this.__options.reverseVerticalLookDirection},a.prototype.setZoomTowardsPivot=function(e){this.__options.dollyToPivot=!!e},a.prototype.getZoomTowardsPivot=function(){return this.__options.dollyToPivot},a.prototype.setOrbitPastWorldPoles=function(e){this.getIs2D()?r.logger.warn("Autodesk.Viewing.Navigation.setOrbitPastWorldPoles is not applicable to 2D"):this.__options.orbitPastPoles=!!e},a.prototype.getOrbitPastWorldPoles=function(){return this.getIs2D()?(r.logger.warn("Autodesk.Viewing.Navigation.orbitPastWorldPoles is not applicable to 2D"),!1):this.__options.orbitPastPoles},a.prototype.setUsePivotAlways=function(e){this.__options.usePivotAlways=!!e},a.prototype.getUsePivotAlways=function(){return this.__options.usePivotAlways},a.prototype.setUseLeftHandedInput=function(e){this.__options.useLeftHandedInput=!!e},a.prototype.getUseLeftHandedInput=function(){return this.__options.useLeftHandedInput},a.prototype.setWheelSetsPivot=function(e){this.__options.wheelSetsPivot=!!e},a.prototype.getWheelSetsPivot=function(){return this.__options.wheelSetsPivot},a.prototype.setSelectionSetsPivot=function(e){this.__options.SelectionSetsPivot=!!e},a.prototype.getSelectionSetsPivot=function(){return this.__options.SelectionSetsPivot},a.prototype.setIsLocked=function(e){this.__options.lockNavigation=!!e},a.prototype.getIsLocked=function(){return this.__options.lockNavigation},a.prototype.setLockSettings=function(e){for(var t in this.__lockSettings)Object.prototype.hasOwnProperty.call(e,t)&&(this.__lockSettings[t]=e[t])},a.prototype.getLockSettings=function(){var e={};for(var t in this.__lockSettings)e[t]=this.__lockSettings[t];return e},a.prototype.isActionEnabled=function(e){return!this.__options.lockNavigation||!0===this.__lockSettings[e]},a.prototype.setPivotSetFlag=function(e){this.__pivotIsSetFlag=!!e},a.prototype.getPivotSetFlag=function(){return this.__pivotIsSetFlag},a.prototype.setRequestFitToView=function(e){this.isActionEnabled("gotoview")&&(this.__fitToViewRequested=!!e)},a.prototype.getRequestFitToView=function(){return this.__fitToViewRequested},a.prototype.setRequestHomeView=function(e){this.isActionEnabled("gotoview")&&(this.__homeViewRequested=!!e)},a.prototype.getRequestHomeView=function(){return this.__homeViewRequested},a.prototype.setRequestTransition=function(e,t,i,n,r,o){this.__destinationView=e?{position:t.clone(),coi:i.clone(),fov:n,up:this.getCamera().up.clone(),worldUp:this.getWorldUpVector(),reorient:r,pivot:o?o.clone():i.clone()}:null},a.prototype.setRequestTransitionWithUp=function(e,t,i,n,r,o,s){this.__destinationView=e?{position:t.clone(),coi:i.clone(),fov:n,up:r.clone(),worldUp:o||this.getWorldUpVector(),reorient:!1,pivot:s?s.clone():i.clone()}:null},a.prototype.getRequestTransition=function(){return this.__destinationView},a.prototype.setTransitionActive=function(e){const t=this.__transitionActive!=e;this.__transitionActive=!!e,t&&this.fireEvent({type:s.TRANSITION_ACTIVE_FLAG_CHANGED,transitionActive:!!e})},a.prototype.getTransitionActive=function(){return this.__transitionActive},a.prototype.getWorldSize=function(e){var t=this.getCamera(),i=t.aspect,r=2*e*Math.tan(n.Math.degToRad(.5*t.fov)),o=r*i;return new n.Vector2(o,r)},a.prototype.screenToViewport=function(e,t){return e=2*e-1,t=2*(t=1-t)-1,new n.Vector3(e,t,1)},a.prototype.viewportToScreen=function(e,t){return e=(e+1)/2,t=1-(t=(t+1)/2),new n.Vector2(e,t)},a.prototype.getWorldPoint=function(e,t){var i=this.screenToViewport(e,t);e=i.x,t=i.y;var r,o=this.getCamera();o.isPerspective&&(r=(r=new n.Vector3(e,t,1)).unproject(o));var s,a,l=this.getEyeVector(),c=this.getPosition();if(!o.isPerspective||isNaN(r.x)){var h=this.getWorldSize(l.length()),u=this.getCameraRightVector(!1).multiplyScalar(.5*e*h.x),d=this.getCameraUpVector().multiplyScalar(.5*t*h.y);s=l.clone().add(u).add(d).normalize()}else s=r.sub(c).normalize();var f=this.getPivotPoint(),p=s.dot(l);return a=this.__pivotIsSetFlag&&(this.getIs2D()||o.isPerspective&&p>0)?0!==p?Math.abs(f.sub(c).dot(l))/p:f.sub(c).length():o.isPerspective?.5*(o.near+o.far):o.orthoScale,s.multiplyScalar(a).add(c)},a.prototype.getPivotPlaneDistance=function(){var e=this.getPivotPoint(),t=this.getEyeVector(),i=this.getPosition();return e.sub(i).dot(t.normalize())},a.prototype.panRelative=function(e,t,i){if(this.isActionEnabled("pan")){var n=this.getScreenViewport(),r=this.getCamera(),o=this.getWorldSize(i),s=e*o.x*n.width/r.clientWidth,a=t*o.y*n.height/r.clientHeight,l=this.getCameraRightVector(!1).multiplyScalar(s),c=this.getCameraUpVector().multiplyScalar(a),h=l.add(c);this.applyPanningConstraint2D(h),this.setView(this.getPosition().add(h),this.getTarget().add(h))}},a.prototype.dollyFromPoint=function(e,t,i){if(this.isActionEnabled("zoom")&&!(Math.abs(e)<=this.__kEpsilon)){var n=this.getPosition(),r=this.getEyeVector();if(!this.getCamera().isPerspective){var o=r.lengthSq(),s=r.dot(this.getTarget().sub(t));t=r.clone().multiplyScalar(s/o).add(t)}var a=t.clone().sub(n),l=a.length(),c=l+e;c<this.__minDistance&&(c=this.__minDistance);var h=c/l;if(h=this.applyDollyConstraint(h,i),Math.abs(h-1)>this.__kEpsilon){a.multiplyScalar(h),a.set(-a.x,-a.y,-a.z);var u=a.add(t);r=this.getEyeVector(),this.getCamera().isPerspective||r.multiplyScalar(h),this.setView(u,r.add(u))}}},a.prototype.toPerspective=function(){if(this.getIs2D())r.logger.warn("Autodesk.Viewing.Navigation.toPerspective is not applicable to 2D");else{var e=this.getCamera();e.isPerspective||(e.toPerspective(),e.dirty=!0)}},a.prototype.toOrthographic=function(){var e=this.getCamera();e.isPerspective&&(e.toOrthographic(),e.dirty=!0)},a.snapToAxis=function(e){var t=new n.Vector3(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z));return t.x>t.y&&t.x>t.z?e.set(e.x>0?1:-1,0,0):t.y>t.x&&t.y>t.z?e.set(0,e.y>0?1:-1,0):e.set(0,0,e.z>0?1:-1),e},o.EventDispatcher.prototype.apply(a.prototype),a.Events=s},23261:(e,t,i)=>{"use strict";i.r(t),i.d(t,{OrbitDollyPanTool:()=>s});var n=i(19556),r=i(26206),o=i(35922);function s(e,t,i){this.setGlobalManager(t.globalManager);var r,s,a=this,l=.001,c=.01,h=i&&i.hasOwnProperty("dollyDragScale")?i.dollyDragScale:100,u=-1!=navigator.userAgent.search("Mac OS"),d=i&&i.disablePinchRotation,f=t.navigation,p=f.getCamera(),m=["orbit","freeorbit","dolly","pan"],g=m[0],v=[g],y=g,b=null,x=1,_=0,E=0,S=0,A=0,w=!0,T=!1,M=null,C=!1,P=33,D=34,L=37,I=38,R=39,O=40,N=48,F=187,U=189,B=-4,k=-1,V=-5,G=new THREE.Vector3,z=new THREE.Vector3,H=new THREE.Vector2,W=new THREE.Vector2,j=new THREE.Vector2,q=new THREE.Vector2,X=new THREE.Vector3,Y=new THREE.Vector3,K=new THREE.Vector3,Q=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3,J=new THREE.Vector3,ee=new THREE.Vector3,te=new THREE.Vector3,ie=new THREE.Quaternion,ne=new THREE.Plane,re=[!1,!1,!1,!1,!1,!1],oe={SHIFT:0,ALT:0,CONTROL:0,SPACE:0};this.active=!1;var se,ae=function(t){e.renderer().rolloverObjectId(0,null,0)},le=.01,ce=i&&i.hasOwnProperty("dollyScrollScale")?i.dollyScrollScale:.6,he=1,ue=5,de=.025;function fe(e,t){var i=a.getWindow(),n=0,r=0,o=i.innerWidth,s=i.innerHeight;ee.set((e-.5*o-n)/(.5*o),(.5*s+r-t)/(.5*s),0);var l=ee.length();return l>1?ee.normalize():ee.z=Math.sqrt(1-l*l),Q.copy(p.position).sub(p.pivot),$.copy(p.up).setLength(ee.y),$.add(J.copy(p.up).cross(Q).setLength(ee.x)),$.add(Q.setLength(ee.z)),$}this.getNames=function(){return m},this.getName=function(){return m[0]},this.activate=function(i){this.active=!0,v.push(i),y=i,w=t.prefs.get(o.Prefs3D.ENABLE_CUSTOM_ORBIT_TOOL_CURSOR),t.prefs.addListeners(o.Prefs3D.ENABLE_CUSTOM_ORBIT_TOOL_CURSOR,this._onPrefCursor),e.canvas.addEventListener("mouseout",ae),t.addEventListener(n.ESCAPE_EVENT,this.handleBlur)},this.deactivate=function(i){this.active=!1,t.prefs.removeListeners(o.Prefs3D.ENABLE_CUSTOM_ORBIT_TOOL_CURSOR,this._onPrefCursor);var r=v.length-1;r>0&&v[r]===i&&(v.pop(),y=v[r-1]),e.canvas.removeEventListener("mouseout",ae),t.removeEventListener(n.ESCAPE_EVENT,this.handleBlur)},this.isActive=function(){return this.active},this.adjustDollyLookSpeed=function(e){0===e?(de=.025,ue=5):((de*=e>0?1.1:.9)<1e-6&&(de=1e-6),(ue*=e>0?1.1:.9)<1e-6&&(ue=1e-6))},this.getDollySpeed=function(e,t){var i;if(!f.getZoomTowardsPivot()&&!f.getWheelSetsPivot()||p.isPerspective||f.getIs2D()){var n=f.getEyeVector(),r=f.getPosition();o=e.clone().sub(r).dot(n.normalize())*de;i=Math.abs(o)<le?o<0?-.01:le:o}else{var o=p.orthoScale*de;i=Math.abs(o)<5e-4&&t?0:o}return i},this.setPivotPointFromInput=function(t,i){if(!f.getIs2D()&&f.getWheelSetsPivot()){var n=e.hitTest(t,i,!0);if(n&&n.intersectPoint)this.utilities.setPivotPoint(n.intersectPoint,!0,!0);else{const n=f.getPivotPoint(),r=f.getEyeVector().normalize(),o=-n.dot(r);ne.set(r,o);const s=e.viewportToRay(e.clientToViewport(t,i));let a=new THREE.Vector3;s.intersectPlane(ne,a),this.utilities.setPivotPoint(a,!0,!0)}}},this.getDollyScrollScale=function(){return ce},this.setDollyScrollScale=function(e){ce=e},this.getDollyDragScale=function(){return h},this.setDollyDragScale=function(e){h=e},this.getLookSpeed=function(){return ue},this.coiIsActive=function(){return f.getPivotSetFlag()&&f.isPointVisible(f.getPivotPoint())},this.adjustSpeed=function(e){this.adjustDollyLookSpeed(e),this.utilities.autocam&&(this.utilities.autocam.orbitMultiplier=this.getLookSpeed())},this.getTriggeredMode=function(){return 1===V&&oe.SHIFT?v[1]:(e=oe,2===V&&e.SHIFT&&!e.ALT&&!e.CONTROL||2===V&&e.ALT&&!e.SHIFT&&!e.CONTROL||"dolly"===y&&!e.ALT&&"pinch"!==b||0!==X.z?function(){var e=oe;return!(e.CONTROL||e.ALT||e.SHIFT||2!==V&&1!==V)}()?"pan":"dolly":function(){var e=oe;return 2===V&&!e.SHIFT&&!(e.ALT^e.CONTROL)||2===V&&e.SHIFT&&e.CONTROL||1===V&&!e.SHIFT&&!e.CONTROL||1===V&&e.ALT||1===V&&e.CONTROL&&!e.ALT||0===V&&e.SHIFT&&!e.CONTROL&&!e.ALT||"pan"===y&&1!==V&&!e.ALT&&!("pinch"===b)||e.SPACE}()?"pan":"pan"===b||"pinch"===b?"dollypan":y);var e},this.initTracking=function(e,t){var i;if(p.isPerspective){i=.5*(p.near+p.far);var n=this.utilities.getHitPoint(e,t),r=f.getPosition();if(n&&n.sub){var o=n.sub(r),s=f.getEyeVector().normalize();i=Math.abs(s.dot(o))}else{if(f.getPivotSetFlag()&&f.isPointVisible(f.getPivotPoint())){var a=f.getPivotPlaneDistance();a>.01&&(i=a)}}}else i=f.getEyeVector().length();he=i},this.initOrbit=function(){this.utilities.setTemporaryPivot(p.isPerspective&&f.getPivotPoint().sub(f.getPosition()).dot(f.getEyeVector())<=0?f.getTarget():null)},this.getActiveMode=function(){return g},this.getCursor=function(){if(!w)return null;switch(g){case"freeorbit":case"orbit":return"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAt1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAzMzP6+vri4uISEhKKioqtra2dnZ2EhIR9fX10dHRkZGQdHR3t7e3Hx8e5ubm1tbWoqKhWVlZKSko4ODgICAjv7+/o6OjMzMyxsbFOTk4pKSkXFxcEBAT29vbW1tZ6enpISEgLCwvhzeX+AAAAGXRSTlMANRO0nHRJHfnskIxQRKh89syDVwTWZjEJxPFEswAAAOFJREFUKM+1j+lygkAQhIflEAJe0Rw9u4CCeKKoSTTX+z9XoMJWWeX+ssrvZ3f19DQ5zOw/0DUMQPlmQ72bE2adBp8/Rp3CQUi3ILx+bxj4fjDs9T1Bmo6bbPPN8aDU4bjJt4nb+de789kSFyxn826jW3ICLNZZKU8nWWbrBTCRVm04U8TpjquRFf1Go0d7l8aYOrUR7FGEFr1S9LGymwthgX2gE/Kl0cHPOtF2xOWZ5QpIC93RflW4InkDoPRXesd5LJIMQPzV7tCMa7f6BvhJL79AVDmYTNQ1NhnxbI/uwB8H5Bjd4zQPBAAAAABJRU5ErkJggg==), auto";case"dolly":return"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAgVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8mJiYAAADNzc2/v7+fn59paWlPT08MDAwICAj6+vqpqak7Ozv29vby8vLp6em2traAgIBkZGRZWVlAQEAaGhpISEgkS7tbAAAAFHRSTlMAOvhpZD8mkQWegMy9qY1YVE01EYiqlE0AAADZSURBVCjPbY9ZloMgEAAbEbfsmRZZXbJn7n/AAX2RQVN/VD26AXLOeZLDGo6IbfI9tHq8cdxuj1HwvgCoaiHqKoRk+M3hB9jueUW8PnfsE/bJ3vms7nCkq7NoE3s99AXxoh8vFoXCpknrn5faAuJCenT0xPkYqnxQFJaU0gdZrsKm8aHZrAIffBj40mc1jsTfIJRWegq6opTMvlfqLqYg7kr1ZB7jFgeaMC59N//8O4WZ1IiPF8b5wMHcJn8zB4g4mc77zpxgAbMSUVoGK4iV0hL4wrksz+H0Bw5+E+HrniDQAAAAAElFTkSuQmCC), auto";case"pan":return"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAABHVBMVEUAAABPTk4AAAAAAAAJCQkRERE0MzQQEBAODg4QEBB4d3dbWlo9PDw/Pj4vLy8sLCwZGBgWFhYcHBwKCgoSEhIAAAAKCgoICAgKCgoQEBAODg4EBAQICAgPDw8REREMDAx2dnY0NDQvLy9QUFAaGhomJSYjIyM7OjokJCQNDA0mJiYNDQ0AAAAUFBQJCQkQEBAEBAQNDQ0PDw8VFRX///+amJkAAAD5+fnz8/PKycn9/f339vbi4eLR0dDNzMyAgIB8e3xycHH7+/vw7+/o6OjX1ta7urq4t7iwsLCnp6eioqKbmppva21OTk74+Pjl5eXc3Nzb29vLy8vDw8PDwsKrqqqdnZ2WlpaSkpKTkZKMiouEg4NkZGRISEgxLzBpgbsEAAAANHRSTlMA+fiQXgngKSYG/vX17uvBuqackpCNg3BpUkpAPBwTDvj18+vl0s/NwrOwoZZ+TDg4NBkBGrzX8QAAAP5JREFUKM99j9Vuw0AQRdeuKZyGkyZNmbnXDLHDVGb8/8/oy7paK1bO0+oc7WiGnGiaxq+QRTQAOh8f9Jv4H/Ge8PZPrCdlvkxfYluUT2WyyCq3mZ7unwlKVLcqOzA/Mf71j0TWJ/Ym6rPeca05Ni4iIevYc7yoUD2zQFhq71BdI9nvBeBabFDSPe8DswlUc1Riw3VxbH0NHBUPQ0jrbDnPYDjALQBMq9E7nkC5y7VDKTZlUg8Q0lmjvl74zlYErgvKa42GPKf3/a0kQmYCDY1SYMDosqMoiWrGwz/uAbNvc/fNon4kXRKGq+PUo2Mb96afV0iUxqGU2s4VBbKUP65NL/LKF+7ZAAAAAElFTkSuQmCC), auto"}return null},this.getMotionDelta=function(e,t){var i=f&&f.getReverseZoomDirection()?-1.5:1.5;u&&(i*=-1),re[0]&&(z.x+=c,j.x+=20),re[1]&&(z.x-=c,j.x-=20),re[2]&&(z.y+=c,j.y+=20),re[3]&&(z.y-=c,j.y-=20),re[4]&&(z.z+=i),re[5]&&(z.z-=i);var n=z.x-G.x,r=z.y-G.y,o=z.z-G.z;Math.abs(n)<l&&(n=0),Math.abs(r)<l&&(r=0),Math.abs(o)<l&&(o=0),e.set(n,r,o),t&&t.set(j.x-W.x,j.y-W.y)},this.stepMotionDelta=function(e,t){t?(G.x+=.6*e.x,G.y+=.6*e.y,G.z+=.6*e.z):G.copy(z),W.copy(j)},this.getFitBounds=function(){return this.utilities.viewerImpl.zoomBoundsChanged&&(se=this.utilities.viewerImpl.getVisibleBounds(!0),this.utilities.viewerImpl.zoomBoundsChanged=!1),se},this.update=function(){var e,i=!1,n=!1;this.getMotionDelta(X,q);var o=X.x,a=X.y,l=X.z;if(T||this.checkInteractionMode(),(T=V>k)&&this.controller.setIsLocked(!0),0!==o||0!==a||0!==l){switch(g){case"orbit":this.utilities.autocam&&this.utilities.autocam.startState&&(q.x=-q.x,M&&this.utilities.autocam.orbit(j,M,q.multiplyScalar(2),this.utilities.autocam.startState));break;case"freeorbit":!function(){if(f.isActionEnabled("orbit")){Q.subVectors(p.position,p.pivot),Z.subVectors(p.position,p.target);var e=Z.length();Z.normalize();var t=Math.acos(Y.dot(K)/Y.length()/K.length());t&&(t*=2,te.crossVectors(Y,K).normalize(),ie.setFromAxisAngle(te,-t),Q.applyQuaternion(ie),p.up.applyQuaternion(ie),K.applyQuaternion(ie),Z.applyQuaternion(ie),Y.copy(K)),p.position.addVectors(p.pivot,Q),p.target.subVectors(p.position,Z.multiplyScalar(e)),p.dirty=!0}}();break;case"dolly":var c,u=new THREE.Vector2;l*=ce,V>=0?(a=-a,l=Math.abs(o)>Math.abs(a)?o:a,f.getReverseZoomDirection()&&(l*=-1),l*=h,o=0,a=0,u=f.viewportToScreen(0,0)):(e=f.getScreenViewport(),r&&s?(u.x=r/e.width,u.y=s/e.height):u=f.viewportToScreen(0,0)),!f.getIs2D()&&f.getZoomTowardsPivot()?this.coiIsActive()?c=f.getPivotPoint():(u=f.viewportToScreen(0,0),c=f.getWorldPoint(u.x,u.y)):c=f.getWorldPoint(u.x,u.y),f.dollyFromPoint(l*this.getDollySpeed(c,l<0),c,this.getFitBounds());break;case"pan":f.panRelative(-o,a,he);break;case"dollypan":0===o&&0===a||f.panRelative(-o,a,he),e=f.getScreenViewport(),c=f.getWorldPoint(r/e.width,s/e.height);var v=f.getPosition(),y=f.getIs2D()?v.sub(c).length():he,A=(_/E-1)*y;f.dollyFromPoint(A,c,this.getFitBounds());var w=new THREE.Vector3,P=new THREE.Quaternion,D=f.getCameraUpVector(),L=w.copy(p.position).sub(p.target).normalize();P.setFromAxisAngle(L,1.2*S),D.applyQuaternion(P),f.getIs2D()||d&&("pinch"===b||"pan"===b)||f.setCameraUpVector(D),_=E,x,he=y+A}n=!0}return this.stepMotionDelta(X,"pan"!==g&&"dollypan"!==g),V===k&&Math.abs(l)<.01&&(this.interactionEnd(k),z.z=0,G.z=0,i=!0,n=!0),(oe.SHIFT||oe.ALT)&&-1!==m.indexOf(t.getActiveNavigationTool())&&(n=!0),!C&&(i||V>-5)&&(V>k&&(G.copy(z),this.utilities.removeTemporaryPivot()),this.utilities.autocam.endInteraction(),V=-5,T&&this.controller.setIsLocked(!1),T=!1,M=null,b=null),n?this.utilities.pivotActive(f.getPivotSetFlag(),V<=k):this.utilities.pivotUpdate(),p.dirty},this.checkInteractionMode=function(){var e=this.getTriggeredMode();e!==g&&("pan"===(g=e)&&V>k||"dollypan"===g)&&this.initTracking(G.x,G.y)},this.interactionStart=function(e,t){(t||e>V)&&(V=e,C=!0,e>k&&("pan"===g&&this.initTracking(G.x,G.y),"orbit"===g&&this.initOrbit()),!f.getSelectionSetsPivot()&&this.utilities.pivotActive(f.getPivotSetFlag(),e===k),this.utilities.autocam&&(this.utilities.autocam.sync(p),this.utilities.autocam.startInteraction(W.x,W.y),M=W.clone()))},this.interactionCheck=function(){(re[0]||re[1]||re[2]||re[3]||re[4]||re[5]||oe.SHIFT||oe.CONTROL||oe.ALT||oe.SPACE)&&this.interactionStart(B,!0)},this.interactionEnd=function(e){e===V&&(e!==k&&this.utilities.pivotActive(!1),C=!1)},this.isInteractionActive=function(){return C},this.handleWheelInput=function(t,i){if(r=i.canvasX,s=i.canvasY,this.isDragging)return!1;if(f.getIs2D()){var n=f.getScreenViewport(),o=e.intersectGround(r+n.width,s+n.height);this.utilities.setPivotPoint(o,!0,!0)}else this.setPivotPointFromInput(r,s);return f.getReverseZoomDirection()&&(t*=-1),z.z+=t,0!=t&&this.interactionStart(k),!0},this.resetKeys=function(){this.autoMove(-1,!1),oe.SHIFT=0,oe.CONTROL=0,oe.ALT=0,oe.SPACE=0},this.autoMove=function(e,t){t&&this.isDragging||(e<0?re[0]=re[1]=re[2]=re[3]=re[4]=re[5]=t:re[e]=t,t||this.interactionEnd(B),this.interactionCheck())},this.updateModifierState=function(e){oe.CONTROL=u&&e.metaKey||e.ctrlKey?1:0,oe.SHIFT=e.shiftKey?1:0,oe.ALT=e.altKey?1:0},this.handleKeyDown=function(e,t){this.updateModifierState(e);var i=!1;if(u&&oe.CONTROL)return this.autoMove(-1,!1),this.interactionEnd(B),!1;switch(t){case F:this.adjustSpeed(1),i=!0;break;case U:this.adjustSpeed(-1),i=!0;break;case N:this.adjustSpeed(0),i=!0;break;case L:this.autoMove(0,!0),i=!0;break;case R:this.autoMove(1,!0),i=!0;break;case P:this.autoMove(2,!0),i=!0;break;case D:this.autoMove(3,!0),i=!0;break;case I:this.autoMove(4,!0),i=!0;break;case O:this.autoMove(5,!0),i=!0;break;default:return!1}return this.isDragging||this.interactionStart(B),i},this.handleKeyUp=function(e,t){this.updateModifierState(e);var i=!1;if(u&&oe.CONTROL)return this.autoMove(-1,!1),this.interactionEnd(B),!1;switch(t){case L:this.autoMove(0,!1),i=!0;break;case R:this.autoMove(1,!1),i=!0;break;case P:this.autoMove(2,!1),i=!0;break;case D:this.autoMove(3,!1),i=!0;break;case I:this.autoMove(4,!1),i=!0;break;case O:this.autoMove(5,!1),i=!0;break;default:return!1}return i&&(this.interactionEnd(B),C||this.interactionCheck()),i},this.handleDollyPan=function(e){r=e.canvasX,s=e.canvasY;var t=f.getScreenViewport();j.x=r,j.y=s,z.x=j.x/t.width,z.y=j.y/t.height,E=function(e){var t=e.pointers[1].clientX-e.pointers[0].clientX,i=e.pointers[1].clientY-e.pointers[0].clientY;return Math.sqrt(t*t+i*i)}(e);var i,n,o=THREE.Math.degToRad(e.rotation);S=o-A,Math.abs(S)>1&&(S=0),A=o,i=e.type,n="start",-1!==i.indexOf(n,i.length-n.length)&&(_=E,1,S=0,A=o),x=e.scale},this.handleGesture=function(e){switch(e.type){case"dragstart":return b="drag",this.handleButtonDown(e,0);case"dragmove":return"drag"!==b&&(this.handleButtonDown(e,0),b="drag"),this.handleMouseMove(e);case"dragend":return"drag"===b&&(this.handleButtonUp(e,0),b=null,!0);case"panstart":return b="pan",this.handlePanStart(e),this.handleDollyPan(e),!0;case"panmove":return"pan"!==b&&(b="pan",this.handlePanStart(e)),this.handleDollyPan(e);case"panend":return"pan"===b&&(this.isDragging=!1,this.handleDollyPan(e),this.interactionEnd(3),!0);case"pinchstart":return this.setPivotPointFromInput(e.center.x,e.center.y),this.isDragging=!0,b="pinch",G.x=.5*(e.normalizedX+1),G.y=1-.5*(e.normalizedY+1),H.set(e.canvasX,e.canvasY),W.set(e.canvasX,e.canvasY),T=!1,this.interactionStart(3),this.handleDollyPan(e),!0;case"pinchmove":return"pinch"===b&&this.handleDollyPan(e);case"pinchend":return"pinch"===b&&(this.isDragging=!1,this.handleDollyPan(e),this.interactionEnd(3),!0)}return!1},this.handleButtonDown=function(e,t){return this.updateModifierState(e),G.x=.5*(e.normalizedX+1),G.y=1-.5*(e.normalizedY+1),W.set(e.canvasX,e.canvasY),z.copy(G),j.copy(W),Y.copy(fe(e.canvasX,e.canvasY)),K.copy(Y),r=e.canvasX,s=e.canvasY,this.isDragging=!0,this.interactionStart(t),!0},this.handlePanStart=function(e){return this.isDragging=!0,G.x=.5*(e.normalizedX+1),G.y=1-.5*(e.normalizedY+1),H.set(e.canvasX,e.canvasY),W.set(e.canvasX,e.canvasY),this.interactionStart(3),!0},this.handleButtonUp=function(e,t){return this.updateModifierState(e),z.x=.5*(e.normalizedX+1),z.y=1-.5*(e.normalizedY+1),j.set(e.canvasX,e.canvasY),K.copy(fe(e.canvasX,e.canvasY)),Y.copy(K),r=e.canvasX,s=e.canvasY,this.interactionEnd(t),this.isDragging=!1,!0},this.handleMouseMove=function(t){return this.updateModifierState(t),this.isDragging?(z.x=.5*(t.normalizedX+1),z.y=1-.5*(t.normalizedY+1),j.set(t.canvasX,t.canvasY),K.copy(fe(t.canvasX,t.canvasY)),r=t.canvasX,s=t.canvasY,!0):(G.x=.5*(t.normalizedX+1),G.y=1-.5*(t.normalizedY+1),W.set(t.canvasX,t.canvasY),z.x=G.x,z.y=G.y,j.copy(W),r=t.canvasX,s=t.canvasY,t.target===e.canvas&&e.rolloverObject(r,s),!1)},this.handleBlur=e=>{this.resetKeys(),this.interactionEnd(V)},this._onPrefCursor=function(e){w=e}.bind(this)}r.GlobalManagerMixin.call(s.prototype)},18310:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SelectionType:()=>n});var n={MIXED:1,REGULAR:2,OVERLAYED:3}},27579:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MultiModelSelector:()=>h,Selector:()=>c});var n=i(63430),r=i(18310),o=i(57480),s=i(83081),a=i(19556),l=i(72091);function c(e,t){var i=this;this.selectedObjectIds={},this.selectionCount=0,this.selectionMode=n.SelectionMode.LEAF_OBJECT,this.lockedNodes=[];var a={};function c(){return t.getData().instanceTree}function h(i){var n=c();if(a[i]>0)a[i]--,0==a[i]&&e.highlightObjectNode(t,i,!1);else if(a[i]<0)throw"Selection State machine broken. Negatively selected object!";n&&n.enumNodeChildren(i,(function(e){h(e)}),!1)}function u(i,n,o){var s=c();if(a[i])a[i]++;else{switch(o){default:case r.SelectionType.MIXED:e.highlightObjectNode(t,i,!0,n);break;case r.SelectionType.REGULAR:e.highlightObjectNode(t,i,!0,!0);break;case r.SelectionType.OVERLAYED:e.highlightObjectNode(t,i,!0,!1)}a[i]=1}s&&s.enumNodeChildren(i,(function(e){u(e,!0,o)}),!1)}function d(e){if(void 0!==e&&i.selectedObjectIds[e])return!0}function f(n,o){if(!i.isNodeSelectionLocked(n)){var s=c();if(o=o||r.SelectionType.MIXED,s){const r=function(){var n;const r="ifc"===(null===(n=t.getData())||void 0===n||null===(n=n.loadOptions)||void 0===n?void 0:n.fileExt),o=void 0!==e.api.prefs.getPrefFromLocalStorage(Autodesk.Viewing.Private.Prefs3D.SELECTION_MODE);return r&&!o?Autodesk.Viewing.SelectionMode.FIRST_OBJECT:i.selectionMode}();if(n=s.findNodeForSelection(n,r),!s.isNodeSelectable(n))return}d(n)||(i.selectedObjectIds[n]=o,i.selectionCount++,u(n,!1,o))}}function p(e){d(e)&&(h(e),i.selectedObjectIds[e]=0,i.selectionCount--)}this.getInstanceTree=c,this.hasSelection=function(){return i.selectionCount>0},this.getSelectionLength=function(){return i.selectionCount},this.getSelection=function(){var e=[],t=i.selectedObjectIds;for(var n in t)if(t[n]){var r=parseInt(n);e.push(r)}return e},this.isSelected=function(e){return d(e)},this.clearNodeSelection=function(e){return void 0!==e&&0!==this.selectionCount&&(h(e),delete i.selectedObjectIds[e],!0)},this.clearSelection=function(e){if(this.selectionCount>0){var t=i.selectedObjectIds;for(var n in t){var r=parseInt(n);void 0!==r&&h(r)}return i.selectedObjectIds={},i.selectionCount=0,!0}},this.deselectInvisible=function(){var n=!1,r=i.selectedObjectIds,o=e.visibilityManager;for(var s in r){var a=parseInt(s);a&&!o.isNodeVisible(t,a)&&(p(a),n=!0)}return n},this.toggleSelection=function(e,i){e||t.isLeaflet()?d(e)?p(e):f(e,i):s.logger.error("Attempting to select node 0.",(0,o.errorCodeString)(o.ErrorCodes.VIEWER_INTERNAL_ERROR))},this.setSelectionMode=function(e){this.clearSelection(!0),this.selectionMode=e},this.isNodeSelectionLocked=function(e){if(-1===e)return!1;var t=c();return t?t.isNodeSelectionLocked(e):-1!==i.lockedNodes.indexOf(e)},this.lockSelection=function(e,t){var n=c();function r(e,t){if(e&&-1!==e)if(t)-1===i.lockedNodes.indexOf(e)&&(i.lockedNodes.push(e),i.clearNodeSelection(e));else{const t=i.lockedNodes.indexOf(e);i.lockedNodes.splice(t,1)}}e=Array.isArray(e)?e:[e],n?e.forEach((function(e){n.enumNodeChildren(e,(function(e){n.lockNodeSelection(e,!1),r(e,t),t&&n.lockNodeSelection(e,t)}),!0)})):e.forEach((e=>{r(e,t)}))},this.setSelection=function(e,t){if(!function(e){if(i.selectionCount!==e.length)return!1;for(var t=0;t<e.length;t++)if(!d(e[t]))return!1;return!0}(e)&&(this.clearSelection(!0),null!=e&&0!==e.length))for(var n=0;n<e.length;n++)f(e[n],t)},this.getSelectionBounds=function(){var e=new l.Box3,n=new l.Box3,r=c();if(r){var o=t.getFragmentList(),s=i.selectedObjectIds;for(var a in s){var h=parseInt(a);r.enumNodeFragments(h,(function(t){o.getWorldBounds(t,n),e.union(n)}),!0)}}return e},this.getSelectionVisibility=function(){var e=!1,n=!1,r=i.selectedObjectIds;for(var o in r){var s=parseInt(o);if(s){var a=c();if(a&&a.isNodeHidden(s)?n=!0:e=!0,e&&n)break}}return{hasVisible:e,hasHidden:n,model:t}},this.update2DSelectionHighlighting=function(){if(i._2DSelectionHighlightingUpdated)return;if(!t.isLoadDone())return;var n=t.getPropertyDb();if(n&&!n.isLoadDone())return;if(!e.overlayScenes[e.selection2dOverlayName(t)])return;for(var r=i.getSelection(),o=0;o<r.length;o++){h(a=r[o])}const s={};Object.keys(i.selectedObjectIds).forEach((e=>{s[t.remapDbId(e)]=i.selectedObjectIds[e]})),i.selectedObjectIds=s;for(o=0;o<r.length;o++){var a;u(a=r[o],!1,i.selectedObjectIds[a])}i._2DSelectionHighlightingUpdated=!0},this.dtor=function(){this.selectedObjectIds=null}}function h(e){var t=[];function i(){t.length>1&&s.logger.warn("This selection call does not yet support multiple models.")}function n(i){for(var n,r=[],o=0;o<t.length;o++){var s=[],l=[],c=t[o].selector.selectedObjectIds,h=t[o].selector.getInstanceTree();for(var u in c)if(c[u]){var d=parseInt(u);d&&(s.push(d),h&&h.enumNodeFragments(d,(function(e){l.push(e)}),!1))}s.length&&r.push({fragIdsArray:l,dbIdArray:s,nodeArray:s,model:t[o]})}1===t.length&&(n={type:a.SELECTION_CHANGED_EVENT,fragIdsArray:r[0]?r[0].fragIdsArray:[],dbIdArray:r[0]?r[0].dbIdArray:[],nodeArray:r[0]?r[0].dbIdArray:[],model:t[0],mouseButton:i},e.api.dispatchEvent(n)),n={type:a.AGGREGATE_SELECTION_CHANGED_EVENT,selections:r,mouseButton:i},e.api.dispatchEvent(n)}function r(){for(var e=!1,i=0;i<t.length;i++)e=t[i].selector.deselectInvisible()||e;e&&n()}function o(e){e.model.is2d()&&e.model.selector&&e.model.selector.update2DSelectionHighlighting()}this.highlightDisabled=!1,this.highlightPaused=!1,this.selectionDisabled=!1,this.addModel=function(i){-1==t.indexOf(i)&&(i.selector=new c(e,i),t.push(i))},this.removeModel=function(e){var i=t.indexOf(e);e.selector.getSelection();e.selector.clearSelection(),e.selector=null,t.splice(i,1)},this.hasSelection=function(){for(var e=0;e<t.length;e++)if(t[e].selector.hasSelection())return!0;return!1},this.getSelectionLength=function(){for(var e=0,i=0;i<t.length;i++)e+=t[i].selector.getSelectionLength();return e},this.getSelection=function(){return i(),t.length>1&&s.logger.warn("Use getAggregateSelection instead of getSelection when there are multiple models in the scene."),t[0]?t[0].selector.getSelection():[]},this.getAggregateSelection=function(){for(var e=[],i=0;i<t.length;i++){var n=t[i].selector.getSelection();n&&n.length&&e.push({model:t[i],selection:n})}return e},this.clearSelection=function(e){let i;for(var r=0;r<t.length;r++)t[r].selector.clearSelection(e)&&(i=!0);!e&&i&&n()},this.toggleSelection=function(e,r,o){this.selectionDisabled||(r||(i(),r=t[0]),r.selector.toggleSelection(e,o),n())},this.setSelectionMode=function(e){for(var i=0;i<t.length;i++)t[i].selector.setSelectionMode(e)},this.isNodeSelectionLocked=function(e,n){return n||(i(),n=t[0]),n&&n.selector.isNodeSelectionLocked(e)},this.lockSelection=function(e,n,r){r||(i(),r=t[0]),r&&r.selector.lockSelection(e,n)},this.unlockSelection=function(e,n){e||n?(n||(i(),n=t[0]),e=e||n.selector.lockedNodes.slice(),this.lockSelection(e,!1,n)):t.forEach((e=>{const t=e.selector.lockedNodes.slice();this.lockSelection(t,!1,e)}))},this.setSelection=function(e,r,o,s){if(!this.selectionDisabled){if(e&&0!==e.length){if(r)for(var a=0;a<t.length;a++)t[a]!==r&&t[a].selector.clearSelection();else i(),r=t[0];r.selector.setSelection(e,o)}else this.clearSelection(!0);n(s)}},this.setAggregateSelection=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.selectionDisabled){if(e&&0!==e.length)for(var i=0;i<e.length;++i){var r=e[i].model,o=e[i].ids,s=e[i].selectionType;r.selector.setSelection(o,s)}else this.clearSelection(!0);t&&n()}},this.getSelectionBounds=function(){if(1==t.length)return t[0].selector.getSelectionBounds();for(var e=new l.Box3,i=0;i<t.length;i++){var n=t[i].selector.getSelectionBounds();e.union(n)}return e},this.getSelectionVisibility=function(){for(var e={hasVisible:!1,hasHidden:!1,details:[]},i=0;i<t.length;i++){var n=t[i].selector.getSelectionVisibility();e.hasVisible=e.hasVisible||n.hasVisible,e.hasHidden=e.hasHidden||n.hasHidden,e.details.push(n)}return e},this.dtor=function(){for(var e=0;e<t.length;e++)t[e].selector.dtor()},e.api.addEventListener(a.ISOLATE_EVENT,(function(e){r()})),e.api.addEventListener(a.HIDE_EVENT,(function(e){r()})),e.api.addEventListener(a.GEOMETRY_LOADED_EVENT,o),e.api.addEventListener(a.OBJECT_TREE_CREATED_EVENT,o),e.api.addEventListener(a.OBJECT_TREE_UNAVAILABLE_EVENT,o)}},83464:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ToolController:()=>a});var n=i(83081),r=i(19556),o=i(49930),s=i(26206);function a(e,t,i,s,l){this.setGlobalManager(t.globalManager),this.domElement=t.canvasWrap,this.selector=e.selector,this.autocam=i,this.lastClickX=-1,this.lastClickY=-1,this.scrollInputEnabled=!0,this.keyMapCmd=!0,this.propagateInputEventTypes=[];var c=-1!==navigator.userAgent.search("Mac OS"),h=-1!==navigator.userAgent.search("Firefox"),u=-1!==navigator.userAgent.search("Chrome"),d=-1!==navigator.userAgent.search("Safari")&&!u,f={},p={},m={},g=[],v=!1,y=-1,b=-1,x=!1,_=null,E=!1,S={},A=this;function w(e){return e.getPriority instanceof Function&&e.getPriority()||0}function T(e,i){return t.navigation.getUseLeftHandedInput()&&0===e||h&&1===e||c&&!d&&0===e&&i.ctrlKey}this.__registerToolByName=function(e,t){f[t]=e},this.registerTool=function(e,t){var i=e.getNames();if(!i||0===i.length)return n.logger.warn("Cannot register tool with no name."),!1;for(var r=!1,o=0;o<i.length;++o)if("default"!==i[o]){this.__registerToolByName(e,i[o]);const n=t=>{const i=e.getName();t?this.activateTool(i):this.deactivateTool(i)};m[i[o]]=t&&t instanceof Function?t:n,r=!0}return e.utilities=s,e.controller=this,e.register&&e.register(),r},this.deregisterTool=function(e){this.deactivateTool(e.getName());var t=e.getNames();if(!t||0===t.length)return!1;for(var i=t.length;--i>=0;)this.__deregisterToolName(t[i]);return e.deregister&&e.deregister(),e.utilities=null,e.controller=null,!0},this.__deregisterToolName=function(e){e in f&&(!function(e){for(var t=g.length;--t>=0;)g[t].activeName===e&&(f[e].deactivate(e),g.splice(t,1))}(e),delete f[e])},this.getTool=function(e){return f[e]},this.getActiveToolName=function(){var e=g.length;return e>0?g[e-1].activeName:"default"},this.getActiveTool=function(){var e=g.length;return e>0?g[e-1]:f.default},this.getActiveTools=function(){return g.slice()},this.isToolActivated=function(e){for(var t=0;t<g.length;t++)if(g[t].activeName===e)return!0;return!1},this.setToolActiveName=function(e){var t=f[e];t&&(t.activeName=e)},this.rearrangeByPriorities=function(){g.sort((function(e,t){return w(e)-w(t)}))},this.activateToolModality=function(e){const t=this.getToolModality(e);for(let e in t){const i=t[e],n=m[e];i!==this.isToolActivated(e)&&n&&n(i,e)}},this.activateTool=function(e){if(v)return!1;var i=f[e];if(this.activateToolModality(e),i){void 0===i.count&&(i.count=0);var o=null;g.length&&"intercept"===g[g.length-1].activeName&&(o=g.pop());for(var s=0,a=0;a<g.length;a++)g[a]===i&&i.count++,w(g[a])<=w(i)&&(s=a+1);return i.activeName=e,0===i.count&&(i.count++,g.splice(s,0,i)),i.activate(e,t),o&&g.push(o),t.dispatchEvent({type:r.TOOL_CHANGE_EVENT,toolName:e,tool:i,active:!0}),!0}return n.logger.warn("activateTool not found: "+e),!1},this.deactivateTool=function(e){if(v)return!1;for(var i=g.length;--i>=0;)if(g[i].activeName===e){const n=f[e];return(!n.count||n.count<=1)&&(1!=n.count&&console.warn("Deactivating tool without activation: "+e),g.splice(i,1)),n.count--,n.deactivate(e),t.dispatchEvent({type:r.TOOL_CHANGE_EVENT,toolName:e,tool:n,active:!1}),!0}return n.logger.warn("deactivateTool not found: "+e),!1},this.getToolNames=function(){return Object.keys(f)},this.setDefaultTool=function(e){var t=this.getDefaultTool();return!(!e||e===t)&&(this.__registerToolByName(e,"default"),t&&t.deactivate("default"),e.activate("default"),!0)},this.getDefaultTool=function(){return f.default},this.setDefaultTool(l),this.setIsLocked=function(e){var t=v;return v=!!e,t},this.getIsLocked=function(){return v},this.__checkCursor=function(){for(var e=null,i=g.length;--i>=0;){var n=g[i];if(n.getCursor&&(e=n.getCursor()))break}e||(e="auto"),_!=e&&(t.canvas.style.cursor=e,_=e)},this.update=function(e){this.__checkCursor();var i=!1;s&&s.update()&&(i=!0);for(var n=g.length;--n>=0;){var r=g[n];r.update&&r.update(e)&&(i=!0)}if(t.navigation.getCamera().dirty?(t.navigation.updateCamera(),i=!0,this.cameraUpdated=!0):this.cameraUpdated=!1,i)t.navigation.updateCamera(),this.moveDelay=Date.now()+150;else if(0!==this.moveDelay){this.moveDelay-Date.now()>0?i=!0:this.moveDelay=0}return i},this.__clientToCanvasCoords=function(t,i,n){var r=e.getCanvasBoundingClientRect(),o=r.width,s=r.height,a=t.clientX-r.left,l=t.clientY-r.top;t.canvasX=a,t.canvasY=l,t.normalizedX=a/o*2-1,t.normalizedY=(s-l)/s*2-1,i&&i.set(a/o,l/s,0),n&&n.set(a,l)},this.__invokeStack=function(e,t,i){for(var n=g.length;--n>=0;){var r=g[n];if(r&&r[e]&&r[e](t,i))return!0}var o=this.getDefaultTool();return!(!o[e]||!o[e](t,i))},this.distributeEvent=function(e,t,i){return this.__invokeStack(e,t,i)},this.handleResize=function(){t.navigation.setScreenViewport(t.container.getBoundingClientRect());for(var e=g.length;--e>=0;){var i=g[e];i.handleResize&&i.handleResize()}},this.handleSingleClick=function(e){var t=this.applyButtonMappings(e);this.lastClickX=e.clientX,this.lastClickY=e.clientY,this.__invokeStack("handleSingleClick",e,t)&&this.__onEventHandled(e)},this.handleDoubleClick=function(e){var t=this.applyButtonMappings(e);this.__invokeStack("handleDoubleClick",e,t)&&this.__onEventHandled(e)},this.handleSingleTap=function(e){this.lastClickX=e.canvasX,this.lastClickY=e.canvasY,this.__invokeStack("handleSingleTap",e)&&this.__onEventHandled(e)},this.handleDoubleTap=function(e){this.lastClickX=e.canvasX,this.lastClickY=e.canvasY,this.__invokeStack("handleDoubleTap",e)&&this.__onEventHandled(e)},this.handleWheelInput=function(e,t){this.__invokeStack("handleWheelInput",e,t)&&this.__onEventHandled(t)},this.applyButtonMappings=function(e){var i=e.button;return"buttons"in e&&(e.firefoxSpoof?i=0:!x||1&e.buttons?2===i&&1&e.buttons&&(i=0,e.firefoxSpoof=x=!0):(e.firefoxSpoof=!0,x=!1,i=0)),t.navigation.getUseLeftHandedInput()&&(i=0===i?2:2===i?0:i),i},this.applyKeyMappings=function(e){switch(e.keyCode){case o.KeyCode.EQUALSMOZ:return o.KeyCode.EQUALS;case o.KeyCode.DASHMOZNEW:case o.KeyCode.DASHMOZ:return o.KeyCode.DASH}return e.keyCode},this.handleKeyDown=function(e){let t;!this.keyMapCmd||!c||"MetaLeft"!=e.code&&"MetaRight"!=e.code?(t=this.applyKeyMappings(e),t&&this.__invokeStack("handleKeyDown",e,t)&&this.__onEventHandled(e)):this.handleCmdKeyEvent(e,"keydown")},this.handleKeyUp=function(e){let t;!this.keyMapCmd||!c||"MetaLeft"!=e.code&&"MetaRight"!=e.code?(t=this.applyKeyMappings(e),t&&this.__invokeStack("handleKeyUp",e,t)&&this.__onEventHandled(e)):this.handleCmdKeyEvent(e,"keyup")},this.handleCmdKeyEvent=function(e,t){this.__onEventHandled(e);var i=new KeyboardEvent(t,{key:"Control",code:"MetaLeft"==e.code?"ControlLeft":"ControlRight",location:e.location,ctrlKey:!0,metaKey:!1,repeat:e.repeat,isComposing:e.isComposing,charCode:0,keyCode:17,which:17});window.dispatchEvent(i)},this.handleButtonDown=function(e,t){this.__invokeStack("handleButtonDown",e,t)&&this.__onEventHandled(e)},this.handleButtonUp=function(e,t){this.__invokeStack("handleButtonUp",e,t)&&this.__onEventHandled(e)},this.handleMouseMove=function(e){this.__invokeStack("handleMouseMove",e)&&this.__onEventHandled(e)},this.handleBlur=function(e){this.__invokeStack("handleBlur",e)&&this.__onEventHandled(e)},this.keydown=function(e){if(!a._lastTouchedElement||A.domElement.contains(a._lastTouchedElement)){var t=A.getDocument();if(!(t.activeElement instanceof HTMLInputElement||t.activeElement instanceof HTMLTextAreaElement||t.activeElement instanceof HTMLSelectElement)){if(t.activeElement){var i=t.activeElement.getAttribute("contenteditable");if("true"===i||""===i)return}A.handleKeyDown(e)}}},this.keyup=function(e){A.handleKeyUp(e)},this.mousedown=function(e){var t=A.getDocument();t.activeElement&&t.activeElement.blur&&t.activeElement.blur(),A.__clientToCanvasCoords(e);var i=A.applyButtonMappings(e);if(A.handleButtonDown(e,i),y=e.canvasX,b=e.canvasY,T(i,e)){var n=S,r=void 0!==n.time&&e.timeStamp-n.time<500,o=void 0!==n.x&&void 0!==n.y&&Math.abs(n.x-e.canvasX)<=2&&Math.abs(n.y-e.canvasY)<=2;(!r||!o||n.clickCount&&2<=n.clickCount)&&(n.clickCount=0),n.clickCount?1===n.clickCount&&(n.clickCount=2):(n.clickCount=1,n.x=e.canvasX,n.y=e.canvasY,n.time=e.timeStamp)}A.addDocumentEventListener("mouseup",(function e(t){A.applyButtonMappings(t)===i&&(A.removeDocumentEventListener("mouseup",e),A.mouseup(t))}),!1),A.registerWindowMouseMove()},this.mousemove=function(e){A.__clientToCanvasCoords(e);var t=y-e.canvasX,i=b-e.canvasY;(Math.abs(t)>2||Math.abs(i)>2)&&(y=-1,b=-1),A.handleMouseMove(e)},this.mouseup=function(e){A.__clientToCanvasCoords(e);var t=A.applyButtonMappings(e);A.handleButtonUp(e,t);var i=y-e.canvasX,n=b-e.canvasY;if(y=-1,b=-1,Math.abs(i)<=2&&Math.abs(n)<=2&&A.handleSingleClick(e),T(t,e)){var r=S;2===r.clickCount&&(A.handleDoubleClick(e),r.clickCount=0,r.x=void 0,r.y=void 0,r.time=void 0)}A.unregisterWindowMouseMove()},this.doubleclick=function(e){A.__clientToCanvasCoords(e),y=e.canvasX,b=e.canvasY,A.handleDoubleClick(e)},this.mousewheel=function(e){if(A.scrollInputEnabled){A.__clientToCanvasCoords(e);var t=0;if(e.wheelDelta)t=e.wheelDelta/40;else if(e.detail)t=-e.detail;else if(e.deltaY){var i=h?1:40;t=-e.deltaY/i}A.handleWheelInput(t,e)}},this.blur=function(e){A.handleBlur(e)},this.mouseover=function(e){a._lastTouchedElement=e.target},this.registerWindowMouseMove=function(){A.addWindowEventListener("mousemove",A.mousemove),A.addWindowEventListener("mouseover",A.mouseover),A.domElement.removeEventListener("mousemove",A.mousemove),A.domElement.removeEventListener("mouseover",A.mouseover)},this.unregisterWindowMouseMove=function(){A.removeWindowEventListener("mousemove",A.mousemove),A.removeWindowEventListener("mouseover",A.mouseover),A.domElement.addEventListener("mousemove",A.mousemove),A.domElement.addEventListener("mouseover",A.mouseover)},this.enableMouseButtons=function(e){e&&!E?(this.domElement.addEventListener("mousedown",this.mousedown),this.domElement.addEventListener("dblclick",this.doubleclick),this.domElement.addEventListener("mousemove",this.mousemove),this.domElement.addEventListener("mouseover",this.mouseover)):!e&&E&&(this.domElement.removeEventListener("mousedown",this.mousedown),this.domElement.removeEventListener("dblclick",this.doubleclick),this.domElement.removeEventListener("mousemove",this.mousemove),this.domElement.removeEventListener("mouseover",this.mouseover));var t=E;return E=e,t},this.domElement.addEventListener("mousewheel",this.mousewheel,!1),this.domElement.addEventListener("DOMMouseScroll",this.mousewheel,!1),A.addWindowEventListener("keydown",this.keydown,!1),A.addWindowEventListener("keyup",this.keyup,!1),A.addWindowEventListener("blur",this.blur,!1),this.uninitialize=function(){for(this.domElement.removeEventListener("mousemove",this.mousemove),this.domElement.removeEventListener("mouseover",this.mouseover),this.removeWindowEventListener("mousemove",this.mousemove),this.removeWindowEventListener("mouseover",this.mouseover),this.removeWindowEventListener("keydown",this.keydown),this.removeWindowEventListener("keyup",this.keyup),this.removeWindowEventListener("blur",this.blur),this.domElement=null,this.selector=null,this.autocam=null,v=!1;g.length>0;)this.deactivateTool(g[g.length-1].activeName);f=null,g=null,A=null,s=null,t=null,e=null,a._lastTouchedElement=null},this.set2DMode=function(){},this.setAutocam=function(){},this.syncCamera=function(){},this.recordHomeView=function(){var e=t.navigation.getCamera();i.sync(e),i.setHomeViewFrom(e)},this.setMouseWheelInputEnabled=function(e){this.scrollInputEnabled=e},this.setModalityMap=function(e){p={};for(let t in e)this.setToolModality(t,e[t])},this.getModalityMap=function(){return Object.assign({},p)},this.getToolModality=function(e){return p[e]},this.setToolModality=function(e,t){e?t?p[e]=t:n.logger.warn("Cannot add tool modality. Missing tool map."):n.logger.warn("Cannot add tool modality. Missing tool name.")},this.__onEventHandled=function(e){this.propagateInputEventTypes.includes(e.type)||(e.preventDefault(),e.stopPropagation())}}Object.defineProperty(a,"_lastTouchedElement",{value:null,writable:!0}),s.GlobalManagerMixin.call(a.prototype)},74481:(e,t,i)=>{"use strict";function n(){this.names=["unnamed"],this.getNames=function(){return this.names},this.getName=function(){return this.names[0]},this.getPriority=function(){return 0},this.register=function(){},this.deregister=function(){},this.activate=function(e,t){},this.deactivate=function(e){},this.update=function(e){return!1},this.handleSingleClick=function(e,t){return!1},this.handleDoubleClick=function(e,t){return!1},this.handleSingleTap=function(e){return!1},this.handleDoubleTap=function(e){return!1},this.handleKeyDown=function(e,t){return!1},this.handleKeyUp=function(e,t){return!1},this.handleWheelInput=function(e){return!1},this.handleButtonDown=function(e,t){return!1},this.handleButtonUp=function(e,t){return!1},this.handleMouseMove=function(e){return!1},this.handleGesture=function(e){return!1},this.handleBlur=function(e){return!1},this.handleResize=function(){}}i.r(t),i.d(t,{ToolInterface:()=>n})},63841:(e,t,i)=>{"use strict";i.r(t),i.d(t,{UnifiedCamera:()=>o});var n=i(72091),r=i(83081);class o extends n.Camera{constructor(e,t){super(),this.fov=45,this.near=.1,this.far=1e5,this.aspect=e/t,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2,this.clientWidth=e,this.clientHeight=t,this.target=new n.Vector3(0,0,-1),this.worldup=new n.Vector3(0,1,0),this.viewInverseEnv=new n.Matrix4,this.projScreenMatrix=new n.Matrix4,this.orthographicCamera=new n.OrthographicCamera(this.left,this.right,this.top,this.bottom,this.near,this.far),this.perspectiveCamera=new n.PerspectiveCamera(this.fov,this.aspect,this.near,this.far),this.zoom=1,this.globalOffset=new n.Vector3,this.toPerspective()}get isOrthographicCamera(){return!this.isPerspective}clone(e){return e=e||new o(2*this.right,2*this.top),n.Camera.prototype.clone.call(this,e),e.position.copy(this.position),e.up.copy(this.up),this.target&&(e.target=this.target.clone()),this.worldup&&(e.worldup=this.worldup.clone()),this.worldUpTransform&&(e.worldUpTransform=this.worldUpTransform.clone()),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e.fov=this.fov,e.aspect=this.aspect,e.zoom=this.zoom,e.clientWidth=this.clientWidth,e.clientHeight=this.clientHeight,e.isPerspective=this.isPerspective,e.globalOffset=this.globalOffset.clone(),e.orthoScale=this.orthoScale,e.updateProjectionMatrix(),e}__computeFovPosition(e){if(Math.abs(this.fov-e)<=1e-4)return this.position.clone();var t,i,r=this.target.clone().sub(this.position),o=r.clone().normalize(),s=n.Math.degToRad(this.fov),a=n.Math.degToRad(e),l=Math.tan(.5*s)/Math.tan(.5*a);this.pivot?(t=(new n.Plane).setFromNormalAndCoplanarPoint(o.clone().negate(),this.pivot).distanceToPoint(this.position),i=o.clone().multiplyScalar(t).add(this.position)):(t=r.length(),i=this.target);t*=l;var c=o.multiplyScalar(-t);return i.clone().add(c)}toPerspective(){!this.isPerspective&&this.saveFov&&(this.position.copy(this.__computeFovPosition(this.saveFov)),this.fov=this.saveFov),this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.fov=this.fov/this.zoom,this.perspectiveCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspectiveCamera.projectionMatrix,this.isPerspective=!0}toOrthographic(){if(this.isPerspective){this.saveFov=this.fov;var e=o.ORTHO_FOV;this.position.copy(this.__computeFovPosition(e)),this.fov=e}this.orthoScale=this.target.clone().sub(this.position).length();var t=.5*this.orthoScale,i=t*this.aspect;this.left=this.orthographicCamera.left=-i,this.right=this.orthographicCamera.right=i,this.top=this.orthographicCamera.top=t,this.bottom=this.orthographicCamera.bottom=-t,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthographicCamera.projectionMatrix,this.isPerspective=!1}updateProjectionMatrix(){this.isPerspective?this.toPerspective():this.toOrthographic()}setSize(e,t){this.aspect=e/t,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2}setFov(e){this.fov=e,this.updateProjectionMatrix()}setLens(e,t){void 0===t&&(t=24);var i=2*n.Math.radToDeg(Math.atan(t/(2*e)));return this.setFov(i),i}setViewFromBox(e,t){o.getViewParamsFromBox(e,t,this.aspect,this.up,this.fov,this),this.updateCameraMatrices()}updateCameraMatrices(){this.lookAt(this.target),this.updateProjectionMatrix(),this.updateMatrixWorld()}setView(e){if(e.position&&this.position.copy(e.position),e.target&&this.target.copy(e.target),e.up&&this.up.copy(e.up),void 0!==e.isPerspective&&(this.isPerspective=e.isPerspective),void 0!==e.orthoScale){this.orthoScale=e.orthoScale;const t=this.target.clone().sub(this.position);this.isPerspective||t.length()===this.orthoScale||(t.normalize().multiplyScalar(this.orthoScale),this.target.copy(t.add(this.position)))}this.updateCameraMatrices()}pixelsPerUnitAtDistance(e){if(!this.isPerspective)return this.clientHeight/this.orthoScale;const t=2*e*Math.tan(n.Math.degToRad(.5*this.fov));return this.clientHeight/t}UnifpixelsPerUnitAtPoint(e){const t=this.position.distanceTo(e);return this.pixelsPerUnitAtDistance(t)}setGlobalOffset(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i;(e!==this.position&&e!==this.target&&e!==this.pivot||(e=e.clone()),t)&&(this.position.add(this.globalOffset).sub(e),this.target.add(this.globalOffset).sub(e),null===(i=this.pivot)||void 0===i||i.add(this.globalOffset).sub(e));this.globalOffset.copy(e)}getGlobalPosition(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new n.Vector3).copy(this.position).add(this.globalOffset)}viewportToRay(e,t){e.z=-1;var i=new n.Vector3(e.x,e.y,1);return e=e.unproject(this),(i=i.unproject(this)).sub(e).normalize(),t||(t=new n.Ray),t.set(this.isPerspective?this.position:e,i),t}transformCurrentView(e){o.transformViewParams(this,e)}}o.ORTHO_FOV=2*Math.atan(.5)*180/Math.PI,o.getViewParamsFromBox=function(e,t,i,r,o,s){var a=s||{},l=e.getSize(new n.Vector3);if(a.target=e.getCenter(new n.Vector3),a.position||(a.position=new n.Vector3),a.up||(a.up=new n.Vector3),t){a.isPerspective=!1;var c=l.x/l.y,h=i;a.orthoScale=h>c?l.y:l.x/h,a.up.set(0,1,0),a.position.copy(a.target),a.position.z+=a.orthoScale,a.target.y+=1e-6*l.y}else a.isPerspective=!0,a.fov=o,a.up.copy(r),a.position.copy(a.target),a.position.z+=1.5*Math.max(l.x,l.y,l.z);return a},o.copyViewParams=function(e,t){return(t=t||{}).position=(t.position||new n.Vector3).copy(e.position),t.target=(t.target||new n.Vector3).copy(e.target),t.up=(t.up||new n.Vector3).copy(e.up),t.aspect=e.aspect,t.fov=e.fov,t.isPerspective=e.isPerspective,t.orthoScale=e.orthoScale,t},o.transformViewParams=function(e,t){var i;e.position.applyMatrix4(t),e.target.applyMatrix4(t),null===(i=e.pivot)||void 0===i||i.applyMatrix4(t),e.up.transformDirection(t)},o.adjustOrthoCamera=function(e,t){if(!e.isPerspective){var i=t.getSize(new n.Vector3),o=e.target.clone().sub(e.position),s=o.length();if(i>0&&s>1e3*i.length()){var a=e.position.distanceTo(t.getCenter(new n.Vector3));e.target.copy(e.position).add(o.normalize().multiplyScalar(a))}else{if(Math.abs(s-e.orthoScale)/s>1e-5)r.logger.warn("Ortho scale does not match eye-target distance. One of them is likely wrong, but which one?"),!(0===e.fov&&1===e.orthoScale)&&e.position.copy(e.target).add(o.normalize().multiplyScalar(-e.orthoScale))}}},o.prototype.isUnifiedCamera=!0},40723:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ViewingUtilities:()=>r});var n=i(72091);function r(e,t,i){this.autocam=t,this.viewerImpl=e,this.setGlobalManager(this.viewerImpl.globalManager);var r=i.getCamera(),o={},s={};var a=new function(e){var t=.6,i=0,r=new n.SphereGeometry(1),o=new n.MeshPhongMaterial({color:32512,opacity:t,transparent:!0}),s=new n.Mesh(r,o),a=e,l=1;a.createOverlayScene("pivot"),s.visible=!1,this.shown=function(){return s.visible},this.show=function(e,n,r){s.scale.x=n*l,s.scale.y=n*l,s.scale.z=n*l,s.position.set(e.x,e.y,e.z),o.opacity=t,s.visible=!0,a.addOverlay("pivot",s),a.invalidate(!1,!1,!0),i=r?Date.now()+500:0},this.hide=function(){s.visible&&(s.visible=!1,a.removeOverlay("pivot",s),a.invalidate(!1,!1,!0),i=0)},this.fade=function(){if(i>0){var e=i-Date.now();if(e<=0)return this.hide(),!0;var n=e/500*t;return o.opacity=n,!0}return!1},this.fading=function(){return i>0},this.setSize=function(e){l=e},this.setColor=function(e,i){o.color=new n.Color(e),void 0!==i&&(t=i,o.opacity=t)}}(this.viewerImpl);this.transitionView=function(e,n,o,s,a,l,c){a=a||i.getWorldUpVector();var h=l?function(e,t,i){var n=t.clone().sub(e);if(0===n.lengthSq())return n.copy(i);var r=n.clone().cross(i);return 0===r.lengthSq()&&(i.z>i.y?n.y-=1e-4:n.z-=1e-4,r.crossVectors(n,i)),r.cross(n).normalize()}(e,n,a):s;h||(h=r.up);var u={position:e,center:n,pivot:c=c||n,fov:o,up:h,worldUp:a,isOrtho:!1===r.isPerspective};t.goToView(u)},this.goHome=function(){this.viewerImpl.track({name:"navigation/home",aggregate:"count"}),t.goHome()},this.getHitPoint=function(e,t){var n=this.viewerImpl.hitTestViewport(i.screenToViewport(e,t),!1);return n?n.intersectPoint:null},this.activatePivot=function(e){if(this.viewerImpl.model&&!this.viewerImpl.model.is2d()){var t=r.isPerspective?i.getPivotPlaneDistance():i.getEyeVector().length(),o=i.getVerticalFov(),s=2*t*Math.tan(n.Math.degToRad(.5*o)),l=i.getScreenViewport(),c=this.getWindow().devicePixelRatio||1,h=5*s/(l.height*c);a.show(i.getPivotPoint(),h,e)}},this.pivotActive=function(e,t){t=t||!1,(e=e&&!i.getIs2D())||!a.shown()?e&&this.activatePivot(t):a.hide()},this.pivotUpdate=function(){a.shown()&&a.fade()&&this.viewerImpl.invalidate(!1,!1,!0)},this.setPivotPoint=function(e,t,n){i.setPivotPoint(e),t||i.setTarget(e),n&&i.setPivotSetFlag(!0),this.setTemporaryPivot(null),i.getIs2D()||a.shown()&&this.activatePivot(a.fading())},this.savePivot=function(e){e||(e="default"),o[e]=i.getPivotPoint(),s[e]=i.getPivotSetFlag()},this.restorePivot=function(e){if(e||(e="default"),o[e]){var t=s[e];this.setPivotPoint(o[e],!0,t),t||i.setPivotSetFlag(!1),delete o[e],delete s[e]}},this.setTemporaryPivot=function(e){if(e){var t=i.getPivotPoint(),n=i.getPivotSetFlag();this.setPivotPoint(e,!0,n),o.TEMP=t,s.TEMP=n}else delete o.TEMP,delete s.TEMP},this.removeTemporaryPivot=function(){this.restorePivot("TEMP")},this.setPivotSize=function(e){a.setSize(e)},this.setPivotColor=function(e,t){a.setColor(e,t)},this.getBoundingBox=function(e){return this.viewerImpl.getFitBounds(e)},this.fitToView=function(e){this.viewerImpl.track({name:"navigation/fit",aggregate:"count"}),this.viewerImpl.fitToView(this.viewerImpl.selector.getAggregateSelection(),e),this.activatePivot(!0)},this.update=function(){i.getRequestFitToView()&&!i.getTransitionActive()&&(i.setRequestFitToView(!1),this.fitToView()),i.getRequestHomeView()&&!i.getTransitionActive()&&(i.setRequestHomeView(!1),this.goHome());var e=i.getRequestTransition();return e&&!i.getTransitionActive()&&(i.setRequestTransition(!1),this.transitionView(e.position,e.coi,e.fov,e.up,e.worldUp,e.reorient,e.pivot)),!1}}i(26206).GlobalManagerMixin.call(r.prototype)},13843:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MultiModelVisibilityManager:()=>s,VisibilityManager:()=>o});var n=i(83081),r=i(19556);function o(e,t){this.viewerImpl=e,this.model=t,this.isolatedNodes=new Set,this.hiddenNodes=new Set}function s(e){this.viewerImpl=e,this.models=[]}o.prototype.getInstanceTree=function(){return this.model?this.model.getData().instanceTree:null},o.prototype.getIsolatedNodes=function(){return Array.from(this.isolatedNodes)},o.prototype.getHiddenNodes=function(){return Array.from(this.hiddenNodes)},o.prototype.setAllVisibility=function(e){var t=this.model?this.model.getRootId():null;t&&this.setVisibilityOnNode(t,e),this.model.getData().is2d&&this.model.setAllVisibility(e)},o.prototype.isNodeVisible=function(e){var t=this.getInstanceTree();return t?!t.isNodeHidden(e):!this.hiddenNodes.has(e)&&(this.isolatedNodes.size||!this.isolatedNodes.has(e))},o.prototype.isolate=function(e){var t=this.getInstanceTree(),i=t?t.getRootId():null,n="number"==typeof e&&e===i||"object"==typeof e&&e.dbId===i;e&&!n?this.isolateMultiple(Array.isArray(e)?e:[e]):this.isolateNone()},o.prototype.isolateNone=function(){this.model.setAllVisibility(!0),this.viewerImpl.sceneUpdated(!0),this.setAllVisibility(!0),this.hiddenNodes=new Set,this.isolatedNodes=new Set,this.viewerImpl.invalidate(!0)},o.prototype.isolateMultiple=function(e){if(e&&0!=e.length){this.model.getData().is2d||(this.model.setAllVisibility(!1),this.viewerImpl.sceneUpdated(!0)),this.setAllVisibility(!1),this.isolatedNodes=new Set(e),this.hiddenNodes=new Set;const i=e.length-1;for(var t=0;t<e.length;t++)this.setVisibilityOnNode(e[t],!0,t!==i)}else this.isolateNone();this.viewerImpl.invalidate(!0)},o.prototype.hide=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i;if(Array.isArray(e)){const t=e.length-1;for(var n=0;n<e.length;++n)this.setVisibilityOnNode(e[n],!1,n!==t);e.length>0&&(i={type:r.HIDE_EVENT,nodeIdArray:e,model:this.model})}else this.setVisibilityOnNode(e,!1),i={type:r.HIDE_EVENT,nodeIdArray:[e],model:this.model};i&&t&&this.viewerImpl.api.dispatchEvent(i)},o.prototype.show=function(e){var t;if(Array.isArray(e)){const n=e.length-1;for(var i=0;i<e.length;++i)this.setVisibilityOnNode(e[i],!0,i!==n);e.length>0&&(t={type:r.SHOW_EVENT,nodeIdArray:e,model:this.model})}else this.setVisibilityOnNode(e,!0),t={type:r.SHOW_EVENT,nodeIdArray:[e],model:this.model};t&&this.viewerImpl.api.dispatchEvent(t)},o.prototype.toggleVisibility=function(e){var t=this.getInstanceTree();if(t){var i=t.isNodeHidden(e);this.setVisibilityOnNode(e,i);var n={type:i?r.SHOW_EVENT:r.HIDE_EVENT,nodeIdArray:[e],model:this.model};this.viewerImpl.api.dispatchEvent(n)}},o.prototype.setVisibilityOnNode=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];var r,o=this.viewerImpl,s=this.model,a=this.getInstanceTree(),l=!t,c=s.getData().is2d;a?a.enumNodeChildren(e,(function(e){var i=a.isNodeVisibleLocked(e);if(a.setNodeHidden(e,l&&!i),c){var n=s.reverseMapDbIdFor2D(e);s.getFragmentList().setObject2DGhosted(n,!t&&!i)}else a.enumNodeFragments(e,(function(e){s.setVisibility(e,t||i)}),!1)}),n):c?s.isLeaflet()?s.setVisibility(null,t):null===(r=s.getFragmentList())||void 0===r||r.setObject2DGhosted(e,!t):s.setVisibility(e,t);o.sceneUpdated(!0,!1,i),this.updateNodeVisibilityTracking(e,t)},o.prototype.updateNodeVisibilityTracking=function(e,t){this.isolatedNodes.size>0?t?this.isolatedNodes.add(e):t||(this.isolatedNodes.delete(e),0===this.isolatedNodes.size&&(this.hiddenNodes=new Set([this.model.getRootId()]))):t?t&&this.hiddenNodes.delete(e):this.hiddenNodes.add(e);var i=this.getInstanceTree();i&&i.root&&i.root.dbId===e&&(t?(this.isolatedNodes=new Set,this.hiddenNodes=new Set):(this.isolatedNodes=new Set,this.hiddenNodes=new Set([e])))},o.prototype.toggleNodeVisibleLocked=function(e){var t=this.getInstanceTree().isNodeVisbileLocked(e);this.lockNodeVisible(e,!t)},o.prototype.lockNodeVisible=function(e,t){var i=this.viewerImpl,n=this.model,r=this.getInstanceTree(),o=n.getData().is2d;if(r){var s=e=>{r.enumNodeChildren(e,(function(e){if(r.lockNodeVisible(e,t),t)if(r.setNodeHidden(e,!1),o){var i=n.reverseMapDbIdFor2D(e);n.getFragmentList().setObject2DGhosted(i,!1)}else r.enumNodeFragments(e,(function(e){n.setVisibility(e,!0)}),!1)}),!0),t&&(i.sceneUpdated(!0),this.updateNodeVisibilityTracking(e,t))};Array.isArray(e)?e.forEach(s):s(e)}},o.prototype.isNodeVisibleLocked=function(e){var t=this.getInstanceTree();return t&&t.isNodeVisibleLocked(e)},o.prototype.setNodeOff=function(e,t,i,n){var r=this.viewerImpl,o=this.model,s=this.getInstanceTree(),a=o.getData().is2d;if(!s)return a?o.getFragmentList().setObject2DVisible(e,!t):o.getFragmentList().setFragOff(e,t),void r.sceneUpdated(!0);if(i&&n){let e,r;if(a)for(let n=0;n<i.length;++n){e=i[n],s.setNodeOff(e,t);var l=o.reverseMapDbIdFor2D(e);o.getFragmentList().setObject2DVisible(l,!t)}else{for(let n=0;n<i.length;++n)e=i[n],s.setNodeOff(e,t);for(let e=0;e<n.length;++e)r=n[e],o.getFragmentList().setFragOff(r,t)}}else s.enumNodeChildren(e,(function(e){if(s.setNodeOff(e,t),a){var i=o.reverseMapDbIdFor2D(e);o.getFragmentList().setObject2DVisible(i,!t)}else s.enumNodeFragments(e,(function(e){o.getFragmentList().setFragOff(e,t)}),!1)}),!0);r.sceneUpdated(!0)},s.prototype.addModel=function(e){-1==this.models.indexOf(e)&&(e.visibilityManager=new o(this.viewerImpl,e),this.models.push(e))},s.prototype.removeModel=function(e){var t=this.models.indexOf(e);e.visibilityManager.isolateNone(),e.visibilityManager=null,this.models.splice(t,1)},s.prototype.warn=function(){this.models.length>1&&n.logger.warn("This selection call does not yet support multiple models.")},s.prototype.getAggregateIsolatedNodes=function(){for(var e=[],t=this.models,i=0;i<t.length;i++){var n=t[i].visibilityManager.getIsolatedNodes();n&&n.length&&e.push({model:t[i],ids:n})}return e},s.prototype.getIsolatedNodes=function(e){return e||(this.warn(),e=this.models[0]),e.visibilityManager.getIsolatedNodes()},s.prototype.getAggregateHiddenNodes=function(){for(var e=[],t=this.models,i=0;i<t.length;i++){var n=t[i].visibilityManager.getHiddenNodes();n&&n.length&&e.push({model:t[i],ids:n})}return e},s.prototype.getHiddenNodes=function(e){return e||(this.warn(),e=this.models[0]),e.visibilityManager.getHiddenNodes()},s.prototype.isNodeVisible=function(e,t){return e||(this.warn(),e=this.models[0]),e.visibilityManager.isNodeVisible(t)},s.prototype.isolate=function(e,t){t||(this.warn(),t=this.models[0]),this.aggregateIsolate([{model:t,ids:e}],{hideLoadedModels:!1})},s.prototype.aggregateIsolate=function(e,t){if(e&&0!==e.length){const i=void 0===(null==t?void 0:t.hideLoadedModels)||t.hideLoadedModels;for(let t of this.models){const n=e.find((e=>e.model==t));if(n){let e=n.ids||n.selection;"number"==typeof e&&(e=[e]),t.visibilityManager.isolate(e)}else i&&t.visibilityManager.setAllVisibility(!1)}}else for(let e of this.models)e.visibilityManager.isolateNone();!function(e){var t=e.getAggregateIsolatedNodes();if(1===e.models.length){var i={type:r.ISOLATE_EVENT,nodeIdArray:t.length?t[0].ids:[],model:e.models[0]};e.viewerImpl.api.dispatchEvent(i)}i={type:r.AGGREGATE_ISOLATION_CHANGED_EVENT,isolation:t};e.viewerImpl.api.dispatchEvent(i)}(this)},s.prototype.hide=function(e,t){t||(this.warn(),t=this.models[0]),t.visibilityManager.hide(e)},s.prototype.aggregateHide=function(e){if(e&&0!==e.length){for(var t=0;t<e.length;++t){var i=e[t].model,n=e[t].ids||e[t].selection;i.visibilityManager.hide(n,1===this.models.length)}var o=this.getAggregateHiddenNodes(),s={type:r.AGGREGATE_HIDDEN_CHANGED_EVENT,hidden:o};this.viewerImpl.api.dispatchEvent(s)}},s.prototype.show=function(e,t){t||(this.warn(),t=this.models[0]),t.visibilityManager.show(e)},s.prototype.toggleVisibility=function(e,t){t||(this.warn(),t=this.models[0]),t.visibilityManager.toggleVisibility(e)},s.prototype.setVisibilityOnNode=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];i||(this.warn(),i=this.models[0]),i.visibilityManager.setVisibilityOnNode(e,t,n,r)},s.prototype.toggleVisibleLocked=function(e,t){t||(this.warn(),t=this.models[0]),t.visibilityManager.toggleVisibleLocked(e)},s.prototype.lockNodeVisible=function(e,t,i){i||(this.warn(),i=this.models[0]),i.visibilityManager.lockNodeVisible(e,t)},s.prototype.isNodeVisibleLocked=function(e,t){return t||(this.warn(),t=this.models[0]),t.visibilityManager.isNodeVisibleLocked(e,t)},s.prototype.setNodeOff=function(e,t,i,n,r){i||(this.warn(),i=this.models[0]),i.visibilityManager.setNodeOff(e,t,n,r)}},60687:(e,t,i)=>{"use strict";i.r(t),i.d(t,{WorldUpTool:()=>o});var n=i(72091),r=i(19556);function o(e,t){var i,o=t.navigation,s=o.getCamera(),a=["worldup"],l=this,c=(i=new n.Vector3,function(e,t,r,o){var s=new n.Vector3(e,t,r),a=o.dot(s);return i.copy(o),i.multiplyScalar(a),s.sub(i)});var h=2*Math.PI,u=.001,d=1e-5,f=!1,p=!1,m=!1,g=new function(e,t){var i=2*Math.tan(n.Math.degToRad(15)),r=new n.MeshPhongMaterial({color:12303291,opacity:.5,transparent:!0,depthTest:!1,depthWrite:!1}),s=new n.Vector3,a=new n.Vector3,l=new n.Quaternion,u=new n.PerspectiveCamera(30,t.aspect,t.near,t.far),f=t,p=1,m=1,g=null,v=null,y=null,b=null,x=null,_=null,E=null,S=null,A=null,w=new Array(6),T=0,M=!1,C=!0,P=0,D=5*Math.PI/180,L=7*Math.PI/180,I=1,R=1e3,O=.1;function N(e,t){var i=Math.abs(e-t);return i>h?i:Math.min(h-i,i)}function F(e,t){var i=V(e);return i.distanceToSquared(t)<d||(a.set(-t.x,-t.y,-t.z),i.distanceToSquared(a)<d)}function U(e){return e>h?e:e<=0?e+Math.PI:e-Math.PI}function B(e,t,i){var n,r=e.clone().normalize(),o=new Array(3),s=new Array(6);o[0]=c(1,0,0,r),o[1]=c(0,1,0,r),o[2]=c(0,0,1,r);var h=t.clone().cross(r).normalize();for(n=0;n<3;++n){var u=o[n];s[n]=u.length(),s[n]<O?w[n]=R:(u.multiplyScalar(1/s[n]),w[n]=Math.atan2(h.dot(u),t.dot(u)))}for(w[3]=U(w[0]),w[4]=U(w[1]),w[5]=U(w[2]),s[3]=s[0],s[4]=s[1],s[5]=s[2],function(e,t){for(var i=D+L+2*Math.PI/180,n=0;n<6;++n)if(w[n]!==R)for(var r=n+1;r<6;++r)if(w[r]!==R&&N(w[n],w[r])<i){if(e[n]<e[r]&&!F(n,t)||F(r,t)){w[n]=R;break}w[r]=R}}(s,i),n=0;n<6;++n)if(w[n]!==R){var d=a.set(0,0,1);l.setFromAxisAngle(d,w[n]);var f=a.set(0,.54,0);f.applyQuaternion(l),S[n].position.copy(f),S[n].visible=!0}else S[n].visible=!1}function k(e,t,i,s,a){return _||(_=function(){_=new n.Object3D;var e=new n.RingGeometry(.5-.01*p,.5,60),t=new n.Mesh(e,r);v=t;var i=.007*p,o=new n.BoxGeometry(.93,i,i),s=new n.BoxGeometry(i,.93,i),a=new n.BoxGeometry(i,i,.93);y=new n.Mesh(o,r),b=new n.Mesh(s,r),x=new n.Mesh(a,r),_.add(y),_.add(b),_.add(x),E=new n.Mesh(new n.CircleGeometry(.005),r),_.add(E),S=new Array(6),A=new Array(6);for(var l=0;l<6;++l){var c=.005*p,h=.0025*p;S[l]=new n.Mesh(new n.CircleGeometry(c,16),r),A[l]=new n.Mesh(new n.CircleGeometry(h,16),r),A[l].visible=!1,S[l].add(A[l]),t.add(S[l])}return _.add(t),_}()),o.orient(v,t,u.position,s),B(i,a,s),_.scale.x=e,_.scale.y=e,_.scale.z=e,_.position.copy(t),_}function V(e){if(s.set(0,0,0),e>=0){var t=e>=3?-1:1;0===(e%=3)&&(s.x=t),1===e&&(s.y=t),2===e&&(s.z=t)}return M&&s.multiplyScalar(-1),s}function G(e,t){for(var i=N(w[0],e),n=0,r=1;r<6;++r){var o=N(w[r],e);o<i&&(i=o,n=r)}return i,i<t?n:-1}function z(e){o.setWorldUpVector(e,!0)}function H(e){if(0!==e){var t=30*Math.PI/180,i=a.copy(u.position).sub(g).normalize();l.setFromAxisAngle(i,e);var n=o.getWorldUpVector(),r=Math.abs(i.angleTo(n));(r<t||Math.PI-r<t)&&n.copy(o.getCameraUpVector()),n.applyQuaternion(l),z(n)}}function W(e,t,i,n){return e<t&&V(i).distanceToSquared(n)<d}function j(e,t){e.dot(t)<0&&(t=t.clone().multiplyScalar(-1)),o.orient(E,g,u.position,t),E.position.copy(t.multiplyScalar(.495));for(var i=!1,n=C?L:D,r=0;r<6;++r){var s=N(w[r],T),a=W(s,n,r,e);a&&(i=!0);var l=a?4:3*(1-3*s/Math.PI);l<1&&(l=1),l*=p,A[r].visible=a;var c=S[r];c.scale.x=l,c.scale.y=l,c.scale.z=l}return y.visible=i,b.visible=i,x.visible=i,i}function q(e){(T+=e)>Math.PI?T-=h:T<=-Math.PI&&(T=h+T);var t=function(){if(!C){var e=G(T,D);if(e>=0)return 0,C=!0,T=w[e],V(e)}return!1}();if(t)P=T,z(t);else if(function(){if(C){if(G(T,L)<0)return C=!1,!0;0}return!1}()){H(T-P),P=0}else{if(C)return!1;H(e)}return!0}e.createOverlayScene("roll",null,null,u),this.updateRollCamera=function(e,t){u.position.copy(f.position),u.quaternion.copy(f.quaternion),u.up.copy(f.up),u.aspect=f.aspect,e&&t&&(u.near=t-e,u.far=t+e),u.updateProjectionMatrix()},this.isSnapped=function(){return C},this.resize=function(){var e=I*i,t=e*f.aspect,n=(f.aspect<1?t:e)*m;_.scale.x=n,_.scale.y=n,_.scale.z=n},this.start=function(t,i){this.updateHUD(t,i),e.addOverlay("roll",_)},this.updateHUD=function(e,t){g=e,t<.35?t=.35:t>.8&&(t=.8),m=t,p=.8/t;var n=s.copy(e).sub(f.position),r=(I=n.length())*i,a=r*f.aspect,l=(f.aspect<1?a:r)*t;this.updateRollCamera(l,I);var c=o.getWorldUpVector(),h=o.getCameraUpVector();k(l,e,n,c,h),T=0,P=0;var u=c.dot(h);M=u<0,C=j(c,h)},this.handleRoll=function(e,t,i){if(this.updateRollCamera(),j(o.getWorldUpVector(),o.getCameraUpVector()),0!==e||0!==t){var n=i.x-e-.5,r=i.y-t-.5,s=i.x-.5,a=i.y-.5;return q(Math.atan2(a,s)-Math.atan2(r,n))}return!1},this.handleRollTouch=function(e){this.updateRollCamera(),j(o.getWorldUpVector(),o.getCameraUpVector());var t=e-T;return Math.abs(t)>.001&&q(t)},this.end=function(){e.removeOverlay("roll",_)}}(e,s),v=new n.Vector3,y=new n.Vector3,b=new n.Vector3,x=null,_=0;this.getNames=function(){return a},this.getName=function(){return a[0]},this.activate=function(e){t.addEventListener(r.CAMERA_CHANGE_EVENT,this.handleCameraChange),m=!1},this.deactivate=function(e){g.end(),t.removeEventListener(r.CAMERA_CHANGE_EVENT,this.handleCameraChange),this.utilities.restorePivot(),x=null,f=!1,m=!1},this.getCursor=function(){return"auto"},this.getMotionDelta=function(e){var t=y.x-v.x,i=y.y-v.y,n=y.z-v.z;Math.abs(t)<u&&(t=0),Math.abs(i)<u&&(i=0),Math.abs(n)<u&&(n=0),e.set(t,i,n)},this.stepMotionDelta=function(){v.copy(y)},this.update=function(){if(!m){var e=o.getEyeVector(),t=.5*(s.near+s.far);e.normalize().multiplyScalar(t);var i=e.add(s.position);this.utilities.savePivot(),this.utilities.setPivotPoint(i,!0,!0),this.utilities.pivotActive(!0);g.start(i,.65),m=!0}var n=p;this.getMotionDelta(b);var r=b.x,a=b.y,l=b.z;return(p||"roll"===x||f&&(0!==r||0!==a||0!==l))&&(p="roll"===x?g.handleRollTouch(_):g.handleRoll(r,a,y)),this.stepMotionDelta(),s.dirty&&(n=!0),n},this.handleResize=function(){g.resize(),p=!0},this.handleGesture=function(e){switch(e.type){case"dragstart":return x="drag",this.handleButtonDown(e,0);case"dragmove":return this.handleMouseMove(e);case"dragend":return x=null,this.handleButtonUp(e,0);case"rotatestart":return t.removeEventListener(r.CAMERA_CHANGE_EVENT,this.handleCameraChange),x="roll",_=n.Math.degToRad(e.rotation),{x:.5*(e.normalizedX+1),y:1-.5*(e.normalizedY+1)},function(e){var t=e.pointers[1].clientX-e.pointers[0].clientX,i=e.pointers[1].clientY-e.pointers[0].clientY,n=Math.sqrt(t*t+i*i),r=o.getScreenViewport();return n/Math.min(r.width,r.height)}(e),!0;case"rotatemove":return _=n.Math.degToRad(e.rotation),"roll"===x;case"rotateend":return t.addEventListener(r.CAMERA_CHANGE_EVENT,this.handleCameraChange),_=n.Math.degToRad(e.rotation),x=null,!1}return!1},this.handleWheelInput=function(e){return!0},this.handleCameraChange=function(){var e=o.getEyeVector(),t=.5*(s.near+s.far);e.normalize().multiplyScalar(t);var i=e.add(s.position);g.updateHUD(i,.65)},this.handleButtonDown=function(e,i){return v.x=.5*(e.normalizedX+1),v.y=1-.5*(e.normalizedY+1),y.copy(v),f=!0,x=null,this.controller.setIsLocked(!0),t.removeEventListener(r.CAMERA_CHANGE_EVENT,l.handleCameraChange),!0},this.handleButtonUp=function(e,i){return y.x=.5*(e.normalizedX+1),y.y=1-.5*(e.normalizedY+1),f=!1,p=!0,this.controller.setIsLocked(!1),t.addEventListener(r.CAMERA_CHANGE_EVENT,l.handleCameraChange),!0},this.handleMouseMove=function(e){return y.x=.5*(e.normalizedX+1),y.y=1-.5*(e.normalizedY+1),!0},this.handleBlur=function(e){return f=!1,x=null,!1}}},43719:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Autocam:()=>h});var n=i(72091),r=i(38842),o=i(26206),s=i(35922);const a=Number.MIN_VALUE||3e-308,l=1e-5;function c(e){const t=1e-12;Math.abs(e.x)<t&&Math.abs(e.y)<t?e.set(0,0,e.z>0?1:-1):Math.abs(e.y)<t&&Math.abs(e.z)<t?e.set(e.x>0?1:-1,0,0):Math.abs(e.z)<t&&Math.abs(e.x)<t&&e.set(0,e.y>0?1:-1,0)}function h(e,t,i){var o=this,h=null,u=!1;this.cube=null,this.camera=e,this.renderer="WEBGL",this.startState={},this.navApi=t,this.orthographicFaces=!1,this.canvas=i,this.cameraChangedCallback=function(){},this.pivotDisplayCallback=function(){},this.transitionCompletedCallback=function(){};var d,f=Date.now(),p=!1;function m(t){u=!0,e.target.copy(o.center),e.pivot.copy(o.pivot),e.worldup?e.worldup.copy(o.sceneUpDirection):e.up.copy(o.sceneUpDirection),o.cameraChangedCallback(t),u=!1}function g(e,t){e.position.copy(e.globalPosition).sub(t),e.center.copy(e.globalCenter).sub(t),e.pivot.copy(e.globalPivot).sub(t)}this.recordTime=!0,this.dtor=function(){this.cube=null,this.cameraChangedCallback=null,this.pivotDisplayCallback=null,this.transitionCompletedCallback=null,this.canvas=null,this.recordTime=!1,this.afAnimateTransition&&cancelAnimationFrame(this.afAnimateTransition)},this.registerCallbackCameraChanged=function(e){this.cameraChangedCallback=e},this.registerCallbackPivotDisplay=function(e){this.pivotDisplayCallback=e},this.registerCallbackTransitionCompleted=function(e){this.transitionCompletedCallback=e},this.showPivot=function(e){this.pivotDisplayCallback(e)},this.setWorldUpVector=function(e){u||e&&e.lengthSq()>0&&!e.normalize().equals(this.sceneUpDirection)&&(this.sceneUpDirection.copy(e),this.sceneFrontDirection.copy(this.getWorldFrontVector()),this.cubeFront.copy(this.sceneFrontDirection).cross(this.sceneUpDirection).normalize(),this.cube&&requestAnimationFrame(this.cube.render))},this.getWorldUpVector=function(){return this.sceneUpDirection.clone()},this.getWorldRightVector=function(){var e=this.sceneUpDirection.clone();return Math.abs(e.z)<=Math.abs(e.y)?e.set(e.y,-e.x,0):e.z>=0?e.set(e.z,0,-e.x):e.set(-e.z,0,e.x),e.normalize()},this.getWorldFrontVector=function(){return this.getWorldUpVector().cross(this.getWorldRightVector()).normalize()},this.goToView=function(e){if(this.navApi.isActionEnabled("gotoview")){var t={position:e.position.clone(),up:e.up.clone(),center:e.center.clone(),pivot:e.pivot.clone(),fov:e.fov,worldUp:e.worldUp.clone(),isOrtho:e.isOrtho};this.addGlobalPositions(t),o.elapsedTime=0,this.animateTransition(t)}},this.getCurrentView=function(){return{position:e.position.clone(),up:e.up.clone(),center:this.center.clone(),pivot:this.pivot.clone(),fov:e.fov,worldUp:this.sceneUpDirection.clone(),isOrtho:!1===e.isPerspective}},this.setCurrentViewAsHome=function(e){e?(this.navApi.setRequestFitToView(!0),p=!0):this.homeVector=this.getCurrentView()},this.setHomeViewFrom=function(e){var t=e.pivot?e.pivot:this.center,i=e.target?e.target:this.pivot,n=e.worldup?e.worldup:this.sceneUpDirection;this.homeVector={position:e.position.clone(),up:e.up.clone(),center:i.clone(),pivot:t.clone(),fov:e.fov,worldUp:n.clone(),isOrtho:!1===e.isPerspective},this.originalHomeVector={position:e.position.clone(),up:e.up.clone(),center:i.clone(),pivot:t.clone(),fov:e.fov,worldUp:n.clone(),worldFront:this.sceneFrontDirection.clone(),isOrtho:!1===e.isPerspective},this.addGlobalPositions(this.homeVector),this.addGlobalPositions(this.originalHomeVector)},this.toPerspective=function(){e.isPerspective||(e.toPerspective(),m(!1))},this.toOrthographic=function(){e.isPerspective&&(e.toOrthographic(),m(!1))},this.setOrthographicFaces=function(e){this.orthographicFaces=e},this.getViewType=function(){return this.orthographicFaces?s.VIEW_TYPES.PERSPECTIVE_ORTHO_FACES:e.isPerspective?s.VIEW_TYPES.PERSPECTIVE:s.VIEW_TYPES.ORTHOGRAPHIC},this.setViewType=function(e,t){switch(e){case s.VIEW_TYPES.ORTHOGRAPHIC:return this.setOrthographicFaces(!1),this.toOrthographic(),!0;case s.VIEW_TYPES.PERSPECTIVE:return this.setOrthographicFaces(!1),this.toPerspective(),!0;case s.VIEW_TYPES.PERSPECTIVE_ORTHO_FACES:return this.setOrthographicFaces(!0),void 0===t&&(t=this.isFaceView()),t?this.toOrthographic():this.toPerspective(),!0;default:return!1}},this.goHome=function(){this.navApi.isActionEnabled("gotoview")&&(this.navApi.setPivotSetFlag(!1),this.goToView(this.homeVector))},this.resetHome=function(){this.homeVector.position.copy(this.originalHomeVector.position),this.homeVector.up.copy(this.originalHomeVector.up),this.homeVector.center.copy(this.originalHomeVector.center),this.homeVector.pivot.copy(this.originalHomeVector.pivot),this.homeVector.fov=this.originalHomeVector.fov,this.homeVector.worldUp.copy(this.originalHomeVector.worldUp),this.homeVector.isOrtho=this.originalHomeVector.isOrtho,this.goHome()},this.getView=function(){return this.center.clone().sub(e.position)},this.setCameraUp=function(t){var i=this.dir.clone(),n=i.cross(t).normalize();0===n.lengthSq()&&(i.copy(this.dir),t.z>t.y?i.y+=1e-4:i.z+=1e-4,n=i.cross(t).normalize()),e.up.copy(n).cross(this.dir).normalize()},this.addGlobalPositions=function(e){var t=this.camera.globalOffset;e.globalPosition=e.position.clone().add(t),e.globalCenter=e.center.clone().add(t),e.globalPivot=e.pivot.clone().add(t)},this.onGlobalOffsetChanged=function(e){g(this.homeVector,e),g(this.originalHomeVector,e),this.camera.setGlobalOffset(e)};var v,b,_,E,S=this;!function e(){S.recordTime&&requestAnimationFrame(e);var t=Date.now();d=t-f,f=t}(),this.ortho=!1,this.center=e.target?e.target.clone():new n.Vector3(0,0,0),this.pivot=e.pivot?e.pivot.clone():this.center.clone(),this.sceneUpDirection=e.worldup?e.worldup.clone():e.up.clone(),this.sceneFrontDirection=this.getWorldFrontVector(),this.dir=this.getView(),this.setCameraUp(e.up),this.saveCenter=this.center.clone(),this.savePivot=this.pivot.clone(),this.saveEye=e.position.clone(),this.saveUp=e.up.clone(),this.cubeFront=this.sceneFrontDirection.clone().cross(this.sceneUpDirection).normalize(),this.setHomeViewFrom(e);var A,w,T=new n.Quaternion,M=new n.Quaternion,C=new n.Quaternion,P=new n.Quaternion;this.userPanSpeed=.5,this.userLookSpeed=2,this.userHeightSpeed=5,this.walkMultiplier=1,this.userZoomSpeed=1.015,this.orbitMultiplier=5,this.currentlyAnimating=!1,e.keepSceneUpright=!0,this.preserveOrbitUpDirection=!0,this.alignOrbitUpDirection=!0,this.constrainOrbitHorizontal=!1,this.constrainOrbitVertical=!1,this.doCustomOrbit=!1,this.snapOrbitDeadZone=.045,this.snapOrbitThresholdH=this.snapOrbitThresholdV=n.Math.degToRad(15),this.snapOrbitAccelerationAX=this.snapOrbitAccelerationAY=1.5,this.snapOrbitAccelerationBX=this.snapOrbitAccelerationBY=2,this.snapOrbitAccelerationPointX=this.snapOrbitAccelerationPointY=.5,this.combined=!1,this.useSnap=!1,this.lockDeltaX=0,this.lockedX=!1,this.lastSnapRotateX=0,this.lockDeltaY=0,this.lockedY=!1,this.lastSnapRotateY=0,this.lastSnapDir=new n.Vector3(0,0,0),this.topLimit=!1,this.bottomLimit=!1,this.minSceneBound=0,this.maxSceneBound=0;var D,L,I={destinationPercent:1,duration:1,zoomToFitScene:!0,useOffAxis:!1};this.shotParams=I,this.zoomDelta=new n.Vector2;var R;function O(e,t,i){if(e<=t)return 0;if(e>=i)return 1;var n=(e-t)/(i-t);return.5*(Math.sin((n-.5)*Math.PI)+1)}function N(e){return Math.round(10*e)/10}function F(e,t){var i=new n.Vector2(0,0),r=o.getWindow();return i.x=e/r.innerWidth,i.y=t/r.innerHeight,i}function U(e,t,i){var n,r,s,a;n=r=s=a=0;var l=0,c=null,h=null,u=o.snapOrbitDeadZone,d=o.orbitMultiplier;return"h"==e?(n=o.snapOrbitThresholdH,r=o.snapOrbitAccelerationAX,s=o.snapOrbitAccelerationBX,a=1-o.snapOrbitAccelerationPointX,h=o.lockDeltaX,c=o.lockedX):(n=o.snapOrbitThresholdV,r=o.snapOrbitAccelerationAY,s=o.snapOrbitAccelerationBY,a=1-o.snapOrbitAccelerationPointY,h=o.lockDeltaY,c=o.lockedY),c?(h+=i)<-u?(l=(h+u)*d*1/s,c=!1):h>u&&(l=(h-u)*d*1/s,c=!1):(l=Math.abs(t)>n?i*d:Math.abs(t)>a*n?i*t>0?i*d*r:i*d*1/r:i*t>0?i*d*s:i*d*1/s)*t>0&&Math.abs(l)>Math.abs(t)&&(this.lockDeltaX=this.lockDeltaY=0,c=!0,l=t),l}function B(){return o.combined}function k(e,t){var i=!1,n=o.getWindow(),r=n.innerWidth,s=e.x%r,a=n.innerHeight,l=e.y%a,c=s>0?s-t.x:r+s-t.x,h=l>0?l-t.y:a+l-t.y;return Math.abs(c)<30&&Math.abs(h)<30&&(i=!0),i}function V(e,t,i){var r=o.getWindow();if(!R||!e){if(e){var s=new n.Vector2,a=t.x,l=t.y;!function(e,t,i){var n=o.getWindow();i.x=(e.x-t.x)/n.innerWidth,e.x=t.x+(e.x-t.x)%n.innerWidth,i.y=(e.y-t.y)/n.innerHeight,e.y=t.y+(e.y-t.y)%n.innerHeight}(t,i,s),r.innerWidth*s.x,r.innerHeight*s.y,a<i.x?a-=60:a+=60,l<i.y?l-=60:l+=60}R=e}}function G(e){var t=Math.pow(e,2);e<0&&(t=-t);var i=F(0,t),n=.01*(o.maxSceneBound-o.minSceneBound);i.y*=n;var r=o.userHeightSpeed*i.y;return r=function(e,t,i){if(0===t)return 0;var n=e,r=o.saveEye.clone().sub(worldUp.clone().multiplyScalar(i+n)),s=o.saveEye.clone().sub(worldUp.clone().multiplyScalar(i)),a=0,l=(o.maxSceneBound-o.minSceneBound)/1e3;o.topLimit&&t>0?(a=o.maxSceneBound-l,o.topLimit=!1):o.bottomLimit&&t<0?(a=o.minSceneBound+l,o.bottomLimit=!1):a=r.dot(worldUp);var c=s.dot(worldUp);return a<o.minSceneBound?c<o.minSceneBound&&(o.bottomLimit=!0,n=0):a>o.maxSceneBound&&c>o.maxSceneBound&&(o.topLimit=!0,n=0),n}(r,e,o.m_amount),r}function z(e){var t=o.sceneFrontDirection.clone().cross(o.sceneUpDirection),i=Math.abs(Math.abs(e.dot(o.sceneUpDirection))-1),n=Math.abs(Math.abs(e.dot(o.sceneFrontDirection))-1),r=Math.abs(Math.abs(e.dot(t))-1);return i<l||n<l||r<l}this.viewCubeMenuOpen=!1,this.menuSize=new n.Vector2(0,0),this.menuOrigin=new n.Vector2(0,0),e.lookAt(this.center),this.setCube=function(e){this.cube=e},this.sync=function(t){t.isPerspective!==e.isPerspective&&(t.isPerspective?e.toPerspective():(e.toOrthographic(),t.saveFov&&(e.saveFov=t.saveFov))),e.fov=t.fov,e.position.copy(t.position),t.target&&(this.center.copy(t.target),e.target.copy(t.target)),t.pivot&&(this.pivot.copy(t.pivot),e.pivot.copy(t.pivot)),this.dir.copy(this.center).sub(e.position),this.setCameraUp(t.up);var i=t.worldup?t.worldup:t.up;i.distanceToSquared(this.sceneUpDirection)>1e-4&&this.setWorldUpVector(i),p&&!this.navApi.getTransitionActive()&&(p=!1,this.setCurrentViewAsHome(!1)),this.cube&&requestAnimationFrame(this.cube.render)},this.refresh=function(){this.cube&&this.cube.refreshCube()},n.Matrix3.prototype.makeRotationFromQuaternion=function(e){var t=this.elements,i=e.x,n=e.y,r=e.z,o=e.w,s=i+i,a=n+n,l=r+r,c=i*s,h=i*a,u=i*l,d=n*a,f=n*l,p=r*l,m=o*s,g=o*a,v=o*l;return t[0]=1-(d+p),t[3]=h-v,t[6]=u+g,t[1]=h+v,t[4]=1-(c+p),t[7]=f-m,t[2]=u-g,t[5]=f+m,t[8]=1-(c+d),this},n.Quaternion.prototype.setFromRotationMatrix3=function(e){var t,i=e.elements,n=i[0],r=i[3],o=i[6],s=i[1],a=i[4],l=i[7],c=i[2],h=i[5],u=i[8],d=n+a+u;return d>0?(t=.5/Math.sqrt(d+1),this.w=.25/t,this.x=(h-l)*t,this.y=(o-c)*t,this.z=(s-r)*t):n>a&&n>u?(t=2*Math.sqrt(1+n-a-u),this.w=(h-l)/t,this.x=.25*t,this.y=(r+s)/t,this.z=(o+c)/t):a>u?(t=2*Math.sqrt(1+a-n-u),this.w=(o-c)/t,this.x=(r+s)/t,this.y=.25*t,this.z=(l+h)/t):(t=2*Math.sqrt(1+u-n-a),this.w=(s-r)/t,this.x=(o+c)/t,this.y=(l+h)/t,this.z=.25*t),this},n.Quaternion.prototype.rotate=function(e){var t=(new n.Matrix4).makeRotationFromQuaternion(this).elements,i=(new n.Matrix3).set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]);return e.applyMatrix3(i)},this.animateTransition=function(t){if(g(t,e.globalOffset),t){var i=!1,n=0;if(this.setCameraOrtho(t.isOrtho),o.elapsedTime>=I.duration)return n=1,o.center.copy(t.center),o.pivot.copy(t.pivot),e.position.copy(t.position),e.up.copy(t.up),e.target.copy(t.center),t.isOrtho||(e.fov=t.fov),e.dirty=!0,(i=!t.worldUp.equals(this.sceneUpDirection))&&this.setWorldUpVector(t.worldUp),this.currentlyAnimating=!1,m(i),this.showPivot(!1),this.cube&&requestAnimationFrame(this.cube.render),this.navApi.setTransitionActive(!1),void this.transitionCompletedCallback();this.currentlyAnimating=!0,this.showPivot(!0),this.navApi.setTransitionActive(!0);var r=I.destinationPercent,s=1-(n=O(o.elapsedTime/I.duration,0,r));o.elapsedTime+=d/500;var a=o.center.clone().multiplyScalar(s).add(t.center.clone().multiplyScalar(n)),l=e.position.clone().multiplyScalar(s).add(t.position.clone().multiplyScalar(n)),c=e.up.clone().multiplyScalar(s).add(t.up.clone().multiplyScalar(n)),h=e.pivot.clone().multiplyScalar(s).add(t.pivot.clone().multiplyScalar(n)),u=this.sceneUpDirection.clone().multiplyScalar(s).add(t.worldUp.clone().multiplyScalar(n)),f=e.fov*s+t.fov*n;o.center.copy(a),o.pivot.copy(h),e.position.copy(l),e.up.copy(c),e.target.copy(a),t.isOrtho||(e.fov=f),e.dirty=!0,(i=u.distanceToSquared(this.sceneUpDirection)>1e-4)&&this.setWorldUpVector(u),e.lookAt(o.center),m(i),this.cube&&requestAnimationFrame(this.cube.render),o.afAnimateTransition=requestAnimationFrame((function(){o.animateTransition(t)}))}},this.sphericallyInterpolateTransition=function(t){var i,r,s,a,l=0;if(this.currentlyAnimating=!0,this.navApi.setTransitionActive(!0),o.elapsedTime>=I.duration)l=1,this.currentlyAnimating=!1;else{var c=I.destinationPercent;l=O(o.elapsedTime/I.duration,0,c),o.elapsedTime+=d/500}if(1===l)r=L.position,i=L.center,s=L.up;else{var h=new n.Matrix3,u=T.clone();u.slerp(M,l),h.makeRotationFromQuaternion(u);var f=A*(1-(a=l))+w*a,p=h.elements;r=(i=D.center.clone().multiplyScalar(1-l).add(L.center.clone().multiplyScalar(l))).clone().sub(new n.Vector3(p[0],p[1],p[2]).multiplyScalar(f)),s=new n.Vector3(p[3],p[4],p[5])}o.center.copy(i),e.position.copy(r),e.up.copy(s),o.navApi.getUsePivotAlways()||o.pivot.copy(i),e.lookAt(o.center),!0===this.currentlyAnimating?(this.showPivot(!0),requestAnimationFrame((function(){o.sphericallyInterpolateTransition(t)}))):(this.navApi.setTransitionActive(!1),this.showPivot(!1),this.orthographicFaces&&this.isFaceView()&&this.setCameraOrtho(!0),t&&t()),m(!1),this.cube&&requestAnimationFrame(this.cube.render)},this.getOrientation=function(){if(this.cube){var t=N(e.up.x),i=N(e.up.y),n=N(e.up.z),r=this.sceneFrontDirection.clone(),o=this.sceneUpDirection.clone(),s=this.sceneFrontDirection.clone().cross(this.sceneUpDirection).normalize();r.x=N(r.x),r.y=N(r.y),r.z=N(r.z),o.x=N(o.x),o.y=N(o.y),o.z=N(o.z),s.x=N(s.x),s.y=N(s.y),s.z=N(s.z);var a=s.clone().multiplyScalar(-1),l=o.clone().multiplyScalar(-1),c=r.clone().multiplyScalar(-1);switch(this.cube.currentFace){case"front":if(o.x==t&&o.y==i&&o.z==n)return"up";if(l.x==t&&l.y==i&&l.z==n)return"down";if(s.x==t&&s.y==i&&s.z==n)return"right";if(a.x==t&&a.y==i&&a.z==n)return"left";break;case"right":if(o.x==t&&o.y==i&&o.z==n)return"up";if(l.x==t&&l.y==i&&l.z==n)return"down";if(c.x==t&&c.y==i&&c.z==n)return"left";if(r.x==t&&r.y==i&&r.z==n)return"right";break;case"left":if(o.x==t&&o.y==i&&o.z==n)return"up";if(l.x==t&&l.y==i&&l.z==n)return"down";if(r.x==t&&r.y==i&&r.z==n)return"left";if(c.x==t&&c.y==i&&c.z==n)return"right";break;case"back":if(o.x==t&&o.y==i&&o.z==n)return"up";if(l.x==t&&l.y==i&&l.z==n)return"down";if(a.x==t&&a.y==i&&a.z==n)return"right";if(s.x==t&&s.y==i&&s.z==n)return"left";break;case"top":if(c.x==t&&c.y==i&&c.z==n)return"down";if(r.x==t&&r.y==i&&r.z==n)return"up";if(s.x==t&&s.y==i&&s.z==n)return"right";if(a.x==t&&a.y==i&&a.z==n)return"left";break;case"bottom":if(r.x==t&&r.y==i&&r.z==n)return"down";if(c.x==t&&c.y==i&&c.z==n)return"up";if(s.x==t&&s.y==i&&s.z==n)return"right";if(a.x==t&&a.y==i&&a.z==n)return"left"}}},this.setCameraOrtho=function(t){t&&e.isPerspective&&e.toOrthographic(),t||e.isPerspective||e.toPerspective()},this.resetOrientation=function(){this.cube&&this.cube.showCompass(this.cube.prevRenderCompass),this.setCameraOrtho(this.originalHomeVector.isOrtho),this.sceneUpDirection.copy(this.originalHomeVector.worldUp),this.sceneFrontDirection.copy(this.originalHomeVector.worldFront),this.cubeFront.copy(this.sceneFrontDirection).cross(this.sceneUpDirection).normalize(),this.setCameraUp(this.sceneUpDirection),m(!0)},this.setCurrentViewAsFront=function(){this.cube&&(this.cube.currentFace="front",this.cube.showCompass(!1)),this.sceneUpDirection.copy(e.up.clone()),c(this.sceneUpDirection),this.sceneFrontDirection.copy(this.getView()).normalize(),c(this.sceneFrontDirection),this.cubeFront.copy(this.sceneFrontDirection).cross(this.sceneUpDirection).normalize(),c(this.cubeFront),this.orthographicFaces&&this.setCameraOrtho(!0),m(!0)},this.setCurrentViewAsTop=function(){this.cube&&(this.cube.currentFace="top",this.cube.showCompass(!1)),this.sceneUpDirection.copy(this.getView()).multiplyScalar(-1).normalize(),c(this.sceneUpDirection),this.sceneFrontDirection.copy(e.up),c(this.sceneFrontDirection),this.cubeFront.copy(this.sceneFrontDirection).cross(this.sceneUpDirection).normalize(),c(this.cubeFront),m(!0)},this.calculateCubeTransform=function(t){var i=this.sceneUpDirection.clone(),r=this.sceneFrontDirection.clone(),s=this.sceneFrontDirection.clone().cross(this.sceneUpDirection).normalize();(D=e.clone()).center=o.center.clone(),D.pivot=o.pivot.clone(),(L=e.clone()).center=o.center.clone(),L.pivot=o.pivot.clone();var l=new n.Vector3(0,0,0);t.indexOf("back")>=0&&(l=l.add(r)),t.indexOf("front")>=0&&(l=l.sub(r)),t.indexOf("top")>=0&&(l=l.add(i)),t.indexOf("bottom")>=0&&(l=l.sub(i)),t.indexOf("right")>=0&&(l=l.add(s)),t.indexOf("left")>=0&&(l=l.sub(s));var c=i,h=l.clone().normalize();if(1-Math.abs(h.dot(i))<a)for(var u=this.getView().normalize(),d=[r.clone(),r.clone().negate(),s.clone(),s.clone().negate()],f=h.dot(i)>0?1:-1,p=u.clone().add(e.up.clone().multiplyScalar(f)).normalize(),m=-2,g=0;g<4;g++){var v=p.dot(d[g]);v>m&&(m=v,c=d[g].multiplyScalar(f))}w=A=this.getView().length(),L.position.copy(L.center.clone().add(l.multiplyScalar(w/l.length()))),L.up.copy(c);var y=D.center.clone().sub(D.position).normalize(),b=y.clone().cross(D.up).normalize(),x=b.clone().cross(y).normalize(),_=new n.Matrix3;_.set(y.x,x.x,b.x,y.y,x.y,b.y,y.z,x.z,b.z),T.setFromRotationMatrix3(_),x=(b=(y=L.center.clone().sub(L.position).normalize()).clone().cross(L.up).normalize()).clone().cross(y).normalize(),_.set(y.x,x.x,b.x,y.y,x.y,b.y,y.z,x.z,b.z),C.setFromAxisAngle(y,0),P.setFromAxisAngle(x,0),M.setFromRotationMatrix3(_),M.multiply(C).multiply(P).normalize()},this.drawDropdownMenu=function(e,t,i,n,o,s,a){var l=0,c=this.getDocument();if(h)s.appendChild(h);else{(h=c.createElement("div")).className="dropDownMenu",h.style.top="100px",h.style.left="-400px";for(var u=0,d=0,f=0;f<e.length;f++){var p;if(null===e[f])(p=c.createElement("li")).style.height="1px",u+=1,p.style.backgroundColor="#E0E0E0";else{var m=r.A.t(e[f]);if(d=m.length>d?m.length:d,i[f]){p=c.createElement("div");var g=c.createElement("input"),v=c.createElement("label");g.type="radio",g.className="dropDownMenuCheck",v.innerHTML=m,v.className="dropDownMenuCheckText",p.appendChild(g),p.appendChild(v),p.className="dropDownMenuCheckbox"}else(p=c.createElement("li")).textContent=m,p.className=t[f]?"dropDownMenuItem":"dropDownMenuItemDisabled";p.id="menuItem"+l,l++,u+=25,p.setAttribute("data-i18n",e[f])}h.appendChild(p)}s.appendChild(h),h.style.minWidth=Math.max(256,7.4*d)+"px";var y=h.getBoundingClientRect().width;this.menuSize.x=y,this.menuSize.y=u}l=0;for(f=0;f<e.length;f++)if(null!==e[f]){if(i[f]){var b="menuItem"+l,x=c.getElementById(b);x&&(x.children[0].checked=i[f]())}l++}var _=o-15,E=n+1,S=this.canvas.getBoundingClientRect();E+this.menuSize.x>S.right&&(E=n-this.menuSize.x-1),_+this.menuSize.y>S.bottom&&(_=S.bottom-this.menuSize.y),_-=a.y,E-=a.x,h.style.top=_+"px",h.style.left=E+"px",this.menuOrigin.x=E,this.menuOrigin.y=_},this.removeDropdownMenu=function(e){e.removeChild(h)},this.isFaceView=function(){return z(this.center.clone().sub(e.position).normalize())&&z(e.up)},this.startInteraction=function(e,t){this.startCursor=new n.Vector2(e,t),this.startState={saveCenter:this.center.clone(),saveEye:this.camera.position.clone(),savePivot:this.pivot.clone(),saveUp:this.camera.up.clone()},this.lockDeltaX=0,this.lockedX=!1,this.lastSnapRotateX=0,this.lockDeltaY=0,this.lockedY=!1,this.lastSnapRotateY=0,this.lastSnapDir=new n.Vector3(0,0,0),this.navApi.setTransitionActive(!0)},this.orbit=function(t,i,r,s){if(this.navApi.isActionEnabled("orbit")&&!0!==this.currentlyAnimating){var a="wheel";if(o.orthographicFaces&&!e.isPerspective&&(e.toPerspective(),s&&s.saveEye.copy(this.camera.position)),s&&(a="cube"),"cube"==a?(this.saveCenter.copy(s.saveCenter),this.saveEye.copy(s.saveEye),this.savePivot.copy(s.savePivot),this.saveUp.copy(s.saveUp),this.useSnap=!0,this.doCustomOrbit=!0):(this.saveCenter.copy(this.center),this.savePivot.copy(this.pivot),this.saveEye.copy(e.position),this.saveUp.copy(e.up),this.useSnap=!1,this.doCustomOrbit=!1),B()&&null==b&&(b=this.saveCenter.clone(),v=this.saveEye.clone(),E=this.savePivot.clone(),_=this.saveUp.clone()),this.preserveOrbitUpDirection){var l=F(t.x-i.x,t.y-i.y),c=F(r.x,r.y),h=this.sceneUpDirection.clone(),u=this.sceneFrontDirection.clone(),d=this.sceneFrontDirection.clone().cross(this.sceneUpDirection).normalize(),f=B()?E:this.savePivot,p=B()?v:this.saveEye,g=B()?b:this.saveCenter,y=B()?_:this.saveUp,x=f.clone().sub(p).normalize(),S=g.clone().sub(p).normalize(),A=S.clone().cross(y),w=p.clone().sub(f).length(),T=p.clone().sub(g).length(),M=x.clone().multiplyScalar(-1),C=S.clone().multiplyScalar(-1),P=A,D=y.clone();if(!this.constrainOrbitHorizontal){h.dot(this.saveUp)<-.009&&(l.x=-l.x,c.x=-c.x);var L=0;L=B()?c.x*this.orbitMultiplier:this.useSnap?this.lastSnapRotateX+U("h",0,-c.x):l.x*this.orbitMultiplier,this.lastSnapRotateX=L;var I=(new n.Quaternion).setFromAxisAngle(h,-L);M.applyQuaternion(I),C.applyQuaternion(I),P.applyQuaternion(I),D.applyQuaternion(I)}if(!this.constrainOrbitVertical){var R=u.clone().multiplyScalar(u.dot(P)),O=d.clone().multiplyScalar(d.dot(P)),N=R.clone().add(O);N.clone().normalize();var k=0;if(B())k=c.y*this.orbitMultiplier;else{var V=U("v",0,c.y);k=this.useSnap?this.lastSnapRotateY+V:l.y*this.orbitMultiplier}var G=(new n.Quaternion).setFromAxisAngle(N,-k);if(this.navApi.getOrbitPastWorldPoles())M.applyQuaternion(G).normalize(),C.applyQuaternion(G).normalize(),D.applyQuaternion(G).normalize();else{var z=D.clone();if(z.applyQuaternion(G).normalize(),h.dot(z)<0){var H=C.clone();H.applyQuaternion(G).normalize();var W=H.angleTo(h);Math.abs(W)>.5*Math.PI&&(W-=W>0?Math.PI:-Math.PI),k-=W,G.setFromAxisAngle(N,-k),M.applyQuaternion(G).normalize(),C.applyQuaternion(G).normalize(),D.applyQuaternion(G).normalize()}else M.applyQuaternion(G).normalize(),C.applyQuaternion(G).normalize(),D.applyQuaternion(G).normalize()}this.lastSnapRotateY=k}var j=M.multiplyScalar(w).add(f);e.position.copy(j),e.up.copy(D),this.center.copy(j),this.center.sub(C.multiplyScalar(T)),B()&&(b.copy(this.center),v.copy(e.position),E.copy(this.pivot),_.copy(e.up))}e.lookAt(this.center),m(!1)}},this.endInteraction=function(){this.navApi.setTransitionActive(!1)},this.look=function(t){if(this.navApi.isActionEnabled("walk")){var i=F(t.x,t.y),r=this.userLookSpeed,o=this.getView(),s=e.up,a=o.clone().cross(s).normalize(),l=this.sceneUpDirection.clone(),c=i.clone();c.x*=Math.PI,c.y*=Math.PI/e.aspect,c.multiplyScalar(r);var h=(new n.Quaternion).setFromAxisAngle(a,-c.y);if(e.keepSceneUpright&&!this.navApi.getOrbitPastWorldPoles()){var u=s.clone();if(u.applyQuaternion(h).normalize(),u.dot(l)<0){var d=o.clone();d.applyQuaternion(h);var f=d.angleTo(l);Math.abs(f)>.5*Math.PI&&(f-=f>0?Math.PI:-Math.PI),c.y-=f,h.setFromAxisAngle(a,-c.y)}}o=h.clone().rotate(o),(s=h.clone().rotate(s)).normalize();var p=e.keepSceneUpright?l:s,g=(new n.Quaternion).setFromAxisAngle(p,-c.x);o=g.clone().rotate(o),s=g.clone().rotate(s),this.center.copy(o.add(e.position)),e.up.copy(s),e.lookAt(this.center),m(!1)}},this.pan=function(t){if(this.navApi.isActionEnabled("pan")){t=F(t.x,t.y);var i=this.getView(),r=e.up.clone().cross(i),o=i.clone().cross(r);r.normalize(),o.normalize(),i.normalize();var s=this.pivot.clone().sub(e.position),a=i.clone().dot(s),l=a*(Math.tan(n.Math.degToRad(e.leftFov))+Math.tan(n.Math.degToRad(e.rightFov))),c=a*(Math.tan(n.Math.degToRad(e.topFov))+Math.tan(n.Math.degToRad(e.bottomFov))),h=t.x*Math.abs(l),u=t.y*Math.abs(c),d=new n.Vector3,f=r.clone().multiplyScalar(h),p=o.clone().multiplyScalar(u);d=f.clone().add(p).clone().multiplyScalar(this.userPanSpeed),e.position.add(d),this.center.add(d),e.lookAt(this.center),m(!1)}},this.zoom=function(t){if(this.navApi.isActionEnabled("zoom")){var i=this.userZoomSpeed,n=Number.MAX_VALUE,r=t.x+t.y,s=Math.pow(i,r),a=this.pivot.clone().sub(this.pivot.clone().sub(this.saveEye).clone().multiplyScalar(s)),l=a.clone().add(o.D.clone().multiplyScalar(o.D.clone().dot(this.pivot.clone().sub(a).clone())));if(!(s>=n)){if(r>0){Math.pow(i,r-0);if(r<0)return void 0;e.position.copy(a),this.center.copy(l);var c=a.clone().sub(this.saveEye).dot(o.D);c>n?(e.position.copy(this.saveEye.sub(o.D).clone().multiplyScalar(n)),n>0?-1:0):-c/n}else e.position.copy(a),this.center.copy(l);e.lookAt(this.center),m(!1)}}},this.walk=function(t,i,r,o,s){if(this.navApi.isActionEnabled("walk")){var l=this.sceneUpDirection.clone(),c=this.sceneFrontDirection.clone(),h=this.sceneFrontDirection.clone().cross(this.sceneUpDirection);k(t,i)?(wheel.cursorImage("SWWalk"),V(!0,t,i),x=i.x,y=i.y):V(!1,t,i),x=t.x,y=t.y;var u=F(x-i.x,y-i.y),d=-u.x,f=-u.y,p=d<0?-1:1,g=f<0?-1:1,v=Math.abs(d),b=Math.abs(f),_=new n.Vector2(30,30);_=F(_.x,_.y),v=k(t,i)?0:Math.abs(d)-_.x,b=k(t,i)?0:Math.abs(f)-_.y;b/=.25;var E=(v=(v/=.25)<1?O(v,0,1):Math.pow(v,1))>0?v*p:0,S=(b=b<1?O(b,0,1):Math.pow(b,1))>0?b*g:0,A=this.getView(),w=A.length();A.normalize(),A.clone().cross(e.up).normalize();var T=h.clone().multiplyScalar(h.clone().dot(A)),M=c.clone().multiplyScalar(c.clone().dot(A)).clone().add(T);M=M.clone().length()>a?M.normalize():e.up;var C=S*(1*this.walkMultiplier),P=M,D=Math.cos(.65);1!=D&&(l.clone().dot(e.up)<-a&&l.clone().dot(A)<-D||l.clone().dot(e.up)>a&&l.clone().dot(A)>D)&&(P=-P);var L=-E*this.walkMultiplier*.05,I=e.up;(l.clone().dot(e.up)<-a||Math.abs(l.clone().dot(e.up))<a&&l.clone().dot(A)>a)&&(L=-L),I=l;var R=(new n.Quaternion).setFromAxisAngle(I,L);R.normalize(),(A=R.clone().rotate(A)).normalize(),e.up.copy(R.clone().rotate(e.up)),e.up.normalize(),e.position.add(P.clone().multiplyScalar(C)),this.center.copy(e.position.clone().add(A.clone().multiplyScalar(w))),(P=l).normalize(),0===C&&(C=.01),e.lookAt(this.center),m(!1)}},this.updown=function(t){if(!this.navApi.getIsLocked()){var i=G(t);o.m_amount+=i;var r=new n.Vector3(0,1,0),s=o.saveEye.clone().sub(r.clone().multiplyScalar(o.m_amount)),a=s.clone().dot(r);e.position.copy(s),a<o.minSceneBound&&e.position.add(r.clone().multiplyScalar(o.minSceneBound-a)),a>o.maxSceneBound&&e.position.add(r.clone().multiplyScalar(o.maxSceneBound-a)),this.center.copy(e.position.clone().add(o.saveCenter.clone().sub(o.saveEye))),e.lookAt(this.center),m(!1)}}}o.GlobalManagerMixin.call(h.prototype)},2312:(e,t,i)=>{"use strict";const{getGlobal:n}=i(55280),r=n();function o(){this.stop=null,this.isRunning=!0}function s(e,t,i,n,s){var a=performance.now(),l=1e3*i,c=0,h=new o;h.stop=function(){c&&r.cancelAnimationFrame(c),h.isRunning=!1},h.skip=function(){h.isRunning&&(n(t),h.stop(),s&&s())};var u=function(i){var o=(i-a)/l;o=Math.max(o,0),o=Math.min(o,1),n(e+o*(t-e)),o<1?c=r.requestAnimationFrame(u):(h.isRunning=!1,s&&s())};return u(a),h}function a(e,t,i){return(1-i)*e+i*t}function l(e){return THREE.Math.smootherstep(e,0,1)}function c(e){var t=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Vector3,c=0,h=0,u=new THREE.Quaternion,d=new THREE.Quaternion,f=new THREE.Vector3,p=new THREE.Quaternion,m=new THREE.Object3D;new THREE.Matrix4;function g(e,t,i,n){Autodesk.Viewing.Navigation.prototype.orient(m,i,t,n),e.copy(m.quaternion)}this.init=function(e,a,l,f){let p=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];t.copy(e.position),i.copy(e.target),n.copy(p?e.worldup:e.up),r.copy(a),o.copy(l),s.copy(p?e.worldup:f),c=t.distanceTo(i),h=r.distanceTo(o),g(u,t,i,n),g(d,r,o,s)},this.updateCamera=function(e,i){var n=l(e);i.position.lerpVectors(t,r,n),p.slerpQuaternions(u,d,n),p.normalize();var o=a(c,h,n);!function(e,t,i){f.set(0,0,-i).applyQuaternion(t),e.target.addVectors(e.position,f),f.set(0,1,0).applyQuaternion(t),e.up.copy(f)}(i,p,o),i.dirty=!0},this.updateViewerCamera=function(e,t){this.updateCamera(e,t.impl.camera),t.impl.syncCamera(),t.impl.invalidate(!0,!0)}}var h;e.exports={flyToView:function(e,t,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];h||(h=new c),i=i||2;var o=e.impl.camera;return h.init(o,t.position,t.target,t.up,r),s(0,1,i,(function(t){h.updateViewerCamera(t,e)}),n)},ShadowFader:function(e,t,i){var n=1,r=null,o=t,a=void 0,l=i;function c(t){n=t,e.impl.setGroundShadowAlpha(t)}function h(){r=null,l&&l(a)}this.shadowOn=function(){r&&a||(r&&!a&&(r.stop(),r=null),n>=1||(r=s(n,1,o*(1-n),c,h),a=!0))},this.shadowOff=function(){r&&!a||(r&&a&&(r.stop(),r=null),n<=0||(r=s(n,0,o*n,c,h),a=!1))},this.isFading=function(){return r&&r.isRunning}},lerp:a,smootherStep:l,fadeValue:s,AnimatedParam:class{constructor(e,t,i){this.setValueCb=t,this.animTime=i,this.fadeAnim=null,this.targetValue=e,this.curValue=e,t(e),this.pendingFinishedCallbacks=[]}stopAnim(){this.fadeAnim&&(this.fadeAnim.stop(),this.fadeAnim=null)}_onAnimEnded(){this.pendingFinishedCallbacks.forEach((e=>e())),this.pendingFinishedCallbacks.length=0}fadeTo(e,t){const i=this.fadeAnim&&this.fadeAnim.isRunning;if(!i&&this.curValue==e)return void(t&&t());if(t&&this.pendingFinishedCallbacks.push(t),i&&e===this.targetValue)return;this.stopAnim();this.targetValue=e,this.fadeAnim=s(this.curValue,this.targetValue,this.animTime,(e=>{e=l(e),this.curValue=e,this.setValueCb(e)}),(()=>this._onAnimEnded()))}skipAnim(){this.fadeAnim&&this.fadeAnim.skip()}setValue(e){this.stopAnim(),this.curValue=e,this.setValueCb(e)}}}},16613:(e,t,i)=>{"use strict";function n(e,t){try{WebAssembly.instantiateStreaming||(WebAssembly.instantiateStreaming=async(e,t)=>{const i=await(await e).arrayBuffer();return await WebAssembly.instantiate(i,t)})}catch(e){throw new Error("WebAssembly is not supported for the current browser.")}if(!e)throw new Error("Expecting a wasm file path.");let i=256,n=256;t&&t.memory&&(i=t.memory.initial,n=t.memory.maximum),this._wasmPath=e,this._memory=new WebAssembly.Memory({initial:i,maximum:n})}i.r(t),i.d(t,{Wasm:()=>n}),n.prototype.constructor=n,n.prototype.instantiate=function(){const e={env:{abortStackOverflow:e=>{throw new Error("overflow")},table:new WebAssembly.Table({initial:0,maximum:0,element:"anyfunc"}),__table_base:0,memory:this._memory,__memory_base:1024,STACKTOP:0,STACK_MAX:this.getBuffer().byteLength}};return new Promise(((t,i)=>{try{WebAssembly.instantiateStreaming(fetch(this._wasmPath),e).then((e=>{const i=e.instance.exports;this.proxy=i,t(i)}))}catch(e){i(e)}}))},n.prototype.getBuffer=function(){return this._memory.buffer}},57872:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CONSOLIDATION_MEMORY_LIMIT:()=>a,DEPTH_EPSILON:()=>M,ENABLE_PIXEL_CULLING:()=>f,GEOMETRY_OVERHEAD:()=>u,GPU_MEMORY_LIMIT:()=>o,GPU_OBJECT_LIMIT:()=>s,INDEX_BUFFER_REGION_SIZE:()=>x,IsUsingWebGPU:()=>T,MODEL_MEMORY_LIMIT:()=>l,PER_FRAME_CONSOLIDATION_TIME_BUDGET:()=>p,PIXEL_CULLING_THRESHOLD:()=>d,USE_BUFFER_MANAGER:()=>v,USE_DEFERRED_CONSOLIDATION:()=>g,USE_HLOD:()=>y,USE_OUT_OF_CORE_TILE_MANAGER:()=>m,USE_VAO:()=>h,VERTEX_BUFFER_REGION_SIZE:()=>b,disableGpuObjectLimit:()=>c,enableOutOfCoreTileManager:()=>A,useBufferManager:()=>_,useHLOD:()=>S,useWebGPU:()=>w});var n=i(55280),r=i(40508);let o=1024*((0,n.isMobileDevice)()?64:256)*1024,s=(0,n.isMobileDevice)()?2500:1e4,a=o/2,l=1048576e3;const c=function(){s=4294967295};let h=!(0,n.isMobileDevice)();const u=336,d=.75;let f=!0;const p=10;let m=!1,g=!1,v=!1,y=!1;const b=1048576,x=1048576;function _(){v=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],h=!v}const E={gpu_memory:2147483648,gpu_objects:512e3,model_memory:4294967296,consolidation_memory:1073741824};function S(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E;(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&e&&((0,n.isMobileDevice)()?console.warn("HLOD is not supported on mobile devices"):(y=!0,_(!0),g=!0,f=!1,o=e.gpu_memory,s=e.gpu_objects,l=e.model_memory,a=e.consolidation_memory,console.log(`Using HLOD settings. Memory: ${o}, Object Limit: ${s}, Consolidation Memory: ${a}`)))}function A(){y&&(m=!0,console.log("Using dynamic GPU Memory Management"))}async function w(e){await(0,r.f6)(e)}function T(){return null!==(0,r.cS)()}const M=2*Math.pow(2,-24)},21968:(e,t,i)=>{"use strict";i.d(t,{_:()=>l});var n=i(72091),r=i(8071),o=i.n(r),s=i(70984),a=i.n(s);let l={uniforms:{color1:{type:"v3",value:new n.Vector3(41/255,76/255,120/255)},color2:{type:"v3",value:new n.Vector3(1/255,2/255,3/255)},opacity:{type:"f",value:1},envMap:{type:"t",value:null},envRotationSin:{type:"f",value:0},envRotationCos:{type:"f",value:1},exposureBias:{type:"f",value:1},envMapExposure:{type:"f",value:1},uCamDir:{type:"v3",value:new n.Vector3},uCamUp:{type:"v3",value:new n.Vector3},uResolution:{type:"v2",value:new n.Vector2(600,400)},uHalfFovTan:{type:"f",value:.5},envMapBackground:{type:"i",value:0},backgroundTexture:{type:"t",value:null}},vertexShader:o(),fragmentShader:a()}},25618:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BasicShader:()=>c});var n=i(72091),r=i(30130),o=i(21175),s=i.n(o),a=i(27608),l=i.n(a);let c={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.shadowmap,r.ShaderChunks.CutPlanesUniforms,r.ShaderChunks.IdUniforms,r.ShaderChunks.ThemingUniform,r.ShaderChunks.PointSizeUniforms,r.ShaderChunks.WideLinesUniforms,r.ShaderChunks.DepthTextureTestUniforms]),vertexShader:s(),fragmentShader:l()};n.ShaderLib.firefly_basic=c},31320:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CelShader:()=>c});var n=i(72091),r=i(30130),o=i(44203),s=i.n(o),a=i(91342),l=i.n(a);let c={uniforms:n.UniformsUtils.merge([r.ShaderChunks.DepthTextureUniforms,{tDiffuse:{type:"t",value:null},tID:{type:"t",value:null},resolution:{type:"v2",value:new n.Vector2(1/1024,1/512)},cameraNear:{type:"f",value:1},cameraFar:{type:"f",value:100},tFill:{type:"t",value:null},tPaper:{type:"t",value:null},style:{type:"i",value:0},idEdges:{type:"i",value:1},normalEdges:{type:"i",value:1},depthEdges:{type:"i",value:1},brightness:{type:"f",value:0},contrast:{type:"f",value:0},grayscale:{type:"i",value:0},preserveColor:{type:"i",value:0},levels:{type:"f",value:6},repeats:{type:"f",value:3},rotation:{type:"f",value:0},outlineRadius:{type:"f",value:1},outlineNoise:{type:"i",value:0},tGraphite1:{type:"t",value:null},tGraphite2:{type:"t",value:null},tGraphite3:{type:"t",value:null},tGraphite4:{type:"t",value:null},tGraphite5:{type:"t",value:null},tGraphite6:{type:"t",value:null},tGraphite7:{type:"t",value:null},tGraphite8:{type:"t",value:null}}]),vertexShader:s(),fragmentShader:l()}},48717:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CopyShader:()=>a});var n=i(44203),r=i.n(n),o=i(78551),s=i.n(o);let a={uniforms:{tDiffuse:{type:"t",value:null}},vertexShader:r(),fragmentShader:s()}},12360:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CreateCubeMapFromColors:()=>s,DecodeEnvMap:()=>f});var n=i(72091),r=i(89024),o=i(83081);function s(e,t){for(var i=255*e.x,r=255*e.y,o=255*e.z,s=255*t.x,a=255*t.y,l=255*t.z,c=new Uint8Array(16),h=new Uint8Array(16),u=new Uint8Array(16),d=0;d<4;d++)c[4*d]=i,c[4*d+1]=r,c[4*d+2]=o,c[4*d+3]=255,h[4*d]=s,h[4*d+1]=a,h[4*d+2]=l,h[4*d+3]=255,d>1?(u[4*d]=i,u[4*d+1]=r,u[4*d+2]=o,u[4*d+3]=255):(u[4*d]=s,u[4*d+1]=a,u[4*d+2]=l,u[4*d+3]=255);var f=new n.DataTexture(u,2,2,n.RGBAFormat),p=new n.DataTexture(u,2,2,n.RGBAFormat),m=new n.DataTexture(h,2,2,n.RGBAFormat),g=new n.DataTexture(c,2,2,n.RGBAFormat),v=new n.DataTexture(u,2,2,n.RGBAFormat),y=new n.DataTexture(u,2,2,n.RGBAFormat),b=new n.Texture(null,n.CubeReflectionMapping,n.RepeatWrapping,n.RepeatWrapping,n.LinearFilter,n.LinearFilter,n.RGBAFormat);return b.image=[p,f,g,m,y,v],b.needsUpdate=!0,b}var a=[6.0014,-2.7008,-1.7996,-1.332,3.1029,-5.7721,.3008,-1.0882,5.6268];function l(e,t){var i=255*t[2]+t[3],n=Math.pow(2,(i-127)/2),r=n/t[1],o=t[0]*r,s=a[0]*o+a[3]*n+a[6]*r,l=a[1]*o+a[4]*n+a[7]*r,c=a[2]*o+a[5]*n+a[8]*r;s<0&&(s=0),l<0&&(l=0),c<0&&(c=0),e[0]=s,e[1]=l,e[2]=c}function c(e,t,i){var n=.0625*Math.sqrt(t[0]*i),r=.0625*Math.sqrt(t[1]*i),o=.0625*Math.sqrt(t[2]*i),s=Math.max(Math.max(n,r),Math.max(o,1e-6));s>1&&(s=1);var a=Math.ceil(255*s)/255;n>1&&(n=1),r>1&&(r=1),o>1&&(o=1),e[3]=a;var l=1/a;e[0]=n*l,e[1]=r*l,e[2]=o*l}function h(e,t,i){var n=Math.sqrt(t[0]*i),r=Math.sqrt(t[1]*i),o=Math.sqrt(t[2]*i),s=65504;n>s&&(n=s),r>s&&(r=s),o>s&&(o=s),e[0]=n,e[1]=r,e[2]=o}var u=new Float32Array(4),d=new Float32Array(4);function f(e,t,i,s){if(e.LogLuv){for(var a=Math.pow(2,t),f=Array.isArray(e.image)?e.image:[e.image],p=0;p<f.length;p++)for(var m=f[p],g=0;g<m.mipmaps.length;g++){var v,y=m.mipmaps[g],b=y.data;i?(v=new Uint16Array(b.length/4*3),y.data=v):v=b.buffer;for(var x=0,_=0;_<b.length;_+=4)u[0]=b[_]/255,u[1]=b[_+1]/255,u[2]=b[_+2]/255,u[3]=b[_+3]/255,l(d,u),i?(h(u,d,a),v[x++]=(0,r.FloatToHalf)(u[0]),v[x++]=(0,r.FloatToHalf)(u[1]),v[x++]=(0,r.FloatToHalf)(u[2])):(c(u,d,a),b[_]=Math.round(255*u[0]),b[_+1]=Math.round(255*u[1]),b[_+2]=Math.round(255*u[2]),b[_+3]=Math.round(255*u[3]))}e.LogLuv=!1,i?(e.type=n.HalfFloatType,e.format=n.RGBFormat,e.RGBM=!1,e.GammaEncoded=!0):e.RGBM=!0,s&&s(e)}else o.logger.warn("Environment map expected to be in LogLuv format.")}},39147:(e,t,i)=>{"use strict";i.d(t,{b:()=>h});var n=i(72091),r=i(8102),o=i.n(r),s=i(15201),a=i.n(s),l=i(68449),c={uniforms:{tDiffuse:{type:"t",value:null},uColor:{type:"v4",value:new n.Vector4(1,1,1,1)}},vertexShader:o(),fragmentShader:a()};let h=function(e,t,i,r,o){var s,a,h,u=e,d=t,f=i||3,p=r||1,m=o.hasAlpha||!1,g=o.blending||!1,v=o.flipUV||!1;this.render=function(e,t,i){s.render(e,h,i),a.render(e,t,h)},this.setSize=function(e,t){this.cleanup(),u=e,d=t,(h=new n.WebGLRenderTarget(e,t,{minFilter:n.LinearFilter,magFilter:n.LinearFilter,format:void 0!==o.format?o.format:n.RGBAFormat,type:void 0!==o.type?o.type:n.UnsignedByteType,stencilBuffer:!1})).texture.generateMipmaps=!1,s.material.defines.KERNEL_SCALE_H=a.material.defines.KERNEL_SCALE_H=(p/u).toFixed(4),s.material.defines.KERNEL_SCALE_V=a.material.defines.KERNEL_SCALE_V=(p/d).toFixed(4),s.material.needsUpdate=a.material.needsUpdate=!0},this.cleanup=function(){h&&h.dispose()},this.setColor=function(e){a.material.uniforms.uColor.value.x=e.r,a.material.uniforms.uColor.value.y=e.g,a.material.uniforms.uColor.value.z=e.b},this.setAlpha=function(e){a.material.uniforms.uColor.value.w=e},s=new l.ShaderPass(c),a=new l.ShaderPass(c),this.setSize(e,t),s.material.blending=a.material.blending=n.NoBlending,s.material.depthWrite=a.material.depthWrite=!1,s.material.depthTest=a.material.depthTest=!1,s.material.defines.HORIZONTAL=1,s.material.defines.KERNEL_RADIUS=a.material.defines.KERNEL_RADIUS=f.toFixed(1),g&&(a.material.transparent=!0,a.material.blending=n.NormalBlending),m&&(s.material.defines.HAS_ALPHA=a.material.defines.HAS_ALPHA=""),v&&(s.material.defines.FLIP_UV="")}},74139:(e,t,i)=>{"use strict";i.d(t,{r:()=>n});class n{needsClear(e,t){if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e[i]!=t[i])return!0}}},15371:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GroundFlags:()=>n});var n={GROUND_UNFINISHED:0,GROUND_FINISHED:1,GROUND_RENDERED:2}},14859:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GroundReflection:()=>m});var n=i(68449),r=i(39147),o=i(21968),s=i(44203),a=i.n(s),l=i(99885),c=i.n(l),h=i(74139),u=i(15371),d=i(57872),f=i(72091),p={uniforms:{tDiffuse:{type:"t",value:null}},vertexShader:a(),fragmentShader:c()};let m=function(e,t,i,s){var a,l,c,h,m,g,v=e,y=v.getContext(),b=t||512,x=i||512,_=!1,E=new f.Color(0,0,0),S=!1,A=!1;this.inTarget=void 0,this.outTarget=void 0;var w,T,M,C,P,D=!0,L=u.GroundFlags.GROUND_UNFINISHED,I={color:new f.Color(1,1,1),alpha:.3,texScale:.5,blurRadius:2,blurTexScale:.5,fadeAngle:Math.PI/18};if(this.setTransform=function(e,t,i){h=e,c.normal=t,c.constant=-e.dot(t)},this.cleanup=function(){a&&a.cleanup(),this.inTarget&&this.inTarget.dispose(),this.outTarget&&this.outTarget.dispose()},this.setSize=function(e,t){b=e,x=t,this.cleanup(),this.inTarget=new f.WebGLRenderTarget(b*I.texScale,x*I.texScale,{magFilter:f.LinearFilter,minFilter:f.LinearFilter,format:f.RGBAFormat,stencilBuffer:!1}),this.inTarget.texture.generateMipmaps=!1,this.inTarget.name="GroundReflection inTarget",this.outTarget=new f.WebGLRenderTarget(b*I.texScale,x*I.texScale,{magFilter:f.LinearFilter,minFilter:f.LinearFilter,format:f.RGBAFormat,stencilBuffer:!1}),this.outTarget.texture.generateMipmaps=!1,this.outTarget.name="GroundReflection outTarget",a?a.setSize(b*I.texScale*I.blurTexScale,x*I.texScale*I.blurTexScale):a=new r.b(b*I.texScale*I.blurTexScale,x*I.texScale*I.blurTexScale,I.blurRadius,1,{hasAlpha:!0,blending:!0,flipUV:!0})},this.updateCamera=function(e){var t;t=e.isPerspective?h.clone():e.target.clone();var i=e.position.clone().sub(t).normalize(),n=Math.PI/2-i.angleTo(c.normal);if(!(_=n<0)){if(I.fadeAngle>0){var r=Math.min(I.fadeAngle,n)/I.fadeAngle;a.setAlpha(r*I.alpha)}var o,s,l,u=(s=(o=c).normal,l=o.constant,(new f.Matrix4).set(1-2*s.x*s.x,-2*s.y*s.x,-2*s.x*s.z,-2*l*s.x,-2*s.x*s.y,1-2*s.y*s.y,-2*s.y*s.z,-2*l*s.y,-2*s.x*s.z,-2*s.y*s.z,1-2*s.z*s.z,-2*l*s.z,0,0,0,1));(m=e.clone()).applyMatrix4(u),m.projectionMatrix.elements[5]*=-1,m.matrixWorldNeedsUpdate=!0,e.worldUpTransform?m.worldUpTransform=e.worldUpTransform.clone():m.worldUpTransform=new f.Matrix4}},this.renderIntoReflection=function(e){_||(v.setRenderTarget(this.inTarget),v.render(e,m))},this.prepareGroundReflection=(T=[],M=0,C=0,P=0,function(e,t,i,n,r,o){var s=t.modelQueue();if(L!==u.GroundFlags.GROUND_UNFINISHED||s.isEmpty())return L=u.GroundFlags.GROUND_FINISHED,r;const a=s.getGeomScenesPerModel();if(D=this.needsClear(T,a)||D){if(D=!1,this.updateCamera(t.camera),this.isGroundCulled())return L=u.GroundFlags.GROUND_FINISHED,r;this.clear(),T=a,w=s.getGeomScenes(),M=w.length,C=0,P=n?Math.max(Math.ceil(M/100),n):M,L=u.GroundFlags.GROUND_UNFINISHED}else{if(L!==u.GroundFlags.GROUND_UNFINISHED)return L=u.GroundFlags.GROUND_FINISHED,r;0===n&&(P=M)}var l,c,h;r&&(l=performance.now(),c=(o=void 0===o?1:o)*r);for(var d=0;d<P&&C<M;){var f=w[C++];if(f&&(d++,f.forceVisible=!0,this.renderIntoReflection(f),f.forceVisible=!1,r)){var p=performance.now()-l;if(c<p&&C<M){L=u.GroundFlags.GROUND_UNFINISHED,h=r-p;break}}}return C<M&&(L=u.GroundFlags.GROUND_UNFINISHED,h=r?r-performance.now()+l:1),void 0===h||i?(this.postprocess(t.camera,t.matman()),e&&e.enabled&&t.renderGroundShadow(this.outTarget),this.renderReflection(t.camera,t.renderer().getColorTarget()),void 0===h&&(L=u.GroundFlags.GROUND_RENDERED),r?r-performance.now()+l:1):h}),this.renderReflection=function(e,t){_||(y.depthRange(1-2*d.DEPTH_EPSILON,1-d.DEPTH_EPSILON),l.render(v,t,this.outTarget),y.depthRange(0,1))},this.toggleEnvMapBackground=function(e){A=e,g.uniforms.envMapBackground.value=e},this.postprocess=function(e){if(!_){if(S||A){const t=g.uniforms.uCamDir.value||new f.Vector3;g.uniforms.uCamDir.value=e.worldUpTransform?e.getWorldDirection(t).applyMatrix4(e.worldUpTransform):e.getWorldDirection(t),g.uniforms.uCamUp.value=e.worldUpTransform?e.up.clone().applyMatrix4(e.worldUpTransform):e.up,g.uniforms.uResolution.value.set(b,x),g.uniforms.uHalfFovTan.value=Math.tan(f.Math.degToRad(.5*e.fov)),g.render(v,this.outTarget),v.setRenderTarget(this.outTarget),v.clear(!1,!0,!1)}else v.setClearColor(E,1),v.setRenderTarget(this.outTarget),v.clear(!0,!0,!1);a.render(v,this.outTarget,this.inTarget)}},this.clear=function(){v.setClearColor(E,0),v.setRenderTarget(this.inTarget),v.clear(!0,!0,!1),v.clearBlend()},this.setClearColors=function(e,t,i){t?(E.setRGB(.5*(e.x+t.x),.5*(e.y+t.y),.5*(e.z+t.z)),S=!e.equals(t)&&!i):(E.copy(e),S=!1),S&&(g.uniforms.color1.value.copy(e),g.uniforms.color2.value.copy(t))},this.setEnvRotation=function(e){g.material.envRotationSin=Math.sin(e),g.material.envRotationCos=Math.cos(e)},this.isGroundCulled=function(){return _},this.getStatus=function(){return L},this.setDirty=function(){D=!0,L=u.GroundFlags.GROUND_UNFINISHED},this.setColor=function(e){a.setColor(I.color),I.color.set(e)},this.setAlpha=function(e){a.setAlpha(I.alpha),I.alpha=e},s)for(var R in I)I[R]=void 0!==s[R]?s[R]:I[R];(l=new n.ShaderPass(p)).material.blending=f.NoBlending,l.material.depthTest=!0,l.material.depthWrite=!1,l.scene.position.z=-(1-2*d.DEPTH_EPSILON),s.clearPass?g=s.clearPass:((g=new n.ShaderPass(o._)).material.blending=f.NoBlending,g.material.depthWrite=!1,g.material.depthTest=!1),this.setSize(b,x),a.setAlpha(I.color),a.setAlpha(I.alpha),c=new f.Plane(new f.Vector3(0,1,0),0),h=new f.Vector3(0,0,0)};m.prototype=h.r.prototype,m.prototype.constructor=m},65802:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GroundShadow:()=>N,createGroundShape:()=>R,setGroundShapeTransform:()=>O});var n=i(2179),r=i(68449),o=i(67312),s=i.n(o),a=i(2647),l=i.n(a),c=i(44203),h=i.n(c),u=i(63694),d=i.n(u),f=i(12065),p=i.n(f),m=i(17797),g=i.n(m),v=i(74139),y=i(15371),b=i(57872),x=i(4897),_=i(21706),E=i(68747),S=i(72091);const A=2;var w={uniforms:{cutplanes:{type:"v4v",value:[]}},vertexShader:s(),fragmentShader:l()},T={uniforms:{tDepth:{type:"t",value:null},worldSize:{type:"v3",value:new S.Vector3(1,1,1)}},defines:{},vertexShader:h(),fragmentShader:d()},M={uniforms:{tDepth:{type:"t",value:null}},defines:{},vertexShader:h(),fragmentShader:p()},C={uniforms:{tDepth:{type:"t",value:null},uShadowColor:{type:"v4",value:new S.Vector4(0,0,0,1)}},vertexShader:h(),fragmentShader:g()};let P,D,L,I=new _.LmvBox3;function R(e){var t=new S.PlaneBufferGeometry(1,1);return t.index.array.reverse(),new S.Mesh(t,e)}function O(e,t,i,n,r){P||(P=new S.Matrix4),D||(D=new S.Vector3),L||(L=new S.Vector3),D.subVectors(t,n),P.lookAt(D,t,r),L.copy(n).multiplyScalar(-.5*i.y).add(t),e.position.copy(L),e.rotation.setFromRotationMatrix(P),e.scale.set(i.z,i.x,i.y)}function N(e,t){var i,o=e;const s=new x.FrustumIntersector;var a,l,c,h,u,d,f,p,m,g,v,_,P,D,L,N,F,U,B,k=!1,V=!0,G=y.GroundFlags.GROUND_FINISHED,z={texSize:64,pixScale:1,blurRadius:7,debug:!1};if(this.setTransform=(v=new S.Vector3(0,0,0),_=new S.Vector3(0,0,0),P=new S.Vector3(0,0,0),D=new S.Vector3(0,0,0),function(e,t,n,r){e.equals(v)&&t.equals(_)&&n.equals(P)&&r.equals(D)||(v.copy(e),_.copy(t),P.copy(n),D.copy(r),this.setDirty(),i.left=-t.z/2,i.right=t.z/2,i.top=t.x/2,i.bottom=-t.x/2,i.near=1,i.far=t.y+i.near,i.updateProjectionMatrix(),O(l,e,t,n,r),i.position.addVectors(e,n.clone().multiplyScalar(-t.y/2-i.near)),r&&i.up.set(r.x,r.y,r.z),i.lookAt(e),z.debug&&(g.position.set(e.x,e.y,e.z),g.rotation.set(i.rotation.x,i.rotation.y,i.rotation.z),g.scale.set(t.z,t.x,t.y)),m.uniforms.worldSize.value.copy(t),i.orthoScale=t.x,i.clientHeight=z.texSize,s.reset(i),s.areaCullThreshold=A)}),this.renderIntoShadow=function(e){if(!e.overrideMaterial||!e.overrideMaterial.transparent){e.forEachNoMesh&&(b.ENABLE_PIXEL_CULLING||b.USE_HLOD)&&(e.forEachNoMesh((t=>{e.frags.getWorldBounds(t,I);const i=e.frags.vizflags[t]&E.MeshFlags.MESH_VISIBLE,n=s.estimateProjectedDiameter(I)<s.areaCullThreshold;e.frags.setFlagFragment(t,E.MeshFlags.MESH_RENDERFLAG,i&&!n)})),e.forceVisible=!1);var t=e.overrideMaterial;e.overrideMaterial=u,o.setRenderTarget(c),o.render(e,i),e.overrideMaterial=t}},this.prepareGroundShadow=(N=[],F=0,U=0,B=0,function(e,t,i,n){if(!this.enabled||e.isEmpty())return G=y.GroundFlags.GROUND_FINISHED,i;const r=e.getGeomScenesPerModel();if(V=this.needsClear(N,r)||V)this.clear(),V=!1,N=r,L=e.getGeomScenes(),F=L.length,U=0,B=t?Math.max(Math.ceil(F/100),t):F;else{if(G===y.GroundFlags.GROUND_RENDERED||G===y.GroundFlags.GROUND_FINISHED)return G=y.GroundFlags.GROUND_FINISHED,i;0===t&&(B=F)}var o,a,l;i&&(o=performance.now(),a=(n=void 0===n?1:n)*i);for(var c=0;c<B&&U<F;){var h=L[U++];if(h&&(!((b.ENABLE_PIXEL_CULLING||b.USE_HLOD)&&h.getBoundingBox&&s.estimateProjectedDiameter(h.getBoundingBox())<s.areaCullThreshold)&&(c++,h.forceVisible=!0,this.renderIntoShadow(h),h.forceVisible=!1,i))){var u=performance.now()-o;if(a<u){G=y.GroundFlags.GROUND_UNFINISHED,l=i-u;break}}}return U<F&&(G=y.GroundFlags.GROUND_UNFINISHED,l=i?i-performance.now()+o:1),void 0!==l?l:(this.postprocess(),G=y.GroundFlags.GROUND_RENDERED,i?i-performance.now()+o:1)}),this.renderShadow=function(e,t){k&&(t&&o.setRenderTarget(t),o.render(a,e))},this.postprocess=function(){p.render(o,h,c),f.render(o,c,h),k=!0},this.clear=function(){var e=o.getClearColor(new S.Color).getHex(),t=o.getClearAlpha();o.setClearColor(0,0),o.setRenderTarget(c),o.clear(!0,!0,!1),o.setClearColor(e,t),o.clearBlend(),k=!1},this.setColor=function(e){d.uniforms.uShadowColor.value.x=e.r,d.uniforms.uShadowColor.value.y=e.g,d.uniforms.uShadowColor.value.z=e.b},this.getColor=function(){return new S.Color(d.uniforms.uShadowColor.value.x,d.uniforms.uShadowColor.value.y,d.uniforms.uShadowColor.value.z)},this.setAlpha=function(e){d.uniforms.uShadowColor.value.w=e},this.getAlpha=function(){return d.uniforms.uShadowColor.value.w},this.isValid=function(){return k},this.getStatus=function(){return G},this.setDirty=function(){V=!0,G=y.GroundFlags.GROUND_UNFINISHED},this.getDepthMaterial=function(){return u},t)for(var H in z)z[H]=t[H]||z[H];a=new S.Scene,i=new S.OrthographicCamera,(c=new S.WebGLRenderTarget(z.texSize,z.texSize,{minFilter:S.LinearFilter,magFilter:S.LinearFilter,format:S.RGBAFormat,stencilBuffer:!1})).texture.generateMipmaps=!1,c.name="GroundShadow targetH",(h=new S.WebGLRenderTarget(z.texSize,z.texSize,{minFilter:S.LinearFilter,magFilter:S.LinearFilter,format:S.RGBAFormat,stencilBuffer:!1})).texture.generateMipmaps=!1,h.name="GroundShadow targetV",(u=(0,n.createShaderMaterial)(w)).type="GroundDepthShader",u.side=S.DoubleSide,u.blending=S.NoBlending,f=new r.ShaderPass(M,"tDepth"),p=new r.ShaderPass(M,"tDepth"),m=new r.ShaderPass(T,"tDepth"),f.material.defines.KERNEL_SCALE=p.material.defines.KERNEL_SCALE=(z.pixScale/z.texSize).toFixed(4),f.material.defines.KERNEL_RADIUS=p.material.defines.KERNEL_RADIUS=z.blurRadius.toFixed(2),m.material.blending=f.material.blending=p.material.blending=S.NoBlending,m.material.depthWrite=f.material.depthWrite=p.material.depthWrite=!1,m.material.depthTest=f.material.depthTest=p.material.depthTest=!1,f.material.defines.HORIZONTAL=1,(d=(0,n.createShaderMaterial)(C)).uniforms.tDepth.value=c.texture,d.depthWrite=!1,d.transparent=!0,l=R(d),a.add(l),z.debug&&(g=new S.Mesh(new S.BoxGeometry(1,1,1),new S.MeshBasicMaterial({color:65280,wireframe:!0})),a.add(g)),this.setTransform(new S.Vector3(0,0,0),new S.Vector3(1,1,1),new S.Vector3(0,1,0),S.Object3D.DefaultUp)}N.prototype=v.r.prototype,N.prototype.constructor=N},89024:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FloatToHalf:()=>a,HALF_INT_MAX:()=>c,HalfTest:()=>d,HalfToFloat:()=>l,HalfToInt:()=>u,IntToHalf:()=>h});var n=new Float32Array(1),r=new Uint32Array(n.buffer),o=new Uint16Array(1),s=new Uint16Array(1);let a=function(e){n[0]=e;var t=r[0],i=0;if(2147483647&t){var a=2147483648&t,l=2139095040&t,c=8388607&t;if(0===l)s[i++]=a>>16;else if(2139095040==l)s[i++]=0===c?a>>16|31744:65024;else{var h,u,d=a>>16,f=(l>>23)-127+15;f>=31?s[i++]=a>>16|31744:f<=0?(14-f>24?h=0:(h=(c|=8388608)>>14-f,o[0]=h,h=o[0],c>>13-f&1&&(h+=1)),s[i++]=d|h):(u=f<<10,o[0]=u,u=o[0],h=c>>13,o[0]=h,h=o[0],s[i++]=4096&c?1+(d|u|h):d|u|h)}}else s[i++]=t>>16;return s[0]},l=function(e){var t,i=65535&e;if(32767&i){var o=32768&i,s=31744&i,a=1023&i;if(0===s){var l=-1;do{l++,a<<=1}while(!(1024&a));var c=o<<16,h=(s<<16>>26)-15+127-l,u=h<<23,d=(1023&a)<<13;t=c|u|d}else t=31744==s?0===a?o<<16|2139095040:4290772992:(c=o<<16)|(u=(h=(s<<16>>26)-15+127)<<23)|(d=a<<13)}else t=i<<16;return r[0]=t,n[0]},c=59390,h=function(e){if(e>c-1||e<0)return console.log("out of range"),a(NaN);if(0===e)return 0;var t=!1;e>c/2-1&&(t=!0,e-=c/2-1);var i=0|Math.abs(e/1024),n=Math.pow(2,i-13),r=n+(e-1024*i)*n/1024;return t&&(r=-r),a(r)},u=function(e){if(0===e)return 0;var t=l(e),i=!1;t<0&&(i=!0,t=-t);var n=0|Math.floor(Math.log(t)/Math.log(2)),r=Math.pow(2,n),o=(t-r)/r*1024+1024*(n+13);return i&&(o+=c/2-1),o},d=function(){for(var e=[-1/255,-.17,-75,-1789,-.005],t=0;t<e.length;t++)console.log("input",e[t],"encoded",a(e[t]),"decoded",l(a(e[t])));for(let e=0;e<c;e++){var i=u(h(e));i!==e&&console.log("Roundtrip failed for",e,i)}}},97011:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineStyleDefs:()=>r,createLinePatternForDef:()=>l,createLinePatternTexture:()=>a,createLinePatternTextureData:()=>o,createLinePatternTextureFromDefs:()=>s});var n=i(72091);let r=[{id:"SOLID",name:"Solid",ascii_art:"_______________________________________",def:[1]},{id:"BORDER",name:"Border",ascii_art:"__ __ . __ __ . __ __ . __ __ . __ __ .",def:[.5,-.25,.5,-.25,0,-.25]},{id:"BORDER2",name:"Border (.5x)",ascii_art:"__ __ . __ __ . __ __ . __ __ . __ __ .",def:[.25,-.125,.25,-.125,0,-.125]},{id:"BORDERX2",name:"Border (2x)",ascii_art:"____ ____ . ____ ____ . ___",def:[1,-.5,1,-.5,0,-.5]},{id:"CENTER",name:"Center",ascii_art:"____ _ ____ _ ____ _ ____ _ ____ _ ____",def:[1.25,-.25,.25,-.25]},{id:"CENTER2",name:"Center (.5x)",ascii_art:"___ _ ___ _ ___ _ ___ _ ___ _ ___",def:[.75,-.125,.125,-.125]},{id:"CENTERX2",name:"Center (2x)",ascii_art:"________ __ ________ __ _____",def:[2.5,-.5,.5,-.5]},{id:"DASHDOT",name:"Dash dot",ascii_art:"__ . __ . __ . __ . __ . __ . __ . __",def:[.5,-.25,0,-.25]},{id:"DASHDOT2",name:"Dash dot (.5x)",ascii_art:"_._._._._._._._._._._._._._._.",def:[.25,-.125,0,-.125]},{id:"DASHDOTX2",name:"Dash dot (2x)",ascii_art:"____ . ____ . ____ . ___",def:[1,-.5,0,-.5]},{id:"DASHED",name:"Dashed",ascii_art:"__ __ __ __ __ __ __ __ __ __ __ __ __ _",def:[.5,-.25]},{id:"DASHED2",name:"Dashed (.5x)",ascii_art:"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",def:[.25,-.125]},{id:"DASHEDX2",name:"Dashed (2x)",ascii_art:"____ ____ ____ ____ ____ ___",def:[1,-.5]},{id:"DIVIDE",name:"Divide",ascii_art:"____ . . ____ . . ____ . . ____ . . ____",def:[.5,-.25,0,-.25,0,-.25]},{id:"DIVIDE2",name:"Divide (.5x)",ascii_art:"__..__..__..__..__..__..__..__.._",def:[.25,-.125,0,-.125,0,-.125]},{id:"DIVIDEX2",name:"Divide (2x)",ascii_art:"________ . . ________ . . _",def:[1,-.5,0,-.5,0,-.5]},{id:"DOT",name:"Dot",ascii_art:". . . . . . . . . . . . . . . . . . . . . . . .",def:[0,-.25]},{id:"DOT2",name:"Dot (.5x)",ascii_art:"........................................",def:[0,-.125]},{id:"DOTX2",name:"Dot (2x)",ascii_art:". . . . . . . . . . . . . .",def:[0,-.5]},{id:"HIDDEN",name:"Hidden",ascii_art:"__ __ __ __ __ __ __ __ __ __ __ __ __ __",def:[.25,-.125]},{id:"HIDDEN2",name:"Hidden (.5x)",ascii_art:"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _",def:[.125,-.0625]},{id:"HIDDENX2",name:"Hidden (2x)",ascii_art:"____ ____ ____ ____ ____ ____ ____",def:[.5,-.25]},{id:"PHANTOM",name:"Phantom",ascii_art:"______ __ __ ______ __ __ ______",def:[1.25,-.25,.25,-.25,.25,-.25]},{id:"PHANTOM2",name:"Phantom (.5x)",ascii_art:"___ _ _ ___ _ _ ___ _ _ ___ _ _",def:[.625,-.125,.125,-.125,.125,-.125]},{id:"PHANTOMX2",name:"Phantom (2x)",ascii_art:"____________ ____ ____ _",def:[2.5,-.5,.5,-.5,.5,-.5]},{id:"ACAD_ISO02W100",name:"ISO dash",ascii_art:"__ __ __ __ __ __ __ __ __ __ __ __ __",def:[12,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO03W100",name:"ISO dash space",ascii_art:"__ __ __ __ __ __",def:[12,-18],pen_width:1,unit:"mm"},{id:"ACAD_ISO04W100",name:"ISO long-dash dot",ascii_art:"____ . ____ . ____ . ____ . _",def:[24,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO05W100",name:"ISO long-dash double-dot",ascii_art:"____ .. ____ .. ____ .",def:[24,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO06W100",name:"ISO long-dash triple-dot",ascii_art:"____ ... ____ ... ____",def:[24,-3,.5,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO07W100",name:"ISO dot",ascii_art:". . . . . . . . . . . . . . . . . . . .",def:[.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO08W100",name:"ISO long-dash short-dash",ascii_art:"____ __ ____ __ ____ _",def:[24,-3,6,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO09W100",name:"ISO long-dash double-short-dash",ascii_art:"____ __ __ ____",def:[24,-3,6,-3,6,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO10W100",name:"ISO dash dot",ascii_art:"__ . __ . __ . __ . __ . __ . __ . ",def:[12,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO11W100",name:"ISO double-dash dot",ascii_art:"__ __ . __ __ . __ __ . __ _",def:[12,-3,12,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO12W100",name:"ISO dash double-dot",ascii_art:"__ . . __ . . __ . . __ . .",def:[12,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO13W100",name:"ISO double-dash double-dot",ascii_art:"__ __ . . __ __ . . _",def:[12,-3,12,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO14W100",name:"ISO dash triple-dot",ascii_art:"__ . . . __ . . . __ . . . _",def:[12,-3,.5,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"ACAD_ISO15W100",name:"ISO double-dash triple-dot",ascii_art:"__ __ . . . __ __ . .",def:[12,-3,12,-3,.5,-3,.5,-3,.5,-3],pen_width:1,unit:"mm"},{id:"FENCELINE1",name:"Fenceline circle",ascii_art:"----0-----0----0-----0----0-----0--",def:[.25,-.1,["CIRC1","ltypeshp.shx","x=-.1","s=.1"],-.1,1]},{id:"FENCELINE2",name:"Fenceline square",ascii_art:"----[]-----[]----[]-----[]----[]---",def:[.25,-.1,["BOX","ltypeshp.shx","x=-.1","s=.1"],-.1,1]},{id:"TRACKS",name:"Tracks",ascii_art:"-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-",def:[.15,["TRACK1","ltypeshp.shx","s=.25"],.15]},{id:"BATTING",name:"Batting",ascii_art:"SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS",def:[1e-4,-.1,["BAT","ltypeshp.shx","x=-.1","s=.1"],-.2,["BAT","ltypeshp.shx","r=180","x=.1","s=.1"],-.1]},{id:"HOT_WATER_SUPPLY",name:"Hot water supply",ascii_art:"---- HW ---- HW ---- HW ----",def:[.5,-.2,["HW","STANDARD","S=.1","R=0.0","X=-0.1","Y=-.05"],-.2]},{id:"GAS_LINE",name:"Gas line",ascii_art:"----GAS----GAS----GAS----GAS----GAS----GAS--",def:[.5,-.2,["GAS","STANDARD","S=.1","R=0.0","X=-0.1","Y=-.05"],-.25]},{id:"ZIGZAG",name:"Zig zag",ascii_art:"/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/",def:[1e-4,-.2,["ZIG","ltypeshp.shx","x=-.2","s=.2"],-.4,["ZIG","ltypeshp.shx","r=180","x=.2","s=.2"],-.2]}],o=function(e,t){for(var i=e+3,r=t,o=1;o<i;)o*=2;for(i=o,o=1;o<r;)o*=2;r=o;var s=new Uint8Array(i*r),a=new n.DataTexture(s,i,r,n.LuminanceFormat,n.UnsignedByteType,n.UVMapping,n.ClampToEdgeWrapping,n.ClampToEdgeWrapping,n.NearestFilter,n.NearestFilter,0);return a.generateMipmaps=!1,a.flipY=!1,a.needsUpdate=!0,{tex:s,pw:i,ph:r,lineStyleTex:a}},s=function(e){for(var t=e.length,i=0,n=0;n<t;n++){var r=e[n];r.def.length>i&&(i=r.def.length)}let{tex:s,pw:a,lineStyleTex:c}=o(i,t);for(var h=0;h<t;h++){let t=e[h];l(t,s,h,a)}return c},a=function(){return s(r)},l=function(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:96;for(var o=i*n,s=e.unit&&"mm"==e.unit?1/25.4:1,a=e.pen_width||0,l=e.def,c=0,h=0;h<l.length;h++){var u=Math.abs(l[h]);u<=.5*a&&(u=0);var d=0|u*r*s;c+=d,t[o+h+2]=d||1}t[o]=c%256,t[o+1]=c/256,t[o+l.length+2]=0}},45383:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>r,fX:()=>o,v8:()=>s});var n=i(33472);class r{constructor(){this.webglContextId=1}onContextRestored(){this.webglContextId++}refreshTargetIfNeeded(e){this.refreshIfNeeded(e);const t=null==e?void 0:e.shareDepthFrom;this.refreshIfNeeded(t)}refreshTargetsIfNeeded(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.refreshTargetIfNeeded(e[t]);else this.refreshTargetIfNeeded(e)}refreshIfNeeded(e){if(!e||e.__webglContextId===this.webglContextId)return!1;this._refreshGlData(e),e.__webglContextId=this.webglContextId}_refreshGlData(e){e instanceof THREE.Mesh&&this._refreshMeshGlData(e),e instanceof THREE.BufferGeometry&&this._refreshBufferGeometryGlData(e),e instanceof THREE.WebGLRenderTarget&&this._refreshTargetGlData(e),e instanceof THREE.Texture&&this._refreshTextureGlData(e),e instanceof THREE.Material&&this._refreshMaterialGlData(e)}_refreshMeshGlData(e){var t;e.__webglActive&&(e.__webglActive=void 0),null!==(t=e.geometry)&&void 0!==t&&t.__webglInit&&(e.geometry.__webglInit=void 0)}_refreshBufferGeometryGlData(e){e.__webglInit&&(e.__webglInit=void 0,e.needsUpdate=!0),e.vbbuffer&&(e.vbbuffer=void 0,e.needsUpdate=!0),e.ibbuffer&&(e.ibbuffer=void 0,e.needsUpdate=!0),e.iblinesbuffer&&(e.iblinesbuffer=void 0,e.needsUpdate=!0),e.vaos&&(e.vaos=void 0,e.needsUpdate=!0),e.streamingDraw===n.O&&(e.streamingDraw=!1,e.streamingDrawIndex=!1);for(let t in e.attributes){const i=e.attributes[t];i.buffer&&(i.buffer=void 0,e.needsUpdate=!0)}}_refreshTargetGlData(e){e.__webglFramebuffer&&(e.__webglFramebuffer=null),e.__webglRenderbuffer&&(e.__webglRenderbuffer=null),e.__webglBoundBuffers&&(e.__webglBoundBuffers=null),e.__webglTexture&&(e.__webglTexture=null)}_refreshTextureGlData(e){e.__webglInit&&(e.__webglInit=void 0,e.needsUpdate=!0),e.__webglTexture&&(e.__webglTexture=void 0,e.needsUpdate=!0),e.__webglTextureCube&&(e.__webglTextureCube=null,e.needsUpdate=!0)}_refreshMaterialGlData(e){(e.program||e.programs)&&(e.program=null,e.programs=[],e.needsUpdate=!0)}}const o=e=>{const t={};return e.getAllModels().forEach((e=>{e.isConsolidated()&&(e.unconsolidate(),t[e.id]=!0)})),t},s=async(e,t)=>{for(const i of e.getAllModels())t[i.id]&&await e.impl.consolidateModel(i)}},68630:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MaterialConverter:()=>s});var n=i(72091),r=i(36771);const o=Autodesk.Viewing;let s={convertMaterial:async function(e,t,i,o){if(c(e))return await a(),i=s.convertPrismMaterial(e,t,i,o),e.transparent=i.transparent,i;o=o||e.userassets;var h,u,d=e.materials,f=d[o],p=f.properties;if(i){if(!(i instanceof n.MeshPhongMaterial))return null;i.needsUpdate=!0}else i=new n.MeshPhongMaterial;if(i.proteinMat=e,i.proteinCategories=f.categories,i.packedNormals=!0,f&&"SimplePhong"===f.definition){i.tag=f.tag,i.proteinType=f.proteinType,void 0===i.proteinType&&(i.proteinType=null);var m=(0,r.parseMaterialBoolean)(p,"generic_baked_lighting",!1);i.disableEnvMap=m;var g=i.ambient=(0,r.parseMaterialColor)(p,"generic_ambient"),v=i.color=(0,r.parseMaterialColor)(p,"generic_diffuse"),y=i.specular=(0,r.parseMaterialColor)(p,"generic_specular"),b=i.emissive=(0,r.parseMaterialColor)(p,"generic_emissive");i.shininess=(0,r.parseMaterialScalar)(p,"generic_glossiness",30),i.opacity=1-(0,r.parseMaterialScalar)(p,"generic_transparency",0),i.reflectivity=(0,r.parseMaterialScalar)(p,"generic_reflectivity_at_0deg",0);var x=(0,r.parseMaterialBoolean)(p,"generic_bump_is_normal"),_=(0,r.parseMaterialScalar)(p,"generic_bump_amount",0);null==_&&(_=1),x?(_>1&&(_=1),i.normalScale=new n.Vector2(_,_)):(_>=1&&(_=.03),i.bumpScale=_);var E=(0,r.parseMaterialBoolean)(p,"generic_is_metal");void 0!==E&&(i.metal=E);var S=(0,r.parseMaterialBoolean)(p,"generic_backface_cull");void 0===S||S||(i.side=n.DoubleSide),i.transparent=f.transparent,i.textureMaps={};var A=f.textures;for(var w in A)if((h={}).textureObj=d[A[w].connections[0]],u=h.textureObj.properties,h.textureObj.matrix=l(h.textureObj),h.uriPointer=u.uris.unifiedbitmap_Bitmap.values,h.uri=h.uriPointer[0],h.uri){if("generic_diffuse"==w)h.mapName="map",(!i.color||0===i.color.r&&0===i.color.g&&0===i.color.b)&&i.color.setRGB(1,1,1);else if("generic_bump"==w)h.mapName=x?"normalMap":"bumpMap";else if("generic_specular"==w)h.mapName="specularMap";else{if("generic_alpha"!=w)continue;h.mapName="alphaMap",i.side=n.DoubleSide,i.transparent=!0}i.textureMaps[h.mapName]=h}0===v.r&&0===v.g&&0===v.b&&0===y.r&&0===y.g&&0===y.b&&0===g.r&&0===g.g&&0===g.b&&0===b.r&&0===b.g&&0===b.b&&(v.r=v.g=v.b=.4),i.extraDepthOffset=(0,r.parseMaterialScalar)(p,"generic_depth_offset"),i.extraDepthOffset&&(i.polygonOffset=!0,i.polygonOffsetFactor=i.extraDepthOffset,i.polygonOffsetUnits=0)}else i.ambient=new n.Color(197379),i.color=new n.Color(7829367),i.specular=new n.Color(3355443),i.shininess=30,i.shading=n.SmoothShading;return e.transparent=i.transparent,i},convertTexture:function(e,t,i,o){"bumpMap"==e.mapName||"normalMap"==e.mapName?t.anisotropy=0:t.anisotropy=o||0;t.flipY=void 0===e.flipY||e.flipY,t.invert=!1,t.wrapS=n.RepeatWrapping,t.wrapT=n.RepeatWrapping,t.offset=e.offset??t.offset,t.rotation=e.rotation??t.rotation??0,t.repeat=e.repeat??t.repeat,e.isPrism?s.convertPrismTexture(e.textureObj,t,i):function(e,t){if(!e)return;var i=e.properties;t.invert=(0,r.parseMaterialBoolean)(i,"unifiedbitmap_Invert"),t.clampS=!(0,r.parseMaterialBoolean)(i,"texture_URepeat",!0),t.clampT=!(0,r.parseMaterialBoolean)(i,"texture_VRepeat",!0),t.wrapS=t.clampS?n.ClampToEdgeWrapping:n.RepeatWrapping,t.wrapT=t.clampT?n.ClampToEdgeWrapping:n.RepeatWrapping,t.matrix=e.matrix||(e.matrix=(0,r.Get2DSimpleMapTransform)(i))}(e.textureObj,t)},isPrismMaterial:c,convertMaterialGltf:function(e,t){var i=new n.MeshPhongMaterial({name:e.name??""});i.packedNormals=!0,i.textureMaps={},i.reflectivity=0;var r=e.pbrMetallicRoughness||{},o=r.baseColorTexture||r.baseColorFactor;if(o)if(Array.isArray(o))i.color=new n.Color(o[0],o[1],o[2]),i.opacity=o[3];else if("object"==typeof o){i.color=new n.Color(1,1,1);var s={mapName:"map"},a=t.gltf.textures[o.index];s.uri=t.gltf.images[a.source].uri,s.flipY=!1,i.textureMaps[s.mapName]=s,u(o,s)}var l=r.metallicRoughnessTexture;if(l){s={mapName:"metallicRoughnessTexture"},a=t.gltf.textures[l.index];s.uri=t.gltf.images[a.source].uri,s.flipY=!1,i.textureMaps[s.mapName]=s,u(l,s)}else i.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,i.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1;!0===e.doubleSided&&(i.side=n.DoubleSide);var c=e.alphaMode||h.OPAQUE;c===h.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,c===h.MASK&&(i.alphaTest=void 0!==e.alphaCutoff?e.alphaCutoff:.5));if(void 0!==e.normalTexture){s={mapName:"normalTexture"},a=t.gltf.textures[e.normalTexture.index];s.uri=a.source,s.flipY=!1,s.uri=t.gltf.images[a.source].uri,u(e.normalTexture,s),i.normalScale=s.repeat,void 0!==e.normalTexture.scale&&i.normalScale.set(e.normalTexture.scale,e.normalTexture.scale)}if(void 0!==e.occlusionTexture){s={mapName:"occlusionTexture"},a=t.gltf.textures[e.occlusionTexture.index];s.uri=t.gltf.images[a.source].uri,s.flipY=!1,i.textureMaps[s.mapName]=s,void 0!==e.occlusionTexture.strength&&(i.aoMapIntensity=e.occlusionTexture.strength),u(e.occlusionTexture,s)}void 0!==e.emissiveFactor&&(i.emissive=(new n.Color).fromArray(e.emissiveFactor));if(void 0!==e.emissiveTexture){s={mapName:"emissiveTexture"},a=t.gltf.textures[e.emissiveTexture.index];s.uri=t.gltf.images[a.source].uri,s.flipY=!1,i.textureMaps[s.mapName]=s,u(e.emissiveTexture,s)}return i},applyAppearanceHeuristics:function(e,t,i){var r=e.proteinMat?e.proteinMat:null,o=e.prismType&&-1!==e.prismType.indexOf("Prism");o&&e.transparent&&(e.side===n.FrontSide&&"PrismGlazing"!==e.prismType&&(e.side=n.DoubleSide),e.side===n.DoubleSide&&e.depthTest&&(e.twoPassTransparency=!0));var s=e.textureMaps||{};if(!t){var a,l=e.proteinType&&-1!==e.proteinType.indexOf("Prism");if(e.metal)e.reflectivity||(e.reflectivity=d(e.specular)),r&&(1===e.reflectivity&&(e.reflectivity=d(e.specular)),0===e.color.r&&0===e.color.g&&0===e.color.b||(e.color.r*=.1,e.color.g*=.1,e.color.b*=.1));else if(l){var c=!1;if("PrismLayered"===e.proteinType){e.clearcoat=!0,e.reflectivity=.06;var h=e.proteinCategories;h&&h.length&&-1!=h[0].indexOf("Metal")&&(c=!0)}e.reflectivity=Math.sqrt(e.reflectivity),c?e.specular.copy(e.color):(e.specular.r=e.reflectivity,e.specular.g=e.reflectivity,e.specular.b=e.reflectivity)}else e.reflectivity?e.reflectivity>.3?(e.metal=!0,e.specular.r=e.color.r,e.specular.g=e.color.g,e.specular.b=e.color.b,e.color.r*=.1,e.color.g*=.1,e.color.b*=.1):(e.specular.r*=e.reflectivity,e.specular.g*=e.reflectivity,e.specular.b*=e.reflectivity):1!==e.color.r||1!==e.color.g||1!==e.color.b||1!==e.specular.r||1!==e.specular.g||1!==e.specular.b||s.map||s.specularMap?(e.reflectivity=.01+.06*d(e.specular),e.specular.r*=e.reflectivity,e.specular.g*=e.reflectivity,e.specular.b*=e.reflectivity):(e.metal=!0,e.reflectivity=.7,e.color.r*=.1,e.color.g*=.1,e.color.b*=.1),e.opacity<1&&(e.reflectivity=1);(e.transparent||-1!==(null===(a=s.map)||void 0===a||null===(a=a.uri)||void 0===a?void 0:a.toLowerCase().indexOf(".png"))||s.alphaMap)&&(e.alphaTest=.01)}if(s.normalMap){var u=e.bumpScale;(void 0===u||u>=1)&&(u=1),e.normalScale=new n.Vector2(u,u)}else(void 0===e.bumpScale&&(s.map||s.bumpMap)||e.bumpScale>=1)&&(e.bumpScale=.03);if((!t||o)&&e.transparent){if(o)e.lmv_depthWriteTransparent=!0,e.depthWrite=!!i;else if(e.opacity>=1)s.alphaMap||(e.transparency=!1);else e.lmv_depthWriteTransparent=!0,e.depthWrite=!!i}void 0!==e.shininess&&(e.shininess*=.25)},applyGeometryFlagsToMaterial:function(e,t){t.attributes.color&&(e.vertexColors=n.VertexColors,e.needsUpdate=!0);if(!e.proteinType&&t.attributes.uv&&t.attributes.uv.isPattern){var i=!1;e.map&&!e.bumpMap&&(e.bumpMap=e.map,e.needsUpdate=!0,i=!0),e.textureMaps&&e.textureMaps.map&&!e.textureMaps.bumpMap&&(e.textureMaps.bumpMap=e.textureMaps.map,e.needsUpdate=!0,i=!0),i&&void 0===e.bumpScale&&(e.bumpScale=.03)}},hasTiling:function(e){var t=e.materials[e.userassets[0]];if(t){if("TilingPattern"===t.definition)return!0}return!1},loadMaterialConverterPrismLibrary:a};async function a(){if(o.MaterialConverterPrism&&o.MaterialConverterPrism.convertPrismMaterial||await o.theExtensionManager.downloadExtension("Autodesk.Viewing.MaterialConverterPrism"),!s.convertPrismMaterial)for(let e in o.MaterialConverterPrism)s[e]=o.MaterialConverterPrism[e]}function l(e){return e.matrix||(e.matrix=(0,r.Get2DSimpleMapTransform)(e.properties)),e.matrix}function c(e){var t=e.materials,i=t[e.userassets[0]];if(i){var n=i.definition;if("TilingPattern"===n)(i=t[i.properties.references.grout_material.connections[0]])&&(n=i.definition);return"PrismLayered"===n||"PrismMetal"===n||"PrismOpaque"===n||"PrismTransparent"===n||"PrismGlazing"===n||"PrismWood"===n}return!1}var h={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function u(e,t){var i;t.offset=new n.Vector2(0,0),t.repeat=new n.Vector2(1,1),t.rotation=0;const r=null===(i=e.extensions)||void 0===i?void 0:i.KHR_texture_transform;if(r&&"object"==typeof r){const{scale:e,offset:i,rotation:o}=r;i&&(t.offset=new n.Vector2(i[0],i[1])),e&&(t.repeat=new n.Vector2(e[0],e[1])),o&&(t.rotation=o)}}function d(e){return.299*e.r+.587*e.g+.114*e.b}},36771:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Get2DSimpleMapTransform:()=>h,MaterialConverterCommon:()=>u,SRGBToLinear:()=>c,SRGBToLinearFloat:()=>l,parseMaterialBoolean:()=>s,parseMaterialColor:()=>r,parseMaterialGeneric:()=>a,parseMaterialScalar:()=>o});var n=i(72091);function r(e,t,i){if(!e||!e.colors)return new n.Color(1,0,0);var r=e.colors[t];if(!r)return new n.Color(0,0,0);var o=r.values;if(!o||!o.length)return new n.Color(1,0,0);var s=o[0];return new n.Color(s.r,s.g,s.b)}function o(e,t,i){if(!e||!e.scalars)return i;var n=e.scalars[t];return n?n.values[0]:i}function s(e,t,i){if(!e||!e.booleans)return i;var n=e.booleans[t];return void 0===n?i:n}function a(e,t,i,n){if(!e||!e[t])return n;var r=e[t][i];return r?r.values[0]:n}function l(e){var t=e;return t<=.04045?t/=12.92:t=Math.pow((t+.055)/1.055,2.4),t}function c(e){var t,i,r;return t=l(e.r),i=l(e.g),r=l(e.b),new n.Color(t,i,r)}function h(e){var t=o(e,"texture_UScale",1),i=o(e,"texture_VScale",1),n=o(e,"texture_UOffset",0),r=o(e,"texture_VOffset",0),s=o(e,"texture_WAngle",0);return{elements:[Math.cos(s)*t,Math.sin(s)*i,0,-Math.sin(s)*t,Math.cos(s)*i,0,n,r,1]}}let u={parseMaterialColor:r,parseMaterialScalar:o,parseMaterialBoolean:s,parseMaterialGeneric:a,SRGBToLinearFloat:l,SRGBToLinear:c,Get2DSimpleMapTransform:h}},62612:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MATERIAL_VARIANT:()=>A,MaterialManager:()=>T});var n=i(72091),r=i(90255),o=i(83081),s=i(49965),a=i.n(s),l=i(24314),c=i.n(l),h=i(30130);let u={uniforms:n.UniformsUtils.merge([h.ShaderChunks.CutPlanesUniforms,{pixelsPerUnit:{type:"f",value:1},aaRange:{type:"f",value:.5},tLayerMask:{type:"t",value:null},tLineStyle:{type:"t",value:null},vLineStyleTexSize:{type:"v2",value:new n.Vector2(13,70)},tRaster:{type:"t",value:null},tSelectionTexture:{type:"t",value:null},vSelTexSize:{type:"v2",value:new n.Vector2(4096,1)},displayPixelRatio:{type:"f",value:1},opacity:{type:"f",value:1},selectionColor:{type:"v4",value:new n.Vector4(0,0,1,1)},modelId:{type:"v3",value:new n.Vector3(0,0,0)},viewportId:{type:"f",value:0},swap:{type:"f",value:0},grayscale:{type:"f",value:0},viewportBounds:{type:"v4",value:new n.Vector4(0,0,1,1)},unpackXform:{type:"v4",value:new n.Vector4(1,1,0,0),perObject:!0},tIdColor:{type:"t",value:null,perObject:!0},vIdColorTexSize:{type:"v2",value:new n.Vector2(256,1),perObject:!0},meshAnimTime:{type:"f",value:0,perObject:!0}}]),vertexShader:a(),fragmentShader:c()};var d=i(97431),f=i.n(d),p=i(65144),m=i.n(p),g=i(30514);let v={uniforms:n.UniformsUtils.merge([u.uniforms,{aaRange:{type:"f",value:1},size:{type:"v2",value:new n.Vector2(1024,768)},cameraPos:{type:"v3",value:new n.Vector3},tanHalfFov:{type:"f",value:0},miterLimit:{type:"f",value:g.VBB_MITER_SEGMENT_LIMIT},miterScaleFactor:{type:"f",value:g.VBB_MITER_SEGMENT_SCALE_FACTOR},miterCP:{type:"f",value:g.VBB_MITER_SEGMENT_CP}}]),vertexShader:f(),fragmentShader:m()};class y extends n.ShaderMaterial{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e.isScreenSpace?{uniforms:n.UniformsUtils.clone(v.uniforms),vertexShader:v.vertexShader,fragmentShader:v.fragmentShader}:{uniforms:n.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}),this.isScreenSpace=!!e.isScreenSpace,e.hasLineStyles&&(this.hasLineStyles=!0),this.is2d=!0,this.supportsViewportBounds=!0,this.depthWrite=!1,this.depthTest=!1,this.side=n.DoubleSide,this.transparent=!0,this.blending=n.NormalBlending,this.type="LMVLineMaterial"+(this.isScreenSpace?"SS":""),"multiply"==e.compositeOperation?this.blending=n.MultiplyBlending:"min"==e.compositeOperation||"darken"==e.compositeOperation?(this.blending=n.CustomBlending,this.blendEquation=n.MinEquation,this.blendEquationAlpha=n.AddEquation,this.blendSrcAlpha=n.SrcAlphaFactor,this.blendDstAlpha=n.DstAlphaFactor):"max"!=e.compositeOperation&&"lighten"!=e.compositeOperation||(this.blending=n.CustomBlending,this.blendEquation=n.MaxEquation,this.blendEquationAlpha=n.AddEquation,this.blendSrcAlpha=n.SrcAlphaFactor,this.blendDstAlpha=n.DstAlphaFactor)}}var b=i(97011),x=i(68630);function _(e,t,i){e.x=t.r,e.y=t.g,e.z=t.b,e.w=i}var E=new n.Color("#0000FF"),S=.6;const A={INSTANCED:0,VERTEX_IDS:1},w=(e,t,i)=>{e[t]=i,e.needsUpdate=!0};function T(e){this._renderer=e,this._textures={},this._texturesToUpdate=[],this._materials={},this._materialsNonHDR={},this._exposureBias=0,this._tonemapMethod=0,this._envMapExposure=1,this._envRotationSin=0,this._envRotationCos=1,this._reflectionMap=null,this._irradianceMap=null,this._cutplanes=[],this.cutplanesHideInterior=0,this._mrtNormals=!1,this._mrtIdBuffer=void 0,this._polygonOffsetOn=!1,this._pixelsPerUnit=1,this._lineStyleTex=null,this._swapBlackAndWhite=0,this._grayscaleLines=0,this._depthWriteTransparent=!0,this._needsTwoSided=!1,this._hasTransparentMaterial=!1,this.hasPrism=!1,this._forceDoubleSided=!1,this._layerMaskTextures={},this._layerMaps={},this._selectionTextures={},this._prismWoodTextures=void 0,this.defaultMaterial=new n.MeshPhongMaterial({color:7829367,specular:3355443,shininess:30,reflectivity:0}),this.addMaterial("__defaultMaterial__",this.defaultMaterial),this.initLineStyleTexture(),this.refCount=0}T.prototype.dtor=function(){this.cleanup(),n.Cache.clear(),this._renderer=null},T.prototype._getModelHash=function(e){const t=e&&("number"==typeof e?e:e.id);return"model:"+(t||"")+"|"},T.prototype._getMaterialHash=function(e,t){return e&&e.isOTG()?t:this._getModelHash(e)+"mat:"+t},T.prototype._getTextureHash=function(e,t,i,n){return`${this._getModelHash(e)}mat:${n}|tex:${t}|map:${i}`},T.prototype.addNonHDRMaterial=function(e,t){t.doNotCut||(t.cutplanes=this._cutplanes),this._applyMRTFlags(t),this._materialsNonHDR[e]=t},T.prototype.removeNonHDRMaterial=function(e){delete this._materialsNonHDR[e]},T.prototype.addMaterialNonHDR=function(e,t){this.addNonHDRMaterial(e,t)},T.prototype.addHDRMaterial=function(e,t){this._reflectionMap&&!t.disableEnvMap&&(t.envMap=this._reflectionMap),this._irradianceMap&&(t.irradianceMap=this._irradianceMap),t.exposureBias=Math.pow(2,this._exposureBias),t.tonemapOutput=this._tonemapMethod,t.envMapExposure=this._envMapExposure,t.envRotationSin=this._envRotationSin,t.envRotationCos=this._envRotationCos,this._applyCutPlanes(t),this._applyMRTFlags(t),this._applyPolygonOffset(t,this._polygonOffsetOn),this._materials[e]=t},T.prototype._applyCutPlanes=function(e){e.doNotCut?e.cutplanes=null:(e.cutplanes=this._cutplanes,e.cutplanesHideInterior=this.cutplanesHideInterior,e.needsUpdate=!0,this._cutplanes&&this._cutplanes.length>0?e.side=n.DoubleSide:this._needsTwoSided||e.is2d||this._forceDoubleSided||(e.side=n.FrontSide))},T.prototype.addMaterial=function(e,t,i){var r=t.prismType&&-1!==t.prismType.indexOf("Prism");this.hasPrism=r||this.hasPrism,x.MaterialConverter.applyAppearanceHeuristics(t,r||i,this.isDepthWriteTransparentEnabled()),t.side===n.DoubleSide&&(this._needsTwoSided=!0),this.addHDRMaterial(e,t)},T.prototype.addLineMaterial=function(e,t,i){var n=i&&this._layerMaskTextures[i];n&&(t.defines.HAS_LAYERS=1,t.uniforms.tLayerMask.value=n),t.hasLineStyles&&(t.defines.HAS_LINESTYLES=1,t.defines.MAX_LINESTYLE_LENGTH=this._lineStyleTex.image.width,t.uniforms.tLineStyle.value=this._lineStyleTex,t.uniforms.vLineStyleTexSize.value.set(this._lineStyleTex.image.width,this._lineStyleTex.image.height)),t.uniforms.swap.value=this._swapBlackAndWhite,t.uniforms.grayscale.value=this._grayscaleLines,t.doNotCut||(t.cutplanes=this._cutplanes),this._updatePixelScaleForMaterial(t),this._materials[e]=t,this._applyMRTFlags(t)},T.prototype.addOverrideMaterial=function(e,t){if(this.addNonHDRMaterial(e,t),t.variants)for(var i=0;i<t.variants.length;i++){var n=t.variants[i];if(n){var r=e+"_variant_"+i;this.addNonHDRMaterial(r,n)}}},T.prototype.getMaterialVariant=function(e,t,i){var n=!!e.hash,r=(n?e.hash:this._getModelHash(i)+e.id)+"|"+t,o=this._materials[r];return o||(o=this.cloneMaterial(e,i),t===A.INSTANCED?(o.useInstancing=!0,o.vertexIds=!0):t===A.VERTEX_IDS&&(o.vertexIds=!0),this.addHDRMaterial(r,o)),n&&this._addMaterialRef(o,i.id),o},T.prototype.addInstancingSupport=function(e){var t=e.clone();t.useInstancing=!0,t.packedNormals=e.packedNormals,t.disableTheming=e.disableTheming;var i=e.clone();i.wideLines=!0,i.packedNormals=e.packedNormals,e.variants=[t,i],e.getCustomOverrideMaterial=function(e){return e.useInstancing?this.variants[0]:e.wideLines?(this.variants[1].linewidth=e.linewidth,this.variants[1]):null}},T.prototype.addCompactLayoutSupport=function(e){var t=function(t){var i=t.clone();return e.uniforms.tSelectionTexture.value&&(i.uniforms.tSelectionTexture.value=e.uniforms.tSelectionTexture.value),e.uniforms.tLayerMask.value&&(i.uniforms.tLayerMask.value=e.uniforms.tLayerMask.value),i.is2d=e.is2d,i.supportsViewportBounds=e.supportsViewportBounds,i.modelScale=e.modelScale,i.defines=Object.assign({},e.defines),i.attributes=Object.assign({},e.attributes),i},i=t(e);i.defines.UNPACK_POSITIONS=1;var n=t(e);n.defines.USE_INSTANCING=1;var r=t(e);r.defines.UNPACK_POSITIONS=1,r.defines.USE_INSTANCING=1,e.variants=[i,n,r],e.getCustomOverrideMaterial=function(e){if(e.defines){var t=(e.defines.UNPACK_POSITIONS?1:0)+(e.defines.USE_INSTANCING?2:0);if(t>0)return this.variants[t-1]}return null}},T.prototype.removeMaterial=function(e){delete this._materials[e]},T.prototype.findMaterial=function(e,t){var i=this._getMaterialHash(e,t);return this._materials[i]},T.prototype.convertSharedMaterial=async function(e,t,i){var n=this.findMaterial(e,i);return n||((n=await this.convertOneMaterial(e,t,i)).hash=i),this._addMaterialRef(n,e.id),n},T.prototype.convertOneMaterial=async function(e,t,i){var r=x.MaterialConverter.isPrismMaterial(t);r&&await x.MaterialConverter.loadMaterialConverterPrismLibrary();var s=e.getData(),a=s&&s.materials?s.materials.scene.SceneUnit:"inch",l=r&&x.MaterialConverter.swapPrismWoodTextures(this._prismWoodTextures);l&&o.logger.warn("Unexpected wood textures converting a material");var c=await x.MaterialConverter.convertMaterial(t,a);if(s.doubleSided&&(c.side=n.DoubleSide),this.addMaterial(i,c),this._hasTransparentMaterial=this._hasTransparentMaterial||c.transparent,x.MaterialConverter.hasTiling(t)){c.decals=[];var h=t.materials,u=h[t.userassets[0]];let e=u.properties.references.base_materials.connections,n=u.properties.references.tiles.connections,r=[];for(let o=0;o<n.length;o++){let s=h[n[o]];r.push(s),(m=await x.MaterialConverter.convertMaterial(t,a,null,e[o])).useTiling=!0,m.transparent=!0,c.decals.push({uv:0,material:m}),this.addMaterial(i+"|tile|"+o,m)}x.MaterialConverter.materialTilingPattern(t,u,r,c.decals,a)}if(t.decals){c.decals||(c.decals=[]);for(var d=0,f=t.decals.length;d<f;d++){var p=t.decals[d],m=await x.MaterialConverter.convertMaterial(p.material,a);c.decals.push({uv:p.uv||0,material:m}),this.addMaterial(i+"|decal|"+d,m)}}return this._prismWoodTextures=r&&x.MaterialConverter.swapPrismWoodTextures(l),c},T.prototype.forEach=function(e,t,i,n){for(var r in n=n||this._materials){var o=n[r];t&&o.is2d||(e(o,r),i&&o.variants&&o.variants.forEach((function(t){t&&e(t)})))}},T.prototype.forEachInModel=function(e,t,i){const n=this._getModelHash(e),r=(e,t)=>{-1!==t.indexOf(n)&&i(e)};this.forEach(r,!1,t),this.forEach(r,!1,t,this._materialsNonHDR)};var M={needsClear:!1,needsRender:!1,overlayDirty:!1};function C(e,t,i){let n=e.slots[i];n?-1==n.indexOf(t)&&n.push(t):e.slots[i]=[t]}T.prototype.updateMaterials=function(){for(M.needsRender=!1;this._texturesToUpdate.length;){var e=this._texturesToUpdate.pop();for(let i in e.slots){let n=e.slots[i];for(var t=0;t<n.length;t++)n[t][i]=e.tex,n[t].needsUpdate=!0,M.needsRender=!0}}return M},T.prototype.setTextureInCache=function(e,t,i,n){var r=this._getTextureHash(e,i.uri,i.mapName,t.id),o=this._textures[r];if(o){for(var s in o.tex||(o.tex=n),o.slots)for(var a=o.slots[s],l=0;l<a.length;l++)a[l][s]=n;this._texturesToUpdate.push(o)}},T.prototype.loadTextureFromCache=function(e,t,i,n){var r=this._getTextureHash(e,i.uri,i.mapName,t.id),o=this._textures[r];if(o)o.tex?(t[n]=o.tex,t.needsUpdate=!0):(o.slots[n]||(o.slots[n]=[]),o.slots[n].push(t));else{var s={};s[n]=[t],this._textures[r]={slots:s,tex:null}}return!!o},T.prototype.getOtgMaterials=function(e){const t=(e,t)=>{const i=t.indexOf(e);if(-1!==i)return{hash:e,idx:i};const n=e+"|"+A.INSTANCED,r=t.indexOf(n);if(-1!==r)return{hash:n,idx:r};const o=e+"|"+A.VERTEX_IDS,s=t.indexOf(o);return-1!==s?{hash:o,idx:s}:void 0};let i={};const n=e.getData(),r=n.fragments.materials,o=Object.keys(this._materials);for(let e=0;e<r.length;e++){const s=r[e],a=t(n.getMaterialHash(s),o);a&&(i[a.hash]=this._materials[a.hash],o.splice(a.idx,1))}return i},T.prototype.getModelMaterials=function(e,t){var i=this._getModelHash(e);let n={};const r={};t&&e.isOTG()&&(n=this.getOtgMaterials(e));for(let e in this._materials)if(-1!==e.indexOf(i)){var o=this._materials[e];o.defines&&o.defines.hasOwnProperty("SELECTION_RENDERER")?r[e]=o:n[e]=o}var s={};for(let e in this._materialsNonHDR)-1!==e.indexOf(i)&&(s[e]=this._materialsNonHDR[e]);var a={};for(let e in this._textures)-1!==e.indexOf(i)&&(a[e]=this._textures[e]);return{mats:n,selectionMats:r,matsNonHDR:s,textures:a}},T.prototype.exportModelMaterials=function(e,t){const i=this.getModelMaterials(e);return this.cleanup(e),i},T.prototype.importModelMaterials=function(e,t){for(var i in e.mats){var n=e.mats[i];n.is2d?this.addLineMaterial(i,n,t):this.addHDRMaterial(i,n)}for(var i in e.matsNonHDR)this.addMaterialNonHDR(i,e.matsNonHDR[i]);for(var r in e.textures)this._textures[r]=e.textures[r]},T.prototype.cloneMaterial=function(e,t){var i=e.clone();if(e.defines&&(i.defines=Object.assign({},e.defines)),(i instanceof n.MeshPhongMaterial||i.isPrismMaterial)&&(i.packedNormals=e.packedNormals,i.exposureBias=e.exposureBias,i.irradianceMap=e.irradianceMap,i.envMapExposure=e.envMapExposure,i.envRotationSin=e.envRotationSin,i.envRotationCos=e.envRotationCos,i.proteinType=e.proteinType,i.proteinMat=e.proteinMat,i.proteinCategories=e.proteinCategories,i.tonemapOutput=e.tonemapOutput,i.cutplanes=e.cutplanes,i.textureMaps=e.textureMaps,i.texturesLoaded=e.texturesLoaded),e.doNotCut&&(i.doNotCut=!0),e.is2d&&(i.is2d=!0),e.disableEnvMap&&(i.disableEnvMap=!0),e.supportsViewportBounds&&(i.supportsViewportBounds=!0),e.textureMaps)for(var r in e.textureMaps)if(e[r])i[r]=e[r];else if(t){var s=i.textureMaps[r],a=s.uri,l=s.mapName,c=this._getTextureHash(t,a,l,e.id),h=this._textures[c];h?C(h,i,r):o.logger.error("Missing texture receiver",c)}else o.logger.error("Cannot connect pending texture maps because cloneMaterial was called without a model");return this._applyMRTFlags(i),i},T.prototype.setupMaterial=function(e,t,i){var r=e.getData(),s=this.findMaterial(e,i);if(!s){s=this.cloneMaterial(this.defaultMaterial,e);var a=this._getMaterialHash(e,i);this._materials[a]=s,o.logger.warn("Material ("+i+") missing, using default material instead.")}if(t.isLines||t.isWideLines||t.isPoints){var l=!!t.attributes.color,c=s;if(c||(c=this.defaultMaterial.clone()),t.isPoints)s=new n.PointCloudMaterial({vertexColors:l,size:t.pointSize});else{var h=l?"cachedLineMaterialVC":"cachedLineMaterial";s=c[h],t.isWideLines?(s||((s=c[h]=new n.MeshBasicMaterial({vertexColors:l})).wideLines=!0),t.isLines=!1,s.polygonOffset=c.polygonOffset,s.polygonOffsetFactor=c.polygonOffsetFactor,s.polygonOffsetUnits=c.polygonOffsetUnits,s.linewidth=c.linewidth):s||(s=c[h]=new n.LineBasicMaterial({vertexColors:l}))}l||(s.color=c.color),s.svfMatId=i;var u=this._getMaterialHash(e,i+"_line_"+s.id);this.addMaterialNonHDR(u,s),r.hasLines=!0}else s.svfMatId=i,x.MaterialConverter.applyGeometryFlagsToMaterial(s,t);return s},T.prototype._addMaterialRef=function(e,t){e._sharedBy||(e._sharedBy=[]);var i=e._sharedBy;-1===i.indexOf(t)&&i.push(t)},T.prototype._removeMaterialRef=function(e,t){var i=e._sharedBy,n=i?i.indexOf(t):-1;-1!==n&&i.splice(n,1)},T.prototype.cleanup=function(e){var t=this._getModelHash(e),i={};for(var r in this._textures){var o=this._textures[r];-1===r.indexOf(t)?i[r]=o:o.tex&&(o.tex.dispose(),o.tex.needsUpdate=!0)}this._textures=i;var s={},a={type:"dispose"};for(var l in this._materials){var c=this._materials[l],h=!e||-1!==l.indexOf(t);if(c._sharedBy&&(h?c._sharedBy.length=0:(this._removeMaterialRef(c,e.id),0===c._sharedBy.length&&(h=!0))),h){if((c=this._materials[l]).dispatchEvent(a),c.needsUpdate=!0,c.envMap=null,c.is2d){c.uniforms.tLayerMask.value=null,c.uniforms.tLineStyle.value=null;var u=c.uniforms.tRaster;u&&u.value instanceof n.Texture&&(u.value.dispose(),u.value.needsUpdate=!0)}}else s[l]=this._materials[l]}this._materials=s;var d={};for(var l in this._materialsNonHDR){if(e&&-1===l.indexOf(t))d[l]=this._materialsNonHDR[l];else(c=this._materialsNonHDR[l]).dispatchEvent(a),c.needsUpdate=!0}this._materialsNonHDR=d;var f=(e,t)=>{var i=this._selectionTextures[e];i&&(i.dispose(),i.needsUpdate=!0,t&&delete this._selectionTextures[e])},p=(e,t)=>{const i=this._layerMaskTextures[e];void 0!==i&&(i.dispose(),i.needsUpdate=!0,t&&delete this._layerMaskTextures[e])};if(this._prismWoodTextures&&x.MaterialConverter.disposePrismWoodTextures(this._prismWoodTextures),this._prismWoodTextures=void 0,e)f(e.id,!0),p(e.id,!0),delete this._layerMaps[e.id];else{for(var m in this._selectionTextures)this._selectionTextures.hasOwnProperty(m)&&f(m,!1);for(var m in this._selectionTextures={},this._layerMaskTextures)this._layerMaskTextures.hasOwnProperty(m)&&p(m,!1);this._layerMaskTextures={},this._layerMaps={},this._reflectionMap=null,this._irradianceMap=null}},T.prototype.toggleDepthWriteTransparent=function(e){this._depthWriteTransparent!=e&&(this._depthWriteTransparent=e,this.forEach((function(t){t.lmv_depthWriteTransparent&&(t.depthWrite=e)}),!1,!0))},T.prototype.isDepthWriteTransparentEnabled=function(){return this._depthWriteTransparent},T.prototype.hasTwoSidedMaterials=function(){return this._needsTwoSided},T.prototype.hasTransparentMaterial=function(){return this._hasTransparentMaterial},T.prototype.texturesLoaded=function(){return 0===this._texturesToUpdate.length},T.prototype.renderer=function(){return this._renderer},T.prototype.setTonemapExposureBias=function(e){this._exposureBias=e;var t=Math.pow(2,e);this.forEach((function(e){w(e,"exposureBias",t)}),!0,!0)},T.prototype.setTonemapMethod=function(e){this._tonemapMethod=e,this.forEach((function(t){t.tonemapOutput=e,t.needsUpdate=!0}),!0,!0)},T.prototype.setEnvExposure=function(e){var t=Math.pow(2,e);this._envMapExposure=t,this.forEach((function(e){w(e,"envMapExposure",t)}),!0,!0)},T.prototype.setEnvRotation=function(e){var t=this._envRotationSin=Math.sin(e),i=this._envRotationCos=Math.cos(e);this.forEach((function(e){e.envRotationSin=t,e.envRotationCos=i,e.needsUpdate=!0}),!0,!0)},T.prototype.setReflectionMap=function(e){this._reflectionMap=e,this.forEach((function(t){t.disableEnvMap||w(t,"envMap",e)}),!0,!0)},T.prototype.setIrradianceMap=function(e){this._irradianceMap=e,this.forEach((function(t){w(t,"irradianceMap",e)}),!0,!0)},T.prototype.setDoubleSided=function(e,t){this._forceDoubleSided=e;let i={};i=t?this.getModelMaterials(t,!0).mats:this._materials,this.forEach((function(t){t.side=e?n.DoubleSide:n.FrontSide,t.needsUpdate=!0}),!0,!0,i)},T.prototype.setCutPlanes=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i=!1;const r=this._cutplanes.length!==(e&&e.length||0),o=t!==this.cutplanesHideInterior,s=r||o;for(;this._cutplanes.length>0;)this._cutplanes.pop();if(this.cutplanesHideInterior=t,e)for(var a=0;a<e.length;a++)this._cutplanes.push(e[a].clone());if(s)for(var l in this.forEach((e=>{this._applyCutPlanes(e),i=i||e.side==n.DoubleSide}),!1,!0),this._materialsNonHDR)this._materialsNonHDR[l].doNotCut||(this._materialsNonHDR[l].needsUpdate=!0);return i||this._needsTwoSided},T.prototype.getCutPlanes=function(){return this._cutplanes.slice()},T.prototype.getCutPlanesRaw=function(){return this._cutplanes},T.prototype._applyPolygonOffset=function(e){(e instanceof n.MeshPhongMaterial||e.isPrismMaterial)&&(e.polygonOffset=this._polygonOffsetOn,e.polygonOffsetFactor=this._polygonOffsetFactor,e.polygonOffsetUnits=this._polygonOffsetUnits,e.extraDepthOffset&&(e.polygonOffsetFactor+=e.extraDepthOffset),e.needsUpdate=!0)},T.prototype.getPolygonOffsetOn=function(){return this._polygonOffsetOn},T.prototype.getPolygonOffsetFactor=function(){return this._polygonOffsetFactor},T.prototype.getPolygonOffsetUnits=function(){return this._polygonOffsetUnits},T.prototype.togglePolygonOffset=function(e,t,i){this._polygonOffsetOn=e,this._polygonOffsetFactor=e?t||1:0,this._polygonOffsetUnits=e?i||.1:0;var n=this;this.forEach((function(e){n._applyPolygonOffset(e)}),!1,!0)},T.prototype._applyMRTFlags=function(e){var t=e.supportsMrtNormals||e instanceof n.MeshPhongMaterial||e.isPrismMaterial||e instanceof n.MeshBasicMaterial||e instanceof n.LineBasicMaterial||e instanceof n.PointCloudMaterial||e instanceof n.PointsMaterial,i=e.mrtNormals,r=e.mrtIdBuffer;e.skipMrtNormals||(e.mrtNormals=t&&this._mrtNormals),e.mrtIdBuffer=this._mrtIdBuffer,e.mrtNormals===i&&e.mrtIdBuffer===r||(e.needsUpdate=!0)},T.prototype.toggleMRTSetting=function(e){this._mrtNormals=e.mrtNormals,this._mrtIdBuffer=e.mrtIdBuffer;var t=this;function i(e){t._applyMRTFlags(e)}this.forEach(i,!1,!0),this.forEach(i,!1,!0,this._materialsNonHDR)},T.prototype.adjustMaterialMRTSetting=function(e){this._applyMRTFlags(e)},T.prototype.initLineStyleTexture=function(){this._lineStyleTex=(0,b.createLinePatternTexture)()},T.prototype.setLineStyleTexture=function(e){this._lineStyleTex=e},T.prototype.initLayersTexture=function(e,t,i){for(var r=this._layerMaskTextures[i],o=r?r.image.data:new Uint8Array(65536),s=0,a=e;s<a;s++)o[s]=255;(r=r||new n.DataTexture(o,256,256,n.LuminanceFormat,n.UnsignedByteType,n.UVMapping,n.ClampToEdgeWrapping,n.ClampToEdgeWrapping,n.NearestFilter,n.NearestFilter,0)).generateMipmaps=!1,r.flipY=!1,r.needsUpdate=!0,this._layerMaskTextures[i]=r,this._layerMaps[i]=t},T.prototype.setLayerVisible=function(e,t,i){for(var n=this._layerMaskTextures[i],r=n.image.data,o=this._layerMaps[i],s=t?255:0,a=0;a<e.length;++a){r[o[e[a]]]=s}n.needsUpdate=!0,this.forEach((function(e){e.is2d&&(e.needsUpdate=!0)}))},T.prototype.initSelectionTexture=function(e,t){if(this._selectionTextures[t])return this._selectionTextures[t];for(var i=e||1,r=4096,o=0|Math.ceil(i/r),s=1;s<o;)s*=2;o=s;for(var a=new Uint8Array(r*o),l=0;l<i;l++)a[l]=0;var c=new n.DataTexture(a,r,o,n.LuminanceFormat,n.UnsignedByteType,n.UVMapping,n.ClampToEdgeWrapping,n.ClampToEdgeWrapping,n.NearestFilter,n.NearestFilter,0);return c.generateMipmaps=!1,c.flipY=!1,c.needsUpdate=!0,this._selectionTextures[t]=c,c},T.prototype.highlightObject2D=function(e,t,i){var n=this._selectionTextures[i];n&&(n.image.data[e]=t?255:0,n.needsUpdate=!0)},T.prototype._updatePixelScaleForMaterial=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._camera,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._deviceWidth,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._deviceHeight,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this._pixelsPerUnit,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(e.is2d){if(e.isScreenSpace)if(e.uniforms.size.value.set(i,n),e.uniforms.aaRange.value=.5,null!=t&&t.isPerspective){e.uniforms.cameraPos.value.copy(t.position);const i=t.fov*Math.PI/180;e.uniforms.tanHalfFov.value=Math.tan(.5*i)}else e.uniforms.tanHalfFov.value=0;else e.uniforms.aaRange.value=.5/(r*e.modelScale*o);e.uniforms.pixelsPerUnit.value=r*e.modelScale*o}},T.prototype.updatePixelScale=function(e,t,i,n){this._pixelsPerUnit=e,this._deviceWidth=t,this._deviceHeight=i,this._camera=n,this.forEach((r=>this._updatePixelScaleForMaterial(r,n,t,i,e)))},T.prototype.updatePixelScaleForModel=function(e,t,i,n,r,o){const s=this.getModelMaterials(e),a=e=>this._updatePixelScaleForMaterial(e,o,i,n,t,r);Object.values(s.mats).forEach(a),Object.values(s.matsNonHDR).forEach(a),Object.values(s.selectionMats).forEach(a)},T.prototype.updateSwapBlackAndWhite=function(e){var t=this._swapBlackAndWhite=e?1:0;this.forEach((function(e){e.is2d&&(e.uniforms.swap.value=t)}))},T.prototype.setGrayscale=function(e){var t=this._grayscaleLines=e?1:0;this.forEach((function(e){e.is2d&&(e.uniforms.grayscale.value=t)}))},T.prototype.updateViewportId=function(e){this.forEach((function(t){t.is2d&&(t.uniforms.viewportId.value=e,t.needsUpdate=!0)}))},T.prototype.create2DMaterial=function(e,t,i,o,s){var a=e?e.getData():null,l="__lineMaterial__";t.image&&(l+="|image:"+t.image.name),t.clip&&(l+="|clip:"+JSON.stringify(t.clip)),i&&(l+="|id"),o&&(l+="|selection"),t.skipEllipticals&&(l+="|skipEllipticals"),t.skipCircles&&(l+="|skipCircles"),t.skipTriangleGeoms&&(l+="|skipTriangleGeoms"),t.skipMiterLines&&(l+="|skipMiterLines"),t.useInstancing&&(l+="|useInstancing"),t.isScreenSpace&&(l+="|isScreenSpace"),t.unpackPositions&&(l+="|unpackPositions"),t.hasLineStyles&&(l+="|hasLineStyles"),t.compositeOperation&&(l+="|"+t.compositeOperation),t.hasOpacity&&(l+="|hasOpacity"),t.noIdOutput&&(l+="|noIdOutput");var c=this._getMaterialHash(e,l);if(!this._materials.hasOwnProperty(c)){var h=new y(t);if(i?(h.defines.ID_COLOR=1,h.blending=n.NoBlending):o?(h.uniforms.tSelectionTexture.value=o,h.uniforms.vSelTexSize.value.set(o.image.width,o.image.height),h.defines.SELECTION_RENDERER=1,this.get2dSelectionColor(h.uniforms.selectionColor)):(this.get2dSelectionColor(h.uniforms.selectionColor),h.mrtIdBuffer=this._mrtIdBuffer),t.skipEllipticals||(h.defines.HAS_ELLIPTICALS=1),t.skipCircles||(h.defines.HAS_CIRCLES=1),t.skipTriangleGeoms||(h.defines.HAS_TRIANGLE_GEOMS=1),t.skipMiterLines||(h.defines.HAS_MITER_LINES=1),t.noIdOutput&&(h.defines.NO_ID_OUTPUT=1),t.useInstancing&&(h.defines.USE_INSTANCING=1),t.unpackPositions&&!i&&(h.defines.UNPACK_POSITIONS=1),t.msdfFontTexture&&(h.defines.MSDF_TEXTURE_FONT=1),t.imageUVTexture&&(h.defines.IMAGE_UV_TEXTURE=1),t.viewportBounds&&(h.uniforms.viewportBounds.value=t.viewportBounds.clone(),h.defines.VIEWPORT_CLIPPING=1),"number"==typeof t.opacity&&(h.uniforms.opacity.value=t.opacity),t.image){var u=function(i,r){i?(i.wrapS=n.ClampToEdgeWrapping,i.wrapT=n.ClampToEdgeWrapping,i.minFilter=r?n.LinearFilter:n.LinearMipMapLinearFilter,i.magFilter=n.LinearFilter,i.anisotropy=1,i.flipY=!0,i.generateMipmaps=!0,i.needsUpdate=!0,t.msdfFontTexture||t.imageUVTexture||(h.defines.HAS_RASTER_QUADS=1),h.uniforms.tRaster.value=i,h.needsUpdate=!0,s&&s(i,e)):s&&s(i,e,t)};if("undefined"!=typeof HTMLCanvasElement&&t.image instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t.image instanceof HTMLImageElement)u(new n.Texture(r.TextureLoader.imageToCanvas(t.image,"multiply"==t.compositeOperation,t.compositeCanvasColor),n.UVMapping),!0);else r.TextureLoader.loadTextureWithSecurity(t.image.dataURI,n.UVMapping,u,null,a.acmSessionId)}h.modelScale=t.modelScale||1,t.doNotCut&&(h.doNotCut=!0),h.textureMaps={},this.addLineMaterial(c,h,e&&e.id),(i||o)&&this.addCompactLayoutSupport(h)}return l},T.prototype.set2dSelectionColor=function(e,t){E=new n.Color(e),S=null==t?S:t,this.forEach((function(e){if(e.is2d&&e.uniforms){var t=e.uniforms.selectionColor;t&&(_(t.value,E,S),e.needsUpdate=!0)}}))},T.prototype.get2dSelectionColor=function(e){return e&&_(e.value,E,S),E},T.prototype.get2dSelectionOpacity=function(){return S},T.prototype.setMaterialViewportBounds=function(e,t){e.supportsViewportBounds&&(t?e.defines.VIEWPORT_CLIPPING?e.uniforms.viewportBounds.value.set(t.min.x,t.min.y,t.max.x,t.max.y):(e.uniforms.viewportBounds.value=new n.Vector4(t.min.x,t.min.y,t.max.x,t.max.y),e.defines.VIEWPORT_CLIPPING=1,e.needsUpdate=!0):e.defines.VIEWPORT_CLIPPING&&(delete e.defines.VIEWPORT_CLIPPING,e.needsUpdate=!0))},T.prototype.setViewportBoundsForModel=function(e,t){this.forEachInModel(e,!1,(e=>{this.setMaterialViewportBounds(e,t)}))}},94998:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PhongShader:()=>c});var n=i(72091),r=i(30130),o=i(77431),s=i.n(o),a=i(73560),l=i.n(a);let c={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.bump,n.UniformsLib.normalmap,n.UniformsLib.lights,n.UniformsLib.fog,r.ShaderChunks.CutPlanesUniforms,r.ShaderChunks.IdUniforms,r.ShaderChunks.ThemingUniform,r.ShaderChunks.ShadowMapUniforms,r.ShaderChunks.WideLinesUniforms,{emissive:{type:"c",value:new n.Color(0)},specular:{type:"c",value:new n.Color(1118481)},shininess:{type:"f",value:30},reflMipIndex:{type:"f",value:0},texMatrix:{type:"m3",value:new n.Matrix3},texMatrixBump:{type:"m3",value:new n.Matrix3},texMatrixAlpha:{type:"m3",value:new n.Matrix3},irradianceMap:{type:"t",value:null},exposureBias:{type:"f",value:1},envMapExposure:{type:"f",value:1},envRotationSin:{type:"f",value:0},envRotationCos:{type:"f",value:1}}]),vertexShader:s(),fragmentShader:l()};n.ShaderLib.firefly_phong=c},60012:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GetPrismMapUniforms:()=>r,PrismUtil:()=>o});var n=i(72091);function r(e){var t=e+"_texMatrix",i=e+"_invert",r={};return r[e]={type:"t",value:null},r[t]={type:"m3",value:new n.Matrix3},r[i]={type:"i",value:0},r}let o={GetPrismMapUniforms:r}},88190:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderContext:()=>te});var n=i(72091),r=i(55280),o=i(57480),s=i(83081),a=i(21968),l=i(30130),c=i(44203),h=i.n(c),u=i(66299),d=i.n(u);let f={uniforms:n.UniformsUtils.merge([l.ShaderChunks.DepthTextureUniforms,{tDiffuse:{type:"t",value:null},tAO:{type:"t",value:null},useAO:{type:"i",value:0},aoOpacity:{type:"f",value:.625},tOverlay:{type:"t",value:null},useOverlay:{type:"i",value:0},useOverlayAlpha:{type:"i",value:1},tID:{type:"t",value:null},tID2:{type:"t",value:null},objIDv4:{type:"v4",value:new n.Vector4(0,0,0,0)},modelIDv2:{type:"v2",value:new n.Vector2(0,0)},modelIDsv2v:{type:"v2v",value:[]},edgeObjIDv4:{type:"v4",value:new n.Vector4(0,0,0,0)},edgeModelIDv2:{type:"v2",value:new n.Vector2(0,0)},highlightIntensity:{type:"f",value:1},highlightColor:{type:"c",value:new n.Color(1,1,1)},resolution:{type:"v2",value:new n.Vector2(1/1024,1/512)},selectionColor:{type:"c",value:new n.Color(0,0,0)},expand2dSelection:{type:"f",value:.5},tCrossFadeTex0:{type:"t",value:null},tCrossFadeTex1:{type:"t",value:null},crossFadeOpacity0:{type:"f",value:0},crossFadeOpacity1:{type:"f",value:0},highlightFullModel:{type:"f",value:0}}]),vertexShader:h(),fragmentShader:d()};var p=i(48717),m=i(2303),g=i.n(m),v=i(49248),y=i.n(v);let b={uniforms:{tDiffuse:{type:"t",value:null},uResolution:{type:"v2",value:new n.Vector2(1/1024,1/512)}},vertexShader:g(),fragmentShader:y()};var x=i(9696),_=i.n(x),E=i(94727),S=i.n(E);let A={uniforms:{color:{type:"v4",value:new n.Vector4(0,0,0,.3)},cutplanes:{type:"v4v",value:[]}},vertexShader:_(),fragmentShader:S()};var w=i(47697),T=i.n(w),M=i(29126),C=i.n(M);let P={uniforms:{cutplanes:{type:"v4v",value:[]}},vertexShader:T(),fragmentShader:C()};var D=i(2179);const L={Color:1,Depth:2,ModelId:3,Overlay:4,Post1:5,Post2:6,SSAO:7,PostDisplay:8};function I(e,t,i,r,o){var s=new n.WebGLRenderTarget(e,t,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:i,type:r,stencilBuffer:!1});return o&&(s.shareDepthFrom=o),s.name="depthTarget",s}const R=new n.Vector4(1,1,1,.5),O=new n.Vector4(1,1,1,1);function N(e,t){var i=new n.WebGLRenderTarget(e,t,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat,type:n.UnsignedByteType,stencilBuffer:!1});return i.texture.generateMipmaps=!1,i.canReadPixels=!0,i}function F(e){e.material.blending=n.NoBlending,e.material.depthWrite=!1,e.material.depthTest=!1}function U(e,t){if(e&&t){t.length=0;for(let i=0;i<e.length;i++)t[i]=e[i]}}var B=i(34423),k=i(9893),V=i.n(k);let G={uniforms:{tDiffuse:{type:"t",value:null},size:{type:"v2",value:new n.Vector2(512,512)},resolution:{type:"v2",value:new n.Vector2(1/512,1/512)},axis:{type:"v2",value:new n.Vector2(1,0)},radius:{type:"f",value:50}},vertexShader:h(),fragmentShader:V()};var z=i(37787),H=i.n(z),W=i(18952),j=i.n(W),q=i(67020),X=i.n(q);const Y={uniforms:{tDiffuse:{type:"t",value:null},cameraNear:{type:"f",value:1},cameraInvNearFar:{type:"f",value:100},resolution:{type:"v2",value:new n.Vector2(1/512,1/512)}},vertexShader:H(),fragmentShader:j()},K={uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new n.Vector2(1/512,1/512)}},vertexShader:H(),fragmentShader:X()};var Q=i(26217),Z=i(68449);const $=(0,r.getGlobal)().document,J=new n.Color(16777215),ee=new n.Color(0);function te(){var e,t,i,l,c,h,u,d,m,g,v,y,x,_,E,S=!1,w=new B.RenderContextPostProcessManager;this.postShadingManager=function(){return w};var T,M,C,k,V={},z=void 0,H=null,W=null,j=null,q=null,X=null,te=null,ie=null,ne=[],re=null,oe=0,se=0,ae=0,le=0,ce=1,he=!1,ue=!1;let de=!1;var fe={},pe={},me=[0,0],ge=new n.Vector4(0,0,0,.3),ve=null,ye=1,be=1,xe=!1,_e={isRenderingHidden:!1,isRenderingOverlays:!1},Ee=n.RGBAFormat,Se=n.FloatType,Ae=!1,we=0,Te=0,Me=0,Ce=[.42,0,1,1],Pe=!0,De={antialias:!0,sao:!1,useHdrTarget:!1,haveTwoSided:!1,useSSAA:!1,idbuffer:!0,customPresentPass:!1,envMapBg:!1,numIdTargets:1,renderEdges:!1,useIdBufferSelection:!1,copyDepth:!1},Le={},Ie=null,Re=null;function Oe(t){try{var i=I(2,2,t.format,t.type);i.texture.generateMipmaps=!1,e.setRenderTarget(i);var n=e.getContext(),r=n.checkFramebufferStatus(n.FRAMEBUFFER);return e.setRenderTarget(null),i.dispose(),r===n.FRAMEBUFFER_COMPLETE}catch(e){return!1}}function Ne(e){De.useIdBufferSelection=e,e?_.material.defines.USE_IDBUFFER_SELECTION="1":delete _.material.defines.USE_IDBUFFER_SELECTION}function Fe(e){e(t);for(var i=1;i<t.variants.length;i++)e(t.variants[i])}function Ue(e){switch(e){case L.Color:return!0;case L.Depth:return Ae&&(De.sao||w.isPostProcShaded());case L.ModelId:return De.idbuffer;case L.Overlay:return!0;case L.SSAO:return De.sao;case L.Post1:return De.antialias||De.sao||De.customPresentPass||w.isPostProcShaded();case L.Post2:return w.isPostProcShaded()||De.customPresentPass;case L.PostDisplay:return De.antialias&&w.isPostProcShaded()}}function Be(){var t=q,i=H;if(_.uniforms.useAO.value){const r=function(){var e=[_.uniforms.useOverlay.value,_.uniforms.objIDv4.value];return _.uniforms.useOverlay.value=0,_.uniforms.objIDv4.value=new n.Vector4,e}();_.render(e,t,i),i=t,t=ie,function(e){_.uniforms.useOverlay.value=e[0],_.uniforms.objIDv4.value=e[1]}(r)}var r=t===q?ie:q;if(t=(i=w.render(e,t,i,r,!1))===q?ie:q,_.uniforms.useOverlay.value||_.uniforms.objIDv4.value){const n=function(){var e=_.uniforms.useAO.value;return _.uniforms.useAO.value=0,e}();_.render(e,t,i),i=t,function(e){_.uniforms.useAO.value=e}(n)}return r=(t=i===q?ie:q)===q?ie:q,i=w.render(e,t,i,r,!0)}function ke(e,t){return(t=t||new n.Vector2).set((255&e)/255,(e>>8&255)/255),t}function Ve(e,t,i){t=t||0;const n=function(e){return e!==Te&&(Te=e,-1===e&&(e=0),_.uniforms.objIDv4.value.set((255&e)/255,(e>>8&255)/255,(e>>16&255)/255,(e>>24&255)/255),!0)}(e),r=function(e){if(Array.isArray(e)&&1==e.length&&(e=e[0]),e===Me)return!1;const t=Array.isArray(Me)?Me.length:1,i=Array.isArray(e)?e.length:1;return!(i>1&&(e.sort(),i==t&&!Me.some(((t,i)=>t!==e[i])))||(i!=t&&(1==i?delete _.material.defines.HIGHLIGHT_MODEL_ID_COUNT:_.material.defines.HIGHLIGHT_MODEL_ID_COUNT=i.toString(),_.material.needsUpdate=!0),Me=e,1==i?ke(e=Array.isArray(e)?e[0]:e,_.uniforms.modelIDv2.value):_.uniforms.modelIDsv2v.value=e.map((e=>ke(e))),0))}(t);if(n||r)return _.uniforms.highlightIntensity.value=0,we=performance.now(),_.uniforms.highlightFullModel.value=i?1:0,!0}this.settings=De,this.depthTargetSupported=function(){return Ae},this.isWeakDevice=function(){return xe},this.init=function(l,c,h){let u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const S=u.offscreen,w=void 0!==u.useIdBufferSelection&&u.useIdBufferSelection;var T;(t=function(){var e=P;const t=(0,D.createShaderMaterial)(e);t.blending=n.NoBlending,t.packedNormals=!0,t.depthWrite=!1;var i=1,r=2,o=4,s=8,a=[];a[0]=null;for(var l=1;l<s;l++){var c=t.clone();c.packedNormals=t.packedNormals,l&i&&(c.cutplanes=null,c.doNotCut=!0),l&r&&(c.useInstancing=!0),l&o&&(c.packedNormals=!1),a[l]=c}return t.variants=a,t.getCustomOverrideMaterial=function(e){var t=!e||!e.cutplanes||0==e.cutplanes.length,n=e.useInstancing,s=!e.packedNormals,a=(t?i:0)|(n?r:0)|(s?o:0);return this.variants[a]},t}(),i=function(e,t){var i=A;const r=(0,D.createShaderMaterial)(i);r.depthWrite=!0,r.depthTest=!0,r.isEdgeMaterial=!0,r.transparent=!0,r.blending=n.NormalBlending,r.supportsMrtNormals=!0;var o=1,s=2,a=4,l=[];l[0]=null;for(var c=1;c<a;c++){var h=r.clone();h.defines=Object.assign({},r.defines),h.isEdgeMaterial=!0,h.supportsMrtNormals=!0,c&o&&(h.useInstancing=!0),c&s&&(h.doNotCut=!0,h.cutplanes=[]),l[c]=h}return r.variants=l,r.getCustomOverrideMaterial=function(i){var n=i.useInstancing?o:0;i.doNotCut&&(n|=s);var a=this.variants[n]||r;return e.isRenderingOverlays?e.isRenderingHidden?a.uniforms.color.value.copy(R):a.uniforms.color.value.copy(O):a.uniforms.color.value.copy(t),void 0!==i.edgeOpacity&&(a.uniforms.color.value.w=i.edgeOpacity),a.uniforms.color.needsUpdate=!0,a},r}(_e,ge),F(g=new Z.ShaderPass(Q.SAOShader)),F(m=new Z.ShaderPass(G)),F(y=new Z.ShaderPass(Y)),F(v=new Z.ShaderPass(K)),F(x=new Z.ShaderPass(b)),F(_=new Z.ShaderPass(f)),F(d=new Z.ShaderPass(a._)),F(E=new Z.ShaderPass(p.CopyShader)),l)?(xe=(0,r.isMobileDevice)(),De.idbuffer=!xe,w&&(De.idbuffer=!0,De.numIdTargets=2,_.material.defines.USE_MODEL_ID="1",Ne(!0)),C=c,k=h,e=l,ue=!!S,de=!!u.removeAlphaInOutput,(T=(xe?[{format:n.RGBAFormat,type:n.HalfFloatType},{format:n.RGBAFormat,type:n.FloatType}]:[{format:n.RGBAFormat,type:n.FloatType},{format:n.RGBAFormat,type:n.HalfFloatType}]).find(Oe))?(Ae=!0,Ee=T.format,Se=T.type):(Ae=!1,s.logger.warn("Depth target is unsupported for this device."))):(0,r.isNodeJS)()||s.logger.error("You need a gl context to make a renderer. Things will go downhill from here.",(0,o.errorCodeString)(o.ErrorCodes.BROWSER_WEBGL_NOT_SUPPORTED))},this.setDepthMaterialOffset=function(e,t,i){Fe((function(n){n.polygonOffset=e,n.polygonOffsetFactor=t,n.polygonOffsetUnits=i,n.extraDepthOffset&&(n.polygonOffsetFactor+=n.extraDepthOffset),n.needsUpdate=!0}))},this.setNoDepthNoBlend=F,this.overlayUpdate=function(){if(0===Te||-1===Te)return!1;var e=_.uniforms.highlightIntensity.value,t=1;if(Pe){var i=.004*(performance.now()-we);i=Math.min(i,1),t=function(e,t){var i=3*e[1],n=3*(e[3]-e[1])-i;return(((1-i-n)*t+n)*t+i)*t}(Ce,i)}return e!=t&&(_.uniforms.highlightIntensity.value=t,!0)},this.setRollOverFadeEnabled=function(e){Pe=e},this.beginScene=function(t,i,a,l){if(c=i,u=t.fog,h=a,S=!1,V={},!H&&C)this.initPostPipeline(De.sao,De.antialias);else if(!H&&!C)return void(he||(0,r.isNodeJS)()||(s.logger.error("Rendering to a canvas that was resized to zero. If you see this message you may be accidentally leaking a viewer instance.",(0,o.errorCodeString)(o.ErrorCodes.VIEWER_INTERNAL_ERROR)),he=!0));if(l&&function(){var t=De.envMapBg&&!!d.material.envMap,i=!!d.material.useBackgroundTexture;if(!ve||t||i){const t=d.uniforms.uCamDir.value||new n.Vector3;d.uniforms.uCamDir.value=c.worldUpTransform?c.getWorldDirection(t).applyMatrix4(c.worldUpTransform):c.getWorldDirection(t),d.uniforms.uCamUp.value=c.worldUpTransform?c.up.clone().applyMatrix4(c.worldUpTransform):c.up,d.uniforms.uResolution.value.set(C,k),d.uniforms.uHalfFovTan.value=Math.tan(n.Math.degToRad(.5*c.fov)),d.uniforms.opacity.value=ye,e.setRenderTarget(H),e.clear(!1,!0,!1),d.render(e,H,null)}else e.setClearColor(ve,ye),e.setRenderTarget(H),e.clear(!0,!0,!1);Ie&&Ie.clearTarget(e);for(var r=0;r<ne.length;r++)e.setClearColor(J,1),e.setRenderTarget(ne[r]),e.clear(!0,!1,!1);Ue(L.Depth)&&(e.setClearColor(ee,0),e.setRenderTarget(M),e.clear(!0,!1,!1))}(),Ue(L.Depth)){var f=i.near,p=i.far;g.uniforms.cameraNear.value=f,g.uniforms.cameraFar.value=p,y.uniforms.cameraNear.value=f,y.uniforms.cameraInvNearFar.value=1/(f-p);var m=i.projectionMatrix.elements;i.isPerspective?g.uniforms.projInfo.value.set(-2/(H.width*m[0]),-2/(H.height*m[5]),(1-m[8])/m[0],(1+m[9])/m[5]):g.uniforms.projInfo.value.set(-2/(H.width*m[0]),-2/(H.height*m[5]),(1-m[12])/m[0],(1-m[13])/m[5]),_.uniforms.projInfo.value.copy(g.uniforms.projInfo.value);var v=i.isPerspective?0:1;g.uniforms.isOrtho.value=v,_.uniforms.isOrtho.value=v;if(g.uniforms.projScale.value=H.height*m[5]*.125,_.uniforms.worldMatrix_mainPass.value=i.matrixWorld,w.isPostProcShaded()){const e=Autodesk.Viewing.Navigation.prototype.fov2fl(i.fov);w.updateUniformValue("focalLength",e),w.updateUniformValue("unitScale",ce),w.updateUniformValue("worldMatrix_mainPass",i.matrixWorld,!0),w.updateUniformValue("cameraPos",i.position,!0),w.updateUniformValue("cameraNear",f),w.updateUniformValue("cameraFar",p),w.updateUniformValue("projInfo",g.uniforms.projInfo.value,!0),w.updateUniformValue("isOrtho",v)}}De.sao||(_.uniforms.useAO.value=0),this.renderScenePart(t,!0,!0,!0,!0)},this._render=function(e,t,i,n,r){e.setRenderTarget(t),e.render(i,n,r)},this._renderDepthTarget=function(i,n,r,o){if(n&&!i.sortObjects&&r){const n=i.overrideMaterial;i.overrideMaterial=t,t.depthWrite!==o&&function(e,t){e.depthWrite=t;for(var i=0;i<e.variants.length;i++){var n=e.variants[i];n&&(n.depthWrite=t)}}(t,o),this._render(e,r,i,c),i.overrideMaterial=n}},this.renderScenePart=function(t,n,r,o,s){void 0!==t.skipColorTarget&&(n=!t.skipColorTarget),void 0!==t.skipDepthTarget&&(r=!t.skipDepthTarget),void 0!==t.skipIdTarget&&(o=!t.skipIdTarget),n&&De.renderEdges&&(t.edgeMaterial=i);var a=r&&Ue(L.Depth),l=H,d=M;Ie&&(l=Ie.chooseColorTarget(t,l),(d=Ie.getRenderSao(t)?M:null)&&M.shareDepthFrom),S=!1,V={};var f,p=s?h:void 0;t.fog=u,f=Ue(L.ModelId)&&o&&a?[l,d].concat(ne):a?[l,d]:Ue(L.ModelId)&&o?[l].concat(ne):l,this._render(e,f,t,c,p),t.edgeMaterial=void 0},this.clearAllOverlays=function(){e.setRenderTarget(W),e.clear(!0,!1,!1)},this.renderOverlays=function(t,r,o){var s=0;_e.isRenderingOverlays=!0;let a=!1,l=!1,h=Object.values(t).sort(((e,t)=>e.needSeparateDepth==t.needSeparateDepth?0:1==e.needSeparateDepth?1:1==t.needSeparateDepth?-1:void 0));for(let t=0;t<h.length;++t){var u=h[t],d=u.scene,f=u.camera?u.camera:c,p=e;if(d.children.filter((e=>"lmvInternal"!==e.name)).length){let e=W;if(p.setRenderTarget(e),s||(s=1,o||(p.setClearColor(ee,0),p.clear(!0,!1,!1))),u.materialPre&&(d.overrideMaterial=u.materialPre),u.needSeparateDepth&&!l?(e=W,e.shareDepthFrom=null,p.setRenderTarget(e),p.clear(!1,!0,!1),l=!0):e.shareDepthFrom=H,u.needIdTarget&&Ue(L.ModelId)){re||((re=N(e.width,e.height)).shareDepthFrom=H,re.name="overlayId"),0==a&&(p.setRenderTarget(re),p.clear(!0,!1,!1),a=!0);var m=[e];u.needIdTarget&&m.push(re),this._render(p,m,d,f,r)}else this._render(p,e,d,f,r),u.needIdTarget&&(re||((re=N(e.width,e.height)).shareDepthFrom=H,re.name="overlayId"),p.setProgramPrefix(1,"#define ID_COLOR","#define ID_COLOR"),this._render(p,re,d,f,r),p.setProgramPrefix(0,"",""));u.materialPost&&(_e.isRenderingHidden=!0,p.getContext().depthFunc(p.getContext().GREATER),u.materialPost.depthFunc=n.GreaterDepth,De.renderEdges&&(i.depthWrite=!1,i.depthTest=!1,d.overrideMaterial=i,this._render(p,e,d,f)),d.overrideMaterial=u.materialPost,this._render(p,e,d,f,r),p.getContext().depthFunc(p.getContext().LEQUAL),u.materialPost.depthFunc=n.LessEqualDepth,_e.isRenderingHidden=!1),De.renderEdges&&u.materialPre&&(i.depthWrite=!1,i.depthTest=!0,d.overrideMaterial=i,this._render(p,e,d,f)),d.overrideMaterial=null}}_e.isRenderingOverlays=!1,i.depthWrite=!0,i.depthTest=!0,_.uniforms.useOverlay.value=s,s&&(_.uniforms.useOverlayAlpha.value=be)},this.computeSSAO=function(t){if(!t&&De.sao){if(!S){if(z&&z.length){var i=z[0];y.uniforms.resolution.value.set(1/i.width,1/i.height),y.render(e,i,M);for(var n=1;n<z.length;n++){var r=z[n];v.uniforms.resolution.value.set(1/r.width,1/r.height),v.render(e,r,i),i=r}}g.render(e,te,H),m.uniforms.axis.value.set(1,0),m.render(e,q,te),m.uniforms.axis.value.set(0,1),m.render(e,te,q),S=!0}_.uniforms.useAO.value=1}else _.uniforms.useAO.value=0},this.getFinalTarget=function(){return Re||null},this.presentBuffer=function(t){if(e){var i=this.getFinalTarget();if(!(_.uniforms.useAO.value||_.uniforms.useOverlay.value||Ie||0!==Te&&-1!==Te||0!==Me&&-1!==Me))if(De.antialias)if(t)x.render(e,q,H),t.render(e,i,q);else if(w.isPostProcShaded()){const t=w.render(e,q,H,ie);E.render(e,X,t),x.render(e,i,X)}else x.render(e,i,H);else if(t)t.render(e,i,H);else if(w.isPostProcShaded()){const t=w.render(e,q,H,ie);E.render(e,i,t)}else E.render(e,i,H);else if(De.antialias)if(t)_.render(e,q,H),x.render(e,ie,q),t.render(e,i,ie);else if(w.isPostProcShaded()){let t=Be();E.render(e,X,t),x.render(e,i,X)}else _.render(e,q,H),x.render(e,i,q);else if(t)_.render(e,q,H),t.render(e,i,q);else if(w.isPostProcShaded()){let t=Be();E.render(e,i,t)}else _.render(e,i,H);if(de){const t=e.getContext(),n=t.getColorMask(),r=e.getClearAlpha();e.setRenderTarget(i),t.colorMask(!1,!1,!1,!0),e.setClearAlpha(1),e.clear(),t.colorMask(...n),e.setClearAlpha(r)}}},this.composeFinalFrame=function(e,t){this.computeSSAO(e),t||this.presentBuffer()},this.cleanup=function(){e&&e.setRenderTarget(null),H&&(H.dispose(),H=null),M&&(M.dispose(),M=null),W&&(W.dispose(),W=null),re&&(re.dispose(),re=null),j&&(j.dispose(),j=null),T&&(T.dispose(),T=null),Ie&&Ie.disposeTargets(),q&&(q.dispose(),q=null),te&&(te.dispose(),te=null),ie&&(ie.dispose(),ie=null),z&&(z.forEach((e=>e.dispose())),z=void 0);for(var t=0;t<ne.length;t++)ne[t]&&ne[t].dispose();ne=[],V={},fe={},pe={}},this.setSize=function(t,i,r,o){var a,l,c,h;if(C=t,k=i,De.logicalWidth=t,De.logicalHeight=i,0===t&&0===i||!e)return void this.cleanup();const u=e.getPixelRatio();let d=Math.max(0,t*u),f=Math.max(0,i*u);var p;De.deviceWidth=d,De.deviceHeight=f,o||(ue?e.setViewport(0,0,t,i):e.setSize(t,i));var v=d,y=f;(De.useSSAA||w.isPostProcShaded()&&!xe&&e.getPixelRatio()<=1&&w.postProcessEdgesOn())&&(d*=2,f*=2);var b=1/d,E=1/f;if(!r&&H&&H.width==d&&H.height==f||(s.logger.log("Reallocating render targets."),this.cleanup(),(H=new n.WebGLRenderTarget(d,f,{minFilter:n.LinearFilter,magFilter:n.LinearFilter,format:n.RGBAFormat,type:De.useHdrTarget?n.FloatType:n.UnsignedByteType,stencilBuffer:!1})).texture.generateMipmaps=!1,H.name="colorTarget",(W=new n.WebGLRenderTarget(d,f,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat,stencilBuffer:!1})).texture.generateMipmaps=!1,W.name="overlayTarget",W.shareDepthFrom=H,M=null,q=null,X=null,te=null,ie=null,z=void 0),Ie&&Ie.updateTargets(d,f,r,De.useHdrTarget),Ue(L.Post1)&&(!r&&q&&q.width==d&&q.height==f||((q=new n.WebGLRenderTarget(d,f,{minFilter:n.LinearFilter,magFilter:n.LinearFilter,format:n.RGBAFormat,stencilBuffer:!1,depthBuffer:!1})).texture.generateMipmaps=!1,q.name="postTarget1")),!te&&Ue(L.SSAO)&&((te=q.clone()).name="SSAO target"),!ie&&Ue(L.Post2)&&((ie=q.clone()).name="post target 2"),!X&&Ue(L.PostDisplay)&&((X=new n.WebGLRenderTarget(v,y,{minFilter:n.LinearFilter,magFilter:n.LinearFilter,format:n.RGBAFormat,stencilBuffer:!1,depthBuffer:!1})).texture.generateMipmaps=!1,X.name="postTargetNormal"),Ue(L.Depth)){if(r||!M||M.width!=d||M.height!=f){M=I(d,f,Ee,Se,H);const e=5,t=Math.floor(Math.log2(Math.max(1,Math.min(d,f)))),i=Math.min(e,t);z=new Array(i),g.material.defines.USE_MIPMAP=i>0,g.material.defines.MAX_MIP_LEVEL=i,g.material.needsUpdate=!0;for(let e=1;e<=i;++e){const t=d>>e,i=f>>e,r=new n.WebGLRenderTarget(t,i,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat,depthBuffer:!1,stencilBuffer:!1});r.texture.generateMipmaps=!1,r.name=`depthTarget_mipmap ${e}`,z[e-1]=r,g.uniforms[`tDepth_mip${e}`].value=r.texture}for(let t=i+1;t<=e;++t)g.uniforms[`tDepth_mip${t}`].value=null}g.uniforms.size.value.set(d,f),g.uniforms.resolution.value.set(b,E),g.uniforms.tDepth.value=M.texture,m.uniforms.size.value.set(d,f),m.uniforms.resolution.value.set(b,E),w.updateUniformValue("tDepth",M),_.uniforms.tDepth.value=M.texture}if(Ue(L.ModelId)){if(r||!ne[0]||ne[0].width!=d||ne[0].height!=f){for(p=0;p<ne.length;p++)ne[p]&&ne[p].dispose();for(ne=[],p=0;p<De.numIdTargets;p++){var S=N(d,f);S.shareDepthFrom=H,S.name="id "+p,ne.push(S)}}w.updateUniformValue("tID",ne[0])}else if(ne[0]){for(p=0;p<ne.length;p++)ne[p].dispose(),ne[p]=null;ne.length=0}x.uniforms.uResolution.value.set(b,E),w.changeResolution(b,E),_.uniforms.tOverlay.value=null===(a=W)||void 0===a?void 0:a.texture,_.uniforms.tAO.value=null===(l=te)||void 0===l?void 0:l.texture,_.uniforms.useAO.value=De.sao?1:0,_.uniforms.resolution.value.set(b,E),_.uniforms.tID.value=(null===(c=ne[0])||void 0===c?void 0:c.texture)||null,_.uniforms.tID2.value=(null===(h=ne[1])||void 0===h?void 0:h.texture)||null,Ie&&Ie.updateBlendPass()},this.getMaxAnisotropy=function(){return e?e.getMaxAnisotropy():0},this.mrtFlags=function(){return{mrtNormals:Ue(L.Depth),mrtIdBuffer:Ue(L.ModelId)?De.numIdTargets:void 0}},this.setIdTargetCount=function(e){if(!(e>2||e<1)&&e!==De.numIdTargets&&(De.numIdTargets=e,0!==ne.length&&2===e&&1===ne.length)){var t=N(ne[0].width,ne[0].height);return t.shareDepthFrom=H,t.name="id "+ne.length,ne.push(t),_.uniforms.tID2.value=t,_.material.defines.USE_MODEL_ID="1",_.material.needsUpdate=!0,!0}},this.getAntialiasing=function(){return De.antialias},this.initPostPipeline=function(e,t){De.sao=e&&Ae,De.antialias=t,De.haveTwoSided&&Fe((function(e){e.side=n.DoubleSide})),Fe((function(e){e.needsUpdate=!0})),g.material.needsUpdate=!0,m.material.needsUpdate=!0,y.material.needsUpdate=!0,v.material.needsUpdate=!0,x.material.needsUpdate=!0,w.setMaterialNeedsUpdate(),_.material.needsUpdate=!0,d.material.needsUpdate=!0,E.material.needsUpdate=!0,this.setSize(C,k)},this.setClearColors=function(e,t){e instanceof n.Color?ve=e.clone():!t||e.equals(t)?ve=new n.Color(e.x,e.y,e.z):xe?ve=new n.Color(.5*(e.x+t.x),.5*(e.y+t.y),.5*(e.z+t.z)):(ve=void 0,d.uniforms.color1.value.copy(e),d.uniforms.color2.value.copy(t))},this.useOverlayAlpha=function(e){be=e},this.setClearAlpha=function(e){ye=e},this.setAOEnabled=function(e){De.sao=e&&Ae,Le.sao=De.sao,this.setSize(C,k,!1,!0)},this.setAOOptions=function(e,t,i){void 0!==e&&(g.uniforms.radius.value=e,g.uniforms.bias.value=(0,r.isMobileDevice)()?.1:.01,m.uniforms.radius.value=e),void 0!==t&&(g.uniforms.intensity.value=t),_.uniforms.aoOpacity.value=void 0!==i?i:1,S=!1},this.getAOEnabled=function(){return De.sao},this.getAORadius=function(){return g.uniforms.radius.value},this.getAOIntensity=function(){return g.uniforms.intensity.value},this.setCubeMap=function(e){d.material.envMap=e,e||this.toggleEnvMapBackground(!1),e&&De.envMapBg&&(d.uniforms.envMapBackground.value=!0)},this.setBackgroundTexture=function(e){const t=d.material.useBackgroundTexture;d.uniforms.backgroundTexture.value=e,d.material.useBackgroundTexture=!!e,!!e!==t&&(d.material.needsUpdate=!0)},this.getCubeMap=function(){return d.material.envMap},this.setEnvRotation=function(e){ae=e,d.material.envRotationSin=Math.sin(e),d.material.envRotationCos=Math.cos(e)},this.getEnvRotation=function(){return ae},this.setEnvExposure=function(e){const t=d.material.envMapExposure,i=Math.pow(2,e);d.uniforms.envMapExposure.value=i,d.material.envMapExposure=i,i!==t&&(d.material.needsUpdate=!0),oe=e},this.setTonemapExposureBias=function(e){se=e,d.uniforms.exposureBias.value=Math.pow(2,e)},this.getExposureBias=function(){return se},this.setCamera=function(e){c=e},this.setTonemapMethod=function(t){const i=le;le=t,e.gammaInput=0!==t,d.material.tonemapOutput=le,t!==i&&(d.material.needsUpdate=!0)},this.getToneMapMethod=function(){return le},this.toggleTwoSided=function(e){De.haveTwoSided!=e&&t&&Fe((function(t){t.side=e?n.DoubleSide:n.FrontSide,t.needsUpdate=!0})),De.haveTwoSided=e},this.toggleEdges=function(e){De.renderEdges=e,Le.renderEdges=e},this.getRenderEdges=function(){return De.renderEdges},this.toggleEnvMapBackground=function(e){De.envMapBg=e,d.uniforms.envMapBackground.value=e&&!!d.material.envMap},this.enter2DMode=function(e,t){l=e,Le.sao=De.sao,Le.antialias=De.antialias,Le.idbuffer=De.idbuffer,Le.renderEdges=De.renderEdges,Le.useIdBufferSelection=De.useIdBufferSelection,t&&(Le.selectionColor=De.selectionColor,this.setSelectionColor(t)),De.idbuffer=!0,De.renderEdges=!1,_.material.defines.IS_2D="",Ne(De.idbuffer),this.initPostPipeline(!1,!1)},this.exit2DMode=function(){l=null,De.idbuffer=Le.idbuffer,De.renderEdges=Le.renderEdges,Le.selectionColor&&this.setSelectionColor(Le.selectionColor),delete _.material.defines.IS_2D,Ne(Le.idbuffer),this.initPostPipeline(Le.sao,Le.antialias)},this.idAtPixel=function(e,t,i,n){return this.idAtPixels(e,t,1,i,n)},this.idAtPixels=function(t,i,n,r,o){if(o&&o[0]||(o=ne),!o[0])return 0;n%2==0&&(n+=1);const s=.5*(t+1)*o[0].width-.5*(n-1),a=.5*(i+1)*o[0].height-.5*(n-1);if(V[n]&&s===V[n][4]&&a===V[n][5]&&V[n][6]==o[0].name)return U(V[n],r),V[n][0];const l=4*n*n;fe[l]||(fe[l]=new Uint8Array(l));const c=fe[l];let h;return e.readRenderTargetPixels(o[0],s,a,n,n,c),o[1]&&(pe[l]||(pe[l]=new Uint8Array(l)),h=pe[l],e.readRenderTargetPixels(o[1],s,a,n,n,h)),function(e,t,i,n,r,o,s){let a;s=s||ne;let l=0,c=0,h=0,u=-1;V[i]=[-1,-1,null,null,e,t,s[0].name];for(let o=0;o<i*i;o++){const o=l+(i-1)/2,f=c+(i-1)/2;if(o>=0&&o<=i&&f>=0&&f<=i){const l=o+f*i;if(a=n[4*l+2]<<16|n[4*l+1]<<8|n[4*l],a=a<<8>>8,V[i][0]=a,r){var d=r[4*l+1]<<8|r[4*l];V[i][1]=d<<16>>16}if(V[i][2]=2*(e+o)/s[0].width-1,V[i][3]=2*(t+f)/s[0].height-1,-1!==a)break}if(l==c||l<0&&l==-c||l>0&&l==1-c){const e=h;h=-u,u=e}l+=h,c+=u}return U(V[i],o),a}(s,a,n,c,h,r,o)},this.idsAtPixelsBox=function(t,i,n,r,o,s){if((s=s||ne)[0]){var a=n*s[0].width,l=r*s[0].height,c=0|.5*(t+1)*s[0].width,h=0|.5*(i+1)*s[0].height,u=new Uint8Array(4*a*l);e.readRenderTargetPixels(s[0],c,h,a,l,u);var d=void 0;o&&s[1]&&(d=new Uint8Array(4*a*l),e.readRenderTargetPixels(s[1],c,h,a,l,d));var f={};for(let e=0;e<u.length;e+=4){var p=u[4*e+2]<<16|u[4*e+1]<<8|u[4*e];if((p=p<<8>>8)>0){var m=0;d&&(m=(m=d[4*e+1]<<8|d[4*e])<<16>>16);var g=p+"-"+m;f[g]||(f[g]=!0,o.push([p,m]))}}}},this.readbackTargetId=function(){if(!ne[0])return null;var t=new Uint8Array(4*ne[0].width*ne[0].height);return e.readRenderTargetPixels(ne[0],0,0,ne[0].width,ne[0].height,t),{buffer:t,width:ne[0].width,height:ne[0].height}},this.rolloverObjectViewport=function(e,t){me[1]=0;var i=this.idAtPixel(e,t,me);return this.rolloverObjectId(i,null,me[1])},this.rolloverObjectId=function(e,t,i){return Ve(e,i,!1)},this.getRollOverDbId=function(){return Te},this.getRollOverModelId=function(){return Me},this.rollOverModelId=function(e){return Ve(1,e,!0)},this.setRollOverHighlightColor=function(e){e?_.uniforms.highlightColor.value.copy(e):_.uniforms.highlightColor.value.setRGB(1,1,1)},this.setDbIdForEdgeDetection=function(e,t){_.uniforms.edgeObjIDv4.value.set((255&e)/255,(e>>8&255)/255,(e>>16&255)/255,(e>>24&255)/255),_.uniforms.edgeModelIDv2.value.set((255&t)/255,(t>>8&255)/255)},this.setSpatialFilterForRollOver=function(e){if(!e||this.spatialFilterForRollOverSupported()){var t="SPATIAL_FILTER";_.material.defines[t]!==e&&(e&&""!==e?_.material.defines[t]=e:delete _.material.defines[t],_.material.needsUpdate=!0,_.uniforms.highlightIntensity.value=0,we=performance.now())}else s.logger.warn("Spatial filter for mouse-over can only be used with depth target")},this.spatialFilterForRollOverSupported=function(){return Ue(L.Depth)},this.setEdgeColor=function(e){ge.copy(e)},this.setSelectionColor=function(e){var t=new n.Color(e);t.r=Math.pow(t.r,2),t.g=Math.pow(t.g,2),t.b=Math.pow(t.b,2),_.uniforms.selectionColor.value.set(t),_.material.needsUpdate=!0,De.selectionColor=e},this.setUnitScale=function(e){ce=e},this.getUnitScale=function(){return ce},this.getBlendPass=function(){return _},this.getClearPass=function(){return d},this.getColorTarget=function(){return H},this.getIDTargets=function(){return ne},this.getDepthTarget=function(){return M},this.getIdTarget=function(){return ne[0]},this.getOverlayIdTarget=function(){return re},this.getDepthMaterial=function(){return t},this.getPostTarget=function(){return q},this.getEdgeMaterial=function(){return i},this.setCrossFade=function(e){Ie=e},this.getCrossFade=function(){return Ie},this.setOffscreenTarget=function(e){Re=e},this.getOffscreenTarget=function(){return Re},this.getNamedTarget=function(e){switch(e){case"color":return H;case"overlay":return W;case"id":return ne[0];case"post1":return q;case"post2":return ie;case"postdisplay":return X;case"ssao":return te;case"depth":return M}return null},this.getCurrentFramebuffer=function(){return e.getCurrentFramebuffer()},this.getConfig=function(){return{renderEdges:De.renderEdges,envMapBackground:De.envMapBg,envMap:d.material.envMap,envExposure:oe,toneMapExposureBias:se,envRotation:this.getEnvRotation(),tonemapMethod:le,clearColor:ve&&ve.clone(),clearColorTop:!ve&&d.uniforms.color1.value.clone(),clearColorBottom:!ve&&d.uniforms.color2.value.clone(),clearAlpha:ye,useOverlayAlpha:be,aoEnabled:this.getAOEnabled(),aoRadius:this.getAORadius(),aoIntensity:this.getAOIntensity(),twoSided:De.haveTwoSided,edgeColor:ge.clone(),unitScale:this.getUnitScale(),is2D:!!_.material.defines.IS_2D,antialias:this.getAntialiasing(),idMaterial:l,selectionColor:De.selectionColor}},this.applyConfig=function(e){this.toggleEdges(e.renderEdges),this.toggleEnvMapBackground(e.envMapBackground),this.setCubeMap(e.envMap),this.setEnvExposure(e.envExposure),this.setTonemapExposureBias(e.toneMapExposureBias),this.setEnvRotation(e.envRotation),this.setTonemapMethod(e.tonemapMethod),this.toggleTwoSided(e.twoSided),this.setEdgeColor(e.edgeColor),this.setUnitScale(e.unitScale),e.clearColor?this.setClearColors(e.clearColor):this.setClearColors(e.clearColorTop,e.clearColorBottom),this.setClearAlpha(e.clearAlpha),this.useOverlayAlpha(e.useOverlayAlpha);var t=!!_.material.defines.IS_2D;e.is2D&&!t?this.enter2DMode(e.idMaterial,e.selectionColor):!e.is2D&&t&&(this.setSelectionColor(e.selectionColor),this.exit2DMode());var i=e.aoEnabled!=this.getAOEnabled(),n=e.antialias!=this.getAntialiasing();(i||n)&&this.initPostPipeline(e.aoEnabled,e.antialias)},this.targetToCanvas=function(t){var i=t.width,n=t.height,r=new Uint8Array(i*n*4);e.readRenderTargetPixels(t,0,0,i,n,r);var o=$.createElement("canvas");o.width=i,o.height=n;var s,a=o.getContext("2d"),l=new Uint8ClampedArray(r);return s=new ImageData(l,i,n),a.putImageData(s,0,0),a.globalCompositeOperation="copy",a.translate(0,n),a.scale(1,-1),a.drawImage(o,0,0,i,n),a.globalCompositeOperation="source-over",{canvas:o,ctx:a}},this.resetRenderStats=function(){e.info.reset()},this.getRenderStats=function(){return Object.assign({},e.info.render)}}},34423:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderContextPostProcessExtension:()=>n,RenderContextPostProcessManager:()=>r});class n{constructor(e,t){this.viewer=t,this.renderContext=e,this.postProcPass=null,this.postProcShaded=!1,this.setGlobalManager(t.globalManager)}load(){}unload(){this.viewer=null,this.renderContext=null,this.postProcPass=null}enable(){this.setPostProcShaded(!0);const e=this.renderContext.settings;this.renderContext.initPostPipeline(e.sao,e.antialias),this.viewer.impl.fireRenderOptionChanged(),this.viewer.impl.invalidate(!0,!0,!0)}disable(){this.setPostProcShaded(!1),this.viewer.impl.invalidate(!1,!1,!0)}shouldRenderAfterOverlays(){return!1}render(e,t,i,n){const r=void 0===n||n===this.shouldRenderAfterOverlays();return!(!this.isPostProcShaded()||!r)&&(this.postProcPass.render(e,t,i),!0)}updateUniformValue(e,t,i){this.postProcPass.uniforms[e]&&(i?this.postProcPass.uniforms[e].value.copy(t):this.postProcPass.uniforms[e].value=t,this.viewer.impl.invalidate(!1,!1,!0))}updateDefineValue(e,t){this.postProcPass.material.defines[e]!==t&&(null!==t?this.postProcPass.material.defines[e]=t:delete this.postProcPass.material.defines[e],this.setMaterialNeedsUpdate())}getUniformValue(e){return this.postProcPass.uniforms[e].value}getDefineValue(e){return this.postProcPass.material.defines[e]}changeResolution(e,t){this.postProcPass.uniforms.resolution.value.set(e,t)}setMaterialNeedsUpdate(){this.postProcPass.material.needsUpdate=!0,this.viewer.impl.invalidate(!1,!1,!0)}postProcessEdgesOn(){return!1}setPostProcShaded(e){this.postProcShaded=e}isPostProcShaded(){return this.postProcShaded}getOrder(){return 0}}class r{constructor(){this.rcExtensions=[]}registerPostProcessingExtension(e){this.rcExtensions.push(e),this.rcExtensions.sort(((e,t)=>t.getOrder()-e.getOrder()))}removePostProcessingExtension(e){const t=this.rcExtensions.indexOf(e);-1!==t&&(e.unload(),this.rcExtensions.splice(t,1))}render(e,t,i,n,r){for(let o=0;o<this.rcExtensions.length;o++){if(this.rcExtensions[o].render(e,t,i,r)){i=t;const e=t;t=n,n=e}}return i}updateUniformValue(e,t,i){for(let n=0;n<this.rcExtensions.length;n++)this.rcExtensions[n].updateUniformValue(e,t,i)}changeResolution(e,t){for(let i=0;i<this.rcExtensions.length;i++)this.rcExtensions[i].changeResolution(e,t)}setMaterialNeedsUpdate(){for(let e=0;e<this.rcExtensions.length;e++)this.rcExtensions[e].setMaterialNeedsUpdate()}postProcessEdgesOn(){return this.rcExtensions.some((e=>e.postProcessEdgesOn()))}isPostProcShaded(){return this.rcExtensions.some((e=>e.isPostProcShaded()))}}},26217:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SAOShader:()=>c});var n=i(72091),r=i(30130),o=i(44203),s=i.n(o),a=i(78101),l=i.n(a);let c={uniforms:n.UniformsUtils.merge([r.ShaderChunks.DepthTextureUniforms,{size:{type:"v2",value:new n.Vector2(512,512)},resolution:{type:"v2",value:new n.Vector2(1/512,1/512)},cameraNear:{type:"f",value:1},cameraFar:{type:"f",value:100},radius:{type:"f",value:12},bias:{type:"f",value:.1},projScale:{type:"f",value:500},intensity:{type:"f",value:1},tDepth_mip1:{type:"t",value:null},tDepth_mip2:{type:"t",value:null},tDepth_mip3:{type:"t",value:null},tDepth_mip4:{type:"t",value:null},tDepth_mip5:{type:"t",value:null}}]),vertexShader:s(),fragmentShader:l()}},30130:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CutPlanesShaderChunk:()=>ke,CutPlanesUniforms:()=>Ee,DepthTextureTestUniforms:()=>De,DepthTextureUniforms:()=>Pe,EnvSamplingShaderChunk:()=>ze,FinalOutputShaderChunk:()=>Xe,HatchPatternShaderChunk:()=>Ge,IdFragmentDeclaration:()=>je,IdOutputShaderChunk:()=>qe,IdUniforms:()=>Se,IdVertexDeclaration:()=>He,IdVertexShaderChunk:()=>We,InstancingVertexDeclaration:()=>Qe,OrderedDitheringShaderChunk:()=>Be,PackDepthShaderChunk:()=>Fe,PackNormalsShaderChunk:()=>Ve,PointSizeDeclaration:()=>tt,PointSizeShaderChunk:()=>it,PointSizeUniforms:()=>Me,ShaderChunks:()=>nt,ShadowMapCommonUniforms:()=>we,ShadowMapDeclareCommonUniforms:()=>Ze,ShadowMapFragmentDeclaration:()=>et,ShadowMapUniforms:()=>Te,ShadowMapVertexDeclaration:()=>$e,ShadowMapVertexShaderChunk:()=>Je,ThemingFragmentDeclaration:()=>Ye,ThemingFragmentShaderChunk:()=>Ke,ThemingUniform:()=>Ae,TonemapShaderChunk:()=>Ue,WideLinesUniforms:()=>Ce,resolve:()=>Ne});var n=i(72091),r=i(35496),o=i.n(r),s=i(96900),a=i.n(s),l=i(99607),c=i.n(l),h=i(1221),u=i.n(h),d=i(90002),f=i.n(d),p=i(9641),m=i.n(p),g=i(22826),v=i.n(g),y=i(1081),b=i.n(y),x=i(31371),_=i.n(x),E=i(91952),S=i.n(E),A=i(14804),w=i.n(A),T=i(11255),M=i.n(T),C=i(26750),P=i.n(C),D=i(15373),L=i.n(D),I=i(78148),R=i.n(I),O=i(74490),N=i.n(O),F=i(25424),U=i.n(F),B=i(30133),k=i.n(B),V=i(40947),G=i.n(V),z=i(79317),H=i.n(z),W=i(40304),j=i.n(W),q=i(53634),X=i.n(q),Y=i(76332),K=i.n(Y),Q=i(6147),Z=i.n(Q),$=i(77019),J=i.n($),ee=i(72373),te=i.n(ee),ie=i(92070),ne=i.n(ie),re=i(50433),oe=i.n(re),se=i(97713),ae=i.n(se),le=i(80862),ce=i.n(le),he=i(17028),ue=i.n(he),de=i(45631),fe=i.n(de),pe=i(1179),me=i.n(pe),ge=i(20990),ve=i.n(ge),ye=i(40444),be=i.n(ye),xe=i(13353),_e=i.n(xe);let Ee={cutplanes:{type:"v4v",value:[]},cutplanesHideInterior:{type:"i",value:0},hatchParams:{type:"v2",value:new n.Vector2(1,10)},hatchTintColor:{type:"c",value:new n.Color(16777215)},hatchTintIntensity:{type:"f",value:1}},Se={dbId:{type:"v3",value:new n.Vector3(0,0,0)},modelId:{type:"v3",value:new n.Vector3(0,0,0)}},Ae={themingColor:{type:"v4",value:new n.Vector4(0,0,0,0)}},we={shadowESMConstant:{type:"f",value:0}},Te=n.UniformsUtils.merge([{shadowMap:{type:"t",value:null},shadowMapSize:{type:"v2",value:new n.Vector2(0,0)},shadowBias:{type:"f",value:0},shadowDarkness:{type:"f",value:0},shadowMatrix:{type:"m4",value:new n.Matrix4},shadowLightDir:{type:"v3",value:new n.Vector3}},we]),Me={point_size:{type:"f",value:1}},Ce={view_size:{type:"v2",value:new n.Vector2(640,480)}},Pe={tDepth:{type:"t",value:null},projInfo:{type:"v4",value:new n.Vector4},isOrtho:{type:"f",value:0},worldMatrix_mainPass:{type:"m4",value:new n.Matrix4}},De={tDepthTest:{type:"t",value:null},tDepthResolution:{type:"v2",value:new n.Vector2(1/1024,1/1024)}};var Le={};for(var Ie in n.ShaderChunk)Le[Ie]=n.ShaderChunk[Ie];Le.pack_depth=o(),Le.depth_texture=a(),Le.tonemap=c(),Le.ordered_dither=u(),Le.cutplanes=f(),Le.pack_normals=m(),Le.hatch_pattern=v(),Le.env_sample=b(),Le.id_decl_vert=_(),Le.id_vert=S(),Le.id_decl_frag=w(),Le.id_frag=M(),Le.final_frag=P(),Le.theming_decl_frag=L(),Le.theming_frag=R(),Le.instancing_decl_vert=N(),Le.shadowmap_decl_common=U(),Le.shadowmap_decl_vert=k(),Le.shadowmap_vert=G(),Le.shadowmap_decl_frag=H(),Le.float3_average=j(),Le.line_decl_common=X(),Le.prism_wood=K(),Le.prism_glazing=Z(),Le.prism_transparency=J(),Le.normal_map=te(),Le.decl_point_size=ne(),Le.point_size=oe(),Le.wide_lines_decl=ae(),Le.wide_lines_vert=ce(),Le.hsv=ue(),Le.importance_sampling=fe(),Le.logdepthbuf_decl_frag=me(),Le.logdepthbuf_frag=ve(),Le.logdepthbuf_decl_vert=be(),Le.logdepthbuf_vert=_e();var Re={},Oe={};for(Ie in Re)Oe[Ie]=new RegExp("#"+Ie+" *<([\\w\\d., ]*)>","g");let Ne=function(e){for(var t in Re){var i=Oe[t];e=e.replace(i,(function(e,i){var n=i.split(",").map((function(e){return e.trim()}));return Re[t].apply(null,n)}))}return e.replace(/#include *<([\w\d.]+)>/g,(function(e,t){if(!Le[t])throw new Error("Cannot resolve #include<"+t+">");return Ne(Le[t])}))},Fe=Le.pack_depth,Ue=Le.tonemap,Be=Le.ordered_dither,ke=Le.cutplanes,Ve=Le.pack_normals,Ge=Le.hatch_pattern,ze=Le.env_sample,He=Le.id_decl_vert,We=Le.id_vert,je=Le.id_decl_frag,qe=Le.id_frag,Xe=Le.final_frag,Ye=Le.theming_decl_frag,Ke=Le.theming_frag,Qe=Le.instancing_decl_vert,Ze=Le.shadowmap_decl_common,$e=Le.shadowmap_decl_vert,Je=Le.shadowmap_vert,et=Le.shadowmap_decl_frag,tt=Le.decl_point_size,it=Le.point_size,nt={IdUniforms:Se,ThemingUniform:Ae,CutPlanesUniforms:Ee,ShadowMapCommonUniforms:we,ShadowMapUniforms:Te,PointSizeUniforms:Me,WideLinesUniforms:Ce,DepthTextureUniforms:Pe,DepthTextureTestUniforms:De,PackDepthShaderChunk:Fe,TonemapShaderChunk:Ue,OrderedDitheringShaderChunk:Be,CutPlanesShaderChunk:ke,PackNormalsShaderChunk:Ve,HatchPatternShaderChunk:Ge,EnvSamplingShaderChunk:ze,IdVertexDeclaration:He,IdVertexShaderChunk:We,IdFragmentDeclaration:je,IdOutputShaderChunk:qe,FinalOutputShaderChunk:Xe,ThemingFragmentDeclaration:Ye,ThemingFragmentShaderChunk:Ke,InstancingVertexDeclaration:Qe,ShadowMapDeclareCommonUniforms:Ze,ShadowMapVertexDeclaration:$e,ShadowMapVertexShaderChunk:Je,ShadowMapFragmentDeclaration:et,PointSizeDeclaration:tt,PointSizeShaderChunk:it,...Le,resolve:Ne}},68449:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ShaderPass:()=>o});var n=i(2179),r=i(72091);let o=function(e,t){this.textureID=void 0!==t?t:"tDiffuse",this.material=(0,n.createShaderMaterial)(e),this.uniforms=this.material.uniforms,this.renderToScreen=!1,this.enabled=!0,this.clear=!1,this.camera=new r.OrthographicCamera(-1,1,1,-1,0,1);var i=new r.BufferGeometry,o=new Float32Array(9);o[0]=-1,o[1]=-1,o[2]=0,o[3]=3,o[4]=-1,o[5]=0,o[6]=-1,o[7]=3,o[8]=0;var s=new Float32Array(6);s[0]=0,s[1]=0,s[2]=2,s[3]=0,s[4]=0,s[5]=2;var a=new Float32Array(9);a[0]=0,a[1]=0,a[2]=1,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=1,i.setAttribute("position",new r.BufferAttribute(o,3)),i.setAttribute("normal",new r.BufferAttribute(a,3)),i.setAttribute("uv",new r.BufferAttribute(s,2)),this.quad=new r.Mesh(i,this.material),this.scene=new r.Scene,this.scene.add(this.quad)};o.prototype={render:function(e,t,i,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i),e.setRenderTarget(t),!this.renderToScreen&&this.clear&&e.clear(),e.render(this.scene,this.camera)}}},2179:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ShaderUtils:()=>a,createShaderMaterial:()=>r,removeMacro:()=>s,setMacro:()=>o});var n=i(72091);let r=function(e){let t={vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return e.uniforms&&(t.uniforms=n.UniformsUtils.clone(e.uniforms)),e.defines&&(t.defines=Object.assign({},e.defines)),e.extensions&&(t.extensions=Object.assign({},e.extensions)),e.attributes&&(t.attributes=e.attributes),new n.ShaderMaterial(t)},o=function(e,t,i){i=i||"",e.defines||(e.defines={}),e.defines[t]!=i&&(e.defines[t]=i,e.needsUpdate=!0)},s=function(e,t){(e.defines||e.defines[t])&&(delete e.defines[t],e.needsUpdate=!0)};const a={createShaderMaterial:r,setMacro:o,removeMacro:s}},22267:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GroundShadowShader:()=>x,SHADOWMAP_INCOMPLETE:()=>A,SHADOWMAP_NEEDS_UPDATE:()=>S,SHADOWMAP_VALID:()=>w,ShadowConfig:()=>E,ShadowMapOverrideMaterials:()=>_,ShadowMapShader:()=>b,ShadowMaps:()=>C,ShadowRender:()=>P});var n=i(30130),r=i(2179),o=i(60012),s=i(65802),a=i(39147),l=i(24528),c=i(72091),h=i(9063),u=i.n(h),d=i(32968),f=i.n(d),p=i(54707),m=i.n(p),g=i(77500),v=i.n(g);let y=function(e,t,i){var n="uv_"+e+"_map",r="";return t&&i?r="if ("+n+".x < 0.0 || "+n+".x > 1.0 || "+n+".y < 0.0 || "+n+".y > 1.0) { discard; }":t?r="if ("+n+".x < 0.0 || "+n+".x > 1.0) { discard; }":i&&(r="if ("+n+".y < 0.0 || "+n+".y > 1.0) { discard; }"),"#define "+e.toUpperCase()+"_CLAMP_TEST "+r},b={uniforms:c.UniformsUtils.merge([n.ShaderChunks.ShadowMapCommonUniforms,{shadowMapRangeMin:{type:"f",value:0},shadowMapRangeSize:{type:"f",value:0},shadowMinOpacity:{type:"f",value:0},map:{type:"t",value:null},alphaMap:{type:"t",value:null},texMatrix:{type:"m3",value:new c.Matrix3},texMatrixAlpha:{type:"m3",value:new c.Matrix3}},(0,o.GetPrismMapUniforms)("surface_cutout_map")]),vertexShader:u(),fragmentShader:f()},x={uniforms:n.ShaderChunks.ShadowMapUniforms,vertexShader:m(),fragmentShader:v()};function _(){var e=[],t=(0,r.createShaderMaterial)(b),i=new c.Material;i.visible=!1;var n=[];var o=new function(){this.init=function(){this.isPrism=!1,this.alphaMap=!1,this.alphaClampS=!1,this.alphaClampT=!1,this.alphaInvert=!1,this.rgbaMap=!1,this.rgbaClampS=!1,this.rgbaClampT=!1,this.rgbaInvert=!1,this.instanced=!1,this.decalIndex=-1},this.init(),this.getMaterialIndex=function(){return(this.isPrism?1:0)|(this.alphaMap?2:0)|(this.alphaClampS?4:0)|(this.alphaClampT?8:0)|(this.alphaInvert?16:0)|(this.rgbaMap?32:0)|(this.rgbaClampS?64:0)|(this.rgbaClampT?128:0)|(this.rgbaInvert?256:0)|(this.instanced?512:0)|1024*(this.decalIndex+1)}};function s(n,s){if((a=n)instanceof c.MeshPhongMaterial?a.opacity<E.ShadowMinOpacity:a.isPrismMaterial?"PrismTransparent"===a.prismType||"PrismGlazing"===a.prismType:!a.visible)return i;var a,l=n instanceof c.MeshPhongMaterial,h=n.isPrismMaterial;if(!l&&!h)return null;var u=l?n.alphaMap:n.surface_cutout_map,d=l&&n.alphaTest?n.map:null;if(!u&&!d&&!n.useInstancing)return null;var f=o;f.init(),f.isPrism=h,f.alphaMap=!!u,f.rgbaMap=!!d,f.instanced=n.useInstancing,f.decalIndex=void 0===s?-1:s,u&&(f.alphaClampS=u.clampS,f.alphaClampT=u.clampT,f.alphaInvert=u.invert),d&&(f.rgbaClampS=d.clampS,f.rgbaClampT=d.clampT,f.rgbaInvert=d.invert);var p=function(i,n){var o=i.getMaterialIndex();if(!e[o]){var s=t.clone();i.isPrism&&i.alphaMap&&((0,r.setMacro)(s,"USE_SURFACE_CUTOUT_MAP"),s.fragmentShader=y("surface_cutout",i.alphaClampS,i.alphaClampT)+"\n"+s.fragmentShader),i.instanced&&(s.useInstancing=!0),e[o]=s}return e[o]}(f);return u&&(l?(p.uniforms.alphaMap.value=u,p.uniforms.texMatrixAlpha.value=u.matrix,p.alphaMap=u,p.side=n.side):(p.uniforms.surface_cutout_map.value=u,p.uniforms.surface_cutout_map_texMatrix.value.copy(u.matrix),p.uniforms.surface_cutout_map_invert.value=u.invert,p.side=c.DoubleSide)),d&&(p.uniforms.map.value=d,p.uniforms.texMatrix.value=d.matrix,p.map=d),p}this.forEachMaterial=function(i){for(var n=0;n<e.length;n++){var r=e[n];r&&i(r)}i(t)},this.getCustomOverrideMaterial=function(e){var t=s(e);if(!t)return null;if(!e.decals)return t.decals=null,t;if(e.decals){n.length=0;for(var i=0;i<e.decals.length;i++){var r=e.decals[i],o=s(r.material,i);if(!o)return null;n.push({uv:r.uv,material:o})}}return t.decals=n,t},this.dispose=function(){this.forEachMaterial((function(e){e.dispose()}))}}const E={ShadowMapSize:1024,ShadowESMConstant:80,ShadowBias:.001,ShadowDarkness:.7,ShadowMapBlurRadius:4,ShadowMinOpacity:.9,UseHardShadows:!1,BlurShadowMap:!0},S=0,A=1,w=2;function T(){this.shadowMap=void 0,this.shadowMapSize=void 0,this.shadowMatrix=void 0,this.shadowLightDir=void 0,this.init=function(e){this.shadowMap=e,this.shadowMapSize=new c.Vector2(e.width,e.height),this.shadowMatrix=new c.Matrix4,this.shadowLightDir=new c.Vector3},this.apply=function(e){e.shadowMap=this.shadowMap,e.shadowMatrix=this.shadowMatrix,e.shadowLightDir=this.shadowLightDir,this.shadowMap?((0,r.setMacro)(e,"USE_SHADOWMAP"),E.UseHardShadows&&(0,r.setMacro)(e,"USE_HARD_SHADOWS")):((0,r.removeMacro)(e,"USE_SHADOWMAP"),(0,r.removeMacro)(e,"USE_HARD_SHADOWS"))}}var M=new T;function C(e){var t=null,i=null,n=new c.OrthographicCamera,o=Math.exp(E.ShadowESMConstant),h=E.UseHardShadows?new c.Color(1,1,1):new c.Color(o,1,1),u=e,d=null,f=null,p=null,m=(0,r.createShaderMaterial)(b),g=new _;m.getCustomOverrideMaterial=g.getCustomOverrideMaterial;var v=null;function y(e,t){e.forEach((function(e){t.apply(e)}))}function C(e){var t=new c.WebGLRenderTarget(e,e,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,type:c.FloatType,stencilBuffer:!1,generateMipmaps:!1});return t.texture.generateMipmaps=!1,t}function P(e){u.setRenderTarget(e),u.setClearColor(h,1),u.clear()}var D,L,I,R,O,N,F,U,B,k,V,G=(D=new c.Matrix4,L=new c.Matrix4,I=new c.Vector3(0,0,0),R=new c.Box3,O=new c.Vector3,N=new c.Vector3,function(e,t,i){e.position.copy(i),e.lookAt(I),D.makeRotationFromQuaternion(e.quaternion),L.copy(D).invert(),R.copy(t).applyMatrix4(L),N=R.getCenter(N),O.set(N.x,N.y,R.max.z),O.applyMatrix4(D),e.position.copy(O),N=R.size(N),e.left=-.5*N.x,e.right=.5*N.x,e.bottom=-.5*N.y,e.top=.5*N.y,e.near=0,e.far=N.z,e.updateMatrixWorld(),e.updateProjectionMatrix()});function z(e){e.uniforms.shadowMapRangeMin.value=n.near,e.uniforms.shadowMapRangeSize.value=n.far-n.near,e.uniforms.shadowESMConstant.value=E.ShadowESMConstant,e.uniforms.shadowMinOpacity.value=E.ShadowMinOpacity}this.init=function(){(t=new T).init(C(E.ShadowMapSize)),i=E.BlurShadowMap?new a.b(E.ShadowMapSize,E.ShadowMapSize,E.ShadowMapBlurRadius,1,{type:t.shadowMap.type,format:t.shadowMap.format}):void 0,(d=(0,r.createShaderMaterial)(x)).depthWrite=!1,d.transparent=!0,f=(0,s.createGroundShape)(d),(p=new c.Scene).add(f),this.groundShapeBox=new c.Box3,P(v=C(1))},this.init(),this.state=S,this.startUpdate=function(e,t,i,r,o){var s=e.getVisibleBounds(!0);return this.beginShadowMapUpdate(i,s,r),e.reset(n,l.RenderFlags.RENDER_SHADOWMAP,!0),this.state=A,t=this.continueUpdate(e,t,o)},this.continueUpdate=function(e,i,n){return i=e.renderSome(this.renderSceneIntoShadowMap,i),e.isDone()?(this.state=w,this.finishShadowMapUpdate(n)):function(e){var i=t.shadowMap;t.shadowMap=v,y(e,t),t.apply(d),t.shadowMap=i}(n),i},this.beginShadowMapUpdate=function(e,i,o){G(n,i,o),z(m),g.forEachMaterial(z),E.UseHardShadows&&((0,r.setMacro)(m,"USE_HARD_SHADOWS"),g.forEachMaterial((function(e){(0,r.setMacro)(e,"USE_HARD_SHADOWS")}))),P(t.shadowMap),this.renderSceneIntoShadowMap(p)},this.renderSceneIntoShadowMap=function(e){e.overrideMaterial=m,u.render(e,n,t.shadowMap),e.overrideMaterial=null},this.finishShadowMapUpdate=function(e){i&&!E.UseHardShadows&&i.render(u,t.shadowMap,t.shadowMap),t.shadowMatrix.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),t.shadowMapRangeMin=n.near,t.shadowMapRangeSize=n.far-n.near,t.shadowLightDir.copy(n.position).normalize(),y(e,t),t.apply(d),this.isValid=!0},this.cleanup=function(e){i&&i.cleanup(),t.shadowMap&&t.shadowMap.dispose(),y(e,M),m.dispose(),g.dispose(),d.dispose(),f.geometry.dispose()},this.setGroundShadowTransform=function(e,t,i,n){(0,s.setGroundShapeTransform)(f,e,t,i,n),this.groundShapeBox.setFromObject(f)},this.renderGroundShadow=function(e,t){u.render(p,e,t,!1)},this.expandByGroundShadow=(F=new c.Plane,U=new c.Ray,B=new c.Vector3,k=new c.Vector3,V=new c.Box3,function(e,t){F.normal.set(0,1,0),F.constant=-e.min.y,U.direction.copy(t).negate().normalize();var i,n,r,o=e.getCenter(B),s=100*o.distanceToSquared(e.min)*100;V.makeEmpty();for(var a=0;a<8;a++){U.origin=(i=e,n=a,r=void 0,(r=new c.Vector3).x=1&n?i.max.x:i.min.x,r.y=2&n?i.max.y:i.min.y,r.z=4&n?i.max.z:i.min.z,r);var l=U.intersectPlane(F,k);l&&(l.distanceToSquared(o)>=s||V.expandByPoint(l))}e.union(V)}),this.getShadowParams=function(){return t},this.getShadowCamera=function(){return n}}const P=function(){};P.RefreshUniformsShadow=function(e,t){e.shadowMap&&(e.shadowMap.value=t.shadowMap),e.shadowMatrix&&(e.shadowMatrix.value=t.shadowMatrix),e.shadowLightDir&&(e.shadowLightDir.value=t.shadowLightDir),e.shadowESMConstant&&(e.shadowESMConstant.value=E.ShadowESMConstant),e.shadowBias&&(e.shadowBias.value=E.ShadowBias),e.shadowMapSize&&(e.shadowMapSize.value=E.ShadowMapSize),e.shadowDarkness&&(e.shadowDarkness.value=E.ShadowDarkness)}},71211:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(38383),r=i.n(n),o=i(88368),s=i.n(o);class a{constructor(e,t,i,n){this.viewerImpl=e,this.renderContext=t,this.glRenderer=i,this.materialManager=n,this.materialName="__material_2Don3D__",this.tmpVec=new THREE.Vector3,this.tmpBox=new THREE.Box3}createContext(){this.sheetContext=new Autodesk.Viewing.Private.RenderContext,this.sheetContext.init(this.glRenderer,this.renderContext.settings.logicalWidth,this.renderContext.settings.logicalHeight,{offscreen:!0});const e=this.renderContext.getConfig();e.antialias=!1,e.renderEdges=!1,e.clearAlpha=0,e.clearColor?e.clearColor.set(1,1,1):(e.clearColorBottom.set(1,1,1),e.clearColorTop.set(1,1,1)),this.sheetContext.applyConfig(e),this.prototypeScene=new THREE.Scene}setSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.renderContext;this.sheetContext&&(this.sheetContext.setSize(e.settings.logicalWidth,e.settings.logicalHeight),this.updateMaterial())}createScene(){this.setSize(),this.scene=new THREE.Scene,this.planeGeometry=new THREE.PlaneBufferGeometry(1,1),this.material=new THREE.ShaderMaterial({uniforms:{sheetMap:{type:"t",value:this.sheetContext.getColorTarget()},idMap:{type:"t",value:this.sheetContext.getIDTargets()[0]},modelIDv2:{type:"v3",value:new THREE.Vector3},resolution:{type:"v2",value:new THREE.Vector2},alphaTest:{type:"f",value:0}},vertexShader:r(),fragmentShader:s(),side:THREE.DoubleSide,transparent:!0}),this.scene.skipDepthTarget=!0,this.updateMaterial(),this.materialManager.addMaterialNonHDR(this.materialName,this.material),this.mesh=new THREE.Mesh(this.planeGeometry,this.material),this.mesh.matrixAutoUpdate=!1,this.scene.add(this.mesh)}updateMaterial(){if(this.material){const e=this.sheetContext.getColorTarget();this.material.uniforms.sheetMap.value=e,this.material.uniforms.idMap.value=this.sheetContext.getIDTargets()[0],this.material.uniforms.resolution.value.set(1/(e.width||1),1/(e.height||1))}}renderScenePart(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.renderContext;if(!e.frags||!e.frags.is2d)return;this.sheetContext||this.createContext(),this.scene||this.createScene(),this.material.uniforms.alphaTest.value=!e.needsTwoPasses||e.isSecondPass?0:.9;const o=e.modelId,s=this.viewerImpl.modelQueue().findModel(o),a=this.tmpBox.copy(s.getBoundingBox(!0)),l=s.getViewportBounds();l&&a.intersect(l);const c=s.getModelToViewerTransform();this.material.uniforms.modelIDv2.value.set((255&o)/255,(o>>8&255)/255,(o>>16&255)/255),r.getAOEnabled()!==this.sheetContext.getAOEnabled()&&this.sheetContext.initPostPipeline(r.getAOEnabled(),!1),n=n&&s.areAllVisible(),i=!1;this.lastRenderedModel===s&&e.isSecondPass||(this.sheetContext.beginScene(this.prototypeScene,this.viewerImpl.camera,this.viewerImpl.noLights,!0),this.sheetContext.renderScenePart(e,t,i,n,!1),this.sheetContext.presentBuffer());const h=a.getSize(new THREE.Vector3);this.mesh.matrix.makeScale(h.x,h.y,1),a.getCenter(this.tmpVec),this.mesh.matrix.setPosition(this.tmpVec),c&&this.mesh.matrix.multiplyMatrices(c,this.mesh.matrix),this.mesh.matrixWorld.copy(this.mesh.matrix),this.scene.modelId=o,r.renderScenePart(this.scene,t,i,n),this.lastRenderedModel=s}destroy(){this.material&&(this.material.dispose(),this.materialManager.removeNonHDRMaterial(this.materialName),this.material=null),this.planeGeometry&&(this.planeGeometry.dispose(),this.planeGeometry=null),this.sheetContext&&(this.sheetContext.cleanup(),this.context=null),this.renderContext=null,this.glRenderer=null}}},46890:(e,t,i)=>{"use strict";i.r(t),i.d(t,{WebGLProgram:()=>l});var n=i(61453),r=i(30130),o=i(72091);const s="#version 300 es\n #define texture2D texture\n #define textureCube texture\n #define attribute in\n #define varying out\n",a="#version 300 es\n #define texture2D texture\n #define textureCube texture\n #define textureCubeLodEXT textureLod\n #define gl_FragColor outFragColor\n #define varying in\n";let l=(c=0,h=function(e){return""!==e},u=function(e,t,i,n,r){var o=n?"1.0-":"",s="texture2D("+e+", (UV))",a="";return r=r||"vec4(0.0)",t&&i?a="((UV).x < 0.0 || (UV).x > 1.0 || (UV).y < 0.0 || (UV).y > 1.0) ? "+r+" : ":t?a="((UV).x < 0.0 || (UV).x > 1.0) ? "+r+" : ":i&&(a="((UV).y < 0.0 || (UV).y > 1.0) ? "+r+" : "),"#define GET_"+e.toUpperCase()+"(UV) ("+a+o+s+")"},function(e,t,i,l,d){var f=e,p=f.context,m=i.defines,g=i.__webglShader.uniforms;let v={};v={...i.attributes,...d.attributes};var y=(0,r.resolve)(l.vertexShader),b=(0,r.resolve)(l.fragmentShader),x=i.index0AttributeName;void 0===x&&!0===l.morphTargets&&(x="position");var _,E,S="ENVMAP_MODE_REFLECTION",A=e.gammaFactor>0?e.gammaFactor:1,w=function(e){var t,i,n=[];for(var r in e)!1!==(t=e[r])&&(i="#define "+r+" "+t,n.push(i));return n.join("\n")}(m),T=p.createProgram();i instanceof o.RawShaderMaterial?((_=[s,w].filter(h).join("\n")).length>0&&(_+="\n"),(E=[a,"precision "+l.precisionFragment+" float;",w,"out vec4 outFragColor;"].filter(h).join("\n")).length>0&&(E+="\n")):(_=[s,"precision "+l.precision+" float;","precision "+l.precision+" int;",w,l.vertexPrefix,l.supportsVertexTextures?"#define VERTEX_TEXTURES":"",f.gammaInput?"#define GAMMA_INPUT":"",f.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+A,l.mrtNormals?"#define MRT_NORMALS":"",l.mrtIdBuffer?"#define MRT_ID_BUFFER":"","#define MAX_DIR_LIGHTS "+l.maxDirLights,"#define MAX_POINT_LIGHTS "+l.maxPointLights,"#define MAX_SPOT_LIGHTS "+l.maxSpotLights,"#define MAX_HEMI_LIGHTS "+l.maxHemiLights,"#define MAX_BONES "+l.maxBones,"#define NUM_CUTPLANES "+l.numCutplanes,l.loadingAnimationDuration>0?"#define LOADING_ANIMATION":"",l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define "+S:"",l.irradianceMap?"#define USE_IRRADIANCEMAP":"",l.lightMap?"#define USE_LIGHTMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.vertexIds?"#define USE_VERTEX_ID":"",l.useTiling?"#define USE_TILING":"",l.useInstancing?"#define USE_INSTANCING":"",l.wideLines?"#define WIDE_LINES":"",l.skinning?"#define USE_SKINNING":"",l.useVertexTexture?"#define BONE_TEXTURE":"",l.morphTargets?"#define USE_MORPHTARGETS":"",l.morphNormals?"#define USE_MORPHNORMALS":"",l.wrapAround?"#define WRAP_AROUND":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.sizeAttenuation?"#define USE_SIZEATTENUATION":"",l.packedNormals?"#define UNPACK_NORMALS":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","#ifdef UNPACK_NORMALS","attribute vec2 normal;","#else","attribute vec3 normal;","#endif","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR"," attribute vec3 color;","#endif",""].join("\n"),E=[a,w,l.fragmentPrefix,"#define MAX_DIR_LIGHTS "+l.maxDirLights,"#define MAX_POINT_LIGHTS "+l.maxPointLights,"#define MAX_SPOT_LIGHTS "+l.maxSpotLights,"#define MAX_HEMI_LIGHTS "+l.maxHemiLights,"#define NUM_CUTPLANES "+l.numCutplanes,l.loadingAnimationDuration>0?"#define LOADING_ANIMATION":"",l.alphaTest?"#define ALPHATEST "+l.alphaTest:"",f.gammaInput?"#define GAMMA_INPUT":"",f.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+A,l.mrtNormals?"#define MRT_NORMALS":"",l.mrtIdBuffer?"#define MRT_ID_BUFFER":"",l.mrtIdBuffer>1?"#define MODEL_COLOR":"","#define TONEMAP_OUTPUT "+(l.tonemapOutput||0),l.useBackgroundTexture?"#define USE_BACKGROUND_TEXTURE":"",l.useFog&&l.fog?"#define USE_FOG":"",l.useFog&&l.fogExp?"#define FOG_EXP2":"",l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define ENVMAP_TYPE_CUBE":"",l.envMap?"#define "+S:"",l.envMap?"#define ENVMAP_BLENDING_MULTIPLY":"",l.irradianceMap?"#define USE_IRRADIANCEMAP":"",l.envGammaEncoded?"#define ENV_GAMMA":"",l.irrGammaEncoded?"#define IRR_GAMMA":"",l.envRGBM?"#define ENV_RGBM":"",l.irrRGBM?"#define IRR_RGBM":"",l.lightMap?"#define USE_LIGHTMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.vertexIds?"#define USE_VERTEX_ID":"",l.metal?"#define METAL":"",l.clearcoat?"#define CLEARCOAT":"",l.wrapAround?"#define WRAP_AROUND":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.hatchPattern?"#define HATCH_PATTERN":"",l.useTheming?"#define USE_THEMING":"",l.mapInvert?"#define MAP_INVERT":"",l.useTiling?"#define USE_TILING":"",l.useTiling?"#define TILE_RANGE_X_MIN "+l.tilingRepeatRange[0]:"",l.useTiling?"#define TILE_RANGE_Y_MIN "+l.tilingRepeatRange[1]:"",l.useTiling?"#define TILE_RANGE_X_MAX "+l.tilingRepeatRange[2]:"",l.useTiling?"#define TILE_RANGE_Y_MAX "+l.tilingRepeatRange[3]:"",l.hasRoundCorner?"#define USE_TILING_NORMAL":"",l.useRandomOffset?"#define USE_TILING_RANDOM":"",u("map",l.mapClampS,l.mapClampT),u("bumpMap",l.bumpMapClampS,l.bumpMapClampT),u("normalMap",l.normalMapClampS,l.normalMapClampT),u("specularMap",l.specularMapClampS,l.specularMapClampT),u("alphaMap",l.alphaMapClampS,l.alphaMapClampT,l.alphaMapInvert),l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF_EXT":"",l.logarithmicDepthBuffer&&l.polygonOffset?"#define POLYGON_OFFSET":"","precision "+l.precisionFragment+" float;","precision "+l.precisionFragment+" int;","layout(location = 0) out vec4 outFragColor;","uniform highp mat4 viewMatrix;","uniform highp mat4 projectionMatrix;","uniform highp vec3 cameraPosition;","#if defined(USE_ENVMAP) || defined(USE_IRRADIANCEMAP)","uniform mat4 viewMatrixInverse;","#endif",""].join("\n"));var M=new n.WebGLShader(p,p.VERTEX_SHADER,_+y),C=new n.WebGLShader(p,p.FRAGMENT_SHADER,E+b);p.attachShader(T,M),p.attachShader(T,C),void 0!==x&&p.bindAttribLocation(T,0,x),p.linkProgram(T),"undefined"!=typeof DEBUG_SHADERS&&DEBUG_SHADERS&&(!1===p.getProgramParameter(T,p.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",p.getProgramParameter(T,p.VALIDATE_STATUS)),console.error("gl.getError()",p.getError())),""!==p.getProgramInfoLog(T)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",p.getProgramInfoLog(T))),p.deleteShader(M),p.deleteShader(C);var P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","viewMatrixInverse","mvpMatrix","dbId"];for(var D in g)P.push(D);for(var L in P.push("logDepthBufFC","polygonOffset"),this.uniforms=function(e,t,i){for(var n={},r=0,o=i.length;r<o;r++){var s=i[r];n[s]=e.getUniformLocation(t,s)}return n}(p,T,P),P=["position","normal","uv","uv2","tangent","color","lineDistance","uvw","id","instOffset","instScaling","instRotation","prev","next","side","uvp","pointScale"],v)P.push(L);return this.attributes=function(e,t,i){for(var n={},r=0,o=i.length;r<o;r++){var s=i[r];n[s]=e.getAttribLocation(t,s)}return n}(p,T,P),this.attributesKeys=Object.keys(this.attributes),this.id=c++,this.code=t,this.usedTimes=1,this.program=T,this.vertexShader=M,this.fragmentShader=C,this});var c,h,u},53870:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEBUG_TEXTURE_LOAD:()=>p,WebGLRenderer:()=>v});var n=i(46890),r=i(22267),o=i(45383),s=i(8879),a=i(55280),l=i(72091),c=i(57872);class h{constructor(e,t,i){this.bufferRegion=e,this.offset=t,this.size=i}getGlBuffer(){return this.bufferRegion._buffer}getStride(){return this.bufferRegion._stride}}class u{constructor(e,t,i,n){this._buffer=e.createBuffer(),this._size=t,this._subsets=[],this._freeSpace=t,this._isVertexBuffer=i===e.ARRAY_BUFFER,this._stride=n,e.bindBuffer(i,this._buffer),e.bufferData(i,t,e.STATIC_DRAW)}tryAllocateBufferSubset(e){if(e>this._freeSpace)return null;let t=0;for(let i=0;i<this._subsets.length;i++){const n=this._subsets[i];if(n.offset-t>=e){const n=new h(this,t,e);return this._subsets.splice(i,0,n),this._freeSpace-=e,n}t=n.offset+n.size}if(t+e>this._size)return null;const i=new h(this,t,e);return this._subsets.push(i),this._freeSpace-=e,i}destroy(e){e.deleteBuffer(this._buffer),this._buffer=null}}class d{constructor(e){this._gl=e,this._indexBuffers=[],this._vertexBuffers=[]}allocateNewBufferRegion(e,t,i){const n=e===this._gl.ARRAY_BUFFER,r=n?this._vertexBuffers:this._indexBuffers,o=Math.max(t,n?c.VERTEX_BUFFER_REGION_SIZE:c.INDEX_BUFFER_REGION_SIZE);console.assert(o%4==0,"Buffer size must be a multiple of 4");const s=new u(this._gl,o,e,i);return r.push(s),s}allocateBufferSubset(e,t,i){const n=t===this._gl.ARRAY_BUFFER?this._vertexBuffers:this._indexBuffers;for(let t=0;t<n.length;t++)if(n[t]._stride===i){const i=n[t].tryAllocateBufferSubset(e);if(i)return i}return this.allocateNewBufferRegion(t,e,i).tryAllocateBufferSubset(e)}freeBufferSubset(e){if(e.bufferRegion._freeSpace+=e.size,e.bufferRegion._subsets.splice(e.bufferRegion._subsets.indexOf(e),1),0===e.bufferRegion._subsets.length){const t=e.bufferRegion._isVertexBuffer?this._vertexBuffers:this._indexBuffers;t.splice(t.indexOf(e.bufferRegion),1),e.bufferRegion.destroy(this._gl)}}resetAfterContextLoss(){this._vertexBuffers=[],this._indexBuffers=[]}printMemoryStatistics(){console.log("Vertex Buffer Count: ",this._vertexBuffers.length),console.log("Memory in Vertex Buffers: ",this._vertexBuffers.reduce(((e,t)=>{this._gl.bindBuffer(this._gl.ARRAY_BUFFER,t._buffer);return e+this._gl.getBufferParameter(this._gl.ARRAY_BUFFER,this._gl.BUFFER_SIZE)}),0)/1024),console.log("Actually allocated memory in Vertex Buffers: ",this._vertexBuffers.reduce(((e,t)=>e+t._size-t._freeSpace),0)),console.log("Index Buffer Count: ",this._indexBuffers.length),console.log("Memory in Index Buffers: ",this._indexBuffers.reduce(((e,t)=>{this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,t._buffer);return e+this._gl.getBufferParameter(this._gl.ELEMENT_ARRAY_BUFFER,this._gl.BUFFER_SIZE)}),0)/1024),console.log("Actually allocated memory in Index Buffers: ",this._indexBuffers.reduce(((e,t)=>e+t._size-t._freeSpace),0))}}var f=i(33472);let p=!1;const m=(0,a.getGlobal)(),g=m.document;let v=function(e){console.log("THREE.WebGLRenderer",l.REVISION);var t=void 0!==(e=e||{}).canvas?e.canvas:g.createElement("canvas"),i=null,a=void 0!==e.precision?e.precision:"highp",h=a,u=void 0!==e.alpha&&e.alpha,v=void 0===e.premultipliedAlpha||e.premultipliedAlpha,y=void 0!==e.antialias&&e.antialias,b=void 0===e.stencil||e.stencil,x=void 0===e.preserveDrawingBuffer||e.preserveDrawingBuffer,_=e.logarithmicDepthBuffer,E=new l.Color(0),S=0,A=[],w={},T=new l.Matrix4,M=new l.Matrix3;this.highResTimeStamp=0;var C=[],P=[];this.domElement=t,this.context=null,this.refCount=0,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaInput=!1,this.gammaOutput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0},reset:function(){this.render.calls=0}};var D,L,I,R,O=this,N=[],F=null,U=null,B=null,k=null,V=-1,G=null,z="",H=0,W="",j="",q=new Set,X=0,Y=0,K=0,Q=t.width,Z=t.height,$={},J=new l.Frustum,ee=new l.Matrix4,te=new l.Matrix4,ie=new l.Vector3,ne=new l.Vector3,re=!0,oe={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};O.capabilities={};try{var se={alpha:u,premultipliedAlpha:v,antialias:y,stencil:b,powerPreference:"high-performance",preserveDrawingBuffer:x};if(D=t.getContext("webgl2",se),O.capabilities.isWebGL2=!0,null===D)throw null!==t.getContext("webgl2",se)?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";!function(e){let t=e.colorMask.bind(e),i=e.getParameter(e.COLOR_WRITEMASK);e.colorMask=function(e,n,r,o){e===i[0]&&n===i[1]&&r===i[2]&&o===i[3]||(i[0]=e,i[1]=n,i[2]=r,i[3]=o,t(e,n,r,o))},e.getColorMask=function(){return i.slice()}}(D);const e=D.getExtension("WEBGL_debug_renderer_info");if(e){const t=D.getParameter(e.UNMASKED_VENDOR_WEBGL),i=D.getParameter(e.UNMASKED_RENDERER_WEBGL);console.log("WebGL Renderer: "+i),console.log("WebGL Vendor: "+t)}L=new d(D),I=c.USE_BUFFER_MANAGER?L.freeBufferSubset.bind(L):D.deleteBuffer.bind(D),R=c.USE_BUFFER_MANAGER?function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",Fe));if(e.streamingDraw&&!q.has(e)){if(e.streamingDraw===f.O){if(e.streamingDraw=!1,e.streamingIndex=!1,e.discardAfterUpload){e.ib&&(e.ibLength=e.ib.length,e.ibByteSize=e.ib instanceof Uint32Array?4:2,e.ib=null),e.vb&&(e.vbLength=e.vb.length,e.vb=null),e.iblines&&(e.iblinesLength=e.iblines.length,e.iblinesByteSize=e.iblines instanceof Uint32Array?4:2,e.iblines=null);const t=e.attributes,i=Object.keys(e.attributes);for(let e=0,n=i.length;e<n;e++){t[i[e]].array=null}}}else if(!e.streamingIndex){var t=e.index;t&&(t.buffer=D.createBuffer(),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,t.buffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,t.array||e.ib,D.STATIC_DRAW))}return}e.vb&&void 0===e.vbbuffer&&(e.vbNeedsUpdate=!0);e.ib&&void 0===e.ibbuffer&&(e.ibNeedsUpdate=!0);e.iblines&&void 0===e.iblinesbuffer&&(e.iblinesNeedsUpdate=!0);if(e.vbNeedsUpdate){let t=!0;void 0!==e.vbbuffer&&(e.vbbuffer.size!==e.vb.byteLength||e.vbbuffer.getStride()!=e.vbstride?L.freeBufferSubset(e.vbbuffer):t=!1),t&&(e.vbbuffer=L.allocateBufferSubset(e.vb.byteLength,D.ARRAY_BUFFER,4*e.vbstride),e.streamingDraw=f.O,e.streamingIndex=f.O,q.add(e)),D.bindBuffer(D.ARRAY_BUFFER,e.vbbuffer.getGlBuffer()),D.bufferSubData(D.ARRAY_BUFFER,e.vbbuffer.offset,e.vb),e.vbNeedsUpdate=!1}if(e.ibNeedsUpdate){let t=!0;void 0!==e.ibbuffer&&(e.ibbuffer.size!==e.ib.byteLength?L.freeBufferSubset(e.ibbuffer):t=!1),t&&(e.ibbuffer=L.allocateBufferSubset(e.ib.byteLength,D.ELEMENT_ARRAY_BUFFER,0),e.streamingDraw=f.O,e.streamingIndex=f.O,q.add(e)),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.ibbuffer.getGlBuffer()),D.bufferSubData(D.ELEMENT_ARRAY_BUFFER,e.ibbuffer.offset,e.ib),e.ibNeedsUpdate=!1}if(e.iblinesNeedsUpdate){let t=!0;void 0!==e.iblinesbuffer&&(e.iblinesbuffer.size!==e.iblines.byteLength?L.freeBufferSubset(e.iblinesbuffer):t=!1),t&&(e.iblinesbuffer=L.allocateBufferSubset(e.iblines.byteLength,D.ELEMENT_ARRAY_BUFFER,0),e.streamingDraw=f.O,e.streamingIndex=f.O,q.add(e)),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.iblinesbuffer.getGlBuffer()),D.bufferSubData(D.ELEMENT_ARRAY_BUFFER,e.iblinesbuffer.offset,e.iblines),e.iblinesNeedsUpdate=!1}const i=e.attributes,n=Object.keys(e.attributes);for(let t=0,s=n.length;t<s;t++){const s=n[t],a=i[s];var r,o="index"===s?D.ELEMENT_ARRAY_BUFFER:D.ARRAY_BUFFER;if(a.array&&void 0===a.buffer){const t=a.bytesPerItem||a.array.BYTES_PER_ELEMENT;a.buffer=L.allocateBufferSubset(a.array.byteLength,o,a.itemSize*t),a.needsUpdate=!0,e.streamingDraw=f.O,e.streamingIndex=f.O,q.add(e)}if(tt(a))void 0===(null===(r=a.buffer)||void 0===r?void 0:r.getGlBuffer)?(D.bindBuffer(o,a.buffer),D.bufferData(o,a.array,D.STATIC_DRAW)):(D.bindBuffer(o,a.buffer.getGlBuffer()),D.bufferSubData(o,a.buffer.offset,a.array)),it(a)}}:function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",Fe));if(e.streamingDraw){if(!e.streamingIndex){var t=e.index;t&&(t.buffer=D.createBuffer(),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,t.buffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,t.array||e.ib,D.STATIC_DRAW))}return}e.vb&&void 0===e.vbbuffer&&(e.vbbuffer=D.createBuffer(),e.vbNeedsUpdate=!0);e.ib&&void 0===e.ibbuffer&&(e.ibbuffer=D.createBuffer(),e.ibNeedsUpdate=!0);e.iblines&&void 0===e.iblinesbuffer&&(e.iblinesbuffer=D.createBuffer(),e.iblinesNeedsUpdate=!0);for(var i=e.attributes,n=Object.keys(e.attributes),r=0,o=n.length;r<o;r++){var s=n[r],a=i[s],l="index"===s;if(a.array&&void 0===a.buffer&&(a.buffer=D.createBuffer(),a.needsUpdate=!0),tt(a)){var c=l?D.ELEMENT_ARRAY_BUFFER:D.ARRAY_BUFFER;D.bindBuffer(c,a.buffer),D.bufferData(c,a.array,D.STATIC_DRAW),it(a),e.discardAfterUpload&&(a.array=null)}}e.vbNeedsUpdate&&(D.bindBuffer(D.ARRAY_BUFFER,e.vbbuffer),D.bufferData(D.ARRAY_BUFFER,e.vb,D.STATIC_DRAW),e.vbNeedsUpdate=!1,e.discardAfterUpload&&(e.vbLength=e.vb.length,e.vb=null));e.ibNeedsUpdate&&(D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.ibbuffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,e.ib,D.STATIC_DRAW),e.ibNeedsUpdate=!1,e.discardAfterUpload&&(e.ibLength=e.ib.length,e.ibByteSize=e.ib instanceof Uint32Array?4:2,e.ib=null));e.iblinesNeedsUpdate&&(D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.iblinesbuffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,e.iblines,D.STATIC_DRAW),e.iblinesNeedsUpdate=!1,e.discardAfterUpload&&(e.iblinesLength=e.iblines.length,e.iblinesByteSize=e.iblines instanceof Uint32Array?4:2,e.iblines=null))},0==D.getShaderPrecisionFormat(D.FRAGMENT_SHADER,D.HIGH_FLOAT).precision&&(h="mediump"),t.addEventListener("webglcontextlost",(function(e){e.preventDefault(),fe(),de(),w={},bt={},xt=0,pe.dispose(),N.length=0}),!1),t.addEventListener("webglcontextrestored",(function(e){e.preventDefault(),O.enableContextRestore&&(he(),Te(),c.USE_BUFFER_MANAGER&&(L.resetAfterContextLoss(),q=new Set),$={},O.lostContextRecovery=O.lostContextRecovery||new o.Ay,O.lostContextRecovery.onContextRestored(),F=null,U=null)}))}catch(e){return void console.error(e)}let ae,le,ce;function he(){ae=new l.WebGLExtensions(D),le=new l.WebGLState(D,Wt),ce=le,ae.get("EXT_texture_filter_anisotropic"),ae.get("WEBGL_compressed_texture_s3tc"),ae.get("EXT_color_buffer_float"),O.extensions=ae}void 0===D.getShaderPrecisionFormat&&(D.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),he();var ue=function(e,t,i,n){!0===v&&(e*=n,t*=n,i*=n),D.clearColor(e,t,i,n)},de=function(){D.clearColor(0,0,0,1),D.clearDepth(1-c.DEPTH_EPSILON),D.clearStencil(0),D.enable(D.DEPTH_TEST),D.depthFunc(D.LEQUAL),D.frontFace(D.CCW),D.cullFace(D.BACK),D.enable(D.CULL_FACE),D.enable(D.BLEND),D.blendEquation(D.FUNC_ADD),D.blendFunc(D.SRC_ALPHA,D.ONE_MINUS_SRC_ALPHA),D.viewport(Y,K,Q,Z),ue(E.r,E.g,E.b,S)},fe=function(){F=null,G=null,z="",V=-1,re=!0,le.reset(),ce.disableUnusedAttributes()};de(),this.context=D,this.state=le;for(var pe,me=D.getParameter(D.MAX_TEXTURE_IMAGE_UNITS),ge=D.getParameter(D.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ve=D.getParameter(D.MAX_TEXTURE_SIZE),ye=D.getParameter(D.MAX_CUBE_MAP_TEXTURE_SIZE),be=ge>0,xe=D.getShaderPrecisionFormat(D.VERTEX_SHADER,D.HIGH_FLOAT),_e=D.getShaderPrecisionFormat(D.VERTEX_SHADER,D.MEDIUM_FLOAT),Ee=D.getShaderPrecisionFormat(D.FRAGMENT_SHADER,D.HIGH_FLOAT),Se=D.getShaderPrecisionFormat(D.FRAGMENT_SHADER,D.MEDIUM_FLOAT),Ae=new Uint8Array(16),we=0;we<4;we++)p?1===we||2===we?(Ae[4*we]=246,Ae[4*we+1]=140,Ae[4*we+2]=220):(Ae[4*we]=48,Ae[4*we+1]=195,Ae[4*we+2]=3):Ae[4*we]=Ae[4*we+1]=Ae[4*we+2]=0,Ae[4*we+3]=255;function Te(){(pe=new l.DataTexture(Ae,2,2,l.RGBAFormat,l.UnsignedByteType,l.UVMapping,l.RepeatWrapping,l.RepeatWrapping,l.NearestFilter,l.NearestFilter)).needsUpdate=!0}Te();var Me,Ce,Pe=function(){if(void 0!==Me)return Me;if(Me=[],ae.get("WEBGL_compressed_texture_pvrtc")||ae.get("WEBGL_compressed_texture_s3tc"))for(var e=D.getParameter(D.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)Me.push(e[t]);return Me},De=xe.precision>0,Le=_e.precision>0;"highp"!==a||De||(Le?(a="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(a="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp"))),"mediump"!==a||Le||(a="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp")),De=Ee.precision>0,Le=Se.precision>0,"highp"!==h||De||(Le?(h="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(h="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp"))),"mediump"!==h||Le||(h="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp")),this.getContext=function(){return D},this.isWebGL2=function(){return!0},this.forceContextLoss=function(){ae.get("WEBGL_lose_context").loseContext()},this.forceContextRestore=function(){ae.get("WEBGL_lose_context").restoreContext()},this.getMaxAnisotropy=function(){if(void 0!==Ce)return Ce;var e=ae.get("EXT_texture_filter_anisotropic");return Ce=null!==e?D.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPixelRatio=function(){return i||m.devicePixelRatio||1},this.setPixelRatio=function(e){i=e},this.getCurrentFramebuffer=function(){return U},this.setSize=function(e,i,n){const r=this.getPixelRatio();t.width=e*r,t.height=i*r,!1!==n&&(t.style.width=e+"px",t.style.height=i+"px"),this.setViewport(0,0,e,i)},this.setViewport=function(e,t,i,n){const r=this.getPixelRatio();Y=e*r,K=t*r,Q=i*r,Z=n*r,D.viewport(Y,K,Q,Z)};var Ie=!1;this.enableViewportOnOffscreenTargets=function(e){Ie=e};var Re=[];function Oe(e){e.__webglVertexBuffer=D.createBuffer(),e.__webglNormalBuffer=D.createBuffer(),e.__webglTangentBuffer=D.createBuffer(),e.__webglColorBuffer=D.createBuffer(),e.__webglUVBuffer=D.createBuffer(),e.__webglUV2Buffer=D.createBuffer(),e.__webglSkinIndicesBuffer=D.createBuffer(),e.__webglSkinWeightsBuffer=D.createBuffer(),e.__webglFaceBuffer=D.createBuffer(),e.__webglLineBuffer=D.createBuffer(),O.info.memory.geometries++}this.pushViewport=function(){Re.push(Y),Re.push(K),Re.push(Q),Re.push(Z)},this.popViewport=function(){var e=Re.length-4;Y=Re[e],K=Re[e+1],Q=Re[e+2],Z=Re[e+3],D.viewport(Y,K,Q,Z),Re.length=e},this.setScissor=function(e,t,i,n){const r=this.getPixelRatio();D.scissor(e*r,t*r,i*r,n*r)},this.enableScissorTest=function(e){e?D.enable(D.SCISSOR_TEST):D.disable(D.SCISSOR_TEST)},this.getClearColor=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),e=new l.Color),e.copy(E)},this.setClearColor=function(e,t){E.set(e),S=void 0!==t?t:1,ue(E.r,E.g,E.b,S)},this.getClearAlpha=function(){return S},this.setClearAlpha=function(e){S=e,ue(E.r,E.g,E.b,S)},this.clear=function(e,t,i){var n=0;(void 0===e||e)&&(n|=D.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=D.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=D.STENCIL_BUFFER_BIT),D.clear(n)},this.clearColor=function(){D.clear(D.COLOR_BUFFER_BIT)},this.clearDepth=function(){D.clear(D.DEPTH_BUFFER_BIT)},this.clearStencil=function(){D.clear(D.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,i,n){this.setRenderTarget(e),this.clear(t,i,n)},this.resetGLState=fe;var Ne=function(e){e.target.traverse((function(e){e.removeEventListener("remove",Ne),function(e){(e instanceof l.Mesh||e instanceof l.PointCloud||e instanceof l.Line)&&delete w[e.id];delete e.__webglInit,delete e.__webglActive}(e)}))},Fe=function(e){var t=e.target;t.removeEventListener("dispose",Fe),Ge(t)},Ue=function(e){var t=e.target;t.removeEventListener("dispose",Ue),qe(t),O.info.memory.textures--},Be=function(e){var t=e.target;t.removeEventListener("dispose",Be),Xe(t),O.info.memory.textures--},ke=function(e){var t=e.target;t.removeEventListener("dispose",ke),Ye(t)},Ve=function(e){if(void 0!==e.__webglVertexBuffer&&(D.deleteBuffer(e.__webglVertexBuffer),e.__webglVertexBuffer=void 0),void 0!==e.__webglNormalBuffer&&(D.deleteBuffer(e.__webglNormalBuffer),e.__webglNormalBuffer=void 0),void 0!==e.__webglTangentBuffer&&(D.deleteBuffer(e.__webglTangentBuffer),e.__webglTangentBuffer=void 0),void 0!==e.__webglColorBuffer&&(D.deleteBuffer(e.__webglColorBuffer),e.__webglColorBuffer=void 0),void 0!==e.__webglUVBuffer&&(D.deleteBuffer(e.__webglUVBuffer),e.__webglUVBuffer=void 0),void 0!==e.__webglUV2Buffer&&(D.deleteBuffer(e.__webglUV2Buffer),e.__webglUV2Buffer=void 0),void 0!==e.__webglSkinIndicesBuffer&&(D.deleteBuffer(e.__webglSkinIndicesBuffer),e.__webglSkinIndicesBuffer=void 0),void 0!==e.__webglSkinWeightsBuffer&&(D.deleteBuffer(e.__webglSkinWeightsBuffer),e.__webglSkinWeightsBuffer=void 0),void 0!==e.__webglFaceBuffer&&(D.deleteBuffer(e.__webglFaceBuffer),e.__webglFaceBuffer=void 0),void 0!==e.__webglLineBuffer&&(D.deleteBuffer(e.__webglLineBuffer),e.__webglLineBuffer=void 0),void 0!==e.__webglLineDistanceBuffer&&(D.deleteBuffer(e.__webglLineDistanceBuffer),e.__webglLineDistanceBuffer=void 0),void 0!==e.__webglCustomAttributesList){for(var t in e.__webglCustomAttributesList)D.deleteBuffer(e.__webglCustomAttributesList[t].buffer);e.__webglCustomAttributesList=void 0}O.info.memory.geometries--},Ge=function(e){var t,i,n,r;if(e.__webglInit=void 0,e instanceof l.BufferGeometry){if(void 0!==e.vbbuffer&&(I(e.vbbuffer),e.vbbuffer=void 0),void 0!==e.ibbuffer&&(I(e.ibbuffer),e.ibbuffer=void 0),void 0!==e.iblinesbuffer&&(I(e.iblinesbuffer),e.iblinesbuffer=void 0),e.vaos){for(t=0;t<e.vaos.length;t++)D.deleteVertexArray(e.vaos[t].vao);e.vaos=void 0}var o=e.attributes;for(var s in o)void 0!==o[s].buffer&&(I(o[s].buffer),o[s].buffer=void 0);O.info.memory.geometries--}else{var a=bt[e.id];if(void 0!==a){for(t=0,i=a.length;t<i;t++){var c=a[t];if(void 0!==c.numMorphTargets){for(n=0,r=c.numMorphTargets;n<r;n++)D.deleteBuffer(c.__webglMorphTargetsBuffers[n]);delete c.__webglMorphTargetsBuffers}if(void 0!==c.numMorphNormals){for(n=0,r=c.numMorphNormals;n<r;n++)D.deleteBuffer(c.__webglMorphNormalsBuffers[n]);delete c.__webglMorphNormalsBuffers}Ve(c)}delete bt[e.id]}else Ve(e)}};this.deallocateGeometry=Ge;var ze,He,We,je,qe=function(e){if(e.__webglTextureCube)D.deleteTexture(e.__webglTextureCube),e.__webglTextureCube=void 0;else{if(!e.__webglInit)return;D.deleteTexture(e.__webglTexture),e.__webglInit=void 0,e.__webglTexture=void 0}},Xe=function(e){e&&e.__webglTexture&&(D.deleteTexture(e.__webglTexture),D.deleteFramebuffer(e.__webglFramebuffer),void 0!==e.__webglRenderbuffer&&D.deleteRenderbuffer(e.__webglRenderbuffer),void 0!==e.__webglRenderbufferOwn&&(D.deleteRenderbuffer(e.__webglRenderbufferOwn),e.__webglRenderbufferOwn=void 0))},Ye=function(e){var t=!1;e.program=void 0,e.programs.forEach((function(e){var i,n,r,o;if(void 0!==e&&null!=(i=e.program))for(n=0,r=N.length;n<r;n++)if((o=N[n])&&o.program===i){o.usedTimes--,0===o.usedTimes&&(N[n]=void 0,D.deleteProgram(i),O.info.memory.programs--,t=!0);break}}),!1),e.programs.length=0,t&&(N=N.filter((function(e){return void 0!==e})))};function Ke(e,t){var i=e.vertices.length,n=t.material;if(n.attributes)for(var r in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),n.attributes){var o=n.attributes[r];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var s=1;"v2"===o.type?s=2:"v3"===o.type?s=3:"v4"===o.type?s=4:"c"===o.type&&(s=3),o.size=s,o.array=new Float32Array(i*s),o.buffer=D.createBuffer(),o.buffer.belongsToAttribute=r,o.needsUpdate=!0}e.__webglCustomAttributesList.push(o)}}function Qe(e,t){var i=t.geometry,n=e.faces3,r=3*n.length,o=1*n.length,s=3*n.length,a=Ze(t,e),l=et(a),c=$e(a),h=Je(a);e.__vertexArray=new Float32Array(3*r),c&&(e.__normalArray=new Float32Array(3*r)),i.hasTangents&&(e.__tangentArray=new Float32Array(4*r)),h&&(e.__colorArray=new Float32Array(3*r)),l&&(i.faceVertexUvs.length>0&&(e.__uvArray=new Float32Array(2*r)),i.faceVertexUvs.length>1&&(e.__uv2Array=new Float32Array(2*r))),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*r),e.__skinWeightArray=new Float32Array(4*r));var u=o>21845?Uint32Array:Uint16Array;if(e.__typeArray=u,e.__faceArray=new u(3*o),e.__lineArray=new u(2*s),e.__webglFaceCount=3*o,e.__webglLineCount=2*s,a.attributes)for(var d in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),a.attributes){var f=a.attributes[d],p={};for(var m in f)p[m]=f[m];if(!p.__webglInitialized||p.createUniqueBuffers){p.__webglInitialized=!0;var g=1;"v2"===p.type?g=2:"v3"===p.type?g=3:"v4"===p.type?g=4:"c"===p.type&&(g=3),p.size=g,p.array=new Float32Array(r*g),p.buffer=D.createBuffer(),p.buffer.belongsToAttribute=d,f.needsUpdate=!0,p.__original=f}e.__webglCustomAttributesList.push(p)}e.__inittedArrays=!0}function Ze(e,t){return e.material instanceof l.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function $e(e){return!(e instanceof l.MeshBasicMaterial&&!e.envMap||e instanceof l.MeshDepthMaterial)&&(function(e){return e&&(void 0!==e.shading&&e.shading===l.SmoothShading||void 0!==e.flatShading&&!1===e.flatShading)}(e)?l.SmoothShading:l.FlatShading)}function Je(e){return!!e.vertexColors&&e.vertexColors}function et(e){return!!(e.map||e.lightMap||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e instanceof l.ShaderMaterial)}function tt(e){return!0===e.needsUpdate}function it(e){e.needsUpdate=!1}function nt(e,t,i,n,r){if(e.__inittedArrays){var o,s,a,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M,C,P,L,I,R=$e(r),O=Je(r),N=et(r),F=R===l.SmoothShading,U=0,B=0,k=0,V=0,G=0,z=0,H=0,W=0,j=0,q=0,X=e.__vertexArray,Y=e.__uvArray,K=e.__uv2Array,Q=e.__normalArray,Z=e.__tangentArray,$=e.__colorArray,J=e.__webglCustomAttributesList,ee=e.__faceArray,te=e.__lineArray,ie=t.geometry,ne=ie.verticesNeedUpdate,re=ie.elementsNeedUpdate,oe=ie.uvsNeedUpdate,se=ie.normalsNeedUpdate,ae=ie.tangentsNeedUpdate,le=ie.colorsNeedUpdate,ce=ie.vertices,he=e.faces3,ue=ie.faces,de=ie.faceVertexUvs[0],fe=ie.faceVertexUvs[1];if(ne){for(o=0,s=he.length;o<s;o++)g=ce[(a=ue[he[o]]).a],v=ce[a.b],y=ce[a.c],X[B]=g.x,X[B+1]=g.y,X[B+2]=g.z,X[B+3]=v.x,X[B+4]=v.y,X[B+5]=v.z,X[B+6]=y.x,X[B+7]=y.y,X[B+8]=y.z,B+=9;D.bindBuffer(D.ARRAY_BUFFER,e.__webglVertexBuffer),D.bufferData(D.ARRAY_BUFFER,X,i)}if(le&&O){for(o=0,s=he.length;o<s;o++)u=(a=ue[he[o]]).vertexColors,d=a.color,3===u.length&&O===l.VertexColors?(E=u[0],S=u[1],A=u[2]):(E=d,S=d,A=d),$[j]=E.r,$[j+1]=E.g,$[j+2]=E.b,$[j+3]=S.r,$[j+4]=S.g,$[j+5]=S.b,$[j+6]=A.r,$[j+7]=A.g,$[j+8]=A.b,j+=9;j>0&&(D.bindBuffer(D.ARRAY_BUFFER,e.__webglColorBuffer),D.bufferData(D.ARRAY_BUFFER,$,i))}if(ae&&ie.hasTangents){for(o=0,s=he.length;o<s;o++)b=(f=(a=ue[he[o]]).vertexTangents)[0],x=f[1],_=f[2],Z[H]=b.x,Z[H+1]=b.y,Z[H+2]=b.z,Z[H+3]=b.w,Z[H+4]=x.x,Z[H+5]=x.y,Z[H+6]=x.z,Z[H+7]=x.w,Z[H+8]=_.x,Z[H+9]=_.y,Z[H+10]=_.z,Z[H+11]=_.w,H+=12;D.bindBuffer(D.ARRAY_BUFFER,e.__webglTangentBuffer),D.bufferData(D.ARRAY_BUFFER,Z,i)}if(se&&R){for(o=0,s=he.length;o<s;o++)if(c=(a=ue[he[o]]).vertexNormals,h=a.normal,3===c.length&&F)for(w=0;w<3;w++)M=c[w],Q[z]=M.x,Q[z+1]=M.y,Q[z+2]=M.z,z+=3;else for(w=0;w<3;w++)Q[z]=h.x,Q[z+1]=h.y,Q[z+2]=h.z,z+=3;D.bindBuffer(D.ARRAY_BUFFER,e.__webglNormalBuffer),D.bufferData(D.ARRAY_BUFFER,Q,i)}if(oe&&de&&N){for(o=0,s=he.length;o<s;o++)if(void 0!==(p=de[he[o]]))for(w=0;w<3;w++)C=p[w],Y[k]=C.x,Y[k+1]=C.y,k+=2;k>0&&(D.bindBuffer(D.ARRAY_BUFFER,e.__webglUVBuffer),D.bufferData(D.ARRAY_BUFFER,Y,i))}if(oe&&fe&&N){for(o=0,s=he.length;o<s;o++)if(void 0!==(m=fe[he[o]]))for(w=0;w<3;w++)P=m[w],K[V]=P.x,K[V+1]=P.y,V+=2;V>0&&(D.bindBuffer(D.ARRAY_BUFFER,e.__webglUV2Buffer),D.bufferData(D.ARRAY_BUFFER,K,i))}if(re){for(o=0,s=he.length;o<s;o++)ee[G]=U,ee[G+1]=U+1,ee[G+2]=U+2,G+=3,te[W]=U,te[W+1]=U+1,te[W+2]=U,te[W+3]=U+2,te[W+4]=U+1,te[W+5]=U+2,W+=6,U+=3;D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,ee,i),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,te,i)}if(J)for(w=0,T=J.length;w<T;w++)if(tt((I=J[w]).__original)){if(q=0,1===I.size){if(void 0===I.boundTo||"vertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)a=ue[he[o]],I.array[q]=I.value[a.a],I.array[q+1]=I.value[a.b],I.array[q+2]=I.value[a.c],q+=3;else if("faces"===I.boundTo)for(o=0,s=he.length;o<s;o++)L=I.value[he[o]],I.array[q]=L,I.array[q+1]=L,I.array[q+2]=L,q+=3}else if(2===I.size){if(void 0===I.boundTo||"vertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)a=ue[he[o]],g=I.value[a.a],v=I.value[a.b],y=I.value[a.c],I.array[q]=g.x,I.array[q+1]=g.y,I.array[q+2]=v.x,I.array[q+3]=v.y,I.array[q+4]=y.x,I.array[q+5]=y.y,q+=6;else if("faces"===I.boundTo)for(o=0,s=he.length;o<s;o++)g=L=I.value[he[o]],v=L,y=L,I.array[q]=g.x,I.array[q+1]=g.y,I.array[q+2]=v.x,I.array[q+3]=v.y,I.array[q+4]=y.x,I.array[q+5]=y.y,q+=6}else if(3===I.size){var pe;if(pe="c"===I.type?["r","g","b"]:["x","y","z"],void 0===I.boundTo||"vertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)a=ue[he[o]],g=I.value[a.a],v=I.value[a.b],y=I.value[a.c],I.array[q]=g[pe[0]],I.array[q+1]=g[pe[1]],I.array[q+2]=g[pe[2]],I.array[q+3]=v[pe[0]],I.array[q+4]=v[pe[1]],I.array[q+5]=v[pe[2]],I.array[q+6]=y[pe[0]],I.array[q+7]=y[pe[1]],I.array[q+8]=y[pe[2]],q+=9;else if("faces"===I.boundTo)for(o=0,s=he.length;o<s;o++)g=L=I.value[he[o]],v=L,y=L,I.array[q]=g[pe[0]],I.array[q+1]=g[pe[1]],I.array[q+2]=g[pe[2]],I.array[q+3]=v[pe[0]],I.array[q+4]=v[pe[1]],I.array[q+5]=v[pe[2]],I.array[q+6]=y[pe[0]],I.array[q+7]=y[pe[1]],I.array[q+8]=y[pe[2]],q+=9;else if("faceVertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)g=(L=I.value[he[o]])[0],v=L[1],y=L[2],I.array[q]=g[pe[0]],I.array[q+1]=g[pe[1]],I.array[q+2]=g[pe[2]],I.array[q+3]=v[pe[0]],I.array[q+4]=v[pe[1]],I.array[q+5]=v[pe[2]],I.array[q+6]=y[pe[0]],I.array[q+7]=y[pe[1]],I.array[q+8]=y[pe[2]],q+=9}else if(4===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)a=ue[he[o]],g=I.value[a.a],v=I.value[a.b],y=I.value[a.c],I.array[q]=g.x,I.array[q+1]=g.y,I.array[q+2]=g.z,I.array[q+3]=g.w,I.array[q+4]=v.x,I.array[q+5]=v.y,I.array[q+6]=v.z,I.array[q+7]=v.w,I.array[q+8]=y.x,I.array[q+9]=y.y,I.array[q+10]=y.z,I.array[q+11]=y.w,q+=12;else if("faces"===I.boundTo)for(o=0,s=he.length;o<s;o++)g=L=I.value[he[o]],v=L,y=L,I.array[q]=g.x,I.array[q+1]=g.y,I.array[q+2]=g.z,I.array[q+3]=g.w,I.array[q+4]=v.x,I.array[q+5]=v.y,I.array[q+6]=v.z,I.array[q+7]=v.w,I.array[q+8]=y.x,I.array[q+9]=y.y,I.array[q+10]=y.z,I.array[q+11]=y.w,q+=12;else if("faceVertices"===I.boundTo)for(o=0,s=he.length;o<s;o++)g=(L=I.value[he[o]])[0],v=L[1],y=L[2],I.array[q]=g.x,I.array[q+1]=g.y,I.array[q+2]=g.z,I.array[q+3]=g.w,I.array[q+4]=v.x,I.array[q+5]=v.y,I.array[q+6]=v.z,I.array[q+7]=v.w,I.array[q+8]=y.x,I.array[q+9]=y.y,I.array[q+10]=y.z,I.array[q+11]=y.w,q+=12;D.bindBuffer(D.ARRAY_BUFFER,I.buffer),D.bufferData(D.ARRAY_BUFFER,I.array,i)}n&&(delete e.__inittedArrays,delete e.__colorArray,delete e.__normalArray,delete e.__tangentArray,delete e.__uvArray,delete e.__uv2Array,delete e.__faceArray,delete e.__vertexArray,delete e.__lineArray,delete e.__skinIndexArray,delete e.__skinWeightArray)}}function rt(e,t,i,n){var r=i.vaos;if(r)for(var o=0,s=r.length;o<s;o++){var a=r[o];if(a.geomhash===t.id&&a.uv===n)return D.bindVertexArray(a.vao),!0}else if(null===r)return!1;return function(e,t,i,n){var r,o,s;if(!c.USE_VAO||i.streamingDraw)return i.vaos=null,!1;if(void 0===i.vaos&&(i.vaos=[]),s=D.createVertexArray(),i.vaos.push({geomhash:t.id,uv:n,vao:s}),D.bindVertexArray(s),e.isEdgeMaterial)D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,i.iblinesbuffer);else{var a=i.index;a&&D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,a.buffer||i.ibbuffer)}for(var l=null,h=t.attributes,u=t.attributesKeys,d=i.vbstride,f=null!==(r=i.groups)&&void 0!==r&&r.length?i.groups[0].index:0,p=null!==(o=i.groups)&&void 0!==o&&o.length&&i.groups[0].instanceStart||0,m=0,g=u.length;m<g;m++){var v=u[m],y=h[v];if(y>=0){var b=i.attributes[v];if("uv"===v&&n&&(b=i.attributes["uv"+(n+1)]),!b){D.bindVertexArray(null);for(var x=0;x<i.vaos.length;x++)D.deleteVertexArray(i.vaos[x].vao);return i.vaos=null,!1}var _=D.FLOAT,E=b.bytesPerItem||4;1===E?_=D.UNSIGNED_BYTE:2===E&&(_=D.UNSIGNED_SHORT),D.enableVertexAttribArray(y);var S=f;b.divisor&&(S+=p),void 0!==b.itemOffset?(l!=i.vbbuffer&&(D.bindBuffer(D.ARRAY_BUFFER,i.vbbuffer),l=i.vbbuffer),D.vertexAttribPointer(y,b.itemSize,_,b.normalized,4*d,4*(b.itemOffset+S*d))):(D.bindBuffer(D.ARRAY_BUFFER,b.buffer),l=b.buffer,D.vertexAttribPointer(y,b.itemSize,_,b.normalized,0,S*b.itemSize*E)),D.vertexAttribDivisor(y,i.numInstances&&b.divisor||0)}}return!0}(e,t,i,n)}function ot(e,t){var i=$[e];return i||(i=D.createBuffer(),$[e]=i),D.bindBuffer(D.ARRAY_BUFFER,i),D.bufferData(D.ARRAY_BUFFER,t,D.DYNAMIC_DRAW),i}function st(e,t,i,n,r,o,s){var a,l=t.attributes,h=t.attributesKeys,u=0;if(r)if(!r.buffer&&i.streamingDraw){var d=$.index;d||(d=D.createBuffer(),$.index=d),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,d),e.isEdgeMaterial?D.bufferData(D.ELEMENT_ARRAY_BUFFER,i.iblines,D.DYNAMIC_DRAW):D.bufferData(D.ELEMENT_ARRAY_BUFFER,r.array||i.ib,D.DYNAMIC_DRAW)}else{var f,p,m;if(c.USE_BUFFER_MANAGER)if(e.isEdgeMaterial)D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,i.iblinesbuffer.getGlBuffer());else D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,(null===(f=r.buffer)||void 0===f||null===(p=f.getGlBuffer)||void 0===p?void 0:p.call(f))||r.buffer||(null===(m=i.ibbuffer)||void 0===m?void 0:m.getGlBuffer()));else e.isEdgeMaterial?D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,i.iblinesbuffer):D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,r.buffer||i.ibbuffer)}for(var g=0,v=h.length;g<v;g++){var y=h[g],b=l[y];if(b>=0){var x=i.attributes[y];"uv"===y&&o&&(x=i.attributes["uv"+(o+1)]);var _=n;if(x){var E=D.FLOAT,S=x.bytesPerItem||4;1===S?E=D.UNSIGNED_BYTE:2===S&&(E=D.UNSIGNED_SHORT);var A,w,T=void 0!==x.itemOffset;T&&(S=4),T?(A=i.vbstride,w=x.itemOffset,u!==a&&(i.streamingDraw?u=ot("interleavedVB",i.vb):(u=i.vbbuffer.getGlBuffer?i.vbbuffer.getGlBuffer():i.vbbuffer,D.bindBuffer(D.ARRAY_BUFFER,u)),a=u)):(A=x.itemSize,w=0,i.streamingDraw?u=ot(y,x.array):x.buffer.getGlBuffer?(u=x.buffer.getGlBuffer(),D.bindBuffer(D.ARRAY_BUFFER,u),_+=x.buffer.offset/(A*S)):(u=x.buffer,D.bindBuffer(D.ARRAY_BUFFER,u))),ce.enableAttribute(b),T&&i.vbbuffer&&i.vbbuffer.getGlBuffer&&i.vbbuffer.getGlBuffer()===u&&(_+=i.vbbuffer.offset/(A*S)),x.divisor&&(_+=s),D.vertexAttribPointer(b,x.itemSize,E,x.normalized,A*S,(w+_*A)*S),D.vertexAttribDivisor(b,i.numInstances&&x.divisor||0)}else if(e.defaultAttributeValues){var M=e.defaultAttributeValues[y];M&&2===M.length?D.vertexAttrib2fv(b,e.defaultAttributeValues[y]):M&&3===M.length?D.vertexAttrib3fv(b,e.defaultAttributeValues[y]):M&&4===M.length&&D.vertexAttrib4fv(b,e.defaultAttributeValues[y])}}}ce.disableUnusedAttributes()}function at(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function lt(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?t.z-e.z:e.id-t.id}function ct(e){ut(e,!0)}function ht(e){ut(e,!1)}function ut(e,t,i){var n,r;if(i||!1!==e.visible){if(e instanceof l.Scene||e instanceof l.Group);else if(e instanceof s.RenderBatch)e.forEach(t?ct:ht);else if(function(e){O.lostContextRecovery&&O.lostContextRecovery.refreshIfNeeded(e),void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("removed",Ne));var t=e.geometry;void 0===t||void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",Fe),t instanceof l.BufferGeometry||(e instanceof l.Mesh?_t(e,t):e instanceof l.Line?void 0===t.__webglVertexBuffer&&(!function(e){e.__webglVertexBuffer=D.createBuffer(),e.__webglColorBuffer=D.createBuffer(),e.__webglLineDistanceBuffer=D.createBuffer(),O.info.memory.geometries++}(t),function(e,t){var i=e.vertices.length;e.__vertexArray=new Float32Array(3*i),e.__colorArray=new Float32Array(3*i),e.__lineDistanceArray=new Float32Array(1*i),e.__webglLineCount=i,Ke(e,t)}(t,e),t.verticesNeedUpdate=!0,t.colorsNeedUpdate=!0,t.lineDistancesNeedUpdate=!0):e instanceof l.PointCloud&&void 0===t.__webglVertexBuffer&&(!function(e){e.__webglVertexBuffer=D.createBuffer(),e.__webglColorBuffer=D.createBuffer(),O.info.memory.geometries++}(t),function(e,t){var i=e.vertices.length;e.__vertexArray=new Float32Array(3*i),e.__colorArray=new Float32Array(3*i),e.__webglPointCount=i,Ke(e,t)}(t,e),t.verticesNeedUpdate=!0,t.colorsNeedUpdate=!0)));if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof l.Mesh){if(t instanceof l.BufferGeometry)Et(w,t,e);else if(t instanceof l.Geometry)for(var i=bt[t.id],n=0,r=i.length;n<r;n++)Et(w,i[n],e)}else(e instanceof l.Line||e instanceof l.PointCloud)&&Et(w,t,e)}(e),e instanceof l.Light)A.push(e);else{var o=w[e.id];if(o&&(!1===e.frustumCulled||!0===J.intersectsObject(e)))for(n=0,r=o.length;n<r;n++){var a=o[n];yt(a),a.render=!0,!0===t&&(ie.setFromMatrixPosition(e.matrixWorld),ie.applyProjection(ee),a.z=ie.z)}}if(e.children)for(n=0,r=e.children.length;n<r;n++)ut(e.children[n],t,i)}}function dt(e,t){if(!t.getCustomOverrideMaterial)return t;var i=t.getCustomOverrideMaterial(e);return i||t}function ft(e,t,i,n,r){for(var o,s=0,a=e.length;s<a;s++){var c=e[s],h=c.object,u=c.buffer;if(r)o=dt(c.material,r);else{if(!(o=c.material))continue;Mt(o)}if(o.twoPassTransparency){var d=o.side;o.side=l.BackSide,pt(o,t,i,n,u,r,h),o.side=l.FrontSide,pt(o,t,i,n,u,r,h),o.side=d}else pt(o,t,i,n,u,r,h)}}function pt(e,t,i,n,r,o,s){if(O.setMaterialFaces(e),r instanceof l.BufferGeometry?O.renderBufferDirect(t,i,n,e,r,s):O.renderBuffer(t,i,n,e,r,s),e.decals)for(var a=e.decals,c=0,h=a.length;c<h;c++){var u=a[c];Mt(e=u.material),O.setMaterialFaces(e),r instanceof l.BufferGeometry&&O.renderBufferDirect(t,i,n,e,r,s,u.uv)}}function mt(e,t){if(e.visible&&!e.hide){var i;if(je)i=dt(e.material,je);else{if(!(i=e.material))return;Mt(i)}if(i.twoPassTransparency){var n=i.side;i.side=l.BackSide,gt(e,i),i.side=l.FrontSide,gt(e,i),i.side=n}else gt(e,i)}}function gt(e,t){if(O.setMaterialFaces(t),O.renderBufferDirect(ze,He,We,t,e.geometry,e),t.decals)for(var i=t.decals,n=0,r=i.length;n<r;n++){var o=i[n];Mt(t=o.material),O.setMaterialFaces(t),O.renderBufferDirect(ze,He,We,t,e.geometry,e,o.uv)}}function vt(e,t,i,n,r,o){He=n,We=r,je=o||null,ze=i,e.forEach(mt,e.forceVisible?1:32,!1)}function yt(e){var t=e.object,i=e.buffer,n=t.geometry,r=t.material;if(r instanceof l.MeshFaceMaterial){var o=n instanceof l.BufferGeometry?0:i.materialIndex;r=r.materials[o],e.material=r,r.transparent?P.push(e):C.push(e)}else r&&(e.material=r,r.transparent?P.push(e):C.push(e))}this.renderBufferDirect=function(e,t,i,n,r,o,s){var a;if(O.lostContextRecovery&&O.lostContextRecovery.refreshIfNeeded(r),!1!==n.visible&&(!n.isEdgeMaterial||r.iblines||r.iblinesbuffer)){R(o.geometry);var h=Ct(e,t,i,n,o),u=!1,d=n.wireframe?1:0,f="direct_"+r.id+(s?"/"+s:"")+"_"+h.id+"_"+d;f!==z&&(z=f,u=!0);var p,m=null===(a=r.groups)||void 0===a?void 0:a.length,g=m&&r.groups.some((function(e){return e.index>=0||e.instanceStart>=0}));g?u=!0:(p=rt(n,h,r,s||0),u=u&&!p),u&&ce.initAttributes();var v,y=r.index;if(y){var b,x=r.ibByteSize,_=y.array?y.array:r.ib;let e=r.ibLength;_&&(y.bytesPerItem=_.BYTES_PER_ELEMENT),n.isEdgeMaterial&&(y=r.attributes.indexlines,_=r.iblines,e=r.iblinesLength,x=r.iblinesByteSize),y.bytesPerItem?x=y.bytesPerItem:_&&(x=_ instanceof Uint32Array?4:_ instanceof Uint16Array?2:1),4===x?b=D.UNSIGNED_INT:2===x?b=D.UNSIGNED_SHORT:1===x&&(b=D.UNSIGNED_BYTE);var E=r.groups;m&&n.isEdgeMaterial&&!Object.prototype.hasOwnProperty.call(E[0],"edgeStart")&&(E=null);var S=0;do{var A,w,T,M,C;if(m){var P,L=E[S];A=L.index,w=n.isEdgeMaterial?L.edgeStart||0:L.start,T=n.isEdgeMaterial?L.edgeCount||(null===(P=_)||void 0===P?void 0:P.length)||e:L.count,M=L.instanceStart||0,C=L.numInstances||r.numInstances;var I=n.program.uniforms;if(I.themingColor&&"themingColor"in L){var N=L.themingColor;N instanceof l.Vector4?D.uniform4f(I.themingColor,N.x,N.y,N.z,N.w):D.uniform4f(I.themingColor,0,0,0,0)}}else{var F;A=0,w=0,T=(null===(F=_)||void 0===F?void 0:F.length)||e,M=0,C=r.numInstances}c.USE_BUFFER_MANAGER&&(n.isEdgeMaterial?w+=r.iblinesbuffer&&!r.streamingDraw?r.iblinesbuffer.offset/x:0:r.index.buffer?w+=r.streamingDraw?0:r.index.buffer.offset/x:w+=r.ibbuffer&&!r.streamingDraw?r.ibbuffer.offset/x:0),u&&(st(n,h,r,A,y,s,M),g||(u=!1)),v=D.TRIANGLES,r.isPoints||o instanceof l.PointCloud?v=D.POINTS:(r.isLines||n.isEdgeMaterial||o instanceof l.Line)&&(v=D.LINES),C?D.drawElementsInstanced(v,T,b,w*x,C):D.drawElements(v,T,b,w*x),++this.info.render.calls}while(E&&++S<E.length)}else{var U;(null===(U=r.groups)||void 0===U?void 0:U.length)>1&&console.error("Geometry with draw calls and no index buffer"),u&&st(n,h,r,0,void 0,s,0);var B=r.attributes.position;v=D.TRIANGLES,r.isPoints||o instanceof l.PointCloud?v=D.POINTS:(r.isLines||n.isEdgeMaterial||o instanceof l.Line)&&(v=D.LINES),r.numInstances?D.drawArraysInstanced(v,0,B.array.length/3,r.numInstances):D.drawArrays(v,0,B.array.length/B.itemSize),++this.info.render.calls}p&&D.bindVertexArray(null)}},this.renderBuffer=function(e,t,i,n,r,o){if(!1!==n.visible&&!n.isEdgeMaterial){!function(e){var t,i,n=e.geometry;if(n instanceof l.BufferGeometry)R(n);else if(e instanceof l.Mesh){!0===n.groupsNeedUpdate&&_t(e,n);for(var r=bt[n.id],o=0,s=r.length;o<s;o++){var a=r[o];t=(i=Ze(e,a)).attributes&&St(i),(n.verticesNeedUpdate||n.morphTargetsNeedUpdate||n.elementsNeedUpdate||n.uvsNeedUpdate||n.normalsNeedUpdate||n.colorsNeedUpdate||n.tangentsNeedUpdate||t)&&nt(a,e,D.DYNAMIC_DRAW,!n.dynamic,i)}n.verticesNeedUpdate=!1,n.morphTargetsNeedUpdate=!1,n.elementsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.tangentsNeedUpdate=!1,i.attributes&&At(i)}else e instanceof l.Line?(t=(i=Ze(e,n)).attributes&&St(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||n.lineDistancesNeedUpdate||t)&&function(e,t){var i,n,r,o,s,a,l,c,h,u,d,f,p=e.vertices,m=e.colors,g=e.lineDistances,v=p.length,y=m.length,b=g.length,x=e.__vertexArray,_=e.__colorArray,E=e.__lineDistanceArray,S=e.verticesNeedUpdate,A=e.colorsNeedUpdate,w=e.lineDistancesNeedUpdate,T=e.__webglCustomAttributesList;if(S){for(i=0;i<v;i++)o=p[i],x[s=3*i]=o.x,x[s+1]=o.y,x[s+2]=o.z;D.bindBuffer(D.ARRAY_BUFFER,e.__webglVertexBuffer),D.bufferData(D.ARRAY_BUFFER,x,t)}if(A){for(n=0;n<y;n++)a=m[n],_[s=3*n]=a.r,_[s+1]=a.g,_[s+2]=a.b;D.bindBuffer(D.ARRAY_BUFFER,e.__webglColorBuffer),D.bufferData(D.ARRAY_BUFFER,_,t)}if(w){for(r=0;r<b;r++)E[r]=g[r];D.bindBuffer(D.ARRAY_BUFFER,e.__webglLineDistanceBuffer),D.bufferData(D.ARRAY_BUFFER,E,t)}if(T)for(l=0,c=T.length;l<c;l++)if(tt(f=T[l])&&(void 0===f.boundTo||"vertices"===f.boundTo)){if(s=0,u=f.value.length,1===f.size)for(h=0;h<u;h++)f.array[h]=f.value[h];else if(2===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,s+=2;else if(3===f.size)if("c"===f.type)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.r,f.array[s+1]=d.g,f.array[s+2]=d.b,s+=3;else for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,s+=3;else if(4===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,f.array[s+3]=d.w,s+=4;D.bindBuffer(D.ARRAY_BUFFER,f.buffer),D.bufferData(D.ARRAY_BUFFER,f.array,t)}}(n,D.DYNAMIC_DRAW),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,n.lineDistancesNeedUpdate=!1,i.attributes&&At(i)):e instanceof l.PointCloud&&(t=(i=Ze(e,n)).attributes&&St(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||t)&&function(e,t){var i,n,r,o,s,a,l,c,h,u,d,f=e.vertices,p=e.colors,m=f.length,g=p.length,v=e.__vertexArray,y=e.__colorArray,b=e.verticesNeedUpdate,x=e.colorsNeedUpdate,_=e.__webglCustomAttributesList;if(b){for(i=0;i<m;i++)r=f[i],v[o=3*i]=r.x,v[o+1]=r.y,v[o+2]=r.z;D.bindBuffer(D.ARRAY_BUFFER,e.__webglVertexBuffer),D.bufferData(D.ARRAY_BUFFER,v,t)}if(x){for(n=0;n<g;n++)s=p[n],y[o=3*n]=s.r,y[o+1]=s.g,y[o+2]=s.b;D.bindBuffer(D.ARRAY_BUFFER,e.__webglColorBuffer),D.bufferData(D.ARRAY_BUFFER,y,t)}if(_)for(a=0,l=_.length;a<l;a++)if(tt(d=_[a])&&(void 0===d.boundTo||"vertices"===d.boundTo)){if(o=0,h=d.value.length,1===d.size)for(c=0;c<h;c++)d.array[c]=d.value[c];else if(2===d.size)for(c=0;c<h;c++)u=d.value[c],d.array[o]=u.x,d.array[o+1]=u.y,o+=2;else if(3===d.size)if("c"===d.type)for(c=0;c<h;c++)u=d.value[c],d.array[o]=u.r,d.array[o+1]=u.g,d.array[o+2]=u.b,o+=3;else for(c=0;c<h;c++)u=d.value[c],d.array[o]=u.x,d.array[o+1]=u.y,d.array[o+2]=u.z,o+=3;else if(4===d.size)for(c=0;c<h;c++)u=d.value[c],d.array[o]=u.x,d.array[o+1]=u.y,d.array[o+2]=u.z,d.array[o+3]=u.w,o+=4;D.bindBuffer(D.ARRAY_BUFFER,d.buffer),D.bufferData(D.ARRAY_BUFFER,d.array,t)}}(n,D.DYNAMIC_DRAW),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,i.attributes&&At(i))}(o);var s=Ct(e,t,i,n,o),a=s.attributes,c=!1,h=n.wireframe?1:0,u=r.id+"_"+s.id+"_"+h;if(u!==z&&(z=u,c=!0),c&&ce.initAttributes(),!n.morphTargets&&a.position>=0&&c&&(D.bindBuffer(D.ARRAY_BUFFER,r.__webglVertexBuffer),ce.enableAttribute(a.position),v(a.position,3,D.FLOAT,!1,0,0)),c){if(r.__webglCustomAttributesList)for(var d=0,f=r.__webglCustomAttributesList.length;d<f;d++){var p=r.__webglCustomAttributesList[d];a[p.buffer.belongsToAttribute]>=0&&(D.bindBuffer(D.ARRAY_BUFFER,p.buffer),ce.enableAttribute(a[p.buffer.belongsToAttribute]),v(a[p.buffer.belongsToAttribute],p.size,D.FLOAT,!1,0,0))}a.color>=0&&(o.geometry.colors.length>0||o.geometry.faces.length>0?(D.bindBuffer(D.ARRAY_BUFFER,r.__webglColorBuffer),ce.enableAttribute(a.color),v(a.color,3,D.FLOAT,!1,0,0)):n.defaultAttributeValues&&D.vertexAttrib3fv(a.color,n.defaultAttributeValues.color)),a.normal>=0&&(D.bindBuffer(D.ARRAY_BUFFER,r.__webglNormalBuffer),ce.enableAttribute(a.normal),v(a.normal,3,D.FLOAT,!1,0,0)),a.tangent>=0&&(D.bindBuffer(D.ARRAY_BUFFER,r.__webglTangentBuffer),ce.enableAttribute(a.tangent),v(a.tangent,4,D.FLOAT,!1,0,0)),a.uv>=0&&(o.geometry.faceVertexUvs[0]?(D.bindBuffer(D.ARRAY_BUFFER,r.__webglUVBuffer),ce.enableAttribute(a.uv),v(a.uv,2,D.FLOAT,!1,0,0)):n.defaultAttributeValues&&D.vertexAttrib2fv(a.uv,n.defaultAttributeValues.uv)),a.uv2>=0&&(o.geometry.faceVertexUvs[1]?(D.bindBuffer(D.ARRAY_BUFFER,r.__webglUV2Buffer),ce.enableAttribute(a.uv2),v(a.uv2,2,D.FLOAT,!1,0,0)):n.defaultAttributeValues&&D.vertexAttrib2fv(a.uv2,n.defaultAttributeValues.uv2)),a.lineDistance>=0&&(D.bindBuffer(D.ARRAY_BUFFER,r.__webglLineDistanceBuffer),ce.enableAttribute(a.lineDistance),v(a.lineDistance,1,D.FLOAT,!1,0,0))}if(ce.disableUnusedAttributes(),o instanceof l.Mesh){var m=r.__typeArray===Uint32Array?D.UNSIGNED_INT:D.UNSIGNED_SHORT;n.wireframe?(le.setLineWidth(n.wireframeLinewidth*this.getPixelRatio()),c&&D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer),D.drawElements(D.LINES,r.__webglLineCount,m,0)):(c&&D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer),D.drawElements(D.TRIANGLES,r.__webglFaceCount,m,0)),++this.info.render.calls}else if(o instanceof l.Line){var g=o.mode===l.LineStrip?D.LINE_STRIP:D.LINES;le.setLineWidth(n.linewidth*this.getPixelRatio()),D.drawArrays(g,0,r.__webglLineCount),++this.info.render.calls}else o instanceof l.PointCloud&&(D.drawArrays(D.POINTS,0,r.__webglPointCount),++this.info.render.calls)}function v(e,t,i,n,r,o){D.vertexAttribPointer(e,t,i,n,r,o),D.vertexAttribDivisor(e,0)}},this.render=function(e,t,i,n){var r,o,a;let c,h=i,u=n;if(arguments.length>2&&(i instanceof l.WebGLRenderTarget||Array.isArray(i))&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),c=i,h=n,u=arguments[4]),t instanceof l.Camera!=!1){if(!D.isContextLost()){z="",V=-1,G=null,q.clear(),void 0!==u&&(A.length=0,re=!0);var d=e.fog;!0===e.autoUpdate&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),t.worldUpTransform?te.multiplyMatrices(t.worldUpTransform,t.matrixWorld):te.copy(t.matrixWorld),ee.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),J.setFromProjectionMatrix(ee);var f=e instanceof s.RenderBatch&&e.renderImmediate;if(f||(C.length=0,P.length=0,ut(e,!0===O.sortObjects,!0===e.forceVisible),!0===O.sortObjects&&(C.sort(lt),P.sort(at))),re&&(u&&u.length&&(A=u.slice()),Nt(A)),void 0!==c&&this.setRenderTarget(c),this.resetGLState(),(this.autoClear||h)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){let i=e.overrideMaterial;Mt(i),f?vt(e,"",t,A,d,i):(ft(C,t,A,d,i),ft(P,t,A,d,i))}else f?vt(e,"",t,A,d,null):(le.setBlending(l.NoBlending),ft(C,t,A,d,null),ft(P,t,A,d,null));if(e.edgeMaterial){D.depthFunc(D.LESS);let i=e.edgeMaterial;Mt(i),f?vt(e,"",t,A,d,i):(ft(C,t,A,d,i),ft(P,t,A,d,i)),D.depthFunc(D.LEQUAL)}!k&&null!==(r=B)&&void 0!==r&&null!==(r=r.texture)&&void 0!==r&&r.generateMipmaps&&(null===(o=B)||void 0===o?void 0:o.texture.minFilter)!==l.NearestFilter&&(null===(a=B)||void 0===a?void 0:a.texture.minFilter)!==l.LinearFilter&&function(e){D.bindTexture(D.TEXTURE_2D,e.__webglTexture),D.generateMipmap(D.TEXTURE_2D),D.bindTexture(D.TEXTURE_2D,null)}(B),this.resetGLState(),le.setDepthTest(!0),le.setDepthWrite(!0)}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setProgramPrefix=function(e,t,i){H=e,W=t,j=i},this.getProgramPrefix=function(){return{programPrefix:H,vertexPrefix:W,fragmentPrefix:j}};var bt={},xt=0;function _t(e,t){var i=e.material,n=!1;void 0!==bt[t.id]&&!0!==t.groupsNeedUpdate||(delete w[e.id],bt[t.id]=function(e,t){for(var i,n,r={},o=e.morphTargets?e.morphTargets.length:0,s=e.morphNormals?e.morphNormals.length:0,a={},l=[],c=0,h=e.faces.length;c<h;c++){var u=e.faces[c],d=t?u.materialIndex:0;d in r||(r[d]={hash:d,counter:0}),(i=r[d].hash+"_"+r[d].counter)in a||(n={id:xt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},a[i]=n,l.push(n)),a[i].vertices+3>4294967296&&(r[d].counter+=1,(i=r[d].hash+"_"+r[d].counter)in a||(n={id:xt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},a[i]=n,l.push(n))),a[i].faces3.push(c),a[i].vertices+=3}return l}(t,i instanceof l.MeshFaceMaterial),t.groupsNeedUpdate=!1);for(var r=bt[t.id],o=0,s=r.length;o<s;o++){var a=r[o];void 0===a.__webglVertexBuffer?(Oe(a),Qe(a,e),t.verticesNeedUpdate=!0,t.morphTargetsNeedUpdate=!0,t.elementsNeedUpdate=!0,t.uvsNeedUpdate=!0,t.normalsNeedUpdate=!0,t.tangentsNeedUpdate=!0,t.colorsNeedUpdate=!0,n=!0):n=!1,(n||void 0===e.__webglActive)&&Et(w,a,e)}e.__webglActive=!0}function Et(e,t,i){var n=i.id;e[n]=e[n]||[],e[n].push({id:n,buffer:t,object:i,material:null,z:0})}function St(e){for(var t in e.attributes)if(tt(e.attributes[t]))return!0;return!1}function At(e){for(var t in e.attributes)it(e.attributes[t])}var wt={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshLambertMaterial:"lambert",LineDashedMaterial:"dashed",MeshBasicMaterial:"firefly_basic",LineBasicMaterial:"firefly_basic",PointCloudMaterial:"firefly_basic",PointsMaterial:"firefly_basic",MeshPhongMaterial:"firefly_phong"};function Tt(e,t,i,r){e.addEventListener("dispose",ke);var o=wt[e.type];if(o){var s=l.ShaderLib[o];let t=l.UniformsUtils.clone(s.uniforms);e.uniforms&&(t=l.UniformsUtils.merge([t,e.uniforms])),e.__webglShader={uniforms:t,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}}else e.__webglShader={uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};var c,u,d=function(e){for(var t=0,i=0,n=0,r=0,o=0,s=e.length;o<s;o++){var a=e[o];a.onlyShadow||(a instanceof l.DirectionalLight&&t++,a instanceof l.PointLight&&i++,a instanceof l.SpotLight&&n++,a instanceof l.HemisphereLight&&r++)}return{directional:t,point:i,spot:n,hemi:r}}(t),f={vertexShader:e.__webglShader.vertexShader,fragmentShader:e.__webglShader.fragmentShader,precision:a,precisionFragment:h,supportsVertexTextures:be,loadingAnimationDuration:O.loadingAnimationDuration,map:!!e.map,envMap:!!e.envMap,irradianceMap:!!e.irradianceMap,envIsSpherical:e.envMap&&e.envMap.mapping==l.SphericalReflectionMapping,envGammaEncoded:e.envMap&&e.envMap.GammaEncoded,irrGammaEncoded:e.irradianceMap&&e.irradianceMap.GammaEncoded,envRGBM:e.envMap&&e.envMap.RGBM,irrRGBM:e.irradianceMap&&e.irradianceMap.RGBM,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,vertexColors:e.vertexColors,vertexIds:e.vertexIds,useInstancing:e.useInstancing,wideLines:e.wideLines,fog:i,useFog:e.fog,useBackgroundTexture:e.useBackgroundTexture,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:_,polygonOffset:e.polygonOffset,maxDirLights:d.directional,maxPointLights:d.point,maxSpotLights:d.spot,maxHemiLights:d.hemi,alphaTest:e.alphaTest,metal:e.metal,clearcoat:e.clearcoat,wrapAround:e.wrapAround,doubleSided:e.side===l.DoubleSide,flipSided:e.side===l.BackSide,mrtNormals:e.mrtNormals,mrtIdBuffer:e.mrtIdBuffer,vertexPrefix:W,fragmentPrefix:j,tonemapOutput:e.tonemapOutput,packedNormals:e.packedNormals,hatchPattern:!!e.hatchParams,useTheming:!e.disableTheming,numCutplanes:e.cutplanes?e.cutplanes.length:0,useTiling:e.useTiling,tilingRepeatRange:e.useTiling&&e.tilingRepeatRange,hasRoundCorner:e.hasRoundCorner,useRandomOffset:e.useRandomOffset,mapInvert:e.map&&e.map.invert,mapClampS:e.map&&e.map.clampS,mapClampT:e.map&&e.map.clampT,bumpMapClampS:e.bumpMap&&e.bumpMap.clampS,bumpMapClampT:e.bumpMap&&e.bumpMap.clampT,normalMapClampS:e.normalMap&&e.normalMap.clampS,normalMapClampT:e.normalMap&&e.normalMap.clampT,specularMapClampS:e.specularMap&&e.specularMap.clampS,specularMapClampT:e.specularMap&&e.specularMap.clampT,alphaMapInvert:e.alphaMap&&e.alphaMap.invert,alphaMapClampS:e.alphaMap&&e.alphaMap.clampS,alphaMapClampT:e.alphaMap&&e.alphaMap.clampT},p=[];for(var m in o?p.push(o):(p.push(e.fragmentShader),p.push(e.vertexShader)),e.defines)p.push(m),p.push(e.defines[m]);for(c in f)p.push(c),p.push(f[c]);var g,v=p.join();for(c=0,u=N.length;c<u;c++){var y=N[c];if(y.code===v){(g=y).usedTimes++;break}}for(var b in void 0===g&&(e.onBeforeCompile(f,O),g=new n.WebGLProgram(O,v,e,f,r.geometry),N.push(g),O.info.memory.programs=N.length),e.programs||(e.programs=[]),e.programs[H]=g,e.uniformsLists||(e.uniformsLists=[]),e.uniformsList=e.uniformsLists[H]=[],e.__webglShader.uniforms){var x=g.uniforms[b];x&&e.uniformsList.push([e.__webglShader.uniforms[b],x])}}function Mt(e){!0===e.transparent?le.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):le.setBlending(l.NoBlending),le.setDepthTest(e.depthTest),le.setDepthWrite(e.depthWrite),le.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function Ct(e,i,n,o,s){X=0,O.lostContextRecovery&&O.lostContextRecovery.refreshIfNeeded(o),tt(o)?(o.program&&Ye(o),Tt(o,i,n,s),it(o)):o.programs&&o.programs[H]||Tt(o,i,n,s);var a=!1,c=!1,h=!1;o.uniformsList=o.uniformsLists[H];var u,d=o.program=o.programs[H],f=d.uniforms,p=o.__webglShader.uniforms;if(d.id!==F&&(D.useProgram(d.program),F=d.id,a=!0,c=!0,h=!0),o.id!==V&&(-1===V&&(h=!0),V=o.id,c=!0),f.meshAnimTime){var m=1;s.geometry.creationTime&&O.loadingAnimationDuration>0&&(m=Math.min((O.highResTimeStamp-s.geometry.creationTime)/O.loadingAnimationDuration,1)),D.uniform1f(f.meshAnimTime,m)}if((a||e!==G)&&(D.uniformMatrix4fv(f.projectionMatrix,!1,e.projectionMatrix.elements),_&&(D.uniform1f(f.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),o.polygonOffset&&D.uniform2f(f.polygonOffset,o.polygonOffsetFactor,o.polygonOffsetUnits)),e!==G&&(G=e),(o instanceof l.ShaderMaterial||o instanceof l.MeshPhongMaterial||o.envMap)&&null!==f.cameraPosition&&(ie.setFromMatrixPosition(e.matrixWorld),D.uniform3f(f.cameraPosition,ie.x,ie.y,ie.z)),(o instanceof l.MeshPhongMaterial||o instanceof l.MeshLambertMaterial||o instanceof l.ShaderMaterial||o.skinning)&&(null!==f.viewMatrix&&D.uniformMatrix4fv(f.viewMatrix,!1,e.matrixWorldInverse.elements),null!==f.viewMatrixInverse&&D.uniformMatrix4fv(f.viewMatrixInverse,!1,te.elements),f.mvpMatrix&&D.uniformMatrix4fv(f.mvpMatrix,!1,ee.elements),h?(Dt(p,o),Lt(p,!0)):Lt(p,!1))),f.unpackXform){var g=s.geometry,v=g.unpackXform;if(v?D.uniform4f(f.unpackXform,v.x,v.y,v.z,v.w):D.uniform4f(f.unpackXform,1,1,0,0),f.tIdColor){D.uniform2f(f.vIdColorTexSize,g.vIdColorTexSize.x,g.vIdColorTexSize.y);var y=Rt();D.uniform1i(f.tIdColor,y),O.setTexture(g.tIdColor,y)}}if(c){if((o instanceof l.MeshPhongMaterial||o instanceof l.MeshLambertMaterial||o.lights)&&(re&&(h=!0,Nt(i),re=!1),h?(!function(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}(p,oe),It(p,!0)):It(p,!1)),(o instanceof l.MeshBasicMaterial||o instanceof l.MeshLambertMaterial||o instanceof l.MeshPhongMaterial)&&(!function(e,t){e.opacity.value=t.opacity,e.diffuse.value.copy(t.color),e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));function i(e,t,i,n){const{x:r,y:o}=i,{x:s,y:a}=t,l=r*Math.cos(n),c=r*Math.sin(n),h=o*Math.cos(n),u=o*Math.sin(n),d=e.elements,f=d[0],p=d[3],m=d[6],g=d[1],v=d[4],y=d[7],b=d[2],x=d[5],_=d[8];d[0]=f*l+g*c+b*s,d[3]=p*l+v*c+x*s,d[6]=m*l+y*c+_*s,d[1]=f*-u+g*h+b*a,d[4]=p*-u+v*h+x*a,d[7]=m*-u+y*h+_*a}function n(e,t,n){const{offset:r,repeat:o,rotation:s}=n;if(t){var a=t.value;n.matrix?a.copy(n.matrix):a.identity(),i(a,r,o,s??0)}else e.offsetRepeat.value.set(r.x,r.y,o.x,o.y)}t.alphaMap&&n(e,e.texMatrixAlpha,t.alphaMap);var r,o;t.normalMap?r=t.normalMap:t.bumpMap&&(r=t.bumpMap);void 0!==r&&n(e,e.texMatrixBump,r);t.map?o=t.map:t.specularMap&&(o=t.specularMap);void 0!==o&&n(e,e.texMatrix,o);e.envMap.value=t.envMap,e.irradianceMap&&(e.irradianceMap.value=t.irradianceMap);e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(p,o),Dt(p,o)),o instanceof l.PointCloudMaterial||o instanceof l.PointsMaterial?function(e,t){Pt(e,t),e.point_size.value=t.size,e.map.value=t.map}(p,o):o instanceof l.LineBasicMaterial?Pt(p,o):o instanceof l.LineDashedMaterial?(Pt(p,o),function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(p,o)):o instanceof l.MeshPhongMaterial?function(e,t){if(e.shininess.value=t.shininess,e.reflMipIndex){var i=Math.log(Math.max(1+1e-10,t.shininess));e.reflMipIndex.value=Math.max(0,-.72134752*i+5.5)}e.emissive&&e.emissive.value.copy(t.emissive);e.specular.value.copy(t.specular),e.exposureBias&&(e.exposureBias.value=t.exposureBias)}(p,o):o instanceof l.MeshLambertMaterial?function(e,t){e.emissive.value.copy(t.emissive),t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}(p,o):o instanceof l.MeshDepthMaterial?(p.mNear.value=e.near,p.mFar.value=e.far,p.opacity.value=o.opacity):o instanceof l.MeshNormalMaterial?p.opacity.value=o.opacity:"function"==typeof o.refreshUniforms&&o.refreshUniforms(p),o.wideLines){var b=s.geometry.lineWidth;void 0!==o.linewidth&&(b=o.linewidth);const e=1/Math.max(Number.EPSILON,b);p.view_size.value=new l.Vector2(t.width*e,t.height*e)}r.ShadowRender&&o.shadowMap&&r.ShadowRender.RefreshUniformsShadow(p,o);var x=p.cutplanes;o.cutplanes&&o.cutplanes.length>0&&x&&(x.value=o.cutplanes,null!=p&&p.cutplanesHideInterior&&(p.cutplanesHideInterior.value=o.cutplanesHideInterior),x._array&&x._array.length!=4*o.cutplanes&&(x._array=void 0)),o.hatchParams&&p.hatchParams&&(p.hatchParams.value.copy(o.hatchParams),p.hatchTintColor.value.copy(o.hatchTintColor),p.hatchTintIntensity.value=o.hatchTintIntensity),function(e){for(var t,i,n,r=0,o=e.length;r<o;r++){var s=e[r][0];if(!1!==s.needsUpdate&&!s.perObject){var a,c,h=s.type,u=s.value,d=e[r][1];switch(h){case"1i":case"i":D.uniform1i(d,u);break;case"1f":case"f":D.uniform1f(d,u);break;case"2f":D.uniform2f(d,u[0],u[1]);break;case"3f":D.uniform3f(d,u[0],u[1],u[2]);break;case"4f":D.uniform4f(d,u[0],u[1],u[2],u[3]);break;case"1iv":case"iv1":D.uniform1iv(d,u);break;case"3iv":case"iv":D.uniform3iv(d,u);break;case"1fv":case"fv1":D.uniform1fv(d,u);break;case"2fv":D.uniform2fv(d,u);break;case"3fv":case"fv":D.uniform3fv(d,u);break;case"4fv":D.uniform4fv(d,u);break;case"Matrix3fv":D.uniformMatrix3fv(d,!1,u);break;case"Matrix4fv":D.uniformMatrix4fv(d,!1,u);break;case"v2":D.uniform2f(d,u.x,u.y);break;case"v3":D.uniform3f(d,u.x,u.y,u.z);break;case"v4":D.uniform4f(d,u.x,u.y,u.z,u.w);break;case"c":D.uniform3f(d,u.r,u.g,u.b);break;case"v2v":for(void 0===s._array&&(s._array=new Float32Array(2*u.length)),a=0,c=u.length;a<c;a++)n=2*a,s._array[n]=u[a].x,s._array[n+1]=u[a].y;D.uniform2fv(d,s._array);break;case"v3v":for(void 0===s._array&&(s._array=new Float32Array(3*u.length)),a=0,c=u.length;a<c;a++)n=3*a,s._array[n]=u[a].x,s._array[n+1]=u[a].y,s._array[n+2]=u[a].z;D.uniform3fv(d,s._array);break;case"v4v":for(void 0===s._array&&(s._array=new Float32Array(4*u.length)),a=0,c=u.length;a<c;a++)n=4*a,s._array[n]=u[a].x,s._array[n+1]=u[a].y,s._array[n+2]=u[a].z,s._array[n+3]=u[a].w;D.uniform4fv(d,s._array);break;case"m3":D.uniformMatrix3fv(d,!1,u.elements);break;case"m3v":for(void 0===s._array&&(s._array=new Float32Array(9*u.length)),a=0,c=u.length;a<c;a++)u[a].flattenToArrayOffset(s._array,9*a);D.uniformMatrix3fv(d,!1,s._array);break;case"m4":D.uniformMatrix4fv(d,!1,u.elements);break;case"m4v":for(void 0===s._array&&(s._array=new Float32Array(16*u.length)),a=0,c=u.length;a<c;a++)u[a].flattenToArrayOffset(s._array,16*a);D.uniformMatrix4fv(d,!1,s._array);break;case"t":if(t=u,i=Rt(),D.uniform1i(d,i),!t){D.activeTexture(D.TEXTURE0+i),D.bindTexture(D.TEXTURE_2D,pe.__webglTexture);continue}O.lostContextRecovery&&O.lostContextRecovery.refreshIfNeeded(t),Array.isArray(t.image)&&6===t.image.length||t instanceof l.CubeTexture?tt(t)?Bt(t,i):(D.activeTexture(D.TEXTURE0+i),D.bindTexture(D.TEXTURE_CUBE_MAP,t.__webglTextureCube)):t instanceof l.WebGLRenderTargetCube?kt(t,i):O.setTexture(t,i);break;case"tv":for(void 0===s._array&&(s._array=[]),a=0,c=s.value.length;a<c;a++)s._array[a]=Rt();for(D.uniform1iv(d,s._array),a=0,c=s.value.length;a<c;a++)t=s.value[a],i=s._array[a],t&&(O.lostContextRecovery&&O.lostContextRecovery.refreshIfNeeded(t),O.setTexture(t,i));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+h)}}}}(o.uniformsList)}if(function(e,t,i){T.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),D.uniformMatrix4fv(e.modelViewMatrix,!1,T.elements),e.normalMatrix&&(M.getNormalMatrix(T),D.uniformMatrix3fv(e.normalMatrix,!1,M.elements));null!==e.modelMatrix&&D.uniformMatrix4fv(e.modelMatrix,!1,t.matrixWorld.elements);e.modelLocalMatrix&&D.uniformMatrix4fv(e.modelLocalMatrix,!1,t.matrix.elements)}(f,s,e),f.modelId){f.dbId&&(u=s.dbId||s.fragId||0,D.uniform3f(f.dbId,(255&u)/255,(u>>8&255)/255,(u>>16&255)/255));var E=s.modelId;D.uniform3f(f.modelId,(255&E)/255,(E>>8&255)/255,(u>>24&255)/255)}else null!==f.dbId&&(u=s.dbId||s.fragId||0,D.uniform3f(f.dbId,(255&u)/255,(u>>8&255)/255,(u>>16&255)/255));if(f.themingColor){var S=s.themingColor;S instanceof l.Vector4?D.uniform4f(f.themingColor,S.x,S.y,S.z,S.w):D.uniform4f(f.themingColor,0,0,0,0)}return d}function Pt(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function Dt(e,t){e.envMap&&(e.envMap.value=t.envMap),e.irradianceMap&&(e.irradianceMap.value=t.irradianceMap),e.envMapExposure&&(e.envMapExposure.value=t.envMapExposure),e.envRotationSin&&e.envRotationCos&&(e.envRotationSin.value=t.envRotationSin,e.envRotationCos.value=t.envRotationCos)}function Lt(e,t){e.envMap&&(e.envMap.needsUpdate=t),e.irradianceMap&&(e.irradianceMap.needsUpdate=t),e.envMapExposure&&(e.envMapExposure.needsUpdate=t)}function It(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function Rt(){var e=X;return e>=me&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+me),X+=1,e}function Ot(e,t,i,n){e[t]=i.r*n,e[t+1]=i.g*n,e[t+2]=i.b*n}function Nt(e){var t,i,n,r,o,s,a,c,h=0,u=0,d=0,f=oe,p=f.directional.colors,m=f.directional.positions,g=f.point.colors,v=f.point.positions,y=f.point.distances,b=f.spot.colors,x=f.spot.positions,_=f.spot.distances,E=f.spot.directions,S=f.spot.anglesCos,A=f.spot.exponents,w=f.hemi.skyColors,T=f.hemi.groundColors,M=f.hemi.positions,C=0,P=0,D=0,L=0,I=0,R=0,O=0,N=0,F=0,U=0,B=0,k=0;for(t=0,i=e.length;t<i;t++)if(!(n=e[t]).onlyShadow)if(r=n.color,a=n.intensity,c=n.distance,n instanceof l.AmbientLight){if(!n.visible)continue;h+=r.r,u+=r.g,d+=r.b}else if(n instanceof l.DirectionalLight){if(I+=1,!n.visible)continue;ne.setFromMatrixPosition(n.matrixWorld),ie.setFromMatrixPosition(n.target.matrixWorld),ne.sub(ie),ne.normalize(),m[F=3*C]=ne.x,m[F+1]=ne.y,m[F+2]=ne.z,Ot(p,F,r,a),C+=1}else if(n instanceof l.PointLight){if(R+=1,!n.visible)continue;Ot(g,U=3*P,r,a),ie.setFromMatrixPosition(n.matrixWorld),v[U]=ie.x,v[U+1]=ie.y,v[U+2]=ie.z,y[P]=c,P+=1}else if(n instanceof l.SpotLight){if(O+=1,!n.visible)continue;Ot(b,B=3*D,r,a),ie.setFromMatrixPosition(n.matrixWorld),x[B]=ie.x,x[B+1]=ie.y,x[B+2]=ie.z,_[D]=c,ne.copy(ie),ie.setFromMatrixPosition(n.target.matrixWorld),ne.sub(ie),ne.normalize(),E[B]=ne.x,E[B+1]=ne.y,E[B+2]=ne.z,S[D]=Math.cos(n.angle),A[D]=n.exponent,D+=1}else if(n instanceof l.HemisphereLight){if(N+=1,!n.visible)continue;ne.setFromMatrixPosition(n.matrixWorld),ne.normalize(),M[k=3*L]=ne.x,M[k+1]=ne.y,M[k+2]=ne.z,o=n.color,s=n.groundColor,Ot(w,k,o,a),Ot(T,k,s,a),L+=1}for(t=3*C,i=Math.max(p.length,3*I);t<i;t++)p[t]=0;for(t=3*P,i=Math.max(g.length,3*R);t<i;t++)g[t]=0;for(t=3*D,i=Math.max(b.length,3*O);t<i;t++)b[t]=0;for(t=3*L,i=Math.max(w.length,3*N);t<i;t++)w[t]=0;for(t=3*L,i=Math.max(T.length,3*N);t<i;t++)T[t]=0;f.directional.length=C,f.point.length=P,f.spot.length=D,f.hemi.length=L,f.ambient[0]=h,f.ambient[1]=u,f.ambient[2]=d}function Ft(e,t,i){var n;i?(D.texParameteri(e,D.TEXTURE_WRAP_S,Wt(t.wrapS)),D.texParameteri(e,D.TEXTURE_WRAP_T,Wt(t.wrapT)),D.texParameteri(e,D.TEXTURE_MAG_FILTER,Wt(t.magFilter)),D.texParameteri(e,D.TEXTURE_MIN_FILTER,Wt(t.minFilter))):(D.texParameteri(e,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(e,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),t.wrapS===l.ClampToEdgeWrapping&&t.wrapT===l.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+t.sourceFile+" )"),D.texParameteri(e,D.TEXTURE_MAG_FILTER,zt(t.magFilter)),D.texParameteri(e,D.TEXTURE_MIN_FILTER,zt(t.minFilter)),t.minFilter!==l.NearestFilter&&t.minFilter!==l.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+t.sourceFile+" )")),(n=ae.get("EXT_texture_filter_anisotropic"))&&t.type!==l.FloatType&&t.type!==l.HalfFloatType&&(t.anisotropy>1||t.__oldAnisotropy)&&(D.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,O.getMaxAnisotropy())),t.__oldAnisotropy=t.anisotropy)}function Ut(e,t){if(e.width<=t&&e.height<=t)return e;if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var i=t/Math.max(e.width,e.height),n=Math.max(Math.floor(e.width*i),1),r=Math.max(Math.floor(e.height*i),1),o=g.createElement("canvas");return o.width=n,o.height=r,o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n,r),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}function Bt(e,t){if(6===e.image.length)if(tt(e)){e.__webglTextureCube||(e.addEventListener("dispose",Ue),e.__webglTextureCube=D.createTexture(),O.info.memory.textures++),D.activeTexture(D.TEXTURE0+t),D.bindTexture(D.TEXTURE_CUBE_MAP,e.__webglTextureCube),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,e.flipY);var i,n=e instanceof l.CompressedTexture,r=e.image[0]instanceof l.DataTexture,o=[];for(i=0;i<6;i++)!O.autoScaleCubemaps||n||r?o[i]=r?e.image[i].image:e.image[i]:o[i]=Ut(e.image[i],ye);var s=o[0],a=l.Math.isPowerOfTwo(s.width)&&l.Math.isPowerOfTwo(s.height),c=Wt(e.format),h=Wt(e.type);for(Ft(D.TEXTURE_CUBE_MAP,e,a),i=0;i<6;i++)if(n)for(var u,d=o[i].mipmaps,f=0,p=d.length;f<p;f++)u=d[f],e.format!==l.RGBAFormat&&e.format!==l.RGBFormat?Pe().indexOf(c)>-1?D.compressedTexImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+i,f,c,u.width,u.height,0,u.data):console.warn("Attempt to load unsupported compressed texture format"):D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+i,f,c,u.width,u.height,0,c,h,u.data);else r?D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,c,o[i].width,o[i].height,0,c,h,o[i].data):D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,c,c,h,o[i]);e.generateMipmaps&&a&&D.generateMipmap(D.TEXTURE_CUBE_MAP),it(e),e.onUpdate&&e.onUpdate()}else D.activeTexture(D.TEXTURE0+t),D.bindTexture(D.TEXTURE_CUBE_MAP,e.__webglTextureCube)}function kt(e,t){D.activeTexture(D.TEXTURE0+t),D.bindTexture(D.TEXTURE_CUBE_MAP,e.__webglTexture)}function Vt(e){var t=D.COLOR_ATTACHMENT0,i=[t];for(we=1;we<e.length;we++)i.push(t+we);D.drawBuffers(i)}function Gt(e){var t=l.Math.isPowerOfTwo(e.width)&&l.Math.isPowerOfTwo(e.height),i=Wt(e.texture.format),n=Wt(e.texture.type),r=Ht(e.texture.format,e.texture.type);e.addEventListener("dispose",Be),e.__webglTexture=D.createTexture(),O.info.memory.textures++,D.bindTexture(D.TEXTURE_2D,e.__webglTexture),Ft(D.TEXTURE_2D,e.texture,t),D.texImage2D(D.TEXTURE_2D,0,r,e.width,e.height,0,i,n,null),t&&e.texture.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D)}function zt(e){return e===l.NearestFilter||e===l.NearestMipMapNearestFilter||e===l.NearestMipMapLinearFilter?D.NEAREST:D.LINEAR}function Ht(e,t){if(e===l.RGBFormat)switch(t){case l.UnsignedByteType:return D.RGB8;case l.FloatType:return D.RGB32F;case l.HalfFloatType:return D.RGB16F}else if(e===l.RGBAFormat)switch(t){case l.UnsignedByteType:return D.RGBA8;case l.FloatType:return D.RGBA32F;case l.HalfFloatType:return D.RGBA16F}else if(e===l.LuminanceFormat&&t===l.UnsignedByteType)return D.LUMINANCE;return console.error("failed to map texture format and type to internalformat"),Wt(e)}function Wt(e){var t;if(e===l.RepeatWrapping)return D.REPEAT;if(e===l.ClampToEdgeWrapping)return D.CLAMP_TO_EDGE;if(e===l.MirroredRepeatWrapping)return D.MIRRORED_REPEAT;if(e===l.NearestFilter)return D.NEAREST;if(e===l.NearestMipMapNearestFilter)return D.NEAREST_MIPMAP_NEAREST;if(e===l.NearestMipMapLinearFilter)return D.NEAREST_MIPMAP_LINEAR;if(e===l.LinearFilter)return D.LINEAR;if(e===l.LinearMipMapNearestFilter)return D.LINEAR_MIPMAP_NEAREST;if(e===l.LinearMipMapLinearFilter)return D.LINEAR_MIPMAP_LINEAR;if(e===l.UnsignedByteType)return D.UNSIGNED_BYTE;if(e===l.UnsignedShort4444Type)return D.UNSIGNED_SHORT_4_4_4_4;if(e===l.UnsignedShort5551Type)return D.UNSIGNED_SHORT_5_5_5_1;if(e===l.UnsignedShort565Type)return D.UNSIGNED_SHORT_5_6_5;if(e===l.ByteType)return D.BYTE;if(e===l.ShortType)return D.SHORT;if(e===l.UnsignedShortType)return D.UNSIGNED_SHORT;if(e===l.IntType)return D.INT;if(e===l.UnsignedIntType)return D.UNSIGNED_INT;if(e===l.FloatType)return D.FLOAT;if(e===l.HalfFloatType)return D.HALF_FLOAT;if(e===l.AlphaFormat)return D.ALPHA;if(e===l.RGBFormat)return D.RGB;if(e===l.RGBAFormat)return D.RGBA;if(e===l.LuminanceFormat)return D.LUMINANCE;if(e===l.LuminanceAlphaFormat)return D.LUMINANCE_ALPHA;if(e===l.AddEquation)return D.FUNC_ADD;if(e===l.MinEquation)return D.MIN;if(e===l.MaxEquation)return D.MAX;if(e===l.SubtractEquation)return D.FUNC_SUBTRACT;if(e===l.ReverseSubtractEquation)return D.FUNC_REVERSE_SUBTRACT;if(e===l.ZeroFactor)return D.ZERO;if(e===l.OneFactor)return D.ONE;if(e===l.SrcColorFactor)return D.SRC_COLOR;if(e===l.OneMinusSrcColorFactor)return D.ONE_MINUS_SRC_COLOR;if(e===l.SrcAlphaFactor)return D.SRC_ALPHA;if(e===l.OneMinusSrcAlphaFactor)return D.ONE_MINUS_SRC_ALPHA;if(e===l.DstAlphaFactor)return D.DST_ALPHA;if(e===l.OneMinusDstAlphaFactor)return D.ONE_MINUS_DST_ALPHA;if(e===l.DstColorFactor)return D.DST_COLOR;if(e===l.OneMinusDstColorFactor)return D.ONE_MINUS_DST_COLOR;if(e===l.SrcAlphaSaturateFactor)return D.SRC_ALPHA_SATURATE;if(null!==(t=ae.get("WEBGL_compressed_texture_s3tc"))){if(e===l.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===l.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===l.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===l.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(t=ae.get("WEBGL_compressed_texture_pvrtc"))){if(e===l.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===l.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===l.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===l.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(t=ae.get("EXT_blend_minmax"))){if(e===l.MinEquation)return t.MIN_EXT;if(e===l.MaxEquation)return t.MAX_EXT}return 0}this.setFaceCulling=function(e,t){e===l.CullFaceNone?D.disable(D.CULL_FACE):(t===l.FrontFaceDirectionCW?D.frontFace(D.CW):D.frontFace(D.CCW),e===l.CullFaceBack?D.cullFace(D.BACK):e===l.CullFaceFront?D.cullFace(D.FRONT):D.cullFace(D.FRONT_AND_BACK),D.enable(D.CULL_FACE))},this.setMaterialFaces=function(e){le.setDoubleSided(e.side===l.DoubleSide),le.setFlipSided(e.side===l.BackSide)},this.uploadTexture=function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",Ue),e.__webglTexture=D.createTexture(),O.info.memory.textures++),D.bindTexture(D.TEXTURE_2D,e.__webglTexture),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,e.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,e.unpackAlignment),e.image=Ut(e.image,ve);var t=e.image,i=l.Math.isPowerOfTwo(t.width)&&l.Math.isPowerOfTwo(t.height),n=Wt(e.format),r=Wt(e.type),o=Ht(e.format,e.type);Ft(D.TEXTURE_2D,e,i);var s,a,c,h=e.mipmaps;if(e instanceof l.DataTexture)if(h.length>0&&i){for(a=0,c=h.length;a<c;a++)s=h[a],D.texImage2D(D.TEXTURE_2D,a,o,s.width,s.height,0,n,r,s.data);e.generateMipmaps=!1}else D.texImage2D(D.TEXTURE_2D,0,o,t.width,t.height,0,n,r,t.data);else if(e instanceof l.CompressedTexture){for(a=0,c=h.length;a<c;a++)s=h[a],e.format!==l.RGBAFormat&&e.format!==l.RGBFormat?Pe().indexOf(n)>-1?D.compressedTexImage2D(D.TEXTURE_2D,a,o,s.width,s.height,0,s.data):console.warn("Attempt to load unsupported compressed texture format"):D.texImage2D(D.TEXTURE_2D,a,o,s.width,s.height,0,n,r,s.data);if(h.length>1&&Pe().indexOf(n)>-1)for(var u,d=s.width>>1,f=s.height>>1,p=h.length;d>=1||f>=1;)u=4==s.width&&4==s.height?s.data:new DataView(s.data.buffer,s.data.byteOffset,s.data.byteLength*(Math.max(d,4)*Math.max(f,4))/(s.width*s.height)),D.compressedTexImage2D(D.TEXTURE_2D,p,o,Math.max(d,1),Math.max(f,1),0,u),d>>=1,f>>=1,++p}else if(h.length>0&&i){for(a=0,c=h.length;a<c;a++)D.texImage2D(D.TEXTURE_2D,a,o,n,r,h[a]);e.generateMipmaps=!1}else D.texImage2D(D.TEXTURE_2D,0,o,n,r,e.image);e.generateMipmaps&&i&&D.generateMipmap(D.TEXTURE_2D),it(e),e.onUpdate&&e.onUpdate()},this.setTexture=function(e,t){D.activeTexture(D.TEXTURE0+t),tt(e)?O.uploadTexture(e):e.__webglTexture?D.bindTexture(D.TEXTURE_2D,e.__webglTexture):D.bindTexture(D.TEXTURE_2D,pe.__webglTexture)},O.uploadTexture(pe),this.initFrameBufferMRT=function(e,t){var i=e[0],n=!1;if(i&&!i.__webglFramebuffer){var r;if(void 0===i.depthBuffer&&(i.depthBuffer=!0),void 0===i.stencilBuffer&&(i.stencilBuffer=!0),i.__webglFramebuffer=D.createFramebuffer(),D.bindFramebuffer(D.FRAMEBUFFER,i.__webglFramebuffer),i.shareDepthFrom)r=i.__webglRenderbuffer=i.shareDepthFrom.__webglRenderbuffer,i.__isUsingShared=!0;else if(r=i.__webglRenderbuffer,i.__isUsingShared=!1,i.depthBuffer){let e;r||(r=i.__webglRenderbuffer=D.createRenderbuffer(),i.__webglRenderbufferOwn=r),D.bindRenderbuffer(D.RENDERBUFFER,r),e=i.stencilBuffer?D.DEPTH24_STENCIL8:D.DEPTH_COMPONENT32F,D.renderbufferStorage(D.RENDERBUFFER,e,i.width,i.height)}if(i.depthBuffer){const e=i.stencilBuffer?D.DEPTH_STENCIL_ATTACHMENT:D.DEPTH_ATTACHMENT;D.framebufferRenderbuffer(D.FRAMEBUFFER,e,D.RENDERBUFFER,r)}n=!0}else if(i)if(i.shareDepthFrom&&0==i.__isUsingShared){if(r=i.shareDepthFrom.__webglRenderbuffer,i.__isUsingShared=!0,i.depthBuffer){const e=i.stencilBuffer?D.DEPTH_STENCIL_ATTACHMENT:D.DEPTH_ATTACHMENT;D.framebufferRenderbuffer(D.FRAMEBUFFER,e,D.RENDERBUFFER,r)}}else if(null==i.shareDepthFrom&&1==i.__isUsingShared){if(r=i.__webglRenderbufferOwn,i.__isUsingShared=!1,null==r&&i.depthBuffer){let e;r=i.__webglRenderbuffer=D.createRenderbuffer(),i.__webglRenderbufferOwn=r,D.bindRenderbuffer(D.RENDERBUFFER,r),e=i.stencilBuffer?D.DEPTH24_STENCIL8:D.DEPTH_COMPONENT32F,D.renderbufferStorage(D.RENDERBUFFER,e,i.width,i.height)}if(i.depthBuffer){const e=i.stencilBuffer?D.DEPTH_STENCIL_ATTACHMENT:D.DEPTH_ATTACHMENT;D.framebufferRenderbuffer(D.FRAMEBUFFER,e,D.RENDERBUFFER,r)}}var o=U;if(D.bindFramebuffer(D.FRAMEBUFFER,i.__webglFramebuffer),function(e,t){let i=e.__webglBoundBuffers;if(!i)return!0;if(i.length!==t.length)return!0;for(let e=0;e<t.length;e++)if(t[e]!==i[e])return!0;return!1}(i,e)){var s;for(s=0;s<e.length;s++){var a=e[s];a&&!a.__webglTexture&&Gt(a),D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0+s,D.TEXTURE_2D,a&&a.__webglTexture,0)}s=e.length;for(var l=i.__webglBoundBuffers&&i.__webglBoundBuffers.length||s;s<l;)D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0+s,D.TEXTURE_2D,null,0),s++;i.__webglBoundBuffers=e.slice()}if(Vt(e),t){var c=D.checkFramebufferStatus(D.FRAMEBUFFER);c!==D.FRAMEBUFFER_COMPLETE&&(console.log("Can't use multiple render targets. Falling back to two passes. "+c),o===i.__webglFramebuffer&&(o=U=null),D.bindFramebuffer(D.FRAMEBUFFER,o),D.deleteFramebuffer(i.__webglFramebuffer),delete i.__webglFramebuffer,t=!1)}return D.bindFramebuffer(D.FRAMEBUFFER,o),n&&(D.bindTexture(D.TEXTURE_2D,null),D.bindRenderbuffer(D.RENDERBUFFER,null),D.bindFramebuffer(D.FRAMEBUFFER,null)),t},this.setRenderTarget=function(e){var t,i,n,r,o,s;if(Array.isArray(e)&&e.length>0?(B=e[0],k=!0):(B=e,k=!1),O.lostContextRecovery&&O.lostContextRecovery.refreshTargetsIfNeeded(e),Array.isArray(e))this.initFrameBufferMRT(e),(t=e[0]).initForMRT=!0;else if(e){var a=e.__webglFramebuffer;a&&U===a&&!e.initForMRT&&null!=e.shareDepthFrom==!!e.__isUsingShared||this.initFrameBufferMRT([e]),(t=e).initForMRT=!1}!t||Ie?(n=Q,r=Z,o=Y,s=K):(n=t.width,r=t.height,o=0,s=0),(i=t?t.__webglFramebuffer:null)!==U&&(D.bindFramebuffer(D.FRAMEBUFFER,i),U=i),D.viewport(o,s,n,r)},this.readRenderTargetPixels=function(e,t,i,n,r,o){if(e instanceof l.WebGLRenderTarget){if(O.lostContextRecovery&&O.lostContextRecovery.refreshTargetsIfNeeded(e),e.__webglFramebuffer){if(e.texture.format!==l.RGBAFormat&&e.texture.format!==l.RGBFormat||e.texture.type!==l.UnsignedByteType)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not a readable format.");var s=!1;e.__webglFramebuffer!==U&&(D.bindFramebuffer(D.FRAMEBUFFER,e.__webglFramebuffer),s=!0),e.canReadPixels||D.checkFramebufferStatus(D.FRAMEBUFFER)===D.FRAMEBUFFER_COMPLETE?D.readPixels(t,i,n,r,D.RGBA,D.UNSIGNED_BYTE,o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&D.bindFramebuffer(D.FRAMEBUFFER,U)}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}},61453:(e,t,i)=>{"use strict";i.r(t),i.d(t,{WebGLShader:()=>r});var n=function(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")};function r(e,t,i){var r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),"undefined"!=typeof DEBUG_SHADERS&&DEBUG_SHADERS&&(!1===e.getShaderParameter(r,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e.getShaderInfoLog(r),n(i))),r}},33472:(e,t,i)=>{"use strict";i.d(t,{O:()=>n});const n={}},75468:(e,t,i)=>{"use strict";function n(e,t){var i,n;this.bytes_per_node=t?32:36,e instanceof ArrayBuffer?(i=e.byteLength/this.bytes_per_node,n=e,this.nodeCount=i):(i=0|e,n=new ArrayBuffer(this.bytes_per_node*i),this.nodeCount=0),this.nodeCapacity=i,this.nodesRaw=n,this.is_lean_node=t,this.node_stride=this.bytes_per_node/4,this.node_stride_short=this.bytes_per_node/2,this.nodesF=new Float32Array(this.nodesRaw),this.nodesI=new Int32Array(this.nodesRaw),this.nodesS=new Uint16Array(this.nodesRaw)}i.r(t),i.d(t,{BVHBuilder:()=>h,BVHModule:()=>s,BVHSortFuncType:()=>c,FragInfoFlags:()=>l,NodeArray:()=>n}),n.prototype.setLeftChild=function(e,t){this.nodesI[e*this.node_stride+6]=t},n.prototype.getLeftChild=function(e){return this.nodesI[e*this.node_stride+6]},n.prototype.setPrimStart=function(e,t){this.is_lean_node?this.nodesI[e*this.node_stride+6]=t:this.nodesI[e*this.node_stride+8]=t},n.prototype.getPrimStart=function(e){return this.is_lean_node?this.nodesI[e*this.node_stride+6]:this.nodesI[e*this.node_stride+8]},n.prototype.setPrimCount=function(e,t){this.nodesS[e*this.node_stride_short+14]=t},n.prototype.getPrimCount=function(e){return this.nodesS[e*this.node_stride_short+14]},n.prototype.setFlags=function(e,t,i,n){this.nodesS[e*this.node_stride_short+15]=n<<3|i<<2|3&t},n.prototype.getFlags=function(e){return this.nodesS[e*this.node_stride_short+15]},n.prototype.setBox0=function(e,t){var i=e*this.node_stride,n=this.nodesF;n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2],n[i+3]=t[3],n[i+4]=t[4],n[i+5]=t[5]},n.prototype.getBoxThree=function(e,t){var i=e*this.node_stride,n=this.nodesF;t.min.x=n[i],t.min.y=n[i+1],t.min.z=n[i+2],t.max.x=n[i+3],t.max.y=n[i+4],t.max.z=n[i+5]},n.prototype.getBoxArray=function(e,t,i){var n=e*this.node_stride,r=this.nodesF;t[0+(i=i||0)]=r[n],t[1+i]=r[n+1],t[2+i]=r[n+2],t[3+i]=r[n+3],t[4+i]=r[n+4],t[5+i]=r[n+5]},n.prototype.setBoxThree=function(e,t){var i=e*this.node_stride,n=this.nodesF;n[i]=t.min.x,n[i+1]=t.min.y,n[i+2]=t.min.z,n[i+3]=t.max.x,n[i+4]=t.max.y,n[i+5]=t.max.z},n.prototype.makeEmpty=function(e){var t=e*this.node_stride,i=this.nodesI;i[t+6]=-1,i[t+7]=0,this.is_lean_node||(i[t+8]=-1)},n.prototype.realloc=function(e){if(this.nodeCount+e>this.nodeCapacity){var t=0|3*this.nodeCapacity/2;t<this.nodeCount+e&&(t=this.nodeCount+e);var i=new ArrayBuffer(t*this.bytes_per_node),n=new Int32Array(i);n.set(this.nodesI),this.nodeCapacity=t,this.nodesRaw=i,this.nodesF=new Float32Array(i),this.nodesI=n,this.nodesS=new Uint16Array(i)}},n.prototype.nextNodes=function(e){this.realloc(e);var t=this.nodeCount;this.nodeCount+=e;for(var i=0;i<e;i++)this.makeEmpty(t+i);return t},n.prototype.getRawData=function(){return this.nodesRaw.slice(0,this.nodeCount*this.bytes_per_node)};var r=3,o=1e-5,s=function(){function e(e,t,i){e[0]>t[i]&&(e[0]=t[i]),e[3]<t[i]&&(e[3]=t[i]),e[1]>t[i+1]&&(e[1]=t[i+1]),e[4]<t[i+1]&&(e[4]=t[i+1]),e[2]>t[i+2]&&(e[2]=t[i+2]),e[5]<t[i+2]&&(e[5]=t[i+2])}function t(e,t,i){e[0]>t[i]&&(e[0]=t[i]),e[1]>t[i+1]&&(e[1]=t[i+1]),e[2]>t[i+2]&&(e[2]=t[i+2]),e[3]<t[i+3]&&(e[3]=t[i+3]),e[4]<t[i+4]&&(e[4]=t[i+4]),e[5]<t[i+5]&&(e[5]=t[i+5])}function i(e,t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]>t[2]&&(e[2]=t[2]),e[3]<t[3]&&(e[3]=t[3]),e[4]<t[4]&&(e[4]=t[4]),e[5]<t[5]&&(e[5]=t[5])}function n(e,t,i,n){for(var r=0;r<3;r++)e[t+r]=i[n+3+r]-i[n+r]}function r(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5]}var s=1/0;function a(e){e[0]=s,e[1]=s,e[2]=s,e[3]=-s,e[4]=-s,e[5]=-s}function l(e,t,i){return e<0||t<0||i<0?0:2*(e*t+t*i+i*e)}function c(e){var t=e[3]-e[0],i=e[4]-e[1],n=e[5]-e[2];return t<0||i<0||n<0?0:2*(t*i+i*n+n*t)}function h(){this.vb_left=new Float32Array(6),this.vb_right=new Float32Array(6),this.cb_left=new Float32Array(6),this.cb_right=new Float32Array(6),this.num_left=0,this.best_split=-1,this.best_cost=-1,this.num_bins=-1}function u(){this.box_bbox=new Float32Array(6),this.box_centroid=new Float32Array(6),this.num_prims=0}function d(){this.BL=new Float32Array(6),this.CL=new Float32Array(6),this.NL=0,this.AL=0}h.prototype.reset=function(){this.num_left=0,this.best_split=-1,this.best_cost=-1,this.num_bins=-1},u.prototype.reset=function(){this.num_prims=0,a(this.box_bbox),a(this.box_centroid)},d.prototype.reset=function(){this.NL=0,this.AL=0,a(this.BL),a(this.CL)};var f,p=[];for(f=0;f<16;f++)p.push(new u);var m=[];for(f=0;f<15;f++)m.push(new d);var g=new Float32Array(6),v=new Float32Array(6);function y(n,o,s,a,l,h,u){if(h[a]<n.scene_epsilon)u.best_cost=1/0;else{var d,f,y=16;for(y>s-o+1&&(y=s-o+1),d=0;d<y;d++)p[d].reset();for(d=0;d<y-1;d++)m[d].reset();for(u.num_bins=y,function(i,n,r,o,s,a,l){for(var c=i.centroids,h=i.primitives,u=i.finfo.boxes,d=i.finfo.boxStride,f=.99999*l/a[o],m=s[o],g=i.sort_prims,v=n;v<=r;v++){var y=0|h[v],b=0|f*(c[3*y+o]-m);b<0?b=0:b>=l&&(b=l-1),g[v]=b,p[b].num_prims++,t(p[b].box_bbox,u,y*d),e(p[b].box_centroid,c,3*y)}}(n,o,s,a,l,h,y),r(m[0].BL,p[0].box_bbox),r(m[0].CL,p[0].box_centroid),m[0].AL=c(m[0].BL),m[0].NL=p[0].num_prims,d=1;d<y-1;d++){f=p[d];var b=m[d];r(b.BL,m[d-1].BL),i(b.BL,f.box_bbox),b.AL=c(b.BL),r(b.CL,m[d-1].CL),i(b.CL,f.box_centroid),b.NL=m[d-1].NL+f.num_prims}r(g,p[d=y-1].box_bbox),r(v,p[d].box_centroid);var x=c(g),_=p[d].num_prims,E=d,S=x*_+m[d-1].AL*m[d-1].NL;for(r(u.vb_right,g),r(u.cb_right,p[d].box_centroid),r(u.vb_left,m[d-1].BL),r(u.cb_left,m[d-1].CL),u.num_left=m[d-1].NL,d-=1;d>=1;d--){f=p[d],i(g,f.box_bbox),i(v,f.box_centroid);var A=(x=c(g))*(_+=f.num_prims)+m[d-1].AL*m[d-1].NL;A<=S&&(S=A,E=d,r(u.vb_right,g),r(u.cb_right,v),r(u.vb_left,m[d-1].BL),r(u.cb_left,m[d-1].CL),u.num_left=m[d-1].NL)}u.best_split=E,u.best_cost=S}}var b=new Float32Array(3);return{bvh_subdivide:function(t,i,r,s,l,c,u,d){n(b,0,c,0);var f=t.nodes,p=u?t.frags_per_leaf_node_transparent:t.frags_per_leaf_node,m=u?t.frags_per_inner_node_transparent:t.frags_per_inner_node,g=t.max_polys_per_node,v=0;b[1]>b[0]&&(v=1),b[2]>b[v]&&(v=2),f.setBox0(i,l);var x=0,_=0,E=s-r+1;let S=!1;if(t.finfo.hasPolygonCounts&&t.frags_per_inner_node){let e=new Set;var A=E<=t.frags_per_inner_node?s:r+t.frags_per_inner_node-1;const i=t.prim_sizes[t.primitives[r]];let n,a=r;for(;a<=A;a++){const r=t.primitives[a];if(S=(x+=t.finfo.getPolygonCount(r))>g,n=i/t.prim_sizes[r],S||=i>o&&n>t.max_size_ratio,t.per_tile_consolidation&&(e.add(t.finfo.getDrawCallId(r)),S||=e.size>=t.max_drawcalls_per_node),_++,S){++a;break}}if(t.per_tile_consolidation&&e.size>=t.max_drawcalls_per_node){const r=a;let s=[],l=[],c=!1;for(;a<=A;a++){const r=t.primitives[a],h=t.finfo.getPolygonCount(r);if(e.has(t.finfo.getDrawCallId(r))){if(c||=x+h>g,n=i/t.prim_sizes[r],c||=i>o&&n>t.max_size_ratio,c)break;s.push(r),_++,x+=h}else l.push(r)}if(s.length>0){a=r;for(let e=0;e<s.length;e++,a++)t.primitives[a]=s[e];for(let e=0;e<l.length;e++,a++)t.primitives[a]=l[e]}S||=c}}if(E<=p&&x<g&&!S||1===E||d>15||b[v]<t.scene_epsilon)return f.setLeftChild(i,-1),f.setPrimStart(i,r),f.setPrimCount(i,s-r+1),void f.setFlags(i,0,0,u?1:0);m&&(v=function(t,i,r,o,s,l,c,h){var u=t.primitives,d=t.centroids,f=s-o+1;f>t.frags_per_inner_node&&(f=t.frags_per_inner_node),f>h&&(f=h),i.setPrimStart(r,o),i.setPrimCount(r,f),o+=f,a(l);for(var p=o;p<=s;p++)e(l,d,3*u[p]);n(c,0,l,0);var m=0;return c[1]>c[0]&&(m=1),c[2]>c[m]&&(m=2),m}(t,f,i,r,s,c,b,_),r+=f.getPrimCount(i));var w=new h;if(y(t,r,s,v,c,b,w),w.num_bins<0)f.setPrimCount(i,f.getPrimCount(i)+s-r+1);else{!function(e,t,i,n,r,o,s){var a,l,c=e.primitives,h=e.sort_prims,u=0,d=0|t,f=0|s.best_split;for(a=t;a<=i;a++){var p=0|c[a];h[a]<f?c[d++]=p:h[u++]=p}for(l=0;l<u;l++)c[d+l]=h[l]}(t,r,s,0,0,0,w);var T=f.nextNodes(2),M=.5*(w.vb_left[3+v]+w.vb_left[v]),C=.5*(w.vb_right[3+v]+w.vb_right[v]);f.setFlags(i,v,M<C?0:1,u?1:0),f.setLeftChild(i,T),t.recursion_stack.push([t,T+1,r+w.num_left,s,w.vb_right,w.cb_right,u,d+1]),t.recursion_stack.push([t,T,r,r+w.num_left-1,w.vb_left,w.cb_left,u,d+1])}},compute_boxes:function(i){var r=i.boxv_o,s=i.boxc_o,l=i.boxv_t,c=i.boxc_t;a(r),a(s),a(l),a(c);for(var h,u,d,f,p=i.centroids,m=i.finfo.boxes,g=i.finfo.boxStride,v=0,y=i.prim_count;v<y;v++){var x=i.primitives[v];d=m,f=g*x,(h=p)[u=3*x]=.5*(d[f]+d[f+3]),h[u+1]=.5*(d[f+1]+d[f+4]),h[u+2]=.5*(d[f+2]+d[f+5]),v>=i.first_transparent?(e(c,p,3*x),t(l,m,g*x)):(e(s,p,3*x),t(r,m,g*x))}n(b,0,i.boxv_o,0);var _=Math.max(b[0],b[1],b[2]);i.scene_epsilon=o*_},box_area:function(e,t){return l(e[t+3]-e[t],e[t+4]-e[t+1],e[t+5]-e[t+2])},sqr_diag_len:function(e,t){var i=e[t+3]-e[t],n=e[t+4]-e[t+1],r=e[t+5]-e[t+2];return i*i+n*n+r*r},box_area_three:function(e){return l(e.max.x-e.min.x,e.max.y-e.min.y,e.max.z-e.min.z)}}}();function a(e,t){this.boxes=e.boxes,this.polygonCounts=e.polygonCounts,this.hasPolygonCounts=!!this.polygonCounts,this.geomIds=e.geomids,this.flags=e.flags,this.materials=e.materials,this.materialDefs=t,this.count=e.length,this.boxStride=6,this.wantSort=e.wantSort??!0}a.prototype.getCount=function(){return this.count},a.prototype.isTransparent=function(e){return this.flags?!!(this.flags[e]&l.IS_TRANSPARENT):!(!this.materialDefs||!this.materialDefs[this.materials[e]])&&this.materialDefs[this.materials[e]].transparent},a.prototype.getPolygonCount=function(e){return this.polygonCounts[e]},a.prototype.getGeometryId=function(e){return this.geomIds[e]},a.prototype.getCanBeConsolidated=function(e){return!!this.flags[e]&l.IS_CONSOLIDATED},a.prototype.getDrawCallId=function(e){return`${this.materials[e]}${this.getCanBeConsolidated(e)?"":"_"+this.getGeometryId(e)}`},a.prototype.supportsPerTileConsolidation=function(){return!!this.materials&&!!this.flags&&!!this.geomIds};const l=Object.freeze({IS_CONSOLIDATED:1,IS_TRANSPARENT:2}),c=Object.freeze({BOX_AREA:"box_area",DIAMETER:"sqr_diag_len"});function h(e,t,i){this.finfo=i||new a(e,t),this.prim_count=this.finfo.getCount(),this.frags_per_leaf_node=-1,this.frags_per_inner_node=-1,this.nodes=null,this.work_buf=new ArrayBuffer(4*this.prim_count),this.sort_prims=new Int32Array(this.work_buf),this.primitives=new Int32Array(this.prim_count),this.centroids=new Float32Array(r*this.prim_count),this.boxv_o=new Float32Array(6),this.boxc_o=new Float32Array(6),this.boxv_t=new Float32Array(6),this.boxc_t=new Float32Array(6),this.recursion_stack=[]}h.prototype.sortPrimitives=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.BOX_AREA;var i=new Float32Array(this.max_size_ratio===1/0?this.work_buf:this.prim_count),n=this.primitives,r=0,o=e;const a=s[t];var l,h;for(l=0,h=this.prim_count;l<h;l++){n[l]=l;var u=this.finfo.isTransparent(l);u&&r++,o?(i[l]=a(this.finfo.boxes,this.finfo.boxStride*l),u&&(i[l]=-i[l])):i[l]=u?-1:1}if(o)Array.prototype.sort.call(this.primitives,(function(e,t){return i[t]-i[e]}));else if(r&&r<this.prim_count){var d=new Int32Array(r),f=0,p=0;for(l=0,h=this.prim_count;l<h;l++)i[l]>=0?n[f++]=n[l]:d[p++]=n[l];n.set(d,this.prim_count-r)}this.prim_sizes=i,this.first_transparent=this.prim_count-r},h.prototype.build=function(e){var t=e&&!!e.useSlimNodes,i=this;function r(t,n){Object.prototype.hasOwnProperty.call(e,t)?i[t]=e[t]:i[t]=n}if(r("max_size_ratio",1/0),r("per_tile_consolidation",!1),e.sortFuncType===c.DIAMETER&&(this.max_size_ratio*=this.max_size_ratio),t)r("frags_per_leaf_node",1),r("frags_per_inner_node",0),r("frags_per_leaf_node_transparent",1),r("frags_per_inner_node_transparent",0),r("max_polys_per_node",1/0);else{var o=e.isWeakDevice?.5:1;r("frags_per_leaf_node",0|256*o),r("frags_per_inner_node",0|this.frags_per_leaf_node),r("frags_per_leaf_node_transparent",this.frags_per_leaf_node),r("frags_per_inner_node_transparent",0),r("max_polys_per_node",0|2e4*o),r("max_drawcalls_per_node",1/0),r("want_sort",this.finfo.wantSort)}if(this.per_tile_consolidation=this.per_tile_consolidation&&this.finfo.supportsPerTileConsolidation()&&this.want_sort,this.nodes&&this.nodes.is_lean_node==t)this.nodes.nodeCount=0;else{for(var a=this.prim_count/this.frags_per_leaf_node,l=1;l<a;)l*=2;this.nodes=new n(l,!!e&&e.useSlimNodes)}this.sortPrimitives(this.want_sort,e.sortFuncType),s.compute_boxes(this);var h,u=this.nodes.nextNodes(2);for(s.bvh_subdivide(this,u,0,this.first_transparent-1,this.boxv_o,this.boxc_o,!1,0);this.recursion_stack.length;)h=this.recursion_stack.pop(),s.bvh_subdivide(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7]);for(s.bvh_subdivide(this,u+1,this.first_transparent,this.prim_count-1,this.boxv_t,this.boxc_t,!0,0);this.recursion_stack.length;)h=this.recursion_stack.pop(),s.bvh_subdivide(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7]);this.prim_sizes.buffer!==this.work_buf&&delete this.prim_sizes}},38749:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BoundsCallback:()=>r});var n=i(72091);function r(e){this.bounds=e,this.point=new n.Vector4,this.point.z=0,this.point.w=1}r.prototype.onVertex=function(e,t,i){this.point.x=e,this.point.y=t,this.bounds.expandByPoint(this.point)},r.prototype.onLineSegment=function(e,t,i,n,r){this.onVertex(e,t),this.onVertex(i,n)},r.prototype.onCircularArc=function(e,t,i,n,r,o){this.onEllipticalArc(e,t,i,n,r,r,0,o)},r.prototype.onEllipticalArc=function(e,t,i,n,r,o,s,a){0==s?i<=0&&n>=2*Math.PI-1e-5?this.onTexQuad(e,t,2*r,2*o,s,a):(this.point.x=e+Math.cos(i)*r,this.point.y=t+Math.sin(i)*o,this.bounds.expandByPoint(this.point),this.point.x=e+Math.cos(n)*r,this.point.y=t+Math.sin(n)*o,this.bounds.expandByPoint(this.point),i>n&&(this.point.x=e+r,this.point.y=t,this.bounds.expandByPoint(this.point),i-=2*Math.PI),i<.5*Math.PI&&n>.5*Math.PI&&(this.point.x=e,this.point.y=t+o,this.bounds.expandByPoint(this.point)),i<Math.PI&&n>Math.PI&&(this.point.x=e-r,this.point.y=t,this.bounds.expandByPoint(this.point)),i<1.5*Math.PI&&n>1.5*Math.PI&&(this.point.x=e,this.point.y=t-o,this.bounds.expandByPoint(this.point))):this.onTexQuad(e,t,2*r,2*o,s,a)},r.prototype.onTexQuad=function(e,t,i,r,o,s){var a=.5*i,l=.5*i;if(0==o)this.onVertex(e-a,t-l),this.onVertex(e+a,t+l);else{var c=new n.Matrix4,h=new n.Matrix4;c.makeRotationZ(o),h.makeTranslation(e,t,0),h.multiply(c);for(var u=0;u<4;u++)this.point.x=u%2==1?a:-a,this.point.y=u>=2?l:-l,this.point.applyMatrix4(h),this.bounds.expandByPoint(this.point)}},r.prototype.onOneTriangle=function(e,t,i,n,r,o,s){this.onVertex(e,t),this.onVertex(i,n),this.onVertex(r,o)}},77201:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BufferGeometryUtils:()=>m,createBufferGeometry:()=>f,findBufferAttribute:()=>a,meshToGeometry:()=>p});var n=i(55280),r=i(72091),o=i(83081),s={};function a(e,t,i){var n,a=t.normalize||t.normalized;if(!t.isInterleavedBufferAttribute&&t.array)n=new r.BufferAttribute(t.array,t.itemSize);else{var l=e+"|"+t.bytesPerItem+"|"+a+"|"+t.isPattern+"|"+t.divisor+"|"+t.offset;if(n=s[l])return n;n=new r.BufferAttribute(void 0,t.itemSize),s[l]=n}return n.normalized=a,n.bytesPerItem=t.bytesPerItem,n.isPattern=t.isPattern,i&&(n.divisor=t.divisor),!t.isInterleavedBufferAttribute&&t.array||(Object.prototype.hasOwnProperty.call(t,"offset")?n.offset=t.offset:o.logger.warn("VB attribute is neither interleaved nor separate. Something is wrong with the buffer specificaiton.")),n}var l,c,h={};var u=1,d=function(){this.id=u++,this.attributes={},this.__webglInit=void 0};function f(e){return l||((l=new r.BufferAttribute(void 0,1)).bytesPerItem=2,(c=new r.BufferAttribute(void 0,1)).bytesPerItem=4),new d}function p(e){var t=e.mesh,i=f(t.numInstances);for(var o in(0,n.isNodeJS)()&&(i.packId=e.packId,i.meshIndex=e.meshIndex),i.byteSize=0,i.vb=t.vb,i.vbbuffer=void 0,i.vbNeedsUpdate=!0,i.vbstride=t.vbstride,i.byteSize+=t.vb.byteLength,i.hash=e.hash,t.isLines&&(i.isLines=t.isLines),t.isWideLines&&(i.isWideLines=!0,i.lineWidth=t.lineWidth),t.isPoints&&(i.isPoints=t.isPoints,i.pointSize=t.pointSize),e.is2d&&(i.is2d=!0),i.numInstances=t.numInstances,t.vblayout){var s=t.vblayout[o];i.attributes[o]=a(o,s,t.numInstances)}return i.index=t.indices instanceof Uint32Array?c:l,i.ib=t.indices,i.ibbuffer=void 0,t.iblines&&(i.attributes.indexlines=t.iblines instanceof Uint32Array?c:l,i.iblines=t.iblines,i.iblinesbuffer=void 0),i.attributesKeys=function(e){var t="";for(var i in e.attributes)t+=i+"|";var n=h[t];return n||(n=Object.keys(e.attributes),h[t]=n,n)}(i),i.byteSize+=t.indices.byteLength,t.boundingBox&&(i.boundingBox=(new r.Box3).copy(t.boundingBox),i.boundingSphere=(new r.Sphere).copy(t.boundingSphere)),i}d.prototype=Object.create(r.BufferGeometry.prototype),d.prototype.clone=function(){const e=new d;e.ib=this.ib,e.vb=this.vb,e.vbstride=this.vbstride,e.byteSize=this.byteSize,e.isLines=this.isLines,e.isWideLines=this.isWideLines,e.lineWidth=this.lineWidth,e.isPoints=this.isPoints,e.pointSize=this.pointSize,e.index=this.index;for(const t in this.attributes){const i=this.attributes[t],n=i.array?new i.array.constructor(this.array):void 0,o=new r.BufferAttribute(n,i.itemSize);o.itemOffset=i.itemOffset,o.bytesPerItem=i.bytesPerItem,o.normalized=i.normalized,e.setAttribute(t,o)}if(this.groups)for(var t=0,i=this.groups.length;t<i;t++){var n=this.groups[t];e.groups.push({start:n.start,index:n.index,count:n.count})}return e},d.prototype.constructor=d,d.prototype.isLeanBufferGeometry=!0;let m={meshToGeometry:p,createBufferGeometry:f,findBufferAttribute:a,interleaveGeometry:function(e,t){if(e.vb&&!e.vbNeedsUpdate)return;let i={},n=0,r=e.attributes,o=r.position;o&&(i.position=a("position",{offset:n,bytesPerItem:4,itemSize:3}),n+=3);let s=r.normal;s&&(t||2===s.bytesPerItem?(i.normal=a("normal",{offset:n,bytesPerItem:2,itemSize:2}),n+=1):(i.normal=a("normal",{offset:n,bytesPerItem:4,itemSize:3}),n+=3));let c=r.uv;c&&(i.uv=a("uv",{offset:n,bytesPerItem:4,itemSize:2}),n+=2);let h,u,d=n,f=o.array.length/(o.array.itemSize||3),p=new Float32Array(f*d),m=new Uint16Array(p.buffer);if(o){let e=0,t=o.array;for(let i=0;i<f;i++,e+=d)p[e]=t[3*i],p[e+1]=t[3*i+1],p[e+2]=t[3*i+2]}if(s)if(2===s.itemSize){let e=2*i.normal.itemOffset,t=s.array;for(let i=0;i<f;i++,e+=2*d)m[e]=t[2*i],m[e+1]=t[2*i+1]}else if(t){let e=2*i.normal.itemOffset,t=s.array;for(let i=0;i<f;i++,e+=2*d){let n=t[3*i],r=t[3*i+1],o=t[3*i+2];m[e]=.5*(Math.atan2(r,n)/Math.PI+1)*65535|0,m[e+1]=.5*(o+1)*65535|0}}else{let e=i.normal.itemOffset,t=s.array;for(let i=0;i<f;i++,e+=d)p[e]=t[3*i],p[e+1]=t[3*i+1],p[e+2]=t[3*i+2]}if(c){let e=i.uv.itemOffset,t=c.array;for(let i=0;i<f;i++,e+=d)p[e]=t[2*i],p[e+1]=t[2*i+1]}if(e.attributes.index)h=r.index.array,i.index=l;else{h=new Uint16Array(f);for(let e=0;e<f;e++)h[e]=e;i.index=l}e.attributes.indexlines&&(u=r.indexlines.array,i.indexlines=l),e.vbstride=d,e.vb=p,e.ib=h,e.iblines=u,e.attributesInterleaved=i,e.vbNeedsUpdate=!1}}},22040:(e,t,i)=>{"use strict";function n(e){var t;if(!e)return 0;return((null===(t=e.attributes.index)||void 0===t?void 0:t.array)||e.ib).length/3||0}function r(e){var t,i,n;return((null===(t=e.vb)||void 0===t?void 0:t.byteLength)||0)+((null===(i=e.ib)||void 0===i?void 0:i.byteLength)||0)+((null===(n=e.iblines)||void 0===n?void 0:n.byteLength)||0)}i.r(t),i.d(t,{getByteSize:()=>r,getPolygonCount:()=>n})},65672:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MeshAccessor:()=>p,createWireframe:()=>m});var n=i(69511),r=i(96118),o=i(21706);const s=1e-6;const a={x:0,y:0,z:0};class l{constructor(e,t,i){this.getVertex=e,this.bbox=t,this.boxSize=this.bbox.getSize().length(),i||(i=s),i>0?(this.precisionTolerance=i,this.scale=1/this.precisionTolerance):(this.precisionTolerance=-i*this.boxSize,this.scale=1/this.precisionTolerance),this.snapBaseX=this.bbox.min.x,this.snapBaseY=this.bbox.min.y,this.snapBaseZ=this.bbox.min.z,this.xymap={}}findOrAddPoint(e,t,i,n){let r,o=0|(e-this.snapBaseX)*this.scale,s=0|(t-this.snapBaseY)*this.scale,l=0|(i-this.snapBaseZ)*this.scale,c=1/0;for(let n=o-1;n<=o+1;n++){let o=this.xymap[n];if(o)for(let n=s-1;n<=s+1;n++){let s=o[n];if(s)for(let n=l-1;n<=l+1;n++){let o=s[n];if(void 0===o)continue;this.getVertex(o,a);let l=a,h=(l.x-e)*(l.x-e)+(l.y-t)*(l.y-t)+(l.z-i)*(l.z-i);h<c&&(r=o,c=h)}}}if(Math.sqrt(c)>this.precisionTolerance&&(r=void 0),void 0===r){let e=this.xymap[o];e||(e=this.xymap[o]={});let t=e[s];return t||(t=e[s]={}),t[l]=n,n}return r}}let c=new r.LmvVector3,h=new r.LmvVector3,u=new r.LmvVector3,d=new r.LmvVector3,f=new r.LmvVector3;class p{constructor(e,t,i){let s=e.boundingBox||i,a=new o.LmvBox3;s&&a.copy(s),this.geom=e,this.myVerts=function(e,t){var i=new Float32Array(3*(0,n.getVertexCount)(e));return(0,n.enumMeshVertices)(e,(function(e,n,r,o){t&&t.expandByPoint(e),i[3*o]=e.x,i[3*o+1]=e.y,i[3*o+2]=e.z})),i}(e,s?null:a);let c=new l(this.getV.bind(this),a,-1/65536);this.remap=new Array((0,n.getVertexCount)(e));for(let e=0,t=0;e<this.myVerts.length;e+=3,t++)this.remap[t]=c.findOrAddPoint(this.myVerts[e],this.myVerts[e+1],this.myVerts[e+2],t);t&&function(e,t){let i=new r.LmvVector3;for(let n=0;n<e.length;n+=3)i.x=e[n],i.y=e[n+1],i.z=e[n+2],i.applyMatrix4(t),e[n]=i.x,e[n+1]=i.y,e[n+2]=i.z}(this.myVerts,t)}getV(e,t){t.x=this.myVerts[3*e],t.y=this.myVerts[3*e+1],t.z=this.myVerts[3*e+2]}getNormal(e,t,i,n){this.getV(e,c),this.getV(t,h),this.getV(i,u),h.sub(c),u.sub(c),h.cross(u),n.copy(h).normalize()}}function m(e,t,i,r){if("isLines"in e&&e.isLines||"indexlines"in e||"iblines"in e)return;let o=new p(e,t,i);var s={},a=[];function l(e,t,i){var n=o.remap[e],l=o.remap[t],c=o.remap[i];if(n!==l&&n!==c&&l!==c){var h=!1;if(n>l){var u=n;n=l,l=u,h=!0}var p=s[n];if(p){var m=p[l];if(void 0===m)p[l]=h?-i-1:i;else{if(r)a.push(e),a.push(t);else{o.getNormal(e,t,i,d),m<0?o.getNormal(l,n,o.remap[-m-1],f):o.getNormal(n,l,o.remap[m],f);var g=d.dot(f);Math.abs(g)<.25&&(a.push(e),a.push(t))}delete p[l]}}else s[n]={},s[n][l]=i}}for(var c in(0,n.enumMeshTriangles)(e,(function(e,t,i,n,r,o){l(n,r,o),l(r,o,n),l(o,n,r)})),s)for(var h in s[c])a.push(parseInt(c)),a.push(parseInt(h));a.length<2||(e.iblines=new Uint16Array(a.length),e.iblines.set(a))}},94549:(e,t,i)=>{"use strict";function n(){let e,t,i,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=0;const s=[],a=[];let l,c,h,u;const d=r.timeSlice||15,f=r.sliceDelay||0,p=r.delay??-1;function m(e){o&&clearTimeout(o),o=0,i=e,s.length=0,a.length=0,l=null,c=-1,h=0,u=0}function g(){o=0;const r=performance.now()+d;for(;performance.now()<r;){var l;if(!x())return m(null),void(null===(l=t)||void 0===l||l());e(a[u],s[h],n,u+1>=a.length,!i||c>=i.length)}o=setTimeout((()=>g()),f)}function v(){if(i&&c<i.length)for(;++c<i.length;){if(l=i[c].getInstanceTree(),s.length=0,l)l.enumNodeChildren(i[c].getRootId(),(function(e){s.push(e)}),!0);else{var e;const t=i[c].getFragmentList();null!=t&&null!==(e=t.fragments)&&void 0!==e&&e.dbId2fragId&&s.push(...Object.keys(t.fragments.dbId2fragId).map((e=>parseInt(e))))}if(s.length>0)return n=i[c],n}return n=null,!1}function y(e){if(l)return!l.isNodeHidden(e)&&!l.isNodeOff(e);return!i[c].getFragmentList().dbIdIsGhosted[e]}function b(){if(h>=s.length)return!1;for(;++h<s.length;){const e=s[h];if(r.includeHidden||y(e)){a.length=0;const t=i[c].getFragmentList();if(l)l.enumNodeFragments(e,(function(e){t.isFragVisible(e)&&a.push(e)}),!1);else if(t){let i=t.fragments.dbId2fragId[e];Array.isArray(i)||(i=[i]),i=i.filter((e=>t.isFragVisible(e))),a.push(...i)}if(a.length>0)return!0}}return!1}function x(){if(++u<a.length)return!0;for(u=0;;){if(b())return!0;if(!v())return!1;h=-1}}this.start=function(i,n,r){Array.isArray(i)||(i=[i]),m(i),e=n,t=r,n&&(p>=0?o=setTimeout((()=>g()),p):g())},this.stop=function(){m(null)}}i.r(t),i.d(t,{FragmentIterator:()=>n})},54561:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FragmentList:()=>b,FragmentPointer:()=>x});var n=i(72091),r=i(68747),o=i(83081),s=i(10149),a=i(81760),l=new Uint32Array(1);function c(e){var t;this.geometry=e,this.vb=e.vb.buffer,this.stride=e.vbstride,this.vbi=new Int32Array(this.vb),this.vbs=new Uint16Array(this.vb),this.vcount=this.vbi.length/this.stride,this.useCompactBuffers=e.unpackXform,this.texData=this.useCompactBuffers&&(null===(t=e.tIdColor)||void 0===t||null===(t=t.image)||void 0===t?void 0:t.data)&&new Uint32Array(e.tIdColor.image.data.buffer),this.texColMap=(()=>{if(!this.texData)return null;const e={},t=new Set;for(let i=0;i<this.vcount;++i){const n=this.vbs[i*this.stride*2+6];t.has(n)||(e[this.texData[n]]=n,t.add(n))}return e})()}c.prototype.setColorAt=function(e,t){if(this.texData){if(n=t,l[0]=n,!((t=l[0])in this.texColMap)){const e=this.texData;if(e.length+1>65536)return void o.logger.warn("setColorAt() cannot add new color as size limit reached");const n=new Uint32Array(e.length+1);n.set(e,0),n[e.length]=t,this.texColMap[t]=e.length;var i=new THREE.DataTexture(new Uint8Array(n.buffer),n.length,1,THREE.RGBAFormat,THREE.UnsignedByteType,THREE.UVMapping,THREE.ClampToEdgeWrapping,THREE.ClampToEdgeWrapping,THREE.NearestFilter,THREE.NearestFilter,0);i.generateMipmaps=!1,i.flipY=!1,i.needsUpdate=!0,this.geometry.tIdColor.dispose(),this.geometry.tIdColor=i,this.texData=new Uint32Array(i.image.data.buffer),this.geometry.vIdColorTexSize=new THREE.Vector2(n.length,1)}this.vbs[e*this.stride*2+6]=this.texColMap[t]}else this.vbi[e*this.stride+6]=t;var n},c.prototype.setVertexFlagsAt=function(e,t){this.texData?this.vbi[e*this.stride+4]=t:this.vbi[e*this.stride+8]=t};const h=new n.Matrix4,u=new n.Box3,d=new n.Quaternion,f=new n.Vector3,p=new n.Vector3,m=new n.Vector4(0,0,0,0),g=new n.Matrix4,v=new n.Color,y=new n.Color;class b{is2d;modelId;fragments;geoms;isFixedSize;vizflags;useThreeMesh;vizMeshes;allVisible=!0;allVisibleDirty=!0;vizflagsDirty=!0;linesHidden=!1;pointsHidden=!1;matrix=null;viewBounds=null;materialmap={};materialIdMap={};nextMaterialId=1;materialIdMapOriginal=null;db2ThemingColor=[];originalColors=[];themingOrGhostingNeedsUpdate={};themingOrGhostingNeedsUpdateByDbId={};dbIdOpacity=[];themeingOrGhostingIsDirty=!0;dbIdIsGhosted=[];animxforms=null;nextAvailableFragID;meshSetCallbacks=[];transformChangedCallbacks=[];materialChangedCallbacks=[];objectFlagsChangedCallbacks=[];themingColorChangedCallbacks=[];visibilityDirtyCallbacks=[];constructor(e,t,i,n,r,o){var a;this.is2d=o.is2d,this.modelId=i,this.fragments=e,this.geoms=t,this.isFixedSize=this.fragments.length>0,this.isFixedSize?(this.boxes=this.fragments.boxes,this.transforms=this.fragments.transforms,this.useThreeMesh=!1):(this.boxes=null,this.transforms=null,this.useThreeMesh=!0);const l=this.fragments.length;this.vizflags=new Uint16Array(l),this.useThreeMesh&&(this.vizmeshes=new Array(l)),o.isOTG?(this.materialids=(0,s.z)(l,n),this.geomids=(0,s.z)(l,r)):(this.geomids=new Int32Array(l),this.materialids=new Int32Array(l)),!o.isOTG&&null!==(a=this.fragments)&&void 0!==a&&a.visibilityFlags?this.vizflags.set(this.fragments.visibilityFlags):this.vizflags.fill(1),this.vizflagsDirty=!0,this.nextAvailableFragID=l}getNextAvailableFragmentId(){return this.nextAvailableFragID++}fragmentsHaveBeenAdded(){return this.vizflags.length>this.fragments.length}getSvfMaterialId(e){var t=this.getMaterial(e);return t?t.svfMatId:void 0}setMesh(e,t,i,s){if(this.vizmeshes){const t=this.vizmeshes[e];t&&t.parent&&t.parent.remove(t)}if(this.vizflags.length<=e){this.isFixedSize&&(o.logger.warn("Attempting to resize a fragments list that was initialized with fixed data. This will have a performance impact."),this.isFixedSize=!1);let t=Math.ceil(1.5*Math.max(this.vizflags.length,e))||1;this.useThreeMesh&&t<this.vizmeshes.length&&(t=this.vizmeshes.length);const i=new Uint16Array(t);if(i.set(this.vizflags),this.vizflags=i,this.transforms){const e=new Float32Array(12*t);e.set(this.transforms),this.transforms=e}if(this.boxes){const e=new Float32Array(6*t);e.set(this.boxes),this.boxes=e}if(this.geomids){const e=new Int32Array(t);e.set(this.geomids),this.geomids=e}if(this.materialids){const e=new Int32Array(t);e.set(this.materialids),this.materialids=e}}if(this.useThreeMesh){let i;s&&t instanceof n.Mesh?(i=t,t.matrix&&i.matrixWorld.copy(t.matrix),i.dbId=i.dbId||0):(i=new n.Mesh(t.geometry,t.material),t.matrix&&(i.matrix&&i.matrix.copy(t.matrix),i.matrixWorld.copy(t.matrix)),i.is2d=t.is2d,i.isLine=t.isLine,i.isWideLine=t.isWideLine,i.isPoint=t.isPoint,i.dbId=0|this.fragments.fragId2dbId[e]),i.matrixAutoUpdate=!1,i.frustumCulled=!1,i.fragId=e,i.modelId=this.modelId,this.matrix&&i.matrixWorld.multiplyMatrices(this.matrix,i.matrix),this.vizmeshes[e]=i}else{let i;t.geometry.hash?(void 0===t.geomId&&console.error("meshInfo must provide geomId"),i=t.geomId):i=t.geometry.svfid,this.geomids[e]=i,this.setMaterial(e,t.material)}let a=0;if(t.isLine?a=r.MeshFlags.MESH_ISLINE:t.isWideLine?a=r.MeshFlags.MESH_ISWIDELINE:t.isPoint&&(a=r.MeshFlags.MESH_ISPOINT),this.isFixedSize?this.vizflags[e]|=a:this.vizflags[e]|=r.MeshFlags.MESH_VISIBLE|a,this.vizflagsDirty=!0,i&&this.transforms&&this.boxes){const i=t.matrix,n=12*e,r=i.elements,o=this.transforms;if(o[n]=r[0],o[n+1]=r[1],o[n+2]=r[2],o[n+3]=r[4],o[n+4]=r[5],o[n+5]=r[6],o[n+6]=r[8],o[n+7]=r[9],o[n+8]=r[10],o[n+9]=r[12],o[n+10]=r[13],o[n+11]=r[14],!this.fragments.boxesLoaded){t.bbox?u.copy(t.bbox):(t.geometry&&t.geometry.boundingBox?u.copy(t.geometry.boundingBox):this.geoms.getModelBox(this.geomids[e],u),u.isEmpty()||u.applyMatrix4(i));const n=6*e,r=this.boxes;r[n]=u.min.x,r[n+1]=u.min.y,r[n+2]=u.min.z,r[n+3]=u.max.x,r[n+4]=u.max.y,r[n+5]=u.max.z}}this.#w(e);for(const t of this.meshSetCallbacks)t(e)}isFlagSet(e,t){return!!(this.vizflags[e]&t)}setFlagFragment(e,t,i){var n=this.vizflags[e];return!!(n&t)!=i&&(this.vizflags[e]=i?n|t:n&~t,this.vizflagsDirty=!0,!0)}setFlagGlobal(e,t){var i=this.vizflags,n=0,r=i.length;if(t)for(;n<r;n++)i[n]=i[n]|e;else for(var o=~e;n<r;n++)i[n]=i[n]&o;this.vizflagsDirty=!0}hideLines(e){if(e!==this.linesHidden)for(const e of this.visibilityDirtyCallbacks)e();this.linesHidden=e}hidePoints(e){if(e!==this.pointsHidden)for(const e of this.visibilityDirtyCallbacks)e();this.pointsHidden=e}hideFragments(e,t){var i=r.MeshFlags.MESH_HIDE,n=this.vizflags,o=0,s=n.length;if(t)for(;o<s;o++)n[o]&e&&(n[o]=n[o]|i);else for(var a=~i;o<s;o++)n[o]&e&&(n[o]=n[o]&a);this.allVisibleDirty=!0,this.vizflagsDirty=!0;for(const e of this.visibilityDirtyCallbacks)e()}isFragVisible(e){var t=this.linesHidden&&(this.isLine(e)||this.isWideLine(e)),i=this.pointsHidden&&this.isPoint(e);return!!(3&this.vizflags[e])&&!t&&!i}isFragOff(e){return!!(this.vizflags[e]&r.MeshFlags.MESH_HIDE)}isVisible(e){return!!(this.vizflags[e]&r.MeshFlags.MESH_VISIBLE)}isNotLoaded(e){return!!(this.vizflags[e]&r.MeshFlags.MESH_NOTLOADED)}isLine(e){return!!(this.vizflags[e]&r.MeshFlags.MESH_ISLINE)}isWideLine(e){return this.isFlagSet(e,r.MeshFlags.MESH_ISWIDELINE)}isPoint(e){return this.isFlagSet(e,r.MeshFlags.MESH_ISPOINT)}unload(e,t){if(this.useThreeMesh)return 0;let i=0;for(const n of e)this.setFlagFragment(n,r.MeshFlags.MESH_NOTLOADED,!0)&&(this.setFragOff(n,!0),this.geoms.removeInstance(this.geomids[n],t),++i);return i}areAllVisible(){if(this.allVisibleDirty){for(var e=this.vizflags,t=!0,i=0,n=e.length;i<n;i++)if(!(1&e[i]&&4&~e[i])){t=!1;break}this.allVisible=t,this.allVisibleDirty=!1}return this.allVisible}vizFlagsChanged(){const e=this.vizflagsDirty;return this.vizflagsDirty=!1,e}themeingOrGhostingChanged(){const e=this.themeingOrGhostingIsDirty;return this.themeingOrGhostingIsDirty=!1,e}static#T(e){const t=e.r;return e.r=e.b,e.b=t,e}#M(e,t){return v.set(16777215&e),b.#T(v),t&&(y.setRGB(t.x,t.y,t.z),v.lerp(y,t.w)),b.#T(v).getHex()|4278190080&e}#C(e){var t=this.originalColors[e],i=this.getGeometry(e);if(!i.vb)return void console.error("Unexpected non-interleaved vertex buffer");const n=new a.VertexBufferReader(i),r=new c(i);if(n.isInterleavedVb){for(var o=!1,s=n.vcount,l=0;l<s;l++){var h=n.getDbIdAt(l),u=t?t[l]:n.getColorAt(l),d=n.getLayerIndexAt(l),f=-1===(h=h<<8>>8)&&0===d,p=this.db2ThemingColor[h],m=0===this.dbIdOpacity[h];if(p||m){if(!t){t=new Uint32Array(s);for(var g=0;g<s;g++)t[g]=n.getColorAt(g);this.originalColors[e]=t}u=m?0:this.#M(u,p),o=!0}else t&&(u=t[l]);if(!m){let e=this.dbIdOpacity[h];if(!isNaN(e)){e=255*e<<24,u=u&parseInt("00FFFFFF",16)|e}}r.setColorAt(l,u);var v=this.dbIdIsGhosted[h]&&!f,y=n.getVertexFlagsAt(l);v?y|=255<<24:y&=16777215,r.setVertexFlagsAt(l,y)}o||(this.originalColors[e]=null),i.vbNeedsUpdate=!0}}#P(e){this.themingOrGhostingNeedsUpdate[e]&&(this.#C(e),this.themingOrGhostingNeedsUpdate[e]=!1)}#w(e){if(this.is2d&&!function(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(this.themingOrGhostingNeedsUpdateByDbId)){let t=this.getDbIds(e);t=Array.isArray(t)?t:[t],t=t.filter((e=>this.themingOrGhostingNeedsUpdateByDbId[e])),t.length&&(this.#C(e),t.forEach((e=>{delete this.themingOrGhostingNeedsUpdateByDbId[e]})))}}getVizmesh(e){if(this.is2d&&this.#P(e),this.useThreeMesh){const t=this.vizmeshes[e];return t&&(t.themingColor=this.db2ThemingColor[t.dbId]),t}const t=this.scratchMesh=this.scratchMesh||function(){var e=new n.Mesh;return e.isTemp=!0,e.dbId=0,e.modelId=0,e.fragId=-1,e.hide=!1,e.isLine=!1,e.isWideLine=!1,e.isPoint=!1,e.frustumCulled=!1,e}();return t.geometry=this.getGeometry(e),t.material=this.getMaterial(e),t.dbId=this.getDbIds(e),t.modelId=this.modelId,t.fragId=e,t.visible=!0,t.isLine=this.isLine(e),t.isWideLine=this.isWideLine(e),t.isPoint=this.isPoint(e),t.hide=this.isFragOff(e),t.themingColor=this.db2ThemingColor[t.dbId],this.getWorldMatrix(e,t.matrixWorld),t}getMaterialId(e){var t=this.getMaterial(e);return t?t.id:0}getMaterial(e){return this.useThreeMesh?this.vizmeshes[e].material:this.materialIdMap[this.materialids[e]]}storeOriginalMaterials(){let e,t;this.materialIdMapOriginal=[];for(let i=0;i<this.fragments.length;i++)e=this.getMaterial(i),t=e.id,this.materialIdMapOriginal.push(t)}restoreOriginalMaterials(){if(!this.materialIdMapOriginal)return;let e;for(let t=0;t<this.materialIdMapOriginal.length;t++)e=this.materialIdMapOriginal[t],this.setMaterial(t,this.materialIdMap[this.materialmap[e]])}getGeometry(e){var t;return this.useThreeMesh?(t=this.vizmeshes[e])?t.geometry:null:this.geoms.getGeometry(this.geomids[e])}hasGeometry(e){var t;return this.useThreeMesh?!!(t=this.vizmeshes[e])&&!!t.geometry:this.geoms.hasGeometry(this.geomids[e])}getGeometryId(e){return this.useThreeMesh?e:this.geomids[e]}setMaterial(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.useThreeMesh)this.vizmeshes[e].material=t;else{var n=this.materialmap[t.id];n||(n=this.nextMaterialId++,this.materialids=(0,s.i)(this.materialids,n),this.materialIdMap[n]=t,this.materialmap[t.id]=n),this.materialids[e]=n}for(const n of this.materialChangedCallbacks)n(e,t,i)}getCount(){return this.vizmeshes?this.vizmeshes.length:this.vizflags.length}getDbIds(e){return this.fragments.fragId2dbId[e]}setObjectFlagsCB=function(e){this.objectFlagsCB=e;for(const e of this.objectFlagsChangedCallbacks)e()};getThemingColor(e){return this.db2ThemingColor[this.fragments.fragId2dbId[e]]}dispose(){if(this.useThreeMesh)for(var e={type:"dispose"},t={type:"removed"},i=0;i<this.vizmeshes.length;i++){var n=this.vizmeshes[i];n&&(n.dispatchEvent(t),n.geometry.dispatchEvent(e))}else this.geoms.dispose()}dtor(e){this.dispose(),this.scratchMesh=null,this.fragments=null,this.geoms.dtor(e),this.geoms=null,this.boxes=null,this.transforms=null,this.vizflags=null,this.vizmeshes=null,this.geomids=null,this.materialids=null,this.materialmap=null,this.materialIdMap=null,this.db2ThemingColor=null,this.originalColors=null,this.themingOrGhostingNeedsUpdate=null,this.themingOrGhostingNeedsUpdateByDbId=null,this.dbIdOpacity=null,this.dbIdIsGhosted=null,this.animxforms=null,this.matrix=null,this.viewBounds=null}setVisibility(e,t){const i=this.setFlagFragment(e,r.MeshFlags.MESH_VISIBLE,t);if(i){this.allVisibleDirty=!0;for(const e of this.visibilityDirtyCallbacks)e()}return i}setFragOff(e,t){const i=this.setFlagFragment(e,r.MeshFlags.MESH_HIDE,t);if(i){this.allVisibleDirty=!0;for(const e of this.visibilityDirtyCallbacks)e()}return i}setAllVisibility(e){if(this.is2d){var t=this.fragments;if(t&&t.dbId2fragId)for(var i in t.dbId2fragId)this.setObject2DGhosted(parseInt(i),!e)}else this.setFlagGlobal(r.MeshFlags.MESH_VISIBLE,e);if(this.allVisible!==e)for(const e of this.visibilityDirtyCallbacks)e();this.allVisible=e,this.allVisibleDirty=!1}updateAnimTransform(e,t,i,n){var o,s=this.animxforms;if(!s){var a=this.getCount();s=this.animxforms=new Float32Array(10*a);for(var l=0;l<a;l++)s[o=10*l]=1,s[o+1]=1,s[o+2]=1,s[o+3]=0,s[o+4]=0,s[o+5]=0,s[o+6]=1,s[o+7]=0,s[o+8]=0,s[o+9]=0}o=10*e;var c=!1;t&&(s[o]=t.x,s[o+1]=t.y,s[o+2]=t.z,c=!0),i&&(s[o+3]=i.x,s[o+4]=i.y,s[o+5]=i.z,s[o+6]=i.w,c=!0),n&&(s[o+7]=n.x,s[o+8]=n.y,s[o+9]=n.z,c=!0),this.setFlagFragment(e,r.MeshFlags.MESH_MOVED,c),c||(s[o]=1,s[o+1]=1,s[o+2]=1,s[o+3]=0,s[o+4]=0,s[o+5]=0,s[o+6]=1,s[o+7]=0,s[o+8]=0,s[o+9]=0);for(const t of this.transformChangedCallbacks)t(e)}getAnimTransform(e,t,i,n){if(!this.animxforms)return!1;if(!this.isFlagSet(e,r.MeshFlags.MESH_MOVED))return!1;var o=10*e,s=this.animxforms;return t&&(t.x=s[o],t.y=s[o+1],t.z=s[o+2]),i&&(i.x=s[o+3],i.y=s[o+4],i.z=s[o+5],i.w=s[o+6]),n&&(n.x=s[o+7],n.y=s[o+8],n.z=s[o+9]),!0}getOriginalWorldMatrix(e,t){var i=12*e,n=t.elements,r=this.transforms;if(r)n[0]=r[i],n[1]=r[i+1],n[2]=r[i+2],n[3]=0,n[4]=r[i+3],n[5]=r[i+4],n[6]=r[i+5],n[7]=0,n[8]=r[i+6],n[9]=r[i+7],n[10]=r[i+8],n[11]=0,n[12]=r[i+9],n[13]=r[i+10],n[14]=r[i+11],n[15]=1;else if(this.useThreeMesh){var o=this.vizmeshes[e];o?t.copy(o.matrix):t.identity()}else t.identity()}getWorldMatrix(e,t){this.getOriginalWorldMatrix(e,t),this.isFlagSet(e,r.MeshFlags.MESH_MOVED)&&(this.getAnimTransform(e,p,d,f),g.compose(f,d,p),t.multiplyMatrices(g,t)),this.matrix&&t.multiplyMatrices(this.matrix,t)}setModelMatrix(e){e?(this.matrix=this.matrix||new n.Matrix4,this.matrix.copy(e),this.useThreeMesh&&this.vizmeshes.forEach((e=>{e.matrixWorld.multiplyMatrices(this.matrix,e.matrix)}))):(this.matrix=null,this.useThreeMesh&&this.vizmeshes.forEach((e=>{e.matrixWorld.copy(e.matrix)}))),this.invMatrix=null}getInverseModelMatrix(){return this.matrix?(this.invMatrix||(this.invMatrix=this.matrix.clone().invert()),this.invMatrix):null}getWorldBounds(e,t){if(this.boxes&&!this.isFlagSet(e,r.MeshFlags.MESH_MOVED)){var i=this.boxes,n=6*e;return t.min.x=i[n],t.min.y=i[n+1],t.min.z=i[n+2],t.max.x=i[n+3],t.max.y=i[n+4],t.max.z=i[n+5],void(this.matrix&&t.applyMatrix4(this.matrix))}if(this.useThreeMesh){var o=this.vizmeshes[e];o&&o.geometry&&t.copy(o.geometry.boundingBox)}else this.geoms.getModelBox(this.geomids[e],t);this.viewBounds&&t.intersect(this.viewBounds),t.isEmpty()?t.makeEmpty():(this.getWorldMatrix(e,h),t.applyMatrix4(h))}getOriginalWorldBounds(e,t){if(this.boxes){var i=this.boxes,n=6*e;return t[0]=i[n],t[1]=i[n+1],t[2]=i[n+2],t[3]=i[n+3],t[4]=i[n+4],void(t[5]=i[n+5])}if(this.useThreeMesh){var r=this.vizmeshes[e];r&&r.geometry&&u.copy(r.geometry.boundingBox)}else this.geoms.getModelBox(this.geomids[e],u);u.isEmpty()||(this.getOriginalWorldMatrix(e,h),u.applyMatrix4(h)),t[0]=u.min.x,t[1]=u.min.y,t[2]=u.min.z,t[3]=u.max.x,t[4]=u.max.y,t[5]=u.max.z}#D(e){if(this.is2d){var t=this.fragments.dbId2fragId[e];if(Array.isArray(t))for(var i=0;i<t.length;i++)this.themingOrGhostingNeedsUpdate[t[i]]=!0;else"number"==typeof t?this.themingOrGhostingNeedsUpdate[t]=!0:this.themingOrGhostingNeedsUpdateByDbId[e]=!0;this.themeingOrGhostingIsDirty=!0}}setThemingColor(e,t){var i=this.db2ThemingColor[e];if(!(i===t||i&&t&&i.equals(t))&&(this.db2ThemingColor[e]=t||void 0,this.#D(e),this.themeingOrGhostingIsDirty=!0,this.themingColorChangedCallbacks.length)){t||(t=m);const i=this.fragments.dbId2fragId[e];if(Array.isArray(i))for(const e of i)for(const i of this.themingColorChangedCallbacks)i(e,t);else if("number"==typeof i)for(const e of this.themingColorChangedCallbacks)e(i,t)}}clearThemingColors(){if(this.is2d){for(var e in this.fragments.dbId2fragId)this.#D(parseInt(e));delete this.db2ThemingColor[-1]}this.db2ThemingColor.length=0,this.themeingOrGhostingIsDirty=!0}setObject2DGhosted(e,t){!!t!=!!this.dbIdIsGhosted[e]&&(this.dbIdIsGhosted[e]=t,this.#D(e))}setObject2DOpacity(e,t){t!==this.dbIdOpacity[e]&&(this.dbIdOpacity[e]=t,this.#D(e))}setObject2DVisible(e,t){t!==(0!==this.dbIdOpacity[e])&&(this.dbIdOpacity[e]=0|t,this.#D(e))}getViewBounds(){return this.viewBounds}setViewBounds(e){e?(this.viewBounds=this.viewBounds||new n.Box3,this.viewBounds.copy(e),Object.prototype.hasOwnProperty.call(e.max,"z")||(this.viewBounds.max.z=1/0,this.viewBounds.min.z=-1/0)):this.viewBounds=null}getDoNotCut(){return this.doNotCut}setDoNotCut(e){this.doNotCut=e}registerMeshSetCallback(e){this.meshSetCallbacks.push(e)}removeMeshSetCallback(e){const t=this.meshSetCallbacks.indexOf(e);-1!==t&&this.meshSetCallbacks.splice(t,1)}registerTransformChangedCallback(e){this.transformChangedCallbacks.push(e)}removeTransformChangedCallback(e){const t=this.transformChangedCallbacks.indexOf(e);-1!==t&&this.transformChangedCallbacks.splice(t,1)}registerMaterialChangedCallback(e){this.materialChangedCallbacks.push(e)}removeMaterialChangedCallback(e){const t=this.materialChangedCallbacks.indexOf(e);-1!==t&&this.materialChangedCallbacks.splice(t,1)}registerObjectFlagsChangedCallback(e){this.objectFlagsChangedCallbacks.push(e)}removeObjectFlagsChangedCallback(e){const t=this.objectFlagsChangedCallbacks.indexOf(e);-1!==t&&this.objectFlagsChangedCallbacks.splice(t,1)}registerThemingColorChangedCallback(e){this.themingColorChangedCallbacks.push(e)}removeThemingColorChangedCallback(e){const t=this.themingColorChangedCallbacks.indexOf(e);-1!==t&&this.themingColorChangedCallbacks.splice(t,1)}registerVisibilityDirtyCallback(e){this.visibilityDirtyCallbacks.push(e)}removeVisibilityDirtyCallback(e){const t=this.visibilityDirtyCallbacks.indexOf(e);-1!==t&&this.visibilityDirtyCallbacks.splice(t,1)}}class x{frags;fragId;scale=null;quaternion=null;position=null;constructor(e,t){this.frags=e,this.fragId=t}getWorldMatrix(e){this.frags.getWorldMatrix(this.fragId,e)}getOriginalWorldMatrix(e){this.frags.getOriginalWorldMatrix(this.fragId,e)}getWorldBounds(e){return this.frags.getWorldBounds(this.fragId,e)}getAnimTransform(){return this.scale||(this.scale=new n.Vector3(1,1,1),this.quaternion=new n.Quaternion(0,0,0,1),this.position=new n.Vector3(0,0,0)),this.frags.getAnimTransform(this.fragId,this.scale,this.quaternion,this.position)}updateAnimTransform(){this.scale||(this.scale=new n.Vector3(1,1,1),this.quaternion=new n.Quaternion(0,0,0,1),this.position=new n.Vector3(0,0,0)),this.frags.updateAnimTransform(this.fragId,this.scale,this.quaternion,this.position)}getMaterial(){return this.frags.getMaterial(this.fragId)}setMaterial(e){return this.frags.setMaterial(this.fragId,e)}}},4897:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CONTAINMENT_UNKNOWN:()=>c,CONTAINS:()=>l,FrustumIntersector:()=>o,INTERSECTS:()=>a,OUTSIDE:()=>s});var n=i(72091),r=[[1,5,4,7,3,2,6],[0,3,2,1,5,4,6],[0,3,2,6,5,4,6],[0,4,7,3,2,1,6],[0,3,2,1,-1,-1,4],[0,3,2,6,5,1,6],[0,4,7,6,2,1,6],[0,3,7,6,2,1,6],[0,3,7,6,5,1,6],[0,1,5,4,7,3,6],[0,1,5,4,-1,-1,4],[0,1,2,6,5,4,6],[0,4,7,3,-1,-1,4],[-1,-1,-1,-1,-1,-1,0],[1,2,6,5,-1,-1,4],[0,4,7,6,2,3,6],[2,3,7,6,-1,-1,4],[1,2,3,7,6,5,6],[0,1,5,6,7,3,6],[0,1,5,6,7,4,6],[0,1,2,6,7,4,6],[0,4,5,6,7,3,6],[4,5,6,7,-1,-1,4],[1,2,6,7,4,5,6],[0,4,5,6,2,3,6],[2,3,7,4,5,6,6],[1,2,3,7,4,5,6]];function o(){this.frustum=new n.Frustum,this.viewProj=new n.Matrix4,this.viewDir=[0,0,1],this.ar=1,this.viewport=new n.Vector3(1,1,1),this.areaConv=1,this.areaCullThreshold=1,this.eye=new n.Vector3,this.perspective=!1,this.projScale=1}const s=0,a=1,l=2,c=-1;var h,u;function d(e,t,i){return i.x=1&t?e.max.x:e.min.x,i.y=2&t?e.max.y:e.min.y,i.z=4&t?e.max.z:e.min.z,i}o.OUTSIDE=s,o.INTERSECTS=a,o.CONTAINS=l,o.CONTAINMENT_UNKNOWN=c,o.prototype.reset=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.viewProj.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this.perspective=e.isPerspective,this.frustum.setFromProjectionMatrix(this.viewProj);var r=e.matrixWorldInverse.elements;this.ar=e.aspect,this.viewDir[0]=-r[2],this.viewDir[1]=-r[6],this.viewDir[2]=-r[10],this.eye.x=e.position.x,this.eye.y=e.position.y,this.eye.z=e.position.z,this.areaConv=e.clientWidth*e.clientHeight/4,this.cutPlanes=t,this.cutplanesHideInterior=i,this.perspective?this.projScale=e.clientHeight/(2*Math.tan(n.Math.degToRad(e.fov/2))):this.projScale=e.clientHeight/e.orthoScale},o.prototype.projectedArea=function(){var e=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3],t=new n.Box2;function i(e,t){var i=e.x,n=e.y,r=e.z,o=t.elements,s=o[3]*i+o[7]*n+o[11]*r+o[15];s<0&&(s=-s);var a=1/s;e.x=(o[0]*i+o[4]*n+o[8]*r+o[12])*a,e.y=(o[1]*i+o[5]*n+o[9]*r+o[13])*a}return function(n){if(n.isEmpty())return 0;var r=this.viewProj;e[0].set(n.min.x,n.min.y,n.min.z),e[1].set(n.min.x,n.min.y,n.max.z),e[2].set(n.min.x,n.max.y,n.min.z),e[3].set(n.min.x,n.max.y,n.max.z),e[4].set(n.max.x,n.min.y,n.min.z),e[5].set(n.max.x,n.min.y,n.max.z),e[6].set(n.max.x,n.max.y,n.min.z),e[7].set(n.max.x,n.max.y,n.max.z);for(var o=0;o<8;o++)i(e[o],r);return t.makeEmpty(),t.setFromPoints(e),t.min.x<-1&&(t.min.x=-1),t.min.x>1&&(t.min.x=1),t.min.y<-1&&(t.min.y=-1),t.min.y>1&&(t.min.y=1),t.max.x>1&&(t.max.x=1),t.max.x<-1&&(t.max.x=-1),t.max.y>1&&(t.max.y=1),t.max.y<-1&&(t.max.y=-1),(t.max.x-t.min.x)*(t.max.y-t.min.y)}}(),o.prototype.projectedBoxArea=function(){for(var e,t=[],i=[],o=0;o<10;o++)t.push(new n.Vector3),i.push(new n.Vector3);function s(e,t){var i=e.x,n=e.y,r=e.z,o=t.elements,s=o[3]*i+o[7]*n+o[11]*r+o[15];s<0&&(s=-s);var a=1/s;e.x=(o[0]*i+o[4]*n+o[8]*r+o[12])*a,e.y=(o[1]*i+o[5]*n+o[9]*r+o[13])*a}return function(n,o){if(n.isEmpty())return 0;var a,l=this.viewProj;if(this.perspective?(a=this.eye.x>=n.min.x?this.eye.x>n.max.x?2:1:0,this.eye.y>=n.min.y&&(a+=this.eye.y>n.max.y?6:3),this.eye.z>=n.min.z&&(a+=this.eye.z>n.max.z?18:9)):(a=this.viewDir[0]<=0?this.viewDir[0]<0?2:1:0,this.viewDir[1]<=0&&(a+=this.viewDir[1]<0?6:3),this.viewDir[2]<=0&&(a+=this.viewDir[2]<0?18:9)),13===a)return 4;var c,h=r[a][6];for(c=0;c<h;c++){var u=r[a][c];t[c].set((u+1)%4<2?n.min.x:n.max.x,u%4<2?n.min.y:n.max.y,u<4?n.min.z:n.max.z),s(t[c],l)}var d=0;if(o)for(d=(t[h-1].x-t[0].x)*(t[h-1].y+t[0].y),c=0;c<h-1;c++)d+=(t[c].x-t[c+1].x)*(t[c].y+t[c+1].y);else{var f=function(t,n){var r,o,s,a,l,c,h,u,d=t,f=i,p=function(e){switch(h){case 0:return e.x>=-1;case 1:return e.x<=1;case 2:return e.y>=-1;case 3:return e.y<=1}},m=function(e){f[u].x=e.x,f[u++].y=e.y},g=function(){var e,t;switch(h){case 0:e=-1,t=o.y+(s.y-o.y)*(e-o.x)/(s.x-o.x);break;case 1:e=1,t=o.y+(s.y-o.y)*(e-o.x)/(s.x-o.x);break;case 2:t=-1,e=o.x+(s.x-o.x)*(t-o.y)/(s.y-o.y);break;case 3:t=1,e=o.x+(s.x-o.x)*(t-o.y)/(s.y-o.y)}f[u].x=e,f[u++].y=t};for(h=0;h<4&&n>2;h++){for(u=0,a=p(o=d[n-1]),c=0;c<n;c++)l=p(s=d[c]),a?l?m(s):g():l&&(g(),m(s)),o=s,a=l;n=u,r=d,d=f,f=r}return e=n,d}(t,h);if(e>=3)for(d=(f[e-1].x-f[0].x)*(f[e-1].y+f[0].y),c=0;c<e-1;c++)d+=(f[c].x-f[c+1].x)*(f[c].y+f[c+1].y)}return Math.abs(.5*d)}}(),o.prototype.estimateDepth=function(e){var t=this.viewProj.elements,i=(e.min.x+e.max.x)/2,n=(e.min.y+e.max.y)/2,r=(e.min.z+e.max.z)/2,o=1/(t[3]*i+t[7]*n+t[11]*r+t[15]);return(t[2]*i+t[6]*n+t[10]*r+t[14])*o},o.prototype.estimateProjectedDiameter=function(e){const t=(e.min.x+e.max.x)/2,i=(e.min.y+e.max.y)/2,n=(e.min.z+e.max.z)/2,r=Math.max(e.max.x-e.min.x,e.max.y-e.min.y,e.max.z-e.min.z);if(this.perspective){const e=(t-this.eye.x)*this.viewDir[0]+(i-this.eye.y)*this.viewDir[1]+(n-this.eye.z)*this.viewDir[2];return r<e?r*this.projScale/e:this.projScale}return r*this.projScale},o.prototype.intersectsBox=(h=new n.Vector3,u=new n.Vector3,function(e){for(var t=this.frustum.planes,i=0,n=0;n<6;n++){var r=t[n];h.x=r.normal.x>0?e.min.x:e.max.x,u.x=r.normal.x>0?e.max.x:e.min.x,h.y=r.normal.y>0?e.min.y:e.max.y,u.y=r.normal.y>0?e.max.y:e.min.y,h.z=r.normal.z>0?e.min.z:e.max.z,u.z=r.normal.z>0?e.max.z:e.min.z;var s=r.distanceToPoint(h),a=r.distanceToPoint(u);if(s<0&&a<0)return o.OUTSIDE;s>0&&a>0&&i++}return 6==i?o.CONTAINS:o.INTERSECTS});var f,p=function(e,t){f||(f=new n.Vector3);for(var i=0;i<8;i++){var r=d(e,i,f);if(s=t,!((o=r).x*s.x+o.y*s.y+o.z*s.z+s.w>1e-6))return!1}var o,s;return!0};let m;o.prototype.boxOutsideCutPlanes=function(e){if(this.cutplanesHideInterior||!this.cutPlanes)return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];m||(m=new n.Vector4);let i=0;for(let n=0;n<t.length;n++)m.copy(t[n]).negate(),p(e,m)&&i++;return t.length>3&&i===t.length}(e,this.cutPlanes);for(var t=0;t<this.cutPlanes.length;t++){var i=this.cutPlanes[t];if(p(e,i))return!0}return!1}},86639:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GeometryList:()=>o});var n=i(72091),r=i(65782);function o(e,t,i,n){this.geoms=[null],this.geomPolyCount=0,this.instancePolyCount=0,this.is2d=t,this.geomBoxes=n?null:new Float32Array(6*Math.max(1,e+1)),this.numObjects=e,this.disableStreaming=!!i,this.instanceCount=[null]}o.prototype._getMemoryStat=function(e){const t=r.MemoryTracker.geomListStats.get(this);return t?t[e]:0},Object.defineProperty(o.prototype,"numGeomsInMemory",{get(){return this._getMemoryStat("geomCount")}}),Object.defineProperty(o.prototype,"geomMemory",{get(){return this._getMemoryStat("geomMemory")}}),Object.defineProperty(o.prototype,"gpuNumMeshes",{get(){return this._getMemoryStat("gpuGeomCount")}}),Object.defineProperty(o.prototype,"gpuMeshMemory",{get(){return this._getMemoryStat("gpuGeomMemory")}}),o.prototype.getGeometry=function(e){return this.geoms[e]},o.prototype.hasGeometry=function(e){return!!this.geoms[e]},o.prototype.getCount=function(){return this.geoms.length},o.prototype._addBbox=function(e,t){if(this.geomBoxes){var i=this.geomBoxes.length/6|0;if(i<this.getCount()){var r=3*this.getCount()/2|0,o=new Float32Array(6*r);o.set(this.geomBoxes);var s=new n.Box3;for(s.makeEmpty();i<r;)o[6*i]=s.min.x,o[6*i+1]=s.min.y,o[6*i+2]=s.min.z,o[6*i+3]=s.max.x,o[6*i+4]=s.max.y,o[6*i+++5]=s.max.z;this.geomBoxes=o}this.geomBoxes[6*e]=t.min.x,this.geomBoxes[6*e+1]=t.min.y,this.geomBoxes[6*e+2]=t.min.z,this.geomBoxes[6*e+3]=t.max.x,this.geomBoxes[6*e+4]=t.max.y,this.geomBoxes[6*e+5]=t.max.z}},o.prototype._getPolygonCount=function(e){const t=e.ib;var i=e.isLines?2:3;return t?t.length/i:e.vb?e.vb.length/(i*e.vbstride):e.attributes.position.array.length/(3*i)},o.prototype.addGeometry=function(e,t,i,n){return e.hash&&e.setModelRefCount(e.modelRefCount+1,n),r.MemoryTracker.trackGeometry(this,e),r.MemoryTracker.setMemoryType(this,e,t),(void 0===i||i<=0)&&(i=this.geoms.length),this.geoms[i]=e,e.boundingBox||e.hash||console.error("Mesh without bbox and without hash should not be."),this._addBbox(i,e.boundingBox),this.is2d||(e.boundingBox=null,e.boundingSphere=null),e.polyCount=this._getPolygonCount(e),this.instanceCount[i]=t||1,this.geomPolyCount+=e.polyCount,this.instancePolyCount+=e.polyCount*this.instanceCount[i],e.svfid=i,i},o.prototype.addInstance=function(e){const t=this.getGeometry(e);t&&(this.instancePolyCount+=t.polyCount||0,++this.instanceCount[e])},o.prototype.removeInstance=function(e,t){const i=this.getGeometry(e);i&&(this.instancePolyCount-=i.polyCount||0,0==--this.instanceCount[e]&&this.removeGeometry(e,t))},o.prototype.getInstanceCount=function(e){return this.instanceCount[e]},o.prototype.removeGeometry=function(e,t){var i=this.getGeometry(e);if(!i)return 0;i.hash?(1===i.modelRefCount&&i.dispose(),i.setModelRefCount(i.modelRefCount-1,t)):i.dispose();const n=r.MemoryTracker.untrackGeometry(this,i);return this.geoms[e]=null,this.geomPolyCount-=i.polyCount,this.instancePolyCount-=this.instanceCount[e]*i.polyCount,this.instanceCount[e]=0,n},o.prototype.getModelBox=function(e,t){if(this.geomBoxes)if(0===e||this.geomBoxes.length/6<=e)t.makeEmpty();else{var i=6*e,n=this.geomBoxes;t.min.x=n[i],t.min.y=n[i+1],t.min.z=n[i+2],t.max.x=n[i+3],t.max.y=n[i+4],t.max.z=n[i+5]}else e>=1&&e<=this.numObjects?(t.min.x=-.5,t.min.y=-.5,t.min.z=-.5,t.max.x=.5,t.max.y=.5,t.max.z=.5):t.makeEmpty()},o.prototype.dispose=function(){let e;for(var t=0,i=this.geoms.length;t<i;t++)e=this.geoms[t],e&&(e.hash?1===e.modelRefCount&&e.dispose():e.dispose())},o.prototype.dtor=function(e){for(var t=1;t<this.geoms.length;t++)this.removeGeometry(t,e);this.geoms=null,this.instanceCount=null,this.geomBoxes=null},o.prototype.printStats=function(){console.log("Total geometry size: "+this.geomMemory/1048576+" MB"),console.log("Number of meshes: "+(this.getCount()-1)),console.log("Num Meshes on GPU: "+this.gpuNumMeshes),console.log("Net GPU geom memory used: "+this.gpuMeshMemory)}},41428:(e,t,i)=>{"use strict";i.r(t),i.d(t,{InstanceTree:()=>l,NODE_TYPE:()=>o});var n=i(63430),r=i(83081);const o={NODE_TYPE_ASSEMBLY:0,NODE_TYPE_INSERT:1,NODE_TYPE_LAYER:2,NODE_TYPE_COLLECTION:3,NODE_TYPE_COMPOSITE:4,NODE_TYPE_MODEL:5,NODE_TYPE_GEOMETRY:6,NODE_TYPE_BITS:7};var s=1073741824,a=2147483648;function l(e,t,i){this.nodeAccess=e,this.maxDepth=i,this.objectCount=t,this.numHidden=0,this.numOff=0,this.fragList=null}l.prototype.dtor=function(){this.nodeAccess.dtor(),this.nodeAccess=null,this.fragList=null},l.prototype.setFlagNode=function(e,t,i){var n=this.nodeAccess.getNodeFlags(e);return!!(n&t)!=i&&(i?this.nodeAccess.setNodeFlags(e,n|t):this.nodeAccess.setNodeFlags(e,n&~t),!0)},l.prototype.setFlagGlobal=function(e,t){var i=this.nodeAccess,n=0,r=i.numNodes;if(t)for(;n<r;n++)i.setNodeFlags(n,i.getNodeFlags(n)|e);else for(var o=~e;n<r;n++)i.setNodeFlags(n,i.getNodeFlags(n)&o)},l.prototype.setNodeOff=function(e,t){var i=this.setFlagNode(e,s,t);return i&&(t?this.numOff++:this.numOff--),i},l.prototype.isNodeOff=function(e){return!!(this.nodeAccess.getNodeFlags(e)&s)},l.prototype.setNodeHidden=function(e,t){var i=this.setFlagNode(e,a,t);return i&&(t?this.numHidden++:this.numHidden--),i},l.prototype.isNodeHidden=function(e){return!!(this.nodeAccess.getNodeFlags(e)&a)},l.prototype.lockNodeSelection=function(e,t){return this.setFlagNode(e,16384,t)},l.prototype.isNodeSelectionLocked=function(e){return!!(16384&this.nodeAccess.getNodeFlags(e))},l.prototype.lockNodeVisible=function(e,t){return this.setFlagNode(e,4096,t)},l.prototype.isNodeVisibleLocked=function(e){return!!(4096&this.nodeAccess.getNodeFlags(e))},l.prototype.isNodeExplodeLocked=function(e){return!!(8192&this.nodeAccess.getNodeFlags(e))},l.prototype.lockNodeExplode=function(e,t){return this.setFlagNode(e,8192,t)},l.prototype.getNodeType=function(e){return this.nodeAccess.getNodeFlags(e)&o.NODE_TYPE_BITS},l.prototype.isNodeSelectable=function(e){return!(536870912&this.nodeAccess.getNodeFlags(e))},l.prototype.getNodeParentId=function(e){return this.nodeAccess.getParentId(e)},l.prototype.getRootId=function(){return this.nodeAccess.rootId},l.prototype.getNodeName=function(e,t){return this.nodeAccess.name(e,t)},l.prototype.getChildCount=function(e){return this.nodeAccess.getNumChildren(e)};var c=new Array(6);l.prototype.getNodeBox=function(e,t){if(!this.nodeAccess.nodeBoxes)return this.fragList?(t[0]=t[1]=t[2]=1/0,t[3]=t[4]=t[5]=-1/0,void this.enumNodeFragments(e,(e=>{this.fragList.getOriginalWorldBounds(e,c),t[0]=Math.min(t[0],c[0]),t[1]=Math.min(t[1],c[1]),t[2]=Math.min(t[2],c[2]),t[3]=Math.max(t[3],c[3]),t[4]=Math.max(t[4],c[4]),t[5]=Math.max(t[5],c[5])}),!0)):void r.logger.error("getNodeBox() requires fragBoxes or nodeBoxes");this.nodeAccess.getNodeBox(e,t)},l.prototype.getNodeIndex=function(e){return this.nodeAccess.getIndex(e)},l.prototype.enumNodeFragments=function(e,t,i){var n;"number"==typeof e?n=e:e&&(n=e.dbId);const r=e=>{var n=this.nodeAccess.enumNodeFragments(e,t);return n||(i&&(n=this.enumNodeChildren(e,(e=>r(e))))?n:void 0)};return r(n)},l.prototype.enumNodeChildren=function(e,t,i){var n;if("number"==typeof e?n=e:e&&(n=e.dbId),i&&t(n))return n;const r=e=>{var n=this.nodeAccess.enumNodeChildren(e,(n=>t(n,e)?n:i?r(n):void 0));if(n)return n};return r(n)},l.prototype.findNodeForSelection=function(e,t){if(t===n.SelectionMode.LEAF_OBJECT)return e;var i,r,s=e;if(t===n.SelectionMode.FIRST_OBJECT){var a=[];for(i=e;i;)a.push(i),i=this.getNodeParentId(i);for(var l=a.length-1;l>=0;l--)if((r=this.getNodeType(a[l]))!==o.NODE_TYPE_MODEL&&r!==o.NODE_TYPE_LAYER&&r!==o.NODE_TYPE_COLLECTION){s=a[l];break}}else if(t===n.SelectionMode.LAST_OBJECT)for(i=e;i;){if((r=this.getNodeType(i))===o.NODE_TYPE_COMPOSITE){s=i;break}i=this.getNodeParentId(i)}return s},l.prototype.setFragmentList=function(e){this.fragList=e},l.prototype.search=function(e){const t=e.toLowerCase();let i=[];return this.enumNodeChildren(this.getRootId(),((e,n)=>{var r;((null===(r=this.getNodeName(e))||void 0===r?void 0:r.toLowerCase())||"").indexOf(t)>-1&&i.push(e)}),!0),i}},65435:(e,t,i)=>{"use strict";i.r(t),i.d(t,{FlatStringStorage:()=>r,InstanceTreeAccess:()=>l,InstanceTreeStorage:()=>s});var n=i(42759);class r{constructor(e){e?(this.buf=e.buf,this.idx=e.idx,this.next=e.next):(this.buf=new Uint8Array(256),this.next=0,this.idx=[0])}allocate(e){if(this.buf.length-this.next<e){var t=Math.max(3*this.buf.length/2,this.buf.length+e),i=new Uint8Array(t);i.set(this.buf),this.buf=i}}add(e){if(null==e)return 0;if(!e.length)return this.idx.push(this.next),this.idx.length-1;var t=(0,n.WC)(e,null);return this.allocate(t),this.next+=(0,n.WC)(e,this.buf,this.next),this.idx.push(this.next),this.idx.length-1}get(e){if(e){var t=this.idx[e-1],i=this.idx[e];return t===i?"":(0,n.jI)(this.buf,t,i-t)}}flatten(){this.idx=a(this.idx)}}var o=5;function s(){this.nodes=[],this.nextNode=0,this.children=[],this.nextChild=0,this.dbIdToIndex={},this.names=[],this.s2i={},this.strings=new r,this.nameSuffixes=[],this.getIndex(0)}function a(e){var t=new Int32Array(e.length);return t.set(e),t}function l(e,t,i){this.nodes=e.nodes,this.children=e.children,this.dbIdToIndex=e.dbIdToIndex,this.names=e.names,this.nameSuffixes=e.nameSuffixes,this.strings=new r(e.strings),this.rootId=t,this.numNodes=this.nodes.length/o,this.visibleIds=null,this.nodeBoxes=i}s.prototype.getIndex=function(e){var t=this.dbIdToIndex[e];if(t)return t;t=this.nextNode++,this.nodes.push(e);for(var i=1;i<o;i++)this.nodes.push(0);return this.dbIdToIndex[e]=t,t},s.prototype.setNode=function(e,t,i,n,r,s){var a,l=this.getIndex(e),c=l*o,h=r.length,u=s&&s.length;for(u&&(h+=s.length),this.nodes[c+1]=t,this.nodes[c+2]=this.nextChild,this.nodes[c+3]=u?-h:h,this.nodes[c+4]=n,a=0;a<r.length;a++)this.children[this.nextChild++]=this.getIndex(r[a]);if(u)for(a=0;a<s.length;a++)this.children[this.nextChild++]=-s[a]-1;this.nextChild>this.children.length&&console.error("Child index out of bounds -- should not happen"),this.processName(l,i)},s.prototype.processName=function(e,t){var i,n,r=-1,o=-1;if(t&&(o=t.lastIndexOf("]"),-1!==(r=t.lastIndexOf("["))&&-1!==o||(r=t.lastIndexOf(":"),o=t.length)),r>=0&&o>r){i=t.slice(0,r+1);var s=t.slice(r+1,o);(n=parseInt(s,10))&&n+""===s||(i=t,n=0)}else i=t,n=0;var a=this.s2i[i];void 0===a&&(a=this.strings.add(i),this.s2i[i]=a),this.names[e]=a,this.nameSuffixes[e]=n},s.prototype.flatten=function(){this.nodes=a(this.nodes),this.children=a(this.children),this.names=a(this.names),this.nameSuffixes=a(this.nameSuffixes),this.strings.flatten(),this.s2i=null},l.prototype.dtor=function(){this.nodes=null,this.children=null,this.dbIdToIndex=null,this.names=null,this.nameSuffixes=null,this.strings=null,this.visibleIds=null,this.nodeBoxes=null},l.prototype.getNumNodes=function(){return this.numNodes},l.prototype.getIndex=function(e){return this.dbIdToIndex[e]},l.prototype.name=function(e,t){var i,n=this.dbIdToIndex[e],r=this.strings.get(this.names[n]),o=this.nameSuffixes[n];o?i="["===r.charAt(r.length-1)?r+o+"]":r+o:i=r;return t&&(this.childCounts||this.computeChildCounts(),this.childCounts[e]>0&&(i+=" ("+this.childCounts[e]+")")),i},l.prototype.getParentId=function(e){var t=this.dbIdToIndex[e];return this.nodes[t*o+1]},l.prototype.getNodeFlags=function(e){var t=this.dbIdToIndex[e];return this.nodes[t*o+4]},l.prototype.setNodeFlags=function(e,t){var i=this.dbIdToIndex[e];i&&(this.nodes[i*o+4]=t)},l.prototype.getNumChildren=function(e){var t=this.dbIdToIndex[e],i=this.nodes[t*o+3];if(i>=0)return i;var n=this.nodes[t*o+2];i=Math.abs(i);for(var r=0,s=0;s<i;s++){if(this.children[n+s]<0)break;r++}return r},l.prototype.getNumFragments=function(e){var t=this.dbIdToIndex[e],i=this.nodes[t*o+3];if(i>=0)return 0;for(var n=this.nodes[t*o+2],r=0,s=(i=Math.abs(i))-1;s>=0;s--){if(this.children[n+s]>=0)break;r++}return r},l.prototype.getNodeBox=function(e,t){for(var i=6*this.getIndex(e),n=0;n<6;n++)t[n]=this.nodeBoxes[i+n]},l.prototype.getVisibleIds=function(){return this.visibleIds||(this.visibleIds=Object.keys(this.dbIdToIndex).map((function(e){return parseInt(e)}))),this.visibleIds},l.prototype.enumNodeChildren=function(e,t){var i=this.dbIdToIndex[e],n=this.nodes[i*o+2],r=this.nodes[i*o+3];r=Math.abs(r);for(var s=0;s<r;s++){var a=this.children[n+s];if(a<0)break;if(t(this.nodes[a*o+0],e,i))return e}},l.prototype.enumNodeFragments=function(e,t){var i=this.dbIdToIndex[e],n=this.nodes[i*o+2],r=this.nodes[i*o+3];if(r<0){r=-r;for(var s=0;s<r;s++){var a=this.children[n+s];if(!(a>0)&&t(-a-1,e,i))return e}}},l.prototype.computeBoxes=function(e){this.nodeBoxes||(this.nodeBoxes=new Float32Array(6*this.numNodes));var t=this,i=t.getIndex(t.rootId),n=t.nodeBoxes;function r(e,i,r){var o=t.getIndex(e);s(e,o);for(var a=6*r,l=6*o,c=0;c<3;c++)n[a+c]>n[l+c]&&(n[a+c]=n[l+c]),n[a+c+3]<n[l+c+3]&&(n[a+c+3]=n[l+c+3])}function o(t,i,r){for(var o=6*t,s=6*r,a=0;a<3;a++)n[s+a]>e[o+a]&&(n[s+a]=e[o+a]),n[s+a+3]<e[o+a+3]&&(n[s+a+3]=e[o+a+3])}function s(e,i){var s=6*i;n[s]=n[s+1]=n[s+2]=1/0,n[s+3]=n[s+4]=n[s+5]=-1/0,t.getNumChildren(e)&&t.enumNodeChildren(e,r,!0),t.getNumFragments(e)&&t.enumNodeFragments(e,o)}s(t.rootId,i)},l.prototype.computeChildCounts=function(){this.childCounts||(this.childCounts={});const e=this,t=e.childCounts;!function i(n){t[n]=0;let r=0;return 4===e.getNodeFlags(n)?r=1:(e.getNumChildren(n)&&e.enumNodeChildren(n,(e=>{t[n]+=i(e)}),!0),e.getNumFragments(n)&&(r=1)),t[n]+r}(e.rootId)},l.prototype.dbIdToIndexFiltered=function(e){const t={},i=this,n=r=>{let o=e(r);return i.enumNodeChildren(r,(e=>{n(e)&&(o=!0)})),o&&(t[r]=i.dbIdToIndex[r]),o};return n(this.rootId),t}},10149:(e,t,i)=>{"use strict";function n(e,t){return t<=255?new Uint8Array(e):t<=65535?new Uint16Array(e):new Uint32Array(e)}function r(e,t){if(t<=255)return e;if(t<=65535&&e instanceof Uint8Array){let t=new Uint16Array(e.length);return t.set(e),t}if(!(e instanceof Uint32Array)){let t=new Uint32Array(e.length);return t.set(e),t}return e}i.d(t,{i:()=>r,z:()=>n})},21706:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LmvBox3:()=>r});var n=i(96118);let r=function(e,t){this.min=void 0!==e?e:new n.LmvVector3(1/0,1/0,1/0),this.max=void 0!==t?t:new n.LmvVector3(-1/0,-1/0,-1/0)};var o,s,a;r.prototype={constructor:r,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromArray:function(e,t){return this.min.x=e[t],this.min.y=e[t+1],this.min.z=e[t+2],this.max.x=e[t+3],this.max.y=e[t+4],this.max.z=e[t+5],this},copyToArray:function(e,t){e[t]=this.min.x,e[t+1]=this.min.y,e[t+2]=this.min.z,e[t+3]=this.max.x,e[t+4]=this.max.y,e[t+5]=this.max.z},setFromCenterAndSize:(a=new n.LmvVector3,function(e,t){var i=a.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},isEmpty:function(){return this.empty()},center:function(e){return console.warn("LmvBox3.center() is deprecated. Use LmvBox3.getCenter() instead."),this.getCenter(e)},getCenter:function(e){return(e||new n.LmvVector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new n.LmvVector3).subVectors(this.max,this.min)},getSize:function(e){return(e||new n.LmvVector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new n.LmvVector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsBox:function(e){return this.isIntersectionBox(e)},clampPoint:function(e,t){return(t||new n.LmvVector3).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n.LmvVector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(o=new n.LmvVector3,s=new n.LmvVector3,function(e){for(var t=e.elements,i=0;i<3;i++){let e=t[12+i],l=e;for(var n=0;n<3;n++){var r=t[i+4*n]*this.min.getComponent(n),a=t[i+4*n]*this.max.getComponent(n);e+=Math.min(r,a),l+=Math.max(r,a)}o.setComponent(i,e),s.setComponent(i,l)}return this.min.copy(o),this.max.copy(s),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}},37365:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LmvMatrix4:()=>r});var n=i(96118);let r=function(e){this.elements=e?new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]):new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.isDoublePrecision=!!e};r.prototype={constructor:r,set:function(e,t,i,n,r,o,s,a,l,c,h,u,d,f,p,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z,o=e.w,s=i+i,a=n+n,l=r+r,c=i*s,h=i*a,u=i*l,d=n*a,f=n*l,p=r*l,m=o*s,g=o*a,v=o*l;return t[0]=1-(d+p),t[4]=h-v,t[8]=u+g,t[1]=h+v,t[5]=1-(c+p),t[9]=f-m,t[2]=u-g,t[6]=f+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},multiply:function(e){return this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,o=i[0],s=i[4],a=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],_=n[0],E=n[4],S=n[8],A=n[12],w=n[1],T=n[5],M=n[9],C=n[13],P=n[2],D=n[6],L=n[10],I=n[14],R=n[3],O=n[7],N=n[11],F=n[15];return r[0]=o*_+s*w+a*P+l*R,r[4]=o*E+s*T+a*D+l*O,r[8]=o*S+s*M+a*L+l*N,r[12]=o*A+s*C+a*I+l*F,r[1]=c*_+h*w+u*P+d*R,r[5]=c*E+h*T+u*D+d*O,r[9]=c*S+h*M+u*L+d*N,r[13]=c*A+h*C+u*I+d*F,r[2]=f*_+p*w+m*P+g*R,r[6]=f*E+p*T+m*D+g*O,r[10]=f*S+p*M+m*L+g*N,r[14]=f*A+p*C+m*I+g*F,r[3]=v*_+y*w+b*P+x*R,r[7]=v*E+y*T+b*D+x*O,r[11]=v*S+y*M+b*L+x*N,r[15]=v*A+y*C+b*I+x*F,this},multiplyToArray:function(e,t,i){var n=this.elements;return this.multiplyMatrices(e,t),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],o=e[1],s=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-n*l*h-r*s*u+i*l*u+n*s*d-i*a*d)+e[7]*(+t*a*d-t*l*u+r*o*u-n*o*d+n*l*c-r*a*c)+e[11]*(+t*l*h-t*s*d-r*o*h+i*o*d+r*s*c-i*l*c)+e[15]*(-n*s*c-t*a*h+t*s*u+n*o*h-i*o*u+i*a*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},invert:function(e){const t=this.elements,i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],v=t[15],y=u*g*c-m*d*c+m*l*f-a*g*f-u*l*v+a*d*v,b=p*d*c-h*g*c-p*l*f+s*g*f+h*l*v-s*d*v,x=h*m*c-p*u*c+p*a*f-s*m*f-h*a*v+s*u*v,_=p*u*l-h*m*l-p*a*d+s*m*d+h*a*g-s*u*g,E=i*y+n*b+r*x+o*_;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/E;return t[0]=y*S,t[1]=(m*d*o-u*g*o-m*r*f+n*g*f+u*r*v-n*d*v)*S,t[2]=(a*g*o-m*l*o+m*r*c-n*g*c-a*r*v+n*l*v)*S,t[3]=(u*l*o-a*d*o-u*r*c+n*d*c+a*r*f-n*l*f)*S,t[4]=b*S,t[5]=(h*g*o-p*d*o+p*r*f-i*g*f-h*r*v+i*d*v)*S,t[6]=(p*l*o-s*g*o-p*r*c+i*g*c+s*r*v-i*l*v)*S,t[7]=(s*d*o-h*l*o+h*r*c-i*d*c-s*r*f+i*l*f)*S,t[8]=x*S,t[9]=(p*u*o-h*m*o-p*n*f+i*m*f+h*n*v-i*u*v)*S,t[10]=(s*m*o-p*a*o+p*n*c-i*m*c-s*n*v+i*a*v)*S,t[11]=(h*a*o-s*u*o-h*n*c+i*u*c+s*n*f-i*a*f)*S,t[12]=_*S,t[13]=(h*m*r-p*u*r+p*n*d-i*m*d-h*n*g+i*u*g)*S,t[14]=(p*a*r-s*m*r-p*n*l+i*m*l+s*n*g-i*a*g)*S,t[15]=(s*u*r-h*a*r+h*n*l-i*u*l-s*n*d+i*a*d)*S,this},getInverse:function(e,t){if(console.warn("LmvMatrix4.getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert(),0===this.determinant()){const e="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(e);console.warn(e),this.identity()}return this},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(i,n)))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,o=e.x,s=e.y,a=e.z,l=r*o,c=r*s;return this.set(l*o+i,l*s-n*a,l*a+n*s,0,l*s+n*a,c*s+i,c*a-n*o,0,l*a-n*s,c*a+n*o,r*a*a+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},lookAt:function(){var e=new n.LmvVector3,t=new n.LmvVector3,i=new n.LmvVector3;return function(n,r,o){var s=this.elements;return i.subVectors(n,r).normalize(),0===i.length()&&(i.z=1),e.crossVectors(o,i).normalize(),0===e.length()&&(i.x+=1e-4,e.crossVectors(o,i).normalize()),t.crossVectors(i,e),s[0]=e.x,s[4]=t.x,s[8]=i.x,s[1]=e.y,s[5]=t.y,s[9]=i.y,s[2]=e.z,s[6]=t.z,s[10]=i.z,this}}(),compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e=new n.LmvVector3,t=new r(!0);return function(i,n,r){var o=this.elements,s=e.set(o[0],o[1],o[2]).length(),a=e.set(o[4],o[5],o[6]).length(),l=e.set(o[8],o[9],o[10]).length();this.determinant()<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],t.elements.set(this.elements);var c=1/s,h=1/a,u=1/l;return t.elements[0]*=c,t.elements[1]*=c,t.elements[2]*=c,t.elements[4]*=h,t.elements[5]*=h,t.elements[6]*=h,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,n.setFromRotationMatrix(t),r.x=s,r.y=a,r.z=l,this}}(),transformPoint:function(e){var t=e.x,i=e.y,n=e.z,r=this.elements;return e.x=r[0]*t+r[4]*i+r[8]*n+r[12],e.y=r[1]*t+r[5]*i+r[9]*n+r[13],e.z=r[2]*t+r[6]*i+r[10]*n+r[14],e},transformDirection:function(e){var t=e.x,i=e.y,n=e.z,r=this.elements;e.x=r[0]*t+r[4]*i+r[8]*n,e.y=r[1]*t+r[5]*i+r[9]*n,e.z=r[2]*t+r[6]*i+r[10]*n;var o=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);if(o>0){var s=1/o;e.x*=s,e.y*=s,e.z*=s}return e},equals(e){const t=this.elements,i=e.elements;for(var n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){return new r(this.isDoublePrecision).fromArray(this.elements)}}},96118:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LmvVector3:()=>n});let n=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0};var r,o,s,a;n.prototype={constructor:n,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12],this.y=r[1]*t+r[5]*i+r[9]*n+r[13],this.z=r[2]*t+r[6]*i+r[10]*n+r[14],this},applyProjection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,o=e.y,s=e.z,a=e.w,l=a*t+o*n-s*i,c=a*i+s*t-r*n,h=a*n+r*i-o*t,u=-r*t-o*i-s*n;return this.x=l*a+u*-r+c*-s-h*-o,this.y=c*a+u*-o+h*-r-l*-s,this.z=h*a+u*-s+l*-o-c*-r,this},transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(e,t){return void 0===s&&(s=new n,a=new n),s.set(e,e,e),a.set(t,t,t),this.clamp(s,a)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-i*e.z,this.z=i*e.y-n*e.x,this},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,s=t.y,a=t.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this},projectOnVector:function(e){return void 0===r&&(r=new n),r.copy(e).normalize(),o=this.dot(r),this.copy(r).multiplyScalar(o)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new n),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new n),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},setEulerFromRotationMatrix:function(e,t){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),i=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){var i=4*e,n=t.elements;return this.x=n[i],this.y=n[i+1],this.z=n[i+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}}},65782:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MemoryTracker:()=>s});var n=i(57872),r=i(55280),o=i(25004);class s{static geomMemory=0;static geomCount=0;static gpuGeomMemory=0;static gpuGeomCount=0;static geomListStats=new WeakMap;static#L(e){let t=this.geomListStats.get(e);return t||(t={geomMemory:0,geomCount:0,gpuGeomMemory:0,gpuGeomCount:0},this.geomListStats.set(e,t)),t}static printStats(){console.log("MemoryTracker Global Stats:"),console.log("--------------------------"),this.#I(this),this.#R||console.log("Available GPU resources are tracked per model.")}static printModelStats(e){console.log("MemoryTracker Model Stats:"),console.log("--------------------------");const t=e.getGeometryList(),i=this.geomListStats.get(t);i?(this.#I(i),this.#R||(console.log("gpuGeomMemory remaining (low/high):",n.GPU_MEMORY_LIMIT-i.gpuGeomMemory,2*n.GPU_MEMORY_LIMIT-i.gpuGeomMemory),console.log("gpuGeomCount remaining:",n.GPU_OBJECT_LIMIT-i.gpuGeomCount))):console.log("No stats tracked for this model yet.")}static#I(e){console.log("geomMemory:",e.geomMemory),console.log("geomCount:",e.geomCount),console.log("gpuGeomMemory:",e.gpuGeomMemory),console.log("gpuGeomCount:",e.gpuGeomCount),this.#R&&(console.log("gpuGeomMemory remaining (low/high):",n.GPU_MEMORY_LIMIT-this.gpuGeomMemory,2*n.GPU_MEMORY_LIMIT-this.gpuGeomMemory),console.log("gpuGeomCount remaining:",n.GPU_OBJECT_LIMIT-this.gpuGeomCount))}static#R=!1;static setMemoryType(e,t,i){const n=void 0!==t.streamingDraw,r=this.#O(e,t,i);n&&!!t.streamingDraw===r?t.modelRefCount>1&&n&&!r&&this.#N(e,t,!0):(t.streamingDraw=t.streamingIndex=r,r?n&&this.untrackGeometry(e,t,!1,!0,!0):this.#N(e,t))}static#O(e,t,i){if(0===this.GPU_MEMORY_LOW)return!0;let r,o;if(this.#R)r=this.gpuGeomMemory,o=this.gpuGeomCount;else{const t=this.#L(e);r=t.gpuGeomMemory,o=t.gpuGeomCount}return!(e.disableStreaming||r<this.GPU_MEMORY_LOW&&o<n.GPU_OBJECT_LIMIT)&&(r>=this.GPU_MEMORY_HIGH||o>=n.GPU_OBJECT_LIMIT||(e.is2d?100001:t.byteSize*(i||1))<1e5)}static#F(e){if(!n.USE_BUFFER_MANAGER)return 1;let t=0,i=0;e.ib&&(i+=e.ib.byteLength),e.iblines&&(i+=e.iblines.byteLength);let r=e.byteSize-i;return t+=i/n.INDEX_BUFFER_REGION_SIZE,t+=r/n.VERTEX_BUFFER_REGION_SIZE,0===t&&(t=1),t}static#N(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=this.#L(e);(0,r.isMobileDevice)()&&(i||(this.geomMemory+=t.byteSize),n.geomMemory+=t.byteSize);let o=this.#F(t);i||(this.gpuGeomMemory+=t.byteSize,this.gpuGeomCount+=o),n.gpuGeomMemory+=t.byteSize,n.gpuGeomCount+=o}static trackGeometry(e,t){const i=t.byteSize+n.GEOMETRY_OVERHEAD;void 0!==t.modelRefCount&&1!==t.modelRefCount||(this.geomMemory+=i,this.geomCount++);const r=this.#L(e);r.geomMemory+=i,r.geomCount++}static untrackGeometry(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=0;const l=this.geomListStats.get(e);if(void 0===o&&(o=!1===t.streamingDraw),i&&(a=t.byteSize+n.GEOMETRY_OVERHEAD,l.geomMemory-=a,l.geomCount--,!t.modelRefCount||s?(this.geomMemory-=a,this.geomCount--,t.streamingDraw=void 0,t.streamingIndex=void 0):a=0),o){let e=this.#F(t);l.gpuGeomMemory-=t.byteSize,l.gpuGeomCount-=e,(0,r.isMobileDevice)()&&(t.modelRefCount&&!s||(a+=t.byteSize,this.geomMemory-=t.byteSize),l.geomMemory-=t.byteSize),t.modelRefCount&&!s||(this.gpuGeomMemory-=t.byteSize,this.gpuGeomCount-=e)}return a}static getGeometrySize(e){return e.byteSize+n.GEOMETRY_OVERHEAD}static get GPU_MEMORY_LOW(){return n.GPU_MEMORY_LIMIT}static get GPU_MEMORY_HIGH(){return 2*n.GPU_MEMORY_LIMIT}}o.EventDispatcher.prototype.apply(s)},68747:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MeshFlags:()=>n});let n={MESH_VISIBLE:1,MESH_HIGHLIGHTED:2,MESH_HIDE:4,MESH_ISLINE:8,MESH_MOVED:16,MESH_RENDERFLAG:32,MESH_NOTLOADED:64,MESH_ISPOINT:128,MESH_ISWIDELINE:256,MESH_TRAVERSED:512,MESH_DRAWN:1024}},1979:(e,t,i)=>{"use strict";i.d(t,{L:()=>l});var n=i(72091),r=new n.Vector3,o=new Float32Array(6);const s="hierarchy";var a=s;class l{constructor(){}static setStrategy(e){if(a!==e)return a=e,!0}static getStrategy(){return a}static explode(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var l=e.getData().instanceTree,c=e.getFragmentList(),h=e.getVisibleBounds(!0).getCenter(new n.Vector3);if(a===s&&l&&0!==t){const{magnitude:e,depthDampening:n}=i;!function(e,t,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var l=i*e.maxDepth+1;1===e.maxDepth&&(l=i);var c=0|l,h=l-c;function u(n,l,d,f,p,m,g,v){var y=i*s/Math.pow(l,a);l==c&&(y*=h),e.getNodeBox(n,o);var b=.5*(o[0]+o[3]),x=.5*(o[1]+o[4]),_=.5*(o[2]+o[5]);l>0&&l<=c&&(m+=(b-d)*y,g+=(x-f)*y,v+=(_-p)*y);e.isNodeExplodeLocked(n)&&(m=g=v=0),e.enumNodeChildren(n,(function(e){u(e,l+1,b,x,_,m,g,v)}),!1),r.x=m,r.y=g,r.z=v,e.enumNodeFragments(n,(function(e){t.updateAnimTransform(e,null,null,r)}),!1)}u(e.getRootId(),0,n.x,n.y,n.z,0,0,0)}(l,c,t,h,e,n)}else!function(e,t,i,n){var o,s,a=e.fragments.boxes;e.useThreeMesh?o=e.vizmeshes:s=e.fragments.fragId2dbId;for(var l=0,c=e.getCount();l<c;l++)if(0==i||t&&t.isNodeExplodeLocked(o?o[l]&&o[l].dbId:s[l]))e.updateAnimTransform(l);else{var h=6*l,u=.5*(a[h]+a[h+3]),d=.5*(a[h+1]+a[h+4]),f=.5*(a[h+2]+a[h+5]);r.x=i*(u-n.x),r.y=i*(d-n.y),r.z=i*(f-n.z),e.updateAnimTransform(l,null,null,r)}}(c,l,t,h)}}},72474:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelIteratorBVH:()=>h});var n=i(57872),r=i(4897),o=i(72091),s=i(75468);const a=new o.Box3,l=new o.Box3,c=new o.Sphere;class h{#U;#B;#k;#V;#G;#z;#H;#W;#j;#q;#X;#Y;#K;#Q;#Z;#$;#J;#ee;#te;#ie;constructor(){this.#U=null,this.#B=null,this.#k=null,this.#V=null,this.#G=null,this.#z=null,this.#H=null,this.#W=0,this.#j=0,this.#q=1,this.#X=!0,this.#Y=!1,this.#K=!1,this.#Q=!1,this.#Z=null,this.#$=!1,this.#J=null,this.#ee=!0,this.#te=null,this.#ie=null}initialize(e,t,i,n){this.#te=e,this.#ie=n,this.#U=e.getFragmentList(),this.#J=e.RenderBatch,n&&n.hasOwnProperty("prioritize_screen_size")&&(this.#X=n.prioritize_screen_size),this.#k=i,this.#V=new Array(t.nodeCount),this.#G=new Int8Array(t.nodeCount),this.#B=t,this.#z=new Int32Array(t.nodeCount+1),this.#H=new Float32Array(t.nodeCount);for(let e=0;e<t.nodeCount;e++){const i=t.getPrimCount(e);if(0===i)continue;this.#V[e]=new this.#J(this,this.#U,t.getPrimStart(e),i);const n=this.#V[e];n.lastItem=n.start+i,n.numAdded=i,n.nodeIndex=e,8&t.getFlags(e)&&(n.sortObjects=!0),t.getBoxArray(e,n.bboxes)}}dtor(){this.#J=null,this.#U=null,this.#te=null}reset(e,t){if(this.#Z=e,this.#W=0,this.#j=0,this.#G[0]=this.#G[1]=r.FrustumIntersector.CONTAINMENT_UNKNOWN,this.#z[this.#j++]=0,this.#Y=!1,this.#K=!1,this.#$=!1,this.#ee){let e=this.#V,t=e.length;for(let i=0;i<t;++i){let t=e[i];t&&t.resetVisStatus&&t.resetVisStatus()}this.#ee=!1}}#ne(e){const t=this.#H[e];let i=this.#j;if(this.#q)for(;i>this.#W&&this.#H[this.#z[i-1]]>t;)this.#z[i]=this.#z[i-1],i--;else for(;i>this.#W&&this.#H[this.#z[i-1]]<t;)this.#z[i]=this.#z[i-1],i--;this.#z[i]=e,this.#j++}nextBatch(){for(this.#K||this.#Y||this.#W!==this.#j||(this.#Q||(this.#z[this.#j++]=1),this.#Y=!0);this.#W!==this.#j;){const e=this.#q||this.#Y?this.#z[--this.#j]:this.#z[this.#W++];let t=this.#G[e];if(t!==r.FrustumIntersector.CONTAINS&&(this.#B.getBoxThree(e,a),t=this.#Z.intersectsBox(a)),t!==r.FrustumIntersector.OUTSIDE){const i=this.#B.getLeftChild(e);let o,l;if(-1!==i){const h=this.#B.getFlags(e),u=this.#Z.viewDir[3&h]<0?1:0;let d=h>>2&1,f=h>>3&1;const p=this.#q||this.#Y?1:0;let m=0,g=0;if(this.#X&&!this.#Y){if(o=i+d,l=i+1-d,n.USE_HLOD){let e;this.#V[o].getLargestFragBoxThree(a),this.getBVH().options.sortFuncType===Autodesk.Viewing.Private.BVHSortFuncType.DIAMETER?(a.getBoundingSphere(c),e=c.center.distanceTo(this.#Z.eye),this.#H[o]=m=c.radius/e,a.getBoundingSphere(c),e=c.center.distanceTo(this.#Z.eye),this.#H[l]=g=c.radius/e):(e=a.getCenter().distanceTo(this.#Z.eye),this.#H[o]=m=s.BVHModule.box_area_three(a)/(e*e),this.#V[l].getLargestFragBoxThree(a),e=a.getCenter().distanceTo(this.#Z.eye),this.#H[l]=g=s.BVHModule.box_area_three(a)/(e*e))}else this.#B.getBoxThree(o,a),this.#H[o]=m=this.#Z.projectedBoxArea(a,t===r.FrustumIntersector.CONTAINS),this.#B.getBoxThree(l,a),this.#H[l]=g=this.#Z.projectedBoxArea(a,t===r.FrustumIntersector.CONTAINS);this.#G[o]=this.#G[l]=t,m>0&&this.#ne(o),g>0&&this.#ne(l)}else u^p^f&&(d=1-d),o=i+d,l=i+1-d,this.#z[this.#j++]=o,this.#H[o]=-1,this.#z[this.#j++]=l,this.#H[l]=-1,this.#G[o]=this.#G[l]=t}if(0!==this.#B.getPrimCount(e)){const i=this.#V[e];return i.renderImportance=this.#Z.projectedBoxArea(i.getBoundingBox(),t===r.FrustumIntersector.CONTAINS),i}}this.#Y||this.#K||this.#W!==this.#j||(this.#Q||(this.#z[this.#j++]=1),this.#Y=!0)}return this.#$=!0,null}skipOpaqueShapes(){this.#Y||this.#K||(this.#W=0,this.#j=0,this.#z[this.#j++]=1,this.#K=!0)}setIgnoreTransparency(e){this.#Q=e}#re(e){const t=this.#B.getLeftChild(e);-1!==t&&(this.#re(t),this.#re(t+1)),a.makeEmpty(),-1!==t&&(this.#B.getBoxThree(t,l),a.union(l),this.#B.getBoxThree(t+1,l),a.union(l));this.#B.getPrimCount(e)&&(a.union(this.#V[e].getBoundingBox()),a.union(this.#V[e].getBoundingBoxHidden())),this.#B.setBoxThree(e,a)}getVisibleBounds(e,t){for(let i=0;i<this.#V.length;i++){let n=this.#V[i];if(!n)continue;n.calculateBounds();let r=n.getBoundingBox();e.union(r),t.union(r),t.union(n.getBoundingBoxHidden())}this.#re(0),this.#re(1)}rayCast(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=e.ray.origin;let s=[1,0],a=new o.Vector3,l=new o.Box3;for(;s.length>0;){const o=s.pop();if(this.#B.getBoxThree(o,l),l.expandByScalar(.5),null!=n.maxDistance){if(l.distanceToPoint(r)>n.maxDistance)continue}if(null===e.ray.intersectBox(l,a))continue;const c=this.#B.getLeftChild(o);-1!==c&&(s.push(c),s.push(c+1));if(0!==this.#B.getPrimCount(o)){this.#V[o].raycast(e,t,i,n)}}}intersectFrustum(e,t){let i=[1,r.FrustumIntersector.CONTAINMENT_UNKNOWN,0,r.FrustumIntersector.CONTAINMENT_UNKNOWN];for(;i.length;){const n=i.pop(),o=i.pop();let s;if(n===r.FrustumIntersector.CONTAINS?s=r.FrustumIntersector.CONTAINS:(this.#B.getBoxThree(o,a),s=e.intersectsBox(a)),s===r.FrustumIntersector.OUTSIDE)continue;const l=this.#B.getLeftChild(o);-1!==l&&(i.push(l),i.push(s),i.push(l+1),i.push(s));if(0!==this.#B.getPrimCount(o)){let i=this.#V[o];i&&i.intersectFrustum(e,t,s===r.FrustumIntersector.CONTAINS)}}}getSceneCount(){return this.#V.length}getGeomScenes(){return this.#V}getBVH(){return{nodes:this.#B,primitives:this.#k,options:this.#ie}}getFragOrder(){return this.#k}done(){return this.#$}resetVisStatus(){this.#ee=!0}clone(){const e=new h,t=new Int32Array(this.#k);return e.initialize(this.#te,this.#B,t,this.#ie),e}}},42525:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelIteratorLinear:()=>o});i(8879);var n=i(55280),r=i(4897);class o{constructor(e){this._frags=e.getFragmentList(),this._RenderBatch=e.RenderBatch,this._model=e,this._is2d=this._model.is2d(),this._fragsPerScene=function(e){let t=500;return e&&(t/=6),(0,n.isMobileDevice)()&&(t/=3),t=Math.floor(t),t>0?t:500}(e.is2d()),this._fragOrder=null,this._geomScenes=[],this._secondPassIndex=null;const t=this._frags.getCount();this._currentScene=0,this._fragOrder=new Int32Array(t);for(let e=0;e<t;e++)this._fragOrder[e]=e;this.setFragmentOrder(t)}dtor(){this.model=null,this._RenderBatch=null,this._frags=null}setFragmentOrder(e){var t=Math.floor((e+this._fragsPerScene-1)/this._fragsPerScene);this._geomScenes.length=t;for(let i=0;i<t;i++){let t=i*this._fragsPerScene,n=this._geomScenes[i]=new this._RenderBatch(this,this._frags,t,this._fragsPerScene),r=t+this._fragsPerScene;r>e&&(r=e),n.lastItem=r,n.count=n.lastItem-t}}addFragment(e){if(this._fragOrder.length<=e){var t=2*this._fragOrder.length;t<=e&&(t=e+1);var i=new Int32Array(t);i.set(this._fragOrder),this._fragOrder=i,this.visibleBoundsDirty=!0}this._fragOrder[e]=e;var n=Math.floor(e/this._fragsPerScene);if(this._geomScenes){var r=this._geomScenes[n];r&&!r.isSecondPass||(r=new this._RenderBatch(this,this._frags,n*this._fragsPerScene,this._fragsPerScene),null===this._secondPassIndex?this._geomScenes[n]=r:this.insertSceneToSecondPass(n,r)),r&&(r.onFragmentAdded(e),null!==this._secondPassIndex&&this._geomScenes[this._secondPassIndex+n].onFragmentAdded(e))}}insertSceneToSecondPass(e,t){const i=this._geomScenes.slice(0,this._secondPassIndex),n=this._geomScenes.slice(this._secondPassIndex);i[e]=t,n[e]=this.cloneForSecondPass(t),this._secondPassIndex=i.length,this._geomScenes=i.concat(n)}reset(e,t){if(this._currentScene=0,this._is2d&&this._geomScenes[0]&&(this._geomScenes[0].drawEnd=0,null!==this._secondPassIndex&&(this._geomScenes[this._secondPassIndex].drawEnd=0)),this._resetVisStatus){let e=this._geomScenes,t=e.length;for(let n=0;n<t;++n){var i=e[n];i&&i.resetVisStatus&&i.resetVisStatus()}this._resetVisStatus=!1}}getSceneCount(){return this._geomScenes.length}getGeomScenes(){return this._geomScenes}getFragOrder(){return this._fragOrder}resetVisStatus(){this._resetVisStatus=!0}done(){return!(this._is2d&&!this._model.isLoadDone())&&(this._currentScene>=this._geomScenes.length-1&&(!(e=this._geomScenes[this._currentScene])||e.drawStart>=e.lastItem));var e}nextBatch(){if(this._currentScene>=this.getSceneCount())return null;let e=this._geomScenes[this._currentScene];if(this._is2d){const t=this.areTwoPassesNeeded();if(e.lastItem>=e.start+e.count&&(++this._currentScene,this._geomScenes[this._currentScene]&&(this._geomScenes[this._currentScene].drawEnd=this._geomScenes[this._currentScene].start)),e.drawStart=e.drawEnd,e.drawEnd=e.lastItem,e.hasOwnProperty("drawStart")&&e.lastItem<=e.drawStart){return t&&!this._isSecondPass?(this._currentScene=this._secondPassIndex,this.nextBatch()):null}const i=!this._model.areAllVisible()||this._isSecondPass;e.renderImportance=i?-1:1e20,e.needsTwoPasses=t}else e.renderImportance=0,++this._currentScene;return e}areTwoPassesNeeded(){const e=this._model.hasPaperTransparency();return e&&null===this._secondPassIndex&&this.addSecondPassScenes(),this._isSecondPass=!!(e&&this._currentScene>=this._secondPassIndex),e}cloneForSecondPass(e){if(!e)return;const t=e.clone();return t.isSecondPass=!0,t}addSecondPassScenes(){const e=this._geomScenes.length;e&&(this._geomScenes=this._geomScenes.concat(this._geomScenes.map(this.cloneForSecondPass)),this._secondPassIndex=e)}getVisibleBounds(e,t){for(var i=this.getSceneCount(),n=0;n<i;n++){this._geomScenes[n].calculateBounds();var r=this._geomScenes[n].getBoundingBox();e.union(r),t.union(r),t.union(this._geomScenes[n].getBoundingBoxHidden())}}rayCast(e,t,i){for(var n=this.getSceneCount(),r=0;r<n;r++)this._geomScenes[r].raycast(e,t,i)}intersectFrustum(e,t){for(let i of this._geomScenes){if(!i)continue;let n=e.intersectsBox(i.getBoundingBox());n!==r.FrustumIntersector.OUTSIDE&&i.intersectFrustum(e,t,n===r.FrustumIntersector.CONTAINS)}}clone(){const e=new o(this._model);for(let t=0;t<this._geomScenes.length;t++)e._geomScenes[t].bboxes=this._geomScenes[t].bboxes.slice();return e}}},70101:(e,t,i)=>{"use strict";i.r(t),i.d(t,{NoOpTraversalController:()=>r});class n{constructor(){}dtor(){}clone(){}nextBatch(){}reset(e,t){}getGeomScenes(){}getSceneCount(){}getVisibleBounds(e,t,i){}rayCast(e,t,i){}}class r extends n{nextBatch(){return null}getGeomScenes(){return new Array}getSceneCount(){return 0}clone(){return new r}}},8879:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ConsolidatedRenderBatch:()=>f,RenderBatch:()=>d});var n=i(36411),r=i(4897),o=i(68747),s=i(24528),a=i(83081),l=i(21706),c=i(57872),h=new l.LmvBox3,u=null;class d{creatorIterator;frags;start;count;lastItem;overrideMaterial=null;sortDone=!1;numAdded=0;avgFrameTime=void 0;nodeIndex=void 0;bboxes=new Array(12);sortObjects=!1;sortByShaderDone=!1;fragOrderChangedCallbacks=[];frustumCulled=!0;forceVisible=!1;renderImmediate;renderImportance=0;isComplete=!1;useRenderBundles=!1;_renderBundles=[];#oe;constructor(e,t,i,n,r){this.creatorIterator=e,this.frags=t,this.start=i,this.count=n,this.lastItem=i,this.indices=r,this.#oe=this.getIndices()[this.start],this.bboxes[0]=this.bboxes[1]=this.bboxes[2]=1/0,this.bboxes[3]=this.bboxes[4]=this.bboxes[5]=-1/0,this.bboxes[6]=this.bboxes[7]=this.bboxes[8]=1/0,this.bboxes[9]=this.bboxes[10]=this.bboxes[11]=-1/0,this.renderImmediate=!t.useThreeMesh}clone(){const e=new d(this.creatorIterator,this.frags,this.start,this.count,this.indices);return e.sortDone=this.sortDone,e.sortByShaderDone=this.sortByShaderDone,e.lastItem=this.lastItem,e.visibleStats=this.visibleStats,e.numAdded=this.numAdded,e.bboxes=this.bboxes.slice(),e}getIndices(){return this.indices??this.creatorIterator.getFragOrder()}registerFragOrderChangedCallback=function(e){this.fragOrderChangedCallbacks.push(e)};removeFragOrderChangedCallback=function(e){const t=this.fragOrderChangedCallbacks.indexOf(e);-1!==t&&this.fragOrderChangedCallbacks.splice(t,1)};sortByMaterial(){if(!(this.numAdded<this.count)){var e=this.frags,t=this.getIndices();if(t){var i=t.subarray(this.start,this.start+this.count);Array.prototype.sort.call(i,(function(t,i){var n=e.getMaterialId(t),r=e.getMaterialId(i);return void 0===n?r?1:0:void 0===r?-1:n-r})),this.numAdded=0,this.sortDone=!0;for(const e of this.fragOrderChangedCallbacks)e(this.start,this.lastItem-this.start)}else a.logger.warn("Only indexed RenderSubsets can be sorted.")}}sortByShader(){if(this.sortDone&&!this.sortByShaderDone){var e=this.frags,t=this.getIndices().subarray(this.start,this.start+this.count);Array.prototype.sort.call(t,(function(t,i){var n=e.getMaterial(t),r=e.getMaterial(i),o=n.program.id-r.program.id;return o||n.id-r.id})),this.numAdded=0,this.sortByShaderDone=!0}}sortByVertexBuffer(e,t){if(this.sortByVBDone)return;let i=this.frags,n=this.getIndices().subarray(e,t);Array.prototype.sort.call(n,(function(e,t){var n,r,o,s,a,l;let c=i.getGeometry(e),h=i.getGeometry(t),u=c?null===(n=c.__gpuvb)||void 0===n?void 0:n.id:Number.MAX_SAFE_INTEGER,d=h?null===(r=h.__gpuvb)||void 0===r?void 0:r.id:Number.MAX_SAFE_INTEGER;if(void 0!==u&&void 0!==d||console.log("sorting too early"),u<d)return-1;if(u>d)return 1;let f=c?null===(o=c.__gpuib)||void 0===o?void 0:o.id:Number.MAX_SAFE_INTEGER,p=h?null===(s=h.__gpuib)||void 0===s?void 0:s.id:Number.MAX_SAFE_INTEGER;return f<p?-1:f>p?1:((null===(a=i.getMaterial(e))||void 0===a?void 0:a.id)??Number.MAX_SAFE_INTEGER)-((null===(l=i.getMaterial(t))||void 0===l?void 0:l.id)??Number.MAX_SAFE_INTEGER)})),this.numAdded=0,this.sortByVBDone=!0,this.sortDone=!0;for(const e of this.fragOrderChangedCallbacks)e(this.start,this.lastItem-this.start)}sortByDepth(e){var t=this.frags,i=this.getIndices(),n=e,r=h;if(i){(!u||u.length<this.count)&&(u=new Float32Array(this.count));var o,s,l=u,c=this.start;this.forEachNoMesh(((e,i)=>{t.hasGeometry(e)?(t.getWorldBounds(e,r),l[i]=n.estimateDepth(r)):l[i]=-1/0}));for(var d=1;d<this.count;d++)for(var f=d;f>0&&l[f-1]<l[f];)o=l[f-1],l[f-1]=l[f],l[f]=o,s=i[c+f-1],i[c+f-1]=i[c+f],i[c+f]=s,f--;for(const e of this.fragOrderChangedCallbacks)e(this.start,this.lastItem-this.start)}else a.logger.warn("Only indexed RenderSubsets can be sorted.")}addToBox(e,t){var i=t?6:0,n=this.bboxes;n[0+i]=Math.min(n[0+i],e.min.x),n[1+i]=Math.min(n[1+i],e.min.y),n[2+i]=Math.min(n[2+i],e.min.z),n[3+i]=Math.max(n[3+i],e.max.x),n[4+i]=Math.max(n[4+i],e.max.y),n[5+i]=Math.max(n[5+i],e.max.z)}getBoundingBox(e){e=e||h;var t=this.bboxes;return e.min.x=t[0],e.min.y=t[1],e.min.z=t[2],e.max.x=t[3],e.max.y=t[4],e.max.z=t[5],e}getBoundingBoxHidden(e){e=e||h;var t=this.bboxes;return e.min.x=t[6],e.min.y=t[7],e.min.z=t[8],e.max.x=t[9],e.max.y=t[10],e.max.z=t[11],e}onFragmentAdded(e){this.frags.getWorldBounds(e,h),this.addToBox(h,!1),this.sortDone=!1,this.lastItem<=e&&(this.lastItem=e+1,void 0!==this.visibleStats&&(this.visibleStats=0)),this.numAdded++}forEach(e,t,i){this.numFragsStreamingDraw=0;var n,r,s,a,l=this.getIndices(),c=this.frags,h=!this.sortByShaderDone;if(t||i||h){const u=Object.prototype.hasOwnProperty.call(this,"drawStart");for(n=t===o.MeshFlags.MESH_RENDERFLAG&&u?this.drawStart:this.start,r=this.lastItem;n<r;n++)s=l?l[n]:n,a=c.getVizmesh(s),!h||a&&a.material&&a.material.program||(h=!1),!(i||a&&a.geometry)||t&&!c.isFlagSet(s,t)||(a.geometry.streamingDraw&&this.numFragsStreamingDraw++,e(a,s))}else for(n=this.start,r=this.lastItem;n<r;n++)s=l?l[n]:n,(a=c.getVizmesh(s))&&a.geometry&&(a.geometry.streamingDraw&&this.numFragsStreamingDraw++,e(a,s));h&&this.sortByShader()}is2d(){return this.frags.is2d}forEachWGPU(e,t,i){const n=0|(this.forceVisible?o.MeshFlags.MESH_VISIBLE:o.MeshFlags.MESH_RENDERFLAG),r=this.getIndices(),s=this.frags;let a=!0;const l=e||this.start;let c=this.lastItem;t&&(c=Math.min(c,l+t));const h=s.geoms.geoms,u=s.vizflags,d=s.geomids,f=s.materialIdMap,p=s.materialids;let m,g=this.is2d();if(this.isComplete)for(this.sortByVBDone||this.sortByVertexBuffer(l,c),m=l;m<c;m++){const e=r[m];if(u[e]&n){if(g){let t=s.vizmeshes[e];t&&i(t)}else i(h[d[e]],f[p[e]],m);0}}else{for(m=l;m<c;m++){var v;const e=0|r[m],t=g?null===(v=s.vizmeshes[e])||void 0===v?void 0:v.geometry:h[d[e]];if(!t){const t=s.getGeometryId(e);(s.isFlagSet(e,o.MeshFlags.MESH_LOADING)||0!==t)&&(a=!1);continue}t.__gpuvb||(a=!1);if(u[e]&n){if(g){let t=s.vizmeshes[e];t&&i(t)}else i(t,f[p[e]],m);0}}a&&(this.isComplete=!0,this.useRenderBundles=!this.sortObjects)}return m===this.lastItem?0:m}setRenderBundle(e,t){this._renderBundles[e]=t}getRenderBundle(e){return this._renderBundles[e]}clearRenderBundles(){this._renderBundles.length=0}forEachNoMesh(e,t,i){for(var n=this.getIndices(),r=this.frags,o=this.start,s=this.lastItem;o<s;o++){var a=n?n[o]:o;!i&&!r.hasGeometry(a)||t&&!r.isFlagSet(a,t)||e(a,o-this.start)}}raycast(e,t,i,r){!1!==e.ray.intersectsBox(this.getBoundingBox())&&this.forEach(((s,a)=>{if(!this.frags.isFlagSet(a,o.MeshFlags.MESH_HIDE)){if(i&&i.length){var l=0|this.frags.getDbIds(a);if(-1===i.indexOf(l))return}this.frags.getWorldBounds(a,h),h.expandByScalar(.5),e.ray.intersectsBox(h)&&n.VBIntersector.rayCast(s,e,t,r)}}),o.MeshFlags.MESH_VISIBLE)}intersectFrustum(e,t,i){if(!i){let t=e.intersectsBox(this.getBoundingBox());if(t===r.FrustumIntersector.OUTSIDE)return;t===r.FrustumIntersector.CONTAINS&&(i=!0)}this.forEach(((n,s)=>{if(this.frags.isFlagSet(s,o.MeshFlags.MESH_HIDE))return;if(i)return void t(s,i);this.frags.getWorldBounds(s,h);let a=e.intersectsBox(h);a!==r.FrustumIntersector.OUTSIDE&&t(s,a===r.FrustumIntersector.CONTAINS)}),o.MeshFlags.MESH_VISIBLE)}calculateBounds(){this.bboxes[0]=this.bboxes[1]=this.bboxes[2]=1/0,this.bboxes[3]=this.bboxes[4]=this.bboxes[5]=-1/0,this.bboxes[6]=this.bboxes[7]=this.bboxes[8]=1/0,this.bboxes[9]=this.bboxes[10]=this.bboxes[11]=-1/0,this.forEachNoMesh((e=>{this.frags.getWorldBounds(e,h);var t=this.frags.vizflags[e];this.addToBox(h,!(1&t))}),0,!0)}applyVisibility(e,t){let i,n,l,u,d,f,p,m;function g(e){var t=!1;return i.getWorldBounds(e,h),d&&!l.intersectsBox(h)&&(t=!0),c.ENABLE_PIXEL_CULLING&&!t&&l.estimateProjectedDiameter(h)<l.areaCullThreshold&&(t=!0),t||p||!l.boxOutsideCutPlanes(h)||(t=!0),t}function v(e,t,i){let r=!1;const a=o.MeshFlags.MESH_RENDERFLAG,l=n[e]&~a;switch(u){case s.RenderFlags.RENDER_HIDDEN:r=!(l&o.MeshFlags.MESH_VISIBLE);break;case s.RenderFlags.RENDER_HIGHLIGHTED:r=l&o.MeshFlags.MESH_HIGHLIGHTED;break;default:r=1==(l&(o.MeshFlags.MESH_VISIBLE|o.MeshFlags.MESH_HIGHLIGHTED|o.MeshFlags.MESH_HIDE))}if(t){const e=l&(o.MeshFlags.MESH_ISLINE|o.MeshFlags.MESH_ISWIDELINE);r=r&&!e}if(i){const e=l&o.MeshFlags.MESH_ISPOINT;r=r&&!e}return n[e]=l|(r?a:0),r}f=!0,l=t,u=e;var y=u===s.RenderFlags.RENDER_HIDDEN?this.getBoundingBoxHidden():this.getBoundingBox(),b=l.intersectsBox(y);return b===r.FrustumIntersector.OUTSIDE||c.ENABLE_PIXEL_CULLING&&l.estimateProjectedDiameter(y)<l.areaCullThreshold?f:(p=this.frags.doNotCut,!p&&t.boxOutsideCutPlanes(y)||(n=this.frags.vizflags,i=this.frags,d=b!==r.FrustumIntersector.CONTAINS,m=this.useRenderBundles,i.useThreeMesh?this.forEach((function(e,t){if(!e&&i.useThreeMesh||!e.geometry)return;if(g(t))return e?e.visible=!1:a.logger.warn("Unexpected null mesh"),void(n[t]=n[t]&~o.MeshFlags.MESH_RENDERFLAG);const r=v(t,i.linesHidden,i.pointsHidden);e&&(e.visible=!!r),f=f&&!r}),null):this.forEachNoMesh((function(e){if(!m&&g(e))return void(n[e]=n[e]&~o.MeshFlags.MESH_RENDERFLAG);const t=v(e,i.linesHidden,i.pointsHidden);f=f&&!t}),0,!1),i=null),f)}render(e){e(this)}getLargestFragBoxThree=e=>{var t=6*this.#oe,i=this.frags.boxes;e.min.x=i[t],e.min.y=i[t+1],e.min.z=i[t+2],e.max.x=i[t+3],e.max.y=i[t+4],e.max.z=i[t+5]}}class f extends d{constructor(e,t,i){var n;const r=new Int32Array(null===(n=i.nodeId2SingleFragIds)||void 0===n?void 0:n[t.nodeIndex]);super(e,t.frags,0,r.length,r),this.lastItem=this.count,this.bboxes=t.bboxes,this.consolidatedScene=new THREE.Scene,this.sortDone=!1}render(e){e(this.consolidatedScene),e(this)}}},24528:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderFlags:()=>n});var n={RENDER_NORMAL:0,RENDER_HIGHLIGHTED:1,RENDER_HIDDEN:2,RENDER_SHADOWMAP:3,RENDER_FINISHED:4}},9478:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderModel:()=>M});var n=i(57872),r=i(86639),o=i(54561),s=i(8879),a=i(90824),l=i(28441),c=i(34845),h=i(72474),u=i(36411),d=i(72091),f=i(68747),p=i(24528),m=i(83081),g=i(37365),v=i(6684),y=i(22040),b=i(65782),x=i(7756),_=i(2404),E=i.n(_);const S=Autodesk.Viewing,A="Job canceled. While ";var w=(()=>{const e=new d.Vector4;return(t,i)=>{e.copy(t);for(let t=0;t<i.length;t++)if(i[t].dot(e)>1e-6)return!0;return!1}})(),T=1;class M{#se=new d.Box3;#ae=new d.Box3;#le=new d.Box3;visibleBoundsDirty=!1;#ce=0;id=T++;#he=null;#U=null;#ue=new c.SceneTraversal;#de=null;#fe=[];#pe=null;#me=0;#Z=null;#ge=p.RenderFlags.RENDER_NORMAL;#ve=null;#ye=null;#be=null;#xe;#_e;#Ee;RenderBatch=s.RenderBatch;#Se=!1;#Ae;#we;visibilityManager=null;#Te=new d.Plane;#Me=new d.Vector3;#Ce;#Pe;#De;#Le;#Ie={};#Re=null;#Oe=null;_currentConsolidationOptions={};static _consolidationCounter=0;static _consolidationWorker=null;static _consolidationJobs=new Map;static _workerRefCount=0;static addJob(e){M._consolidationWorker||(M._consolidationWorker=(0,x.createWorker)("ConsolidationWorker"));let t=!1;return e.stopIfCanceled=function(){if(t)throw A+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")},e.cancel=()=>{t=!0},e.signalProgress=t=>{e.model.loader.viewer3DImpl&&e.model.loader.viewer3DImpl.signalProgress(t,l.ProgressState.OPTIMIZING,e.model)},e.worker=M._consolidationWorker,e.id=M._consolidationCounter++,e.signalProgress(.1),this._consolidationJobs.set(e.id,e),e}static removeJob(e){var t;null===(t=e.model.loader)||void 0===t||t.viewer3DImpl.signalProgress(100,l.ProgressState.OPTIMIZING,this),M._consolidationJobs.delete(e.id)}static _registerConsolidationWorker(){M._workerRefCount++}static async _unregisterConsolidationWorker(){if(this._workerRefCount--,0===M._workerRefCount&&M._consolidationWorker){const e=[];this._consolidationJobs.forEach((t=>{t.cancel(),e.push(t.promise)})),Promise.all(e).then((()=>{0===this._consolidationJobs.size&&(m.logger.info("Shutting down consolidation worker"),M._consolidationWorker.terminate(),M._consolidationWorker=null)}))}}constructor(e){this.#Le=e,this.#Ce=e.modelSpaceBBox,this.#Pe=e.bbox,this.#De=e.placementWithOffset,M._registerConsolidationWorker()}dtor(){this.#o()}setModelFormat(e){this.#Ie=e}initialize(){var e,t;const i=this.#Le.numGeoms,s=!function(e,t,i){return!(e&&e-3*t*2<=n.GPU_MEMORY_LIMIT&&i<n.GPU_OBJECT_LIMIT)}(this.#Le.packFileTotalSize,this.#Le.primitiveCount,i);this.#he=new r.GeometryList(i,this.#Ie.is2d,s,this.#Ie.isOTG);const a=(null===(e=this.#Le.metadata)||void 0===e||null===(e=e.stats)||void 0===e?void 0:e.num_materials)??0,l=(null===(t=this.#Le.metadata)||void 0===t||null===(t=t.stats)||void 0===t?void 0:t.num_geoms)??0,c=this.#Le.fragments;this.#U=new o.FragmentList(c,this.getGeometryList(),this.id,a,l,this.#Ie);const h=this.getModelBounds();h&&(this.#se.copy(h),this.#ae.copy(h))}addTraversalController(e,t){this.#ue.addTraversalController(e,t),this.visibleBoundsDirty=!0;for(const e of this.#fe)e(t)}getGeometryList(){return this.#he}getFragmentList(){return this.#U}getModelId(){return this.id}getIterator(){return this.#ue.getTraversalController()}isIdRemapValid(){return null!=this.#Ae}#o(){this.isConsolidated()&&this.untrackConsolidatedGeometry(),this._cancelConsolidationJob(),M._unregisterConsolidationWorker(),this.#ue.dtor(),this.#de=null,this.#he=null,this.#U&&(this.#U.dtor(this.loader.viewer3DImpl.geomCache(!1)),this.#U=null),this.#Le&&(this.#Le=null)}activateFragment(e,t,i){this.#U&&(this.#U.setMesh(e,t,i),this.#ue.addFragment(e),this.#U.getWorldBounds(e,this.#le),this.#se.union(this.#le),this.#ae.union(this.#le))}setFragment(e,t,i){return void 0===e&&(e=this.getFragmentList().getNextAvailableFragmentId()),this.#U.setMesh(e,t,!0,i),this.#ue.addFragment(e),this.#U.getWorldBounds(e,this.#le),this.#se.union(this.#le),this.#ae.union(this.#le),e}registerIteratorChangedCallback(e){this.#fe.push(e)}removeIteratorChangedCallback=function(e){const t=this.#fe.indexOf(e);-1!==t&&this.#fe.splice(t,1)};setBVH(e,t,i){var n,r;const o=new h.ModelIteratorBVH;o.initialize(this,e,t,i),this.#ue.addTraversalController("BVH",o),null!==(n=this.#U)&&void 0!==n&&n.matrix&&this.invalidateBBoxes();for(const e of this.#fe)e(o);null===(r=this.loader)||void 0===r||r.viewer3DImpl.invalidate(!1,!0)}resetIterator(e,t,i){var n;this.#me=0,this.#ge=i,this.#Z=t;const r=null===(n=this.#U)||void 0===n?void 0:n.fragmentsHaveBeenAdded();return this.#ue.updateView(e,t,i,r),this.getIterator()}setRaycastIterator(e){var t;this.#de=e,null===(t=this.#de)||void 0===t||t.getVisibleBounds(this.#se,this.#ae,!0)}getRaycastIterator(){return this.#de}nextBatch(e){for(;;){this.#me++;const t=this.#ue.nextBatch(e);if(!t)return null;if(t.modelId=this.id,t instanceof d.Scene)return t;if(t instanceof s.ConsolidatedRenderBatch)return this.applyVisibility(t,this.#ge,this.#Z),t;if(this.applyVisibility(t,this.#ge,this.#Z))return t}}applyVisibility(e,t,i){const n=!e.applyVisibility(t,i);return this.#Ie.is2d?n:!!n&&(e.sortObjects&&!this.getFragmentList().useThreeMesh?(e.sortByDepth(i),!0):(e.sortDone||e.sortByMaterial(),!0))}trimPageShadowGeometry(e){if(this.hasPageShadow()){const t=Autodesk.Viewing.Private.F2dShadowRatio;e=e.clone();const i=this.getMetadata("page_dimensions","page_width");e.max.x-=i*t,e.min.y+=i*t}return e}getVisibleBounds(e,t){var i;this.visibleBoundsDirty&&(this.#se.makeEmpty(),this.#ae.makeEmpty(),this.#ue.getVisibleBounds(this.#se,this.#ae,e),null===(i=this.#de)||void 0===i||i.getVisibleBounds(this.#se,this.#ae,e),this.visibleBoundsDirty=!1);let n=e?this.#ae:this.#se;return t&&(n=this.trimPageShadowGeometry(n)),n}rayIntersect2D(e,t,i,n){const r=this.getModelBounds(!0),o=r.getCenter(new d.Vector3);let s=new d.Vector3;this.#Te.normal.set(0,0,1),this.#Te.constant=-o.z;const a=this.getModelToViewerTransform();if(a&&this.#Te.applyMatrix4(a),s=e.ray.intersectPlane(this.#Te,s),s){this.#Me.copy(s);const a=this.getInverseModelToViewerTransform();if(a&&(this.#Me.applyMatrix4(a),this.#Me.z=o.z),r.containsPoint(this.#Me)){var l;const r=null===(l=this.#U)||void 0===l||null===(l=l.getMaterial(0))||void 0===l?void 0:l.cutplanes;if(r&&w(s,r))return;const o=e.ray.origin.distanceTo(s);if(o<e.near||o>e.far)return;let a,h;if(n){const e=n(s);if(a=e[0],t&&t.length>0&&!t.includes(a))return;const i=e[1];if(0!==i&&i!==this.id)return;var c;h=null===(c=this.#U)||void 0===c?void 0:c.fragments.dbId2fragId[a]}const u={intersectPoint:s,point:s,distance:o,dbId:a&&this.remapDbIdFor2D(a),fragId:h,model:this};return i&&i.push(u),u}}return null}rayIntersect(e,t,i,n,r,o){if(this.ignoreRayIntersect)return null;if(this.#Ie.is2d)return this.rayIntersect2D(e,i,n,r);this.visibleBoundsDirty&&this.getVisibleBounds();var s,a=[];if(i&&i.length>0){var l=this.getInstanceTree(),c=[];if(l)for(s=0;s<i.length;s++)l.enumNodeFragments(i[s],(function(e){c.push(e)}),!0);else c=i;if(c.length>2){(this.#de||this.getIterator()).rayCast(e,a,i)}else for(s=0;s<c.length;s++){var h=this.#U.getVizmesh(c[s]);if(h){var d=u.VBIntersector.rayCast(h,e,a,o);d&&a.push(d)}}}else{(this.#de||this.getIterator()).rayCast(e,a,void 0,o)}if(!a.length)return null;a.sort((function(e,t){return e.distance-t.distance}));var f=!!n;for(n=n||[],s=0;s<a.length;s++){var p=a[s].fragId;if(this.isFragVisible(p)){var m=this.#U.getMaterial(p);if(t&&m.transparent)continue;var g=a[s],v=!1;if(m&&m.cutplanes&&(v=w(g.point,m.cutplanes)),v||n.push(g),g.model=this,!f&&n.length>0)break}}var y=n[0]||null;return y&&(y.model=this),y}setHighlighted(e,t){if(!this.#U)return!1;var i=this.#U.setFlagFragment(e,f.MeshFlags.MESH_HIGHLIGHTED,t);return i&&(t?this.#ce++:this.#ce--),i}setVisibility(e,t){this.#U?this.#U.setVisibility(e,t):this.isLeaflet()&&this.#ue.setVisibilityLeaflet(t),this.invalidateBBoxes()}setAllVisibility(e){this.#U?this.#U.setAllVisibility(e):this.isLeaflet()&&this.#ue.setVisibilityLeaflet(e),this.invalidateBBoxes()}hideLines(e){this.#U&&this.#U.hideLines(e)}hidePoints(e){this.#U&&this.#U.hidePoints(e)}hasHighlighted(){return!!this.#ce}isFragVisible(e){return this.#U.isFragVisible(e)}areAllVisible(){return!this.#U||this.#U.areAllVisible()}getGeomScenes(){return this.#ue.getScenes()}getRenderProgress(){const e=this.#me/this.#ue.getSceneCount();return e>1?1:e}update(e){return this.#ue.needsRedrawLeaflet(e)}setThemingColor(e,t,i){if(this.#U){e=this.reverseMapDbIdFor2D(e);const n=this.getInstanceTree();return i&&n?void n.enumNodeChildren(e,(e=>{this.#U.setThemingColor(e,t)}),!0):void this.#U.setThemingColor(e,t)}this.#ue.setThemingColorLeaflet(t)||m.logger.warn("Theming colors are not supported by this model type.")}clearThemingColors(){this.#U?this.#U.clearThemingColors():this.#ue.clearThemingColorsLeaflet()}getLeaflet(){return this.#ue.getLeafletIterator()}chooseMemoryTypes(){const e=this.#ue.getConsolidation();var t=this.getGeometryList(),i=[];let n;for(o=1;o<t.getCount();o++)n=t.getGeometry(o),n&&(b.MemoryTracker.untrackGeometry(t,n,!1,!n.streamingDraw,!0),n.streamingDraw=n.streamingIndex=void 0);const r=this.getFragmentList();if(e)for(var o=0;o<e.meshes.length;o++){var s,a=e.meshes[o];n=(null===(s=a)||void 0===s?void 0:s.geometry)||r.getGeometry(a.fragId),n.byteSize||(n.byteSize=(0,y.getByteSize)(n));var l=Number.isInteger(a.fragId);if(l){const e=void 0!==n.id?n.id:n.svfid;if(i[e])continue;i[e]=!0}b.MemoryTracker.setMemoryType(t,n,n.numInstances||1),l||(n.streamingDraw?b.MemoryTracker.trackGeometry(t,n):n.discardAfterUpload=!0)}for(o=1;o<t.getCount();o++){if(n=t.getGeometry(o),!n)continue;i[void 0!==n.id?n.id:o]||b.MemoryTracker.setMemoryType(t,n,t.getInstanceCount(o)),n.streamingDraw&&n.dispose()}}#Ne(e,t){return this._currentConsolidationOptions.byteLimit!==e||!E()(this._currentConsolidationOptions.bvhOptions,t)}_cancelConsolidationJob(){this.#Re&&!this.#Re.canceled&&(m.logger.info("Canceling consolidation job.",this.#Re.id),this.#Re.cancel())}consolidateAsync(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=t||n.CONSOLIDATION_MEMORY_LIMIT,this.isConsolidating()&&this._cancelConsolidationJob();const o=this.getData().loadOptions.bvhOptions.consolidation,s={byteLimit:t,forceConsolidationMapRecomputation:this.#Ne(t,o),bvhOptions:o,syncTimeSlice:n.USE_HLOD?20:1/0,consolidationMap:this.#pe,useDeferredConsolidation:r,model:this};return m.logger.info("Starting consolidation",s.id),this.#Re=M.addJob(s),this.#Oe=this.#Re.promise=(0,a.consolidateFragmentList)(this,e,s).then((e=>{if(s.canceled)return void m.logger.debug("Skipping results of canceled consolidation",s.id);this.#ue.enableConsolidation(this.#U,e),this.chooseMemoryTypes(),this.#pe=e.consolidationMap;const i=s.consolidationBVH;i&&this.setBVH(i.nodes,i.primitives,i.bvhOptions),this._currentConsolidationOptions.byteLimit=t,this._currentConsolidationOptions.bvhOptions=o,m.logger.info("Consolidation finished",s.id)})).finally((()=>{this.#Oe=null,this.#Re=null,M.removeJob(s)})).catch((e=>{var t;null!=e&&null!==(t=e.startsWith)&&void 0!==t&&t.call(e,A)?m.logger.info("Consolidation canceled."):m.logger.error("Consolidation failed.",e)})),this.#Oe}untrackConsolidatedGeometry(){const e=this.#ue.getConsolidation();for(let t=0;t<e.meshes.length;t++){const i=e.meshes[t];if(!Number.isInteger(i.fragId)){const e=i.geometry;b.MemoryTracker.untrackGeometry(this.getGeometryList(),e,e.streamingDraw)}}}consolidate(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return console.warn("RenderModel.consolidate is deprecated. Use consolidateAsync instead."),this.consolidateAsync(e,t,i,n)}unconsolidate(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.isConsolidating()&&this._cancelConsolidationJob(),this.isConsolidated()&&(this.untrackConsolidatedGeometry(),this.#ue.disableConsolidation(),t&&(this._currentConsolidationOptions={},this.#pe=null),e&&this.chooseMemoryTypes())}isConsolidated(){return this.#ue.isEnabledConsolidation()}isConsolidating(){return null!=this.#Oe}getConsolidationPromise(){return this.#Oe||Promise.resolve()}getConsolidation(){return this.#ue.getConsolidation()}setDbIdRemap(e){this.#Ae=e}remapDbId(e){return this.#Ae&&e>0&&e<this.#Ae.length?this.#Ae[e]:e}remapDbIdFor2D(e){return this.#Ie.is2d?this.remapDbId(e):e}reverseMapDbId(e){if(!this.#Ae||e<=0)return e;if(!this.#we){this.#we={};for(var t=0;t<this.#Ae.length;t++)this.#we[this.#Ae[t]]=t}return this.#we[e]}reverseMapDbIdFor2D(e){return this.#Ie.is2d?this.reverseMapDbId(e):e}updateRenderProxy(e,t){this.#ue.updateRenderProxy(e,t)}skipOpaqueShapes(){this.#ue.skipOpaqueShapes()}invalidateBBoxes(){this.visibleBoundsDirty=!0}changePaperVisibility(e){var t;this.#Ie.is2d&&(null===(t=this.#U)||void 0===t||t.setObject2DVisible(-1,e))}hasPaperTransparency(){var e;if(!this.#Ie.is2d)return!1;const t=(null===(e=this.#U)||void 0===e?void 0:e.dbIdOpacity[-1])??1;return t>0&&t<1}setModelTransform(e){this.#ue.setModelTransformLeaflet(e),this.isLeaflet()||(this.#U.setModelMatrix(e),this.#ue.updateModelTransformConsolidation()),this.invalidateBBoxes(),this.getVisibleBounds(!0),this.#ye=null,this.#be=null}getModelTransform(){var e;const t=this.#ue.getModelTransformLeaflet();return t||(null===(e=this.#U)||void 0===e?void 0:e.matrix)}getModelBounds(e,t){if(!this.#Ce&&!this.#Pe)return null;const i=new d.Box3;if(i.copy(this.#Ce||this.#Pe),t&&i.copy(this.trimPageShadowGeometry(i)),e)return i;this.#De&&this.#Ce&&i.applyMatrix4(this.#De);const n=this.getModelTransform();return n&&i.applyMatrix4(n),i}updateModelBBoxOriginal(e){this.#Ce=e}getInverseModelTransform(){var e;const t=this.#ue.getInverseModelTransformLeaflet();return t||(null===(e=this.#U)||void 0===e?void 0:e.getInverseModelMatrix())}getPlacementTransform(){return this.#ve=this.#ve||new g.LmvMatrix4(!0),this.#xe||this.getData().placementTransform||this.#ve}getGlobalOffset(){return this.#_e||this.getData().globalOffset}setPlacementTransform(e){this.#xe=(this.#xe||new g.LmvMatrix4(!0)).copy(e),v.DynamicGlobalOffset.updateModelMatrix(this,e,this.getGlobalOffset())}setGlobalOffset(e){this.#_e=this.#_e||new d.Vector3,this.#_e.copy(e);var t=this.getPlacementTransform();v.DynamicGlobalOffset.updateModelMatrix(this,t,e)}getModelToViewerTransform(){var e;if(this.#ye)return this.#ye;const t=this.getModelTransform(),i=null===(e=this.getData())||void 0===e?void 0:e.placementWithOffset;return(t||i)&&(this.#ye=new d.Matrix4,t&&this.#ye.multiply(t),i&&this.#ye.multiply(i)),this.#ye}getInverseModelToViewerTransform(){if(this.#be)return this.#be;const e=this.getModelToViewerTransform();return e&&(this.#be=e.clone().invert()),this.#be}getInversePlacementWithOffset(){return this.myData.placementWithOffset?(this.#Ee||(this.#Ee=new g.LmvMatrix4(!0).copy(this.myData.placementWithOffset).invert()),this.#Ee):null}setInnerAttributes(e){this.id=e._id,this.#se=e._visibleBounds,this.#ae=e._visibleBoundsWithHidden,this.#le=e._tmpBox,this.#ce=e._numHighlighted,this.#he=e._geoms,this.#U=e._frags,this.#pe=e._consolidationMap,this.#me=e._renderCounter,this.#Z=e._frustum,this.#ge=e._drawMode,this.#Ae=e._idRemap,this.#we=e._reverseMap;const t={_iterator:e._iterator,_linearIterator:e._linearIterator,_bvhIterator:e._bvhIterator,_consolidationIterator:e._consolidationIterator};this.#ue.setInnerAttributes(t)}getInnerAttributes(){const e=this.#ue.getInnerAttributes();return{_id:this.id,_visibleBounds:this.#se,_visibleBoundsWithHidden:this.#ae,_tmpBox:this.#le,_numHighlighted:this.#ce,_geoms:this.#he,_frags:this.#U,_linearIterator:e.linearIterator,_bvhIterator:e.bvhIterator,_iterator:e.currentIterator,_consolidationIterator:e.consolidationIterator,_consolidationMap:this.#pe,_renderCounter:this.#me,_frustum:this.#Z,_drawMode:this.#ge,_idRemap:this.#Ae,_reverseMap:this.#we}}setDoNotCut(e,t){if(this.#Se===t)return;this.#Se=t,this.#U?this.#U.setDoNotCut(t):this.isLeaflet()&&this.#ue.setDoNotCutLeaflet(t);e.forEachInModel(this,!1,(i=>{var n;i.doNotCut=t;(null===(n=i.cutplanes)||void 0===n?void 0:n.length)>0===t&&(e._applyCutPlanes(i),i.needsUpdate=!0)}))}getDoNotCut(){return this.#Se}setViewportBounds(e,t){this.isLeaflet()?this.#ue.setViewportBoundsLeaflet(t):this.#U&&(t=t||this.isPdf()&&this.getModelBounds(!0,!0),this.#U.setViewBounds(t),e.setViewportBoundsForModel(this,t)),this.invalidateBBoxes()}getViewportBounds(){var e;return this.isLeaflet()?this.#ue.getViewportBoundsLeaflet():null===(e=this.#U)||void 0===e?void 0:e.getViewBounds()}load(e){let t=0;return(this.#Ie.isSVF2||this.#Ie.isOTG)&&(t=this.loader.loadFragments(e)),t}unload(e){let t=0;return(this.#Ie.isSVF2||this.#Ie.isOTG)&&(t=this.getFragmentList().unload(e,this.loader.viewer3DImpl.geomCache(!1)),t>0&&(this.getData().fragsLoaded-=t,this.#Fe({type:S.FRAGMENTS_UNLOADED_EVENT,model:this}))),t}#Fe(e){this.loader.viewer3DImpl.api.dispatchEvent(e)}}},47263:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RenderScene:()=>h});var n=i(57872),r=i(4897),o=i(72091),s=i(24528),a=i(19129),l=i(1979);const c=new o.Box3;class h{#$=!1;#Ue=[];#Be=[];#ke=[];#Ve=[];#Z=new r.FrustumIntersector;#Ge=new o.Raycaster;enableNonResumableFrames=!1;budgetForTransparent=.1;#ze=!1;#He=[];#We=null;constructor(){}frustum(){return this.#Z}#je(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n&&n.id===t)return n}return null}findModel(e){return this.#je(this.#Ue,e)}findHiddenModel(e){return this.#je(this.#Ve,e)}addModel(e){-1===this.#Ue.indexOf(e)&&(this.#Ue.push(e),this.#Be.length=this.#Ue.length,this.#ke.length=this.#Ue.length,this.recomputeLinePrecision())}removeModel(e){const t=this.#Ue.indexOf(e);return t>=0&&this.#Ue.splice(t,1),this.#Be.length=this.#Ue.length,this.#ke.length=this.#Ue.length,this.recomputeLinePrecision(),t>=0}addHiddenModel(e){const t=this.#Ve.indexOf(e);return t<0&&this.#Ve.push(e),t<0}removeHiddenModel(e){const t=this.#Ve.indexOf(e);return t>=0&&this.#Ve.splice(t,1),t>=0}isEmpty(){return 0===this.#Ue.length}recomputeLinePrecision(){let e=1;const t=new o.Vector3;for(let i=0,n=this.#Ue.length;i<n;++i){const n=this.#Ue[i].getData().bbox;if(0===n.getSize(t).length())continue;const r=.001*o.Box3.prototype.getBoundingSphere.call(n,new o.Sphere).radius;e=Math.min(e,r)}this.#Ge.params.Line.threshold=e}_updateAvgFrameTime(e,t){if(void 0===e.avgFrameTime)return e.avgFrameTime=t,void(e.outliers=[]);let i=!0;t<.7*e.avgFrameTime||t>1.5*e.avgFrameTime?(e.outliers.push(t),i=!1,e.outliers.length>4&&(e.avgFrameTime=e.outliers.reduce(((e,t)=>e+t),0)/e.outliers.length,e.outliers.splice(0,1e3))):e.outliers.splice(0,1e3),i&&(e.avgFrameTime=.95*e.avgFrameTime+.05*t)}#qe(e,t,i){let n,r;for(n=0;n<e.length;n++){r=e[n];const i=r.boundingBox||r.getBoundingBox();r.cameraDistance=i.distanceToPoint(t.position)}e.sort((function(e,t){return t.cameraDistance-e.cameraDistance}));let o=performance.now();for(n=0;n<e.length;n++){r=e[n],r.render?r.render(i):i(r);const t=performance.now(),s=t-o;o=t,this._updateAvgFrameTime(r,s)}}frameResumePossible(){return!this.#ze}renderSome(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=performance.now(),o=r;const s=this.budgetForTransparent*t;let a=null,l=0,c=0,h=0,u=n.PER_FRAME_CONSOLIDATION_TIME_BUDGET;const d=e=>{const n=performance.now()+Math.min(u,.5*t);let o=performance.now(),s=e.nextBatch(n),a=performance.now(),l=a-o;return t-=l/i,u-=l,r=a,s};for(;;){let i=0,n=null;for(let e=0;e<this.#Be.length;e++){let r=this.#Be[e];a=this.#Ue[e],r||(this.#Be[e]=r=d(a));if(this.#ze&&t<s){r&&!r.sortObjects&&(a.skipOpaqueShapes(),this.#Be[e]=r=d(a))}if(null===r)continue;n||(i=e,n=r);const o=r.sortObjects==n.sortObjects&&r.renderImportance>n.renderImportance,l=!r.sortObjects&&n.sortObjects;(o||l)&&(i=e,n=r)}if(!n){this.#$=!0;break}if(this.#Be[i]=d(this.#Ue[i]),n.sortObjects&&this.#ze)this.#He.push(n),t-=void 0===n.avgFrameTime?.05:n.avgFrameTime;else{n.render?n.render(e):e(n),Object.prototype.hasOwnProperty.call(n,"drawEnd")&&(n.drawEnd=n.lastItem),o=performance.now();let i,s=o-r;r=o,l>5&&(i=c/l,s>5*i&&h<3&&(s=n.avgFrameTime??i,h++)),c+=s,l++,void 0===n.avgFrameTime&&(s=i??.5),this._updateAvgFrameTime(n,s),t-=n.avgFrameTime}if(t<=0)break}return this.#He.length>0&&(this.#qe(this.#He,this.#We,e),this.#He.length=0),t}reset(e,t,i,r){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.#$=!1,this.#Z.reset(e,r,o),this.#Z.areaCullThreshold=n.PIXEL_CULLING_THRESHOLD,this.#Ue.length){this.#ze=this.enableNonResumableFrames&&i==a.ResetFlags.RESET_RELOAD&&t===s.RenderFlags.RENDER_NORMAL,this.#We=e;for(let n=0;n<this.#Ue.length;n++)this.#Ue[n].resetIterator(e,this.#Z,t,i),this.#Be[n]=this.#Ue[n].nextBatch(),this.#ke[n]=null}}isDone(){return this.#$||this.isEmpty()}setAllVisibility(e){for(let t=0;t<this.#Ue.length;t++)this.#Ue[t].setAllVisibility(e)}hideLines(e){for(let t=0;t<this.#Ue.length;t++)this.#Ue[t].hideLines(e)}hidePoints(e){for(let t=0;t<this.#Ue.length;t++)this.#Ue[t].hidePoints(e)}hasHighlighted(){for(let e=0;e<this.#Ue.length;e++)if(this.#Ue[e].hasHighlighted())return!0;return!1}areAllVisible(){for(let e=0;e<this.#Ue.length;e++)if(!this.#Ue[e].areAllVisible())return!1;return!0}areAll2D(){for(let e=0;e<this.#Ue.length;e++)if(!this.#Ue[e].is2d())return!1;return!0}areAll3D(){for(let e=0;e<this.#Ue.length;e++)if(!this.#Ue[e].is3d())return!1;return!0}invalidateVisibleBounds(){for(let e=0;e<this.#Ue.length;e++)this.#Ue[e].visibleBoundsDirty=!0}getVisibleBounds(e,t,i){c.makeEmpty();for(let n=0;n<this.#Ue.length;n++){const r=this.#Ue[n].getVisibleBounds(e,i);t&&!t(r)||c.union(r)}return c}rayIntersect(e,t,i,n,r,o,s,a){if(this.#Ge.set(e,t),this.#Ue.length>1){const e=[];if(r)for(let t=0;t<r.length;t++){const l=this.findModel(r[t]);if(l){const r=n&&n[t],c=l.rayIntersect(this.#Ge,i,r,o,s,a);c&&e.push(c)}}else for(let t=0;t<this.#Ue.length;t++){const r=this.#Ue[t].rayIntersect(this.#Ge,i,n,o,s,a);r&&e.push(r)}return e.length?(e.sort((function(e,t){return e.distance-t.distance})),e[0]):null}{if(!this.#Ue.length)return null;const e=this.#Ue[0];return r&&-1===r.indexOf(e.id)?null:e.rayIntersect(this.#Ge,i,n,o,s,a)}}getRenderProgress(){return this.#Ue[0].getRenderProgress()}getModels(){return this.#Ue}getHiddenModels(){return this.#Ve}getAllModels(){return this.#Ue.concat(this.#Ve)}getFragmentList(){return this.#Ue[0].getFragmentList()}getGeometryList(){return this.#Ue[0].getGeometryList()}getSceneCount(){return this.#Ue[0].getSceneCount()}getGeomScenes(){let e=[];for(let t=0;t<this.#Ue.length;t++){const i=this.#Ue[t].getGeomScenes();for(let t=0;t<i.length;t++){const n=i[t];n&&e.push(n)}}return e}getGeomScenesPerModel(){return this.#Ue.reduce(((e,t)=>(e.push(t.getGeomScenes()),e)),[])}explode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.#Ue.length){for(let i=0;i<this.#Ue.length;i++){const n=this.#Ue[i];l.L.explode(n,e,t)}this.invalidateVisibleBounds()}}update(e){let t=!1;for(let i=0;i<this.#Ue.length;i++){const n=this.#Ue[i];t=t||n.update(e)}return t}hideModel(e){for(let t=0;t<this.#Ue.length;t++){const i=this.#Ue[t];if(i&&i.id===e)return this.removeModel(i),this.#Ve.push(i),!0}return!1}showModel(e){for(let t=0;t<this.#Ve.length;++t){const i=this.#Ve[t];if(i&&i.id===e)return this.addModel(i),this.#Ve.splice(t,1),!0}return!1}}},19129:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ResetFlags:()=>n});var n={RESET_NORMAL:0,RESET_REDRAW:1,RESET_RELOAD:2}},12153:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SceneMath:()=>c});var n=i(72091);const r=[new n.Vector3(1,0,0),new n.Vector3(0,1,0),new n.Vector3(0,0,1),new n.Vector3(-1,0,0),new n.Vector3(0,-1,0),new n.Vector3(0,0,-1)];let o=new n.Plane;new n.Vector3;function s(e,t,i,r){var o=e;o.z=-1;var s=new n.Vector3(o.x,o.y,1);o=o.unproject(t),(s=s.unproject(t)).sub(o).normalize();var a,l=s;if(Math.abs(l[i])<1e-6)return null;a=t.isPerspective?t.position:o;var c=((r?r.min[i]:0)-a[i])/l[i];return l.multiplyScalar(c),l.add(a),l}function a(e,t,i){var n=e.clone();return n.max(t),n.min(i),n.distanceToSquared(e)}function l(e,t){return a(e,t.min,t.max)}let c={box2CutPlanes:function(e,t){let i=[];for(let s=0;s<r.length;s++){o.normal.copy(r[s]);const a=s<3?e.max:e.min;o.constant=-o.normal.dot(a),t&&o.applyMatrix4(t),i.push(new n.Vector4(o.normal.x,o.normal.y,o.normal.z,o.constant))}return i},getPixelsPerUnit:function(e,t,i,r,o,a){if(!e.isPerspective)return r/e.orthoScale;let c,h=i.getCenter(new n.Vector3);if(t)if(a)c=Math.sqrt(l(e.position,a));else{const t="z",i=s(new n.Vector3(0,0,1),e,t);i&&(h=i),c=e.position.distanceTo(h)}else{if(o){const t=o,n=e.target.clone().sub(e.position).normalize(),r=n.dot(t);if(0!==r){const o=-(e.position.clone().dot(t)+t.w)/r;h=i.clampPoint(n.multiplyScalar(o).add(e.position),h)}}c=e.position.distanceTo(h)}return r/(2*c*Math.tan(n.Math.degToRad(.5*e.fov)))},intersectGroundViewport:s,getNormalizingMatrix:function(e,t){t=t||e.getData().bbox;var i=new n.Matrix4;i.makeTranslation(-t.min.x,-t.min.y,-t.min.z);var r=new n.Vector3(0,0,0).subVectors(t.max,t.min),o=new n.Matrix4;o.makeScale(1/r.x,1/r.y,1);var s=new n.Matrix4;return s.multiplyMatrices(o,i),s},pointToMinMaxBoxDistance2:a,pointToBoxDistance2:l}},34845:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SceneTraversal:()=>s});var n=i(81422),r=i(70101),o=i(8879);class s{#Xe=new Map;#Ye="NoOp";#Ke=null;#Z=void 0;#ge=void 0;constructor(){this.addTraversalController("NoOp",new r.NoOpTraversalController)}addTraversalController(e,t){this.#Xe.set(e,t),this.#Qe()}getTraversalController(){return this.#Xe.get(this.#Ye)}#Qe(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||!this.#Xe.has("BVH")?this.#Xe.has("Linear")?this.#Ye="Linear":this.#Xe.has("Custom")?this.#Ye="Custom":this.#Ye="NoOp":this.#Ye="BVH"}dtor(){this.#Ke&&(this.#Ke.dispose(),this.#Ke=null),this.#Xe.forEach((e=>{e.dtor()})),this.#Xe=null,this.#Ye=null}nextBatch(e){const t=this.getTraversalController().nextBatch();if(!t)return null;if(this.#Ke&&t instanceof o.RenderBatch){const i=this.#Ke.consolidateNextBatch(t,this.#Z,this.#ge,e);return i||t}return t}updateView(e,t,i,n){this.#Z=t,this.#ge=i,this.#Qe(n),this.getTraversalController().reset(t,e),this.#Ke&&this.#Ke.reset()}getVisibleBounds(e,t,i){this.getTraversalController().getVisibleBounds(e,t,i)}getScenes(){const e=this.getTraversalController();return e.isModelIteratorTexQuad?[]:e.getGeomScenes()}getSceneCount(){return this.getTraversalController().getSceneCount()}getInnerAttributes(){return{currentIterator:this.getTraversalController(),linearIterator:this.#Xe.get("Linear"),bvhIterator:this.#Xe.get("BVH"),consolidationIterator:this.#Ke}}setInnerAttributes(e){var t;(!this.#Xe.has("Linear")&&e._linearIterator&&(this.#Xe.set("Linear",e._linearIterator.clone()),e._linearIterator===e._iterator&&(this.#Ye="Linear")),!this.#Xe.has("BVH")&&e._bvhIterator&&(this.#Xe.set("BVH",e._bvhIterator.clone()),e._bvhIterator===e._iterator&&(this.#Ye="BVH")),!this.#Ke&&e._consolidationIterator&&(this.#Ke=e._consolidationIterator.clone()),"NoOp"==!this.#Ye)&&(this.#Xe.set("Custom",null!==(t=e._iterator)&&void 0!==t&&t.clone?e._iterator.clone():e._iterator),this.#Ye="Custom")}addFragment(e){"Linear"==this.#Ye&&this.getTraversalController().addFragment(e)}setVisibilityLeaflet(e){this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().setVisibility(e)}needsRedrawLeaflet(e){return!!this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().update(e)}clearThemingColorsLeaflet(){this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().clearThemingColor()}setThemingColorLeaflet(e){return!!this.getTraversalController().isModelIteratorTexQuad&&(this.getTraversalController().setThemingColor(e),!0)}getLeafletIterator(){return this.getTraversalController().isModelIteratorTexQuad?this.getTraversalController():null}setModelTransformLeaflet(e){this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().setModelMatrix(e)}getModelTransformLeaflet(){if(this.getTraversalController().isModelIteratorTexQuad)return this.getTraversalController().getModelMatrix()}getInverseModelTransformLeaflet(){if(this.getTraversalController().isModelIteratorTexQuad)return this.getTraversalController().getInverseModelMatrix()}setViewportBoundsLeaflet(e){this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().setViewBounds(e)}getViewportBoundsLeaflet(){if(this.getTraversalController().isModelIteratorTexQuad)return this.getTraversalController().getViewBounds()}setDoNotCutLeaflet(e){this.getTraversalController().isModelIteratorTexQuad&&this.getTraversalController().setDoNotCut(e)}updateModelTransformConsolidation(){this.#Ke&&this.#Ke.modelMatrixChanged()}enableConsolidation(e,t){this.#Ke=new n.ConsolidationIterator(e,t)}disableConsolidation(){this.#Ke.dispose(),this.#Ke=null}getConsolidation(){var e;return null===(e=this.#Ke)||void 0===e?void 0:e.getConsolidation()}isEnabledConsolidation(){return!!this.#Ke}updateRenderProxy(e,t){this.isEnabledConsolidation()&&this.#Ke.updateRenderProxy(e,t)}skipOpaqueShapes(){this.getTraversalController().skipOpaqueShapes&&this.getTraversalController().skipOpaqueShapes()}}},63430:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SelectionMode:()=>n});let n={LEAF_OBJECT:0,FIRST_OBJECT:1,LAST_OBJECT:2}},71082:(e,t,i)=>{"use strict";function n(e){var t=e||function(e,t){return e<t},i=[],n=[];function r(e,o,s){if(o||(o=0),s||(s=n.length),o>=s)return s;if(s===o+1){var a=i[n[o]];return t(a,e)?s:o}var l=parseInt(o+(s-o)/2),c=i[n[l-1]];return t(e,c)?r(e,o,l):t(c,e)?r(e,l,s):l-1}this.add=function(e){var t=r(e);if(t==n.length)return i.push(e),void n.push(i.length-1);i.push(e),n.splice(t,0,i.length-1)},this.size=function(){return n.length},this.get=function(e){return i[n[e]]},this.removeAt=function(e){var t=n[e];i[t]=void 0,n.splice(e,1)},this.toString=function(){for(var e="",t=0,i=this.size();t<i;++t)e+=this.get(t),t<i-1&&(e+=", ");return e}}i.r(t),i.d(t,{SortedList:()=>n})},36411:(e,t,i)=>{"use strict";i.r(t),i.d(t,{VBIntersector:()=>m});var n,r,o,s,a=i(69511),l=i(72091);function c(){n||(n=new l.Matrix4,r=new l.Ray,new l.Vector3,new l.Vector3,new l.Vector3,o=new l.Vector3,s=new l.Vector3)}function h(e,t,i){c();var h=e.geometry;if(h){var u=e.material,d=u?u.side:l.FrontSide;n.copy(e.matrixWorld).invert(),r.copy(t.ray).applyMatrix4(n);var f,p,m=t.precision||1e-4;(0,a.enumMeshTriangles)(h,(function(n,a,c,h,u,g,v,y,b,x){null!==(f=d===l.BackSide?r.intersectTriangle(c,a,n,!0,o):r.intersectTriangle(n,a,c,d!==l.DoubleSide,o))&&(f.applyMatrix4(e.matrixWorld),(p=t.ray.origin.distanceTo(f))<m||p<t.near||p>t.far||(l.Triangle.getNormal(n,a,c,s),i.push({distance:p,point:f.clone(),face:new l.Face3(h,u,g,s.clone()),faceIndex:x,fragId:e.fragId,dbId:e.dbId,object:e,modelId:e.modelId})))}))}}function u(e,t,i,o){c();var s=e.geometry;if(s){var h=t.params.Line.threshold;e.isWideLine&&(e.material.linewidth?h=e.material.linewidth:e.geometry.lineWidth&&(h=e.geometry.lineWidth));var u=h*h;n.copy(e.matrixWorld).invert(),r.copy(t.ray).applyMatrix4(n);var d=new l.Vector3,f=new l.Vector3;s instanceof l.BufferGeometry&&(0,a.enumMeshLines)(s,(function(n,s,a,l,c){var h,p;if(r.distanceSqToSegment(n,s,f,d),d.applyMatrix4(e.matrixWorld),f.applyMatrix4(e.matrixWorld),(p=d.distanceToSquared(f))>u)return;if((h=t.ray.origin.distanceTo(d))<t.near||h>t.far)return;let m={distance:h,point:d.clone(),face:{a,b:l},faceIndex:c,fragId:e.fragId,dbId:e.dbId,object:e,distanceToRay:Math.sqrt(p)};o&&o.filter&&!o.filter(m)||i.push(m)}))}}function d(e,t,i,o){e.isLine||e.isWideLine?null!=o&&o.skipLines||u(e,t,i,o):e.isPoint?null!=o&&o.skipPoints||function(e,t,i){c();var o=e.geometry;if(o){n.copy(e.matrixWorld).invert(),r.copy(t.ray).applyMatrix4(n);var s=t.precision||1e-4,h=t.params.PointCloud.threshold;h||(h=1),h*=Math.max(3,o.pointSize),h/=4,o instanceof l.BufferGeometry&&(0,a.enumMeshVertices)(o,(function(n,o,a,l){if(!(r.distanceToPoint(n)>h)){var c=r.closestPointToPoint(n);if(null!==c){c.applyMatrix4(e.matrixWorld);var u=t.ray.origin.distanceTo(c);u<s||u<t.near||u>t.far||i.push({distance:u,point:n,face:{a:l},faceIndex:l,fragId:e.fragId,dbId:e.dbId,object:e})}}}))}}(e,t,i):null!=o&&o.skipMeshes||h(e,t,i)}function f(e,t,i,n){if(e instanceof l.Mesh?d(e,t,i):e.raycast(t,i),!0===n)for(var r=e.children,o=0,s=r.length;o<s;o++)f(r[o],t,i,!0)}var p=function(e,t){return e.distance-t.distance};let m={meshRayCast:h,lineRayCast:u,rayCast:d,intersectObject:function(e,t,i,n){f(e,t,i,n),i.sort(p)}}},81760:(e,t,i)=>{"use strict";i.r(t),i.d(t,{VertexBufferReader:()=>r});var n=2*Math.PI;function r(e){var t;this.vb=e.vb.buffer,this.stride=e.vbstride,this.vbf=new Float32Array(this.vb),this.vbi=new Int32Array(this.vb),this.vbs=new Uint16Array(this.vb),this.ib=e.ib,this.vcount=this.vbf.length/this.stride,this.useInstancing=e.numInstances>0,this.useCompactBuffers=e.unpackXform,this.texData=this.useCompactBuffers&&(null===(t=e.tIdColor)||void 0===t||null===(t=t.image)||void 0===t?void 0:t.data)&&new Uint32Array(e.tIdColor.image.data.buffer),this.isInterleavedVb=(()=>{const t=e.attributes;if(!t)return!1;const i=t.layerVp4b,n=t.flags4b;if(this.useCompactBuffers){return t.uvIdColor&&i&&n}{const e=t.color4b,r=t.dbId4b;return e&&r&&i&&n}})()}r.prototype.getDbIdAt=function(e){return this.texData?this.texData[this.vbs[e*this.stride*2+7]]:this.vbi[e*this.stride+7]},r.prototype.getColorAt=function(e){return this.texData?this.texData[this.vbs[e*this.stride*2+6]]:this.vbi[e*this.stride+6]},r.prototype.getVertexFlagsAt=function(e){return this.texData?this.vbi[e*this.stride+4]:this.vbi[e*this.stride+8]},r.prototype.getLayerIndexAt=function(e){return this.texData?65535&this.vbi[e*this.stride+5]:65535&this.vbi[e*this.stride+9]},r.prototype.getViewportIndexAt=function(e){return this.texData?this.vbi[e*this.stride+5]>>16&65535:this.vbi[e*this.stride+9]>>16&65535},r.prototype.decodeLineAt=function(e,t,i,r){if(r.onLineSegment){if(this.useCompactBuffers)var o=this.stride*e*2,s=this.useCompactBuffers.x*this.vbs[o]/65535+this.useCompactBuffers.z,a=this.useCompactBuffers.y*this.vbs[o+1]/65535+this.useCompactBuffers.w,l=this.vbs[o+2]/65535*n-Math.PI,c=this.vbs[o+3]/65535*Math.max(this.useCompactBuffers.x,this.useCompactBuffers.y),h=this.vbs[o+4]/32767*Math.max(this.useCompactBuffers.x,this.useCompactBuffers.y)*2;else{var u=this.stride*e;s=this.vbf[u],a=this.vbf[u+1],l=this.vbf[u+2]*n-Math.PI,c=this.vbf[u+3],h=2*this.vbf[u+4]}var d=s+c*Math.cos(l),f=a+c*Math.sin(l);r.onLineSegment(s,a,d,f,i,h)}},r.prototype.decodeCircularArcAt=function(e,t,i,r){if(r.onCircularArc){if(this.useCompactBuffers)var o=this.stride*e*2,s=this.useCompactBuffers.x*this.vbs[o]/65535+this.useCompactBuffers.z,a=this.useCompactBuffers.y*this.vbs[o+1]/65535+this.useCompactBuffers.w,l=this.vbs[o+2]/65535*n,c=this.vbs[o+3]/65535*n,h=this.vbs[o+5]/65535*Math.max(this.useCompactBuffers.x,this.useCompactBuffers.y);else{var u=this.stride*e;s=this.vbf[u],a=this.vbf[u+1],l=this.vbf[u+2]*n,c=this.vbf[u+3]*n,h=this.vbf[u+5]}r.onCircularArc(s,a,l,c,h,i)}},r.prototype.decodeEllipticalArcAt=function(e,t,i,r){if(r.onEllipticalArc){var o=this.stride*e,s=this.vbf[o],a=this.vbf[o+1],l=this.vbf[o+2]*n,c=this.vbf[o+3]*n,h=this.vbf[o+5],u=this.vbf[o+10],d=this.vbf[o+11];r.onEllipticalArc(s,a,l,c,h,u,d,i)}},r.prototype.decodeTexQuadAt=function(e,t,i,r){if(r.onTexQuad){if(this.useCompactBuffers)var o=this.stride*e*2,s=this.useCompactBuffers.x*this.vbs[o]/65535+this.useCompactBuffers.z,a=this.useCompactBuffers.y*this.vbs[o+1]/65535+this.useCompactBuffers.w,l=this.vbs[o+2]/65535*n,c=this.vbs[o+3]/65535*Math.max(this.useCompactBuffers.x,this.useCompactBuffers.y),h=this.vbs[o+4]/65535*Math.max(this.useCompactBuffers.x,this.useCompactBuffers.y);else{var u=this.stride*e;s=this.vbf[u],a=this.vbf[u+1],l=this.vbf[u+2]*n,c=this.vbf[u+3],h=this.vbf[u+4]}r.onTexQuad(s,a,c,h,l,i)}},r.prototype.decodeOneTriangleAt=function(e,t,i,n){if(n.onOneTriangle){if(this.useCompactBuffers)var r=this.stride*e*2,o=this.useCompactBuffers.x*this.vbs[r]/65535+this.useCompactBuffers.z,s=this.useCompactBuffers.y*this.vbs[r+1]/65535+this.useCompactBuffers.w,a=this.useCompactBuffers.x*this.vbs[r+2]/65535+this.useCompactBuffers.z,l=this.useCompactBuffers.y*this.vbs[r+3]/65535+this.useCompactBuffers.w,c=this.useCompactBuffers.x*this.vbs[r+4]/65535+this.useCompactBuffers.z,h=this.useCompactBuffers.y*this.vbs[r+5]/65535+this.useCompactBuffers.w;else{var u=this.stride*e;o=this.vbf[u],s=this.vbf[u+1],a=this.vbf[u+2],l=this.vbf[u+3],c=this.vbf[u+4],h=this.vbf[u+5]}n.onOneTriangle(o,s,a,l,c,h,i)}},r.prototype.decodeTriangleIndexed=function(e,t,i,n,r,o){if(o.onOneTriangle){if(this.useCompactBuffers){var s=this.stride*e*2,a=this.useCompactBuffers.x*this.vbs[s]/65535+this.useCompactBuffers.z,l=this.useCompactBuffers.y*this.vbs[s+1]/65535+this.useCompactBuffers.w;s=this.stride*t*2;var c=this.useCompactBuffers.x*this.vbs[s]/65535+this.useCompactBuffers.z,h=this.useCompactBuffers.y*this.vbs[s+1]/65535+this.useCompactBuffers.w;s=this.stride*i*2;var u=this.useCompactBuffers.x*this.vbs[s]/65535+this.useCompactBuffers.z,d=this.useCompactBuffers.y*this.vbs[s+1]/65535+this.useCompactBuffers.w}else{var f=this.stride*e;a=this.vbf[f],l=this.vbf[f+1];f=this.stride*t;c=this.vbf[f],h=this.vbf[f+1];f=this.stride*i;u=this.vbf[f],d=this.vbf[f+1]}o.onOneTriangle(a,l,c,h,u,d,r)}},r.prototype.decodeByType=function(e,t,i,n,r){switch(e){case 11:case 8:case 9:case 10:case 1:this.decodeLineAt(t,i,n,r);break;case 2:this.decodeCircularArcAt(t,i,n,r);break;case 3:this.decodeEllipticalArcAt(t,i,n,r);break;case 4:this.decodeTexQuadAt(t,i,n,r);break;case 5:this.decodeOneTriangleAt(t,i,n,r)}},r.prototype.enumGeomsForObject=function(e,t){if(this.useInstancing)for(var i=0;i<this.vcount;){var n=this.getVertexFlagsAt(i)>>8&255,r=this.getLayerIndexAt(i),o=this.getViewportIndexAt(i);(a=this.getDbIdAt(i)===e)&&this.decodeByType(n,i,r,o,t),i+=1}else for(i=0;i<this.ib.length;){var s=this.ib[i],a=(n=this.getVertexFlagsAt(s)>>8&255,r=this.getLayerIndexAt(s),o=this.getViewportIndexAt(s),this.getDbIdAt(s)===e);0===n?(a&&this.decodeTriangleIndexed(this.ib[i],this.ib[i+1],this.ib[i+2],r,o,t),i+=3):(a&&this.decodeByType(n,s,r,o,t),i+=6)}},r.prototype.enumGeomsForVisibleLayer=function(e,t){this.enumGeoms((function(t,i,n){return!e||0!==i&&-1!==e.indexOf(i)}),t)},r.prototype.enumGeoms=function(e,t){if(this.useInstancing)for(var i=0;i<this.vcount;){var n=this.getVertexFlagsAt(i)>>8&255,r=this.getLayerIndexAt(i),o=this.getViewportIndexAt(i),s=this.getDbIdAt(i);(l=!e||e(s,r,o))&&this.decodeByType(n,i,r,o,t),i+=1}else for(i=0;i<this.ib.length;){var a=this.ib[i],l=(n=this.getVertexFlagsAt(a)>>8&255,r=this.getLayerIndexAt(a),o=this.getViewportIndexAt(a),s=this.getDbIdAt(a),!e||e(s,r,o));0===n?(l&&this.decodeTriangleIndexed(this.ib[i],this.ib[i+1],this.ib[i+2],r,o,t),i+=3):(l&&this.decodeByType(n,a,r,o,t),i+=6)}}},69511:(e,t,i)=>{"use strict";i.r(t),i.d(t,{VertexEnumerator:()=>w,enumMeshEdges:()=>A,enumMeshIndices:()=>_,enumMeshLines:()=>S,enumMeshTriangles:()=>E,enumMeshVertices:()=>x,getIndicesCount:()=>g,getVertexCount:()=>m});var n,r,o,s,a,l,c,h,u,d,f,p=i(96118);function m(e){return e.vb?e.vb.length/e.vbstride:e.attributes.position?e.attributes.position.array.length/3:0}function g(e){const t=b(e);if(t){var i=e.groups;if(!i||0===i.length)return t.length;let o=0;for(var n=0,r=i.length;n<r;++n)o+=i[n].count;return o}return m(e)}function v(e){const t=e.attributes;let i,n,r;if(e.vblayout){if(!e.vblayout.position)return{positions:void 0,poffset:void 0};r=e.vblayout.position.offset}else{if(!t.position)return{positions:void 0,poffset:void 0};r=t.position.offset||0}return i=e.vb||t.position.array,n=e.vb?e.vbstride:3,{positions:i,stride:n,poffset:r}}function y(e){const t=e.attributes;let i=0,n=e.vb||t.normal&&t.normal.array,r=e.vblayout?e.vblayout.normal:t.normal||null;return r?(i=r.offset||0,i*=1):n=null,!r||r.array||3===r.itemSize&&4===r.bytesPerItem||(n=null),{normals:n,noffset:i}}function b(e){return e.ib||e.indices||(e.index?e.index.array:null)}function x(e,t,i){e.attributes;n||(n=new p.LmvVector3,r=new p.LmvVector3,new p.LmvVector3),i&&(o||(o=new THREE.Matrix3),o.getNormalMatrix(i));const{positions:s,stride:a,poffset:l}=v(e),{normals:c,noffset:h}=y(e);if(s)for(var u=m(e),d=l,f=h,g=0;g<u;g++,d+=a,f+=a)n.set(s[d],s[d+1],s[d+2]),i&&n.applyMatrix4(i),c&&(r.set(c[f],c[f+1],c[f+2]),i&&r.applyMatrix3(o)),t(n,c?r:null,null,g)}function _(e,t){const i=b(e);if(i){let n=e.groups;n&&0!==n.length||(n=[{start:0,count:i.length,index:0}]);for(let e=0,r=n.length;e<r;++e){let r=n[e].start,o=n[e].count,s=n[e].index;for(let e=r,n=r+o;e<n;e+=3){t(s+i[e],s+i[e+1],s+i[e+2])}}}else{let i=m(e);for(let e=0;e<i;e++){t(3*e,3*e+1,3*e+2)}}}function E(e,t){var i,n,r;s||(s=new p.LmvVector3,a=new p.LmvVector3,l=new p.LmvVector3,c=new p.LmvVector3,h=new p.LmvVector3,u=new p.LmvVector3);const{positions:o,stride:d,poffset:f}=v(e),{normals:g,noffset:x}=y(e),_=b(e);if(o)if(_){var E=e.groups;E&&0!==E.length||(E=[{start:0,count:_.length,index:0}]);for(var S=0,A=E.length;S<A;++S)for(var w=E[S].start,T=E[S].count,M=E[S].index,C=w,P=w+T;C<P;C+=3){var D=(i=M+_[C])*d+f,L=(n=M+_[C+1])*d+f,I=(r=M+_[C+2])*d+f;if(s.x=o[D],s.y=o[D+1],s.z=o[D+2],a.x=o[L],a.y=o[L+1],a.z=o[L+2],l.x=o[I],l.y=o[I+1],l.z=o[I+2],g){var R=i*d+x,O=n*d+x,N=r*d+x;c.x=g[R],c.y=g[R+1],c.z=g[R+2],h.x=g[O],h.y=g[O+1],h.z=g[O+2],u.x=g[N],u.y=g[N+1],u.z=g[N+2],t(s,a,l,i,n,r,c,h,u,C/3)}else t(s,a,l,i,n,r,null,null,null,C/3)}}else{var F=m(e);for(C=0;C<F;C+=3){D=(i=C)*d+f,L=(n=C+1)*d+f,I=(r=C+2)*d+f;if(s.x=o[D],s.y=o[D+1],s.z=o[D+2],a.x=o[L],a.y=o[L+1],a.z=o[L+2],l.x=o[I],l.y=o[I+1],l.z=o[I+2],g){R=i*d+x,O=n*d+x,N=r*d+x;c.x=g[R],c.y=g[R+1],c.z=g[R+2],h.x=g[O],h.y=g[O+1],h.z=g[O+2],u.x=g[N],u.y=g[N+1],u.z=g[N+2],t(s,a,l,i,n,r,c,h,u,C/3)}else t(s,a,l,i,n,r,null,null,null,C/3)}}}function S(e,t){var i,n,r=e.attributes;d||(d=new p.LmvVector3,f=new p.LmvVector3);var o=2;e.lineWidth&&(o=6);const s=b(e);if(s){let p,b;p=e.vb?e.vb:r.position.array,b=e.vb?e.vbstride:3;var a=e.groups;a&&0!==a.length||(a=[{start:0,count:s.length,index:0}]);for(var l=0,c=a.length;l<c;++l)for(var h=a[l].start,u=a[l].count,m=a[l].index,g=h,v=h+u,y=h/o;g<v;g+=o,y++)i=m+s[g],n=m+s[g+1],d.x=p[i*b],d.y=p[i*b+1],d.z=p[i*b+2],f.x=p[n*b],f.y=p[n*b+1],f.z=p[n*b+2],t(d,f,i,n,y)}else{const s=e.vb?e.vb:r.position.array,a=e.vb?e.vbstride:3;for(g=0,v=s.length/a,y=0;g<v;g+=o,y++)i=g,n=g+1,d.x=s[i*a],d.y=s[i*a+1],d.z=s[i*a+2],f.x=s[n*a],f.y=s[n*a+1],f.z=s[n*a+2],t(d,f,i,n,y)}}function A(e,t){var i,n;d||(d=new p.LmvVector3,f=new p.LmvVector3);const r=e.iblines;if(!r)return;const o=e.vb?e.vb:attributes.position.array,s=e.vb?e.vbstride:3;var a=e.groups;a&&0!==a.length||(a=[{start:0,count:r.length,index:0}]);for(var l=0,c=a.length;l<c;++l)for(var h=a[l].start,u=a[l].count,m=a[l].index,g=h,v=h+u;g<v;g+=2)i=m+r[g],n=m+r[g+1],d.x=o[i*s],d.y=o[i*s+1],d.z=o[i*s+2],f.x=o[n*s],f.y=o[n*s+1],f.z=o[n*s+2],t(d,f,i,n)}let w={getVertexCount:m,enumMeshVertices:x,enumMeshIndices:_,enumMeshTriangles:E,enumMeshLines:S,enumMeshEdges:A}},32431:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Consolidation:()=>B,ConsolidationBuilder:()=>k,canBeMerged:()=>U,copyPrimitiveProps:()=>N,copyVertexFormat:()=>O,isVisible:()=>L,mergeGeometries:()=>F});var n=i(72091),r=i(57872),o=i(69511),s=i(77201),a=i(22040),l=i(1433),c=i(7756),h=i(37365),u=i(96118);function d(e,t,i,n){var r=function(e){for(var t=new Uint16Array(e.length+1),i=0,n=0;n<e.length;n++)t[n]=i,i+=(0,o.getVertexCount)(e[n]);return t[n]=i,t}(e),s=new l.GeomMergeTask;return s.vb=t.vb,s.vbstride=t.vbstride,s.posOffset=t.attributes.position.offset,s.normalOffset=t.attributes.normal?t.attributes.normal.offset:-1,s.matrices=i,s.ranges=r,s.dbIds=n,s}function f(e,t){t.vb=e.vb,t.attributes.id.array=e.vertexIds,t.needsUpdate=!0}function p(e){var t=0,i={},n=[],r=e,o=new Array(2);function s(e){for(var n=e.data,s=0;s<n.length;s++){var a=n[s],l=a.taskId;f(a,i[l]),delete i[l]}if(0===--t)for(r.inProgress=!1,s=0;s<o.length;s++)o[s].terminate(),o[s]=null}this.addMergeTask=function(e,t,r,o){var s=d(e,t,r,o);n.push(s),i[s.id]=t},this.runTasks=function(){for(var e=0;e<2;e++)o[e]=p.createWorker(),o[e].addEventListener("message",s);for(var i=n.length,a=Math.floor(i/2),l=0;l<2;l++){var c=l*a,h=1===l?i:c+a,u=[],d=new Array(4*(h-c)),f=0;for(e=c;e<h;e++){var m=n[e];d[f++]=m.vb.buffer,d[f++]=m.matrices.buffer,d[f++]=m.ranges.buffer,d[f++]=m.dbIds.buffer,u.push(m)}var g={operation:"MERGE_GEOMETRY",tasks:u};o[l].doOperation(g,d),t++}r.inProgress=!0}}p.createWorker=c.createWorker;var m=i(83081),g=i(62612),v=i(68747),y=i(24528),b={UNKNOWN:0,TRIANGLES:1,LINES:2,WIDE_LINES:3,POINTS:4};function x(e){return e.isLines?b.LINES:e.isPoints?b.POINTS:e.isWideLines?b.WIDE_LINES:b.TRIANGLES}function _(e,t){switch(!0===e.isLines&&(e.isLines=void 0),!0===e.isWideLines&&(e.isWideLines=void 0),!0===e.isPoints&&(e.isPoints=void 0),t){case b.LINES:e.isLines=!0;break;case b.WIDE_LINES:e.isWideLines=!0;break;case b.POINTS:e.isPoints=!0}}var E=v.MeshFlags.MESH_HIGHLIGHTED,S=v.MeshFlags.MESH_VISIBLE|v.MeshFlags.MESH_HIDE|E,A=v.MeshFlags.MESH_VISIBLE,w=v.MeshFlags.MESH_VISIBLE|v.MeshFlags.MESH_HIDE,T=0,M=v.MeshFlags.MESH_HIGHLIGHTED|v.MeshFlags.MESH_HIDE,C=v.MeshFlags.MESH_HIGHLIGHTED,P=y.RenderFlags.RENDER_HIDDEN,D=y.RenderFlags.RENDER_HIGHLIGHTED;function L(e,t){switch(t){case P:return(e&w)===T;case D:return(e&M)===C}return(e&S)==A}const I=new n.Matrix4;function R(e){this.geoms=[],this.matrices=[],this.vertexCount=0,this.material=e,this.fragIds=[],this.worldBox=new n.Box3}function O(e,t){for(var i in e.vb||m.logger.warn("copyVertexFormat() supports only interleaved buffers"),t.vbstride=e.vbstride,e.attributes)t.attributes[i]=e.attributes[i];t.attributesKeys=e.attributesKeys.slice(0)}function N(e,t){_(t,x(e)),t.lineWidth=e.lineWidth,t.pointSize=e.pointSize}function F(e,t,i,r,a){var l=function(e){let t=e[0].vbstride;var i=0,r=0;let a,l=0;for(let t=0;t<e.length;t++){const n=e[t];r+=(0,o.getVertexCount)(n);let s=n.ib.length;if(s-=s%(n.isLines?2:3),i+=s,a=n.iblines,a){let e=a.length;e-=e%2,l+=e}}var c=(0,s.createBufferGeometry)();c.byteSize=0,c.vb=new Float32Array(r*t),c.ib=new Uint16Array(i),l>0&&(a=new Uint16Array(l),c.byteSize+=a.byteLength,c.iblines=a),c.byteSize+=c.vb.byteLength+c.ib.byteLength,N(e[0],c),O(e[0],c);var h=new n.BufferAttribute(new Float32Array,3);h.normalized=!0,h.bytesPerItem=1,c.setAttribute("id",h);var u=e[0];return _(c,x(u)),u.isPoints&&(c.pointSize=u.pointSize),u.isWideLines&&(c.lineWidth=u.lineWidth),c}(e);return l.boundingBox=r.clone(),function(e,t){for(var i=0,n=0,r=0,s=0,a=0;a<e.length;a++){var l=e[a],c=(0,o.getVertexCount)(l);const h=l.vb,u=l.ib;let d=u.length;const f=t.vb,p=t.ib,m=l.iblines;let g=(null==m?void 0:m.length)??0;const v=t.iblines;d-=d%(l.isLines?2:3);for(let e=0;e<d;e++)p[r+e]=u[e]+n;g-=g%2;for(let e=0;e<g;e++)v[s+e]=m[e]+n;s+=g,f.set(h,i),i+=h.length,n+=c,r+=d}}(e,l),a?a.addMergeTask(e,l,t,i):function(e,t,i,n){var r=d(e,t,i,n),o=new u.LmvVector3,s=new h.LmvMatrix4;f(r.run(s,o),t)}(e,l,t,i),l}function U(e,t){if(e.vbstride!=t.vbstride)return!1;if(x(e)!==x(t))return!1;if(e.isPoints&&e.pointSize!==t.pointSize)return!1;if(e.isWideLines&&e.lineWidth!==t.lineWidth)return!1;if(e.attributesKeys.length!=t.attributesKeys.length)return!1;for(var i=0,n=e.attributesKeys.length;i<n;i++){var r=e.attributesKeys[i],o=e.attributes[r],s=t.attributes[r];if(!s)return!1;if(o===s)continue;const n=o.bytesPerItem!==s.bytesPerItem;if(o.offset!==s.offset||o.normalized!==s.normalized||o.itemSize!==s.itemSize||n||o.isPattern!==s.isPattern)return!1}return!0}function B(e){this.meshes=[],this.fragId2MeshIndex=new Int32Array(e);for(var t=0;t<this.fragId2MeshIndex.length;t++)this.fragId2MeshIndex[t]=-1;this.byteSize=0,this.consolidationMap=null,r.USE_HLOD?(this.addSingleFragment=this._addSingleFragmentAsRenderBatch,this.nodeId2SingleFragIds=[]):this.addSingleFragment=this._addSingleFragmentAsTHREEMesh}function k(){this.buckets=new Map,this.bucketCount=0,this.costs=0}function V(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.fragOrder=new Uint32Array(e),this.ranges=new Uint32Array(t),this.boxes=new Array(t),this.numConsolidated=-1,this.tmpGeoms=[],this.tmpMatrix=new n.Matrix4,this.fragIdToNodeIdx=i}R.prototype={constructor:R,addGeom:function(e,t,i){this.geoms.push(e),this.fragIds.push(i),this.worldBox.union(t),this.vertexCount+=(0,o.getVertexCount)(e);var n=this.geoms.length;return 1==n?0:(void 0===e.byteSize&&m.logger.warn("Error in consolidation: Geometry must contain byteSize."),e.byteSize+(2==n?this.geoms[0].byteSize:0))}},B.prototype={constructor:B,addContainerMesh:function(e,t,i,r,o){var s=new n.Mesh(e,t);this.meshes.push(s),this.byteSize+=e.byteSize;var a=r||0,l=a+(o||i.length);s.frustumCulled=!1;for(var c=this.meshes.length-1,h=a;h<l;h++){var u=i[h];this.fragId2MeshIndex[u]=c}},addSingleMesh:function(e,t,i,r,o){var s=new n.Mesh(e,t);s.matrix.copy(r),s.matrixAutoUpdate=!1,s.dbId=o,s.fragId=i,this.meshes.push(s),s.frustumCulled=!1,this.fragId2MeshIndex[i]=this.meshes.length-1},_addSingleFragmentAsTHREEMesh:function(e,t){const i=t.getGeometry(e),n=t.getMaterial(e),r=t.getDbIds(e);t.getOriginalWorldMatrix(e,I),this.addSingleMesh(i,n,e,I,r)},_addSingleFragmentAsRenderBatch:function(e){const t=this.consolidationMap.fragIdToNodeIdx[e];let i=this.nodeId2SingleFragIds[t];i||(this.nodeId2SingleFragIds[t]=i=[]),i.push(e),this.fragId2MeshIndex[e]=this.meshes.length,this.meshes.push({fragId:e})},applyAttributes:function(e,t,i,n,r){var o=this.meshes[e],s=o.geometry,a=this.consolidationMap,l=t.vizflags;if(!s.attributes){if(performance.now()>r)return null;o.geometry=a._buildConsolidationGeometry(e,t),o.geometry.streamingDraw=s.streamingDraw,o.geometry.streamingIndex=s.streamingIndex,o.geometry.discardAfterUpload=s.discardAfterUpload,s=o.geometry}var c,h,u,d=a.fragOrder,f=s.numInstances,p=t.db2ThemingColor.length>0||void 0;if(f?h=(c=o.rangeStart)+o.geometry.numInstances:s.attributes.id?(c=a.ranges[e],h=e+1>=a.ranges.length?a.numConsolidated:a.ranges[e+1]):u=o.fragId,!n||void 0!==u)return s.groups&&void 0===u&&(s.groups=void 0),o.visible=L(l[void 0===u?d[c]:u],i),o.themingColor=p&&t.getThemingColor(u),o;var m,g,v=0,y=0,b=0,x=0,_=0;function E(){if(m){s.groups=s.groups||[];var e=s.groups[_]||{index:0};s.groups[_++]=e,f?(e.start=0,e.count=s.ib?s.ib.length:s.ibLength,(s.iblines||s.iblinesLength)&&(e.edgeStart=0,e.edgeCount=s.iblines?s.iblines.length:s.iblinesLength),e.instanceStart=v,e.numInstances=y-v):(e.start=v,e.count=y-v,(s.iblines||s.iblinesLength)&&(e.edgeStart=b,e.edgeCount=x-b)),e.themingColor=g}}for(var S=c;S<h;++S){var A=L(l[u=d[S]],i),w=p&&t.getThemingColor(u);if((A!==m||A&&w!==g)&&(y>v&&E(),v=y,b=x,m=A,g=w),f)y+=1;else{var T=t.getGeometry(u);y+=T.ib?T.ib.length:T.ibLength,(T.iblines||T.iblinesLength)&&(x+=T.iblines?T.iblines.length:T.iblinesLength)}}return 0===v?(o.themingColor=g,o.visible=m,o.material=Array.isArray(o.material)?o.material[0]:o.material):(o.visible=!0,E()),s.groups&&(s.groups.length=_),o},dispose:function(){for(var e={type:"dispose"},t={type:"removed"},i=0;i<this.meshes.length;i++){var n=this.meshes[i],r=n.geometry;r&&(n.dispatchEvent(t),r.dispatchEvent(e),r.needsUpdate=!0)}}},k.prototype={addGeom:function(e,t,i,n,r){var s=null;let a=r?`${t.id}_${r[n]}`:t.id;var l=this.buckets.get(a);if(l)for(var c=0;c<l.length;c++){var h=l[c];if(U(h.geoms[0],e))if(!((0,o.getVertexCount)(e)+h.vertexCount>65535)){s=h;break}}s||(s=new R(t),this.bucketCount++,l?l.push(s):this.buckets.set(a,[s])),this.costs+=s.addGeom(e,i,n)},createConsolidationMap:function(e,t,i){var n=new V(e.length,this.bucketCount,i),r=0,o=0;this.buckets.forEach((e=>{for(var t=0;t<e.length;t++){var i=e[t];n.ranges[o]=r,n.boxes[o]=i.worldBox,n.fragOrder.set(i.fragIds,r),r+=i.fragIds.length,o++}})),n.numConsolidated=t;for(var s=t;s<e.length;s++)n.fragOrder[s]=e[s];return n}},V.prototype={buildConsolidation:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=e.getCount(),o=this.ranges.length,s=new B(r),a=null;n||p.createWorker&&(a=new p(s)),s.consolidationMap=this;for(var l=0;l<o;l++)this._buildConsolidationMesh(l,e,t,i,n,a,s);return a&&a.runTasks(),s},_buildConsolidationMesh:function(e,t,i,n,r,o,s){var a=this.fragOrder,l=this.ranges.length,c=this.ranges[e],h=(e===l-1?this.numConsolidated:this.ranges[e+1])-c;if(1===h){const e=a[c];return void s.addSingleFragment(e,t)}let u=null;u=r?this._buildConsolidationPlaceholder(c,h,a,t):this._buildConsolidationGeometryImpl(e,c,h,a,t,o);var d=a[c],f=t.getMaterial(d),p=i.getMaterialVariant(f,g.MATERIAL_VARIANT.VERTEX_IDS,n);s.addContainerMesh(u,p,a,c,h)},_buildConsolidationGeometry:function(e,t,i){var n=this.fragOrder,r=this.ranges.length,o=this.ranges[e],s=(e===r-1?this.numConsolidated:this.ranges[e+1])-o;if(1!==s)return this._buildConsolidationGeometryImpl(e,o,s,n,t,i)},_buildConsolidationGeometryImpl:function(e,t,i,n,r,o){this.tmpGeoms.length=i;var s=new Float32Array(16*i),a=new Uint32Array(i);let l;for(var c=0;c<i;c++)l=n[t+c],this.tmpGeoms[c]=r.getGeometry(l),r.getOriginalWorldMatrix(l,this.tmpMatrix),s.set(this.tmpMatrix.elements,16*c),a[c]=r.getDbIds(l);var h=this.boxes[e];return F(this.tmpGeoms,s,a,h,o)},_buildConsolidationPlaceholder:function(e,t,i,n){let r=0;for(let o=0;o<t;o++){const t=i[e+o],s=n.getGeometry(t);r+=(0,a.getByteSize)(s)}return{byteSize:r,dispatchEvent:function(){}}}},B.applyBVHDefaults=function(e){e.frags_per_leaf_node=512,e.max_polys_per_node=1e5}},81422:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ConsolidationIterator:()=>d});var n=i(32431),r=i(23936),o=i(72091),s=i(4897),a=i(68747),l=i(24528),c=i(83081),h=i(57872),u=i(8879);function d(e,t){var i=e,f=t,p=[],m=!1;const g=[];var v=[],y=new o.Matrix4,b=new o.Box3;function x(e){const t=i.matrix,n=e.consolidatedScene||e;t?(n.matrixWorld.copy(t),n.matrixAutoUpdate=!1):n.matrixWorld.identity()}function _(){const e=f.meshes;for(let t=0;t<e.length;t++)e[t].matrixWorldNeedsUpdate=!0}this.acquireSceneOrConsolidatedRenderBatch=function(e){const t=e.nodeIndex;let i;return g[t]?i=g[t].consolidatedScene||g[t]:(g[t]=h.USE_HLOD?new u.ConsolidatedRenderBatch(this,e,f):new o.Scene,i=g[t].consolidatedScene||g[t],x(i)),i.children.length=0,g[t]},_(),this.modelMatrixChanged=function(){for(let e=0;e<g.length;e++){const t=g[e];t&&x(t)}_()},this.getConsolidation=function(){return f},this.reset=function(){p.length=null;var t=i.getCount(),n=a.MeshFlags.MESH_MOVED,r=a.MeshFlags.MESH_VISIBLE,o=r|a.MeshFlags.MESH_HIDE|a.MeshFlags.MESH_HIGHLIGHTED,s=i.vizflags,l=f.fragId2MeshIndex;if(i.vizFlagsChanged()||i.themeingOrGhostingChanged()){v.length=0,m=!1;for(var c=i.db2ThemingColor.length>0,h=0;h<t;h++){var u=s[h];if(u&n){m=!0;break}if(u&o^r||c&&e.getThemingColor(h)){var d=l[h];d>=0&&(v[d]=!0)}}}},this.dispose=function(){f.dispose()},this.consolidateNextBatch=function(e,t,n,r){var a=e.nodeIndex;if(m||void 0===a)return e;if(f.inProgress)return e;let u,d=!1,g=this.acquireSceneOrConsolidatedRenderBatch(e);if(h.USE_HLOD)u=g.consolidatedScene;else{u=g;const i=n===l.RenderFlags.RENDER_HIDDEN?e.getBoundingBoxHidden():e.getBoundingBox(),r=t.intersectsBox(i);if(r===s.FrustumIntersector.OUTSIDE)return null;if(h.ENABLE_PIXEL_CULLING&&t.estimateProjectedDiameter(i)<t.areaCullThreshold)return null;d=r!==s.FrustumIntersector.CONTAINS}u.numFragsStreamingDraw=0;const y=e.getIndices();for(var x=e.start;x<e.lastItem;x++){var _,E,S=y?y[x]:x,A=f.fragId2MeshIndex[S];if(-1===A){if(!i.hasGeometry(S))continue;return c.logger.warn("Warning: Missing fragment in consolidation. Consolidation disabled."),e}if(!p[A]&&void 0!==f.meshes[A].geometry){if(!h.USE_HLOD){if(i.getWorldBounds(S,b),d&&!t.intersectsBox(b))continue;if(h.ENABLE_PIXEL_CULLING&&t.estimateProjectedDiameter(b)<t.areaCullThreshold)continue}if(p[A]=!0,null===(E=f.applyAttributes(A,i,n,v[A],r)))return e;if(E.visible){var w=E&&E.geometry,T=w&&(w.isLines||w.isWideLines),M=w&&w.isPoints;i.linesHidden&&T||i.pointsHidden&&M||(null!==(_=w)&&void 0!==_&&_.streamingDraw&&u.numFragsStreamingDraw++,u.add(E))}}}return u.boundingBox||(u.boundingBox=new o.Box3),e.getBoundingBox(u.boundingBox),u.renderImportance=e.renderImportance,u.sortObjects=e.sortObjects,e.lights&&u.children.push(e.lights),g};var E={Merged:1,Instanced:2,Original:3};function S(e){if(e){if(e.numInstances)return E.Instanced;if(e.attributes)return E.Merged}return E.Original}this.updateRenderProxy=function(e,t){if(e.geometry&&e.geometry.attributes){var o=function(e){if(m)return E.Original;var t=f.fragId2MeshIndex[e],i=f.meshes[t];return S(null==i?void 0:i.geometry)}(t),s=S(e.geometry);if(e.needsUpdate||s!=o){var a=i.getGeometry(t),l=f.fragId2MeshIndex[t],c=f.meshes[l];if(o===E.Original)e.geometry=a,e.material=i.getMaterial(t),i.getWorldMatrix(t,e.matrix);else if(o===E.Instanced){i.getWorldMatrix(t,y);var h=i.fragments.fragId2dbId[t],u=new r.InstanceBufferBuilder(a,1);u.addInstance(y,h),e.geometry=u.finish(),e.material=Array.isArray(c.material)?c.material[0]:c.material,e.matrix.identity()}else i.getWorldMatrix(t,y),i.getWorldBounds(t,b),h=i.fragments.fragId2dbId[t],e.geometry=(0,n.mergeGeometries)([a],y.elements,[h],b),e.material=Array.isArray(c.material)?c.material[0]:c.material,e.matrix.identity();e.needsUpdate=!1,e.dispatchEvent({type:"removed"})}}},this.clone=function(){return new d(i,f)}}},90824:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CONSOLIDATION_STOP_MARKER:()=>l,consolidateFragmentList:()=>g});var n=i(32431),r=i(23936),o=i(62612),s=i(72091),a=i(75468);const l=Object.freeze({BVH_SORTING:{name:"Sorting fragments for BVH computation",progress:10},BVH:{name:"Computing Consolidation BVH",progress:30},SORTING:{name:"Sorting Fragments by Consolidation Costs",progress:50},MAP_CREATION:{name:"Creating Consolidation Map",progress:50},INSTANCING:{name:"Applying Instancing to Fragments",progress:70},FINAL_PROCESSING:{name:"Finalizing Consolidation",progress:95}}),c=5e4,h=1e4;let u=0;var d,f=(d=null,function(e,t,i,n,a,l){var c=e.getFragmentList();d||(d=new s.Matrix4);var h=i[n],u=c.getGeometry(h),f=c.getMaterial(h),p=a-n,m=a-1;if(p<=1)for(let e=n;e<=m;e++)l.addSingleFragment(i[e],c);else{var g=new r.InstanceBufferBuilder(u,p);for(let e=n;e<=m;e++){var v=i[e];c.getOriginalWorldMatrix(v,d);var y=c.fragments.fragId2dbId[v];if(!g.addInstance(d,y)){var b=i[m];i[m]=v,i[e]=b,--e,--m}}var x=g.finish();if(x){var _=t.getMaterialVariant(f,o.MATERIAL_VARIANT.INSTANCED,e);l.addContainerMesh(x,_,i,n,p),l.meshes[l.meshes.length-1].rangeStart=n}for(let e=m+1;e<a;e++)v=i[e],l.addSingleFragment(v,c)}});async function p(e,t,i,n){const r=e.getFragmentList(),o=e.getGeometryList();var s=0,a=r.getCount(),l=t&&t.length===a?t:new Int32Array(a);const c=new Uint32Array(a);for(var h=0;h<a;h++){if(!r.hasGeometry(h))continue;l[s]=h;const e=r.getGeometry(h),t=r.getGeometryId(h),i=o.getInstanceCount(t);c[h]=i*e.byteSize,s++}let d;return s<a&&(l=new Int32Array(l.buffer,l.byteOffset,s)),new Promise((e=>{const t=u++;d=i=>{i.data.jobId===t&&e(i.data.fragIds)},n.worker.addEventListener("message",d);const o={operation:"SORT_FRAGMENTS",fragIds:l,geomIds:r.geomids,memCosts:c,materialIds:r.materialids,fragIdToNodeIdx:i,jobId:t};n.worker.doOperation(o)})).finally((()=>{var e;null===(e=n.worker)||void 0===e||e.removeEventListener("message",d)}))}async function m(e,t){if(!t.consolidationMap||t.forceConsolidationMapRecomputation){var i;const r=e.getFragmentList();let o=null,c=new Int32Array(r.getCount());null!==(i=t.bvhOptions)&&void 0!==i&&i.per_tile_consolidation&&(o=new Uint32Array(r.getCount()),await async function(e,t,i,n){const r=e.getFragmentList(),o={boxes:r.fragments.boxes,polygonCounts:new Uint32Array(r.fragments.length),flags:new Uint8Array(r.fragments.length),materials:r.materialids,length:r.fragments.length,geomids:r.geomids};i=await p(e,i,t,n),n.stopIfCanceled(l.BVH_SORTING),n.signalProgress(l.BVH_SORTING.progress);const s=e.getFragmentList().materialIdMap;let c,h=0;for(let e=0;e<i.length;++e){const t=i[e],a=r.getGeometry(t);o.polygonCounts[t]=a?a.polyCount:0,h+=a.byteSize,h<=n.byteLimit&&(o.flags[t]=1);const l=s&&s[o.materials[t]];o.flags[t]|=l&&l.transparent?2:0}const d=await new Promise((t=>{const i=u++;c=e=>{if(e.data.jobId===i){const i=e.data.bvh;t({nodes:new a.NodeArray(i.nodes,i.useLeanNodes),primitives:i.primitives})}},n.worker.addEventListener("message",c),n.worker.doOperation({operation:"COMPUTE_BVH",fragments:o,modelId:e.id,bvhOptions:n.bvhOptions,jobId:i},[o.polygonCounts.buffer,o.flags.buffer])})).finally((()=>{var e;null===(e=n.worker)||void 0===e||e.removeEventListener("message",c)}));n.consolidationBVH=d,n.consolidationBVH.bvhOptions=n.bvhOptions,n.stopIfCanceled(l.BVH),n.signalProgress(l.BVH.progress);let f=e=>{const i=d.nodes.getPrimStart(e),n=i+d.nodes.getPrimCount(e);for(let r=i;r<n;++r)t[d.primitives[r]]=e;const r=d.nodes.getLeftChild(e);-1!=r&&(f(r),f(r+1))};f(0),f(1)}(e,o,c,t)),c=await p(e,c,o,t),t.stopIfCanceled(l.SORTING),t.signalProgress(l.SORTING.progress),t.consolidationMap=await async function(e,t,i,r){return new Promise((o=>{var a=new s.Box3,c=new n.ConsolidationBuilder,u=0;const d=()=>{r.stopIfCanceled(l.MAP_CREATION);const n=performance.now()+r.syncTimeSlice;for(;u<t.length&&!(c.costs>=r.byteLimit);u++){var s=t[u];e.getWorldBounds(s,a);var f=e.getGeometry(s),p=e.getMaterial(s);if(c.addGeom(f,p,a,s,i),u%h==0){const e=l.INSTANCING.progress-l.MAP_CREATION.progress;if(r.signalProgress(l.MAP_CREATION.progress+e*Math.max(u/t.length,c.costs/r.byteLimit)),performance.now()>n)return++u,void setTimeout(d,0)}}o(c.createConsolidationMap(t,u,i))};d()}))}(e.getFragmentList(),c,o,t)}return t.consolidationMap}async function g(e,t,i){const n=e.getFragmentList(),r=(i.consolidationMap=await m(e,i)).buildConsolidation(n,t,e,i.useDeferredConsolidation);await async function(e,t,i,n){var r=e.getFragmentList();const o=n.consolidationMap.fragOrder,s=n.consolidationMap.numConsolidated;if(s>=o.length)return;var a=s,u=-1,d=-1;let p,m=-1,g=0;const v=n.consolidationMap.fragIdToNodeIdx;await new Promise((y=>{let b=s;const x=()=>{n.stopIfCanceled(l.INSTANCING);const _=performance.now()+n.syncTimeSlice;for(;b<o.length;b++){var E=o[b],S=r.getGeometryId(E),A=r.getMaterialId(E),w=v?v[E]:-1;if((S!=u||A!=d||w!=m&&g>c)&&(b!=s&&f(e,t,o,a,b,i),a=b,u=S,d=A,m=w,g=0,p=r.getGeometry(E)),g+=p.ib?p.ib.length:0,b%h==0){const e=l.FINAL_PROCESSING.progress-l.INSTANCING.progress;if(n.signalProgress(l.INSTANCING.progress+e*b/o.length),performance.now()>_)return++b,void setTimeout(x,0)}}y()};x()})),f(e,t,o,a,o.length,i)}(e,t,r,i);const o=e.getModelId();for(let e=0;e<r.meshes.length;e++)r.meshes[e]instanceof s.Mesh&&(r.meshes[e].modelId=o);return r}},1433:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GeomMergeTask:()=>r,writeIdToBuffer:()=>s});var n=1;function r(){this.vb=null,this.vbstride=0,this.posOffset=0,this.normalOffset=0,this.matrices=null,this.ranges=null,this.dbIds=null,this.id=n++}function o(e){e.x=.5*(1+Math.atan2(e.y,e.x)/Math.PI),e.y=.5*(1+e.z),e.z=0}function s(e,t,i){t[i++]=255&e,t[i++]=e>>8&255,t[i++]=e>>16&255,t[i]=0}var a=function(e,t,i,n,r,s,a){for(var l,c,h,u,d,f,p,m=e.posOffset,g=n;g<r;g++){var v=g*e.vbstride+m;a.set(e.vb[v],e.vb[v+1],e.vb[v+2]),a.applyMatrix4(i),e.vb[v]=a.x,e.vb[v+1]=a.y,e.vb[v+2]=a.z}if(-1!==e.normalOffset){var y=2*e.vbstride,b=2*e.normalOffset,x=function(e,t){return t.copy(e),t[12]=0,t[13]=0,t[14]=0,t.invert().transpose()}(i,s);for(g=n;g<r;g++){var _=g*y+b;a.set(t[_],t[_+1],0),a.divideScalar(65535),c=void 0,h=void 0,u=void 0,d=void 0,f=void 0,p=void 0,c=2*(l=a).x-1,h=2*l.y-1,u=Math.sin(c*Math.PI),d=Math.cos(c*Math.PI),f=Math.sqrt(1-h*h),p=h,l.x=d*f,l.y=u*f,l.z=p,a.applyMatrix4(x),a.normalize(),o(a),a.multiplyScalar(65535),t[_]=a.x,t[_+1]=a.y}}};function l(e,t,i){for(var n=16*e,r=0;r<16;r++)i.elements[r]=t[r+n]}r.prototype.run=function(e,t){for(var i=this.vb,n=i.length/this.vbstride,r=e.clone(),o=new Uint8Array(3*n),c=-1!==this.normalOffset?new Uint16Array(i.buffer,i.byteOffset,2*i.length):null,h=this.ranges,u=this.matrices,d=h.length-1,f=0;f<d;f++){var p=h[f],m=h[f+1];l(f,u,e),a(this,c,e,p,m,r,t);for(var g=3*p,v=m-p,y=this.dbIds[f],b=0;b<v;b++)s(y,o,g),g+=3}return{taskId:this.id,vb:this.vb,vertexIds:o}}},23936:(e,t,i)=>{"use strict";i.r(t),i.d(t,{InstanceBufferBuilder:()=>l});var n=i(32431),r=i(1433),o=i(77201),s=i(83081),a=i(72091);function l(e,t){const i=(0,o.createBufferGeometry)(!0);i.ib=e.ib,i.vb=e.vb,i.iblines=e.iblines,(0,n.copyVertexFormat)(e,i),(0,n.copyPrimitiveProps)(e,i);this.offsets=new Float32Array(3*t),this.rotations=new Float32Array(4*t),this.scalings=new Float32Array(3*t),this.ids=new Uint8Array(3*t);var l=new a.Vector3,c=new a.Quaternion,h=new a.Vector3,u=new a.Matrix4,d=0,f=t;this.addInstance=function(e,t){return d>=f?(s.logger.warn("Instance buffer is already full."),!1):(e.decompose(l,c,h),!!function(e,t,i,n){u.compose(t,i,n);for(var r=e.elements,o=u.elements,s=0;s<16;s++){var a=r[s],l=o[s];if(Math.abs(l-a)>1e-4*Math.max(1,Math.min(Math.abs(a),Math.abs(l))))return!1}return!0}(e,l,c,h)&&(this.offsets[3*d]=l.x,this.offsets[3*d+1]=l.y,this.offsets[3*d+2]=l.z,this.rotations[4*d]=c.x,this.rotations[4*d+1]=c.y,this.rotations[4*d+2]=c.z,this.rotations[4*d+3]=c.w,this.scalings[3*d]=h.x,this.scalings[3*d+1]=h.y,this.scalings[3*d+2]=h.z,(0,r.writeIdToBuffer)(t,this.ids,3*d),d++,!0))},this.finish=function(){if(0==d)return null;let e,t,n,r;return d<f&&(this.offsets=new Float32Array(this.offsets.buffer,0,3*d),this.rotations=new Float32Array(this.rotations.buffer,0,4*d),this.scalings=new Float32Array(this.scalings.buffer,0,3*d),this.ids=new Uint8Array(this.ids.buffer,0,3*d)),e=new a.BufferAttribute(this.offsets,3),t=new a.BufferAttribute(this.rotations,4),n=new a.BufferAttribute(this.scalings,3),r=new a.BufferAttribute(this.ids,3),r.normalized=!0,r.bytesPerItem=1,e.divisor=1,t.divisor=1,n.divisor=1,r.divisor=1,i.setAttribute("instOffset",e),i.setAttribute("instRotation",t),i.setAttribute("instScaling",n),i.setAttribute("id",r),i.numInstances=d,i.byteSize=i.vb.byteLength+i.ib.byteLength+this.offsets.byteLength+this.rotations.byteLength+this.scalings.byteLength,i}}},47712:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ModelIteratorTexQuad:()=>w,TexQuadConfig:()=>A});var n=i(55280),r=i(76731),o=i(71082),s=i(37365),a=i(72091);function l(){this.offsetX=0,this.offsetY=0,this.scaleX=1,this.scaleY=1}function c(){var e=[],t=0;const i=new l;function n(e,t){var n=t||i;const r=[n.offsetX,n.offsetY,n.offsetX+n.scaleX,n.offsetY,n.offsetX+n.scaleX,n.offsetY+n.scaleY,n.offsetX,n.offsetY+n.scaleY],o=e.getAttribute("uv");if(o){for(let e=0;e<r.length;e+=2){const t=e/2;o.setXY(t,r[e],r[e+1])}o.needsUpdate=!0}else e.setAttribute("uv",new a.BufferAttribute(new Float32Array(r),2))}this.acquireQuadGeom=function(i){var r=e[t];return r?n(r,i):(r=this.createQuadGeom(i),e[t]=r),t++,r},this.createQuadGeom=function(e){var t=new a.BufferGeometry;return t.setAttribute("position",new a.BufferAttribute(new Float32Array([0,0,0,1,0,0,1,1,0,0,1,0]),3)),t.setIndex([0,1,2,0,2,3]),t.computeVertexNormals(),n(t,e),t},this.reset=function(){t=0},this.dispose=function(){for(var t=0;t<e.length;t++){var i=e[t];i&&(i.dispose(),i.needsUpdate=!0)}e=[]}}l.prototype.toVec4=function(){return new a.Vector4(this.offsetX,this.offsetY,this.scaleX,this.scaleY)},l.prototype.copyTo=function(e){e.offsetX=this.offsetX,e.offsetY=this.offsetY,e.scaleX=this.scaleX,e.scaleY=this.scaleY};var h=i(83081),u=i(12153),d=i(2179),f=i(86546),p=i.n(f),m=i(4965),g=i.n(m),v=i(30130);let y={uniforms:a.UniformsUtils.merge([a.UniformsLib.common,v.ShaderChunks.CutPlanesUniforms,v.ShaderChunks.IdUniforms,v.ShaderChunks.ThemingUniform,{selectionColor:{type:"v4",value:new a.Vector4(0,0,1,0)},viewportBounds:{type:"v4",value:new a.Vector4(0,0,1,1)},modelLocalMatrix:{type:"m4",value:new a.Matrix4}}]),vertexShader:p(),fragmentShader:g()};var b=0,x=1,_=2;const E=(0,n.getGlobal)().document;var S=function(e,t){this.timeStamps=e,this.mesh=t,this.state=b};function A(){this.urlPattern=null,this.tileSize=null,this.maxLevel=null,this.skippedLevels=[],this.textureLoader=null,this.texWidth=0,this.texHeight=0,this.maxActiveTiles=(0,n.isMobileDevice)()?0:400,this.cacheSize=(0,n.isMobileDevice)()?0:150,this.onRootLoaded=null,this.levelOffset=0,this.getRootTileSize=function(){return 1*(this.tileSize<<this.maxLevel)},this.getQuadWidth=function(){return this.scale*this.texWidth/this.getRootTileSize()},this.getQuadHeight=function(){return this.scale*this.texHeight/this.getRootTileSize()},this.getPageToModelTransform=function(e,t){var i=e/this.getQuadWidth(),n=t/this.getQuadHeight();return new s.LmvMatrix4(!0).set(i,0,0,0,0,n,0,0,0,0,1,0,0,0,0,1)},this.getBBox=function(){var e=this.getQuadWidth(),t=this.getQuadHeight();if(this.fitPaperSize)return new a.Box3(new a.Vector3,new a.Vector3(e,t,0));var i=1-t;return new a.Box3(new a.Vector3(0,i,0),new a.Vector3(e,1,0))},this.valid=function(){return"string"==typeof this.urlPattern&&this.urlPattern.length>0&&"number"==typeof this.tileSize&&this.tileSize>0&&"number"==typeof this.maxLevel&&this.maxLevel>0&&"number"==typeof this.texWidth&&this.texWidth>0&&"number"==typeof this.texHeight&&this.texHeight>0},this.initForSimpleImage=function(e){this.urlPattern=decodeURIComponent(e),this.maxLevel=0,this.levelOffset=0,this.scale=1,this.tileSize=-1,this.texWidth=-1,this.texHeight=-1,this.isSimpleImage=!0},this.isLevelPresent=function(e){return!this.skippedLevels[e]},this.initFromLoadOptions=function(e,t,i,n){if(this.urlPattern=decodeURIComponent(e),this.textureLoader=i,this.options=n,t){this.tileSize=t.tileSize,this.maxLevel=(r=t.texWidth,o=t.texHeight,s=t.tileSize,a=Math.ceil(Math.log2(r)),l=Math.ceil(Math.log2(o)),Math.max(a,l)-Math.log2(s)),this.texWidth=t.texWidth,this.texHeight=t.texHeight,this.levelOffset=t.levelOffset,this.zips=t.zips;const e=!(!t.paperWidth||!t.paperHeight);this.fitPaperSize=t.fitPaperSize&&e,this.paperHeight=t.paperHeight,this.scale=this.fitPaperSize?t.paperWidth*this.getRootTileSize()/this.texWidth:1,this.skippedLevels=function(e){var t=[];if(e.zips){i=(i=(i=(i=e.urlPattern.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")).replace(/\\{x\\}/,"[0-9]+")).replace(/\\{y\\}/,"[0-9]+")).replace(/\\{z\\}/,"([0-9]+)");var i=new RegExp("^"+i+"$");t.length=e.maxLevel+1,t.fill(!0);var n=0;e.zips.forEach((function(r){Object.keys(r.fileTable).forEach((function(r){var o=i.exec(r);if(o&&o[1]){var s=parseInt(o[1])-e.levelOffset;s>=0&&s<=e.maxLevel&&(t[s]=!1,++n)}}))})),0===n&&(t.length=0,h.logger.info("No leaflet levels found - assume all are present"))}return t}(this),"number"==typeof t.maxLevel&&function(e,t,i){for(;i>0&&e.skippedLevels[i];)--i;var n=t-i;n>0&&(e.texWidth>>=n,e.texHeight>>=n,e.maxLevel=i)}(this,this.maxLevel,t.maxLevel),this.maxActiveTiles=t.maxActiveTiles||this.maxActiveTiles,this.cacheSize=t.cacheSize||this.cacheSize}else this.options&&(this.options.loadOptions={});var r,o,s,a,l}}function w(e,t){this.isModelIteratorTexQuad=!0;var i=e,n=1,s=e.getBBox(),h=[];let f=null,p=null;const m=new a.Matrix4,g=new a.Matrix4,v=new a.Matrix4,A=new a.Vector3,w=new a.Quaternion,T=new a.Vector3,M=new Autodesk.Viewing.Private.FrustumIntersector;let C,P=1,D=1;const L=new a.Vector4(0,0,0,0),I=(new a.Vector4).copy(L);let R=0;var O=t,N=null,F=!1,U=!1,B=!1,k=new a.Color,V=[],G=[],z=[];this.registerView=function(){var e=h.indexOf(void 0);-1===e&&(e=h.length);var t=new a.Scene;return t.ignoreFadeMaterial=!0,i.placementTransform&&t.matrix.copy(i.placementTransform),t.matrixAutoUpdate=!1,h[e]=t,z[e]=0,V[e]=!0,e},this.registerView();var H=0,W=0,j=!1,q=[],X=null,Y=!1,K=new c;function Q(e){var t=i.maxLevel-e;return i.texWidth>>t}function Z(e){var t=i.maxLevel-e;return i.texHeight>>t}function $(e){var t=Q(e.level),n=Z(e.level),r=e.x*i.tileSize,o=e.y*i.tileSize;return r>=t||o>=n}function J(e){var t=Q(e.level),n=Z(e.level),r=e.x*i.tileSize,o=e.y*i.tileSize,s=Math.max(0,Math.min(i.tileSize,t-r)),l=Math.max(0,Math.min(i.tileSize,n-o)),c=1*i.tileSize;return new a.Vector2(s/c,l/c)}function ee(e){return i.scale/(1<<e)}function te(e){return ee(e.level)*e.x*n}function ie(e){var t=ee(e.level);return(i.fitPaperSize?i.paperHeight:1)-(e.y+1)*t*n}function ne(e){return G[(0,r.tile2Index)(e)]}function re(e){var t=ne(e);return t instanceof S&&t.state===_}function oe(e,t,i){var r;if(t)X||(X=K.createQuadGeom()),r=X;else{var o=function(e,t){for(var i=e.getParent();i;){var n=ne(i),r=n&&n.state===_;if(r&&t&&n.mesh.material.map.needsUpdate&&i.level>0&&(r=!1),r)break;i=i.getParent()}return i}(e);t=ce(o).material;var s=function(e,t){var i=1<<e.level-t.level,n=1/i,r=n,o=J(t);n/=o.x,r/=o.y;var s=t.x*i,a=t.y*i,c=e.x-s,h=e.y-a,u=J(e);c*=n,h=1-(h*=r)-r*u.y;var d=new l;return d.offsetX=c,d.offsetY=h,d.scaleX=n*u.x,d.scaleY=r*u.y,d}(e,o);r=K.acquireQuadGeom(s)}var c=new a.Mesh(r,t);c.tile=e,c.modelId=R,c.themingColor=I;var h=ee(e.level),u=J(e),d=(1-u.y)*h*n,f=te(e),p=ie(e);return c.position.set(f,p+d,0),c.scale.set(h*u.x*n,h*u.y*n,1),t.uniforms.offsetRepeat.value.set(t.map.offset.x,t.map.offset.y,t.map.repeat.x,t.map.repeat.y),c}this.setAggressivePrefetching=function(e){Y=e},this.getScene=function(e){return h[e=e||0]},this.getModelMatrix=function(){return f},this.getInverseModelMatrix=function(){return f?(p||(p=f.clone().invert()),p):null},this.setModelMatrix=function(e){e?(f=f||new a.Matrix4,f.copy(e)):f=null,p=null},this.nextBatch=function(e){return V[e=e||0]?null:(V[e]=!0,h[0].renderImportance=U?-1:void 0,h[0])},this.getSceneCount=function(){return 1},this.done=function(e){return V[e||0]},this.rayCast=function(e,t){return null},this.getVisibleBounds=function(e,t){let n=s;N&&(n=n.clone().intersect(N)),e&&(e.copy(n),i.placementTransform&&e.applyMatrix4(i.placementTransform),f&&e.applyMatrix4(f)),t&&(t.copy(n),i.placementTransform&&t.applyMatrix4(i.placementTransform),f&&t.applyMatrix4(f))},this.setViewBounds=function(e){N=e,O.setViewportBoundsForModel(R,N)},this.getViewBounds=function(){return N},this.setDoNotCut=function(e){return F=e},this.getDoNotCut=function(){return F};var se=function(e){for(var t=e.image,i=1;(i*=2)<t.width;);for(var n=1;(n*=2)<t.height;);if(i!==t.width||n!==t.height){var r=E.createElement("canvas");r.width=i,r.height=n;var o=r.getContext("2d");o.drawImage(t,0,0);var s,a,l=o.getImageData(0,0,i,n),c=new Uint32Array(l.data.buffer,0,i*n);if(t.height<n){var h=t.height*i;for(s=t.height;s<n;++s,h+=i)for(a=0;a<t.width;++a)c[h+a]=c[h+a-i]}if(t.width<i){var u=0;for(s=0;s<n;++s,u+=i)for(a=t.width;a<i;++a)c[u+a]=c[u+a-1]}o.putImageData(l,0,0),e.image=r,e.flipY&&e.offset.set(0,1-t.height/n),e.repeat.set(t.width/i,t.height/n)}},ae=this;function le(t){var n=(0,r.tile2Index)(t),o=G[n];if(!o||o.state===b){o||(o=new S(z.slice()),G[n]=o),o.state=x;var l=function(e){var t=i.levelOffset?i.levelOffset:0;return i.urlPattern.replace("{x}",e.x).replace("{y}",e.y).replace("{z}",e.level+t)}(t);W++,i.textureLoader(l,(function(n,r){!function(n){if(!ae||!n)return;0===i.maxLevel&&(-1===i.texWidth&&(i.texWidth=n.image.width),-1===i.texHeight&&(i.texHeight=n.image.height),-1===i.tileSize&&(i.tileSize=Math.max(n.image.width,n.image.height)),i.options&&(i.options.loadOptions.texWidth=i.texWidth,i.options.loadOptions.texHeight=i.texHeight),s=e.getBBox()),se(n),n.minFilter=a.LinearMipMapLinearFilter,n.magFilter=a.LinearFilter,n.anisotropy=Math.min(4,Math.max(i.maxAnisotropy,1));const r=(0,d.createShaderMaterial)(y);r.supportsMrtNormals=!0,r.supportsViewportBounds=!0,r.map=r.uniforms.map.value=n,r.side=a.DoubleSide,r.doNotCut=ae.getDoNotCut(),r.tile=t,r.disableEnvMap=!0,-1!==l.toLowerCase().indexOf(".png")&&(r.transparent=!0,r.alphaTest=.01);var c=oe(t,r);o.mesh=c,o.state=_,W--,j=!0;var h=n&&n.image?n.image.src:null;h&&a.Cache&&a.Cache.get(h)&&a.Cache.remove(h),0===t.level&&i.onRootLoaded&&(R=i.onRootLoaded()),c.themingColor=I,c.modelId=R,r.name=`model:${R}|${l}`,O.addMaterial(r.name,r,!0),O.setMaterialViewportBounds(r,N),ae._updateMaterialVisibility(r),ae._updateMaterialSelection(r)}(n)}),(function(e){i.onDone(e,null),console.error(e)}))}}function ce(e){var t=(0,r.tile2Index)(e),i=G[t];return i&&i.state===_?i.mesh:null}function he(e,t){var i=te(e)*P,n=ie(e)*D;t.set(i,n,0)}function ue(e,t){var i=ee(e.level),n=(te(e)+i)*P,r=(ie(e)+i)*D;t.set(n,r,0)}this.requestRootTile=function(){le(new r.TileCoords(0,0,0))};var de,fe,pe,me=(de=new a.Vector3,fe=new a.Vector3,pe=new a.Box3,function(e,t){return he(e,de),ue(e,fe),pe.set(de,fe),t.intersectsBox(pe)>0}),ge=function(){var e=new a.Vector3,t=new a.Vector3;return function(i,n,r){var o=ee(i.level);he(i,e),ue(i,t);var s=u.SceneMath.pointToMinMaxBoxDistance2(r,e,t);return(me(i,n)?100:1)*(o*o)/(s=Math.max(s,1e-4))}}(),ve=function(){const e=new a.Vector3,t=new a.Vector3;return function(n,r,o){he(n,e),ue(n,t);const s=Math.abs(function(e,t,i,n){var r=e.clone();return r.max(i),r.min(n),r.sub(e).dot(t)}(r.position,o,e,t)),a=i.getPixelRatio(),l=r.pixelsPerUnitAtDistance(s)*a;return(t.y-e.y)*l}}();function ye(e,t){this.tile=e,this.prio=t}function be(e,t){return e.prio>t.prio}function xe(e,t){var i=G[(0,r.tile2Index)(e)];i&&i.timeStamps[t]!==z[t]&&(i.timeStamps[t]=z[t],H++)}function _e(e,t,i){e.sort((function(e,n){var r=ge(e,t,i);return ge(n,t,i)-r}));for(var n=0,r=0;r<e.length;r++){var o=ne(e[r]);if(!o||o.state!==x){if(W>=5)break;le(e[r]),n++}}return n}function Ee(e){if(e&&e.mesh&&e.mesh.material){var t=e.mesh.material;O.removeMaterial(t.name),t.map.dispose(),t.map.needsUpdate=!0;t.dispatchEvent({type:"dispose"}),t.needsUpdate=!0}}function Se(e){for(var t=0;t<z.length;t++){if(!!h[t]&&e.timeStamps[t]===z[t])return!0}return!1}this.dispose=function(){var e;for(e in G)Ee(G[e]);X&&(X.dispose(),X.needsUpdate=!0),K.dispose()},this.dtor=function(){this.dispose(),ae=null,O=null},this.reset=function(e,t,n){const s=(n=n||0)>0,l=h[n];var c,u;for(({camera:t,frustum:e}=function(e,t,i){const n=e.matrixWorld;if(f?n.multiplyMatrices(f,e.matrix):n.copy(e.matrix),n.equals(v))P=1,D=1;else{n.decompose(A,w,T),m.makeRotationFromQuaternion(w),m.setPosition(A),P=T.x,D=T.y,C=i.clone(C),g.copy(m).invert(),C.transformCurrentView(g),C.updateCameraMatrices();const e=t.cutPlanes,r=t.areaCullThreshold;(t=M).areaCullThreshold=r,t.reset(C,e),i=C}return{camera:i,frustum:t}}(l,e,t)),c=0;c<l.children.length;c++){l.children[c].dispatchEvent({type:"removed"})}if(l.children.length=0,z[n]++,H=0,K.reset(),!re(new r.TileCoords(0,0,0)))return V[n]=!0,!1;var d=new o.SortedList(be),p=new r.TileCoords(0,0,0),y=ge(p,e,t.position);d.add(new ye(p,y));for(var b=t.getWorldDirection(new a.Vector3),x=[],E=[],S=[];d.size()>0;){if(u=d.get(0).tile,d.removeAt(0),$(u))continue;var L=!0;u.level===i.maxLevel&&(L=!1);ve(u,t,b)<i.tileSize&&i.isLevelPresent(u.level)&&(L=!1);var I=me(u,e);if(I&&(!re(u)&&i.isLevelPresent(u.level)&&S.push(u),xe(u,n)),!I&&x.length+E.length>i.maxActiveTiles&&(L=!1),L)for(let i=0;i<4;i++){const n=u.getChild(i);y=ge(n,e,t.position),d.add(new ye(n,y))}else I?x.push(u):E.push(u)}var R=0;j=!1;var O=!0;for(c=0;c<x.length;++c){var N=ce(u=x[c]);N&&N.material.map.needsUpdate&&!Y&&(R<5||s?R++:(N=oe(u,null),j=!0,O=!1)),N||(N=oe(u,null),O=!1),l.add(N)}V[n]=!1;var F=_e(S,e,t.position);H+=W;var U=[];for(c=0;c<E.length&&!(H>=i.maxActiveTiles);c++)if(re(u=E[c]))for(let e=0;e<=u.level;e++){if(xe(u.getParentAtLevel(e),n),H>i.maxActiveTiles)break}else U.push(u),H++;if(F+=_e(U,e,t.position),Y){for(U=[],c=0;c<x.length;++c)if((u=x[c]).level!==i.maxLevel&&i.isLevelPresent(u.level+1))for(let t=0;t<4;t++){const i=u.getChild(t);!$(i)&&me(i,e)&&(re(i)||(U.push(i),H++))}F+=_e(U,e,t.position)}if(s||function(e,t,n){var o=Object.keys(G),s=o.length,a=e-(i.cacheSize-s);if(!(a<=0)){o.sort((function(e,i){var o=G[e].timeStamps[0],s=G[i].timeStamps[0];if(o!==s)return o-s;var a=(0,r.index2Tile)(e),l=(0,r.index2Tile)(i);return ge(a,t,n)-ge(l,t,n)}));for(var l=Math.min(a,o.length),c=0;c<l;c++){var h=o[c];if(0!==(0,r.index2Tile)(h).level){var u=G[h];if(u.state===_){if(Se(u))break;Ee(u),delete G[h]}}}}}(F,e,t.position),O&&q.length>0){var B=q.splice(0,q.length);setTimeout((function(){for(var e=0;e<B.length;e++)B[e](n)}),1)}return O},this.callWhenRefined=function(e){q.push(e)},this.update=function(){return j},this.setDpiScale=function(e){n=e},this.getDpiScale=function(){return n},this.setThemingColor=function(e){I.copy(e)},this.clearThemingColor=function(){I.copy(L)},this.unregisterView=function(e){h[e]=void 0,z[e]=void 0,V[e]=void 0;for(var t=h.length;t>0&&!h[t-1];)t--;h.length=t,z.length=t,V.length=t},this._updateMaterialVisibility=function(e){!e.defines.GHOSTED^!U&&(U?e.defines.GHOSTED=1:delete e.defines.GHOSTED,e.needsUpdate=!0)},this.setVisibility=function(e){U=!e,O.forEachInModel(R,!1,(e=>{this._updateMaterialVisibility(e)}))},this._updateMaterialSelection=function(e){e.uniforms.selectionColor.value.set(k.r,k.g,k.b,B?.6:0)},this.highlightSelection=function(e){B=e,k=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k,O.forEachInModel(R,!1,(e=>{this._updateMaterialSelection(e)}))}}},76731:(e,t,i)=>{"use strict";function n(e,t,i){this.level=e,this.x=t,this.y=i}function r(e){var t=((1<<2*e.level)-1)/3,i=1<<e.level;return t+e.y*i+e.x}function o(e){for(var t=new n(0,0,0);r(t)<=e;)t.level++;t.level--;var i=e-r(t),o=1<<t.level;return t.y=Math.floor(i/o),t.x=i%o,t}i.r(t),i.d(t,{TileCoords:()=>n,index2Tile:()=>o,tile2Index:()=>r}),n.prototype={constructor:n,copy:function(){return new n(this.level,this.x,this.y)},isValid:function(){return Number.isInteger(this.level)&&this.level>=0&&Number.isInteger(this.x)&&Number.isInteger(this.y)},getChild:function(e){var t=1&e?1:0,i=2&e?1:0;return new n(this.level+1,2*this.x+t,2*this.y+i)},getParent:function(){return 0===this.level?null:new n(this.level-1,Math.floor(this.x/2),Math.floor(this.y/2))},getParentAtLevel:function(e){if(e<0||e>this.level)return null;var t=this.level-e;return new n(e,Math.floor(this.x>>t),Math.floor(this.y>>t))},toString:function(){return"("+this.level+", "+this.x+", "+this.y+")"},equals:function(e,t,i){return e instanceof n?this.equals(e.level,e.x,e.y):this.level===e&&this.x===t&&this.y===i}}},44745:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Renderer:()=>xt});const n=67108864,r=16777216,o=33554432;let s=1;function a(e){this.starts=new Map,this.ends=new Map,this.freeSize=0,this.addFreeBlock(0,e)}a.prototype.addFreeBlock=function(e,t){let i=e,n=e+t;this.freeSize+=t;let r=this.starts.get(n);void 0!==r&&(this.starts.delete(n),n=r);let o=this.ends.get(i);void 0!==o&&(this.ends.delete(i),i=o),this.starts.set(i,n),this.ends.set(n,i)},a.prototype.findBlock=function(e){let t,i;for(const[n,r]of this.starts)if(r-n>=e){t=n,i=r;break}if(void 0===t)return;this.freeSize-=e;let n=t+e;return this.starts.delete(t),n===i?this.ends.delete(i):(this.starts.set(n,i),this.ends.set(i,n)),t},a.prototype.getFreeSize=function(){return this.freeSize};class l{#Ze={};#$e=[];#Je=[];#et;constructor(e){this.#et=e}vAlloc(e,t){let i,r,o=this.#Ze[t];if(o)for(let t=o.length-1;t>=0;t--)if(r=o[t].heap.findBlock(e),void 0!==r){i=o[t];break}if(void 0===r){i={buffer:this.#et.createBuffer({size:n,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),heap:new a(n),id:s++},this.#Ze[t]?this.#Ze[t].push(i):this.#Ze[t]=[i],r=i.heap.findBlock(e)}return[i,r/t]}iAlloc(e){let t,i;for(let n=this.#$e.length-1;n>=0;n--)if(i=this.#$e[n].heap.findBlock(e),void 0!==i){t=this.#$e[n];break}if(void 0===i){t={buffer:this.#et.createBuffer({size:r,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!1}),heap:new a(r),id:s++},this.#$e.push(t),i=t.heap.findBlock(e)}return[t,i]}mAlloc(e){let t,i;for(let n=this.#Je.length-1;n>=0;n--)if(i=this.#Je[n].heap.findBlock(e),void 0!==i){t=this.#Je[n];break}if(void 0===i){t={buffer:this.#et.createBuffer({size:o,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),stride:e,heap:new a(o),id:s++},this.#Je.push(t),i=t.heap.findBlock(e)}return[t,i]}gFree(e){e.__gpuvb&&(e.__gpuvb.heap.addFreeBlock(e.__gpuvbBaseVertex*e.vbstride*4,e.__gpuvbSize),e.__gpuvb=void 0),e.__gpuib&&(e.__gpuib.heap.addFreeBlock(e.__gpuibBaseIndex<<e.__gpuibShift,e.__gpuibSize),e.__gpuib=void 0),e.__gpu=void 0}mFree(e){e.__gpumb&&(e.__gpumb.heap.addFreeBlock(e.__gpumbOffset,e.__gpumb.stride),e.__gpumb=void 0,e.__gpumbOffset=void 0)}stats(){console.log(this.#Ze,this.#$e)}computeUsedBytes(){let e=0;for(const t of Object.values(this.#Ze))for(const i of t)e+=i.buffer.size-i.heap.getFreeSize();let t=0;for(const e of this.#$e)t+=e.buffer.size-e.heap.getFreeSize();let i=0;for(const e of this.#Je)i+=e.buffer.size-e.heap.getFreeSize();return{vbBytes:e,ibBytes:t,mbBytes:i,totalBytes:e+t+i}}}class c extends l{#tt;#it;#nt;#rt;#et;constructor(e){const t=e.getDevice();super(t),this.#rt=e,this.#et=t}#ot(e){const t=e.target;if(t.__gpu){const e=t.__gpu;e.gFree(t),t.removeEventListener("dispose",e.#ot)}}static deallocateGeometry(e){e.__gpu&&e.__gpu.gFree(e)}initVB(e){var t;if(e.__gpu&&!e.vbNeedsUpdate)return;c.deallocateGeometry(e),e.__gpu=this;let i=4*e.vbstride,[n,r]=this.vAlloc(e.vb.byteLength,i);this.#et.queue.writeBuffer(n.buffer,r*i,e.vb.buffer,e.vb.byteOffset,e.vb.byteLength),e.__gpuvb=n,e.__gpuvbSize=e.vb.byteLength,e.__gpuvbBaseVertex=r;let o=e.ib.byteLength;o%4&&(o+=2);let s=(null===(t=e.iblines)||void 0===t?void 0:t.byteLength)||0;s%4&&(s+=2);let[a,l]=this.iAlloc(o+s);if(e.ib.byteOffset+o>e.ib.buffer.byteLength){console.log("OUT OF BOUNDS FIX",a.offset,o);let t=new Uint16Array(new ArrayBuffer(o));t.set(e.ib),this.#et.queue.writeBuffer(a.buffer,l,t.buffer,0,o)}else this.#et.queue.writeBuffer(a.buffer,l,e.ib.buffer,e.ib.byteOffset,o);e.iblines&&this.#et.queue.writeBuffer(a.buffer,l+o,e.iblines.buffer,e.iblines.byteOffset,s),e.__gpuib=a,e.ib instanceof Uint16Array?(e.__gpuibType="uint16",e.__gpuibShift=1,e.iblines&&(e.__gpuibLinesOffset=o/2)):e.ib instanceof Uint32Array?(e.__gpuibType="uint32",e.__gpuibShift=2,e.iblines&&(e.__gpuibLinesOffset=o/4)):console.warn("unknown index buffer type"),e.__gpuibBaseIndex=l>>e.__gpuibShift,e.__gpuibSize=o+s,e.vbNeedsUpdate=!1,e.addEventListener("dispose",this.#ot)}draw(e,t,i){t.__gpuvb&&!t.vbNeedsUpdate||this.initVB(t);const n=t.__gpuvb,r=t.__gpuib;this.#nt!==e?(e.setVertexBuffer(0,n.buffer),this.#tt=n.buffer,e.setIndexBuffer(r.buffer,t.__gpuibType),this.#it=r.buffer,this.#nt=e):(n.buffer!==this.#tt&&(e.setVertexBuffer(0,n.buffer),this.#tt=n.buffer),r.buffer!==this.#it&&(e.setIndexBuffer(r.buffer,t.__gpuibType),this.#it=r.buffer)),e.drawIndexed(t.ib.length,1,t.__gpuibBaseIndex,t.__gpuvbBaseVertex,i)}drawEdges(e,t,i){if(!t.iblines)return;t.__gpuvb||this.initVB(t);const n=t.__gpuvb,r=t.__gpuib;this.#nt!==e?(e.setVertexBuffer(0,n.buffer),this.#tt=n.buffer,e.setIndexBuffer(r.buffer,t.__gpuibType),this.#it=r.buffer,this.#nt=e):(n.buffer!==this.#tt&&(e.setVertexBuffer(0,n.buffer),this.#tt=n.buffer),r.buffer!==this.#it&&(e.setIndexBuffer(r.buffer,t.__gpuibType),this.#it=r.buffer));let o=t.__gpuibBaseIndex+t.__gpuibLinesOffset;e.drawIndexed(t.iblines.length,1,o,t.__gpuvbBaseVertex,i)}}var h=i(43851);const u="//See documentation in Fxaa3_11.h\n//This shader uses the CONSOLE PC version of the algorithm, adapted for WebGPU.\n//We use Luma encoded into the alpha channel from the previous rendering pass\n//Since WGSL doesn't currently allow texture reads from non-uniform code paths,\n//a small adaptation is necessary to avoid the early out\n\ndiagnostic(off, derivative_uniformity);\n\n@group(0) @binding(0) var tex: texture_2d<f32>;\n@group(0) @binding(1) var smpl: sampler;\n\n@id(0) override invWidth = (1.0/1024.0);\n@id(1) override invHeight = (1.0/1024.0);\n\nfn FxaaTexTop(p: vec2f) -> vec4f {\n\treturn textureSample(tex, smpl, p);\n}\n\n/*============================================================================\n\n\t\t\t\t\t\t FXAA3 CONSOLE - PC VERSION\n\n------------------------------------------------------------------------------\nInstead of using this on PC, I'd suggest just using FXAA Quality with\n\t#define FXAA_QUALITY__PRESET 10\nOr\n\t#define FXAA_QUALITY__PRESET 20\nEither are higher qualilty and almost as fast as this on modern PC GPUs.\n============================================================================*/\n\nconst fxaaConsoleEdgeThresholdMin = 0.05;\nconst fxaaConsoleEdgeThreshold = 0.125;\nconst fxaaConsoleEdgeSharpness = 8.0;\nconst fxaaConsoleRcpFrameOpt = 0.33; //0.33 (sharper) or 0.5 (default) // This affects sub-pixel AA quality and inversely sharpness.\nconst fxaaConsoleRcpFrameOpt2 = 2.0;\n\n/*--------------------------------------------------------------------------*/\n@fragment fn FxaaPixelShader(\n\t@builtin(position) coord : vec4f,\n\t@location(0) @interpolate(linear) pos: vec2f\n) -> @location(0) vec4f {\n\n\tvar invDim = vec2f(invWidth, invHeight);\n\n/*--------------------------------------------------------------------------*/\n\t//Luma encoded in alpha component of input texture\n\tvar lumaNw = (textureSample(tex, smpl, pos, vec2i(-1,-1))).w;\n\tvar lumaSw = (textureSample(tex, smpl, pos, vec2i(-1, 1))).w;\n\tvar lumaNe = (textureSample(tex, smpl, pos, vec2i( 1,-1))).w;\n\tvar lumaSe = (textureSample(tex, smpl, pos, vec2i( 1, 1))).w;\n/*--------------------------------------------------------------------------*/\n\tvar rgbyM = FxaaTexTop(pos);\n\tvar lumaM = rgbyM.w;\n/*--------------------------------------------------------------------------*/\n\tvar lumaMaxNwSw = max(lumaNw, lumaSw);\n\tlumaNe += 1.0/384.0;\n\tvar lumaMinNwSw = min(lumaNw, lumaSw);\n/*--------------------------------------------------------------------------*/\n\tvar lumaMaxNeSe = max(lumaNe, lumaSe);\n\tvar lumaMinNeSe = min(lumaNe, lumaSe);\n/*--------------------------------------------------------------------------*/\n\tvar lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);\n\tvar lumaMin = min(lumaMinNeSe, lumaMinNwSw);\n/*--------------------------------------------------------------------------*/\n\tvar lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;\n/*--------------------------------------------------------------------------*/\n\tvar lumaMinM = min(lumaMin, lumaM);\n\tvar lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);\n\tvar lumaMaxM = max(lumaMax, lumaM);\n\tvar dirSwMinusNe = lumaSw - lumaNe;\n\tvar lumaMaxSubMinM = lumaMaxM - lumaMinM;\n\tvar dirSeMinusNw = lumaSe - lumaNw;\n\tvar earlyOut = 0.0;\n\tif(lumaMaxSubMinM < lumaMaxScaledClamped) {\n\t\treturn vec4f(rgbyM.xyz, 1.0);\n\t}\n/*--------------------------------------------------------------------------*/\n\tvar dir: vec2f;\n\tdir.x = dirSwMinusNe + dirSeMinusNw;\n\tdir.y = dirSwMinusNe - dirSeMinusNw;\n/*--------------------------------------------------------------------------*/\n\tvar dir1 = normalize(dir.xy);\n\tvar rcpFrameOpt = fxaaConsoleRcpFrameOpt * invDim;\n\tvar rgbyN1 = FxaaTexTop(pos - dir1 * rcpFrameOpt);\n\tvar rgbyP1 = FxaaTexTop(pos + dir1 * rcpFrameOpt);\n/*--------------------------------------------------------------------------*/\n\tvar dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;\n\tvar dir2 = clamp(dir1.xy / dirAbsMinTimesC, vec2f(-2.0), vec2f(2.0));\n/*--------------------------------------------------------------------------*/\n\tvar rcpFrameOpt2 = fxaaConsoleRcpFrameOpt2 * invDim;\n\tvar rgbyN2 = FxaaTexTop(pos - dir2 * rcpFrameOpt2);\n\tvar rgbyP2 = FxaaTexTop(pos + dir2 * rcpFrameOpt2);\n/*--------------------------------------------------------------------------*/\n\tvar rgbyA = rgbyN1 + rgbyP1;\n\tvar rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);\n/*--------------------------------------------------------------------------*/\n\tvar twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax);\n\tif(twoTap) {\n\t\treturn vec4f(rgbyA.xyz * 0.5, 1.0);\n\t} else {\n\t\treturn vec4f(rgbyB.xyz, 1.0);\n\t}\n}\n/*==========================================================================*/\n\n";var d=i(29251),f=i(19698);const p="struct BlendUniforms {\n highlightColor: vec4f, //0\n selectionColor: vec4f, //4\n\n objectId: i32, //8\n modelId: i32, //9\n glowFlagInt: i32, //10\n glowCompFunc: i32, //11\n highlightIntensity: f32, //12\n useAO: i32, //13\n encodeLuma: i32, //14\n aoBias: f32, //15\n edgeObjectId: i32, //16\n edgeModelId: i32, //17\n useOverlay: i32 //18 //TODO: combine with useAO into single bitmask uniform\n\n //Enable these if the forward pass renders in HDR-linear target and the Blend shader is doing the tone mapping\n //exposureBias: f32,\n //toneMapMethod: i32,\n}\n@group($0) @binding(0) var<uniform> u : BlendUniforms;\n";class m extends f.D{constructor(){super(null,32,!0,!1)}init(e){this.setDevice(e)}setAOEnabled(e){this.setInt(13,e?1:0)}setFXAAEnabled(e){let t=e?1:0;this.setInt(14,t)}setHighlightObjectId(e){this.setInt(8,e)}setHighlightModelId(e){this.setInt(9,e)}setHighlightIntensity(e){this.setFloat(12,e)}getHighlightIntensity(){return this.getFloat(12)}setRolloverHighlightColor(e){this.setColor(0,e,1)}setEdgeHighlightObjectId(e,t){this.setInt(16,e),this.setInt(17,t)}setGlowFlag(e){this.setInt(10,e)}setGlowOptions(e,t){this.setInt(11,t)}setAOBias(e){this.setFloat(15,e)}setSelectionColor(e){this.setColor(4,e,1)}setUseOverlay(e){this.setInt(18,e?1:0)}}const g="//post-gamma luminance\nfn luminance_post(rgb: vec3f) -> f32 {\n\treturn dot(rgb, vec3f(0.299, 0.587, 0.114));\n}\n\n//pre-gamma luminance\nfn luminance_pre(rgb: vec3f) -> f32 {\n\treturn dot(rgb, vec3f(0.212671, 0.715160, 0.072169));\n}\n\n\nfn xyz2rgb(xyz: vec3f) -> vec3f {\n\t//XYZ -> RGB conversion matrix using HDTV constants\n\tvar R = vec3f( 3.240479, -1.537150, -0.498535);\n\tvar G = vec3f(-0.969256, 1.875992, 0.041556);\n\tvar B = vec3f( 0.055648, -0.204043, 1.057311);\n\n\tvar rgb: vec3f;\n\trgb.b = dot(xyz, B);\n\trgb.g = dot(xyz, G);\n\trgb.r = dot(xyz, R);\n\n\treturn rgb;\n}\n\nfn rgb2xyz(rgb: vec3f) -> vec3f {\n\t//RGB -> XYZ conversion matrix using HDTV constants\n\tvar X = vec3f(0.412453, 0.35758, 0.180423);\n\tvar Y = vec3f(0.212671, 0.71516, 0.0721688);\n\tvar Z = vec3f(0.0193338, 0.119194, 0.950227);\n\n\tvar xyz: vec3f;\n\txyz.x = dot(rgb, X);\n\txyz.y = dot(rgb, Y);\n\txyz.z = dot(rgb, Z);\n\n\treturn xyz;\n}\n\nfn xyz2xyY(xyz: vec3f) -> vec3f {\n\tvar sum = xyz.x + xyz.y + xyz.z;\n\n\t//Note in case of division by 0, the hardware\n\t//should output zero for sum, so we are still ok with the result\n\tsum = 1.0 / sum;\n\n\tvar xyY: vec3f;\n\txyY.z = xyz.y;\n\txyY.x = xyz.x * sum;\n\txyY.y = xyz.y * sum;\n\n\treturn xyY;\n}\n\nfn xyY2xyz(xyY: vec3f) -> vec3f {\n\tvar x = xyY.x;\n\tvar y = xyY.y;\n\tvar Y = xyY.z;\n\n\tvar xyz: vec3f;\n\txyz.y = Y;\n\txyz.x = x * (Y / y);\n\txyz.z = (1.0 - x - y) * (Y / y);\n\n\treturn xyz;\n}\n\n\n\n//OGS/RaaS Cannon tonemappong with ColorPerserving enabled.\nfn toneMapCanon_T(x: f32) -> f32\n{\n\t// this function fits the measured Canon sigmoid *without gamma correction* through 0.0\n\tvar xpow = pow(x, 1.60525727);\n\tvar tmp = ((1.05542877*4.68037409)*xpow) / (4.68037409*xpow + 1.0);\n\treturn clamp(tmp, 0.0, 1.0);\n}\n\n\nconst Shift = 1.0 / 0.18;\n\n//Best fit of John Hable's generalized filmic function parameters to the Canon curve\n//This is a significantly better and cheaper to compute fit than the power and polynomial\n//least squares fits from OGS/RaaS (which have larger max and average error, and also go negative near\n//the origin).\nfn toneMapCanonFilmic_NoGamma(y: f32) -> f32 {\n\n\t//This extra exposure by 1.0/0.18 mimics what is also done in OGS's implementation\n\t//and the curve fit was done with this scale in mind.\n\tvar x = y;\n\tx *= Shift;\n\n\tconst A = 0.2; //shoulder strength\n\tconst B = 0.34; //linear strength\n\tconst C = 0.002; //linear angle\n\tconst D = 1.68; //toe strength\n\tconst E = 0.0005; //toe numerator\n\tconst F = 0.252; //toe denominator (E/F = toe angle)\n\tconst scale = 1.0/0.833837;\n\n\treturn (((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F) * scale;\n}\n\n\n//Same as above but with 2.2 gamma built into the fit and working on the\n//whole RGB triplet at once (i.e. non color preserving version).\nfn toneMapCanonFilmic_WithGamma(y: vec3f) -> vec3f {\n\n\t//This extra exposure by 1.0/0.18 mimics what is also done in OGS's implementation\n\t//and the curve fit was done with this scale in mind.\n\tvar x = y;\n\tx *= Shift;\n\n\t//Best overall error params\n\t/*\n\tconst float A = 0.2;\n\tconst float B = 0.23;\n\tconst float C = 0.147;\n\tconst float D = 0.26;\n\t//const float E = 0.0;\n\tconst float F = 0.22;\n\tconst float scale = 1.0/0.900202;\n\t*/\n\n\t//Best max deviation params\n\tconst A = 0.27;\n\tconst B = 0.29;\n\tconst C = 0.052;\n\tconst D = 0.2;\n\t//const E = 0.0;\n\tconst F = 0.18;\n\tconst scale = 1.0/0.897105;\n\n\treturn (((x*(A*x+C*B))/(x*(A*x+B)+D*F))) * scale;\n}\n\n\nfn toneMapCanonOGS_WithGamma_WithColorPerserving(x: vec3f) -> vec3f {\n\tvar outColor = x.rgb;\n\toutColor = min(outColor, vec3f(3.0));\n\tvar inLum = luminance_pre(outColor);\n\tif (inLum > 0.0) {\n\t\tvar outLum = toneMapCanon_T(inLum);\n\t\toutColor = outColor * (outLum / inLum);\n\t\toutColor = clamp(outColor, vec3f(0.0), vec3f(1.0));\n\t}\n\tconst gamma = 1.0/2.2;\n\toutColor = pow(outColor, vec3f(gamma));\n\treturn outColor;\n}\n",v="\nfn calculateHatchPatternRaw(hatchSlope: f32, hatchPeriod: f32, coord: vec2f ) -> f32 {\n\t//Note that this condition is inverted from the WebGL version, because\n\t//screen coordinates are Y-down in WebGPU, so the slope is inverted\n\tif (abs(hatchSlope) > 1.0) {\n\t\tvar hatchPhase = f32(coord.y - hatchSlope * coord.x);\n\t\tvar dist = abs(hatchPhase % hatchPeriod);\n\t\treturn dist;\n\t} else {\n\t\tvar hatchPhase = - f32(coord.y / hatchSlope + coord.x);\n\t\tvar dist = abs(hatchPhase % hatchPeriod);\n\t\treturn dist;\n\t}\n}\n\nfn calculateHatchPattern(hatchParams: vec2f, coord: vec2f, fragColor: vec4f, hatchTintColor: vec3f, hatchTintIntensity: f32 ) -> vec4f {\n\n\tvar dist = calculateHatchPatternRaw(hatchParams.x, hatchParams.y, coord);\n\tvar outColor: vec4f;\n\n\tif (dist < 1.0) {\n\t\toutColor = vec4f(0.0,0.0,0.0,1.0);\n\t} else {\n\t\toutColor = vec4f(mix(fragColor.xyz, hatchTintColor, hatchTintIntensity), fragColor.a);\n\t}\n\n\treturn outColor;\n}\n",y="@group(0) @binding(0) var tColor: texture_2d<f32>;\n@group(0) @binding(1) var tOverlay: texture_2d<f32>;\n@group(0) @binding(2) var tID: texture_2d<u32>;\n@group(0) @binding(3) var tID2: texture_2d<u32>;\n//@group(0) @binding(4) var tID3: texture_2d<u32>;\n@group(0) @binding(4) var tAO: texture_2d<f32>;\n\n$blendUniforms\n$tonemap\n$hatch\n\nfn toInt(v: vec4u) -> i32 {\n return i32(v.r | (v.g << 8) | (v.b << 16) | (v.a << 24));\n}\n\n// modify rgb by applying rollOver highlighting.\n// filterValue is an additonal multiplier for highlighting intensity. (always 1.0 if no spatial filter is used)\nfn applyHighlighting(inRgb: vec3f) -> vec3f {\n //rgb += highlightColor * filterValue * u.highlightIntensity * 0.20;\n var rgb = inRgb;\n rgb += vec3(1.0,1.0,1.0) * u.highlightIntensity * 0.20;\n return rgb;\n}\n\n//Color key based edge detection for selection set\nfn isSelectionColor(C : vec3f) -> bool {\n\n //Simple check that assumes the blue selection color\n if (C.b >= C.g && C.b >= C.r) {\n return true;\n }\n\n return false;\n/*\n var minS = min(u.selectionColor.r, min(u.selectionColor.g, u.selectionColor.b));\n var maxS = max(u.selectionColor.r, max(u.selectionColor.g, u.selectionColor.b));\n var satS = maxS - minS;\n var minC = min(C.r, min(C.g, C.b));\n var maxC = max(C.r, max(C.g, C.b));\n var satC = maxC - minC;\n // If one color has low saturation, they only match if both have low saturation.\n if (satC < .01 || satS < .01) {\n return false;\n }\n\n // Now compare the hue. We don't convert to a numeric hue, just\n // the vector representation.\n var S = (u.selectionColor.rgb - minS) / satS;\n var H = (C - minC) / satC;\n var D = H - S;\n var eps = .15;\n // We want to match the hue of selectionColor and C, but if the max component of C is\n // 1, then it may have been clamped which will change the hue. In this case the\n // middle colors should be higher than we expect, so we just make sure that\n // all of C's components are larger than selectionColor's.\n return (abs(D.r) + abs(D.g) + abs(D.b) < eps)\n || (maxC >= (1.0 - eps) && D.r >= -eps && D.g >= -eps && D.b >= -eps);\n */\n}\n\nfn sampleTargetSS(coord: vec2i, offset: vec2i) -> vec4f {\n return textureLoad(tOverlay, coord + offset, 0);\n}\n\nstruct SumNeighbors {\n hasEdge: i32,\n selectionPixel: vec4f,\n maxAlpha: f32\n}\nvar<private> sum: SumNeighbors;\n\nfn checkEdgeSelection(ssCoord: vec2i, offX: i32, offY: i32) {\n var c = sampleTargetSS( ssCoord, vec2i(offX, offY));\n sum.maxAlpha = max(sum.maxAlpha, c.a);\n if (c.a <= 0.0) {\n sum.hasEdge++;\n }\n}\n\n// search neighbors to detect change in pixel coverage\n// the current pixel is outline if is selection && has empty neighbors\nfn overlayEdgeDetect(ssCoord: vec2i) -> vec4f {\n\n //Note that the sampled color here has pre-multiplied alpha,\n //but we don't need to correct for that with the current isSelectionColor check\n var center = sampleTargetSS(ssCoord, vec2i(0));\n var paintOutline = false;\n\n if (center.a > 0.0 && isSelectionColor(center.rgb)) {\n checkEdgeSelection(ssCoord, -1,-1);\n checkEdgeSelection(ssCoord, 0,-1);\n checkEdgeSelection(ssCoord, 1,-1);\n\n checkEdgeSelection(ssCoord, -1, 0);\n checkEdgeSelection(ssCoord, 1, 0);\n\n checkEdgeSelection(ssCoord, -1, 1);\n checkEdgeSelection(ssCoord, 0, 1);\n checkEdgeSelection(ssCoord, 1, 1);\n\n checkEdgeSelection(ssCoord, -2,-2);\n checkEdgeSelection(ssCoord, -1,-2);\n checkEdgeSelection(ssCoord, 0,-2);\n checkEdgeSelection(ssCoord, 1,-2);\n checkEdgeSelection(ssCoord, 2,-2);\n\n checkEdgeSelection(ssCoord, -2,2);\n checkEdgeSelection(ssCoord, -1,2);\n checkEdgeSelection(ssCoord, 0,2);\n checkEdgeSelection(ssCoord, 1,2);\n checkEdgeSelection(ssCoord, 2,2);\n\n checkEdgeSelection(ssCoord, -2, -2);\n checkEdgeSelection(ssCoord, -2, -1);\n checkEdgeSelection(ssCoord, -2, 0);\n checkEdgeSelection(ssCoord, -2, 1);\n checkEdgeSelection(ssCoord, -2, 2);\n\n checkEdgeSelection(ssCoord, 2, -2);\n checkEdgeSelection(ssCoord, 2, -1);\n checkEdgeSelection(ssCoord, 2, 0);\n checkEdgeSelection(ssCoord, 2, 1);\n checkEdgeSelection(ssCoord, 2, 2);\n\n if (sum.hasEdge != 0) { // if has empty neighbors\n paintOutline = true;\n } else {\n center.a = -center.a; // special flag marking inside pixel\n }\n }\n\n // calculate outline color\n if (paintOutline) {\n var rgb = mix(sqrt(u.selectionColor.rgb), vec3f(1.0), 0.65);\n var a = 1.0; //make edge fully opaque so it's easier to see\n center = vec4f(rgb, a);\n }\n\n return center;\n}\n\nfn glowComp(c: i32) -> bool {\n if (u.glowCompFunc == 0) {\n return c == u.glowFlagInt;\n } else {\n return (c != -1) && ((c & u.glowFlagInt) != 0);\n }\n}\n\nvar<private> hasEdgeGlow: i32;\n\nfn checkEdgeId(ssCoord: vec2i, offX: i32, offY: i32, W: i32) {\n //See corresponding comment in UberShader. We currently don't have enough room\n //to encode the object flags in a separate render target, so we put half of it\n //in the upper 2 bytes of the modelId render target (tID2). We need to find a solution\n //for the remaining two bytes, or an alternative solution that doesn't require the extra\n //target during the main pass (e.g. lookup into data texture by model/object ID which we already know)\n var c = toInt(textureLoad(tID2, ssCoord + vec2i(offX, offY), 0)) >> 16;\n if (glowComp(c)) {\n hasEdgeGlow += W;\n }\n}\n\nconst glowColor = vec3f(1.0,1.0,0.0);\n\n// search 3x3 neighbors\n// the current pixel is outline if\n// (is selection && has empty neighbor) || (pixel is empty && has selection neighbor)\nfn glowEdgeDetect(ssCoord: vec2i) -> vec4f {\n\n hasEdgeGlow = 0;\n\n var paintOutline = false;\n\n checkEdgeId(ssCoord, -1,-1, 2);\n checkEdgeId(ssCoord, 0,-1, 4);\n checkEdgeId(ssCoord, 1,-1, 2);\n checkEdgeId(ssCoord,-1, 0, 4);\n checkEdgeId(ssCoord, 1, 0, 4);\n checkEdgeId(ssCoord,-1, 1, 2);\n checkEdgeId(ssCoord, 0, 1, 4);\n checkEdgeId(ssCoord, 1, 1, 2);\n\n checkEdgeId(ssCoord, 2, -1, 1);\n checkEdgeId(ssCoord, 2, 0, 1);\n checkEdgeId(ssCoord, 2, 1, 1);\n\n checkEdgeId(ssCoord, -2, -1, 1);\n checkEdgeId(ssCoord, -2, 0, 1);\n checkEdgeId(ssCoord, -2, 1, 1);\n\n checkEdgeId(ssCoord, -1, 2, 1);\n checkEdgeId(ssCoord, 0, 2, 1);\n checkEdgeId(ssCoord, 1, 2, 1);\n\n checkEdgeId(ssCoord, -1, -2, 1);\n checkEdgeId(ssCoord, 0, -2, 1);\n checkEdgeId(ssCoord, 1, -2, 1);\n\n if (hasEdgeGlow != 0) { // if has object neighbors\n paintOutline = true;\n }\n\n // calculate outline color\n if (paintOutline) {\n return vec4f(glowColor.rgb, min(1.0, f32(hasEdgeGlow)/6.0));\n }\n\n return vec4f(0.0);\n}\n\n\n@fragment\nfn main(\n @builtin(position) coord : vec4f,\n @location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n\n var pixelCoord = vec2i(floor(coord.xy));\n\n var outColor = textureLoad(tColor, pixelCoord, 0);\n\n if (u.useAO != 0) {\n var ao = textureLoad(tAO, pixelCoord, 0).r;\n outColor = vec4f(sqrt(outColor.rgb * outColor.rgb * min(1.0, ao+ u.aoBias)), outColor.a);\n }\n\n if (u.useOverlay != 0) {\n //composite in the overlays texture\n var overlay = overlayEdgeDetect(pixelCoord);\n\n // Negative alpha signals the inside overlay condition, as above.\n if (overlay.a < 0.0) {\n overlay.a = -overlay.a;\n\n if (overlay.a >= 0.99) {\n //Blend the overlay color with the luminance of the underlying\n //pixel so that we do not lose detail from any underlying texture map\n outColor = vec4f(vec3f(luminance_post(outColor.rgb)), 0.75);\n }\n }\n\n // For 3D, apply some hard-wired gamma correction.\n // Todo: When embedding 2D in 3D scenes, the gamma-correction will alter the 2D colors as well.\n //outColor = vec4f(outColor.rgb * (1.0 - overlay.a) + sqrt(overlay.rgb * overlay.a), outColor.a);\n //WEBGPU: do not gamma the overlay because it's currently using the UberShader that applies tone mapping + gamma in the pixel shader\n //Note we use pre-multiplied blend function here, because that's how our blend function is set up\n //to put pixels into the color targets\n outColor = vec4f(outColor.rgb * (1.0 - overlay.a) + overlay.rgb, outColor.a);\n\n //if (useOverlayAlpha != 0) {\n // In case texel (diffuse color) has 0 alpha, but overlay has something to render, make sure to update the alpha accordingly.\n outColor = vec4f(outColor.rgb, outColor.a + overlay.a * (1.0 - outColor.a));\n //}\n\n //test only\n //outColor = overlay;\n }\n\n //rollover highlighting\n if (u.objectId != 0) {\n var objectId = toInt(textureLoad(tID, pixelCoord, 0));\n var modelId = toInt(textureLoad(tID2, pixelCoord, 0)) & 0xffff;\n\n if (u.objectId == objectId && u.modelId == modelId) {\n outColor = vec4f(applyHighlighting(outColor.rgb), outColor.a);\n }\n }\n\n //glow effect\n if (u.glowFlagInt != 0) {\n\n var flagAtPixel = toInt(textureLoad(tID2, pixelCoord, 0)) >> 16;\n\n if (!glowComp(flagAtPixel)) {\n var outline = glowEdgeDetect(pixelCoord);\n outline.a *= u.highlightIntensity;\n outColor = vec4f(outColor.rgb * (1.0 - outline.a) + outline.rgb * outline.a, outColor.a);\n } else {\n var dist = calculateHatchPatternRaw(1.0, 10.0, coord.xy);\n var intensity : f32;\n if (dist <= 0.5) {\n intensity = 1.0;\n } else {\n intensity = 0.10;\n }\n //float intensity = 0.1;\n outColor = vec4f(mix(outColor.rgb, glowColor, intensity * u.highlightIntensity), outColor.a);\n }\n }\n\n\n //Encode luminance in A for the downstream FXAA pass\n //TODO: make this shader constant\n if (u.encodeLuma == 1) {\n outColor.a = luminance_post(outColor.rgb);\n }\n return outColor;\n}\n";function b(e){let t,i,n,r,o,s,a,l,c=e,f=navigator.gpu.getPreferredCanvasFormat(),b=new m,x=[],_=[];this.init=function(){t=c.getDevice(),b.init(t)},this.getBlendSettings=function(){return b},this.resize=function(e,m){!function(e,i){o||(o=t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}}]})),n=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[o]}),vertex:{module:t.createShaderModule({code:h}),entryPoint:"mainFlipY"},fragment:{module:t.createShaderModule({code:u}),entryPoint:"FxaaPixelShader",targets:[{format:f}],constants:{0:1/e,1:1/i}},primitive:{topology:"triangle-list",cullMode:"back"}}),l||(l=t.createSampler({magFilter:"linear",minFilter:"linear"}))}(e,m),function(){var e;r||(r=t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"uint"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"uint"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]})),i||(i=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[r,b.getLayout()]}),vertex:{module:t.createShaderModule({code:h}),entryPoint:"main"},fragment:{module:t.createShaderModule({code:(0,d.$wgsl)(y,{blendUniforms:(e=1,(0,d.$wgsl)(p,e+0||0)),tonemap:g,hatch:v})}),entryPoint:"main",targets:[{format:f}]},primitive:{topology:"triangle-list",cullMode:"back"}}));let n=c.getRenderTargets().getTargetViewsForBlend().map(((e,t)=>({binding:t,resource:e})));n.push({binding:n.length,resource:c.getSAO().getTargetView()}),a=t.createBindGroup({layout:r,entries:n}),s||(s={colorAttachments:[{view:void 0,clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]})}(),function(e,i){for(let e=0;e<2;e++)_[e]=c.getRenderTargets().getPostTarget(e).createView(),x[e]=t.createBindGroup({layout:o,entries:[{binding:0,resource:_[e]},{binding:1,resource:l}]})}()},this.run=function(e,r){b.setFXAAEnabled(r),b.upload();let o=t.createCommandEncoder();if(r){s.colorAttachments[0].view=_[0];let t=o.beginRenderPass(s);t.setPipeline(i),t.setBindGroup(0,a),t.setBindGroup(1,b.getBindGroup()),t.draw(3),t.end(),s.colorAttachments[0].view=e,t=o.beginRenderPass(s),t.setPipeline(n),t.setBindGroup(0,x[0]),t.draw(3),t.end()}else{s.colorAttachments[0].view=e;let t=o.beginRenderPass(s);t.setPipeline(i),t.setBindGroup(0,a),t.setBindGroup(1,b.getBindGroup()),t.draw(3),t.end()}t.queue.submit([o.finish()])}}const x="depth24plus",_={color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}};class E{#rt;#et;#st;#at;#lt;#ct;#ht;#ut;#dt;#ft;#pt=[0,0];#mt;#gt;#vt;#yt;#bt=!0;#xt=!1;#_t;#Et;#St;constructor(e){this.#rt=e}init(e){this.#et=this.#rt.getDevice(),this.#mt=navigator.gpu.getPreferredCanvasFormat(),this.#gt=e?"rgba16float":this.#mt}cleanup(){var e,t,i,n,r,o,s;null===(e=this.#at)||void 0===e||e.destroy(),null===(t=this.#st)||void 0===t||t.destroy(),null===(i=this.#ht)||void 0===i||i.destroy(),null===(n=this.#lt)||void 0===n||n.destroy(),null===(r=this.#ct)||void 0===r||r.destroy(),null===(o=this.#ut)||void 0===o||o.forEach((e=>null==e?void 0:e.destroy())),null===(s=this.#dt)||void 0===s||s.forEach((e=>null==e?void 0:e.destroy())),this.#at=null,this.#st=null,this.#ht=null,this.#lt=null,this.#ut=[],this.#dt=[]}resize(e,t){if(this.#_t=null,this.#Et=null,this.#St=null,this.#pt[0]=e,this.#pt[1]=t,this.#yt=null,this.cleanup(),0!==e&&0!==t){this.#st=this.#et.createTexture({size:[e,t],format:this.#gt,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),this.#ft=this.#st.createView(),this.#at=this.#et.createTexture({size:[e,t],format:x,usage:GPUTextureUsage.RENDER_ATTACHMENT}),this.#ht=this.#et.createTexture({size:[e,t],format:this.#mt,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),this.#lt=this.#et.createTexture({size:[e,t],format:"rgb10a2unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),this.#ct=this.#et.createTexture({size:[e,t],format:"rgb10a2unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),this.#ut=new Array(2);for(let i=0;i<this.#ut.length;i++){let n=this.#et.createTexture({size:[e,t],format:"rgba8uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});this.#ut[i]=n}this.#dt=[null,null];for(let i=0;i<this.#dt.length;i++){let n=this.#et.createTexture({size:[e,t],format:this.#mt,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});this.#dt[i]=n}}}getPreferredFormat(){return this.#mt}getColorTarget(){return this.#st}getNormalsTarget(){return this.#lt}getDepthTarget(){return this.#at}getViewDepthTarget(){return this.#ct}getOverlayTarget(){return this.#ht}getIdTarget(e){return this.#ut[e]}getPostTarget(e){return this.#dt[e]}getTargetViewsForBlend(){let e=[this.#st.createView(),this.#ht.createView()];for(let t=0;t<2;t++)e.push(this.#ut[t].createView());return e}getColorTargetView(){return this.#ft}getTargetSize(){return this.#pt}getTargetsListMainPass(){if(!this.#_t){this.#_t=[{format:this.#st.format,blend:_},{format:this.#lt.format,blend:_},{format:this.#ct.format,blend:_}];for(let e=0;e<2;e++)this.#_t.push({format:this.#ut[e].format})}return this.#_t}getTargetsListEdgePass(){return this.#Et||(this.#Et=[{format:this.#st.format,blend:_}]),this.#Et}getOverlayTargetsList(){return this.#St||(this.#St=[{format:this.#st.format,blend:_}]),this.#St}async readIdTargetPixelsAsync(e,t,i,n,r){var o;if("pending"===(null===(o=this.#vt)||void 0===o?void 0:o.mapState))return;let s=4*i,a=s%256;a>0&&(s+=256-a);let l=s*n;var c;(!this.#vt||this.#vt.size<2*l)&&(null===(c=this.#vt)||void 0===c||c.destroy(),this.#vt=this.#et.createBuffer({size:2*l,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}));let h=this.#et.createCommandEncoder();return h.copyTextureToBuffer({texture:this.#ut[0],origin:[e,t]},{buffer:this.#vt,offset:0,bytesPerRow:s},[i,n]),h.copyTextureToBuffer({texture:this.#ut[1],origin:[e,t]},{buffer:this.#vt,offset:l,bytesPerRow:s},[i,n]),this.#et.queue.submit([h.finish()]),this.#vt.mapAsync(GPUMapMode.READ,0).then((()=>{let e=new Uint8Array(this.#vt.getMappedRange());!function(e,t,i,n,r){const o=e[0],s=e[1],a=r*n;for(let e=0;e<n;e++){let n=r*e,l=n+a,c=i*e;for(let e=0;e<i;e++)o[c]=t[n++],s[c]=t[l++],c++}}(r,e,4*i,n,s),this.#vt.unmap()}))}async#At(){console.log("read whole targets"),this.#xt=!0;let[e,t]=this.#pt,i=4*e,n=i%256;n>0&&(i+=256-n);let r=i*t;var o;(!this.#vt||this.#vt.size<2*r)&&(null===(o=this.#vt)||void 0===o||o.destroy(),this.#vt=this.#et.createBuffer({size:2*r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}));let s=this.#et.createCommandEncoder();return s.copyTextureToBuffer({texture:this.#ut[0],origin:[0,0]},{buffer:this.#vt,offset:0,bytesPerRow:i},[e,t]),s.copyTextureToBuffer({texture:this.#ut[1],origin:[0,0]},{buffer:this.#vt,offset:r,bytesPerRow:i},[e,t]),this.#et.queue.submit([s.finish()]),this.#vt.mapAsync(GPUMapMode.READ,0).then((()=>{let e=new Uint8Array(this.#vt.getMappedRange());this.#yt||(this.#yt=new Uint8Array(e.byteLength)),this.#yt.set(e),this.#vt.unmap(),this.#bt=!1,this.#xt=!1}))}readIdTargetPixelsSyncOrFail(e,t,i,n,r){var o;function s(){for(let e=0;e<r.length;e++)r[e].fill(0)}if("pending"===(null===(o=this.#vt)||void 0===o?void 0:o.mapState))return void s();if(this.#xt)return void s();if(this.#bt)return s(),void this.#At();let a=4*this.#pt[0],l=a%256;l>0&&(a+=256-l),((e,t,i,n,r,o,s)=>{const a=e[0],l=e[1],c=r*this.#pt[1],h=o||0,u=s||0;for(let e=0;e<n;e++){let n=r*(e+u)+4*h,o=n+c,s=i*e;for(let e=0;e<i;e++)a[s]=t[n++],l[s]=t[o++],s++}})(r,this.#yt,4*i,n,a,e,t)}setTargetsDirty(){this.#bt=!0}}var S=i(8879);const A="struct ObjectUniforms {\n modelMatrix: mat4x4f,\n\n dbId: u32,\n modelId: u32,\n objectFlags: u32,\n themeColor: u32,\n\n materialIndex: u32,\n pad: u32,\n pad2: u32,\n pad3: u32\n}\n\nstruct CommonMaterialUniforms {\n edgeColor: u32,\n doNotCutOverride: u32,\n pad: u32,\n pad2: u32\n}\n\nstruct MaterialUniforms {\n renderFlags: u32,\n diffuse: u32,\n specular: u32,\n shininess: f32,\n\n hatchParams: vec2f,\n hatchTintIntensity: f32,\n heatmapSensorCountAndOffset: u32\n}\n\n@group($bindGroup) @binding(0) var<storage> objectUniformsArr : array<ObjectUniforms>;\n//@group($bindGroup) @binding(0) var<uniform> objectUniformsArr : array<ObjectUniforms, ${MAX_BATCH}>;\n@group($bindGroup) @binding(1) var<storage> materialUniformsArr : array<MaterialUniforms>;\n@group($bindGroup) @binding(2) var<uniform> commonMaterialUniforms : CommonMaterialUniforms;\n\n\nfn getObjectUniforms(instance: u32) -> ObjectUniforms {\n return objectUniformsArr[instance];\n}\n\nfn getMaterialUniforms(materialIndex: u32) -> MaterialUniforms {\n return materialUniformsArr[materialIndex];\n}\n\nfn intToVec(v : u32) -> vec4u {\n return vec4u(v & 0xff, (v >> 8) & 0xff, (v >> 16) & 0xff, (v >> 24) & 0xff);\n}\n\nfn intToVecf(v : u32) -> vec4f {\n return vec4f(intToVec(v)) / 255.0;\n}\n";var w=i(37365),T=i(26027),M=i(99315);class C{#et;#wt;#Tt;#Mt={};constructor(e){this.#et=e}#Ct(e){let t=this.#Mt[e];if(!t){const i=this.#et.createShaderModule({label:"Mipmap Generator",code:(0,M.E)()});this.#wt=this.#et.createBindGroupLayout({label:"Mipmap Generator",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{}}]}),this.#Tt=this.#et.createPipelineLayout({label:"Mipmap Generator",bindGroupLayouts:[this.#wt]}),t=this.#et.createRenderPipeline({layout:this.#Tt,vertex:{module:i,entryPoint:"vertexMain"},fragment:{module:i,entryPoint:"fragmentMain",targets:[{format:e}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint32"}}),this.#Mt[e]=t}return t}generateMipmaps(e,t){let i=e.__gpuTexture.createView({baseMipLevel:0,mipLevelCount:1});const n=this.#et.createCommandEncoder({});for(let r=1;r<t.mipLevelCount;++r){const o=e.__gpuTexture.createView({baseMipLevel:r,mipLevelCount:1}),s=n.beginRenderPass({colorAttachments:[{view:o,loadValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),a=this.#Ct(t.format),l=this.#et.createBindGroup({layout:a.getBindGroupLayout(0),entries:[{binding:0,resource:e.__gpuSampler},{binding:1,resource:i}]});s.setPipeline(a),s.setBindGroup(0,l),s.draw(3,1,0,0),s.end(),i=o}this.#et.queue.submit([n.finish()])}}const P="struct TextureUniforms {\n\t//Note that 3x3 matrix is padded to 4 floats per row\n\ttexMatrix: mat3x3f,\n\ttexMatrixBump: mat3x3f,\n\ttexMatrixAlpha: mat3x3f,\n\tnormalScale: vec2f,\n\tpad: vec2f\n}\n@group($bindGroup) @binding(0) var<uniform> textureUniforms : TextureUniforms;\n\n//TODO: add other material specific uniforms like texture map bindings here\n//Note that basic stuff like diffuse/specular color is already handled by ObjectUniforms, here\n//is meant for more complex materials\n\n@group($bindGroup) @binding(1) var mapDiffuse: texture_2d<f32>;\n@group($bindGroup) @binding(2) var smplDiffuse: sampler;\n\n@group($bindGroup) @binding(3) var mapSpecular: texture_2d<f32>;\n@group($bindGroup) @binding(4) var smplSpecular: sampler;\n\n//Contains either bump map or normal map, depending on render flags\n@group($bindGroup) @binding(5) var mapNormal: texture_2d<f32>;\n@group($bindGroup) @binding(6) var smplNormal: sampler;\n\n@group($bindGroup) @binding(7) var mapAlpha: texture_2d<f32>;\n@group($bindGroup) @binding(8) var smplAlpha: sampler;\n";function D(){return{binding:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,visibility:arguments.length>1&&void 0!==arguments[1]?arguments[1]:GPUShaderStage.FRAGMENT,texture:{sampleType:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"float"}}}function L(){return{binding:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,visibility:arguments.length>1&&void 0!==arguments[1]?arguments[1]:GPUShaderStage.FRAGMENT,sampler:{}}}function I(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return(0,d.$wgsl)(P,{bindGroup:e})}const R={NO_UNIFORMS:268435456,TEXTURE_MASK:255,MAP_DIFFUSE:1,MAP_SPECULAR:2,MAP_BUMP:4,MAP_NORMAL:8,MAP_ALPHA:16},O=new Float32Array(9);class N extends f.D{#et;#Pt;#Dt;#Lt;#It;constructor(e,t,i){super(e,40,!0,!1),this.#et=e,this.#Pt=i,this.#Dt=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT|GPUShaderStage.VERTEX,buffer:{}},D(1),L(2),D(3),L(4),D(5),L(6),D(7),L(8)]}),t?(this.#It||(this.#It=new C(e)),this.#Rt(t)):this.#Ot()}#Ot(){let e=this.#Pt.view,t=this.#Pt.sampler;this.#Lt=this.#et.createBindGroup({layout:this.#Dt,entries:[{binding:0,resource:{buffer:this.getBuffer()}},{binding:1,resource:e},{binding:2,resource:t},{binding:3,resource:e},{binding:4,resource:t},{binding:5,resource:e},{binding:6,resource:t},{binding:7,resource:e},{binding:8,resource:t}]})}#Nt(e,t){let i=e.offset,n=e.repeat;if(e.matrix)O.set(e.matrix.elements);else for(let e=0;e<9;e++)O[e]=e%4?0:1;O[6]+=i.x,O[7]+=i.y,O[0]*=n.x,O[3]*=n.x,O[1]*=n.y,O[4]*=n.y,this.setMatrix3x3(t,O)}#Rt(e){let t=0,i=[{binding:0,resource:{buffer:this.getBuffer()}}];const n=(n,r,o)=>{let s,a,l=e[n];l?((0,T.i1)(this.#et,this.#It,l),s=l.__gpuTexture.createView(),a=l.__gpuSampler,t|=r):(s=this.#Pt.view,a=this.#Pt.sampler),i.push({binding:o,resource:s}),i.push({binding:o+1,resource:a})};n("map",R.MAP_DIFFUSE,1),n("specularMap",R.MAP_SPECULAR,3),e.bumpMap?n("bumpMap",R.MAP_BUMP,5):n("normalMap",R.MAP_NORMAL,5),n("alphaMap",R.MAP_ALPHA,7);let r=e.map||e.specularMap;r&&this.#Nt(r,0);let o=e.normalMap||e.bumpMap;o&&this.#Nt(o,12);let s=e.alphaMap;return s&&this.#Nt(s,24),e.bumpMap&&(this.setFloat(36,e.bumpScale),this.setFloat(37,e.bumpScale)),e.normalMap&&(this.setFloat(36,e.normalScale.x),this.setFloat(37,e.normalScale.y)),this.upload(),this.#Lt=this.#et.createBindGroup({layout:this.#Dt,entries:i}),t}getLayout(){return this.#Dt}getBindGroup(){return this.#Lt}}function F(e){let t=0;return e.map&&(t|=R.MAP_DIFFUSE),e.specularMap&&(t|=R.MAP_SPECULAR),e.bumpMap&&(t|=R.MAP_BUMP),e.normalMap&&(t|=R.MAP_NORMAL),e.alphaMap&&(t|=R.MAP_ALPHA),t}function U(e){const t=e.target;t.__gpuMaterialUniforms&&(t.__gpuMaterialUniforms.getBuffer().destroy(),t.__gpuMaterialUniforms=void 0),t.removeEventListener("dispose",U)}let B;const k=512,V=96;function G(e){return(0,d.$wgsl)(A,{bindGroup:e})}function z(e,t,i){return 255*e.r|255*e.g<<8|255*e.b<<16|255*t<<24}function H(e){return 255*e.x|255*e.y<<8|255*e.z<<16|255*e.w<<24}function W(e,t){for(let i=0;i<e.length;++i)if(t<e[i])return i}const j=new w.LmvMatrix4(!1);class q{#rt;#et;#Ft;#Ut;#Bt;#kt;#Vt;#Gt;#zt;#Ht;#Wt=[];#jt;#qt;#Xt;#Yt=this.#Kt.bind(this);#Qt=this.#Zt.bind(this);#$t=this.#Jt.bind(this);#ei=this.#ti.bind(this);#ii=this.#ni.bind(this);#ri=this.#oi.bind(this);#si=this.#ai.bind(this);#li=0;#ci=!1;#hi=0;#ui;constructor(e,t,i,n,r,o,s,a){this.#rt=e,this.#et=this.#rt.getDevice(),this.#Ft=t,this.#Ut=i,this.#Bt=n,this.#kt=r,this.#Vt=o,this.#Gt=this.#Vt.id,this.#jt=this.#Vt.getFragmentList(),this.#Ht=s,this.#ui=a,this.#jt.registerMeshSetCallback(this.#$t),this.#jt.registerTransformChangedCallback(this.#ei),this.#jt.registerMaterialChangedCallback(this.#ii),this.#jt.registerObjectFlagsChangedCallback(this.#ri),this.#jt.registerThemingColorChangedCallback(this.#si),this.#Vt.registerIteratorChangedCallback(this.#Yt),this.#Kt(this.#Vt.getIterator())}dtor(){this.#Vt.removeIteratorChangedCallback(this.#Yt),this.#di(),this.#fi()}#di(){this.#jt.removeMeshSetCallback(this.#$t),this.#jt.removeTransformChangedCallback(this.#ei),this.#jt.removeMaterialChangedCallback(this.#ii),this.#jt.removeObjectFlagsChangedCallback(this.#ri),this.#jt.removeThemingColorChangedCallback(this.#si)}#fi(){const e=this.#zt.getGeomScenes();for(let t=0;t<e.length;++t){const i=e[t];i&&i.count&&i.removeFragOrderChangedCallback(this.#Qt)}}#Kt(e){this.#zt&&this.#fi(),this.#zt=e,this.#qt=this.#zt.getFragOrder(),this.#Xt=new Uint32Array(this.#qt.length);for(let e=0;e<this.#qt.length;++e)this.#Xt[this.#qt[e]]=e;const t=this.#zt.getGeomScenes(),i=[];for(let e=0;e<t.length;++e){const n=t[e];n&&n.count&&(i.push(n),n.registerFragOrderChangedCallback(this.#Qt))}const n=[];i.sort(((e,t)=>e.start-t.start));for(let e=0;e<i.length;++e)n.push(i[e].count);this.#pi(n),this.#oi()}#Zt(e,t){let i,n=!1;void 0===e&&(e=0,t=this.#jt.fragments.length,n=!0);for(let n=e;n<e+t;++n)i=this.#qt[n],this.#Xt[i]=n;n?this.#oi():this.updateBatch(e,t)}#oi(){const e=this.#zt.getGeomScenes();let t;for(let i=0;i<e.length;++i)t=e[i],t&&(t.uniformsNeedUpdate=!0)}#pi(e){this.#Wt.length=0,this.#Ft.setBufferLimits(this.#Gt,this.#Wt);let t=this.#Ht.length,i=0,n=this.#Ht[0].size/V,r=0,o=0,s=0;for(let a of e){if(o+=a,o>n){if(t<=i+1){const e=this.#jt.fragments.length-r,n=e<=this.#Ut?e:this.#Ut,o=this.#et.createBuffer({size:n*V,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this.#Ht.push(o),t++,this.#ui(this.#Gt,i+1,o)}this.#Wt[i++]=r+s,r+=s,o=a,n=this.#Ht[i].size/V}s=o}this.#Wt[i]=r+s}#mi(e,t){if(this.#jt.hasGlobalTransform||16&this.#jt.vizflags[e])this.#jt.getWorldMatrix(e,j),this.#Bt.set(j.elements,this.#li);else{const t=12*e,i=this.#jt.transforms;this.#Bt[this.#li]=i[t],this.#Bt[this.#li+1]=i[t+1],this.#Bt[this.#li+2]=i[t+2],this.#Bt[this.#li+3]=0,this.#Bt[this.#li+4]=i[t+3],this.#Bt[this.#li+5]=i[t+4],this.#Bt[this.#li+6]=i[t+5],this.#Bt[this.#li+7]=0,this.#Bt[this.#li+8]=i[t+6],this.#Bt[this.#li+9]=i[t+7],this.#Bt[this.#li+10]=i[t+8],this.#Bt[this.#li+11]=0,this.#Bt[this.#li+12]=i[t+9],this.#Bt[this.#li+13]=i[t+10],this.#Bt[this.#li+14]=i[t+11],this.#Bt[this.#li+15]=1}const i=this.#jt.fragments.fragId2dbId[e];this.#kt[this.#li+16]=i,this.#kt[this.#li+17]=this.#Gt,this.#kt[this.#li+18]=this.#jt.objectFlagsCB&&this.#jt.objectFlagsCB(i);const n=this.#jt.db2ThemingColor[i];n&&n.w>0?this.#kt[this.#li+19]=H(n):this.#kt[this.#li+19]=0;let r=80;return t&&(this.#Ft.setMaterialReference(this.#li,t),r=V),r}#Jt(e,t){if(this.#gi())return;const i=this.#mi(e,t),n=this.#Xt[e];this.#vi(n,0,i)}#ni(e,t,i){if(this.#gi())return;this.#Ft.setMaterialReference(this.#li,t);const n=this.#Xt[e];this.#vi(n,80,4),i||this.#rt.invalidateRenderBundles(this.#Vt)}#ti(e){if(this.#gi())return;this.#jt.getWorldMatrix(e,j),this.#Bt.set(j.elements,this.#li);const t=this.#Xt[e];this.#vi(t,0,64)}#ai(e,t){if(this.#gi())return;t.w>0?this.#kt[this.#li+19]=H(t):this.#kt[this.#li+19]=0;const i=this.#Xt[e];this.#vi(i,76,4)}updateBatch(e,t){let i,n;this.#li=0;let r=0,o=e;for(let s=e;s<e+t;++s)i=this.#qt[s],n=this.#jt.getMaterial(i),this.#mi(i,n),this.#li+=24,++r===k&&(this.#vi(o,0,r*V),o+=r,r=0,this.#li=0);r>0&&this.#vi(o,0,r*V),this.#li=0}#gi(){return!!this.#ci||++this.#hi>1e3&&(this.#ci=!0,this.#oi(),!0)}resetUpdateHeuristic(){this.#hi=0,this.#ci=!1}#vi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V;const n=W(this.#Wt,e),r=this.#Ht[n],o=0===n?e:e-this.#Wt[n-1];this.#et.queue.writeBuffer(r,o*V+t,this.#Bt.buffer,t,i)}}class X extends l{#rt;#et;#Ft;#yi=new Float32Array(12288);#bi=new Int32Array(this.#yi.buffer);#Ht=new Map;#xi;#Ut;#Wt=new Map;#_i=new Map;#Ei=new Map;#Si;#Ai;#wi;#Ti;#Mi;#Ci=new Float32Array(8);#Pi=new Int32Array(this.#Ci.buffer);#Di;#Li;#Ii;#Ri=new Float32Array(4);#Oi=new Int32Array(this.#Ri.buffer);#Ni;#Fi;constructor(e){super(e.getDevice()),this.#rt=e,this.#et=this.#rt.getDevice(),this.MAX_BATCH=k,this.OBJECT_STRIDE_32=24;const t=this.#et.limits.maxStorageBufferBindingSize;this.#xi=Math.floor(t/V)*V,this.#Ut=this.#xi/V,this.#Ui(),this.#Di=this.#Bi.bind(this),this.#Li=this.#ki.bind(this)}#Vi(e){return this.#et.createBindGroup({layout:this.#Ni,entries:[{binding:0,resource:{buffer:e}},{binding:1,resource:{buffer:this.#Mi}},{binding:2,resource:{buffer:this.#Ii}}]})}#ui(e,t,i){const n=this.#_i.get(e);n&&(n[t]=this.#Vi(i))}#Ui(){this.#Ft=this.#et.createBuffer({size:49152,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.#Ii=this.#et.createBuffer({size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});const e=this.mAlloc(0);e[0].stride=32,this.#Mi=e[0].buffer,this.#Ni=this.#et.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),this.#Fi=this.#Vi(this.#Ft)}#Gi(e){let t;if(e.__gpumb)t=e.__gpumbOffset;else{const i=this.mAlloc(32);e.__gpumb=i[0],e.__gpumbOffset=t=i[1];const n=()=>{this.mFree(e),e.removeEventListener("dispose",n)};e.addEventListener("dispose",n)}return t}#zi(e){this.#et.queue.writeBuffer(this.#Mi,e,this.#Ci.buffer,0,this.#Ci.byteLength)}addModel(e){if(this.#Ht.has(e.id))return;const t=e.getFragmentList().fragments.length*V;if(0===t)return;let i=Math.ceil(t/this.#xi);const n=511*(i-1)*V;i*this.#xi<t+n&&(i+=1);let r=(t+n)/this.#xi%1*this.#xi;r=0===r?this.#xi:r+3&4294967292;const o=[],s=[];for(let e=0;e<i;++e){const t=e===i-1?r:this.#xi,n=this.#et.createBuffer({size:t,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});o.push(n);const a=this.#Vi(n);s.push(a)}this.#Ht.set(e.id,o),this.#_i.set(e.id,s);const a=new q(this.#rt,this,this.#Ut,this.#yi,this.#bi,e,o,this.#ui.bind(this));this.#Ei.set(e.id,a)}removeModel(e){if(this.#Ht.has(e.id)){const t=this.#Ht.get(e.id);for(const e of t)e.destroy();this.#Ht.delete(e.id),this.#Wt.delete(e.id);this.#Ei.get(e.id).dtor(),this.#Ei.delete(e.id),this.#Si=null,this.#Ai=null,this.#wi=null,this.#Ti=null}}#Bi(e){const t=e.target,i=F(t);this.setOneMaterialData(t,i,!0)}#ki(e){const t=e.target;t.removeEventListener("update",this.#Di),t.removeEventListener("dispose",this.#Li)}initMaterialUpdateHook(e,t){if(!e.hasEventListener("update",this.#Di)){e.addEventListener("update",this.#Di),e.addEventListener("dispose",this.#Li);const i=!0;this.setOneMaterialData(e,t,i)}}setOne(e,t,i,n){this.setOneObjectData(e,t),this.setOneMaterialData(i,n)}setMaterialReference(e,t){const i=this.#Gi(t);this.#bi[e+20]=i/32}setOneMaterialData(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(i||e.needsUpdate||e.uniformsNeedUpdate){this.#Gi(e);const n=e.opacity<0?1:0,r=e.doNotCut?2:0,o=e.alphaTest>0?4:0,s=e.hatchPattern?8:0;this.#Pi[0]=n|r|o|s|t<<16,e.uniformsNeedUpdate&&(e.__gpuDiffuse=z(e.color,Math.abs(e.opacity)),e.specular?e.__gpuSpecular=z(e.specular,e.reflectivity):e.__gpuSpecular=0,e.uniformsNeedUpdate=!1),this.#Pi[1]=e.__gpuDiffuse,this.#Pi[2]=e.__gpuSpecular,this.#Ci[3]=e.shininess,e.hatchPattern&&(this.#Ci[4]=e.hatchParams.x,this.#Ci[5]=e.hatchParams.y,this.#Ci[6]=e.hatchTintIntensity),this.#Pi[7]=((e.heatmapSensorOffset??0)<<8)+e.heatmapSensorCount??0,this.#zi(e.__gpumbOffset),i||(e.needsUpdate=!1)}}setOneMaterialData2D(e,t){if(e.needsUpdate||e.uniformsNeedUpdate){this.#Gi(e);const i=e.opacity<0?1:0,n=e.doNotCut?2:0,r=e.alphaTest>0?4:0,o=e.hatchPattern?8:0;this.#Pi[0]=i|n|r|o|t<<16,e.uniformsNeedUpdate&&(e.__gpuDiffuse=255*(e.opacity||1)<<24,e.uniformsNeedUpdate=!1),this.#Pi[1]=e.__gpuDiffuse,e.hatchPattern&&(this.#Ci[4]=e.hatchParams.x,this.#Ci[5]=e.hatchParams.y,this.#Ci[6]=e.hatchTintIntensity),this.#zi(e.__gpumbOffset),e.needsUpdate=!1}}setOneObjectData(e,t){let i=24*t;this.#yi.set(e.matrixWorld.elements,i),this.#bi[i+16]=e.dbId,this.#bi[i+17]=e.modelId,this.#bi[i+18]=e.objectFlags||0;const n=e.themingColor;n&&n.w>0?this.#bi[i+19]=H(n):this.#bi[i+19]=0,this.setMaterialReference(i,e.material)}updateBatch(e){var t;const i=e.frags.modelId,n=e.start,r=e.lastItem-n;null===(t=this.#Ei.get(i))||void 0===t||t.updateBatch(n,r)}setEdgeColorInt(e){e!==this.#Oi[0]&&(this.#Oi[0]=e,this.#et.queue.writeBuffer(this.#Ii,0,this.#Ri.buffer,0,this.#Ri.byteLength))}setDoNotCutOverride(e){e!==!!this.#Oi[1]&&(this.#Oi[1]=e,this.#et.queue.writeBuffer(this.#Ii,0,this.#Ri.buffer,0,this.#Ri.byteLength))}getBufferInt(){return this.#bi}getBufferFloat(){return this.#yi}getObjectStride(){return V}writeToQueue(e){let t=e*V;t=t+255&4294967040,this.#et.queue.writeBuffer(this.#Ft,0,this.#yi.buffer,0,t)}resetUpdateHeuristic(e){var t;null===(t=this.#Ei.get(e))||void 0===t||t.resetUpdateHeuristic()}getRenderIndex(e){return e-this.#wi}setBufferLimits(e,t){this.#Wt.set(e,t)}getBindGroup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(-1!==e){this.MAX_BATCH=1/0;const i=this.#Wt.get(e),n=W(i,t);return e===this.#Si&&n===this.#Ai||(this.#Si=e,this.#Ai=n,this.#wi=0===n?0:i[n-1],this.#Ti=this.#_i.get(e)[n]),this.#Ti}return this.MAX_BATCH=k,this.#Fi}getLayout(){return this.#Ni}}var Y=i(65796);var K=i(12360);const Q=function(e){return(0,d.$wgsl)("const NUM_STOPS = $NUM_HEATMAP_STOPS;\n\n// Interleaving heatmap colors and stops for better alignment\nstruct ColorsAndStops {\n color: vec3f,\n stop: f32\n};\n\nstruct IBLSettings {\n envMapExposure: f32,\n exposureBias: f32,\n tonemapMethod: i32,\n numCutplanes: i32,\n heatmapAlpha: f32,\n pad1: u32,\n pad2: u32,\n pad3: u32,\n colorsAndStops: array<ColorsAndStops, NUM_STOPS>\n}\n@group($bindGroupNumber) @binding(0) var<uniform> ibl : IBLSettings;\n@group($bindGroupNumber) @binding(1) var reflMap: texture_cube<f32>;\n@group($bindGroupNumber) @binding(2) var reflSampler: sampler;\n@group($bindGroupNumber) @binding(3) var irrMap: texture_cube<f32>;\n@group($bindGroupNumber) @binding(4) var irrSampler: sampler;\n@group($bindGroupNumber) @binding(5) var<uniform> cutplanes: array<vec4f, 6>; //TODO: could use variable length array of needed\n@group($bindGroupNumber) @binding(6) var<storage> heatmapSensors: array<vec4f>;\n\n//TODO: Add lights here if we want to support discrete lights\n\nfn checkCutPlanes(worldPosition: vec3f) {\n for (var i=0; i<ibl.numCutplanes; i++) {\n // test if point is outside of cutting plane; if so, discard fragment\n if (dot(vec4f(worldPosition, 1.0), cutplanes[i]) > 0.0) {\n discard;\n }\n }\n}\n",{NUM_HEATMAP_STOPS:5,bindGroupNumber:e})};function Z(e){let t,i=e,n=(0,K.CreateCubeMapFromColors)({x:1,y:1,z:1},{x:1,y:1,z:1}),r=n,o=n;(0,T.rL)(n),(0,T.rL)(r),(0,T.rL)(o);let s,a,l,c,h=1,u=1,d=0,f=new Float32Array(28),p=new Int32Array(f.buffer),m=new Float32Array(24),g=0,v=!1;const y=new Float32Array(20);let b,x,_,E,S,A=!1;this.init=function(){t=i.getDevice(),s=t.createBuffer({size:f.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),c=t.createBuffer({size:m.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),_=t.createBuffer({size:64,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),a=t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:5,visibility:GPUShaderStage.FRAGMENT,buffer:{}},{binding:6,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]})},this.setReflectionMap=function(e){e!==r&&(e||=n,(0,T.rL)(e),(0,T.el)(r),r=e,E=!0)},this.setIrradianceMap=function(e){e||=n,(0,T.rL)(e),(0,T.el)(o),o=e,E=!0},this.isComplete=function(){return r&&o},this.setEnvExposure=function(e){const t=Math.pow(2,e);t!==u&&(u=t,S=!0)},this.setExposureBias=function(e){let t=Math.pow(2,e);t!==h&&(h=t,S=!0)},this.setTonemapMethod=function(e){d!==e&&(d=e,S=!0)},this.setEnvRotation=function(e){},this.setCutPlanes=function(e){if(g!==((null==e?void 0:e.length)||0)&&(g=(null==e?void 0:e.length)||0,S=!0),!e)return;e.length>6&&console.warn("too many cut planes");let t=0;for(let i=0;i<e.length;i++){let n=e[i],r=n.x;m[t]!==r&&(v=!0,m[t]=r),t++,r=n.y,m[t]!==r&&(v=!0,m[t]=r),t++,r=n.z,m[t]!==r&&(v=!0,m[t]=r),t++,r=n.w,m[t]!==r&&(v=!0,m[t]=r),t++}},this.setHeatmaps=function(e,t,i){let n=0;for(let i=0;i<5;++i)y.set([e[3*i],e[3*i+1],e[3*i+2],t[i]],n),n+=4;b=i,S=!0},this.setHeatmapSensors=function(e){!x||x.length<e.length?x=new Float32Array(e):x.set(e),A=!0},this.getBindGroup=function(){return l},this.getLayout=function(){return a},this.update=function(){var e,n,w,M,C,P;t&&(S&&(f[0]=u,f[1]=h,p[2]=d,p[3]=g,f[4]=b,f.set(y,8),t.queue.writeBuffer(s,0,f.buffer,0,f.byteLength),S=!1),v&&(t.queue.writeBuffer(c,0,m.buffer,0,m.byteLength),v=!1),A&&((!_||_.size<x.byteLength)&&(_&&_.destroy(),_=t.createBuffer({size:x.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),E=!0),t.queue.writeBuffer(_,0,x.buffer,0,x.byteLength),A=!1),(E||null!==(e=r)&&void 0!==e&&e.needsUpdate||null!==(n=o)&&void 0!==n&&n.needsUpdate)&&((0,T.eY)(t,r),(0,T.eY)(t,o),l=t.createBindGroup({layout:a,entries:[{binding:0,resource:{buffer:s}},{binding:1,resource:null===(w=r)||void 0===w?void 0:w.__gpuTextureCube.createView({dimension:"cube"})},{binding:2,resource:null===(M=r)||void 0===M?void 0:M.__gpuSampler},{binding:3,resource:null===(C=o)||void 0===C?void 0:C.__gpuTextureCube.createView({dimension:"cube"})},{binding:4,resource:null===(P=o)||void 0===P?void 0:P.__gpuSampler},{binding:5,resource:{buffer:c}},{binding:6,resource:{buffer:_}}]}),i.invalidateRenderBundles(),E=!1))}}const $="// Precomputed sin/cos of the environment rotation\n//DT uniform float envRotationSin;\n//DT uniform float envRotationCos;\nconst envRotationSin = 0.0;\nconst envRotationCos = 1.0;\n\nfn adjustLookupVector(lookup: vec3f) -> vec3f {\n return vec3f(\n envRotationCos * lookup.x - envRotationSin * lookup.z,\n lookup.y,\n envRotationSin * lookup.x + envRotationCos * lookup.z);\n}\n\n//NOTE: This depends on the specific encoding used.\n//We use the environment preset's built in exposure correction,\n//a gamma of 2.0 and an extra factor of 16\n//when generating the cube map in the modified CubeMapGen tool\n//See this article by Karis for details: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\nfn RGBMDecode(vRGBM: vec4f, exposure: f32) -> vec3f {\n var ret = vRGBM.rgb * (vRGBM.a * 16.0); //variable factor in alpha channel + fixed factor of 16.0\n ret *= ret; //remove gamma of 2.0 to go into linear space\n ret *= exposure; //apply exposure to get back original intensity\n return ret;\n}\n\n//Gamma encoded half-float or float input texture. See DecodeEnvMap for details.\nfn GammaDecode(vRGBA: vec4f, exposure: f32) -> vec3f {\n return vRGBA.xyz * vRGBA.xyz * exposure;\n}\n\nfn sampleIrradianceMap(dirWorld: vec3f, irrMap: texture_cube<f32>, s: sampler, exposure: f32) -> vec3f {\n\n var cubeColor4 = textureSample(irrMap, s, adjustLookupVector(dirWorld));\n\n#if $isGamma\n var indirectDiffuse = GammaDecode(cubeColor4, exposure);\n return indirectDiffuse;\n#elif $isRgbm\n var indirectDiffuse = RGBMDecode(cubeColor4, exposure);\n return indirectDiffuse;\n#else\n var indirectDiffuse = cubeColor4.xyz;\n\n\t#if $gammaInput\n\t\tindirectDiffuse.xyz *= indirectDiffuse.xyz;\n\t#endif\n\n return indirectDiffuse;\n\n#endif\n}\n\nfn sampleReflection(dir: vec3f, envMap: texture_cube<f32>, s: sampler, mipIndex: f32, exposure: f32) -> vec3f {\n\n var adjDir = adjustLookupVector(dir);\n\n#if $isGamma\n //TODO: is it textureSampleBias or textureSampleLevel? Used to be textureCubeLod in WebGL\n var envTexColor = textureSampleLevel( envMap, s, adjDir, mipIndex );\n return GammaDecode(envTexColor, exposure);\n#elif $isRgbm\n var envTexColor = textureSampleLevel( envMap, s, adjDir, mipIndex );\n return RGBMDecode(envTexColor, exposure);\n#else\n\n //Assumes this code path is non-HDR and non-blurred reflection map, like vanilla three.js\n\n var envTexColor = textureSample( envMap, s, adjDir );\n var cubeColor = envTexColor.xyz;\n\n\t#if $gammaInput\n\t\tcubeColor *= cubeColor;\n\t#endif\n\n\treturn cubeColor;\n#endif\n\n}\n";function J(e,t,i){return(0,d.$wgsl)($,{isGamma:e,isRgbm:t,gammaInput:i})}const ee="struct CameraUniforms {\n projectionMatrix : mat4x4f,\n viewMatrix: mat4x4f,\n viewMatrixInverse: mat4x4f,\n viewInverseEnv: mat4x4f,\n near: f32,\n far: f32\n}\n@group($0) @binding(0) var<uniform> uniforms : CameraUniforms;\n";function te(e){return(0,d.$wgsl)(ee,e||0)}const ie=new w.LmvMatrix4;ie.elements[10]=.5,ie.elements[14]=.5;class ne extends f.D{#Hi=new w.LmvMatrix4;#Wi=new w.LmvMatrix4;#ji=new w.LmvMatrix4;constructor(e){super(e,80,!0,!0)}update(e){void 0!==e.parent&&null!==e.parent||e.updateMatrixWorld(),e.worldUpTransform?this.#Wi.multiplyMatrices(e.worldUpTransform,e.matrixWorld):this.#Wi.copy(e.matrixWorld),this.#Hi.multiplyMatrices(ie,e.projectionMatrix),this.#ji.multiplyMatrices(this.#Hi,e.matrixWorldInverse),this.setBuffer(0,this.#Hi.elements),this.setBuffer(16,e.matrixWorldInverse.elements),this.setBuffer(32,e.matrixWorld.elements),this.setBuffer(48,this.#Wi.elements),this.setFloat(64,e.near),this.setFloat(65,e.far),this.upload()}getViewProjectionMatrix(){return this.#ji}}function re(e,t,i,n,r){return(0,d.$wgsl)("\tdiagnostic(off, derivative_uniformity);\n\n\t$IBL\n\t$cameraUniforms\n\t$objectUniforms\n\t$materialUniforms\n\t$pack_normals\n\t$pack_depth\n\t$mat_inverse\n\t$tonemap\n\t$envMapSample\n\t$heatmapDecl\n\t$hatch\n\n\tconst hatchTintColor = vec3f(0, 0, 0);\n\n\n\tstruct VertexOutput {\n\t\t@builtin(position) Position : vec4f,\n\t\t@location(0) @interpolate(flat) instance: u32,\n\t\t@location(1) vViewNormal: vec3f,\n\t\t@location(2) vViewPosition: vec3f,\n\t\t@location(3) vWorldPosition: vec3f,\n\t\t@location(4) depth: f32,\n#if $isUVW\n\t\t@location(5) uvw : vec3f,\n\t\t@location(6) uvwBump : vec3f,\n\t\t@location(7) uvwAlpha : vec3f,\n#elif $hasTextures\n\t\t@location(5) uv : vec2f,\n\t\t@location(6) uvBump : vec2f,\n\t\t@location(7) uvAlpha : vec2f,\n#endif\n#if $hasVertexColors\n\t\t@location(8) color: vec3f\n#endif\n\t}\n\n\tstruct VertexInput {\n\t\t@location(0) position : vec3f,\n\t\t@location(1) normal : u32,\n#if $hasUVAndHasVertexColors\n\t\t@location(2) color: vec3f,\n\t\t@location(3) uv: vec2f,\n#endif\n#if $hasUVAndNotHasVertexColors\n\t#if $isUVW\n\t\t@location(2) uvw: vec3f,\n\t#else\n\t\t@location(2) uv: vec2f,\n\t#endif\n#endif\n#if $notHasUVAndHasVertexColors\n\t\t@location(2) color: vec3f,\n#endif\n\t}\n\n\t@vertex fn vsmain(\n\t\tin: VertexInput,\n\t\t@builtin(instance_index) instance : u32\n\t) -> VertexOutput {\n\n\t\tvar objectUniforms = getObjectUniforms(instance);\n\n\t\tvar output : VertexOutput;\n\t\tvar pos4 = vec4f(in.position.x, in.position.y, in.position.z, 1.0);\n\n\t\tvar mvMatrix = uniforms.viewMatrix * objectUniforms.modelMatrix;\n\t\tvar mvPosition = mvMatrix * pos4;\n\n\t\toutput.Position = uniforms.projectionMatrix * mvPosition;\n\n\t\toutput.vViewPosition = -mvPosition.xyz;\n\t\toutput.vViewNormal = getNormalMatrix(mvMatrix) * decodeNormalInt(in.normal);\n\t\toutput.vWorldPosition = (objectUniforms.modelMatrix * pos4).xyz;\n\n#if $hasTextures\n\t#if $isUVW\n\t\toutput.uvw = textureUniforms.texMatrix * in.uvw;\n\t\toutput.uvwBump = textureUniforms.texMatrixBump * in.uvw;\n\t\toutput.uvwAlpha = textureUniforms.texMatrixAlpha * in.uvw;\n\t#else\n\t\toutput.uv = (textureUniforms.texMatrix * vec3f(in.uv, 1.0)).xy;\n\t\toutput.uvBump = (textureUniforms.texMatrixBump * vec3f(in.uv, 1.0)).xy;\n\t\toutput.uvAlpha = (textureUniforms.texMatrixAlpha * vec3f(in.uv, 1.0)).xy;\n\t#endif\n#else\n\t#if $isUVW\n\t\toutput.uvw = in.uvw;\n\t\toutput.uvwBump = in.uvw;\n\t\toutput.uvwAlpha = in.uvw;\n\t#endif\n#endif\n\t\toutput.instance = instance;\n\t\toutput.depth = mvPosition.z;\n#if $hasVertexColors\n\t\toutput.color = in.color;\n#endif\n\n\t\treturn output;\n\t}\n\n\tstruct PixelOutput {\n\t\t@location(0) color: vec4f,\n\t\t@location(1) normal: vec4f,\n\t\t@location(2) viewDepth: vec4f,\n\t\t@location(3) dbId: vec4u,\n\t\t@location(4) modelId: vec4u,\n\t\t//@location(5) objectFlags: vec4u\n\t}\n\n\n\t//Samples normal map texture (will be treated as either bump map or normal map depending on flags)\n\tfn GET_BUMPMAP(uv: vec2f) -> vec4f {\n\t\t//TODO: this ignores invert and clamp settings, see getMapChunk in WebGLProgram.js for details\n\t\treturn textureSample(mapNormal, smplNormal, uv);\n\t}\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\tfn dHdxy_fwd(vUvBump: vec2f) -> vec2f {\n\n\t\tvar dSTdx = dpdx( vUvBump );\n\t\tvar dSTdy = dpdy( vUvBump );\n\n\t\tvar Hll = textureUniforms.normalScale.x * GET_BUMPMAP(vUvBump).x;\n\t\tvar dBx = textureUniforms.normalScale.x * GET_BUMPMAP(vUvBump + dSTdx).x - Hll;\n\t\tvar dBy = textureUniforms.normalScale.x * GET_BUMPMAP(vUvBump + dSTdy).x - Hll;\n\n\t\treturn vec2f( dBx, dBy );\n\t}\n\n\tfn perturbNormalArb( surf_pos: vec3f, surf_norm: vec3f, dHdxy: vec2f ) -> vec3f {\n\n\t\tvar vSigmaX = dpdx( surf_pos );\n\t\tvar vSigmaY = dpdy( surf_pos );\n\t\tvar vN = surf_norm; // normalized\n\n\t\tvar R1 = cross( vSigmaY, vN );\n\t\tvar R2 = cross( vN, vSigmaX );\n\n\t\tvar fDet = dot( vSigmaX, R1 );\n\n\t\tvar vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\tfn perturbNormal2Arb( eye_pos: vec3f, surf_norm: vec3f, vUvBump: vec2f ) -> vec3f {\n\n\t\tvar q0 = dpdx( eye_pos.xyz );\n\t\tvar q1 = dpdy( eye_pos.xyz );\n\t\tvar st0 = dpdx( vUvBump.xy );\n\t\tvar st1 = dpdy( vUvBump.xy );\n\n\t\tvar S = normalize( q0 * st1.y - q1 * st0.y );\n\t\tvar T = normalize( -q0 * st1.x + q1 * st0.x );\n\t\tvar N = normalize( surf_norm );\n\n\t\tvar mapN = GET_BUMPMAP(vUvBump).xyz * 2.0 - 1.0;\n\t\tmapN = vec3f(textureUniforms.normalScale * mapN.xy, mapN.z);\n\t\tvar tsn = mat3x3f( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n\n\n\tfn toIntVec(v: vec4f) -> vec4u\n\t{\n\t\treturn vec4u(v * 255.0);\n\t}\n\n\tfn Schlick_v3(v: vec3f, cosHV: f32) -> vec3f {\n\t\tvar facing = max(1.0 - cosHV, 0.0);\n\t\treturn v + (1.0 - v) * pow(facing, 5.0);\n\t}\n\n\tfn Schlick_f(v: f32, cosHV: f32) -> f32 {\n\t\tvar facing = max(1.0 - cosHV, 0.0);\n\t\treturn v + ( 1.0 - v ) * pow(facing, 5.0);\n\t}\n\n\tfn InputToLinear(v: vec3f) -> vec3f {\n\t\treturn v*v;\n\t}\n\n\tconst AlphaTest = 0.01;\n\n\t@fragment fn psmain(\n\t\tin: VertexOutput\n\t) -> PixelOutput\n\t{\n#if $hasTextures\n\t#if $isUVW\n\t\tvar vUv = in.uvw.xy;\n\t\tvar vUvBump = in.uvwBump.xy;\n\t\tvar vUvAlpha = in.uvwAlpha.xy;\n\t#else\n\t\tvar vUv = in.uv;\n\t\tvar vUvBump = in.uvBump;\n\t\tvar vUvAlpha = in.uvAlpha;\n\t#endif\n#else\n\tconst vUv = vec2f(0.0,0.0);\n\tconst vUvBump = vec2f(0.0,0.0);\n\tconst vUvAlpha = vec2f(0.0,0.0);\n#endif\n\t\tvar output: PixelOutput;\n\t\tvar objectUniforms = getObjectUniforms(in.instance);\n\t\tvar materialUniforms = getMaterialUniforms(objectUniforms.materialIndex);\n\n\t\t//check doNotCut flag\n\t\tif (commonMaterialUniforms.doNotCutOverride + (materialUniforms.renderFlags & 2) == 0) {\n\t\t\tcheckCutPlanes(in.vWorldPosition);\n\t\t}\n\n\t\tvar normal = normalize(in.vViewNormal);\n\n\t\t//With ortho projection, the view direction needs to be\n\t\t//adjusted so that all view direction rays (for all pixels) are parallel\n\t\t//instead of going from the camera position directly to the vertex like\n\t\t//in perspective. In view space, this is kind of easy -- the view vector is along Z.\n\t\t//TODO: Actually the vViewPosition varying is the position of the camera wrt the vertex\n\t\t//so the naming of the variable can be clarified.\n\t\tvar viewDirection: vec3f;\n\t\tif (uniforms.projectionMatrix[3][3] == 0.0) {\n\t\t\tviewDirection = normalize( in.vViewPosition );\n\t\t} else {\n\t\t\tviewDirection = vec3f(0.0, 0.0, 1.0);\n\t\t}\n\t\tnormal = faceForward(normal, -viewDirection, normal);\n\n\t\tvar geomNormal = normal;\n\n#if $hasTextures\n\t\tif ((materialUniforms.renderFlags & (8 << 16)) != 0) {\n\t\t\tnormal = perturbNormal2Arb( -in.vViewPosition, normal, vUvBump );\n\t\t} else if ((materialUniforms.renderFlags & (4 << 16)) != 0) {\n\t\t\tnormal = perturbNormalArb( -in.vViewPosition, normal, dHdxy_fwd(vUvBump) );\n\t\t}\n#endif\n\n\t\t//TODO: vertex color\n#if $hasVertexColors\n\t\tvar diffuse = vec4f(in.color, 1.0);\n#else\n\t\tvar diffuse = intToVecf(materialUniforms.diffuse);\n\t\tif ((materialUniforms.renderFlags & (1 << 16)) != 0) {\n\t\t\tdiffuse *= textureSample(mapDiffuse, smplDiffuse, vUv);\n\t\t}\n#endif\n\t\tvar outAlpha = diffuse.a;\n\n#if $hasTextures\n\t\tif ((materialUniforms.renderFlags & (16 << 16)) != 0) {\n\t\t\tvar alphaTexel = textureSample(mapAlpha, smplAlpha, vUvAlpha);\n\t\t\toutAlpha *= alphaTexel.r;\n\t\t}\n#endif\n\n\t\t//In the WebGL version, alpha test is a configurable parameter of each material,\n\t\t//However, we don't _really_ need to be that generic\n\t\tif ((materialUniforms.renderFlags & 4) != 0 && outAlpha < AlphaTest) {\n\t\t\tdiscard;\n\t\t}\n\n\t\tvar specularR = intToVecf(materialUniforms.specular);\n\t\tvar reflectivity = specularR.a;\n\t\tvar specular = InputToLinear(specularR.xyz);\n\n\t\t//Diffuse from irradiance map\n\t\tvar worldNormal = getMat3(uniforms.viewInverseEnv) * normal;\n\t\tvar indirectDiffuse = sampleIrradianceMap(worldNormal, irrMap, irrSampler, ibl.envMapExposure);\n\n\t\tvar outColor = InputToLinear(diffuse.xyz) * indirectDiffuse;\n\n\t\t//Reflection map\n\t\tvar reflectVec = reflect( -viewDirection, normal );\n\n\t\treflectVec = getMat3(uniforms.viewInverseEnv) * reflectVec;\n\n\t\t//If the reflection vector points into the ground, we will scale\n\t\t//down the reflection intensity, in order to fake interference with the\n\t\t//ground plane and avoid an eclipse-like light-dark line between the object\n\t\t//and its shadow.\n\t\t//The actual scaling is made up so that it gets very dark near the ground facing faces\n\t\t//float reflectScale = 1.0 - clamp(-reflectVec.y, 0.0, 1.0);\n\t\t//reflectScale *= (reflectScale * reflectScale);\n\t\tvar reflectScale = 1.0;\n\n\t\t//The environment cube map is blurred with the assumption that\n\t\t//max shininess is 2048 and every mip drops that by a factor of 4\n\t\t//float MipmapIndex = log4(shininess / 2048.0) / log4(0.25);\n\t\t//The simplification below was given in the original source for this method.\n\t\t//It uses log base 10. We use log base 2 below, which changes the constant.\n\t\t//float MipmapIndex = max(0.0, -1.66096404744368 * logShiny + 5.5);\n\t\tvar logShiny = log2(max(1.0+1e-10, materialUniforms.shininess));\n\t\tvar reflMipIndex = max(0.0, 5.5 - 0.5 * logShiny);\n\t\t//If we get roughness map support, we'd have to sample the roughness map here to get a mip index.\n\n\t\tvar cubeColor = sampleReflection(reflectVec, reflMap, reflSampler, reflMipIndex, ibl.envMapExposure);\n\n\t\tcubeColor *= reflectScale;\n\n\t\tvar facing = dot( viewDirection, normal );\n\n\t\t//Argh. If facing is very much below the horizon, it's probably\n\t\t//a backwards facing polygon, so turn off Fresnel completely.\n\t\t//Otherwise, if it's just slightly below, it's probably some interpolation\n\t\t//artifact, so we treat it as almost oblique facing.\n\t\t// Bypassing Fresnel when reflectivity is set exactly to 0.0 is intentional and provided\n\t\t// as a way to turn off the effect\n\t\tif (facing < -1e-2 || reflectivity == 0.0) {\n\t\t\tfacing = 1.0;\n\t\t} else {\n\t\t\tfacing = max(1e-6, facing);\n\t\t}\n\n#if $hasTextures\n\t\t//Gratuitous hack to make bump mapped materials less shiny at grazing angles.\n\t\t//This has the effect of reducing the Fresnel effect when bumpScale is large.\n\t\t//Assumption is that large bump scale = very rough surface.\n\t\tif ((materialUniforms.renderFlags & (4 << 16)) != 0) {\n\t\t\tfacing = min(1.0, facing + textureUniforms.normalScale.x * 7.0);\n\t\t}\n#endif\n\n#if $metalMaterial\n\n\t\t//Metals do not generally have Fresnel reflection\n\t\tvar schlickRefl = specular;\n\n#else\n\n\t\t//Nonmetals reflect using Fresnel -- so they reflect a lot at grazing angles\n\t\tvar schlickRefl = Schlick_v3(specular, facing);\n\n\t\t//Seems appropriate to also reduce transparency of the material as\n\t\t//the view angle is more oblique:\n\t\t//BOGUS: The scaling by reflectivity is not physical -- here\n\t\t//we use reflectivity as a scale to make transparent ghosted objects look good\n\t\t//while still retaining some physical Fresnel for glass materials.\n\t\t//For ghosted objects the reflectivity is 0 while for physical glass\n\t\t//it is a non-zero value.\n\t\toutAlpha = mix(outAlpha, Schlick_f(outAlpha, facing), reflectivity);\n\n\t\t//Scale down diffuse in order to keep energy conservation\n\t\t//at grazing angles, where specular takes over. The actual equation is\n\t\t//given here: http://www.cs.utah.edu/~shirley/papers/jgtbrdf.pdf.\n\t\t//For the environment map, N.V and N.R are equal so we can just square the one factor\n\t\t//instead of computing two and multiplying them.\n\t\t//TODO: check further on the exact normalization factors needed.\n\t\t//Also note that we drop a factor of PI (we drop that from the specular light as well,\n\t\t//where we use n/8 instead of n/8pi as normalization).\n\t\tvar invSchlick = pow(1.0 - facing * 0.5, 5.0);\n\n\t\t//If contrast is too high, and RaaS complains, set this factor to 1.\n\t\tvar norm_factor = (28.0 / 23.0) * (1.0 - invSchlick) * (1.0 - invSchlick);\n\n\t\toutColor *= norm_factor * (1.0 - specular);\n#endif\n\n\t\toutColor += cubeColor.xyz * schlickRefl.xyz;\n\n\t\tif (ibl.tonemapMethod == 1) {\n\t\t\toutColor = toneMapCanonOGS_WithGamma_WithColorPerserving(ibl.exposureBias * outColor);\n\t\t} else if (ibl.tonemapMethod == 2) {\n\t\t\toutColor = toneMapCanonFilmic_WithGamma(ibl.exposureBias * outColor);\n\t\t}\n\n\t\toutput.color = vec4f(outColor, outAlpha);\n\n\t\t//Store normal and depth information for SSAO (opaque objects only)\n\t\tvar discardNormal = 1.0;\n\t\tif (outAlpha < 0.9) {\n\t\t\tdiscardNormal = 0.0;\n\t\t}\n\n\t\toutput.normal = vec4f(packNormal10(geomNormal), discardNormal);\n\t\tvar unitDepth = (-in.depth - uniforms.near) / (uniforms.far - uniforms.near);\n\t\toutput.viewDepth = vec4f(packDepth10(unitDepth), discardNormal);\n\n\t\t//Store object identity information\n\t\toutput.dbId = intToVec(objectUniforms.dbId);\n\n\n\t\t//Currently we don't have enough room to bind a third ID render target (32 byte limit on render attachments),\n\t\t//so we stash half of the object flags in the modelId\n\t\t//output.objectFlags = intToVec(objectUniforms.objectFlags);\n\n\t\toutput.modelId = intToVec(objectUniforms.modelId | (objectUniforms.objectFlags << 16));\n\n\t\t//If there is theming color, apply it at the end\n\t\t//If we ever use the uber shader for drawing ghosted objects, which are not subject to theming\n\t\t//we will also need to check the ghosting flag here (materialUniforms.renderFlags & 1)\n\t\t//Currently our ghosting effect is edges only.\n\t\tif (objectUniforms.themeColor != 0) {\n\t\t\tvar themingColor = intToVecf(objectUniforms.themeColor);\n\t\t\toutput.color = mix(output.color, themingColor, themingColor.a);\n\t\t}\n\n\t\t// (See the comment on theming above). If this shader is ever used for ghosted objects,\n\t\t// the heatmap chunk needs to check for that.\n\t\t$heatmap\n\n\t\t// cap mesh hatch pattern\n\t\tif ((materialUniforms.renderFlags & 8) != 0) {\n\t\t\toutput.color = calculateHatchPattern(materialUniforms.hatchParams, in.Position.xy, output.color,\n\t\t\t\thatchTintColor, materialUniforms.hatchTintIntensity);\n\t\t}\n\n\t\treturn output;\n\t}\n",{IBL:Q(0),cameraUniforms:te(1),objectUniforms:G(2),materialUniforms:I(3),pack_normals:"//See http://aras-p.info/texts/CompactNormalStorage.html\n//Currently using the slow and simple approach of mapping 3d normal to two spherical coords.\n//TODO try other, cheaper ways to encode the normal.\n\nconst kPI = 3.14159265358979;\n\nfn encodeNormal (n: vec3f) -> vec2f {\n\treturn (vec2f(atan2(n.y,n.x)/kPI, n.z)+1.0)*0.5;\n}\n\nfn decodeNormal (enc: vec2f) -> vec3f {\n\tvar ang = enc * 2.0 - 1.0;\n\tvar scth = vec2f(sin(ang.x * kPI), cos(ang.x * kPI));\n\t//sincos(ang.x * kPI, scth.x, scth.y);\n\tvar scphi = vec2f(sqrt(1.0 - ang.y * ang.y), ang.y);\n\treturn vec3f(scth.y * scphi.x, scth.x * scphi.x, scphi.y);\n}\n\nfn decodeNormalInt (enc: u32) -> vec3f {\n\tvar xy = vec2f(f32(enc & 0xffff), f32((enc >> 16) & 0xffff)) / 65535.0;\n\treturn decodeNormal(xy);\n}",pack_depth:Y,mat_inverse:"\nfn inverse2(m: mat2x2f) -> mat2x2f {\n\treturn mat2x2f(\n\t\tm[1][1],-m[0][1],\n\t\t-m[1][0], m[0][0]\n\t) * (1.0 / (m[0][0]*m[1][1] - m[0][1]*m[1][0]));\n}\n\nfn inverse3(m: mat3x3f) -> mat3x3f {\n\tvar a00 = m[0][0]; var a01 = m[0][1]; var a02 = m[0][2];\n\tvar a10 = m[1][0]; var a11 = m[1][1]; var a12 = m[1][2];\n\tvar a20 = m[2][0]; var a21 = m[2][1]; var a22 = m[2][2];\n\n\tvar b01 = a22 * a11 - a12 * a21;\n\tvar b11 = -a22 * a10 + a12 * a20;\n\tvar b21 = a21 * a10 - a11 * a20;\n\n\tvar det = a00 * b01 + a01 * b11 + a02 * b21;\n\n\treturn mat3x3f(\n\t\tb01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n\t\tb11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n\t\tb21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)\n\t) * (1.0 / det);\n}\n\nfn inverse4(m: mat4x4f) -> mat4x4f {\n\tvar a00 = m[0][0]; var a01 = m[0][1]; var a02 = m[0][2]; var a03 = m[0][3];\n\tvar a10 = m[1][0]; var a11 = m[1][1]; var a12 = m[1][2]; var a13 = m[1][3];\n\tvar a20 = m[2][0]; var a21 = m[2][1]; var a22 = m[2][2]; var a23 = m[2][3];\n\tvar a30 = m[3][0]; var a31 = m[3][1]; var a32 = m[3][2]; var a33 = m[3][3];\n\n\tvar b00 = a00 * a11 - a01 * a10;\n\tvar b01 = a00 * a12 - a02 * a10;\n\tvar b02 = a00 * a13 - a03 * a10;\n\tvar b03 = a01 * a12 - a02 * a11;\n\tvar b04 = a01 * a13 - a03 * a11;\n\tvar b05 = a02 * a13 - a03 * a12;\n\tvar b06 = a20 * a31 - a21 * a30;\n\tvar b07 = a20 * a32 - a22 * a30;\n\tvar b08 = a20 * a33 - a23 * a30;\n\tvar b09 = a21 * a32 - a22 * a31;\n\tvar b10 = a21 * a33 - a23 * a31;\n\tvar b11 = a22 * a33 - a23 * a32;\n\n\tvar det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n\treturn mat4x4f(\n\t\ta11 * b11 - a12 * b10 + a13 * b09,\n\t\ta02 * b10 - a01 * b11 - a03 * b09,\n\t\ta31 * b05 - a32 * b04 + a33 * b03,\n\t\ta22 * b04 - a21 * b05 - a23 * b03,\n\t\ta12 * b08 - a10 * b11 - a13 * b07,\n\t\ta00 * b11 - a02 * b08 + a03 * b07,\n\t\ta32 * b02 - a30 * b05 - a33 * b01,\n\t\ta20 * b05 - a22 * b02 + a23 * b01,\n\t\ta10 * b10 - a11 * b08 + a13 * b06,\n\t\ta01 * b08 - a00 * b10 - a03 * b06,\n\t\ta30 * b04 - a31 * b02 + a33 * b00,\n\t\ta21 * b02 - a20 * b04 - a23 * b00,\n\t\ta11 * b07 - a10 * b09 - a12 * b06,\n\t\ta00 * b09 - a01 * b07 + a02 * b06,\n\t\ta31 * b01 - a30 * b03 - a32 * b00,\n\t\ta20 * b03 - a21 * b01 + a22 * b00\n\t) * (1.0 / det);\n}\n\nfn getMat3(m: mat4x4f) -> mat3x3f {\n\treturn mat3x3f(\n\t\tm[0].xyz,\n\t\tm[1].xyz,\n\t\tm[2].xyz\n\t);\n}\n\nfn getNormalMatrix(m: mat4x4f) -> mat3x3f\n{\n\tvar nm = getMat3(m);\n\treturn transpose(inverse3(nm));\n}\n",tonemap:g,envMapSample:J(!0,!1,!0),hatch:v,heatmapDecl:"fn lmap(value: f32, inMin: f32, inMax: f32, outMin: f32, outMax: f32) -> f32 {\n return clamp(outMin + ((outMax - outMin) * (value - inMin)) / (inMax - inMin), outMin, outMax);\n}\n\n// Gradient with multiple colors in non-equal intervals\nfn colormap(x: f32) -> vec3f {\n var colorsAndStops = ibl.colorsAndStops;\n for (var i = 1; i < NUM_STOPS; i++) {\n if (x <= colorsAndStops[i].stop) {\n var stopPct = lmap(x, colorsAndStops[i - 1].stop, colorsAndStops[i].stop, 0.0, 1.0);\n return mix(colorsAndStops[i - 1].color, colorsAndStops[i].color, stopPct);\n }\n }\n\n // In case 'x' goes beyond upper bound.\n return colorsAndStops[NUM_STOPS - 1].color;\n}\n",heatmap:"var sensorCount = materialUniforms.heatmapSensorCountAndOffset & 0x000000ff;\nif (sensorCount > 0) {\n\n var sensorOffset = materialUniforms.heatmapSensorCountAndOffset >> 8;\n var heatResult: f32 = 0.0;\n var heatSum: f32 = 0.0;\n var heatWsum: f32 = 0.000001;\n var heatFound: bool = false; // at exact location of the sensor\n var heatmapAlpha = ibl.heatmapAlpha;\n\n for (var i = sensorOffset; i < sensorOffset + sensorCount; i++) {\n var mydist = distance(in.vWorldPosition, heatmapSensors[i].xyz);\n if (mydist < 0.00001) {\n // So the exact pixel of the sensor will get the right color, but pretty much nothing beside it.\n heatResult = heatmapSensors[i][3];\n heatFound = true;\n } else {\n var w = (1.0 / (mydist * mydist));\n heatSum += (heatmapSensors[i][3] * w);\n heatWsum += w;\n }\n }\n\n if (!heatFound) {\n heatResult = heatSum / heatWsum;\n }\n\n // Defaults without influence from any sensor\n var sensorColor = vec3f(0.5);\n if (heatResult >= 0.0) {\n heatResult = clamp(heatResult, 0.0, 1.0);\n sensorColor = colormap(heatResult);\n }\n\n // If this chunk is used in shaders that render ghosted objects, we need to check for that and don't apply the\n // heatmap color, i.e. use 'ghosted ? 0.0 : heatmapAlpha' below.\n output.color = vec4f(mix(vec3f(luminance_post(output.color.rgb)), sensorColor, heatmapAlpha), output.color.a);\n if (heatmapAlpha > 0.0) {\n output.color[3] = max(output.color.a, heatmapAlpha);\n }\n}\n",metalMaterial:e.metal,hasUV:t,hasTextures:i,hasVertexColors:n,isUVW:r,hasUVAndHasVertexColors:t&&n,hasUVAndNotHasVertexColors:t&&!n,notHasUVAndHasVertexColors:!t&&n})}var oe=i(77201);function se(e,t,i,n,r,o){let s=e.__gpuPipelineHash;s||(s=function(e,t,i,n){let r=e.__gpuPipelineHash;if(r)return r;e.vb||oe.BufferGeometryUtils.interleaveGeometry(e,!0),r=255&e.vbstride;const o=e.attributesInterleaved||e.attributes;for(let e in o){let t=o[e];switch(e){case"position":0!==t.itemOffset&&console.log("unexpected itemOffset"),r|=256;break;case"normal":3!==t.itemOffset&&console.log("unexpected itemOffset"),2===t.bytesPerItem?r|=512:r|=1024;break;case"uv":case"uvw":i&&(3===t.itemOffset?r|=2048:4===t.itemOffset?r|=4096:6===t.itemOffset?r|=6144:console.log("unexpected itemOffset for color channel",t.itemOffset));break;case"color":n&&(3===t.itemOffset?r|=8192:4===t.itemOffset?r|=16384:6===t.itemOffset?r|=24576:8===t.itemOffset?r|=32768:console.log("unexpected itemOffset"))}}let s=0;return e.isLines&&(s=1),r|=s<<16,e.__gpuPipelineHash=r,r}(e,e.isLines,n,r));let a=t.__gpuPipelineHash;return!t.needsUpdate&&a||(a=function(e,t){let i=16777216;if(e.depthWrite&&(i|=1),e.depthTest&&(i|=2),e.depthFunc)switch(e.depthFunc){case"less":i|=4;break;case"less-equal":i|=8;break;case"greater":i|=12;break;case"greater-equal":i|=16;break;case"never":i|=20;break;case"always":i|=24;break;default:console.warn("unsupported depthFunc",e.depthFunc)}else i|=8;return i|=(e.side||0)<<5,i|=t?128:0,i|=e.isRoomMaterial&&e.heatmapSensorCount?256:0,e.__gpuPipelineHash=i,i}(t,o)),s|a<<17}function ae(e,t,i,n){let r=[],o=n&&e.attributes.color;if(e.vb){let s={arrayStride:4*e.vbstride,attributes:[]},a=e.attributesInterleaved||e.attributes;for(let r in a){let l=a[r];switch(r){case"position":s.attributes.push({shaderLocation:0,offset:4*l.itemOffset,format:"float32x3"});break;case"normal":!e.isLines&&t&&s.attributes.push({shaderLocation:1,offset:4*l.itemOffset,format:"uint32"});break;case"uv":i&&s.attributes.push({shaderLocation:o?3:2,offset:4*l.itemOffset,format:"float32x2"});break;case"uvw":i&&s.attributes.push({shaderLocation:o?3:2,offset:4*l.itemOffset,format:"float32x3"});break;case"color":n&&s.attributes.push({shaderLocation:2,offset:4*l.itemOffset,format:"float32x3"})}}r.push(s)}else console.log("non-interleaved buffer geometry not yet done");return r}function le(e){let t=[],i={arrayStride:4*e.vbstride,attributes:[]};return i.attributes.push({shaderLocation:0,offset:0,format:"float32x2"}),i.attributes.push({shaderLocation:1,offset:8,format:"float32x4"}),i.attributes.push({shaderLocation:2,offset:24,format:"unorm8x4"}),i.attributes.push({shaderLocation:3,offset:28,format:"uint8x4"}),i.attributes.push({shaderLocation:4,offset:32,format:"uint8x4"}),i.attributes.push({shaderLocation:5,offset:36,format:"uint8x4"}),i.attributes.push({shaderLocation:6,offset:i.arrayStride-8,format:"float32x2"}),t.push(i),t}function ce(e,t,i,n,r,o){let s=e.__gpuPipelineHash;s||(s=function(e){return e.__gpuPipelineHash=e.vbstride,e.__gpuPipelineHash}(e));let a=t.__gpuPipelineHash;return!t.needsUpdate&&a||(t.__gpuPipelineHash=a=16777216),s|a<<24}var he=i(82116);class ue{#rt;#et;#Mt=new Map;#qi;#Xi;#Yi;#Ki;#Qi;#Zi;constructor(e){this.#rt=e,this.#et=e.getDevice(),this.#Qi=this.#rt.getVB(),this.#Zi=se}#Ct(e,t,i,n){const r=t.attributes,o=r.color&&i.vertexColors,s=!!r.uvw,a=r.uv||s,l=a&&0!==n;let c;if(t.isLines){let e=this.#et.createShaderModule({code:(0,d.$wgsl)("$IBL\n$cameraUniforms\n$objectUniforms\n\nstruct VertexOutput {\n @builtin(position) Position : vec4f,\n @location(0) @interpolate(flat) instance: u32,\n @location(4) vWorldPosition: vec3f\n}\n\n@vertex\nfn vsmain(\n @location(0) position : vec3f,\n @builtin(instance_index) instance : u32\n) -> VertexOutput {\n\n var objectUniforms = getObjectUniforms(instance);\n\n var output : VertexOutput;\n var pos4 = vec4f(position.x, position.y, position.z, 1.0);\n\n var mvMatrix = uniforms.viewMatrix * objectUniforms.modelMatrix;\n var mvPosition = mvMatrix * pos4;\n\n output.Position = uniforms.projectionMatrix * mvPosition;\n output.vWorldPosition = (objectUniforms.modelMatrix * pos4).xyz;\n\n output.instance = instance;\n\n //TODO: world position for cutplanes\n\n return output;\n}\n\nstruct PixelOutput {\n @location(0) color: vec4f,\n @location(1) normal: vec4f,\n @location(2) viewDepth: vec4f,\n @location(3) dbId: vec4u,\n @location(4) modelId: vec4u\n //@location(4) objectFlags: vec4u,\n}\n\n@fragment\nfn psmain(\n in: VertexOutput,\n) -> PixelOutput {\n\n var output: PixelOutput;\n\n var objectUniforms = getObjectUniforms(in.instance);\n var materialUniforms = getMaterialUniforms(objectUniforms.materialIndex);\n\n //TODO: vertex color\n var diffuse = intToVecf(materialUniforms.diffuse);\n\n //check doNotCut flag\n if (commonMaterialUniforms.doNotCutOverride + (materialUniforms.renderFlags & 2) == 0) {\n checkCutPlanes(in.vWorldPosition);\n }\n\n //For line geometry, we just return the color as is\n output.color = diffuse;\n output.normal = vec4f(0.0);\n output.viewDepth = vec4f(0.0);\n output.dbId = intToVec(objectUniforms.dbId);\n output.modelId = intToVec(objectUniforms.modelId);\n\n return output;\n}\n",{IBL:Q(0),cameraUniforms:te(1),objectUniforms:G(2)})});c=this.#et.createRenderPipeline({label:"uber shader lines",layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#Yi}),vertex:{module:e,entryPoint:"vsmain",buffers:ae(t,!1,!1,!1)},fragment:{module:e,entryPoint:"psmain",targets:this.#Ki},primitive:{topology:"line-list",cullMode:"none"},depthStencil:{depthWriteEnabled:i.depthWrite,depthCompare:i.depthTest?i.depthFunc||"less-equal":"always",format:x}})}else{const n=this.#et.createShaderModule({label:"uber shader triangles ("+e+")",code:re(i,a,l,o,s)});c=this.#et.createRenderPipeline({label:"uber pipeline triangles ("+e+")",layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#Yi}),vertex:{module:n,entryPoint:"vsmain",buffers:ae(t,!0,a,o)},fragment:{module:n,entryPoint:"psmain",targets:this.#Ki},primitive:{topology:"triangle-list",cullMode:(0,he.oh)(i.side)},depthStencil:{depthWriteEnabled:i.depthWrite,depthCompare:i.depthTest?i.depthFunc||"less-equal":"always",format:x,depthBias:i.isRoomMaterial&&i.heatmapSensorCount?1:2,depthBiasSlopeScale:i.isRoomMaterial&&i.heatmapSensorCount?.5:1}})}return this.#Mt.set(e,c),c}reset(e,t){this.#qi=null,this.#Xi=null,this.#Yi=e,this.#Ki=t}#$i(e,t){let i=0|t.__gpuUniformsMask;return i!==R.NO_UNIFORMS||t.needsUpdate?((0===i||t.needsUpdate)&&(i=function(e,t,i){let n=F(t);if(0!==n){t.__gpuMaterialUniforms&&U({target:t});const n=new N(e,t,i);t.__gpuMaterialUniforms=n,t.addEventListener("dispose",U)}return B&&t.addEventListener("update",B),t.__gpuUniformsMask=n|=R.NO_UNIFORMS,n}(this.#et,t,this.#rt.getPlaceholderTexture()),this.#Xi=null),i===R.NO_UNIFORMS?0:(this.#Xi!==t&&(e.setBindGroup(3,t.__gpuMaterialUniforms.getBindGroup()),this.#Xi=t),i)):0}drawOne(e,t,i,n){if(i instanceof THREE.Geometry)return 0;const r=this.#$i(e,n)&R.TEXTURE_MASK,o=i.attributes,s=o.color&&n.vertexColors,a=o.uv,l=a&&0!==r,c=this.#Zi(i,n,!0,a,s,l);let h=this.#Mt.get(c);return h||(h=this.#Ct(c,i,n,r)),h!==this.#qi&&(e.setPipeline(h),this.#qi=h),this.#Qi.draw(e,i,t),r}}const de='\nfn orderedDithering(coord: vec2i) -> f32 {\n\n\t//Matrix for 4x4 ordered dithering. (http://en.wikipedia.org/wiki/Ordered_dithering)\n\tconst thresholdMatrix = mat4x4f(\n\t\t 1.0, 9.0, 3.0, 11.0,\n\t\t13.0, 5.0, 15.0, 7.0,\n\t\t 4.0, 12.0, 2.0, 10.0,\n\t\t16.0, 8.0, 14.0, 6.0) * (1.0 / 17.0);\n\n\tvar i = coord.x & 3;\n\tvar j = coord.y & 3;\n\n\treturn thresholdMatrix[i][j];\n\n}\n\n\n//Screen door transparency for "ghosted" elements, indicated by opacity < 0\nfn checkGhosting(coord: vec2i, isGhosted: bool) {\n\tif (isGhosted) {\n\t\tif (orderedDithering(coord) < 0.5) {\n\t\t\tdiscard;\n\t\t}\n\t}\n}\n';function fe(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,d.$wgsl)("$ghosting\n$IBL\n$cameraUniforms\n$objectUniforms\n$materialUniforms\n\n\nstruct VertexOutput {\n @builtin(position) Position : vec4f,\n @location(0) @interpolate(flat) instance: u32,\n @location(4) vWorldPosition: vec3f\n}\n\n@vertex\nfn vsmain(\n @location(0) position : vec3f,\n @builtin(instance_index) instance : u32\n) -> VertexOutput {\n\n var objectUniforms = getObjectUniforms(instance);\n\n var output : VertexOutput;\n var pos4 = vec4f(position.x, position.y, position.z, 1.0);\n\n var mvMatrix = uniforms.viewMatrix * objectUniforms.modelMatrix;\n var mvPosition = mvMatrix * pos4;\n\n output.Position = uniforms.projectionMatrix * mvPosition;\n output.vWorldPosition = (objectUniforms.modelMatrix * pos4).xyz;\n\n //TODO: world position for cutplanes\n\n output.instance = instance;\n\n return output;\n}\n\n@fragment\nfn psmain(\n in: VertexOutput\n) -> @location(0) vec4f {\n\n var objectUniforms = getObjectUniforms(in.instance);\n var materialUniforms = getMaterialUniforms(objectUniforms.materialIndex);\n\n //check doNotCut flag\n if (commonMaterialUniforms.doNotCutOverride + (materialUniforms.renderFlags & 2) == 0) {\n checkCutPlanes(in.vWorldPosition);\n }\n\n var color = intToVecf(commonMaterialUniforms.edgeColor);\n\n #if $ghosted\n checkGhosting(vec2i(floor(in.Position.xy)), true);\n #endif\n\n return vec4(color.r, color.g, color.b, color.a);\n}\n",{ghosting:de,ghosted:e,IBL:Q(0),cameraUniforms:te(1),objectUniforms:G(2),materialUniforms:I(3)})}class pe{#rt;#et;#Mt=new Map;#qi;#Yi;#Ki;#Qi;#Zi=se;constructor(e){this.#rt=e,this.#et=e.getDevice()}#Ct(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=this.#et.createShaderModule({code:fe(n)}),o=this.#et.createRenderPipeline({layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#Yi}),vertex:{module:r,entryPoint:"vsmain",buffers:ae(t,!1,!1,!1)},fragment:{module:r,entryPoint:"psmain",targets:this.#Ki},primitive:{topology:"line-list",cullMode:"none"},depthStencil:{depthWriteEnabled:i.depthWrite,depthCompare:i.depthTest?i.depthFunc||"less-equal":"always",format:x,depthBias:0,depthBiasSlopeScale:0}});return this.#Mt.set(e,o),o}reset(e,t){this.#qi=null,this.#Yi=e,this.#Ki=t,this.#Qi=this.#rt.getVB()}drawOne(e,t,i,n){if(i instanceof THREE.Geometry)return 0;if(i.isLines)return;let r=this.#Zi(i,n,!1,!1,!1),o=this.#Mt.get(r);o||(o=this.#Ct(r,i,n)),o!==this.#qi&&(e.setPipeline(o),this.#qi=o),this.#Qi.drawEdges(e,i,t)}drawOneGhosted(e,t,i,n){let r=this.#Zi(i,n,!1,!1,!1,!0),o=this.#Mt.get(r);o||(o=this.#Ct(r,i,n,!0)),o!==this.#qi&&(e.setPipeline(o),this.#qi=o),i.isLines?this.#Qi.draw(e,i,t):this.#Qi.drawEdges(e,i,t)}}const me="//Uniforms\nstruct Line2DUniforms {\n pixelsPerUnit: f32,\n aaRange: f32,\n size: vec2f,\n\n viewportId: f32,\n swap: f32,\n tanHalfFov: f32,\n opacity: f32,\n\n lineStyleWidth: u32,\n miterLimit: f32,\n miterScaleFactor: f32,\n miterCp: f32,\n}\n@group($group) @binding(0) var<uniform> u: Line2DUniforms;\n@group($group) @binding(1) var<storage> lineStyles : array<u32>;\n";var ge=i(30514);class ve extends f.D{#et;#Dt;#Lt;#Ji;#en;constructor(e){super(e,16,!0,!0),this.setFloat(5,0),this.setFloat(7,1),this.#et=e,this.#Dt=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT|GPUShaderStage.VERTEX,buffer:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]}),this.#en=this.#et.createBuffer({size:64,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.setInt(8,0),this.setMiterData(ge.VBB_MITER_SEGMENT_LIMIT,ge.VBB_MITER_SEGMENT_SCALE_FACTOR,ge.VBB_MITER_SEGMENT_CP),this.#Vi()}#Vi(){this.#Lt=this.#et.createBindGroup({layout:this.#Dt,entries:[{binding:0,resource:{buffer:this.getBuffer()}},{binding:1,resource:{buffer:this.#en}}]})}updatePixelScale(e,t){if(this.#Ji=e,this.setFloat(1,.5),null!=t&&t.isPerspective){const e=t.fov*Math.PI/180;this.setFloat(6,Math.tan(.5*e))}else this.setFloat(6,0);this.setFloat(0,e)}setLineStyleBuffer(e,t){this.#en&&this.#en.size!==e.byteLength&&(this.#en.destroy(),this.#en=null),this.#en||(this.#en=this.#et.createBuffer({size:e.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),this.#et.queue.writeBuffer(this.#en,0,e.buffer,0,e.byteLength),this.setInt(8,t)}setTargetSize(e,t){this.setFloat(2,e),this.setFloat(3,t)}setMiterData(e,t,i){this.setFloat(9,e),this.setFloat(10,t),this.setFloat(11,i)}getLayout(){return this.#Dt}getBindGroup(){return this.#Lt}}function ye(e){return(0,d.$wgsl)("$IBL\n$cameraUniforms\n$objectUniforms\n$lineUniforms\n$hatch\n\nconst hatchTintColor = vec3f(1, 1, 1);\n\n// Common defines\nconst TAU = 6.28318530718;\nconst PI = 3.14159265358979;\nconst HALF_PI = 1.57079632679;\nconst PI_1_5 = 4.71238898038; // 1.5 * PI\n\n// discard fragments if they belong to ghosted layers\n@id(0) override ENABLE_ID_DISCARD: u32 = 1;\n\n// Geometry type defines\nconst VBB_GT_TRIANGLE_INDEXED = 0;\nconst VBB_GT_LINE_SEGMENT = 1;\nconst VBB_GT_ARC_CIRCULAR = 2;\nconst VBB_GT_ARC_ELLIPTICAL = 3;\nconst VBB_GT_TEX_QUAD = 4;\nconst VBB_GT_ONE_TRIANGLE = 5;\nconst VBB_GT_MSDF_TRIANGLE_INDEXED = 6;\nconst VBB_GT_TEX_TRIANGLE_INDEXED = 7;\nconst VBB_GT_LINE_SEGMENT_CAPPED = 8;\nconst VBB_GT_LINE_SEGMENT_CAPPED_START = 9;\nconst VBB_GT_LINE_SEGMENT_CAPPED_END = 10;\nconst VBB_GT_LINE_SEGMENT_MITER = 11;\n\n// ID defines\nconst VBB_INSTANCED_FLAG = 0;\nconst VBB_SEG_START_RIGHT = 0;\nconst VBB_SEG_START_LEFT = 1;\nconst VBB_SEG_END_RIGHT = 2;\nconst VBB_SEG_END_LEFT = 3;\n\n// Defines scaling of line style patterns (e.g. for dashed and dotted lines)\n// We define some fixed scaling here.\n//\n// Why 0.25?: The choice is currently sort-of arbitrary - just manually adjusted\n// to look reasonable when drawing into 2D overlays. If this is not sufficient, we could make it\n// adjustable per shader parameter.\n//\n// AutoCAD will scale patterns based on the LTSCALE setting, and currently this is ignored here.\nconst LTSCALE = 0.25;\n\n//Attributes\nstruct VsInput {\n\t@builtin(instance_index) instance : u32,\n\t@location(0) fields1: vec2f,\n\t@location(1) fields2: vec4f,\n\t@location(2) color4b: vec4f,\n\t@location(3) dbId4b: vec4u,\n\t@location(4) flags4b: vec4u,\n\t@location(5) layerVp4b: vec4u,\n\t@location(6) extraParams: vec2f,\n}\n\n// Varyings\nstruct VsOutput {\n\t@builtin(position) position : vec4f,\n\t//TODO: most of these should be tagged @interpolate(flat)\n\t@location(0) @interpolate(flat) fsColor: vec4f,\n\t@location(1) fsOffsetDirection: vec2f,\n\t@location(2) fsMultipurpose: vec4f,\n\t//fsGeomType: f32,\n\t@location(3) @interpolate(flat) fsHalfWidth: f32,\n\t@location(4) fsVpTC: vec2f,\n\t@location(5) @interpolate(flat) fsGhosting: f32,\n\t@location(6) @interpolate(flat) dbId: vec4u,\n\t@location(7) vWorldPosition: vec3f, //for cutplanes\n\t@location(8) @interpolate(flat) instance: u32,\n#if $materialHasLineStyles\n\t@location(9) vPixelsPerUnit: f32\n#endif\n}\n\n// used internally by the VS\nvar<private> centralVertex: vec2f;\nvar<private> offsetPosition: vec2f;\nvar<private> offsetPosDepth: vec2f;\nvar<private> mvpMatrix: mat4x4f;\n\nfn cos_sin(angle: f32) -> vec2f {\n\treturn vec2f(cos(angle), sin(angle));\n}\n\nfn getVertexId(in: VsInput) -> u32 { return in.flags4b.x; }\n\nfn isStartVertex(in: VsInput) -> bool { return (getVertexId(in) < VBB_SEG_END_RIGHT); }\nfn isLeftVertex(in: VsInput) -> bool { var id = getVertexId(in); return ((id == VBB_SEG_END_LEFT || id == VBB_SEG_START_LEFT)); }\n\nfn min_max(minPt: ptr<function, vec2f>, maxPt: ptr<function, vec2f>, p: vec2f) {\n\t*minPt = min(*minPt, p);\n\t*maxPt = max(*maxPt, p);\n}\n\nfn setMvp(instance: u32) {\n\tvar objectUniforms = getObjectUniforms(instance);\n\tmvpMatrix = uniforms.projectionMatrix * uniforms.viewMatrix * objectUniforms.modelMatrix;\n}\n\n// Get the 2d screenspace position of a model-space position.\nfn posToSs(pos: vec4f) -> vec2f {\n\treturn clipPosToSs(mvpMatrix * pos);\n}\n\n// Get the 2d screenspace position of a clip-space position.\n// Visible positions will be within [0, width] x [0, height].\nfn clipPosToSs(clip: vec4f) -> vec2f {\n\treturn (clip.xy / clip.w + vec2f(1)) * 0.5 * u.size;\n}\n\n// Get the 2d screenspace transformation of a model-space vector.\nfn vecToSs(inVec: vec4f) -> vec2f {\n\tvar clip = mvpMatrix * inVec;\n\t// Don't divide by w, and don't translate vectors.\n\treturn clip.xy * 0.5 * u.size;\n}\n\n// Convert screenspace position back to clip space position.\nfn ssToClip(ssPos: vec2f, clipZw: vec2f) -> vec4f {\n\treturn vec4((ssPos / u.size * 2.0 - vec2f(1)) * clipZw[1], clipZw);\n}\n\nstruct SegmentData {\n\tangle: f32,\n\tdistAlong: f32,\n\tdistTotal: f32,\n\tlineWidthHalf: f32,\n\tlineType: u32\n};\n\nfn decodeSegmentData(in: VsInput) -> SegmentData {\n\tvar seg: SegmentData;\n\tseg.angle = in.fields2.x * TAU - PI;\n\tseg.distAlong = in.fields2.y;\n\tseg.distTotal = in.fields2.w;\n\tseg.lineWidthHalf = in.fields2.z;\n\tseg.lineType = in.flags4b.z;\n\n\treturn seg;\n}\n\nfn strokeLineSegment(in: VsInput, geomType: u32, out: ptr<function, VsOutput>) {\n\tvar seg = decodeSegmentData(in);\n\n\t//Compute output point based on start point plus segment length and direction\n\t//This is because the line segment's 4 vertices are all equal to the start\n\t//point to begin with. We move the vertex to the correct place in the quad\n\t//based on vertex flags indicating whether it's left/right/top/bottom vertex in the\n\t//quad.\n\tvar isStartCapVertex = select(1.0, -1.0, isStartVertex(in));\n\tvar isLeftSide = select(-1.0, 1.0, isLeftVertex(in));\n\n\tsetMvp(in.instance);\n\n\t// Clip-space start position\n\tvar clipStart = (mvpMatrix * vec4f(centralVertex.xy, 0.0, 1.0));\n\n\tvar distanceAlong = seg.distAlong;\n\tvar along = distanceAlong * cos_sin(seg.angle);\n\n\tvar clipEnd = (mvpMatrix * vec4f(centralVertex.xy + along, 0.0, 1.0));\n\n\tvar screenStart = clipPosToSs(clipStart);\n\tvar screenEnd = clipPosToSs(clipEnd);\n\tvar roundedEnd = 0.0;\n\n\tif (isStartCapVertex < 0.0) {\n\t\toffsetPosition = screenStart;\n\t\tcentralVertex = screenStart;\n\t\toffsetPosDepth = clipStart.zw;\n\t\t// use 0.5 instead of 1.0 so that floor(roundedEnd)==roundedEnd\n\t\troundedEnd = select(0.0, 0.5, geomType == VBB_GT_LINE_SEGMENT || geomType == VBB_GT_LINE_SEGMENT_CAPPED_END);\n\t} else {\n\t\toffsetPosition = screenEnd;\n\t\tcentralVertex = screenEnd;\n\t\toffsetPosDepth = clipEnd.zw;\n\t\t// use 0.5 instead of 1.0 so that floor(roundedEnd)==roundedEnd\n\t\troundedEnd = select(0.0, 0.5, geomType == VBB_GT_LINE_SEGMENT || geomType == VBB_GT_LINE_SEGMENT_CAPPED_START);\n\t}\n\n#if $materialHasLineStyles\n\t// For consistency, disable butt capped ends for any pattern other\n\t// than a solid line (seg.lineType will be >0 and thus roundedEnd\n\t// will be >0, i.e., true)\n\t// See note in fragment shader\n\n\t// transport roundedEnd as fractional part of the integer lineType\n\troundedEnd += seg.lineType;\n#endif\n\n\t// Apply transverse line width offset to the start/endpoint\n\tvar screenDelta = screenEnd - screenStart;\n\tvar screenAngle = 0.0;\n\tif (distanceAlong != 0.0) {\n\t\tscreenAngle = atan2(screenDelta.y, screenDelta.x);\n\t}\n\tvar angleTransverse = screenAngle - isLeftSide * HALF_PI;\n\tvar lwAdjustment = (*out).fsHalfWidth + u.aaRange;\n\tvar transverseDir = cos_sin(angleTransverse);\n\toffsetPosition += transverseDir * lwAdjustment;\n\n\t// Apply start/end-cap extension offsets if needed\n\t// for rounded ends, the extension is lwAdjustment,\n\t// for butt capped ends it's aaRange\n\tvar segmentExtension = select(u.aaRange, lwAdjustment, roundedEnd > 0.0);\n\tvar moveOffset = isStartCapVertex * isLeftSide * vec2f(-transverseDir.y, transverseDir.x) * segmentExtension;\n\toffsetPosition += moveOffset;\n\tcentralVertex += moveOffset;\n\n\t// Distance we care about beyond the actual line segment vertex.\n\t// For start vertex, this is negative and equal to half a line weight\n\t// For end vertex this is the segment length plus the half line weight adjustment.\n\tvar distanceFromStart = max(0.0, isStartCapVertex) * length(screenDelta);\n\n\t(*out).fsMultipurpose = vec4f(\n\t\t// distance after end point that we want to fill with cap/join\n\t\t(isStartCapVertex * segmentExtension) + distanceFromStart,\n\t\tlength(screenDelta),\n\t\tseg.distTotal,\n\t\troundedEnd\n\t);\n\n\tif (seg.lineWidthHalf < 0.0) {\n\t\t(*out).fsHalfWidth = -(*out).fsHalfWidth;\n\t}\n\n\t// Vector from logical line centerline to the pixel position of the thick\n\t// line being shaded. We use this distance for antialiasing and line caps clipping\n\t(*out).fsOffsetDirection = offsetPosition - centralVertex;\n\n\t// Back to clip space coords\n\t(*out).position = ssToClip(offsetPosition, offsetPosDepth);\n}\n\nstruct MiterSegmentData {\n\tangle: f32,\n\tdistAlong: f32,\n\tdistAlongPN: f32,\n\tanglePrev: f32,\n\tangleNext: f32,\n\tlineWidthHalf: f32,\n\tlineType: u32,\n};\n\nfn decodeMiterSegment(in: VsInput) -> MiterSegmentData {\n\tvar seg: MiterSegmentData;\n\tseg.angle = in.fields2.x * TAU - PI;\n\tseg.distAlong = in.fields2.y;\n\tseg.anglePrev = in.fields2.w * TAU - PI;\n\tseg.lineWidthHalf = in.fields2.z;\n\tseg.lineType = in.flags4b.z;\n\tseg.angleNext = in.extraParams.x * TAU - PI;\n\tseg.distAlongPN = in.extraParams.y;\n\treturn seg;\n}\n\nfn strokeMiterLineSegment(in: VsInput, out: ptr<function, VsOutput>) {\n\tvar seg = decodeMiterSegment(in);\n\n\t// Compute output point based on a starting point plus three directions to get the\n\t// previous, current, and next line segment. Using this information, each line\n\t// segment can calculate the correct miter joints on the start and end vertices.\n\t// The vertex flags indicate whether it's left/right/top/bottom vertex in the joint.\n\n\tvar isStartCapVertex = select(1.0, -1.0, isStartVertex(in));\n\tvar isLeftSide = select(-1.0, 1.0, isLeftVertex(in));\n\n\tsetMvp(in.instance);\n\n\t// Unpack previous and next line segment lengths. Precision was lost during compression.\n\t// These lengths are used along with the angles to determine if the line segments are\n\t// self intersecting and if so to draw a regular line segment with no miter joints.\n\tvar next = floor(seg.distAlongPN / u.miterCp);\n\tvar prev = seg.distAlongPN - (next * u.miterCp);\n\tvar distanceAlongNext = floor(next) / u.miterScaleFactor;\n\tvar distanceAlongPrev = floor(prev) / u.miterScaleFactor;\n\n\t// Screen space start position\n\tvar distanceAlong = seg.distAlong;\n\tvar along = cos_sin(seg.anglePrev) * distanceAlongPrev;\n\tvar along2 = cos_sin(seg.angle) * distanceAlong;\n\tvar along3 = along2 + cos_sin(seg.angleNext) * distanceAlongNext;\n\n\tvar screenPrev = posToSs(vec4(centralVertex.xy - along, 0.0, 1.0));\n\tvar screenNext = posToSs(vec4(centralVertex.xy + along3, 0.0, 1.0));\n\n\tvar clipStart = mvpMatrix * vec4(centralVertex.xy, 0.0, 1.0);\n\tvar screenStart = clipPosToSs(clipStart);\n\tvar clipEnd = mvpMatrix * vec4(centralVertex.xy + along2, 0.0, 1.0);\n\tvar screenEnd = clipPosToSs(clipEnd);\n\n\tif (isStartCapVertex < 0.0) {\n\t\toffsetPosition = screenStart;\n\t\toffsetPosDepth = clipStart.zw;\n\t} else {\n\t\toffsetPosition = screenEnd;\n\t\toffsetPosDepth = clipEnd.zw;\n\t}\n\tcentralVertex = offsetPosition;\n\n\tvar screenDelta = screenEnd - screenStart;\n\n\tvar AB = normalize(screenStart.xy - screenPrev.xy);\n\tvar BC = normalize(screenDelta);\n\tvar CD = normalize(screenNext.xy - screenEnd.xy);\n\n\tvar a = screenPrev;\n\tvar b = screenStart;\n\tvar c = screenEnd;\n\tvar d = screenNext;\n\tvar p = select(d, a, isStartCapVertex < 0.0);\n\n\tvar a2 = select(c, a, isStartCapVertex < 0.0);\n\tvar b2 = select(d, b, isStartCapVertex < 0.0);\n\tvar p2 = select(b, c, isStartCapVertex < 0.0);\n\tvar PP = select(CD, AB, isStartCapVertex < 0.0);\n\n\tvar normalBC = vec2(-BC.y, BC.x);\n\tvar normalPP = vec2(-PP.y, PP.x);\n\n\t// Check if the line segment at the start/end is interecting with the previous/next\n\t// line segment's start/end.\n\tvar pIsLeftOfBC = select(-1.0, 1.0, ((c.x - b.x)*(p.y - b.y) - (c.y - b.y)*(p.x - b.x)) > 0.0);\n\tvar bN = b + normalBC * (*out).fsHalfWidth * pIsLeftOfBC;\n\tvar cN = c + normalBC * (*out).fsHalfWidth * pIsLeftOfBC;\n\tvar pN = p + normalPP * (*out).fsHalfWidth * pIsLeftOfBC;\n\tvar isPIntersecting = ((cN.x - bN.x)*(pN.y - bN.y) - (cN.y - bN.y)*(pN.x - bN.x)) * pIsLeftOfBC;\n\n\tvar p2IsLeftOfPP = select(-1.0, 1.0, ((b2.x - a2.x)*(p2.y - a2.y) - (b2.y - a2.y)*(p2.x - a2.x)) > 0.0);\n\tvar a2N = a2 + normalPP * (*out).fsHalfWidth * p2IsLeftOfPP;\n\tvar b2N = b2 + normalPP * (*out).fsHalfWidth * p2IsLeftOfPP;\n\tvar p2N = p2 + normalBC * (*out).fsHalfWidth * p2IsLeftOfPP;\n\tvar isP2Intersecting = ((b2N.x - a2N.x)*(p2N.y - a2N.y) - (b2N.y - a2N.y)*(p2N.x - a2N.x)) * p2IsLeftOfPP;\n\n\t// calculate the miter joint\n\tvar tangentLength = select(length(BC + CD), length(AB + BC), isStartCapVertex < 0.0);\n\tvar tangent = select(normalize(BC + CD), normalize(AB + BC), isStartCapVertex < 0.0);\n\tvar miter = vec2(-tangent.y, tangent.x);\n\tvar normal = select(vec2(-BC.y, BC.x), vec2(-AB.y, AB.x), isStartCapVertex < 0.0);\n\tvar miterLength = abs(1.0 / dot(miter, normal));\n\n\tvar moveOffset: vec2f;\n\tvar lwAdjustment = (*out).fsHalfWidth + u.aaRange;\n\tif (miterLength > u.miterLimit || min(isPIntersecting, isP2Intersecting) < 0.0) {\n\t\tmoveOffset = isLeftSide * lwAdjustment * normalBC;\n\t} else {\n\t\tmoveOffset = isLeftSide * miter * lwAdjustment * miterLength;\n\t}\n\n\toffsetPosition += moveOffset;\n\n\tvar distanceFromStart = max(0.0, isStartCapVertex) * (length(screenDelta) + dot(moveOffset, BC));\n\t(*out).fsMultipurpose.x = distanceFromStart;\n\t(*out).fsMultipurpose.y = length(screenDelta) + dot(moveOffset, BC);\n\t(*out).fsMultipurpose.z = 0.0;\n#if $materialHasLineStyles\n\t(*out).fsMultipurpose.w = seg.lineType + 0.5; // enforce round line ends\n#else\n\t(*out).fsMultipurpose.w = 0.5; // enforce round line ends\n#endif\n\n\tif (seg.lineWidthHalf < 0.0) {\n\t\t(*out).fsHalfWidth = -(*out).fsHalfWidth;\n\t}\n\n\t// Vector from logical line centerline to the pixel position of the thick\n\t// line being shaded. We use this distance for antialiasing and line caps clipping\n\t(*out).fsOffsetDirection = offsetPosition - BC * dot(moveOffset, BC) - centralVertex;\n\n\t// Back to clip space coords\n\t(*out).position = ssToClip(offsetPosition, offsetPosDepth);\n}\n\nstruct ArcData {\n\tc: vec2f,\n\tstart: f32,\n\tend: f32,\n\tmajor: f32,\n\tminor: f32,\n\ttilt: f32,\n\tlineWidthHalf: f32,\n};\n\nfn decodeArcData(in: VsInput) -> ArcData {\n\tvar arc : ArcData;\n\tarc.c = in.fields1.xy;\n\tarc.start = in.fields2.x * TAU;\n\tarc.end = in.fields2.y * TAU;\n\tarc.major = in.fields2.w;\n\tarc.minor = in.extraParams.x;\n\tarc.tilt = in.extraParams.y * TAU;\n\tarc.lineWidthHalf = in.fields2.z;\n\treturn arc;\n}\n\nfn strokeArc(in: VsInput, circle: bool, out: ptr<function, VsOutput>) {\n\tvar arc = decodeArcData(in);\n\tif (circle) {\n\t\t// This doesn't get set for circles.\n\t\tarc.minor = arc.major;\n\t}\n\n\t// TODO: Handle rotation/tilt.\n\n\t// Compute a tighter bounding quad for arcs if possible,\n\t// to avoid massive overdraw in case of very small angular range\n\tvar minPt: vec2f;\n\tvar maxPt: vec2f;\n\n\tvar angles: vec2f = vec2f(arc.start, arc.end);\n\tvar endsX: vec2f = vec2f(arc.c.x) + arc.major * cos(angles);\n\tvar endsY: vec2f = vec2f(arc.c.y) + arc.minor * sin(angles);\n\tminPt = vec2f(endsX.x, endsY.x);\n\tmaxPt = minPt;\n\tmin_max(&minPt, &maxPt, vec2f(endsX.y, endsY.y));\n\n\tif (arc.end > arc.start) {\n\t\tif (arc.start < HALF_PI && arc.end > HALF_PI) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x, arc.c.y + arc.minor));\n\t\t}\n\t\tif (arc.start < PI && arc.end > PI) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x - arc.major, arc.c.y));\n\t\t}\n\t\tif (arc.start < PI_1_5 && arc.end > PI_1_5) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x, arc.c.y - arc.minor));\n\t\t}\n\t} else {\n\t\t// In this case, CW arcs, we know it passes through angle 0:\n\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x + arc.major, arc.c.y));\n\n\t\t// All other checks are also reversed\n\t\t// TODO: verify this logic -- it might be overestimating\n\t\tif (arc.start < HALF_PI || arc.end > HALF_PI) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x, arc.c.y + arc.minor));\n\t\t}\n\t\tif (arc.start < PI || arc.end > PI) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x - arc.major, arc.c.y));\n\t\t}\n\t\tif (arc.start < PI_1_5 || arc.end > PI_1_5) {\n\t\t\tmin_max(&minPt, &maxPt, vec2f(arc.c.x, arc.c.y - arc.minor));\n\t\t}\n\t}\n\n\tminPt -= arc.lineWidthHalf;\n\tmaxPt += arc.lineWidthHalf;\n\n\tvar isStart = isStartVertex(in);\n\tvar isLeft = isLeftVertex(in);\n\tvar offsetPos: vec2f;\n\toffsetPos.x = select(maxPt.x, minPt.x, isStart);\n\toffsetPos.y = select(maxPt.y, minPt.y, isLeft);\n\n\tsetMvp(in.instance);\n\n\tvar clipPos = mvpMatrix * vec4(offsetPos, 0, 1);\n\toffsetPosition = clipPosToSs(clipPos);\n\n\t// Apply the aaRange offset in the correct screenspace direction.\n\tvar aaDir: vec2f;\n\taaDir.x = select(1.0, -1.0, isStart);\n\taaDir.y = select(1.0, -1.0, isLeft);\n\tvar ssAaDir = normalize(vecToSs(vec4(aaDir, 0, 0)));\n\toffsetPosition += u.aaRange * sqrt(2.0) * ssAaDir;\n\n\tcentralVertex = posToSs(vec4(arc.c, 0, 1));\n\t(*out).fsOffsetDirection = vec2(offsetPosition - centralVertex);\n\n\t// Back to clip space coords\n\t(*out).position = ssToClip(offsetPosition, clipPos.zw);\n\n\t// Get the screenspace lengths of the major and minor axis vectors.\n\tvar ssMajor = length(vecToSs(vec4(arc.major, 0, 0, 0)));\n\tvar ssMinor = length(vecToSs(vec4(0, arc.minor, 0, 0)));\n\n\t(*out).fsMultipurpose.x = arc.start;\n\t(*out).fsMultipurpose.y = -ssMajor;\n\t(*out).fsMultipurpose.z = arc.end;\n\t(*out).fsMultipurpose.w = ssMinor;\n}\n\nstruct CommonAttribs {\n\tpos: vec2f,\n\tcolor: vec4f,\n\tlayerTC: vec2f,\n\tvpTC: vec2f,\n\tlineWidthHalf: f32,\n\tgeomType: u32,\n\tghosting: u32\n}\n\nfn decodeCommonAttribs(in: VsInput) -> CommonAttribs {\n\tvar attribs : CommonAttribs;\n\tattribs.pos = in.fields1.xy;\n\tattribs.color = in.color4b;\n\tattribs.geomType = in.flags4b.y;\n\tattribs.layerTC = vec2f(in.layerVp4b.xy) / 255.0;\n\tattribs.vpTC = vec2f(in.layerVp4b.zw) / 255.0;\n\tattribs.lineWidthHalf = in.fields2.z;\n\tattribs.ghosting = in.flags4b.w;\n\treturn attribs;\n}\n\nfn strokeIndexedTriangle(in: VsInput, out: ptr<function, VsOutput>) {\n\t// nothing to go, since centralVertex = attribs.pos already happened in main()...\n\t(*out).fsHalfWidth = 0.0;\n\t(*out).fsMultipurpose = vec4f(0.0);\n\tvar objectUniforms = getObjectUniforms(in.instance);\n\t(*out).position = uniforms.projectionMatrix * uniforms.viewMatrix * objectUniforms.modelMatrix * vec4(centralVertex.xy, 0.0, 1.0);\n}\n\nfn getColor(attribs: CommonAttribs) -> vec4f {\n\t//Check layer visibility\n\t//TODO:\n\t//if (isLayerOff(attribs)) { return vec4(0.0); }\n\treturn attribs.color;\n}\n\n@vertex fn vsmain(in: VsInput) -> VsOutput {\n\n\tvar out: VsOutput;\n\n\tvar objectUniforms = getObjectUniforms(in.instance);\n\tvar attribs = decodeCommonAttribs(in);\n\n\tout.instance = in.instance;\n\tout.fsColor = getColor(attribs);\n\n\n\t// LMV-1133: Add AutoCAD-like display functionality, swapping black and white line and fill elements.\n\t/*\n\tif (u.swap != 0.0 ) {\n\t\t// if black, go to white\n\t\tif ( fsColor.r == 0.0 && fsColor.g == 0.0 && fsColor.b == 0.0 ) {\n\t\t\tfsColor.rgb = vec3(1.0,1.0,1.0);\n\t\t// if white, go to black\n\t\t} else if ( fsColor.r == 1.0 && fsColor.g == 1.0 && fsColor.b == 1.0 ) {\n\t\t\tfsColor.rgb = vec3(0.0,0.0,0.0);\n\t\t}\n\t}\n\t*/\n\n\tcentralVertex = attribs.pos;\n\toffsetPosition = attribs.pos;\n\n\tvar lineWeight = attribs.lineWidthHalf;\n\n\tvar ppu = u.pixelsPerUnit;\n\t// For perspective camera calculate pixelsPerUnit according to vertex distance from camera.\n\t// Previously this was done as a general value with distance taken from center of the model,\n\t// but this is more accurate\n\tif (u.tanHalfFov > 0.0) { // For ortho camera, tanHalfFov is set to 0 in the uniform\n\n\t\t// There's a bit of chicken and egg problem here. The offsetPosition is modified later\n\t\t// (e.g. see strokeLineSegment) but fsHalfWidth needs to be calculated beforehand for that,\n\t\t// and that in itself is based on the pixelsPerUnit. So if we wait until the end to calculate\n\t\t// ppu according to the final offsetPosition it will be too late anyway and would need to be recalculated.\n\t\t// This should be a good enough approximation, though.\n\t\tvar cameraPos = uniforms.viewMatrixInverse[3].xyz;\n\t\tvar worldPos = objectUniforms.modelMatrix * vec4f(offsetPosition.xy, 0.0, 1.0);\n\t\tvar distanceToCamera = length(cameraPos - worldPos.xyz);\n\t\tppu = u.size.y / (2.0 * distanceToCamera * u.tanHalfFov);\n\t}\n\n#if $materialHasLineStyles\n\tout.vPixelsPerUnit = ppu; // Fragment shader only uses for linestyles (in the meantime...)\n#endif\n\n\tif (lineWeight > 0.0) {\n\t\t//Do not go below a line width of one pixel\n\t\t//Since we store, half-widths, the comparison is to 0.5 instead of 1.0\n\t\tlineWeight = max(0.5, lineWeight * ppu);\n\t}\n\telse {\n\t\t//Negative line weight means device space (pixel) width.\n\t\t//Currently used for antialiasing of polygon outlines.\n\t\tlineWeight = max(0.5, abs(lineWeight));\n\t}\n\n\tout.fsHalfWidth = lineWeight;\n\n\tout.dbId = vec4u(in.dbId4b);\n\n\tout.fsVpTC = attribs.vpTC;\n\tout.fsGhosting = f32(attribs.ghosting);\n\n\tif (attribs.geomType == VBB_GT_LINE_SEGMENT\n\t\t|| attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED\n\t\t|| attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_START\n\t\t|| attribs.geomType == VBB_GT_LINE_SEGMENT_CAPPED_END) {\n\t\tstrokeLineSegment(in, attribs.geomType, &out);\n\t} else if (attribs.geomType == VBB_GT_LINE_SEGMENT_MITER) {\n\t\tstrokeMiterLineSegment(in, &out);\n\t} else if (attribs.geomType == VBB_GT_ARC_CIRCULAR) {\n\t\tstrokeArc(in, true, &out);\n\t} else if (attribs.geomType == VBB_GT_ARC_ELLIPTICAL) {\n\t\tstrokeArc(in, false, &out);\n\t} else /*if (attribs.geomType == VBB_GT_TRIANGLE_INDEXED)*/ {\n\t\tstrokeIndexedTriangle(in, &out);\n\t}\n\n\t//fsGeomType = attribs.geomType;\n\n\t// pass world-pos for cut planes\n\tvar worldPosition = objectUniforms.modelMatrix * vec4f( offsetPosition.xy, 0.0, 1.0 );\n\tout.vWorldPosition = worldPosition.xyz;\n\n\treturn out;\n}\n\n\n//Gaussian falloff function\nfn curveGaussian(r : f32, width: f32) -> f32 {\n\tvar amt = clamp(abs(r / (width * 1.0)), 0.0, 1.0);\n\tamt = max(amt - 0.0, 0.0);\n\n\tvar exponent = amt * 2.0;\n\n\treturn clamp(exp(-exponent*exponent), 0.0, 1.0);\n}\n\n#if $materialHasLineStyles\nfn getLinePatternPixel(i: u32, j: u32) -> f32 {\n\treturn f32(lineStyles[j * u.lineStyleWidth + i]) * 255.0;\n}\n\nfn getPatternLength(whichPattern: u32) -> f32 {\n\tvar p1 = getLinePatternPixel(0, whichPattern);\n\tvar p2 = getLinePatternPixel(1, whichPattern);\n\treturn (p2 * 256.0 + p1);\n}\n#endif\n\n\nfn fillLineSegment(in: VsOutput, out: ptr<function, PixelOutput>) {\n\n\tvar radius = abs(in.fsHalfWidth);\n\tvar parametricDistance = in.fsMultipurpose.x;\n\tvar segmentLength = in.fsMultipurpose.y;\n\tvar totalDistance = in.fsMultipurpose.z;\n\tvar roundedEnd = in.fsMultipurpose.w;\n\n\t//Apply any dot/dash linetype\n#if $materialHasLineStyles\n\tvar whichPattern = u32(in.fsMultipurpose.w);\n\n\tif (whichPattern > 0) {\n\t\tconst TEX_TO_UNIT = 1.0 / 96.0;\n\n\t\tvar patternScale: f32;\n\n\t\t//If line width is negative it means device space line style (zoom invariant)\n\t\t//line width, which also implies the same about the line pattern -- check for this here.\n\t\tif (in.fsHalfWidth < 0.0) {\n\t\t\tpatternScale = LTSCALE;\n\t\t} else {\n\t\t\tpatternScale = LTSCALE * TEX_TO_UNIT * in.vPixelsPerUnit;\n\t\t}\n\n\t\tvar patLen = patternScale * getPatternLength(whichPattern);\n\t\tvar phase = (totalDistance + parametricDistance) % patLen;\n\n\t\tvar onPixel = true;\n\t\tvar radiusPixels = radius + u.aaRange;\n\n\t\tfor (var i: u32 = 2; i < u.lineStyleWidth; i += 2) {\n\n\t\t\tvar on = getLinePatternPixel(i, whichPattern);\n\t\t\tif (on == 1.0) {\n\t\t\t\ton = 0.0; //special handling for dots, map length 1 to 0\n\t\t\t}\n\t\t\ton *= patternScale;\n\n\t\t\tonPixel = true;\n\t\t\tphase -= on;\n\t\t\tif (phase < 0.0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (phase <= radiusPixels) {\n\t\t\t\tonPixel = false;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tvar off = getLinePatternPixel(i+1, whichPattern);\n\t\t\tif (off <= 1.0) {\n\t\t\t\toff = 0.0; //special handling for dots, map length 1 to 0\n\t\t\t}\n\t\t\toff *= patternScale;\n\n\t\t\tonPixel = false;\n\t\t\tphase -= off;\n\t\t\tif (phase < -radiusPixels) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\tif (phase <= 0.0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t//Modify the parametricDistance value used for round cap\n\t\t//rendering to reflect the current position along the dash,\n\t\t//so that dashes get caps also.\n\t\tif (!onPixel && (abs(phase) <= radiusPixels)) {\n\t\t\tsegmentLength = 0.0;\n\t\t\tparametricDistance = phase;\n\t\t}\n\t}\n#endif // HAS_LINESTYLES\n\n\t//Check for end cap or join region -- here we reduce\n\t///allowed distance from centerline in a circular way\n\t//to get a round cap/join\n\tvar dist: f32;\n\tvar offsetLength2 = dot(in.fsOffsetDirection, in.fsOffsetDirection);\n\t/*\n\t if (parametricDistance < 0.0) {\n\t var d = parametricDistance;\n\t dist = sqrt(d * d + offsetLength2);\n\t } else if (parametricDistance >= segmentLength) {\n\t var d = parametricDistance - segmentLength;\n\t dist = sqrt(d * d + offsetLength2);\n\t } else {\n\t dist = sqrt(offsetLength2);\n\t }\n\t*/\n\n\t//Branchless version of the above ifs (because who doesn't like to do boolean logic with float ops?):\n\tvar ltz = max(0.0, sign(-parametricDistance));\n\tvar gtsl = max(0.0, sign(parametricDistance - segmentLength));\n\tvar d = (ltz + gtsl) * (parametricDistance - gtsl * segmentLength);\n\tdist = sqrt(max(0.0, offsetLength2 + d*d));\n\n\t//pixel is too far out of the line center\n\t//so discard it\n\tvar range = dist - radius;\n\n\t// Handle butt capped ends:\n\t// Any line pattern != 0 (solid line) will automatically use round line ends. This behavior is on purpose!\n\t// Patterned lines must use the (unknown) actual line end style for each dash, not the style of either segment end.\n\t// The actual line end style would have to get passed in from Javascript (e.g., as extra bit in the pattern)\n\tif (roundedEnd < 0.25) {\n\t\t// this pixel is close to a butt capped end. Get its distance to the closer line end.\n\t\tvar buttRange = max(-parametricDistance, parametricDistance - segmentLength);\n\t\trange = max(range, buttRange);\n\t}\n\n\t//Here aaRange will always be 0.5 pixels.\n\t//The logic below blurs a thickness of 1 pixel, a distance of\n\t//(halfLineWidth - 0.5) to (halfLineWidth + 0.5) away from the centerline.\n\n\t//Fully outside, discard\n\tif (range > u.aaRange) {\n\t\tdiscard;\n\t}\n\n\t//The geometry covers this pixel -- do AA.\n\t(*out).color = in.fsColor;\n\n\t//Blur if we are in the blur range.\n\t//The exact parameters to the gaussian function (and inside it)\n\t//are based on personal preference observations\n\tif (range > -u.aaRange) {\n\t\t(*out).color = vec4f((*out).color.xyz, curveGaussian(range+u.aaRange, u.aaRange * 2.0));\n\t}\n\t//out.color.a *= curveGaussian(range, 1.0);\n}\n\nfn EllipticalApprox(\n\t\titers: i32,\n\t\tt0: ptr<function, f32>, t1: ptr<function, f32>,\n\t\ty: vec2f, e: vec2f, ey: vec2f, esqr: vec2f) -> f32 {\n\tvar r: vec2f;\n\tfor (var i = 0; i < 10; i++) { // maximum 10 iterations\n\t\tif (i >= iters) {\n\t\t\tbreak; // early out if we don't want the max number of iterations\n\t\t}\n\n\t\tvar t = mix(*t0, *t1, 0.5); // 0.5*(t0 + t1);\n\t\tr = ey / (vec2(t) + esqr);\n\n\t\tvar rsq = r * r;\n\t\tvar f = rsq.x + rsq.y - 1.0;\n\n\t\tif (f > 0.0) {\n\t\t\t*t0 = t;\n\t\t} else {\n\t\t\t*t1 = t;\n\t\t}\n\t}\n\n\tvar closestPoint = e * r;\n\treturn distance(closestPoint, y);\n}\n\nfn EllipseDistanceSpecial(\n\t\te: vec2f, y: vec2f, width: f32, aaRange: f32) -> f32 {\n\tvar dist: f32;\n\n\t// Bisect to compute the root of F(t) for t >= -e1*e1.\n\tvar esqr = e * e;\n\tvar ey = e * y;\n\tvar t0 = -esqr[1] + ey[1];\n\tvar t1 = -esqr[1] + length(ey);\n\n\t//Do a few initial iterations without loop break checks\n\t//to get approximately close to the result\n\tdist = EllipticalApprox(6, &t0, &t1, y, e, ey, esqr);\n\n\t//Early out -- point is going to be too far to matter for the ellipse outline\n\tif (dist > max(2.0 * (width + aaRange), e[0] * 0.05)) {\n\t\treturn dist;\n\t}\n\n\t//Do a few more iterations to get really close to the result...\n\tdist = EllipticalApprox(6, &t0, &t1, y, e, ey, esqr);\n\n\t//Early out -- point is too far to matter for the ellipse outline\n\t//The bigger the eccentricity, the worse the estimate, so increse\n\t//the tolerance based on that.\n\tvar ecc = 1.0 + 0.1 * e[0] / e[1];\n\n\tif (dist > max(ecc * (width + aaRange), e[0] * 0.001)) {\n\t\treturn dist;\n\t}\n\tif (dist < (width - aaRange) / ecc) {\n\t\treturn dist;\n\t}\n\n\t//Finally get an almost exact answer since\n\t//we are near the line width boundary\n\tdist = EllipticalApprox(10, &t0, &t1, y, e, ey, esqr);\n\treturn dist;\n}\n\n\n//----------------------------------------------------------------------------\n// The ellipse is (x0/e0)^2 + (x1/e1)^2 = 1. The query point is (y0,y1).\n// The function returns the distance from the query point to the ellipse.\n//----------------------------------------------------------------------------\nfn EllipseDistance(\n\t\te: vec2f, y: vec2f, width: f32, aaRange: f32) -> f32 {\n\tvar locE = e;\n\tvar locY = y;\n\tif (e[0] < e[1]) {\n\t\t// Determine the axis order for decreasing extents\n\t\tlocE = locE.yx;\n\t\tlocY = locY.yx;\n\t}\n\n\t// Determine reflections for y to the first quadrant.\n\tvar refl = sign(locY);\n\tlocY *= refl;\n\n\treturn EllipseDistanceSpecial(locE, locY, width, aaRange);\n}\n\nfn fillArc(in: VsOutput, out: ptr<function, PixelOutput>) {\n\tvar dist = length(in.fsOffsetDirection);\n\tvar angles = in.fsMultipurpose.xz; // (start, end) angles\n\tvar radiusX = abs(in.fsMultipurpose.y);\n\tvar radiusY = in.fsMultipurpose.w;\n\n\tvar edgeDist: f32;\n\tvar angle: f32;\n\tif (radiusX == radiusY) {\n\t\tedgeDist = abs(dist - radiusX);\n\t\tangle = atan2(in.fsOffsetDirection.y, in.fsOffsetDirection.x);\n\t} else {\n\t\tedgeDist = EllipseDistance(\n\t\t\tvec2(radiusX, radiusY), in.fsOffsetDirection, in.fsHalfWidth, u.aaRange);\n\t\tvar aspect = radiusX / radiusY;\n\t\tangle = atan2(aspect * in.fsOffsetDirection.y, in.fsOffsetDirection.x);\n\t}\n\tedgeDist -= in.fsHalfWidth;\n\n\t// pixel is too far out of the line center\n\t// so discard it\n\tif (edgeDist > u.aaRange) {\n\t\tdiscard;\n\t}\n\n\t// Handle clockwise arcs, which happen when the arc\n\t// crosses the X axis -- convert to CCW arc starting\n\t// at negative angle instead.\n\tif (angles.x > angles.y) {\n\t\t// Handle the case that 0 < angleStart < PI.\n\t\tif (angle > angles.x && angle < PI) {\n\t\t\tangle -= TAU;\n\t\t}\n\t\tangles.x -= TAU;\n\t\t// Fixed for https://jira.autodesk.com/browse/TREX-508: some arcs in this drawing are trimmed after translating\n\t\t// We need to handle the case that -PI < angle < angleStart < 0\n\t\t// In the case, angle needs to add 2*PI to ensure angle in the range of [angleStart, angleEnd]\n\t\tif (angle < angles.x) {\n\t\t\tangle += TAU;\n\t\t}\n\t} else if (angle < 0.0) {\n\t\tangle += TAU;\n\t}\n\n\t// TODO: Do we need this?\n\t// # ifdef LOADING_ANIMATION\n\t// \tif ((angle - angles.x) / (angles.y - angles.x) > loadingProgress) {\n\t// \t\tdiscard;\n\t// \t}\n\t// # endif\n\n\t// Are we in the exact range of the arc?\n\tif (angle > angles.x && angle < angles.y) {\n\t\t(*out).color = in.fsColor;\n\n\t\tif (edgeDist > -u.aaRange) {\n\t\t\t(*out).color.a *= curveGaussian(edgeDist + u.aaRange, u.aaRange * 2.0);\n\t\t}\n\t} else {\n\t\tdiscard;\n\t}\n}\n\n\nfn fillTriangle(in: VsOutput, out: ptr<function, PixelOutput>) {\n\t(*out).color = in.fsColor;\n}\n\n\n// Checks whether C is on the right/left of the AB vector\n// Returns 0 on the line\n// -1 on right side\n// 1 on left side\nfn getSide(a: vec2f, b: vec2f, c: vec2f) -> f32 {\n\treturn sign((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));\n}\n\n\nstruct PixelOutput {\n\t@location(0) color: vec4f,\n\t@location(1) normal: vec4f,\n\t@location(2) viewDepth: vec4f,\n\t@location(3) dbId: vec4u,\n\t@location(4) modelId: vec4u,\n\t//@location(5) objectFlags: vec4u\n}\n\n@fragment fn psmain(in: VsOutput) -> PixelOutput {\n\n\tvar out: PixelOutput;\n\n\tvar objectUniforms = getObjectUniforms(in.instance);\n\tvar materialUniforms = getMaterialUniforms(objectUniforms.materialIndex);\n\n\t//Is visibility off?\n\t//Note we check for all components to be zero,\n\t//because we still want the ability to mark the ID buffer\n\t//with IDs that do not render anything into the color buffer\n\tif (in.fsColor.a == 0.0 && in.fsColor.r == 0.0 && in.fsColor.g == 0.0 && in.fsColor.b == 0.0) {\n\t\tdiscard;\n\t}\n\n\tif (in.fsHalfWidth == 0.0) {\n\t\t// Filled triangle, not a line, no need for extra math\n\t\tfillTriangle(in, &out);\n\n\t\t// cap mesh hatch pattern\n\t\tif ((materialUniforms.renderFlags & 8) != 0) {\n\t\t\tout.color = calculateHatchPattern(materialUniforms.hatchParams, in.position.xy, out.color,\n\t\t\t\thatchTintColor, materialUniforms.hatchTintIntensity);\n\t\t}\n\t} else if (in.fsMultipurpose.y < 0.0) {\n\t\tfillArc(in, &out);\n\t} else {\n\t\tfillLineSegment(in, &out);\n\t}\n\n\t// The LineShader requires the ability to discard IDs independent of color. This is needed for ghosted 2D\n\t// objects, which are visible, but not selectable (allowing to select the object below).\n\t// To support this, the id_frag shader chunk supports the ENABLE_ID_DISCARD macro, which is always defined\n\t// by LineShader. If this macro is set, id_frag requires a variable writeId to control whether the id is\n\t// written (writeId=1.0) or not (writeId=0.0).\n\tvar writeId = 1.0;\n\n\tout.color.a *= u.opacity;\n\t// For fully transparent pixels we can discard\n\tif (out.color.a == 0.0) {\n\t\tdiscard;\n\t}\n\n\t// Apply ghosting, i.e., make an object transparent and exclude it from ID buffer if...\n\t// a) It is in the ghosting layer (see FragmentList.js)\n\t// b) We are in 2D measure mode and it belongs to a different viewport than the first selected one\n\tif (in.fsGhosting != 0.0)\n\t\t//|| ((in.viewportId != 0.0) && (abs(in.fsVpTC.x * 255.0 + in.fsVpTC.y) >= 0.5 && abs(in.fsVpTC.x * 255.0 + in.fsVpTC.y - in.viewportId) >= 0.5)))\n\t{\n\t\t// apply ghosting\n\t\twriteId = 0.0;\n\n\t\t// When swapping black and white, must kick up faded inks a bit to give them more contrast\n\t\t// with the (likely to be black) background. By visual test, 0.21 looks good.\n\t\t//DT gl_FragColor.a *= ((u.swap == 1.0) ? 0.21 : 0.1);\n\t\tout.color.a *= 0.30;\n\t}\n\n\t//check doNotCut flag\n\tif (commonMaterialUniforms.doNotCutOverride + (materialUniforms.renderFlags & 2) == 0) {\n\t\tcheckCutPlanes(in.vWorldPosition);\n\t}\n\n\tif (writeId == 1.0) {\n\t\t//Store object identity information\n\t\tout.dbId = in.dbId;\n\n\t\t//Currently we don't have enough room to bind a third ID render target (32 byte limit on render attachments),\n\t\t//so we stash half of the object flags in the modelId\n\t\t//output.objectFlags = intToVec(objectUniforms.objectFlags);\n\n\t\tout.modelId = intToVec(objectUniforms.modelId | (objectUniforms.objectFlags << 16));\n\t}\n\n\treturn out;\n}\n",{IBL:Q(0),cameraUniforms:te(1),objectUniforms:G(2),lineUniforms:(t=3,(0,d.$wgsl)(me,{group:t})),hatch:v,materialHasLineStyles:e.hasLineStyles});var t}class be{#rt;#et;#Mt=new Map;#qi;#Yi;#Ki;#Qi;#tn;constructor(e){this.#rt=e,this.#et=e.getDevice(),this.#Qi=this.#rt.getVB(),this.#tn=ce}#Ct(e,t,i){let n,r=this.#et.createShaderModule({code:ye(i)});return n=this.#et.createRenderPipeline({layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#Yi}),vertex:{module:r,entryPoint:"vsmain",buffers:le(t)},fragment:{module:r,entryPoint:"psmain",targets:this.#Ki},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{depthWriteEnabled:i.depthWrite,depthCompare:i.depthTest?i.depthFunc||"less-equal":"always",format:x}}),this.#Mt.set(e,n),n}reset(e,t){this.#qi=null,this.#Yi=e,this.#Ki=t}drawOne(e,t,i,n){const r=this.#tn(i,n);let o=this.#Mt.get(r);o||(o=this.#Ct(r,i,n)),o!==this.#qi&&(e.setPipeline(o),this.#qi=o),this.#Qi.draw(e,i,t)}}var xe=i(72091),_e=i.n(xe);let Ee,Se=[],Ae=[],we=new(_e().Vector3),Te=new(_e().Frustum),Me=!1;function Ce(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function Pe(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?t.z-e.z:e.id-t.id}function De(e,t,i){if(i||!1!==e.visible){if(e instanceof _e().Scene||e instanceof _e().Group);else if(e instanceof S.RenderBatch);else if(e instanceof _e().Light);else if((e instanceof _e().Mesh||e instanceof _e().Line)&&(!1===e.frustumCulled||!0===Te.intersectsObject(e))){const i=e.material;i&&(i.transparent?Ae.push(e):Se.push(e),i.is2d&&(Me=!0)),!0===t&&(we.setFromMatrixPosition(e.matrixWorld),we.applyProjection(Ee),e.z=we.z)}if(e.children)for(let n=0,r=e.children.length;n<r;n++)De(e.children[n],t,i)}}let Le=new class{forEachWGPU(e,t,i){let n=t||-1,r=e,o=0,s=Se.length;if(r<s){let e=s;for(n>0&&(e-r>n?(e=r+n,o=e):n=Math.max(0,n-(e-r)));r<e;r++){i(Se[r])}}if(o)return o;if(0===n)return s;r-=s;let a=Ae.length;for(n>0&&a-r>n&&(a=r+n,o=a+s);r<a;r++){i(Ae[r])}return o}is2d(){return Me}};function Ie(e,t){return t?(Ee=t,Te.setFromProjectionMatrix(Ee)):Ee=null,!0===e.autoUpdate&&e.updateMatrixWorld(),Se.length=0,Ae.length=0,Me=!1,De(e,!0===e.sortObjects,!0===e.forceVisible),!0===e.sortObjects&&(Se.sort(Pe),Ae.sort(Ce)),Le}const Re={depthTest:!0,depthWrite:!0,depthFunc:"less-equal"},Oe={depthTest:!0,depthWrite:!1,depthFunc:"greater"},Ne={depthTest:!0,depthWrite:!1,depthFunc:"less-equal"},Fe={depthTest:!0,depthWrite:!0,depthFunc:"less"},Ue={x:0,y:0,z:0,w:1},Be={x:0,y:0,z:0,w:.15},ke={x:.75,y:.875,z:1,w:.15},Ve={x:1,y:1,z:1,w:1},Ge={x:1,y:1,z:1,w:.5};class ze{#rt;#et;#in;#nn;#rn;#on;#sn;#an;#ln;#cn;#hn;#un;#A;#dn;#Ft;#Mi;#fn;#pn;#mn;#gn;#vn;#yn;#bn;#xn=H(Ue);#_n=H(ke);#En;#Sn;#An=[];#wn=[];constructor(e){this.#rt=e,this.#dn=new Z(e)}#Tn(){let e=this.#rt.getRenderTargets(),t=e.getColorTarget().createView(),i=e.getDepthTarget().createView(),n=e.getNormalsTarget().createView(),r=e.getViewDepthTarget().createView(),o=e.getOverlayTarget().createView();this.#rn={colorAttachments:[{view:n,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},{view:r,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:i,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}},this.#in={colorAttachments:[{view:t,loadOp:"load",storeOp:"store"},{view:n,loadOp:"load",storeOp:"store"},{view:r,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:i,depthLoadOp:"load",depthStoreOp:"store"}},this.#an={colorFormats:[e.getColorTarget().format,e.getNormalsTarget().format,e.getViewDepthTarget().format],depthStencilFormat:[e.getDepthTarget().format]};for(let t=0;t<2;t++){let i={view:e.getIdTarget(t).createView(),clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},n={view:i.view,loadOp:"load",storeOp:"store"},r=e.getIdTarget(t).format;this.#rn.colorAttachments.push(i),this.#in.colorAttachments.push(n),this.#an.colorFormats.push(r)}this.#ln={colorFormats:[e.getColorTarget().format],depthStencilFormat:[e.getDepthTarget().format]},this.#nn={colorAttachments:[{view:t,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:i,depthLoadOp:"load",depthStoreOp:"store"}},this.#on={colorAttachments:[{view:o,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]},this.#sn={colorAttachments:[{view:o,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:i,depthLoadOp:"load",depthStoreOp:"store"}}}init(e){this.#et=this.#rt.getDevice(),this.#dn.init(),this.#fn=new ne(this.#et),this.#Ft=e,this.#An.length=this.#Ft.MAX_BATCH,this.#wn.length=this.#Ft.MAX_BATCH,this.#Mi=new N(this.#et,void 0,this.#rt.getPlaceholderTexture()),this.#pn=new ve(this.#et),this.#mn=new ue(this.#rt),this.#gn=new pe(this.#rt),this.#yn=new be(this.#rt),this.#bn=new be(this.#rt),this.#vn=new ue(this.#rt),this.#En=[this.#dn.getLayout(),this.#fn.getLayout(),this.#Ft.getLayout(),this.#Mi.getLayout()],this.#Sn=[this.#dn.getLayout(),this.#fn.getLayout(),this.#Ft.getLayout(),this.#pn.getLayout()]}resize(e,t){let i=this.#rt.getPixelRatio()>1.5?1:.6;Ue.w=i,this.#xn=H(Ue),this.#Tn(e,t),this.#pn.setTargetSize(e,t)}#Mn(e){let t=this.#et.createCommandEncoder();t.beginRenderPass(e).end(),this.#et.queue.submit([t.finish()])}clearMainTargets(){this.#Mn(this.#rn)}clearOverlayTargets(){this.#Mn(this.#on)}setGhostingBrightness(e){this.#_n=H(e?Be:ke)}updatePixelScale(e,t){this.#pn&&(this.#pn.updatePixelScale(e,t),this.#pn.upload())}setLineStyleBuffer(e,t){this.#pn&&(this.#pn.setLineStyleBuffer(e,t),this.#pn.upload())}getIBL(){return this.#dn}#Cn(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=e.beginRenderPass(t),s=o;if(i){if(!i.record)return o;s=i}return s.setBindGroup(0,this.#dn.getBindGroup()),s.setBindGroup(1,this.#fn.getBindGroup()),s.setBindGroup(2,this.#Ft.getBindGroup(n,r)),s.setBindGroup(3,this.#Mi.getBindGroup()),o}#Pn(e,t){let i=e.beginRenderPass(t);return i.setBindGroup(0,this.#dn.getBindGroup()),i.setBindGroup(1,this.#fn.getBindGroup()),i.setBindGroup(2,this.#Ft.getBindGroup(-1)),i.setBindGroup(3,this.#pn.getBindGroup()),i}#Dn(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e.finish();if(i&&t&&this.#Ft.writeToQueue(t),!i)return n;this.#et.queue.submit([n])}beginScene(e,t){this.#fn.update(e),this.#dn.update()}#Ln(e,t,i){let n;if(!this.#cn||this.#hn.record){const r=this.#Ft.getRenderIndex(i);this.#An[this.#A]=e,this.#wn[this.#A]=r,n=this.#mn.drawOne(this.#un,r,e,t),this.#Ft.initMaterialUpdateHook(t,n),t.needsUpdate=!1,this.#A++}}#In(e,t,i){const n=this.#Ft.getRenderIndex(i);this.#gn.drawOneGhosted(this.#un,n,e,Fe)}#Rn(e){const t=e.geometry,i=e.material;this.#An[this.#A]=t,this.#wn[this.#A]=this.#A;const n=this.#mn.drawOne(this.#un,this.#A,t,i);this.#Ft.setOneObjectData(e,this.#A),this.#Ft.setOneMaterialData(i,n),this.#A++}#On(e){this.#Ft.setOneObjectData(e,this.#A),this.#gn.drawOneGhosted(this.#un,this.#A,e.geometry,Fe),this.#A++}#Nn(e){const t=this.#et.createRenderBundleEncoder(e);return t.record=!0,t}#Fn(e,t,i,n){if(n){let r=n;n.record&&(r=n.finish(),e.setRenderBundle(t,r)),i.executeBundles([r])}}renderScenePart(e,t){let i,n,r,o,s,a,l,c,h=this.#rt.getRenderTargets();if(h.setTargetsDirty(),this.#cn=!1,e instanceof S.RenderBatch)i=e,n=i.frags.modelId,r=!0,o=this.#Ln.bind(this),s=this.#In.bind(this),this.#Ft.resetUpdateHeuristic(n),i.uniformsNeedUpdate&&(this.#Ft.updateBatch(i),i.uniformsNeedUpdate=!1),this.#cn=i.useRenderBundles,this.#rt.clearModelVisibilityDirty(n),this.#cn&&(a=i.getRenderBundle(0),l=i.getRenderBundle(1),t&&a&&!l&&(a=null),!t&&l&&(i.setRenderBundle(1,null),l=null),c=i.getRenderBundle(2));else{if(i=Ie(e,this.#fn.getViewProjectionMatrix()),!i)return;n=-1,r=!1,o=this.#Rn.bind(this),s=this.#On.bind(this)}if(i.is2d())return void this.#Un(i);let u=h.getTargetsListMainPass(),d=h.getTargetsListEdgePass();this.#Ft.setDoNotCutOverride(!1);let f,p=0;do{this.#A=0;let h=this.#et.createCommandEncoder();if(e.edgesOnly){this.#Ft.setEdgeColorInt(this.#_n),this.#cn&&!c&&(c=this.#Nn(this.#ln));let e=this.#Cn(h,this.#nn,c,n,i.start);this.#un=c||e,this.#gn.reset(this.#En,d),this.#A=0;let t=0;this.#cn&&!c.record||(t=i.forEachWGPU(p,this.#Ft.MAX_BATCH,s)),this.#Fn(i,2,e,c),e.end(),f=this.#Dn(h,this.#A,!r),p=t}else{this.#Ft.setEdgeColorInt(this.#xn),this.#cn&&(a||(a=this.#Nn(this.#an)),this.#hn=a);let e=this.#Cn(h,this.#in,a,n,i.start);this.#un=a||e,this.#mn.reset(this.#En,u);let s=0;if(this.#cn&&!a.record||(s=i.forEachWGPU(p,this.#Ft.MAX_BATCH,o)),this.#Fn(i,0,e,a),e.end(),t){this.#cn&&!l&&(l=this.#Nn(this.#ln));let e=this.#Cn(h,this.#nn,l,n,i.start);if(this.#un=l||e,this.#gn.reset(this.#En,d),!this.#cn||l.record)for(let e=0;e<this.#A;e++)this.#gn.drawOne(this.#un,this.#wn[e],this.#An[e],Re);this.#Fn(i,1,e,l),e.end()}f=this.#Dn(h,this.#A,!r),p=s}}while(p>0);return this.#un=null,this.#hn=null,f}#Un(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.#rt.getRenderTargets();n.setTargetsDirty();let r=e,o=i?n.getOverlayTargetsList():n.getTargetsListMainPass();this.#Ft.setDoNotCutOverride(!1);let s=0;do{let e=0,n=this.#et.createCommandEncoder();const a=i?this.#sn:this.#in;let l=this.#Pn(n,a);const c=i?this.#bn:this.#yn;c.reset(this.#Sn,o);let h=r.forEachWGPU(s,this.#Ft.MAX_BATCH,(i=>{const n=i.geometry,r=t||i.material;c.drawOne(l,e,n,r),this.#Ft.setOneObjectData(i,e),this.#Ft.setOneMaterialData2D(r,0),e++}));l.end(),this.#Dn(n,e),s=h}while(s>0)}renderOverlay(e,t,i,n,r,o,s){this.#fn.update(t);let a=Ie(e,this.#fn.getViewProjectionMatrix());if(a.is2d())return void this.#Un(a,i,!0);let l=this.#rt.getRenderTargets().getOverlayTargetsList();this.#Ft.setDoNotCutOverride(!0);let c,h=0;do{let e,t=0,s=this.#et.createCommandEncoder();i&&(e=i),this.#Ft.setEdgeColorInt(H(o||Ge));let u=this.#Cn(s,this.#sn);if(this.#vn.reset(this.#En,l),c=a.forEachWGPU(h,this.#Ft.MAX_BATCH,(i=>{const n=i.geometry,r=i.material;this.#An[t]=n;const o=e||r,s=this.#vn.drawOne(u,t,n,o);i.material=o,this.#Ft.setOneObjectData(i,t),this.#Ft.setOneMaterialData(o,s),t++})),u.end(),n){if(r){let e=this.#Cn(s,this.#sn);this.#gn.reset(this.#En,l);for(let i=0;i<t;i++)this.#gn.drawOne(e,i,this.#An[i],Oe);e.end()}this.#Dn(s,t),s=this.#et.createCommandEncoder();{n.depthFunc="greater",n.needsUpdate=!0,this.#Ft.setEdgeColorInt(H(o||Ve));let e=this.#Cn(s,this.#sn);this.#vn.reset(this.#En,l);let t=0;const i=n;c=a.forEachWGPU(h,this.#Ft.MAX_BATCH,(n=>{const r=this.#vn.drawOne(e,t,n.geometry,i);this.#Ft.setMaterialReference(t*this.#Ft.OBJECT_STRIDE_32,i),this.#Ft.setOneMaterialData(i,r),t++})),e.end()}}if(r){let e=this.#Cn(s,this.#sn);this.#gn.reset(this.#En,l);for(let i=0;i<t;i++)this.#gn.drawOne(e,i,this.#An[i],Ne);e.end()}this.#Dn(s,t),h=c}while(h>0)}}const He="$0 // ghosting\n\n@id(0) override r1: f32 = 0.9;\n@id(1) override g1: f32 = 0.9;\n@id(2) override b1: f32 = 0.9;\n\n@id(3) override r2: f32 = 0.59;\n@id(4) override g2: f32 = 0.59;\n@id(5) override b2: f32 = 0.59;\n\n@fragment\nfn main(\n @builtin(position) coord : vec4f,\n @location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n var outColor = mix(vec3f(r2, g2, b2), vec3f(r1, g1, b1), vUv.y);\n return vec4f(outColor + orderedDithering(vec2i(floor(coord.xy))) / 256.0, 1.0);\n}\n";function We(e){let t,i,n,r,o,s,a,l,c,u,f,p=e,m=!1;function g(){i=t.createRenderPipeline({layout:"auto",vertex:{module:r,entryPoint:"main"},fragment:{module:o,entryPoint:"main",targets:[{format:p.getRenderTargets().getColorTarget().format}],constants:{0:s,1:a,2:l,3:c,4:u,5:f}},primitive:{topology:"triangle-list",cullMode:"back"}})}this.init=function(){t=p.getDevice(),r||(r=t.createShaderModule({code:h})),o||(o=t.createShaderModule({code:(0,d.$wgsl)(He,de)})),!i&&m&&g(),n||(n={colorAttachments:[{view:void 0,clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]})},this.run=function(){if(!t||!m)return;let e=t.createCommandEncoder();n.colorAttachments[0].view=p.getRenderTargets().getColorTargetView();let r=e.beginRenderPass(n);r.setPipeline(i),r.draw(3),r.end(),t.queue.submit([e.finish()])},this.setClearColors=function(e,n,r,o,h,d){s=e,a=n,l=r,c=o,u=h,f=d,i=null,t&&g(),m=!0},this.getClearColors=function(){return[s,a,l,c,u,f]}}const je="@group(0) @binding(0) var envMap: texture_cube<f32>;\n@group(0) @binding(1) var envSampler: sampler;\n\nstruct EnvMapUniforms {\n\tuCamDir: vec4f,\n\tuCamUp: vec4f,\n\tuResolution: vec2f,\n\tuHalfFovTan: f32,\n\tenvMapExposure: f32,\n\texposureBias: f32,\n\ttonemapMethod: i32\n}\n@group(1) @binding(0) var<uniform> u : EnvMapUniforms;\n\n$tonemap\n$envMapSample\n\nfn rayDir(vUv: vec2f) -> vec3f {\n var A = (u.uResolution.x/u.uResolution.y)*normalize(cross(u.uCamDir.xyz,u.uCamUp.xyz)) * (u.uHalfFovTan * 2.0);\n var B = normalize(u.uCamUp.xyz) * (u.uHalfFovTan * 2.0);\n var C = normalize(u.uCamDir.xyz);\n\n var ray = normalize( C + (2.0*vUv.x - 1.0)*A + (2.0*vUv.y - 1.0)*B );\n return ray;\n}\n\n\n@fragment\nfn main\t(\n\t@builtin(position) coord : vec4f,\n\t@location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n\n\tvar rd = rayDir(vUv);\n\n\tvar outColor = sampleIrradianceMap(rd, envMap, envSampler, u.envMapExposure).xyz;\n\n#if $tonemapMethod1\n\toutColor = toneMapCanonOGS_WithGamma_WithColorPerserving(u.exposureBias * outColor.xyz);\n#elif $tonemapMethod2\n\toutColor = toneMapCanonFilmic_WithGamma(u.exposureBias * outColor.xyz);\n#endif\n\n\treturn vec4f(outColor, 1.0);\n}\n";var qe=i(96118);let Xe=new qe.LmvVector3;class Ye extends f.D{constructor(e){super(e,14,!0,!1)}update(e,t,i,n,r,o){let s=e.worldUpTransform?e.getWorldDirection(Xe).applyMatrix4(e.worldUpTransform):e.getWorldDirection(Xe);this.setVector3(0,s);let a=e.worldUpTransform?e.up.clone().applyMatrix4(e.worldUpTransform):e.up;this.setVector3(4,a),this.setFloat(8,t[0]),this.setFloat(9,t[1]),this.setFloat(10,Math.tan(THREE.Math.degToRad(.5*e.fov))),this.setFloat(11,n),this.setFloat(12,r),this.setInt(13,o)}}function Ke(e){let t,i,n,r,o,s,a,l=e,c=1,u=1,f=0;this.init=function(){var e,i;t=l.getDevice(),n=new Ye(t),o||(o=t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}}]})),r||(r=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[o,n.getLayout()]}),vertex:{module:t.createShaderModule({code:h}),entryPoint:"main"},fragment:{module:t.createShaderModule({code:(e=!0,i=2,(0,d.$wgsl)(je,{tonemap:g,envMapSample:J(e,!e,i>0),tonemapMethod1:1===i,tonemapMethod2:2===i}))}),entryPoint:"main",targets:[{format:l.getRenderTargets().getColorTarget().format}]},primitive:{topology:"triangle-list",cullMode:"back"}})),a||(a={colorAttachments:[{view:void 0,clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]})},this.setCubeMap=function(e){(0,T.rL)(e),(0,T.el)(i),i=e},this.getCubeMap=function(){return i},this.hasCubeMap=function(){return!!i},this.setEnvExposure=function(e){const t=Math.pow(2,e);t!==u&&(u=t)},this.setExposureBias=function(e){let t=Math.pow(2,e);t!==c&&(c=t)},this.setTonemapMethod=function(e){f!==e&&(f=e)},this.setEnvRotation=function(e){},this.setCamera=function(e,i){if(!t)return;let r=l.getRenderTargets().getTargetSize();n.update(e,r,i,u,c,f)},this.run=function(){if(!t)return;!i.needsUpdate&&s||((0,T.eY)(t,i),s=t.createBindGroup({layout:o,entries:[{binding:0,resource:i.__gpuTextureCube.createView({dimension:"cube"})},{binding:1,resource:i.__gpuSampler}]})),n.upload();let e=t.createCommandEncoder();a.colorAttachments[0].view=l.getRenderTargets().getColorTargetView();let c=e.beginRenderPass(a);c.setPipeline(r),c.setBindGroup(0,s),c.setBindGroup(1,n.getBindGroup()),c.draw(3),c.end(),t.queue.submit([e.finish()])}}const Qe='$pack_depth\n\n// Total number of direct samples to take at each pixel\nconst NUM_SAMPLES = 17;\n\n// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower\n// miplevel to maintain reasonable spatial locality in the cache\n// If this number is too small (< 3), too many taps will land in the same pixel, and we\'ll get bad variance that manifests as flashing.\n// If it is too high (> 5), we\'ll get bad performance because we\'re not using the MIP levels effectively\nconst LOG_MAX_OFFSET: i32 = 3;\n\n// This must be less than or equal to the MAX_MIP_LEVEL defined in SSAO.cpp\nconst MAX_MIP_LEVEL: i32 = 5;\n\n// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent\n// taps from lining up. This particular choice (5) was tuned for NUM_SAMPLES == 17\n// Here is the table. The one\'s digit is the column, the ten\'s is the row to look at.\n// +0 1 2 3 4 5 6 7 8 9\n// 1, 1, 1, 2, 3, 2, 5, 2, 3, 2, // 00\n// 3, 3, 5, 5, 3, 4, 7, 5, 5, 7, // 10\n// 9, 8, 5, 5, 7, 7, 7, 8, 5, 8, // 20\n// 11, 12, 7, 10, 13, 8, 11, 8, 7, 14, // 30\n// 11, 11, 13, 12, 13, 19, 17, 13, 11, 18, // 40\n// 19, 11, 11, 14, 17, 21, 15, 16, 17, 18, // 50\n// 13, 17, 11, 17, 19, 18, 25, 18, 19, 19, // 60\n// 29, 21, 19, 27, 31, 29, 21, 18, 17, 29, // 70\n// 31, 31, 23, 18, 25, 26, 25, 23, 19, 34, // 80\n// 19, 27, 21, 25, 39, 29, 17, 21, 27, 29}; // 90\n\nconst NUM_SPIRAL_TURNS = 5;\n\nconst MIN_RADIUS = 3.0; // pixels\n\nconst TAU = 6.28318530718;\n\n//////////////////////////////////////////////////\n\n//\n// Uniforms and functions to reconstruct camera-space and world-space positions.\n// in post-processing passes from the (linear) depth texture.\n//\nstruct SAOUniforms {\n\t// vec4 used to reconstruct camera-space positions from screen-space + zValue (from tDepth).\n\t// It is computed from canvas resolution and projection matrix used during scene rendering by:\n\t// (see RenderContext.beginScene)\n\t//\n\t// vec4(-2.0f / (width*P[0][0]),\n\t// -2.0f / (height*P[1][1]),\n\t// ( 1.0f - P[0][2]) / P[0][0],\n\t// ( 1.0f + P[1][2]) / P[1][1])\n\t//\n\t// where P is the projection matrix that maps camera space points\n\t// to [-1, 1] x [-1, 1].\n\tprojInfo: vec4f,\n\n\t/* The height in pixels of a 1m object if viewed from 1m away.\n\t You can compute it from your projection matrix. The actual value is just\n\t a scale factor on radius; you can simply hardcode this to a constant (~500)\n\t and make your radius value unitless (...but resolution dependent.) */\n\tprojScale: f32,\n\n\tcameraNear: f32,\n\tcameraFar: f32,\n\tlumInfluence: f32,// how much luminance affects occlusion\n\n\t/* World-space AO radius in scene units (r). e.g., 1.0m */\n\tradius: f32,\n\t/* Bias to avoid AO in smooth corners, e.g., 0.01m */\n\tbias: f32,\n\tintensity: f32,\n\tisOrtho: i32 // 1 if ortho-camera is used, 0 for perspective\n}\n\n// Negative, "linear" depth values in world-space units\n@group(0) @binding(0) var tNormals: texture_2d<f32>;\n@group(0) @binding(1) var tDepth: texture_2d<f32>;\n@group(0) @binding(2) var<uniform> u: SAOUniforms;\n\n#if $USE_MIPMAP\n\t@group(0) @binding(3) var tDepth_mip: texture_2d<f32>;\n#endif\n\n\n/* intensity / radius^6 */\n//uniform float intensityDivR6;\n//float intensityDivR6 = intensity / pow(radius, 6.0);\n\n/* Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */\nfn tapLocation(sampleNumber: i32, spinAngle: f32) -> vec3f {\n\t// Radius relative to ssR\n\tvar alpha = (f32(sampleNumber) + 0.5) * (1.0 / f32(NUM_SAMPLES));\n\tvar angle = alpha * (f32(NUM_SPIRAL_TURNS) * TAU) + spinAngle;\n\n\treturn vec3f(cos(angle), sin(angle), alpha);\n}\n\n\n/* Used for packing Z into the GB channels */\nfn CSZToKey(z: f32) -> f32 {\n\t// convert from z in camera space to 0-1 space:\n\t// z is a negative value, near and far are positive\n\t// (-z-cameraNear) / (cameraFar-cameraNear)\n\treturn clamp( (z + u.cameraNear) / (u.cameraNear - u.cameraFar), 0.0, 1.0);\n}\n\n\n/* Used for packing Z into the GB channels */\nfn packKey(key: f32) -> vec2f {\n\tvar p: vec2f;\n\n\t// Round to the nearest 1/256.0\n\tvar temp = floor(key * 255.0);\n\n\t// Integer part\n\tp.x = temp * (1.0 / 255.0);\n\n\t// Fractional part\n\tp.y = key * 255.0 - temp;\n\n\treturn p;\n}\n\n//Used to unpack depth value when input depth texture is RGBA8\nfn unpackDepthNearFar( packedDepth: vec3f ) -> f32 {\n\tvar depth = unpackDepth10(packedDepth);\n\tif (depth == 0.0) {\n\t\t//pixel is sky box\n\t\treturn -u.cameraFar * 1.0e10;\n\t}\n\treturn -(depth * (u.cameraFar - u.cameraNear) + u.cameraNear);\n}\n\n/*\n Clipping plane constants for use by reconstructZ\n\n clipInfo = (z_f == -inf()) ? Vector3(z_n, -1.0f, 1.0f) : Vector3(z_n * z_f, z_n - z_f, z_f);\n */\n//"uniform vec3 clipInfo;",\n//"vec3 clipInfo = vec3(cameraNear * cameraFar, cameraNear - cameraFar, cameraFar);",\n\n//"float reconstructCSZ(float d) {",\n// "return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);",\n//"}",\n\n/* Reconstructs screen-space unit normal from screen-space position */\n//vec3 reconstructCSFaceNormal(vec3 C) {\n// return normalize(cross(dFdy(C), dFdx(C)));\n//}\n\n//vec3 reconstructNonUnitCSFaceNormal(vec3 C) {\n// return cross(dFdy(C), dFdx(C));\n//}\n\n\n// Reconstruct camera-space P.xyz from screen-space fragCoords = (x, y) in\n// pixels and camera-space z < 0. Assumes that the upper-left pixel center\n// is at (0.5, 0.5) [but that need not be the location at which the sample tap\n// was placed!]\n//\n// Costs 3 MADD. Error is on the order of 10^3 at the far plane, partly due to z precision.\nfn reconstructCSPosition(fragCoords: vec2f, z: f32) -> vec3f {\n\tvar ndc = (fragCoords * u.projInfo.xy + u.projInfo.zw);\n\n\tif (u.isOrtho != 0) {\n\t\treturn vec3f(ndc * -1.0, z);\n\t} else {\n\t\treturn vec3f(ndc * z, z);\n\t}\n}\n\n/* Read the camera-space position of the point at screen-space pixel ssP */\nfn getPosition(ssP: vec2<i32>, depth: f32) -> vec3f {\n\t// Offset to pixel center\n\tvar P = reconstructCSPosition(vec2f(ssP) + vec2f(0.5), depth);\n\treturn P;\n}\n\n/* Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */\nfn getOffsetPosition(ssC: vec2i, unitOffset: vec2f, ssR: f32) -> vec3f {\n\n\tvar ssP = vec2i(ssR * unitOffset) + ssC;\n\n\tvar z: f32;\n\n\t// We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.\n\t// Manually clamp to the texture size because texelFetch bypasses the texture unit\n\t//"ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), textureSize(CS_Z_buffer, mipLevel) - ivec2(1));",\n\t//"ivec2 mipP = ssP;",\n\t//"P.z = texelFetch(tDepth, mipP, 0).z;",\n\n#if $USE_MIPMAP\n\tvar mipLevel: u32 = u32(clamp(i32(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL));\n\n\tif (mipLevel == 0) {\n\t\tz = unpackDepthNearFar(textureLoad(tDepth, ssP, 0).rgb);\n\t}\n\telse {\n\t\tmipLevel -= 1;\n\t\tvar mipP: vec2i = clamp(ssP >> vec2u(mipLevel + 1), vec2i(0), vec2i(textureDimensions(tDepth_mip, mipLevel)) - vec2i(1));\n\t\tz = unpackDepthNearFar(textureLoad(tDepth_mip, mipP, mipLevel).rgb);\n\t}\n#else\n\tz = unpackDepthNearFar(textureLoad(tDepth, ssP, 0).rgb);\n#endif\n\n\n\t// Offset to pixel center\n\treturn reconstructCSPosition(vec2f(ssP) + vec2f(0.5), z);\n}\n\n/** Compute the occlusion due to sample with index \\a i about the pixel at \\a ssC that corresponds\n to camera-space point \\a C with unit normal \\a n_C, using maximum screen-space sampling radius \\a ssDiskRadius\n\n Note that units of H() in the HPG12 paper are meters, not\n unitless. The whole falloff/sampling function is therefore\n unitless. In this implementation, we factor out (9 / radius).\n\n Four versions of the falloff function are implemented below\n */\nfn sampleAO(ssC: vec2i, C: vec3f, n_C: vec3f, ssDiskRadius: f32, tapIndex: i32, randomPatternRotationAngle: f32) -> f32 {\n\t// Offset on the unit disk, spun for this pixel\n\tvar unitOffset = tapLocation(tapIndex, randomPatternRotationAngle);\n\tvar ssR = unitOffset.z;\n\n\t// Ensure that the taps are at least 1 pixel away\n\tssR = max(0.75, ssR * ssDiskRadius);\n\n\t// The occluding point in camera space\n\tvar Q = getOffsetPosition(ssC, unitOffset.xy, ssR);\n\n\t// aoValueFromPositionsAndNormal() in original code\n\tvar v = Q - C;\n\n\tvar vv = dot(v, v);\n\tvar vn = dot(v, n_C);\n\n\tconst epsilon = 0.001; // was 0.01, but in G3D code it\'s 0.001\n\n\t// Without the angular adjustment term, surfaces seen head-on have less AO\n\tvar angAdjust = mix(1.0, max(0.0, 1.5 * n_C.z), 0.35);\n\n\t// fallOffFunction()\n\t// comment out this line for lower quality function:\n//#define HIGH_QUALITY\n\t// A: From the HPG12 paper\n\t// Note large epsilon to avoid overdarkening within cracks\n\t//"return angAdjust * float(vv < radius * radius) * max((vn - bias) / (epsilon + vv), 0.0) * (radius * radius) * 0.6;",\n\n\t// B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]\n//#ifdef HIGH_QUALITY\n\n\t// Higher quality version:\n\t// Epsilon inside the sqrt for rsqrt operation\n\tvar f = max(1.0 - vv / (u.radius * u.radius), 0.0); return angAdjust * f * max((vn - u.bias) / sqrt(epsilon + vv), 0.0);\n//# else\n\t// Avoid the square root from above.\n\t// Assumes the desired result is intensity/radius^6 in main()\n\t//var f = max(u.radius * u.radius - vv, 0.0); return angAdjust * f * f * f * max((vn - u.bias) / (epsilon + vv), 0.0);\n//# endif\n\n\t// C: Medium contrast (which looks better at high radii), no division. Note that the\n\t// contribution still falls off with radius^2, but we\'ve adjusted the rate in a way that is\n\t// more computationally efficient and happens to be aesthetically pleasing.\n\t//"return angAdjust * 4.0 * max(1.0 - vv / (radius * radius), 0.0) * max(vn - bias, 0.0);",\n\n\t// D: Low contrast, no division operation\n\t//"return angAdjust * 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);",\n}\n\n\n// user variables\n\n\n// random angle in radians between 0 and 2 PI\nfn getRandomAngle(pos: vec2f) -> f32 {\n\t// from http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\n\tvar dt = dot(pos ,vec2f(12.9898,78.233));\n\treturn TAU * fract(sin(dt % 3.14) * 43758.5453);\n}\n\n@fragment fn psmain(\n\t@builtin(position) position: vec4f,\n\t@location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n\n\t// Pixel being shaded\n\tvar ssC = vec2i(floor(position.xy));\n\n\t//get the normal and depth from our normal+depth texture\n\tvar nrmz = textureLoad(tNormals, ssC, 0);\n\tvar depth = unpackDepth10(textureLoad(tDepth, ssC, 0).rgb);\n\n\t//TODO: figure out how to hook this up with a depth test\n\t// Unneccessary with depth test.\n\tif (depth == 0.0) {\n\t\t// We\'re on the skybox\n\t\treturn vec4f(1.0, packKey(1.0), 0.0);\n\t}\n\n\tdepth = -(depth * (u.cameraFar - u.cameraNear) + u.cameraNear);\n\n\tvar output: vec4f;\n\n\t// Camera space point being shaded\n\tvar C = getPosition(ssC, depth);\n\n\tvar outputGB = packKey(CSZToKey(C.z));\n\toutput.g = outputGB.x;\n\toutput.b = outputGB.y;\n\n\t// Choose the screen-space sample radius\n\t// proportional to the projected area of the sphere.\n\t// If orthographic, use 1.0 for the divisor, else use the world-space point\'s Z value.\n\tvar ssDiskRadius = u.projScale * u.radius;\n\tif (u.isOrtho == 0) {\n\t\tssDiskRadius /= -C.z;\n\t}\n\n\tvar A: f32;\n\tif (ssDiskRadius <= MIN_RADIUS) {\n\t\t// There is no way to compute AO at this radius\n\t\tA = 1.0;\n\t} else {\n\n\t\tvar sum = 0.0;\n\n\t\t// Hash function used in the HPG12 AlchemyAO paper\n\t\t//var randomPatternRotationAngle = modXXX(f32((((3 * ssC.x) ^ (ssC.y + ssC.x * ssC.y))) * 10), TAU);\n\t\tvar randomPatternRotationAngle = getRandomAngle(vUv);\n\n\t\t// Reconstruct normals from positions. These will lead to 1-pixel black lines\n\t\t// at depth discontinuities, however the blur will wipe those out so they are not visible\n\t\t// in the final image.\n\t\t//vec3 n_C = reconstructCSFaceNormal(C);\n\t\tvar n_C = unpackNormal10(nrmz.xyz);\n\n\t\tfor (var i = 0; i < NUM_SAMPLES; i++) {\n\t\t\tsum += sampleAO(ssC, C, n_C, ssDiskRadius, i, randomPatternRotationAngle);\n\t\t}\n\n\t\t//var intensityDivR6 = u.intensity / pow(u.radius, 6.0);\n\t\t// high quality:\n\t//#ifdef HIGH_QUALITY\n\t\tA = pow(max(0.0, 1.0 - sqrt(sum * (3.0 / f32(NUM_SAMPLES)))), u.intensity);\n\n\t//# else\n\t\t// lower quality:\n\t\t//A = max(0.0, 1.0 - sum * intensityDivR6 * (5.0 / float(NUM_SAMPLES)));\n\t\t// Use the following line only with the lower quality formula.\n\t\t// Anti-tone map to reduce contrast and drag dark region farther\n\t\t// (x^0.2 + 1.2 * x^4)/2.2\n\t\t//A = (pow(A, 0.2) + 1.2 * A*A*A*A) / 2.2;\n\t//# endif\n\n\t\t// This code has been removed by the creator of the algorithm, see:\n\t\t// http://g3d.cs.williams.edu/websvn/filedetails.php?repname=g3d&path=%2FG3D10%2Fdata-files%2Fshader%2FAmbientOcclusion%2FAmbientOcclusion_AO.pix\n\t\t// In practice it seems to make no difference visually, but matters for\n\t\t// time spent in the benchmark! We see drops on 80 spheres metal and red of 20%. Weird.\n\t\t// So, we\'ll leave it in.\n\t\t// Bilateral box-filter over a quad for free, respecting depth edges\n\t\t// (the difference that this makes is subtle)\n\t\t//"if (abs(dFdx(C.z)) < 0.02) {",\n\t\t// "A -= dFdx(A) * ((ssC.x & 1) - 0.5);",\n\t\t//"}",\n\t\t//"if (abs(dFdy(C.z)) < 0.02) {",\n\t\t// "A -= dFdy(A) * ((ssC.y & 1) - 0.5);",\n\t\t//"}",\n\t\t/*\n\t\tif (abs(dFdx(C.z)) < 0.02) {\n\t\t\tA -= dFdx(A) * (mod(float(ssC.x), 2.0) - 0.5);\n\t\t}\n\t\tif (abs(dFdy(C.z)) < 0.02) {\n\t\t\tA -= dFdy(A) * (mod(float(ssC.y), 2.0) - 0.5);\n\t\t}\n\t\t*/\n\n\t\t// Fade in as the radius reaches 2 pixels\n\t\tA = mix(1.0, A, clamp(ssDiskRadius - MIN_RADIUS,0.0,1.0));\n\t}\n\n\toutput.r = A;\n\toutput.a = 1.0;\n\n\t// to show depths instead of SAO, uncomment:\n\t//output.r = CSZToKey(C.z);\n\t// to show normal component (pick one, x or y):\n\t//output.r = nrmz.y;\n\n\treturn output;\n\n}\n',Ze=!0;const $e="@group(0) @binding(0) var tDepth: texture_2d<f32>;\n\n@fragment\nfn psmain(\n\t@builtin(position) coord : vec4f,\n) -> @location(0) vec4f {\n\n\t// Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.\n\tvar ssP = vec2i(coord.xy);\n\treturn textureLoad(tDepth, clamp(ssP * 2 + vec2i(ssP.y & 1, ssP.x & 1), vec2i(0), vec2i(textureDimensions(tDepth)) - vec2i(1)), 0);\n}\n",Je='/* Increase to make depth edges crisper (though possibly noisier. Decrease to reduce flicker. */\nconst EDGE_SHARPNESS = 3.0;\n\n/* Step in 2-pixel intervals since we already blurred against neighbors in the\n first AO pass. This constant can be increased while R decreases to improve\n performance at the expense of some dithering artifacts.\n\n Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was\n unobjectionable after shading was applied but eliminated most temporal incoherence\n from using small numbers of sample taps.\n */\nconst SCALE = 2;\n\n/* Filter radius in pixels. This will be multiplied by SCALE. */\n// Don\'t change this value, as the loop using it had to be unwound and hardcoded.\nconst R = 4;\n\n//////////////////////////////////////////////////////////////////////////////////////////////\n\n/* Swizzle to use to extract the channels of source. This macro allows\n the same blur shader to be used on different kinds of input data. */\n//#define VALUE_COMPONENTS r\n\n//#define VALUE_IS_KEY 0\n\n/* Channel encoding the bilateral key value (which must not be the same as VALUE_COMPONENTS) */\n//#define KEY_COMPONENTS gb\n\n\n// Gaussian coefficients (must be of length R+1)\nconst gaussian = array<f32, R+1>(\n// float[](0.356642, 0.239400, 0.072410, 0.009869);\n// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0\n0.153170, 0.144893, 0.122649, 0.092902, 0.062970 // stddev = 2.0\n// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0\n);\n\n@id(0) override axisX : i32 = 1;\n\nstruct SAOBlurUniforms {\n\tradius: f32\n}\n\n@group(0) @binding(0) var tAO: texture_2d<f32>;\n@group(0) @binding(1) var<uniform> u: SAOBlurUniforms;\n\n//#define result gl_FragColor.r\n//#define keyPassThrough gl_FragColor.gb\n\n/* Returns a number on (0, 1) */\nfn unpackKey(p: vec2f) -> f32 {\n return p.x + p.y * (1.0 / 255.0);\n}\n\n\n@fragment fn psmain(\n\t@builtin(position) position: vec4f,\n\t@location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n\n\tvar axis = vec2i(axisX, 1 - axisX);\n\tvar output: vec4f;\n\n\tvar ssC = vec2i(floor(position.xy));\n\tvar temp = textureLoad(tAO, ssC, 0);\n\n\toutput.g = temp.g;\n\toutput.b = temp.b;\n\toutput.a = temp.a;\n\n\tvar sum = temp.r;\n\n\tif (temp.a == 0.0) {\n\t\t// Sky pixel (we encoded that flag in the A component in the SAO shader)\n\t\toutput.r = sum;\n\t\treturn output;\n\t}\n\n\tvar key = unpackKey(output.gb);\n\n\t// Base weight for depth falloff. Increase this for more blurriness,\n\t// decrease it for better edge discrimination\n\tvar BASE = gaussian[0];\n\tvar totalWeight = BASE;\n\tsum *= totalWeight;\n\n\tvar scale = 1.5 / u.radius;\n\n\tfor (var r = -R; r <= R; r++) {\n\t\t// We already handled the zero case above. This loop should be unrolled and the static branch optimized out,\n\t\t// so the IF statement has no runtime cost\n\t\tif (r != 0) {\n\t\t\ttemp = textureLoad(tAO, ssC + axis * r * SCALE, 0);\n\n\t\t\tvar tapKey = unpackKey(temp.gb);\n\t\t\tvar value = temp.r;\n\n\t\t\t// spatial domain: offset gaussian tap\n\t\t\tvar weight = 0.3 + gaussian[abs(r)];\n\n\t\t\t// range domain (the "bilateral" weight). As depth difference increases, decrease weight.\n\t\t\tvar dz = tapKey - key;\n\t\t\tweight *= max(0.0, 1.0 - (EDGE_SHARPNESS * 2000.0) * abs(dz) * scale);\n\n\t\t\tsum += value * weight;\n\t\t\ttotalWeight += weight;\n\t\t}\n\t}\n\n\tconst epsilon = 0.0001;\n\toutput.r = sum / (totalWeight + epsilon);\n\n\treturn output;\n}\n';class et extends f.D{constructor(e){super(e,48,!0,!1)}setCamera(e,t,i){let n=e.near,r=e.far;this.setFloat(5,n),this.setFloat(6,r);let o=e.projectionMatrix.elements;e.isPerspective?this.setFloat4(0,-2/(t*o[0]),2/(i*o[5]),(1-o[8])/o[0],-(1+o[9])/o[5]):this.setFloat4(0,-2/(t*o[0]),2/(i*o[5]),(1-o[12])/o[0],-(1-o[13])/o[5]);let s=e.isPerspective?0:1;this.setInt(11,s);let a=i*o[5]*.125;this.setFloat(4,a)}setAOOptions(e,t,i){void 0!==e&&this.setFloat(8,e),void 0!==t&&this.setFloat(9,t),void 0!==i&&this.setFloat(10,i)}}class tt extends f.D{constructor(e){super(e,16,!0,!1)}setRadius(e){this.setFloat(0,e),this.upload()}}function it(){return{binding:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,visibility:arguments.length>1&&void 0!==arguments[1]?arguments[1]:GPUShaderStage.FRAGMENT,texture:{sampleType:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unfilterable-float"}}}function nt(){return{binding:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,visibility:arguments.length>1&&void 0!==arguments[1]?arguments[1]:GPUShaderStage.FRAGMENT,buffer:{}}}const rt={topology:"triangle-list",cullMode:"back"},ot=5;function st(e){let t,i,n,r,o,s,a,l,c,u,f,p,m,g,v,y,b,x,_,E,S,A,w,T=e;this.init=function(){t=e.getDevice(),n=new et(t),n.setAOOptions(8,.01,1),u=new tt(t),u.setRadius(8);const i=t.createShaderModule({code:h}),r=t.createShaderModule({label:"sao mip shader",code:$e}),o=t.createShaderModule({code:Je}),s=T.getRenderTargets().getPreferredFormat();"bgra8unorm"!==s&&"rgba8unorm"!==s&&console.warn("post-processing render target format",s,"may not work with SSAO"),a=t.createBindGroupLayout({label:"sao bind group layout",entries:[it(0),it(1),nt(2),it(3)]}),y=t.createBindGroupLayout({label:"sao mip bind group layout",entries:[it(0)]}),f=t.createBindGroupLayout({entries:[it(0),nt(1)]}),l=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[a]}),vertex:{module:i,entryPoint:"mainFlipY"},fragment:{module:t.createShaderModule({code:(0,d.$wgsl)(Qe,{pack_depth:Y,USE_MIPMAP:Ze})}),entryPoint:"psmain",targets:[{format:s}]},primitive:rt}),x=t.createRenderPipeline({label:"sao mip pipeline",layout:t.createPipelineLayout({bindGroupLayouts:[y]}),vertex:{module:i,entryPoint:"mainFlipY"},fragment:{module:r,entryPoint:"psmain",targets:[{format:"rgb10a2unorm"}]},primitive:rt}),g=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[f]}),vertex:{module:i,entryPoint:"mainFlipY"},fragment:{module:o,entryPoint:"psmain",targets:[{format:s}],constants:{0:1}},primitive:rt}),v=t.createRenderPipeline({layout:t.createPipelineLayout({bindGroupLayouts:[f]}),vertex:{module:i,entryPoint:"mainFlipY"},fragment:{module:o,entryPoint:"psmain",targets:[{format:s}],constants:{0:0}},primitive:rt}),c={colorAttachments:[{view:void 0,clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]}},this.cleanup=function(){var e;null===(e=i)||void 0===e||e.destroy()},this.setAOOptions=function(e,t,i){n.setAOOptions(e,t,i),u.setRadius(e)},this.setUnitScale=function(e){},this.resize=function(e,l){r=e,o=l;const c=T.getRenderTargets();i&&i.destroy(),_&&_.destroy(),i=t.createTexture({size:[e,l],format:c.getPreferredFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),A=i.createView(),w=c.getPostTarget(0).createView();const h=c.getViewDepthTarget().createView();E=null,S=[],b=[];const d=Math.min(ot,Math.min(Math.floor(Math.log2(e)),Math.floor(Math.log2(l)))),g=0|e/2,v=0|l/2;g>=1&&v>=1&&(_=t.createTexture({label:"saoMipTarget",size:[g,v],format:"rgb10a2unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,mipLevelCount:d}),E=_.createView({baseMipLevel:0,mipLevelCount:d}));for(let e=0;e<d;e++){const i=_.createView({baseMipLevel:e,mipLevelCount:1});S.push(i),b.push(t.createBindGroup({label:"saoMipBindGroup "+e,layout:y,entries:[{binding:0,resource:0===e?h:S[e-1]}]}))}s=t.createBindGroup({label:"sao bind group",layout:a,entries:[{binding:0,resource:c.getNormalsTarget().createView()},{binding:1,resource:h},{binding:2,resource:{buffer:n.getBuffer()}},{binding:3,resource:E}]}),p=t.createBindGroup({layout:f,entries:[{binding:0,resource:A},{binding:1,resource:{buffer:u.getBuffer()}}]}),m=t.createBindGroup({layout:f,entries:[{binding:0,resource:w},{binding:1,resource:{buffer:u.getBuffer()}}]})},this.getTargetView=function(){return i.createView()},this.run=function(e){if(!t)return;n.setCamera(e,r,o),n.upload();const i=t.createCommandEncoder();let a;if(_&&S.length)for(let e=0;e<S.length;e++)c.colorAttachments[0].view=S[e],a=i.beginRenderPass(c),a.setPipeline(x),a.setBindGroup(0,b[e]),a.draw(3),a.end();c.colorAttachments[0].view=A,a=i.beginRenderPass(c),a.setPipeline(l),a.setBindGroup(0,s),a.draw(3),a.end(),c.colorAttachments[0].view=w,a=i.beginRenderPass(c),a.setPipeline(g),a.setBindGroup(0,p),a.draw(3),a.end(),c.colorAttachments[0].view=A,a=i.beginRenderPass(c),a.setPipeline(v),a.setBindGroup(0,m),a.draw(3),a.end(),t.queue.submit([i.finish()])}}var at=i(4897),lt=i(15371),ct=i(68747);const ht="// Contains either the H/V texture or the main/color target, depending on the pipeline\n@group($bindGroup) @binding(0) var map: texture_2d<f32>;\n@group($bindGroup) @binding(1) var smpl: sampler;\n";function ut(e){return(0,d.$wgsl)(ht,{bindGroup:e})}function dt(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"ground shadow texture bind group";return e.createBindGroup({label:r,layout:t,entries:[{binding:0,resource:n},{binding:1,resource:i}]})}function ft(e,t){return(0,d.$wgsl)("$pack_depth\n$groundShadowTexture\n\nconst PI: f32 = 3.14159265358979;\n@id(0) override KERNEL_SCALE: f32;\n@id(1) override KERNEL_RADIUS: f32;\noverride SIGMA: f32 = (2.0 * KERNEL_RADIUS + 1.0) / 6.0;\noverride SIGMASQ2: f32 = 2.0 * SIGMA * SIGMA;\noverride QUOTIENT: f32 = sqrt(PI * SIGMASQ2);\n\n#if $horizontal\n fn getUv(vUv: vec2f, x: f32) -> vec2f {\n\t\treturn vec2f(vUv.x + KERNEL_SCALE * x, vUv.y);\n\t}\n#else\n fn getUv(vUv: vec2f, y: f32) -> vec2f {\n return vec2f(vUv.x, vUv.y + KERNEL_SCALE * y);\n }\n#endif\n\nfn kernelVal(x: f32) -> f32 {\n return (1.0 / QUOTIENT) * exp(-x * x / SIGMASQ2);\n}\n\n@fragment\nfn psmain(\n @builtin(position) coord: vec4f,\n @location(0) @interpolate(linear) vUv: vec2f\n) -> @location(0) vec4f {\n var depthVal: f32 = 0.0;\n var sum: f32 = 0.0;\n var kVal: f32;\n\n for (var x = -KERNEL_RADIUS; x <= KERNEL_RADIUS; x += 1.0) {\n kVal = kernelVal(x);\n depthVal += unpackDepth(textureSample(map, smpl, getUv(vUv, x))) * kVal;\n sum += kVal;\n }\n\n return packDepth(depthVal / sum);\n}\n",{pack_depth:Y,groundShadowTexture:ut(t),horizontal:e})}class pt{#rt;#et;#Bn={ibl:0,camera:1,object:2};#En=[];#kn=[];#Mt=new Map;#qi;#Qi;#Vn={};constructor(e,t,i,n,r){this.#rt=e,this.#et=e.getDevice();for(let e in this.#Bn)switch(e){case"ibl":this.#En[this.#Bn[e]]=t;break;case"camera":this.#En[this.#Bn[e]]=i;break;case"object":this.#En[this.#Bn[e]]=n}this.#kn.push({format:r})}getBindGroupOrder(){return this.#Bn}getPipeline(e){const t=se(e,this.#Vn,0,!1,!1,!1);let i=this.#Mt.get(t);if(i)return i;const n=this.#et.createShaderModule({label:"ground shadow shader",code:(r=this.#Bn.ibl,o=this.#Bn.camera,s=this.#Bn.object,(0,d.$wgsl)("// We don't need IBL here, but this is where cut planes are currently implemented\n$IBL\n$cameraUniforms\n$objectUniforms\n$pack_depth\n\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) vWorldPosition: vec3f,\n //@location(1) @interpolate(flat) doNotCut: u32\n}\n\n@vertex fn vsmain(\n @location(0) position: vec3f,\n @builtin(instance_index) instance: u32\n) -> VertexOutput {\n\n var objectUniforms = getObjectUniforms(instance);\n\n var output: VertexOutput;\n\n var pos4 = vec4f(position.x, position.y, position.z, 1.0);\n var mvMatrix = uniforms.viewMatrix * objectUniforms.modelMatrix;\n var mvPosition = mvMatrix * pos4;\n\n output.position = uniforms.projectionMatrix * mvPosition;\n output.vWorldPosition = (objectUniforms.modelMatrix * pos4).xyz;\n\n return output;\n}\n\n@fragment fn psmain(\n in: VertexOutput\n) -> @location(0) vec4f {\n // if (in.doNotCut == 0) {\n checkCutPlanes(in.vWorldPosition);\n // }\n\n var depth = 1.0 - in.position.z / in.position.w;\n\n return packDepth(depth);\n}\n",{IBL:Q(r),cameraUniforms:te(o),objectUniforms:G(s),pack_depth:Y}))});var r,o,s;const a={label:"ground shadow pipeline",layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#En}),vertex:{module:n,entryPoint:"vsmain",buffers:ae(e,!1,!1,!1)},fragment:{module:n,entryPoint:"psmain",targets:this.#kn},primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:x,depthBias:1,depthBiasSlopeScale:1}};return e.isLines?a.primitive.topology="line-list":a.primitive.topology="triangle-list",i=this.#et.createRenderPipeline(a),this.#Mt.set(t,i),i}reset(){this.#qi=null,this.#Qi=this.#rt.getVB()}drawOne(e,t,i){const n=this.getPipeline(i);n!==this.#qi&&(e.setPipeline(n),this.#qi=n),this.#Qi.draw(e,i,t)}}class mt{#rt;#et;#Gn;#Bn={camera:0,texture:1};#En=[];#kn=[];constructor(e,t,i,n,r){this.#rt=e,this.#et=e.getDevice();for(let e in this.#Bn)switch(e){case"camera":this.#En[this.#Bn[e]]=t;break;case"texture":this.#En[this.#Bn[e]]=i}this.#kn.push({format:n,blend:_});const o=this.#et.createShaderModule({label:"ground shadow color shader",code:(s=this.#Bn.camera,a=this.#Bn.texture,(0,d.$wgsl)("$cameraUniforms\n$groundShadowTexture\n$pack_depth\n\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) vUv: vec2f\n}\n\n@vertex fn vsmain(\n @location(0) position: vec3f,\n @location(1) uv: vec2f,\n @builtin(instance_index) instance: u32\n) -> VertexOutput {\n\n var output: VertexOutput;\n\n var pos4 = vec4f(position.x, position.y, position.z, 1.0);\n var mvPosition = uniforms.viewMatrix * pos4;\n\n output.position = uniforms.projectionMatrix * mvPosition;\n output.vUv = uv;\n\n return output;\n}\n\n@fragment fn psmain(\n in: VertexOutput\n) -> @location(0) vec4f {\n var depthVal = unpackDepth(textureSample(map, smpl, in.vUv));\n var shadowColor = vec4f(0, 0, 0, 1);\n\n return vec4f(shadowColor.rgb, shadowColor.a * depthVal);\n}\n",{cameraUniforms:te(s),groundShadowTexture:ut(a),pack_depth:Y}))});var s,a;this.#Gn=this.#et.createRenderPipeline({label:"ground shadow color pipeline",layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#En}),vertex:{module:o,entryPoint:"vsmain",buffers:[{arrayStride:4*r,attributes:[{shaderLocation:0,offset:0,format:"float32x3"},{shaderLocation:1,offset:12,format:"float32x2"}]}]},fragment:{module:o,entryPoint:"psmain",targets:this.#kn},primitive:{cullMode:"back",topology:"triangle-list"},depthStencil:{depthWriteEnabled:!1,depthCompare:"less",format:x,depthBias:0,depthBiasSlopeScale:0}})}getPipeline(){return this.#Gn}getBindGroupOrder(){return this.#Bn}}class gt{#rt;#et;#Gn;#zn;#Hn;#Wn;#Bn={texture:0};#En=[];#kn=[];constructor(e,t,i,n,r,o){this.#rt=e,this.#et=e.getDevice(),this.#zn=n,this.#Hn=r,this.#Wn=o;for(let e in this.#Bn)if("texture"===e)this.#En[this.#Bn[e]]=t;this.#kn.push({format:i});const s=this.#et.createShaderModule({label:"ground shadow blur vertex shader",code:h}),a=this.#et.createShaderModule({label:"ground shadow blur fragment shader",code:ft(this.#zn,this.#Bn.texture)});this.#Gn=this.#et.createRenderPipeline({label:"ground shadow blur pipeline",layout:this.#et.createPipelineLayout({bindGroupLayouts:this.#En}),vertex:{module:s,entryPoint:"mainFlipY"},fragment:{module:a,entryPoint:"psmain",targets:this.#kn,constants:{0:this.#Hn,1:this.#Wn}},primitive:{cullMode:"back",topology:"triangle-list"}})}getPipeline(){return this.#Gn}getBindGroupOrder(){return this.#Bn}}class vt{#rt;#et;#jn=64;#qn=1;#Xn=7;#Yn;#Kn;#at;#Qn;#Zn;#$n;#Jn;#fn;#Ft;#er;#tr;#ir;#nr;#rr;#rn;#or;#sr;#ar;#lr;#cr;#hr;#ur;#dr=new Float32Array(20);#fr;#pr=new Uint16Array(6);#mr=new qe.LmvVector3;#gr=new THREE.Quaternion;#vr=new THREE.Euler;#yr=new qe.LmvVector3(1,1,1);#We=new THREE.OrthographicCamera;#br=new at.FrustumIntersector;#xr=!0;#_r=lt.GroundFlags.GROUND_FINISHED;#Er=!1;#Sr=new qe.LmvVector3(0,0,0);#Ar=new qe.LmvVector3(0,0,0);#wr=new qe.LmvVector3(0,0,0);#Tr=new qe.LmvVector3(0,0,0);#le=new THREE.Box3;#Mr=[];#Cr;#Pr=0;#Dr=0;#Lr=0;constructor(e){this.#rt=e,this.enabled=!1}init(e){this.#et=this.#rt.getDevice(),this.#fn=new ne(this.#et),this.#Ft=e,this.#ar=this.#et.createBindGroupLayout({label:"ground shadow texture bind group layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}}]}),this.#Ir(),this.#er=new pt(this.#rt,this.#rt.getIBL().getLayout(),this.#fn.getLayout(),this.#Ft.getLayout(!1),this.#Yn.format),this.#tr=new mt(this.#rt,this.#fn.getLayout(),this.#ar,navigator.gpu.getPreferredCanvasFormat(),5),this.#nr=new gt(this.#rt,this.#ar,this.#Kn.format,!1,(this.#qn/this.#jn).toFixed(4),this.#Xn.toFixed(2)),this.#ir=new gt(this.#rt,this.#ar,this.#Yn.format,!0,(this.#qn/this.#jn).toFixed(4),this.#Xn.toFixed(2)),this.#Rr(),this.setTransform(new qe.LmvVector3(0,0,0),new qe.LmvVector3(1,1,1),new qe.LmvVector3(0,1,0),new qe.LmvVector3(0,1,0))}#Ir(){this.#Yn=this.#et.createTexture({label:"ground shadow h texture",size:{width:this.#jn,height:this.#jn},format:navigator.gpu.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),this.#Qn=this.#Yn.createView({label:"ground shadow h texture view"}),this.#Kn=this.#et.createTexture({label:"ground shadow v texture",size:[this.#jn,this.#jn],format:navigator.gpu.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),this.#Zn=this.#Kn.createView({label:"ground shadow v texture view"}),this.#at=this.#et.createTexture({size:[this.#jn,this.#jn],format:x,usage:GPUTextureUsage.RENDER_ATTACHMENT}),this.#$n=this.#at.createView(),this.#Jn=this.#et.createSampler({label:"ground shadow texture sampler",magFilter:"linear",minFilter:"linear"}),this.#rn={label:"ground shadow clear pass descriptor",colorAttachments:[{view:this.#Qn,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},{view:this.#Zn,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.#$n,depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}},this.#rr={label:"ground shadow pass descriptor",colorAttachments:[{view:this.#Qn,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:this.#$n,depthLoadOp:"load",depthStoreOp:"store"}},this.#sr={label:"ground shadow color pass descriptor",colorAttachments:[{loadOp:"load",storeOp:"store"}],depthStencilAttachment:{depthLoadOp:"load",depthStoreOp:"store"}},this.#or={label:"ground shadow blur pass descriptor",colorAttachments:[{loadOp:"load",storeOp:"store"}]},this.#hr=dt(this.#et,this.#ar,this.#Jn,this.#Qn,"ground shadow color texture bind group"),this.#lr=dt(this.#et,this.#ar,this.#Jn,this.#Zn,"ground shadow blur h texture bind group"),this.#cr=dt(this.#et,this.#ar,this.#Jn,this.#Qn,"ground shadow blur v texture bind group"),this.#ur=this.#et.createBuffer({label:"ground shadow plane buffer",size:this.#dr.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.#fr=this.#et.createBuffer({label:"ground shadow plane index buffer",size:this.#pr.byteLength,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST})}#Rr(){this.#dr.set([-.5,.5,0,0,0,.5,.5,0,1,0,-.5,-.5,0,0,1,.5,-.5,0,1,1]),this.#pr.set([1,3,2,1,2,0])}#Or(e,t,i,n){const r=new w.LmvMatrix4(!1),o=new qe.LmvVector3,s=new qe.LmvVector3;o.subVectors(e,i),r.lookAt(o,e,n),s.copy(i).multiplyScalar(-.5*t.y).add(e),this.#mr.copy(s),this.#vr.setFromRotationMatrix(r),this.#gr.setFromEuler(this.#vr,!1),this.#yr.set(t.z,t.x,t.y),r.compose(this.#mr,this.#gr,this.#yr);for(let e=0;e<4;++e)o.set(this.#dr[5*e],this.#dr[5*e+1],this.#dr[5*e+2]),o.applyMatrix4(r),this.#dr[5*e]=o.x,this.#dr[5*e+1]=o.y,this.#dr[5*e+2]=o.z}setTransform(e,t,i,n){e.equals(this.#Sr)&&t.equals(this.#Ar)&&i.equals(this.#wr)&&n.equals(this.#Tr)||(this.setDirty(),this.#Sr.copy(e),this.#Ar.copy(t),this.#wr.copy(i),this.#Tr.copy(n),this.#We.left=-t.z/2,this.#We.right=t.z/2,this.#We.top=t.x/2,this.#We.bottom=-t.x/2,this.#We.near=1,this.#We.far=t.y+this.#We.near,this.#We.updateProjectionMatrix(),this.#Rr(),this.#Or(e,t,i,n),this.#We.position.addVectors(e,i.clone().multiplyScalar(-t.y/2-this.#We.near)),n&&this.#We.up.set(n.x,n.y,n.z),this.#We.lookAt(e),this.#We.orthoScale=t.x,this.#We.clientHeight=this.#jn,this.#br.reset(this.#We),this.#br.areaCullThreshold=2)}#Nr(){this.#fn.update(this.#We),this.#rt.getIBL().update()}#Dn(e){const t=e.finish();this.#et.queue.submit([t])}#Fr(e,t){if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e[i]!=t[i])return!0;return!1}#Ur(e){if(e.edgesOnly)return;e.forEachNoMesh((t=>{e.frags.getWorldBounds(t,this.#le);const i=e.frags.vizflags[t]&ct.MeshFlags.MESH_VISIBLE,n=this.#br.estimateProjectedDiameter(this.#le)<this.#br.areaCullThreshold;e.frags.setFlagFragment(t,ct.MeshFlags.MESH_RENDERFLAG,i&&!n)})),e.forceVisible=!1;const t=this.#et.createCommandEncoder({label:"ground shadow encoder"}),i=t.beginRenderPass(this.#rr),n=this.#er.getBindGroupOrder(),r=e.frags.modelId,o=e.start;let s;i.setBindGroup(n.ibl,this.#rt.getIBL().getBindGroup()),i.setBindGroup(n.camera,this.#fn.getBindGroup()),i.setBindGroup(n.object,this.#Ft.getBindGroup(r,o)),this.#er.reset(),this.#Ft.resetUpdateHeuristic(r),e.uniformsNeedUpdate&&(this.#Ft.updateBatch(e),e.uniformsNeedUpdate=!1),e.forEachWGPU(0,this.#Ft.MAX_BATCH,((e,t,n)=>{s=this.#Ft.getRenderIndex(n),this.#er.drawOne(i,s,e)})),i.end(),this.#Dn(t)}prepareGroundShadow(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!this.enabled||e.isEmpty())return this.#_r=lt.GroundFlags.GROUND_FINISHED,i;const r=e.getGeomScenesPerModel();if(this.#xr=this.#Fr(this.#Mr,r)||this.#xr,this.#xr)this.clear(),this.#xr=!1,this.#Nr(),this.#Mr=r,this.#Cr=e.getGeomScenes(),this.#Pr=this.#Cr.length,this.#Dr=0,this.#Lr=t?Math.max(Math.ceil(this.#Pr/100),t):this.#Pr;else{if(this.#_r===lt.GroundFlags.GROUND_RENDERED||this.#_r===lt.GroundFlags.GROUND_FINISHED)return this.#_r=lt.GroundFlags.GROUND_FINISHED,i;0===t&&(this.#Lr=this.#Pr)}let o,s,a;i&&(o=performance.now(),s=n*i);let l=0;for(;l<this.#Lr&&this.#Dr<this.#Pr;){const e=this.#Cr[this.#Dr++];if(!e)continue;if(!(e.getBoundingBox&&this.#br.estimateProjectedDiameter(e.getBoundingBox())<this.#br.areaCullThreshold)&&(l++,e.forceVisible=!0,this.#Ur(e),e.forceVisible=!1,i)){const e=performance.now()-o;if(s<e){this.#_r=lt.GroundFlags.GROUND_UNFINISHED,a=i-e;break}}}return this.#Dr<this.#Pr&&(this.#_r=lt.GroundFlags.GROUND_UNFINISHED,a=i?i-performance.now()+o:1),void 0!==a?a:(this.#Br(),this.#_r=lt.GroundFlags.GROUND_RENDERED,i?i-performance.now()+o:1)}#kr(e,t){const i=this.#et.createCommandEncoder({label:"ground shadow blur encoder"}),n=i.beginRenderPass(this.#or),r=e.getBindGroupOrder();n.setBindGroup(r.texture,t),n.setPipeline(e.getPipeline()),n.draw(3),n.end(),this.#et.queue.submit([i.finish()])}#Br(){this.#or.colorAttachments[0].view=this.#Zn,this.#kr(this.#nr,this.#cr),this.#or.colorAttachments[0].view=this.#Qn,this.#kr(this.#ir,this.#lr),this.#Er=!0}renderShadow(e){if(!this.#Er)return;this.#fn.update(e),this.#et.queue.writeBuffer(this.#ur,0,this.#dr),this.#et.queue.writeBuffer(this.#fr,0,this.#pr);const t=this.#et.createCommandEncoder({label:"ground shadow color encoder"});this.#sr.colorAttachments[0].view=this.#rt.getRenderTargets().getColorTargetView(),this.#sr.depthStencilAttachment.view=this.#rt.getRenderTargets().getDepthTarget().createView();const i=t.beginRenderPass(this.#sr),n=this.#tr.getBindGroupOrder();i.setBindGroup(n.camera,this.#fn.getBindGroup()),i.setBindGroup(n.texture,this.#hr),i.setVertexBuffer(0,this.#ur),i.setIndexBuffer(this.#fr,"uint16"),i.setPipeline(this.#tr.getPipeline()),i.drawIndexed(this.#pr.length,1,0,0,0),i.end(),this.#et.queue.submit([t.finish()])}clear(){if(!this.enabled)return;const e=this.#et.createCommandEncoder({label:"ground shadow clear encoder"});e.beginRenderPass(this.#rn).end(),this.#et.queue.submit([e.finish()]),this.#Er=!1}setDirty(){this.#xr=!0,this.#_r=lt.GroundFlags.GROUND_UNFINISHED}getStatus(){return this.#_r}}const yt={WEBGPU_DEVICE_LOST:"webgpudevicelost",WEBGPU_INIT_FAILED:"webgpuinitfailed",WEBGPU_RENDER_DONE:"webgpurenderdone"},bt=3;function xt(e,t){let i,n,r,o,s,a,l,h,u=e,d=[],f=new Set,p=new Map,m=new Map,g=new E(this),v=new ze(this),y=new b(this),x=new We(this),_=new Ke(this),S=new st(this),A=new vt(this);function w(e,t){this.visibilityDirty||(this.visibilityDirty=!0,t.invalidateRenderBundles(e))}n=t.canvas||document.createElement("canvas"),i=n.getContext("webgpu"),o=t.pixelRatio,this.context=i,Autodesk.Viewing.EventDispatcher.prototype.apply(this),B=e=>{const t=e.target;(t.__gpuUniformsMask&R.TEXTURE_MASK)!==F(t)&&this.invalidateRenderBundles()},this.initSync=function(e,t){l=new X(this),a=navigator.gpu.getPreferredCanvasFormat(),i.configure({device:u,format:a,alphaMode:"premultiplied"}),r=!0,function(){let e=u.createTexture({dimension:"2d",format:"bgra8unorm",size:[4,4],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST}),t=e.createView(),i=u.createSampler({addressModeU:"repeat",addressModeV:"repeat"});h={texture:e,sampler:i,view:t};const n=new Uint32Array(16),r=4294967295,o=4294901760;n[0]=o,n[1]=r,n[2]=r,n[3]=o,n[4]=o,n[5]=r,n[6]=o,n[7]=o,n[8]=o,n[9]=o,n[10]=r,n[11]=o,n[12]=r,n[13]=r,n[14]=o,n[15]=r,u.queue.writeTexture({texture:e},n,{offset:0,bytesPerRow:16},[4,4])}(),s=new c(this),g.init(),v.init(l),S.init(),y.init(),A.init(l),this.setSize(e,t),x.init(),_.init(),u.lost.then((e=>{console.error(`WebGPU device was lost: ${e.message}`),u=null,this.fireEvent({type:yt.WEBGPU_DEVICE_LOST})}))},this.clearModelVisibilityDirty=function(e){m.get(e).visibilityDirty=!1},this.addModel=function(e){f.add(e),l.addModel(e);const t={visibilityDirty:!1},i=w.bind(t,e,this);t.callback=i,e.getFragmentList().registerVisibilityDirtyCallback(i),m.set(e.id,t)},this.removeModel=function(e){f.delete(e),l.removeModel(e);const t=m.get(e.id).callback;e.getFragmentList().removeVisibilityDirtyCallback(t),m.delete(e.id),this.invalidateRenderBundles(e);const i=e.getIterator().getGeomScenes();for(const e of i)e&&(e.isComplete=!1,e.useRenderBundles=!1)},this.getPixelRatio=function(){var e;return o||(null===(e=window)||void 0===e?void 0:e.devicePixelRatio)||1},this.setPixelRatio=function(e){o=e},this.setSize=function(e,t,i){n.width=e*this.getPixelRatio(),n.height=t*this.getPixelRatio(),!1!==i&&(n.style.width=e+"px",n.style.height=t+"px"),g.resize(n.width,n.height),v.resize(n.width,n.height),S.resize(n.width,n.height),y.resize(n.width,n.height)},this.renderBackground=function(e){e&&_.hasCubeMap()?_.run():x.run()},this.present=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(r){if(n){const t=g.getPostTarget(1);y.run(t.createView(),e),n.run(i.getCurrentTexture(),t)}else y.run(i.getCurrentTexture().createView(),e);t&&u.queue.onSubmittedWorkDone().then((()=>{this.fireEvent({type:yt.WEBGPU_RENDER_DONE})}))}else this.fireEvent({type:yt.WEBGPU_RENDER_DONE})},this.beginScene=function(e,t){r&&(p.clear(),v.beginScene(e,t))},this.renderScenePart=function(e,t){if(!r)return;const i=v.renderScenePart(e,t);i&&(d.push(i),d.length>=bt&&(u.queue.submit(d),d.length=0))},this.renderOverlay=function(e,t,i,n,o,s,a){r&&v.renderOverlay(e,t,i,n,o,s,a)},this.flushCommandQueue=function(){d.length&&(u.queue.submit(d),d.length=0)},this.getDevice=function(){return u},this.getRenderTargets=function(){return g},this.getVB=function(){return s},this.getGradientPass=function(){return x},this.getEnvMapPass=function(){return _},this.getIBL=function(){return v.getIBL()},this.getSAO=function(){return S},this.getMainPass=function(){return v},this.getGroundShadowPass=function(){return A},this.getBlendSettings=function(){return y.getBlendSettings()},this.setRenderTarget=function(e){},this.clearTarget=function(e){},this.clearMainTargets=function(){r&&v.clearMainTargets()},this.clearOverlayTargets=function(){r&&v.clearOverlayTargets()},this.clear=function(){},this.depthFunc=function(){},this.updateTimestamp=function(e){},this.getMaxAnisotropy=function(){return 16},this.supportsMRT=function(){return!0},this.verifyMRTWorks=function(){return!0},this.cleanup=function(){},this.getPlaceholderTexture=function(){return h},this.stats=function(){s.stats()},this.setLineStyleBuffer=function(e,t){v.setLineStyleBuffer(e,t)},this.invalidateRenderBundles=function(e){let t;t=e?[e]:f,t.forEach((e=>{if(!p.has(e.id)){const t=e.getIterator().getGeomScenes();for(const e of t)e&&e.clearRenderBundles();p.set(e.id)}}))},this.getContext=function(){return this.context}}xt.Events=yt},26027:(e,t,i)=>{"use strict";i.d(t,{eY:()=>a,el:()=>h,i1:()=>l,rL:()=>c});var n=i(82116),r=i(99315);function o(e,t){if(e.width<=t&&e.height<=t)return e;if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var i=t/Math.max(e.width,e.height),n=Math.max(Math.floor(e.width*i),1),r=Math.max(Math.floor(e.height*i),1),o=document.createElement("canvas");return o.width=n,o.height=r,o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n,r),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}function s(e,t){return e.createSampler({addressModeU:(0,n.X9)(t.wrapS),addressModeV:(0,n.X9)(t.wrapT),magFilter:(0,n.X9)(t.magFilter),minFilter:(0,n.X9)(t.minFilter),mipmapFilter:(0,n.X9)(t.minFilter,!0),maxAnisotropy:t.anisotropy||1})}function a(e,t){if(6!==(null==t?void 0:t.image.length))return;if(!0!==t.needsUpdate)return;let i=t instanceof THREE.CompressedTexture,r=t.image[0]instanceof THREE.DataTexture,a=[];for(let n=0;n<6;n++)a[n]=i||r?r?t.image[n].image:t.image[n]:o(t.image[n],e.limits.maxTextureDimension2D||8192);var l;t.__gpuTextureCube||(t.addEventListener("dispose",(()=>{var e;null===(e=t.__gpuTextureCube)||void 0===e||e.destroy(),t.__gpuTextureCube=null,t.__gpuSampler=null})),t.__gpuTextureCube=e.createTexture({dimension:"2d",format:(0,n.L0)(t.format,t.type),mipLevelCount:(null===(l=a[0].mipmaps)||void 0===l?void 0:l.length)||1,size:[a[0].width,a[0].height,6],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST}),t.__gpuSampler=s(e,t));for(let n=0;n<6;n++)if(i){let i=a[n].mipmaps;for(let r=0,o=i.length;r<o;r++){let o=i[r];e.queue.writeTexture({texture:t.__gpuTextureCube,origin:[0,0,n],mipLevel:r},o.data,{offset:0,bytesPerRow:o.data.byteLength/o.height},[o.width,o.height])}}else r?e.queue.writeTexture({texture:t.__gpuTextureCube,origin:[0,0,n]},a[n].data,{offset:0,bytesPerRow:a[n].data.byteLength/a[n].height},[a[n].width,a[n].height]):e.queue.copyExternalImageToTexture({source:a[n],flipY:!!t.flipY},{texture:t.__gpuTextureCube,origin:[0,0,n]},[a[n].width,a[n].height]);t.needsUpdate=!1,t.onUpdate&&t.onUpdate()}function l(e,t,i){var a;if(!0!==i.needsUpdate)return;let l=i instanceof THREE.CompressedTexture,c=i.image[0]instanceof THREE.DataTexture;l||c||(i.image=o(i.image,e.limits.maxTextureDimension2D||8192));const h=(0,r.J)(i.image);let u={dimension:"2d",format:(0,n.L0)(i.format,i.type),mipLevelCount:(null===(a=i.mipmaps)||void 0===a?void 0:a.length)||h,size:[i.image.width,i.image.height],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT};i.__gpuTexture||(i.addEventListener("dispose",(()=>{var e;null===(e=i.__gpuTexture)||void 0===e||e.destroy(),i.__gpuTexture=null,i.__gpuSampler=null})),i.__gpuTexture=e.createTexture(u),i.__gpuSampler=s(e,i));let d=i.image,f=i.mipmaps;if(c||l)if(f.length>0){for(let t=0,n=f.length;t<n;t++){let n=f[t];e.queue.writeTexture({texture:i.__gpuTexture,origin:[0,0],mipLevel:t},n.data,{offset:0,bytesPerRow:n.data.byteLength/n.height},[n.width,n.height])}i.generateMipmaps=!1}else e.queue.writeTexture({texture:i.__gpuTextureCube,origin:[0,0]},d.data,{offset:0,bytesPerRow:d.data.byteLength/d.height},[d.width,d.height]);else if(f.length>0){for(let t=0,n=f.length;t<n;t++){let n=f[t];e.queue.copyExternalImageToTexture({source:n,flipY:!!i.flipY},{texture:i.__gpuTexture,mipLevel:t,premultipliedAlpha:!!i.premultiplyAlpha},[n.width,n.height])}i.generateMipmaps=!1}else e.queue.copyExternalImageToTexture({source:d,flipY:!!i.flipY},{texture:i.__gpuTexture},[d.width,d.height]);i.generateMipmaps&&(t.generateMipmaps(i,u),i.generateMipmaps=!1),i.needsUpdate=!1,i.onUpdate&&i.onUpdate()}function c(e){e instanceof THREE.Texture&&(e.__refCount=(e.__refCount||0)+1)}function h(e){e instanceof THREE.Texture&&Number.isFinite(e.__refCount)&&(e.__refCount<1&&console.warning("Texture was unreferenced more times than referenced."),e.__refCount--,e.__refCount<1&&e.dispose())}},19698:(e,t,i)=>{"use strict";i.d(t,{D:()=>n});class n{#et;#Vr;#Gr;#zr;#Dt;#Lt;#Hr;#Wr=!1;constructor(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.#et=e;let r=t,o=t%4;o&&(r+=4-o),this.#Vr=new Float32Array(r),this.#Gr=new Int32Array(this.#Vr.buffer);let s=0;i&&(s|=GPUShaderStage.FRAGMENT),n&&(s|=GPUShaderStage.VERTEX),this.#Hr=s,this.#et&&this.#Ir()}#Ir(){this.#zr||(this.#zr=this.#et.createBuffer({size:this.#Vr.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.#Dt=this.#et.createBindGroupLayout({entries:[{binding:0,visibility:this.#Hr,buffer:{}}]}),this.#Lt=this.#et.createBindGroup({layout:this.#Dt,entries:[{binding:0,resource:{buffer:this.#zr}}]}))}setDevice(e){this.#et=e,this.#Ir()}getLayout(){return this.#Dt}getBindGroup(){return this.#Lt}getBuffer(){return this.#zr}setFloat(e,t){this.#Vr[e]=t}getFloat(e){return this.#Vr[e]}setFloat2(e,t,i){this.#Vr[e]=t,this.#Vr[e+1]=i}setFloat4(e,t,i,n,r){this.#Vr[e]=t,this.#Vr[e+1]=i,this.#Vr[e+2]=n,this.#Vr[e+3]=r}setVector3(e,t){this.#Vr[e]=t.x,this.#Vr[e+1]=t.y,this.#Vr[e+2]=t.z}setVector4(e,t){this.#Vr[e]=t.x,this.#Vr[e+1]=t.y,this.#Vr[e+2]=t.z,this.#Vr[e+3]=t.w}setColor(e,t,i){this.#Vr[e]=t.r,this.#Vr[e+1]=t.g,this.#Vr[e+2]=t.b,void 0!==i&&(this.#Vr[e+3]=i)}setMatrix3x3(e,t){for(let i=0;i<3;i++)for(let n=0;n<3;n++)this.#Vr[e+n+4*i]=t[n+3*i]}setInt=function(e,t){this.#Gr[e]=t};getInt(e){return this.#Gr[e]}setBuffer(e,t){this.#Vr.set(t,e)}upload(){this.#et.queue.writeBuffer(this.#zr,0,this.#Vr.buffer,0,this.#Vr.byteLength)}}},99315:(e,t,i)=>{"use strict";function n(e){return Math.floor(Math.log2(Math.max(e.width,e.height)))+1}function r(){return"\n\tvar<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n\t\tvec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0)\n\t);\n\n\tstruct VertexOutput {\n\t\t@builtin(position) position : vec4<f32>,\n\t\t@location(0) texCoord : vec2<f32>,\n\t};\n\n\t@vertex\n\tfn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n\t\tvar output : VertexOutput;\n\t\toutput.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n\t\toutput.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);\n\t\treturn output;\n\t}\n\n\t@group(0) @binding(0) var imgSampler : sampler;\n\t@group(0) @binding(1) var img : texture_2d<f32>;\n\n\t@fragment\n\tfn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {\n\t\treturn textureSample(img, imgSampler, texCoord);\n\t}\n\t"}i.d(t,{E:()=>r,J:()=>n})},82116:(e,t,i)=>{"use strict";i.d(t,{L0:()=>s,X9:()=>o,oh:()=>a});var n=i(72091),r=i.n(n);function o(e,t){switch(e){case r().RepeatWrapping:return"repeat";case r().ClampToEdgeWrapping:return"clamp-to-edge";case r().MirroredRepeatWrapping:return"mirror-repeat";case r().NearestFilter:case r().NearestMipMapNearestFilter:return"nearest";case r().NearestMipMapLinearFilter:return t?"linear":"nearest";case r().LinearFilter:return"linear";case r().LinearMipMapNearestFilter:return t?"nearest":"linear";case r().LinearMipMapLinearFilter:return"linear";default:return console.warn("unknown filter param",e),""}}function s(e,t){let i,n;switch(e){case r().AlphaFormat:i="r";break;case r().RGBFormat:i="rgb is unsupported";break;case r().RGBAFormat:i="rgba";break;case r().LuminanceFormat:i="r";break;case r().LuminanceAlphaFormat:i="rg";break;case r().RGB_S3TC_DXT1_Format:return"bc1-rgb-unorm unsupported";case r().RGBA_S3TC_DXT1_Format:return"bc1-rgba-unorm";case r().RGBA_S3TC_DXT3_Format:return"bc2-rgba-unorm";case r().RGBA_S3TC_DXT5_Format:return"bc3-rgba-unorm";default:i=e}switch(t){case r().UnsignedByteType:n="8unorm";break;case r().ByteType:n="8snorm";break;case r().ShortType:n="16sint";break;case r().UnsignedShortType:n="16uint";break;case r().IntType:n="32sint";break;case r().UnsignedIntType:n="32uint";break;case r().FloatType:n="32float";break;case r().HalfFloatType:n="16float";break;default:console.warn("unknown type",t),n=""}return""+i+n}function a(e){switch(e){case r().FrontSide:return"back";case r().BackSide:return"front";case r().DoubleSide:return"none"}}},40508:(e,t,i)=>{"use strict";i.d(t,{cS:()=>o,f6:()=>r});let n=null;async function r(e){if(!n)return n=await async function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i=Object.assign({},{powerPreference:"high-performance"},t),n=await(null===(e=navigator)||void 0===e||null===(e=e.gpu)||void 0===e?void 0:e.requestAdapter(i));if(!n)return void console.warn("Couldn't request WebGPU adapter. WebGPU will not be available.");const r=n.info||await n.requestAdapterInfo();console.log(r);const o=await n.requestDevice({});return console.log(o.limits),o}(e),n}function o(){return n}},98233:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CPUTexture:()=>_});var n=i(5732),r=i(55280);const o="rgba8unorm",s="bgra8unorm",a="rgba8uint",l="rgb10a2unorm",c="depth32float",h="depth24plus",u="r32float",d="rgba32float",f={unknown:"unknown",uint8:"uint8",float32:"float32"};function p(e){switch(e){case o:case s:case a:case l:return f.uint8;case c:case u:case d:return f.float32}return console.error("Unsupported format: "+e),f.unknown}function m(e){switch(e){case o:case s:case a:case l:return 4;case c:case h:case u:return 1;case d:return 4;default:return console.error("Unsupported format: "+e),0}}function g(e){switch(e){case f.uint8:return Uint8Array;case f.float32:return Float32Array;default:return null}}async function v(e){const t=await async function(e){return new Promise((t=>{e.toBlob(t)}))}(e);return URL.createObjectURL(t)}const y=(e,t)=>{t.r=.5*(e.r+1)*255,t.g=.5*(e.g+1)*255,t.b=.5*(e.b+1)*255,t.a=255};const b=(e,t)=>{const i=e.r|e.g<<8|e.b<<16|e.a<<24,n=i?(1103515245*i+12345)%2**31:0;t.r=255&n,t.g=n>>8&255,t.b=n>>16&255,t.a=255},x=(e,t)=>{const i=255*e.r;t.r=i,t.g=i,t.b=i,t.a=255};class _{width=0;height=0;data=null;format=null;constructor(){}init(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.width=e,this.height=t,this.format=i,n)this.data=r?n.slice():n;else{const n=m(i),r=p(i),o=e*t*n;this.data=function(e,t){return new(g(e))(t)}(r,o)}return this}static async createFromTexture(e,t){const i=t.usage&GPUTextureUsage.COPY_SRC,r=t.usage&GPUTextureUsage.TEXTURE_BINDING;if(!i&&!r)return console.error("GPUTexture must have COPY_SRC or TEXTURE_BINDING usage for readback."),null;let o=i?t:(0,n.copyGPUTexture)(e,t);const s=await(new _).mapFromTexture(e,o),a=(new _).copyFrom(s,0,0,t.width,t.height);return s.unmap(),a}isEmpty(){return null===this.data}copyFrom(e,t,i,n,r){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;if(this.isEmpty()){const t=o+n,i=s+r;this.init(t,i,e.format)}const a=m(e.format);for(let l=0;l<r;l++){const r=e.width*(i+l)+t,c=r+n,h=e.data.subarray(a*r,a*c),u=this.width*(s+l)+o,d=u+n;this.data.set(h,a*u,a*d)}return this}async mapFromTexture(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.width,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t.height;const s=function(e){switch(e){case"depth24plus":case"depth32float":case"bgra8unorm":case"rgba8uint":case"rgb10a2unorm":case"r32float":return 4;case"rgba32float":return 16;default:throw new Error("Unsupported texture format: "+e)}}(t.format);let a=(l=t.width*s,256*Math.ceil(l/256));var l;let c=a*t.height;const h=a/s,u=e.createBuffer({size:c,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),d=e.createCommandEncoder(),f=[i,n,0];d.copyTextureToBuffer({texture:t,origin:f},{buffer:u,bytesPerRow:a},[r,o]),e.queue.submit([d.finish()]),await u.mapAsync(GPUMapMode.READ);const m=new(g(p(t.format)))(u.getMappedRange());return this.init(h,o,t.format,m,!1),this.unmap=()=>{u.unmap(),u.destroy()},this}static async createFromColorTarget(e){const t=e.getRenderTargets(),i=e.getDevice(),n=t.getColorTarget();return await _.createFromTexture(i,n)}static async createFromViewDepthTarget(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=e.getRenderTargets(),r=e.getDevice(),o=i.getViewDepthTarget();let s=o;if(t){const e=r.createTexture({size:[o.width,o.height],format:"r32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});(0,n.convertTexture)(r,o,e,n.UnpackRGB10DepthShader),s=e}return await _.createFromTexture(r,s)}static async createFromNormalsTarget(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=e.getRenderTargets(),r=e.getDevice(),o=i.getNormalsTarget();let s=o;if(t){const e=r.createTexture({size:[o.width,o.height],format:"rgba32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});(0,n.convertTexture)(r,o,e,n.UnpackRGB10NormalsShader),s=e}return await _.createFromTexture(r,s)}static async createFromIdTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=e.getRenderTargets(),n=e.getDevice(),r=i.getIdTarget(t);return await _.createFromTexture(n,r)}swizzelRGChannels(){const e=this.format===_.Formats.rgba8unorm,t=this.format===_.Formats.bgra8unorm;if(!e&&!t)return console.error("SwizzelRGChannels only supported for rgba8unorm and bgra8unorm formats."),null;for(var i=0;i<this.data.length;i+=4){const e=this.data[i];this.data[i]=this.data[i+2],this.data[i+2]=e}return this.format=e?_.Formats.bgra8unorm:_.Formats.rgba8unorm,this}toGreyScaleDepth(){return this.toColorImage(x)}toColorizedNormals(){return this.toColorImage(y)}toColorizedIds(){return this.toColorImage(b)}getPixel(e,t,i){const n=m(this.format),r=n*(t*this.width+e);i.r=this.data[r],n>1&&(i.g=this.data[r+1]),n>2&&(i.b=this.data[r+2]),n>3&&(i.a=this.data[r+3])}setPixel(e,t,i){const n=m(this.format),r=n*(t*this.width+e);this.data[r]=i.r,n>1&&(this.data[r+1]=i.g),n>2&&(this.data[r+2]=i.b),n>3&&(this.data[r+3]=i.a)}toColorImage(e){const t=(new _).init(this.width,this.height,o),i={r:0,g:0,b:0,a:0},n={r:0,g:0,b:0,a:0};for(var r=0;r<this.height;r++)for(var s=0;s<this.width;s++)this.getPixel(s,r,i),e(i,n),t.setPixel(s,r,n);return t}toCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.width,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.height,s=this;"r32float"===this.format&&(s=this.toColorImage(x)),e=e||(0,r.getGlobal)().document.createElement("canvas"),e.width=n,e.height=o;var a,l=e.getContext("2d"),c=new Uint8ClampedArray(s.data);return a=new ImageData(c,n,o),l.putImageData(a,t,i,0,0,n,o),e}async toImageUrl(){return v(this.toCanvas())}async showInNewTab(){const e=await this.toImageUrl();window.open(e)}}},5732:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CopyFragmentShader:()=>l,DummyFragmentShader:()=>a,ShaderPassWebGPU:()=>u,UnpackRGB10DepthShader:()=>c,UnpackRGB10NormalsShader:()=>h,convertTexture:()=>d,copyGPUTexture:()=>f});var n=i(29251),r=i(43851),o=i(41007),s=i(65796);const a=n.wgsl`
|
||
@fragment
|
||
fn main(
|
||
@builtin(position) coord : vec4f,
|
||
@location(0) @interpolate(linear) vUv: vec2f
|
||
) -> @location(0) vec4f {
|
||
var outColor = vec4f(vUv, 0.0, 1.0);
|
||
return outColor;
|
||
}
|
||
`,l=n.wgsl`
|
||
@group(0) @binding(1) var texture: texture_2d<f32>;
|
||
@group(0) @binding(2) var texSampler: sampler;
|
||
|
||
@fragment
|
||
fn main(
|
||
@builtin(position) coord: vec4f,
|
||
@location(0) @interpolate(linear) vUv: vec2f
|
||
) -> @location(0) vec4f {
|
||
var outColor = textureSample(texture, texSampler, vUv);
|
||
return outColor;
|
||
}
|
||
`,c=n.wgsl`
|
||
${s}
|
||
|
||
@group(0) @binding(1) var texture: texture_2d<f32>;
|
||
@group(0) @binding(2) var texSampler: sampler;
|
||
|
||
@fragment
|
||
fn main(
|
||
@builtin(position) coord: vec4f,
|
||
@location(0) @interpolate(linear) vUv: vec2f
|
||
) -> @location(0) vec4f {
|
||
|
||
var packedDepth = textureSample(texture, texSampler, vUv);
|
||
var depth = unpackDepth10(packedDepth.rgb);
|
||
return vec4f(depth, 0, 0, 1);
|
||
}
|
||
`,h=n.wgsl`
|
||
// Note that pack_normals chunk is only needed for int-packed vertex-normals.
|
||
// The rgb10-packed normals need unpackNormals10 instead.
|
||
${s}
|
||
|
||
@group(0) @binding(1) var texture: texture_2d<f32>;
|
||
@group(0) @binding(2) var texSampler: sampler;
|
||
|
||
@fragment
|
||
fn main(
|
||
@builtin(position) coord: vec4f,
|
||
@location(0) @interpolate(linear) vUv: vec2f
|
||
) -> @location(0) vec4f {
|
||
|
||
var packedNormal = textureSample(texture, texSampler, vUv);
|
||
var normal = unpackNormal10(packedNormal.xyz);
|
||
return vec4f(normal, 1.0f);
|
||
}
|
||
`;class u{#et;#Gn;#jr;#qr;#Xr;#Yr;#Kr;#Qr;#Zr=[];#$r;#Jr;#eo;#to;#io=0;#no=0;#ro=0;#Pt;constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.#et=e,this.#Pt=t,this.setFragmentShader(),this.setVertexShader();const n=new o.UniformGroup(e,i);this.setUniforms(n,i)}setFragmentShader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"main";this.#$r=e,this.#Jr=t,this.#Xr=null,this.#Gn=null}setVertexShader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mainFlipY";this.#eo=e,this.#to=t,this.#qr=null,this.#Gn=null}setSourceTextureUniform(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.#io=e,this.#no=t,this.#ro=i;const n=this.getUniforms(i);n.isAssigned(e)||n.addTexture(e),n.isAssigned(t)||n.addSampler(t)}setUniforms(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.#Zr[t]=e}getUniforms(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.#Zr[e]}get uniforms(){return this.getUniforms()}createPipeline(){let e="auto";if(this.#Zr.length>0){const t=[];for(let e=0;e<this.#Zr.length;e++){const i=this.#Zr[e];t[e]=i.layout}e=this.#et.createPipelineLayout({bindGroupLayouts:t})}this.#Gn=this.#et.createRenderPipeline({layout:e,vertex:{module:this.#qr,entryPoint:this.#to},fragment:{module:this.#Xr,entryPoint:this.#Jr,targets:[{format:this.#Yr}]},primitive:{topology:"triangle-list",cullMode:"back"}})}init(e){if((e=e||this.#Qr)&&(!this.#Gn||this.#Qr!==e)){for(let e in this.#Zr)this.#Zr[e].update(this.#et,this.#Pt);this.#Kr=e.createView(),this.#Qr=e,this.#qr||(this.#qr=this.#et.createShaderModule({code:this.#eo})),this.#Xr||(this.#Xr=this.#et.createShaderModule({code:this.#$r})),this.#Gn&&this.#Yr===e.format||(this.#Yr=e.format,this.createPipeline()),this.#jr||(this.#jr={colorAttachments:[{view:void 0,clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]})}}run(e,t){if(!this.#et)return;if(t){this.getUniforms(this.#ro).setTexture(t,this.#io)}this.init(e);let i=this.#et.createCommandEncoder();this.#jr.colorAttachments[0].view=this.#Kr;let n=i.beginRenderPass(this.#jr);this.#Zr.forEach(((e,t)=>{n.setBindGroup(t,e.bindGroup)})),n.setPipeline(this.#Gn),n.draw(3),n.end(),this.#et.queue.submit([i.finish()])}}function d(e,t,i,n){let r=new u(e);r.setSourceTextureUniform(),r.setFragmentShader(n),r.run(i,t)}function f(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC;const n=e.createTexture({size:[t.width,t.height],format:t.format,usage:i});return d(e,t,n,l),n}},29251:e=>{const t=/#([^\s]*)(\s*)/g;function i(e){const i=[];let n={string:"",elseIsValid:!1,expression:!0,levelProcessed:!1,ignoreNested:!1};for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];for(let r=0;r<e.length;++r){const s=e[r],a=s.matchAll(t);let l=0,c=!1;for(const e of a){switch(n.expression&&!n.levelProcessed&&(n.string+=s.substring(l,e.index)),e[1]){case"if":if(e.index+e[0].length!=s.length)throw new Error("#if must be immediately followed by a template expression (ie: ${value})");c=!0,i.push(n),n={string:"",elseIsValid:!0,expression:!!o[r],levelProcessed:n.ignoreNested,ignoreNested:n.ignoreNested||!o[r]};break;case"elif":if(e.index+e[0].length!=s.length)throw new Error("#elif must be immediately followed by a template expression (ie: ${value})");if(!n.elseIsValid)throw new Error("#elif not preceeded by an #if or #elif");c=!0,n.levelProcessed||=n.expression,n.expression=!!o[r],n.ignoreNested=n.levelProcessed||!o[r];break;case"else":if(!n.elseIsValid)throw new Error("#else not preceeded by an #if or #elif");n.levelProcessed||=n.expression,n.ignoreNested=n.levelProcessed,n.expression=!0,n.expression&&!n.levelProcessed&&(n.string+=e[2]),n.elseIsValid=!1;break;case"endif":{if(!i.length)throw new Error("#endif not preceeded by an #if");const t=n;n=i.pop(),n.string+=t.string,n.string+=e[2];break}default:n.string+=e[0]}l=e.index+e[0].length}n.expression&&!n.levelProcessed&&(l!=s.length&&(n.string+=s.substring(l,s.length)),!c&&o.length>r&&(n.string+=o[r]))}if(i.length)throw new Error("Mismatched #if/#endif count");return n.string}function n(e,t){if(!t||t.length<e.length){const i=e.slice((null==t?void 0:t.length)||0).map((e=>`"$${e}"`)).join(", ");throw new Error(`[wgpu] Missing values for: ${i}`)}return t}e.exports={wgsl:i,$wgsl:function(e,t){const r=/\$\w+/,o=e.match(/(?<=\$)(\w+)/g);if(!o||!o.length)return e;if(Array.isArray(t))return i(e.split(r),...n(o,t));if(t&&!Array.isArray(t)&&"object"==typeof t)return i(e.split(r),...o.map((e=>{if(!Object.hasOwn(t,e))throw new Error(`[wgpu] Missing value for "$${e}"`);const i=t[e];if("object"==typeof i&&null!==i||"function"==typeof i)throw new Error(`[wgpu] Unsupported value type "${typeof i}"`);return i})));for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];return i(e.split(r),...n(o,[t,...a]))}}},41944:(e,t,i)=>{var n;
|
||
/*! Hammer.JS - v2.0.8 - 2016-04-23
|
||
* http://hammerjs.github.io/
|
||
*
|
||
* Copyright (c) 2016 Jorik Tangelder;
|
||
* Licensed under the MIT license */!function(r,o,s,a){"use strict";var l=["","webkit","Moz","MS","ms","o"],c=o.createElement("div"),h="function",u=Math.round,d=Math.abs,f=Date.now;function p(e,t,i){return setTimeout(E(e,i),t)}function m(e,t,i){return!!Array.isArray(e)&&(g(e,i[t],i),!0)}function g(e,t,i){var n;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(n=0;n<e.length;)t.call(i,e[n],n,e),n++;else for(n in e)e.hasOwnProperty(n)&&t.call(i,e[n],n,e)}function v(e,t,i){var n="DEPRECATED METHOD: "+t+"\n"+i+" AT \n";return function(){var t=new Error("get-stack-trace"),i=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,n,i),e.apply(this,arguments)}}var y=function(e){if(e===a||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(n!==a&&null!==n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=Array.isArray(n[r])?n[r].slice(0):n[r])}return t},b=v((function(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;)(!i||i&&e[n[r]]===a)&&(e[n[r]]=t[n[r]]),r++;return e}),"extend","Use `assign`."),x=v((function(e,t){return b(e,t,!0)}),"merge","Use `assign`.");function _(e,t,i){var n,r=t.prototype;(n=e.prototype=Object.create(r)).constructor=e,n._super=r,i&&y(n,i)}function E(e,t){return function(){return e.apply(t,arguments)}}function S(e,t){return typeof e==h?e.apply(t&&t[0]||a,t):e}function A(e,t){return e===a?t:e}function w(e,t,i){g(P(t),(function(t){e.addEventListener(t,i,!1)}))}function T(e,t,i){g(P(t),(function(t){e.removeEventListener(t,i,!1)}))}function M(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function C(e,t){return e.indexOf(t)>-1}function P(e){return e.trim().split(/\s+/g)}function D(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var n=0;n<e.length;){if(i&&e[n][i]==t||!i&&e[n]===t)return n;n++}return-1}function L(e){return Array.prototype.slice.call(e,0)}function I(e,t,i){for(var n=[],r=[],o=0;o<e.length;){var s=t?e[o][t]:e[o];D(r,s)<0&&n.push(e[o]),r[o]=s,o++}return i&&(n=t?n.sort((function(e,i){return e[t]>i[t]})):n.sort()),n}function R(e,t){for(var i,n,r=t[0].toUpperCase()+t.slice(1),o=0;o<l.length;){if((n=(i=l[o])?i+r:t)in e)return n;o++}return a}var O=1;function N(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||r}var F="ontouchstart"in r,U=R(r,"PointerEvent")!==a,B=F&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",V="mouse",G=25,z=1,H=4,W=8,j=1,q=2,X=4,Y=8,K=16,Q=q|X,Z=Y|K,$=Q|Z,J=["x","y"],ee=["clientX","clientY"];function te(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){S(e.options.enable,[e])&&i.handler(t)},this.init()}function ie(e,t,i){var n=i.pointers.length,r=i.changedPointers.length,o=t&z&&n-r==0,s=t&(H|W)&&n-r==0;i.isFirst=!!o,i.isFinal=!!s,o&&(e.session={}),i.eventType=t,function(e,t){var i=e.session,n=t.pointers,r=n.length;i.firstInput||(i.firstInput=ne(t));r>1&&!i.firstMultiple?i.firstMultiple=ne(t):1===r&&(i.firstMultiple=!1);var o=i.firstInput,s=i.firstMultiple,l=s?s.center:o.center,c=t.center=re(n);t.timeStamp=f(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=le(l,c),t.distance=ae(l,c),function(e,t){var i=t.center,n=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==z&&o.eventType!==H||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y});t.deltaX=r.x+(i.x-n.x),t.deltaY=r.y+(i.y-n.y)}(i,t),t.offsetDirection=se(t.deltaX,t.deltaY);var h=oe(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=d(h.x)>d(h.y)?h.x:h.y,t.scale=s?(u=s.pointers,p=n,ae(p[0],p[1],ee)/ae(u[0],u[1],ee)):1,t.rotation=s?function(e,t){return le(t[1],t[0],ee)-le(e[1],e[0],ee)}(s.pointers,n):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,n,r,o,s=e.lastInterval||t,l=t.timeStamp-s.timeStamp;if(t.eventType!=W&&(l>G||s.velocity===a)){var c=t.deltaX-s.deltaX,h=t.deltaY-s.deltaY,u=oe(l,c,h);n=u.x,r=u.y,i=d(u.x)>d(u.y)?u.x:u.y,o=se(c,h),e.lastInterval=t}else i=s.velocity,n=s.velocityX,r=s.velocityY,o=s.direction;t.velocity=i,t.velocityX=n,t.velocityY=r,t.direction=o}(i,t);var u,p;var m=e.element;M(t.srcEvent.target,m)&&(m=t.srcEvent.target);t.target=m}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function ne(e){for(var t=[],i=0;i<e.pointers.length;)t[i]={clientX:u(e.pointers[i].clientX),clientY:u(e.pointers[i].clientY)},i++;return{timeStamp:f(),pointers:t,center:re(t),deltaX:e.deltaX,deltaY:e.deltaY}}function re(e){var t=e.length;if(1===t)return{x:u(e[0].clientX),y:u(e[0].clientY)};for(var i=0,n=0,r=0;r<t;)i+=e[r].clientX,n+=e[r].clientY,r++;return{x:u(i/t),y:u(n/t)}}function oe(e,t,i){return{x:t/e||0,y:i/e||0}}function se(e,t){return e===t?j:d(e)>=d(t)?e<0?q:X:t<0?Y:K}function ae(e,t,i){i||(i=J);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.sqrt(n*n+r*r)}function le(e,t,i){i||(i=J);var n=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return 180*Math.atan2(r,n)/Math.PI}te.prototype={handler:function(){},init:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(N(this.element),this.evWin,this.domHandler)}};var ce={mousedown:z,mousemove:2,mouseup:H},he="mousedown",ue="mousemove mouseup";function de(){this.evEl=he,this.evWin=ue,this.pressed=!1,te.apply(this,arguments)}_(de,te,{handler:function(e){var t=ce[e.type];t&z&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=H),this.pressed&&(t&H&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:V,srcEvent:e}))}});var fe={pointerdown:z,pointermove:2,pointerup:H,pointercancel:W,pointerout:W},pe={2:k,3:"pen",4:V,5:"kinect"},me="pointerdown",ge="pointermove pointerup pointercancel";function ve(){this.evEl=me,this.evWin=ge,te.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}r.MSPointerEvent&&!r.PointerEvent&&(me="MSPointerDown",ge="MSPointerMove MSPointerUp MSPointerCancel"),_(ve,te,{handler:function(e){var t=this.store,i=!1,n=e.type.toLowerCase().replace("ms",""),r=fe[n],o=pe[e.pointerType]||e.pointerType,s=o===k,a=o===V,l=D(t,e.pointerId,"pointerId");r&z&&(0===e.button||s)?l<0&&(t.push(e),l=t.length-1):r&(H|W)&&(i=!0),l<0||(t[l]=e,a&&!this.manager.options.handlePointerEventMouse||this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),i&&t.splice(l,1))}});var ye={touchstart:z,touchmove:2,touchend:H,touchcancel:W};function be(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,te.apply(this,arguments)}function xe(e,t){var i=L(e.touches),n=L(e.changedTouches);return t&(H|W)&&(i=I(i.concat(n),"identifier",!0)),[i,n]}_(be,te,{handler:function(e){var t=ye[e.type];if(t===z&&(this.started=!0),this.started){var i=xe.call(this,e,t);t&(H|W)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}}});var _e={touchstart:z,touchmove:2,touchend:H,touchcancel:W},Ee="touchstart touchmove touchend touchcancel";function Se(){this.evTarget=Ee,this.targetIds={},te.apply(this,arguments)}function Ae(e,t){var i=L(e.touches),n=this.targetIds;if(t&(2|z)&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,o,s=L(e.changedTouches),a=[],l=this.target;if(o=i.filter((function(e){return M(e.target,l)})),t===z)for(r=0;r<o.length;)n[o[r].identifier]=!0,r++;for(r=0;r<s.length;)n[s[r].identifier]&&a.push(s[r]),t&(H|W)&&delete n[s[r].identifier],r++;return a.length?[I(o.concat(a),"identifier",!0),a]:void 0}_(Se,te,{handler:function(e){var t=_e[e.type],i=Ae.call(this,e,t);i&&this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:e})}});var we=2500;function Te(){te.apply(this,arguments);var e=E(this.handler,this);this.touch=new Se(this.manager,e),this.mouse=new de(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Me(e,t){e&z?(this.primaryTouch=t.changedPointers[0].identifier,Ce.call(this,t)):e&(H|W)&&Ce.call(this,t)}function Ce(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var i={x:t.clientX,y:t.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout((function(){var e=n.indexOf(i);e>-1&&n.splice(e,1)}),we)}}function Pe(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(t-r.x),s=Math.abs(i-r.y);if(o<=25&&s<=25)return!0}return!1}_(Te,te,{handler:function(e,t,i){var n=i.pointerType==k,r=i.pointerType==V;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)Me.call(this,t,i);else if(r&&Pe.call(this,i))return;this.callback(e,t,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var De=R(c.style,"touchAction"),Le=De!==a,Ie="compute",Re="auto",Oe="manipulation",Ne="none",Fe="pan-x",Ue="pan-y",Be=function(){if(!Le)return!1;var e={},t=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!t||r.CSS.supports("touch-action",i)})),e}();function ke(e,t){this.manager=e,this.set(t)}ke.prototype={set:function(e){e==Ie&&(e=this.compute()),Le&&this.manager.element.style&&Be[e]&&(this.manager.element.style[De]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return g(this.manager.recognizers,(function(t){S(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(C(e,Ne))return Ne;var t=C(e,Fe),i=C(e,Ue);if(t&&i)return Ne;if(t||i)return t?Fe:Ue;if(C(e,Oe))return Oe;return Re}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var n=this.actions,r=C(n,Ne)&&!Be[Ne],o=C(n,Ue)&&!Be[Ue],s=C(n,Fe)&&!Be[Fe];if(r){var a=1===e.pointers.length,l=e.distance<2,c=e.deltaTime<250;if(a&&l&&c)return}if(!s||!o)return r||o&&i&Q||s&&i&Z?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ve=1,Ge=32;function ze(e){this.options=y({},this.defaults,e||{}),this.id=O++,this.manager=null,this.options.enable=A(this.options.enable,!0),this.state=Ve,this.simultaneous={},this.requireFail=[]}function He(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function We(e){return e==K?"down":e==Y?"up":e==q?"left":e==X?"right":""}function je(e,t){var i=t.manager;return i?i.get(e):e}function qe(){ze.apply(this,arguments)}function Xe(){qe.apply(this,arguments),this.pX=null,this.pY=null}function Ye(){qe.apply(this,arguments)}function Ke(){ze.apply(this,arguments),this._timer=null,this._input=null}function Qe(){qe.apply(this,arguments)}function Ze(){qe.apply(this,arguments)}function $e(){ze.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Je(e,t){return(t=t||{}).recognizers=A(t.recognizers,Je.defaults.preset),new et(e,t)}ze.prototype={defaults:{},set:function(e){return y(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(m(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=je(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return m(e,"dropRecognizeWith",this)||(e=je(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(m(e,"requireFailure",this))return this;var t=this.requireFail;return-1===D(t,e=je(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(m(e,"dropRequireFailure",this))return this;e=je(e,this);var t=D(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function n(i){t.manager.emit(i,e)}i<8&&n(t.options.event+He(i)),n(t.options.event),e.additionalEvent&&n(e.additionalEvent),i>=8&&n(t.options.event+He(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Ge},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Ge|Ve)))return!1;e++}return!0},recognize:function(e){var t=y({},e);if(!S(this.options.enable,[this,t]))return this.reset(),void(this.state=Ge);56&this.state&&(this.state=Ve),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},_(qe,ze,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,i=e.eventType,n=6&t,r=this.attrTest(e);return n&&(i&W||!r)?16|t:n||r?i&H?8|t:2&t?4|t:2:Ge}}),_(Xe,qe,{defaults:{event:"pan",threshold:10,pointers:1,direction:$},getTouchAction:function(){var e=this.options.direction,t=[];return e&Q&&t.push(Ue),e&Z&&t.push(Fe),t},directionTest:function(e){var t=this.options,i=!0,n=e.distance,r=e.direction,o=e.deltaX,s=e.deltaY;return r&t.direction||(t.direction&Q?(r=0===o?j:o<0?q:X,i=o!=this.pX,n=Math.abs(e.deltaX)):(r=0===s?j:s<0?Y:K,i=s!=this.pY,n=Math.abs(e.deltaY))),e.direction=r,i&&n>t.threshold&&r&t.direction},attrTest:function(e){return qe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=We(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),_(Ye,qe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ne]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),_(Ke,ze,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Re]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!n||!i||e.eventType&(H|W)&&!r)this.reset();else if(e.eventType&z)this.reset(),this._timer=p((function(){this.state=8,this.tryEmit()}),t.time,this);else if(e.eventType&H)return 8;return Ge},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&H?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),_(Qe,qe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ne]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),_(Ze,qe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Q|Z,pointers:1},getTouchAction:function(){return Xe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(Q|Z)?t=e.overallVelocity:i&Q?t=e.overallVelocityX:i&Z&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&d(t)>this.options.velocity&&e.eventType&H},emit:function(e){var t=We(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),_($e,ze,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Oe]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&z&&0===this.count)return this.failTimeout();if(n&&r&&i){if(e.eventType!=H)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||ae(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,s&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=p((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Ge},failTimeout:function(){return this._timer=p((function(){this.state=Ge}),this.options.interval,this),Ge},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Je.VERSION="2.0.8",Je.defaults={domEvents:!1,touchAction:Ie,enable:!0,handlePointerEventMouse:!0,inputTarget:null,inputClass:null,preset:[[Qe,{enable:!1}],[Ye,{enable:!1},["rotate"]],[Ze,{direction:Q}],[Xe,{direction:Q},["swipe"]],[$e],[$e,{event:"doubletap",taps:2},["tap"]],[Ke]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function et(e,t){var i;this.options=y({},Je.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((i=this).options.inputClass||(U?ve:B?Se:F?Te:de))(i,ie),this.touchAction=new ke(this,this.options.touchAction),tt(this,!0),g(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function tt(e,t){var i,n=e.element;n.style&&(g(e.options.cssProps,(function(r,o){i=R(n.style,o),t?(e.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=e.oldCssProps[i]||""})),t||(e.oldCssProps={}))}et.prototype={set:function(e){return y(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var i;this.touchAction.preventDefaults(e);var n=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===t.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(e),!r&&14&i.state&&(r=t.curRecognizer=i),o++}},get:function(e){if(e instanceof ze)return e;for(var t=this.recognizers,i=0;i<t.length;i++)if(t[i].options.event==e)return t[i];return null},add:function(e){if(m(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(m(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,i=D(t,e);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this},on:function(e,t){if(e!==a&&t!==a){var i=this.handlers;return g(P(e),(function(e){i[e]=i[e]||[],i[e].push(t)})),this}},off:function(e,t){if(e!==a){var i=this.handlers;return g(P(e),(function(e){t?i[e]&&i[e].splice(D(i[e],t),1):delete i[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var i=o.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=t,t.target.dispatchEvent(i)}(e,t);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()},t.stopPropagation=function(){t.srcEvent.stopPropagation()};for(var n=0;n<i.length;)i[n](t),n++}},destroy:function(){this.element&&tt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},y(Je,{INPUT_START:z,INPUT_MOVE:2,INPUT_END:H,INPUT_CANCEL:W,STATE_POSSIBLE:Ve,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Ge,DIRECTION_NONE:j,DIRECTION_LEFT:q,DIRECTION_RIGHT:X,DIRECTION_UP:Y,DIRECTION_DOWN:K,DIRECTION_HORIZONTAL:Q,DIRECTION_VERTICAL:Z,DIRECTION_ALL:$,Manager:et,Input:te,TouchAction:ke,TouchInput:Se,MouseInput:de,PointerEventInput:ve,TouchMouseInput:Te,SingleTouchInput:be,Recognizer:ze,AttrRecognizer:qe,Tap:$e,Pan:Xe,Swipe:Ze,Pinch:Ye,Rotate:Qe,Press:Ke,on:w,off:T,each:g,merge:x,extend:b,assign:y,inherit:_,bindFn:E,prefixed:R}),(void 0!==r?r:"undefined"!=typeof self?self:{}).Hammer=Je,(n=function(){return Je}.call(t,i,t,e))===a||(e.exports=n)}(window,document)},9341:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DDSLoader:()=>r});var n=i(72091),r=function(){this._parser=r.parse};r.prototype=Object.create(n.CompressedTextureLoader.prototype),r.prototype.constructor=r,r.parse=function(e,t){var i={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function r(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function o(e,t,i,n){for(var r=i*n*4,o=new Uint8Array(e,t,r),s=new Uint8Array(r),a=0,l=0,c=0;c<n;c++)for(var h=0;h<i;h++){var u=o[l],d=o[++l],f=o[++l],p=o[++l];l++,s[a]=f,s[++a]=d,s[++a]=u,s[++a]=p,a++}return s}var s=r("DXT1"),a=r("DXT3"),l=r("DXT5");if(e.byteLength<124)return console.error("THREE.DDSLoader.parse: File is empty or incomplete."),i;var c,h=new Int32Array(e,0,31);if(542327876!==h[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),i;if(4&!h[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),i;var u,d=h[21],f=!1;switch(d){case s:c=8,i.format=n.RGB_S3TC_DXT1_Format;break;case a:c=16,i.format=n.RGBA_S3TC_DXT3_Format;break;case l:c=16,i.format=n.RGBA_S3TC_DXT5_Format;break;default:if(!(32==h[22]&&16711680&h[23]&&65280&h[24]&&255&h[25]&&4278190080&h[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(u=d,String.fromCharCode(255&u,u>>8&255,u>>16&255,u>>24&255))),i;f=!0,c=64,i.format=n.RGBAFormat}i.mipmapCount=1,h[7]>0&&!1!==t&&(i.mipmapCount=Math.max(1,h[7])),i.isCubemap=!!(512&h[28]),i.width=h[4],i.height=h[3];for(var p=h[1]+4,m=i.width,g=i.height,v=i.isCubemap?6:1,y=0;y<v;y++){for(var b=0;b<i.mipmapCount;b++){if(f)var x=(_=o(e,p,m,g)).length;else{x=Math.max(4,m)/4*Math.max(4,g)/4*c;var _=new Uint8Array(e,p,x)}var E={data:_,width:m,height:g};i.mipmaps.push(E),p+=x,m=Math.max(.5*m,1),g=Math.max(.5*g,1)}m=i.width,g=i.height}return i}},22201:(e,t,i)=>{"use strict";
|
||
/*!
|
||
MIT License
|
||
|
||
Copyright (c) 2019 Fyrestar
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
of this software and associated documentation files (the "Software"), to deal
|
||
in the Software without restriction, including without limitation the rights
|
||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
copies of the Software, and to permit persons to whom the Software is
|
||
furnished to do so, subject to the following conditions:
|
||
|
||
The above copyright notice and this permission notice shall be included in all
|
||
copies or substantial portions of the Software.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
SOFTWARE.
|
||
*/
|
||
function n(e,t){for(let i in t){const n=t[i];if("@"===i[0]){const t=i.substr(1);e=e.replace(t,n)}else if("?"===i[0]){const t=i.substr(1);e=e.replace(t,n+"\n"+t)}else e=e.replace(i,i+"\n"+n)}return e}function r(e,t){const i=(t.header||"")+"\n";let r=(t.vertexHeader||"")+"\n"+e.vertexShader,o=(t.fragmentHeader||"")+"\n"+e.fragmentShader;return t.vertexEnd&&(r=r.replace(/\}(?=[^\}]*$)/g,t.vertexEnd+"\n}")),t.fragmentEnd&&(o=o.replace(/\}(?=[^\}]*$)/g,t.fragmentEnd+"\n}")),void 0!==t.vertex&&(r=n(r,t.vertex)),void 0!==t.fragment&&(o=n(o,t.fragment)),e.vertexShader=i+r,e.fragmentShader=i+o,e}i.r(t),i.d(t,{patchShader:()=>r})},63004:(e,t,i)=>{"use strict";i.r(t),i.d(t,{polyfillTHREE:()=>d});const n=(e,t,i)=>{"object"!=typeof e&&"function"!=typeof e||Object.prototype.hasOwnProperty.call(e,t)||(e[t]=i)},r=(e,t,i)=>{"object"==typeof e&&Object.defineProperty(e,t,i)},o=e=>{n(e,"BoxBufferGeometry",class extends e.BufferGeometry{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;super(),this.type="BoxGeometry",this.parameters={width:t,height:i,depth:n,widthSegments:r,heightSegments:o,depthSegments:s};const a=this;r=Math.floor(r),o=Math.floor(o),s=Math.floor(s);const l=[],c=[],h=[],u=[];let d=0,f=0;function p(t,i,n,r,o,s,p,m,g,v,y){const b=s/g,x=p/v,_=s/2,E=p/2,S=m/2,A=g+1,w=v+1;let T=0,M=0;const C=new e.Vector3;for(let e=0;e<w;e++){const s=e*x-E;for(let a=0;a<A;a++){const l=a*b-_;C[t]=l*r,C[i]=s*o,C[n]=S,c.push(C.x,C.y,C.z),C[t]=0,C[i]=0,C[n]=m>0?1:-1,h.push(C.x,C.y,C.z),u.push(a/g),u.push(1-e/v),T+=1}}for(let e=0;e<v;e++)for(let t=0;t<g;t++){const i=d+t+A*e,n=d+t+A*(e+1),r=d+(t+1)+A*(e+1),o=d+(t+1)+A*e;l.push(i,n,o),l.push(n,r,o),M+=6}a.addGroup(f,M,0),f+=M,d+=T}p("z","y","x",-1,-1,n,i,t,s,o,0),p("z","y","x",1,-1,n,i,-t,s,o,1),p("x","z","y",1,1,t,n,i,r,s,2),p("x","z","y",1,-1,t,n,-i,r,s,3),p("x","y","z",1,-1,t,i,n,r,o,4),p("x","y","z",-1,-1,t,i,-n,r,o,5),this.setIndex(l),this.setAttribute("position",new e.Float32BufferAttribute(c,3)),this.setAttribute("normal",new e.Float32BufferAttribute(h,3)),this.setAttribute("uv",new e.Float32BufferAttribute(u,2))}})},s=e=>{n(e,"CircleBufferGeometry",class extends e.BufferGeometry{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="CircleGeometry",this.parameters={radius:t,segments:i,thetaStart:n,thetaLength:r},i=Math.max(3,i);const o=[],s=[],a=[],l=[],c=new e.Vector3,h=new e.Vector2;s.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let e=0,o=3;e<=i;e++,o+=3){const u=n+e/i*r;c.x=t*Math.cos(u),c.y=t*Math.sin(u),s.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(s[o]/t+1)/2,h.y=(s[o+1]/t+1)/2,l.push(h.x,h.y)}for(let e=1;e<=i;e++)o.push(e,e+1,0);this.setIndex(o),this.setAttribute("position",new e.Float32BufferAttribute(s,3)),this.setAttribute("normal",new e.Float32BufferAttribute(a,3)),this.setAttribute("uv",new e.Float32BufferAttribute(l,2))}})},a=e=>{n(e,"CylinderBufferGeometry",class extends e.BufferGeometry{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:i,height:n,radialSegments:r,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),o=Math.floor(o);const h=[],u=[],d=[],f=[];let p=0;const m=[],g=n/2;let v=0;function y(n){const o=p,s=new e.Vector2,m=new e.Vector3;let y=0;const b=!0===n?t:i,x=!0===n?1:-1;for(let e=1;e<=r;e++)u.push(0,g*x,0),d.push(0,x,0),f.push(.5,.5),p++;const _=p;for(let e=0;e<=r;e++){const t=e/r*l+a,i=Math.cos(t),n=Math.sin(t);m.x=b*n,m.y=g*x,m.z=b*i,u.push(m.x,m.y,m.z),d.push(0,x,0),s.x=.5*i+.5,s.y=.5*n*x+.5,f.push(s.x,s.y),p++}for(let e=0;e<r;e++){const t=o+e,i=_+e;!0===n?h.push(i,i+1,t):h.push(i+1,i,t),y+=3}c.addGroup(v,y,0),v+=y}!function(){const s=new e.Vector3,y=new e.Vector3;let b=0;const x=(i-t)/n;for(let e=0;e<=o;e++){const c=[],h=e/o,v=h*(i-t)+t;for(let e=0;e<=r;e++){const t=e/r,i=t*l+a,o=Math.sin(i),m=Math.cos(i);y.x=v*o,y.y=-h*n+g,y.z=v*m,u.push(y.x,y.y,y.z),s.set(o,x,m).normalize(),d.push(s.x,s.y,s.z),f.push(t,1-h),c.push(p++)}m.push(c)}for(let e=0;e<r;e++)for(let t=0;t<o;t++){const i=m[t][e],n=m[t+1][e],r=m[t+1][e+1],o=m[t][e+1];h.push(i,n,o),h.push(n,r,o),b+=6}c.addGroup(v,b,0),v+=b}(),!1===s&&(t>0&&y(!0),i>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new e.Float32BufferAttribute(u,3)),this.setAttribute("normal",new e.Float32BufferAttribute(d,3)),this.setAttribute("uv",new e.Float32BufferAttribute(f,2))}})},l=e=>{n(e,"PolyhedronBufferGeometry",class extends e.BufferGeometry{constructor(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:i,radius:n,detail:r};const o=[],s=[];function a(e,t,i,n){const r=n+1,o=[];for(let n=0;n<=r;n++){o[n]=[];const s=e.clone().lerp(i,n/r),a=t.clone().lerp(i,n/r),l=r-n;for(let e=0;e<=l;e++)o[n][e]=0===e&&n===r?s:s.clone().lerp(a,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){const i=Math.floor(t/2);t%2==0?(l(o[e][i+1]),l(o[e+1][i]),l(o[e][i])):(l(o[e][i+1]),l(o[e+1][i+1]),l(o[e+1][i]))}}function l(e){o.push(e.x,e.y,e.z)}function c(e,i){const n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function h(e,t,i,n){n<0&&1===e.x&&(s[t]=e.x-1),0===i.x&&0===i.z&&(s[t]=n/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function d(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(t){const n=new e.Vector3,r=new e.Vector3,o=new e.Vector3;for(let e=0;e<i.length;e+=3)c(i[e+0],n),c(i[e+1],r),c(i[e+2],o),a(n,r,o,t)}(r),function(t){const i=new e.Vector3;for(let e=0;e<o.length;e+=3)i.x=o[e+0],i.y=o[e+1],i.z=o[e+2],i.normalize().multiplyScalar(t),o[e+0]=i.x,o[e+1]=i.y,o[e+2]=i.z}(n),function(){const t=new e.Vector3;for(let e=0;e<o.length;e+=3){t.x=o[e+0],t.y=o[e+1],t.z=o[e+2];const i=u(t)/2/Math.PI+.5,n=d(t)/Math.PI+.5;s.push(i,1-n)}(function(){const t=new e.Vector3,i=new e.Vector3,n=new e.Vector3,r=new e.Vector3,a=new e.Vector2,l=new e.Vector2,c=new e.Vector2;for(let e=0,d=0;e<o.length;e+=9,d+=6){t.set(o[e+0],o[e+1],o[e+2]),i.set(o[e+3],o[e+4],o[e+5]),n.set(o[e+6],o[e+7],o[e+8]),a.set(s[d+0],s[d+1]),l.set(s[d+2],s[d+3]),c.set(s[d+4],s[d+5]),r.copy(t).add(i).add(n).divideScalar(3);const f=u(r);h(a,d+0,t,f),h(l,d+2,i,f),h(c,d+4,n,f)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],i=s[e+2],n=s[e+4],r=Math.max(t,i,n),o=Math.min(t,i,n);r>.9&&o<.1&&(t<.2&&(s[e+0]+=1),i<.2&&(s[e+2]+=1),n<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new e.Float32BufferAttribute(o,3)),this.setAttribute("normal",new e.Float32BufferAttribute(o.slice(),3)),this.setAttribute("uv",new e.Float32BufferAttribute(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}})},c=e=>{n(e,"OctahedronBufferGeometry",class extends e.PolyhedronBufferGeometry{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}})},h=e=>{n(e,"SphereBufferGeometry",class extends e.BufferGeometry{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:i,heightSegments:n,phiStart:r,phiLength:o,thetaStart:s,thetaLength:a},i=Math.max(3,Math.floor(i)),n=Math.max(2,Math.floor(n));const l=Math.min(s+a,Math.PI);let c=0;const h=[],u=new e.Vector3,d=new e.Vector3,f=[],p=[],m=[],g=[];for(let e=0;e<=n;e++){const f=[],v=e/n;let y=0;0==e&&0==s?y=.5/i:e==n&&l==Math.PI&&(y=-.5/i);for(let e=0;e<=i;e++){const n=e/i;u.x=-t*Math.cos(r+n*o)*Math.sin(s+v*a),u.y=t*Math.cos(s+v*a),u.z=t*Math.sin(r+n*o)*Math.sin(s+v*a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),g.push(n+y,1-v),f.push(c++)}h.push(f)}for(let e=0;e<n;e++)for(let t=0;t<i;t++){const i=h[e][t+1],r=h[e][t],o=h[e+1][t],a=h[e+1][t+1];(0!==e||s>0)&&f.push(i,r,a),(e!==n-1||l<Math.PI)&&f.push(r,o,a)}this.setIndex(f),this.setAttribute("position",new e.Float32BufferAttribute(p,3)),this.setAttribute("normal",new e.Float32BufferAttribute(m,3)),this.setAttribute("uv",new e.Float32BufferAttribute(g,2))}})},u=e=>{n(e,"TorusBufferGeometry",class extends e.BufferGeometry{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;super(),this.type="TorusGeometry",this.parameters={radius:t,tube:i,radialSegments:n,tubularSegments:r,arc:o},n=Math.floor(n),r=Math.floor(r);const s=[],a=[],l=[],c=[],h=new e.Vector3,u=new e.Vector3,d=new e.Vector3;for(let e=0;e<=n;e++)for(let s=0;s<=r;s++){const f=s/r*o,p=e/n*Math.PI*2;u.x=(t+i*Math.cos(p))*Math.cos(f),u.y=(t+i*Math.cos(p))*Math.sin(f),u.z=i*Math.sin(p),a.push(u.x,u.y,u.z),h.x=t*Math.cos(f),h.y=t*Math.sin(f),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(s/r),c.push(e/n)}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const i=(r+1)*e+t-1,n=(r+1)*(e-1)+t-1,o=(r+1)*(e-1)+t,a=(r+1)*e+t;s.push(i,n,a),s.push(n,o,a)}this.setIndex(s),this.setAttribute("position",new e.Float32BufferAttribute(a,3)),this.setAttribute("normal",new e.Float32BufferAttribute(l,3)),this.setAttribute("uv",new e.Float32BufferAttribute(c,2))}})},d=e=>{var t,i,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M,C,P,D,L,I,R,O,N,F,U,B,k,V;const G=new e.Vector3;n(null==e||null===(t=e.Camera)||void 0===t?void 0:t.prototype,"updateMatrixWorld",(function(t){e.Object3D.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()})),n(null==e||null===(i=e.Box2)||void 0===i?void 0:i.prototype,"getSize",(function(e){return this.isEmpty()?e.set(0,0):this.size(e)})),n(null==e||null===(d=e.Box3)||void 0===d?void 0:d.prototype,"getSize",(function(e){return this.isEmpty()?e.set(0,0,0):this.size(e)})),n(null==e||null===(f=e.Box2)||void 0===f?void 0:f.prototype,"intersectsBox",(function(e){return this.isIntersectionBox(e)})),n(null==e||null===(p=e.Box3)||void 0===p?void 0:p.prototype,"intersectsBox",(function(e){return this.isIntersectionBox(e)})),n(null==e||null===(m=e.Ray)||void 0===m?void 0:m.prototype,"intersectsBox",(function(e){return this.isIntersectionBox(e)})),n(null==e||null===(g=e.BufferAttribute)||void 0===g?void 0:g.prototype,"applyMatrix4",(function(e){for(let t=0,i=this.count;t<i;t++)G.x=this.getX(t),G.y=this.getY(t),G.z=this.getZ(t),G.applyMatrix4(e),this.setXYZ(t,G.x,G.y,G.z);return this})),n(null==e||null===(v=e.BufferAttribute)||void 0===v?void 0:v.prototype,"getX",(function(e){return this.array[e*this.itemSize]})),n(null==e||null===(y=e.BufferAttribute)||void 0===y?void 0:y.prototype,"getY",(function(e){return this.array[e*this.itemSize+1]})),n(null==e||null===(b=e.BufferAttribute)||void 0===b?void 0:b.prototype,"getZ",(function(e){return this.array[e*this.itemSize+2]})),r(null==e||null===(x=e.BufferAttribute)||void 0===x?void 0:x.prototype,"itemOffset",{get:function(){return this.offset},set:function(e){this.offset=e}}),"function"==typeof(null==e?void 0:e.BufferAttribute)&&(n(e,"Float32BufferAttribute",class extends e.BufferAttribute{constructor(e,t,i){super(new Float32Array(e),t,i)}}),n(e,"Uint16BufferAttribute",class extends e.BufferAttribute{constructor(e,t,i){super(new Uint16Array(e),t,i)}}),n(e,"Uint32BufferAttribute",class extends e.BufferAttribute{constructor(e,t,i){super(new Uint32Array(e),t,i)}})),n(null==e||null===(_=e.BufferGeometry)||void 0===_?void 0:_.prototype,"applyMatrix4",(function(e){return this.applyMatrix(e),this})),r(null==e||null===(E=e.BufferGeometry)||void 0===E?void 0:E.prototype,"groups",{get:function(){return this.offsets},set:function(e){this.offsets=e,this.drawcalls=e}}),n(null==e||null===(S=e.BufferGeometry)||void 0===S?void 0:S.prototype,"addGroup",(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return void 0!==i&&0!==i&&console.warn("THREE.BufferGeometry: .addGroup() with `materialIndex !== 0` is not supported in this Three.js version. Ignoring the `materialIndex` parameter."),this.addDrawCall(e,t)})),r(null==e||null===(A=e.BufferGeometry)||void 0===A?void 0:A.prototype,"index",{get:function(){return this.attributes.index},set:function(e){this.attributes.index=e}}),n(null==e||null===(w=e.BufferGeometry)||void 0===w?void 0:w.prototype,"setFromPoints",(function(t){const i=[];for(let e=0,n=t.length;e<n;e++){const n=t[e];i.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new e.Float32BufferAttribute(i,3)),this})),n(null==e||null===(T=e.BufferGeometry)||void 0===T?void 0:T.prototype,"setIndex",(function(t){return Array.isArray(t)?this.index=new((e=>{if(0===e.length)return-1/0;for(var t=e[0],i=1,n=e.length;i<n;++i)e[i]>t&&(t=e[i]);return t})(t)>65535?e.Uint32BufferAttribute:e.Uint16BufferAttribute)(t,1):this.index=t,this})),"function"==typeof(null==e?void 0:e.BufferGeometry)&&(o(e),s(e),a(e),l(e),c(e),h(e),u(e)),n(null==e||null===(M=e.Frustum)||void 0===M?void 0:M.prototype,"setFromProjectionMatrix",(function(e){return this.setFromMatrix(e)})),n(null==e||null===(C=e.Geometry)||void 0===C?void 0:C.prototype,"applyMatrix4",(function(e){return this.applyMatrix(e),this})),"function"==typeof e.Line&&n(e,"LineSegments",class extends e.Line{constructor(t,i){super(t,i,e.LinePieces),this.isLineSegments=!0,this.type="LineSegments"}}),n(null==e||null===(P=e.Line)||void 0===P?void 0:P.prototype,"computeLineDistances",(function(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)_start.fromBufferAttribute(t,e-1),_end.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=_start.distanceTo(_end);e.setAttribute("lineDistance",new Float32BufferAttribute(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this})),n(null==e||null===(D=e.Matrix3)||void 0===D?void 0:D.prototype,"invert",(function(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=c*o-s*l,u=s*a-c*r,d=l*r-o*a,f=t*h+i*u+n*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const p=1/f;return e[0]=h*p,e[1]=(n*l-c*i)*p,e[2]=(s*i-n*o)*p,e[3]=u*p,e[4]=(c*t-n*a)*p,e[5]=(n*r-s*t)*p,e[6]=d*p,e[7]=(i*a-l*t)*p,e[8]=(o*t-i*r)*p,this})),n(null==e||null===(L=e.Matrix4)||void 0===L?void 0:L.prototype,"invert",(function(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],f=e[12],p=e[13],m=e[14],g=e[15],v=h*m*l-p*u*l+p*a*d-s*m*d-h*a*g+s*u*g,y=f*u*l-c*m*l-f*a*d+o*m*d+c*a*g-o*u*g,b=c*p*l-f*h*l+f*s*d-o*p*d-c*s*g+o*h*g,x=f*h*a-c*p*a-f*s*u+o*p*u+c*s*m-o*h*m,_=t*v+i*y+n*b+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/_;return e[0]=v*E,e[1]=(p*u*r-h*m*r-p*n*d+i*m*d+h*n*g-i*u*g)*E,e[2]=(s*m*r-p*a*r+p*n*l-i*m*l-s*n*g+i*a*g)*E,e[3]=(h*a*r-s*u*r-h*n*l+i*u*l+s*n*d-i*a*d)*E,e[4]=y*E,e[5]=(c*m*r-f*u*r+f*n*d-t*m*d-c*n*g+t*u*g)*E,e[6]=(f*a*r-o*m*r-f*n*l+t*m*l+o*n*g-t*a*g)*E,e[7]=(o*u*r-c*a*r+c*n*l-t*u*l-o*n*d+t*a*d)*E,e[8]=b*E,e[9]=(f*h*r-c*p*r-f*i*d+t*p*d+c*i*g-t*h*g)*E,e[10]=(o*p*r-f*s*r+f*i*l-t*p*l-o*i*g+t*s*g)*E,e[11]=(c*s*r-o*h*r-c*i*l+t*h*l+o*i*d-t*s*d)*E,e[12]=x*E,e[13]=(c*p*n-f*h*n+f*i*u-t*p*u-c*i*m+t*h*m)*E,e[14]=(f*s*n-o*p*n-f*i*a+t*p*a+o*i*m-t*s*m)*E,e[15]=(o*h*n-c*s*n+c*i*a-t*h*a-o*i*u+t*s*u)*E,this})),r(null==e||null===(I=e.MeshPhongMaterial)||void 0===I?void 0:I.prototype,"flatShading",{get:function(){return this.shading===e.FlatShading},set:function(t){this.shading=!0===t?e.FlatShading:e.SmoothShading}}),n(null==e||null===(R=e.Object3D)||void 0===R?void 0:R.prototype,"applyMatrix4",(function(e){return this.applyMatrix(e)})),n(e,"PointsMaterial",e.PointCloudMaterial),n(null==e||null===(O=e.Quaternion)||void 0===O?void 0:O.prototype,"invert",(function(){return this.inverse()})),n(null==e||null===(N=e.Quaternion)||void 0===N?void 0:N.prototype,"slerpQuaternions",(function(e,t,i){return this.copy(e).slerp(t,i)})),n(null==e?void 0:e.Triangle,"getNormal",(function(e,t,i,n){return this.normal(e,t,i,n)})),n(null==e||null===(F=e.Vector2)||void 0===F?void 0:F.prototype,"fromBufferAttribute",(function(e,t,i){return this.fromAttribute(e,t,i)})),n(null==e||null===(U=e.Vector3)||void 0===U?void 0:U.prototype,"fromBufferAttribute",(function(e,t,i){return this.fromAttribute(e,t,i)})),n(null==e||null===(B=e.Vector4)||void 0===B?void 0:B.prototype,"fromBufferAttribute",(function(e,t,i){return this.fromAttribute(e,t,i)})),r(null==e||null===(k=e.WebGLRenderTarget)||void 0===k?void 0:k.prototype,"texture",{get:function(){return this}}),n(null==e||null===(V=e.Material)||void 0===V?void 0:V.prototype,"onBeforeCompile",(function(){}))}},72091:(e,t,i)=>{var n,r,o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M,C,P,D,L,I,R,O,N,F,U,B,k,V,G,z,H,W,j,q,X,Y,K=e.exports={REVISION:"71"};void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),K.log=function(){console.log.apply(console,arguments)},K.warn=function(){console.warn.apply(console,arguments)},K.error=function(){console.error.apply(console,arguments)},K.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},K.CullFaceNone=0,K.CullFaceBack=1,K.CullFaceFront=2,K.CullFaceFrontBack=3,K.FrontFaceDirectionCW=0,K.FrontFaceDirectionCCW=1,K.BasicShadowMap=0,K.PCFShadowMap=1,K.PCFSoftShadowMap=2,K.FrontSide=0,K.BackSide=1,K.DoubleSide=2,K.NoShading=0,K.FlatShading=1,K.SmoothShading=2,K.NoColors=0,K.FaceColors=1,K.VertexColors=2,K.NoBlending=0,K.NormalBlending=1,K.AdditiveBlending=2,K.SubtractiveBlending=3,K.MultiplyBlending=4,K.CustomBlending=5,K.AddEquation=100,K.SubtractEquation=101,K.ReverseSubtractEquation=102,K.MinEquation=103,K.MaxEquation=104,K.ZeroFactor=200,K.OneFactor=201,K.SrcColorFactor=202,K.OneMinusSrcColorFactor=203,K.SrcAlphaFactor=204,K.OneMinusSrcAlphaFactor=205,K.DstAlphaFactor=206,K.OneMinusDstAlphaFactor=207,K.DstColorFactor=208,K.OneMinusDstColorFactor=209,K.SrcAlphaSaturateFactor=210,K.MultiplyOperation=0,K.MixOperation=1,K.AddOperation=2,K.UVMapping=300,K.CubeReflectionMapping=301,K.CubeRefractionMapping=302,K.EquirectangularReflectionMapping=303,K.EquirectangularRefractionMapping=304,K.SphericalReflectionMapping=305,K.RepeatWrapping=1e3,K.ClampToEdgeWrapping=1001,K.MirroredRepeatWrapping=1002,K.NearestFilter=1003,K.NearestMipMapNearestFilter=1004,K.NearestMipMapLinearFilter=1005,K.LinearFilter=1006,K.LinearMipMapNearestFilter=1007,K.LinearMipMapLinearFilter=1008,K.UnsignedByteType=1009,K.ByteType=1010,K.ShortType=1011,K.UnsignedShortType=1012,K.IntType=1013,K.UnsignedIntType=1014,K.FloatType=1015,K.HalfFloatType=1025,K.UnsignedShort4444Type=1016,K.UnsignedShort5551Type=1017,K.UnsignedShort565Type=1018,K.AlphaFormat=1019,K.RGBFormat=1020,K.RGBAFormat=1021,K.LuminanceFormat=1022,K.LuminanceAlphaFormat=1023,K.RGBEFormat=K.RGBAFormat,K.RGB_S3TC_DXT1_Format=2001,K.RGBA_S3TC_DXT1_Format=2002,K.RGBA_S3TC_DXT3_Format=2003,K.RGBA_S3TC_DXT5_Format=2004,K.RGB_PVRTC_4BPPV1_Format=2100,K.RGB_PVRTC_2BPPV1_Format=2101,K.RGBA_PVRTC_4BPPV1_Format=2102,K.RGBA_PVRTC_2BPPV1_Format=2103,K.Projector=function(){K.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){K.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){K.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){K.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},K.CanvasRenderer=function(){K.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},K.Color=function(e){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},K.Color.prototype={constructor:K.Color,r:1,g:1,b:1,set:function(e){return e instanceof K.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(e,t,i){if(0===t)this.r=this.g=this.b=i;else{var n=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e},r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=n(o,r,e+1/3),this.g=n(o,r,e),this.b=n(o,r,e-1/3)}return this},setStyle:function(e){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(e)){var t=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(e)){t=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}if(/^(\w+)$/i.test(e))return this.setHex(K.ColorKeywords[e]),this},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,i,n=e||{h:0,s:0,l:0},r=this.r,o=this.g,s=this.b,a=Math.max(r,o,s),l=Math.min(r,o,s),c=(l+a)/2;if(l===a)t=0,i=0;else{var h=a-l;switch(i=c<=.5?h/(a+l):h/(2-a-l),a){case r:t=(o-s)/h+(o<s?6:0);break;case o:t=(s-r)/h+2;break;case s:t=(r-o)/h+4}t/=6}return n.h=t,n.s=i,n.l=c,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var n=this.getHSL();return n.h+=e,n.s+=t,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},clone:function(){return(new K.Color).setRGB(this.r,this.g,this.b)}},K.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},K.Quaternion=function(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==n?n:1},K.Quaternion.prototype={constructor:K.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this.onChangeCallback(),this},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof K.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),n=Math.cos(e._y/2),r=Math.cos(e._z/2),o=Math.sin(e._x/2),s=Math.sin(e._y/2),a=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=o*n*r+i*s*a,this._y=i*s*r-o*n*a,this._z=i*n*a+o*s*r,this._w=i*n*r-o*s*a):"YXZ"===e.order?(this._x=o*n*r+i*s*a,this._y=i*s*r-o*n*a,this._z=i*n*a-o*s*r,this._w=i*n*r+o*s*a):"ZXY"===e.order?(this._x=o*n*r-i*s*a,this._y=i*s*r+o*n*a,this._z=i*n*a+o*s*r,this._w=i*n*r-o*s*a):"ZYX"===e.order?(this._x=o*n*r-i*s*a,this._y=i*s*r+o*n*a,this._z=i*n*a-o*s*r,this._w=i*n*r+o*s*a):"YZX"===e.order?(this._x=o*n*r+i*s*a,this._y=i*s*r+o*n*a,this._z=i*n*a-o*s*r,this._w=i*n*r-o*s*a):"XZY"===e.order&&(this._x=o*n*r-i*s*a,this._y=i*s*r-o*n*a,this._z=i*n*a+o*s*r,this._w=i*n*r+o*s*a),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,n=i[0],r=i[4],o=i[8],s=i[1],a=i[5],l=i[9],c=i[2],h=i[6],u=i[10],d=n+a+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-l)*t,this._y=(o-c)*t,this._z=(s-r)*t):n>a&&n>u?(t=2*Math.sqrt(1+n-a-u),this._w=(h-l)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(o+c)/t):a>u?(t=2*Math.sqrt(1+a-n-u),this._w=(o-c)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-n-a),this._w=(s-r)/t,this._x=(o+c)/t,this._y=(l+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(e,t){return void 0===n&&(n=new K.Vector3),(r=e.dot(t)+1)<1e-6?(r=0,Math.abs(e.x)>Math.abs(e.z)?n.set(-e.y,e.x,0):n.set(0,-e.z,e.y)):n.crossVectors(e,t),this._x=n.x,this._y=n.y,this._z=n.z,this._w=r,this.normalize(),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(K.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var i=e._x,n=e._y,r=e._z,o=e._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=i*c+o*s+n*l-r*a,this._y=n*c+o*a+r*s-i*l,this._z=r*c+o*l+i*a-n*s,this._w=o*c-i*s-n*a-r*l,this.onChangeCallback(),this},multiplyVector3:function(e){return K.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,n=this._y,r=this._z,o=this._w,s=o*e._w+i*e._x+n*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var a=Math.acos(s),l=Math.sqrt(1-s*s);if(Math.abs(l)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.sin((1-t)*a)/l,h=Math.sin(t*a)/l;return this._w=o*c+this._w*h,this._x=i*c+this._x*h,this._y=n*c+this._y*h,this._z=r*c+this._z*h,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new K.Quaternion(this._x,this._y,this._z,this._w)}},K.Quaternion.slerp=function(e,t,i,n){return i.copy(e).slerp(t,n)},K.Vector2=function(e,t){this.x=e||0,this.y=t||0},K.Vector2.prototype={constructor:K.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(K.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},sub:function(e,t){return void 0!==t?(K.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},clampScalar:function(e,t){return void 0===o&&(o=new K.Vector2,s=new K.Vector2),o.set(e,e),s.set(t,t),this.clamp(o,s)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new K.Vector2(this.x,this.y)}},K.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},K.Vector3.prototype={constructor:K.Vector3,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(K.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(K.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(K.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e instanceof K.Euler==0&&K.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===l&&(l=new K.Quaternion),this.applyQuaternion(l.setFromEuler(e)),this},applyAxisAngle:function(){var e;return function(t,i){return void 0===e&&(e=new K.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,i)),this}}(),applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12],this.y=r[1]*t+r[5]*i+r[9]*n+r[13],this.z=r[2]*t+r[6]*i+r[10]*n+r[14],this},applyProjection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,o=e.y,s=e.z,a=e.w,l=a*t+o*n-s*i,c=a*i+s*t-r*n,h=a*n+r*i-o*t,u=-r*t-o*i-s*n;return this.x=l*a+u*-r+c*-s-h*-o,this.y=c*a+u*-o+h*-r-l*-s,this.z=h*a+u*-s+l*-o-c*-r,this},project:function(e){return void 0===a&&(a=new K.Matrix4),a.multiplyMatrices(e.projectionMatrix,a.getInverse(e.matrixWorld)),this.applyProjection(a)},unproject:function(){var e;return function(t){return void 0===e&&(e=new K.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new K.Vector3,t=new K.Vector3),e.set(i,i,i),t.set(n,n,n),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e),this},cross:function(e,t){if(void 0!==t)return K.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-i*e.z,this.z=i*e.y-n*e.x,this},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,s=t.y,a=t.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this},projectOnVector:function(){var e,t;return function(i){return void 0===e&&(e=new K.Vector3),e.copy(i).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new K.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new K.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(K.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},setEulerFromRotationMatrix:function(e,t){K.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){K.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return K.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return K.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return K.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),i=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){var i=4*e,n=t.elements;return this.x=n[i],this.y=n[i+1],this.z=n[i+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new K.Vector3(this.x,this.y,this.z)}},K.Vector4=function(e,t,i,n){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==n?n:1},K.Vector4.prototype={constructor:K.Vector4,set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(K.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(e,t){return void 0!==t?(K.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*r,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t,this.w*=t}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,n,r,o=.01,s=.1,a=e.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],f=a[9],p=a[2],m=a[6],g=a[10];if(Math.abs(c-u)<o&&Math.abs(h-p)<o&&Math.abs(f-m)<o){if(Math.abs(c+u)<s&&Math.abs(h+p)<s&&Math.abs(f+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;var v=(l+1)/2,y=(d+1)/2,b=(g+1)/2,x=(c+u)/4,_=(h+p)/4,E=(f+m)/4;return v>y&&v>b?v<o?(i=0,n=.707106781,r=.707106781):(n=x/(i=Math.sqrt(v)),r=_/i):y>b?y<o?(i=.707106781,n=0,r=.707106781):(i=x/(n=Math.sqrt(y)),r=E/n):b<o?(i=.707106781,n=.707106781,r=0):(i=_/(r=Math.sqrt(b)),n=E/r),this.set(i,n,r,t),this}var S=Math.sqrt((m-f)*(m-f)+(h-p)*(h-p)+(u-c)*(u-c));return Math.abs(S)<.001&&(S=1),this.x=(m-f)/S,this.y=(h-p)/S,this.z=(u-c)/S,this.w=Math.acos((l+d+g-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this.w<e.w&&(this.w=e.w),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this.w<e.w?this.w=e.w:this.w>t.w&&(this.w=t.w),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new K.Vector4,t=new K.Vector4),e.set(i,i,i,i),t.set(n,n,n,n),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this},clone:function(){return new K.Vector4(this.x,this.y,this.z,this.w)}},K.Euler=function(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._order=n||K.Euler.DefaultOrder},K.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],K.Euler.DefaultOrder="XYZ",K.Euler.prototype={constructor:K.Euler,_x:0,_y:0,_z:0,_order:K.Euler.DefaultOrder,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var n=K.Math.clamp,r=e.elements,o=r[0],s=r[4],a=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],f=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===t?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,c))):"YZX"===t?(this._z=Math.asin(n(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(a,f))):"XZY"===t?(this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-h,f),this._y=0)):K.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,i,n){return void 0===e&&(e=new K.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,n),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(c=new K.Quaternion,function(e){c.setFromEuler(this),this.setFromQuaternion(c,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new K.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new K.Euler(this._x,this._y,this._z,this._order)}},K.Line3=function(e,t){this.start=void 0!==e?e:new K.Vector3,this.end=void 0!==t?t:new K.Vector3},K.Line3.prototype={constructor:K.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){return(e||new K.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new K.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new K.Vector3;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(h=new K.Vector3,u=new K.Vector3,function(e,t){h.subVectors(e,this.start),u.subVectors(this.end,this.start);var i=u.dot(u),n=u.dot(h)/i;return t&&(n=K.Math.clamp(n,0,1)),n}),closestPointToPoint:function(e,t,i){var n=this.closestPointToPointParameter(e,t),r=i||new K.Vector3;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new K.Line3).copy(this)}},K.Box2=function(e,t){this.min=void 0!==e?e:new K.Vector2(1/0,1/0),this.max=void 0!==t?t:new K.Vector2(-1/0,-1/0)},K.Box2.prototype={constructor:K.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new K.Vector2;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},empty:function(){return console.warn("Box2.empty has been deprecated. Use Box2.isEmpty instead"),this.isEmpty()},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){return console.warn("Box2.center() is deprecated. Use Box2.getCenter() instead."),this.getCenter(e)},getCenter:function(e){return(e||new K.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new K.Vector2).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new K.Vector2).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new K.Vector2).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new K.Vector2;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new K.Box2).copy(this)}},K.Box3=function(e,t){this.min=void 0!==e?e:new K.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new K.Vector3(-1/0,-1/0,-1/0)},K.Box3.prototype={constructor:K.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new K.Vector3;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var e=new K.Vector3;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse((function(t){var n=t.geometry;if(void 0!==n)if(n instanceof K.Geometry)for(var r=n.vertices,o=0,s=r.length;o<s;o++)e.copy(r[o]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e);else if(n instanceof K.BufferGeometry&&void 0!==n.attributes.position){var a=n.attributes.position.array;for(o=0,s=a.length;o<s;o+=3)e.set(a[o],a[o+1],a[o+2]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e)}})),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},empty:function(){return console.warn("Box3.empty has been deprecated. Use Box3.isEmpty instead"),this.isEmpty()},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){return console.warn("Box3.center() is deprecated. Use Box3.getCenter() instead."),this.getCenter(e)},getCenter:function(e){return e=e||new K.Vector3,this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new K.Vector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new K.Vector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},clampPoint:function(e,t){return(t||new K.Vector3).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new K.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new K.Vector3;return function(t){var i=t||new K.Sphere;return i.center=this.getCenter(),i.radius=.5*this.size(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(d=[new K.Vector3,new K.Vector3,new K.Vector3,new K.Vector3,new K.Vector3,new K.Vector3,new K.Vector3,new K.Vector3],function(e){return d[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),d[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),d[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),d[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),d[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),d[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),d[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),d[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(d),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new K.Box3).copy(this)}},K.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&K.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},K.Matrix3.prototype={constructor:K.Matrix3,set:function(e,t,i,n,r,o,s,a,l){var c=this.elements;return c[0]=e,c[3]=t,c[6]=i,c[1]=n,c[4]=r,c[7]=o,c[2]=s,c[5]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return K.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return K.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new K.Vector3;return function(t,i,n){void 0===i&&(i=0),void 0===n&&(n=t.length);for(var r=0,o=i;r<n;r+=3,o+=3)e.x=t[o],e.y=t[o+1],e.z=t[o+2],e.applyMatrix3(this),t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z;return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8];return t*o*c-t*s*l-i*r*c+i*s*a+n*r*l-n*o*a},getInverse:function(e,t){var i=e.elements,n=this.elements;n[0]=i[10]*i[5]-i[6]*i[9],n[1]=-i[10]*i[1]+i[2]*i[9],n[2]=i[6]*i[1]-i[2]*i[5],n[3]=-i[10]*i[4]+i[6]*i[8],n[4]=i[10]*i[0]-i[2]*i[8],n[5]=-i[6]*i[0]+i[2]*i[4],n[6]=i[9]*i[4]-i[5]*i[8],n[7]=-i[9]*i[0]+i[1]*i[8],n[8]=i[5]*i[0]-i[1]*i[4];var r=i[0]*n[0]+i[1]*n[3]+i[2]*n[6];if(0===r){var o="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(o);return K.warn(o),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},clone:function(){return(new K.Matrix3).fromArray(this.elements)}},K.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&K.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},K.Matrix4.prototype={constructor:K.Matrix4,set:function(e,t,i,n,r,o,s,a,l,c,h,u,d,f,p,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return K.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){var n=this.elements;return e.set(n[0],n[1],n[2]),t.set(n[4],n[5],n[6]),i.set(n[8],n[9],n[10]),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e=new K.Vector3;return function(t){var i=this.elements,n=t.elements,r=1/e.set(n[0],n[1],n[2]).length(),o=1/e.set(n[4],n[5],n[6]).length(),s=1/e.set(n[8],n[9],n[10]).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*s,i[9]=n[9]*s,i[10]=n[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof K.Euler==!1&&K.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,n=e.y,r=e.z,o=Math.cos(i),s=Math.sin(i),a=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*c,d=o*h,f=s*c,p=s*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=d+f*l,t[5]=u-p*l,t[9]=-s*a,t[2]=p-u*l,t[6]=f+d*l,t[10]=o*a}else if("YXZ"===e.order){var m=a*c,g=a*h,v=l*c,y=l*h;t[0]=m+y*s,t[4]=v*s-g,t[8]=o*l,t[1]=o*h,t[5]=o*c,t[9]=-s,t[2]=g*s-v,t[6]=y+m*s,t[10]=o*a}else if("ZXY"===e.order){m=a*c,g=a*h,v=l*c,y=l*h;t[0]=m-y*s,t[4]=-o*h,t[8]=v+g*s,t[1]=g+v*s,t[5]=o*c,t[9]=y-m*s,t[2]=-o*l,t[6]=s,t[10]=o*a}else if("ZYX"===e.order){u=o*c,d=o*h,f=s*c,p=s*h;t[0]=a*c,t[4]=f*l-d,t[8]=u*l+p,t[1]=a*h,t[5]=p*l+u,t[9]=d*l-f,t[2]=-l,t[6]=s*a,t[10]=o*a}else if("YZX"===e.order){var b=o*a,x=o*l,_=s*a,E=s*l;t[0]=a*c,t[4]=E-b*h,t[8]=_*h+x,t[1]=h,t[5]=o*c,t[9]=-s*c,t[2]=-l*c,t[6]=x*h+_,t[10]=b-E*h}else if("XZY"===e.order){b=o*a,x=o*l,_=s*a,E=s*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=b*h+E,t[5]=o*c,t[9]=x*h-_,t[2]=_*h-x,t[6]=s*c,t[10]=E*h+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return K.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z,o=e.w,s=i+i,a=n+n,l=r+r,c=i*s,h=i*a,u=i*l,d=n*a,f=n*l,p=r*l,m=o*s,g=o*a,v=o*l;return t[0]=1-(d+p),t[4]=h-v,t[8]=u+g,t[1]=h+v,t[5]=1-(c+p),t[9]=f-m,t[2]=u-g,t[6]=f+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new K.Vector3,t=new K.Vector3,i=new K.Vector3;return function(n,r,o){var s=this.elements;return i.subVectors(n,r).normalize(),0===i.length()&&(i.z=1),e.crossVectors(o,i).normalize(),0===e.length()&&(i.x+=1e-4,e.crossVectors(o,i).normalize()),t.crossVectors(i,e),s[0]=e.x,s[4]=t.x,s[8]=i.x,s[1]=e.y,s[5]=t.y,s[9]=i.y,s[2]=e.z,s[6]=t.z,s[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(K.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,o=i[0],s=i[4],a=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],_=n[0],E=n[4],S=n[8],A=n[12],w=n[1],T=n[5],M=n[9],C=n[13],P=n[2],D=n[6],L=n[10],I=n[14],R=n[3],O=n[7],N=n[11],F=n[15];return r[0]=o*_+s*w+a*P+l*R,r[4]=o*E+s*T+a*D+l*O,r[8]=o*S+s*M+a*L+l*N,r[12]=o*A+s*C+a*I+l*F,r[1]=c*_+h*w+u*P+d*R,r[5]=c*E+h*T+u*D+d*O,r[9]=c*S+h*M+u*L+d*N,r[13]=c*A+h*C+u*I+d*F,r[2]=f*_+p*w+m*P+g*R,r[6]=f*E+p*T+m*D+g*O,r[10]=f*S+p*M+m*L+g*N,r[14]=f*A+p*C+m*I+g*F,r[3]=v*_+y*w+b*P+x*R,r[7]=v*E+y*T+b*D+x*O,r[11]=v*S+y*M+b*L+x*N,r[15]=v*A+y*C+b*I+x*F,this},multiplyToArray:function(e,t,i){var n=this.elements;return this.multiplyMatrices(e,t),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return K.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return K.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return K.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new K.Vector3;return function(t,i,n){void 0===i&&(i=0),void 0===n&&(n=t.length);for(var r=0,o=i;r<n;r+=3,o+=3)e.x=t[o],e.y=t[o+1],e.z=t[o+2],e.applyMatrix4(this),t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z;return t}}(),rotateAxis:function(e){K.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return K.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],o=e[1],s=e[5],a=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*a*h-n*l*h-r*s*u+i*l*u+n*s*d-i*a*d)+e[7]*(+t*a*d-t*l*u+r*o*u-n*o*d+n*l*c-r*a*c)+e[11]*(+t*l*h-t*s*d-r*o*h+i*o*d+r*s*c-i*l*c)+e[15]*(-n*s*c-t*a*h+t*s*u+n*o*h-i*o*u+i*a*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e},getPosition:function(){var e=new K.Vector3;return function(){K.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,n=e.elements,r=n[0],o=n[4],s=n[8],a=n[12],l=n[1],c=n[5],h=n[9],u=n[13],d=n[2],f=n[6],p=n[10],m=n[14],g=n[3],v=n[7],y=n[11],b=n[15];i[0]=h*m*v-u*p*v+u*f*y-c*m*y-h*f*b+c*p*b,i[4]=a*p*v-s*m*v-a*f*y+o*m*y+s*f*b-o*p*b,i[8]=s*u*v-a*h*v+a*c*y-o*u*y-s*c*b+o*h*b,i[12]=a*h*f-s*u*f-a*c*p+o*u*p+s*c*m-o*h*m,i[1]=u*p*g-h*m*g-u*d*y+l*m*y+h*d*b-l*p*b,i[5]=s*m*g-a*p*g+a*d*y-r*m*y-s*d*b+r*p*b,i[9]=a*h*g-s*u*g-a*l*y+r*u*y+s*l*b-r*h*b,i[13]=s*u*d-a*h*d+a*l*p-r*u*p-s*l*m+r*h*m,i[2]=c*m*g-u*f*g+u*d*v-l*m*v-c*d*b+l*f*b,i[6]=a*f*g-o*m*g-a*d*v+r*m*v+o*d*b-r*f*b,i[10]=o*u*g-a*c*g+a*l*v-r*u*v-o*l*b+r*c*b,i[14]=a*c*d-o*u*d-a*l*f+r*u*f+o*l*m-r*c*m,i[3]=h*f*g-c*p*g-h*d*v+l*p*v+c*d*y-l*f*y,i[7]=o*p*g-s*f*g+s*d*v-r*p*v-o*d*y+r*f*y,i[11]=s*c*g-o*h*g-s*l*v+r*h*v+o*l*y-r*c*y,i[15]=o*h*d-s*c*d+s*l*f-r*h*f-o*l*p+r*c*p;var x=r*i[0]+l*i[4]+d*i[8]+g*i[12];if(0==x){var _="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(_);return K.warn(_),this.identity(),this}return this.multiplyScalar(1/x),this},translate:function(e){K.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){K.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){K.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){K.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){K.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(i,n)))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,o=e.x,s=e.y,a=e.z,l=r*o,c=r*s;return this.set(l*o+i,l*s-n*a,l*a+n*s,0,l*s+n*a,c*s+i,c*a-n*o,0,l*a-n*s,c*a+n*o,r*a*a+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e=new K.Vector3,t=new K.Matrix4;return function(i,n,r){var o=this.elements,s=e.set(o[0],o[1],o[2]).length(),a=e.set(o[4],o[5],o[6]).length(),l=e.set(o[8],o[9],o[10]).length();this.determinant()<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],t.elements.set(this.elements);var c=1/s,h=1/a,u=1/l;return t.elements[0]*=c,t.elements[1]*=c,t.elements[2]*=c,t.elements[4]*=h,t.elements[5]*=h,t.elements[6]*=h,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,n.setFromRotationMatrix(t),r.x=s,r.y=a,r.z=l,this}}(),makeFrustum:function(e,t,i,n,r,o){var s=this.elements,a=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this},makePerspective:function(e,t,i,n){var r=i*Math.tan(K.Math.degToRad(.5*e)),o=-r,s=o*t,a=r*t;return this.makeFrustum(s,a,o,r,i,n)},makeOrthographic:function(e,t,i,n,r,o){var s=this.elements,a=t-e,l=i-n,c=o-r,h=(t+e)/a,u=(i+n)/l,d=(o+r)/c;return s[0]=2/a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2/l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2/c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},equals(e){const t=this.elements,i=e.elements;for(var n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){return(new K.Matrix4).fromArray(this.elements)}},K.Ray=function(e,t){this.origin=void 0!==e?e:new K.Vector3,this.direction=void 0!==t?t:new K.Vector3},K.Ray.prototype={constructor:K.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new K.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new K.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new K.Vector3;i.subVectors(e,this.origin);var n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(){var e=new K.Vector3;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceTo(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceTo(t))}}(),distanceSqToSegment:(p=new K.Vector3,m=new K.Vector3,g=new K.Vector3,function(e,t,i,n){p.copy(e).add(t).multiplyScalar(.5),m.copy(t).sub(e).normalize(),g.copy(this.origin).sub(p);var r,o,s,a,l=.5*e.distanceTo(t),c=-this.direction.dot(m),h=g.dot(this.direction),u=-g.dot(m),d=g.lengthSq(),f=Math.abs(1-c*c);if(f>0)if(o=c*h-u,a=l*f,(r=c*u-h)>=0)if(o>=-a)if(o<=a){var v=1/f;s=(r*=v)*(r+c*(o*=v)+2*h)+o*(c*r+o+2*u)+d}else o=l,s=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+d;else o=-l,s=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+d;else o<=-a?s=-(r=Math.max(0,-(-c*l+h)))*r+(o=r>0?-l:Math.min(Math.max(-l,-u),l))*(o+2*u)+d:o<=a?(r=0,s=(o=Math.min(Math.max(-l,-u),l))*(o+2*u)+d):s=-(r=Math.max(0,-(c*l+h)))*r+(o=r>0?l:Math.min(Math.max(-l,-u),l))*(o+2*u)+d;else o=c>0?-l:l,s=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+d;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(m).multiplyScalar(o).add(p),s}),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var e=new K.Vector3;return function(t,i){e.subVectors(t.center,this.origin);var n=e.dot(this.direction),r=e.dot(e)-n*n,o=t.radius*t.radius;if(r>o)return null;var s=Math.sqrt(o-r),a=n-s,l=n+s;return a<0&&l<0?null:a<0?this.at(l,i):this.at(a,i)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},isIntersectionBox:(f=new K.Vector3,function(e){return null!==this.intersectBox(e,f)}),intersectBox:function(e,t){var i,n,r,o,s,a,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o<n||n!=n)&&(n=o),h>=0?(s=(e.min.z-u.z)*h,a=(e.max.z-u.z)*h):(s=(e.max.z-u.z)*h,a=(e.min.z-u.z)*h),i>a||s>n?null:((s>i||i!=i)&&(i=s),(a<n||n!=n)&&(n=a),n<0?null:this.at(i>=0?i:n,t)))},intersectTriangle:function(){var e=new K.Vector3,t=new K.Vector3,i=new K.Vector3,n=new K.Vector3;return function(r,o,s,a,l){t.subVectors(o,r),i.subVectors(s,r),n.crossVectors(t,i);var c,h=this.direction.dot(n);if(h>0){if(a)return null;c=1}else{if(!(h<0))return null;c=-1,h=-h}e.subVectors(this.origin,r);var u=c*this.direction.dot(i.crossVectors(e,i));if(u<0)return null;var d=c*this.direction.dot(t.cross(e));if(d<0)return null;if(u+d>h)return null;var f=-c*e.dot(n);return f<0?null:this.at(f/h,l)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new K.Ray).copy(this)}},K.Sphere=function(e,t){this.center=void 0!==e?e:new K.Vector3,this.radius=void 0!==t?t:0},K.Sphere.prototype={constructor:K.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(v=new K.Box3,function(e,t){var i=this.center;void 0!==t?i.copy(t):v.setFromPoints(e).getCenter(i);for(var n=0,r=0,o=e.length;r<o;r++)n=Math.max(n,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(n),this}),copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),n=t||new K.Vector3;return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new K.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new K.Sphere).copy(this)}},K.Frustum=function(e,t,i,n,r,o){this.planes=[void 0!==e?e:new K.Plane,void 0!==t?t:new K.Plane,void 0!==i?i:new K.Plane,void 0!==n?n:new K.Plane,void 0!==r?r:new K.Plane,void 0!==o?o:new K.Plane]},K.Frustum.prototype={constructor:K.Frustum,set:function(e,t,i,n,r,o){var s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(o),this},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],c=i[6],h=i[7],u=i[8],d=i[9],f=i[10],p=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(s-n,h-a,p-u,y-m).normalize(),t[1].setComponents(s+n,h+a,p+u,y+m).normalize(),t[2].setComponents(s+r,h+l,p+d,y+g).normalize(),t[3].setComponents(s-r,h-l,p-d,y-g).normalize(),t[4].setComponents(s-o,h-c,p-f,y-v).normalize(),t[5].setComponents(s+o,h+c,p+f,y+v).normalize(),this},intersectsObject:(x=new K.Sphere,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),x.copy(t.boundingSphere),x.applyMatrix4(e.matrixWorld),this.intersectsSphere(x)}),intersectsSphere:function(e){for(var t=this.planes,i=e.center,n=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:(y=new K.Vector3,b=new K.Vector3,function(e){for(var t=this.planes,i=0;i<6;i++){var n=t[i];y.x=n.normal.x>0?e.min.x:e.max.x,b.x=n.normal.x>0?e.max.x:e.min.x,y.y=n.normal.y>0?e.min.y:e.max.y,b.y=n.normal.y>0?e.max.y:e.min.y,y.z=n.normal.z>0?e.min.z:e.max.z,b.z=n.normal.z>0?e.max.z:e.min.z;var r=n.distanceToPoint(y),o=n.distanceToPoint(b);if(r<0&&o<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0},clone:function(){return(new K.Frustum).copy(this)}},K.Plane=function(e,t){this.normal=void 0!==e?e:new K.Vector3(1,0,0),this.constant=void 0!==t?t:0},K.Plane.prototype={constructor:K.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new K.Vector3,t=new K.Vector3;return function(i,n,r){var o=e.subVectors(r,n).cross(t.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e);return(t||new K.Vector3).copy(this.normal).multiplyScalar(i)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0},intersectLine:function(){var e=new K.Vector3;return function(t,i){var n=i||new K.Vector3,r=t.delta(e),o=this.normal.dot(r);if(0==o)return 0==this.distanceToPoint(t.start)?n.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/o;return s<0||s>1?void 0:n.copy(r).multiplyScalar(s).add(t.start)}}(),coplanarPoint:function(e){return(e||new K.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new K.Vector3,t=new K.Vector3,i=new K.Matrix3;return function(n,r){var o=r||i.getNormalMatrix(n),s=e.copy(this.normal).applyMatrix3(o);s.normalize();var a=this.coplanarPoint(t);return a.applyMatrix4(n),this.setFromNormalAndCoplanarPoint(s,a),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new K.Plane).copy(this)}},K.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;r<36;r++)8==r||13==r||18==r||23==r?i[r]="-":14==r?i[r]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[r]=t[19==r?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return e<t?t:e>i?i:e},clampBottom:function(e,t){return e<t?t:e},mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:(E=Math.PI/180,function(e){return e*E}),radToDeg:(_=180/Math.PI,function(e){return e*_}),isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}},K.Spline=function(e){this.points=e;var t,i,n,r,o,s,a,l,c,h=[],u={x:0,y:0,z:0};function d(e,t,i,n,r,o,s){var a=.5*(i-e),l=.5*(n-t);return(2*(t-i)+a+l)*s+(-3*(t-i)-2*a-l)*o+a*r+t}this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return t=(this.points.length-1)*e,i=Math.floor(t),n=t-i,h[0]=0===i?i:i-1,h[1]=i,h[2]=i>this.points.length-2?this.points.length-1:i+1,h[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[h[0]],a=this.points[h[1]],l=this.points[h[2]],c=this.points[h[3]],o=n*(r=n*n),u.x=d(s.x,a.x,l.x,c.x,n,r,o),u.y=d(s.y,a.y,l.y,c.y,n,r,o),u.z=d(s.z,a.z,l.z,c.z,n,r,o),u},this.getControlPointsArray=function(){var e,t,i=this.points.length,n=[];for(e=0;e<i;e++)t=this.points[e],n[e]=[t.x,t.y,t.z];return n},this.getLength=function(e){var t,i,n,r,o=0,s=0,a=0,l=new K.Vector3,c=new K.Vector3,h=[],u=0;for(h[0]=0,e||(e=100),n=this.points.length*e,l.copy(this.points[0]),t=1;t<n;t++)i=t/n,r=this.getPoint(i),c.copy(r),u+=c.distanceTo(l),l.copy(r),o=(this.points.length-1)*i,(s=Math.floor(o))!=a&&(h[s]=u,a=s);return h[h.length]=u,{chunks:h,total:u}},this.reparametrizeByArcLength=function(e){var t,i,n,r,o,s,a,l,c=[],h=new K.Vector3,u=this.getLength();for(c.push(h.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(s=u.chunks[t]-u.chunks[t-1],a=Math.ceil(e*s/u.total),r=(t-1)/(this.points.length-1),o=t/(this.points.length-1),i=1;i<a-1;i++)n=r+i*(1/a)*(o-r),l=this.getPoint(n),c.push(h.copy(l).clone());c.push(h.copy(this.points[t]).clone())}this.points=c}},K.Triangle=function(e,t,i){this.a=void 0!==e?e:new K.Vector3,this.b=void 0!==t?t:new K.Vector3,this.c=void 0!==i?i:new K.Vector3},K.Triangle.normal=(S=new K.Vector3,function(e,t,i,n){var r=n||new K.Vector3;r.subVectors(i,t),S.subVectors(e,t),r.cross(S);var o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}),K.Triangle.barycoordFromPoint=function(){var e=new K.Vector3,t=new K.Vector3,i=new K.Vector3;return function(n,r,o,s,a){e.subVectors(s,r),t.subVectors(o,r),i.subVectors(n,r);var l=e.dot(e),c=e.dot(t),h=e.dot(i),u=t.dot(t),d=t.dot(i),f=l*u-c*c,p=a||new K.Vector3;if(0==f)return p.set(-2,-1,-1);var m=1/f,g=(u*h-c*d)*m,v=(l*d-c*h)*m;return p.set(1-g-v,v,g)}}(),K.Triangle.containsPoint=function(){var e=new K.Vector3;return function(t,i,n,r){var o=K.Triangle.barycoordFromPoint(t,i,n,r,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),K.Triangle.prototype={constructor:K.Triangle,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new K.Vector3,t=new K.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new K.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return K.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new K.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return K.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return K.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new K.Triangle).copy(this)}},K.Clock=function(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},K.Clock.prototype={constructor:K.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},K.EventDispatcher=function(){},K.EventDispatcher.prototype={constructor:K.EventDispatcher,apply:function(e){e.addEventListener=K.EventDispatcher.prototype.addEventListener,e.hasEventListener=K.EventDispatcher.prototype.hasEventListener,e.removeEventListener=K.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=K.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners[e];if(void 0!==i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var i=[],n=t.length,r=0;r<n;r++)i[r]=t[r];for(r=0;r<n;r++)i[r].call(this,e)}}}},function(e){e.Raycaster=function(t,i,n,r){this.ray=new e.Ray(t,i),this.near=n||0,this.far=r||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{threshold:1}}};var t=function(e,t){return e.distance-t.distance},i=function(e,t,n,r){if(e.raycast(t,n),!0===r)for(var o=e.children,s=0,a=o.length;s<a;s++)i(o[s],t,n,!0)};e.Raycaster.prototype={constructor:e.Raycaster,precision:1e-4,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,i){i instanceof e.PerspectiveCamera?(this.ray.origin.copy(i.position),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(i.position).normalize()):i instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld)):e.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,n){var r=[];return i(e,this,r,n),r.sort(t),r},intersectObjects:function(n,r){var o=[];if(n instanceof Array==!1)return e.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),o;for(var s=0,a=n.length;s<a;s++)i(n[s],this,o,r);return o.sort(t),o}},Object.defineProperty(e.Raycaster.prototype,"linePrecision",{get:function(){return console.warn("THREE.Raycaster: .linePrecision is now .params.Line.threshold."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision is now .params.Line.threshold."),this.params.Line.threshold=e}})}(K),K.Object3D=function(){Object.defineProperty(this,"id",{value:K.Object3DIdCount++}),this.uuid=K.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=K.Object3D.DefaultUp.clone();var e=new K.Vector3,t=new K.Euler,i=new K.Quaternion,n=new K.Vector3(1,1,1);t.onChange((function(){i.setFromEuler(t,!1)})),i.onChange((function(){t.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:n}}),this.rotationAutoUpdate=!0,this.matrix=new K.Matrix4,this.matrixWorld=new K.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},K.Object3D.DefaultUp=new K.Vector3(0,1,0),K.Object3D.prototype={constructor:K.Object3D,get eulerOrder(){return K.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(e){K.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=e},get useQuaternion(){K.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(e){K.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(M=new K.Quaternion,function(e,t){return M.setFromAxisAngle(e,t),this.quaternion.multiply(M),this}),rotateX:function(){var e=new K.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new K.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new K.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new K.Vector3;return function(t,i){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translate:function(e,t){return K.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},translateX:function(){var e=new K.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new K.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new K.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(T=new K.Matrix4,function(e){return e.applyMatrix4(T.getInverse(this.matrixWorld))}),lookAt:function(){var e=new K.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(K.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof K.Object3D?(void 0!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):K.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var i=this.children.indexOf(e);-1!==i&&(e.parent=void 0,e.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getChildByName:function(e){return K.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){var t=e||new K.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(A=new K.Vector3,w=new K.Vector3,function(e){var t=e||new K.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(A,t,w),t}),getWorldRotation:function(){var e=new K.Quaternion;return function(t){var i=t||new K.Euler;return this.getWorldQuaternion(e),i.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new K.Vector3,t=new K.Quaternion;return function(i){var n=i||new K.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new K.Quaternion;return function(t){var i=t||new K.Vector3;return this.getWorldQuaternion(e),i.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=0,i=this.children.length;t<i;t++)this.children[t].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=0,i=this.children.length;t<i;t++)this.children[t].traverseVisible(e)}},traverseAncestors:function(e){this.parent&&(e(this.parent),this.parent.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(){var e={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},t={},i={},n=function(t){if(void 0===e.materials&&(e.materials=[]),void 0===i[t.uuid]){var n=t.toJSON();delete n.metadata,i[t.uuid]=n,e.materials.push(n)}return t.uuid},r=function(i){var o={};if(o.uuid=i.uuid,o.type=i.type,""!==i.name&&(o.name=i.name),"{}"!==JSON.stringify(i.userData)&&(o.userData=i.userData),!0!==i.visible&&(o.visible=i.visible),i instanceof K.PerspectiveCamera?(o.fov=i.fov,o.aspect=i.aspect,o.near=i.near,o.far=i.far):i instanceof K.OrthographicCamera?(o.left=i.left,o.right=i.right,o.top=i.top,o.bottom=i.bottom,o.near=i.near,o.far=i.far):i instanceof K.AmbientLight?o.color=i.color.getHex():i instanceof K.DirectionalLight?(o.color=i.color.getHex(),o.intensity=i.intensity):i instanceof K.PointLight?(o.color=i.color.getHex(),o.intensity=i.intensity,o.distance=i.distance,o.decay=i.decay):i instanceof K.SpotLight?(o.color=i.color.getHex(),o.intensity=i.intensity,o.distance=i.distance,o.angle=i.angle,o.exponent=i.exponent,o.decay=i.decay):i instanceof K.HemisphereLight?(o.color=i.color.getHex(),o.groundColor=i.groundColor.getHex()):i instanceof K.Mesh||i instanceof K.Line||i instanceof K.PointCloud?(o.geometry=function(i){if(void 0===e.geometries&&(e.geometries=[]),void 0===t[i.uuid]){var n=i.toJSON();delete n.metadata,t[i.uuid]=n,e.geometries.push(n)}return i.uuid}(i.geometry),o.material=n(i.material),i instanceof K.Line&&(o.mode=i.mode)):i instanceof K.Sprite&&(o.material=n(i.material)),o.matrix=i.matrix.toArray(),i.children.length>0){o.children=[];for(var s=0;s<i.children.length;s++)o.children.push(r(i.children[s]))}return o};return e.object=r(this),e},clone:function(e,t){if(void 0===e&&(e=new K.Object3D),void 0===t&&(t=!0),e.name=this.name,e.up.copy(this.up),e.position.copy(this.position),e.quaternion.copy(this.quaternion),e.scale.copy(this.scale),e.rotationAutoUpdate=this.rotationAutoUpdate,e.matrix.copy(this.matrix),e.matrixWorld.copy(this.matrixWorld),e.matrixAutoUpdate=this.matrixAutoUpdate,e.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,e.visible=this.visible,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow,e.frustumCulled=this.frustumCulled,e.userData=JSON.parse(JSON.stringify(this.userData)),!0===t)for(var i=0;i<this.children.length;i++){var n=this.children[i];e.add(n.clone())}return e}},K.EventDispatcher.prototype.apply(K.Object3D.prototype),K.Object3DIdCount=0,K.Face3=function(e,t,i,n,r,o){this.a=e,this.b=t,this.c=i,this.normal=n instanceof K.Vector3?n:new K.Vector3,this.vertexNormals=n instanceof Array?n:[],this.color=r instanceof K.Color?r:new K.Color,this.vertexColors=r instanceof Array?r:[],this.vertexTangents=[],this.materialIndex=void 0!==o?o:0},K.Face3.prototype={constructor:K.Face3,clone:function(){var e=new K.Face3(this.a,this.b,this.c);e.normal.copy(this.normal),e.color.copy(this.color),e.materialIndex=this.materialIndex;for(var t=0,i=this.vertexNormals.length;t<i;t++)e.vertexNormals[t]=this.vertexNormals[t].clone();for(t=0,i=this.vertexColors.length;t<i;t++)e.vertexColors[t]=this.vertexColors[t].clone();for(t=0,i=this.vertexTangents.length;t<i;t++)e.vertexTangents[t]=this.vertexTangents[t].clone();return e}},K.Face4=function(e,t,i,n,r,o,s){return K.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new K.Face3(e,t,i,r,o,s)},K.BufferAttribute=function(e,t){this.array=e,this.itemSize=t,this.count=null!=e?e.length/t:0,this.needsUpdate=!1},K.BufferAttribute.prototype={constructor:K.BufferAttribute,get length(){return this.array.length},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},setX:function(e,t){return this.array[e*this.itemSize]=t,this},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=i,this.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this},clone:function(){return new K.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},K.Int8Attribute=function(e,t){return K.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Uint8Attribute=function(e,t){return K.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Uint8ClampedAttribute=function(e,t){return K.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Int16Attribute=function(e,t){return K.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Uint16Attribute=function(e,t){return K.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Int32Attribute=function(e,t){return K.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Uint32Attribute=function(e,t){return K.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Float32Attribute=function(e,t){return K.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.Float64Attribute=function(e,t){return K.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new K.BufferAttribute(e,t)},K.DynamicBufferAttribute=function(e,t){K.BufferAttribute.call(this,e,t),this.updateRange={offset:0,count:-1}},K.DynamicBufferAttribute.prototype=Object.create(K.BufferAttribute.prototype),K.DynamicBufferAttribute.prototype.constructor=K.DynamicBufferAttribute,K.DynamicBufferAttribute.prototype.clone=function(){return new K.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)},K.BufferGeometry=function(){Object.defineProperty(this,"id",{value:K.GeometryIdCount++}),this.uuid=K.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},K.BufferGeometry.prototype={constructor:K.BufferGeometry,addAttribute:function(e,t){console.warn("BufferGeometry.addAttribute() is deprecated. Use BufferGeometry.setAttribute() instead."),this.setAttribute(e,t)},setAttribute:function(e,t){if(t instanceof K.BufferAttribute==!1)return K.warn("THREE.BufferGeometry: .setAttribute() now expects ( name, attribute )."),void(this.attributes[e]={array:arguments[1],itemSize:arguments[2]});this.attributes[e]=t,this.attributesKeys=Object.keys(this.attributes)},getAttribute:function(e){return this.attributes[e]},addDrawCall:function(e,t,i){this.drawcalls.push({start:e,count:t,index:void 0!==i?i:0})},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new K.Matrix3).getNormalMatrix(e).applyToVector3Array(i.array),i.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.applyMatrix((new K.Matrix4).setPosition(e)),e},fromGeometry:function(e,t){t=t||{vertexColors:K.NoColors};var i=e.vertices,n=e.faces,r=e.faceVertexUvs,o=t.vertexColors,s=r[0].length>0,a=3==n[0].vertexNormals.length,l=new Float32Array(3*n.length*3);this.setAttribute("position",new K.BufferAttribute(l,3));var c=new Float32Array(3*n.length*3);if(this.setAttribute("normal",new K.BufferAttribute(c,3)),o!==K.NoColors){var h=new Float32Array(3*n.length*3);this.setAttribute("color",new K.BufferAttribute(h,3))}if(!0===s){var u=new Float32Array(3*n.length*2);this.setAttribute("uv",new K.BufferAttribute(u,2))}for(var d=0,f=0,p=0;d<n.length;d++,f+=6,p+=9){var m=n[d],g=i[m.a],v=i[m.b],y=i[m.c];if(l[p]=g.x,l[p+1]=g.y,l[p+2]=g.z,l[p+3]=v.x,l[p+4]=v.y,l[p+5]=v.z,l[p+6]=y.x,l[p+7]=y.y,l[p+8]=y.z,!0===a){var b=m.vertexNormals[0],x=m.vertexNormals[1],_=m.vertexNormals[2];c[p]=b.x,c[p+1]=b.y,c[p+2]=b.z,c[p+3]=x.x,c[p+4]=x.y,c[p+5]=x.z,c[p+6]=_.x,c[p+7]=_.y,c[p+8]=_.z}else{var E=m.normal;c[p]=E.x,c[p+1]=E.y,c[p+2]=E.z,c[p+3]=E.x,c[p+4]=E.y,c[p+5]=E.z,c[p+6]=E.x,c[p+7]=E.y,c[p+8]=E.z}if(o===K.FaceColors){var S=m.color;h[p]=S.r,h[p+1]=S.g,h[p+2]=S.b,h[p+3]=S.r,h[p+4]=S.g,h[p+5]=S.b,h[p+6]=S.r,h[p+7]=S.g,h[p+8]=S.b}else if(o===K.VertexColors){var A=m.vertexColors[0],w=m.vertexColors[1],T=m.vertexColors[2];h[p]=A.r,h[p+1]=A.g,h[p+2]=A.b,h[p+3]=w.r,h[p+4]=w.g,h[p+5]=w.b,h[p+6]=T.r,h[p+7]=T.g,h[p+8]=T.b}if(!0===s){var M=r[0][d][0],C=r[0][d][1],P=r[0][d][2];u[f]=M.x,u[f+1]=M.y,u[f+2]=C.x,u[f+3]=C.y,u[f+4]=P.x,u[f+5]=P.y}}return this.computeBoundingSphere(),this},computeBoundingBox:function(){var e=new K.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new K.Box3);var t=this.attributes.position.array;if(t){var i=this.boundingBox;i.makeEmpty();for(var n=0,r=t.length;n<r;n+=3)e.set(t[n],t[n+1],t[n+2]),i.expandByPoint(e)}void 0!==t&&0!==t.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&K.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),computeBoundingSphere:function(){var e=new K.Box3,t=new K.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new K.Sphere);var i=this.attributes.position.array;if(i){e.makeEmpty();for(var n=this.boundingSphere.center,r=0,o=i.length;r<o;r+=3)t.set(i[r],i[r+1],i[r+2]),e.expandByPoint(t);e.getCenter(n);var s=0;for(r=0,o=i.length;r<o;r+=3)t.set(i[r],i[r+1],i[r+2]),s=Math.max(s,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&K.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.attributes;if(e.position){var t=e.position.array;if(void 0===e.normal)this.setAttribute("normal",new K.BufferAttribute(new Float32Array(t.length),3));else for(var i=0,n=(a=e.normal.array).length;i<n;i++)a[i]=0;var r,o,s,a=e.normal.array,l=new K.Vector3,c=new K.Vector3,h=new K.Vector3,u=new K.Vector3,d=new K.Vector3;if(e.index)for(var f=e.index.array,p=this.offsets.length>0?this.offsets:[{start:0,count:f.length,index:0}],m=0,g=p.length;m<g;++m){var v=p[m].start,y=p[m].count,b=p[m].index;for(i=v,n=v+y;i<n;i+=3)r=3*(b+f[i]),o=3*(b+f[i+1]),s=3*(b+f[i+2]),l.fromArray(t,r),c.fromArray(t,o),h.fromArray(t,s),u.subVectors(h,c),d.subVectors(l,c),u.cross(d),a[r]+=u.x,a[r+1]+=u.y,a[r+2]+=u.z,a[o]+=u.x,a[o+1]+=u.y,a[o+2]+=u.z,a[s]+=u.x,a[s+1]+=u.y,a[s+2]+=u.z}else for(i=0,n=t.length;i<n;i+=9)l.fromArray(t,i),c.fromArray(t,i+3),h.fromArray(t,i+6),u.subVectors(h,c),d.subVectors(l,c),u.cross(d),a[i]=u.x,a[i+1]=u.y,a[i+2]=u.z,a[i+3]=u.x,a[i+4]=u.y,a[i+5]=u.z,a[i+6]=u.x,a[i+7]=u.y,a[i+8]=u.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},computeTangents:function(){if(void 0!==this.attributes.index&&void 0!==this.attributes.position&&void 0!==this.attributes.normal&&void 0!==this.attributes.uv){var e=this.attributes.index.array,t=this.attributes.position.array,i=this.attributes.normal.array,n=this.attributes.uv.array,r=t.length/3;void 0===this.attributes.tangent&&this.setAttribute("tangent",new K.BufferAttribute(new Float32Array(4*r),4));for(var o=this.attributes.tangent.array,s=[],a=[],l=0;l<r;l++)s[l]=new K.Vector3,a[l]=new K.Vector3;var c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M=new K.Vector3,C=new K.Vector3,P=new K.Vector3,D=new K.Vector2,L=new K.Vector2,I=new K.Vector2,R=new K.Vector3,O=new K.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,e.length,0);var N,F,U,B=this.drawcalls;for(E=0,S=B.length;E<S;++E){var k=B[E].start,V=B[E].count,G=B[E].index;for(x=k,_=k+V;x<_;x+=3)A=G+e[x],w=G+e[x+1],T=G+e[x+2],N=A,F=w,U=T,M.fromArray(t,3*N),C.fromArray(t,3*F),P.fromArray(t,3*U),D.fromArray(n,2*N),L.fromArray(n,2*F),I.fromArray(n,2*U),c=C.x-M.x,h=P.x-M.x,u=C.y-M.y,d=P.y-M.y,f=C.z-M.z,p=P.z-M.z,m=L.x-D.x,g=I.x-D.x,v=L.y-D.y,y=I.y-D.y,b=1/(m*y-g*v),R.set((y*c-v*h)*b,(y*u-v*d)*b,(y*f-v*p)*b),O.set((m*h-g*c)*b,(m*d-g*u)*b,(m*p-g*f)*b),s[N].add(R),s[F].add(R),s[U].add(R),a[N].add(O),a[F].add(O),a[U].add(O)}var z,H,W,j=new K.Vector3,q=new K.Vector3,X=new K.Vector3,Y=new K.Vector3;for(E=0,S=B.length;E<S;++E){k=B[E].start,V=B[E].count,G=B[E].index;for(x=k,_=k+V;x<_;x+=3)A=G+e[x],w=G+e[x+1],T=G+e[x+2],Q(A),Q(w),Q(T)}}else K.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");function Q(e){X.fromArray(i,3*e),Y.copy(X),H=s[e],j.copy(H),j.sub(X.multiplyScalar(X.dot(H))).normalize(),q.crossVectors(Y,H),W=q.dot(a[e]),z=W<0?-1:1,o[4*e]=j.x,o[4*e+1]=j.y,o[4*e+2]=j.z,o[4*e+3]=z}},computeOffsets:function(e){void 0===e&&(e=65535);for(var t=this.attributes.index.array,i=this.attributes.position.array,n=t.length/3,r=new Uint16Array(t.length),o=0,s=0,a=[{start:0,count:0,index:0}],l=a[0],c=0,h=new Int32Array(6),u=new Int32Array(i.length),d=new Int32Array(i.length),f=0;f<i.length;f++)u[f]=-1,d[f]=-1;for(var p=0;p<n;p++){c=0;for(var m=0;m<3;m++){-1==u[b=t[3*p+m]]?(h[2*m]=b,h[2*m+1]=-1,c++):u[b]<l.index?(h[2*m]=b,h[2*m+1]=-1):(h[2*m]=b,h[2*m+1]=u[b])}if(s+c>l.index+e){var g={start:o,count:0,index:s};a.push(g),l=g;for(var v=0;v<6;v+=2){(y=h[v+1])>-1&&y<l.index&&(h[v+1]=-1)}}for(v=0;v<6;v+=2){var y,b=h[v];-1===(y=h[v+1])&&(y=s++),u[b]=y,d[y]=b,r[o++]=y-l.index,l.count++}}return this.reorderBuffers(r,d,s),this.offsets=a,this.drawcalls=a,a},merge:function(e,t){if(e instanceof K.BufferGeometry!=!1){void 0===t&&(t=0);var i=this.attributes;for(var n in i)if(void 0!==e.attributes[n])for(var r=i[n].array,o=e.attributes[n],s=o.array,a=0,l=o.itemSize*t;a<s.length;a++,l++)r[l]=s[a];return this}K.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e,t,i,n,r=this.attributes.normal.array,o=0,s=r.length;o<s;o+=3)e=r[o],t=r[o+1],i=r[o+2],n=1/Math.sqrt(e*e+t*t+i*i),r[o]*=n,r[o+1]*=n,r[o+2]*=n},reorderBuffers:function(e,t,i){var n={};for(var r in this.attributes)if("index"!=r){var o=this.attributes[r].array;n[r]=new o.constructor(this.attributes[r].itemSize*i)}for(var s=0;s<i;s++){var a=t[s];for(var r in this.attributes)if("index"!=r)for(var l=this.attributes[r].array,c=this.attributes[r].itemSize,h=n[r],u=0;u<c;u++)h[s*c+u]=l[a*c+u]}for(var r in this.attributes.index.array=e,this.attributes)"index"!=r&&(this.attributes[r].array=n[r],this.attributes[r].numItems=this.attributes[r].itemSize*i)},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},t=this.attributes,i=this.offsets,n=this.boundingSphere;for(var r in t){var o=t[r],s=Array.prototype.slice.call(o.array);e.data.attributes[r]={itemSize:o.itemSize,type:o.array.constructor.name,array:s}}return i.length>0&&(e.data.offsets=JSON.parse(JSON.stringify(i))),null!==n&&(e.data.boundingSphere={center:n.center.toArray(),radius:n.radius}),e},clone:function(){var e=new K.BufferGeometry;for(var t in this.attributes){var i=this.attributes[t];e.setAttribute(t,i.clone())}for(var n=0,r=this.offsets.length;n<r;n++){var o=this.offsets[n];e.offsets.push({start:o.start,index:o.index,count:o.count})}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},K.EventDispatcher.prototype.apply(K.BufferGeometry.prototype),K.Geometry=function(){Object.defineProperty(this,"id",{value:K.GeometryIdCount++}),this.uuid=K.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},K.Geometry.prototype={constructor:K.Geometry,applyMatrix:function(e){for(var t=(new K.Matrix3).getNormalMatrix(e),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(e)}for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(t).normalize();for(var o=0,s=r.vertexNormals.length;o<s;o++)r.vertexNormals[o].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},fromBufferGeometry:function(e){for(var t=this,i=e.attributes,n=i.position.array,r=void 0!==i.index?i.index.array:void 0,o=void 0!==i.normal?i.normal.array:void 0,s=void 0!==i.color?i.color.array:void 0,a=void 0!==i.uv?i.uv.array:void 0,l=[],c=[],h=0,u=0;h<n.length;h+=3,u+=2)t.vertices.push(new K.Vector3(n[h],n[h+1],n[h+2])),void 0!==o&&l.push(new K.Vector3(o[h],o[h+1],o[h+2])),void 0!==s&&t.colors.push(new K.Color(s[h],s[h+1],s[h+2])),void 0!==a&&c.push(new K.Vector2(a[u],a[u+1]));var d=function(e,i,n){var r=void 0!==o?[l[e].clone(),l[i].clone(),l[n].clone()]:[],h=void 0!==s?[t.colors[e].clone(),t.colors[i].clone(),t.colors[n].clone()]:[];t.faces.push(new K.Face3(e,i,n,r,h)),void 0!==a&&t.faceVertexUvs[0].push([c[e].clone(),c[i].clone(),c[n].clone()])};if(void 0!==r){var f=e.drawcalls;if(f.length>0)for(h=0;h<f.length;h++)for(var p=f[h],m=p.start,g=p.count,v=p.index,y=(u=m,m+g);u<y;u+=3)d(v+r[u],v+r[u+1],v+r[u+2]);else for(h=0;h<r.length;h+=3)d(r[h],r[h+1],r[h+2])}else for(h=0;h<n.length/3;h+=3)d(h,h+1,h+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.applyMatrix((new K.Matrix4).setPosition(e)),e},computeFaceNormals:function(){for(var e=new K.Vector3,t=new K.Vector3,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],o=this.vertices[r.a],s=this.vertices[r.b],a=this.vertices[r.c];e.subVectors(a,s),t.subVectors(o,s),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,i,n,r,o,s;for(s=new Array(this.vertices.length),t=0,i=this.vertices.length;t<i;t++)s[t]=new K.Vector3;if(e){var a,l,c,h=new K.Vector3,u=new K.Vector3;for(n=0,r=this.faces.length;n<r;n++)o=this.faces[n],a=this.vertices[o.a],l=this.vertices[o.b],c=this.vertices[o.c],h.subVectors(c,l),u.subVectors(a,l),h.cross(u),s[o.a].add(h),s[o.b].add(h),s[o.c].add(h)}else for(n=0,r=this.faces.length;n<r;n++)s[(o=this.faces[n]).a].add(o.normal),s[o.b].add(o.normal),s[o.c].add(o.normal);for(t=0,i=this.vertices.length;t<i;t++)s[t].normalize();for(n=0,r=this.faces.length;n<r;n++)(o=this.faces[n]).vertexNormals[0]=s[o.a].clone(),o.vertexNormals[1]=s[o.b].clone(),o.vertexNormals[2]=s[o.c].clone()},computeMorphNormals:function(){var e,t,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for((r=this.faces[i]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var o=new K.Geometry;for(o.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s=this.morphNormals[e].faceNormals,a=this.morphNormals[e].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)l=new K.Vector3,c={a:new K.Vector3,b:new K.Vector3,c:new K.Vector3},s.push(l),a.push(c)}var l,c,h=this.morphNormals[e];for(o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals(),i=0,n=this.faces.length;i<n;i++)r=this.faces[i],l=h.faceNormals[i],c=h.vertexNormals[i],l.copy(r.normal),c.a.copy(r.vertexNormals[0]),c.b.copy(r.vertexNormals[1]),c.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)(r=this.faces[i]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeTangents:function(){var e,t,i,n,r,o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M,C,P,D,L,I,R,O=[],N=[],F=new K.Vector3,U=new K.Vector3,B=new K.Vector3,k=new K.Vector3,V=new K.Vector3;for(i=0,n=this.vertices.length;i<n;i++)O[i]=new K.Vector3,N[i]=new K.Vector3;for(e=0,t=this.faces.length;e<t;e++)s=this.faces[e],a=this.faceVertexUvs[0][e],M=this,C=s.a,P=s.b,D=s.c,L=0,I=1,R=2,l=M.vertices[C],c=M.vertices[P],h=M.vertices[D],u=a[L],d=a[I],f=a[R],p=c.x-l.x,m=h.x-l.x,g=c.y-l.y,v=h.y-l.y,y=c.z-l.z,b=h.z-l.z,x=d.x-u.x,_=f.x-u.x,E=d.y-u.y,S=f.y-u.y,A=1/(x*S-_*E),F.set((S*p-E*m)*A,(S*g-E*v)*A,(S*y-E*b)*A),U.set((x*m-_*p)*A,(x*v-_*g)*A,(x*b-_*y)*A),O[C].add(F),O[P].add(F),O[D].add(F),N[C].add(U),N[P].add(U),N[D].add(U);var G=["a","b","c","d"];for(e=0,t=this.faces.length;e<t;e++)for(s=this.faces[e],r=0;r<Math.min(s.vertexNormals.length,3);r++)V.copy(s.vertexNormals[r]),o=s[G[r]],w=O[o],B.copy(w),B.sub(V.multiplyScalar(V.dot(w))).normalize(),k.crossVectors(s.vertexNormals[r],w),T=k.dot(N[o])<0?-1:1,s.vertexTangents[r]=new K.Vector4(B.x,B.y,B.z,T);this.hasTangents=!0},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,n=t.length;i<n;i++)i>0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new K.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new K.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e instanceof K.Geometry!=!1){var n,r=this.vertices.length,o=this.vertices,s=e.vertices,a=this.faces,l=e.faces,c=this.faceVertexUvs[0],h=e.faceVertexUvs[0];void 0===i&&(i=0),void 0!==t&&(n=(new K.Matrix3).getNormalMatrix(t));for(var u=0,d=s.length;u<d;u++){var f=s[u].clone();void 0!==t&&f.applyMatrix4(t),o.push(f)}for(u=0,d=l.length;u<d;u++){var p,m,g,v=l[u],y=v.vertexNormals,b=v.vertexColors;(p=new K.Face3(v.a+r,v.b+r,v.c+r)).normal.copy(v.normal),void 0!==n&&p.normal.applyMatrix3(n).normalize();for(var x=0,_=y.length;x<_;x++)m=y[x].clone(),void 0!==n&&m.applyMatrix3(n).normalize(),p.vertexNormals.push(m);p.color.copy(v.color);for(x=0,_=b.length;x<_;x++)g=b[x],p.vertexColors.push(g.clone());p.materialIndex=v.materialIndex+i,a.push(p)}for(u=0,d=h.length;u<d;u++){var E=h[u],S=[];if(void 0!==E){for(x=0,_=E.length;x<_;x++)S.push(E[x].clone());c.push(S)}}}else K.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e instanceof K.Mesh!=!1?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):K.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,i,n,r,o,s,a,l={},c=[],h=[],u=Math.pow(10,4);for(i=0,n=this.vertices.length;i<n;i++)e=this.vertices[i],void 0===l[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(l[t]=i,c.push(this.vertices[i]),h[i]=c.length-1):h[i]=h[l[t]];var d=[];for(i=0,n=this.faces.length;i<n;i++){(r=this.faces[i]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],o=[r.a,r.b,r.c];for(var f=0;f<3;f++)if(o[f]==o[(f+1)%3]){f,d.push(i);break}}for(i=d.length-1;i>=0;i--){var p=d[i];for(this.faces.splice(p,1),s=0,a=this.faceVertexUvs.length;s<a;s++)this.faceVertexUvs[s].splice(p,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}for(var n=[],r=0;r<this.vertices.length;r++){var o=this.vertices[r];n.push(o.x,o.y,o.z)}var s=[],a=[],l={},c=[],h={},u=[],d={};for(r=0;r<this.faces.length;r++){var f=this.faces[r],p=void 0!==this.faceVertexUvs[0][r],m=f.normal.length()>0,g=f.vertexNormals.length>0,v=1!==f.color.r||1!==f.color.g||1!==f.color.b,y=f.vertexColors.length>0,b=0;if(b=S(b,0,0),b=S(b,1,!1),b=S(b,2,!1),b=S(b,3,p),b=S(b,4,m),b=S(b,5,g),b=S(b,6,v),b=S(b,7,y),s.push(b),s.push(f.a,f.b,f.c),p){var x=this.faceVertexUvs[0][r];s.push(T(x[0]),T(x[1]),T(x[2]))}if(m&&s.push(A(f.normal)),g){var _=f.vertexNormals;s.push(A(_[0]),A(_[1]),A(_[2]))}if(v&&s.push(w(f.color)),y){var E=f.vertexColors;s.push(w(E[0]),w(E[1]),w(E[2]))}}function S(e,t,i){return i?e|1<<t:e&~(1<<t)}function A(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=a.length/3,a.push(e.x,e.y,e.z)),l[t]}function w(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=c.length,c.push(e.getHex())),h[t]}function T(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=u.length/2,u.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=n,e.data.normals=a,c.length>0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=s,e},clone:function(){for(var e=new K.Geometry,t=this.vertices,i=0,n=t.length;i<n;i++)e.vertices.push(t[i].clone());var r=this.faces;for(i=0,n=r.length;i<n;i++)e.faces.push(r[i].clone());for(i=0,n=this.faceVertexUvs.length;i<n;i++){var o=this.faceVertexUvs[i];void 0===e.faceVertexUvs[i]&&(e.faceVertexUvs[i]=[]);for(var s=0,a=o.length;s<a;s++){for(var l=o[s],c=[],h=0,u=l.length;h<u;h++){var d=l[h];c.push(d.clone())}e.faceVertexUvs[i].push(c)}}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},K.EventDispatcher.prototype.apply(K.Geometry.prototype),K.GeometryIdCount=0,K.Camera=function(){K.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new K.Matrix4,this.projectionMatrix=new K.Matrix4},K.Camera.prototype=Object.create(K.Object3D.prototype),K.Camera.prototype.constructor=K.Camera,K.Camera.prototype.getWorldDirection=function(){var e=new K.Quaternion;return function(t){var i=t||new K.Vector3;return this.getWorldQuaternion(e),i.set(0,0,-1).applyQuaternion(e)}}(),K.Camera.prototype.lookAt=function(){var e=new K.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),K.Camera.prototype.clone=function(e){return void 0===e&&(e=new K.Camera),K.Object3D.prototype.clone.call(this,e),e.matrixWorldInverse.copy(this.matrixWorldInverse),e.projectionMatrix.copy(this.projectionMatrix),e},K.CubeCamera=function(e,t,i){K.Object3D.call(this),this.type="CubeCamera";var n=90,r=new K.PerspectiveCamera(n,1,e,t);r.up.set(0,-1,0),r.lookAt(new K.Vector3(1,0,0)),this.add(r);var o=new K.PerspectiveCamera(n,1,e,t);o.up.set(0,-1,0),o.lookAt(new K.Vector3(-1,0,0)),this.add(o);var s=new K.PerspectiveCamera(n,1,e,t);s.up.set(0,0,1),s.lookAt(new K.Vector3(0,1,0)),this.add(s);var a=new K.PerspectiveCamera(n,1,e,t);a.up.set(0,0,-1),a.lookAt(new K.Vector3(0,-1,0)),this.add(a);var l=new K.PerspectiveCamera(n,1,e,t);l.up.set(0,-1,0),l.lookAt(new K.Vector3(0,0,1)),this.add(l);var c=new K.PerspectiveCamera(n,1,e,t);c.up.set(0,-1,0),c.lookAt(new K.Vector3(0,0,-1)),this.add(c),this.renderTarget=new K.WebGLRenderTargetCube(i,i,{format:K.RGBFormat,magFilter:K.LinearFilter,minFilter:K.LinearFilter}),this.updateCubeMap=function(e,t){var i=this.renderTarget,n=i.generateMipmaps;i.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,r,i),i.activeCubeFace=1,e.render(t,o,i),i.activeCubeFace=2,e.render(t,s,i),i.activeCubeFace=3,e.render(t,a,i),i.activeCubeFace=4,e.render(t,l,i),i.generateMipmaps=n,i.activeCubeFace=5,e.render(t,c,i)}},K.CubeCamera.prototype=Object.create(K.Object3D.prototype),K.CubeCamera.prototype.constructor=K.CubeCamera,K.OrthographicCamera=function(e,t,i,n,r,o){K.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},K.OrthographicCamera.prototype=Object.create(K.Camera.prototype),K.OrthographicCamera.prototype.constructor=K.OrthographicCamera,K.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(i-e,i+e,n+t,n-t,this.near,this.far)},K.OrthographicCamera.prototype.clone=function(){var e=new K.OrthographicCamera;return K.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},K.PerspectiveCamera=function(e,t,i,n){K.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.updateProjectionMatrix()},K.PerspectiveCamera.prototype=Object.create(K.Camera.prototype),K.PerspectiveCamera.prototype.constructor=K.PerspectiveCamera,K.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*K.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},K.PerspectiveCamera.prototype.setViewOffset=function(e,t,i,n,r,o){this.fullWidth=e,this.fullHeight=t,this.x=i,this.y=n,this.width=r,this.height=o,this.updateProjectionMatrix()},K.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=K.Math.radToDeg(2*Math.atan(Math.tan(.5*K.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,i=Math.tan(K.Math.degToRad(.5*e))*this.near,n=-i,r=t*n,o=t*i,s=Math.abs(o-r),a=Math.abs(i-n);this.projectionMatrix.makeFrustum(r+this.x*s/this.fullWidth,r+(this.x+this.width)*s/this.fullWidth,i-(this.y+this.height)*a/this.fullHeight,i-this.y*a/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},K.PerspectiveCamera.prototype.clone=function(){var e=new K.PerspectiveCamera;return K.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},K.Light=function(e){K.Object3D.call(this),this.type="Light",this.color=new K.Color(e)},K.Light.prototype=Object.create(K.Object3D.prototype),K.Light.prototype.constructor=K.Light,K.Light.prototype.clone=function(e){return void 0===e&&(e=new K.Light),K.Object3D.prototype.clone.call(this,e),e.color.copy(this.color),e},K.AmbientLight=function(e){K.Light.call(this,e),this.type="AmbientLight"},K.AmbientLight.prototype=Object.create(K.Light.prototype),K.AmbientLight.prototype.constructor=K.AmbientLight,K.AmbientLight.prototype.clone=function(){var e=new K.AmbientLight;return K.Light.prototype.clone.call(this,e),e},K.AreaLight=function(e,t){K.Light.call(this,e),this.type="AreaLight",this.normal=new K.Vector3(0,-1,0),this.right=new K.Vector3(1,0,0),this.intensity=void 0!==t?t:1,this.width=1,this.height=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},K.AreaLight.prototype=Object.create(K.Light.prototype),K.AreaLight.prototype.constructor=K.AreaLight,K.DirectionalLight=function(e,t){K.Light.call(this,e),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new K.Object3D,this.intensity=void 0!==t?t:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new K.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},K.DirectionalLight.prototype=Object.create(K.Light.prototype),K.DirectionalLight.prototype.constructor=K.DirectionalLight,K.DirectionalLight.prototype.clone=function(){var e=new K.DirectionalLight;return K.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraLeft=this.shadowCameraLeft,e.shadowCameraRight=this.shadowCameraRight,e.shadowCameraTop=this.shadowCameraTop,e.shadowCameraBottom=this.shadowCameraBottom,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e.shadowCascade=this.shadowCascade,e.shadowCascadeOffset.copy(this.shadowCascadeOffset),e.shadowCascadeCount=this.shadowCascadeCount,e.shadowCascadeBias=this.shadowCascadeBias.slice(0),e.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),e.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),e.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),e.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),e},K.HemisphereLight=function(e,t,i){K.Light.call(this,e),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new K.Color(t),this.intensity=void 0!==i?i:1},K.HemisphereLight.prototype=Object.create(K.Light.prototype),K.HemisphereLight.prototype.constructor=K.HemisphereLight,K.HemisphereLight.prototype.clone=function(){var e=new K.HemisphereLight;return K.Light.prototype.clone.call(this,e),e.groundColor.copy(this.groundColor),e.intensity=this.intensity,e},K.PointLight=function(e,t,i,n){K.Light.call(this,e),this.type="PointLight",this.intensity=void 0!==t?t:1,this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1},K.PointLight.prototype=Object.create(K.Light.prototype),K.PointLight.prototype.constructor=K.PointLight,K.PointLight.prototype.clone=function(){var e=new K.PointLight;return K.Light.prototype.clone.call(this,e),e.intensity=this.intensity,e.distance=this.distance,e.decay=this.decay,e},K.SpotLight=function(e,t,i,n,r,o){K.Light.call(this,e),this.type="SpotLight",this.position.set(0,1,0),this.target=new K.Object3D,this.intensity=void 0!==t?t:1,this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.exponent=void 0!==r?r:10,this.decay=void 0!==o?o:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},K.SpotLight.prototype=Object.create(K.Light.prototype),K.SpotLight.prototype.constructor=K.SpotLight,K.SpotLight.prototype.clone=function(){var e=new K.SpotLight;return K.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.distance=this.distance,e.angle=this.angle,e.exponent=this.exponent,e.decay=this.decay,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraFov=this.shadowCameraFov,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e},K.Cache={files:{},add:function(e,t){this.files[e]=t},get:function(e){return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},K.Loader=function(e){this.showStatus=e,this.statusDomElement=e?K.Loader.prototype.addStatusElement():null,this.imageLoader=new K.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},K.Loader.prototype={constructor:K.Loader,crossOrigin:void 0,addStatusElement:function(){var e=document.createElement("div");return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";e.total?t+=(100*e.loaded/e.total).toFixed(0)+"%":t+=(e.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t);return i},needsTangents:function(e){for(var t=0,i=e.length;t<i;t++){if(e[t]instanceof K.ShaderMaterial)return!0}return!1},createMaterial:function(e,t){var i=this;function n(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function r(e,r,o,s,a,l,c){var h,u=t+o,d=K.Loader.Handlers.get(u);if(null!==d?h=d.load(u):(h=new K.Texture,(d=i.imageLoader).crossOrigin=i.crossOrigin,d.load(u,(function(e){if(!1===K.Math.isPowerOfTwo(e.width)||!1===K.Math.isPowerOfTwo(e.height)){var t=n(e.width),i=n(e.height),r=document.createElement("canvas");r.width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),h.image=r}else h.image=e;h.needsUpdate=!0}))),h.sourceFile=o,s&&(h.repeat.set(s[0],s[1]),1!==s[0]&&(h.wrapS=K.RepeatWrapping),1!==s[1]&&(h.wrapT=K.RepeatWrapping)),a&&h.offset.set(a[0],a[1]),l){var f={repeat:K.RepeatWrapping,mirror:K.MirroredRepeatWrapping};void 0!==f[l[0]]&&(h.wrapS=f[l[0]]),void 0!==f[l[1]]&&(h.wrapT=f[l[1]])}c&&(h.anisotropy=c),e[r]=h}function o(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]}var s="MeshLambertMaterial",a={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(e.shading){var l=e.shading.toLowerCase();"phong"===l?s="MeshPhongMaterial":"basic"===l&&(s="MeshBasicMaterial")}void 0!==e.blending&&void 0!==K[e.blending]&&(a.blending=K[e.blending]),void 0!==e.transparent&&(a.transparent=e.transparent),void 0!==e.opacity&&e.opacity<1&&(a.transparent=!0),void 0!==e.depthTest&&(a.depthTest=e.depthTest),void 0!==e.depthWrite&&(a.depthWrite=e.depthWrite),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.flipSided&&(a.side=K.BackSide),void 0!==e.doubleSided&&(a.side=K.DoubleSide),void 0!==e.wireframe&&(a.wireframe=e.wireframe),void 0!==e.vertexColors&&("face"===e.vertexColors?a.vertexColors=K.FaceColors:e.vertexColors&&(a.vertexColors=K.VertexColors)),e.colorDiffuse?a.color=o(e.colorDiffuse):e.DbgColor&&(a.color=e.DbgColor),e.colorSpecular&&(a.specular=o(e.colorSpecular)),e.colorEmissive&&(a.emissive=o(e.colorEmissive)),void 0!==e.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),e.opacity=e.transparency),void 0!==e.opacity&&(a.opacity=e.opacity),e.specularCoef&&(a.shininess=e.specularCoef),e.mapDiffuse&&t&&r(a,"map",e.mapDiffuse,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy),e.mapLight&&t&&r(a,"lightMap",e.mapLight,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy),e.mapBump&&t&&r(a,"bumpMap",e.mapBump,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy),e.mapNormal&&t&&r(a,"normalMap",e.mapNormal,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy),e.mapSpecular&&t&&r(a,"specularMap",e.mapSpecular,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy),e.mapAlpha&&t&&r(a,"alphaMap",e.mapAlpha,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy),e.mapBumpScale&&(a.bumpScale=e.mapBumpScale),e.mapNormalFactor&&(a.normalScale=new K.Vector2(e.mapNormalFactor,e.mapNormalFactor));var c=new K[s](a);return void 0!==e.DbgName&&(c.name=e.DbgName),c}},K.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=0,i=this.handlers.length;t<i;t+=2){var n=this.handlers[t],r=this.handlers[t+1];if(n.test(e))return r}return null}},K.XHRLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager},K.XHRLoader.prototype={constructor:K.XHRLoader,load:function(e,t,i,n){var r=this,o=K.Cache.get(e);if(void 0===o){var s=new XMLHttpRequest;s.open("GET",e,!0),s.addEventListener("load",(function(i){K.Cache.add(e,this.response),t&&t(this.response),r.manager.itemEnd(e)}),!1),void 0!==i&&s.addEventListener("progress",(function(e){i(e)}),!1),void 0!==n&&s.addEventListener("error",(function(e){n(e)}),!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(s.responseType=this.responseType),s.send(null),r.manager.itemStart(e)}else t&&t(o)},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e}},K.ImageLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager},K.ImageLoader.prototype={constructor:K.ImageLoader,load:function(e,t,i,n){var r=this,o=K.Cache.get(e);if(void 0===o){var s=document.createElement("img");return s.addEventListener("load",(function(i){K.Cache.add(e,this),t&&t(this),r.manager.itemEnd(e)}),!1),void 0!==i&&s.addEventListener("progress",(function(e){i(e)}),!1),void 0!==n&&s.addEventListener("error",(function(e){n(e)}),!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),s.src=e,r.manager.itemStart(e),s}t(o)},setCrossOrigin:function(e){this.crossOrigin=e}},K.JSONLoader=function(e){K.Loader.call(this,e),this.withCredentials=!1},K.JSONLoader.prototype=Object.create(K.Loader.prototype),K.JSONLoader.prototype.constructor=K.JSONLoader,K.JSONLoader.prototype.load=function(e,t,i){i=i&&"string"==typeof i?i:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,i)},K.JSONLoader.prototype.loadAjaxJSON=function(e,t,i,n,r){var o=new XMLHttpRequest,s=0;o.onreadystatechange=function(){if(o.readyState===o.DONE)if(200===o.status||0===o.status){if(o.responseText){var a=JSON.parse(o.responseText),l=a.metadata;if(void 0!==l){if("object"===l.type)return void K.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===l.type)return void K.error("THREE.JSONLoader: "+t+" seems to be a Scene. Use THREE.SceneLoader instead.")}var c=e.parse(a,n);i(c.geometry,c.materials)}else K.error("THREE.JSONLoader: "+t+" seems to be unreachable or the file is empty.");e.onLoadComplete()}else K.error("THREE.JSONLoader: Couldn't load "+t+" ("+o.status+")");else o.readyState===o.LOADING?r&&(0===s&&(s=o.getResponseHeader("Content-Length")),r({total:s,loaded:o.responseText.length})):o.readyState===o.HEADERS_RECEIVED&&void 0!==r&&(s=o.getResponseHeader("Content-Length"))},o.open("GET",t,!0),o.withCredentials=this.withCredentials,o.send(null)},K.JSONLoader.prototype.parse=function(e,t){var i=new K.Geometry,n=void 0!==e.scale?1/e.scale:1;if(function(t){function n(e,t){return e&1<<t}var r,o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T,M,C,P,D,L=e.faces,I=e.vertices,R=e.normals,O=e.colors,N=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&N++;for(r=0;r<N;r++)i.faceVertexUvs[r]=[]}a=0,l=I.length;for(;a<l;)(_=new K.Vector3).x=I[a++]*t,_.y=I[a++]*t,_.z=I[a++]*t,i.vertices.push(_);a=0,l=L.length;for(;a<l;)if(p=n(f=L[a++],0),m=n(f,1),g=n(f,3),v=n(f,4),y=n(f,5),b=n(f,6),x=n(f,7),p){if((S=new K.Face3).a=L[a],S.b=L[a+1],S.c=L[a+3],(A=new K.Face3).a=L[a+1],A.b=L[a+2],A.c=L[a+3],a+=4,m&&(d=L[a++],S.materialIndex=d,A.materialIndex=d),s=i.faces.length,g)for(r=0;r<N;r++)for(M=e.uvs[r],i.faceVertexUvs[r][s]=[],i.faceVertexUvs[r][s+1]=[],o=0;o<4;o++)P=M[2*(u=L[a++])],D=M[2*u+1],C=new K.Vector2(P,D),2!==o&&i.faceVertexUvs[r][s].push(C),0!==o&&i.faceVertexUvs[r][s+1].push(C);if(v&&(h=3*L[a++],S.normal.set(R[h++],R[h++],R[h]),A.normal.copy(S.normal)),y)for(r=0;r<4;r++)h=3*L[a++],T=new K.Vector3(R[h++],R[h++],R[h]),2!==r&&S.vertexNormals.push(T),0!==r&&A.vertexNormals.push(T);if(b&&(w=O[c=L[a++]],S.color.setHex(w),A.color.setHex(w)),x)for(r=0;r<4;r++)w=O[c=L[a++]],2!==r&&S.vertexColors.push(new K.Color(w)),0!==r&&A.vertexColors.push(new K.Color(w));i.faces.push(S),i.faces.push(A)}else{if((E=new K.Face3).a=L[a++],E.b=L[a++],E.c=L[a++],m&&(d=L[a++],E.materialIndex=d),s=i.faces.length,g)for(r=0;r<N;r++)for(M=e.uvs[r],i.faceVertexUvs[r][s]=[],o=0;o<3;o++)P=M[2*(u=L[a++])],D=M[2*u+1],C=new K.Vector2(P,D),i.faceVertexUvs[r][s].push(C);if(v&&(h=3*L[a++],E.normal.set(R[h++],R[h++],R[h])),y)for(r=0;r<3;r++)h=3*L[a++],T=new K.Vector3(R[h++],R[h++],R[h]),E.vertexNormals.push(T);if(b&&(c=L[a++],E.color.setHex(O[c])),x)for(r=0;r<3;r++)c=L[a++],E.vertexColors.push(new K.Color(O[c]));i.faces.push(E)}}(n),function(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var n=0,r=e.skinWeights.length;n<r;n+=t){var o=e.skinWeights[n],s=t>1?e.skinWeights[n+1]:0,a=t>2?e.skinWeights[n+2]:0,l=t>3?e.skinWeights[n+3]:0;i.skinWeights.push(new K.Vector4(o,s,a,l))}if(e.skinIndices)for(n=0,r=e.skinIndices.length;n<r;n+=t){var c=e.skinIndices[n],h=t>1?e.skinIndices[n+1]:0,u=t>2?e.skinIndices[n+2]:0,d=t>3?e.skinIndices[n+3]:0;i.skinIndices.push(new K.Vector4(c,h,u,d))}i.bones=e.bones,i.bones&&i.bones.length>0&&(i.skinWeights.length!==i.skinIndices.length||i.skinIndices.length!==i.vertices.length)&&K.warn("THREE.JSONLoader: When skinning, number of vertices ("+i.vertices.length+"), skinIndices ("+i.skinIndices.length+"), and skinWeights ("+i.skinWeights.length+") should match.");i.animation=e.animation,i.animations=e.animations}(),function(t){var n,r,o,s,a,l,c,h,u,d,f;if(void 0!==e.morphTargets)for(a=0,l=e.morphTargets.length;a<l;a++)for(i.morphTargets[a]={},i.morphTargets[a].name=e.morphTargets[a].name,i.morphTargets[a].vertices=[],o=i.morphTargets[a].vertices,n=0,r=(s=e.morphTargets[a].vertices).length;n<r;n+=3){var p=new K.Vector3;p.x=s[n]*t,p.y=s[n+1]*t,p.z=s[n+2]*t,o.push(p)}if(void 0!==e.morphColors)for(a=0,l=e.morphColors.length;a<l;a++)for(i.morphColors[a]={},i.morphColors[a].name=e.morphColors[a].name,i.morphColors[a].colors=[],u=i.morphColors[a].colors,c=0,h=(d=e.morphColors[a].colors).length;c<h;c+=3)(f=new K.Color(16755200)).setRGB(d[c],d[c+1],d[c+2]),u.push(f)}(n),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:i};var r=this.initMaterials(e.materials,t);return this.needsTangents(r)&&i.computeTangents(),{geometry:i,materials:r}},K.LoadingManager=function(e,t,i){var n=this,r=0,o=0;this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++},this.itemEnd=function(e){r++,void 0!==n.onProgress&&n.onProgress(e,r,o),r===o&&void 0!==n.onLoad&&n.onLoad()}},K.DefaultLoadingManager=new K.LoadingManager,K.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager},K.BufferGeometryLoader.prototype={constructor:K.BufferGeometryLoader,load:function(e,t,i,n){var r=this,o=new K.XHRLoader(r.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,(function(e){t(r.parse(JSON.parse(e)))}),i,n)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new K.BufferGeometry,i=e.data.attributes;for(var n in i){var r=i[n],o=new self[r.type](r.array);t.setAttribute(n,new K.BufferAttribute(o,r.itemSize))}var s=e.data.offsets;void 0!==s&&(t.offsets=JSON.parse(JSON.stringify(s)));var a=e.data.boundingSphere;if(void 0!==a){var l=new K.Vector3;void 0!==a.center&&l.fromArray(a.center),t.boundingSphere=new K.Sphere(l,a.radius)}return t}},K.MaterialLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager},K.MaterialLoader.prototype={constructor:K.MaterialLoader,load:function(e,t,i,n){var r=this,o=new K.XHRLoader(r.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,(function(e){t(r.parse(JSON.parse(e)))}),i,n)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new K[e.type];if(void 0!==e.color&&t.color.setHex(e.color),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.materials)for(var i=0,n=e.materials.length;i<n;i++)t.materials.push(this.parse(e.materials[i]));return t}},K.ObjectLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager,this.texturePath=""},K.ObjectLoader.prototype={constructor:K.ObjectLoader,load:function(e,t,i,n){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this,o=new K.XHRLoader(r.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,(function(e){r.parse(JSON.parse(e),t)}),i,n)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),n=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),r=this.parseTextures(e.textures,n),o=this.parseMaterials(e.materials,r),s=this.parseObject(e.object,i,o);return void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new K.JSONLoader,n=new K.BufferGeometryLoader,r=0,o=e.length;r<o;r++){var s,a=e[r];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new K[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new K.BoxGeometry(a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":s=new K.CircleGeometry(a.radius,a.segments);break;case"CylinderGeometry":s=new K.CylinderGeometry(a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded);break;case"SphereGeometry":s=new K.SphereGeometry(a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"IcosahedronGeometry":s=new K.IcosahedronGeometry(a.radius,a.detail);break;case"TorusGeometry":s=new K.TorusGeometry(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":s=new K.TorusKnotGeometry(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.p,a.q,a.heightScale);break;case"BufferGeometry":s=n.parse(a);break;case"Geometry":s=i.parse(a.data).geometry}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),t[a.uuid]=s}return t},parseMaterials:function(e,t){var i={};if(void 0!==e)for(var n=function(e){return void 0===t[e]&&K.warn("THREE.ObjectLoader: Undefined texture",e),t[e]},r=new K.MaterialLoader,o=0,s=e.length;o<s;o++){var a=e[o],l=r.parse(a);l.uuid=a.uuid,void 0!==a.name&&(l.name=a.name),void 0!==a.map&&(l.map=n(a.map)),void 0!==a.bumpMap&&(l.bumpMap=n(a.bumpMap),a.bumpScale&&(l.bumpScale=new K.Vector2(a.bumpScale,a.bumpScale))),void 0!==a.alphaMap&&(l.alphaMap=n(a.alphaMap)),void 0!==a.envMap&&(l.envMap=n(a.envMap)),void 0!==a.normalMap&&(l.normalMap=n(a.normalMap),a.normalScale&&(l.normalScale=new K.Vector2(a.normalScale,a.normalScale))),void 0!==a.lightMap&&(l.lightMap=n(a.lightMap)),void 0!==a.specularMap&&(l.specularMap=n(a.specularMap)),i[a.uuid]=l}return i},parseImages:function(e,t){var i=this,n={};if(void 0!==e&&e.length>0){var r=new K.LoadingManager(t),o=new K.ImageLoader(r);o.setCrossOrigin(this.crossOrigin);for(var s=function(e){return i.manager.itemStart(e),o.load(e,(function(){i.manager.itemEnd(e)}))},a=0,l=e.length;a<l;a++){var c=e[a],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.texturePath+c.url;n[c.uuid]=s(h)}}return n},parseTextures:function(e,t){var i={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var o=e[n];void 0===o.image&&K.warn('THREE.ObjectLoader: No "image" speficied for',o.uuid),void 0===t[o.image]&&K.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new K.Texture(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.repeat&&(s.repeat=new K.Vector2(o.repeat[0],o.repeat[1])),void 0!==o.minFilter&&(s.minFilter=K[o.minFilter]),void 0!==o.magFilter&&(s.magFilter=K[o.magFilter]),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),o.wrap instanceof Array&&(s.wrapS=K[o.wrap[0]],s.wrapT=K[o.wrap[1]]),i[o.uuid]=s}return i},parseObject:function(){var e=new K.Matrix4;return function(t,i,n){var r,o=function(e){return void 0===i[e]&&K.warn("THREE.ObjectLoader: Undefined geometry",e),i[e]},s=function(e){return void 0===n[e]&&K.warn("THREE.ObjectLoader: Undefined material",e),n[e]};switch(t.type){case"Scene":r=new K.Scene;break;case"PerspectiveCamera":r=new K.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":r=new K.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":r=new K.AmbientLight(t.color);break;case"DirectionalLight":r=new K.DirectionalLight(t.color,t.intensity);break;case"PointLight":r=new K.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":r=new K.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":r=new K.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":r=new K.Mesh(o(t.geometry),s(t.material));break;case"Line":r=new K.Line(o(t.geometry),s(t.material),t.mode);break;case"PointCloud":r=new K.PointCloud(o(t.geometry),s(t.material));break;case"Sprite":r=new K.Sprite(s(t.material));break;case"Group":r=new K.Group;break;default:r=new K.Object3D}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.children)for(var a in t.children)r.add(this.parseObject(t.children[a],i,n));return r}}()},K.TextureLoader=function(e){this.manager=void 0!==e?e:K.DefaultLoadingManager},K.TextureLoader.prototype={constructor:K.TextureLoader,load:function(e,t,i,n){var r=new K.ImageLoader(this.manager);r.setCrossOrigin(this.crossOrigin),r.load(e,(function(e){var i=new K.Texture(e);i.needsUpdate=!0,void 0!==t&&t(i)}),i,n)},setCrossOrigin:function(e){this.crossOrigin=e}},K.DataTextureLoader=K.BinaryTextureLoader=function(){this._parser=null},K.BinaryTextureLoader.prototype={constructor:K.BinaryTextureLoader,load:function(e,t,i,n){var r=this,o=new K.DataTexture,s=new K.XHRLoader;return s.setResponseType("arraybuffer"),s.load(e,(function(e){var i=r._parser(e);i&&(void 0!==i.image?o.image=i.image:void 0!==i.data&&(o.image.width=i.width,o.image.height=i.height,o.image.data=i.data),o.wrapS=void 0!==i.wrapS?i.wrapS:K.ClampToEdgeWrapping,o.wrapT=void 0!==i.wrapT?i.wrapT:K.ClampToEdgeWrapping,o.magFilter=void 0!==i.magFilter?i.magFilter:K.LinearFilter,o.minFilter=void 0!==i.minFilter?i.minFilter:K.LinearMipMapLinearFilter,o.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(o.format=i.format),void 0!==i.type&&(o.type=i.type),void 0!==i.mipmaps&&(o.mipmaps=i.mipmaps),1===i.mipmapCount&&(o.minFilter=K.LinearFilter),o.needsUpdate=!0,t&&t(o,i))}),i,n),o}},K.CompressedTextureLoader=function(){this._parser=null},K.CompressedTextureLoader.prototype={constructor:K.CompressedTextureLoader,load:function(e,t,i){var n=this,r=[],o=new K.CompressedTexture;o.image=r;var s=new K.XHRLoader;if(s.setResponseType("arraybuffer"),e instanceof Array)for(var a=0,l=function(i){s.load(e[i],(function(e){var s=n._parser(e,!0);r[i]={width:s.width,height:s.height,format:s.format,mipmaps:s.mipmaps},6===(a+=1)&&(1==s.mipmapCount&&(o.minFilter=K.LinearFilter),o.format=s.format,o.needsUpdate=!0,t&&t(o))}))},c=0,h=e.length;c<h;++c)l(c);else s.load(e,(function(e){var i=n._parser(e,!0);if(i.isCubemap)for(var s=i.mipmaps.length/i.mipmapCount,a=0;a<s;a++){r[a]={mipmaps:[]};for(var l=0;l<i.mipmapCount;l++)r[a].mipmaps.push(i.mipmaps[a*i.mipmapCount+l]),r[a].format=i.format,r[a].width=i.width,r[a].height=i.height}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=K.LinearFilter),o.format=i.format,o.needsUpdate=!0,t&&t(o)}));return o}},K.Material=function(){Object.defineProperty(this,"id",{value:K.MaterialIdCount++}),this.uuid=K.Math.generateUUID(),this.name="",this.type="Material",this.side=K.FrontSide,this.opacity=1,this.transparent=!1,this.blending=K.NormalBlending,this.blendSrc=K.SrcAlphaFactor,this.blendDst=K.OneMinusSrcAlphaFactor,this.blendEquation=K.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthTest=!0,this.depthWrite=!0,this.colorWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this._needsUpdate=!0,this._uniformsNeedUpdate=!0},K.Material.prototype={constructor:K.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},get uniformsNeedUpdate(){return this._uniformsNeedUpdate},set uniformsNeedUpdate(e){!0===e&&this.update(),this._uniformsNeedUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){if(t in this){var n=this[t];n instanceof K.Color?n.set(i):n instanceof K.Vector3&&i instanceof K.Vector3?n.copy(i):this[t]="overdraw"==t?Number(i):i}}else K.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(){var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(e.name=this.name),this instanceof K.MeshBasicMaterial?(e.color=this.color.getHex(),this.vertexColors!==K.NoColors&&(e.vertexColors=this.vertexColors),this.blending!==K.NormalBlending&&(e.blending=this.blending),this.side!==K.FrontSide&&(e.side=this.side)):this instanceof K.MeshLambertMaterial?(e.color=this.color.getHex(),e.emissive=this.emissive.getHex(),this.vertexColors!==K.NoColors&&(e.vertexColors=this.vertexColors),this.shading!==K.SmoothShading&&(e.shading=this.shading),this.blending!==K.NormalBlending&&(e.blending=this.blending),this.side!==K.FrontSide&&(e.side=this.side)):this instanceof K.MeshPhongMaterial?(e.color=this.color.getHex(),e.emissive=this.emissive.getHex(),e.specular=this.specular.getHex(),e.shininess=this.shininess,this.vertexColors!==K.NoColors&&(e.vertexColors=this.vertexColors),this.shading!==K.SmoothShading&&(e.shading=this.shading),this.blending!==K.NormalBlending&&(e.blending=this.blending),this.side!==K.FrontSide&&(e.side=this.side)):this instanceof K.MeshNormalMaterial||this instanceof K.MeshDepthMaterial?(this.blending!==K.NormalBlending&&(e.blending=this.blending),this.side!==K.FrontSide&&(e.side=this.side)):this instanceof K.PointCloudMaterial?(e.size=this.size,e.sizeAttenuation=this.sizeAttenuation,e.color=this.color.getHex(),this.vertexColors!==K.NoColors&&(e.vertexColors=this.vertexColors),this.blending!==K.NormalBlending&&(e.blending=this.blending)):this instanceof K.ShaderMaterial?(e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader):this instanceof K.SpriteMaterial&&(e.color=this.color.getHex()),this.opacity<1&&(e.opacity=this.opacity),!1!==this.transparent&&(e.transparent=this.transparent),!1!==this.wireframe&&(e.wireframe=this.wireframe),e},clone:function(e){return void 0===e&&(e=new K.Material),e.name=this.name,e.side=this.side,e.opacity=this.opacity,e.transparent=this.transparent,e.blending=this.blending,e.blendSrc=this.blendSrc,e.blendDst=this.blendDst,e.blendEquation=this.blendEquation,e.blendSrcAlpha=this.blendSrcAlpha,e.blendDstAlpha=this.blendDstAlpha,e.blendEquationAlpha=this.blendEquationAlpha,e.depthTest=this.depthTest,e.depthWrite=this.depthWrite,e.polygonOffset=this.polygonOffset,e.polygonOffsetFactor=this.polygonOffsetFactor,e.polygonOffsetUnits=this.polygonOffsetUnits,e.alphaTest=this.alphaTest,e.overdraw=this.overdraw,e.visible=this.visible,e},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},K.EventDispatcher.prototype.apply(K.Material.prototype),K.MaterialIdCount=0,K.LineBasicMaterial=function(e){K.Material.call(this),this.type="LineBasicMaterial",this.color=new K.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=K.NoColors,this.fog=!0,this.setValues(e)},K.LineBasicMaterial.prototype=Object.create(K.Material.prototype),K.LineBasicMaterial.prototype.constructor=K.LineBasicMaterial,K.LineBasicMaterial.prototype.clone=function(){var e=new K.LineBasicMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.linecap=this.linecap,e.linejoin=this.linejoin,e.vertexColors=this.vertexColors,e.fog=this.fog,e},K.LineDashedMaterial=function(e){K.Material.call(this),this.type="LineDashedMaterial",this.color=new K.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},K.LineDashedMaterial.prototype=Object.create(K.Material.prototype),K.LineDashedMaterial.prototype.constructor=K.LineDashedMaterial,K.LineDashedMaterial.prototype.clone=function(){var e=new K.LineDashedMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.scale=this.scale,e.dashSize=this.dashSize,e.gapSize=this.gapSize,e.vertexColors=this.vertexColors,e.fog=this.fog,e},K.MeshBasicMaterial=function(e){K.Material.call(this),this.type="MeshBasicMaterial",this.color=new K.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=K.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=K.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},K.MeshBasicMaterial.prototype=Object.create(K.Material.prototype),K.MeshBasicMaterial.prototype.constructor=K.MeshBasicMaterial,K.MeshBasicMaterial.prototype.clone=function(){var e=new K.MeshBasicMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e},K.MeshLambertMaterial=function(e){K.Material.call(this),this.type="MeshLambertMaterial",this.color=new K.Color(16777215),this.emissive=new K.Color(0),this.wrapAround=!1,this.wrapRGB=new K.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=K.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=K.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},K.MeshLambertMaterial.prototype=Object.create(K.Material.prototype),K.MeshLambertMaterial.prototype.constructor=K.MeshLambertMaterial,K.MeshLambertMaterial.prototype.clone=function(){var e=new K.MeshLambertMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.emissive.copy(this.emissive),e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},K.MeshPhongMaterial=function(e){K.Material.call(this),this.type="MeshPhongMaterial",this.color=new K.Color(16777215),this.emissive=new K.Color(0),this.specular=new K.Color(1118481),this.shininess=30,this.metal=!1,this.wrapAround=!1,this.wrapRGB=new K.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new K.Vector2(1,1),this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=K.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=K.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},K.MeshPhongMaterial.prototype=Object.create(K.Material.prototype),K.MeshPhongMaterial.prototype.constructor=K.MeshPhongMaterial,K.MeshPhongMaterial.prototype.clone=function(){var e=new K.MeshPhongMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.emissive.copy(this.emissive),e.specular.copy(this.specular),e.shininess=this.shininess,e.metal=this.metal,e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.bumpMap=this.bumpMap,e.bumpScale=this.bumpScale,e.normalMap=this.normalMap,e.normalScale.copy(this.normalScale),e.specularMap=this.specularMap,e.alphaMap=this.alphaMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},K.MeshDepthMaterial=function(e){K.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},K.MeshDepthMaterial.prototype=Object.create(K.Material.prototype),K.MeshDepthMaterial.prototype.constructor=K.MeshDepthMaterial,K.MeshDepthMaterial.prototype.clone=function(){var e=new K.MeshDepthMaterial;return K.Material.prototype.clone.call(this,e),e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},K.MeshNormalMaterial=function(e){K.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},K.MeshNormalMaterial.prototype=Object.create(K.Material.prototype),K.MeshNormalMaterial.prototype.constructor=K.MeshNormalMaterial,K.MeshNormalMaterial.prototype.clone=function(){var e=new K.MeshNormalMaterial;return K.Material.prototype.clone.call(this,e),e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},K.MeshFaceMaterial=function(e){this.uuid=K.Math.generateUUID(),this.type="MeshFaceMaterial",this.materials=e instanceof Array?e:[]},K.MeshFaceMaterial.prototype={constructor:K.MeshFaceMaterial,toJSON:function(){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=0,i=this.materials.length;t<i;t++)e.materials.push(this.materials[t].toJSON());return e},clone:function(){for(var e=new K.MeshFaceMaterial,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e}},K.PointCloudMaterial=function(e){K.Material.call(this),this.type="PointCloudMaterial",this.color=new K.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=K.NoColors,this.fog=!0,this.setValues(e)},K.PointCloudMaterial.prototype=Object.create(K.Material.prototype),K.PointCloudMaterial.prototype.constructor=K.PointCloudMaterial,K.PointCloudMaterial.prototype.clone=function(){var e=new K.PointCloudMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,this.defines&&(e.defines=Object.assign({},this.defines)),e.size=this.size,e.sizeAttenuation=this.sizeAttenuation,e.vertexColors=this.vertexColors,e.fog=this.fog,e},K.ParticleBasicMaterial=function(e){return K.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new K.PointCloudMaterial(e)},K.ParticleSystemMaterial=function(e){return K.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new K.PointCloudMaterial(e)},K.ShaderMaterial=function(e){K.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=K.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=K.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(e)},K.ShaderMaterial.prototype=Object.create(K.Material.prototype),K.ShaderMaterial.prototype.constructor=K.ShaderMaterial,K.ShaderMaterial.prototype.clone=function(){var e=new K.ShaderMaterial;return K.Material.prototype.clone.call(this,e),e.fragmentShader=this.fragmentShader,e.vertexShader=this.vertexShader,e.uniforms=K.UniformsUtils.clone(this.uniforms),e.attributes=this.attributes,e.defines=this.defines,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.fog=this.fog,e.lights=this.lights,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},K.RawShaderMaterial=function(e){K.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},K.RawShaderMaterial.prototype=Object.create(K.ShaderMaterial.prototype),K.RawShaderMaterial.prototype.constructor=K.RawShaderMaterial,K.RawShaderMaterial.prototype.clone=function(){var e=new K.RawShaderMaterial;return K.ShaderMaterial.prototype.clone.call(this,e),e},K.SpriteMaterial=function(e){K.Material.call(this),this.type="SpriteMaterial",this.color=new K.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},K.SpriteMaterial.prototype=Object.create(K.Material.prototype),K.SpriteMaterial.prototype.constructor=K.SpriteMaterial,K.SpriteMaterial.prototype.clone=function(){var e=new K.SpriteMaterial;return K.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.rotation=this.rotation,e.fog=this.fog,e},K.Texture=function(e,t,i,n,r,o,s,a,l){Object.defineProperty(this,"id",{value:K.TextureIdCount++}),this.uuid=K.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:K.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:K.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:K.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:K.ClampToEdgeWrapping,this.magFilter=void 0!==r?r:K.LinearFilter,this.minFilter=void 0!==o?o:K.LinearMipMapLinearFilter,this.anisotropy=void 0!==l?l:1,this.format=void 0!==s?s:K.RGBAFormat,this.type=void 0!==a?a:K.UnsignedByteType,this.offset=new K.Vector2(0,0),this.repeat=new K.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},K.Texture.DEFAULT_IMAGE=void 0,K.Texture.DEFAULT_MAPPING=K.UVMapping,K.Texture.prototype={constructor:K.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){!0===e&&this.update(),this._needsUpdate=e},clone:function(e){return void 0===e&&(e=new K.Texture),e.image=this.image,e.mipmaps=this.mipmaps.slice(0),e.mapping=this.mapping,e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.format=this.format,e.type=this.type,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.generateMipmaps=this.generateMipmaps,e.premultiplyAlpha=this.premultiplyAlpha,e.flipY=this.flipY,e.unpackAlignment=this.unpackAlignment,e},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},K.EventDispatcher.prototype.apply(K.Texture.prototype),K.TextureIdCount=0,K.CubeTexture=function(e,t,i,n,r,o,s,a,l){t=void 0!==t?t:K.CubeReflectionMapping,K.Texture.call(this,e,t,i,n,r,o,s,a,l),this.images=e},K.CubeTexture.prototype=Object.create(K.Texture.prototype),K.CubeTexture.prototype.constructor=K.CubeTexture,K.CubeTexture.clone=function(e){return void 0===e&&(e=new K.CubeTexture),K.Texture.prototype.clone.call(this,e),e.images=this.images,e},K.CompressedTexture=function(e,t,i,n,r,o,s,a,l,c,h){K.Texture.call(this,null,o,s,a,l,c,n,r,h),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},K.CompressedTexture.prototype=Object.create(K.Texture.prototype),K.CompressedTexture.prototype.constructor=K.CompressedTexture,K.CompressedTexture.prototype.clone=function(){var e=new K.CompressedTexture;return K.Texture.prototype.clone.call(this,e),e},K.DataTexture=function(e,t,i,n,r,o,s,a,l,c,h){K.Texture.call(this,null,o,s,a,l,c,n,r,h),this.image={data:e,width:t,height:i}},K.DataTexture.prototype=Object.create(K.Texture.prototype),K.DataTexture.prototype.constructor=K.DataTexture,K.DataTexture.prototype.clone=function(){var e=new K.DataTexture;return K.Texture.prototype.clone.call(this,e),e},K.VideoTexture=function(e,t,i,n,r,o,s,a,l){K.Texture.call(this,e,t,i,n,r,o,s,a,l),this.generateMipmaps=!1;var c=this,h=function(){requestAnimationFrame(h),e.readyState===e.HAVE_ENOUGH_DATA&&(c.needsUpdate=!0)};h()},K.VideoTexture.prototype=Object.create(K.Texture.prototype),K.VideoTexture.prototype.constructor=K.VideoTexture,K.Group=function(){K.Object3D.call(this),this.type="Group"},K.Group.prototype=Object.create(K.Object3D.prototype),K.Group.prototype.constructor=K.Group,K.PointCloud=function(e,t){K.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==e?e:new K.Geometry,this.material=void 0!==t?t:new K.PointCloudMaterial({color:16777215*Math.random()})},K.PointCloud.prototype=Object.create(K.Object3D.prototype),K.PointCloud.prototype.constructor=K.PointCloud,K.PointCloud.prototype.raycast=(C=new K.Matrix4,P=new K.Ray,function(e,t){var i=this,n=i.geometry,r=e.params.PointCloud.threshold;if(C.getInverse(this.matrixWorld),P.copy(e.ray).applyMatrix4(C),null===n.boundingBox||!1!==P.isIntersectionBox(n.boundingBox)){var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=new K.Vector3,a=function(n,r){var s=P.distanceToPoint(n);if(s<o){var a=P.closestPointToPoint(n);a.applyMatrix4(i.matrixWorld);var l=e.ray.origin.distanceTo(a);t.push({distance:l,distanceToRay:s,point:a.clone(),index:r,face:null,object:i})}};if(n instanceof K.BufferGeometry){var l=n.attributes,c=l.position.array;if(void 0!==l.index){var h=l.index.array,u=n.offsets;0===u.length&&(u=[{start:0,count:h.length,index:0}]);for(var d=0,f=u.length;d<f;++d)for(var p=u[d].start,m=u[d].count,g=u[d].index,v=p,y=p+m;v<y;v++){var b=g+h[v];s.fromArray(c,3*b),a(s,b)}}else{var x=c.length/3;for(v=0;v<x;v++)s.set(c[3*v],c[3*v+1],c[3*v+2]),a(s,v)}}else{var _=this.geometry.vertices;for(v=0;v<_.length;v++)a(_[v],v)}}}),K.PointCloud.prototype.clone=function(e){return void 0===e&&(e=new K.PointCloud(this.geometry,this.material)),K.Object3D.prototype.clone.call(this,e),e},K.ParticleSystem=function(e,t){return K.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new K.PointCloud(e,t)},K.Line=function(e,t,i){K.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new K.Geometry,this.material=void 0!==t?t:new K.LineBasicMaterial({color:16777215*Math.random()}),this.mode=void 0!==i?i:K.LineStrip},K.LineStrip=0,K.LinePieces=1,K.Line.prototype=Object.create(K.Object3D.prototype),K.Line.prototype.constructor=K.Line,K.Line.prototype.raycast=function(){var e=new K.Matrix4,t=new K.Ray,i=new K.Sphere;return function(n,r){var o=n.linePrecision,s=o*o,a=this.geometry;if(null===a.boundingSphere&&a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(this.matrixWorld),!1!==n.ray.isIntersectionSphere(i)){e.getInverse(this.matrixWorld),t.copy(n.ray).applyMatrix4(e);var l=new K.Vector3,c=new K.Vector3,h=new K.Vector3,u=new K.Vector3,d=this.mode===K.LineStrip?1:2;if(a instanceof K.BufferGeometry){var f=a.attributes;if(void 0!==f.index){var p=f.index.array,m=f.position.array,g=a.offsets;0===g.length&&(g=[{start:0,count:p.length,index:0}]);for(var v=0;v<g.length;v++)for(var y=g[v].start,b=g[v].count,x=g[v].index,_=y;_<y+b-1;_+=d){var E=x+p[_],S=x+p[_+1];if(l.fromArray(m,3*E),c.fromArray(m,3*S),!(t.distanceSqToSegment(l,c,u,h)>s))(T=t.origin.distanceTo(u))<n.near||T>n.far||r.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:_,offsetIndex:v,face:null,faceIndex:null,object:this})}}else for(m=f.position.array,_=0;_<m.length/3-1;_+=d){if(l.fromArray(m,3*_),c.fromArray(m,3*_+3),!(t.distanceSqToSegment(l,c,u,h)>s))(T=t.origin.distanceTo(u))<n.near||T>n.far||r.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else if(a instanceof K.Geometry){var A=a.vertices,w=A.length;for(_=0;_<w-1;_+=d){var T;if(!(t.distanceSqToSegment(A[_],A[_+1],u,h)>s))(T=t.origin.distanceTo(u))<n.near||T>n.far||r.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),K.Line.prototype.clone=function(e){return void 0===e&&(e=new K.Line(this.geometry,this.material,this.mode)),K.Object3D.prototype.clone.call(this,e),e},K.Mesh=function(e,t){K.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new K.Geometry,this.material=void 0!==t?t:new K.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},K.Mesh.prototype=Object.create(K.Object3D.prototype),K.Mesh.prototype.constructor=K.Mesh,K.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},K.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(K.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},K.Mesh.prototype.raycast=function(){var e=new K.Matrix4,t=new K.Ray,i=new K.Sphere,n=new K.Vector3,r=new K.Vector3,o=new K.Vector3;return function(s,a){var l=this.geometry;if(null===l.boundingSphere&&l.computeBoundingSphere(),i.copy(l.boundingSphere),i.applyMatrix4(this.matrixWorld),!1!==s.ray.isIntersectionSphere(i)&&(e.getInverse(this.matrixWorld),t.copy(s.ray).applyMatrix4(e),null===l.boundingBox||!1!==t.isIntersectionBox(l.boundingBox)))if(l instanceof K.BufferGeometry){if(void 0===(L=this.material))return;var c=l.attributes,h=s.precision;if(void 0!==c.index){var u=c.index.array,d=c.position.array,f=l.offsets;0===f.length&&(f=[{start:0,count:u.length,index:0}]);for(var p=0,m=f.length;p<m;++p)for(var g=f[p].start,v=f[p].count,y=f[p].index,b=g,x=g+v;b<x;b+=3){if(S=y+u[b],A=y+u[b+1],w=y+u[b+2],n.fromArray(d,3*S),r.fromArray(d,3*A),o.fromArray(d,3*w),L.side===K.BackSide)var _=t.intersectTriangle(o,r,n,!0);else _=t.intersectTriangle(n,r,o,L.side!==K.DoubleSide);if(null!==_)_.applyMatrix4(this.matrixWorld),(k=s.ray.origin.distanceTo(_))<h||k<s.near||k>s.far||a.push({distance:k,point:_,face:new K.Face3(S,A,w,K.Triangle.normal(n,r,o)),faceIndex:null,object:this})}}else{b=0;var E=0;for(x=(d=c.position.array).length;b<x;b+=3,E+=9){if(S=b,A=b+1,w=b+2,n.fromArray(d,E),r.fromArray(d,E+3),o.fromArray(d,E+6),L.side===K.BackSide)_=t.intersectTriangle(o,r,n,!0);else _=t.intersectTriangle(n,r,o,L.side!==K.DoubleSide);if(null!==_)_.applyMatrix4(this.matrixWorld),(k=s.ray.origin.distanceTo(_))<h||k<s.near||k>s.far||a.push({distance:k,point:_,face:new K.Face3(S,A,w,K.Triangle.normal(n,r,o)),faceIndex:null,object:this})}}}else if(l instanceof K.Geometry)for(var S,A,w,T=this.material instanceof K.MeshFaceMaterial,M=!0===T?this.material.materials:null,C=(h=s.precision,l.vertices),P=0,D=l.faces.length;P<D;P++){var L,I=l.faces[P];if(void 0!==(L=!0===T?M[I.materialIndex]:this.material)){if(S=C[I.a],A=C[I.b],w=C[I.c],!0===L.morphTargets){var R=l.morphTargets,O=this.morphTargetInfluences;n.set(0,0,0),r.set(0,0,0),o.set(0,0,0);for(var N=0,F=R.length;N<F;N++){var U=O[N];if(0!==U){var B=R[N].vertices;n.x+=(B[I.a].x-S.x)*U,n.y+=(B[I.a].y-S.y)*U,n.z+=(B[I.a].z-S.z)*U,r.x+=(B[I.b].x-A.x)*U,r.y+=(B[I.b].y-A.y)*U,r.z+=(B[I.b].z-A.z)*U,o.x+=(B[I.c].x-w.x)*U,o.y+=(B[I.c].y-w.y)*U,o.z+=(B[I.c].z-w.z)*U}}n.add(S),r.add(A),o.add(w),S=n,A=r,w=o}if(L.side===K.BackSide)_=t.intersectTriangle(w,A,S,!0);else _=t.intersectTriangle(S,A,w,L.side!==K.DoubleSide);var k;if(null!==_)_.applyMatrix4(this.matrixWorld),(k=s.ray.origin.distanceTo(_))<h||k<s.near||k>s.far||a.push({distance:k,point:_,face:I,faceIndex:P,object:this})}}}}(),K.Mesh.prototype.clone=function(e,t){return void 0===e&&(e=new K.Mesh(this.geometry,this.material)),K.Object3D.prototype.clone.call(this,e,t),e},K.Bone=function(e){K.Object3D.call(this),this.type="Bone",this.skin=e},K.Bone.prototype=Object.create(K.Object3D.prototype),K.Bone.prototype.constructor=K.Bone,K.Skeleton=function(e,t,i){var n;(this.useVertexTexture=void 0===i||i,this.identityMatrix=new K.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture)?(n=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new K.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,K.RGBAFormat,K.FloatType),this.boneTexture.minFilter=K.NearestFilter,this.boneTexture.magFilter=K.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{K.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r<o;r++)this.boneInverses.push(new K.Matrix4)}},K.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var i=new K.Matrix4;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},K.Skeleton.prototype.pose=function(){for(var e,t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,i=this.bones.length;t<i;t++)(e=this.bones[t])&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},K.Skeleton.prototype.update=(D=new K.Matrix4,function(){for(var e=0,t=this.bones.length;e<t;e++){var i=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;D.multiplyMatrices(i,this.boneInverses[e]),D.flattenToArrayOffset(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}),K.SkinnedMesh=function(e,t,i){K.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new K.Matrix4,this.bindMatrixInverse=new K.Matrix4;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,o,s,a,l,c=0,h=this.geometry.bones.length;c<h;++c)s=(o=this.geometry.bones[c]).pos,a=o.rotq,l=o.scl,r=new K.Bone(this),n.push(r),r.name=o.name,r.position.set(s[0],s[1],s[2]),r.quaternion.set(a[0],a[1],a[2],a[3]),void 0!==l?r.scale.set(l[0],l[1],l[2]):r.scale.set(1,1,1);for(c=0,h=this.geometry.bones.length;c<h;++c)-1!==(o=this.geometry.bones[c]).parent?n[o.parent].add(n[c]):this.add(n[c])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new K.Skeleton(n,void 0,i))},K.SkinnedMesh.prototype=Object.create(K.Mesh.prototype),K.SkinnedMesh.prototype.constructor=K.SkinnedMesh,K.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},K.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},K.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof K.Geometry)for(var e=0;e<this.geometry.skinIndices.length;e++){var t=this.geometry.skinWeights[e],i=1/t.lengthManhattan();i!==1/0?t.multiplyScalar(i):t.set(1)}},K.SkinnedMesh.prototype.updateMatrixWorld=function(e){K.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):K.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)},K.SkinnedMesh.prototype.clone=function(e){return void 0===e&&(e=new K.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),K.Mesh.prototype.clone.call(this,e),e},K.MorphAnimMesh=function(e,t){K.Mesh.call(this,e,t),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},K.MorphAnimMesh.prototype=Object.create(K.Mesh.prototype),K.MorphAnimMesh.prototype.constructor=K.MorphAnimMesh,K.MorphAnimMesh.prototype.setFrameRange=function(e,t){this.startKeyframe=e,this.endKeyframe=t,this.length=this.endKeyframe-this.startKeyframe+1},K.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},K.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},K.MorphAnimMesh.prototype.parseAnimations=function(){var e=this.geometry;e.animations||(e.animations={});for(var t,i=e.animations,n=/([a-z]+)_?(\d+)/,r=0,o=e.morphTargets.length;r<o;r++){var s=e.morphTargets[r].name.match(n);if(s&&s.length>1){var a=s[1];i[a]||(i[a]={start:1/0,end:-1/0});var l=i[a];r<l.start&&(l.start=r),r>l.end&&(l.end=r),t||(t=a)}}e.firstAnimation=t},K.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,i){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:i}},K.MorphAnimMesh.prototype.playAnimation=function(e,t){var i=this.geometry.animations[e];i?(this.setFrameRange(i.start,i.end),this.duration=(i.end-i.start)/t*1e3,this.time=0):K.warn("THREE.MorphAnimMesh: animation["+e+"] undefined in .playAnimation()")},K.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var i=this.startKeyframe+K.Math.clamp(Math.floor(this.time/t),0,this.length-1);i!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[i]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=i);var n=this.time%t/t;this.directionBackwards&&(n=1-n),this.morphTargetInfluences[this.currentKeyframe]=n,this.morphTargetInfluences[this.lastKeyframe]=1-n},K.MorphAnimMesh.prototype.interpolateTargets=function(e,t,i){for(var n=this.morphTargetInfluences,r=0,o=n.length;r<o;r++)n[r]=0;e>-1&&(n[e]=1-i),t>-1&&(n[t]=i)},K.MorphAnimMesh.prototype.clone=function(e){return void 0===e&&(e=new K.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,K.Mesh.prototype.clone.call(this,e),e},K.LOD=function(){K.Object3D.call(this),this.objects=[]},K.LOD.prototype=Object.create(K.Object3D.prototype),K.LOD.prototype.constructor=K.LOD,K.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=0;i<this.objects.length&&!(t<this.objects[i].distance);i++);this.objects.splice(i,0,{distance:t,object:e}),this.add(e)},K.LOD.prototype.getObjectForDistance=function(e){for(var t=1,i=this.objects.length;t<i&&!(e<this.objects[t].distance);t++);return this.objects[t-1].object},K.LOD.prototype.raycast=(L=new K.Vector3,function(e,t){L.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(L);this.getObjectForDistance(i).raycast(e,t)}),K.LOD.prototype.update=function(){var e=new K.Vector3,t=new K.Vector3;return function(i){if(this.objects.length>1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);this.objects[0].object.visible=!0;for(var r=1,o=this.objects.length;r<o&&n>=this.objects[r].distance;r++)this.objects[r-1].object.visible=!1,this.objects[r].object.visible=!0;for(;r<o;r++)this.objects[r].object.visible=!1}}}(),K.LOD.prototype.clone=function(e){void 0===e&&(e=new K.LOD),K.Object3D.prototype.clone.call(this,e);for(var t=0,i=this.objects.length;t<i;t++){var n=this.objects[t].object.clone();n.visible=0===t,e.addLevel(n,this.objects[t].distance)}return e},K.Sprite=(I=new Uint16Array([0,1,2,0,2,3]),R=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),O=new Float32Array([0,0,1,0,1,1,0,1]),(N=new K.BufferGeometry).setAttribute("index",new K.BufferAttribute(I,1)),N.setAttribute("position",new K.BufferAttribute(R,3)),N.setAttribute("uv",new K.BufferAttribute(O,2)),function(e){K.Object3D.call(this),this.type="Sprite",this.geometry=N,this.material=void 0!==e?e:new K.SpriteMaterial}),K.Sprite.prototype=Object.create(K.Object3D.prototype),K.Sprite.prototype.constructor=K.Sprite,K.Sprite.prototype.raycast=function(){var e=new K.Vector3;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceToPoint(e);n>this.scale.x||i.push({distance:n,point:this.position,face:null,object:this})}}(),K.Sprite.prototype.clone=function(e){return void 0===e&&(e=new K.Sprite(this.material)),K.Object3D.prototype.clone.call(this,e),e},K.Particle=K.Sprite,K.LensFlare=function(e,t,i,n,r){K.Object3D.call(this),this.lensFlares=[],this.positionScreen=new K.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,n,r)},K.LensFlare.prototype=Object.create(K.Object3D.prototype),K.LensFlare.prototype.constructor=K.LensFlare,K.LensFlare.prototype.add=function(e,t,i,n,r,o){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===o&&(o=1),void 0===r&&(r=new K.Color(16777215)),void 0===n&&(n=K.NormalBlending),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:1,opacity:o,color:r,blending:n})},K.LensFlare.prototype.updateLensFlares=function(){var e,t,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(e=0;e<i;e++)(t=this.lensFlares[e]).x=this.positionScreen.x+n*t.distance,t.y=this.positionScreen.y+r*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},K.Scene=function(){K.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},K.Scene.prototype=Object.create(K.Object3D.prototype),K.Scene.prototype.constructor=K.Scene,K.Scene.prototype.clone=function(e){return void 0===e&&(e=new K.Scene),K.Object3D.prototype.clone.call(this,e),null!==this.fog&&(e.fog=this.fog.clone()),null!==this.overrideMaterial&&(e.overrideMaterial=this.overrideMaterial.clone()),e.autoUpdate=this.autoUpdate,e.matrixAutoUpdate=this.matrixAutoUpdate,e},K.Fog=function(e,t,i){this.name="",this.color=new K.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3},K.Fog.prototype.clone=function(){return new K.Fog(this.color.getHex(),this.near,this.far)},K.FogExp2=function(e,t){this.name="",this.color=new K.Color(e),this.density=void 0!==t?t:25e-5},K.FogExp2.prototype.clone=function(){return new K.FogExp2(this.color.getHex(),this.density)},K.ShaderChunk={},K.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n\tfloat distance = dot( planeNormal, point-pointOnPlane );\n\treturn point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n",K.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",K.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\n\n#endif\n",K.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n",K.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",K.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",K.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n",K.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",K.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif",K.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n",K.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",K.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif",K.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n",K.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",K.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n",K.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n",K.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif",K.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",K.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif",K.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif",K.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif",K.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",K.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",K.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif",K.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n",K.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n",K.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",K.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",K.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n",K.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",K.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",K.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",K.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif",K.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",K.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",K.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",K.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",K.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",K.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n",K.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",K.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",K.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",K.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",K.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",K.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif",K.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n",K.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n",K.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif\n",K.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif",K.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",K.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif",K.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",K.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",K.UniformsUtils={merge:function(e){for(var t={},i=0;i<e.length;i++){var n=this.clone(e[i]);for(var r in n)t[r]=n[r]}return t},clone:function(e){var t={};for(var i in e)for(var n in t[i]={},e[i]){var r=e[i][n];r instanceof K.Color||r instanceof K.Vector2||r instanceof K.Vector3||r instanceof K.Vector4||r instanceof K.Matrix4||r instanceof K.Texture?t[i][n]=r.clone():t[i][n]=r instanceof Array?r.slice():r}return t}},K.UniformsLib={common:{diffuse:{type:"c",value:new K.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new K.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new K.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new K.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new K.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new K.Vector4(0,0,1,1)},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new K.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},K.ShaderLib={basic:{uniforms:K.UniformsUtils.merge([K.UniformsLib.common,K.UniformsLib.fog,K.UniformsLib.shadowmap]),vertexShader:[K.ShaderChunk.common,K.ShaderChunk.map_pars_vertex,K.ShaderChunk.lightmap_pars_vertex,K.ShaderChunk.envmap_pars_vertex,K.ShaderChunk.color_pars_vertex,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.skinning_pars_vertex,K.ShaderChunk.shadowmap_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.map_vertex,K.ShaderChunk.lightmap_vertex,K.ShaderChunk.color_vertex,K.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",K.ShaderChunk.morphnormal_vertex,K.ShaderChunk.skinnormal_vertex,K.ShaderChunk.defaultnormal_vertex,"\t#endif",K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.skinning_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,K.ShaderChunk.worldpos_vertex,K.ShaderChunk.envmap_vertex,K.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",K.ShaderChunk.common,K.ShaderChunk.color_pars_fragment,K.ShaderChunk.map_pars_fragment,K.ShaderChunk.alphamap_pars_fragment,K.ShaderChunk.lightmap_pars_fragment,K.ShaderChunk.envmap_pars_fragment,K.ShaderChunk.fog_pars_fragment,K.ShaderChunk.shadowmap_pars_fragment,K.ShaderChunk.specularmap_pars_fragment,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",K.ShaderChunk.logdepthbuf_fragment,K.ShaderChunk.map_fragment,K.ShaderChunk.color_fragment,K.ShaderChunk.alphamap_fragment,K.ShaderChunk.alphatest_fragment,K.ShaderChunk.specularmap_fragment,"\toutgoingLight = diffuseColor.rgb;",K.ShaderChunk.lightmap_fragment,K.ShaderChunk.envmap_fragment,K.ShaderChunk.shadowmap_fragment,K.ShaderChunk.linear_to_gamma_fragment,K.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},lambert:{uniforms:K.UniformsUtils.merge([K.UniformsLib.common,K.UniformsLib.fog,K.UniformsLib.lights,K.UniformsLib.shadowmap,{emissive:{type:"c",value:new K.Color(0)},wrapRGB:{type:"v3",value:new K.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",K.ShaderChunk.common,K.ShaderChunk.map_pars_vertex,K.ShaderChunk.lightmap_pars_vertex,K.ShaderChunk.envmap_pars_vertex,K.ShaderChunk.lights_lambert_pars_vertex,K.ShaderChunk.color_pars_vertex,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.skinning_pars_vertex,K.ShaderChunk.shadowmap_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.map_vertex,K.ShaderChunk.lightmap_vertex,K.ShaderChunk.color_vertex,K.ShaderChunk.morphnormal_vertex,K.ShaderChunk.skinbase_vertex,K.ShaderChunk.skinnormal_vertex,K.ShaderChunk.defaultnormal_vertex,K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.skinning_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,K.ShaderChunk.worldpos_vertex,K.ShaderChunk.envmap_vertex,K.ShaderChunk.lights_lambert_vertex,K.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform vec3 emissive;","uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",K.ShaderChunk.common,K.ShaderChunk.color_pars_fragment,K.ShaderChunk.map_pars_fragment,K.ShaderChunk.alphamap_pars_fragment,K.ShaderChunk.lightmap_pars_fragment,K.ShaderChunk.envmap_pars_fragment,K.ShaderChunk.fog_pars_fragment,K.ShaderChunk.shadowmap_pars_fragment,K.ShaderChunk.specularmap_pars_fragment,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",K.ShaderChunk.logdepthbuf_fragment,K.ShaderChunk.map_fragment,K.ShaderChunk.color_fragment,K.ShaderChunk.alphamap_fragment,K.ShaderChunk.alphatest_fragment,K.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED","\t\tif ( gl_FrontFacing )","\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;","\t\telse","\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;","\t#else","\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;","\t#endif",K.ShaderChunk.lightmap_fragment,K.ShaderChunk.envmap_fragment,K.ShaderChunk.shadowmap_fragment,K.ShaderChunk.linear_to_gamma_fragment,K.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},phong:{uniforms:K.UniformsUtils.merge([K.UniformsLib.common,K.UniformsLib.bump,K.UniformsLib.normalmap,K.UniformsLib.fog,K.UniformsLib.lights,K.UniformsLib.shadowmap,{emissive:{type:"c",value:new K.Color(0)},specular:{type:"c",value:new K.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new K.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif",K.ShaderChunk.common,K.ShaderChunk.map_pars_vertex,K.ShaderChunk.lightmap_pars_vertex,K.ShaderChunk.envmap_pars_vertex,K.ShaderChunk.lights_phong_pars_vertex,K.ShaderChunk.color_pars_vertex,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.skinning_pars_vertex,K.ShaderChunk.shadowmap_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.map_vertex,K.ShaderChunk.lightmap_vertex,K.ShaderChunk.color_vertex,K.ShaderChunk.morphnormal_vertex,K.ShaderChunk.skinbase_vertex,K.ShaderChunk.skinnormal_vertex,K.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif",K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.skinning_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = -mvPosition.xyz;",K.ShaderChunk.worldpos_vertex,K.ShaderChunk.envmap_vertex,K.ShaderChunk.lights_phong_vertex,K.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",K.ShaderChunk.common,K.ShaderChunk.color_pars_fragment,K.ShaderChunk.map_pars_fragment,K.ShaderChunk.alphamap_pars_fragment,K.ShaderChunk.lightmap_pars_fragment,K.ShaderChunk.envmap_pars_fragment,K.ShaderChunk.fog_pars_fragment,K.ShaderChunk.lights_phong_pars_fragment,K.ShaderChunk.shadowmap_pars_fragment,K.ShaderChunk.bumpmap_pars_fragment,K.ShaderChunk.normalmap_pars_fragment,K.ShaderChunk.specularmap_pars_fragment,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",K.ShaderChunk.logdepthbuf_fragment,K.ShaderChunk.map_fragment,K.ShaderChunk.color_fragment,K.ShaderChunk.alphamap_fragment,K.ShaderChunk.alphatest_fragment,K.ShaderChunk.specularmap_fragment,K.ShaderChunk.lights_phong_fragment,K.ShaderChunk.lightmap_fragment,K.ShaderChunk.envmap_fragment,K.ShaderChunk.shadowmap_fragment,K.ShaderChunk.linear_to_gamma_fragment,K.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},particle_basic:{uniforms:K.UniformsUtils.merge([K.UniformsLib.particle,K.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",K.ShaderChunk.common,K.ShaderChunk.color_pars_vertex,K.ShaderChunk.shadowmap_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\t#ifdef USE_SIZEATTENUATION","\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );","\t#else","\t\tgl_PointSize = size;","\t#endif","\tgl_Position = projectionMatrix * mvPosition;",K.ShaderChunk.logdepthbuf_vertex,K.ShaderChunk.worldpos_vertex,K.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",K.ShaderChunk.common,K.ShaderChunk.color_pars_fragment,K.ShaderChunk.map_particle_pars_fragment,K.ShaderChunk.fog_pars_fragment,K.ShaderChunk.shadowmap_pars_fragment,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( psColor, opacity );",K.ShaderChunk.logdepthbuf_fragment,K.ShaderChunk.map_particle_fragment,K.ShaderChunk.color_fragment,K.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",K.ShaderChunk.shadowmap_fragment,K.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},dashed:{uniforms:K.UniformsUtils.merge([K.UniformsLib.common,K.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",K.ShaderChunk.common,K.ShaderChunk.color_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",K.ShaderChunk.common,K.ShaderChunk.color_pars_fragment,K.ShaderChunk.fog_pars_fragment,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tif ( mod( vLineDistance, totalSize ) > dashSize ) {","\t\tdiscard;","\t}","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",K.ShaderChunk.logdepthbuf_fragment,K.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",K.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[K.ShaderChunk.common,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",K.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;","\t#else","\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;","\t#endif","\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );","\tgl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",K.ShaderChunk.common,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvNormal = normalize( normalMatrix * normal );",K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",K.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",K.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",K.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[K.ShaderChunk.common,K.ShaderChunk.morphtarget_pars_vertex,K.ShaderChunk.skinning_pars_vertex,K.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",K.ShaderChunk.skinbase_vertex,K.ShaderChunk.morphtarget_vertex,K.ShaderChunk.skinning_vertex,K.ShaderChunk.default_vertex,K.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[K.ShaderChunk.common,K.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","\tres -= res.xxyz * bit_mask;","\treturn res;","}","void main() {",K.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","\t#else","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","\t#endif","}"].join("\n")}},K.WebGLRenderer=function(e){console.log("THREE.WebGLRenderer",K.REVISION);var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElement("canvas"),i=void 0!==e.context?e.context:null,n=1,r=void 0!==e.precision?e.precision:"highp",o=void 0!==e.alpha&&e.alpha,s=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,l=void 0!==e.antialias&&e.antialias,c=void 0===e.premultipliedAlpha||e.premultipliedAlpha,h=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.logarithmicDepthBuffer&&e.logarithmicDepthBuffer,d=new K.Color(0),f=0,p=[],m={},g=[],v=[],y=[],b=[],x=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=K.PCFShadowMap,this.shadowMapCullFace=K.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var _,E=this,S=[],A=null,w=null,T=-1,M="",C=null,P=0,D=0,L=0,I=t.width,R=t.height,O=0,N=0,F=new K.Frustum,U=new K.Matrix4,B=new K.Vector3,k=new K.Vector3,V=!0,G={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var z={alpha:o,depth:s,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:h};if(null===(_=i||t.getContext("webgl",z)||t.getContext("experimental-webgl",z)))throw null!==t.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";t.addEventListener("webglcontextlost",(function(e){e.preventDefault(),X(),q(),m={}}),!1)}catch(e){K.error("THREE.WebGLRenderer: "+e)}var H=new K.WebGLState(_,st);void 0===_.getShaderPrecisionFormat&&(_.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var W=new K.WebGLExtensions(_);W.get("OES_texture_float"),W.get("OES_texture_float_linear"),W.get("OES_texture_half_float"),W.get("OES_texture_half_float_linear"),W.get("OES_standard_derivatives"),u&&W.get("EXT_frag_depth");var j=function(e,t,i,n){!0===c&&(e*=n,t*=n,i*=n),_.clearColor(e,t,i,n)},q=function(){_.clearColor(0,0,0,1),_.clearDepth(1),_.clearStencil(0),_.enable(_.DEPTH_TEST),_.depthFunc(_.LEQUAL),_.frontFace(_.CCW),_.cullFace(_.BACK),_.enable(_.CULL_FACE),_.enable(_.BLEND),_.blendEquation(_.FUNC_ADD),_.blendFunc(_.SRC_ALPHA,_.ONE_MINUS_SRC_ALPHA),_.viewport(D,L,I,R),j(d.r,d.g,d.b,f)},X=function(){A=null,C=null,M="",T=-1,V=!0,H.reset()};q(),this.context=_,this.state=H;var Y,Q=_.getParameter(_.MAX_TEXTURE_IMAGE_UNITS),Z=_.getParameter(_.MAX_VERTEX_TEXTURE_IMAGE_UNITS),$=_.getParameter(_.MAX_TEXTURE_SIZE),J=_.getParameter(_.MAX_CUBE_MAP_TEXTURE_SIZE),ee=Z>0,te=ee&&W.get("OES_texture_float"),ie=_.getShaderPrecisionFormat(_.VERTEX_SHADER,_.HIGH_FLOAT),ne=_.getShaderPrecisionFormat(_.VERTEX_SHADER,_.MEDIUM_FLOAT),re=_.getShaderPrecisionFormat(_.FRAGMENT_SHADER,_.HIGH_FLOAT),oe=_.getShaderPrecisionFormat(_.FRAGMENT_SHADER,_.MEDIUM_FLOAT),se=function(){if(void 0!==Y)return Y;if(Y=[],W.get("WEBGL_compressed_texture_pvrtc")||W.get("WEBGL_compressed_texture_s3tc"))for(var e=_.getParameter(_.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)Y.push(e[t]);return Y},ae=ie.precision>0&&re.precision>0,le=ne.precision>0&&oe.precision>0;"highp"!==r||ae||(le?(r="mediump",K.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(r="lowp",K.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==r||le||(r="lowp",K.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var ce,he=new K.ShadowMapPlugin(this,p,m,g),ue=new K.SpritePlugin(this,b),de=new K.LensFlarePlugin(this,x);function fe(e){e.__webglVertexBuffer=_.createBuffer(),e.__webglNormalBuffer=_.createBuffer(),e.__webglTangentBuffer=_.createBuffer(),e.__webglColorBuffer=_.createBuffer(),e.__webglUVBuffer=_.createBuffer(),e.__webglUV2Buffer=_.createBuffer(),e.__webglSkinIndicesBuffer=_.createBuffer(),e.__webglSkinWeightsBuffer=_.createBuffer(),e.__webglFaceBuffer=_.createBuffer(),e.__webglLineBuffer=_.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var i=0,n=t;i<n;i++)e.__webglMorphTargetsBuffers.push(_.createBuffer())}var r=e.numMorphNormals;if(r){e.__webglMorphNormalsBuffers=[];for(i=0,n=r;i<n;i++)e.__webglMorphNormalsBuffers.push(_.createBuffer())}E.info.memory.geometries++}this.getContext=function(){return _},this.forceContextLoss=function(){W.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return ee},this.supportsFloatTextures=function(){return W.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return W.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return W.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return W.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return W.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return W.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){if(void 0!==ce)return ce;var e=W.get("EXT_texture_filter_anisotropic");return ce=null!==e?_.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return r},this.getPixelRatio=function(){return n},this.setPixelRatio=function(e){n=e},this.setSize=function(e,i,r){t.width=e*n,t.height=i*n,!1!==r&&(t.style.width=e+"px",t.style.height=i+"px"),this.setViewport(0,0,e,i)},this.setViewport=function(e,t,i,r){D=e*n,L=t*n,I=i*n,R=r*n,_.viewport(D,L,I,R)},this.setScissor=function(e,t,i,r){_.scissor(e*n,t*n,i*n,r*n)},this.enableScissorTest=function(e){e?_.enable(_.SCISSOR_TEST):_.disable(_.SCISSOR_TEST)},this.getClearColor=function(){return d},this.setClearColor=function(e,t){d.set(e),f=void 0!==t?t:1,j(d.r,d.g,d.b,f)},this.getClearAlpha=function(){return f},this.setClearAlpha=function(e){f=e,j(d.r,d.g,d.b,f)},this.clear=function(e,t,i){var n=0;(void 0===e||e)&&(n|=_.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=_.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=_.STENCIL_BUFFER_BIT),_.clear(n)},this.clearColor=function(){_.clear(_.COLOR_BUFFER_BIT)},this.clearDepth=function(){_.clear(_.DEPTH_BUFFER_BIT)},this.clearStencil=function(){_.clear(_.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,i,n){this.setRenderTarget(e),this.clear(t,i,n)},this.resetGLState=X;var pe=function(e){e.target.traverse((function(e){e.removeEventListener("remove",pe),function(e){e instanceof K.Mesh||e instanceof K.PointCloud||e instanceof K.Line?delete m[e.id]:(e instanceof K.ImmediateRenderObject||e.immediateRenderCallback)&&function(e,t){for(var i=e.length-1;i>=0;i--)e[i].object===t&&e.splice(i,1)}(g,e);delete e.__webglInit,delete e._modelViewMatrix,delete e._normalMatrix,delete e.__webglActive}(e)}))},me=function(e){var t=e.target;t.removeEventListener("dispose",me),xe(t)},ge=function(e){var t=e.target;t.removeEventListener("dispose",ge),_e(t),E.info.memory.textures--},ve=function(e){var t=e.target;t.removeEventListener("dispose",ve),Ee(t),E.info.memory.textures--},ye=function(e){var t=e.target;t.removeEventListener("dispose",ye),Se(t)},be=function(e){for(var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],i=0,n=t.length;i<n;i++){void 0!==e[r=t[i]]&&(_.deleteBuffer(e[r]),delete e[r])}if(void 0!==e.__webglCustomAttributesList){for(var r in e.__webglCustomAttributesList)_.deleteBuffer(e.__webglCustomAttributesList[r].buffer);delete e.__webglCustomAttributesList}E.info.memory.geometries--},xe=function(e){if(delete e.__webglInit,e instanceof K.BufferGeometry){for(var t in e.attributes){var i=e.attributes[t];void 0!==i.buffer&&(_.deleteBuffer(i.buffer),delete i.buffer)}E.info.memory.geometries--}else{var n=Ue[e.id];if(void 0!==n){for(var r=0,o=n.length;r<o;r++){var s=n[r];if(void 0!==s.numMorphTargets){for(var a=0,l=s.numMorphTargets;a<l;a++)_.deleteBuffer(s.__webglMorphTargetsBuffers[a]);delete s.__webglMorphTargetsBuffers}if(void 0!==s.numMorphNormals){for(a=0,l=s.numMorphNormals;a<l;a++)_.deleteBuffer(s.__webglMorphNormalsBuffers[a]);delete s.__webglMorphNormalsBuffers}be(s)}delete Ue[e.id]}else be(e)}M=""},_e=function(e){if(e.image&&e.image.__webglTextureCube)_.deleteTexture(e.image.__webglTextureCube),delete e.image.__webglTextureCube;else{if(void 0===e.__webglInit)return;_.deleteTexture(e.__webglTexture),delete e.__webglTexture,delete e.__webglInit}},Ee=function(e){if(e&&void 0!==e.__webglTexture){if(_.deleteTexture(e.__webglTexture),delete e.__webglTexture,e instanceof K.WebGLRenderTargetCube)for(var t=0;t<6;t++)_.deleteFramebuffer(e.__webglFramebuffer[t]),_.deleteRenderbuffer(e.__webglRenderbuffer[t]);else _.deleteFramebuffer(e.__webglFramebuffer),_.deleteRenderbuffer(e.__webglRenderbuffer);delete e.__webglFramebuffer,delete e.__webglRenderbuffer}},Se=function(e){var t=e.program.program;if(void 0!==t){var i,n,r;e.program=void 0;var o=!1;for(i=0,n=S.length;i<n;i++)if((r=S[i]).program===t){r.usedTimes--,0===r.usedTimes&&(o=!0);break}if(!0===o){var s=[];for(i=0,n=S.length;i<n;i++)(r=S[i]).program!==t&&s.push(r);S=s,_.deleteProgram(t),E.info.memory.programs--}}};function Ae(e){var t=e.geometry,i=e.material,n=t.vertices.length;if(i.attributes)for(var r in void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]),i.attributes){var o=i.attributes[r];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var s=1;"v2"===o.type?s=2:"v3"===o.type?s=3:"v4"===o.type?s=4:"c"===o.type&&(s=3),o.size=s,o.array=new Float32Array(n*s),o.buffer=_.createBuffer(),o.buffer.belongsToAttribute=r,o.needsUpdate=!0}t.__webglCustomAttributesList.push(o)}}function we(e,t){var i=t.geometry,n=e.faces3,r=3*n.length,o=1*n.length,s=3*n.length,a=Te(t,e);e.__vertexArray=new Float32Array(3*r),e.__normalArray=new Float32Array(3*r),e.__colorArray=new Float32Array(3*r),e.__uvArray=new Float32Array(2*r),i.faceVertexUvs.length>1&&(e.__uv2Array=new Float32Array(2*r)),i.hasTangents&&(e.__tangentArray=new Float32Array(4*r)),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*r),e.__skinWeightArray=new Float32Array(4*r));var l=null!==W.get("OES_element_index_uint")&&o>21845?Uint32Array:Uint16Array;e.__typeArray=l,e.__faceArray=new l(3*o),e.__lineArray=new l(2*s);var c=e.numMorphTargets;if(c){e.__morphTargetsArrays=[];for(var h=0,u=c;h<u;h++)e.__morphTargetsArrays.push(new Float32Array(3*r))}var d=e.numMorphNormals;if(d){e.__morphNormalsArrays=[];for(h=0,u=d;h<u;h++)e.__morphNormalsArrays.push(new Float32Array(3*r))}if(e.__webglFaceCount=3*o,e.__webglLineCount=2*s,a.attributes)for(var f in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),a.attributes){var p=a.attributes[f],m={};for(var g in p)m[g]=p[g];if(!m.__webglInitialized||m.createUniqueBuffers){m.__webglInitialized=!0;var v=1;"v2"===m.type?v=2:"v3"===m.type?v=3:"v4"===m.type?v=4:"c"===m.type&&(v=3),m.size=v,m.array=new Float32Array(r*v),m.buffer=_.createBuffer(),m.buffer.belongsToAttribute=f,p.needsUpdate=!0,m.__original=p}e.__webglCustomAttributesList.push(m)}e.__inittedArrays=!0}function Te(e,t){return e.material instanceof K.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function Me(e,t,i,n,r){if(e.__inittedArrays){var o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,E,S,A,w,T,M,C,P,D,L,I,R,O,N,F,U,B,k,V,G,z,H,W,j,q,X=function(e){return e instanceof K.MeshPhongMaterial==0&&e.shading===K.FlatShading}(r),Y=0,Q=0,Z=0,$=0,J=0,ee=0,te=0,ie=0,ne=0,re=0,oe=0,se=0,ae=e.__vertexArray,le=e.__uvArray,ce=e.__uv2Array,he=e.__normalArray,ue=e.__tangentArray,de=e.__colorArray,fe=e.__skinIndexArray,pe=e.__skinWeightArray,me=e.__morphTargetsArrays,ge=e.__morphNormalsArrays,ve=e.__webglCustomAttributesList,ye=e.__faceArray,be=e.__lineArray,xe=t.geometry,_e=xe.verticesNeedUpdate,Ee=xe.elementsNeedUpdate,Se=xe.uvsNeedUpdate,Ae=xe.normalsNeedUpdate,we=xe.tangentsNeedUpdate,Te=xe.colorsNeedUpdate,Me=xe.morphTargetsNeedUpdate,Ce=xe.vertices,Pe=e.faces3,De=xe.faces,Le=xe.faceVertexUvs[0],Ie=xe.faceVertexUvs[1],Re=xe.skinIndices,Oe=xe.skinWeights,Ne=xe.morphTargets,Fe=xe.morphNormals;if(_e){for(o=0,s=Pe.length;o<s;o++)m=Ce[(a=De[Pe[o]]).a],g=Ce[a.b],v=Ce[a.c],ae[Q]=m.x,ae[Q+1]=m.y,ae[Q+2]=m.z,ae[Q+3]=g.x,ae[Q+4]=g.y,ae[Q+5]=g.z,ae[Q+6]=v.x,ae[Q+7]=v.y,ae[Q+8]=v.z,Q+=9;_.bindBuffer(_.ARRAY_BUFFER,e.__webglVertexBuffer),_.bufferData(_.ARRAY_BUFFER,ae,i)}if(Me)for(k=0,V=Ne.length;k<V;k++){for(oe=0,o=0,s=Pe.length;o<s;o++)a=De[H=Pe[o]],m=Ne[k].vertices[a.a],g=Ne[k].vertices[a.b],v=Ne[k].vertices[a.c],(G=me[k])[oe]=m.x,G[oe+1]=m.y,G[oe+2]=m.z,G[oe+3]=g.x,G[oe+4]=g.y,G[oe+5]=g.z,G[oe+6]=v.x,G[oe+7]=v.y,G[oe+8]=v.z,r.morphNormals&&(X?(S=E=Fe[k].faceNormals[H],A=E):(E=(W=Fe[k].vertexNormals[H]).a,S=W.b,A=W.c),(z=ge[k])[oe]=E.x,z[oe+1]=E.y,z[oe+2]=E.z,z[oe+3]=S.x,z[oe+4]=S.y,z[oe+5]=S.z,z[oe+6]=A.x,z[oe+7]=A.y,z[oe+8]=A.z),oe+=9;_.bindBuffer(_.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]),_.bufferData(_.ARRAY_BUFFER,me[k],i),r.morphNormals&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]),_.bufferData(_.ARRAY_BUFFER,ge[k],i))}if(Oe.length){for(o=0,s=Pe.length;o<s;o++)C=Oe[(a=De[Pe[o]]).a],P=Oe[a.b],D=Oe[a.c],pe[re]=C.x,pe[re+1]=C.y,pe[re+2]=C.z,pe[re+3]=C.w,pe[re+4]=P.x,pe[re+5]=P.y,pe[re+6]=P.z,pe[re+7]=P.w,pe[re+8]=D.x,pe[re+9]=D.y,pe[re+10]=D.z,pe[re+11]=D.w,L=Re[a.a],I=Re[a.b],R=Re[a.c],fe[re]=L.x,fe[re+1]=L.y,fe[re+2]=L.z,fe[re+3]=L.w,fe[re+4]=I.x,fe[re+5]=I.y,fe[re+6]=I.z,fe[re+7]=I.w,fe[re+8]=R.x,fe[re+9]=R.y,fe[re+10]=R.z,fe[re+11]=R.w,re+=12;re>0&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),_.bufferData(_.ARRAY_BUFFER,fe,i),_.bindBuffer(_.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),_.bufferData(_.ARRAY_BUFFER,pe,i))}if(Te){for(o=0,s=Pe.length;o<s;o++)h=(a=De[Pe[o]]).vertexColors,u=a.color,3===h.length&&r.vertexColors===K.VertexColors?(w=h[0],T=h[1],M=h[2]):(w=u,T=u,M=u),de[ne]=w.r,de[ne+1]=w.g,de[ne+2]=w.b,de[ne+3]=T.r,de[ne+4]=T.g,de[ne+5]=T.b,de[ne+6]=M.r,de[ne+7]=M.g,de[ne+8]=M.b,ne+=9;ne>0&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglColorBuffer),_.bufferData(_.ARRAY_BUFFER,de,i))}if(we&&xe.hasTangents){for(o=0,s=Pe.length;o<s;o++)y=(d=(a=De[Pe[o]]).vertexTangents)[0],b=d[1],x=d[2],ue[te]=y.x,ue[te+1]=y.y,ue[te+2]=y.z,ue[te+3]=y.w,ue[te+4]=b.x,ue[te+5]=b.y,ue[te+6]=b.z,ue[te+7]=b.w,ue[te+8]=x.x,ue[te+9]=x.y,ue[te+10]=x.z,ue[te+11]=x.w,te+=12;_.bindBuffer(_.ARRAY_BUFFER,e.__webglTangentBuffer),_.bufferData(_.ARRAY_BUFFER,ue,i)}if(Ae){for(o=0,s=Pe.length;o<s;o++)if(l=(a=De[Pe[o]]).vertexNormals,c=a.normal,3===l.length&&!1===X)for(O=0;O<3;O++)F=l[O],he[ee]=F.x,he[ee+1]=F.y,he[ee+2]=F.z,ee+=3;else for(O=0;O<3;O++)he[ee]=c.x,he[ee+1]=c.y,he[ee+2]=c.z,ee+=3;_.bindBuffer(_.ARRAY_BUFFER,e.__webglNormalBuffer),_.bufferData(_.ARRAY_BUFFER,he,i)}if(Se&&Le){for(o=0,s=Pe.length;o<s;o++)if(void 0!==(f=Le[Pe[o]]))for(O=0;O<3;O++)U=f[O],le[Z]=U.x,le[Z+1]=U.y,Z+=2;Z>0&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglUVBuffer),_.bufferData(_.ARRAY_BUFFER,le,i))}if(Se&&Ie){for(o=0,s=Pe.length;o<s;o++)if(void 0!==(p=Ie[Pe[o]]))for(O=0;O<3;O++)B=p[O],ce[$]=B.x,ce[$+1]=B.y,$+=2;$>0&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglUV2Buffer),_.bufferData(_.ARRAY_BUFFER,ce,i))}if(Ee){for(o=0,s=Pe.length;o<s;o++)ye[J]=Y,ye[J+1]=Y+1,ye[J+2]=Y+2,J+=3,be[ie]=Y,be[ie+1]=Y+1,be[ie+2]=Y,be[ie+3]=Y+2,be[ie+4]=Y+1,be[ie+5]=Y+2,ie+=6,Y+=3;_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),_.bufferData(_.ELEMENT_ARRAY_BUFFER,ye,i),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),_.bufferData(_.ELEMENT_ARRAY_BUFFER,be,i)}if(ve)for(O=0,N=ve.length;O<N;O++)if((q=ve[O]).__original.needsUpdate){if(se=0,1===q.size){if(void 0===q.boundTo||"vertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)a=De[Pe[o]],q.array[se]=q.value[a.a],q.array[se+1]=q.value[a.b],q.array[se+2]=q.value[a.c],se+=3;else if("faces"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)j=q.value[Pe[o]],q.array[se]=j,q.array[se+1]=j,q.array[se+2]=j,se+=3}else if(2===q.size){if(void 0===q.boundTo||"vertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)a=De[Pe[o]],m=q.value[a.a],g=q.value[a.b],v=q.value[a.c],q.array[se]=m.x,q.array[se+1]=m.y,q.array[se+2]=g.x,q.array[se+3]=g.y,q.array[se+4]=v.x,q.array[se+5]=v.y,se+=6;else if("faces"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)m=j=q.value[Pe[o]],g=j,v=j,q.array[se]=m.x,q.array[se+1]=m.y,q.array[se+2]=g.x,q.array[se+3]=g.y,q.array[se+4]=v.x,q.array[se+5]=v.y,se+=6}else if(3===q.size){var Ue;if(Ue="c"===q.type?["r","g","b"]:["x","y","z"],void 0===q.boundTo||"vertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)a=De[Pe[o]],m=q.value[a.a],g=q.value[a.b],v=q.value[a.c],q.array[se]=m[Ue[0]],q.array[se+1]=m[Ue[1]],q.array[se+2]=m[Ue[2]],q.array[se+3]=g[Ue[0]],q.array[se+4]=g[Ue[1]],q.array[se+5]=g[Ue[2]],q.array[se+6]=v[Ue[0]],q.array[se+7]=v[Ue[1]],q.array[se+8]=v[Ue[2]],se+=9;else if("faces"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)m=j=q.value[Pe[o]],g=j,v=j,q.array[se]=m[Ue[0]],q.array[se+1]=m[Ue[1]],q.array[se+2]=m[Ue[2]],q.array[se+3]=g[Ue[0]],q.array[se+4]=g[Ue[1]],q.array[se+5]=g[Ue[2]],q.array[se+6]=v[Ue[0]],q.array[se+7]=v[Ue[1]],q.array[se+8]=v[Ue[2]],se+=9;else if("faceVertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)m=(j=q.value[Pe[o]])[0],g=j[1],v=j[2],q.array[se]=m[Ue[0]],q.array[se+1]=m[Ue[1]],q.array[se+2]=m[Ue[2]],q.array[se+3]=g[Ue[0]],q.array[se+4]=g[Ue[1]],q.array[se+5]=g[Ue[2]],q.array[se+6]=v[Ue[0]],q.array[se+7]=v[Ue[1]],q.array[se+8]=v[Ue[2]],se+=9}else if(4===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)a=De[Pe[o]],m=q.value[a.a],g=q.value[a.b],v=q.value[a.c],q.array[se]=m.x,q.array[se+1]=m.y,q.array[se+2]=m.z,q.array[se+3]=m.w,q.array[se+4]=g.x,q.array[se+5]=g.y,q.array[se+6]=g.z,q.array[se+7]=g.w,q.array[se+8]=v.x,q.array[se+9]=v.y,q.array[se+10]=v.z,q.array[se+11]=v.w,se+=12;else if("faces"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)m=j=q.value[Pe[o]],g=j,v=j,q.array[se]=m.x,q.array[se+1]=m.y,q.array[se+2]=m.z,q.array[se+3]=m.w,q.array[se+4]=g.x,q.array[se+5]=g.y,q.array[se+6]=g.z,q.array[se+7]=g.w,q.array[se+8]=v.x,q.array[se+9]=v.y,q.array[se+10]=v.z,q.array[se+11]=v.w,se+=12;else if("faceVertices"===q.boundTo)for(o=0,s=Pe.length;o<s;o++)m=(j=q.value[Pe[o]])[0],g=j[1],v=j[2],q.array[se]=m.x,q.array[se+1]=m.y,q.array[se+2]=m.z,q.array[se+3]=m.w,q.array[se+4]=g.x,q.array[se+5]=g.y,q.array[se+6]=g.z,q.array[se+7]=g.w,q.array[se+8]=v.x,q.array[se+9]=v.y,q.array[se+10]=v.z,q.array[se+11]=v.w,se+=12;_.bindBuffer(_.ARRAY_BUFFER,q.buffer),_.bufferData(_.ARRAY_BUFFER,q.array,i)}n&&(delete e.__inittedArrays,delete e.__colorArray,delete e.__normalArray,delete e.__tangentArray,delete e.__uvArray,delete e.__uv2Array,delete e.__faceArray,delete e.__vertexArray,delete e.__lineArray,delete e.__skinIndexArray,delete e.__skinWeightArray)}}function Ce(e,t,i,n){for(var r=i.attributes,o=t.attributes,s=t.attributesKeys,a=0,l=s.length;a<l;a++){var c=s[a],h=o[c];if(h>=0){var u=r[c];if(void 0!==u){var d=u.itemSize;_.bindBuffer(_.ARRAY_BUFFER,u.buffer),H.enableAttribute(h),_.vertexAttribPointer(h,d,_.FLOAT,!1,0,n*d*4)}else void 0!==e.defaultAttributeValues&&(2===e.defaultAttributeValues[c].length?_.vertexAttrib2fv(h,e.defaultAttributeValues[c]):3===e.defaultAttributeValues[c].length&&_.vertexAttrib3fv(h,e.defaultAttributeValues[c]))}}H.disableUnusedAttributes()}function Pe(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function De(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Le(e,t){return t[0]-e[0]}function Ie(e){if(!1!==e.visible){if(e instanceof K.Scene||e instanceof K.Group);else if(function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new K.Matrix4,e._normalMatrix=new K.Matrix3,e.addEventListener("removed",pe));var t=e.geometry;void 0===t||void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",me),t instanceof K.BufferGeometry?E.info.memory.geometries++:e instanceof K.Mesh?ke(e,t):e instanceof K.Line?void 0===t.__webglVertexBuffer&&(!function(e){e.__webglVertexBuffer=_.createBuffer(),e.__webglColorBuffer=_.createBuffer(),e.__webglLineDistanceBuffer=_.createBuffer(),E.info.memory.geometries++}(t),function(e,t){var i=e.vertices.length;e.__vertexArray=new Float32Array(3*i),e.__colorArray=new Float32Array(3*i),e.__lineDistanceArray=new Float32Array(1*i),e.__webglLineCount=i,Ae(t)}(t,e),t.verticesNeedUpdate=!0,t.colorsNeedUpdate=!0,t.lineDistancesNeedUpdate=!0):e instanceof K.PointCloud&&void 0===t.__webglVertexBuffer&&(!function(e){e.__webglVertexBuffer=_.createBuffer(),e.__webglColorBuffer=_.createBuffer(),E.info.memory.geometries++}(t),function(e,t){var i=e.vertices.length;e.__vertexArray=new Float32Array(3*i),e.__colorArray=new Float32Array(3*i),e.__webglParticleCount=i,Ae(t)}(t,e),t.verticesNeedUpdate=!0,t.colorsNeedUpdate=!0));if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof K.Mesh){if(t instanceof K.BufferGeometry)Ve(m,t,e);else if(t instanceof K.Geometry)for(var i=Ue[t.id],n=0,r=i.length;n<r;n++)Ve(m,i[n],e)}else e instanceof K.Line||e instanceof K.PointCloud?Ve(m,t,e):(e instanceof K.ImmediateRenderObject||e.immediateRenderCallback)&&function(e,t){e.push({id:null,object:t,opaque:null,transparent:null,z:0})}(g,e)}(e),e instanceof K.Light)p.push(e);else if(e instanceof K.Sprite)b.push(e);else if(e instanceof K.LensFlare)x.push(e);else{var t=m[e.id];if(t&&(!1===e.frustumCulled||!0===F.intersectsObject(e)))for(var i=0,n=t.length;i<n;i++){var r=t[i];Fe(r),r.render=!0,!0===E.sortObjects&&(B.setFromMatrixPosition(e.matrixWorld),B.applyProjection(U),r.z=B.z)}}for(i=0,n=e.children.length;i<n;i++)Ie(e.children[i])}}function Re(e,t,i,n,r){for(var o,s=0,a=e.length;s<a;s++){var l=e[s],c=l.object,h=l.buffer;if(Ze(c,t),r)o=r;else{if(!(o=l.material))continue;qe(o)}E.setMaterialFaces(o),h instanceof K.BufferGeometry?E.renderBufferDirect(t,i,n,o,h,c):E.renderBuffer(t,i,n,o,h,c)}}function Oe(e,t,i,n,r,o){for(var s,a=0,l=e.length;a<l;a++){var c=e[a],h=c.object;if(h.visible){if(o)s=o;else{if(!(s=c[t]))continue;qe(s)}E.renderImmediateObject(i,n,r,s,h)}}}function Ne(e){var t=e.object.material;t.transparent?(e.transparent=t,e.opaque=null):(e.opaque=t,e.transparent=null)}function Fe(e){var t=e.object,i=e.buffer,n=t.geometry,r=t.material;if(r instanceof K.MeshFaceMaterial){var o=n instanceof K.BufferGeometry?0:i.materialIndex;r=r.materials[o],e.material=r,r.transparent?y.push(e):v.push(e)}else r&&(e.material=r,r.transparent?y.push(e):v.push(e))}this.renderBufferImmediate=function(e,t,i){if(H.initAttributes(),e.hasPositions&&!e.__webglVertexBuffer&&(e.__webglVertexBuffer=_.createBuffer()),e.hasNormals&&!e.__webglNormalBuffer&&(e.__webglNormalBuffer=_.createBuffer()),e.hasUvs&&!e.__webglUvBuffer&&(e.__webglUvBuffer=_.createBuffer()),e.hasColors&&!e.__webglColorBuffer&&(e.__webglColorBuffer=_.createBuffer()),e.hasPositions&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglVertexBuffer),_.bufferData(_.ARRAY_BUFFER,e.positionArray,_.DYNAMIC_DRAW),H.enableAttribute(t.attributes.position),_.vertexAttribPointer(t.attributes.position,3,_.FLOAT,!1,0,0)),e.hasNormals){if(_.bindBuffer(_.ARRAY_BUFFER,e.__webglNormalBuffer),i instanceof K.MeshPhongMaterial==!1&&i.shading===K.FlatShading){var n,r,o,s,a,l,c,h,u,d,f,p=3*e.count;for(f=0;f<p;f+=9)s=(d=e.normalArray)[f],l=d[f+1],h=d[f+2],a=d[f+3],c=d[f+4],u=d[f+5],n=(s+a+d[f+6])/3,r=(l+c+d[f+7])/3,o=(h+u+d[f+8])/3,d[f]=n,d[f+1]=r,d[f+2]=o,d[f+3]=n,d[f+4]=r,d[f+5]=o,d[f+6]=n,d[f+7]=r,d[f+8]=o}_.bufferData(_.ARRAY_BUFFER,e.normalArray,_.DYNAMIC_DRAW),H.enableAttribute(t.attributes.normal),_.vertexAttribPointer(t.attributes.normal,3,_.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglUvBuffer),_.bufferData(_.ARRAY_BUFFER,e.uvArray,_.DYNAMIC_DRAW),H.enableAttribute(t.attributes.uv),_.vertexAttribPointer(t.attributes.uv,2,_.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==K.NoColors&&(_.bindBuffer(_.ARRAY_BUFFER,e.__webglColorBuffer),_.bufferData(_.ARRAY_BUFFER,e.colorArray,_.DYNAMIC_DRAW),H.enableAttribute(t.attributes.color),_.vertexAttribPointer(t.attributes.color,3,_.FLOAT,!1,0,0)),H.disableUnusedAttributes(),_.drawArrays(_.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,i,r,o,s){if(!1!==r.visible){Ge(s);var a=Xe(e,t,i,r,s),l=!1,c=r.wireframe?1:0,h="direct_"+o.id+"_"+a.id+"_"+c;if(h!==M&&(M=h,l=!0),l&&H.initAttributes(),s instanceof K.Mesh){var u=!0===r.wireframe?_.LINES:_.TRIANGLES;if(g=o.attributes.index){if(g.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(v=_.UNSIGNED_INT,y=4):(v=_.UNSIGNED_SHORT,y=2),0===(b=o.offsets).length)l&&(Ce(r,a,o,0),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,g.array.length,v,0),E.info.render.calls++,E.info.render.vertices+=g.array.length,E.info.render.faces+=g.array.length/3;else{l=!0;for(var d=0,f=b.length;d<f;d++){var p=b[d].index;l&&(Ce(r,a,o,p),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,b[d].count,v,b[d].start*y),E.info.render.calls++,E.info.render.vertices+=b[d].count,E.info.render.faces+=b[d].count/3}}}else{l&&Ce(r,a,o,0);var m=o.attributes.position;_.drawArrays(u,0,m.array.length/m.itemSize),E.info.render.calls++,E.info.render.vertices+=m.array.length/m.itemSize,E.info.render.faces+=m.array.length/(3*m.itemSize)}}else if(s instanceof K.PointCloud){u=_.POINTS;if(g=o.attributes.index){if(g.array instanceof Uint32Array&&W.get("OES_element_index_uint")?(v=_.UNSIGNED_INT,y=4):(v=_.UNSIGNED_SHORT,y=2),0===(b=o.offsets).length)l&&(Ce(r,a,o,0),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,g.array.length,v,0),E.info.render.calls++,E.info.render.points+=g.array.length;else{b.length>1&&(l=!0);for(d=0,f=b.length;d<f;d++){p=b[d].index;l&&(Ce(r,a,o,p),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,b[d].count,v,b[d].start*y),E.info.render.calls++,E.info.render.points+=b[d].count}}}else{l&&Ce(r,a,o,0);m=o.attributes.position;if(0===(b=o.offsets).length)_.drawArrays(u,0,m.array.length/3),E.info.render.calls++,E.info.render.points+=m.array.length/3;else for(d=0,f=b.length;d<f;d++)_.drawArrays(u,b[d].index,b[d].count),E.info.render.calls++,E.info.render.points+=b[d].count}}else if(s instanceof K.Line){var g;u=s.mode===K.LineStrip?_.LINE_STRIP:_.LINES;if(H.setLineWidth(r.linewidth*n),g=o.attributes.index){var v,y;if(g.array instanceof Uint32Array?(v=_.UNSIGNED_INT,y=4):(v=_.UNSIGNED_SHORT,y=2),0===(b=o.offsets).length)l&&(Ce(r,a,o,0),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,g.array.length,v,0),E.info.render.calls++,E.info.render.vertices+=g.array.length;else{b.length>1&&(l=!0);for(d=0,f=b.length;d<f;d++){p=b[d].index;l&&(Ce(r,a,o,p),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g.buffer)),_.drawElements(u,b[d].count,v,b[d].start*y),E.info.render.calls++,E.info.render.vertices+=b[d].count}}}else{l&&Ce(r,a,o,0);var b;m=o.attributes.position;if(0===(b=o.offsets).length)_.drawArrays(u,0,m.array.length/3),E.info.render.calls++,E.info.render.vertices+=m.array.length/3;else for(d=0,f=b.length;d<f;d++)_.drawArrays(u,b[d].index,b[d].count),E.info.render.calls++,E.info.render.vertices+=b[d].count}}}},this.renderBuffer=function(e,t,i,r,o,s){if(!1!==r.visible){Ge(s);var a=Xe(e,t,i,r,s),l=a.attributes,c=!1,h=r.wireframe?1:0,u=o.id+"_"+a.id+"_"+h;if(u!==M&&(M=u,c=!0),c&&H.initAttributes(),!r.morphTargets&&l.position>=0?c&&(_.bindBuffer(_.ARRAY_BUFFER,o.__webglVertexBuffer),H.enableAttribute(l.position),_.vertexAttribPointer(l.position,3,_.FLOAT,!1,0,0)):s.morphTargetBase&&function(e,t,i){var n=e.program.attributes;-1!==i.morphTargetBase&&n.position>=0?(_.bindBuffer(_.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[i.morphTargetBase]),H.enableAttribute(n.position),_.vertexAttribPointer(n.position,3,_.FLOAT,!1,0,0)):n.position>=0&&(_.bindBuffer(_.ARRAY_BUFFER,t.__webglVertexBuffer),H.enableAttribute(n.position),_.vertexAttribPointer(n.position,3,_.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var r=0,o=i.morphTargetForcedOrder,s=i.morphTargetInfluences;r<e.numSupportedMorphTargets&&r<o.length;)(a=n["morphTarget"+r])>=0&&(_.bindBuffer(_.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[o[r]]),H.enableAttribute(a),_.vertexAttribPointer(a,3,_.FLOAT,!1,0,0)),(a=n["morphNormal"+r])>=0&&e.morphNormals&&(_.bindBuffer(_.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[o[r]]),H.enableAttribute(a),_.vertexAttribPointer(a,3,_.FLOAT,!1,0,0)),i.__webglMorphTargetInfluences[r]=s[o[r]],r++;else{var a,l=[],c=(s=i.morphTargetInfluences,i.geometry.morphTargets);s.length>c.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),s.length=c.length);for(var h=0,u=s.length;h<u;h++){var d=s[h];l.push([d,h])}l.length>e.numSupportedMorphTargets?(l.sort(Le),l.length=e.numSupportedMorphTargets):l.length>e.numSupportedMorphNormals?l.sort(Le):0===l.length&&l.push([0,0]);r=0;for(var f=e.numSupportedMorphTargets;r<f;r++)if(l[r]){var p=l[r][1];(a=n["morphTarget"+r])>=0&&(_.bindBuffer(_.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[p]),H.enableAttribute(a),_.vertexAttribPointer(a,3,_.FLOAT,!1,0,0)),(a=n["morphNormal"+r])>=0&&e.morphNormals&&(_.bindBuffer(_.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[p]),H.enableAttribute(a),_.vertexAttribPointer(a,3,_.FLOAT,!1,0,0)),i.__webglMorphTargetInfluences[r]=s[p]}else i.__webglMorphTargetInfluences[r]=0}null!==e.program.uniforms.morphTargetInfluences&&_.uniform1fv(e.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}(r,o,s),c){if(o.__webglCustomAttributesList)for(var d=0,f=o.__webglCustomAttributesList.length;d<f;d++){var p=o.__webglCustomAttributesList[d];l[p.buffer.belongsToAttribute]>=0&&(_.bindBuffer(_.ARRAY_BUFFER,p.buffer),H.enableAttribute(l[p.buffer.belongsToAttribute]),_.vertexAttribPointer(l[p.buffer.belongsToAttribute],p.size,_.FLOAT,!1,0,0))}l.color>=0&&(s.geometry.colors.length>0||s.geometry.faces.length>0?(_.bindBuffer(_.ARRAY_BUFFER,o.__webglColorBuffer),H.enableAttribute(l.color),_.vertexAttribPointer(l.color,3,_.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&_.vertexAttrib3fv(l.color,r.defaultAttributeValues.color)),l.normal>=0&&(_.bindBuffer(_.ARRAY_BUFFER,o.__webglNormalBuffer),H.enableAttribute(l.normal),_.vertexAttribPointer(l.normal,3,_.FLOAT,!1,0,0)),l.tangent>=0&&(_.bindBuffer(_.ARRAY_BUFFER,o.__webglTangentBuffer),H.enableAttribute(l.tangent),_.vertexAttribPointer(l.tangent,4,_.FLOAT,!1,0,0)),l.uv>=0&&(s.geometry.faceVertexUvs[0]?(_.bindBuffer(_.ARRAY_BUFFER,o.__webglUVBuffer),H.enableAttribute(l.uv),_.vertexAttribPointer(l.uv,2,_.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&_.vertexAttrib2fv(l.uv,r.defaultAttributeValues.uv)),l.uv2>=0&&(s.geometry.faceVertexUvs[1]?(_.bindBuffer(_.ARRAY_BUFFER,o.__webglUV2Buffer),H.enableAttribute(l.uv2),_.vertexAttribPointer(l.uv2,2,_.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&_.vertexAttrib2fv(l.uv2,r.defaultAttributeValues.uv2)),r.skinning&&l.skinIndex>=0&&l.skinWeight>=0&&(_.bindBuffer(_.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),H.enableAttribute(l.skinIndex),_.vertexAttribPointer(l.skinIndex,4,_.FLOAT,!1,0,0),_.bindBuffer(_.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),H.enableAttribute(l.skinWeight),_.vertexAttribPointer(l.skinWeight,4,_.FLOAT,!1,0,0)),l.lineDistance>=0&&(_.bindBuffer(_.ARRAY_BUFFER,o.__webglLineDistanceBuffer),H.enableAttribute(l.lineDistance),_.vertexAttribPointer(l.lineDistance,1,_.FLOAT,!1,0,0))}if(H.disableUnusedAttributes(),s instanceof K.Mesh){var m=o.__typeArray===Uint32Array?_.UNSIGNED_INT:_.UNSIGNED_SHORT;r.wireframe?(H.setLineWidth(r.wireframeLinewidth*n),c&&_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),_.drawElements(_.LINES,o.__webglLineCount,m,0)):(c&&_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),_.drawElements(_.TRIANGLES,o.__webglFaceCount,m,0)),E.info.render.calls++,E.info.render.vertices+=o.__webglFaceCount,E.info.render.faces+=o.__webglFaceCount/3}else if(s instanceof K.Line){var g=s.mode===K.LineStrip?_.LINE_STRIP:_.LINES;H.setLineWidth(r.linewidth*n),_.drawArrays(g,0,o.__webglLineCount),E.info.render.calls++}else s instanceof K.PointCloud&&(_.drawArrays(_.POINTS,0,o.__webglParticleCount),E.info.render.calls++,E.info.render.points+=o.__webglParticleCount)}},this.render=function(e,t,i,n){if(t instanceof K.Camera!=!1){var r=e.fog;M="",T=-1,C=null,V=!0,!0===e.autoUpdate&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),e.traverse((function(e){e instanceof K.SkinnedMesh&&e.skeleton.update()})),t.matrixWorldInverse.getInverse(t.matrixWorld),U.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromMatrix(U),p.length=0,v.length=0,y.length=0,b.length=0,x.length=0,Ie(e),!0===E.sortObjects&&(v.sort(Pe),y.sort(De)),he.render(e,t),E.info.render.calls=0,E.info.render.vertices=0,E.info.render.faces=0,E.info.render.points=0,this.setRenderTarget(i),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var o=0,s=g.length;o<s;o++){var a=g[o],l=a.object;l.visible&&(Ze(l,t),Ne(a))}if(e.overrideMaterial){var c=e.overrideMaterial;qe(c),Re(v,t,p,r,c),Re(y,t,p,r,c),Oe(g,"",t,p,r,c)}else H.setBlending(K.NoBlending),Re(v,t,p,r,null),Oe(g,"opaque",t,p,r,null),Re(y,t,p,r,null),Oe(g,"transparent",t,p,r,null);ue.render(e,t),de.render(e,t,O,N),i&&i.generateMipmaps&&i.minFilter!==K.NearestFilter&&i.minFilter!==K.LinearFilter&&function(e){e instanceof K.WebGLRenderTargetCube?(_.bindTexture(_.TEXTURE_CUBE_MAP,e.__webglTexture),_.generateMipmap(_.TEXTURE_CUBE_MAP),_.bindTexture(_.TEXTURE_CUBE_MAP,null)):(_.bindTexture(_.TEXTURE_2D,e.__webglTexture),_.generateMipmap(_.TEXTURE_2D),_.bindTexture(_.TEXTURE_2D,null))}(i),H.setDepthTest(!0),H.setDepthWrite(!0),H.setColorWrite(!0)}else K.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.renderImmediateObject=function(e,t,i,n,r){var o=Xe(e,t,i,n,r);M="",E.setMaterialFaces(n),r.immediateRenderCallback?r.immediateRenderCallback(o,_,F):r.render((function(e){E.renderBufferImmediate(e,o,n)}))};var Ue={},Be=0;function ke(e,t){var i=e.material,n=!1;void 0!==Ue[t.id]&&!0!==t.groupsNeedUpdate||(delete m[e.id],Ue[t.id]=function(e,t){for(var i,n,r=W.get("OES_element_index_uint")?4294967296:65535,o={},s=e.morphTargets.length,a=e.morphNormals.length,l={},c=[],h=0,u=e.faces.length;h<u;h++){var d=e.faces[h],f=t?d.materialIndex:0;f in o||(o[f]={hash:f,counter:0}),(i=o[f].hash+"_"+o[f].counter)in l||(n={id:Be++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:s,numMorphNormals:a},l[i]=n,c.push(n)),l[i].vertices+3>r&&(o[f].counter+=1,(i=o[f].hash+"_"+o[f].counter)in l||(n={id:Be++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:s,numMorphNormals:a},l[i]=n,c.push(n))),l[i].faces3.push(h),l[i].vertices+=3}return c}(t,i instanceof K.MeshFaceMaterial),t.groupsNeedUpdate=!1);for(var r=Ue[t.id],o=0,s=r.length;o<s;o++){var a=r[o];void 0===a.__webglVertexBuffer?(fe(a),we(a,e),t.verticesNeedUpdate=!0,t.morphTargetsNeedUpdate=!0,t.elementsNeedUpdate=!0,t.uvsNeedUpdate=!0,t.normalsNeedUpdate=!0,t.tangentsNeedUpdate=!0,t.colorsNeedUpdate=!0,n=!0):n=!1,(n||void 0===e.__webglActive)&&Ve(m,a,e)}e.__webglActive=!0}function Ve(e,t,i){var n=i.id;e[n]=e[n]||[],e[n].push({id:n,buffer:t,object:i,material:null,z:0})}function Ge(e){var t=e.geometry;if(t instanceof K.BufferGeometry)for(var i=t.attributes,n=t.attributesKeys,r=0,o=n.length;r<o;r++){var s=n[r],a=i[s],l="index"===s?_.ELEMENT_ARRAY_BUFFER:_.ARRAY_BUFFER;void 0===a.buffer?(a.buffer=_.createBuffer(),_.bindBuffer(l,a.buffer),_.bufferData(l,a.array,a instanceof K.DynamicBufferAttribute?_.DYNAMIC_DRAW:_.STATIC_DRAW),a.needsUpdate=!1):!0===a.needsUpdate&&(_.bindBuffer(l,a.buffer),void 0===a.updateRange||-1===a.updateRange.count?_.bufferSubData(l,0,a.array):0===a.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(_.bufferSubData(l,a.updateRange.offset*a.array.BYTES_PER_ELEMENT,a.array.subarray(a.updateRange.offset,a.updateRange.offset+a.updateRange.count)),a.updateRange.count=0),a.needsUpdate=!1)}else if(e instanceof K.Mesh){!0===t.groupsNeedUpdate&&ke(e,t);for(var c=Ue[t.id],h=(r=0,c.length);r<h;r++){var u=c[r],d=(f=Te(e,u)).attributes&&ze(f);(t.verticesNeedUpdate||t.morphTargetsNeedUpdate||t.elementsNeedUpdate||t.uvsNeedUpdate||t.normalsNeedUpdate||t.colorsNeedUpdate||t.tangentsNeedUpdate||d)&&Me(u,e,_.DYNAMIC_DRAW,!t.dynamic,f)}t.verticesNeedUpdate=!1,t.morphTargetsNeedUpdate=!1,t.elementsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.tangentsNeedUpdate=!1,f.attributes&&He(f)}else if(e instanceof K.Line){d=(f=Te(e,t)).attributes&&ze(f);(t.verticesNeedUpdate||t.colorsNeedUpdate||t.lineDistancesNeedUpdate||d)&&function(e,t){var i,n,r,o,s,a,l,c,h,u,d,f,p=e.vertices,m=e.colors,g=e.lineDistances,v=p.length,y=m.length,b=g.length,x=e.__vertexArray,E=e.__colorArray,S=e.__lineDistanceArray,A=e.verticesNeedUpdate,w=e.colorsNeedUpdate,T=e.lineDistancesNeedUpdate,M=e.__webglCustomAttributesList;if(A){for(i=0;i<v;i++)o=p[i],x[s=3*i]=o.x,x[s+1]=o.y,x[s+2]=o.z;_.bindBuffer(_.ARRAY_BUFFER,e.__webglVertexBuffer),_.bufferData(_.ARRAY_BUFFER,x,t)}if(w){for(n=0;n<y;n++)a=m[n],E[s=3*n]=a.r,E[s+1]=a.g,E[s+2]=a.b;_.bindBuffer(_.ARRAY_BUFFER,e.__webglColorBuffer),_.bufferData(_.ARRAY_BUFFER,E,t)}if(T){for(r=0;r<b;r++)S[r]=g[r];_.bindBuffer(_.ARRAY_BUFFER,e.__webglLineDistanceBuffer),_.bufferData(_.ARRAY_BUFFER,S,t)}if(M)for(l=0,c=M.length;l<c;l++)if((f=M[l]).needsUpdate&&(void 0===f.boundTo||"vertices"===f.boundTo)){if(s=0,u=f.value.length,1===f.size)for(h=0;h<u;h++)f.array[h]=f.value[h];else if(2===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,s+=2;else if(3===f.size)if("c"===f.type)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.r,f.array[s+1]=d.g,f.array[s+2]=d.b,s+=3;else for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,s+=3;else if(4===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,f.array[s+3]=d.w,s+=4;_.bindBuffer(_.ARRAY_BUFFER,f.buffer),_.bufferData(_.ARRAY_BUFFER,f.array,t),f.needsUpdate=!1}}(t,_.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,t.lineDistancesNeedUpdate=!1,f.attributes&&He(f)}else if(e instanceof K.PointCloud){var f;d=(f=Te(e,t)).attributes&&ze(f);(t.verticesNeedUpdate||t.colorsNeedUpdate||d)&&function(e,t,i){var n,r,o,s,a,l,c,h,u,d,f,p=e.vertices,m=p.length,g=e.colors,v=g.length,y=e.__vertexArray,b=e.__colorArray,x=e.verticesNeedUpdate,E=e.colorsNeedUpdate,S=e.__webglCustomAttributesList;if(x){for(n=0;n<m;n++)o=p[n],y[s=3*n]=o.x,y[s+1]=o.y,y[s+2]=o.z;_.bindBuffer(_.ARRAY_BUFFER,e.__webglVertexBuffer),_.bufferData(_.ARRAY_BUFFER,y,t)}if(E){for(r=0;r<v;r++)a=g[r],b[s=3*r]=a.r,b[s+1]=a.g,b[s+2]=a.b;_.bindBuffer(_.ARRAY_BUFFER,e.__webglColorBuffer),_.bufferData(_.ARRAY_BUFFER,b,t)}if(S)for(l=0,c=S.length;l<c;l++){if((f=S[l]).needsUpdate&&(void 0===f.boundTo||"vertices"===f.boundTo))if(u=f.value.length,s=0,1===f.size)for(h=0;h<u;h++)f.array[h]=f.value[h];else if(2===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,s+=2;else if(3===f.size)if("c"===f.type)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.r,f.array[s+1]=d.g,f.array[s+2]=d.b,s+=3;else for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,s+=3;else if(4===f.size)for(h=0;h<u;h++)d=f.value[h],f.array[s]=d.x,f.array[s+1]=d.y,f.array[s+2]=d.z,f.array[s+3]=d.w,s+=4;_.bindBuffer(_.ARRAY_BUFFER,f.buffer),_.bufferData(_.ARRAY_BUFFER,f.array,t),f.needsUpdate=!1}}(t,_.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,f.attributes&&He(f)}}function ze(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function He(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}var We={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};function je(e,t,i,n){e.addEventListener("dispose",ye);var o=We[e.type];if(o){var s=K.ShaderLib[o];e.__webglShader={uniforms:K.UniformsUtils.clone(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}}else e.__webglShader={uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};var a=function(e){for(var t=0,i=0,n=0,r=0,o=0,s=e.length;o<s;o++){var a=e[o];a.onlyShadow||!1===a.visible||(a instanceof K.DirectionalLight&&t++,a instanceof K.PointLight&&i++,a instanceof K.SpotLight&&n++,a instanceof K.HemisphereLight&&r++)}return{directional:t,point:i,spot:n,hemi:r}}(t),l=function(e){for(var t=0,i=0,n=e.length;i<n;i++){var r=e[i];r.castShadow&&(r instanceof K.SpotLight&&t++,r instanceof K.DirectionalLight&&!r.shadowCascade&&t++)}return t}(t),c=function(e){if(te&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var t=_.getParameter(_.MAX_VERTEX_UNIFORM_VECTORS),i=Math.floor((t-20)/4);return void 0!==e&&e instanceof K.SkinnedMesh&&(i=Math.min(e.skeleton.bones.length,i))<e.skeleton.bones.length&&K.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)"),i}(n),h={precision:r,supportsVertexTextures:ee,map:!!e.map,envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,combine:e.combine,vertexColors:e.vertexColors,fog:i,useFog:e.fog,fogExp:i instanceof K.FogExp2,flatShading:e.shading===K.FlatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:u,skinning:e.skinning,maxBones:c,useVertexTexture:te&&n&&n.skeleton&&n.skeleton.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:E.maxMorphTargets,maxMorphNormals:E.maxMorphNormals,maxDirLights:a.directional,maxPointLights:a.point,maxSpotLights:a.spot,maxHemiLights:a.hemi,maxShadows:l,shadowMapEnabled:E.shadowMapEnabled&&n.receiveShadow&&l>0,shadowMapType:E.shadowMapType,shadowMapDebug:E.shadowMapDebug,shadowMapCascade:E.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,wrapAround:e.wrapAround,doubleSided:e.side===K.DoubleSide,flipSided:e.side===K.BackSide},d=[];if(o?d.push(o):(d.push(e.fragmentShader),d.push(e.vertexShader)),void 0!==e.defines)for(var f in e.defines)d.push(f),d.push(e.defines[f]);for(var f in h)d.push(f),d.push(h[f]);for(var p,m=d.join(),g=0,v=S.length;g<v;g++){var y=S[g];if(y.code===m){(p=y).usedTimes++;break}}void 0===p&&(p=new K.WebGLProgram(E,m,e,h),S.push(p),E.info.memory.programs=S.length),e.program=p;var b=p.attributes;if(e.morphTargets){e.numSupportedMorphTargets=0;for(var x="morphTarget",A=0;A<E.maxMorphTargets;A++)b[x+A]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;x="morphNormal";for(A=0;A<E.maxMorphNormals;A++)b[x+A]>=0&&e.numSupportedMorphNormals++}for(var w in e.uniformsList=[],e.__webglShader.uniforms){var T=e.program.uniforms[w];T&&e.uniformsList.push([e.__webglShader.uniforms[w],T])}}function qe(e){!0===e.transparent?H.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):H.setBlending(K.NoBlending),H.setDepthTest(e.depthTest),H.setDepthWrite(e.depthWrite),H.setColorWrite(e.colorWrite),H.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function Xe(e,i,n,r,o){P=0,r.needsUpdate&&(r.program&&Se(r),je(r,i,n,o),r.needsUpdate=!1),r.morphTargets&&(o.__webglMorphTargetInfluences||(o.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets)));var s=!1,a=!1,l=!1,c=r.program,h=c.uniforms,d=r.__webglShader.uniforms;if(c.id!==A&&(_.useProgram(c.program),A=c.id,s=!0,a=!0,l=!0),r.id!==T&&(-1===T&&(l=!0),T=r.id,a=!0),(s||e!==C)&&(_.uniformMatrix4fv(h.projectionMatrix,!1,e.projectionMatrix.elements),u&&_.uniform1f(h.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==C&&(C=e),(r instanceof K.ShaderMaterial||r instanceof K.MeshPhongMaterial||r.envMap)&&null!==h.cameraPosition&&(B.setFromMatrixPosition(e.matrixWorld),_.uniform3f(h.cameraPosition,B.x,B.y,B.z)),(r instanceof K.MeshPhongMaterial||r instanceof K.MeshLambertMaterial||r instanceof K.MeshBasicMaterial||r instanceof K.ShaderMaterial||r.skinning)&&null!==h.viewMatrix&&_.uniformMatrix4fv(h.viewMatrix,!1,e.matrixWorldInverse.elements)),r.skinning)if(o.bindMatrix&&null!==h.bindMatrix&&_.uniformMatrix4fv(h.bindMatrix,!1,o.bindMatrix.elements),o.bindMatrixInverse&&null!==h.bindMatrixInverse&&_.uniformMatrix4fv(h.bindMatrixInverse,!1,o.bindMatrixInverse.elements),te&&o.skeleton&&o.skeleton.useVertexTexture){if(null!==h.boneTexture){var f=Qe();_.uniform1i(h.boneTexture,f),E.setTexture(o.skeleton.boneTexture,f)}null!==h.boneTextureWidth&&_.uniform1i(h.boneTextureWidth,o.skeleton.boneTextureWidth),null!==h.boneTextureHeight&&_.uniform1i(h.boneTextureHeight,o.skeleton.boneTextureHeight)}else o.skeleton&&o.skeleton.boneMatrices&&null!==h.boneGlobalMatrices&&_.uniformMatrix4fv(h.boneGlobalMatrices,!1,o.skeleton.boneMatrices);return a&&(n&&r.fog&&function(e,t){e.fogColor.value=t.color,t instanceof K.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof K.FogExp2&&(e.fogDensity.value=t.density)}(d,n),(r instanceof K.MeshPhongMaterial||r instanceof K.MeshLambertMaterial||r.lights)&&(V&&(l=!0,function(e){var t,i,n,r,o,s,a,l,c=0,h=0,u=0,d=G,f=d.directional.colors,p=d.directional.positions,m=d.point.colors,g=d.point.positions,v=d.point.distances,y=d.point.decays,b=d.spot.colors,x=d.spot.positions,_=d.spot.distances,E=d.spot.directions,S=d.spot.anglesCos,A=d.spot.exponents,w=d.spot.decays,T=d.hemi.skyColors,M=d.hemi.groundColors,C=d.hemi.positions,P=0,D=0,L=0,I=0,R=0,O=0,N=0,F=0,U=0,V=0,z=0,H=0;for(t=0,i=e.length;t<i;t++)if(!(n=e[t]).onlyShadow)if(r=n.color,a=n.intensity,l=n.distance,n instanceof K.AmbientLight){if(!n.visible)continue;c+=r.r,h+=r.g,u+=r.b}else if(n instanceof K.DirectionalLight){if(R+=1,!n.visible)continue;k.setFromMatrixPosition(n.matrixWorld),B.setFromMatrixPosition(n.target.matrixWorld),k.sub(B),k.normalize(),p[U=3*P]=k.x,p[U+1]=k.y,p[U+2]=k.z,$e(f,U,r,a),P+=1}else if(n instanceof K.PointLight){if(O+=1,!n.visible)continue;$e(m,V=3*D,r,a),B.setFromMatrixPosition(n.matrixWorld),g[V]=B.x,g[V+1]=B.y,g[V+2]=B.z,v[D]=l,y[D]=0===n.distance?0:n.decay,D+=1}else if(n instanceof K.SpotLight){if(N+=1,!n.visible)continue;$e(b,z=3*L,r,a),k.setFromMatrixPosition(n.matrixWorld),x[z]=k.x,x[z+1]=k.y,x[z+2]=k.z,_[L]=l,B.setFromMatrixPosition(n.target.matrixWorld),k.sub(B),k.normalize(),E[z]=k.x,E[z+1]=k.y,E[z+2]=k.z,S[L]=Math.cos(n.angle),A[L]=n.exponent,w[L]=0===n.distance?0:n.decay,L+=1}else if(n instanceof K.HemisphereLight){if(F+=1,!n.visible)continue;k.setFromMatrixPosition(n.matrixWorld),k.normalize(),C[H=3*I]=k.x,C[H+1]=k.y,C[H+2]=k.z,o=n.color,s=n.groundColor,$e(T,H,o,a),$e(M,H,s,a),I+=1}for(t=3*P,i=Math.max(f.length,3*R);t<i;t++)f[t]=0;for(t=3*D,i=Math.max(m.length,3*O);t<i;t++)m[t]=0;for(t=3*L,i=Math.max(b.length,3*N);t<i;t++)b[t]=0;for(t=3*I,i=Math.max(T.length,3*F);t<i;t++)T[t]=0;for(t=3*I,i=Math.max(M.length,3*F);t<i;t++)M[t]=0;d.directional.length=P,d.point.length=D,d.spot.length=L,d.hemi.length=I,d.ambient[0]=c,d.ambient[1]=h,d.ambient[2]=u}(i),V=!1),l?(!function(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.pointLightDecay.value=t.point.decays,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.spotLightDecay.value=t.spot.decays,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}(d,G),Ke(d,!0)):Ke(d,!1)),(r instanceof K.MeshBasicMaterial||r instanceof K.MeshLambertMaterial||r instanceof K.MeshPhongMaterial)&&function(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));var i;t.map?i=t.map:t.specularMap?i=t.specularMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.alphaMap&&(i=t.alphaMap);if(void 0!==i){var n=i.offset,r=i.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof K.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}(d,r),r instanceof K.LineBasicMaterial?Ye(d,r):r instanceof K.LineDashedMaterial?(Ye(d,r),function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(d,r)):r instanceof K.PointCloudMaterial?function(e,i){if(e.psColor.value=i.color,e.opacity.value=i.opacity,e.size.value=i.size,e.scale.value=t.height/2,e.map.value=i.map,null!==i.map){var n=i.map.offset,r=i.map.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}(d,r):r instanceof K.MeshPhongMaterial?function(e,t){e.shininess.value=t.shininess,e.emissive.value=t.emissive,e.specular.value=t.specular,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}(d,r):r instanceof K.MeshLambertMaterial?function(e,t){e.emissive.value=t.emissive,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}(d,r):r instanceof K.MeshDepthMaterial?(d.mNear.value=e.near,d.mFar.value=e.far,d.opacity.value=r.opacity):r instanceof K.MeshNormalMaterial&&(d.opacity.value=r.opacity),o.receiveShadow&&!r._shadowPass&&function(e,t){if(e.shadowMatrix)for(var i=0,n=0,r=t.length;n<r;n++){var o=t[n];o.castShadow&&((o instanceof K.SpotLight||o instanceof K.DirectionalLight&&!o.shadowCascade)&&(e.shadowMap.value[i]=o.shadowMap,e.shadowMapSize.value[i]=o.shadowMapSize,e.shadowMatrix.value[i]=o.shadowMatrix,e.shadowDarkness.value[i]=o.shadowDarkness,e.shadowBias.value[i]=o.shadowBias,i++))}}(d,i),function(e){for(var t,i,n,r=0,o=e.length;r<o;r++){var s=e[r][0];if(!1!==s.needsUpdate){var a=s.type,l=s.value,c=e[r][1];switch(a){case"1i":case"i":_.uniform1i(c,l);break;case"1f":case"f":_.uniform1f(c,l);break;case"2f":_.uniform2f(c,l[0],l[1]);break;case"3f":_.uniform3f(c,l[0],l[1],l[2]);break;case"4f":_.uniform4f(c,l[0],l[1],l[2],l[3]);break;case"1iv":case"iv1":_.uniform1iv(c,l);break;case"3iv":case"iv":_.uniform3iv(c,l);break;case"1fv":case"fv1":_.uniform1fv(c,l);break;case"2fv":_.uniform2fv(c,l);break;case"3fv":case"fv":_.uniform3fv(c,l);break;case"4fv":_.uniform4fv(c,l);break;case"Matrix3fv":_.uniformMatrix3fv(c,!1,l);break;case"Matrix4fv":_.uniformMatrix4fv(c,!1,l);break;case"v2":_.uniform2f(c,l.x,l.y);break;case"v3":_.uniform3f(c,l.x,l.y,l.z);break;case"v4":_.uniform4f(c,l.x,l.y,l.z,l.w);break;case"c":_.uniform3f(c,l.r,l.g,l.b);break;case"v2v":void 0===s._array&&(s._array=new Float32Array(2*l.length));for(var h=0,u=l.length;h<u;h++)n=2*h,s._array[n]=l[h].x,s._array[n+1]=l[h].y;_.uniform2fv(c,s._array);break;case"v3v":void 0===s._array&&(s._array=new Float32Array(3*l.length));for(h=0,u=l.length;h<u;h++)n=3*h,s._array[n]=l[h].x,s._array[n+1]=l[h].y,s._array[n+2]=l[h].z;_.uniform3fv(c,s._array);break;case"v4v":void 0===s._array&&(s._array=new Float32Array(4*l.length));for(h=0,u=l.length;h<u;h++)n=4*h,s._array[n]=l[h].x,s._array[n+1]=l[h].y,s._array[n+2]=l[h].z,s._array[n+3]=l[h].w;_.uniform4fv(c,s._array);break;case"m3":_.uniformMatrix3fv(c,!1,l.elements);break;case"m3v":void 0===s._array&&(s._array=new Float32Array(9*l.length));for(h=0,u=l.length;h<u;h++)l[h].flattenToArrayOffset(s._array,9*h);_.uniformMatrix3fv(c,!1,s._array);break;case"m4":_.uniformMatrix4fv(c,!1,l.elements);break;case"m4v":void 0===s._array&&(s._array=new Float32Array(16*l.length));for(h=0,u=l.length;h<u;h++)l[h].flattenToArrayOffset(s._array,16*h);_.uniformMatrix4fv(c,!1,s._array);break;case"t":if(t=l,i=Qe(),_.uniform1i(c,i),!t)continue;t instanceof K.CubeTexture||t.image instanceof Array&&6===t.image.length?tt(t,i):t instanceof K.WebGLRenderTargetCube?it(t,i):E.setTexture(t,i);break;case"tv":void 0===s._array&&(s._array=[]);for(h=0,u=s.value.length;h<u;h++)s._array[h]=Qe();_.uniform1iv(c,s._array);for(h=0,u=s.value.length;h<u;h++)t=s.value[h],i=s._array[h],t&&E.setTexture(t,i);break;default:K.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}(r.uniformsList)),function(e,t){_.uniformMatrix4fv(e.modelViewMatrix,!1,t._modelViewMatrix.elements),e.normalMatrix&&_.uniformMatrix3fv(e.normalMatrix,!1,t._normalMatrix.elements)}(h,o),null!==h.modelMatrix&&_.uniformMatrix4fv(h.modelMatrix,!1,o.matrixWorld.elements),c}function Ye(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function Ke(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.pointLightDecay.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.spotLightDecay.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function Qe(){var e=P;return e>=Q&&K.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Q),P+=1,e}function Ze(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getNormalMatrix(e._modelViewMatrix)}function $e(e,t,i,n){e[t]=i.r*n,e[t+1]=i.g*n,e[t+2]=i.b*n}function Je(e,t,i){var n;i?(_.texParameteri(e,_.TEXTURE_WRAP_S,st(t.wrapS)),_.texParameteri(e,_.TEXTURE_WRAP_T,st(t.wrapT)),_.texParameteri(e,_.TEXTURE_MAG_FILTER,st(t.magFilter)),_.texParameteri(e,_.TEXTURE_MIN_FILTER,st(t.minFilter))):(_.texParameteri(e,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(e,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),t.wrapS===K.ClampToEdgeWrapping&&t.wrapT===K.ClampToEdgeWrapping||K.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+t.sourceFile+" )"),_.texParameteri(e,_.TEXTURE_MAG_FILTER,ot(t.magFilter)),_.texParameteri(e,_.TEXTURE_MIN_FILTER,ot(t.minFilter)),t.minFilter!==K.NearestFilter&&t.minFilter!==K.LinearFilter&&K.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+t.sourceFile+" )")),(n=W.get("EXT_texture_filter_anisotropic"))&&t.type!==K.FloatType&&t.type!==K.HalfFloatType&&(t.anisotropy>1||t.__currentAnisotropy)&&(_.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,E.getMaxAnisotropy())),t.__currentAnisotropy=t.anisotropy)}function et(e,t){if(e.width>t||e.height>t){var i=t/Math.max(e.width,e.height),n=document.createElement("canvas");return n.width=Math.floor(e.width*i),n.height=Math.floor(e.height*i),n.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),K.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height,e),n}return e}function tt(e,t){if(6===e.image.length)if(e.needsUpdate){e.image.__webglTextureCube||(e.addEventListener("dispose",ge),e.image.__webglTextureCube=_.createTexture(),E.info.memory.textures++),_.activeTexture(_.TEXTURE0+t),_.bindTexture(_.TEXTURE_CUBE_MAP,e.image.__webglTextureCube),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e instanceof K.CompressedTexture,n=e.image[0]instanceof K.DataTexture,r=[],o=0;o<6;o++)!E.autoScaleCubemaps||i||n?r[o]=n?e.image[o].image:e.image[o]:r[o]=et(e.image[o],J);var s=r[0],a=K.Math.isPowerOfTwo(s.width)&&K.Math.isPowerOfTwo(s.height),l=st(e.format),c=st(e.type);Je(_.TEXTURE_CUBE_MAP,e,a);for(o=0;o<6;o++)if(i)for(var h,u=r[o].mipmaps,d=0,f=u.length;d<f;d++)h=u[d],e.format!==K.RGBAFormat&&e.format!==K.RGBFormat?se().indexOf(l)>-1?_.compressedTexImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,l,h.width,h.height,0,h.data):K.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,l,h.width,h.height,0,l,c,h.data);else n?_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,l,r[o].width,r[o].height,0,l,c,r[o].data):_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,l,l,c,r[o]);e.generateMipmaps&&a&&_.generateMipmap(_.TEXTURE_CUBE_MAP),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else _.activeTexture(_.TEXTURE0+t),_.bindTexture(_.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}function it(e,t){_.activeTexture(_.TEXTURE0+t),_.bindTexture(_.TEXTURE_CUBE_MAP,e.__webglTexture)}function nt(e,t,i){_.bindFramebuffer(_.FRAMEBUFFER,e),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,i,t.__webglTexture,0)}function rt(e,t){_.bindRenderbuffer(_.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(_.renderbufferStorage(_.RENDERBUFFER,_.DEPTH_COMPONENT16,t.width,t.height),_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_ATTACHMENT,_.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(_.renderbufferStorage(_.RENDERBUFFER,_.DEPTH_STENCIL,t.width,t.height),_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_STENCIL_ATTACHMENT,_.RENDERBUFFER,e)):_.renderbufferStorage(_.RENDERBUFFER,_.RGBA4,t.width,t.height)}function ot(e){return e===K.NearestFilter||e===K.NearestMipMapNearestFilter||e===K.NearestMipMapLinearFilter?_.NEAREST:_.LINEAR}function st(e){var t;if(e===K.RepeatWrapping)return _.REPEAT;if(e===K.ClampToEdgeWrapping)return _.CLAMP_TO_EDGE;if(e===K.MirroredRepeatWrapping)return _.MIRRORED_REPEAT;if(e===K.NearestFilter)return _.NEAREST;if(e===K.NearestMipMapNearestFilter)return _.NEAREST_MIPMAP_NEAREST;if(e===K.NearestMipMapLinearFilter)return _.NEAREST_MIPMAP_LINEAR;if(e===K.LinearFilter)return _.LINEAR;if(e===K.LinearMipMapNearestFilter)return _.LINEAR_MIPMAP_NEAREST;if(e===K.LinearMipMapLinearFilter)return _.LINEAR_MIPMAP_LINEAR;if(e===K.UnsignedByteType)return _.UNSIGNED_BYTE;if(e===K.UnsignedShort4444Type)return _.UNSIGNED_SHORT_4_4_4_4;if(e===K.UnsignedShort5551Type)return _.UNSIGNED_SHORT_5_5_5_1;if(e===K.UnsignedShort565Type)return _.UNSIGNED_SHORT_5_6_5;if(e===K.ByteType)return _.BYTE;if(e===K.ShortType)return _.SHORT;if(e===K.UnsignedShortType)return _.UNSIGNED_SHORT;if(e===K.IntType)return _.INT;if(e===K.UnsignedIntType)return _.UNSIGNED_INT;if(e===K.FloatType)return _.FLOAT;if(null!==(t=W.get("OES_texture_half_float"))&&e===K.HalfFloatType)return t.HALF_FLOAT_OES;if(e===K.AlphaFormat)return _.ALPHA;if(e===K.RGBFormat)return _.RGB;if(e===K.RGBAFormat)return _.RGBA;if(e===K.LuminanceFormat)return _.LUMINANCE;if(e===K.LuminanceAlphaFormat)return _.LUMINANCE_ALPHA;if(e===K.AddEquation)return _.FUNC_ADD;if(e===K.SubtractEquation)return _.FUNC_SUBTRACT;if(e===K.ReverseSubtractEquation)return _.FUNC_REVERSE_SUBTRACT;if(e===K.ZeroFactor)return _.ZERO;if(e===K.OneFactor)return _.ONE;if(e===K.SrcColorFactor)return _.SRC_COLOR;if(e===K.OneMinusSrcColorFactor)return _.ONE_MINUS_SRC_COLOR;if(e===K.SrcAlphaFactor)return _.SRC_ALPHA;if(e===K.OneMinusSrcAlphaFactor)return _.ONE_MINUS_SRC_ALPHA;if(e===K.DstAlphaFactor)return _.DST_ALPHA;if(e===K.OneMinusDstAlphaFactor)return _.ONE_MINUS_DST_ALPHA;if(e===K.DstColorFactor)return _.DST_COLOR;if(e===K.OneMinusDstColorFactor)return _.ONE_MINUS_DST_COLOR;if(e===K.SrcAlphaSaturateFactor)return _.SRC_ALPHA_SATURATE;if(null!==(t=W.get("WEBGL_compressed_texture_s3tc"))){if(e===K.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===K.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===K.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===K.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(t=W.get("WEBGL_compressed_texture_pvrtc"))){if(e===K.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===K.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===K.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===K.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(t=W.get("EXT_blend_minmax"))){if(e===K.MinEquation)return t.MIN_EXT;if(e===K.MaxEquation)return t.MAX_EXT}return 0}this.setFaceCulling=function(e,t){e===K.CullFaceNone?_.disable(_.CULL_FACE):(t===K.FrontFaceDirectionCW?_.frontFace(_.CW):_.frontFace(_.CCW),e===K.CullFaceBack?_.cullFace(_.BACK):e===K.CullFaceFront?_.cullFace(_.FRONT):_.cullFace(_.FRONT_AND_BACK),_.enable(_.CULL_FACE))},this.setMaterialFaces=function(e){H.setDoubleSided(e.side===K.DoubleSide),H.setFlipSided(e.side===K.BackSide)},this.uploadTexture=function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",ge),e.__webglTexture=_.createTexture(),E.info.memory.textures++),_.bindTexture(_.TEXTURE_2D,e.__webglTexture),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,e.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,e.unpackAlignment),e.image=et(e.image,$);var t=e.image,i=K.Math.isPowerOfTwo(t.width)&&K.Math.isPowerOfTwo(t.height),n=st(e.format),r=st(e.type);Je(_.TEXTURE_2D,e,i);var o,s=e.mipmaps;if(e instanceof K.DataTexture)if(s.length>0&&i){for(var a=0,l=s.length;a<l;a++)o=s[a],_.texImage2D(_.TEXTURE_2D,a,n,o.width,o.height,0,n,r,o.data);e.generateMipmaps=!1}else _.texImage2D(_.TEXTURE_2D,0,n,t.width,t.height,0,n,r,t.data);else if(e instanceof K.CompressedTexture)for(a=0,l=s.length;a<l;a++)o=s[a],e.format!==K.RGBAFormat&&e.format!==K.RGBFormat?se().indexOf(n)>-1?_.compressedTexImage2D(_.TEXTURE_2D,a,n,o.width,o.height,0,o.data):K.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_.texImage2D(_.TEXTURE_2D,a,n,o.width,o.height,0,n,r,o.data);else if(s.length>0&&i){for(a=0,l=s.length;a<l;a++)o=s[a],_.texImage2D(_.TEXTURE_2D,a,n,n,r,o);e.generateMipmaps=!1}else _.texImage2D(_.TEXTURE_2D,0,n,n,r,e.image);e.generateMipmaps&&i&&_.generateMipmap(_.TEXTURE_2D),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()},this.setTexture=function(e,t){_.activeTexture(_.TEXTURE0+t),e.needsUpdate?E.uploadTexture(e):_.bindTexture(_.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(e){var t,i,n,r,o,s=e instanceof K.WebGLRenderTargetCube;if(e&&void 0===e.__webglFramebuffer){void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",ve),e.__webglTexture=_.createTexture(),E.info.memory.textures++;var a=K.Math.isPowerOfTwo(e.width)&&K.Math.isPowerOfTwo(e.height),l=st(e.format),c=st(e.type);if(s){e.__webglFramebuffer=[],e.__webglRenderbuffer=[],_.bindTexture(_.TEXTURE_CUBE_MAP,e.__webglTexture),Je(_.TEXTURE_CUBE_MAP,e,a);for(var h=0;h<6;h++)e.__webglFramebuffer[h]=_.createFramebuffer(),e.__webglRenderbuffer[h]=_.createRenderbuffer(),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,e.width,e.height,0,l,c,null),nt(e.__webglFramebuffer[h],e,_.TEXTURE_CUBE_MAP_POSITIVE_X+h),rt(e.__webglRenderbuffer[h],e);a&&_.generateMipmap(_.TEXTURE_CUBE_MAP)}else e.__webglFramebuffer=_.createFramebuffer(),e.shareDepthFrom?e.__webglRenderbuffer=e.shareDepthFrom.__webglRenderbuffer:e.__webglRenderbuffer=_.createRenderbuffer(),_.bindTexture(_.TEXTURE_2D,e.__webglTexture),Je(_.TEXTURE_2D,e,a),_.texImage2D(_.TEXTURE_2D,0,l,e.width,e.height,0,l,c,null),nt(e.__webglFramebuffer,e,_.TEXTURE_2D),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_ATTACHMENT,_.RENDERBUFFER,e.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_STENCIL_ATTACHMENT,_.RENDERBUFFER,e.__webglRenderbuffer):rt(e.__webglRenderbuffer,e),a&&_.generateMipmap(_.TEXTURE_2D);s?_.bindTexture(_.TEXTURE_CUBE_MAP,null):_.bindTexture(_.TEXTURE_2D,null),_.bindRenderbuffer(_.RENDERBUFFER,null),_.bindFramebuffer(_.FRAMEBUFFER,null)}e?(t=s?e.__webglFramebuffer[e.activeCubeFace]:e.__webglFramebuffer,i=e.width,n=e.height,r=0,o=0):(t=null,i=I,n=R,r=D,o=L),t!==w&&(_.bindFramebuffer(_.FRAMEBUFFER,t),_.viewport(r,o,i,n),w=t),O=i,N=n},this.readRenderTargetPixels=function(e,t,i,n,r,o){if(e instanceof K.WebGLRenderTarget){if(e.__webglFramebuffer){if(e.format!==K.RGBAFormat)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");var s=!1;e.__webglFramebuffer!==w&&(_.bindFramebuffer(_.FRAMEBUFFER,e.__webglFramebuffer),s=!0),_.checkFramebufferStatus(_.FRAMEBUFFER)===_.FRAMEBUFFER_COMPLETE?_.readPixels(t,i,n,r,_.RGBA,_.UNSIGNED_BYTE,o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&_.bindFramebuffer(_.FRAMEBUFFER,w)}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.initMaterial=function(){K.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){K.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){K.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){K.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},K.WebGLRenderTarget=function(e,t,i){this.width=e,this.height=t,i=i||{},this.wrapS=void 0!==i.wrapS?i.wrapS:K.ClampToEdgeWrapping,this.wrapT=void 0!==i.wrapT?i.wrapT:K.ClampToEdgeWrapping,this.magFilter=void 0!==i.magFilter?i.magFilter:K.LinearFilter,this.minFilter=void 0!==i.minFilter?i.minFilter:K.LinearMipMapLinearFilter,this.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,this.offset=new K.Vector2(0,0),this.repeat=new K.Vector2(1,1),this.format=void 0!==i.format?i.format:K.RGBAFormat,this.type=void 0!==i.type?i.type:K.UnsignedByteType,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==i.shareDepthFrom?i.shareDepthFrom:null},K.WebGLRenderTarget.prototype={constructor:K.WebGLRenderTarget,setSize:function(e,t){this.width=e,this.height=t},clone:function(){var e=new K.WebGLRenderTarget(this.width,this.height);return e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.format=this.format,e.type=this.type,e.depthBuffer=this.depthBuffer,e.stencilBuffer=this.stencilBuffer,e.generateMipmaps=this.generateMipmaps,e.shareDepthFrom=this.shareDepthFrom,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},K.EventDispatcher.prototype.apply(K.WebGLRenderTarget.prototype),K.WebGLRenderTargetCube=function(e,t,i){K.WebGLRenderTarget.call(this,e,t,i),this.activeCubeFace=0},K.WebGLRenderTargetCube.prototype=Object.create(K.WebGLRenderTarget.prototype),K.WebGLRenderTargetCube.prototype.constructor=K.WebGLRenderTargetCube,K.WebGLExtensions=function(e){var t={};this.get=function(i){if(void 0!==t[i])return t[i];var n;switch(i){case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return null===n&&K.warn("THREE.WebGLRenderer: "+i+" extension not supported."),t[i]=n,n}},K.WebGLProgram=(F=0,function(e,t,i,n){var r=e,o=r.context,s=i.defines,a=i.__webglShader.uniforms,l=i.attributes,c=i.__webglShader.vertexShader,h=i.__webglShader.fragmentShader,u=i.index0AttributeName;void 0===u&&!0===n.morphTargets&&(u="position");var d="SHADOWMAP_TYPE_BASIC";n.shadowMapType===K.PCFShadowMap?d="SHADOWMAP_TYPE_PCF":n.shadowMapType===K.PCFSoftShadowMap&&(d="SHADOWMAP_TYPE_PCF_SOFT");var f="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",m="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(i.envMap.mapping){case K.CubeReflectionMapping:case K.CubeRefractionMapping:f="ENVMAP_TYPE_CUBE";break;case K.EquirectangularReflectionMapping:case K.EquirectangularRefractionMapping:f="ENVMAP_TYPE_EQUIREC";break;case K.SphericalReflectionMapping:f="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case K.CubeRefractionMapping:case K.EquirectangularRefractionMapping:p="ENVMAP_MODE_REFRACTION"}switch(i.combine){case K.MultiplyOperation:m="ENVMAP_BLENDING_MULTIPLY";break;case K.MixOperation:m="ENVMAP_BLENDING_MIX";break;case K.AddOperation:m="ENVMAP_BLENDING_ADD"}}var g,v,y=e.gammaFactor>0?e.gammaFactor:1,b=function(e){var t,i,n=[];for(var r in e)!1!==(t=e[r])&&(i="#define "+r+" "+t,n.push(i));return n.join("\n")}(s),x=o.createProgram();i instanceof K.RawShaderMaterial?(g="",v=""):(g=["precision "+n.precision+" float;","precision "+n.precision+" int;",b,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",r.gammaInput?"#define GAMMA_INPUT":"",r.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+y,"#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_SPOT_LIGHTS "+n.maxSpotLights,"#define MAX_HEMI_LIGHTS "+n.maxHemiLights,"#define MAX_SHADOWS "+n.maxShadows,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals?"#define USE_MORPHNORMALS":"",n.wrapAround?"#define WRAP_AROUND":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",n.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",""].join("\n"),v=["precision "+n.precision+" float;","precision "+n.precision+" int;",n.bumpMap||n.normalMap||n.flatShading?"#extension GL_OES_standard_derivatives : enable":"",b,"#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_SPOT_LIGHTS "+n.maxSpotLights,"#define MAX_HEMI_LIGHTS "+n.maxHemiLights,"#define MAX_SHADOWS "+n.maxShadows,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"",r.gammaInput?"#define GAMMA_INPUT":"",r.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.envMap?"#define "+p:"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.metal?"#define METAL":"",n.wrapAround?"#define WRAP_AROUND":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",n.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var _=new K.WebGLShader(o,o.VERTEX_SHADER,g+c),E=new K.WebGLShader(o,o.FRAGMENT_SHADER,v+h);o.attachShader(x,_),o.attachShader(x,E),void 0!==u&&o.bindAttribLocation(x,0,u),o.linkProgram(x);var S=o.getProgramInfoLog(x);!1===o.getProgramParameter(x,o.LINK_STATUS)&&K.error("THREE.WebGLProgram: shader error: "+o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(x,o.VALIDATE_STATUS),"gl.getPRogramInfoLog",S),""!==S&&K.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+S),o.deleteShader(_),o.deleteShader(E);var A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];for(var w in n.useVertexTexture?(A.push("boneTexture"),A.push("boneTextureWidth"),A.push("boneTextureHeight")):A.push("boneGlobalMatrices"),n.logarithmicDepthBuffer&&A.push("logDepthBufFC"),a)A.push(w);this.uniforms=function(e,t,i){for(var n={},r=0,o=i.length;r<o;r++){var s=i[r];n[s]=e.getUniformLocation(t,s)}return n}(o,x,A),A=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var T=0;T<n.maxMorphTargets;T++)A.push("morphTarget"+T);for(T=0;T<n.maxMorphNormals;T++)A.push("morphNormal"+T);for(var M in l)A.push(M);return this.attributes=function(e,t,i){for(var n={},r=0,o=i.length;r<o;r++){var s=i[r];n[s]=e.getAttribLocation(t,s)}return n}(o,x,A),this.attributesKeys=Object.keys(this.attributes),this.id=F++,this.code=t,this.usedTimes=1,this.program=x,this.vertexShader=_,this.fragmentShader=E,this}),K.WebGLShader=function(e,t,i){var n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&K.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&K.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e.getShaderInfoLog(n),function(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}(i)),n},K.WebGLState=function(e,t){var i=new Uint8Array(16),n=new Uint8Array(16),r=null,o=null,s=null,a=null,l=null,c=null,h=null,u=null,d=null,f=null,p=null,m=null,g=null,v=null,y=null,b=null;this.initAttributes=function(){for(var e=0,t=i.length;e<t;e++)i[e]=0},this.enableAttribute=function(t){i[t]=1,0===n[t]&&(e.enableVertexAttribArray(t),n[t]=1)},this.disableUnusedAttributes=function(){for(var t=0,r=n.length;t<r;t++)n[t]!==i[t]&&(e.disableVertexAttribArray(t),n[t]=0)},this.setBlending=function(i,n,u,d,f,p,m){i!==r&&(i===K.NoBlending?e.disable(e.BLEND):i===K.AdditiveBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):i===K.SubtractiveBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):i===K.MultiplyBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):i===K.CustomBlending?e.enable(e.BLEND):(e.enable(e.BLEND),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),r=i),i===K.CustomBlending?(f=f||n,p=p||u,m=m||d,n===o&&f===l||(e.blendEquationSeparate(t(n),t(f)),o=n,l=f),u===s&&d===a&&p===c&&m===h||(e.blendFuncSeparate(t(u),t(d),t(p),t(m)),s=u,a=d,c=p,h=m)):(o=null,s=null,a=null,l=null,c=null,h=null)},this.setDepthTest=function(t){u!==t&&(t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),u=t)},this.setDepthWrite=function(t){d!==t&&(e.depthMask(t),d=t)},this.setColorWrite=function(t){f!==t&&(e.colorMask(t,t,t,t),f=t)},this.setDoubleSided=function(t){p!==t&&(t?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),p=t)},this.setFlipSided=function(t){m!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),m=t)},this.setLineWidth=function(t){t!==g&&(e.lineWidth(t),g=t)},this.setPolygonOffset=function(t,i,n){v!==t&&(t?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),v=t),!t||y===i&&b===n||(e.polygonOffset(i,n),y=i,b=n)},this.reset=function(){for(var e=0;e<n.length;e++)n[e]=0;r=null,u=null,d=null,f=null,p=null,m=null}},K.LensFlarePlugin=function(e,t){var i,n,r,o,s,a,l,c,h=e.context,u=function(){var t,u=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),d=new Uint16Array([0,1,2,0,2,3]);i=h.createBuffer(),n=h.createBuffer(),h.bindBuffer(h.ARRAY_BUFFER,i),h.bufferData(h.ARRAY_BUFFER,u,h.STATIC_DRAW),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,n),h.bufferData(h.ELEMENT_ARRAY_BUFFER,d,h.STATIC_DRAW),l=h.createTexture(),c=h.createTexture(),h.bindTexture(h.TEXTURE_2D,l),h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.bindTexture(h.TEXTURE_2D,c),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),t=(a=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0)?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},r=function(t){var i=h.createProgram(),n=h.createShader(h.FRAGMENT_SHADER),r=h.createShader(h.VERTEX_SHADER),o="precision "+e.getPrecision()+" float;\n";return h.shaderSource(n,o+t.fragmentShader),h.shaderSource(r,o+t.vertexShader),h.compileShader(n),h.compileShader(r),h.attachShader(i,n),h.attachShader(i,r),h.linkProgram(i),i}(t),o={vertex:h.getAttribLocation(r,"position"),uv:h.getAttribLocation(r,"uv")},s={renderType:h.getUniformLocation(r,"renderType"),map:h.getUniformLocation(r,"map"),occlusionMap:h.getUniformLocation(r,"occlusionMap"),opacity:h.getUniformLocation(r,"opacity"),color:h.getUniformLocation(r,"color"),scale:h.getUniformLocation(r,"scale"),rotation:h.getUniformLocation(r,"rotation"),screenPosition:h.getUniformLocation(r,"screenPosition")}};this.render=function(d,f,p,m){if(0!==t.length){var g=new K.Vector3,v=m/p,y=.5*p,b=.5*m,x=16/m,_=new K.Vector2(x*v,x),E=new K.Vector3(1,1,0),S=new K.Vector2(1,1);void 0===r&&u(),h.useProgram(r),h.enableVertexAttribArray(o.vertex),h.enableVertexAttribArray(o.uv),h.uniform1i(s.occlusionMap,0),h.uniform1i(s.map,1),h.bindBuffer(h.ARRAY_BUFFER,i),h.vertexAttribPointer(o.vertex,2,h.FLOAT,!1,16,0),h.vertexAttribPointer(o.uv,2,h.FLOAT,!1,16,8),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,n),h.disable(h.CULL_FACE),h.depthMask(!1);for(var A=0,w=t.length;A<w;A++){x=16/m,_.set(x*v,x);var T=t[A];if(g.set(T.matrixWorld.elements[12],T.matrixWorld.elements[13],T.matrixWorld.elements[14]),g.applyMatrix4(f.matrixWorldInverse),g.applyProjection(f.projectionMatrix),E.copy(g),S.x=E.x*y+y,S.y=E.y*b+b,a||S.x>0&&S.x<p&&S.y>0&&S.y<m){h.activeTexture(h.TEXTURE1),h.bindTexture(h.TEXTURE_2D,l),h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,S.x-8,S.y-8,16,16,0),h.uniform1i(s.renderType,0),h.uniform2f(s.scale,_.x,_.y),h.uniform3f(s.screenPosition,E.x,E.y,E.z),h.disable(h.BLEND),h.enable(h.DEPTH_TEST),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,c),h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,S.x-8,S.y-8,16,16,0),h.uniform1i(s.renderType,1),h.disable(h.DEPTH_TEST),h.activeTexture(h.TEXTURE1),h.bindTexture(h.TEXTURE_2D,l),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0),T.positionScreen.copy(E),T.customUpdateCallback?T.customUpdateCallback(T):T.updateLensFlares(),h.uniform1i(s.renderType,2),h.enable(h.BLEND);for(var M=0,C=T.lensFlares.length;M<C;M++){var P=T.lensFlares[M];P.opacity>.001&&P.scale>.001&&(E.x=P.x,E.y=P.y,E.z=P.z,x=P.size*P.scale/m,_.x=x*v,_.y=x,h.uniform3f(s.screenPosition,E.x,E.y,E.z),h.uniform2f(s.scale,_.x,_.y),h.uniform1f(s.rotation,P.rotation),h.uniform1f(s.opacity,P.opacity),h.uniform3f(s.color,P.color.r,P.color.g,P.color.b),e.state.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),e.setTexture(P.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0))}}}h.enable(h.CULL_FACE),h.enable(h.DEPTH_TEST),h.depthMask(!0),e.resetGLState()}}},K.ShadowMapPlugin=function(e,t,i,n){var r,o,s,a,l=e.context,c=new K.Frustum,h=new K.Matrix4,u=new K.Vector3,d=new K.Vector3,f=new K.Vector3,p=[],m=K.ShaderLib.depthRGBA,g=K.UniformsUtils.clone(m.uniforms);function v(e,t,n){if(t.visible){var r=i[t.id];if(r&&t.castShadow&&(!1===t.frustumCulled||!0===c.intersectsObject(t)))for(var o=0,s=r.length;o<s;o++){var a=r[o];t._modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),p.push(a)}for(o=0,s=t.children.length;o<s;o++)v(e,t.children[o],n)}}function y(e,t){var i=new K.DirectionalLight;i.isVirtual=!0,i.onlyShadow=!0,i.castShadow=!0,i.shadowCameraNear=e.shadowCameraNear,i.shadowCameraFar=e.shadowCameraFar,i.shadowCameraLeft=e.shadowCameraLeft,i.shadowCameraRight=e.shadowCameraRight,i.shadowCameraBottom=e.shadowCameraBottom,i.shadowCameraTop=e.shadowCameraTop,i.shadowCameraVisible=e.shadowCameraVisible,i.shadowDarkness=e.shadowDarkness,i.shadowBias=e.shadowCascadeBias[t],i.shadowMapWidth=e.shadowCascadeWidth[t],i.shadowMapHeight=e.shadowCascadeHeight[t],i.pointsWorld=[],i.pointsFrustum=[];for(var n=i.pointsWorld,r=i.pointsFrustum,o=0;o<8;o++)n[o]=new K.Vector3,r[o]=new K.Vector3;var s=e.shadowCascadeNearZ[t],a=e.shadowCascadeFarZ[t];return r[0].set(-1,-1,s),r[1].set(1,-1,s),r[2].set(-1,1,s),r[3].set(1,1,s),r[4].set(-1,-1,a),r[5].set(1,-1,a),r[6].set(-1,1,a),r[7].set(1,1,a),i}function b(e,t){var i=e.shadowCascadeArray[t];i.position.copy(e.position),i.target.position.copy(e.target.position),i.lookAt(i.target),i.shadowCameraVisible=e.shadowCameraVisible,i.shadowDarkness=e.shadowDarkness,i.shadowBias=e.shadowCascadeBias[t];var n=e.shadowCascadeNearZ[t],r=e.shadowCascadeFarZ[t],o=i.pointsFrustum;o[0].z=n,o[1].z=n,o[2].z=n,o[3].z=n,o[4].z=r,o[5].z=r,o[6].z=r,o[7].z=r}function x(e,t){var i=t.shadowCamera,n=t.pointsFrustum,r=t.pointsWorld;u.set(1/0,1/0,1/0),d.set(-1/0,-1/0,-1/0);for(var o=0;o<8;o++){var s=r[o];s.copy(n[o]),s.unproject(e),s.applyMatrix4(i.matrixWorldInverse),s.x<u.x&&(u.x=s.x),s.x>d.x&&(d.x=s.x),s.y<u.y&&(u.y=s.y),s.y>d.y&&(d.y=s.y),s.z<u.z&&(u.z=s.z),s.z>d.z&&(d.z=s.z)}i.left=u.x,i.right=d.x,i.top=d.y,i.bottom=u.y,i.updateProjectionMatrix()}function _(e){return e.material instanceof K.MeshFaceMaterial?e.material.materials[0]:e.material}r=new K.ShaderMaterial({uniforms:g,vertexShader:m.vertexShader,fragmentShader:m.fragmentShader}),o=new K.ShaderMaterial({uniforms:g,vertexShader:m.vertexShader,fragmentShader:m.fragmentShader,morphTargets:!0}),s=new K.ShaderMaterial({uniforms:g,vertexShader:m.vertexShader,fragmentShader:m.fragmentShader,skinning:!0}),a=new K.ShaderMaterial({uniforms:g,vertexShader:m.vertexShader,fragmentShader:m.fragmentShader,morphTargets:!0,skinning:!0}),r._shadowPass=!0,o._shadowPass=!0,s._shadowPass=!0,a._shadowPass=!0,this.render=function(i,u){if(!1!==e.shadowMapEnabled){var d,m,g,E,S,A,w,T,M,C,P,D,L,I=[],R=0,O=null;for(l.clearColor(1,1,1,1),l.disable(l.BLEND),l.enable(l.CULL_FACE),l.frontFace(l.CCW),e.shadowMapCullFace===K.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.BACK),e.state.setDepthTest(!0),d=0,m=t.length;d<m;d++)if((L=t[d]).castShadow)if(L instanceof K.DirectionalLight&&L.shadowCascade)for(S=0;S<L.shadowCascadeCount;S++){var N;if(L.shadowCascadeArray[S])N=L.shadowCascadeArray[S];else{(N=y(L,S)).originalCamera=u;var F=new K.Gyroscope;F.position.copy(L.shadowCascadeOffset),F.add(N),F.add(N.target),u.add(F),L.shadowCascadeArray[S]=N}b(L,S),I[R]=N,R++}else I[R]=L,R++;for(d=0,m=I.length;d<m;d++){if(!(L=I[d]).shadowMap){var U=K.LinearFilter;e.shadowMapType===K.PCFSoftShadowMap&&(U=K.NearestFilter);var B={minFilter:U,magFilter:U,format:K.RGBAFormat};L.shadowMap=new K.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,B),L.shadowMapSize=new K.Vector2(L.shadowMapWidth,L.shadowMapHeight),L.shadowMatrix=new K.Matrix4}if(!L.shadowCamera){if(L instanceof K.SpotLight)L.shadowCamera=new K.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar);else{if(!(L instanceof K.DirectionalLight)){K.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",L);continue}L.shadowCamera=new K.OrthographicCamera(L.shadowCameraLeft,L.shadowCameraRight,L.shadowCameraTop,L.shadowCameraBottom,L.shadowCameraNear,L.shadowCameraFar)}i.add(L.shadowCamera),!0===i.autoUpdate&&i.updateMatrixWorld()}var k,V,G;for(L.shadowCameraVisible&&!L.cameraHelper&&(L.cameraHelper=new K.CameraHelper(L.shadowCamera),i.add(L.cameraHelper)),L.isVirtual&&N.originalCamera==u&&x(u,L),A=L.shadowMap,w=L.shadowMatrix,(T=L.shadowCamera).position.setFromMatrixPosition(L.matrixWorld),f.setFromMatrixPosition(L.target.matrixWorld),T.lookAt(f),T.updateMatrixWorld(),T.matrixWorldInverse.getInverse(T.matrixWorld),L.cameraHelper&&(L.cameraHelper.visible=L.shadowCameraVisible),L.shadowCameraVisible&&L.cameraHelper.update(),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(T.projectionMatrix),w.multiply(T.matrixWorldInverse),h.multiplyMatrices(T.projectionMatrix,T.matrixWorldInverse),c.setFromMatrix(h),e.setRenderTarget(A),e.clear(),p.length=0,v(i,i,T),g=0,E=p.length;g<E;g++)D=(P=p[g]).object,M=P.buffer,k=_(D),V=void 0!==D.geometry.morphTargets&&D.geometry.morphTargets.length>0&&k.morphTargets,G=D instanceof K.SkinnedMesh&&k.skinning,C=D.customDepthMaterial?D.customDepthMaterial:G?V?a:s:V?o:r,e.setMaterialFaces(k),M instanceof K.BufferGeometry?e.renderBufferDirect(T,t,O,C,M,D):e.renderBuffer(T,t,O,C,M,D);for(g=0,E=n.length;g<E;g++)(D=(P=n[g]).object).visible&&D.castShadow&&(D._modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,D.matrixWorld),e.renderImmediateObject(T,t,O,r,D))}var z=e.getClearColor(),H=e.getClearAlpha();l.clearColor(z.r,z.g,z.b,H),l.enable(l.BLEND),e.shadowMapCullFace===K.CullFaceFront&&l.cullFace(l.BACK),e.resetGLState()}}},K.SpritePlugin=function(e,t){var i,n,r,o,s,a,l=e.context,c=new K.Vector3,h=new K.Quaternion,u=new K.Vector3,d=function(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),c=new Uint16Array([0,1,2,0,2,3]);i=l.createBuffer(),n=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,i),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,n),l.bufferData(l.ELEMENT_ARRAY_BUFFER,c,l.STATIC_DRAW),r=function(){var t=l.createProgram(),i=l.createShader(l.VERTEX_SHADER),n=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(i),l.compileShader(n),l.attachShader(t,i),l.attachShader(t,n),l.linkProgram(t),t}(),o={position:l.getAttribLocation(r,"position"),uv:l.getAttribLocation(r,"uv")},s={uvOffset:l.getUniformLocation(r,"uvOffset"),uvScale:l.getUniformLocation(r,"uvScale"),rotation:l.getUniformLocation(r,"rotation"),scale:l.getUniformLocation(r,"scale"),color:l.getUniformLocation(r,"color"),map:l.getUniformLocation(r,"map"),opacity:l.getUniformLocation(r,"opacity"),modelViewMatrix:l.getUniformLocation(r,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(r,"projectionMatrix"),fogType:l.getUniformLocation(r,"fogType"),fogDensity:l.getUniformLocation(r,"fogDensity"),fogNear:l.getUniformLocation(r,"fogNear"),fogFar:l.getUniformLocation(r,"fogFar"),fogColor:l.getUniformLocation(r,"fogColor"),alphaTest:l.getUniformLocation(r,"alphaTest")};var h=document.createElement("canvas");h.width=8,h.height=8;var u=h.getContext("2d");u.fillStyle="white",u.fillRect(0,0,8,8),(a=new K.Texture(h)).needsUpdate=!0};function f(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(p,m){if(0!==t.length){void 0===r&&d(),l.useProgram(r),l.enableVertexAttribArray(o.position),l.enableVertexAttribArray(o.uv),l.disable(l.CULL_FACE),l.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,i),l.vertexAttribPointer(o.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(o.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,n),l.uniformMatrix4fv(s.projectionMatrix,!1,m.projectionMatrix.elements),l.activeTexture(l.TEXTURE0),l.uniform1i(s.map,0);var g=0,v=0,y=p.fog;y?(l.uniform3f(s.fogColor,y.color.r,y.color.g,y.color.b),y instanceof K.Fog?(l.uniform1f(s.fogNear,y.near),l.uniform1f(s.fogFar,y.far),l.uniform1i(s.fogType,1),g=1,v=1):y instanceof K.FogExp2&&(l.uniform1f(s.fogDensity,y.density),l.uniform1i(s.fogType,2),g=2,v=2)):(l.uniform1i(s.fogType,0),g=0,v=0);for(var b=0,x=t.length;b<x;b++){(E=t[b])._modelViewMatrix.multiplyMatrices(m.matrixWorldInverse,E.matrixWorld),E.z=-E._modelViewMatrix.elements[14]}t.sort(f);var _=[];for(b=0,x=t.length;b<x;b++){var E,S=(E=t[b]).material;l.uniform1f(s.alphaTest,S.alphaTest),l.uniformMatrix4fv(s.modelViewMatrix,!1,E._modelViewMatrix.elements),E.matrixWorld.decompose(c,h,u),_[0]=u.x,_[1]=u.y;var A=0;p.fog&&S.fog&&(A=v),g!==A&&(l.uniform1i(s.fogType,A),g=A),null!==S.map?(l.uniform2f(s.uvOffset,S.map.offset.x,S.map.offset.y),l.uniform2f(s.uvScale,S.map.repeat.x,S.map.repeat.y)):(l.uniform2f(s.uvOffset,0,0),l.uniform2f(s.uvScale,1,1)),l.uniform1f(s.opacity,S.opacity),l.uniform3f(s.color,S.color.r,S.color.g,S.color.b),l.uniform1f(s.rotation,S.rotation),l.uniform2fv(s.scale,_),e.state.setBlending(S.blending,S.blendEquation,S.blendSrc,S.blendDst),e.state.setDepthTest(S.depthTest),e.state.setDepthWrite(S.depthWrite),S.map&&S.map.image&&S.map.image.width?e.setTexture(S.map,0):e.setTexture(a,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}l.enable(l.CULL_FACE),e.resetGLState()}}},K.GeometryUtils={merge:function(e,t,i){var n;K.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t instanceof K.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,i)},center:function(e){return K.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},K.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,i,n){var r=new K.ImageLoader;r.crossOrigin=this.crossOrigin;var o=new K.Texture(void 0,t);return r.load(e,(function(e){o.image=e,o.needsUpdate=!0,i&&i(o)}),void 0,(function(e){n&&n(e)})),o.sourceFile=e,o},loadTextureCube:function(e,t,i,n){var r=new K.ImageLoader;r.crossOrigin=this.crossOrigin;var o=new K.CubeTexture([],t);o.flipY=!1;for(var s=0,a=function(t){r.load(e[t],(function(e){o.images[t]=e,6===(s+=1)&&(o.needsUpdate=!0,i&&i(o))}),void 0,n)},l=0,c=e.length;l<c;++l)a(l);return o},loadCompressedTexture:function(){K.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){K.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(e,t){var i=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},n=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t|=1;var r=e.width,o=e.height,s=document.createElement("canvas");s.width=r,s.height=o;var a=s.getContext("2d");a.drawImage(e,0,0);for(var l,c,h=a.getImageData(0,0,r,o).data,u=a.createImageData(r,o),d=u.data,f=0;f<r;f++)for(var p=0;p<o;p++){var m=p-1<0?0:p-1,g=p+1>o-1?o-1:p+1,v=f-1<0?0:f-1,y=f+1>r-1?r-1:f+1,b=[],x=[0,0,h[4*(p*r+f)]/255*t];b.push([-1,0,h[4*(p*r+v)]/255*t]),b.push([-1,-1,h[4*(m*r+v)]/255*t]),b.push([0,-1,h[4*(m*r+f)]/255*t]),b.push([1,-1,h[4*(m*r+y)]/255*t]),b.push([1,0,h[4*(p*r+y)]/255*t]),b.push([1,1,h[4*(g*r+y)]/255*t]),b.push([0,1,h[4*(g*r+f)]/255*t]),b.push([-1,1,h[4*(g*r+v)]/255*t]);for(var _=[],E=b.length,S=0;S<E;S++){var A=b[S],w=b[(S+1)%E];A=i(A,x),w=i(w,x),_.push(n((c=w,[(l=A)[1]*c[2]-l[2]*c[1],l[2]*c[0]-l[0]*c[2],l[0]*c[1]-l[1]*c[0]])))}var T=[0,0,0];for(S=0;S<_.length;S++)T[0]+=_[S][0],T[1]+=_[S][1],T[2]+=_[S][2];T[0]/=_.length,T[1]/=_.length,T[2]/=_.length;var M=4*(p*r+f);d[M]=(T[0]+1)/2*255|0,d[M+1]=(T[1]+1)/2*255|0,d[M+2]=255*T[2]|0,d[M+3]=255}return a.putImageData(u,0,0),s},generateDataTexture:function(e,t,i){for(var n=e*t,r=new Uint8Array(3*n),o=Math.floor(255*i.r),s=Math.floor(255*i.g),a=Math.floor(255*i.b),l=0;l<n;l++)r[3*l]=o,r[3*l+1]=s,r[3*l+2]=a;var c=new K.DataTexture(r,e,t,K.RGBFormat);return c.needsUpdate=!0,c}},K.SceneUtils={createMultiMaterialObject:function(e,t){for(var i=new K.Object3D,n=0,r=t.length;n<r;n++)i.add(new K.Mesh(e,t[n]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var n=new K.Matrix4;n.getInverse(i.matrixWorld),e.applyMatrix(n),t.remove(e),i.add(e)}},K.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(e){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(e){var t=e.familyName.toLowerCase(),i=this;return i.faces[t]=i.faces[t]||{},i.faces[t][e.cssFontWeight]=i.faces[t][e.cssFontWeight]||{},i.faces[t][e.cssFontWeight][e.cssFontStyle]=e,i.faces[t][e.cssFontWeight][e.cssFontStyle]=e,e},drawText:function(e){var t,i=this.getFace(),n=this.size/i.resolution,r=0,o=String(e).split(""),s=o.length,a=[];for(t=0;t<s;t++){var l=new K.Path,c=this.extractGlyphPoints(o[t],i,n,r,l);r+=c.offset,a.push(c.path)}return{paths:a,offset:r/2}},extractGlyphPoints:function(e,t,i,n,r){var o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S=[],A=t.glyphs[e]||t.glyphs["?"];if(A){if(A.o)for(c=(l=A._cachedOutline||(A._cachedOutline=A.o.split(" "))).length,h=i,u=i,o=0;o<c;)switch(l[o++]){case"m":d=l[o++]*h+n,f=l[o++]*u,r.moveTo(d,f);break;case"l":d=l[o++]*h+n,f=l[o++]*u,r.lineTo(d,f);break;case"q":if(p=l[o++]*h+n,m=l[o++]*u,y=l[o++]*h+n,b=l[o++]*u,r.quadraticCurveTo(y,b,p,m),E=S[S.length-1])for(g=E.x,v=E.y,s=1,a=this.divisions;s<=a;s++){var w=s/a;K.Shape.Utils.b2(w,g,y,p),K.Shape.Utils.b2(w,v,b,m)}break;case"b":if(p=l[o++]*h+n,m=l[o++]*u,y=l[o++]*h+n,b=l[o++]*u,x=l[o++]*h+n,_=l[o++]*u,r.bezierCurveTo(y,b,x,_,p,m),E=S[S.length-1])for(g=E.x,v=E.y,s=1,a=this.divisions;s<=a;s++){w=s/a;K.Shape.Utils.b3(w,g,y,x,p),K.Shape.Utils.b3(w,v,b,_,m)}}return{offset:A.ha*i,path:r}}}},K.FontUtils.generateShapes=function(e,t){var i=void 0!==(t=t||{}).size?t.size:100,n=void 0!==t.curveSegments?t.curveSegments:4,r=void 0!==t.font?t.font:"helvetiker",o=void 0!==t.weight?t.weight:"normal",s=void 0!==t.style?t.style:"normal";K.FontUtils.size=i,K.FontUtils.divisions=n,K.FontUtils.face=r,K.FontUtils.weight=o,K.FontUtils.style=s;for(var a=K.FontUtils.drawText(e).paths,l=[],c=0,h=a.length;c<h;c++)Array.prototype.push.apply(l,a[c].toShapes());return l},U=K.FontUtils,B=1e-10,k=function(e){for(var t=e.length,i=0,n=t-1,r=0;r<t;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return.5*i},V=function(e,t,i,n,r,o){var s,a,l,c,h,u,d,f,p,m,g,v,y,b,x;if(a=e[o[t]].x,l=e[o[t]].y,c=e[o[i]].x,h=e[o[i]].y,u=e[o[n]].x,d=e[o[n]].y,B>(c-a)*(d-l)-(h-l)*(u-a))return!1;for(m=u-c,g=d-h,v=a-u,y=l-d,b=c-a,x=h-l,s=0;s<r;s++)if(f=e[o[s]].x,p=e[o[s]].y,!(f===a&&p===l||f===c&&p===h||f===u&&p===d)&&m*(p-h)-g*(f-c)>=-1e-10&&v*(p-d)-y*(f-u)>=-1e-10&&b*(p-l)-x*(f-a)>=-1e-10)return!1;return!0},U.Triangulate=function(e,t){var i=e.length;if(i<3)return null;var n,r,o,s=[],a=[],l=[];if(k(e)>0)for(r=0;r<i;r++)a[r]=r;else for(r=0;r<i;r++)a[r]=i-1-r;var c=i,h=2*c;for(r=c-1;c>2;){if(h--<=0)return K.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),t?l:s;if(c<=(n=r)&&(n=0),c<=(r=n+1)&&(r=0),c<=(o=r+1)&&(o=0),V(e,n,r,o,c,a)){var u,d,f,p,m;for(u=a[n],d=a[r],f=a[o],s.push([e[u],e[d],e[f]]),l.push([a[n],a[r],a[o]]),p=r,m=r+1;m<c;p++,m++)a[p]=a[m];h=2*--c}}return t?l:s},U.Triangulate.area=k,K.Audio=function(e){K.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.isPlaying=!1},K.Audio.prototype=Object.create(K.Object3D.prototype),K.Audio.prototype.constructor=K.Audio,K.Audio.prototype.load=function(e){var t=this,i=new XMLHttpRequest;return i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(e){t.context.decodeAudioData(this.response,(function(e){t.source.buffer=e,t.autoplay&&t.play()}))},i.send(),this},K.Audio.prototype.play=function(){if(!0!==this.isPlaying){var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.connect(this.panner),e.start(0,this.startTime),this.isPlaying=!0,this.source=e}else K.warn("THREE.Audio: Audio is already playing.")},K.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},K.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},K.Audio.prototype.onEnded=function(){this.isPlaying=!1},K.Audio.prototype.setLoop=function(e){this.source.loop=e},K.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},K.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},K.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},K.Audio.prototype.updateMatrixWorld=function(){var e=new K.Vector3;return function(t){K.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),K.AudioListener=function(){K.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},K.AudioListener.prototype=Object.create(K.Object3D.prototype),K.AudioListener.prototype.constructor=K.AudioListener,K.AudioListener.prototype.updateMatrixWorld=function(){var e=new K.Vector3,t=new K.Quaternion,i=new K.Vector3,n=new K.Vector3,r=new K.Vector3,o=new K.Vector3;return function(s){K.Object3D.prototype.updateMatrixWorld.call(this,s);var a=this.context.listener,l=this.up;this.matrixWorld.decompose(e,t,i),n.set(0,0,-1).applyQuaternion(t),r.subVectors(e,o),a.setPosition(e.x,e.y,e.z),a.setOrientation(n.x,n.y,n.z,l.x,l.y,l.z),a.setVelocity(r.x,r.y,r.z),o.copy(e)}}(),K.Curve=function(){},K.Curve.prototype.getPoint=function(e){return K.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},K.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},K.Curve.prototype.getPoints=function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPoint(t/e));return i},K.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,i=[];for(t=0;t<=e;t++)i.push(this.getPointAt(t/e));return i},K.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},K.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,n=[],r=this.getPoint(0),o=0;for(n.push(0),i=1;i<=e;i++)o+=(t=this.getPoint(i/e)).distanceTo(r),n.push(o),r=t;return this.cacheArcLengths=n,n},K.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},K.Curve.prototype.getUtoTmapping=function(e,t){var i,n=this.getLengths(),r=0,o=n.length;i=t||e*n[o-1];for(var s,a=0,l=o-1;a<=l;)if((s=n[r=Math.floor(a+(l-a)/2)]-i)<0)a=r+1;else{if(!(s>0)){l=r;break}l=r-1}if(n[r=l]==i)return r/(o-1);var c=n[r];return(r+(i-c)/(n[r+1]-c))/(o-1)},K.Curve.prototype.getTangent=function(e){var t=1e-4,i=e-t,n=e+t;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i);return this.getPoint(n).clone().sub(r).normalize()},K.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},K.Curve.Utils={tangentQuadraticBezier:function(e,t,i,n){return 2*(1-e)*(i-t)+2*e*(n-i)},tangentCubicBezier:function(e,t,i,n,r){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*n*(1-e)-3*e*e*n+3*e*e*r},tangentSpline:function(e,t,i,n,r){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,i,n,r){var o=.5*(i-e),s=.5*(n-t),a=r*r;return(2*t-2*i+o+s)*(r*a)+(-3*t+3*i-2*o-s)*a+o*r+t}},K.Curve.create=function(e,t){return e.prototype=Object.create(K.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},K.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},K.CurvePath.prototype=Object.create(K.Curve.prototype),K.CurvePath.prototype.constructor=K.CurvePath,K.CurvePath.prototype.add=function(e){this.curves.push(e)},K.CurvePath.prototype.checkConnection=function(){},K.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new K.LineCurve(t,e))},K.CurvePath.prototype.getPoint=function(e){for(var t,i=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=i){var o=1-(n[r]-i)/(t=this.curves[r]).getLength();return t.getPointAt(o)}r++}return null},K.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},K.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e,t=[],i=0,n=this.curves.length;for(e=0;e<n;e++)i+=this.curves[e].getLength(),t.push(i);return this.cacheLengths=t,t},K.CurvePath.prototype.getBoundingBox=function(){var e,t,i,n,r,o,s,a,l,c,h=this.getPoints();e=t=Number.NEGATIVE_INFINITY,n=r=Number.POSITIVE_INFINITY;var u=h[0]instanceof K.Vector3;for(c=u?new K.Vector3:new K.Vector2,a=0,l=h.length;a<l;a++)(s=h[a]).x>e?e=s.x:s.x<n&&(n=s.x),s.y>t?t=s.y:s.y<r&&(r=s.y),u&&(s.z>i?i=s.z:s.z<o&&(o=s.z)),c.add(s);var d={minX:n,minY:r,maxX:e,maxY:t};return u&&(d.maxZ=i,d.minZ=o),d},K.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,!0);return this.createGeometry(t)},K.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,!0);return this.createGeometry(t)},K.CurvePath.prototype.createGeometry=function(e){for(var t=new K.Geometry,i=0;i<e.length;i++)t.vertices.push(new K.Vector3(e[i].x,e[i].y,e[i].z||0));return t},K.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)},K.CurvePath.prototype.getTransformedPoints=function(e,t){var i,n,r=this.getPoints(e);for(t||(t=this.bends),i=0,n=t.length;i<n;i++)r=this.getWrapPoints(r,t[i]);return r},K.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var i,n,r=this.getSpacedPoints(e);for(t||(t=this.bends),i=0,n=t.length;i<n;i++)r=this.getWrapPoints(r,t[i]);return r},K.CurvePath.prototype.getWrapPoints=function(e,t){var i,n,r,o,s,a,l=this.getBoundingBox();for(i=0,n=e.length;i<n;i++){o=(r=e[i]).x,s=r.y,a=o/l.maxX,a=t.getUtoTmapping(a,o);var c=t.getPoint(a),h=t.getTangent(a);h.set(-h.y,h.x).multiplyScalar(s),r.x=c.x+h.x,r.y=c.y+h.y}return e},K.Gyroscope=function(){K.Object3D.call(this)},K.Gyroscope.prototype=Object.create(K.Object3D.prototype),K.Gyroscope.prototype.constructor=K.Gyroscope,K.Gyroscope.prototype.updateMatrixWorld=(G=new K.Vector3,z=new K.Quaternion,H=new K.Vector3,W=new K.Vector3,j=new K.Quaternion,q=new K.Vector3,function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(W,j,q),this.matrix.decompose(G,z,H),this.matrixWorld.compose(W,z,q)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)}),K.Path=function(e){K.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},K.Path.prototype=Object.create(K.CurvePath.prototype),K.Path.prototype.constructor=K.Path,K.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},K.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y)},K.Path.prototype.moveTo=function(e,t){var i=Array.prototype.slice.call(arguments);this.actions.push({action:K.PathActions.MOVE_TO,args:i})},K.Path.prototype.lineTo=function(e,t){var i=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,r=n[n.length-2],o=n[n.length-1],s=new K.LineCurve(new K.Vector2(r,o),new K.Vector2(e,t));this.curves.push(s),this.actions.push({action:K.PathActions.LINE_TO,args:i})},K.Path.prototype.quadraticCurveTo=function(e,t,i,n){var r=Array.prototype.slice.call(arguments),o=this.actions[this.actions.length-1].args,s=o[o.length-2],a=o[o.length-1],l=new K.QuadraticBezierCurve(new K.Vector2(s,a),new K.Vector2(e,t),new K.Vector2(i,n));this.curves.push(l),this.actions.push({action:K.PathActions.QUADRATIC_CURVE_TO,args:r})},K.Path.prototype.bezierCurveTo=function(e,t,i,n,r,o){var s=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args,l=a[a.length-2],c=a[a.length-1],h=new K.CubicBezierCurve(new K.Vector2(l,c),new K.Vector2(e,t),new K.Vector2(i,n),new K.Vector2(r,o));this.curves.push(h),this.actions.push({action:K.PathActions.BEZIER_CURVE_TO,args:s})},K.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,n=i[i.length-2],r=i[i.length-1],o=[new K.Vector2(n,r)];Array.prototype.push.apply(o,e);var s=new K.SplineCurve(o);this.curves.push(s),this.actions.push({action:K.PathActions.CSPLINE_THRU,args:t})},K.Path.prototype.arc=function(e,t,i,n,r,o){var s=this.actions[this.actions.length-1].args,a=s[s.length-2],l=s[s.length-1];this.absarc(e+a,t+l,i,n,r,o)},K.Path.prototype.absarc=function(e,t,i,n,r,o){this.absellipse(e,t,i,i,n,r,o)},K.Path.prototype.ellipse=function(e,t,i,n,r,o,s){var a=this.actions[this.actions.length-1].args,l=a[a.length-2],c=a[a.length-1];this.absellipse(e+l,t+c,i,n,r,o,s)},K.Path.prototype.absellipse=function(e,t,i,n,r,o,s){var a=Array.prototype.slice.call(arguments),l=new K.EllipseCurve(e,t,i,n,r,o,s);this.curves.push(l);var c=l.getPoint(1);a.push(c.x),a.push(c.y),this.actions.push({action:K.PathActions.ELLIPSE,args:a})},K.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);for(var i=[],n=0;n<e;n++)i.push(this.getPoint(n/e));return i},K.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(e,t);e=e||12;var i,n,r,o,s,a,l,c,h,u,d,f,p,m,g,v,y,b,x=[];for(i=0,n=this.actions.length;i<n;i++)switch(o=(r=this.actions[i]).action,s=r.args,o){case K.PathActions.MOVE_TO:case K.PathActions.LINE_TO:x.push(new K.Vector2(s[0],s[1]));break;case K.PathActions.QUADRATIC_CURVE_TO:for(a=s[2],l=s[3],u=s[0],d=s[1],x.length>0?(f=(m=x[x.length-1]).x,p=m.y):(f=(m=this.actions[i-1].args)[m.length-2],p=m[m.length-1]),g=1;g<=e;g++)v=g/e,y=K.Shape.Utils.b2(v,f,u,a),b=K.Shape.Utils.b2(v,p,d,l),x.push(new K.Vector2(y,b));break;case K.PathActions.BEZIER_CURVE_TO:for(a=s[4],l=s[5],u=s[0],d=s[1],c=s[2],h=s[3],x.length>0?(f=(m=x[x.length-1]).x,p=m.y):(f=(m=this.actions[i-1].args)[m.length-2],p=m[m.length-1]),g=1;g<=e;g++)v=g/e,y=K.Shape.Utils.b3(v,f,u,c,a),b=K.Shape.Utils.b3(v,p,d,h,l),x.push(new K.Vector2(y,b));break;case K.PathActions.CSPLINE_THRU:m=this.actions[i-1].args;var _=[new K.Vector2(m[m.length-2],m[m.length-1])],E=e*s[0].length;_=_.concat(s[0]);var S=new K.SplineCurve(_);for(g=1;g<=E;g++)x.push(S.getPointAt(g/E));break;case K.PathActions.ARC:var A=s[0],w=s[1],T=s[2],M=s[3],C=s[4],P=!!s[5],D=C-M,L=2*e;for(g=1;g<=L;g++)v=g/L,P||(v=1-v),I=M+v*D,y=A+T*Math.cos(I),b=w+T*Math.sin(I),x.push(new K.Vector2(y,b));break;case K.PathActions.ELLIPSE:A=s[0],w=s[1];var I,R=s[2],O=s[3];M=s[4],C=s[5],P=!!s[6],D=C-M,L=2*e;for(g=1;g<=L;g++)v=g/L,P||(v=1-v),I=M+v*D,y=A+R*Math.cos(I),b=w+O*Math.sin(I),x.push(new K.Vector2(y,b))}var N=x[x.length-1];return Math.abs(N.x-x[0].x)<1e-10&&Math.abs(N.y-x[0].y)<1e-10&&x.splice(x.length-1,1),t&&x.push(x[0]),x},K.Path.prototype.toShapes=function(e,t){function i(e){for(var t=[],i=0,n=e.length;i<n;i++){var r=e[i],o=new K.Shape;o.actions=r.actions,o.curves=r.curves,t.push(o)}return t}function n(e,t){for(var i=t.length,n=!1,r=i-1,o=0;o<i;r=o++){var s=t[r],a=t[o],l=a.x-s.x,c=a.y-s.y;if(Math.abs(c)>1e-10){if(c<0&&(s=t[o],l=-l,a=t[r],c=-c),e.y<s.y||e.y>a.y)continue;if(e.y==s.y){if(e.x==s.x)return!0}else{var h=c*(e.x-s.x)-l*(e.y-s.y);if(0==h)return!0;if(h<0)continue;n=!n}}else{if(e.y!=s.y)continue;if(a.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=a.x)return!0}}return n}var r=function(e){var t,i,n,r,o,s=[],a=new K.Path;for(t=0,i=e.length;t<i;t++)o=(n=e[t]).args,(r=n.action)==K.PathActions.MOVE_TO&&0!=a.actions.length&&(s.push(a),a=new K.Path),a[r].apply(a,o);return 0!=a.actions.length&&s.push(a),s}(this.actions);if(0==r.length)return[];if(!0===t)return i(r);var o,s,a,l=[];if(1==r.length)return s=r[0],(a=new K.Shape).actions=s.actions,a.curves=s.curves,l.push(a),l;var c=!K.Shape.Utils.isClockWise(r[0].getPoints());c=e?!c:c;var h,u,d,f,p,m,g=[],v=[],y=[],b=0;for(v[b]=void 0,y[b]=[],u=0,d=r.length;u<d;u++)h=(s=r[u]).getPoints(),o=K.Shape.Utils.isClockWise(h),(o=e?!o:o)?(!c&&v[b]&&b++,v[b]={s:new K.Shape,p:h},v[b].s.actions=s.actions,v[b].s.curves=s.curves,c&&b++,y[b]=[]):y[b].push({h:s,p:h[0]});if(!v[0])return i(r);if(v.length>1){for(var x=!1,_=[],E=0,S=v.length;E<S;E++)g[E]=[];for(E=0,S=v.length;E<S;E++)for(var A=y[E],w=0;w<A.length;w++){for(var T=A[w],M=!0,C=0;C<v.length;C++)n(T.p,v[C].p)&&(E!=C&&_.push({froms:E,tos:C,hole:w}),M?(M=!1,g[C].push(T)):x=!0);M&&g[E].push(T)}_.length>0&&(x||(y=g))}for(u=0,d=v.length;u<d;u++)for(a=v[u].s,l.push(a),p=0,m=(f=y[u]).length;p<m;p++)a.holes.push(f[p].h);return l},K.Shape=function(){K.Path.apply(this,arguments),this.holes=[]},K.Shape.prototype=Object.create(K.Path.prototype),K.Shape.prototype.constructor=K.Shape,K.Shape.prototype.extrude=function(e){return new K.ExtrudeGeometry(this,e)},K.Shape.prototype.makeGeometry=function(e){return new K.ShapeGeometry(this,e)},K.Shape.prototype.getPointsHoles=function(e){var t,i=this.holes.length,n=[];for(t=0;t<i;t++)n[t]=this.holes[t].getTransformedPoints(e,this.bends);return n},K.Shape.prototype.getSpacedPointsHoles=function(e){var t,i=this.holes.length,n=[];for(t=0;t<i;t++)n[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return n},K.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},K.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},K.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},K.Shape.Utils={triangulateShape:function(e,t){function i(e,t,i){return e.x!=t.x?e.x<t.x?e.x<=i.x&&i.x<=t.x:t.x<=i.x&&i.x<=e.x:e.y<t.y?e.y<=i.y&&i.y<=t.y:t.y<=i.y&&i.y<=e.y}function n(e,t,n,r,o){var s=t.x-e.x,a=t.y-e.y,l=r.x-n.x,c=r.y-n.y,h=e.x-n.x,u=e.y-n.y,d=a*l-s*c,f=a*h-s*u;if(Math.abs(d)>1e-10){var p;if(d>0){if(f<0||f>d)return[];if((p=c*h-l*u)<0||p>d)return[]}else{if(f>0||f<d)return[];if((p=c*h-l*u)>0||p<d)return[]}if(0==p)return!o||0!=f&&f!=d?[e]:[];if(p==d)return!o||0!=f&&f!=d?[t]:[];if(0==f)return[n];if(f==d)return[r];var m=p/d;return[{x:e.x+m*s,y:e.y+m*a}]}if(0!=f||c*h!=l*u)return[];var g,v,y,b,x,_,E,S,A=0==s&&0==a,w=0==l&&0==c;return A&&w?e.x!=n.x||e.y!=n.y?[]:[e]:A?i(n,r,e)?[e]:[]:w?i(e,t,n)?[n]:[]:(0!=s?(e.x<t.x?(g=e,y=e.x,v=t,b=t.x):(g=t,y=t.x,v=e,b=e.x),n.x<r.x?(x=n,E=n.x,_=r,S=r.x):(x=r,E=r.x,_=n,S=n.x)):(e.y<t.y?(g=e,y=e.y,v=t,b=t.y):(g=t,y=t.y,v=e,b=e.y),n.y<r.y?(x=n,E=n.y,_=r,S=r.y):(x=r,E=r.y,_=n,S=n.y)),y<=E?b<E?[]:b==E?o?[]:[x]:b<=S?[x,v]:[x,_]:y>S?[]:y==S?o?[]:[g]:b<=S?[g,v]:[g,_])}function r(e,t,i,n){var r=t.x-e.x,o=t.y-e.y,s=i.x-e.x,a=i.y-e.y,l=n.x-e.x,c=n.y-e.y,h=r*a-o*s,u=r*c-o*l;if(Math.abs(h)>1e-10){var d=l*a-c*s;return h>0?u>=0&&d>=0:u>=0||d>=0}return u>0}for(var o,s,a,l,c,h,u={},d=e.concat(),f=0,p=t.length;f<p;f++)Array.prototype.push.apply(d,t[f]);for(o=0,s=d.length;o<s;o++)void 0!==u[c=d[o].x+":"+d[o].y]&&K.warn("THREE.Shape: Duplicate point",c),u[c]=o;var m=function(e,t){var i,o=e.concat();function s(e,t){var n=o.length-1,s=e-1;s<0&&(s=n);var a=e+1;a>n&&(a=0);var l=r(o[e],o[s],o[a],i[t]);if(!l)return!1;var c=i.length-1,h=t-1;h<0&&(h=c);var u=t+1;return u>c&&(u=0),!!(l=r(i[t],i[h],i[u],o[e]))}function a(e,t){var i,r;for(i=0;i<o.length;i++)if(r=i+1,r%=o.length,n(e,t,o[i],o[r],!0).length>0)return!0;return!1}var l=[];function c(e,i){var r,o,s,a;for(r=0;r<l.length;r++)for(o=t[l[r]],s=0;s<o.length;s++)if(a=s+1,a%=o.length,n(e,i,o[s],o[a],!0).length>0)return!0;return!1}for(var h,u,d,f,p,m,g,v,y,b,x=[],_=0,E=t.length;_<E;_++)l.push(_);for(var S=0,A=2*l.length;l.length>0;){if(--A<0){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(u=S;u<o.length;u++){d=o[u],h=-1;for(_=0;_<l.length;_++)if(p=l[_],void 0===x[m=d.x+":"+d.y+":"+p]){i=t[p];for(var w=0;w<i.length;w++)if(f=i[w],s(u,w)&&!a(d,f)&&!c(d,f)){h=w,l.splice(_,1),g=o.slice(0,u+1),v=o.slice(u),y=i.slice(h),b=i.slice(0,h+1),o=g.concat(y).concat(b).concat(v),S=u;break}if(h>=0)break;x[m]=!0}if(h>=0)break}}return o}(e,t),g=K.FontUtils.Triangulate(m,!1);for(o=0,s=g.length;o<s;o++)for(l=g[o],a=0;a<3;a++)void 0!==(h=u[c=l[a].x+":"+l[a].y])&&(l[a]=h);return g.concat()},isClockWise:function(e){return K.FontUtils.Triangulate.area(e)<0},b2p0:function(e,t){var i=1-e;return i*i*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,i,n){return this.b2p0(e,t)+this.b2p1(e,i)+this.b2p2(e,n)},b3p0:function(e,t){var i=1-e;return i*i*i*t},b3p1:function(e,t){var i=1-e;return 3*i*i*e*t},b3p2:function(e,t){return 3*(1-e)*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,i,n,r){return this.b3p0(e,t)+this.b3p1(e,i)+this.b3p2(e,n)+this.b3p3(e,r)}},K.LineCurve=function(e,t){this.v1=e,this.v2=t},K.LineCurve.prototype=Object.create(K.Curve.prototype),K.LineCurve.prototype.constructor=K.LineCurve,K.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},K.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},K.LineCurve.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},K.QuadraticBezierCurve=function(e,t,i){this.v0=e,this.v1=t,this.v2=i},K.QuadraticBezierCurve.prototype=Object.create(K.Curve.prototype),K.QuadraticBezierCurve.prototype.constructor=K.QuadraticBezierCurve,K.QuadraticBezierCurve.prototype.getPoint=function(e){var t=new K.Vector2;return t.x=K.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=K.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t},K.QuadraticBezierCurve.prototype.getTangent=function(e){var t=new K.Vector2;return t.x=K.Curve.Utils.tangentQuadraticBezier(e,this.v0.x,this.v1.x,this.v2.x),t.y=K.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y),t.normalize()},K.CubicBezierCurve=function(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n},K.CubicBezierCurve.prototype=Object.create(K.Curve.prototype),K.CubicBezierCurve.prototype.constructor=K.CubicBezierCurve,K.CubicBezierCurve.prototype.getPoint=function(e){var t,i;return t=K.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),i=K.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new K.Vector2(t,i)},K.CubicBezierCurve.prototype.getTangent=function(e){var t,i;t=K.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),i=K.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var n=new K.Vector2(t,i);return n.normalize(),n},K.SplineCurve=function(e){this.points=null==e?[]:e},K.SplineCurve.prototype=Object.create(K.Curve.prototype),K.SplineCurve.prototype.constructor=K.SplineCurve,K.SplineCurve.prototype.getPoint=function(e){var t=this.points,i=(t.length-1)*e,n=Math.floor(i),r=i-n,o=t[0==n?n:n-1],s=t[n],a=t[n>t.length-2?t.length-1:n+1],l=t[n>t.length-3?t.length-1:n+2],c=new K.Vector2;return c.x=K.Curve.Utils.interpolate(o.x,s.x,a.x,l.x,r),c.y=K.Curve.Utils.interpolate(o.y,s.y,a.y,l.y,r),c},K.EllipseCurve=function(e,t,i,n,r,o,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s},K.EllipseCurve.prototype=Object.create(K.Curve.prototype),K.EllipseCurve.prototype.constructor=K.EllipseCurve,K.EllipseCurve.prototype.getPoint=function(e){var t,i=this.aEndAngle-this.aStartAngle;i<0&&(i+=2*Math.PI),i>2*Math.PI&&(i-=2*Math.PI),t=!0===this.aClockwise?this.aEndAngle+(1-e)*(2*Math.PI-i):this.aStartAngle+e*i;var n=new K.Vector2;return n.x=this.aX+this.xRadius*Math.cos(t),n.y=this.aY+this.yRadius*Math.sin(t),n},K.ArcCurve=function(e,t,i,n,r,o){K.EllipseCurve.call(this,e,t,i,i,n,r,o)},K.ArcCurve.prototype=Object.create(K.EllipseCurve.prototype),K.ArcCurve.prototype.constructor=K.ArcCurve,K.LineCurve3=K.Curve.create((function(e,t){this.v1=e,this.v2=t}),(function(e){var t=new K.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t})),K.QuadraticBezierCurve3=K.Curve.create((function(e,t,i){this.v0=e,this.v1=t,this.v2=i}),(function(e){var t=new K.Vector3;return t.x=K.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=K.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t.z=K.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),t})),K.CubicBezierCurve3=K.Curve.create((function(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n}),(function(e){var t=new K.Vector3;return t.x=K.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t.y=K.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t.z=K.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),t})),K.SplineCurve3=K.Curve.create((function(e){this.points=null==e?[]:e}),(function(e){var t=this.points,i=(t.length-1)*e,n=Math.floor(i),r=i-n,o=t[0==n?n:n-1],s=t[n],a=t[n>t.length-2?t.length-1:n+1],l=t[n>t.length-3?t.length-1:n+2],c=new K.Vector3;return c.x=K.Curve.Utils.interpolate(o.x,s.x,a.x,l.x,r),c.y=K.Curve.Utils.interpolate(o.y,s.y,a.y,l.y,r),c.z=K.Curve.Utils.interpolate(o.z,s.z,a.z,l.z,r),c})),K.ClosedSplineCurve3=K.Curve.create((function(e){this.points=null==e?[]:e}),(function(e){var t=this.points,i=(t.length-0)*e,n=Math.floor(i),r=i-n,o=t[((n+=n>0?0:(Math.floor(Math.abs(n)/t.length)+1)*t.length)-1)%t.length],s=t[n%t.length],a=t[(n+1)%t.length],l=t[(n+2)%t.length],c=new K.Vector3;return c.x=K.Curve.Utils.interpolate(o.x,s.x,a.x,l.x,r),c.y=K.Curve.Utils.interpolate(o.y,s.y,a.y,l.y,r),c.z=K.Curve.Utils.interpolate(o.z,s.z,a.z,l.z,r),c})),K.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){K.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){K.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){K.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(e){if(!0===e.initialized)return e;for(var t=0;t<e.hierarchy.length;t++){for(var i=0;i<e.hierarchy[t].keys.length;i++)if(e.hierarchy[t].keys[i].time<0&&(e.hierarchy[t].keys[i].time=0),void 0!==e.hierarchy[t].keys[i].rot&&!(e.hierarchy[t].keys[i].rot instanceof K.Quaternion)){var n=e.hierarchy[t].keys[i].rot;e.hierarchy[t].keys[i].rot=(new K.Quaternion).fromArray(n)}if(e.hierarchy[t].keys.length&&void 0!==e.hierarchy[t].keys[0].morphTargets){var r={};for(i=0;i<e.hierarchy[t].keys.length;i++)for(var o=0;o<e.hierarchy[t].keys[i].morphTargets.length;o++){r[a=e.hierarchy[t].keys[i].morphTargets[o]]=-1}e.hierarchy[t].usedMorphTargets=r;for(i=0;i<e.hierarchy[t].keys.length;i++){var s={};for(var a in r){for(o=0;o<e.hierarchy[t].keys[i].morphTargets.length;o++)if(e.hierarchy[t].keys[i].morphTargets[o]===a){s[a]=e.hierarchy[t].keys[i].morphTargetsInfluences[o];break}o===e.hierarchy[t].keys[i].morphTargets.length&&(s[a]=0)}e.hierarchy[t].keys[i].morphTargetsInfluences=s}}for(i=1;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].time===e.hierarchy[t].keys[i-1].time&&(e.hierarchy[t].keys.splice(i,1),i--);for(i=0;i<e.hierarchy[t].keys.length;i++)e.hierarchy[t].keys[i].index=i}return e.initialized=!0,e},parse:function(e){var t=function(e,i){i.push(e);for(var n=0;n<e.children.length;n++)t(e.children[n],i)},i=[];if(e instanceof K.SkinnedMesh)for(var n=0;n<e.skeleton.bones.length;n++)i.push(e.skeleton.bones[n]);else t(e,i);return i},play:function(e){-1===this.animations.indexOf(e)&&this.animations.push(e)},stop:function(e){var t=this.animations.indexOf(e);-1!==t&&this.animations.splice(t,1)},update:function(e){for(var t=0;t<this.animations.length;t++)this.animations[t].resetBlendWeights();for(t=0;t<this.animations.length;t++)this.animations[t].update(e)}},K.Animation=function(e,t){this.root=e,this.data=K.AnimationHandler.init(t),this.hierarchy=K.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=!0,this.weight=0,this.interpolationType=K.AnimationHandler.LINEAR},K.Animation.prototype={constructor:K.Animation,keyTypes:["pos","rot","scl"],play:function(e,t){this.currentTime=void 0!==e?e:0,this.weight=void 0!==t?t:1,this.isPlaying=!0,this.reset(),K.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,K.AnimationHandler.stop(this)},reset:function(){for(var e=0,t=this.hierarchy.length;e<t;e++){var i=this.hierarchy[e];void 0===i.animationCache&&(i.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var n=this.data.name,r=i.animationCache.animations,o=r[n];void 0===o&&(o={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:i.matrix},r[n]=o);for(var s=0;s<3;s++){for(var a=this.keyTypes[s],l=this.data.hierarchy[e].keys[0],c=this.getNextKeyWith(a,e,1);c.time<this.currentTime&&c.index>l.index;)l=c,c=this.getNextKeyWith(a,e,c.index+1);o.prevKey[a]=l,o.nextKey[a]=c}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;e<t;e++){var i=this.hierarchy[e].animationCache;if(void 0!==i){var n=i.blending;n.positionWeight=0,n.quaternionWeight=0,n.scaleWeight=0}}},update:function(){var e=[],t=new K.Vector3,i=new K.Vector3,n=new K.Quaternion,r=function(e,t){var i,n,r,s,a,l,c,h,u,d=[],f=[];return r=(i=(e.length-1)*t)-(n=Math.floor(i)),d[0]=0===n?n:n-1,d[1]=n,d[2]=n>e.length-2?n:n+1,d[3]=n>e.length-3?n:n+2,l=e[d[0]],c=e[d[1]],h=e[d[2]],u=e[d[3]],a=r*(s=r*r),f[0]=o(l[0],c[0],h[0],u[0],r,s,a),f[1]=o(l[1],c[1],h[1],u[1],r,s,a),f[2]=o(l[2],c[2],h[2],u[2],r,s,a),f},o=function(e,t,i,n,r,o,s){var a=.5*(i-e),l=.5*(n-t);return(2*(t-i)+a+l)*s+(-3*(t-i)-2*a-l)*o+a*r+t};return function(o){if(!1!==this.isPlaying&&(this.currentTime+=o*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var a=0,l=this.hierarchy.length;a<l;a++)for(var c=this.hierarchy[a],h=c.animationCache.animations[this.data.name],u=c.animationCache.blending,d=0;d<3;d++){var f=this.keyTypes[d],p=h.prevKey[f],m=h.nextKey[f];if(this.timeScale>0&&m.time<=this.currentTime||this.timeScale<0&&p.time>=this.currentTime){for(p=this.data.hierarchy[a].keys[0],m=this.getNextKeyWith(f,a,1);m.time<this.currentTime&&m.index>p.index;)p=m,m=this.getNextKeyWith(f,a,m.index+1);h.prevKey[f]=p,h.nextKey[f]=m}var g=(this.currentTime-p.time)/(m.time-p.time),v=p[f],y=m[f];if(g<0&&(g=0),g>1&&(g=1),"pos"===f){if(this.interpolationType===K.AnimationHandler.LINEAR){i.x=v[0]+(y[0]-v[0])*g,i.y=v[1]+(y[1]-v[1])*g,i.z=v[2]+(y[2]-v[2])*g;var b=this.weight/(this.weight+u.positionWeight);c.position.lerp(i,b),u.positionWeight+=this.weight}else if(this.interpolationType===K.AnimationHandler.CATMULLROM||this.interpolationType===K.AnimationHandler.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",a,p.index-1).pos,e[1]=v,e[2]=y,e[3]=this.getNextKeyWith("pos",a,m.index+1).pos;var x=r(e,g=.33*g+.33);b=this.weight/(this.weight+u.positionWeight);u.positionWeight+=this.weight;var _=c.position;if(_.x=_.x+(x[0]-_.x)*b,_.y=_.y+(x[1]-_.y)*b,_.z=_.z+(x[2]-_.z)*b,this.interpolationType===K.AnimationHandler.CATMULLROM_FORWARD){var E=r(e,1.01*g);t.set(E[0],E[1],E[2]),t.sub(_),t.y=0,t.normalize();var S=Math.atan2(t.x,t.z);c.rotation.set(0,S,0)}}}else if("rot"===f)if(K.Quaternion.slerp(v,y,n,g),0===u.quaternionWeight)c.quaternion.copy(n),u.quaternionWeight=this.weight;else{b=this.weight/(this.weight+u.quaternionWeight);K.Quaternion.slerp(c.quaternion,n,c.quaternion,b),u.quaternionWeight+=this.weight}else if("scl"===f){i.x=v[0]+(y[0]-v[0])*g,i.y=v[1]+(y[1]-v[1])*g,i.z=v[2]+(y[2]-v[2])*g;b=this.weight/(this.weight+u.scaleWeight);c.scale.lerp(i,b),u.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(e,t,i){var n=this.data.hierarchy[t].keys;for(this.interpolationType===K.AnimationHandler.CATMULLROM||this.interpolationType===K.AnimationHandler.CATMULLROM_FORWARD?i=i<n.length-1?i:n.length-1:i%=n.length;i<n.length;i++)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[0]},getPrevKeyWith:function(e,t,i){var n=this.data.hierarchy[t].keys;for(i=this.interpolationType===K.AnimationHandler.CATMULLROM||this.interpolationType===K.AnimationHandler.CATMULLROM_FORWARD?i>0?i:0:i>=0?i:i+n.length;i>=0;i--)if(void 0!==n[i][e])return n[i];return this.data.hierarchy[t].keys[n.length-1]}},K.KeyFrameAnimation=function(e){this.root=e.node,this.data=K.AnimationHandler.init(e),this.hierarchy=K.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var t=0,i=this.hierarchy.length;t<i;t++){var n=this.data.hierarchy[t].keys,r=this.data.hierarchy[t].sids,o=this.hierarchy[t];if(n.length&&r){for(var s=0;s<r.length;s++){var a=r[s],l=this.getNextKeyWith(a,t,0);l&&l.apply(a)}o.matrixAutoUpdate=!1,this.data.hierarchy[t].node.updateMatrix(),o.matrixWorldNeedsUpdate=!0}}},K.KeyFrameAnimation.prototype={constructor:K.KeyFrameAnimation,play:function(e){if(this.currentTime=void 0!==e?e:0,!1===this.isPlaying){this.isPlaying=!0;var t,i,n,r=this.hierarchy.length;for(t=0;t<r;t++){i=this.hierarchy[t],void 0===(n=this.data.hierarchy[t]).animationCache&&(n.animationCache={},n.animationCache.prevKey=null,n.animationCache.nextKey=null,n.animationCache.originalMatrix=i.matrix);var o=this.data.hierarchy[t].keys;o.length&&(n.animationCache.prevKey=o[0],n.animationCache.nextKey=o[1],this.startTime=Math.min(o[0].time,this.startTime),this.endTime=Math.max(o[o.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,K.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,this.isPaused=!1,K.AnimationHandler.stop(this);for(var e=0;e<this.data.hierarchy.length;e++){var t=this.hierarchy[e],i=this.data.hierarchy[e];if(void 0!==i.animationCache){var n=i.animationCache.originalMatrix;n.copy(t.matrix),t.matrix=n,delete i.animationCache}}},update:function(e){if(!1!==this.isPlaying){this.currentTime+=e*this.timeScale;var t=this.data.length;!0===this.loop&&this.currentTime>t&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var i=0,n=this.hierarchy.length;i<n;i++){var r=this.hierarchy[i],o=this.data.hierarchy[i],s=o.keys,a=o.animationCache;if(s.length){var l=a.prevKey,c=a.nextKey;if(c.time<=this.currentTime){for(;c.time<this.currentTime&&c.index>l.index;)c=s[(l=c).index+1];a.prevKey=l,a.nextKey=c}c.time>=this.currentTime?l.interpolate(c,this.currentTime):l.interpolate(c,c.time),this.data.hierarchy[i].node.updateMatrix(),r.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(e,t,i){var n=this.data.hierarchy[t].keys;for(i%=n.length;i<n.length;i++)if(n[i].hasTarget(e))return n[i];return n[0]},getPrevKeyWith:function(e,t,i){var n=this.data.hierarchy[t].keys;for(i=i>=0?i:i+n.length;i>=0;i--)if(n[i].hasTarget(e))return n[i];return n[n.length-1]}},K.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},K.MorphAnimation.prototype={constructor:K.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(!1!==this.isPlaying){this.currentTime+=e,!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,i=Math.floor(this.currentTime/t),n=this.mesh.morphTargetInfluences;i!=this.currentFrame&&(n[this.lastFrame]=0,n[this.currentFrame]=1,n[i]=0,this.lastFrame=this.currentFrame,this.currentFrame=i),n[i]=this.currentTime%t/t,n[this.lastFrame]=1-n[i]}}},K.BoxGeometry=function(e,t,i,n,r,o){K.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.widthSegments=n||1,this.heightSegments=r||1,this.depthSegments=o||1;var s=this,a=e/2,l=t/2,c=i/2;function h(e,t,i,n,r,o,a,l){var c,h,u,d=s.widthSegments,f=s.heightSegments,p=r/2,m=o/2,g=s.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?c="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(c="y",f=s.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(c="x",d=s.depthSegments);var v=d+1,y=f+1,b=r/d,x=o/f,_=new K.Vector3;for(_[c]=a>0?1:-1,u=0;u<y;u++)for(h=0;h<v;h++){var E=new K.Vector3;E[e]=(h*b-p)*i,E[t]=(u*x-m)*n,E[c]=a,s.vertices.push(E)}for(u=0;u<f;u++)for(h=0;h<d;h++){var S=h+v*u,A=h+v*(u+1),w=h+1+v*(u+1),T=h+1+v*u,M=new K.Vector2(h/d,1-u/f),C=new K.Vector2(h/d,1-(u+1)/f),P=new K.Vector2((h+1)/d,1-(u+1)/f),D=new K.Vector2((h+1)/d,1-u/f),L=new K.Face3(S+g,A+g,T+g);L.normal.copy(_),L.vertexNormals.push(_.clone(),_.clone(),_.clone()),L.materialIndex=l,s.faces.push(L),s.faceVertexUvs[0].push([M,C,D]),(L=new K.Face3(A+g,w+g,T+g)).normal.copy(_),L.vertexNormals.push(_.clone(),_.clone(),_.clone()),L.materialIndex=l,s.faces.push(L),s.faceVertexUvs[0].push([C.clone(),P,D.clone()])}}h("z","y",-1,-1,i,t,a,0),h("z","y",1,-1,i,t,-a,1),h("x","z",1,1,e,i,l,2),h("x","z",1,-1,e,i,-l,3),h("x","y",1,-1,e,t,c,4),h("x","y",-1,-1,e,t,-c,5),this.mergeVertices()},K.BoxGeometry.prototype=Object.create(K.Geometry.prototype),K.BoxGeometry.prototype.constructor=K.BoxGeometry,K.CircleGeometry=function(e,t,i,n){K.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},e=e||50,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,o=[],s=new K.Vector3,a=new K.Vector2(.5,.5);for(this.vertices.push(s),o.push(a),r=0;r<=t;r++){var l=new K.Vector3,c=i+r/t*n;l.x=e*Math.cos(c),l.y=e*Math.sin(c),this.vertices.push(l),o.push(new K.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}var h=new K.Vector3(0,0,1);for(r=1;r<=t;r++)this.faces.push(new K.Face3(r,r+1,0,[h.clone(),h.clone(),h.clone()])),this.faceVertexUvs[0].push([o[r].clone(),o[r+1].clone(),a.clone()]);this.computeFaceNormals(),this.boundingSphere=new K.Sphere(new K.Vector3,e)},K.CircleGeometry.prototype=Object.create(K.Geometry.prototype),K.CircleGeometry.prototype.constructor=K.CircleGeometry,K.CubeGeometry=function(e,t,i,n,r,o){return K.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new K.BoxGeometry(e,t,i,n,r,o)},K.CylinderGeometry=function(e,t,i,n,r,o,s,a){K.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a},e=void 0!==e?e:20,t=void 0!==t?t:20,i=void 0!==i?i:100,n=n||8,r=r||1,o=void 0!==o&&o,s=void 0!==s?s:0,a=void 0!==a?a:2*Math.PI;var l,c,h=i/2,u=[],d=[];for(c=0;c<=r;c++){var f=[],p=[],m=c/r,g=m*(t-e)+e;for(l=0;l<=n;l++){var v=l/n,y=new K.Vector3;y.x=g*Math.sin(v*a+s),y.y=-m*i+h,y.z=g*Math.cos(v*a+s),this.vertices.push(y),f.push(this.vertices.length-1),p.push(new K.Vector2(v,1-m))}u.push(f),d.push(p)}var b,x,_=(t-e)/i;for(l=0;l<n;l++)for(0!==e?(b=this.vertices[u[0][l]].clone(),x=this.vertices[u[0][l+1]].clone()):(b=this.vertices[u[1][l]].clone(),x=this.vertices[u[1][l+1]].clone()),b.setY(Math.sqrt(b.x*b.x+b.z*b.z)*_).normalize(),x.setY(Math.sqrt(x.x*x.x+x.z*x.z)*_).normalize(),c=0;c<r;c++){var E=u[c][l],S=u[c+1][l],A=u[c+1][l+1],w=u[c][l+1],T=b.clone(),M=b.clone(),C=x.clone(),P=x.clone(),D=d[c][l].clone(),L=d[c+1][l].clone(),I=d[c+1][l+1].clone(),R=d[c][l+1].clone();this.faces.push(new K.Face3(E,S,w,[T,M,P])),this.faceVertexUvs[0].push([D,L,R]),this.faces.push(new K.Face3(S,A,w,[M.clone(),C,P.clone()])),this.faceVertexUvs[0].push([L.clone(),I,R.clone()])}if(!1===o&&e>0)for(this.vertices.push(new K.Vector3(0,h,0)),l=0;l<n;l++){E=u[0][l],S=u[0][l+1],A=this.vertices.length-1,T=new K.Vector3(0,1,0),M=new K.Vector3(0,1,0),C=new K.Vector3(0,1,0),D=d[0][l].clone(),L=d[0][l+1].clone(),I=new K.Vector2(L.x,0);this.faces.push(new K.Face3(E,S,A,[T,M,C])),this.faceVertexUvs[0].push([D,L,I])}if(!1===o&&t>0)for(this.vertices.push(new K.Vector3(0,-h,0)),l=0;l<n;l++){E=u[r][l+1],S=u[r][l],A=this.vertices.length-1,T=new K.Vector3(0,-1,0),M=new K.Vector3(0,-1,0),C=new K.Vector3(0,-1,0),D=d[r][l+1].clone(),L=d[r][l].clone(),I=new K.Vector2(L.x,1);this.faces.push(new K.Face3(E,S,A,[T,M,C])),this.faceVertexUvs[0].push([D,L,I])}this.computeFaceNormals()},K.CylinderGeometry.prototype=Object.create(K.Geometry.prototype),K.CylinderGeometry.prototype.constructor=K.CylinderGeometry,K.ExtrudeGeometry=function(e,t){void 0!==e?(K.Geometry.call(this),this.type="ExtrudeGeometry",e=e instanceof Array?e:[e],this.addShapeList(e,t),this.computeFaceNormals()):e=[]},K.ExtrudeGeometry.prototype=Object.create(K.Geometry.prototype),K.ExtrudeGeometry.prototype.constructor=K.ExtrudeGeometry,K.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var i=e.length,n=0;n<i;n++){var r=e[n];this.addShape(r,t)}},K.ExtrudeGeometry.prototype.addShape=function(e,t){var i,n,r,o,s,a,l,c,h=void 0!==t.amount?t.amount:100,u=void 0!==t.bevelThickness?t.bevelThickness:6,d=void 0!==t.bevelSize?t.bevelSize:u-2,f=void 0!==t.bevelSegments?t.bevelSegments:3,p=void 0===t.bevelEnabled||t.bevelEnabled,m=void 0!==t.curveSegments?t.curveSegments:12,g=void 0!==t.steps?t.steps:1,v=t.extrudePath,y=!1,b=t.material,x=t.extrudeMaterial,_=void 0!==t.UVGenerator?t.UVGenerator:K.ExtrudeGeometry.WorldUVGenerator;v&&(i=v.getSpacedPoints(g),y=!0,p=!1,n=void 0!==t.frames?t.frames:new K.TubeGeometry.FrenetFrames(v,g,!1),r=new K.Vector3,o=new K.Vector3,s=new K.Vector3),p||(f=0,u=0,d=0);var E=this,S=this.vertices.length,A=e.extractPoints(m),w=A.shape,T=A.holes,M=!K.Shape.Utils.isClockWise(w);if(M){for(w=w.reverse(),l=0,c=T.length;l<c;l++)a=T[l],K.Shape.Utils.isClockWise(a)&&(T[l]=a.reverse());M=!1}var C=K.Shape.Utils.triangulateShape(w,T),P=w;for(l=0,c=T.length;l<c;l++)a=T[l],w=w.concat(a);function D(e,t,i){return t||K.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}var L,I,R,O,N,F,U=w.length,B=C.length;function k(e,t,i){var n,r,o=1e-10,s=1,a=e.x-t.x,l=e.y-t.y,c=i.x-e.x,h=i.y-e.y,u=a*a+l*l,d=a*h-l*c;if(Math.abs(d)>o){var f=Math.sqrt(u),p=Math.sqrt(c*c+h*h),m=t.x-l/f,g=t.y+a/f,v=((i.x-h/p-m)*h-(i.y+c/p-g)*c)/(a*h-l*c),y=(n=m+a*v-e.x)*n+(r=g+l*v-e.y)*r;if(y<=2)return new K.Vector2(n,r);s=Math.sqrt(y/2)}else{var b=!1;a>o?c>o&&(b=!0):a<-1e-10?c<-1e-10&&(b=!0):Math.sign(l)==Math.sign(h)&&(b=!0),b?(n=-l,r=a,s=Math.sqrt(u)):(n=a,r=l,s=Math.sqrt(u/2))}return new K.Vector2(n/s,r/s)}for(var V=[],G=0,z=P.length,H=z-1,W=G+1;G<z;G++,H++,W++)H===z&&(H=0),W===z&&(W=0),V[G]=k(P[G],P[H],P[W]);var j,q,X=[],Y=V.concat();for(l=0,c=T.length;l<c;l++){for(a=T[l],j=[],G=0,H=(z=a.length)-1,W=G+1;G<z;G++,H++,W++)H===z&&(H=0),W===z&&(W=0),j[G]=k(a[G],a[H],a[W]);X.push(j),Y=Y.concat(j)}for(L=0;L<f;L++){for(O=u*(1-(R=L/f)),I=d*Math.sin(R*Math.PI/2),G=0,z=P.length;G<z;G++)Z((N=D(P[G],V[G],I)).x,N.y,-O);for(l=0,c=T.length;l<c;l++)for(a=T[l],j=X[l],G=0,z=a.length;G<z;G++)Z((N=D(a[G],j[G],I)).x,N.y,-O)}for(I=d,G=0;G<U;G++)N=p?D(w[G],Y[G],I):w[G],y?(o.copy(n.normals[0]).multiplyScalar(N.x),r.copy(n.binormals[0]).multiplyScalar(N.y),s.copy(i[0]).add(o).add(r),Z(s.x,s.y,s.z)):Z(N.x,N.y,0);for(q=1;q<=g;q++)for(G=0;G<U;G++)N=p?D(w[G],Y[G],I):w[G],y?(o.copy(n.normals[q]).multiplyScalar(N.x),r.copy(n.binormals[q]).multiplyScalar(N.y),s.copy(i[q]).add(o).add(r),Z(s.x,s.y,s.z)):Z(N.x,N.y,h/g*q);for(L=f-1;L>=0;L--){for(O=u*(1-(R=L/f)),I=d*Math.sin(R*Math.PI/2),G=0,z=P.length;G<z;G++)Z((N=D(P[G],V[G],I)).x,N.y,h+O);for(l=0,c=T.length;l<c;l++)for(a=T[l],j=X[l],G=0,z=a.length;G<z;G++)N=D(a[G],j[G],I),y?Z(N.x,N.y+i[g-1].y,i[g-1].x+O):Z(N.x,N.y,h+O)}function Q(e,t){var i,n;for(G=e.length;--G>=0;){i=G,(n=G-1)<0&&(n=e.length-1);var r=0,o=g+2*f;for(r=0;r<o;r++){var s=U*r,a=U*(r+1);J(t+i+s,t+n+s,t+n+a,t+i+a,e,r,o,i,n)}}}function Z(e,t,i){E.vertices.push(new K.Vector3(e,t,i))}function $(e,t,i){e+=S,t+=S,i+=S,E.faces.push(new K.Face3(e,t,i,null,null,b));var n=_.generateTopUV(E,e,t,i);E.faceVertexUvs[0].push(n)}function J(e,t,i,n,r,o,s,a,l){e+=S,t+=S,i+=S,n+=S,E.faces.push(new K.Face3(e,t,n,null,null,x)),E.faces.push(new K.Face3(t,i,n,null,null,x));var c=_.generateSideWallUV(E,e,t,i,n);E.faceVertexUvs[0].push([c[0],c[1],c[3]]),E.faceVertexUvs[0].push([c[1],c[2],c[3]])}!function(){if(p){var e=0,t=U*e;for(G=0;G<B;G++)$((F=C[G])[2]+t,F[1]+t,F[0]+t);for(t=U*(e=g+2*f),G=0;G<B;G++)$((F=C[G])[0]+t,F[1]+t,F[2]+t)}else{for(G=0;G<B;G++)$((F=C[G])[2],F[1],F[0]);for(G=0;G<B;G++)$((F=C[G])[0]+U*g,F[1]+U*g,F[2]+U*g)}}(),function(){var e=0;for(Q(P,e),e+=P.length,l=0,c=T.length;l<c;l++)Q(a=T[l],e),e+=a.length}()},K.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,i,n){var r=e.vertices,o=r[t],s=r[i],a=r[n];return[new K.Vector2(o.x,o.y),new K.Vector2(s.x,s.y),new K.Vector2(a.x,a.y)]},generateSideWallUV:function(e,t,i,n,r){var o=e.vertices,s=o[t],a=o[i],l=o[n],c=o[r];return Math.abs(s.y-a.y)<.01?[new K.Vector2(s.x,1-s.z),new K.Vector2(a.x,1-a.z),new K.Vector2(l.x,1-l.z),new K.Vector2(c.x,1-c.z)]:[new K.Vector2(s.y,1-s.z),new K.Vector2(a.y,1-a.z),new K.Vector2(l.y,1-l.z),new K.Vector2(c.y,1-c.z)]}},K.ShapeGeometry=function(e,t){K.Geometry.call(this),this.type="ShapeGeometry",e instanceof Array==!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},K.ShapeGeometry.prototype=Object.create(K.Geometry.prototype),K.ShapeGeometry.prototype.constructor=K.ShapeGeometry,K.ShapeGeometry.prototype.addShapeList=function(e,t){for(var i=0,n=e.length;i<n;i++)this.addShape(e[i],t);return this},K.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var i,n,r,o=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,a=void 0===t.UVGenerator?K.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,l=this.vertices.length,c=e.extractPoints(o),h=c.shape,u=c.holes,d=!K.Shape.Utils.isClockWise(h);if(d){for(h=h.reverse(),i=0,n=u.length;i<n;i++)r=u[i],K.Shape.Utils.isClockWise(r)&&(u[i]=r.reverse());d=!1}var f=K.Shape.Utils.triangulateShape(h,u);for(i=0,n=u.length;i<n;i++)r=u[i],h=h.concat(r);var p,m,g=h.length,v=f.length;for(i=0;i<g;i++)p=h[i],this.vertices.push(new K.Vector3(p.x,p.y,0));for(i=0;i<v;i++){var y=(m=f[i])[0]+l,b=m[1]+l,x=m[2]+l;this.faces.push(new K.Face3(y,b,x,null,null,s)),this.faceVertexUvs[0].push(a.generateTopUV(this,y,b,x))}},K.LatheGeometry=function(e,t,i,n){K.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},t=t||12,i=i||0,n=n||2*Math.PI;for(var r=1/(e.length-1),o=1/t,s=0,a=t;s<=a;s++)for(var l=i+s*o*n,c=Math.cos(l),h=Math.sin(l),u=0,d=e.length;u<d;u++){var f=e[u],p=new K.Vector3;p.x=c*f.x-h*f.y,p.y=h*f.x+c*f.y,p.z=f.z,this.vertices.push(p)}var m=e.length;for(s=0,a=t;s<a;s++)for(u=0,d=e.length-1;u<d;u++){var g=u+m*s,v=g,y=g+m,b=(c=g+1+m,g+1),x=s*o,_=u*r,E=x+o,S=_+r;this.faces.push(new K.Face3(v,y,b)),this.faceVertexUvs[0].push([new K.Vector2(x,_),new K.Vector2(E,_),new K.Vector2(x,S)]),this.faces.push(new K.Face3(y,c,b)),this.faceVertexUvs[0].push([new K.Vector2(E,_),new K.Vector2(E,S),new K.Vector2(x,S)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},K.LatheGeometry.prototype=Object.create(K.Geometry.prototype),K.LatheGeometry.prototype.constructor=K.LatheGeometry,K.PlaneGeometry=function(e,t,i,n){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),K.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new K.PlaneBufferGeometry(e,t,i,n))},K.PlaneGeometry.prototype=Object.create(K.Geometry.prototype),K.PlaneGeometry.prototype.constructor=K.PlaneGeometry,K.PlaneBufferGeometry=function(e,t,i,n){K.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};for(var r=e/2,o=t/2,s=i||1,a=n||1,l=s+1,c=a+1,h=e/s,u=t/a,d=new Float32Array(l*c*3),f=new Float32Array(l*c*3),p=new Float32Array(l*c*2),m=0,g=0,v=0;v<c;v++)for(var y=v*u-o,b=0;b<l;b++){var x=b*h-r;d[m]=x,d[m+1]=-y,f[m+2]=1,p[g]=b/s,p[g+1]=1-v/a,m+=3,g+=2}m=0;var _=new(d.length/3>65535?Uint32Array:Uint16Array)(s*a*6);for(v=0;v<a;v++)for(b=0;b<s;b++){var E=b+l*v,S=b+l*(v+1),A=b+1+l*(v+1),w=b+1+l*v;_[m]=E,_[m+1]=S,_[m+2]=w,_[m+3]=S,_[m+4]=A,_[m+5]=w,m+=6}this.setAttribute("index",new K.BufferAttribute(_,1)),this.setAttribute("position",new K.BufferAttribute(d,3)),this.setAttribute("normal",new K.BufferAttribute(f,3)),this.setAttribute("uv",new K.BufferAttribute(p,2))},K.PlaneBufferGeometry.prototype=Object.create(K.BufferGeometry.prototype),K.PlaneBufferGeometry.prototype.constructor=K.PlaneBufferGeometry,K.RingGeometry=function(e,t,i,n,r,o){K.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},e=e||0,t=t||50,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?Math.max(3,i):8;var s,a,l=[],c=e,h=(t-e)/(n=void 0!==n?Math.max(1,n):8);for(s=0;s<n+1;s++){for(a=0;a<i+1;a++){var u=new K.Vector3,d=r+a/i*o;u.x=c*Math.cos(d),u.y=c*Math.sin(d),this.vertices.push(u),l.push(new K.Vector2((u.x/t+1)/2,(u.y/t+1)/2))}c+=h}var f=new K.Vector3(0,0,1);for(s=0;s<n;s++){var p=s*(i+1);for(a=0;a<i;a++){var m=d=a+p,g=d+i+1,v=d+i+2;this.faces.push(new K.Face3(m,g,v,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([l[m].clone(),l[g].clone(),l[v].clone()]),m=d,g=d+i+2,v=d+1,this.faces.push(new K.Face3(m,g,v,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([l[m].clone(),l[g].clone(),l[v].clone()])}}this.computeFaceNormals(),this.boundingSphere=new K.Sphere(new K.Vector3,c)},K.RingGeometry.prototype=Object.create(K.Geometry.prototype),K.RingGeometry.prototype.constructor=K.RingGeometry,K.SphereGeometry=function(e,t,i,n,r,o,s){K.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,s=void 0!==s?s:Math.PI;var a,l,c=[],h=[];for(l=0;l<=i;l++){var u=[],d=[];for(a=0;a<=t;a++){var f=a/t,p=l/i,m=new K.Vector3;m.x=-e*Math.cos(n+f*r)*Math.sin(o+p*s),m.y=e*Math.cos(o+p*s),m.z=e*Math.sin(n+f*r)*Math.sin(o+p*s),this.vertices.push(m),u.push(this.vertices.length-1),d.push(new K.Vector2(f,1-p))}c.push(u),h.push(d)}for(l=0;l<i;l++)for(a=0;a<t;a++){var g=c[l][a+1],v=c[l][a],y=c[l+1][a],b=c[l+1][a+1],x=this.vertices[g].clone().normalize(),_=this.vertices[v].clone().normalize(),E=this.vertices[y].clone().normalize(),S=this.vertices[b].clone().normalize(),A=h[l][a+1].clone(),w=h[l][a].clone(),T=h[l+1][a].clone(),M=h[l+1][a+1].clone();Math.abs(this.vertices[g].y)===e?(A.x=(A.x+w.x)/2,this.faces.push(new K.Face3(g,y,b,[x,E,S])),this.faceVertexUvs[0].push([A,T,M])):Math.abs(this.vertices[y].y)===e?(T.x=(T.x+M.x)/2,this.faces.push(new K.Face3(g,v,y,[x,_,E])),this.faceVertexUvs[0].push([A,w,T])):(this.faces.push(new K.Face3(g,v,b,[x,_,S])),this.faceVertexUvs[0].push([A,w,M]),this.faces.push(new K.Face3(v,y,b,[_.clone(),E,S.clone()])),this.faceVertexUvs[0].push([w.clone(),T,M.clone()]))}this.computeFaceNormals(),this.boundingSphere=new K.Sphere(new K.Vector3,e)},K.SphereGeometry.prototype=Object.create(K.Geometry.prototype),K.SphereGeometry.prototype.constructor=K.SphereGeometry,K.TextGeometry=function(e,t){t=t||{};var i=K.FontUtils.generateShapes(e,t);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),K.ExtrudeGeometry.call(this,i,t),this.type="TextGeometry"},K.TextGeometry.prototype=Object.create(K.ExtrudeGeometry.prototype),K.TextGeometry.prototype.constructor=K.TextGeometry,K.TorusGeometry=function(e,t,i,n,r){K.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},e=e||100,t=t||40,i=i||8,n=n||6,r=r||2*Math.PI;for(var o=new K.Vector3,s=[],a=[],l=0;l<=i;l++)for(var c=0;c<=n;c++){var h=c/n*r,u=l/i*Math.PI*2;o.x=e*Math.cos(h),o.y=e*Math.sin(h);var d=new K.Vector3;d.x=(e+t*Math.cos(u))*Math.cos(h),d.y=(e+t*Math.cos(u))*Math.sin(h),d.z=t*Math.sin(u),this.vertices.push(d),s.push(new K.Vector2(c/n,l/i)),a.push(d.clone().sub(o).normalize())}for(l=1;l<=i;l++)for(c=1;c<=n;c++){var f=(n+1)*l+c-1,p=(n+1)*(l-1)+c-1,m=(n+1)*(l-1)+c,g=(n+1)*l+c,v=new K.Face3(f,p,g,[a[f].clone(),a[p].clone(),a[g].clone()]);this.faces.push(v),this.faceVertexUvs[0].push([s[f].clone(),s[p].clone(),s[g].clone()]),v=new K.Face3(p,m,g,[a[p].clone(),a[m].clone(),a[g].clone()]),this.faces.push(v),this.faceVertexUvs[0].push([s[p].clone(),s[m].clone(),s[g].clone()])}this.computeFaceNormals()},K.TorusGeometry.prototype=Object.create(K.Geometry.prototype),K.TorusGeometry.prototype.constructor=K.TorusGeometry,K.TorusKnotGeometry=function(e,t,i,n,r,o,s){K.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,p:r,q:o,heightScale:s},e=e||100,t=t||40,i=i||64,n=n||8,r=r||2,o=o||3,s=s||1;for(var a=new Array(i),l=new K.Vector3,c=new K.Vector3,h=new K.Vector3,u=0;u<i;++u){a[u]=new Array(n);var d=u/i*2*r*Math.PI,f=D(d,o,r,e,s),p=D(d+.01,o,r,e,s);l.subVectors(p,f),c.addVectors(p,f),h.crossVectors(l,c),c.crossVectors(h,l),h.normalize(),c.normalize();for(var m=0;m<n;++m){var g=m/n*2*Math.PI,v=-t*Math.cos(g),y=t*Math.sin(g),b=new K.Vector3;b.x=f.x+v*c.x+y*h.x,b.y=f.y+v*c.y+y*h.y,b.z=f.z+v*c.z+y*h.z,a[u][m]=this.vertices.push(b)-1}}for(u=0;u<i;++u)for(m=0;m<n;++m){var x=(u+1)%i,_=(m+1)%n,E=a[u][m],S=a[x][m],A=a[x][_],w=a[u][_],T=new K.Vector2(u/i,m/n),M=new K.Vector2((u+1)/i,m/n),C=new K.Vector2((u+1)/i,(m+1)/n),P=new K.Vector2(u/i,(m+1)/n);this.faces.push(new K.Face3(E,S,w)),this.faceVertexUvs[0].push([T,M,P]),this.faces.push(new K.Face3(S,A,w)),this.faceVertexUvs[0].push([M.clone(),C,P.clone()])}function D(e,t,i,n,r){var o=Math.cos(e),s=Math.sin(e),a=t/i*e,l=Math.cos(a),c=n*(2+l)*.5*o,h=n*(2+l)*s*.5,u=r*n*Math.sin(a)*.5;return new K.Vector3(c,h,u)}this.computeFaceNormals(),this.computeVertexNormals()},K.TorusKnotGeometry.prototype=Object.create(K.Geometry.prototype),K.TorusKnotGeometry.prototype.constructor=K.TorusKnotGeometry,K.TubeGeometry=function(e,t,i,n,r,o){K.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:i,radialSegments:n,closed:r},t=t||64,i=i||1,n=n||8,r=r||!1,o=o||K.TubeGeometry.NoTaper;var s,a,l,c,h,u,d,f,p,m,g,v,y,b,x,_,E,S,A,w,T=[],M=this,C=t+1,P=new K.Vector3,D=new K.TubeGeometry.FrenetFrames(e,t,r),L=D.tangents,I=D.normals,R=D.binormals;function O(e,t,i){return M.vertices.push(new K.Vector3(e,t,i))-1}for(this.tangents=L,this.normals=I,this.binormals=R,p=0;p<C;p++)for(T[p]=[],l=p/(C-1),f=e.getPointAt(l),L[p],s=I[p],a=R[p],h=i*o(l),m=0;m<n;m++)c=m/n*2*Math.PI,u=-h*Math.cos(c),d=h*Math.sin(c),P.copy(f),P.x+=u*s.x+d*a.x,P.y+=u*s.y+d*a.y,P.z+=u*s.z+d*a.z,T[p][m]=O(P.x,P.y,P.z);for(p=0;p<t;p++)for(m=0;m<n;m++)g=r?(p+1)%t:p+1,v=(m+1)%n,y=T[p][m],b=T[g][m],x=T[g][v],_=T[p][v],E=new K.Vector2(p/t,m/n),S=new K.Vector2((p+1)/t,m/n),A=new K.Vector2((p+1)/t,(m+1)/n),w=new K.Vector2(p/t,(m+1)/n),this.faces.push(new K.Face3(y,b,_)),this.faceVertexUvs[0].push([E,S,w]),this.faces.push(new K.Face3(b,x,_)),this.faceVertexUvs[0].push([S.clone(),A,w.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},K.TubeGeometry.prototype=Object.create(K.Geometry.prototype),K.TubeGeometry.prototype.constructor=K.TubeGeometry,K.TubeGeometry.NoTaper=function(e){return 1},K.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},K.TubeGeometry.FrenetFrames=function(e,t,i){var n,r,o,s,a,l,c,h=new K.Vector3,u=[],d=[],f=[],p=new K.Vector3,m=new K.Matrix4,g=t+1;for(this.tangents=u,this.normals=d,this.binormals=f,l=0;l<g;l++)c=l/(g-1),u[l]=e.getTangentAt(c),u[l].normalize();for(function(){d[0]=new K.Vector3,f[0]=new K.Vector3,r=Number.MAX_VALUE,o=Math.abs(u[0].x),s=Math.abs(u[0].y),a=Math.abs(u[0].z),o<=r&&(r=o,h.set(1,0,0));s<=r&&(r=s,h.set(0,1,0));a<=r&&h.set(0,0,1);p.crossVectors(u[0],h).normalize(),d[0].crossVectors(u[0],p),f[0].crossVectors(u[0],d[0])}(),l=1;l<g;l++)d[l]=d[l-1].clone(),f[l]=f[l-1].clone(),p.crossVectors(u[l-1],u[l]),p.length()>1e-4&&(p.normalize(),n=Math.acos(K.Math.clamp(u[l-1].dot(u[l]),-1,1)),d[l].applyMatrix4(m.makeRotationAxis(p,n))),f[l].crossVectors(u[l],d[l]);if(i)for(n=Math.acos(K.Math.clamp(d[0].dot(d[g-1]),-1,1)),n/=g-1,u[0].dot(p.crossVectors(d[0],d[g-1]))>0&&(n=-n),l=1;l<g;l++)d[l].applyMatrix4(m.makeRotationAxis(u[l],n*l)),f[l].crossVectors(u[l],d[l])},K.PolyhedronGeometry=function(e,t,i,n){K.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n},i=i||1,n=n||0;for(var r=this,o=0,s=e.length;o<s;o+=3)x(new K.Vector3(e[o],e[o+1],e[o+2]));var a=this.vertices,l=[],c=(o=0,0);for(s=t.length;o<s;o+=3,c++){var h=a[t[o]],u=a[t[o+1]],d=a[t[o+2]];l[c]=new K.Face3(h.index,u.index,d.index,[h.clone(),u.clone(),d.clone()])}var f=new K.Vector3;for(o=0,s=l.length;o<s;o++)E(l[o],n);for(o=0,s=this.faceVertexUvs[0].length;o<s;o++){var p=this.faceVertexUvs[0][o],m=p[0].x,g=p[1].x,v=p[2].x,y=Math.max(m,Math.max(g,v)),b=Math.min(m,Math.min(g,v));y>.9&&b<.1&&(m<.2&&(p[0].x+=1),g<.2&&(p[1].x+=1),v<.2&&(p[2].x+=1))}for(o=0,s=this.vertices.length;o<s;o++)this.vertices[o].multiplyScalar(i);function x(e){var t=e.normalize().clone();t.index=r.vertices.push(t)-1;var i=S(e)/2/Math.PI+.5,n=function(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}(e)/Math.PI+.5;return t.uv=new K.Vector2(i,1-n),t}function _(e,t,i){var n=new K.Face3(e.index,t.index,i.index,[e.clone(),t.clone(),i.clone()]);r.faces.push(n),f.copy(e).add(t).add(i).divideScalar(3);var o=S(f);r.faceVertexUvs[0].push([A(e.uv,e,o),A(t.uv,t,o),A(i.uv,i,o)])}function E(e,t){for(var i=Math.pow(2,t),n=x(r.vertices[e.a]),o=x(r.vertices[e.b]),s=x(r.vertices[e.c]),a=[],l=0;l<=i;l++){a[l]=[];for(var c=x(n.clone().lerp(s,l/i)),h=x(o.clone().lerp(s,l/i)),u=i-l,d=0;d<=u;d++)a[l][d]=0==d&&l==i?c:x(c.clone().lerp(h,d/u))}for(l=0;l<i;l++)for(d=0;d<2*(i-l)-1;d++){var f=Math.floor(d/2);d%2==0?_(a[l][f+1],a[l+1][f],a[l][f]):_(a[l][f+1],a[l+1][f+1],a[l+1][f])}}function S(e){return Math.atan2(e.z,-e.x)}function A(e,t,i){return i<0&&1===e.x&&(e=new K.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new K.Vector2(i/2/Math.PI+.5,e.y)),e.clone()}this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new K.Sphere(new K.Vector3,i)},K.PolyhedronGeometry.prototype=Object.create(K.Geometry.prototype),K.PolyhedronGeometry.prototype.constructor=K.PolyhedronGeometry,K.DodecahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];K.PolyhedronGeometry.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t)},K.DodecahedronGeometry.prototype=Object.create(K.Geometry.prototype),K.DodecahedronGeometry.prototype.constructor=K.DodecahedronGeometry,K.IcosahedronGeometry=function(e,t){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];K.PolyhedronGeometry.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},K.IcosahedronGeometry.prototype=Object.create(K.Geometry.prototype),K.IcosahedronGeometry.prototype.constructor=K.IcosahedronGeometry,K.OctahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};K.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},K.OctahedronGeometry.prototype=Object.create(K.Geometry.prototype),K.OctahedronGeometry.prototype.constructor=K.OctahedronGeometry,K.TetrahedronGeometry=function(e,t){K.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},K.TetrahedronGeometry.prototype=Object.create(K.Geometry.prototype),K.TetrahedronGeometry.prototype.constructor=K.TetrahedronGeometry,K.ParametricGeometry=function(e,t,i){K.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i};var n,r,o,s,a,l,c,h,u,d,f,p,m=this.vertices,g=this.faces,v=this.faceVertexUvs[0],y=t+1;for(n=0;n<=i;n++)for(s=n/i,r=0;r<=t;r++)o=e(r/t,s),m.push(o);for(n=0;n<i;n++)for(r=0;r<t;r++)a=n*y+r,l=n*y+r+1,c=(n+1)*y+r+1,h=(n+1)*y+r,u=new K.Vector2(r/t,n/i),d=new K.Vector2((r+1)/t,n/i),f=new K.Vector2((r+1)/t,(n+1)/i),p=new K.Vector2(r/t,(n+1)/i),g.push(new K.Face3(a,l,h)),v.push([u,d,p]),g.push(new K.Face3(l,c,h)),v.push([d.clone(),f,p.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},K.ParametricGeometry.prototype=Object.create(K.Geometry.prototype),K.ParametricGeometry.prototype.constructor=K.ParametricGeometry,K.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),i=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new K.BufferGeometry;n.setAttribute("position",new K.BufferAttribute(t,3)),n.setAttribute("color",new K.BufferAttribute(i,3));var r=new K.LineBasicMaterial({vertexColors:K.VertexColors});K.Line.call(this,n,r,K.LinePieces)},K.AxisHelper.prototype=Object.create(K.Line.prototype),K.AxisHelper.prototype.constructor=K.AxisHelper,K.ArrowHelper=function(){var e=new K.Geometry;e.vertices.push(new K.Vector3(0,0,0),new K.Vector3(0,1,0));var t=new K.CylinderGeometry(0,.5,1,5,1);return t.applyMatrix((new K.Matrix4).makeTranslation(0,-.5,0)),function(i,n,r,o,s,a){K.Object3D.call(this),void 0===o&&(o=16776960),void 0===r&&(r=1),void 0===s&&(s=.2*r),void 0===a&&(a=.2*s),this.position.copy(n),this.line=new K.Line(e,new K.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new K.Mesh(t,new K.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(i),this.setLength(r,s,a)}}(),K.ArrowHelper.prototype=Object.create(K.Object3D.prototype),K.ArrowHelper.prototype.constructor=K.ArrowHelper,K.ArrowHelper.prototype.setDirection=(Y=new K.Vector3,function(e){e.y>.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Y.set(e.z,0,-e.x).normalize(),X=Math.acos(e.y),this.quaternion.setFromAxisAngle(Y,X))}),K.ArrowHelper.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,e-t,1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},K.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},K.BoxHelper=function(e){var t=new K.BufferGeometry;t.setAttribute("position",new K.BufferAttribute(new Float32Array(72),3)),K.Line.call(this,t,new K.LineBasicMaterial({color:16776960}),K.LinePieces),void 0!==e&&this.update(e)},K.BoxHelper.prototype=Object.create(K.Line.prototype),K.BoxHelper.prototype.constructor=K.BoxHelper,K.BoxHelper.prototype.update=function(e){var t=e.geometry;null===t.boundingBox&&t.computeBoundingBox();var i=t.boundingBox.min,n=t.boundingBox.max,r=this.geometry.attributes.position.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=i.x,r[4]=n.y,r[5]=n.z,r[6]=i.x,r[7]=n.y,r[8]=n.z,r[9]=i.x,r[10]=i.y,r[11]=n.z,r[12]=i.x,r[13]=i.y,r[14]=n.z,r[15]=n.x,r[16]=i.y,r[17]=n.z,r[18]=n.x,r[19]=i.y,r[20]=n.z,r[21]=n.x,r[22]=n.y,r[23]=n.z,r[24]=n.x,r[25]=n.y,r[26]=i.z,r[27]=i.x,r[28]=n.y,r[29]=i.z,r[30]=i.x,r[31]=n.y,r[32]=i.z,r[33]=i.x,r[34]=i.y,r[35]=i.z,r[36]=i.x,r[37]=i.y,r[38]=i.z,r[39]=n.x,r[40]=i.y,r[41]=i.z,r[42]=n.x,r[43]=i.y,r[44]=i.z,r[45]=n.x,r[46]=n.y,r[47]=i.z,r[48]=n.x,r[49]=n.y,r[50]=n.z,r[51]=n.x,r[52]=n.y,r[53]=i.z,r[54]=i.x,r[55]=n.y,r[56]=n.z,r[57]=i.x,r[58]=n.y,r[59]=i.z,r[60]=i.x,r[61]=i.y,r[62]=n.z,r[63]=i.x,r[64]=i.y,r[65]=i.z,r[66]=n.x,r[67]=i.y,r[68]=n.z,r[69]=n.x,r[70]=i.y,r[71]=i.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},K.BoundingBoxHelper=function(e,t){var i=void 0!==t?t:8947848;this.object=e,this.box=new K.Box3,K.Mesh.call(this,new K.BoxGeometry(1,1,1),new K.MeshBasicMaterial({color:i,wireframe:!0}))},K.BoundingBoxHelper.prototype=Object.create(K.Mesh.prototype),K.BoundingBoxHelper.prototype.constructor=K.BoundingBoxHelper,K.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.getCenter(this.position)},K.CameraHelper=function(e){var t=new K.Geometry,i=new K.LineBasicMaterial({color:16777215,vertexColors:K.FaceColors}),n={},r=16755200,o=16711680,s=43775,a=3355443;function l(e,t,i){c(e,i),c(t,i)}function c(e,i){t.vertices.push(new K.Vector3),t.colors.push(new K.Color(i)),void 0===n[e]&&(n[e]=[]),n[e].push(t.vertices.length-1)}l("n1","n2",r),l("n2","n4",r),l("n4","n3",r),l("n3","n1",r),l("f1","f2",r),l("f2","f4",r),l("f4","f3",r),l("f3","f1",r),l("n1","f1",r),l("n2","f2",r),l("n3","f3",r),l("n4","f4",r),l("p","n1",o),l("p","n2",o),l("p","n3",o),l("p","n4",o),l("u1","u2",s),l("u2","u3",s),l("u3","u1",s),l("c","t",16777215),l("p","c",a),l("cn1","cn2",a),l("cn3","cn4",a),l("cf1","cf2",a),l("cf3","cf4",a),K.Line.call(this,t,i,K.LinePieces),this.camera=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update()},K.CameraHelper.prototype=Object.create(K.Line.prototype),K.CameraHelper.prototype.constructor=K.CameraHelper,K.CameraHelper.prototype.update=function(){var e,t,i=new K.Vector3,n=new K.Camera,r=function(r,o,s,a){i.set(o,s,a).unproject(n);var l=t[r];if(void 0!==l)for(var c=0,h=l.length;c<h;c++)e.vertices[l[c]].copy(i)};return function(){e=this.geometry,t=this.pointMap;n.projectionMatrix.copy(this.camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-1,-1,-1),r("n2",1,-1,-1),r("n3",-1,1,-1),r("n4",1,1,-1),r("f1",-1,-1,1),r("f2",1,-1,1),r("f3",-1,1,1),r("f4",1,1,1),r("u1",.7,1.1,-1),r("u2",-.7,1.1,-1),r("u3",0,2,-1),r("cf1",-1,0,1),r("cf2",1,0,1),r("cf3",0,-1,1),r("cf4",0,1,1),r("cn1",-1,0,-1),r("cn2",1,0,-1),r("cn3",0,-1,-1),r("cn4",0,1,-1),e.verticesNeedUpdate=!0}}(),K.DirectionalLightHelper=function(e,t){K.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var i=new K.Geometry;i.vertices.push(new K.Vector3(-t,t,0),new K.Vector3(t,t,0),new K.Vector3(t,-t,0),new K.Vector3(-t,-t,0),new K.Vector3(-t,t,0));var n=new K.LineBasicMaterial({fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new K.Line(i,n),this.add(this.lightPlane),(i=new K.Geometry).vertices.push(new K.Vector3,new K.Vector3),(n=new K.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new K.Line(i,n),this.add(this.targetLine),this.update()},K.DirectionalLightHelper.prototype=Object.create(K.Object3D.prototype),K.DirectionalLightHelper.prototype.constructor=K.DirectionalLightHelper,K.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},K.DirectionalLightHelper.prototype.update=function(){var e=new K.Vector3,t=new K.Vector3,i=new K.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(t,e),this.lightPlane.lookAt(i),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(i),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),K.EdgesHelper=function(e,t,i){var n=void 0!==t?t:16777215;i=void 0!==i?i:1;var r,o=Math.cos(K.Math.degToRad(i)),s=[0,0],a={},l=function(e,t){return e-t},c=["a","b","c"],h=new K.BufferGeometry;e.geometry instanceof K.BufferGeometry?(r=new K.Geometry).fromBufferGeometry(e.geometry):r=e.geometry.clone(),r.mergeVertices(),r.computeFaceNormals();for(var u=r.vertices,d=r.faces,f=0,p=0,m=d.length;p<m;p++)for(var g=d[p],v=0;v<3;v++){s[0]=g[c[v]],s[1]=g[c[(v+1)%3]],s.sort(l),void 0===a[x=s.toString()]?(a[x]={vert1:s[0],vert2:s[1],face1:p,face2:void 0},f++):a[x].face2=p}var y=new Float32Array(2*f*3),b=0;for(var x in a){var _=a[x];if(void 0===_.face2||d[_.face1].normal.dot(d[_.face2].normal)<=o){var E=u[_.vert1];y[b++]=E.x,y[b++]=E.y,y[b++]=E.z,E=u[_.vert2],y[b++]=E.x,y[b++]=E.y,y[b++]=E.z}}h.setAttribute("position",new K.BufferAttribute(y,3)),K.Line.call(this,h,new K.LineBasicMaterial({color:n}),K.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},K.EdgesHelper.prototype=Object.create(K.Line.prototype),K.EdgesHelper.prototype.constructor=K.EdgesHelper,K.FaceNormalsHelper=function(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;for(var r=void 0!==i?i:16776960,o=void 0!==n?n:1,s=new K.Geometry,a=0,l=this.object.geometry.faces.length;a<l;a++)s.vertices.push(new K.Vector3,new K.Vector3);K.Line.call(this,s,new K.LineBasicMaterial({color:r,linewidth:o}),K.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new K.Matrix3,this.update()},K.FaceNormalsHelper.prototype=Object.create(K.Line.prototype),K.FaceNormalsHelper.prototype.constructor=K.FaceNormalsHelper,K.FaceNormalsHelper.prototype.update=function(){var e=this.geometry.vertices,t=this.object,i=t.geometry.vertices,n=t.geometry.faces,r=t.matrixWorld;t.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(r);for(var o=0,s=0,a=n.length;o<a;o++,s+=2){var l=n[o];e[s].copy(i[l.a]).add(i[l.b]).add(i[l.c]).divideScalar(3).applyMatrix4(r),e[s+1].copy(l.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(e[s])}return this.geometry.verticesNeedUpdate=!0,this},K.GridHelper=function(e,t){var i=new K.Geometry,n=new K.LineBasicMaterial({vertexColors:K.VertexColors});this.color1=new K.Color(4473924),this.color2=new K.Color(8947848);for(var r=-e;r<=e;r+=t){i.vertices.push(new K.Vector3(-e,0,r),new K.Vector3(e,0,r),new K.Vector3(r,0,-e),new K.Vector3(r,0,e));var o=0===r?this.color1:this.color2;i.colors.push(o,o,o,o)}K.Line.call(this,i,n,K.LinePieces)},K.GridHelper.prototype=Object.create(K.Line.prototype),K.GridHelper.prototype.constructor=K.GridHelper,K.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},K.HemisphereLightHelper=function(e,t){K.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new K.Color,new K.Color];var i=new K.SphereGeometry(t,4,2);i.applyMatrix((new K.Matrix4).makeRotationX(-Math.PI/2));for(var n=0;n<8;n++)i.faces[n].color=this.colors[n<4?0:1];var r=new K.MeshBasicMaterial({vertexColors:K.FaceColors,wireframe:!0});this.lightSphere=new K.Mesh(i,r),this.add(this.lightSphere),this.update()},K.HemisphereLightHelper.prototype=Object.create(K.Object3D.prototype),K.HemisphereLightHelper.prototype.constructor=K.HemisphereLightHelper,K.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},K.HemisphereLightHelper.prototype.update=function(){var e=new K.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),K.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var i=new K.SphereGeometry(t,4,2),n=new K.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),K.Mesh.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},K.PointLightHelper.prototype=Object.create(K.Mesh.prototype),K.PointLightHelper.prototype.constructor=K.PointLightHelper,K.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},K.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},K.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new K.Geometry,i=0;i<this.bones.length;i++){this.bones[i].parent instanceof K.Bone&&(t.vertices.push(new K.Vector3),t.vertices.push(new K.Vector3),t.colors.push(new K.Color(0,0,1)),t.colors.push(new K.Color(0,1,0)))}var n=new K.LineBasicMaterial({vertexColors:K.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});K.Line.call(this,t,n,K.LinePieces),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},K.SkeletonHelper.prototype=Object.create(K.Line.prototype),K.SkeletonHelper.prototype.constructor=K.SkeletonHelper,K.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof K.Bone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,this.getBoneList(e.children[i]));return t},K.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new K.Matrix4).getInverse(this.root.matrixWorld),i=new K.Matrix4,n=0,r=0;r<this.bones.length;r++){var o=this.bones[r];o.parent instanceof K.Bone&&(i.multiplyMatrices(t,o.matrixWorld),e.vertices[n].setFromMatrixPosition(i),i.multiplyMatrices(t,o.parent.matrixWorld),e.vertices[n+1].setFromMatrixPosition(i),n+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},K.SpotLightHelper=function(e){K.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var t=new K.CylinderGeometry(0,1,1,8,1,!0);t.applyMatrix((new K.Matrix4).makeTranslation(0,-.5,0)),t.applyMatrix((new K.Matrix4).makeRotationX(-Math.PI/2));var i=new K.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new K.Mesh(t,i),this.add(this.cone),this.update()},K.SpotLightHelper.prototype=Object.create(K.Object3D.prototype),K.SpotLightHelper.prototype.constructor=K.SpotLightHelper,K.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},K.SpotLightHelper.prototype.update=function(){var e=new K.Vector3,t=new K.Vector3;return function(){var i=this.light.distance?this.light.distance:1e4,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),K.VertexNormalsHelper=function(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;for(var r=void 0!==i?i:16711680,o=void 0!==n?n:1,s=new K.Geometry,a=e.geometry.faces,l=0,c=a.length;l<c;l++)for(var h=0,u=a[l].vertexNormals.length;h<u;h++)s.vertices.push(new K.Vector3,new K.Vector3);K.Line.call(this,s,new K.LineBasicMaterial({color:r,linewidth:o}),K.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new K.Matrix3,this.update()},K.VertexNormalsHelper.prototype=Object.create(K.Line.prototype),K.VertexNormalsHelper.prototype.constructor=K.VertexNormalsHelper,K.VertexNormalsHelper.prototype.update=function(e){var t=new K.Vector3;return function(e){var i=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var n=this.geometry.vertices,r=this.object.geometry.vertices,o=this.object.geometry.faces,s=this.object.matrixWorld,a=0,l=0,c=o.length;l<c;l++)for(var h=o[l],u=0,d=h.vertexNormals.length;u<d;u++){var f=r[h[i[u]]],p=h.vertexNormals[u];n[a].copy(f).applyMatrix4(s),t.copy(p).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),t.add(n[a]),n[a+=1].copy(t),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),K.VertexTangentsHelper=function(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;for(var r=void 0!==i?i:255,o=void 0!==n?n:1,s=new K.Geometry,a=e.geometry.faces,l=0,c=a.length;l<c;l++)for(var h=0,u=a[l].vertexTangents.length;h<u;h++)s.vertices.push(new K.Vector3),s.vertices.push(new K.Vector3);K.Line.call(this,s,new K.LineBasicMaterial({color:r,linewidth:o}),K.LinePieces),this.matrixAutoUpdate=!1,this.update()},K.VertexTangentsHelper.prototype=Object.create(K.Line.prototype),K.VertexTangentsHelper.prototype.constructor=K.VertexTangentsHelper,K.VertexTangentsHelper.prototype.update=function(e){var t=new K.Vector3;return function(e){var i=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var n=this.geometry.vertices,r=this.object.geometry.vertices,o=this.object.geometry.faces,s=this.object.matrixWorld,a=0,l=0,c=o.length;l<c;l++)for(var h=o[l],u=0,d=h.vertexTangents.length;u<d;u++){var f=r[h[i[u]]],p=h.vertexTangents[u];n[a].copy(f).applyMatrix4(s),t.copy(p).transformDirection(s).multiplyScalar(this.size),t.add(n[a]),n[a+=1].copy(t),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),K.WireframeHelper=function(e,t){var i=void 0!==t?t:16777215,n=[0,0],r={},o=function(e,t){return e-t},s=["a","b","c"],a=new K.BufferGeometry;if(e.geometry instanceof K.Geometry){for(var l=e.geometry.vertices,c=e.geometry.faces,h=0,u=new Uint32Array(6*c.length),d=0,f=c.length;d<f;d++)for(var p=c[d],m=0;m<3;m++){n[0]=p[s[m]],n[1]=p[s[(m+1)%3]],n.sort(o),void 0===r[T=n.toString()]&&(u[2*h]=n[0],u[2*h+1]=n[1],r[T]=!0,h++)}var g=new Float32Array(2*h*3);for(d=0,f=h;d<f;d++)for(m=0;m<2;m++){var v=l[u[2*d+m]];g[(A=6*d+3*m)+0]=v.x,g[A+1]=v.y,g[A+2]=v.z}a.setAttribute("position",new K.BufferAttribute(g,3))}else if(e.geometry instanceof K.BufferGeometry)if(void 0!==e.geometry.attributes.index){l=e.geometry.attributes.position.array;var y=e.geometry.attributes.index.array,b=e.geometry.drawcalls;h=0;0===b.length&&(b=[{count:y.length,index:0,start:0}]);u=new Uint32Array(2*y.length);for(var x=0,_=b.length;x<_;++x)for(var E=b[x].start,S=b[x].count,A=b[x].index,w=(d=E,E+S);d<w;d+=3)for(m=0;m<3;m++){var T;n[0]=A+y[d+m],n[1]=A+y[d+(m+1)%3],n.sort(o),void 0===r[T=n.toString()]&&(u[2*h]=n[0],u[2*h+1]=n[1],r[T]=!0,h++)}for(g=new Float32Array(2*h*3),d=0,f=h;d<f;d++)for(m=0;m<2;m++){A=6*d+3*m;var M=3*u[2*d+m];g[A+0]=l[M],g[A+1]=l[M+1],g[A+2]=l[M+2]}a.setAttribute("position",new K.BufferAttribute(g,3))}else{var C=(h=(l=e.geometry.attributes.position.array).length/3)/3;for(g=new Float32Array(2*h*3),d=0,f=C;d<f;d++)for(m=0;m<3;m++){var P=9*d+3*m;g[(A=18*d+6*m)+0]=l[P],g[A+1]=l[P+1],g[A+2]=l[P+2];M=9*d+(m+1)%3*3;g[A+3]=l[M],g[A+4]=l[M+1],g[A+5]=l[M+2]}a.setAttribute("position",new K.BufferAttribute(g,3))}K.Line.call(this,a,new K.LineBasicMaterial({color:i}),K.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},K.WireframeHelper.prototype=Object.create(K.Line.prototype),K.WireframeHelper.prototype.constructor=K.WireframeHelper,K.ImmediateRenderObject=function(){K.Object3D.call(this),this.render=function(e){}},K.ImmediateRenderObject.prototype=Object.create(K.Object3D.prototype),K.ImmediateRenderObject.prototype.constructor=K.ImmediateRenderObject,K.MorphBlendMesh=function(e,t){K.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n="__default",r=i-1,o=i/1;this.createAnimation(n,0,r,o),this.setAnimationWeight(n,1)},K.MorphBlendMesh.prototype=Object.create(K.Mesh.prototype),K.MorphBlendMesh.prototype.constructor=K.MorphBlendMesh,K.MorphBlendMesh.prototype.createAnimation=function(e,t,i,n){var r={startFrame:t,endFrame:i,length:i-t+1,fps:n,duration:(i-t)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=r,this.animationsList.push(r)},K.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)_?(\d+)/,n={},r=this.geometry,o=0,s=r.morphTargets.length;o<s;o++){var a=r.morphTargets[o].name.match(i);if(a&&a.length>1)n[l=a[1]]||(n[l]={start:1/0,end:-1/0}),o<(c=n[l]).start&&(c.start=o),o>c.end&&(c.end=o),t||(t=l)}for(var l in n){var c=n[l];this.createAnimation(l,c.start,c.end,e)}this.firstAnimation=t},K.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},K.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},K.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},K.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},K.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},K.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},K.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},K.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},K.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):K.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},K.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},K.MorphBlendMesh.prototype.update=function(e){for(var t=0,i=this.animationsList.length;t<i;t++){var n=this.animationsList[t];if(n.active){var r=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var o=n.startFrame+K.Math.clamp(Math.floor(n.time/r),0,n.length-1),s=n.weight;o!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[o]=0,n.lastFrame=n.currentFrame,n.currentFrame=o);var a=n.time%r/r;n.directionBackwards&&(a=1-a),this.morphTargetInfluences[n.currentFrame]=a*s,this.morphTargetInfluences[n.lastFrame]=(1-a)*s}}};const{polyfillTHREE:Q}=i(63004);Q(K)},67526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),i=t[0],n=t[1];return 3*(i+n)/4-n},t.toByteArray=function(e){var t,i,o=a(e),s=o[0],l=o[1],c=new r(function(e,t,i){return 3*(t+i)/4-i}(0,s,l)),h=0,u=l>0?s-4:s;for(i=0;i<u;i+=4)t=n[e.charCodeAt(i)]<<18|n[e.charCodeAt(i+1)]<<12|n[e.charCodeAt(i+2)]<<6|n[e.charCodeAt(i+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;2===l&&(t=n[e.charCodeAt(i)]<<2|n[e.charCodeAt(i+1)]>>4,c[h++]=255&t);1===l&&(t=n[e.charCodeAt(i)]<<10|n[e.charCodeAt(i+1)]<<4|n[e.charCodeAt(i+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],s=16383,a=0,c=n-r;a<c;a+=s)o.push(l(e,a,a+s>c?c:a+s));1===r?(t=e[n-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")};for(var i=[],n=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)i[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function l(e,t,n){for(var r,o,s=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=r)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8939:e=>{e.exports=function(){"use strict";var e=function(){for(var e=3,t=document.createElement("b"),i=t.all||[];t.innerHTML="\x3c!--[if gt IE "+ ++e+"]><i><![endif]--\x3e",i[0];);return e>4?e:document.documentMode}(),t=navigator.platform.toLowerCase().indexOf("mac")+1,i=function(e){if(!(this instanceof i))return new i(e);var s=this,a={rows_in_block:50,blocks_in_cluster:4,tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{}};s.options={};for(var l,c=["rows_in_block","blocks_in_cluster","show_no_data_row","no_data_class","no_data_text","keep_parity","tag","callbacks"],h=0;l=c[h];h++)s.options[l]=void 0!==e[l]&&null!=e[l]?e[l]:a[l];var u,d=["scroll","content"];for(h=0;u=d[h];h++)if(s[u+"_elem"]=e[u+"Id"]?document.getElementById(e[u+"Id"]):e[u+"Elem"],!s[u+"_elem"])throw new Error("Error! Could not find "+u+" element");s.content_elem.hasAttribute("tabindex")||s.content_elem.setAttribute("tabindex",0);var f=o(e.rows)?e.rows:s.fetchMarkup(),p={},m=s.scroll_elem.scrollTop;s.insertToDOM(f,p),s.scroll_elem.scrollTop=m;var g=!1,v=0,y=!1,b=function(){t&&(y||(s.content_elem.style.pointerEvents="none"),y=!0,clearTimeout(v),v=setTimeout((function(){s.content_elem.style.pointerEvents="auto",y=!1}),50)),g!=(g=s.getClusterNum())&&s.insertToDOM(f,p),s.options.callbacks.scrollingProgress&&s.options.callbacks.scrollingProgress(s.getScrollProgress())},x=0,_=function(){clearTimeout(x),x=setTimeout(s.refresh,100)};n("scroll",s.scroll_elem,b),n("resize",window,_),s.destroy=function(e){r("scroll",s.scroll_elem,b),r("resize",window,_),s.html((e?s.generateEmptyRow():f).join(""))},s.refresh=function(e){(s.getRowsHeight(f)||e)&&s.update(f)},s.update=function(e){f=o(e)?e:[];var t=s.scroll_elem.scrollTop;f.length*s.options.item_height<t&&(s.scroll_elem.scrollTop=0,g=0),s.insertToDOM(f,p),s.scroll_elem.scrollTop=t},s.clear=function(){s.update([])},s.getRowsAmount=function(){return f.length},s.getScrollProgress=function(){return this.options.scroll_top/(f.length*this.options.item_height)*100||0};var E=function(e,t){var i=o(t)?t:[];i.length&&(f="append"==e?f.concat(i):i.concat(f),s.insertToDOM(f,p))};s.append=function(e){E("append",e)},s.prepend=function(e){E("prepend",e)}};function n(e,t,i){return t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function r(e,t,i){return t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent("on"+e,i)}function o(e){return"[object Array]"===Object.prototype.toString.call(e)}function s(e,t){return window.getComputedStyle?window.getComputedStyle(t)[e]:t.currentStyle[e]}return i.prototype={constructor:i,fetchMarkup:function(){for(var e=[],t=this.getChildNodes(this.content_elem);t.length;)e.push(t.shift().outerHTML);return e},exploreEnvironment:function(t,i){var n=this.options;n.content_tag=this.content_elem.tagName.toLowerCase(),t.length&&(e&&e<=9&&!n.tag&&(n.tag=t[0].match(/<([^>\s/]*)/)[1].toLowerCase()),this.content_elem.children.length<=1&&(i.data=this.html(t[0]+t[0]+t[0])),n.tag||(n.tag=this.content_elem.children[0].tagName.toLowerCase()),this.getRowsHeight(t))},getRowsHeight:function(e){var t=this.options,i=t.item_height;if(t.cluster_height=0,e.length){var n=this.content_elem.children;if(n.length){var r=n[Math.floor(n.length/2)];if(t.item_height=r.offsetHeight,"tr"==t.tag&&"collapse"!=s("borderCollapse",this.content_elem)&&(t.item_height+=parseInt(s("borderSpacing",this.content_elem),10)||0),"tr"!=t.tag){var o=parseInt(s("marginTop",r),10)||0,a=parseInt(s("marginBottom",r),10)||0;t.item_height+=Math.max(o,a)}return t.block_height=t.item_height*t.rows_in_block,t.rows_in_cluster=t.blocks_in_cluster*t.rows_in_block,t.cluster_height=t.blocks_in_cluster*t.block_height,i!=t.item_height}}},getClusterNum:function(){return this.options.scroll_top=this.scroll_elem.scrollTop,Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var e=this.options;if(!e.tag||!e.show_no_data_row)return[];var t,i=document.createElement(e.tag),n=document.createTextNode(e.no_data_text);return i.className=e.no_data_class,"tr"==e.tag&&((t=document.createElement("td")).colSpan=100,t.appendChild(n)),i.appendChild(t||n),[i.outerHTML]},generate:function(e,t){var i=this.options,n=e.length;if(n<i.rows_in_block)return{top_offset:0,bottom_offset:0,rows_above:0,rows:n?e:this.generateEmptyRow()};var r=Math.max((i.rows_in_cluster-i.rows_in_block)*t,0),o=r+i.rows_in_cluster,s=Math.max(r*i.item_height,0),a=Math.max((n-o)*i.item_height,0),l=[],c=r;s<1&&c++;for(var h=r;h<o;h++)e[h]&&l.push(e[h]);return{top_offset:s,bottom_offset:a,rows_above:c,rows:l}},renderExtraTag:function(e,t){var i=document.createElement(this.options.tag),n="clusterize-";return i.className=[n+"extra-row",n+e].join(" "),t&&(i.style.height=t+"px"),i.outerHTML},insertToDOM:function(e,t){this.options.cluster_height||this.exploreEnvironment(e,t);var i=this.generate(e,this.getClusterNum()),n=i.rows.join(""),r=this.checkChanges("data",n,t),o=this.checkChanges("top",i.top_offset,t),s=this.checkChanges("bottom",i.bottom_offset,t),a=this.options.callbacks,l=[];r||o?(i.top_offset&&(this.options.keep_parity&&l.push(this.renderExtraTag("keep-parity")),l.push(this.renderExtraTag("top-space",i.top_offset))),l.push(n),i.bottom_offset&&l.push(this.renderExtraTag("bottom-space",i.bottom_offset)),a.clusterWillChange&&a.clusterWillChange(),this.html(l.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",i.rows_above),this.content_elem.style["counter-increment"]="clusterize-counter "+(i.rows_above-1),a.clusterChanged&&a.clusterChanged()):s&&(this.content_elem.lastChild.style.height=i.bottom_offset+"px")},html:function(t){var i=this.content_elem;if(e&&e<=9&&"tr"==this.options.tag){var n,r=document.createElement("div");for(r.innerHTML="<table><tbody>"+t+"</tbody></table>";n=i.lastChild;)i.removeChild(n);for(var o=this.getChildNodes(r.firstChild.firstChild);o.length;)i.appendChild(o.shift())}else i.innerHTML=t},getChildNodes:function(e){for(var t=e.children,i=[],n=0,r=t.length;n<r;n++)i.push(t[n]);return i},checkChanges:function(e,t,i){var n=t!=i[e];return i[e]=t,n}},i}()},18211:(e,t,i)=>{"use strict";var n=i(67526),r=i(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <https://feross.org>
|
||
* @license MIT
|
||
*/t.hp=l,t.IS=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,i)}function c(e,t,i){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var i=0|m(e,t),n=a(i),r=n.write(e,t);r!==i&&(n=n.slice(0,r));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(G(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer))return f(e,t,i);if("undefined"!=typeof SharedArrayBuffer&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return f(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,i);var r=function(e){if(l.isBuffer(e)){var t=0|p(e.length),i=a(t);return 0===i.length||e.copy(i,0,0,t),i}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?a(0):d(e);if("Buffer"===e.type&&Array.isArray(e.data))return d(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return h(e),a(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),i=a(t),n=0;n<t;n+=1)i[n]=255&e[n];return i}function f(e,t,i){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(i||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,t):new Uint8Array(e,t,i),Object.setPrototypeOf(n,l.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return k(e).length;default:if(r)return n?-1:B(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,i);case"utf8":case"utf-8":return T(this,t,i);case"ascii":return C(this,t,i);case"latin1":case"binary":return P(this,t,i);case"base64":return w(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function y(e,t,i,n,r){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),z(i=+i)&&(i=r?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(r)return-1;i=e.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:b(e,t,i,n,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):b(e,[t],i,n,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,i,n,r){var o,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,i/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var h=-1;for(o=i;o<a;o++)if(c(e,o)===c(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===l)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(i+l>a&&(i=a-l),o=i;o>=0;o--){for(var u=!0,d=0;d<l;d++)if(c(e,o+d)!==c(t,d)){u=!1;break}if(u)return o}return-1}function x(e,t,i,n){i=Number(i)||0;var r=e.length-i;n?(n=Number(n))>r&&(n=r):n=r;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(z(a))return s;e[i+s]=a}return s}function _(e,t,i,n){return V(B(t,e.length-i),e,i,n)}function E(e,t,i,n){return V(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function S(e,t,i,n){return V(k(t),e,i,n)}function A(e,t,i,n){return V(function(e,t){for(var i,n,r,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(i=e.charCodeAt(s))>>8,r=i%256,o.push(r),o.push(n);return o}(t,e.length-i),e,i,n)}function w(e,t,i){return 0===t&&i===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,i))}function T(e,t,i){i=Math.min(e.length,i);for(var n=[],r=t;r<i;){var o,s,a,l,c=e[r],h=null,u=c>239?4:c>223?3:c>191?2:1;if(r+u<=i)switch(u){case 1:c<128&&(h=c);break;case 2:128==(192&(o=e[r+1]))&&(l=(31&c)<<6|63&o)>127&&(h=l);break;case 3:o=e[r+1],s=e[r+2],128==(192&o)&&128==(192&s)&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=e[r+1],s=e[r+2],a=e[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}null===h?(h=65533,u=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),r+=u}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=M));return i}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,i){return c(e,t,i)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,i){return function(e,t,i){return h(e),e<=0?a(e):void 0!==t?"string"==typeof i?a(e).fill(t,i):a(e).fill(t):a(e)}(e,t,i)},l.allocUnsafe=function(e){return u(e)},l.allocUnsafeSlow=function(e){return u(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(G(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,r=0,o=Math.min(i,n);r<o;++r)if(e[r]!==t[r]){i=e[r],n=t[r];break}return i<n?-1:n<i?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var i;if(void 0===t)for(t=0,i=0;i<e.length;++i)t+=e[i].length;var n=l.allocUnsafe(t),r=0;for(i=0;i<e.length;++i){var o=e[i];if(G(o,Uint8Array))r+o.length>n.length?l.from(o).copy(n,r):Uint8Array.prototype.set.call(n,o,r);else{if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,r)}r+=o.length}return n},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",i=t.IS;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,i,n,r){if(G(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===r&&(r=this.length),t<0||i>e.length||n<0||r>this.length)throw new RangeError("out of range index");if(n>=r&&t>=i)return 0;if(n>=r)return-1;if(t>=i)return 1;if(this===e)return 0;for(var o=(r>>>=0)-(n>>>=0),s=(i>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,r),h=e.slice(t,i),u=0;u<a;++u)if(c[u]!==h[u]){o=c[u],s=h[u];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},l.prototype.indexOf=function(e,t,i){return y(this,e,t,i,!0)},l.prototype.lastIndexOf=function(e,t,i){return y(this,e,t,i,!1)},l.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}var r=this.length-t;if((void 0===i||i>r)&&(i=r),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return x(this,e,t,i);case"utf8":case"utf-8":return _(this,e,t,i);case"ascii":case"latin1":case"binary":return E(this,e,t,i);case"base64":return S(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function C(e,t,i){var n="";i=Math.min(e.length,i);for(var r=t;r<i;++r)n+=String.fromCharCode(127&e[r]);return n}function P(e,t,i){var n="";i=Math.min(e.length,i);for(var r=t;r<i;++r)n+=String.fromCharCode(e[r]);return n}function D(e,t,i){var n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);for(var r="",o=t;o<i;++o)r+=H[e[o]];return r}function L(e,t,i){for(var n=e.slice(t,i),r="",o=0;o<n.length-1;o+=2)r+=String.fromCharCode(n[o]+256*n[o+1]);return r}function I(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,i,n,r,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(i+n>e.length)throw new RangeError("Index out of range")}function O(e,t,i,n,r,o){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function N(e,t,i,n,o){return t=+t,i>>>=0,o||O(e,0,i,4),r.write(e,t,i,n,23,4),i+4}function F(e,t,i,n,o){return t=+t,i>>>=0,o||O(e,0,i,8),r.write(e,t,i,n,52,8),i+8}l.prototype.slice=function(e,t){var i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||I(e,t,this.length);for(var n=this[e],r=1,o=0;++o<t&&(r*=256);)n+=this[e+o]*r;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||I(e,t,this.length);for(var n=this[e+--t],r=1;t>0&&(r*=256);)n+=this[e+--t]*r;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||I(e,t,this.length);for(var n=this[e],r=1,o=0;++o<t&&(r*=256);)n+=this[e+o]*r;return n>=(r*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||I(e,t,this.length);for(var n=t,r=1,o=this[e+--n];n>0&&(r*=256);)o+=this[e+--n]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},l.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,i,n){(e=+e,t>>>=0,i>>>=0,n)||R(this,e,t,i,Math.pow(2,8*i)-1,0);var r=1,o=0;for(this[t]=255&e;++o<i&&(r*=256);)this[t+o]=e/r&255;return t+i},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,i,n){(e=+e,t>>>=0,i>>>=0,n)||R(this,e,t,i,Math.pow(2,8*i)-1,0);var r=i-1,o=1;for(this[t+r]=255&e;--r>=0&&(o*=256);)this[t+r]=e/o&255;return t+i},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){var r=Math.pow(2,8*i-1);R(this,e,t,i,r-1,-r)}var o=0,s=1,a=0;for(this[t]=255&e;++o<i&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+i},l.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){var r=Math.pow(2,8*i-1);R(this,e,t,i,r-1,-r)}var o=i-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+i},l.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,i){return N(this,e,t,!0,i)},l.prototype.writeFloatBE=function(e,t,i){return N(this,e,t,!1,i)},l.prototype.writeDoubleLE=function(e,t,i){return F(this,e,t,!0,i)},l.prototype.writeDoubleBE=function(e,t,i){return F(this,e,t,!1,i)},l.prototype.copy=function(e,t,i,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);var r=n-i;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),t),r},l.prototype.fill=function(e,t,i,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var r=e.charCodeAt(0);("utf8"===n&&r<128||"latin1"===n)&&(e=r)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;var o;if(t>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(o=t;o<i;++o)this[o]=e;else{var s=l.isBuffer(e)?e:l.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=s[o%a]}return this};var U=/[^+/0-9A-Za-z-_]/g;function B(e,t){var i;t=t||1/0;for(var n=e.length,r=null,o=[],s=0;s<n;++s){if((i=e.charCodeAt(s))>55295&&i<57344){if(!r){if(i>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}r=i;continue}if(i<56320){(t-=3)>-1&&o.push(239,191,189),r=i;continue}i=65536+(r-55296<<10|i-56320)}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,i<128){if((t-=1)<0)break;o.push(i)}else if(i<2048){if((t-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function k(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,i,n){for(var r=0;r<n&&!(r+i>=t.length||r>=e.length);++r)t[r+i]=e[r];return r}function G(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var H=function(){for(var e="0123456789abcdef",t=new Array(256),i=0;i<16;++i)for(var n=16*i,r=0;r<16;++r)t[n+r]=e[i]+e[r];return t}()},84406:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=i(90784),s=i(65757);t.backOff=function(e,t){return void 0===t&&(t={}),n(this,void 0,void 0,(function(){var i;return r(this,(function(n){switch(n.label){case 0:return i=o.getSanitizedOptions(t),[4,new a(e,i).execute()];case 1:return[2,n.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return n(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,s.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},88348:function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},n(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(i(36698).Delay);t.AlwaysDelay=o},36698:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(66071),r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return n.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,i=this.numOfDelayedAttempts,n=e*Math.pow(t,i);return Math.min(n,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r},65757:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(7510),r=i(88348);t.DelayFactory=function(e,t){var i=function(e){if(!e.delayFirstAttempt)return new n.SkipFirstDelay(e);return new r.AlwaysDelay(e)}(e);return i.setAttemptNumber(t),i}},7510:function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},n(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.apply=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(i(36698).Delay);t.SkipFirstDelay=a},38500:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},66071:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(38500),r=i(14764);t.JitterFactory=function(e){return"full"===e.jitter?n.fullJitter:r.noJitter}},14764:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},90784:function(e,t){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var n={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=i(i({},n),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},95204:function(e,t){var i="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();!function(e){!function(t){var i="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,r="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,i){e.onload=function(){t(e.result)},e.onerror=function(){i(e.error)}}))}function m(e){var t=new FileReader,i=p(t);return t.readAsArrayBuffer(e),i}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&r&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,i,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,i=p(t),t.readAsText(e),i;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),i=new Array(t.length),n=0;n<t.length;n++)i[n]=String.fromCharCode(t[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=c(e),t=h(t);var i=this.map[e];this.map[e]=i?i+", "+t:t},d.prototype.delete=function(e){delete this.map[c(e)]},d.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},d.prototype.set=function(e,t){this.map[c(e)]=h(t)},d.prototype.forEach=function(e,t){for(var i in this.map)this.map.hasOwnProperty(i)&&e.call(t,this.map[i],i,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,i){e.push(i)})),u(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,i){e.push([i,t])})),u(e)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var i,n,r=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(i=t.method||this.method||"GET",n=i.toUpperCase(),y.indexOf(n)>-1?n:i),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var i=e.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(r))}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];_.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var i=Error(e);this.stack=i.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,i){return new Promise((function(n,o){var s=new b(e,i);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var e,t,i={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var i=e.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();t.append(n,r)}})),t)};i.url="responseURL"in a?a.responseURL:i.headers.get("X-Request-URL");var r="response"in a?a.response:a.responseText;n(new _(r,i))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",l)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=d,e.Request=b,e.Response=_),t.Headers=d,t.Request=b,t.Response=_,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var r=n;(t=r.fetch).default=r.fetch,t.fetch=r.fetch,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,e.exports=t},38842:(e,t,i)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}function o(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?Object(arguments[t]):{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(i).filter((function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach((function(t){o(e,t,i[t])}))}return e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,r(n.key),n)}}function c(e,t,i){return t&&l(e.prototype,t),i&&l(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}i.d(t,{A:()=>H});var m={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},g=new(function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.init(t,i)}return c(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||m,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,i,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(i).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,s({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}()),v=function(){function e(){a(this,e),this.observers={}}return c(e,[{key:"on",value:function(e,t){var i=this;return e.split(" ").forEach((function(e){i.observers[e]=i.observers[e]||[],i.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,i)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(i))}))}}]),e}();function y(){var e,t,i=new Promise((function(i,n){e=i,t=n}));return i.resolve=e,i.reject=t,i}function b(e){return null==e?"":""+e}function x(e,t,i){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(r())return{};var s=n(o.shift());!e[s]&&i&&(e[s]=new i),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return r()?{}:{obj:e,k:n(o.shift())}}function _(e,t,i){var n=x(e,t,Object);n.obj[n.k]=i}function E(e,t){var i=x(e,t),n=i.obj,r=i.k;if(n)return n[r]}function S(e,t,i){var n=E(e,i);return void 0!==n?n:E(t,i)}function A(e,t,i){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?i&&(e[n]=t[n]):A(e[n],t[n],i):e[n]=t[n]);return e}function w(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var T={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function M(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return T[e]})):e}var C="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1;function P(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(i),r=e,o=0;o<n.length;++o){if(!r)return;if("string"==typeof r[n[o]]&&o+1<n.length)return;if(void 0===r[n[o]]){for(var s=2,a=n.slice(o,o+s).join(i),l=r[a];void 0===l&&n.length>o+s;)s++,l=r[a=n.slice(o,o+s).join(i)];if(void 0===l)return;if("string"==typeof l)return l;if(a&&"string"==typeof l[a])return l[a];var c=n.slice(o+s).join(i);return c?P(l,c,i):void 0}r=r[n[o]]}return r}}var D=function(e){function t(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return a(this,t),i=u(this,d(t).call(this)),C&&v.call(h(i)),i.data=e||{},i.options=n,void 0===i.options.keySeparator&&(i.options.keySeparator="."),void 0===i.options.ignoreJSONStructure&&(i.options.ignoreJSONStructure=!0),i}return p(t,e),c(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];i&&"string"!=typeof i&&(s=s.concat(i)),i&&"string"==typeof i&&(s=s.concat(r?i.split(r):i)),e.indexOf(".")>-1&&(s=e.split("."));var a=E(this.data,s);return a||!o||"string"!=typeof i?a:P(this.data&&this.data[e]&&this.data[e][t],i,r)}},{key:"addResource",value:function(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];i&&(s=s.concat(o?i.split(o):i)),e.indexOf(".")>-1&&(n=t,t=(s=e.split("."))[1]),this.addNamespaces(t),_(this.data,s,n),r.silent||this.emit("added",e,t,i,n)}},{key:"addResources",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in i)"string"!=typeof i[r]&&"[object Array]"!==Object.prototype.toString.apply(i[r])||this.addResource(e,t,r,i[r],{silent:!0});n.silent||this.emit("added",e,t,i)}},{key:"addResourceBundle",value:function(e,t,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(n=i,i=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var l=E(this.data,a)||{};n?A(l,i,r):l=s({},l,i),_(this.data,a,l),o.silent||this.emit("added",e,t,i)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?s({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(v),L={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,i,n,r){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,i,n,r))})),t}},I={},R=function(e){function t(e){var i,n,r,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),i=u(this,d(t).call(this)),C&&v.call(h(i)),n=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,o=h(i),n.forEach((function(e){r[e]&&(o[e]=r[e])})),i.options=s,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=g.create("translator"),i}return p(t,e),c(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var i=this.resolve(e,t);return i&&void 0!==i.res}},{key:"extractFromKey",value:function(e,t){var i=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,r=t.ns||this.options.defaultNS;if(i&&e.indexOf(i)>-1){var o=e.match(this.interpolator.nestingRegexp);if(o&&o.length>0)return{key:e,namespaces:r};var s=e.split(i);(i!==n||i===n&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),e=s.join(n)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}},{key:"translate",value:function(e,i,r){var o=this;if("object"!==n(i)&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),i||(i={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var a=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,l=this.extractFromKey(e[e.length-1],i),c=l.key,h=l.namespaces,u=h[h.length-1],d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var p=i.nsSeparator||this.options.nsSeparator;return u+p+c}return c}var m=this.resolve(e,i),g=m&&m.res,v=m&&m.usedKey||c,y=m&&m.exactUsedKey||c,b=Object.prototype.toString.apply(g),x=void 0!==i.joinArrays?i.joinArrays:this.options.joinArrays,_=!this.i18nFormat||this.i18nFormat.handleAsObject;if(_&&g&&("string"!=typeof g&&"boolean"!=typeof g&&"number"!=typeof g)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(b)<0&&("string"!=typeof x||"[object Array]"!==b)){if(!i.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,g,s({},i,{ns:h})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");if(a){var E="[object Array]"===b,S=E?[]:{},A=E?y:v;for(var w in g)if(Object.prototype.hasOwnProperty.call(g,w)){var T="".concat(A).concat(a).concat(w);S[w]=this.translate(T,s({},i,{joinArrays:!1,ns:h})),S[w]===T&&(S[w]=g[w])}g=S}}else if(_&&"string"==typeof x&&"[object Array]"===b)(g=g.join(x))&&(g=this.extendTranslation(g,e,i,r));else{var M=!1,C=!1,P=void 0!==i.count&&"string"!=typeof i.count,D=t.hasDefaultValue(i),L=P?this.pluralResolver.getSuffix(d,i.count):"",I=i["defaultValue".concat(L)]||i.defaultValue;!this.isValidLookup(g)&&D&&(M=!0,g=I),this.isValidLookup(g)||(C=!0,g=c);var R=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:g,O=D&&I!==g&&this.options.updateMissing;if(C||M||O){if(this.logger.log(O?"updateKey":"missingKey",d,u,c,O?I:g),a){var N=this.resolve(c,s({},i,{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if("fallback"===this.options.saveMissingTo&&U&&U[0])for(var B=0;B<U.length;B++)F.push(U[B]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(i.lng||this.language):F.push(i.lng||this.language);var k=function(e,t,n){o.options.missingKeyHandler?o.options.missingKeyHandler(e,u,t,O?n:R,O,i):o.backendConnector&&o.backendConnector.saveMissing&&o.backendConnector.saveMissing(e,u,t,O?n:R,O,i),o.emit("missingKey",e,u,t,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach((function(e){o.pluralResolver.getSuffixes(e).forEach((function(t){k([e],c+t,i["defaultValue".concat(t)]||I)}))})):k(F,c,I))}g=this.extendTranslation(g,e,i,m,r),C&&g===c&&this.options.appendNamespaceToMissingKey&&(g="".concat(u,":").concat(c)),(C||M)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(g))}return g}},{key:"extendTranslation",value:function(e,t,i,n,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,i,n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(s({},i,{interpolation:s({},this.options.interpolation,i.interpolation)}));var a,l=i.interpolation&&i.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(l){var c=e.match(this.interpolator.nestingRegexp);a=c&&c.length}var h=i.replace&&"string"!=typeof i.replace?i.replace:i;if(this.options.interpolation.defaultVariables&&(h=s({},this.options.interpolation.defaultVariables,h)),e=this.interpolator.interpolate(e,h,i.lng||this.language,i),l){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(i.nest=!1)}!1!==i.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];return r&&r[0]===n[0]&&!i.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):o.translate.apply(o,n.concat([t]))}),i)),i.interpolation&&this.interpolator.reset()}var d=i.postProcess||this.options.postProcess,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==i.applyPostProcessor&&(e=L.handle(f,e,t,this.options&&this.options.postProcessPassResolved?s({i18nResolved:n},i):i,this)),e}},{key:"resolve",value:function(e){var t,i,n,r,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),c=l.key;i=c;var h=l.namespaces;s.options.fallbackNS&&(h=h.concat(s.options.fallbackNS));var u=void 0!==a.count&&"string"!=typeof a.count,d=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,f=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);h.forEach((function(e){s.isValidLookup(t)||(o=e,!I["".concat(f[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(I["".concat(f[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(i,'" for languages "').concat(f.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach((function(i){if(!s.isValidLookup(t)){r=i;var o,l,h=c,f=[h];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(f,c,i,e,a);else u&&(o=s.pluralResolver.getSuffix(i,a.count)),u&&d&&f.push(h+o),d&&f.push(h+="".concat(s.options.contextSeparator).concat(a.context)),u&&f.push(h+=o);for(;l=f.pop();)s.isValidLookup(t)||(n=l,t=s.getResource(i,e,l,a))}})))}))}})),{res:t,usedKey:i,exactUsedKey:n,usedLng:r,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,i,n):this.resourceStore.getResource(e,t,i,n)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,12)&&void 0!==e[i])return!0;return!1}}]),t}(v);function O(e){return e.charAt(0).toUpperCase()+e.slice(1)}var N=function(){function e(t){a(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=g.create("languageUtils")}return c(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],i=e.split("-");return this.options.lowerCaseLng?i=i.map((function(e){return e.toLowerCase()})):2===i.length?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=O(i[1].toLowerCase()))):3===i.length&&(i[0]=i[0].toLowerCase(),2===i[1].length&&(i[1]=i[1].toUpperCase()),"sgn"!==i[0]&&2===i[2].length&&(i[2]=i[2].toUpperCase()),t.indexOf(i[1].toLowerCase())>-1&&(i[1]=O(i[1].toLowerCase())),t.indexOf(i[2].toLowerCase())>-1&&(i[2]=O(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,i=this;return e?(e.forEach((function(e){if(!t){var n=i.formatLanguageCode(e);i.options.supportedLngs&&!i.isSupportedCode(n)||(t=n)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var n=i.getLanguagePartFromCode(e);if(i.isSupportedCode(n))return t=n;t=i.options.supportedLngs.find((function(e){if(0===e.indexOf(n))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}},{key:"toResolveHierarchy",value:function(e,t){var i=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=function(e){e&&(i.isSupportedCode(e)?r.push(e):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),n.forEach((function(e){r.indexOf(e)<0&&o(i.formatLanguageCode(e))})),r}}]),e}(),F=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],U={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};var B=function(){function e(t){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.languageUtils=t,this.options=n,this.logger=g.create("pluralResolver"),this.rules=(i={},F.forEach((function(e){e.lngs.forEach((function(t){i[t]={numbers:e.nr,plurals:U[e.fc]}}))})),i)}return c(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,i=this.getRule(e);return i?i.numbers.map((function(i){return t.getSuffix(e,i)})):[]}},{key:"getSuffix",value:function(e,t){var i=this,n=this.getRule(e);if(n){var r=n.noAbs?n.plurals(t):n.plurals(Math.abs(t)),o=n.numbers[r];this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===n.numbers.length&&1===n.numbers[0]?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),k=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.logger=g.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return c(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:M,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?w(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?w(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?w(t.nestingPrefix):t.nestingPrefixEscaped||w("$t("),this.nestingSuffix=t.nestingSuffix?w(t.nestingSuffix):t.nestingSuffixEscaped||w(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(e,t,i,n){var r,o,a,l=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function h(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(l.formatSeparator)<0){var r=S(t,c,e);return l.alwaysFormat?l.format(r,void 0,i,s({},n,t,{interpolationkey:e})):r}var o=e.split(l.formatSeparator),a=o.shift().trim(),h=o.join(l.formatSeparator).trim();return l.format(S(t,c,a),h,i,s({},n,t,{interpolationkey:a}))};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,f=n&&n.interpolation&&n.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return h(e)}},{regex:this.regexp,safeValue:function(e){return l.escapeValue?h(l.escape(e)):h(e)}}].forEach((function(t){for(a=0;r=t.regex.exec(e);){if(void 0===(o=u(r[1].trim())))if("function"==typeof d){var i=d(e,r,n);o="string"==typeof i?i:""}else{if(f){o=r[0];continue}l.logger.warn("missed to pass in variable ".concat(r[1]," for interpolating ").concat(e)),o=""}else"string"==typeof o||l.useRawValueToEscape||(o=b(o));var s=t.safeValue(o);if(e=e.replace(r[0],s),f?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,++a>=l.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var i,n,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=s({},o);function l(e,t){var i=this.nestingOptionsSeparator;if(e.indexOf(i)<0)return e;var n=e.split(new RegExp("".concat(i,"[ ]*{"))),r="{".concat(n[1]);e=n[0],r=(r=this.interpolate(r,a)).replace(/'/g,'"');try{a=JSON.parse(r),t&&(a=s({},t,a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(i).concat(r)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;i=this.nestingRegexp.exec(e);){var c=[],h=!1;if(-1!==i[0].indexOf(this.formatSeparator)&&!/{.*}/.test(i[1])){var u=i[1].split(this.formatSeparator).map((function(e){return e.trim()}));i[1]=u.shift(),c=u,h=!0}if((n=t(l.call(this,i[1].trim(),a),a))&&i[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=b(n)),n||(this.logger.warn("missed to resolve ".concat(i[1]," for nesting ").concat(e)),n=""),h&&(n=c.reduce((function(e,t){return r.format(e,t,o.lng,s({},o,{interpolationkey:i[1].trim()}))}),n.trim())),e=e.replace(i[0],n),this.regexp.lastIndex=0}return e}}]),e}();var V=function(e){function t(e,i,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return a(this,t),r=u(this,d(t).call(this)),C&&v.call(h(r)),r.backend=e,r.store=i,r.services=n,r.languageUtils=n.languageUtils,r.options=o,r.logger=g.create("backendConnector"),r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(n,o.backend,o),r}return p(t,e),c(t,[{key:"queueLoad",value:function(e,t,i,n){var r=this,o=[],s=[],a=[],l=[];return e.forEach((function(e){var n=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!i.reload&&r.store.hasResourceBundle(e,t)?r.state[a]=2:r.state[a]<0||(1===r.state[a]?s.indexOf(a)<0&&s.push(a):(r.state[a]=1,n=!1,s.indexOf(a)<0&&s.push(a),o.indexOf(a)<0&&o.push(a),l.indexOf(t)<0&&l.push(t)))})),n||a.push(e)})),(o.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:n}),{toLoad:o,pending:s,toLoadLanguages:a,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,i){var n=e.split("|"),r=n[0],o=n[1];t&&this.emit("failedLoading",r,o,t),i&&this.store.addResourceBundle(r,o,i),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(i){var n,a,l,c,h,u;n=i.loaded,a=o,c=x(n,[r],Object),h=c.obj,u=c.k,h[u]=h[u]||[],l&&(h[u]=h[u].concat(a)),l||h[u].push(a),function(e,t){for(var i=e.indexOf(t);-1!==i;)e.splice(i,1),i=e.indexOf(t)}(i.pending,e),t&&i.errors.push(t),0!==i.pending.length||i.done||(Object.keys(i.loaded).forEach((function(e){s[e]||(s[e]=[]),i.loaded[e].length&&i.loaded[e].forEach((function(t){s[e].indexOf(t)<0&&s[e].push(t)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,i){var n=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,s=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[i](e,t,(function(a,l){a&&l&&r<5?setTimeout((function(){n.read.call(n,e,t,i,r+1,2*o,s)}),o):s(a,l)})):s(null,{})}},{key:"prepareLoading",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach((function(e){i.loadOne(e)}))}},{key:"load",value:function(e,t,i){this.prepareLoading(e,t,{},i)}},{key:"reload",value:function(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}},{key:"loadOne",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(function(n,s){n&&t.logger.warn("".concat(i,"loading namespace ").concat(o," for language ").concat(r," failed"),n),!n&&s&&t.logger.log("".concat(i,"loaded namespace ").concat(o," for language ").concat(r),s),t.loaded(e,n,s)}))}},{key:"saveMissing",value:function(e,t,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(i,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=i&&""!==i&&(this.backend&&this.backend.create&&this.backend.create(e,t,i,n,null,s({},o,{isUpdate:r})),e&&e[0]&&this.store.addResource(e[0],t,i,n))}}]),t}(v);function G(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function z(){}const H=new(function(e){function t(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(a(this,t),e=u(this,d(t).call(this)),C&&v.call(h(e)),e.options=G(i),e.services={},e.logger=g,e.modules={external:[]},n&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,n),u(e,h(e));setTimeout((function(){e.init(i,n)}),0)}return e}return p(t,e),c(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(i=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=s({},{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===n(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===n(e[2])||"object"===n(e[3])){var i=e[3]||e[2];Object.keys(i).forEach((function(e){t[e]=i[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,i,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}},this.options,G(t)),this.format=this.options.interpolation.format,i||(i=z),!this.options.isClone){this.modules.logger?g.init(r(this.modules.logger),this.options):g.init(null,this.options);var o=new N(this.options);this.store=new D(this.options.resources,this.options);var a=this.services;a.logger=g,a.resourceStore=this.store,a.languageUtils=o,a.pluralResolver=new B(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),a.interpolator=new k(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new V(r(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e.emit.apply(e,[t].concat(n))})),this.modules.languageDetector&&(a.languageDetector=r(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=r(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new R(this.services,this.options),this.translator.on("*",(function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e.emit.apply(e,[t].concat(n))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var i;return(i=e.store)[t].apply(i,arguments),e}}));var c=y(),h=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),c.resolve(n),i(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),c}},{key:"loadResources",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:z,n="string"==typeof e?e:this.language;if("function"==typeof e&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return i();var r=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){r.indexOf(e)<0&&r.push(e)}))};if(n)o(n);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return o(e)}));this.options.preload&&this.options.preload.forEach((function(e){return o(e)})),this.services.backendConnector.load(r,this.options.ns,i)}else i(null)}},{key:"reloadResources",value:function(e,t,i){var n=y();return e||(e=this.languages),t||(t=this.options.ns),i||(i=z),this.services.backendConnector.reload(e,t,(function(e){n.resolve(),i(e)})),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&L.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var i=this;this.isLanguageChangingTo=e;var n=y();this.emit("languageChanging",e);var r=function(r){e||r||!i.services.languageDetector||(r=[]);var o="string"==typeof r?r:i.services.languageUtils.getBestMatchFromCodes(r);o&&(i.language||(i.language=o,i.languages=i.services.languageUtils.toResolveHierarchy(o)),i.translator.language||i.translator.changeLanguage(o),i.services.languageDetector&&i.services.languageDetector.cacheUserLanguage(o)),i.loadResources(o,(function(e){!function(e,r){r?(i.language=r,i.languages=i.services.languageUtils.toResolveHierarchy(r),i.translator.changeLanguage(r),i.isLanguageChangingTo=void 0,i.emit("languageChanged",r),i.logger.log("languageChanged",r)):i.isLanguageChangingTo=void 0,n.resolve((function(){return i.t.apply(i,arguments)})),t&&t(e,(function(){return i.t.apply(i,arguments)}))}(e,o)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,i){var r=this,o=function e(t,o){var a;if("object"!==n(o)){for(var l=arguments.length,c=new Array(l>2?l-2:0),h=2;h<l;h++)c[h-2]=arguments[h];a=r.options.overloadTranslationOptionHandler([t,o].concat(c))}else a=s({},o);a.lng=a.lng||e.lng,a.lngs=a.lngs||e.lngs,a.ns=a.ns||e.ns;var u=r.options.keySeparator||".",d=i?"".concat(i).concat(u).concat(t):t;return r.t(d,a)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=i,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var s=function(e,i){var n=t.services.backendConnector.state["".concat(e,"|").concat(i)];return-1===n||2===n};if(i.precheck){var a=i.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(n,e)||(!this.services.backendConnector.backend||!(!s(n,e)||r&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var i=this,n=y();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){i.options.ns.indexOf(e)<0&&i.options.ns.push(e)})),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var i=y();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],r=e.filter((function(e){return n.indexOf(e)<0}));return r.length?(this.options.preload=n.concat(r),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}},{key:"cloneInstance",value:function(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:z,r=s({},this.options,i,{isClone:!0}),o=new t(r);return["store","services","language"].forEach((function(t){o[t]=e[t]})),o.services=s({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new R(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];o.emit.apply(o,[e].concat(i))})),o.init(r,n),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages}}}]),t}(v))},251:(e,t)=>{t.read=function(e,t,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?r-1:0,d=i?-1:1,f=e[t+u];for(u+=d,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+u],u+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+e[t+u],u+=d,h-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=c}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,i,n,r,o){var s,a,l,c=8*o-r-1,h=(1<<c)-1,u=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=h?(a=0,s=h):s+u>=1?(a=(t*l-1)*Math.pow(2,r),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;e[i+f]=255&a,f+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[i+f]=255&s,f+=p,s/=256,c-=8);e[i+f-p]|=128*m}},55580:(e,t,i)=>{var n=i(56110)(i(9325),"DataView");e.exports=n},21549:(e,t,i)=>{var n=i(22032),r=i(63862),o=i(66721),s=i(12749),a=i(35749);function l(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=r,l.prototype.get=o,l.prototype.has=s,l.prototype.set=a,e.exports=l},80079:(e,t,i)=>{var n=i(63702),r=i(70080),o=i(24739),s=i(48655),a=i(31175);function l(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=r,l.prototype.get=o,l.prototype.has=s,l.prototype.set=a,e.exports=l},68223:(e,t,i)=>{var n=i(56110)(i(9325),"Map");e.exports=n},53661:(e,t,i)=>{var n=i(63040),r=i(17670),o=i(90289),s=i(4509),a=i(72949);function l(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=r,l.prototype.get=o,l.prototype.has=s,l.prototype.set=a,e.exports=l},32804:(e,t,i)=>{var n=i(56110)(i(9325),"Promise");e.exports=n},76545:(e,t,i)=>{var n=i(56110)(i(9325),"Set");e.exports=n},38859:(e,t,i)=>{var n=i(53661),r=i(31380),o=i(51459);function s(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new n;++t<i;)this.add(e[t])}s.prototype.add=s.prototype.push=r,s.prototype.has=o,e.exports=s},37217:(e,t,i)=>{var n=i(80079),r=i(51420),o=i(90938),s=i(63605),a=i(29817),l=i(80945);function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=s,c.prototype.has=a,c.prototype.set=l,e.exports=c},51873:(e,t,i)=>{var n=i(9325).Symbol;e.exports=n},37828:(e,t,i)=>{var n=i(9325).Uint8Array;e.exports=n},28303:(e,t,i)=>{var n=i(56110)(i(9325),"WeakMap");e.exports=n},79770:e=>{e.exports=function(e,t){for(var i=-1,n=null==e?0:e.length,r=0,o=[];++i<n;){var s=e[i];t(s,i,e)&&(o[r++]=s)}return o}},70695:(e,t,i)=>{var n=i(78096),r=i(72428),o=i(56449),s=i(3656),a=i(30361),l=i(37167),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var i=o(e),h=!i&&r(e),u=!i&&!h&&s(e),d=!i&&!h&&!u&&l(e),f=i||h||u||d,p=f?n(e.length,String):[],m=p.length;for(var g in e)!t&&!c.call(e,g)||f&&("length"==g||u&&("offset"==g||"parent"==g)||d&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,m))||p.push(g);return p}},14528:e=>{e.exports=function(e,t){for(var i=-1,n=t.length,r=e.length;++i<n;)e[r+i]=t[i];return e}},14248:e=>{e.exports=function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1}},26025:(e,t,i)=>{var n=i(75288);e.exports=function(e,t){for(var i=e.length;i--;)if(n(e[i][0],t))return i;return-1}},82199:(e,t,i)=>{var n=i(14528),r=i(56449);e.exports=function(e,t,i){var o=t(e);return r(e)?o:n(o,i(e))}},72552:(e,t,i)=>{var n=i(51873),r=i(659),o=i(59350),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?r(e):o(e)}},27534:(e,t,i)=>{var n=i(72552),r=i(40346);e.exports=function(e){return r(e)&&"[object Arguments]"==n(e)}},60270:(e,t,i)=>{var n=i(87068),r=i(40346);e.exports=function e(t,i,o,s,a){return t===i||(null==t||null==i||!r(t)&&!r(i)?t!=t&&i!=i:n(t,i,o,s,e,a))}},87068:(e,t,i)=>{var n=i(37217),r=i(25911),o=i(21986),s=i(50689),a=i(5861),l=i(56449),c=i(3656),h=i(37167),u="[object Arguments]",d="[object Array]",f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,i,m,g,v){var y=l(e),b=l(t),x=y?d:a(e),_=b?d:a(t),E=(x=x==u?f:x)==f,S=(_=_==u?f:_)==f,A=x==_;if(A&&c(e)){if(!c(t))return!1;y=!0,E=!1}if(A&&!E)return v||(v=new n),y||h(e)?r(e,t,i,m,g,v):o(e,t,x,i,m,g,v);if(!(1&i)){var w=E&&p.call(e,"__wrapped__"),T=S&&p.call(t,"__wrapped__");if(w||T){var M=w?e.value():e,C=T?t.value():t;return v||(v=new n),g(M,C,i,m,v)}}return!!A&&(v||(v=new n),s(e,t,i,m,g,v))}},45083:(e,t,i)=>{var n=i(1882),r=i(87296),o=i(23805),s=i(47473),a=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,h=l.toString,u=c.hasOwnProperty,d=RegExp("^"+h.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||r(e))&&(n(e)?d:a).test(s(e))}},4901:(e,t,i)=>{var n=i(72552),r=i(30294),o=i(40346),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&r(e.length)&&!!s[n(e)]}},88984:(e,t,i)=>{var n=i(55527),r=i(3650),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return r(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}},78096:e=>{e.exports=function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}},54128:(e,t,i)=>{var n=i(31800),r=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(r,""):e}},27301:e=>{e.exports=function(e){return function(t){return e(t)}}},19219:e=>{e.exports=function(e,t){return e.has(t)}},55481:(e,t,i)=>{var n=i(9325)["__core-js_shared__"];e.exports=n},25911:(e,t,i)=>{var n=i(38859),r=i(14248),o=i(19219);e.exports=function(e,t,i,s,a,l){var c=1&i,h=e.length,u=t.length;if(h!=u&&!(c&&u>h))return!1;var d=l.get(e),f=l.get(t);if(d&&f)return d==t&&f==e;var p=-1,m=!0,g=2&i?new n:void 0;for(l.set(e,t),l.set(t,e);++p<h;){var v=e[p],y=t[p];if(s)var b=c?s(y,v,p,t,e,l):s(v,y,p,e,t,l);if(void 0!==b){if(b)continue;m=!1;break}if(g){if(!r(t,(function(e,t){if(!o(g,t)&&(v===e||a(v,e,i,s,l)))return g.push(t)}))){m=!1;break}}else if(v!==y&&!a(v,y,i,s,l)){m=!1;break}}return l.delete(e),l.delete(t),m}},21986:(e,t,i)=>{var n=i(51873),r=i(37828),o=i(75288),s=i(25911),a=i(20317),l=i(84247),c=n?n.prototype:void 0,h=c?c.valueOf:void 0;e.exports=function(e,t,i,n,c,u,d){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!u(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&n;if(f||(f=l),e.size!=t.size&&!p)return!1;var m=d.get(e);if(m)return m==t;n|=2,d.set(e,t);var g=s(f(e),f(t),n,c,u,d);return d.delete(e),g;case"[object Symbol]":if(h)return h.call(e)==h.call(t)}return!1}},50689:(e,t,i)=>{var n=i(50002),r=Object.prototype.hasOwnProperty;e.exports=function(e,t,i,o,s,a){var l=1&i,c=n(e),h=c.length;if(h!=n(t).length&&!l)return!1;for(var u=h;u--;){var d=c[u];if(!(l?d in t:r.call(t,d)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=l;++u<h;){var v=e[d=c[u]],y=t[d];if(o)var b=l?o(y,v,d,t,e,a):o(v,y,d,e,t,a);if(!(void 0===b?v===y||s(v,y,i,o,a):b)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var x=e.constructor,_=t.constructor;x==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof _&&_ instanceof _||(m=!1)}return a.delete(e),a.delete(t),m}},34840:(e,t,i)=>{var n="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;e.exports=n},50002:(e,t,i)=>{var n=i(82199),r=i(4664),o=i(95950);e.exports=function(e){return n(e,o,r)}},12651:(e,t,i)=>{var n=i(74218);e.exports=function(e,t){var i=e.__data__;return n(t)?i["string"==typeof t?"string":"hash"]:i.map}},56110:(e,t,i)=>{var n=i(45083),r=i(10392);e.exports=function(e,t){var i=r(e,t);return n(i)?i:void 0}},659:(e,t,i)=>{var n=i(51873),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),i=e[a];try{e[a]=void 0;var n=!0}catch(e){}var r=s.call(e);return n&&(t?e[a]=i:delete e[a]),r}},4664:(e,t,i)=>{var n=i(79770),r=i(63345),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),n(s(e),(function(t){return o.call(e,t)})))}:r;e.exports=a},5861:(e,t,i)=>{var n=i(55580),r=i(68223),o=i(32804),s=i(76545),a=i(28303),l=i(72552),c=i(47473),h="[object Map]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",p="[object DataView]",m=c(n),g=c(r),v=c(o),y=c(s),b=c(a),x=l;(n&&x(new n(new ArrayBuffer(1)))!=p||r&&x(new r)!=h||o&&x(o.resolve())!=u||s&&x(new s)!=d||a&&x(new a)!=f)&&(x=function(e){var t=l(e),i="[object Object]"==t?e.constructor:void 0,n=i?c(i):"";if(n)switch(n){case m:return p;case g:return h;case v:return u;case y:return d;case b:return f}return t}),e.exports=x},10392:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},22032:(e,t,i)=>{var n=i(81042);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},63862:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},66721:(e,t,i)=>{var n=i(81042),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return r.call(t,e)?t[e]:void 0}},12749:(e,t,i)=>{var n=i(81042),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:r.call(t,e)}},35749:(e,t,i)=>{var n=i(81042);e.exports=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},30361:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,i){var n=typeof e;return!!(i=null==i?9007199254740991:i)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<i}},74218:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},87296:(e,t,i)=>{var n,r=i(55481),o=(n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},55527:e=>{var t=Object.prototype;e.exports=function(e){var i=e&&e.constructor;return e===("function"==typeof i&&i.prototype||t)}},63702:e=>{e.exports=function(){this.__data__=[],this.size=0}},70080:(e,t,i)=>{var n=i(26025),r=Array.prototype.splice;e.exports=function(e){var t=this.__data__,i=n(t,e);return!(i<0)&&(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}},24739:(e,t,i)=>{var n=i(26025);e.exports=function(e){var t=this.__data__,i=n(t,e);return i<0?void 0:t[i][1]}},48655:(e,t,i)=>{var n=i(26025);e.exports=function(e){return n(this.__data__,e)>-1}},31175:(e,t,i)=>{var n=i(26025);e.exports=function(e,t){var i=this.__data__,r=n(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}},63040:(e,t,i)=>{var n=i(21549),r=i(80079),o=i(68223);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||r),string:new n}}},17670:(e,t,i)=>{var n=i(12651);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},90289:(e,t,i)=>{var n=i(12651);e.exports=function(e){return n(this,e).get(e)}},4509:(e,t,i)=>{var n=i(12651);e.exports=function(e){return n(this,e).has(e)}},72949:(e,t,i)=>{var n=i(12651);e.exports=function(e,t){var i=n(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}},20317:e=>{e.exports=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i}},81042:(e,t,i)=>{var n=i(56110)(Object,"create");e.exports=n},3650:(e,t,i)=>{var n=i(74335)(Object.keys,Object);e.exports=n},86009:(e,t,i)=>{e=i.nmd(e);var n=i(34840),r=t&&!t.nodeType&&t,o=r&&e&&!e.nodeType&&e,s=o&&o.exports===r&&n.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a},59350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74335:e=>{e.exports=function(e,t){return function(i){return e(t(i))}}},9325:(e,t,i)=>{var n=i(34840),r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")();e.exports=o},31380:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},51459:e=>{e.exports=function(e){return this.__data__.has(e)}},84247:e=>{e.exports=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}},51420:(e,t,i)=>{var n=i(80079);e.exports=function(){this.__data__=new n,this.size=0}},90938:e=>{e.exports=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}},63605:e=>{e.exports=function(e){return this.__data__.get(e)}},29817:e=>{e.exports=function(e){return this.__data__.has(e)}},80945:(e,t,i)=>{var n=i(80079),r=i(68223),o=i(53661);e.exports=function(e,t){var i=this.__data__;if(i instanceof n){var s=i.__data__;if(!r||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(s)}return i.set(e,t),this.size=i.size,this}},47473:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},31800:e=>{var t=/\s/;e.exports=function(e){for(var i=e.length;i--&&t.test(e.charAt(i)););return i}},38221:(e,t,i)=>{var n=i(23805),r=i(10124),o=i(99374),s=Math.max,a=Math.min;e.exports=function(e,t,i){var l,c,h,u,d,f,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=l,n=c;return l=c=void 0,p=t,u=e.apply(n,i)}function b(e){var i=e-f;return void 0===f||i>=t||i<0||g&&e-p>=h}function x(){var e=r();if(b(e))return _(e);d=setTimeout(x,function(e){var i=t-(e-f);return g?a(i,h-(e-p)):i}(e))}function _(e){return d=void 0,v&&l?y(e):(l=c=void 0,u)}function E(){var e=r(),i=b(e);if(l=arguments,c=this,f=e,i){if(void 0===d)return function(e){return p=e,d=setTimeout(x,t),m?y(e):u}(f);if(g)return clearTimeout(d),d=setTimeout(x,t),y(f)}return void 0===d&&(d=setTimeout(x,t)),u}return t=o(t)||0,n(i)&&(m=!!i.leading,h=(g="maxWait"in i)?s(o(i.maxWait)||0,t):h,v="trailing"in i?!!i.trailing:v),E.cancel=function(){void 0!==d&&clearTimeout(d),p=0,l=f=c=d=void 0},E.flush=function(){return void 0===d?u:_(r())},E}},75288:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},72428:(e,t,i)=>{var n=i(27534),r=i(40346),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return r(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=l},56449:e=>{var t=Array.isArray;e.exports=t},64894:(e,t,i)=>{var n=i(1882),r=i(30294);e.exports=function(e){return null!=e&&r(e.length)&&!n(e)}},3656:(e,t,i)=>{e=i.nmd(e);var n=i(9325),r=i(89935),o=t&&!t.nodeType&&t,s=o&&e&&!e.nodeType&&e,a=s&&s.exports===o?n.Buffer:void 0,l=(a?a.isBuffer:void 0)||r;e.exports=l},2404:(e,t,i)=>{var n=i(60270);e.exports=function(e,t){return n(e,t)}},1882:(e,t,i)=>{var n=i(72552),r=i(23805);e.exports=function(e){if(!r(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},30294:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},23805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},40346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},44394:(e,t,i)=>{var n=i(72552),r=i(40346);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==n(e)}},37167:(e,t,i)=>{var n=i(4901),r=i(27301),o=i(86009),s=o&&o.isTypedArray,a=s?r(s):n;e.exports=a},95950:(e,t,i)=>{var n=i(70695),r=i(88984),o=i(64894);e.exports=function(e){return o(e)?n(e):r(e)}},10124:(e,t,i)=>{var n=i(9325);e.exports=function(){return n.Date.now()}},63345:e=>{e.exports=function(){return[]}},89935:e=>{e.exports=function(){return!1}},99374:(e,t,i)=>{var n=i(54128),r=i(23805),o=i(44394),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var i=a.test(e);return i||l.test(e)?c(e.slice(2),i?2:8):s.test(e)?NaN:+e}},51436:e=>{function t(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}function i(e){e.pending+=1;var t=!1;return function(r){if(t)throw new Error("callback called twice");if(t=!0,e.error=e.error||r,e.pending-=1,e.waiting.length>0&&e.pending<e.max)n(e,e.waiting.shift());else if(0===e.pending){var o=e.listeners;e.listeners=[],o.forEach(i)}};function i(t){t(e.error)}}function n(e,t){t(i(e))}e.exports=t,t.prototype.go=function(e){this.pending<this.max?n(this,e):this.waiting.push(e)},t.prototype.wait=function(e){0===this.pending?e(this.error):this.listeners.push(e)},t.prototype.hold=function(){return i(this)}},41007:(e,t,i)=>{"use strict";i.r(t),i.d(t,{UniformGroup:()=>h,getDefaultSampler:()=>c});var n,r=i(19698),o=i(26027);function s(e){switch(e){case n.f32:case n.i32:return 1;case n.vec2f:return 2;case n.vec3f:return 3;case n.vec4f:return 4;case n.mat3x3f:return 12;default:throw new Error(`Unknown uniform type: ${e}`)}}function a(e,t,i,r){switch(i){case n.f32:e.setFloat(t,r);break;case n.i32:e.setInt(t,r);break;case n.vec2f:e.setFloat2(t,r.x,r.y);break;case n.vec3f:e.setVector3(t,r);break;case n.vec4f:e.setVector4(t,r);break;case n.mat3x3f:e.setMatrix3x3(t,r);break;default:throw new Error(`Unknown uniform type: ${i}`)}}function l(e,t){const i={},n=function(e,t){let i=0;for(const n in e){const r=e[n];t&&(t[n]=i),i+=s(r)}return i}(e,i),o=Boolean(t&GPUShaderStage.FRAGMENT),a=Boolean(t&GPUShaderStage.VERTEX);return{buffer:new r.D(void 0,n,o,a),offsets:i}}function c(){return{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",lodMinClamp:0,lodMaxClamp:10,maxAnisotropy:16}}!function(e){e.f32="f32",e.i32="i32",e.vec2f="vec2f",e.vec3f="vec3f",e.vec4f="vec4f",e.mat3x3f="mat3x3f"}(n||(n={}));class h{#oo=new Map;#so=new Map;#ao=new Map;#lo;#wt;#Lt;#co;#Pt;#ho;#uo=!1;constructor(){}setDefaultTexture(e){const t=e?.createView();e!=this.#Pt&&(this.#so.forEach((e=>{!e.texture&&e.bindGroupEntry?.resource&&(e.bindGroupEntry.resource=t,this.#Lt=null)})),(0,o.el)(this.#Pt),(0,o.rL)(e),this.#Pt=e||null,this.#ho=t||null)}addUniformBuffer(e,t,i=GPUShaderStage.FRAGMENT|GPUShaderStage.VERTEX){if(this.#do(e))return;const n={uniformBufferLayout:t,uniformBufferValues:{},layoutEntry:{binding:e,visibility:i,buffer:{}},needsUpload:!0,bindGroupEntry:null,uniformBuffer:null,offsets:null};this.#oo.set(e,n),this.#fo()}addTexture(e,t,i=GPUShaderStage.FRAGMENT,n="float"){if(this.#do(e))return;const r={binding:e,visibility:i,texture:{sampleType:n}},o={texture:t,textureView:t?.createView()||null,layoutEntry:r,bindGroupEntry:null};this.#so.set(e,o),this.#fo()}addSampler(e,t=GPUShaderStage.FRAGMENT,i={addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",lodMinClamp:0,lodMaxClamp:10,maxAnisotropy:16},n={}){if(this.#do(e))return;const r={samplerDesc:i,layoutEntry:{binding:e,visibility:t,sampler:n},sampler:null,bindGroupEntry:null};this.#ao.set(e,r),this.#fo()}setUniformBufferValues(e,t=0){const i=this.#oo.get(t);if(i){for(const t in e){const n=i.uniformBufferLayout[t];n?(i.uniformBufferValues[t]=e[t],i.uniformBuffer&&a(i.uniformBuffer,i.offsets[t],n,e[t])):console.error("Uniform name not found in the UniformBufferLayout: ",t)}i.needsUpload=!0,this.#uo=!0}else console.error("Uniform buffer not found for binding: ",t)}setTexture(e,t){const i=this.#so.get(t);i?((0,o.el)(i.texture),(0,o.rL)(e),i.texture=e,i.textureView=e?.createView()||this.#ho,i.bindGroupEntry&&(i.bindGroupEntry.resource=i.textureView),this.#Lt=null):console.error("Texture not found for binding: ",t)}isAssigned(e){return void 0!==this.#po(e)}update(e){this.#wt||(this.#mo(e),this.#go(e),this.#vo(e)),this.#yo(e),this.#bo()}get layout(){return this.#wt}get bindGroup(){return this.#Lt}#go(e){for(const t of this.#oo.values()){(!t.uniformBuffer||!t.offsets)&&(this.#xo(e,t),this.#_o(t))}}#xo(e,t){const{buffer:i,offsets:n}=l(t.uniformBufferLayout,t.layoutEntry.visibility);i.setDevice(e),t.uniformBuffer=i,t.offsets=n}#_o(e){for(const t in e.uniformBufferValues){const i=e.uniformBufferLayout[t];a(e.uniformBuffer,e.offsets[t],i,e.uniformBufferValues[t]),e.uniformBuffer.upload(),e.needsUpload=!1}}#vo(e){this.#ao.forEach((t=>{t.sampler||(t.sampler=e.createSampler(t.samplerDesc))}))}#mo(e){const t=[];for(const e of this.#oo.values())t.push(e.layoutEntry);for(const e of this.#so.values())t.push(e.layoutEntry);for(const e of this.#ao.values())t.push(e.layoutEntry);this.#lo={entries:t},this.#wt=e.createBindGroupLayout(this.#lo)}#yo(e){this.#co||this.#Eo(),this.#Lt||(this.#Lt=e.createBindGroup({layout:this.#wt,entries:this.#co}))}#So(e){const t=e.uniformBuffer?.getBuffer(),i=e.textureView,n=e.sampler;return t?{buffer:t}:i||(n||null)}#Ao(e){const t={binding:e.layoutEntry.binding,resource:this.#So(e)};this.#co.push(t),e.bindGroupEntry=t}#Eo(){this.#co=[];for(const e of this.#oo.values())this.#Ao(e);for(const e of this.#so.values())e.textureView||this.#ho||console.error(`Texture is missing for binding: ${e.layoutEntry.binding}. Null textures are only allowed if a default texture is provided`),this.#Ao(e);for(const e of this.#ao.values())this.#Ao(e)}#wo(){this.#lo=null,this.#wt=null,this.#Lt=null,this.#oo.forEach((e=>{e.bindGroupEntry=null,e.uniformBuffer=null,e.offsets=null})),this.#so.forEach((e=>{e.bindGroupEntry=null})),this.#ao.forEach((e=>{e.bindGroupEntry=null}))}#fo(){this.#wo()}#po(e){const t=this.#oo.get(e),i=this.#so.get(e),n=this.#ao.get(e);return t||i||n}#do(e){return!!this.#po(e)&&(console.error("Binding ",e," is assigned."),!0)}#bo(){if(this.#uo){for(const e of this.#oo.values())e.needsUpload&&e.uniformBuffer.upload();this.#uo=!1}}}},65796:e=>{"use strict";e.exports="\n//https://www.shadertoy.com/view/ltc3zl\n//https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\n//Packs a float in the range 0-1 to an RGBA8\nfn packDepth( depth: f32 ) -> vec4f {\n var enc = vec4f(1.0, 255.0, 65025.0, 16581375.0) * depth;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);\n return enc;\n}\n\n//Used to unpack depth value when input depth texture is RGBA8\nfn unpackDepth( rgba_depth: vec4f ) -> f32 {\n return dot( rgba_depth, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/16581375.0) );\n}\n\n//Packs a float in the range 0-1 to an RGB8\nfn packDepth3( depth: f32 ) -> vec3f {\n var enc = vec3f(1.0, 255.0, 65025.0) * depth;\n enc = fract(enc);\n enc -= vec3f(enc.yz, 0.0) * vec3f(1.0/255.0 ,1.0/255.0, 0.0);\n return enc;\n}\n\n//Used to unpack depth value when input depth texture is RGB8\nfn unpackDepth3( rgba_depth: vec3f ) -> f32 {\n return dot( rgba_depth, vec3f(1.0, 1.0/255.0, 1.0/65025.0) );\n}\n\n//Packs depth in the range 0-1 in an RGB10\nfn packDepth10( depth: f32 ) -> vec3f {\n var enc = vec3f(1.0, 1023.0, 1023.0 * 1023.0) * depth;\n enc = fract(enc);\n enc -= vec3f(enc.yz, 0.0) * vec3f(1.0/1023.0 ,1.0/1023.0, 0.0);\n return enc;\n}\n\n//Used to unpack depth value when input depth texture is RGB10A2\nfn unpackDepth10( rgba_depth: vec3f ) -> f32 {\n return dot( rgba_depth, vec3f(1.0, 1.0/1023.0, 1.0/(1023.0*1023.0)) );\n}\n\n//Pack view space normal for use in rgb10unorm target\n//Packing the sign bits into the spare B component gives us\n//an extra bit of precision, until we need to pack something else into\n//that component. The difference in the SSAO output is not really visible\nfn packNormal10( normal: vec3f) -> vec3f {\n/*\n\t//we keep the absolute values of the x and y components (z is derived)\n\tvar res = abs(normal);\n\n\t//pack the sign bits of the x and y components into the z component\n\tvar sxIsNeg = clamp(-sign(res.x), 0.0, 1.0);\n\tvar syIsNeg = clamp(-sign(res.y), 0.0, 1.0);\n\tres.z = (sxIsNeg + 2.0 * syIsNeg) * 0.25;\n*/\n\tvar res = normal * 0.5 + vec3f(0.5);\n\n\treturn res;\n}\n\nfn unpackNormal10( value: vec3f) -> vec3f {\n/*\n\tvar res = value;\n\tvar signs = value.z * 4.0;\n\t//There's probably more efficient way to retrieve this\n\tif (signs >= 2.0) {\n\t\tres.y = -res.y;\n\t}\n\tif (signs == 1.0 || signs == 3.0) {\n\t\tres.x = -res.x;\n\t}\n\tres.z = sqrt(1.0 - dot(res.xy, res.xy));\n*/\n\tvar res = (value - vec3f(0.5)) * 2.0;\n\n\treturn res;\n}\n"},43851:e=>{"use strict";e.exports="\nstruct VertexOutput {\n\t@builtin(position) position: vec4f,\n\t@location(0) @interpolate(linear) vUv: vec2f\n}\n\n@vertex\nfn main(\n @builtin(vertex_index) VertexIndex : u32\n) -> VertexOutput {\n\n\t//Instead of using a screen quad we use a large triangle -- this is slightly\n\t//faster (~6% measured in our specific case), due to better cache coherency. See this article:\n\t//http://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/\n\n\tconst pos = array(\n\t\tvec2f(-1.0, -1.0),\n\t\tvec2f( 3.0, -1.0),\n\t\tvec2f(-1.0, 3.0),\n\t);\n\tconst uv = array(\n\t\tvec2f(0.0, 0.0),\n\t\tvec2f(2.0, 0.0),\n\t\tvec2f(0.0, 2.0),\n\t);\n\n\tvar output: VertexOutput;\n\toutput.position = vec4f(pos[VertexIndex], 0.0, 1.0);\n\toutput.vUv = uv[VertexIndex];\n\n\treturn output;\n}\n\n@vertex\nfn mainFlipY(\n @builtin(vertex_index) VertexIndex : u32\n) -> VertexOutput {\n\n\t//Instead of using a screen quad we use a large triangle -- this is slightly\n\t//faster (~6% measured in our specific case), due to better cache coherency. See this article:\n\t//http://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/\n\n\tconst pos = array(\n\t\tvec2f(-1.0, -1.0),\n\t\tvec2f( 3.0, -1.0),\n\t\tvec2f(-1.0, 3.0),\n\t);\n\tconst uv = array(\n\t\tvec2f(0.0, 1.0),\n\t\tvec2f(2.0, 1.0),\n\t\tvec2f(0.0, -1.0),\n\t);\n\n\tvar output: VertexOutput;\n\toutput.position = vec4f(pos[VertexIndex], 0.0, 1.0);\n\toutput.vUv = uv[VertexIndex];\n\n\treturn output;\n}"},86059:e=>{"use strict";e.exports="DELETED_WORKERNODE"},39709:()=>{},50684:()=>{},9631:()=>{},18215:()=>{},90315:()=>{},79306:(e,t,i)=>{"use strict";var n=i(94901),r=i(16823),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(r(e)+" is not a function")}},36194:(e,t,i)=>{"use strict";var n=i(72248).has;e.exports=function(e){return n(e),e}},73506:(e,t,i)=>{"use strict";var n=i(13925),r=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o("Can't set "+r(e)+" as a prototype")}},97080:(e,t,i)=>{"use strict";var n=i(94402).has;e.exports=function(e){return n(e),e}},76557:(e,t,i)=>{"use strict";var n=i(44995).has;e.exports=function(e){return n(e),e}},23755:(e,t,i)=>{"use strict";var n=i(88205).has;e.exports=function(e){return n(e),e}},6469:(e,t,i)=>{"use strict";var n=i(78227),r=i(2360),o=i(24913).f,s=n("unscopables"),a=Array.prototype;void 0===a[s]&&o(a,s,{configurable:!0,value:r(null)}),e.exports=function(e){a[s][e]=!0}},90679:(e,t,i)=>{"use strict";var n=i(1625),r=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new r("Incorrect invocation")}},28551:(e,t,i)=>{"use strict";var n=i(20034),r=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(r(e)+" is not an object")}},77811:e=>{"use strict";e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},15652:(e,t,i)=>{"use strict";var n=i(79039);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},94644:(e,t,i)=>{"use strict";var n,r,o,s=i(77811),a=i(43724),l=i(24475),c=i(94901),h=i(20034),u=i(39297),d=i(36955),f=i(16823),p=i(66699),m=i(36840),g=i(62106),v=i(1625),y=i(42787),b=i(52967),x=i(78227),_=i(33392),E=i(91181),S=E.enforce,A=E.get,w=l.Int8Array,T=w&&w.prototype,M=l.Uint8ClampedArray,C=M&&M.prototype,P=w&&y(w),D=T&&y(T),L=Object.prototype,I=l.TypeError,R=x("toStringTag"),O=_("TYPED_ARRAY_TAG"),N="TypedArrayConstructor",F=s&&!!b&&"Opera"!==d(l.opera),U=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},k={BigInt64Array:8,BigUint64Array:8},V=function(e){var t=y(e);if(h(t)){var i=A(t);return i&&u(i,N)?i[N]:V(t)}},G=function(e){if(!h(e))return!1;var t=d(e);return u(B,t)||u(k,t)};for(n in B)(o=(r=l[n])&&r.prototype)?S(o)[N]=r:F=!1;for(n in k)(o=(r=l[n])&&r.prototype)&&(S(o)[N]=r);if((!F||!c(P)||P===Function.prototype)&&(P=function(){throw new I("Incorrect invocation")},F))for(n in B)l[n]&&b(l[n],P);if((!F||!D||D===L)&&(D=P.prototype,F))for(n in B)l[n]&&b(l[n].prototype,D);if(F&&y(C)!==D&&b(C,D),a&&!u(D,R))for(n in U=!0,g(D,R,{configurable:!0,get:function(){return h(this)?this[O]:void 0}}),B)l[n]&&p(l[n],O,n);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:F,TYPED_ARRAY_TAG:U&&O,aTypedArray:function(e){if(G(e))return e;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(e){if(c(e)&&(!b||v(P,e)))return e;throw new I(f(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,n){if(a){if(i)for(var r in B){var o=l[r];if(o&&u(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}D[e]&&!i||m(D,e,i?t:F&&T[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,i){var n,r;if(a){if(b){if(i)for(n in B)if((r=l[n])&&u(r,e))try{delete r[e]}catch(e){}if(P[e]&&!i)return;try{return m(P,e,i?t:F&&P[e]||t)}catch(e){}}for(n in B)!(r=l[n])||r[e]&&!i||m(r,e,t)}},getTypedArrayConstructor:V,isView:function(e){if(!h(e))return!1;var t=d(e);return"DataView"===t||u(B,t)||u(k,t)},isTypedArray:G,TypedArray:P,TypedArrayPrototype:D}},19617:(e,t,i)=>{"use strict";var n=i(25397),r=i(35610),o=i(26198),s=function(e){return function(t,i,s){var a=n(t),l=o(a);if(0===l)return!e&&-1;var c,h=r(s,l);if(e&&i!=i){for(;l>h;)if((c=a[h++])!=c)return!0}else for(;l>h;h++)if((e||h in a)&&a[h]===i)return e||h||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},59213:(e,t,i)=>{"use strict";var n=i(76080),r=i(79504),o=i(47055),s=i(48981),a=i(26198),l=i(1469),c=r([].push),h=function(e){var t=1===e,i=2===e,r=3===e,h=4===e,u=6===e,d=7===e,f=5===e||u;return function(p,m,g,v){for(var y,b,x=s(p),_=o(x),E=a(_),S=n(m,g),A=0,w=v||l,T=t?w(p,E):i||d?w(p,0):void 0;E>A;A++)if((f||A in _)&&(b=S(y=_[A],A,x),e))if(t)T[A]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return A;case 2:c(T,y)}else switch(e){case 4:return!1;case 7:c(T,y)}return u?-1:r||h?h:T}};e.exports={forEach:h(0),map:h(1),filter:h(2),some:h(3),every:h(4),find:h(5),findIndex:h(6),filterReject:h(7)}},67680:(e,t,i)=>{"use strict";var n=i(79504);e.exports=n([].slice)},87433:(e,t,i)=>{"use strict";var n=i(34376),r=i(33517),o=i(20034),s=i(78227)("species"),a=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(r(t)&&(t===a||n(t.prototype))||o(t)&&null===(t=t[s]))&&(t=void 0)),void 0===t?a:t}},1469:(e,t,i)=>{"use strict";var n=i(87433);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},79565:(e,t,i)=>{"use strict";var n=i(79504),r=i(79306),o=i(64117),s=i(26198),a=i(48981),l=i(72248),c=i(26223),h=l.Map,u=l.has,d=l.set,f=n([].push);e.exports=function(e){var t,i,n,l=a(this),p=s(l),m=[],g=new h,v=o(e)?function(e){return e}:r(e);for(t=0;t<p;t++)n=v(i=l[t]),u(g,n)||d(g,n,i);return c(g,(function(e){f(m,e)})),m}},84428:(e,t,i)=>{"use strict";var n=i(78227)("iterator"),r=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){r=!0}};s[n]=function(){return this},Array.from(s,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!r)return!1}catch(e){return!1}var i=!1;try{var o={};o[n]=function(){return{next:function(){return{done:i=!0}}}},e(o)}catch(e){}return i}},44576:(e,t,i)=>{"use strict";var n=i(79504),r=n({}.toString),o=n("".slice);e.exports=function(e){return o(r(e),8,-1)}},36955:(e,t,i)=>{"use strict";var n=i(92140),r=i(94901),o=i(44576),s=i(78227)("toStringTag"),a=Object,l="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=a(e),s))?i:l?o(t):"Object"===(n=o(t))&&r(t.callee)?"Arguments":n}},70933:(e,t,i)=>{"use strict";var n=i(76080),r=i(28551),o=i(48981),s=i(72652);e.exports=function(e,t,i){return function(a){var l=o(a),c=arguments.length,h=c>1?arguments[1]:void 0,u=void 0!==h,d=u?n(h,c>2?arguments[2]:void 0):void 0,f=new e,p=0;return s(l,(function(e){var n=u?d(e,p++):e;i?t(f,r(n)[0],n[1]):t(f,n)})),f}}},87500:(e,t,i)=>{"use strict";var n=i(28551);e.exports=function(e,t,i){return function(){for(var r=new e,o=arguments.length,s=0;s<o;s++){var a=arguments[s];i?t(r,n(a)[0],a[1]):t(r,a)}return r}}},86938:(e,t,i)=>{"use strict";var n=i(2360),r=i(62106),o=i(56279),s=i(76080),a=i(90679),l=i(64117),c=i(72652),h=i(51088),u=i(62529),d=i(87633),f=i(43724),p=i(3451).fastKey,m=i(91181),g=m.set,v=m.getterFor;e.exports={getConstructor:function(e,t,i,h){var u=e((function(e,r){a(e,d),g(e,{type:t,index:n(null),first:void 0,last:void 0,size:0}),f||(e.size=0),l(r)||c(r,e[h],{that:e,AS_ENTRIES:i})})),d=u.prototype,m=v(t),y=function(e,t,i){var n,r,o=m(e),s=b(e,t);return s?s.value=i:(o.last=s={index:r=p(t,!0),key:t,value:i,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),f?o.size++:e.size++,"F"!==r&&(o.index[r]=s)),e},b=function(e,t){var i,n=m(e),r=p(t);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key===t)return i};return o(d,{clear:function(){for(var e=m(this),t=e.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=void 0),t=t.next;e.first=e.last=void 0,e.index=n(null),f?e.size=0:this.size=0},delete:function(e){var t=this,i=m(t),n=b(t,e);if(n){var r=n.next,o=n.previous;delete i.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),i.first===n&&(i.first=r),i.last===n&&(i.last=o),f?i.size--:t.size--}return!!n},forEach:function(e){for(var t,i=m(this),n=s(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!b(this,e)}}),o(d,i?{get:function(e){var t=b(this,e);return t&&t.value},set:function(e,t){return y(this,0===e?0:e,t)}}:{add:function(e){return y(this,e=0===e?0:e,e)}}),f&&r(d,"size",{configurable:!0,get:function(){return m(this).size}}),u},setStrong:function(e,t,i){var n=t+" Iterator",r=v(t),o=v(n);h(e,t,(function(e,t){g(this,{type:n,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?u("keys"===t?i.key:"values"===t?i.value:[i.key,i.value],!1):(e.target=void 0,u(void 0,!0))}),i?"entries":"values",!i,!0),d(t)}}},91625:(e,t,i)=>{"use strict";var n=i(79504),r=i(56279),o=i(3451).getWeakData,s=i(90679),a=i(28551),l=i(64117),c=i(20034),h=i(72652),u=i(59213),d=i(39297),f=i(91181),p=f.set,m=f.getterFor,g=u.find,v=u.findIndex,y=n([].splice),b=0,x=function(e){return e.frozen||(e.frozen=new _)},_=function(){this.entries=[]},E=function(e,t){return g(e.entries,(function(e){return e[0]===t}))};_.prototype={get:function(e){var t=E(this,e);if(t)return t[1]},has:function(e){return!!E(this,e)},set:function(e,t){var i=E(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=v(this.entries,(function(t){return t[0]===e}));return~t&&y(this.entries,t,1),!!~t}},e.exports={getConstructor:function(e,t,i,n){var u=e((function(e,r){s(e,f),p(e,{type:t,id:b++,frozen:void 0}),l(r)||h(r,e[n],{that:e,AS_ENTRIES:i})})),f=u.prototype,g=m(t),v=function(e,t,i){var n=g(e),r=o(a(t),!0);return!0===r?x(n).set(t,i):r[n.id]=i,e};return r(f,{delete:function(e){var t=g(this);if(!c(e))return!1;var i=o(e);return!0===i?x(t).delete(e):i&&d(i,t.id)&&delete i[t.id]},has:function(e){var t=g(this);if(!c(e))return!1;var i=o(e);return!0===i?x(t).has(e):i&&d(i,t.id)}}),r(f,i?{get:function(e){var t=g(this);if(c(e)){var i=o(e);return!0===i?x(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return v(this,e,t)}}:{add:function(e){return v(this,e,!0)}}),u}}},16468:(e,t,i)=>{"use strict";var n=i(46518),r=i(24475),o=i(79504),s=i(92796),a=i(36840),l=i(3451),c=i(72652),h=i(90679),u=i(94901),d=i(64117),f=i(20034),p=i(79039),m=i(84428),g=i(10687),v=i(23167);e.exports=function(e,t,i){var y=-1!==e.indexOf("Map"),b=-1!==e.indexOf("Weak"),x=y?"set":"add",_=r[e],E=_&&_.prototype,S=_,A={},w=function(e){var t=o(E[e]);a(E,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(b&&!f(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return b&&!f(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(b&&!f(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(s(e,!u(_)||!(b||E.forEach&&!p((function(){(new _).entries().next()})))))S=i.getConstructor(t,e,y,x),l.enable();else if(s(e,!0)){var T=new S,M=T[x](b?{}:-0,1)!==T,C=p((function(){T.has(1)})),P=m((function(e){new _(e)})),D=!b&&p((function(){for(var e=new _,t=5;t--;)e[x](t,t);return!e.has(-0)}));P||((S=t((function(e,t){h(e,E);var i=v(new _,e,S);return d(t)||c(t,i[x],{that:i,AS_ENTRIES:y}),i}))).prototype=E,E.constructor=S),(C||D)&&(w("delete"),w("has"),y&&w("get")),(D||M)&&w(x),b&&E.clear&&delete E.clear}return A[e]=S,n({global:!0,constructor:!0,forced:S!==_},A),g(S,e),b||i.setStrong(S,e,y),S}},59323:(e,t,i)=>{"use strict";i(36033),i(73772);var n=i(97751),r=i(2360),o=i(20034),s=Object,a=TypeError,l=n("Map"),c=n("WeakMap"),h=function(){this.object=null,this.symbol=null,this.primitives=null,this.objectsByIndex=r(null)};h.prototype.get=function(e,t){return this[e]||(this[e]=t())},h.prototype.next=function(e,t,i){var n=i?this.objectsByIndex[e]||(this.objectsByIndex[e]=new c):this.primitives||(this.primitives=new l),r=n.get(t);return r||n.set(t,r=new h),r};var u=new h;e.exports=function(){var e,t,i=u,n=arguments.length;for(e=0;e<n;e++)o(t=arguments[e])&&(i=i.next(e,t,!0));if(this===s&&i===u)throw new a("Composite keys must contain a non-primitive component");for(e=0;e<n;e++)o(t=arguments[e])||(i=i.next(e,t,!1));return i}},77740:(e,t,i)=>{"use strict";var n=i(39297),r=i(35031),o=i(77347),s=i(24913);e.exports=function(e,t,i){for(var a=r(t),l=s.f,c=o.f,h=0;h<a.length;h++){var u=a[h];n(e,u)||i&&n(i,u)||l(e,u,c(t,u))}}},12211:(e,t,i)=>{"use strict";var n=i(79039);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},62529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},66699:(e,t,i)=>{"use strict";var n=i(43724),r=i(24913),o=i(6980);e.exports=n?function(e,t,i){return r.f(e,t,o(1,i))}:function(e,t,i){return e[t]=i,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},62106:(e,t,i)=>{"use strict";var n=i(50283),r=i(24913);e.exports=function(e,t,i){return i.get&&n(i.get,t,{getter:!0}),i.set&&n(i.set,t,{setter:!0}),r.f(e,t,i)}},36840:(e,t,i)=>{"use strict";var n=i(94901),r=i(24913),o=i(50283),s=i(39433);e.exports=function(e,t,i,a){a||(a={});var l=a.enumerable,c=void 0!==a.name?a.name:t;if(n(i)&&o(i,c,a),a.global)l?e[t]=i:s(t,i);else{try{a.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=i:r.f(e,t,{value:i,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},56279:(e,t,i)=>{"use strict";var n=i(36840);e.exports=function(e,t,i){for(var r in t)n(e,r,t[r],i);return e}},39433:(e,t,i)=>{"use strict";var n=i(24475),r=Object.defineProperty;e.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch(i){n[e]=t}return t}},43724:(e,t,i)=>{"use strict";var n=i(79039);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,i)=>{"use strict";var n=i(24475),r=i(20034),o=n.document,s=r(o)&&r(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},6763:e=>{"use strict";e.exports="function"==typeof Bun&&Bun&&"string"==typeof Bun.version},48119:(e,t,i)=>{"use strict";var n=i(79392);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},19088:(e,t,i)=>{"use strict";var n=i(24475),r=i(44576);e.exports="process"===r(n.process)},79392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},77388:(e,t,i)=>{"use strict";var n,r,o=i(24475),s=i(79392),a=o.process,l=o.Deno,c=a&&a.versions||l&&l.version,h=c&&c.v8;h&&(r=(n=h.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(r=+n[1]),e.exports=r},88727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},46518:(e,t,i)=>{"use strict";var n=i(24475),r=i(77347).f,o=i(66699),s=i(36840),a=i(39433),l=i(77740),c=i(92796);e.exports=function(e,t){var i,h,u,d,f,p=e.target,m=e.global,g=e.stat;if(i=m?n:g?n[p]||a(p,{}):n[p]&&n[p].prototype)for(h in t){if(d=t[h],u=e.dontCallGetSet?(f=r(i,h))&&f.value:i[h],!c(m?h:p+(g?".":"#")+h,e.forced)&&void 0!==u){if(typeof d==typeof u)continue;l(d,u)}(e.sham||u&&u.sham)&&o(d,"sham",!0),s(i,h,d,e)}}},79039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},92744:(e,t,i)=>{"use strict";var n=i(79039);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},18745:(e,t,i)=>{"use strict";var n=i(40616),r=Function.prototype,o=r.apply,s=r.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?s.bind(o):function(){return s.apply(o,arguments)})},76080:(e,t,i)=>{"use strict";var n=i(27476),r=i(79306),o=i(40616),s=n(n.bind);e.exports=function(e,t){return r(e),void 0===t?e:o?s(e,t):function(){return e.apply(t,arguments)}}},40616:(e,t,i)=>{"use strict";var n=i(79039);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},69565:(e,t,i)=>{"use strict";var n=i(40616),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},10350:(e,t,i)=>{"use strict";var n=i(43724),r=i(39297),o=Function.prototype,s=n&&Object.getOwnPropertyDescriptor,a=r(o,"name"),l=a&&"something"===function(){}.name,c=a&&(!n||n&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:l,CONFIGURABLE:c}},46706:(e,t,i)=>{"use strict";var n=i(79504),r=i(79306);e.exports=function(e,t,i){try{return n(r(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},27476:(e,t,i)=>{"use strict";var n=i(44576),r=i(79504);e.exports=function(e){if("Function"===n(e))return r(e)}},79504:(e,t,i)=>{"use strict";var n=i(40616),r=Function.prototype,o=r.call,s=n&&r.bind.bind(o,o);e.exports=n?s:function(e){return function(){return o.apply(e,arguments)}}},97751:(e,t,i)=>{"use strict";var n=i(24475),r=i(94901);e.exports=function(e,t){return arguments.length<2?(i=n[e],r(i)?i:void 0):n[e]&&n[e][t];var i}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},50851:(e,t,i)=>{"use strict";var n=i(36955),r=i(55966),o=i(64117),s=i(26269),a=i(78227)("iterator");e.exports=function(e){if(!o(e))return r(e,a)||r(e,"@@iterator")||s[n(e)]}},70081:(e,t,i)=>{"use strict";var n=i(69565),r=i(79306),o=i(28551),s=i(16823),a=i(50851),l=TypeError;e.exports=function(e,t){var i=arguments.length<2?a(e):t;if(r(i))return o(n(i,e));throw new l(s(e)+" is not iterable")}},55966:(e,t,i)=>{"use strict";var n=i(79306),r=i(64117);e.exports=function(e,t){var i=e[t];return r(i)?void 0:n(i)}},83789:(e,t,i)=>{"use strict";var n=i(79306),r=i(28551),o=i(69565),s=i(91291),a=i(1767),l="Invalid size",c=RangeError,h=TypeError,u=Math.max,d=function(e,t){this.set=e,this.size=u(t,0),this.has=n(e.has),this.keys=n(e.keys)};d.prototype={getIterator:function(){return a(r(o(this.keys,this.set)))},includes:function(e){return o(this.has,this.set,e)}},e.exports=function(e){r(e);var t=+e.size;if(t!=t)throw new h(l);var i=s(t);if(i<0)throw new c(l);return new d(e,i)}},24475:function(e,t,i){"use strict";var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},39297:(e,t,i)=>{"use strict";var n=i(79504),r=i(48981),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(r(e),t)}},30421:e=>{"use strict";e.exports={}},90757:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},20397:(e,t,i)=>{"use strict";var n=i(97751);e.exports=n("document","documentElement")},35917:(e,t,i)=>{"use strict";var n=i(43724),r=i(79039),o=i(4055);e.exports=!n&&!r((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},47055:(e,t,i)=>{"use strict";var n=i(79504),r=i(79039),o=i(44576),s=Object,a=n("".split);e.exports=r((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?a(e,""):s(e)}:s},23167:(e,t,i)=>{"use strict";var n=i(94901),r=i(20034),o=i(52967);e.exports=function(e,t,i){var s,a;return o&&n(s=t.constructor)&&s!==i&&r(a=s.prototype)&&a!==i.prototype&&o(e,a),e}},33706:(e,t,i)=>{"use strict";var n=i(79504),r=i(94901),o=i(77629),s=n(Function.toString);r(o.inspectSource)||(o.inspectSource=function(e){return s(e)}),e.exports=o.inspectSource},3451:(e,t,i)=>{"use strict";var n=i(46518),r=i(79504),o=i(30421),s=i(20034),a=i(39297),l=i(24913).f,c=i(38480),h=i(10298),u=i(34124),d=i(33392),f=i(92744),p=!1,m=d("meta"),g=0,v=function(e){l(e,m,{value:{objectID:"O"+g++,weakData:{}}})},y=e.exports={enable:function(){y.enable=function(){},p=!0;var e=c.f,t=r([].splice),i={};i[m]=1,e(i).length&&(c.f=function(i){for(var n=e(i),r=0,o=n.length;r<o;r++)if(n[r]===m){t(n,r,1);break}return n},n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:h.f}))},fastKey:function(e,t){if(!s(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,m)){if(!u(e))return"F";if(!t)return"E";v(e)}return e[m].objectID},getWeakData:function(e,t){if(!a(e,m)){if(!u(e))return!0;if(!t)return!1;v(e)}return e[m].weakData},onFreeze:function(e){return f&&p&&u(e)&&!a(e,m)&&v(e),e}};o[m]=!0},91181:(e,t,i)=>{"use strict";var n,r,o,s=i(58622),a=i(24475),l=i(20034),c=i(66699),h=i(39297),u=i(77629),d=i(66119),f=i(30421),p="Object already initialized",m=a.TypeError,g=a.WeakMap;if(s||u.state){var v=u.state||(u.state=new g);v.get=v.get,v.has=v.has,v.set=v.set,n=function(e,t){if(v.has(e))throw new m(p);return t.facade=e,v.set(e,t),t},r=function(e){return v.get(e)||{}},o=function(e){return v.has(e)}}else{var y=d("state");f[y]=!0,n=function(e,t){if(h(e,y))throw new m(p);return t.facade=e,c(e,y,t),t},r=function(e){return h(e,y)?e[y]:{}},o=function(e){return h(e,y)}}e.exports={set:n,get:r,has:o,enforce:function(e){return o(e)?r(e):n(e,{})},getterFor:function(e){return function(t){var i;if(!l(t)||(i=r(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return i}}}},44209:(e,t,i)=>{"use strict";var n=i(78227),r=i(26269),o=n("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||s[o]===e)}},34376:(e,t,i)=>{"use strict";var n=i(44576);e.exports=Array.isArray||function(e){return"Array"===n(e)}},94901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},33517:(e,t,i)=>{"use strict";var n=i(79504),r=i(79039),o=i(94901),s=i(36955),a=i(97751),l=i(33706),c=function(){},h=a("Reflect","construct"),u=/^\s*(?:class|function)\b/,d=n(u.exec),f=!u.test(c),p=function(e){if(!o(e))return!1;try{return h(c,[],e),!0}catch(e){return!1}},m=function(e){if(!o(e))return!1;switch(s(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!d(u,l(e))}catch(e){return!0}};m.sham=!0,e.exports=!h||r((function(){var e;return p(p.call)||!p(Object)||!p((function(){e=!0}))||e}))?m:p},92796:(e,t,i)=>{"use strict";var n=i(79039),r=i(94901),o=/#|\.prototype\./,s=function(e,t){var i=l[a(e)];return i===h||i!==c&&(r(t)?n(t):!!t)},a=s.normalize=function(e){return String(e).replace(o,".").toLowerCase()},l=s.data={},c=s.NATIVE="N",h=s.POLYFILL="P";e.exports=s},31563:(e,t,i)=>{"use strict";var n=i(36955),r=i(39297),o=i(64117),s=i(78227),a=i(26269),l=s("iterator"),c=Object;e.exports=function(e){if(o(e))return!1;var t=c(e);return void 0!==t[l]||"@@iterator"in t||r(a,n(t))}},64117:e=>{"use strict";e.exports=function(e){return null==e}},20034:(e,t,i)=>{"use strict";var n=i(94901);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},13925:(e,t,i)=>{"use strict";var n=i(20034);e.exports=function(e){return n(e)||null===e}},96395:e=>{"use strict";e.exports=!1},10757:(e,t,i)=>{"use strict";var n=i(97751),r=i(94901),o=i(1625),s=i(7040),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return r(t)&&o(t.prototype,a(e))}},40507:(e,t,i)=>{"use strict";var n=i(69565);e.exports=function(e,t,i){for(var r,o,s=i?e:e.iterator,a=e.next;!(r=n(a,s)).done;)if(void 0!==(o=t(r.value)))return o}},72652:(e,t,i)=>{"use strict";var n=i(76080),r=i(69565),o=i(28551),s=i(16823),a=i(44209),l=i(26198),c=i(1625),h=i(70081),u=i(50851),d=i(9539),f=TypeError,p=function(e,t){this.stopped=e,this.result=t},m=p.prototype;e.exports=function(e,t,i){var g,v,y,b,x,_,E,S=i&&i.that,A=!(!i||!i.AS_ENTRIES),w=!(!i||!i.IS_RECORD),T=!(!i||!i.IS_ITERATOR),M=!(!i||!i.INTERRUPTED),C=n(t,S),P=function(e){return g&&d(g,"normal",e),new p(!0,e)},D=function(e){return A?(o(e),M?C(e[0],e[1],P):C(e[0],e[1])):M?C(e,P):C(e)};if(w)g=e.iterator;else if(T)g=e;else{if(!(v=u(e)))throw new f(s(e)+" is not iterable");if(a(v)){for(y=0,b=l(e);b>y;y++)if((x=D(e[y]))&&c(m,x))return x;return new p(!1)}g=h(e,v)}for(_=w?e.next:g.next;!(E=r(_,g)).done;){try{x=D(E.value)}catch(e){d(g,"throw",e)}if("object"==typeof x&&x&&c(m,x))return x}return new p(!1)}},9539:(e,t,i)=>{"use strict";var n=i(69565),r=i(28551),o=i(55966);e.exports=function(e,t,i){var s,a;r(e);try{if(!(s=o(e,"return"))){if("throw"===t)throw i;return i}s=n(s,e)}catch(e){a=!0,s=e}if("throw"===t)throw i;if(a)throw s;return r(s),i}},33994:(e,t,i)=>{"use strict";var n=i(57657).IteratorPrototype,r=i(2360),o=i(6980),s=i(10687),a=i(26269),l=function(){return this};e.exports=function(e,t,i,c){var h=t+" Iterator";return e.prototype=r(n,{next:o(+!c,i)}),s(e,h,!1,!0),a[h]=l,e}},51088:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(96395),s=i(10350),a=i(94901),l=i(33994),c=i(42787),h=i(52967),u=i(10687),d=i(66699),f=i(36840),p=i(78227),m=i(26269),g=i(57657),v=s.PROPER,y=s.CONFIGURABLE,b=g.IteratorPrototype,x=g.BUGGY_SAFARI_ITERATORS,_=p("iterator"),E="keys",S="values",A="entries",w=function(){return this};e.exports=function(e,t,i,s,p,g,T){l(i,t,s);var M,C,P,D=function(e){if(e===p&&N)return N;if(!x&&e&&e in R)return R[e];switch(e){case E:case S:case A:return function(){return new i(this,e)}}return function(){return new i(this)}},L=t+" Iterator",I=!1,R=e.prototype,O=R[_]||R["@@iterator"]||p&&R[p],N=!x&&O||D(p),F="Array"===t&&R.entries||O;if(F&&(M=c(F.call(new e)))!==Object.prototype&&M.next&&(o||c(M)===b||(h?h(M,b):a(M[_])||f(M,_,w)),u(M,L,!0,!0),o&&(m[L]=w)),v&&p===S&&O&&O.name!==S&&(!o&&y?d(R,"name",S):(I=!0,N=function(){return r(O,this)})),p)if(C={values:D(S),keys:g?N:D(E),entries:D(A)},T)for(P in C)(x||I||!(P in R))&&f(R,P,C[P]);else n({target:t,proto:!0,forced:x||I},C);return o&&!T||R[_]===N||f(R,_,N,{name:p}),m[t]=N,C}},57657:(e,t,i)=>{"use strict";var n,r,o,s=i(79039),a=i(94901),l=i(20034),c=i(2360),h=i(42787),u=i(36840),d=i(78227),f=i(96395),p=d("iterator"),m=!1;[].keys&&("next"in(o=[].keys())?(r=h(h(o)))!==Object.prototype&&(n=r):m=!0),!l(n)||s((function(){var e={};return n[p].call(e)!==e}))?n={}:f&&(n=c(n)),a(n[p])||u(n,p,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:m}},26269:e=>{"use strict";e.exports={}},26198:(e,t,i)=>{"use strict";var n=i(18014);e.exports=function(e){return n(e.length)}},50283:(e,t,i)=>{"use strict";var n=i(79504),r=i(79039),o=i(94901),s=i(39297),a=i(43724),l=i(10350).CONFIGURABLE,c=i(33706),h=i(91181),u=h.enforce,d=h.get,f=String,p=Object.defineProperty,m=n("".slice),g=n("".replace),v=n([].join),y=a&&!r((function(){return 8!==p((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,i){"Symbol("===m(f(t),0,7)&&(t="["+g(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!s(e,"name")||l&&e.name!==t)&&(a?p(e,"name",{value:t,configurable:!0}):e.name=t),y&&i&&s(i,"arity")&&e.length!==i.arity&&p(e,"length",{value:i.arity});try{i&&s(i,"constructor")&&i.constructor?a&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=u(e);return s(n,"source")||(n.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return o(this)&&d(this).source||c(this)}),"toString")},72248:(e,t,i)=>{"use strict";var n=i(79504),r=Map.prototype;e.exports={Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}},26223:(e,t,i)=>{"use strict";var n=i(79504),r=i(40507),o=i(72248),s=o.Map,a=o.proto,l=n(a.forEach),c=n(a.entries),h=c(new s).next;e.exports=function(e,t,i){return i?r({iterator:c(e),next:h},(function(e){return t(e[1],e[0])})):l(e,t)}},33164:(e,t,i)=>{"use strict";var n=i(77782),r=Math.abs,o=2220446049250313e-31,s=1/o;e.exports=function(e,t,i,a){var l=+e,c=r(l),h=n(l);if(c<a)return h*function(e){return e+s-s}(c/a/t)*a*t;var u=(1+t/o)*c,d=u-(u-c);return d>i||d!=d?h*(1/0):h*d}},15617:(e,t,i)=>{"use strict";var n=i(33164);e.exports=Math.fround||function(e){return n(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}},77905:e=>{"use strict";e.exports=Math.scale||function(e,t,i,n,r){var o=+e,s=+t,a=+i,l=+n,c=+r;return o!=o||s!=s||a!=a||l!=l||c!=c?NaN:o===1/0||o===-1/0?o:(o-s)*(c-l)/(a-s)+l}},77782:e=>{"use strict";e.exports=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1}},80741:e=>{"use strict";var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?i:t)(n)}},36043:(e,t,i)=>{"use strict";var n=i(79306),r=TypeError,o=function(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw new r("Bad Promise constructor");t=e,i=n})),this.resolve=n(t),this.reject=n(i)};e.exports.f=function(e){return new o(e)}},50360:(e,t,i)=>{"use strict";var n=i(24475).isFinite;e.exports=Number.isFinite||function(e){return"number"==typeof e&&n(e)}},2360:(e,t,i)=>{"use strict";var n,r=i(28551),o=i(96801),s=i(88727),a=i(30421),l=i(20397),c=i(4055),h=i(66119),u="prototype",d="script",f=h("IE_PROTO"),p=function(){},m=function(e){return"<"+d+">"+e+"</"+d+">"},g=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,i;v="undefined"!=typeof document?document.domain&&n?g(n):(t=c("iframe"),i="java"+d+":",t.style.display="none",l.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):g(n);for(var r=s.length;r--;)delete v[u][s[r]];return v()};a[f]=!0,e.exports=Object.create||function(e,t){var i;return null!==e?(p[u]=r(e),i=new p,p[u]=null,i[f]=e):i=v(),void 0===t?i:o.f(i,t)}},96801:(e,t,i)=>{"use strict";var n=i(43724),r=i(48686),o=i(24913),s=i(28551),a=i(25397),l=i(71072);t.f=n&&!r?Object.defineProperties:function(e,t){s(e);for(var i,n=a(t),r=l(t),c=r.length,h=0;c>h;)o.f(e,i=r[h++],n[i]);return e}},24913:(e,t,i)=>{"use strict";var n=i(43724),r=i(35917),o=i(48686),s=i(28551),a=i(56969),l=TypeError,c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,u="enumerable",d="configurable",f="writable";t.f=n?o?function(e,t,i){if(s(e),t=a(t),s(i),"function"==typeof e&&"prototype"===t&&"value"in i&&f in i&&!i[f]){var n=h(e,t);n&&n[f]&&(e[t]=i.value,i={configurable:d in i?i[d]:n[d],enumerable:u in i?i[u]:n[u],writable:!1})}return c(e,t,i)}:c:function(e,t,i){if(s(e),t=a(t),s(i),r)try{return c(e,t,i)}catch(e){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},77347:(e,t,i)=>{"use strict";var n=i(43724),r=i(69565),o=i(48773),s=i(6980),a=i(25397),l=i(56969),c=i(39297),h=i(35917),u=Object.getOwnPropertyDescriptor;t.f=n?u:function(e,t){if(e=a(e),t=l(t),h)try{return u(e,t)}catch(e){}if(c(e,t))return s(!r(o.f,e,t),e[t])}},10298:(e,t,i)=>{"use strict";var n=i(44576),r=i(25397),o=i(38480).f,s=i(67680),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"Window"===n(e)?function(e){try{return o(e)}catch(e){return s(a)}}(e):o(r(e))}},38480:(e,t,i)=>{"use strict";var n=i(61828),r=i(88727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,r)}},33717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},42787:(e,t,i)=>{"use strict";var n=i(39297),r=i(94901),o=i(48981),s=i(66119),a=i(12211),l=s("IE_PROTO"),c=Object,h=c.prototype;e.exports=a?c.getPrototypeOf:function(e){var t=o(e);if(n(t,l))return t[l];var i=t.constructor;return r(i)&&t instanceof i?i.prototype:t instanceof c?h:null}},34124:(e,t,i)=>{"use strict";var n=i(79039),r=i(20034),o=i(44576),s=i(15652),a=Object.isExtensible,l=n((function(){a(1)}));e.exports=l||s?function(e){return!!r(e)&&((!s||"ArrayBuffer"!==o(e))&&(!a||a(e)))}:a},1625:(e,t,i)=>{"use strict";var n=i(79504);e.exports=n({}.isPrototypeOf)},61828:(e,t,i)=>{"use strict";var n=i(79504),r=i(39297),o=i(25397),s=i(19617).indexOf,a=i(30421),l=n([].push);e.exports=function(e,t){var i,n=o(e),c=0,h=[];for(i in n)!r(a,i)&&r(n,i)&&l(h,i);for(;t.length>c;)r(n,i=t[c++])&&(~s(h,i)||l(h,i));return h}},71072:(e,t,i)=>{"use strict";var n=i(61828),r=i(88727);e.exports=Object.keys||function(e){return n(e,r)}},48773:(e,t)=>{"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);t.f=r?function(e){var t=n(this,e);return!!t&&t.enumerable}:i},52967:(e,t,i)=>{"use strict";var n=i(46706),r=i(20034),o=i(67750),s=i(73506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=n(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(e){}return function(i,n){return o(i),s(n),r(i)?(t?e(i,n):i.__proto__=n,i):i}}():void 0)},84270:(e,t,i)=>{"use strict";var n=i(69565),r=i(94901),o=i(20034),s=TypeError;e.exports=function(e,t){var i,a;if("string"===t&&r(i=e.toString)&&!o(a=n(i,e)))return a;if(r(i=e.valueOf)&&!o(a=n(i,e)))return a;if("string"!==t&&r(i=e.toString)&&!o(a=n(i,e)))return a;throw new s("Can't convert object to primitive value")}},35031:(e,t,i)=>{"use strict";var n=i(97751),r=i(79504),o=i(38480),s=i(33717),a=i(28551),l=r([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(a(e)),i=s.f;return i?l(t,i(e)):t}},19167:(e,t,i)=>{"use strict";var n=i(24475);e.exports=n},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},18449:(e,t,i)=>{"use strict";i(36033),i(73772);var n=i(97751),r=i(79504),o=i(25745),s=n("Map"),a=n("WeakMap"),l=r([].push),c=o("metadata"),h=c.store||(c.store=new a),u=function(e,t,i){var n=h.get(e);if(!n){if(!i)return;h.set(e,n=new s)}var r=n.get(t);if(!r){if(!i)return;n.set(t,r=new s)}return r};e.exports={store:h,getMap:u,has:function(e,t,i){var n=u(t,i,!1);return void 0!==n&&n.has(e)},get:function(e,t,i){var n=u(t,i,!1);return void 0===n?void 0:n.get(e)},set:function(e,t,i,n){u(i,n,!0).set(e,t)},keys:function(e,t){var i=u(e,t,!1),n=[];return i&&i.forEach((function(e,t){l(n,t)})),n},toKey:function(e){return void 0===e||"symbol"==typeof e?e:String(e)}}},67979:(e,t,i)=>{"use strict";var n=i(28551);e.exports=function(){var e=n(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},67750:(e,t,i)=>{"use strict";var n=i(64117),r=TypeError;e.exports=function(e){if(n(e))throw new r("Can't call method on "+e);return e}},33317:e=>{"use strict";e.exports=function(e,t){return e===t||e!=e&&t!=t}},79472:(e,t,i)=>{"use strict";var n,r=i(24475),o=i(18745),s=i(94901),a=i(6763),l=i(79392),c=i(67680),h=i(22812),u=r.Function,d=/MSIE .\./.test(l)||a&&((n=r.Bun.version.split(".")).length<3||"0"===n[0]&&(n[1]<3||"3"===n[1]&&"0"===n[2]));e.exports=function(e,t){var i=t?2:1;return d?function(n,r){var a=h(arguments.length,1)>i,l=s(n)?n:u(n),d=a?c(arguments,i):[],f=a?function(){o(l,this,d)}:l;return t?e(f,r):e(f)}:e}},89286:(e,t,i)=>{"use strict";var n=i(94402),r=i(38469),o=n.Set,s=n.add;e.exports=function(e){var t=new o;return r(e,(function(e){s(t,e)})),t}},83440:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402),o=i(89286),s=i(25170),a=i(83789),l=i(38469),c=i(40507),h=r.has,u=r.remove;e.exports=function(e){var t=n(this),i=a(e),r=o(t);return s(t)<=i.size?l(t,(function(e){i.includes(e)&&u(r,e)})):c(i.getIterator(),(function(e){h(t,e)&&u(r,e)})),r}},94402:(e,t,i)=>{"use strict";var n=i(79504),r=Set.prototype;e.exports={Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}},68750:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402),o=i(25170),s=i(83789),a=i(38469),l=i(40507),c=r.Set,h=r.add,u=r.has;e.exports=function(e){var t=n(this),i=s(e),r=new c;return o(t)>i.size?l(i.getIterator(),(function(e){u(t,e)&&h(r,e)})):a(t,(function(e){i.includes(e)&&h(r,e)})),r}},64449:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402).has,o=i(25170),s=i(83789),a=i(38469),l=i(40507),c=i(9539);e.exports=function(e){var t=n(this),i=s(e);if(o(t)<=i.size)return!1!==a(t,(function(e){if(i.includes(e))return!1}),!0);var h=i.getIterator();return!1!==l(h,(function(e){if(r(t,e))return c(h,"normal",!1)}))}},53838:(e,t,i)=>{"use strict";var n=i(97080),r=i(25170),o=i(38469),s=i(83789);e.exports=function(e){var t=n(this),i=s(e);return!(r(t)>i.size)&&!1!==o(t,(function(e){if(!i.includes(e))return!1}),!0)}},28527:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402).has,o=i(25170),s=i(83789),a=i(40507),l=i(9539);e.exports=function(e){var t=n(this),i=s(e);if(o(t)<i.size)return!1;var c=i.getIterator();return!1!==a(c,(function(e){if(!r(t,e))return l(c,"normal",!1)}))}},38469:(e,t,i)=>{"use strict";var n=i(79504),r=i(40507),o=i(94402),s=o.Set,a=o.proto,l=n(a.forEach),c=n(a.keys),h=c(new s).next;e.exports=function(e,t,i){return i?r({iterator:c(e),next:h},t):l(e,t)}},25170:(e,t,i)=>{"use strict";var n=i(46706),r=i(94402);e.exports=n(r.proto,"size","get")||function(e){return e.size}},87633:(e,t,i)=>{"use strict";var n=i(97751),r=i(62106),o=i(78227),s=i(43724),a=o("species");e.exports=function(e){var t=n(e);s&&t&&!t[a]&&r(t,a,{configurable:!0,get:function(){return this}})}},83650:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402),o=i(89286),s=i(83789),a=i(40507),l=r.add,c=r.has,h=r.remove;e.exports=function(e){var t=n(this),i=s(e).getIterator(),r=o(t);return a(i,(function(e){c(t,e)?h(r,e):l(r,e)})),r}},10687:(e,t,i)=>{"use strict";var n=i(24913).f,r=i(39297),o=i(78227)("toStringTag");e.exports=function(e,t,i){e&&!i&&(e=e.prototype),e&&!r(e,o)&&n(e,o,{configurable:!0,value:t})}},44204:(e,t,i)=>{"use strict";var n=i(97080),r=i(94402).add,o=i(89286),s=i(83789),a=i(40507);e.exports=function(e){var t=n(this),i=s(e).getIterator(),l=o(t);return a(i,(function(e){r(l,e)})),l}},66119:(e,t,i)=>{"use strict";var n=i(25745),r=i(33392),o=n("keys");e.exports=function(e){return o[e]||(o[e]=r(e))}},77629:(e,t,i)=>{"use strict";var n=i(96395),r=i(24475),o=i(39433),s="__core-js_shared__",a=e.exports=r[s]||o(s,{});(a.versions||(a.versions=[])).push({version:"3.36.1",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"})},25745:(e,t,i)=>{"use strict";var n=i(77629);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},68183:(e,t,i)=>{"use strict";var n=i(79504),r=i(91291),o=i(655),s=i(67750),a=n("".charAt),l=n("".charCodeAt),c=n("".slice),h=function(e){return function(t,i){var n,h,u=o(s(t)),d=r(i),f=u.length;return d<0||d>=f?e?"":void 0:(n=l(u,d))<55296||n>56319||d+1===f||(h=l(u,d+1))<56320||h>57343?e?a(u,d):n:e?c(u,d,d+2):h-56320+(n-55296<<10)+65536}};e.exports={codeAt:h(!1),charAt:h(!0)}},4495:(e,t,i)=>{"use strict";var n=i(77388),r=i(79039),o=i(24475).String;e.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},59225:(e,t,i)=>{"use strict";var n,r,o,s,a=i(24475),l=i(18745),c=i(76080),h=i(94901),u=i(39297),d=i(79039),f=i(20397),p=i(67680),m=i(4055),g=i(22812),v=i(48119),y=i(19088),b=a.setImmediate,x=a.clearImmediate,_=a.process,E=a.Dispatch,S=a.Function,A=a.MessageChannel,w=a.String,T=0,M={},C="onreadystatechange";d((function(){n=a.location}));var P=function(e){if(u(M,e)){var t=M[e];delete M[e],t()}},D=function(e){return function(){P(e)}},L=function(e){P(e.data)},I=function(e){a.postMessage(w(e),n.protocol+"//"+n.host)};b&&x||(b=function(e){g(arguments.length,1);var t=h(e)?e:S(e),i=p(arguments,1);return M[++T]=function(){l(t,void 0,i)},r(T),T},x=function(e){delete M[e]},y?r=function(e){_.nextTick(D(e))}:E&&E.now?r=function(e){E.now(D(e))}:A&&!v?(s=(o=new A).port2,o.port1.onmessage=L,r=c(s.postMessage,s)):a.addEventListener&&h(a.postMessage)&&!a.importScripts&&n&&"file:"!==n.protocol&&!d(I)?(r=I,a.addEventListener("message",L,!1)):r=C in m("script")?function(e){f.appendChild(m("script"))[C]=function(){f.removeChild(this),P(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:b,clear:x}},35610:(e,t,i)=>{"use strict";var n=i(91291),r=Math.max,o=Math.min;e.exports=function(e,t){var i=n(e);return i<0?r(i+t,0):o(i,t)}},25397:(e,t,i)=>{"use strict";var n=i(47055),r=i(67750);e.exports=function(e){return n(r(e))}},91291:(e,t,i)=>{"use strict";var n=i(80741);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},18014:(e,t,i)=>{"use strict";var n=i(91291),r=Math.min;e.exports=function(e){var t=n(e);return t>0?r(t,9007199254740991):0}},48981:(e,t,i)=>{"use strict";var n=i(67750),r=Object;e.exports=function(e){return r(n(e))}},58229:(e,t,i)=>{"use strict";var n=i(99590),r=RangeError;e.exports=function(e,t){var i=n(e);if(i%t)throw new r("Wrong offset");return i}},99590:(e,t,i)=>{"use strict";var n=i(91291),r=RangeError;e.exports=function(e){var t=n(e);if(t<0)throw new r("The argument can't be less than 0");return t}},72777:(e,t,i)=>{"use strict";var n=i(69565),r=i(20034),o=i(10757),s=i(55966),a=i(84270),l=i(78227),c=TypeError,h=l("toPrimitive");e.exports=function(e,t){if(!r(e)||o(e))return e;var i,l=s(e,h);if(l){if(void 0===t&&(t="default"),i=n(l,e,t),!r(i)||o(i))return i;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},56969:(e,t,i)=>{"use strict";var n=i(72777),r=i(10757);e.exports=function(e){var t=n(e,"string");return r(t)?t:t+""}},47650:(e,t,i)=>{"use strict";var n=i(97751),r=i(94901),o=i(31563),s=i(20034),a=n("Set");e.exports=function(e){return function(e){return s(e)&&"number"==typeof e.size&&r(e.has)&&r(e.keys)}(e)?e:o(e)?new a(e):e}},92140:(e,t,i)=>{"use strict";var n={};n[i(78227)("toStringTag")]="z",e.exports="[object z]"===String(n)},655:(e,t,i)=>{"use strict";var n=i(36955),r=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return r(e)}},16823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},33392:(e,t,i)=>{"use strict";var n=i(79504),r=0,o=Math.random(),s=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++r+o,36)}},7040:(e,t,i)=>{"use strict";var n=i(4495);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},48686:(e,t,i)=>{"use strict";var n=i(43724),r=i(79039);e.exports=n&&r((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},22812:e=>{"use strict";var t=TypeError;e.exports=function(e,i){if(e<i)throw new t("Not enough arguments");return e}},58622:(e,t,i)=>{"use strict";var n=i(24475),r=i(94901),o=n.WeakMap;e.exports=r(o)&&/native code/.test(String(o))},44995:(e,t,i)=>{"use strict";var n=i(79504),r=WeakMap.prototype;e.exports={WeakMap,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete)}},88205:(e,t,i)=>{"use strict";var n=i(79504),r=WeakSet.prototype;e.exports={WeakSet,add:n(r.add),has:n(r.has),remove:n(r.delete)}},70511:(e,t,i)=>{"use strict";var n=i(19167),r=i(39297),o=i(1951),s=i(24913).f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});r(t,e)||s(t,e,{value:o.f(e)})}},1951:(e,t,i)=>{"use strict";var n=i(78227);t.f=n},78227:(e,t,i)=>{"use strict";var n=i(24475),r=i(25745),o=i(39297),s=i(33392),a=i(4495),l=i(7040),c=n.Symbol,h=r("wks"),u=l?c.for||c:c&&c.withoutSetter||s;e.exports=function(e){return o(h,e)||(h[e]=a&&o(c,e)?c[e]:u("Symbol."+e)),h[e]}},74423:(e,t,i)=>{"use strict";var n=i(46518),r=i(19617).includes,o=i(79039),s=i(6469);n({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),s("includes")},48523:(e,t,i)=>{"use strict";i(16468)("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),i(86938))},47072:(e,t,i)=>{"use strict";var n=i(46518),r=i(79504),o=i(79306),s=i(67750),a=i(72652),l=i(72248),c=i(96395),h=l.Map,u=l.has,d=l.get,f=l.set,p=r([].push);n({target:"Map",stat:!0,forced:c},{groupBy:function(e,t){s(e),o(t);var i=new h,n=0;return a(e,(function(e){var r=t(e,n++);u(i,r)?p(d(i,r),e):f(i,r,[e])})),i}})},36033:(e,t,i)=>{"use strict";i(48523)},69479:(e,t,i)=>{"use strict";var n=i(24475),r=i(43724),o=i(62106),s=i(67979),a=i(79039),l=n.RegExp,c=l.prototype;r&&a((function(){var e=!0;try{l(".","d")}catch(t){e=!1}var t={},i="",n=e?"dgimsy":"gimsy",r=function(e,n){Object.defineProperty(t,e,{get:function(){return i+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in e&&(o.hasIndices="d"),o)r(s,o[s]);return Object.getOwnPropertyDescriptor(c,"flags").get.call(t)!==n||i!==n}))&&o(c,"flags",{configurable:!0,get:s})},28845:(e,t,i)=>{"use strict";var n=i(24475),r=i(69565),o=i(94644),s=i(26198),a=i(58229),l=i(48981),c=i(79039),h=n.RangeError,u=n.Int8Array,d=u&&u.prototype,f=d&&d.set,p=o.aTypedArray,m=o.exportTypedArrayMethod,g=!c((function(){var e=new Uint8ClampedArray(2);return r(f,e,{length:1,0:3},1),3!==e[1]})),v=g&&o.NATIVE_ARRAY_BUFFER_VIEWS&&c((function(){var e=new u(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));m("set",(function(e){p(this);var t=a(arguments.length>1?arguments[1]:void 0,1),i=l(e);if(g)return r(f,this,i,t);var n=this.length,o=s(i),c=0;if(o+t>n)throw new h("Wrong length");for(;c<o;)this[t+c]=i[c++]}),!g||v)},65746:(e,t,i)=>{"use strict";var n,r=i(92744),o=i(24475),s=i(79504),a=i(56279),l=i(3451),c=i(16468),h=i(91625),u=i(20034),d=i(91181).enforce,f=i(79039),p=i(58622),m=Object,g=Array.isArray,v=m.isExtensible,y=m.isFrozen,b=m.isSealed,x=m.freeze,_=m.seal,E=!o.ActiveXObject&&"ActiveXObject"in o,S=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},A=c("WeakMap",S,h),w=A.prototype,T=s(w.set);if(p)if(E){n=h.getConstructor(S,"WeakMap",!0),l.enable();var M=s(w.delete),C=s(w.has),P=s(w.get);a(w,{delete:function(e){if(u(e)&&!v(e)){var t=d(this);return t.frozen||(t.frozen=new n),M(this,e)||t.frozen.delete(e)}return M(this,e)},has:function(e){if(u(e)&&!v(e)){var t=d(this);return t.frozen||(t.frozen=new n),C(this,e)||t.frozen.has(e)}return C(this,e)},get:function(e){if(u(e)&&!v(e)){var t=d(this);return t.frozen||(t.frozen=new n),C(this,e)?P(this,e):t.frozen.get(e)}return P(this,e)},set:function(e,t){if(u(e)&&!v(e)){var i=d(this);i.frozen||(i.frozen=new n),C(this,e)?T(this,e,t):i.frozen.set(e,t)}else T(this,e,t);return this}})}else r&&f((function(){var e=x([]);return T(new A,e,1),!y(e)}))&&a(w,{set:function(e,t){var i;return g(e)&&(y(e)?i=x:b(e)&&(i=_)),T(this,e,t),i&&i(e),this}})},73772:(e,t,i)=>{"use strict";i(65746)},17656:(e,t,i)=>{"use strict";var n=i(43724),r=i(6469),o=i(48981),s=i(26198),a=i(62106);n&&(a(Array.prototype,"lastIndex",{configurable:!0,get:function(){var e=o(this),t=s(e);return 0===t?0:t-1}}),r("lastIndex"))},55105:(e,t,i)=>{"use strict";var n=i(43724),r=i(6469),o=i(48981),s=i(26198),a=i(62106);n&&(a(Array.prototype,"lastItem",{configurable:!0,get:function(){var e=o(this),t=s(e);return 0===t?void 0:e[t-1]},set:function(e){var t=o(this),i=s(t);return t[0===i?0:i-1]=e}}),r("lastItem"))},7467:(e,t,i)=>{"use strict";var n=i(46518),r=i(18745),o=i(59323),s=i(97751),a=i(2360),l=Object,c=function(){var e=s("Object","freeze");return e?e(a(null)):a(null)};n({global:!0,forced:!0},{compositeKey:function(){return r(o,l,arguments).get("object",c)}})},10586:(e,t,i)=>{"use strict";var n=i(46518),r=i(59323),o=i(97751),s=i(18745);n({global:!0,forced:!0},{compositeSymbol:function(){return 1===arguments.length&&"string"==typeof arguments[0]?o("Symbol").for(arguments[0]):s(r,null,arguments).get("symbol",o("Symbol"))}})},71517:(e,t,i)=>{"use strict";var n=i(46518),r=i(36194),o=i(72248).remove;n({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=r(this),i=!0,n=0,s=arguments.length;n<s;n++)e=o(t,arguments[n]),i=i&&e;return!!i}})},93777:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0);return!1!==s(t,(function(e,n){if(!i(e,n,t))return!1}),!0)}})},14190:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(72248),a=i(26223),l=s.Map,c=s.set;n({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=new l;return a(t,(function(e,r){i(e,r,t)&&c(n,r,e)})),n}})},86097:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=s(t,(function(e,n){if(i(e,n,t))return{key:n}}),!0);return n&&n.key}})},12359:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=s(t,(function(e,n){if(i(e,n,t))return{value:e}}),!0);return n&&n.value}})},39172:(e,t,i)=>{"use strict";var n=i(46518),r=i(72248);n({target:"Map",stat:!0,forced:!0},{from:i(70933)(r.Map,r.set,!0)})},57019:(e,t,i)=>{"use strict";i(47072)},17273:(e,t,i)=>{"use strict";var n=i(46518),r=i(33317),o=i(36194),s=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===s(o(this),(function(t){if(r(t,e))return!0}),!0)}})},81723:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(72652),s=i(94901),a=i(79306),l=i(72248).Map;n({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var i=new(s(this)?this:l);a(t);var n=a(i.set);return o(e,(function(e){r(n,i,t(e),e)})),i}})},27415:(e,t,i)=>{"use strict";var n=i(46518),r=i(36194),o=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=o(r(this),(function(t,i){if(t===e)return{key:i}}),!0);return t&&t.key}})},19929:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(72248),a=i(26223),l=s.Map,c=s.set;n({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=new l;return a(t,(function(e,r){c(n,i(e,r,t),e)})),n}})},37583:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(72248),a=i(26223),l=s.Map,c=s.set;n({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=new l;return a(t,(function(e,r){c(n,r,i(e,r,t))})),n}})},55122:(e,t,i)=>{"use strict";var n=i(46518),r=i(36194),o=i(72652),s=i(72248).set;n({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=r(this),i=arguments.length,n=0;n<i;)o(arguments[n++],(function(e,i){s(t,e,i)}),{AS_ENTRIES:!0});return t}})},16385:(e,t,i)=>{"use strict";var n=i(46518),r=i(72248);n({target:"Map",stat:!0,forced:!0},{of:i(87500)(r.Map,r.set,!0)})},20230:(e,t,i)=>{"use strict";var n=i(46518),r=i(79306),o=i(36194),s=i(26223),a=TypeError;n({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=o(this),i=arguments.length<2,n=i?void 0:arguments[1];if(r(e),s(t,(function(r,o){i?(i=!1,n=r):n=e(n,r,o,t)})),i)throw new a("Reduce of empty map with no initial value");return n}})},57268:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(36194),s=i(26223);n({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0);return!0===s(t,(function(e,n){if(i(e,n,t))return!0}),!0)}})},79733:(e,t,i)=>{"use strict";var n=i(46518),r=i(79306),o=i(36194),s=i(72248),a=TypeError,l=s.get,c=s.has,h=s.set;n({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var i=o(this),n=arguments.length;r(t);var s=c(i,e);if(!s&&n<3)throw new a("Updating absent value");var u=s?l(i,e):r(n>2?arguments[2]:void 0)(e,i);return h(i,e,t(u,e,i)),i}})},58179:(e,t,i)=>{"use strict";var n=i(46518),r=Math.min,o=Math.max;n({target:"Math",stat:!0,forced:!0},{clamp:function(e,t,i){return r(i,o(t,e))}})},30456:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,nonConfigurable:!0,nonWritable:!0},{DEG_PER_RAD:Math.PI/180})},74017:(e,t,i)=>{"use strict";var n=i(46518),r=180/Math.PI;n({target:"Math",stat:!0,forced:!0},{degrees:function(e){return e*r}})},79310:(e,t,i)=>{"use strict";var n=i(46518),r=i(77905),o=i(15617);n({target:"Math",stat:!0,forced:!0},{fscale:function(e,t,i,n,s){return o(r(e,t,i,n,s))}})},83062:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{iaddh:function(e,t,i,n){var r=e>>>0,o=i>>>0;return(t>>>0)+(n>>>0)+((r&o|(r|o)&~(r+o>>>0))>>>31)|0}})},96369:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{imulh:function(e,t){var i=65535,n=+e,r=+t,o=n&i,s=r&i,a=n>>16,l=r>>16,c=(a*s>>>0)+(o*s>>>16);return a*l+(c>>16)+((o*l>>>0)+(c&i)>>16)}})},15637:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{isubh:function(e,t,i,n){var r=e>>>0,o=i>>>0;return(t>>>0)-(n>>>0)-((~r&o|(r^~o)&r-o>>>0)>>>31)|0}})},2848:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,nonConfigurable:!0,nonWritable:!0},{RAD_PER_DEG:180/Math.PI})},24842:(e,t,i)=>{"use strict";var n=i(46518),r=Math.PI/180;n({target:"Math",stat:!0,forced:!0},{radians:function(e){return e*r}})},24746:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{scale:i(77905)})},33454:(e,t,i)=>{"use strict";var n=i(46518),r=i(28551),o=i(50360),s=i(33994),a=i(62529),l=i(91181),c="Seeded Random",h=c+" Generator",u=l.set,d=l.getterFor(h),f=TypeError,p=s((function(e){u(this,{type:h,seed:e%2147483647})}),c,(function(){var e=d(this),t=e.seed=(1103515245*e.seed+12345)%2147483647;return a((1073741823&t)/1073741823,!1)}));n({target:"Math",stat:!0,forced:!0},{seededPRNG:function(e){var t=r(e).seed;if(!o(t))throw new f('Math.seededPRNG() argument should have a "seed" field with a finite value.');return new p(t)}})},6660:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{signbit:function(e){var t=+e;return t==t&&0===t?1/t==-1/0:t<0}})},15941:(e,t,i)=>{"use strict";i(46518)({target:"Math",stat:!0,forced:!0},{umulh:function(e,t){var i=65535,n=+e,r=+t,o=n&i,s=r&i,a=n>>>16,l=r>>>16,c=(a*s>>>0)+(o*s>>>16);return a*l+(c>>>16)+((o*l>>>0)+(c&i)>>>16)}})},82101:(e,t,i)=>{"use strict";var n=i(46518),r=i(79504),o=i(91291),s="Invalid number representation",a=RangeError,l=SyntaxError,c=TypeError,h=parseInt,u=Math.pow,d=/^[\d.a-z]+$/,f=r("".charAt),p=r(d.exec),m=r(1..toString),g=r("".slice),v=r("".split);n({target:"Number",stat:!0,forced:!0},{fromString:function(e,t){var i=1;if("string"!=typeof e)throw new c(s);if(!e.length)throw new l(s);if("-"===f(e,0)&&(i=-1,!(e=g(e,1)).length))throw new l(s);var n=void 0===t?10:o(t);if(n<2||n>36)throw new a("Invalid radix");if(!p(d,e))throw new l(s);var r=v(e,"."),y=h(r[0],n);if(r.length>1&&(y+=h(r[1],n)/u(n,r[1].length)),10===n&&m(y,n)!==e)throw new l(s);return i*y}})},15239:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(43724),s=i(87633),a=i(79306),l=i(28551),c=i(90679),h=i(94901),u=i(64117),d=i(20034),f=i(55966),p=i(36840),m=i(56279),g=i(62106),v=i(90757),y=i(78227),b=i(91181),x=y("observable"),_="Observable",E="Subscription",S="SubscriptionObserver",A=b.getterFor,w=b.set,T=A(_),M=A(E),C=A(S),P=function(e){this.observer=l(e),this.cleanup=void 0,this.subscriptionObserver=void 0};P.prototype={type:E,clean:function(){var e=this.cleanup;if(e){this.cleanup=void 0;try{e()}catch(e){v(e)}}},close:function(){if(!o){var e=this.facade,t=this.subscriptionObserver;e.closed=!0,t&&(t.closed=!0)}this.observer=void 0},isClosed:function(){return void 0===this.observer}};var D=function(e,t){var i,n=w(this,new P(e));o||(this.closed=!1);try{(i=f(e,"start"))&&r(i,e,this)}catch(e){v(e)}if(!n.isClosed()){var s=n.subscriptionObserver=new L(n);try{var l=t(s),c=l;u(l)||(n.cleanup=h(l.unsubscribe)?function(){c.unsubscribe()}:a(l))}catch(e){return void s.error(e)}n.isClosed()&&n.clean()}};D.prototype=m({},{unsubscribe:function(){var e=M(this);e.isClosed()||(e.close(),e.clean())}}),o&&g(D.prototype,"closed",{configurable:!0,get:function(){return M(this).isClosed()}});var L=function(e){w(this,{type:S,subscriptionState:e}),o||(this.closed=!1)};L.prototype=m({},{next:function(e){var t=C(this).subscriptionState;if(!t.isClosed()){var i=t.observer;try{var n=f(i,"next");n&&r(n,i,e)}catch(e){v(e)}}},error:function(e){var t=C(this).subscriptionState;if(!t.isClosed()){var i=t.observer;t.close();try{var n=f(i,"error");n?r(n,i,e):v(e)}catch(e){v(e)}t.clean()}},complete:function(){var e=C(this).subscriptionState;if(!e.isClosed()){var t=e.observer;e.close();try{var i=f(t,"complete");i&&r(i,t)}catch(e){v(e)}e.clean()}}}),o&&g(L.prototype,"closed",{configurable:!0,get:function(){return C(this).subscriptionState.isClosed()}});var I=function(e){c(this,R),w(this,{type:_,subscriber:a(e)})},R=I.prototype;m(R,{subscribe:function(e){var t=arguments.length;return new D(h(e)?{next:e,error:t>1?arguments[1]:void 0,complete:t>2?arguments[2]:void 0}:d(e)?e:{},T(this).subscriber)}}),p(R,x,(function(){return this})),n({global:!0,constructor:!0,forced:!0},{Observable:I}),s(_)},9035:(e,t,i)=>{"use strict";var n=i(46518),r=i(97751),o=i(69565),s=i(28551),a=i(33517),l=i(70081),c=i(55966),h=i(72652),u=i(78227)("observable");n({target:"Observable",stat:!0,forced:!0},{from:function(e){var t=a(this)?this:r("Observable"),i=c(s(e),u);if(i){var n=s(o(i,e));return n.constructor===t?n:new t((function(e){return n.subscribe(e)}))}var d=l(e);return new t((function(e){h(d,(function(t,i){if(e.next(t),e.closed)return i()}),{IS_ITERATOR:!0,INTERRUPTED:!0}),e.complete()}))}})},2917:(e,t,i)=>{"use strict";i(15239),i(9035),i(78662)},78662:(e,t,i)=>{"use strict";var n=i(46518),r=i(97751),o=i(33517),s=r("Array");n({target:"Observable",stat:!0,forced:!0},{of:function(){for(var e=o(this)?this:r("Observable"),t=arguments.length,i=s(t),n=0;n<t;)i[n]=arguments[n++];return new e((function(e){for(var n=0;n<t;n++)if(e.next(i[n]),e.closed)return;e.complete()}))}})},47628:(e,t,i)=>{"use strict";var n=i(46518),r=i(36043),o=i(1103);n({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=r.f(this),i=o(e);return(i.error?t.reject:t.resolve)(i.value),t.promise}})},65186:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.toKey,a=r.set;n({target:"Reflect",stat:!0},{defineMetadata:function(e,t,i){var n=arguments.length<4?void 0:s(arguments[3]);a(e,t,o(i),n)}})},42978:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.toKey,a=r.getMap,l=r.store;n({target:"Reflect",stat:!0},{deleteMetadata:function(e,t){var i=arguments.length<3?void 0:s(arguments[2]),n=a(o(t),i,!1);if(void 0===n||!n.delete(e))return!1;if(n.size)return!0;var r=l.get(t);return r.delete(i),!!r.size||l.delete(t)}})},79852:(e,t,i)=>{"use strict";var n=i(46518),r=i(79504),o=i(18449),s=i(28551),a=i(42787),l=r(i(79565)),c=r([].concat),h=o.keys,u=o.toKey,d=function(e,t){var i=h(e,t),n=a(e);if(null===n)return i;var r=d(n,t);return r.length?i.length?l(c(i,r)):r:i};n({target:"Reflect",stat:!0},{getMetadataKeys:function(e){var t=arguments.length<2?void 0:u(arguments[1]);return d(s(e),t)}})},72527:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=i(42787),a=r.has,l=r.get,c=r.toKey,h=function(e,t,i){if(a(e,t,i))return l(e,t,i);var n=s(t);return null!==n?h(e,n,i):void 0};n({target:"Reflect",stat:!0},{getMetadata:function(e,t){var i=arguments.length<3?void 0:c(arguments[2]);return h(e,o(t),i)}})},40617:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.keys,a=r.toKey;n({target:"Reflect",stat:!0},{getOwnMetadataKeys:function(e){var t=arguments.length<2?void 0:a(arguments[1]);return s(o(e),t)}})},42376:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.get,a=r.toKey;n({target:"Reflect",stat:!0},{getOwnMetadata:function(e,t){var i=arguments.length<3?void 0:a(arguments[2]);return s(e,o(t),i)}})},73067:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=i(42787),a=r.has,l=r.toKey,c=function(e,t,i){if(a(e,t,i))return!0;var n=s(t);return null!==n&&c(e,n,i)};n({target:"Reflect",stat:!0},{hasMetadata:function(e,t){var i=arguments.length<3?void 0:l(arguments[2]);return c(e,o(t),i)}})},66820:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.has,a=r.toKey;n({target:"Reflect",stat:!0},{hasOwnMetadata:function(e,t){var i=arguments.length<3?void 0:a(arguments[2]);return s(e,o(t),i)}})},8288:(e,t,i)=>{"use strict";var n=i(46518),r=i(18449),o=i(28551),s=r.toKey,a=r.set;n({target:"Reflect",stat:!0},{metadata:function(e,t){return function(i,n){a(e,t,o(i),s(n))}}})},25509:(e,t,i)=>{"use strict";var n=i(46518),r=i(97080),o=i(94402).add;n({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=r(this),t=0,i=arguments.length;t<i;t++)o(e,arguments[t]);return e}})},65223:(e,t,i)=>{"use strict";var n=i(46518),r=i(97080),o=i(94402).remove;n({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=r(this),i=!0,n=0,s=arguments.length;n<s;n++)e=o(t,arguments[n]),i=i&&e;return!!i}})},60321:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(83440);n({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){return r(s,this,o(e))}})},41927:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(97080),s=i(38469);n({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0);return!1!==s(t,(function(e){if(!i(e,e,t))return!1}),!0)}})},11632:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(97080),s=i(94402),a=i(38469),l=s.Set,c=s.add;n({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=new l;return a(t,(function(e){i(e,e,t)&&c(n,e)})),n}})},64377:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(97080),s=i(38469);n({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=s(t,(function(e){if(i(e,e,t))return{value:e}}),!0);return n&&n.value}})},49522:(e,t,i)=>{"use strict";var n=i(46518),r=i(94402);n({target:"Set",stat:!0,forced:!0},{from:i(70933)(r.Set,r.add,!1)})},66771:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(68750);n({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return r(s,this,o(e))}})},12516:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(64449);n({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return r(s,this,o(e))}})},68931:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(53838);n({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return r(s,this,o(e))}})},52514:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(28527);n({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return r(s,this,o(e))}})},35694:(e,t,i)=>{"use strict";var n=i(46518),r=i(79504),o=i(97080),s=i(38469),a=i(655),l=r([].join),c=r([].push);n({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=o(this),i=void 0===e?",":a(e),n=[];return s(t,(function(e){c(n,e)})),l(n,i)}})},52774:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(97080),s=i(94402),a=i(38469),l=s.Set,c=s.add;n({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0),n=new l;return a(t,(function(e){c(n,i(e,e,t))})),n}})},23283:(e,t,i)=>{"use strict";var n=i(46518),r=i(94402);n({target:"Set",stat:!0,forced:!0},{of:i(87500)(r.Set,r.add,!1)})},49536:(e,t,i)=>{"use strict";var n=i(46518),r=i(79306),o=i(97080),s=i(38469),a=TypeError;n({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=o(this),i=arguments.length<2,n=i?void 0:arguments[1];if(r(e),s(t,(function(r){i?(i=!1,n=r):n=e(n,r,r,t)})),i)throw new a("Reduce of empty set with no initial value");return n}})},21926:(e,t,i)=>{"use strict";var n=i(46518),r=i(76080),o=i(97080),s=i(38469);n({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=o(this),i=r(e,arguments.length>1?arguments[1]:void 0);return!0===s(t,(function(e){if(i(e,e,t))return!0}),!0)}})},94483:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(83650);n({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return r(s,this,o(e))}})},16215:(e,t,i)=>{"use strict";var n=i(46518),r=i(69565),o=i(47650),s=i(44204);n({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return r(s,this,o(e))}})},78898:(e,t,i)=>{"use strict";var n=i(46518),r=i(68183).charAt,o=i(67750),s=i(91291),a=i(655);n({target:"String",proto:!0,forced:!0},{at:function(e){var t=a(o(this)),i=t.length,n=s(e),l=n>=0?n:i+n;return l<0||l>=i?void 0:r(t,l)}})},74176:(e,t,i)=>{"use strict";var n=i(46518),r=i(33994),o=i(62529),s=i(67750),a=i(655),l=i(91181),c=i(68183),h=c.codeAt,u=c.charAt,d="String Iterator",f=l.set,p=l.getterFor(d),m=r((function(e){f(this,{type:d,string:e,index:0})}),"String",(function(){var e,t=p(this),i=t.string,n=t.index;return n>=i.length?o(void 0,!0):(e=u(i,n),t.index+=e.length,o({codePoint:h(e,0),position:n},!1))}));n({target:"String",proto:!0,forced:!0},{codePoints:function(){return new m(a(s(this)))}})},43275:(e,t,i)=>{"use strict";var n=i(24475),r=i(70511),o=i(24913).f,s=i(77347).f,a=n.Symbol;if(r("dispose"),a){var l=s(a,"dispose");l.enumerable&&l.configurable&&l.writable&&o(a,"dispose",{value:l.value,enumerable:!1,configurable:!1,writable:!1})}},42793:(e,t,i)=>{"use strict";i(70511)("observable")},77208:(e,t,i)=>{"use strict";i(70511)("patternMatch")},67348:(e,t,i)=>{"use strict";var n=i(46518),r=i(76557),o=i(44995).remove;n({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=r(this),i=!0,n=0,s=arguments.length;n<s;n++)e=o(t,arguments[n]),i=i&&e;return!!i}})},26957:(e,t,i)=>{"use strict";var n=i(46518),r=i(44995);n({target:"WeakMap",stat:!0,forced:!0},{from:i(70933)(r.WeakMap,r.set,!0)})},79732:(e,t,i)=>{"use strict";var n=i(46518),r=i(44995);n({target:"WeakMap",stat:!0,forced:!0},{of:i(87500)(r.WeakMap,r.set,!0)})},83742:(e,t,i)=>{"use strict";var n=i(46518),r=i(23755),o=i(88205).add;n({target:"WeakSet",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=r(this),t=0,i=arguments.length;t<i;t++)o(e,arguments[t]);return e}})},56422:(e,t,i)=>{"use strict";var n=i(46518),r=i(23755),o=i(88205).remove;n({target:"WeakSet",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=r(this),i=!0,n=0,s=arguments.length;n<s;n++)e=o(t,arguments[n]),i=i&&e;return!!i}})},82451:(e,t,i)=>{"use strict";var n=i(46518),r=i(88205);n({target:"WeakSet",stat:!0,forced:!0},{from:i(70933)(r.WeakSet,r.add,!1)})},46270:(e,t,i)=>{"use strict";var n=i(46518),r=i(88205);n({target:"WeakSet",stat:!0,forced:!0},{of:i(87500)(r.WeakSet,r.add,!1)})},86368:(e,t,i)=>{"use strict";var n=i(46518),r=i(24475),o=i(59225).clear;n({global:!0,bind:!0,enumerable:!0,forced:r.clearImmediate!==o},{clearImmediate:o})},59848:(e,t,i)=>{"use strict";i(86368),i(29309)},29309:(e,t,i)=>{"use strict";var n=i(46518),r=i(24475),o=i(59225).set,s=i(79472),a=r.setImmediate?s(o,!1):o;n({global:!0,bind:!0,enumerable:!0,forced:r.setImmediate!==a},{setImmediate:a})},85178:(e,t,i)=>{var n;if("function"==typeof fetch&&(n=void 0!==i.g&&i.g.fetch?i.g.fetch:"undefined"!=typeof window&&window.fetch?window.fetch:fetch),"undefined"==typeof window||void 0===window.document){var r=n||i(95204);r.default&&(r=r.default),t.default=r,e.exports=t.default}},92467:e=>{"use strict";e.exports=JSON.parse('{"globals":{"dimension":{},"factor":{"factor":1},"factor.derived":{"parentFactors":{}},"quantity":{"units":[]},"symbol":{"doc":"http://docs.adskunits.apiary.io/#introduction/definitions/unit-symbols","unit":{"typeid":"unit","description":"Measurement unit this symbol applies to."}},"symbol.placement":{"Prefix":{"value":0},"Suffix":1},"symbol.prefixOrSuffix":{"text":{"typeid":"String","description":"Text to annotate the value."},"placement":{"typeid":"symbol.placement","description":"Placement of the annotation text."},"space":{"typeid":"Bool","description":"Specifies whether the annotation should be separated from the value by a space."}},"system":{"Metric":{"value":0,"description":"Metric system of measurement units."},"Imperial":1},"unit":{"doc":"http://docs.adskunits.apiary.io/#introduction/definitions/measurement-units","unitSystem":{"typeid":"system"}},"unit.absolute":{"parentUnit":{"typeid":"unit.relative","description":"Relative unit from which this absolute unit is derived."},"offset":{"typeid":"Float64","value":0,"description":"An offset used to position an absolute scale of measurement on the number line."}},"unit.derived":{"parentFactors":{},"parentUnits":{}},"unit.primitive":{},"unit.primitive.dimensional":{"dimension":{"typeid":"dimension"}},"unit.relative":{}},"factor":{"nineFifths":{"factor":1.8},"pi":{"factor":3.14159265358979},"atto":{"parentFactors":{"ten":-18}},"centi":{"parentFactors":{"ten":-2}},"deci":{"parentFactors":{"ten":-1}},"deka":{"parentFactors":{"ten":1}},"exa":{"parentFactors":{"ten":18}},"femto":{"parentFactors":{"ten":-15}},"giga":{"parentFactors":{"ten":9}},"hecto":{"parentFactors":{"ten":2}},"kilo":{"parentFactors":{"ten":3}},"mega":{"parentFactors":{"ten":6}},"micro":{"parentFactors":{"ten":-6}},"milli":{"parentFactors":{"ten":-3}},"nano":{"parentFactors":{"ten":-9}},"peta":{"parentFactors":{"ten":15}},"pico":{"parentFactors":{"ten":-12}},"tera":{"parentFactors":{"ten":12}},"yocto":{"parentFactors":{"ten":-24}},"yotta":{"parentFactors":{"ten":24}},"zepto":{"parentFactors":{"ten":-21}},"zetta":{"parentFactors":{"ten":21}},"ten":{"factor":10},"threeHundredSixty":{"factor":360},"threeThousandNineHundredThirtySeven":{"factor":3937},"twelve":{"factor":12}},"dimension":{"currency":{},"electricCurrent":{},"length":{},"luminousIntensity":{},"mass":{},"temperature":{},"time":{}},"unit":{"1ToRatio":{"unitSystem":"Metric","parentUnits":{"ratioTo1":-1},"symbols":{"1Colon":{"text":"1:","placement":"Prefix","space":false}}},"acres":{"unitSystem":"Imperial","factor":4840,"parentUnits":{"squareYards":1},"symbols":{"acres":{"text":"acres","placement":"Suffix","space":true}}},"ampereHours":{"unitSystem":"Metric","parentUnits":{"amperes":1,"hours":1},"symbols":{"aDashH":{"text":"A-h","placement":"Suffix","space":true}}},"ampereSeconds":{"unitSystem":"Metric","parentUnits":{"amperes":1,"seconds":1},"symbols":{"aDashS":{"text":"A-s","placement":"Suffix","space":true}}},"amperes":{"unitSystem":"Metric","dimension":"electricCurrent","symbols":{"ampere":{"text":"A","placement":"Suffix","space":true}}},"atmospheres":{"unitSystem":"Imperial","factor":101325,"parentUnits":{"pascals":1},"symbols":{"atm":{"text":"atm","placement":"Suffix","space":true}}},"bars":{"unitSystem":"Metric","factor":100,"parentUnits":{"kilopascals":1},"symbols":{"bar":{"text":"bar","placement":"Suffix","space":true}}},"britishThermalUnits":{"unitSystem":"Imperial","factor":1055.05585262,"parentUnits":{"joules":1},"symbols":{"btu":{"text":"Btu","placement":"Suffix","space":true}}},"britishThermalUnitsPerDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnits":1,"fahrenheitInterval":-1},"symbols":{"btuPerDegreeF":{"text":"BTU/°F","placement":"Suffix","space":true}}},"britishThermalUnitsPerHour":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnits":1,"hours":-1},"symbols":{"btuPerH":{"text":"Btu/h","placement":"Suffix","space":true}}},"britishThermalUnitsPerHourCubicFoot":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnitsPerHour":1,"cubicFeet":-1},"symbols":{"btuPerHFtSup3":{"text":"Btu/(h·ft³)","placement":"Suffix","space":true}}},"britishThermalUnitsPerHourFootDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnitsPerHour":1,"feet":-1,"fahrenheitInterval":-1},"symbols":{"btuPerHFtDegreeF":{"text":"BTU/(h·ft·°F)","placement":"Suffix","space":true}}},"britishThermalUnitsPerHourSquareFoot":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnitsPerHour":1,"squareFeet":-1},"symbols":{"btuPerHFtSup2":{"text":"Btu/(h·ft²)","placement":"Suffix","space":true}}},"britishThermalUnitsPerHourSquareFootDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnitsPerHourSquareFoot":1,"fahrenheitInterval":-1},"symbols":{"btuPerHFtSup2DegreeF":{"text":"BTU/(h·ft²·°F)","placement":"Suffix","space":true}}},"britishThermalUnitsPerPound":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnits":1,"poundsMass":-1},"symbols":{"btuPerLb":{"text":"BTU/lb","placement":"Suffix","space":true}}},"britishThermalUnitsPerPoundDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnitsPerPound":1,"fahrenheitInterval":-1},"symbols":{"btuPerLbDegreeF":{"text":"BTU/(lb·°F)","placement":"Suffix","space":true}}},"britishThermalUnitsPerSecond":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnits":1,"seconds":-1},"symbols":{"btuPerS":{"text":"Btu/s","placement":"Suffix","space":true}}},"britishThermalUnitsPerSquareFootDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"britishThermalUnits":1,"squareFeet":-1,"fahrenheitInterval":-1},"symbols":{"btuPerFtSup2DegreeF":{"text":"BTU/(ft²·°F)","placement":"Suffix","space":true}}},"calories":{"unitSystem":"Metric","factor":4.1868,"parentUnits":{"joules":1},"symbols":{"cal":{"text":"cal","placement":"Suffix","space":true}}},"caloriesPerSecond":{"unitSystem":"Metric","parentUnits":{"calories":1,"seconds":-1},"symbols":{"calPerS":{"text":"cal/s","placement":"Suffix","space":true}}},"candelas":{"unitSystem":"Metric","dimension":"luminousIntensity","symbols":{"cd":{"text":"cd","placement":"Suffix","space":true}}},"candelasPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"candelas":1,"squareFeet":-1},"symbols":{"cdPerFtSup2":{"text":"cd/ft²","placement":"Suffix","space":true}}},"candelasPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"candelas":1,"squareMeters":-1},"symbols":{"cdPerMSup2":{"text":"cd/m²","placement":"Suffix","space":true}}},"celsius":{"unitSystem":"Metric","parentUnit":"celsiusInterval","offset":273.15,"symbols":{"degreeC":{"text":"°C","placement":"Suffix","space":true}}},"celsiusInterval":{"unitSystem":"Metric","parentUnits":{"kelvinInterval":1},"symbols":{"degreeCInterval":{"text":"°C","placement":"Suffix","space":true},"deltaDegreeC":{"text":"delta°C","placement":"Suffix","space":true}}},"centimeters":{"unitSystem":"Metric","parentFactors":{"centi":1},"parentUnits":{"meters":1},"symbols":{"cm":{"text":"cm","placement":"Suffix","space":true}}},"centimetersPerMinute":{"unitSystem":"Metric","parentUnits":{"centimeters":1,"minutes":-1},"symbols":{"cmPerMin":{"text":"cm/min","placement":"Suffix","space":true}}},"centimetersToTheFourthPower":{"unitSystem":"Metric","parentUnits":{"centimeters":4},"symbols":{"cmSup4":{"text":"cm⁴","placement":"Suffix","space":true}}},"centimetersToTheSixthPower":{"unitSystem":"Metric","parentUnits":{"centimeters":6},"symbols":{"cmSup6":{"text":"cm⁶","placement":"Suffix","space":true}}},"centipoises":{"unitSystem":"Metric","parentFactors":{"centi":1},"parentUnits":{"poises":1},"symbols":{"cP":{"text":"cP","placement":"Suffix","space":true}}},"circularMils":{"unitSystem":"Imperial","factor":0.25,"parentFactors":{"pi":1},"parentUnits":{"squareMils":1},"symbols":{"cMil":{"text":"cmil","placement":"Suffix","space":true}}},"coulombs":{"unitSystem":"Metric","parentUnits":{"ampereSeconds":1},"symbols":{"coulomb":{"text":"C","placement":"Suffix","space":true}}},"cubicCentimeters":{"defaultSymbol":"cmSup3","unitSystem":"Metric","parentUnits":{"centimeters":3},"symbols":{"cmCaret3":{"text":"cm^3","placement":"Suffix","space":true},"cmSup3":{"text":"cm³","placement":"Suffix","space":true}}},"cubicFeet":{"defaultSymbol":"ftSup3","unitSystem":"Imperial","parentUnits":{"feet":3},"symbols":{"cf":{"text":"CF","placement":"Suffix","space":true},"ftCaret3":{"text":"ft^3","placement":"Suffix","space":true},"ftSup3":{"text":"ft³","placement":"Suffix","space":true}}},"cubicFeetPerHour":{"defaultSymbol":"ftSup3PerHour","unitSystem":"Imperial","parentUnits":{"cubicFeet":1,"hours":-1},"symbols":{"cfh":{"text":"CFH","placement":"Suffix","space":true},"ftSup3PerH":{"text":"ft³/h","placement":"Suffix","space":true}}},"cubicFeetPerKip":{"unitSystem":"Imperial","parentUnits":{"cubicFeet":1,"kips":-1},"symbols":{"ftSup3PerKip":{"text":"ft³/kip","placement":"Suffix","space":true}}},"cubicFeetPerMinute":{"defaultSymbol":"ftSup3PerMin","unitSystem":"Imperial","parentUnits":{"cubicFeet":1,"minutes":-1},"symbols":{"cfm":{"text":"CFM","placement":"Suffix","space":true},"ftSup3PerMin":{"text":"ft³/min","placement":"Suffix","space":true}}},"cubicFeetPerMinuteCubicFoot":{"defaultSymbol":"cfmPerFtSup3","unitSystem":"Imperial","parentUnits":{"cubicFeetPerMinute":1,"cubicFeet":-1},"symbols":{"cfmPerCf":{"text":"CFM/CF","placement":"Suffix","space":true},"cfmPerFtSup3":{"text":"CFM/ft³","placement":"Suffix","space":true}}},"cubicFeetPerMinutePerBritishThermalUnitPerHour":{"unitSystem":"Imperial","parentUnits":{"cubicFeetPerMinute":1,"britishThermalUnitsPerHour":-1},"symbols":{"ftSup3HPerMinBtu":{"text":"ft³·h/(min·Btu)","placement":"Suffix","space":true}}},"cubicFeetPerMinuteSquareFoot":{"defaultSymbol":"cfmPerFtSup2","unitSystem":"Imperial","parentUnits":{"cubicFeetPerMinute":1,"squareFeet":-1},"symbols":{"cfmPerFtSup2":{"text":"CFM/ft²","placement":"Suffix","space":true},"cfmPerSf":{"text":"CFM/SF","placement":"Suffix","space":true}}},"cubicFeetPerMinuteSquareMeter":{"unitSystem":"Metric","parentUnits":{"cubicFeetPerMinute":1,"squareMeters":-1}},"cubicFeetPerMinuteTonOfRefrigeration":{"unitSystem":"Imperial","parentUnits":{"cubicFeetPerMinute":1,"tonsOfRefrigeration":-1},"symbols":{"cfmPerTon":{"text":"CFM/ton","placement":"Suffix","space":true}}},"cubicFeetPerPoundMass":{"unitSystem":"Imperial","parentUnits":{"cubicFeet":1,"poundsMass":-1},"symbols":{"ftSup3PerLbMass":{"text":"ft³/lb","placement":"Suffix","space":true}}},"cubicInches":{"defaultSymbol":"inSup3","unitSystem":"Imperial","parentUnits":{"inches":3},"symbols":{"inCaret3":{"text":"in^3","placement":"Suffix","space":true},"inSup3":{"text":"in³","placement":"Suffix","space":true}}},"cubicMeters":{"defaultSymbol":"mSup3","unitSystem":"Metric","parentUnits":{"meters":3},"symbols":{"mCaret3":{"text":"m^3","placement":"Suffix","space":true},"mSup3":{"text":"m³","placement":"Suffix","space":true}}},"cubicMetersPerHour":{"defaultSymbol":"mSup3PerH","unitSystem":"Metric","parentUnits":{"cubicMeters":1,"hours":-1},"symbols":{"cmh":{"text":"CMH","placement":"Suffix","space":true},"mSup3PerH":{"text":"m³/h","placement":"Suffix","space":true}}},"cubicMetersPerHourCubicMeter":{"unitSystem":"Metric","parentUnits":{"cubicMetersPerHour":1,"cubicMeters":-1},"symbols":{"mSup3PerHMSup3":{"text":"m³/(h·m³)","placement":"Suffix","space":true}}},"cubicMetersPerHourSquareMeter":{"unitSystem":"Metric","parentUnits":{"cubicMetersPerHour":1,"squareMeters":-1},"symbols":{"mSup3PerHMSup2":{"text":"m³/(h·m²)","placement":"Suffix","space":true}}},"cubicMetersPerKilogram":{"unitSystem":"Metric","parentUnits":{"cubicMeters":1,"kilograms":-1},"symbols":{"mSup3PerKg":{"text":"m³/kg","placement":"Suffix","space":true}}},"cubicMetersPerKilonewton":{"unitSystem":"Metric","parentUnits":{"cubicMeters":1,"kilonewtons":-1},"symbols":{"mSup3PerKN":{"text":"m³/kN","placement":"Suffix","space":true}}},"cubicMetersPerSecond":{"defaultSymbol":"mSup3PerS","unitSystem":"Metric","parentUnits":{"cubicMeters":1,"seconds":-1},"symbols":{"cms":{"text":"CMS","placement":"Suffix","space":true},"mSup3PerS":{"text":"m³/s","placement":"Suffix","space":true}}},"cubicMetersPerWattSecond":{"unitSystem":"Metric","parentUnits":{"cubicMeters":1,"watts":-1,"seconds":-1},"symbols":{"mSup3PerWS":{"text":"m³/(W·s)","placement":"Suffix","space":true}}},"cubicMillimeters":{"defaultSymbol":"mmSup3","unitSystem":"Metric","parentUnits":{"millimeters":3},"symbols":{"mmCaret3":{"text":"mm^3","placement":"Suffix","space":true},"mmSup3":{"text":"mm³","placement":"Suffix","space":true}}},"cubicYards":{"unitSystem":"Imperial","parentUnits":{"yards":3},"symbols":{"cy":{"text":"CY","placement":"Suffix","space":true}}},"currency":{"defaultSymbol":"usDollar","unitSystem":"Imperial","dimension":"currency","symbols":{"baht":{"description":"Baht is the official currency of Thailand.","text":"฿","placement":"Prefix","space":false},"chineseHongKongDollar":{"description":"Hong Kong Dollar is the official currency of Hong Kong..","text":"HK$","placement":"Prefix","space":false},"dong":{"description":"Dong is the official currency of Vietnam.","text":"₫","placement":"Suffix","space":false},"euroPrefix":{"text":"€","placement":"Prefix","space":false},"euroSuffix":{"text":"€","placement":"Suffix","space":false},"krone":{"description":"Krone is the official currency of Denmark, Greenland, and the Faroe Islands.","text":"kr","placement":"Suffix","space":true},"shekel":{"description":"Shekel is the official currency of Israel.","text":"₪","placement":"Prefix","space":false},"ukPound":{"text":"£","placement":"Prefix","space":false},"usDollar":{"text":"$","placement":"Prefix","space":false},"won":{"description":"Won is the official currency of South Korea.","text":"₩","placement":"Prefix","space":false},"yen":{"text":"¥","placement":"Prefix","space":false}}},"currencyPerBritishThermalUnit":{"unitSystem":"Imperial","parentUnits":{"currency":1,"britishThermalUnits":-1},"symbols":{"dollarPerBtu":{"text":"$/Btu","placement":"Suffix","space":true}}},"currencyPerBritishThermalUnitPerHour":{"unitSystem":"Imperial","parentUnits":{"currency":1,"britishThermalUnitsPerHour":-1},"symbols":{"dollarHPerBtu":{"text":"$·h/Btu","placement":"Suffix","space":true}}},"currencyPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"currency":1,"squareFeet":-1},"symbols":{"dollarPerFtSup2":{"text":"$/ft²","placement":"Suffix","space":true}}},"currencyPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"currency":1,"squareMeters":-1},"symbols":{"dollarPerMSup2":{"text":"$/m²","placement":"Suffix","space":true}}},"currencyPerWatt":{"unitSystem":"Metric","parentUnits":{"currency":1,"watts":-1},"symbols":{"dollarPerW":{"text":"$/W","placement":"Suffix","space":true}}},"currencyPerWattHour":{"unitSystem":"Metric","parentUnits":{"currency":1,"watts":-1,"hours":-1},"symbols":{"dollarPerWH":{"text":"$/(W·h)","placement":"Suffix","space":true}}},"cyclesPerSecond":{"unitSystem":"Metric","parentUnits":{"seconds":-1},"symbols":{"cps":{"text":"cps","placement":"Suffix","space":true}}},"decimeters":{"unitSystem":"Metric","parentFactors":{"deci":1},"parentUnits":{"meters":1},"symbols":{"dm":{"text":"dm","placement":"Suffix","space":true}}},"degrees":{"defaultSymbol":"degree","unitSystem":"Metric","parentFactors":{"threeHundredSixty":-1},"parentUnits":{"turns":1},"symbols":{"degree":{"text":"°","placement":"Suffix","space":false},"degreesMinutesSeconds":{"inherits":"symbol"}}},"dekanewtonMeters":{"unitSystem":"Metric","parentUnits":{"dekanewtons":1,"meters":1},"symbols":{"daNDashM":{"text":"daN-m","placement":"Suffix","space":true}}},"dekanewtonMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"dekanewtonMeters":1,"meters":-1},"symbols":{"daNDashMPerM":{"text":"daN-m/m","placement":"Suffix","space":true}}},"dekanewtons":{"unitSystem":"Metric","parentFactors":{"deka":1},"parentUnits":{"newtons":1},"symbols":{"daN":{"text":"daN","placement":"Suffix","space":true}}},"dekanewtonsPerMeter":{"unitSystem":"Metric","parentUnits":{"dekanewtons":1,"meters":-1},"symbols":{"daNPerM":{"text":"daN/m","placement":"Suffix","space":true}}},"dekanewtonsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"dekanewtons":1,"squareMeters":-1},"symbols":{"daNPerMSup2":{"text":"daN/m²","placement":"Suffix","space":true}}},"dynes":{"unitSystem":"Metric","factor":10,"parentFactors":{"micro":1},"parentUnits":{"newtons":1},"symbols":{"dyn":{"text":"dyn","placement":"Suffix","space":true}}},"ergs":{"unitSystem":"Metric","parentFactors":{"ten":-7},"parentUnits":{"joules":1},"symbols":{"erg":{"text":"erg","placement":"Suffix","space":true}}},"fahrenheit":{"unitSystem":"Imperial","parentUnit":"fahrenheitInterval","offset":459.67,"symbols":{"degreeF":{"text":"°F","placement":"Suffix","space":true}}},"fahrenheitInterval":{"defaultSymbol":"degreeFInterval","unitSystem":"Imperial","parentUnits":{"rankineInterval":1},"symbols":{"degreeFInterval":{"text":"°F","placement":"Suffix","space":true},"deltaDegreeF":{"text":"delta°F","placement":"Suffix","space":true}}},"farads":{"unitSystem":"Metric","parentUnits":{"coulombs":1,"volts":-1},"symbols":{"farad":{"text":"F","placement":"Suffix","space":true}}},"feet":{"defaultSymbol":"feetAndInches","unitSystem":"Imperial","factor":12,"parentUnits":{"inches":1},"symbols":{"feetAndInches":{"inherits":"symbol"},"footSingleQuote":{"text":"\'","placement":"Suffix","space":false},"ft":{"text":"ft","placement":"Suffix","space":true},"lf":{"text":"LF","placement":"Suffix","space":true}}},"feetOfWater39.2DegreesFahrenheit":{"defaultSymbol":"feetOfWater","unitSystem":"Imperial","factor":2988.98,"parentUnits":{"pascals":1},"symbols":{"feetOfWater":{"text":"Feet","placement":"Suffix","space":true},"ftH2O":{"text":"ftH2O","placement":"Suffix","space":true},"ftOfWater":{"text":"FT","placement":"Suffix","space":true}}},"feetOfWater39.2DegreesFahrenheitPer100Feet":{"defaultSymbol":"feetOfWaterPer100ft","unitSystem":"Imperial","factor":0.01,"parentUnits":{"feetOfWater39.2DegreesFahrenheit":1,"feet":-1},"symbols":{"feetOfWaterPer100ft":{"text":"Feet/100ft","placement":"Suffix","space":true},"ftH2OPer100ft":{"text":"ftH2O/100ft","placement":"Suffix","space":true},"ftOfWaterPer100ft":{"text":"FT/100ft","placement":"Suffix","space":true}}},"feetPerKip":{"unitSystem":"Imperial","parentUnits":{"feet":1,"kips":-1},"symbols":{"ftPerKip":{"text":"ft/kip","placement":"Suffix","space":true}}},"feetPerKipFoot":{"unitSystem":"Imperial","parentUnits":{"feet":1,"kipFeet":-1},"symbols":{"ftPerKipDashFt":{"text":"ft/kip-ft","placement":"Suffix","space":true}}},"feetPerMinute":{"defaultSymbol":"fpm","unitSystem":"Imperial","parentUnits":{"feet":1,"minutes":-1},"symbols":{"fpm":{"text":"FPM","placement":"Suffix","space":true},"ftPerMin":{"text":"ft/min","placement":"Suffix","space":true}}},"feetPerSecond":{"defaultSymbol":"fps","unitSystem":"Imperial","parentUnits":{"feet":1,"seconds":-1},"symbols":{"fps":{"text":"FPS","placement":"Suffix","space":true},"ftPerS":{"text":"ft/s","placement":"Suffix","space":true}}},"feetPerSecondSquared":{"unitSystem":"Imperial","parentUnits":{"feetPerSecond":1,"seconds":-1},"symbols":{"ftPerSSup2":{"text":"ft/s²","placement":"Suffix","space":true}}},"feetToTheFourthPower":{"unitSystem":"Imperial","parentUnits":{"feet":4},"symbols":{"ftSup4":{"text":"ft⁴","placement":"Suffix","space":true}}},"feetToTheSixthPower":{"unitSystem":"Imperial","parentUnits":{"feet":6},"symbols":{"ftSup6":{"text":"ft⁶","placement":"Suffix","space":true}}},"fixed":{"unitSystem":"Metric","parentUnits":{"ratioTo1":1}},"footcandles":{"defaultSymbol":"fc","unitSystem":"Imperial","parentUnits":{"lumens":1,"squareFeet":-1},"symbols":{"fc":{"text":"fc","placement":"Suffix","space":true},"ftc":{"text":"Ftc","placement":"Suffix","space":true}}},"footlamberts":{"defaultSymbol":"fL","unitSystem":"Imperial","parentFactors":{"pi":-1},"parentUnits":{"candelas":1,"squareFeet":-1},"symbols":{"fL":{"text":"fL","placement":"Suffix","space":true},"flLowercase":{"text":"fl","placement":"Suffix","space":true},"ftL":{"text":"ftL","placement":"Suffix","space":true}}},"gammas":{"unitSystem":"Metric","parentFactors":{"nano":1},"parentUnits":{"teslas":1},"symbols":{"gamma":{"text":"gamma","placement":"Suffix","space":true}}},"gauss":{"unitSystem":"Metric","parentFactors":{"ten":-4},"parentUnits":{"teslas":1},"symbols":{"gs":{"text":"Gs","placement":"Suffix","space":true}}},"general":{"unitSystem":"Metric","parentUnits":{"ratioTo1":1}},"gigajoules":{"unitSystem":"Metric","parentFactors":{"giga":1},"parentUnits":{"joules":1}},"gradians":{"unitSystem":"Metric","factor":0.9,"parentUnits":{"degrees":1},"symbols":{"grad":{"text":"grad","placement":"Suffix","space":true}}},"grains":{"unitSystem":"Imperial","factor":64.79891,"parentUnits":{"milligrams":1},"symbols":{"gr":{"text":"gr","placement":"Suffix","space":true}}},"grainsPerHourSquareFootInchMercury":{"unitSystem":"Imperial","parentUnits":{"grains":1,"hours":-1,"squareFeet":-1,"inchesOfMercury32DegreesFahrenheit":-1},"symbols":{"grPerHFtSup2InHg":{"text":"gr/(h·ft²·inHg)","placement":"Suffix","space":true}}},"grams":{"unitSystem":"Metric","factor":0.001,"parentUnits":{"kilograms":1},"symbols":{"gram":{"text":"g","placement":"Suffix","space":true}}},"hectares":{"unitSystem":"Metric","parentUnits":{"squareHectometers":1},"symbols":{"hectare":{"text":"hectare","placement":"Suffix","space":true}}},"hectometers":{"unitSystem":"Metric","parentFactors":{"hecto":1},"parentUnits":{"meters":1},"symbols":{"hm":{"text":"hm","placement":"Suffix","space":true}}},"henries":{"unitSystem":"Metric","parentUnits":{"ohms":1,"seconds":1},"symbols":{"henry":{"text":"H","placement":"Suffix","space":true}}},"hertz":{"unitSystem":"Metric","parentUnits":{"cyclesPerSecond":1},"symbols":{"hz":{"text":"Hz","placement":"Suffix","space":true}}},"horsepower":{"unitSystem":"Imperial","factor":33000,"parentUnits":{"poundForceFeet":1,"minutes":-1},"symbols":{"hp":{"text":"hp","placement":"Suffix","space":true}}},"hourSquareFootDegreesFahrenheitPerBritishThermalUnit":{"unitSystem":"Imperial","parentUnits":{"hours":1,"squareFeet":1,"fahrenheitInterval":1,"britishThermalUnits":-1},"symbols":{"hFtSup2DegreeFPerBtu":{"text":"(h·ft²·°F)/BTU","placement":"Suffix","space":true}}},"hours":{"unitSystem":"Metric","factor":60,"parentUnits":{"minutes":1},"symbols":{"hour":{"text":"h","placement":"Suffix","space":true}}},"inches":{"defaultSymbol":"in","unitSystem":"Imperial","factor":2.54,"parentUnits":{"centimeters":1},"symbols":{"in":{"text":"in","placement":"Suffix","space":true},"inchDoubleQuote":{"text":"\\"","placement":"Suffix","space":false}}},"inchesOfMercury32DegreesFahrenheit":{"unitSystem":"Imperial","factor":3386.389,"parentUnits":{"pascals":1},"symbols":{"inHg":{"text":"inHg","placement":"Suffix","space":true}}},"inchesOfWater60DegreesFahrenheit":{"unitSystem":"Imperial","factor":248.84,"parentUnits":{"pascals":1},"symbols":{"inDashWg":{"text":"in-wg","placement":"Suffix","space":true}}},"inchesOfWater60DegreesFahrenheitPer100Feet":{"unitSystem":"Imperial","factor":0.01,"parentUnits":{"inchesOfWater60DegreesFahrenheit":1,"feet":-1},"symbols":{"inDashWgPer100ft":{"text":"in-wg/100ft","placement":"Suffix","space":true}}},"inchesPerSecond":{"unitSystem":"Imperial","parentUnits":{"inches":1,"seconds":-1},"symbols":{"inPerS":{"text":"in/s","placement":"Suffix","space":true}}},"inchesPerSecondSquared":{"unitSystem":"Imperial","parentUnits":{"inchesPerSecond":1,"seconds":-1},"symbols":{"inPerSSup2":{"text":"in/s²","placement":"Suffix","space":true}}},"inchesToTheFourthPower":{"unitSystem":"Imperial","parentUnits":{"inches":4},"symbols":{"inSup4":{"text":"in⁴","placement":"Suffix","space":true}}},"inchesToTheSixthPower":{"unitSystem":"Imperial","parentUnits":{"inches":6},"symbols":{"inSup6":{"text":"in⁶","placement":"Suffix","space":true}}},"inverseDegreesCelsius":{"unitSystem":"Metric","parentUnits":{"celsiusInterval":-1},"symbols":{"invDegreeC":{"text":"1/°C","placement":"Suffix","space":true}}},"inverseDegreesFahrenheit":{"unitSystem":"Imperial","parentUnits":{"fahrenheitInterval":-1},"symbols":{"invDegreeF":{"text":"1/°F","placement":"Suffix","space":true}}},"inverseKilonewtons":{"unitSystem":"Metric","parentUnits":{"kilonewtons":-1},"symbols":{"invKN":{"text":"1/kN","placement":"Suffix","space":true}}},"inverseKips":{"unitSystem":"Imperial","parentUnits":{"kips":-1},"symbols":{"invKip":{"text":"1/kip","placement":"Suffix","space":true}}},"joules":{"unitSystem":"Metric","parentUnits":{"newtonMeters":1},"symbols":{"joule":{"text":"J","placement":"Suffix","space":true}}},"joulesPerGram":{"unitSystem":"Metric","parentUnits":{"joules":1,"grams":-1},"symbols":{"jPerG":{"text":"J/g","placement":"Suffix","space":true}}},"joulesPerGramDegreeCelsius":{"unitSystem":"Metric","parentUnits":{"joulesPerGram":1,"celsiusInterval":-1},"symbols":{"jPerGDegreeC":{"text":"J/(g·°C)","placement":"Suffix","space":true}}},"joulesPerKelvin":{"unitSystem":"Metric","parentUnits":{"joules":1,"kelvinInterval":-1},"symbols":{"jPerK":{"text":"J/K","placement":"Suffix","space":true}}},"joulesPerKilogram":{"unitSystem":"Metric","parentUnits":{"joules":1,"kilograms":-1},"symbols":{"jPerKg":{"text":"J/kg","placement":"Suffix","space":true}}},"joulesPerKilogramDegreeCelsius":{"unitSystem":"Metric","parentUnits":{"joulesPerKilogram":1,"celsiusInterval":-1},"symbols":{"jPerKgDegreeC":{"text":"J/(kg·°C)","placement":"Suffix","space":true}}},"joulesPerSquareMeterKelvin":{"unitSystem":"Metric","parentUnits":{"joules":1,"squareMeters":-1,"kelvinInterval":-1},"symbols":{"jPerMSup2K":{"text":"J/(m²·K)","placement":"Suffix","space":true}}},"kelvin":{"unitSystem":"Metric","parentUnit":"kelvinInterval","symbols":{"kelvin":{"text":"K","placement":"Suffix","space":true}}},"kelvinInterval":{"defaultSymbol":"deltaK","unitSystem":"Metric","dimension":"temperature","symbols":{"deltaK":{"text":"deltaK","placement":"Suffix","space":true},"kelvinInterval":{"text":"K","placement":"Suffix","space":true}}},"kiloamperes":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"amperes":1},"symbols":{"kA":{"text":"kA","placement":"Suffix","space":true}}},"kilocalories":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"calories":1},"symbols":{"kcal":{"text":"kcal","placement":"Suffix","space":true}}},"kilocaloriesPerSecond":{"unitSystem":"Metric","parentUnits":{"kilocalories":1,"seconds":-1},"symbols":{"kcalPerS":{"text":"kcal/s","placement":"Suffix","space":true}}},"kilogramForceMeters":{"unitSystem":"Metric","parentUnits":{"kilogramsForce":1,"meters":1},"symbols":{"kgfDashM":{"text":"kgf-m","placement":"Suffix","space":true}}},"kilogramForceMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"kilogramForceMeters":1,"meters":-1},"symbols":{"kgfDashMPerM":{"text":"kgf-m/m","placement":"Suffix","space":true}}},"kilogramKelvins":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"kelvinInterval":1},"symbols":{"kgK":{"text":"kg·K","placement":"Suffix","space":true}}},"kilograms":{"unitSystem":"Metric","dimension":"mass","symbols":{"kg":{"text":"kg","placement":"Suffix","space":true}}},"kilogramsForce":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"standardGravity":1},"symbols":{"kgf":{"text":"kgf","placement":"Suffix","space":true}}},"kilogramsForcePerMeter":{"unitSystem":"Metric","parentUnits":{"kilogramsForce":1,"meters":-1},"symbols":{"kgfPerM":{"text":"kgf/m","placement":"Suffix","space":true}}},"kilogramsForcePerSquareMeter":{"unitSystem":"Metric","parentUnits":{"kilogramsForce":1,"squareMeters":-1},"symbols":{"kgfPerMSup2":{"text":"kgf/m²","placement":"Suffix","space":true}}},"kilogramsPerCubicCentimeter":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"cubicCentimeters":-1}},"kilogramsPerCubicMeter":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"cubicMeters":-1},"symbols":{"kgPerMSup3":{"text":"kg/m³","placement":"Suffix","space":true}}},"kilogramsPerHour":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"hours":-1},"symbols":{"kgPerH":{"text":"kg/h","placement":"Suffix","space":true}}},"kilogramsPerKilogramKelvin":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"kilogramKelvins":-1},"symbols":{"kgPerKgK":{"text":"kg/(kg·K)","placement":"Suffix","space":true}}},"kilogramsPerMeter":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"meters":-1},"symbols":{"kgPerM":{"text":"kg/m","placement":"Suffix","space":true}}},"kilogramsPerMeterHour":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"meters":-1,"hours":-1},"symbols":{"kgPerMH":{"text":"kg/(m·h)","placement":"Suffix","space":true}}},"kilogramsPerMeterSecond":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"meters":-1,"seconds":-1},"symbols":{"kgPerMS":{"text":"kg/(m·s)","placement":"Suffix","space":true}}},"kilogramsPerMinute":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"minutes":-1},"symbols":{"kgPerMin":{"text":"kg/min","placement":"Suffix","space":true}}},"kilogramsPerSecond":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"seconds":-1},"symbols":{"kgPerS":{"text":"kg/s","placement":"Suffix","space":true}}},"kilogramsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"squareMeters":-1},"symbols":{"kgPerMSup2":{"text":"kg/m²","placement":"Suffix","space":true}}},"kilojoules":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"joules":1},"symbols":{"kJ":{"text":"kJ","placement":"Suffix","space":true}}},"kilojoulesPerKelvin":{"unitSystem":"Metric","parentUnits":{"kilojoules":1,"kelvinInterval":-1},"symbols":{"kJPerK":{"text":"kJ/K","placement":"Suffix","space":true}}},"kilojoulesPerSquareMeterKelvin":{"unitSystem":"Metric","parentUnits":{"kilojoules":1,"squareMeters":-1,"kelvinInterval":-1},"symbols":{"kJPerMSup2K":{"text":"kJ/(m²·K)","placement":"Suffix","space":true}}},"kilometers":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"meters":1},"symbols":{"km":{"text":"km","placement":"Suffix","space":true}}},"kilometersPerHour":{"unitSystem":"Metric","parentUnits":{"kilometers":1,"hours":-1},"symbols":{"kmPerH":{"text":"km/h","placement":"Suffix","space":true}}},"kilometersPerSecond":{"unitSystem":"Metric","parentUnits":{"kilometers":1,"seconds":-1},"symbols":{"kmPerS":{"text":"km/s","placement":"Suffix","space":true}}},"kilometersPerSecondSquared":{"unitSystem":"Metric","parentUnits":{"kilometersPerSecond":1,"seconds":-1},"symbols":{"kmPerSSup2":{"text":"km/s²","placement":"Suffix","space":true}}},"kilonewtonMeters":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"meters":1},"symbols":{"kNDashM":{"text":"kN-m","placement":"Suffix","space":true}}},"kilonewtonMetersPerDegree":{"unitSystem":"Metric","parentUnits":{"kilonewtonMeters":1,"degrees":-1},"symbols":{"kNDashMPerDegree":{"text":"kN-m/°","placement":"Suffix","space":true}}},"kilonewtonMetersPerDegreePerMeter":{"unitSystem":"Metric","parentUnits":{"kilonewtonMetersPerDegree":1,"meters":-1},"symbols":{"kNDashMPerDegreePerM":{"text":"kN-m/°/m","placement":"Suffix","space":true}}},"kilonewtonMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"kilonewtonMeters":1,"meters":-1},"symbols":{"kNDashMPerM":{"text":"kN-m/m","placement":"Suffix","space":true}}},"kilonewtons":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"newtons":1},"symbols":{"kN":{"text":"kN","placement":"Suffix","space":true}}},"kilonewtonsPerCubicMeter":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"cubicMeters":-1},"symbols":{"kNPerMSup3":{"text":"kN/m³","placement":"Suffix","space":true}}},"kilonewtonsPerMeter":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"meters":-1},"symbols":{"kNPerM":{"text":"kN/m","placement":"Suffix","space":true}}},"kilonewtonsPerSquareCentimeter":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"squareCentimeters":-1},"symbols":{"kNPerCmSup2":{"text":"kN/cm²","placement":"Suffix","space":true}}},"kilonewtonsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"squareMeters":-1},"symbols":{"kNPerMSup2":{"text":"kN/m²","placement":"Suffix","space":true}}},"kilonewtonsPerSquareMillimeter":{"unitSystem":"Metric","parentUnits":{"kilonewtons":1,"squareMillimeters":-1},"symbols":{"kNPerMmSup2":{"text":"kN/mm²","placement":"Suffix","space":true}}},"kilopascals":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"pascals":1},"symbols":{"kPa":{"text":"kPa","placement":"Suffix","space":true}}},"kilovoltAmperes":{"unitSystem":"Metric","parentUnits":{"kilovolts":1,"amperes":1},"symbols":{"kVA":{"text":"kVA","placement":"Suffix","space":true}}},"kilovolts":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"volts":1},"symbols":{"kV":{"text":"kV","placement":"Suffix","space":true}}},"kilowattHours":{"unitSystem":"Metric","parentUnits":{"kilowatts":1,"hours":1},"symbols":{"kWh":{"text":"kWh","placement":"Suffix","space":true}}},"kilowattHoursPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"kilowattHours":1,"squareMeters":-1},"symbols":{"kWhPerMSup2":{"text":"kWh/m²","placement":"Suffix","space":true}}},"kilowatts":{"unitSystem":"Metric","parentFactors":{"kilo":1},"parentUnits":{"watts":1},"symbols":{"kW":{"text":"kW","placement":"Suffix","space":true}}},"kipFeet":{"unitSystem":"Imperial","parentUnits":{"kips":1,"feet":1},"symbols":{"kipDashFt":{"text":"kip-ft","placement":"Suffix","space":true}}},"kipFeetPerDegree":{"unitSystem":"Imperial","parentUnits":{"kipFeet":1,"degrees":-1},"symbols":{"kipDashFtPerDegree":{"text":"kip-ft/°","placement":"Suffix","space":true}}},"kipFeetPerDegreePerFoot":{"unitSystem":"Imperial","parentUnits":{"kipFeetPerDegree":1,"feet":-1},"symbols":{"kipDashFtPerDegreePerFt":{"text":"kip-ft/°/ft","placement":"Suffix","space":true}}},"kipFeetPerFoot":{"unitSystem":"Imperial","parentUnits":{"kipFeet":1,"feet":-1},"symbols":{"kipDashFtPerFt":{"text":"kip-ft/ft","placement":"Suffix","space":true}}},"kips":{"unitSystem":"Imperial","parentFactors":{"kilo":1},"parentUnits":{"poundsForce":1},"symbols":{"kip":{"text":"kip","placement":"Suffix","space":true}}},"kipsPerCubicFoot":{"unitSystem":"Imperial","parentUnits":{"kips":1,"cubicFeet":-1},"symbols":{"kipPerFtSup3":{"text":"kip/ft³","placement":"Suffix","space":true}}},"kipsPerCubicInch":{"unitSystem":"Imperial","parentUnits":{"kips":1,"cubicInches":-1},"symbols":{"kipPerInSup3":{"text":"kip/in³","placement":"Suffix","space":true}}},"kipsPerFoot":{"unitSystem":"Imperial","parentUnits":{"kips":1,"feet":-1},"symbols":{"kipPerFt":{"text":"kip/ft","placement":"Suffix","space":true}}},"kipsPerInch":{"unitSystem":"Imperial","parentUnits":{"kips":1,"inches":-1},"symbols":{"kipPerIn":{"text":"kip/in","placement":"Suffix","space":true}}},"kipsPerSquareFoot":{"defaultSymbol":"kipPerFtSup2","unitSystem":"Imperial","parentUnits":{"kips":1,"squareFeet":-1},"symbols":{"kipPerFtSup2":{"text":"kip/ft²","placement":"Suffix","space":true},"ksf":{"text":"ksf","placement":"Suffix","space":true}}},"kipsPerSquareInch":{"defaultSymbol":"kipPerInSup2","unitSystem":"Imperial","parentUnits":{"kips":1,"squareInches":-1},"symbols":{"kipPerInSup2":{"text":"kip/in²","placement":"Suffix","space":true},"ksi":{"text":"ksi","placement":"Suffix","space":true}}},"liters":{"unitSystem":"Metric","parentUnits":{"decimeters":3},"symbols":{"liter":{"text":"L","placement":"Suffix","space":true}}},"litersPerHour":{"unitSystem":"Metric","parentUnits":{"liters":1,"hours":-1},"symbols":{"lPerH":{"text":"L/h","placement":"Suffix","space":true}}},"litersPerMinute":{"defaultSymbol":"lPerMin","unitSystem":"Metric","parentUnits":{"liters":1,"minutes":-1},"symbols":{"lPerMin":{"text":"L/min","placement":"Suffix","space":true},"lpm":{"text":"LPM","placement":"Suffix","space":true}}},"litersPerSecond":{"defaultSymbol":"lPerS","unitSystem":"Metric","parentUnits":{"liters":1,"seconds":-1},"symbols":{"lPerS":{"text":"L/s","placement":"Suffix","space":true},"lps":{"text":"LPS","placement":"Suffix","space":true}}},"litersPerSecondCubicMeter":{"unitSystem":"Metric","parentUnits":{"litersPerSecond":1,"cubicMeters":-1},"symbols":{"lPerSMSup3":{"text":"L/(s·m³)","placement":"Suffix","space":true}}},"litersPerSecondKilowatt":{"unitSystem":"Metric","parentUnits":{"litersPerSecond":1,"kilowatts":-1},"symbols":{"lPerSKw":{"text":"L/(s·kW)","placement":"Suffix","space":true}}},"litersPerSecondSquareMeter":{"defaultSymbol":"lPerSMSup2","unitSystem":"Metric","parentUnits":{"litersPerSecond":1,"squareMeters":-1},"symbols":{"lPerSMSup2":{"text":"L/(s·m²)","placement":"Suffix","space":true},"lpsPerMSup2":{"text":"LPS/m²","placement":"Suffix","space":true}}},"lumens":{"unitSystem":"Metric","parentUnits":{"candelas":1,"steradians":1},"symbols":{"lm":{"text":"lm","placement":"Suffix","space":true}}},"lumensPerWatt":{"unitSystem":"Metric","parentUnits":{"lumens":1,"watts":-1},"symbols":{"lmPerW":{"text":"lm/W","placement":"Suffix","space":true}}},"lux":{"unitSystem":"Metric","parentUnits":{"lumens":1,"squareMeters":-1},"symbols":{"lx":{"text":"lx","placement":"Suffix","space":true}}},"maxwells":{"unitSystem":"Metric","parentFactors":{"ten":-8},"parentUnits":{"webers":1},"symbols":{"mx":{"text":"Mx","placement":"Suffix","space":true}}},"megajoules":{"unitSystem":"Metric","parentFactors":{"mega":1},"parentUnits":{"joules":1}},"megajoulesPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"megajoules":1,"squareMeters":-1}},"meganewtonMeters":{"unitSystem":"Metric","parentUnits":{"meganewtons":1,"meters":1},"symbols":{"mNDashM":{"text":"MN-m","placement":"Suffix","space":true}}},"meganewtonMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"meganewtonMeters":1,"meters":-1},"symbols":{"mNDashMPerM":{"text":"MN-m/m","placement":"Suffix","space":true}}},"meganewtons":{"unitSystem":"Metric","parentFactors":{"mega":1},"parentUnits":{"newtons":1},"symbols":{"mN":{"text":"MN","placement":"Suffix","space":true}}},"meganewtonsPerMeter":{"unitSystem":"Metric","parentUnits":{"meganewtons":1,"meters":-1},"symbols":{"mNPerM":{"text":"MN/m","placement":"Suffix","space":true}}},"meganewtonsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"meganewtons":1,"squareMeters":-1},"symbols":{"mNPerMSup2":{"text":"MN/m²","placement":"Suffix","space":true}}},"megapascals":{"unitSystem":"Metric","parentFactors":{"mega":1},"parentUnits":{"pascals":1},"symbols":{"mPa":{"text":"MPa","placement":"Suffix","space":true}}},"megawattHours":{"unitSystem":"Metric","parentUnits":{"megawatts":1,"hours":1},"symbols":{"mWh":{"text":"mWh","placement":"Suffix","space":true}}},"megawatts":{"unitSystem":"Metric","parentFactors":{"mega":1},"parentUnits":{"watts":1}},"meters":{"defaultSymbol":"meter","unitSystem":"Metric","dimension":"length","symbols":{"meter":{"text":"m","placement":"Suffix","space":true},"metersAndCentimeters":{"inherits":"symbol"}}},"metersOfWaterColumn":{"unitSystem":"Metric","parentUnits":{"meters":1,"standardGravity":1,"waterDensity4DegreesCelsius":1},"symbols":{"mH2O":{"text":"mH2O","placement":"Suffix","space":true}}},"metersOfWaterColumnPerMeter":{"unitSystem":"Metric","parentUnits":{"metersOfWaterColumn":1,"meters":-1},"symbols":{"mH2OPerM":{"text":"mH2O/m","placement":"Suffix","space":true}}},"metersPerKilonewton":{"unitSystem":"Metric","parentUnits":{"meters":1,"kilonewtons":-1},"symbols":{"mPerKN":{"text":"m/kN","placement":"Suffix","space":true}}},"metersPerKilonewtonMeter":{"unitSystem":"Metric","parentUnits":{"meters":1,"kilonewtonMeters":-1},"symbols":{"mPerKNDashM":{"text":"m/kN-m","placement":"Suffix","space":true}}},"metersPerSecond":{"unitSystem":"Metric","parentUnits":{"meters":1,"seconds":-1},"symbols":{"mPerS":{"text":"m/s","placement":"Suffix","space":true}}},"metersPerSecondSquared":{"unitSystem":"Metric","parentUnits":{"metersPerSecond":1,"seconds":-1},"symbols":{"mPerSSup2":{"text":"m/s²","placement":"Suffix","space":true}}},"metersToTheFourthPower":{"unitSystem":"Metric","parentUnits":{"meters":4},"symbols":{"mSup4":{"text":"m⁴","placement":"Suffix","space":true}}},"metersToTheSixthPower":{"unitSystem":"Metric","parentUnits":{"meters":6},"symbols":{"mSup6":{"text":"m⁶","placement":"Suffix","space":true}}},"mhos":{"unitSystem":"Metric","parentUnits":{"ohms":-1},"symbols":{"mho":{"text":"mho","placement":"Suffix","space":true}}},"microinches":{"unitSystem":"Imperial","parentFactors":{"micro":1},"parentUnits":{"inches":1},"symbols":{"uin":{"text":"µin","placement":"Suffix","space":true}}},"microinchesPerInchDegreeFahrenheit":{"unitSystem":"Imperial","parentFactors":{"micro":1},"parentUnits":{"inverseDegreesFahrenheit":1},"symbols":{"uinPerInDegreeF":{"text":"µin/(in·°F)","placement":"Suffix","space":true}}},"micrometersPerMeterDegreeCelsius":{"unitSystem":"Metric","parentFactors":{"micro":1},"parentUnits":{"inverseDegreesCelsius":1},"symbols":{"umPerMDegreeC":{"text":"µm/(m·°C)","placement":"Suffix","space":true}}},"microns":{"unitSystem":"Metric","parentFactors":{"micro":1},"parentUnits":{"meters":1},"symbols":{"micron":{"text":"micron","placement":"Suffix","space":true}}},"miles":{"unitSystem":"Imperial","factor":1760,"parentUnits":{"yards":1},"symbols":{"mi":{"text":"mi","placement":"Suffix","space":true}}},"milesPerHour":{"unitSystem":"Imperial","parentUnits":{"miles":1,"hours":-1},"symbols":{"mph":{"text":"mph","placement":"Suffix","space":true}}},"milesPerSecond":{"unitSystem":"Imperial","parentUnits":{"miles":1,"seconds":-1},"symbols":{"miPerS":{"text":"mi/s","placement":"Suffix","space":true}}},"milesPerSecondSquared":{"unitSystem":"Imperial","parentUnits":{"milesPerSecond":1,"seconds":-1},"symbols":{"miPerSSup2":{"text":"mi/s²","placement":"Suffix","space":true}}},"milliamperes":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"amperes":1},"symbols":{"mA":{"text":"mA","placement":"Suffix","space":true}}},"milligrams":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"grams":1},"symbols":{"mg":{"text":"mg","placement":"Suffix","space":true}}},"millimeters":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"meters":1},"symbols":{"mm":{"text":"mm","placement":"Suffix","space":true}}},"millimetersOfMercury":{"unitSystem":"Metric","factor":133.3224,"parentUnits":{"pascals":1},"symbols":{"mmHg":{"text":"mmHg","placement":"Suffix","space":true}}},"millimetersOfWaterColumn":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"metersOfWaterColumn":1},"symbols":{"mmH2O":{"text":"mmH2O","placement":"Suffix","space":true}}},"millimetersOfWaterColumnPerMeter":{"unitSystem":"Metric","parentUnits":{"millimetersOfWaterColumn":1,"meters":-1},"symbols":{"mmH2OPerM":{"text":"mmH2O/m","placement":"Suffix","space":true}}},"millimetersToTheFourthPower":{"unitSystem":"Metric","parentUnits":{"millimeters":4},"symbols":{"mmSup4":{"text":"mm⁴","placement":"Suffix","space":true}}},"millimetersToTheSixthPower":{"unitSystem":"Metric","parentUnits":{"millimeters":6},"symbols":{"mmSup6":{"text":"mm⁶","placement":"Suffix","space":true}}},"milliseconds":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"seconds":1},"symbols":{"ms":{"text":"ms","placement":"Suffix","space":true}}},"millivolts":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"volts":1},"symbols":{"mV":{"text":"mV","placement":"Suffix","space":true}}},"mils":{"unitSystem":"Imperial","parentFactors":{"milli":1},"parentUnits":{"inches":1},"symbols":{"mil":{"text":"mil","placement":"Suffix","space":true}}},"minutes":{"unitSystem":"Metric","factor":60,"parentUnits":{"seconds":1},"symbols":{"min":{"text":"min","placement":"Suffix","space":true}}},"nanograms":{"unitSystem":"Metric","parentFactors":{"nano":1},"parentUnits":{"grams":1},"symbols":{"ng":{"text":"ng","placement":"Suffix","space":true}}},"nanogramsPerPascalSecondSquareMeter":{"unitSystem":"Metric","parentUnits":{"nanograms":1,"seconds":-1,"squareMeters":-1,"pascals":-1},"symbols":{"ngPerPaSMSup2":{"text":"ng/(Pa·s·m²)","placement":"Suffix","space":true}}},"nanometers":{"unitSystem":"Metric","parentFactors":{"nano":1},"parentUnits":{"meters":1},"symbols":{"nm":{"text":"nm","placement":"Suffix","space":true}}},"nauticalMiles":{"unitSystem":"Imperial","factor":1852,"parentUnits":{"meters":1},"symbols":{"nauticalMile":{"text":"M","placement":"Suffix","space":true}}},"newtonMeters":{"unitSystem":"Metric","parentUnits":{"newtons":1,"meters":1},"symbols":{"nDashM":{"text":"N-m","placement":"Suffix","space":true}}},"newtonMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"newtonMeters":1,"meters":-1},"symbols":{"nDashMPerM":{"text":"N-m/m","placement":"Suffix","space":true}}},"newtonSecondsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"newtons":1,"seconds":1,"squareMeters":-1},"symbols":{"nSPerMSup2":{"text":"N·s/m²","placement":"Suffix","space":true}}},"newtons":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"metersPerSecondSquared":1},"symbols":{"newton":{"text":"N","placement":"Suffix","space":true}}},"newtonsPerMeter":{"unitSystem":"Metric","parentUnits":{"newtons":1,"meters":-1},"symbols":{"nPerM":{"text":"N/m","placement":"Suffix","space":true}}},"newtonsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"newtons":1,"squareMeters":-1},"symbols":{"nPerMSup2":{"text":"N/m²","placement":"Suffix","space":true}}},"newtonsPerSquareMillimeter":{"unitSystem":"Metric","parentUnits":{"newtons":1,"squareMillimeters":-1},"symbols":{"nPerMmSup2":{"text":"N/mm²","placement":"Suffix","space":true}}},"oersteds":{"unitSystem":"Metric","factor":250,"parentFactors":{"pi":-1},"parentUnits":{"amperes":1,"meters":-1},"symbols":{"oe":{"text":"Oe","placement":"Suffix","space":true}}},"ohmMeters":{"unitSystem":"Metric","parentUnits":{"ohms":1,"meters":1},"symbols":{"ohmM":{"text":"ohm·m","placement":"Suffix","space":true}}},"ohms":{"defaultSymbol":"omega","unitSystem":"Metric","parentUnits":{"volts":1,"amperes":-1},"symbols":{"ohm":{"text":"ohm","placement":"Suffix","space":true},"omega":{"text":"Ω","placement":"Suffix","space":true}}},"ouncesForce":{"unitSystem":"Imperial","factor":0.0625,"parentUnits":{"poundsForce":1},"symbols":{"ozf":{"text":"ozf","placement":"Suffix","space":true}}},"ouncesMass":{"unitSystem":"Imperial","factor":0.0625,"parentUnits":{"poundsMass":1},"symbols":{"oz":{"text":"oz","placement":"Suffix","space":true}}},"pascalSeconds":{"unitSystem":"Metric","parentUnits":{"pascals":1,"seconds":1},"symbols":{"paDashS":{"text":"Pa-s","placement":"Suffix","space":true}}},"pascals":{"unitSystem":"Metric","parentUnits":{"newtonsPerSquareMeter":1},"symbols":{"pa":{"text":"Pa","placement":"Suffix","space":true}}},"pascalsPerMeter":{"unitSystem":"Metric","parentUnits":{"pascals":1,"meters":-1},"symbols":{"paPerM":{"text":"Pa/m","placement":"Suffix","space":true}}},"perMille":{"unitSystem":"Metric","parentFactors":{"milli":1},"parentUnits":{"ratioTo1":1},"symbols":{"perMille":{"text":"‰","placement":"Suffix","space":false}}},"percentage":{"unitSystem":"Metric","parentFactors":{"centi":1},"parentUnits":{"ratioTo1":1},"symbols":{"percent":{"text":"%","placement":"Suffix","space":false}}},"pi":{"unitSystem":"Imperial","parentFactors":{"pi":1},"parentUnits":{"radians":1},"symbols":{"pi":{"text":"π","placement":"Suffix","space":true}}},"poises":{"unitSystem":"Metric","parentUnits":{"grams":1,"centimeters":-1,"seconds":-1},"symbols":{"poise":{"text":"P","placement":"Suffix","space":true}}},"poundForceFeet":{"defaultSymbol":"lbForceDashFt","unitSystem":"Imperial","parentUnits":{"poundsForce":1,"feet":1},"symbols":{"lbForceDashFt":{"text":"lb-ft","placement":"Suffix","space":true},"lbfDashFt":{"text":"lbf-ft","placement":"Suffix","space":true}}},"poundForceFeetPerFoot":{"defaultSymbol":"lbForceDashFtPerFt","unitSystem":"Imperial","parentUnits":{"poundForceFeet":1,"feet":-1},"symbols":{"lbForceDashFtPerFt":{"text":"lb-ft/ft","placement":"Suffix","space":true},"lbfDashFtPerFt":{"text":"lbf-ft/ft","placement":"Suffix","space":true}}},"poundForceSecondsPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"poundsForce":1,"seconds":1,"squareFeet":-1},"symbols":{"lbForceSPerFtSup2":{"text":"lb·s/ft²","placement":"Suffix","space":true}}},"poundMassDegreesFahrenheit":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"fahrenheitInterval":1},"symbols":{"lbMassDegreeF":{"text":"lb·°F","placement":"Suffix","space":true}}},"poundsForce":{"defaultSymbol":"lbForce","unitSystem":"Imperial","parentUnits":{"poundsMass":1,"standardGravity":1},"symbols":{"lbForce":{"text":"lb","placement":"Suffix","space":true},"lbf":{"text":"lbf","placement":"Suffix","space":true}}},"poundsForcePerCubicFoot":{"defaultSymbol":"lbForcePerFtSup3","unitSystem":"Imperial","parentUnits":{"poundsForce":1,"cubicFeet":-1},"symbols":{"lbForcePerFtSup3":{"text":"lb/ft³","placement":"Suffix","space":true},"lbfPerFtSup3":{"text":"lbf/ft³","placement":"Suffix","space":true}}},"poundsForcePerFoot":{"defaultSymbol":"lbForcePerFt","unitSystem":"Imperial","parentUnits":{"poundsForce":1,"feet":-1},"symbols":{"lbForcePerFt":{"text":"lb/ft","placement":"Suffix","space":true},"lbfPerFt":{"text":"lbf/ft","placement":"Suffix","space":true}}},"poundsForcePerSquareFoot":{"defaultSymbol":"lbForcePerFtSup2","unitSystem":"Imperial","parentUnits":{"poundsForce":1,"squareFeet":-1},"symbols":{"lbForcePerFtSup2":{"text":"lb/ft²","placement":"Suffix","space":true},"lbfPerFtSup2":{"text":"lbf/ft²","placement":"Suffix","space":true},"psf":{"text":"psf","placement":"Suffix","space":true}}},"poundsForcePerSquareInch":{"defaultSymbol":"lbForcePerInSup2","unitSystem":"Imperial","parentUnits":{"poundsForce":1,"squareInches":-1},"symbols":{"lbForcePerInSup2":{"text":"lb/in²","placement":"Suffix","space":true},"lbfPerInSup2":{"text":"lbf/in²","placement":"Suffix","space":true},"psi":{"text":"psi","placement":"Suffix","space":true},"psia":{"text":"psia","placement":"Suffix","space":true},"psig":{"text":"psig","placement":"Suffix","space":true}}},"poundsMass":{"defaultSymbol":"lbMass","unitSystem":"Imperial","factor":0.45359237,"parentUnits":{"kilograms":1},"symbols":{"lbMass":{"text":"lb","placement":"Suffix","space":true},"lbm":{"text":"lbm","placement":"Suffix","space":true}}},"poundsMassPerCubicFoot":{"defaultSymbol":"lbMassPerFtSup3","unitSystem":"Imperial","parentUnits":{"poundsMass":1,"cubicFeet":-1},"symbols":{"lbMassPerFtSup3":{"text":"lb/ft³","placement":"Suffix","space":true},"lbmPerFtSup3":{"text":"lbm/ft³","placement":"Suffix","space":true}}},"poundsMassPerCubicInch":{"defaultSymbol":"lbMassPerInSup3","unitSystem":"Imperial","parentUnits":{"poundsMass":1,"cubicInches":-1},"symbols":{"lbMassPerInSup3":{"text":"lb/in³","placement":"Suffix","space":true},"lbmPerInSup3":{"text":"lbm/in³","placement":"Suffix","space":true}}},"poundsMassPerFoot":{"defaultSymbol":"lbMassPerFt","unitSystem":"Imperial","parentUnits":{"poundsMass":1,"feet":-1},"symbols":{"lbMassPerFt":{"text":"lb/ft","placement":"Suffix","space":true},"lbmPerFt":{"text":"lbm/ft","placement":"Suffix","space":true}}},"poundsMassPerFootHour":{"defaultSymbol":"lbMassPerFtDashH","unitSystem":"Imperial","parentUnits":{"poundsMassPerFoot":1,"hours":-1},"symbols":{"lbMassPerFtDashH":{"text":"lb/ft-h","placement":"Suffix","space":true},"lbmPerFtDashH":{"text":"lbm/ft-h","placement":"Suffix","space":true}}},"poundsMassPerFootSecond":{"defaultSymbol":"lbMassPerFtDashS","unitSystem":"Imperial","parentUnits":{"poundsMassPerFoot":1,"seconds":-1},"symbols":{"lbMassPerFtDashS":{"text":"lb/ft-s","placement":"Suffix","space":true},"lbmPerFtDashS":{"text":"lbm/ft-s","placement":"Suffix","space":true}}},"poundsMassPerHour":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"hours":-1},"symbols":{"lbMassPerH":{"text":"lb/h","placement":"Suffix","space":true}}},"poundsMassPerMinute":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"minutes":-1},"symbols":{"lbMassPerMin":{"text":"lb/min","placement":"Suffix","space":true}}},"poundsMassPerPoundDegreeFahrenheit":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"poundMassDegreesFahrenheit":-1},"symbols":{"lbMassPerLbDegreeF":{"text":"lb/(lb·°F)","placement":"Suffix","space":true}}},"poundsMassPerSecond":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"seconds":-1},"symbols":{"lbMassPerS":{"text":"lb/s","placement":"Suffix","space":true}}},"poundsMassPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"poundsMass":1,"squareFeet":-1},"symbols":{"lbMassPerFtSup2":{"text":"lb/ft²","placement":"Suffix","space":true}}},"radians":{"unitSystem":"Metric","symbols":{"rad":{"text":"rad","placement":"Suffix","space":true}}},"radiansPerSecond":{"unitSystem":"Metric","parentUnits":{"radians":1,"seconds":-1},"symbols":{"radPerS":{"text":"rad/s","placement":"Suffix","space":true}}},"rankine":{"unitSystem":"Imperial","parentUnit":"rankineInterval","symbols":{"degreeR":{"text":"°R","placement":"Suffix","space":true}}},"rankineInterval":{"defaultSymbol":"degreeRInterval","unitSystem":"Imperial","parentFactors":{"nineFifths":-1},"parentUnits":{"kelvinInterval":1},"symbols":{"degreeRInterval":{"text":"°R","placement":"Suffix","space":true},"deltaDegreeR":{"text":"delta°R","placement":"Suffix","space":true}}},"ratioTo1":{"unitSystem":"Metric","symbols":{"colon1":{"text":":1","placement":"Suffix","space":false}}},"ratioTo10":{"unitSystem":"Metric","parentFactors":{"ten":-1},"parentUnits":{"ratioTo1":1},"symbols":{"colon10":{"text":":10","placement":"Suffix","space":false}}},"ratioTo12":{"unitSystem":"Imperial","parentFactors":{"twelve":-1},"parentUnits":{"ratioTo1":1},"symbols":{"colon12":{"text":":12","placement":"Suffix","space":false}}},"revolutionsPerMinute":{"unitSystem":"Imperial","parentUnits":{"turns":1,"minutes":-1},"symbols":{"rpm":{"text":"RPM","placement":"Suffix","space":true}}},"revolutionsPerSecond":{"unitSystem":"Metric","parentUnits":{"turns":1,"seconds":-1},"symbols":{"rps":{"text":"RPS","placement":"Suffix","space":true}}},"riseDividedBy1000Millimeters":{"unitSystem":"Metric","parentUnits":{"perMille":1}},"riseDividedBy10Feet":{"unitSystem":"Imperial","parentUnits":{"ratioTo10":1}},"riseDividedBy120Inches":{"unitSystem":"Imperial","parentFactors":{"ten":-1},"parentUnits":{"riseDividedBy12Inches":1}},"riseDividedBy12Inches":{"unitSystem":"Imperial","parentUnits":{"ratioTo12":1}},"riseDividedBy1Foot":{"unitSystem":"Imperial","parentUnits":{"ratioTo1":1}},"seconds":{"unitSystem":"Metric","dimension":"time","symbols":{"second":{"text":"s","placement":"Suffix","space":true}}},"siemens":{"unitSystem":"Metric","parentUnits":{"mhos":1},"symbols":{"siemens":{"text":"S","placement":"Suffix","space":true}}},"slugs":{"unitSystem":"Imperial","parentUnits":{"poundsForce":1,"seconds":2,"feet":-1},"symbols":{"slug":{"text":"slug","placement":"Suffix","space":true}}},"squareCentimeters":{"defaultSymbol":"cmSup2","unitSystem":"Metric","parentUnits":{"centimeters":2},"symbols":{"cmCaret2":{"text":"cm^2","placement":"Suffix","space":true},"cmSup2":{"text":"cm²","placement":"Suffix","space":true}}},"squareCentimetersPerMeter":{"unitSystem":"Metric","parentUnits":{"squareCentimeters":1,"meters":-1},"symbols":{"cmSup2PerM":{"text":"cm²/m","placement":"Suffix","space":true}}},"squareFeet":{"defaultSymbol":"ftSup2","unitSystem":"Imperial","parentUnits":{"feet":2},"symbols":{"ftCaret2":{"text":"ft^2","placement":"Suffix","space":true},"ftSup2":{"text":"ft²","placement":"Suffix","space":true},"sf":{"text":"SF","placement":"Suffix","space":true}}},"squareFeetPer1000BritishThermalUnitsPerHour":{"defaultSymbol":"ftSup2HPerKbtu","unitSystem":"Imperial","factor":0.001,"parentUnits":{"squareFeet":1,"britishThermalUnitsPerHour":-1},"symbols":{"ftSup2HPerKbtu":{"text":"ft²·h/kBtu","placement":"Suffix","space":true},"ftSup2PerMbh":{"text":"ft²/MBh","placement":"Suffix","space":true},"sfHPerKbtu":{"text":"SF·h/kBtu","placement":"Suffix","space":true},"sfPerMbh":{"text":"SF/MBh","placement":"Suffix","space":true}}},"squareFeetPerFoot":{"unitSystem":"Imperial","parentUnits":{"squareFeet":1,"feet":-1},"symbols":{"ftSup2PerFt":{"text":"ft²/ft","placement":"Suffix","space":true}}},"squareFeetPerKip":{"unitSystem":"Imperial","parentUnits":{"squareFeet":1,"kips":-1},"symbols":{"ftSup2PerKip":{"text":"ft²/kip","placement":"Suffix","space":true}}},"squareFeetPerKipFoot":{"unitSystem":"Imperial","parentUnits":{"squareFeet":1,"kipFeet":-1},"symbols":{"ftSup2PerKipDashFt":{"text":"ft²/kip-ft","placement":"Suffix","space":true}}},"squareFeetPerSecond":{"unitSystem":"Imperial","parentUnits":{"squareFeet":1,"seconds":-1},"symbols":{"ftSup2PerS":{"text":"ft²/s","placement":"Suffix","space":true}}},"squareFeetPerTonOfRefrigeration":{"defaultSymbol":"ftSup2PerTon","unitSystem":"Imperial","parentUnits":{"squareFeet":1,"tonsOfRefrigeration":-1},"symbols":{"ftSup2PerTon":{"text":"ft²/ton","placement":"Suffix","space":true},"sfPerTon":{"text":"SF/ton","placement":"Suffix","space":true}}},"squareHectometers":{"unitSystem":"Metric","parentUnits":{"hectometers":2},"symbols":{"hmSup2":{"text":"hm²","placement":"Suffix","space":true}}},"squareInches":{"defaultSymbol":"inSup2","unitSystem":"Imperial","parentUnits":{"inches":2},"symbols":{"inCaret2":{"text":"in^2","placement":"Suffix","space":true},"inSup2":{"text":"in²","placement":"Suffix","space":true}}},"squareInchesPerFoot":{"unitSystem":"Imperial","parentUnits":{"squareInches":1,"feet":-1},"symbols":{"inSup2PerFt":{"text":"in²/ft","placement":"Suffix","space":true}}},"squareMeterKelvinsPerWatt":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"kelvinInterval":1,"watts":-1},"symbols":{"mSup2KPerW":{"text":"(m²·K)/W","placement":"Suffix","space":true}}},"squareMeters":{"defaultSymbol":"mSup2","unitSystem":"Metric","parentUnits":{"meters":2},"symbols":{"mCaret2":{"text":"m^2","placement":"Suffix","space":true},"mSup2":{"text":"m²","placement":"Suffix","space":true}}},"squareMetersPerKilonewton":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"kilonewtons":-1},"symbols":{"mSup2PerKN":{"text":"m²/kN","placement":"Suffix","space":true}}},"squareMetersPerKilonewtonMeter":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"kilonewtonMeters":-1},"symbols":{"mSup2PerKNDashM":{"text":"m²/kN-m","placement":"Suffix","space":true}}},"squareMetersPerKilowatt":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"kilowatts":-1},"symbols":{"mSup2PerKw":{"text":"m²/kW","placement":"Suffix","space":true}}},"squareMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"meters":-1},"symbols":{"mSup2PerM":{"text":"m²/m","placement":"Suffix","space":true}}},"squareMetersPerSecond":{"unitSystem":"Metric","parentUnits":{"squareMeters":1,"seconds":-1},"symbols":{"mSup2PerS":{"text":"m²/s","placement":"Suffix","space":true}}},"squareMillimeters":{"defaultSymbol":"mmSup2","unitSystem":"Metric","parentUnits":{"millimeters":2},"symbols":{"mmCaret2":{"text":"mm^2","placement":"Suffix","space":true},"mmSup2":{"text":"mm²","placement":"Suffix","space":true}}},"squareMillimetersPerMeter":{"unitSystem":"Metric","parentUnits":{"squareMillimeters":1,"meters":-1},"symbols":{"mmSup2PerM":{"text":"mm²/m","placement":"Suffix","space":true}}},"squareMils":{"defaultSymbol":"milSup2","unitSystem":"Imperial","parentUnits":{"mils":2},"symbols":{"milCaret2":{"text":"mil^2","placement":"Suffix","space":true},"milSup2":{"text":"mil²","placement":"Suffix","space":true}}},"squareYards":{"unitSystem":"Imperial","parentUnits":{"yards":2},"symbols":{"ydSup2":{"text":"yd²","placement":"Suffix","space":true}}},"standardGravity":{"unitSystem":"Metric","factor":9.80665,"parentUnits":{"metersPerSecondSquared":1},"symbols":{"gravity":{"text":"𝘨","placement":"Suffix","space":true}}},"steradians":{"unitSystem":"Metric","symbols":{"sr":{"text":"sr","placement":"Suffix","space":true}}},"teslas":{"unitSystem":"Metric","parentUnits":{"webers":1,"meters":-2},"symbols":{"tesla":{"text":"T","placement":"Suffix","space":true}}},"therms":{"unitSystem":"Imperial","factor":100000,"parentUnits":{"britishThermalUnits":1},"symbols":{"therm":{"text":"therm","placement":"Suffix","space":true}}},"thousandBritishThermalUnits":{"unitSystem":"Imperial","parentFactors":{"kilo":1},"parentUnits":{"britishThermalUnits":1},"symbols":{"kBtu":{"text":"kBtu","placement":"Suffix","space":true}}},"thousandBritishThermalUnitsPerHour":{"unitSystem":"Imperial","factor":1000,"parentUnits":{"britishThermalUnitsPerHour":1},"symbols":{"mbh":{"text":"MBH","placement":"Suffix","space":true}}},"thousandBritishThermalUnitsPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"thousandBritishThermalUnits":1,"squareFeet":-1},"symbols":{"kBtuPerFtSup2":{"text":"kBtu/ft²","placement":"Suffix","space":true}}},"tonneForceMeters":{"unitSystem":"Metric","parentUnits":{"tonnesForce":1,"meters":1},"symbols":{"tfDashM":{"text":"Tf-m","placement":"Suffix","space":true}}},"tonneForceMetersPerMeter":{"unitSystem":"Metric","parentUnits":{"tonneForceMeters":1,"meters":-1},"symbols":{"tfDashMPerM":{"text":"Tf-m/m","placement":"Suffix","space":true}}},"tonnes":{"unitSystem":"Metric","factor":1000,"parentUnits":{"kilograms":1},"symbols":{"tonne":{"text":"t","placement":"Suffix","space":true}}},"tonnesForce":{"unitSystem":"Metric","parentUnits":{"tonnes":1,"standardGravity":1},"symbols":{"tf":{"text":"Tf","placement":"Suffix","space":true}}},"tonnesForcePerMeter":{"unitSystem":"Metric","parentUnits":{"tonnesForce":1,"meters":-1},"symbols":{"tfPerM":{"text":"Tf/m","placement":"Suffix","space":true}}},"tonnesForcePerSquareMeter":{"unitSystem":"Metric","parentUnits":{"tonnesForce":1,"squareMeters":-1},"symbols":{"tfPerMSup2":{"text":"Tf/m²","placement":"Suffix","space":true}}},"tonsOfRefrigeration":{"defaultSymbol":"ton","unitSystem":"Imperial","factor":12000,"parentUnits":{"britishThermalUnitsPerHour":1},"symbols":{"ton":{"text":"ton","placement":"Suffix","space":true},"tonOfRefrigeration":{"text":"ton of refrigeration","placement":"Suffix","space":true}}},"turns":{"unitSystem":"Metric","factor":2,"parentFactors":{"pi":1},"parentUnits":{"radians":1},"symbols":{"tr":{"text":"tr","placement":"Suffix","space":true}}},"usGallons":{"unitSystem":"Imperial","factor":231,"parentUnits":{"cubicInches":1},"symbols":{"gal":{"text":"gal","placement":"Suffix","space":true}}},"usGallonsPerHour":{"defaultSymbol":"galPerH","unitSystem":"Imperial","parentUnits":{"usGallons":1,"hours":-1},"symbols":{"galPerH":{"text":"gal/h","placement":"Suffix","space":true},"gph":{"text":"GPH","placement":"Suffix","space":true},"usgph":{"text":"usgph","placement":"Suffix","space":true}}},"usGallonsPerMinute":{"defaultSymbol":"galPerMin","unitSystem":"Imperial","parentUnits":{"usGallons":1,"minutes":-1},"symbols":{"galPerMin":{"text":"gal/min","placement":"Suffix","space":true},"gpm":{"text":"GPM","placement":"Suffix","space":true},"usgpm":{"text":"usgpm","placement":"Suffix","space":true}}},"usSurveyFeet":{"unitSystem":"Imperial","factor":1200,"parentFactors":{"threeThousandNineHundredThirtySeven":-1},"parentUnits":{"meters":1},"symbols":{"usft":{"text":"USft","placement":"Suffix","space":true}}},"usTonnesForce":{"defaultSymbol":"stf","unitSystem":"Imperial","parentUnits":{"usTonnesMass":1,"standardGravity":1},"symbols":{"stf":{"text":"STf","placement":"Suffix","space":true},"tonsf":{"text":"Tonsf","placement":"Suffix","space":true},"usTonnesForceSt":{"text":"ST","placement":"Suffix","space":true},"usTonnesForceT":{"text":"T","placement":"Suffix","space":true},"usTonnesForceTons":{"text":"Tons","placement":"Suffix","space":true}}},"usTonnesMass":{"defaultSymbol":"usTonnesMassSt","unitSystem":"Imperial","factor":2000,"parentUnits":{"poundsMass":1},"symbols":{"usTonnesMassSt":{"text":"ST","placement":"Suffix","space":true},"usTonnesMassT":{"text":"T","placement":"Suffix","space":true},"usTonnesMassTons":{"text":"Tons","placement":"Suffix","space":true}}},"voltAmperes":{"unitSystem":"Metric","parentUnits":{"volts":1,"amperes":1},"symbols":{"vA":{"text":"VA","placement":"Suffix","space":true}}},"voltAmperesPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"voltAmperes":1,"squareFeet":-1},"symbols":{"vAPerFtSup2":{"text":"VA/ft²","placement":"Suffix","space":true}}},"voltAmperesPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"voltAmperes":1,"squareMeters":-1},"symbols":{"vAPerMSup2":{"text":"VA/m²","placement":"Suffix","space":true}}},"volts":{"unitSystem":"Metric","parentUnits":{"watts":1,"amperes":-1},"symbols":{"volt":{"text":"V","placement":"Suffix","space":true}}},"waterDensity4DegreesCelsius":{"unitSystem":"Metric","parentUnits":{"kilograms":1,"liters":-1}},"watts":{"unitSystem":"Metric","parentUnits":{"joules":1,"seconds":-1},"symbols":{"watt":{"text":"W","placement":"Suffix","space":true}}},"wattsPerCubicFoot":{"unitSystem":"Imperial","parentUnits":{"watts":1,"cubicFeet":-1},"symbols":{"wPerFtSup3":{"text":"W/ft³","placement":"Suffix","space":true}}},"wattsPerCubicFootPerMinute":{"unitSystem":"Imperial","parentUnits":{"watts":1,"cubicFeetPerMinute":-1},"symbols":{"wMinPerFtSup3":{"text":"W·min/ft³","placement":"Suffix","space":true}}},"wattsPerCubicMeter":{"unitSystem":"Metric","parentUnits":{"watts":1,"cubicMeters":-1},"symbols":{"wPerMSup3":{"text":"W/m³","placement":"Suffix","space":true}}},"wattsPerCubicMeterPerSecond":{"unitSystem":"Metric","parentUnits":{"watts":1,"cubicMetersPerSecond":-1},"symbols":{"wSPerMSup3":{"text":"W·s/m³","placement":"Suffix","space":true}}},"wattsPerFoot":{"unitSystem":"Imperial","parentUnits":{"watts":1,"feet":-1},"symbols":{"wPerFt":{"text":"W/ft","placement":"Suffix","space":true}}},"wattsPerMeter":{"unitSystem":"Metric","parentUnits":{"watts":1,"meters":-1},"symbols":{"wPerM":{"text":"W/m","placement":"Suffix","space":true}}},"wattsPerMeterKelvin":{"unitSystem":"Metric","parentUnits":{"watts":1,"meters":-1,"kelvinInterval":-1},"symbols":{"wPerMK":{"text":"W/(m·K)","placement":"Suffix","space":true}}},"wattsPerSquareFoot":{"unitSystem":"Imperial","parentUnits":{"watts":1,"squareFeet":-1},"symbols":{"wPerFtSup2":{"text":"W/ft²","placement":"Suffix","space":true}}},"wattsPerSquareMeter":{"unitSystem":"Metric","parentUnits":{"watts":1,"squareMeters":-1},"symbols":{"wPerMSup2":{"text":"W/m²","placement":"Suffix","space":true}}},"wattsPerSquareMeterKelvin":{"unitSystem":"Metric","parentUnits":{"wattsPerSquareMeter":1,"kelvinInterval":-1},"symbols":{"wPerMSup2K":{"text":"W/(m²·K)","placement":"Suffix","space":true}}},"webers":{"unitSystem":"Metric","parentUnits":{"volts":1,"seconds":1},"symbols":{"wb":{"text":"Wb","placement":"Suffix","space":true}}},"yards":{"unitSystem":"Imperial","factor":3,"parentUnits":{"feet":1},"symbols":{"yd":{"text":"yd","placement":"Suffix","space":true}}},"feetFractionalInches":{"defaultSymbol":"feetAndInches","unitSystem":"Imperial","factor":12,"parentUnits":{"inches":1},"symbols":{"feetAndInches":{"inherits":"symbol"},"footSingleQuote":{"text":"\'","placement":"Suffix","space":false},"ft":{"text":"ft","placement":"Suffix","space":true},"lf":{"text":"LF","placement":"Suffix","space":true}}},"fractionalInches":{"defaultSymbol":"in","unitSystem":"Imperial","factor":2.54,"parentUnits":{"centimeters":1},"symbols":{"in":{"text":"in","placement":"Suffix","space":true},"inchDoubleQuote":{"text":"\\"","placement":"Suffix","space":false}}},"metersCentimeters":{"defaultSymbol":"meter","unitSystem":"Metric","dimension":"length","symbols":{"meter":{"text":"m","placement":"Suffix","space":true},"metersAndCentimeters":{"inherits":"symbol"}}},"degreesMinutes":{"defaultSymbol":"degree","unitSystem":"Metric","parentFactors":{"threeHundredSixty":-1},"parentUnits":{"turns":1},"symbols":{"degree":{"text":"°","placement":"Suffix","space":false},"degreesMinutesSeconds":{"inherits":"symbol"}}},"slopeDegrees":{"defaultSymbol":"slopeDegree","unitSystem":"Metric","parentFactors":{"threeHundredSixty":-1},"parentUnits":{"turns":1},"symbols":{"slopeDegree":{"text":"°","placement":"Suffix","space":false}}},"stationingFeet":{"defaultSymbol":"feetAndInches","unitSystem":"Imperial","factor":12,"parentUnits":{"inches":1},"symbols":{"feetAndInches":{"inherits":"symbol"},"footSingleQuote":{"text":"\'","placement":"Suffix","space":false},"ft":{"text":"ft","placement":"Suffix","space":true},"lf":{"text":"LF","placement":"Suffix","space":true}}},"stationingMeters":{"defaultSymbol":"meter","unitSystem":"Metric","dimension":"length","symbols":{"meter":{"text":"m","placement":"Suffix","space":true},"metersAndCentimeters":{"inherits":"symbol"}}},"stationingSurveyFeet":{"unitSystem":"Imperial","factor":1200,"parentFactors":{"threeThousandNineHundredThirtySeven":-1},"parentUnits":{"meters":1},"symbols":{"usft":{"text":"USft","placement":"Suffix","space":true}}},"dateTime":{"symbols":{"date":{"text":"Date"},"dateTime":{"text":"ISODate","description":"default"},"dateAndTime":{"text":"Date, Time"}}}},"quantity":{"acceleration":{"units":["metersPerSecondSquared","kilometersPerSecondSquared","inchesPerSecondSquared","feetPerSecondSquared","milesPerSecondSquared","standardGravity"]},"angle":{"units":["degrees","radians","gradians","turns"]},"angularLineSpringCoefficient":{"units":["kipFeetPerDegreePerFoot","kilonewtonMetersPerDegreePerMeter"]},"angularPointSpringCoefficient":{"units":["kipFeetPerDegree","kilonewtonMetersPerDegree"]},"angularSpeed":{"units":["radiansPerSecond","revolutionsPerMinute"]},"area":{"units":["squareFeet","squareInches","squareMeters","squareCentimeters","squareHectometers","squareMillimeters","acres","hectares","squareYards","circularMils","squareMils"]},"areaPerLength":{"units":["squareFeetPerFoot","squareCentimetersPerMeter","squareMillimetersPerMeter","squareInchesPerFoot","squareMetersPerMeter"]},"areaPerPower":{"units":["squareFeetPerTonOfRefrigeration","squareMetersPerKilowatt","squareFeetPer1000BritishThermalUnitsPerHour"]},"areaPerTorque":{"units":["squareFeetPerKipFoot","squareMetersPerKilonewtonMeter"]},"colorTemperature":{"units":["kelvin"]},"costPerArea":{"units":["currencyPerSquareFoot","currencyPerSquareMeter"]},"currency":{"units":["currency"]},"density":{"units":["kilogramsPerCubicMeter","poundsMassPerCubicInch","poundsMassPerCubicFoot"]},"diffusivity":{"units":["squareFeetPerSecond","squareMetersPerSecond"]},"dynamicViscosity":{"units":["centipoises","kilogramsPerMeterHour","kilogramsPerMeterSecond","newtonSecondsPerSquareMeter","pascalSeconds","poises","poundForceSecondsPerSquareFoot","poundsMassPerFootHour","poundsMassPerFootSecond"]},"electricCapacitance":{"units":["farads"]},"electricCharge":{"units":["coulombs","ampereHours","ampereSeconds"]},"electricConductance":{"units":["mhos","siemens"]},"electricCurrent":{"units":["amperes","kiloamperes","milliamperes"]},"electricInductance":{"units":["henries"]},"electricPotential":{"units":["volts","kilovolts","millivolts"]},"electricResistance":{"units":["ohms"]},"electricResistivity":{"units":["ohmMeters"]},"energy":{"units":["joules","newtonMeters","kilogramForceMeters","poundForceFeet","kilojoules","britishThermalUnits","calories","kilocalories","kilowattHours","therms","ergs"]},"flow":{"units":["cubicFeetPerMinute","cubicFeetPerHour","cubicMetersPerSecond","cubicMetersPerHour","litersPerHour","litersPerMinute","litersPerSecond","usGallonsPerMinute","usGallonsPerHour"]},"flowPerArea":{"units":["cubicFeetPerMinuteSquareFoot","litersPerSecondSquareMeter"]},"flowPerPower":{"units":["cubicFeetPerMinutePerBritishThermalUnitPerHour","cubicFeetPerMinuteTonOfRefrigeration","cubicMetersPerWattSecond","litersPerSecondKilowatt","squareFeetPerKip","squareMetersPerKilonewton"]},"flowPerVolume":{"units":["cubicFeetPerMinuteCubicFoot","litersPerSecondCubicMeter"]},"force":{"units":["newtons","dekanewtons","kilonewtons","meganewtons","kips","kilogramsForce","tonnesForce","usTonnesForce","poundsForce","dynes","ouncesForce"]},"forceDensity":{"units":["kilonewtonsPerCubicMeter","poundsForcePerCubicFoot","kipsPerCubicInch","kipsPerCubicFoot"]},"forcePerLength":{"units":["newtonsPerMeter","dekanewtonsPerMeter","kilonewtonsPerMeter","meganewtonsPerMeter","kipsPerFoot","kilogramsForcePerMeter","tonnesForcePerMeter","poundsForcePerFoot","kipsPerInch"]},"frequency":{"units":["hertz","cyclesPerSecond"]},"friction":{"units":["pascalsPerMeter","feetOfWater39.2DegreesFahrenheitPer100Feet","inchesOfWater60DegreesFahrenheitPer100Feet"]},"heatCapacity":{"units":["britishThermalUnitsPerDegreeFahrenheit","joulesPerKelvin","kilojoulesPerKelvin"]},"heatTransferCoefficient":{"units":["wattsPerSquareMeterKelvin","britishThermalUnitsPerHourSquareFootDegreeFahrenheit"]},"illuminance":{"units":["lux","footcandles"]},"length":{"units":["centimeters","decimeters","feet","hectometers","inches","kilometers","meters","microinches","microns","miles","millimeters","mils","nanometers","nauticalMiles","usSurveyFeet","yards"]},"lengthPerTorque":{"units":["metersPerKilonewtonMeter","feetPerKipFoot"]},"lightingEfficacy":{"units":["lumensPerWatt"]},"luminance":{"units":["footlamberts","candelasPerSquareFoot","candelasPerSquareMeter"]},"luminousFlux":{"units":["lumens"]},"luminousIntensity":{"units":["candelas"]},"magneticFieldStrength":{"units":["oersteds"]},"magneticFlux":{"units":["webers","maxwells"]},"magneticFluxDensity":{"units":["teslas","gauss","gammas"]},"mass":{"units":["kilograms","tonnes","poundsMass","grams","milligrams","nanograms","grains","usTonnesMass","slugs","ouncesMass"]},"massPerArea":{"units":["kilogramsPerSquareMeter","poundsMassPerSquareFoot"]},"massPerLength":{"units":["kilogramsPerMeter","poundsMassPerFoot"]},"massPerTime":{"units":["poundsMassPerHour","poundsMassPerMinute","poundsMassPerSecond","kilogramsPerHour","kilogramsPerMinute","kilogramsPerSecond"]},"number":{"units":["general","fixed","percentage"]},"permeability":{"units":["nanogramsPerPascalSecondSquareMeter","grainsPerHourSquareFootInchMercury"]},"power":{"units":["watts","kilowatts","britishThermalUnitsPerSecond","britishThermalUnitsPerHour","caloriesPerSecond","kilocaloriesPerSecond","voltAmperes","kilovoltAmperes","horsepower","thousandBritishThermalUnitsPerHour","tonsOfRefrigeration"]},"powerDensity":{"units":["wattsPerCubicFoot","wattsPerCubicMeter","britishThermalUnitsPerHourCubicFoot"]},"powerPerArea":{"units":["wattsPerSquareFoot","wattsPerSquareMeter","britishThermalUnitsPerHourSquareFoot"]},"powerPerFlow":{"units":["wattsPerCubicFootPerMinute","wattsPerCubicMeterPerSecond"]},"powerPerLength":{"units":["wattsPerFoot","wattsPerMeter"]},"pressure":{"units":["pascals","kilopascals","megapascals","poundsForcePerSquareInch","inchesOfMercury32DegreesFahrenheit","millimetersOfMercury","atmospheres","bars","feetOfWater39.2DegreesFahrenheit","inchesOfWater60DegreesFahrenheit"]},"ratio":{"units":["fixed","percentage","perMille","ratioTo1","ratioTo10","ratioTo12","1ToRatio"]},"secondMomentOfArea":{"units":["feetToTheFourthPower","inchesToTheFourthPower","millimetersToTheFourthPower","centimetersToTheFourthPower","metersToTheFourthPower"]},"slope":{"units":["percentage","ratioTo1","ratioTo10","ratioTo12","riseDividedBy12Inches","riseDividedBy1Foot","riseDividedBy1000Millimeters","riseDividedBy120Inches","1ToRatio","riseDividedBy10Feet","perMille"]},"solidAngle":{"units":["steradians"]},"specificEnergy":{"units":["joulesPerGram","joulesPerKilogram","britishThermalUnitsPerPound"]},"specificHeatCapacity":{"units":["joulesPerGramDegreeCelsius","britishThermalUnitsPerPoundDegreeFahrenheit","joulesPerKilogramDegreeCelsius"]},"stress":{"units":["pascals","kilopascals","megapascals","poundsForcePerSquareInch","bars","newtonsPerSquareMeter","dekanewtonsPerSquareMeter","kilonewtonsPerSquareMeter","meganewtonsPerSquareMeter","kipsPerSquareFoot","kilogramsForcePerSquareMeter","tonnesForcePerSquareMeter","poundsForcePerSquareFoot","kipsPerSquareInch","kilonewtonsPerSquareCentimeter","newtonsPerSquareMillimeter","kilonewtonsPerSquareMillimeter"]},"temperature":{"units":["fahrenheit","celsius","kelvin","rankine"]},"temperatureInterval":{"units":["fahrenheitInterval","celsiusInterval","kelvinInterval","rankineInterval"]},"thermalConductivity":{"units":["wattsPerMeterKelvin","britishThermalUnitsPerHourFootDegreeFahrenheit"]},"thermalExpansionCoefficient":{"units":["inverseDegreesFahrenheit","inverseDegreesCelsius","micrometersPerMeterDegreeCelsius","microinchesPerInchDegreeFahrenheit"]},"thermalInsulance":{"units":["hourSquareFootDegreesFahrenheitPerBritishThermalUnit","squareMeterKelvinsPerWatt"]},"time":{"units":["milliseconds","seconds","minutes","hours"]},"torque":{"units":["newtonMeters","dekanewtonMeters","kilonewtonMeters","meganewtonMeters","kipFeet","kilogramForceMeters","tonneForceMeters","poundForceFeet"]},"torquePerLength":{"units":["newtonMetersPerMeter","dekanewtonMetersPerMeter","kilonewtonMetersPerMeter","meganewtonMetersPerMeter","kipFeetPerFoot","kilogramForceMetersPerMeter","tonneForceMetersPerMeter","poundForceFeetPerFoot"]},"velocity":{"units":["feetPerMinute","centimetersPerMinute","inchesPerSecond","metersPerSecond","feetPerSecond","kilometersPerSecond","milesPerSecond","kilometersPerHour","milesPerHour"]},"volume":{"units":["cubicYards","cubicFeet","cubicInches","cubicMeters","cubicCentimeters","cubicMillimeters","liters","usGallons"]},"volumePerForce":{"units":["cubicFeetPerKip","cubicMetersPerKilonewton"]},"warpingCoefficient":{"units":["feetToTheSixthPower","inchesToTheSixthPower","millimetersToTheSixthPower","centimetersToTheSixthPower","metersToTheSixthPower"]}}}')}},n={};function r(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={id:e,loaded:!1,exports:{}};return i[e].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(i,n){if(1&n&&(i=this(i)),8&n)return i;if("object"==typeof i&&i){if(4&n&&i.__esModule)return i;if(16&n&&"function"==typeof i.then)return i}var o=Object.create(null);r.r(o);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&n&&i;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>i[e]));return s.default=()=>i,r.d(o,s),o},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var o=r(72980);LMV=o})();
|
||
//# sourceMappingURL=viewer3D.min.js.map |