@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240709

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
  6. package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
  7. package/assets/esri/core/workers/chunks/3375de864347a847393d.js +1042 -0
  8. package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
  9. package/assets/esri/core/workers/chunks/{812e18c65aa6e398c338.js → 5b6c89dc41067d81c952.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
  11. package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
  12. package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
  18. package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
  19. package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
  20. package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
  22. package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
  23. package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
  24. package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
  25. package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
  26. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
  27. package/assets/esri/themes/dark/main.css +1 -1
  28. package/assets/esri/themes/light/main.css +1 -1
  29. package/assets/esri/themes/light/view.css +1 -1
  30. package/chunks/AtmosphereCompositing.glsl.js +6 -9
  31. package/chunks/BlendLayers.glsl.js +1 -7
  32. package/chunks/BlendWeights.glsl.js +45 -51
  33. package/chunks/Blur.glsl.js +1 -3
  34. package/chunks/ChapmanAtmosphere.glsl.js +3 -8
  35. package/chunks/CheckerBoard.glsl.js +3 -9
  36. package/chunks/Clouds.glsl.js +21 -10
  37. package/chunks/CloudsComposition.glsl.js +3 -7
  38. package/chunks/ColorMaterial.glsl.js +3 -9
  39. package/chunks/ComponentShader.glsl.js +35 -50
  40. package/chunks/Compositing.glsl.js +5 -7
  41. package/chunks/DefaultMaterial.glsl.js +68 -73
  42. package/chunks/EdgeDetect.glsl.js +5 -10
  43. package/chunks/EdgeShader.glsl.js +37 -60
  44. package/chunks/Fog.glsl.js +4 -9
  45. package/chunks/HUDCompositing.glsl.js +1 -3
  46. package/chunks/HUDMaterial.glsl.js +8 -14
  47. package/chunks/Heatmap.glsl.js +4 -7
  48. package/chunks/HeatmapDensity.glsl.js +5 -11
  49. package/chunks/HighlightApply.glsl.js +133 -152
  50. package/chunks/HighlightDownsample.glsl.js +29 -32
  51. package/chunks/ImageMaterial.glsl.js +11 -21
  52. package/chunks/LaserlinePath.glsl.js +4 -9
  53. package/chunks/LineCallout.glsl.js +91 -108
  54. package/chunks/LineMarker.glsl.js +2 -8
  55. package/chunks/Magnifier.glsl.js +4 -9
  56. package/chunks/MeasurementArrow.glsl.js +9 -15
  57. package/chunks/NativeLine.glsl.js +8 -12
  58. package/chunks/NoiseTextureAtlas.glsl.js +89 -86
  59. package/chunks/OITCompositing.glsl.js +2 -3
  60. package/chunks/OverlayCompositing.glsl.js +2 -4
  61. package/chunks/Path.glsl.js +31 -55
  62. package/chunks/Pattern.glsl.js +16 -20
  63. package/chunks/PointRenderer.glsl.js +39 -48
  64. package/chunks/Precipitation.glsl.js +15 -27
  65. package/chunks/RasterColorizer.glsl.js +25 -33
  66. package/chunks/RealisticTree.glsl.js +53 -65
  67. package/chunks/SSAO.glsl.js +7 -10
  68. package/chunks/SSAOBlur.glsl.js +10 -14
  69. package/chunks/ShadedColorMaterial.glsl.js +12 -15
  70. package/chunks/ShadowCastAccumulate.glsl.js +2 -4
  71. package/chunks/ShadowCastVisualize.glsl.js +12 -19
  72. package/chunks/ShadowHighlight.glsl.js +46 -50
  73. package/chunks/SimpleAtmosphere.glsl.js +4 -13
  74. package/chunks/SlicePlaneMaterial.glsl.js +3 -7
  75. package/chunks/Stars.glsl.js +3 -7
  76. package/chunks/Terrain.glsl.js +20 -61
  77. package/chunks/TextureOnly.glsl.js +2 -4
  78. package/chunks/Viewshed.glsl.js +20 -38
  79. package/chunks/WaterSurface.glsl.js +34 -60
  80. package/core/workers/registry.js +1 -1
  81. package/interfaces.d.ts +34 -4
  82. package/layers/WCSLayer.js +1 -1
  83. package/layers/support/SubtypeSublayer.js +1 -1
  84. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  85. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  86. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  87. package/package.json +3 -3
  88. package/support/revision.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
  90. package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
  91. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  93. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  94. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  95. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  96. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  97. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  98. package/views/3d/layers/StreamLayerView3D.js +1 -1
  99. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  100. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  101. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
  102. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
  103. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
  104. package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
  105. package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
  106. package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
  107. package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
  108. package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
  109. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  110. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  111. package/views/3d/layers/support/projectExtentUtils.js +1 -1
  112. package/views/3d/terrain/OverlayRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainRenderer.js +1 -1
  114. package/views/3d/terrain/TileCompositor.js +1 -1
  115. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  116. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
  117. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
  118. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
  119. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
  120. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
  122. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +2 -2
  123. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
  124. package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
  125. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  126. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  127. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  128. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  129. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  130. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  131. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  132. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  133. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  134. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  135. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  136. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  137. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  138. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  139. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  140. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  141. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  142. package/views/SceneView.js +1 -1
  143. package/views/webgl/RenderingContext.js +1 -1
  144. package/views/webgl/enums.js +1 -1
  145. package/views/webgl/heatmapTextureUtils.js +1 -1
  146. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  147. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  148. package/widgets/FeatureForm.js +1 -1
  149. package/widgets/OrientedImageryViewer/constants.js +1 -1
  150. package/widgets/OrientedImageryViewer.js +1 -1
  151. package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
  152. package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
  153. package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
  154. package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
  155. package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
  156. package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
  157. package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
  158. package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
  159. package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.js +0 -1
@@ -0,0 +1,1042 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5268],{28491:(e,t,r)=>{r.d(t,{D:()=>G,b:()=>V});var n=r(46686),o=r(32680),i=r(49255),a=r(76591),s=r(76597),l=r(82991),c=r(96336),d=r(10764),u=r(39014),h=r(53466),m=r(92700),f=r(72824),p=r(54154),v=r(9169),g=r(77695),_=r(3452),x=r(8881),T=r(98619),b=r(51343),y=r(62602),A=r(22393),E=r(59469),S=r(25618),M=r(51406),w=r(986),C=r(35093),O=r(11955),R=r(27950),I=r(20693),N=r(33079),P=r(71988),L=r(20304),H=r(2597),D=r(85977),B=r(63761),F=r(46540),z=r(60517);function V(e){const t=new D.N5,{vertex:r,fragment:V,varyings:G}=t;if((0,I.NB)(r,e),t.include(d.I),G.add("vpos","vec3"),t.include(w.A,e),t.include(l.BK,e),t.include(p.G,e),t.include(M.q2,e),e.output!==i.V.Color)return t.include(v.E,e),t;t.include(M.Sx,e),t.include(M.MU,e),t.include(M.O1,e),t.include(M.QM,e),(0,I.yu)(r,e),t.include(c.Y,e),t.include(s.d,e);const U=e.normalType===c.W.Attribute||e.normalType===c.W.Compressed;return U&&e.offsetBackfaces&&t.include(o.M),t.include(g.W,e),t.include(f.Mh,e),e.instancedColor&&t.attributes.add(F.r.INSTANCECOLOR,"vec4"),G.add("vPositionLocal","vec3"),t.include(h.U,e),t.include(n.oD,e),t.include(u.K,e),t.include(m.c,e),r.uniforms.add(new P.E("externalColor",(e=>e.externalColor))),G.add("vcolorExt","vec4"),e.multipassEnabled&&G.add("depth","float"),r.main.add(H.H`
2
+ forwardNormalizedVertexColor();
3
+ vcolorExt = externalColor;
4
+ ${e.instancedColor?"vcolorExt *= instanceColor * 0.003921568627451;":""}
5
+ vcolorExt *= vvColor();
6
+ vcolorExt *= getSymbolColor();
7
+ forwardColorMixMode();
8
+
9
+ if (vcolorExt.a < ${H.H.float(C.Q)}) {
10
+ gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
11
+ } else {
12
+ vpos = getVertexInLocalOriginSpace();
13
+ vPositionLocal = vpos - view[3].xyz;
14
+ vpos = subtractOrigin(vpos);
15
+ ${U?H.H`vNormalWorld = dpNormal(vvLocalNormal(normalModel()));`:""}
16
+ vpos = addVerticalOffset(vpos, localOrigin);
17
+ ${e.hasVertexTangents?"vTangent = dpTransformVertexTangent(tangent);":""}
18
+ gl_Position = transformPosition(proj, view, vpos);
19
+ ${U&&e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
20
+ }
21
+
22
+ ${e.multipassEnabled?"depth = (view * vec4(vpos, 1.0)).z;":""}
23
+ forwardLinearDepth();
24
+ forwardTextureCoordinates();
25
+ forwardColorUV();
26
+ forwardNormalUV();
27
+ forwardEmissiveUV();
28
+ forwardOcclusionUV();
29
+ forwardMetallicRoughnessUV();`),t.include(x.kA,e),t.include(_.n,e),t.include(O.S,e),t.include(e.instancedDoublePrecision?S.G:S.Bz,e),t.include(b.Q,e),t.include(a.HQ,e),t.include(z.z,e),(0,I.yu)(V,e),V.uniforms.add(r.uniforms.get("localOrigin"),new N.t("ambient",(e=>e.ambient)),new N.t("diffuse",(e=>e.diffuse)),new L.m("opacity",(e=>e.opacity)),new L.m("layerOpacity",(e=>e.layerOpacity))),e.hasColorTexture&&V.uniforms.add(new B.N("tex",(e=>e.texture))),t.include(E._Z,e),t.include(A.c,e),V.include(R.N),t.include(y.r,e),(0,x.a8)(V),(0,x.eU)(V),(0,T.O4)(V),V.main.add(H.H`
30
+ discardBySlice(vpos);
31
+ ${e.multipassEnabled?"terrainDepthTest(depth);":""}
32
+ ${e.hasColorTexture?H.H`
33
+ vec4 texColor = texture(tex, ${e.hasColorTextureTransform?H.H`colorUV`:H.H`vuv0`});
34
+ ${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
35
+ discardOrAdjustAlpha(texColor);`:H.H`vec4 texColor = vec4(1.0);`}
36
+ shadingParams.viewDirection = normalize(vpos - cameraPosition);
37
+ ${e.normalType===c.W.ScreenDerivative?H.H`
38
+ vec3 normal = screenDerivativeNormal(vPositionLocal);`:H.H`
39
+ shadingParams.normalView = vNormalWorld;
40
+ vec3 normal = shadingNormal(shadingParams);`}
41
+ ${e.pbrMode===E.A9.Normal?"applyPBRFactors();":""}
42
+ float ssao = evaluateAmbientOcclusionInverse() * getBakedOcclusion();
43
+
44
+ vec3 posWorld = vpos + localOrigin;
45
+
46
+ float additionalAmbientScale = additionalDirectedAmbientLight(posWorld);
47
+ float shadow = ${e.receiveShadows?"readShadowMap(vpos, linearDepth)":e.spherical?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
48
+
49
+ vec3 matColor = max(ambient, diffuse);
50
+ ${e.hasVertexColors?H.H`
51
+ vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
52
+ float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:H.H`
53
+ vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
54
+ float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
55
+ ${e.hasNormalTexture?H.H`
56
+ mat3 tangentSpace = ${e.hasVertexTangents?"computeTangentSpace(normal);":"computeTangentSpace(normal, vpos, vuv0);"}
57
+ vec3 shadingNormal = computeTextureNormal(tangentSpace, ${e.hasNormalTextureTransform?H.H`normalUV`:"vuv0"});`:H.H`vec3 shadingNormal = normal;`}
58
+ vec3 normalGround = ${e.spherical?H.H`normalize(posWorld);`:H.H`vec3(0.0, 0.0, 1.0);`}
59
+
60
+ ${e.snowCover?H.H`
61
+ float snow = smoothstep(0.5, 0.55, dot(normal, normalGround));
62
+ albedo = mix(albedo, vec3(1), snow);
63
+ shadingNormal = mix(shadingNormal, normal, snow);
64
+ ssao = mix(ssao, 1.0, snow);`:""}
65
+
66
+ vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
67
+
68
+ ${e.pbrMode===E.A9.Normal||e.pbrMode===E.A9.Schematic?H.H`
69
+ float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
70
+ ${e.snowCover?H.H`
71
+ mrr = mix(mrr, vec3(0.0, 1.0, 0.04), snow);
72
+ emission = mix(emission, vec3(0.0), snow);`:""}
73
+
74
+ vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:H.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
75
+ vec4 finalColor = vec4(shadedColor, opacity_);
76
+ outputColorHighlightOID(finalColor, vpos);
77
+ `),t}const G=Object.freeze(Object.defineProperty({__proto__:null,build:V},Symbol.toStringTag,{value:"Module"}))},57323:(e,t,r)=>{r.d(t,{R:()=>B,b:()=>D});var n=r(46686),o=r(32680),i=r(49255),a=r(76591),s=r(76597),l=r(82991),c=r(96336),d=r(10764),u=r(39014),h=r(53466),m=r(92700),f=r(54154),p=r(9169),v=r(3452),g=r(8881),_=r(98619),x=r(51343),T=r(22393),b=r(59469),y=r(25618),A=r(986),E=r(35093),S=r(11955),M=r(27950),w=r(20693),C=r(33079),O=r(71988),R=r(20304),I=r(2597),N=r(85977),P=r(63761),L=r(46540),H=r(60517);function D(e){const t=new N.N5,{vertex:r,fragment:D,varyings:B}=t;return(0,w.NB)(r,e),t.include(d.I),B.add("vpos","vec3"),t.include(A.A,e),t.include(l.BK,e),t.include(f.G,e),e.output===i.V.Color&&((0,w.yu)(t.vertex,e),t.include(c.Y,e),t.include(s.d,e),e.offsetBackfaces&&t.include(o.M),e.instancedColor&&t.attributes.add(L.r.INSTANCECOLOR,"vec4"),B.add("vNormalWorld","vec3"),B.add("localvpos","vec3"),e.multipassEnabled&&B.add("depth","float"),t.include(h.U,e),t.include(n.oD,e),t.include(u.K,e),t.include(m.c,e),r.uniforms.add(new O.E("externalColor",(e=>e.externalColor))),B.add("vcolorExt","vec4"),r.main.add(I.H`
78
+ forwardNormalizedVertexColor();
79
+ vcolorExt = externalColor;
80
+ ${e.instancedColor?"vcolorExt *= instanceColor * 0.003921568627451;":""}
81
+ vcolorExt *= vvColor();
82
+ vcolorExt *= getSymbolColor();
83
+ forwardColorMixMode();
84
+
85
+ if (vcolorExt.a < ${I.H.float(E.Q)}) {
86
+ gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
87
+ } else {
88
+ vpos = getVertexInLocalOriginSpace();
89
+ localvpos = vpos - view[3].xyz;
90
+ vpos = subtractOrigin(vpos);
91
+ vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
92
+ vpos = addVerticalOffset(vpos, localOrigin);
93
+ gl_Position = transformPosition(proj, view, vpos);
94
+ ${e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
95
+ }
96
+ ${e.multipassEnabled?I.H`depth = (view * vec4(vpos, 1.0)).z;`:""}
97
+ forwardLinearDepth();
98
+ forwardTextureCoordinates();`)),e.output===i.V.Color&&(t.include(g.kA,e),t.include(v.n,e),t.include(S.S,e),t.include(e.instancedDoublePrecision?y.G:y.Bz,e),t.include(x.Q,e),t.include(a.HQ,e),t.include(H.z,e),(0,w.yu)(t.fragment,e),(0,_.Gc)(D),(0,g.a8)(D),(0,g.eU)(D),D.uniforms.add(r.uniforms.get("localOrigin"),r.uniforms.get("view"),new C.t("ambient",(e=>e.ambient)),new C.t("diffuse",(e=>e.diffuse)),new R.m("opacity",(e=>e.opacity)),new R.m("layerOpacity",(e=>e.layerOpacity))),e.hasColorTexture&&D.uniforms.add(new P.N("tex",(e=>e.texture))),t.include(b._Z,e),t.include(T.c,e),D.include(M.N),(0,_.O4)(D),D.main.add(I.H`
99
+ discardBySlice(vpos);
100
+ ${e.multipassEnabled?I.H`terrainDepthTest(depth);`:""}
101
+ ${e.hasColorTexture?I.H`
102
+ vec4 texColor = texture(tex, ${e.hasColorTextureTransform?"colorUV":"vuv0"});
103
+ ${e.textureAlphaPremultiplied?I.H`texColor.rgb /= texColor.a;`:""}
104
+ discardOrAdjustAlpha(texColor);`:I.H`vec4 texColor = vec4(1.0);`}
105
+ vec3 viewDirection = normalize(vpos - cameraPosition);
106
+ ${e.pbrMode===b.A9.Normal?I.H`applyPBRFactors();`:""}
107
+ float ssao = evaluateAmbientOcclusionInverse();
108
+ ssao *= getBakedOcclusion();
109
+
110
+ float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
111
+ vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
112
+ ${e.receiveShadows?I.H`float shadow = readShadowMap(vpos, linearDepth);`:e.spherical?I.H`float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);`:I.H`float shadow = 0.0;`}
113
+ vec3 matColor = max(ambient, diffuse);
114
+ ${e.hasVertexColors?I.H`vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
115
+ float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:I.H`vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
116
+ float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
117
+ ${e.snowCover?I.H`albedo = mix(albedo, vec3(1), 0.9);`:""}
118
+ ${I.H`vec3 shadingNormal = normalize(vNormalWorld);
119
+ albedo *= 1.2;
120
+ vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
121
+ float alignmentLightView = clamp(dot(viewForward, -mainLightDirection), 0.0, 1.0);
122
+ float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
123
+ float treeRadialFalloff = vColor.r;
124
+ float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
125
+ additionalLight += backLightFactor * mainLightIntensity;`}
126
+ ${e.pbrMode===b.A9.Normal||e.pbrMode===b.A9.Schematic?e.spherical?I.H`vec3 normalGround = normalize(vpos + localOrigin);`:I.H`vec3 normalGround = vec3(0.0, 0.0, 1.0);`:""}
127
+ ${e.pbrMode===b.A9.Normal||e.pbrMode===b.A9.Schematic?I.H`float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
128
+ ${e.snowCover?I.H`mrr = vec3(0.0, 1.0, 0.04);
129
+ emission = vec3(0.0);`:""}
130
+ vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:I.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
131
+ vec4 finalColor = vec4(shadedColor, opacity_);
132
+ outputColorHighlightOID(finalColor, vpos);`)),t.include(p.E,e),t}const B=Object.freeze(Object.defineProperty({__proto__:null,build:D},Symbol.toStringTag,{value:"Module"}))},15581:(e,t,r)=>{r.d(t,{S:()=>g,b:()=>f,g:()=>p});var n=r(37585),o=r(48163),i=r(82048),a=r(52540),s=r(34845),l=r(47286),c=r(20304),d=r(2597),u=r(85977),h=r(63761);const m=16;function f(){const e=new u.N5,t=e.fragment;return e.include(i.c),e.include(s.Ir),t.include(a.E),t.uniforms.add(new c.m("radius",((e,t)=>p(t.camera)))).code.add(d.H`vec3 sphere[16] = vec3[16](
133
+ vec3(0.186937, 0.0, 0.0),
134
+ vec3(0.700542, 0.0, 0.0),
135
+ vec3(-0.864858, -0.481795, -0.111713),
136
+ vec3(-0.624773, 0.102853, -0.730153),
137
+ vec3(-0.387172, 0.260319, 0.007229),
138
+ vec3(-0.222367, -0.642631, -0.707697),
139
+ vec3(-0.01336, -0.014956, 0.169662),
140
+ vec3(0.122575, 0.1544, -0.456944),
141
+ vec3(-0.177141, 0.85997, -0.42346),
142
+ vec3(-0.131631, 0.814545, 0.524355),
143
+ vec3(-0.779469, 0.007991, 0.624833),
144
+ vec3(0.308092, 0.209288,0.35969),
145
+ vec3(0.359331, -0.184533, -0.377458),
146
+ vec3(0.192633, -0.482999, -0.065284),
147
+ vec3(0.233538, 0.293706, -0.055139),
148
+ vec3(0.417709, -0.386701, 0.442449)
149
+ );
150
+ float fallOffFunction(float vv, float vn, float bias) {
151
+ float f = max(radius * radius - vv, 0.0);
152
+ return f * f * f * max(vn - bias, 0.0);
153
+ }`),t.code.add(d.H`float aoValueFromPositionsAndNormal(vec3 C, vec3 n_C, vec3 Q) {
154
+ vec3 v = Q - C;
155
+ float vv = dot(v, v);
156
+ float vn = dot(normalize(v), n_C);
157
+ return fallOffFunction(vv, vn, 0.1);
158
+ }`),t.uniforms.add(new h.N("normalMap",(e=>e.normalTexture)),new h.N("depthMap",(e=>e.depthTexture)),new c.m("projScale",(e=>e.projScale)),new h.N("rnm",(e=>e.noiseTexture)),new l.G("rnmScale",((e,t)=>(0,n.hZ)(v,t.camera.fullWidth/e.noiseTexture.descriptor.width,t.camera.fullHeight/e.noiseTexture.descriptor.height))),new c.m("intensity",(e=>e.intensity)),new l.G("screenSize",((e,t)=>(0,n.hZ)(v,t.camera.fullWidth,t.camera.fullHeight)))),e.outputs.add("fragOcclusion","float"),t.main.add(d.H`
159
+ float depth = depthFromTexture(depthMap, uv);
160
+
161
+ // Early out if depth is out of range, such as in the sky
162
+ if (depth >= 1.0 || depth <= 0.0) {
163
+ fragOcclusion = 1.0;
164
+ return;
165
+ }
166
+
167
+ // get the normal of current fragment
168
+ vec4 norm4 = texture(normalMap, uv);
169
+ if(norm4.a != 1.0) {
170
+ fragOcclusion = 1.0;
171
+ return;
172
+ }
173
+ vec3 norm = vec3(-1.0) + 2.0 * norm4.xyz;
174
+
175
+ float currentPixelDepth = linearizeDepth(depth);
176
+ vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy, currentPixelDepth);
177
+
178
+ float sum = 0.0;
179
+ vec3 tapPixelPos;
180
+
181
+ vec3 fres = normalize(2.0 * texture(rnm, uv * rnmScale).xyz - 1.0);
182
+
183
+ // note: the factor 2.0 should not be necessary, but makes ssao much nicer.
184
+ // bug or deviation from CE somewhere else?
185
+ float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y);
186
+
187
+ for(int i = 0; i < ${d.H.int(m)}; ++i) {
188
+ vec2 unitOffset = reflect(sphere[i], fres).xy;
189
+ vec2 offset = vec2(-unitOffset * radius * ps);
190
+
191
+ // don't use current or very nearby samples
192
+ if( abs(offset.x) < 2.0 || abs(offset.y) < 2.0){
193
+ continue;
194
+ }
195
+
196
+ vec2 tc = vec2(gl_FragCoord.xy + offset);
197
+ if (tc.x < 0.0 || tc.y < 0.0 || tc.x > screenSize.x || tc.y > screenSize.y) continue;
198
+ vec2 tcTap = tc / screenSize;
199
+ float occluderFragmentDepth = linearDepthFromTexture(depthMap, tcTap);
200
+
201
+ tapPixelPos = reconstructPosition(tc, occluderFragmentDepth);
202
+
203
+ sum += aoValueFromPositionsAndNormal(currentPixelPos, norm, tapPixelPos);
204
+ }
205
+
206
+ // output the result
207
+ float A = max(1.0 - sum * intensity / float(${d.H.int(m)}), 0.0);
208
+
209
+ // Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4) / 2.2
210
+ A = (pow(A, 0.2) + 1.2 * A * A * A * A) / 2.2;
211
+
212
+ fragOcclusion = A;`),e}function p(e){return Math.max(10,20*e.computeScreenPixelSizeAtDist(Math.abs(4*e.relativeElevation)))}const v=(0,o.vt)(),g=Object.freeze(Object.defineProperty({__proto__:null,build:f,getRadius:p},Symbol.toStringTag,{value:"Module"}))},95774:(e,t,r)=>{r.d(t,{S:()=>f,b:()=>m});var n=r(38954),o=r(82048),i=r(52540),a=r(68259),s=r(20304),l=r(2597),c=r(85977),d=r(15976),u=r(63761);const h=4;function m(){const e=new c.N5,t=e.fragment;e.include(o.c);const r=(h+1)/2,m=1/(2*r*r);return t.include(i.E),t.uniforms.add(new u.N("depthMap",(e=>e.depthTexture)),new d.o("tex",(e=>e.colorTexture)),new a.t("blurSize",(e=>e.blurSize)),new s.m("projScale",((e,t)=>{const r=(0,n.p)(t.camera.eye,t.camera.center);return r>5e4?Math.max(0,e.projScale-(r-5e4)):e.projScale}))),t.code.add(l.H`
213
+ void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
214
+ float c = texture(tex, uv).r;
215
+ float d = linearDepthFromTexture(depthMap, uv);
216
+
217
+ float ddiff = d - center_d;
218
+
219
+ float w = exp(-r * r * ${l.H.float(m)} - ddiff * ddiff * sharpness);
220
+ wTotal += w;
221
+ bTotal += w * c;
222
+ }
223
+ `),e.outputs.add("fragBlur","float"),t.main.add(l.H`
224
+ float b = 0.0;
225
+ float w_total = 0.0;
226
+
227
+ float center_d = linearDepthFromTexture(depthMap, uv);
228
+
229
+ float sharpness = -0.05 * projScale / center_d;
230
+ for (int r = -${l.H.int(h)}; r <= ${l.H.int(h)}; ++r) {
231
+ float rf = float(r);
232
+ vec2 uvOffset = uv + rf * blurSize;
233
+ blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
234
+ }
235
+ fragBlur = b / w_total;`),e}const f=Object.freeze(Object.defineProperty({__proto__:null,build:m},Symbol.toStringTag,{value:"Module"}))},76412:(e,t,r)=>{r.d(t,{c:()=>p,d:()=>_,f:()=>b,g:()=>T,h:()=>x,k:()=>M,o:()=>P}),r(44208),r(53966);var n=r(34727),o=r(58083),i=r(38954),a=r(51850),s=r(87317),l=r(91829),c=r(34304),d=r(88582),u=r(71351),h=r(44280),m=r(32114);const f=p();function p(){return(0,l.vt)()}const v=s.e,g=s.e;function _(e,t){return(0,s.c)(t,e)}function x(e){return e[3]}function T(e){return e}function b(e,t,r,n){return(0,l.fA)(e,t,r,n)}function y(e,t,r){if(null==t)return!1;if(!E(e,t,A))return!1;let{t0:n,t1:o}=A;if((n<0||o<n&&o>0)&&(n=o),n<0)return!1;if(r){const{origin:e,direction:o}=t;r[0]=e[0]+o[0]*n,r[1]=e[1]+o[1]*n,r[2]=e[2]+o[2]*n}return!0}const A={t0:0,t1:0};function E(e,t,r){const{origin:n,direction:o}=t,i=S;i[0]=n[0]-e[0],i[1]=n[1]-e[1],i[2]=n[2]-e[2];const a=o[0]*o[0]+o[1]*o[1]+o[2]*o[2];if(0===a)return!1;const s=2*(o[0]*i[0]+o[1]*i[1]+o[2]*i[2]),l=s*s-4*a*(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]-e[3]*e[3]);if(l<0)return!1;const c=Math.sqrt(l);return r.t0=(-s-c)/(2*a),r.t1=(-s+c)/(2*a),!0}const S=(0,a.vt)();function M(e,t){return y(e,t,null)}function w(e,t,r){const n=m.rq.get(),a=m.Rc.get();(0,i.b)(n,t.origin,t.direction);const s=x(e);(0,i.b)(r,n,t.origin),(0,i.j)(r,r,1/(0,i.l)(r)*s);const l=O(e,t.origin),c=(0,h.g7)(t.origin,r);return(0,o.$0)(a,c+l,n),(0,i.h)(r,r,a),r}function C(e,t,r){const n=(0,i.f)(m.rq.get(),t,e),o=(0,i.j)(m.rq.get(),n,e[3]/(0,i.l)(n));return(0,i.g)(r,o,e)}function O(e,t){const r=(0,i.f)(m.rq.get(),t,e),o=(0,i.l)(r),a=x(e),s=a+Math.abs(a-o);return(0,n.XM)(a/s)}const R=(0,a.vt)();function I(e,t,r,o){const a=(0,i.f)(R,t,e);switch(r){case d._.X:{const e=(0,n.jU)(a,R)[2];return(0,i.s)(o,-Math.sin(e),Math.cos(e),0)}case d._.Y:{const e=(0,n.jU)(a,R),t=e[1],r=e[2],s=Math.sin(t);return(0,i.s)(o,-s*Math.cos(r),-s*Math.sin(r),Math.cos(t))}case d._.Z:return(0,i.n)(o,a);default:return}}function N(e,t){const r=(0,i.f)(L,t,e);return(0,i.l)(r)-e[3]}function P(e,t){const r=(0,i.a)(e,t),n=x(e);return r<=n*n}const L=(0,a.vt)(),H=p();Object.freeze(Object.defineProperty({__proto__:null,NullSphere:f,altitudeAt:N,angleToSilhouette:O,axisAt:I,cameraFrustumCoverage:function(e,t,r,n){const o=x(e),i=o*o,a=t+.5*Math.PI,s=r*r+i-2*Math.cos(a)*r*o,l=Math.sqrt(s),c=s-i;if(c<=0)return.5;const d=Math.sqrt(c),u=Math.acos(d/l)-Math.asin(o/(l/Math.sin(a)));return Math.min(1,(u+.5*n)/n)},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},closestPoint:function(e,t,r){return y(e,t,r)?r:((0,u.oC)(t,e,r),C(e,r,r))},closestPointOnSilhouette:w,containsPoint:P,copy:_,create:p,distanceToSilhouette:function(e,t){const r=(0,i.f)(m.rq.get(),t,e),n=(0,i.q)(r),o=e[3]*e[3];return Math.sqrt(Math.abs(n-o))},elevate:function(e,t,r){return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=e[3]+t,r},equals:g,exactEquals:v,fromCenterAndRadius:function(e,t){return(0,l.fA)(e[0],e[1],e[2],t)},fromRadius:function(e,t){return e[0]=e[1]=e[2]=0,e[3]=t,e},fromValues:b,getCenter:T,getExtent:function(e,t){return t},getRadius:x,intersectLine:function(e,t,r){const n=(0,u.Cr)(t,r);if(!E(e,n,A))return[];const{origin:o,direction:s}=n,{t0:l,t1:d}=A,h=t=>{const r=(0,a.vt)();return(0,i.r)(r,o,s,t),C(e,r,r)};return Math.abs(l-d)<(0,c.FD)()?[h(l)]:[h(l),h(d)]},intersectRay:y,intersectRayClosestSilhouette:function(e,t,r){if(y(e,t,r))return r;const n=w(e,t,m.rq.get());return(0,i.g)(r,t.origin,(0,i.j)(m.rq.get(),t.direction,(0,i.p)(t.origin,n)/(0,i.l)(t.direction))),r},intersectsRay:M,projectPoint:C,setAltitudeAt:function(e,t,r,n){const o=N(e,t),a=I(e,t,d._.Z,L),s=(0,i.j)(L,a,r-o);return(0,i.g)(n,t,s)},setExtent:function(e,t,r){return e!==r&&_(e,r),r},tmpSphere:H,union:function(e,t,r=(0,l.vt)()){const n=(0,i.p)(e,t),o=e[3],a=t[3];return n+a<o?((0,s.c)(r,e),r):n+o<a?((0,s.c)(r,t),r):((0,i.o)(r,e,t,(n+a-o)/(2*n)),r[3]=(n+o+a)/2,r)},wrap:function(e){return e}},Symbol.toStringTag,{value:"Module"}))},43609:(e,t,r)=>{r.d(t,{a:()=>i,f:()=>a,n:()=>o});var n=r(34275);function o(e,t){i(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function i(e,t,r=2,o=r){const i=t.length/2;let a=0,s=0;if((0,n.cy)(t)||(0,n.dk)(t)){for(let n=0;n<i;++n)e[a]=t[s],e[a+1]=t[s+1],a+=r,s+=o;return}const l=(0,n.a3)(t);if((0,n.JI)(t))for(let n=0;n<i;++n)e[a]=Math.max(t[s]/l,-1),e[a+1]=Math.max(t[s+1]/l,-1),a+=r,s+=o;else for(let n=0;n<i;++n)e[a]=t[s]/l,e[a+1]=t[s+1]/l,a+=r,s+=o}function a(e,t,r,n){const o=e.typedBuffer,i=e.typedBufferStride,a=n?.count??e.count;let s=(n?.dstIndex??0)*i;for(let e=0;e<a;++e)o[s]=t,o[s+1]=r,s+=i}Object.freeze(Object.defineProperty({__proto__:null,fill:a,normalizeIntegerBuffer:i,normalizeIntegerBufferView:o},Symbol.toStringTag,{value:"Module"}))},73354:(e,t,r)=>{function n(e,t,r){o(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r,n=3,o=n){if(e.length/n!==Math.ceil(t.length/o))return e;const i=e.length/n,a=r[0],s=r[1],l=r[2],c=r[4],d=r[5],u=r[6],h=r[8],m=r[9],f=r[10],p=r[12],v=r[13],g=r[14];let _=0,x=0;for(let r=0;r<i;r++){const r=t[_],i=t[_+1],T=t[_+2];e[x]=a*r+c*i+h*T+p,e[x+1]=s*r+d*i+m*T+v,e[x+2]=l*r+u*i+f*T+g,_+=o,x+=n}return e}function i(e,t,r){a(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function a(e,t,r,n=3,o=n){if(e.length/n!==Math.ceil(t.length/o))return;const i=e.length/n,a=r[0],s=r[1],l=r[2],c=r[3],d=r[4],u=r[5],h=r[6],m=r[7],f=r[8];let p=0,v=0;for(let r=0;r<i;r++){const r=t[p],i=t[p+1],g=t[p+2];e[v]=a*r+c*i+h*g,e[v+1]=s*r+d*i+m*g,e[v+2]=l*r+u*i+f*g,p+=o,v+=n}}function s(e,t,r){l(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function l(e,t,r,n=3,o=n){const i=Math.min(e.length/n,t.length/o);let a=0,s=0;for(let l=0;l<i;l++)e[s]=r*t[a],e[s+1]=r*t[a+1],e[s+2]=r*t[a+2],a+=o,s+=n;return e}function c(e,t,r,n=3,o=n){const i=e.length/n;if(i!==Math.ceil(t.length/o))return e;let a=0,s=0;for(let l=0;l<i;l++)e[s]=t[a]+r[0],e[s+1]=t[a+1]+r[1],e[s+2]=t[a+2]+r[2],a+=o,s+=n;return e}function d(e,t){u(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function u(e,t,r=3,n=r){const o=Math.min(e.length/r,t.length/n);let i=0,a=0;for(let s=0;s<o;s++){const o=t[i],s=t[i+1],l=t[i+2],c=o*o+s*s+l*l;if(c>0){const t=1/Math.sqrt(c);e[a]=t*o,e[a+1]=t*s,e[a+2]=t*l}i+=n,a+=r}}r.d(t,{a:()=>o,b:()=>c,c:()=>i,d:()=>n,e:()=>d,f:()=>l,n:()=>u,s:()=>s,t:()=>a}),r(44208),r(53966),Object.freeze(Object.defineProperty({__proto__:null,normalize:u,normalizeView:d,scale:l,scaleView:s,shiftRight:function(e,t,r){const n=Math.min(e.count,t.count),o=e.typedBuffer,i=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;let l=0,c=0;for(let e=0;e<n;e++)o[c]=a[l]>>r,o[c+1]=a[l+1]>>r,o[c+2]=a[l+2]>>r,l+=s,c+=i},transformMat3:a,transformMat3View:i,transformMat4:o,transformMat4View:n,translate:c},Symbol.toStringTag,{value:"Module"}))},51737:(e,t,r)=>{function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=3,n=r){const o=t.length/n;let i=0,a=0;for(let s=0;s<o;++s)e[i]=t[a],e[i+1]=t[a+1],e[i+2]=t[a+2],i+=r,a+=n}function i(e,t,r,n,o){const i=e.typedBuffer,a=e.typedBufferStride,s=o?.count??e.count;let l=(o?.dstIndex??0)*a;for(let e=0;e<s;++e)i[l]=t,i[l+1]=r,i[l+2]=n,l+=a}r.d(t,{a:()=>n,c:()=>o,f:()=>i}),Object.freeze(Object.defineProperty({__proto__:null,copy:o,copyView:n,fill:i},Symbol.toStringTag,{value:"Module"}))},65686:(e,t,r)=>{r.d(t,{a:()=>o,b:()=>l,n:()=>a,s:()=>s,t:()=>i}),r(44208);var n=r(53966);function o(e,t,r){i(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function i(e,t,r,n=4,o=n){if(e.length/n!=t.length/o)return;const i=e.length/n,a=r[0],s=r[1],l=r[2],c=r[3],d=r[4],u=r[5],h=r[6],m=r[7],f=r[8];let p=0,v=0;for(let r=0;r<i;r++){const r=t[p],i=t[p+1],g=t[p+2],_=t[p+3];e[v]=a*r+c*i+h*g,e[v+1]=s*r+d*i+m*g,e[v+2]=l*r+u*i+f*g,e[v+3]=_,p+=o,v+=n}}function a(e,t){const r=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,i=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*o,r=e*a,s=i[r],l=i[r+1],c=i[r+2],d=s*s+l*l+c*c;if(d>0){const e=1/Math.sqrt(d);n[t]=e*s,n[t+1]=e*l,n[t+2]=e*c}}}function s(e,t,r){l(e.typedBuffer,t,r,e.typedBufferStride)}function l(e,t,r,n=4){const o=Math.min(e.length/n,t.count),i=t.typedBuffer,a=t.typedBufferStride;let s=0,l=0;for(let t=0;t<o;t++)e[l]=r*i[s],e[l+1]=r*i[s+1],e[l+2]=r*i[s+2],e[l+3]=r*i[s+3],s+=a,l+=n}Object.freeze(Object.defineProperty({__proto__:null,normalize:a,scale:l,scaleView:s,transformMat3:i,transformMat3View:o,transformMat4:function(e,t,r,o=4,i=o){if(e.length/o!=t.length/i)return void n.A.getLogger("esri.views.3d.support.buffer.math").error("source and destination buffers need to have the same number of elements");const a=e.length/o,s=r[0],l=r[1],c=r[2],d=r[3],u=r[4],h=r[5],m=r[6],f=r[7],p=r[8],v=r[9],g=r[10],_=r[11],x=r[12],T=r[13],b=r[14],y=r[15];let A=0,E=0;for(let r=0;r<a;r++){const r=t[A],n=t[A+1],a=t[A+2],S=t[A+3];e[E]=s*r+u*n+p*a+x*S,e[E+1]=l*r+h*n+v*a+T*S,e[E+2]=c*r+m*n+g*a+b*S,e[E+3]=d*r+f*n+_*a+y*S,A+=i,E+=o}},transformMat4View:function(e,t,r){if(e.count!==t.count)return;const n=e.count,o=r[0],i=r[1],a=r[2],s=r[3],l=r[4],c=r[5],d=r[6],u=r[7],h=r[8],m=r[9],f=r[10],p=r[11],v=r[12],g=r[13],_=r[14],x=r[15],T=e.typedBuffer,b=e.typedBufferStride,y=t.typedBuffer,A=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*b,r=e*A,n=y[r],E=y[r+1],S=y[r+2],M=y[r+3];T[t]=o*n+l*E+h*S+v*M,T[t+1]=i*n+c*E+m*S+g*M,T[t+2]=a*n+d*E+f*S+_*M,T[t+3]=s*n+u*E+p*S+x*M}}},Symbol.toStringTag,{value:"Module"}))},78358:(e,t,r)=>{function n(e,t){o(e.typedBuffer,t,e.typedBufferStride)}function o(e,t,r=4){const n=t.typedBuffer,o=t.typedBufferStride,i=t.count;let a=0,s=0;for(let t=0;t<i;++t)e[a]=n[s],e[a+1]=n[s+1],e[a+2]=n[s+2],e[a+3]=n[s+3],a+=r,s+=o}function i(e,t,r,n,o,i){const a=e.typedBuffer,s=e.typedBufferStride,l=i?.count??e.count;let c=(i?.dstIndex??0)*s;for(let e=0;e<l;++e)a[c]=t,a[c+1]=r,a[c+2]=n,a[c+3]=o,c+=s}r.d(t,{a:()=>o,c:()=>n,f:()=>i}),Object.freeze(Object.defineProperty({__proto__:null,copy:o,copyView:n,fill:i},Symbol.toStringTag,{value:"Module"}))},4341:(e,t,r)=>{r.d(t,{I:()=>o});var n=r(26390);class o{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,n.d)((()=>this._reset())),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){const e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*i);this._items.length=Math.min(e,this._items.length),this._itemsPtr=0}_grow(){for(let e=0;e<Math.max(8,Math.min(this._items.length,i));e++)this._items.push(this._allocator())}}const i=1024},46140:(e,t,r)=>{r.d(t,{R:()=>o});var n=r(49186);let o=class e{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}since(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new n.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,r=""){const[o,i]=t.split("."),a=/^\s*\d+\s*$/;if(!o?.match||!a.test(o))throw new n.A((r&&r+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!i?.match||!a.test(i))throw new n.A((r&&r+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const s=parseInt(o,10),l=parseInt(i,10);return new e(s,l,r)}}},61473:(e,t,r)=>{function n(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.match(t)))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(i)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{EM:()=>o,b5:()=>n});const i=/^devext\.arcgis\.com$/,a=/^qaext\.arcgis\.com$/,s=/^[\w-]*\.mapsdevext\.arcgis\.com$/,l=/^[\w-]*\.mapsqa\.arcgis\.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local\.esri\.com$/,i,a,/^jsapps\.esri\.com$/,s,l]},11964:(e,t,r)=>{r.d(t,{Cr:()=>c,H6:()=>h,_I:()=>u,kb:()=>d,vt:()=>l});var n=r(34727),o=r(4341),i=r(38954),a=r(51850),s=r(32114);function l(e){return e?{origin:(0,a.o8)(e.origin),vector:(0,a.o8)(e.vector)}:{origin:(0,a.vt)(),vector:(0,a.vt)()}}function c(e,t,r=l()){return(0,i.c)(r.origin,e),(0,i.f)(r.vector,t,e),r}function d(e,t){const r=(0,i.f)(s.rq.get(),t,e.origin),o=(0,i.m)(e.vector,r),a=(0,i.m)(e.vector,e.vector),l=(0,n.qE)(o/a,0,1),c=(0,i.f)(s.rq.get(),(0,i.j)(s.rq.get(),e.vector,l),r);return(0,i.m)(c,c)}function u(e,t,r){return h(e,t,0,1,r)}function h(e,t,r,o,a){const{vector:l,origin:c}=e,d=(0,i.f)(s.rq.get(),t,c),u=(0,i.m)(l,d)/(0,i.q)(l);return(0,i.j)(a,l,(0,n.qE)(u,r,o)),(0,i.g)(a,a,e.origin)}(0,a.vt)(),(0,a.vt)(),new o.I((()=>l()))},71351:(e,t,r)=>{r.d(t,{Cr:()=>d,LV:()=>c,kb:()=>u,oC:()=>h,vt:()=>s}),r(4576);var n=r(4341),o=r(38954),i=r(51850),a=r(32114);function s(e){return e?l((0,i.o8)(e.origin),(0,i.o8)(e.direction)):l((0,i.vt)(),(0,i.vt)())}function l(e,t){return{origin:e,direction:t}}function c(e,t){const r=m.get();return r.origin=e,r.direction=t,r}function d(e,t,r=s()){return(0,o.c)(r.origin,e),(0,o.f)(r.direction,t,e),r}function u(e,t){const r=(0,o.b)(a.rq.get(),(0,o.n)(a.rq.get(),e.direction),(0,o.f)(a.rq.get(),t,e.origin));return(0,o.m)(r,r)}function h(e,t,r){const n=(0,o.m)(e.direction,(0,o.f)(r,t,e.origin));return(0,o.g)(r,e.origin,(0,o.j)(r,e.direction,n)),r}const m=new n.I((()=>s()));(0,i.vt)()},21015:(e,t,r)=>{r.d(t,{R:()=>l});var n=r(78888),o=r(60999),i=r(49186),a=r(74887),s=r(84952);class l{constructor(e){this._streamDataRequester=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,s.DB)(e)?((0,a.Te)(t),(0,s.lJ)(e)):this._load("binary",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,r){if(null==this._streamDataRequester)return(await(0,n.A)(t,{responseType:c[e]})).data;const s=await(0,o.Ke)(this._streamDataRequester.request(t,e,r));if(!0===s.ok)return s.value;throw(0,a.QP)(s.error),new i.A("",`Request for resource failed: ${s.error}`)}}const c={image:"image",binary:"array-buffer",json:"json","image+type":void 0}},84498:(e,t,r)=>{r.d(t,{x:()=>a});var n=r(34275),o=r(97146),i=r(63907);function a(e,t){switch(t){case i.WR.TRIANGLES:return"number"==typeof(r=e)?(0,o.tM)(r):(0,n.mg)(r)?new Uint16Array(r):r;case i.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const r=t-2,n=(0,o.my)(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;t+=1)t%2==0?(n[e++]=t,n[e++]=t+1,n[e++]=t+2):(n[e++]=t+1,n[e++]=t,n[e++]=t+2)}else{let t=0;for(let o=0;o<r;o+=1)o%2==0?(n[t++]=e[o],n[t++]=e[o+1],n[t++]=e[o+2]):(n[t++]=e[o+1],n[t++]=e[o],n[t++]=e[o+2])}return n}(e);case i.WR.TRIANGLE_FAN:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return new Uint16Array(0);const r=t-2,n=r<=65536?new Uint16Array(3*r):new Uint32Array(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;++t)n[e++]=0,n[e++]=t+1,n[e++]=t+2;return n}const o=e[0];let i=e[1],a=0;for(let t=0;t<r;++t){const r=e[t+2];n[a++]=o,n[a++]=i,n[a++]=r,i=r}return n}(e)}var r}},51530:(e,t,r)=>{r.d(t,{KB:()=>s,Xi:()=>i,pn:()=>l,x3:()=>a});var n=r(44208),o=r(89192);class i{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=o.JS.KTX2_ENCODING}}function a(e){return"encoded-mesh-texture"===e?.type}async function s(e){const t=new Blob([e]),r=await t.text();return JSON.parse(r)}async function l(e,t){if(t===o.JS.KTX2_ENCODING)return new i(e);const r=new Blob([e],{type:t}),a=URL.createObjectURL(r),s=new Image;if((0,n.A)("esri-iPhone"))return new Promise(((e,t)=>{const r=()=>{o(),e(s)},n=e=>{o(),t(e)},o=()=>{URL.revokeObjectURL(a),s.removeEventListener("load",r),s.removeEventListener("error",n)};s.addEventListener("load",r),s.addEventListener("error",n),s.src=a}));try{s.src=a,await s.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(a),s}},55268:(e,t,r)=>{r.d(t,{fetch:()=>Sr});var n=r(61473),o=r(34727),i=r(77690),a=r(29242),s=r(58083),l=r(9093),c=r(48163),d=r(38954),u=r(51850),h=r(70328),m=r(11868),f=r(13030),p=r(73354),v=r(65686),g=r(43609),_=r(51737),x=r(78358),T=r(21015),b=r(84498),y=r(51530),A=r(88340);function E(e){if(null==e)return null;const t=null!=e.offset?e.offset:A.uY,r=null!=e.rotation?e.rotation:0,n=null!=e.scale?e.scale:A.Un,o=(0,a.fA)(1,0,0,0,1,0,t[0],t[1],1),s=(0,a.fA)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),l=(0,a.fA)(n[0],0,0,0,n[1],0,0,0,1),c=(0,a.vt)();return(0,i.lw)(c,s,l),(0,i.lw)(c,o,c),c}class S{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class M{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new S,this.numberOfVertices=0}}var w=r(78888),C=r(60999),O=r(86805),R=r(49186),I=r(53966);class N{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get(e,t){return this._outer.get(e)?.get(t)}set(e,t,r){const n=this._outer.get(e);n?n.set(t,r):this._outer.set(e,new Map([[t,r]]))}delete(e,t){const r=this._outer.get(e);r&&(r.delete(t),0===r.size&&this._outer.delete(e))}forEach(e){this._outer.forEach(((t,r)=>e(t,r)))}forAll(e){for(const t of this._outer.values())for(const r of t.values())e(r)}}var P=r(74887),L=r(46140),H=r(97146);async function D(e,t){const{data:r}=await(0,w.A)(e,{responseType:"image",...t});return r}var B=r(46610),F=r(89192),z=r(34275);function V(e){if(e.length<z.y9)return Array.from(e);if((0,z.cy)(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return(0,z.jq)(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var G=r(3694),U=r(620);class W{constructor(e,t,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.position=r,this._children=void 0,(0,U.vA)(e.length>=1),(0,U.vA)(3===r.size||4===r.size);const{data:n,size:o,indices:i}=r;(0,U.vA)(i.length%this._numIndexPerPrimitive==0),(0,U.vA)(i.length>=e.length*this._numIndexPerPrimitive);const a=e.length;let s=o*i[this._numIndexPerPrimitive*e[0]];j.clear(),j.push(s);const l=(0,u.fA)(n[s],n[s+1],n[s+2]),c=(0,u.o8)(l);for(let t=0;t<a;++t){const r=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=o*i[r+e],j.push(s);let t=n[s];l[0]=Math.min(t,l[0]),c[0]=Math.max(t,c[0]),t=n[s+1],l[1]=Math.min(t,l[1]),c[1]=Math.max(t,c[1]),t=n[s+2],l[2]=Math.min(t,l[2]),c[2]=Math.max(t,c[2])}}this.bbMin=l,this.bbMax=c;const h=(0,d.o)((0,u.vt)(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(c[0]-l[0],c[1]-l[1]),c[2]-l[2]);let m=this.radius*this.radius;for(let e=0;e<j.length;++e){s=j.at(e);const t=n[s]-h[0],r=n[s+1]-h[1],o=n[s+2]-h[2],i=t*t+r*r+o*o;if(i<=m)continue;const a=Math.sqrt(i),l=.5*(a-this.radius);this.radius=this.radius+l,m=this.radius*this.radius;const c=l/a;h[0]+=t*c,h[1]+=r*c,h[2]+=o*c}this.center=h,j.clear()}getChildren(){if(this._children||(0,d.a)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,d.o)((0,u.vt)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),n=new Array(8);for(let e=0;e<8;++e)n[e]=0;const{data:o,size:i,indices:a}=this.position;for(let s=0;s<t;++s){let t=0;const l=this._numIndexPerPrimitive*this.primitiveIndices[s];let c=i*a[l],d=o[c],u=o[c+1],h=o[c+2];for(let e=1;e<this._numIndexPerPrimitive;++e){c=i*a[l+e];const t=o[c],r=o[c+1],n=o[c+2];t<d&&(d=t),r<u&&(u=r),n<h&&(h=n)}d<e[0]&&(t|=1),u<e[1]&&(t|=2),h<e[2]&&(t|=4),r[s]=t,++n[t]}let s=0;for(let e=0;e<8;++e)n[e]>0&&++s;if(s<2)return;const l=new Array(8);for(let e=0;e<8;++e)l[e]=n[e]>0?new Uint32Array(n[e]):void 0;for(let e=0;e<8;++e)n[e]=0;for(let e=0;e<t;++e){const t=r[e];l[t][n[t]++]=this.primitiveIndices[e]}this._children=new Array;for(let e=0;e<8;++e)void 0!==l[e]&&this._children.push(new W(l[e],this._numIndexPerPrimitive,this.position));return this._children}static prune(){j.prune()}}const j=new G.A({deallocator:null});var q=r(69720),k=r(96672),$=r(4341),Y=r(11964);function X(e,t,r){return(0,d.f)(Z,t,e),(0,d.f)(J,r,e),.5*(0,d.l)((0,d.b)(Z,Z,J))}r(32114),new $.I(Y.vt),new $.I((()=>{return e?{p0:(0,u.o8)(e.p0),p1:(0,u.o8)(e.p1),p2:(0,u.o8)(e.p2)}:{p0:(0,u.vt)(),p1:(0,u.vt)(),p2:(0,u.vt)()};var e}));const Z=(0,u.vt)(),J=(0,u.vt)(),K=(0,u.vt)(),Q=(0,u.vt)(),ee=(0,u.vt)(),te=(0,u.vt)();var re=r(24326);class ne{constructor(e){this.channel=e,this.id=(0,re.c)()}}var oe=r(46540);r(28449),(0,u.vt)(),new Float32Array(6);class ie extends q.J{constructor(e,t,r=null,n=k.X.Mesh,o=null,i=-1){super(),this.material=e,this.mapPositions=r,this.type=n,this.objectAndLayerIdColor=o,this.edgeIndicesLength=i,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[e,r]of t)this._attributes.set(e,{...r,indices:(0,H.Dg)(r.indices)}),e===oe.r.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(e).indices.length:this.edgeIndicesLength)}instantiate(e={}){const t=new ie(e.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((e,r)=>{e.exclusive=!1,t._attributes.set(r,e)})),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}get attributes(){return this._attributes}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:V(t.data)},this._attributes.set(e,t)),t}setAttributeData(e,t){const r=this._attributes.get(e);r&&this._attributes.set(e,{...r,exclusive:!0,data:t})}get indexCount(){const e=this._attributes.values().next().value.indices;return e?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return!!(this.type===k.X.Mesh?this._computeAttachmentOriginTriangles(e):this.type===k.X.Line?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(null!=this._transformation&&(0,d.h)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){return function(e,t){if(!e)return!1;const{size:r,data:n,indices:o}=e;(0,d.s)(t,0,0,0),(0,d.s)(te,0,0,0);let i=0,a=0;for(let e=0;e<o.length-2;e+=3){const s=o[e]*r,l=o[e+1]*r,c=o[e+2]*r;(0,d.s)(K,n[s],n[s+1],n[s+2]),(0,d.s)(Q,n[l],n[l+1],n[l+2]),(0,d.s)(ee,n[c],n[c+1],n[c+2]);const u=X(K,Q,ee);u?((0,d.g)(K,K,Q),(0,d.g)(K,K,ee),(0,d.j)(K,K,1/3*u),(0,d.g)(t,t,K),i+=u):((0,d.g)(te,te,K),(0,d.g)(te,te,Q),(0,d.g)(te,te,ee),a+=3)}return!(0===a&&0===i||(0!==i?((0,d.j)(t,t,1/i),0):0===a||((0,d.j)(t,te,1/a),0)))}(this.attributes.get(oe.r.POSITION),e)}_computeAttachmentOriginLines(e){const t=this.attributes.get(oe.r.POSITION);return function(e,t,r){if(!e)return!1;(0,d.s)(r,0,0,0),(0,d.s)(te,0,0,0);let n=0,o=0;const{size:i,data:a,indices:s}=e,l=s.length-1,c=l+(t?2:0);for(let e=0;e<c;e+=2){const t=e<l?e+1:0,c=s[e<l?e:l]*i,u=s[t]*i;K[0]=a[c],K[1]=a[c+1],K[2]=a[c+2],Q[0]=a[u],Q[1]=a[u+1],Q[2]=a[u+2],(0,d.j)(K,(0,d.g)(K,K,Q),.5);const h=(0,d.F)(K,Q);h>0?((0,d.g)(r,r,(0,d.j)(K,K,h)),n+=h):0===n&&((0,d.g)(te,te,K),o++)}return 0!==n?((0,d.j)(r,r,1/n),!0):0!==o&&((0,d.j)(r,te,1/o),!0)}(t,function(e,t){return!(!("isClosed"in e)||!e.isClosed)&&t.indices.length>2}(this.material.parameters,t),e)}_computeAttachmentOriginPoints(e){return function(e,t){if(!e)return!1;const{size:r,data:n,indices:o}=e;(0,d.s)(t,0,0,0);let i=-1,a=0;for(let e=0;e<o.length;e++){const s=o[e]*r;i!==s&&(t[0]+=n[s],t[1]+=n[s+1],t[2]+=n[s+2],a++),i=s}return a>1&&(0,d.j)(t,t,1/a),a>0}(this.attributes.get(oe.r.POSITION),e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.attributes.get(oe.r.POSITION);if(!e||0===e.indices.length)return null;const t=this.type===k.X.Mesh?3:1;(0,U.vA)(e.indices.length%t==0,"Indexing error: "+e.indices.length+" not divisible by "+t);const r=(0,H.tM)(e.indices.length/t);return new W(r,t,e)}get transformation(){return this._transformation??l.zK}set transformation(e){this._transformation=e&&e!==l.zK?(0,l.o8)(e):null}addHighlight(){const e=new ne(F.Mg.Highlight);return this.highlights=function(e,t){return null==e&&(e=[]),e.push(t),e}(this.highlights,e),e}removeHighlight(e){this.highlights=function(e,t){if(null==e)return null;const r=e.filter((e=>e!==t));return 0===r.length?null:r}(this.highlights,e)}}var ae=r(44208),se=r(65529),le=r(97768),ce=r(84952),de=r(56058),ue=r(2741);let he;var me,fe;(fe=me||(me={}))[fe.ETC1_RGB=0]="ETC1_RGB",fe[fe.ETC2_RGBA=1]="ETC2_RGBA",fe[fe.BC1_RGB=2]="BC1_RGB",fe[fe.BC3_RGBA=3]="BC3_RGBA",fe[fe.BC4_R=4]="BC4_R",fe[fe.BC5_RG=5]="BC5_RG",fe[fe.BC7_M6_RGB=6]="BC7_M6_RGB",fe[fe.BC7_M5_RGBA=7]="BC7_M5_RGBA",fe[fe.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",fe[fe.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",fe[fe.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",fe[fe.ATC_RGB=11]="ATC_RGB",fe[fe.ATC_RGBA=12]="ATC_RGBA",fe[fe.FXT1_RGB=17]="FXT1_RGB",fe[fe.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",fe[fe.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",fe[fe.ETC2_EAC_R11=20]="ETC2_EAC_R11",fe[fe.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",fe[fe.RGBA32=13]="RGBA32",fe[fe.RGB565=14]="RGB565",fe[fe.BGR565=15]="BGR565",fe[fe.RGBA4444=16]="RGBA4444";var pe=r(63907),ve=r(21231),ge=r(42293);let _e=null,xe=null;async function Te(){return null==xe&&(he??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,ue.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),xe=he,_e=await xe),xe}function be(e,t,r,n,o){const i=(0,ge.IB)(t?pe.CQ.COMPRESSED_RGBA8_ETC2_EAC:pe.CQ.COMPRESSED_RGB8_ETC2),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*n*i*a)}function ye(e){return e.getNumImages()>=1&&!e.isUASTC()}function Ae(e){return e.getFaces()>=1&&e.isETC1S()}function Ee(e,t,r,n,o,i,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?n?[me.ETC2_RGBA,pe.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[me.ETC1_RGB,pe.CQ.COMPRESSED_RGB8_ETC2]:c?n?[me.BC3_RGBA,pe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[me.BC1_RGB,pe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[me.RGBA32,pe.Ab.RGBA],h=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<h;e++)m.push(new Uint8Array(a(e,d))),s(e,d,m[e]);return t.internalFormat=u,t.hasMipmap=m.length>1,t.samplingMode=t.hasMipmap?pe.Cj.LINEAR_MIPMAP_LINEAR:pe.Cj.LINEAR,t.width=o,t.height=i,new ve.g(e,t,{type:"compressed",levels:m})}const Se=()=>I.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function Me(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const we=Me("DXT1"),Ce=Me("DXT3"),Oe=Me("DXT5");function Re(e,t,r){if(e instanceof ImageData)return Re(Ie(e),t,r);const n=document.createElement("canvas");return n.width=t,n.height=r,n.getContext("2d").drawImage(e,0,0,n.width,n.height),n}function Ie(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");if(null==r)throw new R.A("Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}var Ne,Pe,Le=r(67171);class He extends q.J{get parameters(){return this._parameters}constructor(e,t){super(),this._data=e,this.type=k.X.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new se.A,this._parameters={...Be,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){null!=e&&(e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,ce.w8)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,ce.DB)(e.src)||(0,ce.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new Le.R;return t.wrapMode=this._parameters.wrap??pe.pF.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?pe.Cj.LINEAR_MIPMAP_LINEAR:pe.Cj.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture}get memoryEstimate(){return this._glTexture?.usedMemory||function(e,t){if(null==e)return 0;if((0,z.mw)(e)||(0,z.mg)(e))return t.encoding===F.JS.KTX2_ENCODING?function(e,t){if(null==_e)return e.byteLength;const r=new _e.KTX2File(new Uint8Array(e)),n=Ae(r)?be(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),n}(e,!!t.mipmap):t.encoding===F.JS.BASIS_ENCODING?function(e,t){if(null==_e)return e.byteLength;const r=new _e.BasisFile(new Uint8Array(e)),n=ye(r)?be(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),n}(e,!!t.mipmap):e.byteLength;const{width:r,height:n}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?De(e):t;return(t.mipmap?4/3:1)*r*n*(t.components||4)||0}(this._data,this._parameters)}load(e){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const t=this._data;return null==t?(this._glTexture=new ve.g(e,this._createDescriptor(e),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):((0,z.mw)(t)||(0,z.mg)(t))&&this._parameters.encoding===F.JS.DDS_ENCODING?this._loadFromDDSData(e,t):((0,z.mw)(t)||(0,z.mg)(t))&&this._parameters.encoding===F.JS.KTX2_ENCODING?this._loadFromKTX2(e,t):((0,z.mw)(t)||(0,z.mg)(t))&&this._parameters.encoding===F.JS.BASIS_ENCODING?this._loadFromBasis(e,t):(0,z.mg)(t)?this._loadFromPixelData(e,t):(0,z.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<Ne.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const n=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return Se().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Se().error("Unsupported format, must contain a FourCC code"),null;const n=r[21];let o,i;switch(n){case we:o=8,i=pe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ce:o=16,i=pe.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Oe:o=16,i=pe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Se().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(n)),null}let a=1,s=r[4],l=r[3];(3&s||3&l)&&(Se().warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7]));let m=r[1]+4;const f=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*o,u=new Uint8Array(e,m,h),f.push(u),m+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:f},internalFormat:i,width:c,height:d}}(r,t.hasMipmap??!1);if(null==n)throw new Error("DDS texture data is null");const{textureData:o,internalFormat:i,width:a,height:s}=n;return t.samplingMode=o.levels.length>1?pe.Cj.LINEAR_MIPMAP_LINEAR:pe.Cj.LINEAR,t.hasMipmap=o.levels.length>1,t.internalFormat=i,t.width=a,t.height=s,new ve.g(e,t,o)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){null==_e&&(_e=await Te());const n=new _e.KTX2File(new Uint8Array(r));if(!Ae(n))return null;n.startTranscoding();const o=Ee(e,t,n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),((e,t)=>n.getImageTranscodedSizeInBytes(e,0,0,t)),((e,t,r)=>n.transcodeImage(r,e,0,0,t,0,-1,-1)));return n.close(),n.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>async function(e,t,r){null==_e&&(_e=await Te());const n=new _e.BasisFile(new Uint8Array(r));if(!ye(n))return null;n.startTranscoding();const o=Ee(e,t,n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),((e,t)=>n.getImageTranscodedSizeInBytes(0,e,t)),((e,t,r)=>n.transcodeImage(r,0,e,t,0,0)));return n.close(),n.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){(0,U.vA)(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?pe.Ab.LUMINANCE:3===this._parameters.components?pe.Ab.RGB:pe.Ab.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new ve.g(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const n=await D(t,{signal:r});return(0,P.Te)(r),this._loadFromImage(e,n)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const n=await(0,de.Sx)(t,t.src,!1,r);return(0,P.Te)(r),this._loadFromImage(e,n)}))}_loadFromVideoElement(e,t){return t.readyState>=Ne.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync((r=>new Promise(((n,o)=>{const i=()=>{t.removeEventListener("loadeddata",a),t.removeEventListener("error",s),(0,le.xt)(l)},a=()=>{t.readyState>=Ne.HAVE_CURRENT_DATA&&(i(),n(this._loadFromImage(e,t)))},s=e=>{i(),o(e||new R.A("Failed to load video"))};t.addEventListener("loadeddata",a),t.addEventListener("error",s);const l=(0,P.u7)(r,(()=>s((0,P.NK)())))}))))}_loadFromImage(e,t){let r=t;if(!(r instanceof HTMLVideoElement)){const{maxTextureSize:t}=e.parameters;r=this._parameters.downsampleUncompressed?function(e,t){let r=e.width*e.height;if(r<4096)return e instanceof ImageData?Ie(e):e;let n=e.width,o=e.height;do{n=Math.ceil(n/2),o=Math.ceil(o/2),r=n*o}while(r>1048576||null!=t&&(n>t||o>t));return Re(e,n,o)}(r,t):function(e,t){const r=Math.max(e.width,e.height);if(r<=t)return e;const n=t/r;return Re(e,Math.round(e.width*n),Math.round(e.height*n))}(r,t)}const n=De(r);this._parameters.width=n.width,this._parameters.height=n.height;const o=this._createDescriptor(e);return o.pixelFormat=3===this._parameters.components?pe.Ab.RGB:pe.Ab.RGBA,o.width=n.width,o.height=n.height,this._glTexture=new ve.g(e,o,r),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const n=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(n,n),r}unload(){if(this._glTexture=(0,le.WD)(this._glTexture),null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}function De(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}(Pe=Ne||(Ne={}))[Pe.HAVE_NOTHING=0]="HAVE_NOTHING",Pe[Pe.HAVE_METADATA=1]="HAVE_METADATA",Pe[Pe.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",Pe[Pe.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",Pe[Pe.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";const Be={wrap:{s:pe.pF.REPEAT,t:pe.pF.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,downsampleUncompressed:!1};var Fe=r(24151),ze=r(1843),Ve=r(49255),Ge=r(96336),Ue=r(62602),We=r(59469),je=r(35093),qe=r(25634),ke=r(14903),$e=r(14327),Ye=r(90644);const Xe=(0,Ye.p3)(pe.dn.SRC_ALPHA,pe.dn.ONE,pe.dn.ONE_MINUS_SRC_ALPHA,pe.dn.ONE_MINUS_SRC_ALPHA),Ze=(0,Ye.p3)(pe.dn.ONE,pe.dn.ZERO,pe.dn.ONE,pe.dn.ONE_MINUS_SRC_ALPHA);function Je(e){switch(e){case $e.y.NONE:return Xe;case $e.y.ColorAlpha:return Ze;case $e.y.FrontFace:case $e.y.COUNT:return null}}const Ke={factor:-1,units:-2};function Qe(e,t=pe.MT.LESS){return e===$e.y.NONE||e===$e.y.FrontFace?t:pe.MT.LEQUAL}function et(e){return e===$e.y.ColorAlpha?{buffers:[pe.Nm.COLOR_ATTACHMENT0,pe.Nm.COLOR_ATTACHMENT1]}:null}class tt{constructor(e=!1,t=!0){this.isVerticalRay=e,this.normalRequired=t}}const rt=(0,h.vt)();function nt(e,t,r,n,o,i){if(!e.visible)return;const a=(0,d.z)(vt,n,r),s=(e,t,r)=>{i(e,r,t,!1)},l=new tt(!1,t.options.normalRequired);if(e.boundingInfo){(0,U.vA)(e.type===k.X.Mesh);const n=t.tolerance;it(e.boundingInfo,r,a,n,o,l,s)}else{const t=e.attributes.get(oe.r.POSITION),n=t.indices;!function(e,t,r,n,o,i,a,s,l,c){const u=t,h=gt,m=Math.abs(u[0]),f=Math.abs(u[1]),p=Math.abs(u[2]),v=m>=f?m>=p?0:2:f>=p?1:2,g=v,_=u[g]<0?2:1,x=(v+_)%3,T=(v+(3-_))%3,b=u[x]/u[g],y=u[T]/u[g],A=1/u[g],E=st,S=lt,M=ct,{normalRequired:w}=l;for(let t=r;t<n;++t){const r=3*t,n=a*o[r];(0,d.s)(h[0],i[n+0],i[n+1],i[n+2]);const l=a*o[r+1];(0,d.s)(h[1],i[l+0],i[l+1],i[l+2]);const u=a*o[r+2];(0,d.s)(h[2],i[u+0],i[u+1],i[u+2]),s&&((0,d.c)(h[0],s.applyToVertex(h[0][0],h[0][1],h[0][2],t)),(0,d.c)(h[1],s.applyToVertex(h[1][0],h[1][1],h[1][2],t)),(0,d.c)(h[2],s.applyToVertex(h[2][0],h[2][1],h[2][2],t))),(0,d.z)(E,h[0],e),(0,d.z)(S,h[1],e),(0,d.z)(M,h[2],e);const m=E[x]-b*E[g],f=E[T]-y*E[g],p=S[x]-b*S[g],v=S[T]-y*S[g],_=M[x]-b*M[g],C=M[T]-y*M[g],O=_*v-C*p,R=m*C-f*_,I=p*f-v*m;if((O<0||R<0||I<0)&&(O>0||R>0||I>0))continue;const N=O+R+I;if(0===N)continue;const P=O*(A*E[g])+R*(A*S[g])+I*(A*M[g]);if(P*Math.sign(N)<0)continue;const L=P/N;L>=0&&c(L,t,w?ut(h):null)}}(r,a,0,n.length/3,n,t.data,t.stride,o,l,s)}}const ot=(0,u.vt)();function it(e,t,r,n,o,i,a){if(null==e)return;const s=function(e,t){return(0,d.s)(t,1/e[0],1/e[1],1/e[2])}(r,ot);if((0,h.Ne)(rt,e.bbMin),(0,h.vI)(rt,e.bbMax),null!=o&&o.applyToAabb(rt),function(e,t,r,n){return function(e,t,r,n,o){const i=(e[0]-n-t[0])*r[0],a=(e[3]+n-t[0])*r[0];let s=Math.min(i,a),l=Math.max(i,a);const c=(e[1]-n-t[1])*r[1],d=(e[4]+n-t[1])*r[1];if(l=Math.min(l,Math.max(c,d)),l<0)return!1;if(s=Math.max(s,Math.min(c,d)),s>l)return!1;const u=(e[2]-n-t[2])*r[2],h=(e[5]+n-t[2])*r[2];return l=Math.min(l,Math.max(u,h)),!(l<0)&&(s=Math.max(s,Math.min(u,h)),!(s>l)&&s<1/0)}(e,t,r,n)}(rt,t,s,n)){const{primitiveIndices:s,position:l}=e,c=s?s.length:l.indices.length/3;if(c>ft){const s=e.getChildren();if(void 0!==s){for(const e of s)it(e,t,r,n,o,i,a);return}}!function(e,t,r,n,o,i,a,s,l,c,d){const u=e[0],h=e[1],m=e[2],f=t[0],p=t[1],v=t[2],{normalRequired:g}=c;for(let e=0;e<n;++e){const t=s[e],r=3*t,n=a*o[r];let c=i[n],_=i[n+1],x=i[n+2];const T=a*o[r+1];let b=i[T],y=i[T+1],A=i[T+2];const E=a*o[r+2];let S=i[E],M=i[E+1],w=i[E+2];null!=l&&([c,_,x]=l.applyToVertex(c,_,x,e),[b,y,A]=l.applyToVertex(b,y,A,e),[S,M,w]=l.applyToVertex(S,M,w,e));const C=b-c,O=y-_,R=A-x,I=S-c,N=M-_,P=w-x,L=p*P-N*v,H=v*I-P*f,D=f*N-I*p,B=C*L+O*H+R*D;if(Math.abs(B)<=pt)continue;const F=u-c,z=h-_,V=m-x,G=F*L+z*H+V*D;if(B>0){if(G<0||G>B)continue}else if(G>0||G<B)continue;const U=z*R-O*V,W=V*C-R*F,j=F*O-C*z,q=f*U+p*W+v*j;if(B>0){if(q<0||G+q>B)continue}else if(q>0||G+q<B)continue;const k=(I*U+N*W+P*j)/B;k>=0&&d(k,t,g?dt(C,O,R,I,N,P,at):null)}}(t,r,0,c,l.indices,l.data,l.stride,s,o,i,a)}}const at=(0,u.vt)();const st=(0,u.vt)(),lt=(0,u.vt)(),ct=(0,u.vt)();function dt(e,t,r,n,o,i,a){return(0,d.s)(ht,e,t,r),(0,d.s)(mt,n,o,i),(0,d.b)(a,ht,mt),(0,d.n)(a,a),a}function ut(e){return(0,d.z)(ht,e[1],e[0]),(0,d.z)(mt,e[2],e[0]),(0,d.b)(at,ht,mt),(0,d.n)(at,at),at}const ht=(0,u.vt)(),mt=(0,u.vt)(),ft=1e3,pt=1e-7,vt=(0,u.vt)(),gt=[(0,u.vt)(),(0,u.vt)(),(0,u.vt)()];var _t,xt;(xt=_t||(_t={}))[xt.INTEGRATED_MESH=0]="INTEGRATED_MESH",xt[xt.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",xt[xt.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",xt[xt.OPAQUE_NO_SSAO_DEPTH=3]="OPAQUE_NO_SSAO_DEPTH",xt[xt.TRANSPARENT_MATERIAL=4]="TRANSPARENT_MATERIAL",xt[xt.TRANSPARENT_NO_SSAO_DEPTH=5]="TRANSPARENT_NO_SSAO_DEPTH",xt[xt.TRANSPARENT_TERRAIN=6]="TRANSPARENT_TERRAIN",xt[xt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=7]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",xt[xt.OCCLUDED_TERRAIN=8]="OCCLUDED_TERRAIN",xt[xt.OCCLUDER_MATERIAL=9]="OCCLUDER_MATERIAL",xt[xt.TRANSPARENT_OCCLUDER_MATERIAL=10]="TRANSPARENT_OCCLUDER_MATERIAL",xt[xt.OCCLUSION_PIXELS=11]="OCCLUSION_PIXELS",xt[xt.OPAQUE_ENVIRONMENT=12]="OPAQUE_ENVIRONMENT",xt[xt.TRANSPARENT_ENVIRONMENT=13]="TRANSPARENT_ENVIRONMENT",xt[xt.HUD_MATERIAL=14]="HUD_MATERIAL",xt[xt.LABEL_MATERIAL=15]="LABEL_MATERIAL",xt[xt.LINE_CALLOUTS=16]="LINE_CALLOUTS",xt[xt.LINE_CALLOUTS_HUD_DEPTH=17]="LINE_CALLOUTS_HUD_DEPTH",xt[xt.DRAPED_MATERIAL=18]="DRAPED_MATERIAL",xt[xt.DRAPED_WATER=19]="DRAPED_WATER",xt[xt.VIEWSHED=20]="VIEWSHED",xt[xt.VOXEL=21]="VOXEL",xt[xt.MAX_SLOTS=22]="MAX_SLOTS";var Tt=r(76412),bt=r(57005);const yt=new class{constructor(e=0){this.offset=e,this.sphere=(0,Tt.c)(),this.tmpVertex=(0,u.vt)()}applyToVertex(e,t,r){const n=this.objectTransform.transform,o=(0,d.s)(At,e,t,r),i=(0,d.h)(o,o,n),a=this.offset/(0,d.l)(i);(0,d.r)(i,i,i,a);const s=this.objectTransform.inverse;return(0,d.h)(this.tmpVertex,i,s),this.tmpVertex}applyToMinMax(e,t){const r=this.offset/(0,d.l)(e);(0,d.r)(e,e,e,r);const n=this.offset/(0,d.l)(t);(0,d.r)(t,t,t,n)}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=(0,d.l)((0,Tt.g)(e)),r=this.offset/t;return(0,d.r)((0,Tt.g)(this.sphere),(0,Tt.g)(e),(0,Tt.g)(e),r),this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpVertex=(0,u.vt)(),this._tmpMbs=(0,Tt.c)(),this._tmpObb=new bt.ab,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=(0,d.l)(e)}applyToVertex(e,t,r){const n=(0,d.s)(At,e,t,r),o=(0,d.s)(Et,e,t,r+this.componentLocalOriginLength),i=this._totalOffset/(0,d.l)(o);return(0,d.r)(this._tmpVertex,n,o,i),this._tmpVertex}applyToAabb(e){const t=this.componentLocalOriginLength,r=e[0],n=e[1],o=e[2]+t,i=e[3],a=e[4],s=e[5]+t,l=Math.abs(r),c=Math.abs(n),d=Math.abs(o),u=Math.abs(i),h=Math.abs(a),m=Math.abs(s),f=.5*(1+Math.sign(r*i))*Math.min(l,u),p=.5*(1+Math.sign(n*a))*Math.min(c,h),v=.5*(1+Math.sign(o*s))*Math.min(d,m),g=Math.max(l,u),_=Math.max(c,h),x=Math.max(d,m),T=Math.sqrt(f*f+p*p+v*v),b=Math.sign(l+r),y=Math.sign(c+n),A=Math.sign(d+o),E=Math.sign(u+i),S=Math.sign(h+a),M=Math.sign(m+s),w=this._totalOffset;if(T<w)return e[0]-=(1-b)*w,e[1]-=(1-y)*w,e[2]-=(1-A)*w,e[3]+=E*w,e[4]+=S*w,e[5]+=M*w,e;const C=w/Math.sqrt(g*g+_*_+x*x),O=w/T,R=O-C,I=-R;return e[0]+=r*(b*I+O),e[1]+=n*(y*I+O),e[2]+=o*(A*I+O),e[3]+=i*(E*R+C),e[4]+=a*(S*R+C),e[5]+=s*(M*R+C),e}applyToMbs(e){const t=(0,d.l)((0,Tt.g)(e)),r=this._totalOffset/t;return(0,d.r)((0,Tt.g)(this._tmpMbs),(0,Tt.g)(e),(0,Tt.g)(e),r),this._tmpMbs[3]=e[3]+e[3]*this._totalOffset/t,this._tmpMbs}applyToObb(e){return(0,bt.gm)(e,this._totalOffset,this._totalOffset,Fe.RT.Global,this._tmpObb),this._tmpObb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,u.vt)()}applyToVertex(e,t,r){const n=(0,d.s)(At,e,t,r),o=(0,d.g)(Et,n,this.localOrigin),i=this.offset/(0,d.l)(o);return(0,d.r)(this.tmpVertex,n,o,i),this.tmpVertex}applyToAabb(e){const t=St,r=Mt,n=wt;for(let o=0;o<3;++o)t[o]=e[0+o]+this.localOrigin[o],r[o]=e[3+o]+this.localOrigin[o],n[o]=t[o];const o=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=o[t],e[t+3]=o[t];const i=t=>{const r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=Math.min(e[t],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let o=0;o<3;++o)n[o]=e&1<<o?r[o]:t[o];i(n)}let a=0;for(let e=0;e<3;++e)t[e]*r[e]<0&&(a|=1<<e);if(0!==a&&7!==a)for(let e=0;e<8;++e)if(!(a&e)){for(let o=0;o<3;++o)n[o]=a&1<<o?0:e&1<<o?t[o]:r[o];i(n)}for(let t=0;t<3;++t)e[t]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const At=(0,u.vt)(),Et=(0,u.vt)(),St=(0,u.vt)(),Mt=(0,u.vt)(),wt=(0,u.vt)();function Ct(e,t,r){const{data:n,indices:o}=e,i=t.typedBuffer,a=t.typedBufferStride,s=o.length;r*=a;for(let e=0;e<s;++e){const t=2*o[e];i[r]=n[t],i[r+1]=n[t+1],r+=a}}function Ot(e,t,r,n){const{data:o,indices:i}=e,a=t.typedBuffer,s=t.typedBufferStride,l=i.length;if(r*=s,null==n||1===n)for(let e=0;e<l;++e){const t=3*i[e];a[r]=o[t],a[r+1]=o[t+1],a[r+2]=o[t+2],r+=s}else for(let e=0;e<l;++e){const t=3*i[e];for(let e=0;e<n;++e)a[r]=o[t],a[r+1]=o[t+1],a[r+2]=o[t+2],r+=s}}function Rt(e,t,r,n=1){const{data:o,indices:i}=e,a=t.typedBuffer,s=t.typedBufferStride,l=i.length;if(r*=s,1===n)for(let e=0;e<l;++e){const t=4*i[e];a[r]=o[t],a[r+1]=o[t+1],a[r+2]=o[t+2],a[r+3]=o[t+3],r+=s}else for(let e=0;e<l;++e){const t=4*i[e];for(let e=0;e<n;++e)a[r]=o[t],a[r+1]=o[t+1],a[r+2]=o[t+2],a[r+3]=o[t+3],r+=s}}function It(e,t,r,n,o=1){const i=t.typedBuffer,a=t.typedBufferStride;if(n*=a,1===o)for(let t=0;t<r;++t)i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2],i[n+3]=e[3],n+=a;else for(let t=0;t<r;++t)for(let t=0;t<o;++t)i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2],i[n+3]=e[3],n+=a}function Nt(e,t,r,n,o,i){switch(e){case oe.r.POSITION:{(0,U.vA)(3===t.size);const n=o.getField(e,f.xs);(0,U.vA)(!!n,`No buffer view for ${e}`),n&&function(e,t,r,n,o=1){if(!t)return void Ot(e,r,n,o);const{data:i,indices:a}=e,l=r.typedBuffer,c=r.typedBufferStride,d=a.length,u=t[0],h=t[1],m=t[2],f=t[4],p=t[5],v=t[6],g=t[8],_=t[9],x=t[10],T=t[12],b=t[13],y=t[14];n*=c;let A=0,E=0,S=0;const M=(0,s.tZ)(t)?e=>{A=i[e]+T,E=i[e+1]+b,S=i[e+2]+y}:e=>{const t=i[e],r=i[e+1],n=i[e+2];A=u*t+f*r+g*n+T,E=h*t+p*r+_*n+b,S=m*t+v*r+x*n+y};if(1===o)for(let e=0;e<d;++e)M(3*a[e]),l[n]=A,l[n+1]=E,l[n+2]=S,n+=c;else for(let e=0;e<d;++e){M(3*a[e]);for(let e=0;e<o;++e)l[n]=A,l[n+1]=E,l[n+2]=S,n+=c}}(t,r,n,i);break}case oe.r.NORMAL:{(0,U.vA)(3===t.size);const r=o.getField(e,f.xs);(0,U.vA)(!!r,`No buffer view for ${e}`),r&&function(e,t,r,n,o=1){if(!t)return void Ot(e,r,n,o);const{data:i,indices:a}=e,l=t,c=r.typedBuffer,d=r.typedBufferStride,u=a.length,h=l[0],m=l[1],f=l[2],p=l[4],v=l[5],g=l[6],_=l[8],x=l[9],T=l[10],b=!(0,s.ut)(l),y=1e-6,A=1-y;n*=d;let E=0,S=0,M=0;const w=(0,s.tZ)(l)?e=>{E=i[e],S=i[e+1],M=i[e+2]}:e=>{const t=i[e],r=i[e+1],n=i[e+2];E=h*t+p*r+_*n,S=m*t+v*r+x*n,M=f*t+g*r+T*n};if(1===o)if(b)for(let e=0;e<u;++e){w(3*a[e]);const t=E*E+S*S+M*M;if(t<A&&t>y){const e=1/Math.sqrt(t);c[n]=E*e,c[n+1]=S*e,c[n+2]=M*e}else c[n]=E,c[n+1]=S,c[n+2]=M;n+=d}else for(let e=0;e<u;++e)w(3*a[e]),c[n]=E,c[n+1]=S,c[n+2]=M,n+=d;else for(let e=0;e<u;++e){if(w(3*a[e]),b){const e=E*E+S*S+M*M;if(e<A&&e>y){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}for(let e=0;e<o;++e)c[n]=E,c[n+1]=S,c[n+2]=M,n+=d}}(t,n,r,i);break}case oe.r.NORMALCOMPRESSED:{(0,U.vA)(2===t.size);const r=o.getField(e,f.mJ);(0,U.vA)(!!r,`No buffer view for ${e}`),r&&Ct(t,r,i);break}case oe.r.UV0:{(0,U.vA)(2===t.size);const r=o.getField(e,f.gH);(0,U.vA)(!!r,`No buffer view for ${e}`),r&&Ct(t,r,i);break}case oe.r.COLOR:case oe.r.SYMBOLCOLOR:{const r=o.getField(e,f.XP);(0,U.vA)(!!r,`No buffer view for ${e}`),(0,U.vA)(3===t.size||4===t.size),!r||3!==t.size&&4!==t.size||function(e,t,r,n,o=1){const{data:i,indices:a}=e,s=r.typedBuffer,l=r.typedBufferStride,c=a.length;if(n*=l,t!==i.length||4!==t)if(1!==o)if(4!==t)for(let e=0;e<c;++e){const t=3*a[e];for(let e=0;e<o;++e)s[n]=i[t],s[n+1]=i[t+1],s[n+2]=i[t+2],s[n+3]=255,n+=l}else for(let e=0;e<c;++e){const t=4*a[e];for(let e=0;e<o;++e)s[n]=i[t],s[n+1]=i[t+1],s[n+2]=i[t+2],s[n+3]=i[t+3],n+=l}else{if(4===t){for(let e=0;e<c;++e){const t=4*a[e];s[n]=i[t],s[n+1]=i[t+1],s[n+2]=i[t+2],s[n+3]=i[t+3],n+=l}return}for(let e=0;e<c;++e){const t=3*a[e];s[n]=i[t],s[n+1]=i[t+1],s[n+2]=i[t+2],s[n+3]=255,n+=l}}else{s[n]=i[0],s[n+1]=i[1],s[n+2]=i[2],s[n+3]=i[3];const e=new Uint32Array(r.typedBuffer.buffer,r.start),t=l/4,a=e[n/=4];n+=t;const d=c*o;for(let r=1;r<d;++r)e[n]=a,n+=t}}(t,t.size,r,i);break}case oe.r.COLORFEATUREATTRIBUTE:{const r=o.getField(e,f.Y$);(0,U.vA)(!!r,`No buffer view for ${e}`),(0,U.vA)(1===t.size),r&&1===t.size&&function(e,t,r){const{data:n,indices:o}=e,i=t.typedBuffer,a=t.typedBufferStride,s=o.length,l=n[0];r*=a;for(let e=0;e<s;++e)i[r]=l,r+=a}(t,r,i);break}case oe.r.TANGENT:{(0,U.vA)(4===t.size);const n=o.getField(e,f.Eq);(0,U.vA)(!!n,`No buffer view for ${e}`),n&&function(e,t,r,n,o=1){if(!t)return void Rt(e,r,n,o);const{data:i,indices:a}=e,l=t,c=r.typedBuffer,d=r.typedBufferStride,u=a.length,h=l[0],m=l[1],f=l[2],p=l[4],v=l[5],g=l[6],_=l[8],x=l[9],T=l[10],b=!(0,s.ut)(l),y=1e-6,A=1-y;if(n*=d,1===o)for(let e=0;e<u;++e){const t=4*a[e],r=i[t],o=i[t+1],s=i[t+2],l=i[t+3];let u=h*r+p*o+_*s,E=m*r+v*o+x*s,S=f*r+g*o+T*s;if(b){const e=u*u+E*E+S*S;if(e<A&&e>y){const t=1/Math.sqrt(e);u*=t,E*=t,S*=t}}c[n]=u,c[n+1]=E,c[n+2]=S,c[n+3]=l,n+=d}else for(let e=0;e<u;++e){const t=4*a[e],r=i[t],s=i[t+1],l=i[t+2],u=i[t+3];let E=h*r+p*s+_*l,S=m*r+v*s+x*l,M=f*r+g*s+T*l;if(b){const e=E*E+S*S+M*M;if(e<A&&e>y){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}for(let e=0;e<o;++e)c[n]=E,c[n+1]=S,c[n+2]=M,c[n+3]=u,n+=d}}(t,r,n,i);break}case oe.r.PROFILERIGHT:case oe.r.PROFILEUP:case oe.r.PROFILEVERTEXANDNORMAL:case oe.r.FEATUREVALUE:{(0,U.vA)(4===t.size);const r=o.getField(e,f.Eq);(0,U.vA)(!!r,`No buffer view for ${e}`),r&&Rt(t,r,i)}}}class Pt{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.attributes.get(oe.r.POSITION).indices.length}write(e,t,r,n,o){!function(e,t,r,n,o,i){for(const a of t.fields.keys()){const t=e.attributes.get(a),s=t?.indices;if(t&&s)Nt(a,t,r,n,o,i);else if(a===oe.r.OBJECTANDLAYERIDCOLOR&&null!=e.objectAndLayerIdColor){const t=e.attributes.get(oe.r.POSITION)?.indices;if(t){const r=t.length,n=o.getField(a,f.XP);It(e.objectAndLayerIdColor,n,r,i)}}}}(r,this.vertexBufferLayout,e,t,n,o)}}var Lt=r(13752),Ht=r(91829),Dt=r(53466),Bt=r(72824),Ft=r(97220),zt=r(84867),Vt=r(39341),Gt=r(34886);pe.MT.LESS,pe.MT.ALWAYS;const Ut={mask:255},Wt={function:{func:pe.MT.ALWAYS,ref:F.dd.OutlineVisualElementMask,mask:F.dd.OutlineVisualElementMask},operation:{fail:pe.eA.KEEP,zFail:pe.eA.KEEP,zPass:pe.eA.ZERO}},jt={function:{func:pe.MT.ALWAYS,ref:F.dd.OutlineVisualElementMask,mask:F.dd.OutlineVisualElementMask},operation:{fail:pe.eA.KEEP,zFail:pe.eA.KEEP,zPass:pe.eA.REPLACE}};pe.MT.EQUAL,F.dd.OutlineVisualElementMask,F.dd.OutlineVisualElementMask,pe.eA.KEEP,pe.eA.KEEP,pe.eA.KEEP,pe.MT.NOTEQUAL,F.dd.OutlineVisualElementMask,F.dd.OutlineVisualElementMask,pe.eA.KEEP,pe.eA.KEEP,pe.eA.KEEP;const qt=[1,1,.5],kt=[0,.6,.2],$t=[0,1,.2];var Yt=r(28491);class Xt extends Bt.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,u.ci)(qt),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=F.s2.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=(0,u.fA)(0,0,0),this.instancedDoublePrecision=!1,this.normalType=Ge.W.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,u.fA)(.2,.2,.2),this.diffuse=(0,u.fA)(.8,.8,.8),this.externalColor=(0,Ht.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,u.vt)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=F.it.Less,this.textureAlphaMode=F.sf.Blend,this.textureAlphaCutoff=je.Q,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=ke.m$.Occlude,this.isDecoration=!1}}Bt.gy;class Zt extends zt.w{initializeConfiguration(e,t){t.spherical=e.viewingMode===Fe.RT.Global,t.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?Dt.q.Default:Dt.q.None,t.objectAndLayerIdColorInstanced=t.instanced}initializeProgram(e){return this._initializeProgram(e,Zt.shader)}_initializeProgram(e,t){return new Gt.B(e.rctx,t.get().build(this.configuration),Vt.D)}_makePipeline(e,t){const r=this.configuration,n=e===$e.y.NONE,o=e===$e.y.FrontFace;return(0,Ye.Ey)({blending:r.output===Ve.V.Color&&r.transparent?Je(e):null,culling:Kt(r)?(0,Ye.Xt)(r.cullFace):null,depthTest:{func:Qe(e,Jt(r.customDepthTest))},depthWrite:(n||o)&&r.writeDepth?Ye.kn:null,drawBuffers:r.output===Ve.V.Depth?{buffers:[pe.Hr.NONE]}:et(e),colorWrite:Ye.wE,stencilWrite:r.hasOccludees?Ut:null,stencilTest:r.hasOccludees?t?jt:Wt:null,polygonOffset:n||o?null:(i=r.enableOffset,i?Ke:null)});var i}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function Jt(e){return e===F.it.Lequal?pe.MT.LEQUAL:pe.MT.LESS}function Kt(e){return e.cullFace!==F.s2.None||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}Zt.shader=new Ft.$(Yt.D,(()=>r.e(5141).then(r.bind(r,5141))));var Qt=r(90237),er=r(99769),tr=r(82991),rr=r(46263);class nr extends tr.nW{}(0,Qt._)([(0,er.W)({constValue:!0})],nr.prototype,"hasSliceHighlight",void 0),(0,Qt._)([(0,er.W)({constValue:!1})],nr.prototype,"hasSliceInVertexProgram",void 0),(0,Qt._)([(0,er.W)({constValue:rr.c.Pass})],nr.prototype,"pbrTextureBindType",void 0);class or extends nr{constructor(){super(...arguments),this.output=Ve.V.Color,this.alphaDiscardMode=F.sf.Opaque,this.doubleSidedMode=Ue.W.None,this.pbrMode=We.A9.Disabled,this.cullFace=F.s2.None,this.transparencyPassType=$e.y.NONE,this.normalType=Ge.W.Attribute,this.textureCoordinateType=Dt.q.None,this.customDepthTest=F.it.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}}(0,Qt._)([(0,er.W)({count:Ve.V.COUNT})],or.prototype,"output",void 0),(0,Qt._)([(0,er.W)({count:F.sf.COUNT})],or.prototype,"alphaDiscardMode",void 0),(0,Qt._)([(0,er.W)({count:Ue.W.COUNT})],or.prototype,"doubleSidedMode",void 0),(0,Qt._)([(0,er.W)({count:We.A9.COUNT})],or.prototype,"pbrMode",void 0),(0,Qt._)([(0,er.W)({count:F.s2.COUNT})],or.prototype,"cullFace",void 0),(0,Qt._)([(0,er.W)({count:$e.y.COUNT})],or.prototype,"transparencyPassType",void 0),(0,Qt._)([(0,er.W)({count:Ge.W.COUNT})],or.prototype,"normalType",void 0),(0,Qt._)([(0,er.W)({count:Dt.q.COUNT})],or.prototype,"textureCoordinateType",void 0),(0,Qt._)([(0,er.W)({count:F.it.COUNT})],or.prototype,"customDepthTest",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"spherical",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasVertexColors",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasSymbolColors",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasVerticalOffset",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasSlicePlane",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasSliceHighlight",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasColorTexture",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasMetallicRoughnessTexture",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasEmissionTexture",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasOcclusionTexture",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasNormalTexture",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasScreenSizePerspective",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasVertexTangents",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasOccludees",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"multipassEnabled",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasModelTransformation",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"offsetBackfaces",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"vvSize",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"vvColor",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"receiveShadows",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"receiveAmbientOcclusion",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"textureAlphaPremultiplied",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"instanced",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"instancedColor",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"objectAndLayerIdColorInstanced",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"instancedDoublePrecision",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"writeDepth",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"transparent",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"enableOffset",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"cullAboveGround",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"snowCover",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasColorTextureTransform",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasEmissionTextureTransform",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasNormalTextureTransform",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasOcclusionTextureTransform",void 0),(0,Qt._)([(0,er.W)()],or.prototype,"hasMetallicRoughnessTextureTransform",void 0),(0,Qt._)([(0,er.W)({constValue:!0})],or.prototype,"discardTransparentFragments",void 0),(0,Qt._)([(0,er.W)({constValue:!1})],or.prototype,"occlusionPass",void 0),(0,Qt._)([(0,er.W)({constValue:!0})],or.prototype,"hasVvInstancing",void 0),(0,Qt._)([(0,er.W)({constValue:!1})],or.prototype,"useCustomDTRExponentForWater",void 0),(0,Qt._)([(0,er.W)({constValue:!1})],or.prototype,"supportsTextureAtlas",void 0),(0,Qt._)([(0,er.W)({constValue:!0})],or.prototype,"useFillLights",void 0);var ir=r(57323);class ar extends Zt{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetallicRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=Ge.W.Attribute,t.doubleSidedMode=Ue.W.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,ar.shader)}}ar.shader=new Ft.$(ir.R,(()=>r.e(9933).then(r.bind(r,39933))));class sr extends ke.im{constructor(e){super(e,cr),this._configuration=new or,this.supportsEdges=!0,this.produces=new Map([[_t.OPAQUE_MATERIAL,e=>((0,Ve.XY)(e)||(0,Ve.PJ)(e))&&!this.parameters.transparent],[_t.TRANSPARENT_MATERIAL,e=>((0,Ve.XY)(e)||(0,Ve.PJ)(e))&&this.parameters.transparent&&this.parameters.writeDepth],[_t.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>((0,Ve.XY)(e)||(0,Ve.PJ)(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=function(e){const t=(0,ze.BP)().vec3f(oe.r.POSITION);return e.normalType===Ge.W.Compressed?t.vec2i16(oe.r.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(oe.r.NORMAL),e.hasVertexTangents&&t.vec4f(oe.r.TANGENT),(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(oe.r.UV0),e.hasVertexColors&&t.vec4u8(oe.r.COLOR),e.hasSymbolColors&&t.vec4u8(oe.r.SYMBOLCOLOR),(0,ae.A)("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(oe.r.OBJECTANDLAYERIDCOLOR),t}(this.parameters)}isVisibleForOutput(e){return e!==Ve.V.Shadow&&e!==Ve.V.ShadowExcludeHighlight&&e!==Ve.V.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(e.layerOpacity<je.Q)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:n,vvColor:o}=e,i=t||o||n,a="replace"===e.colorMixMode,s=e.opacity>=je.Q;if(r&&i)return a||s;const l=e.externalColor&&e.externalColor[3]>=je.Q;return r?a?l:s:i?a||s:a?l:s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?F.s2.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e===Ve.V.Color&&(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=Ue.W.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?Ue.W.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?Ue.W.WindingOrder:Ue.W.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?We.A9.Schematic:We.A9.Normal:We.A9.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<5e5,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,n,o,i){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,d.s)(pr,t[12],t[13],t[14]);let i=null;switch(r.viewingMode){case Fe.RT.Global:i=(0,d.n)(mr,pr);break;case Fe.RT.Local:i=(0,d.c)(mr,hr)}let a=0;const s=(0,d.f)(vr,pr,e.eye),l=(0,d.l)(s),c=(0,d.j)(s,s,1/l);let u=null;this.parameters.screenSizePerspective&&(u=(0,d.m)(i,c)),a+=(0,Lt.kE)(e,l,this.parameters.verticalOffset,u??0,this.parameters.screenSizePerspective),(0,d.j)(i,i,a),(0,d.t)(fr,i,r.transform.inverseRotation),n=(0,d.f)(dr,n,fr),o=(0,d.f)(ur,o,fr)}var a;nt(e,r,n,o,null!=(a=r.verticalOffset)?(yt.offset=a,yt):null,i)}createGLMaterial(e){return new lr(e)}createBufferWriter(){return new Pt(this._vertexBufferLayout)}}class lr extends qe.m{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===Ve.V.Color&&(this._updateShadowState(e),this._updateOccludeeState(e));const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,d.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?ar:Zt,e)}}class cr extends Xt{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const dr=(0,u.vt)(),ur=(0,u.vt)(),hr=(0,u.fA)(0,0,1),mr=(0,u.vt)(),fr=(0,u.vt)(),pr=(0,u.vt)(),vr=(0,u.vt)(),gr=()=>I.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function _r(e){throw new R.A("",`Request for object resource failed: ${e}`)}function xr(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(gr().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(gr().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(gr().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(gr().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else gr().warn("Indexed geometries must specify faces"),n=!1;break}default:gr().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(gr().warn("Geometry requires material"),n=!1);const o=e.params.vertexAttributes;for(const e in o)o[e].values||(gr().warn("Geometries with externally defined attributes are not yet supported"),n=!1);return n}function Tr(e){const t=(0,h.Ie)();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&((0,h.iT)(t,r.bbMin),(0,h.iT)(t,r.bbMax))})),t}function br(e){switch(e){case"mask":return F.sf.Mask;case"maskAndTransparency":return F.sf.MaskBlend;case"none":return F.sf.Opaque;default:return F.sf.Blend}}function yr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Ar=new L.R(1,2,"wosr");var Er=r(61765);async function Sr(e,t){const a=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,n.EM)(e));if("wosr"===a.fileType){const e=await(t.cache?t.cache.loadWOSR(a.url,t):async function(e,t){const r=await async function(e,t){const r=t?.streamDataRequester;if(r)return async function(e,t,r){const n=await(0,C.Ke)(t.request(e,"json",r));if(!0===n.ok)return n.value;(0,P.QP)(n.error),_r(n.error.details.url)}(e,r,t);const n=await(0,C.Ke)((0,w.A)(e,t));if(!0===n.ok)return n.value.data;(0,P.QP)(n.error),_r(n.error)}(e,t),n=await async function(e,t){const r=new Array;for(const n in e){const o=e[n],i=o.images[0].data;if(!i){gr().warn("Externally referenced texture data is not yet supported");continue}const a=o.encoding+";base64,"+i,s="/textureDefinitions/"+n,l="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:pe.pF.REPEAT,t:pe.pF.REPEAT},preMultiplyAlpha:br(l)!==F.sf.Opaque},d=t?.disableTextures?Promise.resolve(null):D(a,t);r.push(d.then((e=>({refId:s,image:e,parameters:c,alphaChannelUsage:l}))))}const n=await Promise.all(r),o={};for(const e of n)o[e.refId]=e;return o}(r.textureDefinitions??{},t);let o=0;for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];o+=t?.image?t.image.width*t.image.height*4:0}return{resource:r,textures:n,size:o+(0,O.iL)(r)}}(a.url,t)),{engineResources:r,referenceBoundingBox:n}=function(e,t){const r=new Array,n=new Array,o=new Array,i=new N,a=e.resource,s=L.R.parse(a.version||"1.0","wosr");Ar.validate(s);const l=a.model.name,c=a.model.geometries,d=a.materialDefinitions??{},h=e.textures;let m=0;const f=new Map;for(let e=0;e<c.length;e++){const a=c[e];if(!xr(a))continue;const s=yr(a),l=a.params.vertexAttributes,p=[],v=e=>{if("PerAttributeArray"===a.params.topology)return null;const t=a.params.faces;for(const r in t)if(r===e)return t[r].values;return null},g=l[oe.r.POSITION],_=g.values.length/g.valuesPerElement;for(const e in l){const t=l[e],r=t.values,n=v(e)??(0,H.tM)(_);p.push([e,new B.n(r,n,t.valuesPerElement,!0)])}const x=s.texture,T=h&&h[x];if(T&&!f.has(x)){const{image:e,parameters:t}=T,r=new He(e,t);n.push(r),f.set(x,r)}const b=f.get(x),y=b?b.id:void 0,A=s.material;let E=i.get(A,x);if(null==E){const e=d[A.substring(A.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=T&&T.alphaChannelUsage,n=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,o=T?br(T.alphaChannelUsage):void 0,a={ambient:(0,u.ci)(e.diffuse),diffuse:(0,u.ci)(e.diffuse),opacity:1-(e.transparency||0),transparent:n,textureAlphaMode:o,textureAlphaCutoff:.33,textureId:y,initTextureTransparent:!0,doubleSided:!0,cullFace:F.s2.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:T?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(a,t.materialParameters),E=new sr(a),i.set(A,x,E)}o.push(E);const S=new ie(E,p);m+=p.find((e=>e[0]===oe.r.POSITION))?.[1]?.indices.length??0,r.push(S)}return{engineResources:[{name:l,stageResources:{textures:n,materials:o,geometries:r},pivotOffset:a.model.pivotOffset,numberOfVertices:m,lodThreshold:null}],referenceBoundingBox:Tr(r)}}(e,t);return{lods:r,referenceBoundingBox:n,isEsriSymbolResource:!1,isWosr:!0}}let A;if(t.cache)A=await t.cache.loadGLTF(a.url,t,!!t.usePBR);else{const{loadGLTF:e}=await r.e(4399).then(r.bind(r,4399));A=await e(new T.R(t.streamDataRequester),a.url,t,t.usePBR)}const S=A.model.meta?.ESRI_proxyEllipsoid,R=A.meta.isEsriSymbolResource&&null!=S&&"EsriRealisticTreesStyle"===A.meta.ESRI_webstyle;R&&!A.customMeta.esriTreeRendering&&(A.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r){const n=e.model.lods[r];for(const o of n.parts){const n=o.attributes.normal;if(null==n)return;const i=o.attributes.position,a=i.count,c=(0,u.vt)(),h=(0,u.vt)(),m=(0,u.vt)(),p=new Uint8Array(4*a),v=new Float64Array(3*a),g=(0,s.B8)((0,l.vt)(),o.transform);let _=0,x=0;for(let s=0;s<a;s++){i.getVec(s,h),n.getVec(s,c),(0,d.h)(h,h,o.transform),(0,d.f)(m,h,t.center),(0,d.D)(m,m,t.radius);const a=m[2],l=(0,d.l)(m),u=Math.min(.45+.55*l*l,1);(0,d.D)(m,m,t.radius),null!==g&&(0,d.h)(m,m,g),(0,d.n)(m,m),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,d.o)(m,m,c,a>-1?.2:Math.min(-4*a-3.8,1)),v[_]=m[0],v[_+1]=m[1],v[_+2]=m[2],_+=3,p[x]=255*u,p[x+1]=255*u,p[x+2]=255*u,p[x+3]=255,x+=4}o.attributes.normal=new f.xs(v),o.attributes.color=new f.XP(p)}}}(A,S));const I=!!t.usePBR,z=A.meta.isEsriSymbolResource?{usePBR:I,isSchematic:!1,treeRendering:R,mrrFactors:[...$t]}:{usePBR:I,isSchematic:!1,treeRendering:!1,mrrFactors:[...qt]},V={...t.materialParameters,treeRendering:R},{engineResources:G,referenceBoundingBox:U}=function(e,t,r,n){const a=e.model,s=new Array,l=new Map,T=new Map,A=a.lods.length,S=(0,h.Ie)();return a.lods.forEach(((e,w)=>{const C=!0===n.skipHighLods&&(A>1&&0===w||A>3&&1===w)||!1===n.skipHighLods&&null!=n.singleLodIndex&&w!==n.singleLodIndex;if(C&&0!==w)return;const O=new M(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const n=C?new sr({}):function(e,t,r,n,o,i,a){const s=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),l=e.materials.get(t.material),h=null!=t.attributes.texCoord0,m=null!=t.attributes.normal;if(null==l)return null;const f=function(e){switch(e){case"BLEND":return F.sf.Blend;case"MASK":return F.sf.Mask;case"OPAQUE":case null:case void 0:return F.sf.Opaque}}(l.alphaMode);if(!i.has(s)){if(h){const t=(t,r=!1)=>{if(null!=t&&!a.has(t)){const n=e.textures.get(t);if(null!=n){const e=n.data;a.set(t,new He((0,y.x3)(e)?e.data:e,{...n.parameters,preMultiplyAlpha:!(0,y.x3)(e)&&r,encoding:(0,y.x3)(e)&&null!=e.encoding?e.encoding:void 0}))}}};t(l.textureColor,f!==F.sf.Opaque),t(l.textureNormal),t(l.textureOcclusion),t(l.textureEmissive),t(l.textureMetallicRoughness)}const r=l.color[0]**(1/Er.T),p=l.color[1]**(1/Er.T),v=l.color[2]**(1/Er.T),g=l.emissiveFactor[0]**(1/Er.T),_=l.emissiveFactor[1]**(1/Er.T),x=l.emissiveFactor[2]**(1/Er.T),T=null!=l.textureColor&&h?a.get(l.textureColor):null,b=function({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:n,emissiveTexture:o,emissiveFactor:i,occlusionTexture:a}){return null==e&&null==t&&null==o&&(null==i||(0,d.e)(i,u.uY))&&null==a&&(null==n||1===n)&&(null==r||1===r)}({normalTexture:l.textureNormal,metallicRoughnessTexture:l.textureMetallicRoughness,metallicFactor:l.metallicFactor,roughnessFactor:l.roughnessFactor,emissiveTexture:l.textureEmissive,emissiveFactor:l.emissiveFactor,occlusionTexture:l.textureOcclusion}),A=null!=l.normalTextureTransform?.scale?l.normalTextureTransform?.scale:c.Un;i.set(s,new sr({...n,transparent:f===F.sf.Blend,customDepthTest:F.it.Lequal,textureAlphaMode:f,textureAlphaCutoff:l.alphaCutoff,diffuse:[r,p,v],ambient:[r,p,v],opacity:l.opacity,doubleSided:l.doubleSided,doubleSidedType:"winding-order",cullFace:l.doubleSided?F.s2.None:F.s2.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:m?Ge.W.Attribute:Ge.W.ScreenDerivative,castShadows:!0,receiveShadows:l.receiveShadows,receiveAmbientOcclusion:l.receiveAmbientOcclustion,textureId:null!=T?T.id:void 0,colorMixMode:l.colorMixMode,normalTextureId:null!=l.textureNormal&&h?a.get(l.textureNormal).id:void 0,textureAlphaPremultiplied:null!=T&&!!T.parameters.preMultiplyAlpha,occlusionTextureId:null!=l.textureOcclusion&&h?a.get(l.textureOcclusion).id:void 0,emissiveTextureId:null!=l.textureEmissive&&h?a.get(l.textureEmissive).id:void 0,metallicRoughnessTextureId:null!=l.textureMetallicRoughness&&h?a.get(l.textureMetallicRoughness).id:void 0,emissiveFactor:[g,_,x],mrrFactors:b?[...kt]:[l.metallicFactor,l.roughnessFactor,n.mrrFactors[2]],isSchematic:b,colorTextureTransformMatrix:E(l.colorTextureTransform),normalTextureTransformMatrix:E(l.normalTextureTransform),scale:[A[0],A[1]],occlusionTextureTransformMatrix:E(l.occlusionTextureTransform),emissiveTextureTransformMatrix:E(l.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:E(l.metallicRoughnessTextureTransform),...o}))}const p=i.get(s);if(r.stageResources.materials.push(p),h){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(l.textureColor),e(l.textureNormal),e(l.textureOcclusion),e(l.textureEmissive),e(l.textureMetallicRoughness)}return p}(a,e,O,t,r,l,T),{geometry:s,vertexCount:A}=function(e,t){const r=e.attributes.position.count,n=(0,b.x)(e.indices||r,e.primitiveType),a=(0,m.oe)(3*r),{typedBuffer:s,typedBufferStride:l}=e.attributes.position;(0,p.a)(a,s,e.transform,3,l);const c=[[oe.r.POSITION,new B.n(a,n,3,!0)]];if(null!=e.attributes.normal){const t=(0,m.oe)(3*r),{typedBuffer:a,typedBufferStride:s}=e.attributes.normal;(0,i.Ge)(Mr,e.transform),(0,p.t)(t,a,Mr,3,s),(0,o.or)(Mr)&&(0,p.n)(t,t),c.push([oe.r.NORMAL,new B.n(t,n,3,!0)])}if(null!=e.attributes.tangent){const t=(0,m.oe)(4*r),{typedBuffer:a,typedBufferStride:s}=e.attributes.tangent;(0,i.z0)(Mr,e.transform),(0,v.t)(t,a,Mr,4,s),(0,o.or)(Mr)&&(0,p.n)(t,t,4),c.push([oe.r.TANGENT,new B.n(t,n,4,!0)])}if(null!=e.attributes.texCoord0){const t=(0,m.oe)(2*r),{typedBuffer:o,typedBufferStride:i}=e.attributes.texCoord0;(0,g.a)(t,o,2,i),c.push([oe.r.UV0,new B.n(t,n,2,!0)])}const d=e.attributes.color;if(null!=d){const t=new Uint8Array(4*r);4===d.elementCount?d instanceof f.Eq?(0,v.b)(t,d,255):d instanceof f.XP?(0,x.a)(t,d):d instanceof f.Uz&&(0,v.b)(t,d,1/256):(t.fill(255),d instanceof f.xs?(0,p.f)(t,d.typedBuffer,255,4,d.typedBufferStride):e.attributes.color instanceof f.eI?(0,_.c)(t,d.typedBuffer,4,e.attributes.color.typedBufferStride):e.attributes.color instanceof f.nS&&(0,p.f)(t,d.typedBuffer,1/256,4,d.typedBufferStride)),c.push([oe.r.COLOR,new B.n(t,n,4,!0)])}return{geometry:new ie(t,c),vertexCount:r}}(e,null!=n?n:new sr({})),M=s.boundingInfo;null!=M&&0===w&&((0,h.iT)(S,M.bbMin),(0,h.iT)(S,M.bbMax)),null!=n&&(O.stageResources.geometries.push(s),O.numberOfVertices+=A)})),C||s.push(O)})),{engineResources:s,referenceBoundingBox:S}}(A,z,V,t.skipHighLods&&null==a.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:a.specifiedLodIndex});return{lods:G,referenceBoundingBox:U,isEsriSymbolResource:A.meta.isEsriSymbolResource,isWosr:!1}}const Mr=(0,a.vt)()},66104:(e,t,r)=>{var n,o;r.d(t,{k5:()=>n}),r(34727),(o=n||(n={}))[o.Multiply=1]="Multiply",o[o.Ignore=2]="Ignore",o[o.Replace=3]="Replace",o[o.Tint=4]="Tint"},42583:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(66104),o=r(2597);function i(e){e.vertex.code.add(o.H`
236
+ vec4 decodeSymbolColor(vec4 symbolColor, out int colorMixMode) {
237
+ float symbolAlpha = 0.0;
238
+
239
+ const float maxTint = 85.0;
240
+ const float maxReplace = 170.0;
241
+ const float scaleAlpha = 3.0;
242
+
243
+ if (symbolColor.a > maxReplace) {
244
+ colorMixMode = ${o.H.int(n.k5.Multiply)};
245
+ symbolAlpha = scaleAlpha * (symbolColor.a - maxReplace);
246
+ } else if (symbolColor.a > maxTint) {
247
+ colorMixMode = ${o.H.int(n.k5.Replace)};
248
+ symbolAlpha = scaleAlpha * (symbolColor.a - maxTint);
249
+ } else if (symbolColor.a > 0.0) {
250
+ colorMixMode = ${o.H.int(n.k5.Tint)};
251
+ symbolAlpha = scaleAlpha * symbolColor.a;
252
+ } else {
253
+ colorMixMode = ${o.H.int(n.k5.Multiply)};
254
+ symbolAlpha = 0.0;
255
+ }
256
+
257
+ return vec4(symbolColor.r, symbolColor.g, symbolColor.b, symbolAlpha);
258
+ }
259
+ `)}},46686:(e,t,r)=>{r.d(t,{i$:()=>c,oD:()=>d,xJ:()=>l});var n=r(49255),o=r(33752),i=r(47286),a=r(2597);function s(e){e.varyings.add("linearDepth","float")}function l(e){e.vertex.uniforms.add(new i.G("nearFar",((e,t)=>t.camera.nearFar)))}function c(e){e.vertex.code.add(a.H`float calculateLinearDepth(vec2 nearFar,float z) {
260
+ return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
261
+ }`)}function d(e,t){const{vertex:r}=e;switch(t.output){case n.V.Color:if(t.receiveShadows)return s(e),void r.code.add(a.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`);break;case n.V.Shadow:case n.V.ShadowHighlight:case n.V.ShadowExcludeHighlight:case n.V.ViewshedShadow:return e.include(o.em,t),s(e),l(e),c(e),void r.code.add(a.H`void forwardLinearDepth() {
262
+ linearDepth = calculateLinearDepth(nearFar, vPosition_view.z);
263
+ }`)}r.code.add(a.H`void forwardLinearDepth() {}`)}},32680:(e,t,r)=>{r.d(t,{M:()=>o});var n=r(2597);function o(e){e.vertex.code.add(n.H`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
264
+ vec3 camToVert = posWorld - camPosWorld;
265
+ bool isBackface = dot(camToVert, normalWorld) > 0.0;
266
+ if (isBackface) {
267
+ posClip.z += 0.0000003 * posClip.w;
268
+ }
269
+ return posClip;
270
+ }`)}},82048:(e,t,r)=>{r.d(t,{c:()=>i});var n=r(2597),o=r(46540);function i(e,t=!0){e.attributes.add(o.r.POSITION,"vec2"),t&&e.varyings.add("uv","vec2"),e.vertex.main.add(n.H`
271
+ gl_Position = vec4(position, 0.0, 1.0);
272
+ ${t?n.H`uv = position * 0.5 + vec2(0.5);`:""}
273
+ `)}},49255:(e,t,r)=>{var n;function o(e){return e===n.Shadow||e===n.ShadowHighlight||e===n.ShadowExcludeHighlight||e===n.ViewshedShadow}function i(e){return function(e){return function(e){return s(e)||a(e)}(e)||l(e)}(e)||e===n.Normal}function a(e){return e===n.Highlight||e===n.ObjectAndLayerIdColor}function s(e){return e===n.Color}function l(e){return e===n.Depth}r.d(t,{PJ:()=>o,V:()=>n,XY:()=>i}),function(e){e[e.Color=0]="Color",e[e.Depth=1]="Depth",e[e.Normal=2]="Normal",e[e.Shadow=3]="Shadow",e[e.ShadowHighlight=4]="ShadowHighlight",e[e.ShadowExcludeHighlight=5]="ShadowExcludeHighlight",e[e.ViewshedShadow=6]="ViewshedShadow",e[e.Highlight=7]="Highlight",e[e.ObjectAndLayerIdColor=8]="ObjectAndLayerIdColor",e[e.COUNT=9]="COUNT"}(n||(n={}))},76591:(e,t,r)=>{r.d(t,{HQ:()=>c});var n=r(58083),o=r(9093),i=r(38954),a=r(51850),s=r(40710),l=(r(33079),r(2597));function c(e,t){!function(e,t,...r){if(!t.hasSlicePlane){const r=l.H`#define rejectBySlice(_pos_) false
274
+ #define discardBySlice(_pos_) {}
275
+ #define highlightSlice(_color_, _pos_) (_color_)`;return t.hasSliceInVertexProgram&&e.vertex.code.add(r),void e.fragment.code.add(r)}const n=l.H`struct SliceFactors {
276
+ float front;
277
+ float side0;
278
+ float side1;
279
+ float side2;
280
+ float side3;
281
+ };
282
+ SliceFactors calculateSliceFactors(vec3 pos) {
283
+ vec3 rel = pos - slicePlaneOrigin;
284
+ vec3 slicePlaneNormal = -cross(slicePlaneBasis1, slicePlaneBasis2);
285
+ float slicePlaneW = -dot(slicePlaneNormal, slicePlaneOrigin);
286
+ float basis1Len2 = dot(slicePlaneBasis1, slicePlaneBasis1);
287
+ float basis2Len2 = dot(slicePlaneBasis2, slicePlaneBasis2);
288
+ float basis1Dot = dot(slicePlaneBasis1, rel);
289
+ float basis2Dot = dot(slicePlaneBasis2, rel);
290
+ return SliceFactors(
291
+ dot(slicePlaneNormal, pos) + slicePlaneW,
292
+ -basis1Dot - basis1Len2,
293
+ basis1Dot - basis1Len2,
294
+ -basis2Dot - basis2Len2,
295
+ basis2Dot - basis2Len2
296
+ );
297
+ }
298
+ bool sliceByFactors(SliceFactors factors) {
299
+ return factors.front < 0.0
300
+ && factors.side0 < 0.0
301
+ && factors.side1 < 0.0
302
+ && factors.side2 < 0.0
303
+ && factors.side3 < 0.0;
304
+ }
305
+ bool sliceEnabled() {
306
+ return dot(slicePlaneBasis1, slicePlaneBasis1) != 0.0;
307
+ }
308
+ bool sliceByPlane(vec3 pos) {
309
+ return sliceEnabled() && sliceByFactors(calculateSliceFactors(pos));
310
+ }
311
+ #define rejectBySlice(_pos_) sliceByPlane(_pos_)
312
+ #define discardBySlice(_pos_) { if (sliceByPlane(_pos_)) discard; }`,o=l.H`vec4 applySliceHighlight(vec4 color, vec3 pos) {
313
+ SliceFactors factors = calculateSliceFactors(pos);
314
+ const float HIGHLIGHT_WIDTH = 1.0;
315
+ const vec4 HIGHLIGHT_COLOR = vec4(0.0, 0.0, 0.0, 0.3);
316
+ factors.front /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.front);
317
+ factors.side0 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side0);
318
+ factors.side1 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side1);
319
+ factors.side2 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side2);
320
+ factors.side3 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side3);
321
+ if (sliceByFactors(factors)) {
322
+ return color;
323
+ }
324
+ float highlightFactor = (1.0 - step(0.5, factors.front))
325
+ * (1.0 - step(0.5, factors.side0))
326
+ * (1.0 - step(0.5, factors.side1))
327
+ * (1.0 - step(0.5, factors.side2))
328
+ * (1.0 - step(0.5, factors.side3));
329
+ return mix(color, vec4(HIGHLIGHT_COLOR.rgb, color.a), highlightFactor * HIGHLIGHT_COLOR.a);
330
+ }`,i=t.hasSliceHighlight?l.H`
331
+ ${o}
332
+ #define highlightSlice(_color_, _pos_) (sliceEnabled() ? applySliceHighlight(_color_, _pos_) : (_color_))
333
+ `:l.H`#define highlightSlice(_color_, _pos_) (_color_)`;t.hasSliceInVertexProgram&&e.vertex.uniforms.add(...r).code.add(n),e.fragment.uniforms.add(...r).code.add(n),e.fragment.code.add(i)}(e,t,new s.W("slicePlaneOrigin",((e,r)=>function(e,t,r){if(null==r.slicePlane)return a.uY;const n=d(e,t,r),o=u(n,r.slicePlane),s=h(e,n,r);return null!=s?(0,i.h)(p,o,s):o}(t,e,r))),new s.W("slicePlaneBasis1",((e,r)=>m(t,e,r,r.slicePlane?.basis1))),new s.W("slicePlaneBasis2",((e,r)=>m(t,e,r,r.slicePlane?.basis2))))}function d(e,t,r){return e.instancedDoublePrecision?(0,i.s)(f,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]):t.slicePlaneLocalOrigin}function u(e,t){return null!=e?(0,i.f)(p,t.origin,e):t.origin}function h(e,t,r){return e.hasSliceTranslatedView?null!=t?(0,n.Tl)(g,r.camera.viewMatrix,t):r.camera.viewMatrix:null}function m(e,t,r,n){if(null==n||null==r.slicePlane)return a.uY;const o=d(e,t,r),s=u(o,r.slicePlane),l=h(e,o,r);return null!=l?((0,i.g)(v,n,s),(0,i.h)(p,s,l),(0,i.h)(v,v,l),(0,i.f)(v,v,p)):n}l.Y;const f=(0,a.vt)(),p=(0,a.vt)(),v=(0,a.vt)(),g=(0,o.vt)()},76597:(e,t,r)=>{r.d(t,{d:()=>i});var n=r(46686),o=r(2597);function i(e){(0,n.i$)(e),e.vertex.code.add(o.H`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
334
+ vec4 eye = view * vec4(pos, 1.0);
335
+ depth = calculateLinearDepth(nearFar,eye.z);
336
+ return proj * eye;
337
+ }`),e.vertex.code.add(o.H`vec4 transformPosition(mat4 proj, mat4 view, vec3 pos) {
338
+ return proj * (view * vec4(pos, 1.0));
339
+ }`)}},82991:(e,t,r)=>{r.d(t,{BK:()=>b,nW:()=>x});var n=r(90237),o=r(77690),i=r(29242),a=r(9093),s=r(38954),l=r(51850),c=r(49255),d=r(26425),u=r(20693),h=r(40710),m=r(2597),f=r(35644),p=r(40095),v=r(99769),g=r(46540),_=r(28449);class x extends v.K{constructor(){super(...arguments),this.instancedDoublePrecision=!1,this.hasModelTransformation=!1}}(0,n._)([(0,v.W)()],x.prototype,"instancedDoublePrecision",void 0),(0,n._)([(0,v.W)()],x.prototype,"hasModelTransformation",void 0),m.Y;const T=(0,i.vt)();function b(e,t){const r=t.hasModelTransformation,n=t.instancedDoublePrecision;r&&(e.vertex.uniforms.add(new p.X("model",(e=>e.modelTransformation??a.zK))),e.vertex.uniforms.add(new f.k("normalLocalOriginFromModel",(e=>((0,o.Ge)(T,e.modelTransformation??a.zK),T))))),t.instanced&&n&&(e.attributes.add(g.r.INSTANCEMODELORIGINHI,"vec3"),e.attributes.add(g.r.INSTANCEMODELORIGINLO,"vec3"),e.attributes.add(g.r.INSTANCEMODEL,"mat3"),e.attributes.add(g.r.INSTANCEMODELNORMAL,"mat3"));const i=e.vertex;n&&(i.include(d.u,t),i.uniforms.add(new h.W("viewOriginHi",((e,t)=>(0,_.Zo)((0,s.s)(y,t.camera.viewInverseTransposeMatrix[3],t.camera.viewInverseTransposeMatrix[7],t.camera.viewInverseTransposeMatrix[11]),y))),new h.W("viewOriginLo",((e,t)=>(0,_.jA)((0,s.s)(y,t.camera.viewInverseTransposeMatrix[3],t.camera.viewInverseTransposeMatrix[7],t.camera.viewInverseTransposeMatrix[11]),y))))),i.code.add(m.H`
340
+ vec3 getVertexInLocalOriginSpace() {
341
+ return ${r?n?"(model * vec4(instanceModel * localPosition().xyz, 1.0)).xyz":"(model * localPosition()).xyz":n?"instanceModel * localPosition().xyz":"localPosition().xyz"};
342
+ }
343
+
344
+ vec3 subtractOrigin(vec3 _pos) {
345
+ ${n?m.H`
346
+ // Negated inputs are intentionally the first two arguments. The other way around the obfuscation in dpAdd() stopped
347
+ // working for macOS 14+ and iOS 17+.
348
+ // Issue: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/56280
349
+ vec3 originDelta = dpAdd(-instanceModelOriginHi, -instanceModelOriginLo, viewOriginHi, viewOriginLo);
350
+ return _pos - originDelta;`:"return vpos;"}
351
+ }
352
+ `),i.code.add(m.H`
353
+ vec3 dpNormal(vec4 _normal) {
354
+ return normalize(${r?n?"normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz)":"normalLocalOriginFromModel * _normal.xyz":n?"instanceModelNormal * _normal.xyz":"_normal.xyz"});
355
+ }
356
+ `),t.output===c.V.Normal&&((0,u.S7)(i),i.code.add(m.H`
357
+ vec3 dpNormalView(vec4 _normal) {
358
+ return normalize((viewNormal * ${r?n?"vec4(normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz), 1.0)":"vec4(normalLocalOriginFromModel * _normal.xyz, 1.0)":n?"vec4(instanceModelNormal * _normal.xyz, 1.0)":"_normal"}).xyz);
359
+ }
360
+ `)),t.hasVertexTangents&&i.code.add(m.H`
361
+ vec4 dpTransformVertexTangent(vec4 _tangent) {
362
+ ${r?n?"return vec4(normalLocalOriginFromModel * (instanceModelNormal * _tangent.xyz), _tangent.w);":"return vec4(normalLocalOriginFromModel * _tangent.xyz, _tangent.w);":n?"return vec4(instanceModelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"}
363
+ }`)}const y=(0,l.vt)()},96336:(e,t,r)=>{r.d(t,{W:()=>n,Y:()=>l});var n,o,i=r(21818),a=r(2597),s=r(46540);function l(e,t){switch(t.normalType){case n.Compressed:e.attributes.add(s.r.NORMALCOMPRESSED,"vec2"),e.vertex.code.add(a.H`vec3 decompressNormal(vec2 normal) {
364
+ float z = 1.0 - abs(normal.x) - abs(normal.y);
365
+ return vec3(normal + sign(normal) * min(z, 0.0), z);
366
+ }
367
+ vec3 normalModel() {
368
+ return decompressNormal(normalCompressed);
369
+ }`);break;case n.Attribute:e.attributes.add(s.r.NORMAL,"vec3"),e.vertex.code.add(a.H`vec3 normalModel() {
370
+ return normal;
371
+ }`);break;case n.ScreenDerivative:e.fragment.code.add(a.H`vec3 screenDerivativeNormal(vec3 positionView) {
372
+ return normalize(cross(dFdx(positionView), dFdy(positionView)));
373
+ }`);break;default:(0,i.Xb)(t.normalType);case n.COUNT:case n.Ground:}}(o=n||(n={}))[o.Attribute=0]="Attribute",o[o.Compressed=1]="Compressed",o[o.Ground=2]="Ground",o[o.ScreenDerivative=3]="ScreenDerivative",o[o.COUNT=4]="COUNT"},10764:(e,t,r)=>{r.d(t,{I:()=>i});var n=r(2597),o=r(46540);function i(e){e.attributes.add(o.r.POSITION,"vec3"),e.vertex.code.add(n.H`vec3 positionModel() { return position; }`)}},39014:(e,t,r)=>{r.d(t,{K:()=>l});var n=r(42583),o=r(93588),i=r(2597),a=r(46540),s=r(13752);function l(e,t){t.hasSymbolColors?(e.include(n.A),e.attributes.add(a.r.SYMBOLCOLOR,"vec4"),e.varyings.add("colorMixMode","mediump float"),e.vertex.code.add(i.H`int symbolColorMixMode;
374
+ vec4 getSymbolColor() {
375
+ return decodeSymbolColor(symbolColor, symbolColorMixMode) * 0.003921568627451;
376
+ }
377
+ void forwardColorMixMode() {
378
+ colorMixMode = float(symbolColorMixMode) + 0.5;
379
+ }`)):(e.fragment.uniforms.add(new o.c("colorMixMode",(e=>s.Um[e.colorMixMode]))),e.vertex.code.add(i.H`vec4 getSymbolColor() { return vec4(1.0); }
380
+ void forwardColorMixMode() {}`))}},53466:(e,t,r)=>{r.d(t,{U:()=>l,q:()=>n});var n,o,i=r(21818),a=r(2597),s=r(46540);function l(e,t){switch(t.textureCoordinateType){case n.Default:return e.attributes.add(s.r.UV0,"vec2"),e.varyings.add("vuv0","vec2"),void e.vertex.code.add(a.H`void forwardTextureCoordinates() {
381
+ vuv0 = uv0;
382
+ }`);case n.Compressed:return e.attributes.add(s.r.UV0,"vec2"),e.varyings.add("vuv0","vec2"),void e.vertex.code.add(a.H`vec2 getUV0() {
383
+ return uv0 / 16384.0;
384
+ }
385
+ void forwardTextureCoordinates() {
386
+ vuv0 = getUV0();
387
+ }`);case n.Atlas:return e.attributes.add(s.r.UV0,"vec2"),e.varyings.add("vuv0","vec2"),e.attributes.add(s.r.UVREGION,"vec4"),e.varyings.add("vuvRegion","vec4"),void e.vertex.code.add(a.H`void forwardTextureCoordinates() {
388
+ vuv0 = uv0;
389
+ vuvRegion = uvRegion;
390
+ }`);default:(0,i.Xb)(t.textureCoordinateType);case n.None:return void e.vertex.code.add(a.H`void forwardTextureCoordinates() {}`);case n.COUNT:return}}(o=n||(n={}))[o.None=0]="None",o[o.Default=1]="Default",o[o.Atlas=2]="Atlas",o[o.Compressed=3]="Compressed",o[o.COUNT=4]="COUNT"},92700:(e,t,r)=>{r.d(t,{c:()=>i});var n=r(2597),o=r(46540);function i(e,t){t.hasVertexColors?(e.attributes.add(o.r.COLOR,"vec4"),e.varyings.add("vColor","vec4"),e.vertex.code.add(n.H`void forwardVertexColor() { vColor = color; }`),e.vertex.code.add(n.H`void forwardNormalizedVertexColor() { vColor = color * 0.003921568627451; }`)):e.vertex.code.add(n.H`void forwardVertexColor() {}
391
+ void forwardNormalizedVertexColor() {}`)}},72824:(e,t,r)=>{r.d(t,{Mh:()=>u,Zo:()=>h,gy:()=>m});var n=r(21818),o=r(29242),i=r(91829),a=r(96336),s=r(33752),l=r(2597),c=r(98353),d=r(35644);function u(e,t){switch(t.normalType){case a.W.Attribute:case a.W.Compressed:e.include(a.Y,t),e.varyings.add("vNormalWorld","vec3"),e.varyings.add("vNormalView","vec3"),e.vertex.uniforms.add(new c.h("transformNormalGlobalFromModel",(e=>e.transformNormalGlobalFromModel)),new d.k("transformNormalViewFromGlobal",(e=>e.transformNormalViewFromGlobal))),e.vertex.code.add(l.H`void forwardNormal() {
392
+ vNormalWorld = transformNormalGlobalFromModel * normalModel();
393
+ vNormalView = transformNormalViewFromGlobal * vNormalWorld;
394
+ }`);break;case a.W.Ground:e.include(s.em,t),e.varyings.add("vNormalWorld","vec3"),e.vertex.code.add(l.H`
395
+ void forwardNormal() {
396
+ vNormalWorld = ${t.spherical?l.H`normalize(vPositionWorldCameraRelative);`:l.H`vec3(0.0, 0.0, 1.0);`}
397
+ }
398
+ `);break;case a.W.ScreenDerivative:e.vertex.code.add(l.H`void forwardNormal() {}`);break;default:(0,n.Xb)(t.normalType);case a.W.COUNT:}}class h extends s.dO{constructor(){super(...arguments),this.transformNormalViewFromGlobal=(0,o.vt)()}}class m extends s.EM{constructor(){super(...arguments),this.transformNormalGlobalFromModel=(0,o.vt)(),this.toMapSpace=(0,i.vt)()}}},33752:(e,t,r)=>{r.d(t,{EM:()=>v,dO:()=>p,em:()=>f});var n=r(29242),o=r(9093),i=r(51850),a=r(10764),s=r(26425),l=r(40710),c=r(33079),d=r(2597),u=r(98353),h=r(35644),m=r(40095);function f(e,t){e.include(a.I);const r=e.vertex;r.include(s.u,t),e.varyings.add("vPositionWorldCameraRelative","vec3"),e.varyings.add("vPosition_view","vec3"),r.uniforms.add(new c.t("transformWorldFromViewTH",(e=>e.transformWorldFromViewTH)),new c.t("transformWorldFromViewTL",(e=>e.transformWorldFromViewTL)),new h.k("transformViewFromCameraRelativeRS",(e=>e.transformViewFromCameraRelativeRS)),new m.X("transformProjFromView",(e=>e.transformProjFromView)),new u.h("transformWorldFromModelRS",(e=>e.transformWorldFromModelRS)),new l.W("transformWorldFromModelTH",(e=>e.transformWorldFromModelTH)),new l.W("transformWorldFromModelTL",(e=>e.transformWorldFromModelTL))),r.code.add(d.H`vec3 positionWorldCameraRelative() {
399
+ vec3 rotatedModelPosition = transformWorldFromModelRS * positionModel();
400
+ vec3 transform_CameraRelativeFromModel = dpAdd(
401
+ transformWorldFromModelTL,
402
+ transformWorldFromModelTH,
403
+ -transformWorldFromViewTL,
404
+ -transformWorldFromViewTH
405
+ );
406
+ return transform_CameraRelativeFromModel + rotatedModelPosition;
407
+ }`),r.code.add(d.H`
408
+ void forwardPosition(float fOffset) {
409
+ vPositionWorldCameraRelative = positionWorldCameraRelative();
410
+ if (fOffset != 0.0) {
411
+ vPositionWorldCameraRelative += fOffset * ${t.spherical?d.H`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:d.H`vec3(0.0, 0.0, 1.0)`};
412
+ }
413
+
414
+ vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
415
+ gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
416
+ }
417
+ `),e.fragment.uniforms.add(new c.t("transformWorldFromViewTL",(e=>e.transformWorldFromViewTL))),r.code.add(d.H`vec3 positionWorld() {
418
+ return transformWorldFromViewTL + vPositionWorldCameraRelative;
419
+ }`),e.fragment.code.add(d.H`vec3 positionWorld() {
420
+ return transformWorldFromViewTL + vPositionWorldCameraRelative;
421
+ }`)}class p extends d.Y{constructor(){super(...arguments),this.transformWorldFromViewTH=(0,i.vt)(),this.transformWorldFromViewTL=(0,i.vt)(),this.transformViewFromCameraRelativeRS=(0,n.vt)(),this.transformProjFromView=(0,o.vt)()}}class v extends d.Y{constructor(){super(...arguments),this.transformWorldFromModelRS=(0,n.vt)(),this.transformWorldFromModelTH=(0,i.vt)(),this.transformWorldFromModelTL=(0,i.vt)()}}},99208:(e,t,r)=>{r.d(t,{r:()=>s});var n=r(21818),o=r(53466),i=r(2597);function a(e){e.fragment.code.add(i.H`vec4 textureAtlasLookup(sampler2D tex, vec2 textureCoordinates, vec4 atlasRegion) {
422
+ vec2 atlasScale = atlasRegion.zw - atlasRegion.xy;
423
+ vec2 uvAtlas = fract(textureCoordinates) * atlasScale + atlasRegion.xy;
424
+ float maxdUV = 0.125;
425
+ vec2 dUVdx = clamp(dFdx(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
426
+ vec2 dUVdy = clamp(dFdy(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
427
+ return textureGrad(tex, uvAtlas, dUVdx, dUVdy);
428
+ }`)}function s(e,t){switch(e.include(o.U,t),t.textureCoordinateType){case o.q.Default:case o.q.Compressed:return void e.fragment.code.add(i.H`vec4 textureLookup(sampler2D tex, vec2 uv) {
429
+ return texture(tex, uv);
430
+ }`);case o.q.Atlas:return e.include(a),void e.fragment.code.add(i.H`vec4 textureLookup(sampler2D tex, vec2 uv) {
431
+ return textureAtlasLookup(tex, uv, vuvRegion);
432
+ }`);default:(0,n.Xb)(t.textureCoordinateType);case o.q.None:case o.q.COUNT:return}}},54154:(e,t,r)=>{r.d(t,{G:()=>m});var n=r(87317),o=r(91829),i=r(38954),a=r(51850),s=r(33079),l=r(2597);function c(e){e.vertex.code.add(l.H`float screenSizePerspectiveViewAngleDependentFactor(float absCosAngle) {
433
+ return absCosAngle * absCosAngle * absCosAngle;
434
+ }`),e.vertex.code.add(l.H`vec3 screenSizePerspectiveScaleFactor(float absCosAngle, float distanceToCamera, vec3 params) {
435
+ return vec3(
436
+ min(params.x / (distanceToCamera - params.y), 1.0),
437
+ screenSizePerspectiveViewAngleDependentFactor(absCosAngle),
438
+ params.z
439
+ );
440
+ }`),e.vertex.code.add(l.H`float applyScreenSizePerspectiveScaleFactorFloat(float size, vec3 factor) {
441
+ return mix(size * clamp(factor.x, factor.z, 1.0), size, factor.y);
442
+ }`),e.vertex.code.add(l.H`float screenSizePerspectiveScaleFloat(float size, float absCosAngle, float distanceToCamera, vec3 params) {
443
+ return applyScreenSizePerspectiveScaleFactorFloat(
444
+ size,
445
+ screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params)
446
+ );
447
+ }`),e.vertex.code.add(l.H`vec2 applyScreenSizePerspectiveScaleFactorVec2(vec2 size, vec3 factor) {
448
+ return mix(size * clamp(factor.x, factor.z, 1.0), size, factor.y);
449
+ }`),e.vertex.code.add(l.H`vec2 screenSizePerspectiveScaleVec2(vec2 size, float absCosAngle, float distanceToCamera, vec3 params) {
450
+ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params));
451
+ }`)}const d=(0,a.vt)();var u=r(20693),h=r(71988);function m(e,t){const r=e.vertex;t.hasVerticalOffset?(function(e){e.uniforms.add(new h.E("verticalOffset",((e,t)=>{const{minWorldLength:r,maxWorldLength:o,screenLength:i}=e.verticalOffset,a=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),s=t.camera.pixelRatio||1;return(0,n.s)(f,i*s,a,r,o)})))}(r),t.hasScreenSizePerspective&&(e.include(c),function(e){e.uniforms.add(new s.t("screenSizePerspectiveAlignment",(e=>function(e){return(0,i.s)(d,e.parameters.divisor,e.parameters.offset,e.minScaleFactor)}(e.screenSizePerspectiveAlignment||e.screenSizePerspective))))}(r),(0,u.yu)(e.vertex,t)),r.code.add(l.H`
452
+ vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
453
+ float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
454
+ ${t.spherical?l.H`vec3 worldNormal = normalize(worldPos + localOrigin);`:l.H`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
455
+ ${t.hasScreenSizePerspective?l.H`
456
+ float cosAngle = dot(worldNormal, normalize(worldPos - cameraPosition));
457
+ float verticalOffsetScreenHeight = screenSizePerspectiveScaleFloat(verticalOffset.x, abs(cosAngle), viewDistance, screenSizePerspectiveAlignment);`:l.H`
458
+ float verticalOffsetScreenHeight = verticalOffset.x;`}
459
+ // Screen sized offset in world space, used for example for line callouts
460
+ float worldOffset = clamp(verticalOffsetScreenHeight * verticalOffset.y * viewDistance, verticalOffset.z, verticalOffset.w);
461
+ return worldNormal * worldOffset;
462
+ }
463
+
464
+ vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
465
+ return worldPos + calculateVerticalOffset(worldPos, localOrigin);
466
+ }
467
+ `)):r.code.add(l.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const f=(0,o.vt)()},9169:(e,t,r)=>{r.d(t,{E:()=>b});var n=r(46686),o=r(49255),i=r(76591),a=r(76597),s=r(96336),l=r(2597),c=r(46540);function d(e,t){const r=t.output===o.V.ObjectAndLayerIdColor,n=t.objectAndLayerIdColorInstanced;r&&(e.varyings.add("objectAndLayerIdColorVarying","vec4"),n?e.attributes.add(c.r.INSTANCEOBJECTANDLAYERIDCOLOR,"vec4"):e.attributes.add(c.r.OBJECTANDLAYERIDCOLOR,"vec4")),e.vertex.code.add(l.H`
468
+ void forwardObjectAndLayerIdColor() {
469
+ ${r?n?l.H`objectAndLayerIdColorVarying = instanceObjectAndLayerIdColor * 0.003921568627451;`:l.H`objectAndLayerIdColorVarying = objectAndLayerIdColor * 0.003921568627451;`:l.H``} }`),e.fragment.code.add(l.H`
470
+ void outputObjectAndLayerIdColor() {
471
+ ${r?l.H`fragColor = objectAndLayerIdColorVarying;`:l.H``} }`)}var u=r(53466),h=r(72824),m=r(80730);function f(e,t){switch(t.output){case o.V.Shadow:case o.V.ShadowHighlight:case o.V.ShadowExcludeHighlight:case o.V.ViewshedShadow:e.fragment.include(m.U),e.fragment.code.add(l.H`float _calculateFragDepth(const in float depth) {
472
+ const float SLOPE_SCALE = 2.0;
473
+ const float BIAS = 20.0 * .000015259;
474
+ float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
475
+ return depth + SLOPE_SCALE * m + BIAS;
476
+ }
477
+ void outputDepth(float _linearDepth) {
478
+ fragColor = floatToRgba4(_calculateFragDepth(_linearDepth));
479
+ }`)}}var p=r(76662),v=r(986),g=r(11955),_=r(20693),x=r(63761),T=r(89192);function b(e,t){const{vertex:r,fragment:c}=e,m=t.hasColorTexture&&t.alphaDiscardMode!==T.sf.Opaque;switch(t.output){case o.V.Depth:(0,_.NB)(r,t),e.include(a.d,t),e.include(i.HQ,t),e.include(u.U,t),m&&c.uniforms.add(new x.N("tex",(e=>e.texture))),r.main.add(l.H`vpos = getVertexInLocalOriginSpace();
480
+ vpos = subtractOrigin(vpos);
481
+ vpos = addVerticalOffset(vpos, localOrigin);
482
+ gl_Position = transformPosition(proj, view, vpos);
483
+ forwardTextureCoordinates();`),e.include(g.S,t),c.main.add(l.H`
484
+ discardBySlice(vpos);
485
+ ${m?l.H`vec4 texColor = texture(tex, ${t.hasColorTextureTransform?"colorUV":"vuv0"});
486
+ discardOrAdjustAlpha(texColor);`:""}`);break;case o.V.Shadow:case o.V.ShadowHighlight:case o.V.ShadowExcludeHighlight:case o.V.ViewshedShadow:case o.V.ObjectAndLayerIdColor:(0,_.NB)(r,t),e.include(a.d,t),e.include(u.U,t),e.include(v.A,t),e.include(f,t),e.include(i.HQ,t),e.include(d,t),(0,n.xJ)(e),e.varyings.add("depth","float"),m&&c.uniforms.add(new x.N("tex",(e=>e.texture))),r.main.add(l.H`vpos = getVertexInLocalOriginSpace();
487
+ vpos = subtractOrigin(vpos);
488
+ vpos = addVerticalOffset(vpos, localOrigin);
489
+ gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);
490
+ forwardTextureCoordinates();
491
+ forwardObjectAndLayerIdColor();`),e.include(g.S,t),c.main.add(l.H`
492
+ discardBySlice(vpos);
493
+ ${m?l.H`vec4 texColor = texture(tex, ${t.hasColorTextureTransform?"colorUV":"vuv0"});
494
+ discardOrAdjustAlpha(texColor);`:""}
495
+ ${t.output===o.V.ObjectAndLayerIdColor?l.H`outputObjectAndLayerIdColor();`:l.H`outputDepth(depth);`}`);break;case o.V.Normal:{(0,_.NB)(r,t),e.include(a.d,t),e.include(s.Y,t),e.include(h.Mh,t),e.include(u.U,t),e.include(v.A,t),m&&c.uniforms.add(new x.N("tex",(e=>e.texture))),t.normalType===s.W.ScreenDerivative&&e.varyings.add("vPositionView","vec3");const n=t.normalType===s.W.Attribute||t.normalType===s.W.Compressed;r.main.add(l.H`
496
+ vpos = getVertexInLocalOriginSpace();
497
+ ${n?l.H`vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:l.H`vPositionView = (view * vec4(vpos, 1.0)).xyz;`}
498
+ vpos = subtractOrigin(vpos);
499
+ vpos = addVerticalOffset(vpos, localOrigin);
500
+ gl_Position = transformPosition(proj, view, vpos);
501
+ forwardTextureCoordinates();`),e.include(i.HQ,t),e.include(g.S,t),c.main.add(l.H`
502
+ discardBySlice(vpos);
503
+ ${m?l.H`vec4 texColor = texture(tex, ${t.hasColorTextureTransform?"colorUV":"vuv0"});
504
+ discardOrAdjustAlpha(texColor);`:""}
505
+
506
+ ${t.normalType===s.W.ScreenDerivative?l.H`vec3 normal = screenDerivativeNormal(vPositionView);`:l.H`vec3 normal = normalize(vNormalWorld);
507
+ if (gl_FrontFacing == false){
508
+ normal = -normal;
509
+ }`}
510
+ fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case o.V.Highlight:(0,_.NB)(r,t),e.include(a.d,t),e.include(u.U,t),e.include(v.A,t),m&&c.uniforms.add(new x.N("tex",(e=>e.texture))),r.main.add(l.H`vpos = getVertexInLocalOriginSpace();
511
+ vpos = subtractOrigin(vpos);
512
+ vpos = addVerticalOffset(vpos, localOrigin);
513
+ gl_Position = transformPosition(proj, view, vpos);
514
+ forwardTextureCoordinates();`),e.include(i.HQ,t),e.include(g.S,t),e.include(p.Q,t),c.main.add(l.H`
515
+ discardBySlice(vpos);
516
+ ${m?l.H`vec4 texColor = texture(tex, ${t.hasColorTextureTransform?"colorUV":"vuv0"});
517
+ discardOrAdjustAlpha(texColor);`:""}
518
+ outputHighlight();`)}}},76662:(e,t,r)=>{r.d(t,{Q:()=>a});var n=r(93588),o=r(2597),i=r(63761);function a(e){e.fragment.uniforms.add(new i.N("depthTexture",((e,t)=>t.mainDepth))),e.fragment.uniforms.add(new i.N("highlightTexture",((e,t)=>t.highlightTexture))),e.fragment.uniforms.add(new n.c("highlightLevel",((e,t)=>t.highlightLevel))),e.fragment.code.add(o.H`void outputHighlightNet(bool occluded) {
519
+ int ll = highlightLevel & 3;
520
+ int newI = 0;
521
+ newI |= 1 << (ll*2);
522
+ if (occluded) { newI |= 2 << (ll*2); }
523
+ vec4 prevHighlight = texelFetch(highlightTexture, ivec2(gl_FragCoord.xy), 0);
524
+ int li = (highlightLevel >> 2) & 3;
525
+ int prevI = int(prevHighlight[li] * 255.0);
526
+ int cI = newI | prevI;
527
+ float cf = float(cI) / 255.0;
528
+ vec4 combinedHighlight = prevHighlight;
529
+ combinedHighlight[li] = cf;
530
+ fragColor = combinedHighlight;
531
+ }
532
+ void outputHighlight() {
533
+ float sceneDepth = texelFetch(depthTexture, ivec2(gl_FragCoord.xy), 0).x;
534
+ bool occluded = gl_FragCoord.z > sceneDepth + 5e-5;
535
+ outputHighlightNet(occluded);
536
+ }`)}},52540:(e,t,r)=>{r.d(t,{E:()=>s});var n=r(37585),o=r(48163),i=(r(26835),r(47286)),a=r(2597);function s(e){e.uniforms.add(new i.G("zProjectionMap",((e,t)=>function(e){const t=e.projectionMatrix;return(0,n.hZ)(l,t[14],t[10])}(t.camera)))),e.code.add(a.H`float linearizeDepth(float depth) {
537
+ float depthNdc = depth * 2.0 - 1.0;
538
+ float c1 = zProjectionMap[0];
539
+ float c2 = zProjectionMap[1];
540
+ return -(c1 / (depthNdc + c2 + 1e-7));
541
+ }`),e.code.add(a.H`float depthFromTexture(sampler2D depthTexture, vec2 uv) {
542
+ ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
543
+ float depth = texelFetch(depthTexture, iuv, 0).r;
544
+ return depth;
545
+ }`),e.code.add(a.H`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
546
+ return linearizeDepth(depthFromTexture(depthTexture, uv));
547
+ }`)}const l=(0,o.vt)()},77695:(e,t,r)=>{r.d(t,{W:()=>p});var n=r(29242),o=r(48163),i=r(53466),a=r(99208),s=r(62602),l=r(47286),c=r(2597),d=r(35644),u=r(15976),h=r(63761),m=r(46263),f=r(46540);function p(e,t){const r=e.fragment;t.hasVertexTangents?(e.attributes.add(f.r.TANGENT,"vec4"),e.varyings.add("vTangent","vec4"),t.doubleSidedMode===s.W.WindingOrder?r.code.add(c.H`mat3 computeTangentSpace(vec3 normal) {
548
+ float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
549
+ vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
550
+ vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
551
+ return mat3(tangent, bitangent, normal);
552
+ }`):r.code.add(c.H`mat3 computeTangentSpace(vec3 normal) {
553
+ float tangentHeadedness = vTangent.w;
554
+ vec3 tangent = normalize(vTangent.xyz);
555
+ vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
556
+ return mat3(tangent, bitangent, normal);
557
+ }`)):r.code.add(c.H`mat3 computeTangentSpace(vec3 normal, vec3 pos, vec2 st) {
558
+ vec3 Q1 = dFdx(pos);
559
+ vec3 Q2 = dFdy(pos);
560
+ vec2 stx = dFdx(st);
561
+ vec2 sty = dFdy(st);
562
+ float det = stx.t * sty.s - sty.t * stx.s;
563
+ vec3 T = stx.t * Q2 - sty.t * Q1;
564
+ T = T - normal * dot(normal, T);
565
+ T *= inversesqrt(max(dot(T,T), 1.e-10));
566
+ vec3 B = sign(det) * cross(normal, T);
567
+ return mat3(T, B, normal);
568
+ }`),t.textureCoordinateType!==i.q.None&&(e.include(a.r,t),r.uniforms.add(t.pbrTextureBindType===m.c.Pass?new h.N("normalTexture",(e=>e.textureNormal)):new u.o("normalTexture",(e=>e.textureNormal))),t.hasNormalTextureTransform&&(r.uniforms.add(new l.G("scale",(e=>e.scale??o.Un))),r.uniforms.add(new d.k("normalTextureTransformMatrix",(e=>e.normalTextureTransformMatrix??n.zK)))),r.code.add(c.H`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
569
+ vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),t.hasNormalTextureTransform&&r.code.add(c.H`mat3 normalTextureRotation = mat3(normalTextureTransformMatrix[0][0]/scale[0], normalTextureTransformMatrix[0][1]/scale[1], 0.0,
570
+ normalTextureTransformMatrix[1][0]/scale[0], normalTextureTransformMatrix[1][1]/scale[1], 0.0,
571
+ 0.0, 0.0, 0.0 );
572
+ rawNormal.xy = (normalTextureRotation * vec3(rawNormal.x, rawNormal.y, 1.0)).xy;`),r.code.add(c.H`return tangentSpace * rawNormal;
573
+ }`))}},3452:(e,t,r)=>{r.d(t,{n:()=>G});var n,o,i,a=r(2597),s=r(63761),l=r(90237),c=r(34727),d=r(97768),u=r(36708),h=r(78659),m=r(10107),f=(r(44208),r(53966),r(87811),r(40608)),p=r(37585);(i=n||(n={}))[i.RED=0]="RED",i[i.RG=1]="RG",i[i.RGBA4=2]="RGBA4",i[i.RGBA=3]="RGBA",i[i.RGBA_MIPMAP=4]="RGBA_MIPMAP",i[i.R16F=5]="R16F",i[i.RGBA16F=6]="RGBA16F",function(e){e[e.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",e[e.DEPTH16_BUFFER=1]="DEPTH16_BUFFER"}(o||(o={}));var v=r(69622),g=r(49186),_=r(89192);let x=class extends v.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces="composite-color",this.requireGeometryDepth=!1,this._context=null,this._dirty=!0}initialize(){this.addHandles([(0,u.wB)((()=>this.view.ready),(e=>{e&&this.view._stage?.renderer.addRenderNode(this)}),u.Vh)])}destroy(){this.view._stage?.renderer?.removeRenderNode(this)}render(){throw new g.A("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view._stage.renderView.renderingContext.gl}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,t=this.view._stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return t.fbo?.initializeAndBind(),t}bindRenderTarget(){return this._frameBuffer?.fbo?.initializeAndBind(),this._frameBuffer}requestRender(e){e===_.C7.UPDATE&&this.view._stage?.renderView.requestRender(e),this._dirty=!0}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view._stage.renderer.fboCache}get bindParameters(){return this._context.bindParameters}get renderingContext(){return this.view._stage.renderView.renderingContext}updateAnimation(){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e,t){this._context=t,this._frameBuffer=e.find((({name:e})=>e===this.produces));try{return this.render(e)}finally{this._frameBuffer=null}}};(0,l._)([(0,m.MZ)({constructOnly:!0})],x.prototype,"view",void 0),(0,l._)([(0,m.MZ)({constructOnly:!0})],x.prototype,"consumes",void 0),(0,l._)([(0,m.MZ)()],x.prototype,"produces",void 0),x=(0,l._)([(0,f.$)("esri.views.3d.webgl.RenderNode")],x);const T=x;var b=r(97220),y=r(84867),A=r(39341),E=r(34886),S=r(95774),M=r(90644);class w extends y.w{initializeProgram(e){return new E.B(e.rctx,w.shader.get().build(),A.D)}initializePipeline(){return(0,M.Ey)({colorWrite:M.wE})}}w.shader=new b.$(S.S,(()=>r.e(9384).then(r.bind(r,59384))));var C=r(48163);class O extends a.Y{constructor(){super(...arguments),this.projScale=1}}class R extends O{constructor(){super(...arguments),this.intensity=1}}class I extends a.Y{}class N extends I{constructor(){super(...arguments),this.blurSize=(0,C.vt)()}}var P=r(15581);class L extends y.w{initializeProgram(e){return new E.B(e.rctx,L.shader.get().build(),A.D)}initializePipeline(){return(0,M.Ey)({colorWrite:M.wE})}}L.shader=new b.$(P.S,(()=>r.e(191).then(r.bind(r,90191))));var H=r(63907),D=r(21231),B=r(67171);const F=2;let z=class extends T{constructor(e){super(e),this.consumes={required:["normals"]},this.produces="ssao",this.isEnabled=()=>!1,this._enableTime=(0,h.l5)(0),this._passParameters=new R,this._drawParameters=new N}initialize(){const e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),(e=>e.charCodeAt(0))),t=new B.R;t.wrapMode=H.pF.CLAMP_TO_EDGE,t.pixelFormat=H.Ab.RGB,t.wrapMode=H.pF.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new D.g(this.renderingContext,t,e),this._ssaoTechnique=this.techniques.acquire(L),this._blurTechnique=this.techniques.acquire(w),this.addHandles((0,u.wB)((()=>this.isEnabled()),(()=>this._enableTime=(0,h.l5)(0))))}destroy(){this._passParameters.noiseTexture=(0,d.WD)(this._passParameters.noiseTexture),this._blurTechnique.release(),this._ssaoTechnique.release()}render(e){const t=this.bindParameters,r=e.find((({name:e})=>"normals"===e)),o=r?.getTexture(),i=r?.getTexture(H.nI),a=this.fboCache,s=t.camera,l=s.fullViewport[2],d=s.fullViewport[3],u=Math.round(l/F),m=Math.round(d/F);if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=(0,h.l5)(performance.now()),this.requestRender(),a.acquire(u,m,"ssao",n.RED);0===this._enableTime&&(this._enableTime=(0,h.l5)(performance.now()));const f=this.renderingContext,v=this.view.qualitySettings.fadeDuration,g=s.relativeElevation,x=(0,c.qE)((5e5-g)/2e5,0,1),T=v>0?Math.min(v,performance.now()-this._enableTime)/v:1,b=T*x;this._passParameters.normalTexture=o,this._passParameters.depthTexture=i,this._passParameters.projScale=1/s.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*V/(0,P.g)(s)**6*b;const y=a.acquire(l,d,"ssao input",n.RG);f.unbindTexture(y.fbo.colorTexture),f.bindFramebuffer(y.fbo),f.setViewport(0,0,l,d),f.bindTechnique(this._ssaoTechnique,t,this._passParameters,this._drawParameters),f.screen.draw();const A=a.acquire(u,m,"ssao blur",n.RED);f.unbindTexture(A.fbo.colorTexture),f.bindFramebuffer(A.fbo),this._drawParameters.colorTexture=y.getTexture(),(0,p.hZ)(this._drawParameters.blurSize,0,F/d),f.bindTechnique(this._blurTechnique,t,this._passParameters,this._drawParameters),f.setViewport(0,0,u,m),f.screen.draw(),y.release();const E=a.acquire(u,m,"ssao",n.RED);return f.unbindTexture(E.fbo.colorTexture),f.bindFramebuffer(E.fbo),f.setViewport(0,0,l,d),f.setClearColor(1,1,1,0),f.clear(H.NV.COLOR),this._drawParameters.colorTexture=A.getTexture(),(0,p.hZ)(this._drawParameters.blurSize,F/l,0),f.bindTechnique(this._blurTechnique,t,this._passParameters,this._drawParameters),f.setViewport(0,0,u,m),f.screen.draw(),f.setViewport4fv(s.fullViewport),A.release(),T<1&&this.requestRender(_.C7.UPDATE),E}};(0,l._)([(0,m.MZ)()],z.prototype,"consumes",void 0),(0,l._)([(0,m.MZ)()],z.prototype,"produces",void 0),(0,l._)([(0,m.MZ)({constructOnly:!0})],z.prototype,"techniques",void 0),(0,l._)([(0,m.MZ)({constructOnly:!0})],z.prototype,"isEnabled",void 0),z=(0,l._)([(0,f.$)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],z);const V=.5;function G(e,t){const r=e.fragment;t.receiveAmbientOcclusion?(r.uniforms.add(new s.N("ssaoTex",((e,t)=>t.ssao?.getTexture()))),r.constants.add("blurSizePixelsInverse","float",1/F),r.code.add(a.H`float evaluateAmbientOcclusionInverse() {
574
+ vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0));
575
+ return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r;
576
+ }
577
+ float evaluateAmbientOcclusion() {
578
+ return 1.0 - evaluateAmbientOcclusionInverse();
579
+ }`)):r.code.add(a.H`float evaluateAmbientOcclusionInverse() { return 1.0; }
580
+ float evaluateAmbientOcclusion() { return 0.0; }`)}},8881:(e,t,r)=>{r.d(t,{kA:()=>M,a8:()=>E,eU:()=>S});var n=r(21818),o=r(38954),i=r(51850),a=r(87317),s=r(91829),l=r(59469),c=r(33079),d=r(71988),u=r(2597);function h(e,t){const r=e.fragment,n=void 0!==t.lightingSphericalHarmonicsOrder?t.lightingSphericalHarmonicsOrder:2;0===n?(r.uniforms.add(new c.t("lightingAmbientSH0",((e,t)=>(0,o.s)(m,t.lighting.sh.r[0],t.lighting.sh.g[0],t.lighting.sh.b[0])))),r.code.add(u.H`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
581
+ vec3 ambientLight = 0.282095 * lightingAmbientSH0;
582
+ return ambientLight * (1.0 - ambientOcclusion);
583
+ }`)):1===n?(r.uniforms.add(new d.E("lightingAmbientSH_R",((e,t)=>(0,a.s)(f,t.lighting.sh.r[0],t.lighting.sh.r[1],t.lighting.sh.r[2],t.lighting.sh.r[3]))),new d.E("lightingAmbientSH_G",((e,t)=>(0,a.s)(f,t.lighting.sh.g[0],t.lighting.sh.g[1],t.lighting.sh.g[2],t.lighting.sh.g[3]))),new d.E("lightingAmbientSH_B",((e,t)=>(0,a.s)(f,t.lighting.sh.b[0],t.lighting.sh.b[1],t.lighting.sh.b[2],t.lighting.sh.b[3])))),r.code.add(u.H`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
584
+ vec4 sh0 = vec4(
585
+ 0.282095,
586
+ 0.488603 * normal.x,
587
+ 0.488603 * normal.z,
588
+ 0.488603 * normal.y
589
+ );
590
+ vec3 ambientLight = vec3(
591
+ dot(lightingAmbientSH_R, sh0),
592
+ dot(lightingAmbientSH_G, sh0),
593
+ dot(lightingAmbientSH_B, sh0)
594
+ );
595
+ return ambientLight * (1.0 - ambientOcclusion);
596
+ }`)):2===n&&(r.uniforms.add(new c.t("lightingAmbientSH0",((e,t)=>(0,o.s)(m,t.lighting.sh.r[0],t.lighting.sh.g[0],t.lighting.sh.b[0]))),new d.E("lightingAmbientSH_R1",((e,t)=>(0,a.s)(f,t.lighting.sh.r[1],t.lighting.sh.r[2],t.lighting.sh.r[3],t.lighting.sh.r[4]))),new d.E("lightingAmbientSH_G1",((e,t)=>(0,a.s)(f,t.lighting.sh.g[1],t.lighting.sh.g[2],t.lighting.sh.g[3],t.lighting.sh.g[4]))),new d.E("lightingAmbientSH_B1",((e,t)=>(0,a.s)(f,t.lighting.sh.b[1],t.lighting.sh.b[2],t.lighting.sh.b[3],t.lighting.sh.b[4]))),new d.E("lightingAmbientSH_R2",((e,t)=>(0,a.s)(f,t.lighting.sh.r[5],t.lighting.sh.r[6],t.lighting.sh.r[7],t.lighting.sh.r[8]))),new d.E("lightingAmbientSH_G2",((e,t)=>(0,a.s)(f,t.lighting.sh.g[5],t.lighting.sh.g[6],t.lighting.sh.g[7],t.lighting.sh.g[8]))),new d.E("lightingAmbientSH_B2",((e,t)=>(0,a.s)(f,t.lighting.sh.b[5],t.lighting.sh.b[6],t.lighting.sh.b[7],t.lighting.sh.b[8])))),r.code.add(u.H`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
597
+ vec3 ambientLight = 0.282095 * lightingAmbientSH0;
598
+ vec4 sh1 = vec4(
599
+ 0.488603 * normal.x,
600
+ 0.488603 * normal.z,
601
+ 0.488603 * normal.y,
602
+ 1.092548 * normal.x * normal.y
603
+ );
604
+ vec4 sh2 = vec4(
605
+ 1.092548 * normal.y * normal.z,
606
+ 0.315392 * (3.0 * normal.z * normal.z - 1.0),
607
+ 1.092548 * normal.x * normal.z,
608
+ 0.546274 * (normal.x * normal.x - normal.y * normal.y)
609
+ );
610
+ ambientLight += vec3(
611
+ dot(lightingAmbientSH_R1, sh1),
612
+ dot(lightingAmbientSH_G1, sh1),
613
+ dot(lightingAmbientSH_B1, sh1)
614
+ );
615
+ ambientLight += vec3(
616
+ dot(lightingAmbientSH_R2, sh2),
617
+ dot(lightingAmbientSH_G2, sh2),
618
+ dot(lightingAmbientSH_B2, sh2)
619
+ );
620
+ return ambientLight * (1.0 - ambientOcclusion);
621
+ }`),t.pbrMode!==l.A9.Normal&&t.pbrMode!==l.A9.Schematic||r.code.add(u.H`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0);
622
+ vec3 calculateAmbientRadiance(float ambientOcclusion)
623
+ {
624
+ vec3 ambientLight = 1.2 * (0.282095 * lightingAmbientSH0) - 0.2;
625
+ return ambientLight *= (1.0 - ambientOcclusion) * skyTransmittance;
626
+ }`))}const m=(0,i.vt)(),f=(0,s.vt)();var p=r(3452),v=r(98619),g=r(22393),_=r(89786),x=r(39589),T=r(46263);class b extends x.n{constructor(e,t){super(e,"bool",T.c.Pass,((r,n,o)=>r.setUniform1b(e,t(n,o))))}}var y=r(20304);r(34727),(0,i.vt)();const A=.4;function E(e){e.constants.add("ambientBoostFactor","float",A)}function S(e){e.uniforms.add(new y.m("lightingGlobalFactor",((e,t)=>t.lighting.globalFactor)))}function M(e,t){const r=e.fragment;switch(e.include(p.n,t),t.pbrMode!==l.A9.Disabled&&e.include(g.c,t),e.include(h,t),e.include(_.p),r.code.add(u.H`
627
+ const float GAMMA_SRGB = 2.1;
628
+ const float INV_GAMMA_SRGB = 0.4761904;
629
+ ${t.pbrMode===l.A9.Disabled?"":"const vec3 GROUND_REFLECTANCE = vec3(0.2);"}
630
+ `),E(r),S(r),(0,v.Gc)(r),r.code.add(u.H`
631
+ float additionalDirectedAmbientLight(vec3 vPosWorld) {
632
+ float vndl = dot(${t.spherical?u.H`normalize(vPosWorld)`:u.H`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
633
+ return smoothstep(0.0, 1.0, clamp(vndl * 2.5, 0.0, 1.0));
634
+ }
635
+ `),(0,v.O4)(r),r.code.add(u.H`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
636
+ float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
637
+ return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
638
+ }`),t.pbrMode){case l.A9.Disabled:case l.A9.WaterOnIntegratedMesh:case l.A9.Water:e.include(v.qU),r.code.add(u.H`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight)
639
+ {
640
+ vec3 mainLighting = evaluateMainLighting(normalWorld, shadow);
641
+ vec3 ambientLighting = calculateAmbientIrradiance(normalWorld, ssao);
642
+ vec3 albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
643
+ vec3 totalLight = mainLighting + ambientLighting + additionalLight;
644
+ totalLight = min(totalLight, vec3(PI));
645
+ vec3 outColor = vec3((albedoLinear / PI) * totalLight);
646
+ return pow(outColor, vec3(INV_GAMMA_SRGB));
647
+ }`);break;case l.A9.Normal:case l.A9.Schematic:r.code.add(u.H`const float fillLightIntensity = 0.25;
648
+ const float horizonLightDiffusion = 0.4;
649
+ const float additionalAmbientIrradianceFactor = 0.02;
650
+ vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDir, vec3 normalGround, vec3 mrr, vec3 _emission, float additionalAmbientIrradiance)
651
+ {
652
+ vec3 viewDirection = -viewDir;
653
+ vec3 h = normalize(viewDirection + mainLightDirection);
654
+ PBRShadingInfo inputs;
655
+ inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
656
+ inputs.NdotV = clamp(abs(dot(normal, viewDirection)), 0.001, 1.0);
657
+ inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
658
+ inputs.VdotH = clamp(dot(viewDirection, h), 0.0, 1.0);
659
+ inputs.NdotNG = clamp(dot(normal, normalGround), -1.0, 1.0);
660
+ vec3 reflectedView = normalize(reflect(viewDirection, normal));
661
+ inputs.RdotNG = clamp(dot(reflectedView, normalGround), -1.0, 1.0);
662
+ inputs.albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
663
+ inputs.ssao = ssao;
664
+ inputs.metalness = mrr[0];
665
+ inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),r.code.add(u.H`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
666
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
667
+ inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),t.useFillLights?r.uniforms.add(new b("hasFillLights",((e,t)=>t.enableFillLights))):r.constants.add("hasFillLights","bool",!1),r.code.add(u.H`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]);
668
+ ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
669
+ inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
670
+ vec3 mainLightIrradianceComponent = inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
671
+ vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
672
+ vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
673
+ inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
674
+ inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),r.uniforms.add(new y.m("lightingSpecularStrength",((e,t)=>t.lighting.mainLight.specularStrength)),new y.m("lightingEnvironmentStrength",((e,t)=>t.lighting.mainLight.environmentStrength))),r.code.add(u.H`vec3 horizonRingDir = inputs.RdotNG * normalGround - reflectedView;
675
+ vec3 horizonRingH = normalize(viewDirection + horizonRingDir);
676
+ inputs.NdotH_Horizon = dot(normal, horizonRingH);
677
+ vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(inputs.NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
678
+ vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
679
+ vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance(ssao) + additionalLight;
680
+ float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotNG + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
681
+ inputs.skyRadianceToSurface = (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
682
+ inputs.groundRadianceToSurface = 0.5 * GROUND_REFLECTANCE * (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
683
+ inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE[1]);`),r.code.add(u.H`
684
+ vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
685
+ vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
686
+ vec3 emissionComponent = _emission == vec3(0.0) ? _emission : pow(_emission, vec3(GAMMA_SRGB));
687
+ vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent + emissionComponent;
688
+ ${t.pbrMode!==l.A9.Schematic||t.hasColorTexture?u.H`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs), vec3(INV_GAMMA_SRGB));`:u.H`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`}
689
+ return outColor;
690
+ }
691
+ `);break;case l.A9.Simplified:case l.A9.TerrainWithWater:e.include(v.qU),r.code.add(u.H`const float roughnessTerrain = 0.5;
692
+ const float specularityTerrain = 0.5;
693
+ const vec3 fresnelReflectionTerrain = vec3(0.04);
694
+ vec3 evaluatePBRSimplifiedLighting(vec3 n, vec3 c, float shadow, float ssao, vec3 al, vec3 vd, vec3 nup) {
695
+ vec3 viewDirection = -vd;
696
+ vec3 h = normalize(viewDirection + mainLightDirection);
697
+ float NdotL = clamp(dot(n, mainLightDirection), 0.001, 1.0);
698
+ float NdotV = clamp(abs(dot(n, viewDirection)), 0.001, 1.0);
699
+ float NdotH = clamp(dot(n, h), 0.0, 1.0);
700
+ float NdotNG = clamp(dot(n, nup), -1.0, 1.0);
701
+ vec3 albedoLinear = pow(c, vec3(GAMMA_SRGB));
702
+ float lightness = 0.3 * albedoLinear[0] + 0.5 * albedoLinear[1] + 0.2 * albedoLinear[2];
703
+ vec3 f0 = (0.85 * lightness + 0.15) * fresnelReflectionTerrain;
704
+ vec3 f90 = vec3(clamp(dot(f0, vec3(50.0 * 0.33)), 0.0, 1.0));
705
+ vec3 mainLightIrradianceComponent = (1. - shadow) * NdotL * mainLightIntensity;
706
+ vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(n, ssao) + al;
707
+ vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
708
+ vec3 indirectDiffuse = ((1.0 - NdotNG) * mainLightIrradianceComponent + (1.0 + NdotNG ) * ambientSky) * 0.5;
709
+ vec3 outDiffColor = albedoLinear * (1.0 - f0) * indirectDiffuse / PI;
710
+ vec3 mainLightRadianceComponent = normalDistribution(NdotH, roughnessTerrain) * mainLightIntensity;
711
+ vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, NdotV);
712
+ vec3 specularColor = f0 * dfg.x + f90 * dfg.y;
713
+ vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceComponent;
714
+ vec3 outColorLinear = outDiffColor + specularComponent;
715
+ vec3 outColor = pow(outColorLinear, vec3(INV_GAMMA_SRGB));
716
+ return outColor;
717
+ }`);break;default:(0,n.Xb)(t.pbrMode);case l.A9.COUNT:}}(0,i.vt)()},98619:(e,t,r)=>{r.d(t,{Gc:()=>i,O4:()=>a,qU:()=>s});var n=r(33079),o=r(2597);function i(e){e.uniforms.add(new n.t("mainLightDirection",((e,t)=>t.lighting.mainLight.direction)))}function a(e){e.uniforms.add(new n.t("mainLightIntensity",((e,t)=>t.lighting.mainLight.intensity)))}function s(e){i(e.fragment),a(e.fragment),e.fragment.code.add(o.H`vec3 evaluateMainLighting(vec3 normal_global, float shadowing) {
718
+ float dotVal = clamp(dot(normal_global, mainLightDirection), 0.0, 1.0);
719
+ return mainLightIntensity * ((1.0 - shadowing) * dotVal);
720
+ }`)}},51343:(e,t,r)=>{r.d(t,{Q:()=>a});var n=r(52540),o=r(2597),i=r(63761);function a(e,t){if(!t.multipassEnabled)return;e.fragment.include(n.E),e.fragment.uniforms.add(new i.N("terrainDepthTexture",((e,t)=>t.multipassTerrain.depth?.attachment)));const r=t.occlusionPass;e.fragment.code.add(o.H`
721
+ ${r?"bool":"void"} terrainDepthTest(float fragmentDepth) {
722
+ float depth = texelFetch(terrainDepthTexture, ivec2(gl_FragCoord.xy), 0).r;
723
+ float linearDepth = linearizeDepth(depth);
724
+ ${r?o.H`return fragmentDepth < linearDepth && depth < 1.0;`:o.H`
725
+ if(fragmentDepth ${t.cullAboveGround?">":"<="} linearDepth){
726
+ discard;
727
+ }`}
728
+ }`)}},62602:(e,t,r)=>{r.d(t,{W:()=>n,r:()=>s});var n,o,i=r(21818),a=r(2597);function s(e,t){const r=e.fragment;switch(r.code.add(a.H`struct ShadingNormalParameters {
729
+ vec3 normalView;
730
+ vec3 viewDirection;
731
+ } shadingParams;`),t.doubleSidedMode){case n.None:r.code.add(a.H`vec3 shadingNormal(ShadingNormalParameters params) {
732
+ return normalize(params.normalView);
733
+ }`);break;case n.View:r.code.add(a.H`vec3 shadingNormal(ShadingNormalParameters params) {
734
+ return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
735
+ }`);break;case n.WindingOrder:r.code.add(a.H`vec3 shadingNormal(ShadingNormalParameters params) {
736
+ return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
737
+ }`);break;default:(0,i.Xb)(t.doubleSidedMode);case n.COUNT:}}(o=n||(n={}))[o.None=0]="None",o[o.View=1]="View",o[o.WindingOrder=2]="WindingOrder",o[o.COUNT=3]="COUNT"},22393:(e,t,r)=>{r.d(t,{c:()=>s});var n=r(2597);function o(e){const t=e.fragment.code;t.add(n.H`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG)
738
+ {
739
+ return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5;
740
+ }`),t.add(n.H`float integratedRadiance(float cosTheta2, float roughness)
741
+ {
742
+ return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0);
743
+ }`),t.add(n.H`vec3 evaluateSpecularIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float RdotNG, float roughness)
744
+ {
745
+ float cosTheta2 = 1.0 - RdotNG * RdotNG;
746
+ float intRadTheta = integratedRadiance(cosTheta2, roughness);
747
+ float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta;
748
+ float sky = 2.0 - ground;
749
+ return (ground * ambientGround + sky * ambientSky) * 0.5;
750
+ }`)}var i=r(59469),a=r(89786);function s(e,t){const r=e.fragment.code;e.include(a.p),t.pbrMode!==i.A9.Normal&&t.pbrMode!==i.A9.Schematic&&t.pbrMode!==i.A9.Simplified&&t.pbrMode!==i.A9.TerrainWithWater||(r.add(n.H`float normalDistribution(float NdotH, float roughness)
751
+ {
752
+ float a = NdotH * roughness;
753
+ float b = roughness / (1.0 - NdotH * NdotH + a * a);
754
+ return b * b * INV_PI;
755
+ }`),r.add(n.H`const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
756
+ const vec4 c1 = vec4( 1.0, 0.0425, 1.040, -0.040);
757
+ const vec2 c2 = vec2(-1.04, 1.04);
758
+ vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
759
+ vec4 r = roughness * c0 + c1;
760
+ float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
761
+ return c2 * a004 + r.zw;
762
+ }`)),t.pbrMode!==i.A9.Normal&&t.pbrMode!==i.A9.Schematic||(e.include(o),r.add(n.H`struct PBRShadingInfo
763
+ {
764
+ float NdotL;
765
+ float NdotV;
766
+ float NdotH;
767
+ float VdotH;
768
+ float LdotH;
769
+ float NdotNG;
770
+ float RdotNG;
771
+ float NdotAmbDir;
772
+ float NdotH_Horizon;
773
+ vec3 skyRadianceToSurface;
774
+ vec3 groundRadianceToSurface;
775
+ vec3 skyIrradianceToSurface;
776
+ vec3 groundIrradianceToSurface;
777
+ float averageAmbientRadiance;
778
+ float ssao;
779
+ vec3 albedoLinear;
780
+ vec3 f0;
781
+ vec3 f90;
782
+ vec3 diffuseColor;
783
+ float metalness;
784
+ float roughness;
785
+ };`),r.add(n.H`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
786
+ vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotNG);
787
+ vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotNG, inputs.roughness);
788
+ vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
789
+ vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
790
+ vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
791
+ vec3 specularComponent = specularColor * indirectSpecular;
792
+ return (diffuseComponent + specularComponent);
793
+ }`),r.add(n.H`float gamutMapChanel(float x, vec2 p){
794
+ return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
795
+ }`),r.add(n.H`vec3 blackLevelSoftCompression(vec3 inColor, PBRShadingInfo inputs){
796
+ vec3 outColor;
797
+ vec2 p = vec2(0.02 * (inputs.averageAmbientRadiance), 0.0075 * (inputs.averageAmbientRadiance));
798
+ outColor.x = gamutMapChanel(inColor.x, p) ;
799
+ outColor.y = gamutMapChanel(inColor.y, p) ;
800
+ outColor.z = gamutMapChanel(inColor.z, p) ;
801
+ return outColor;
802
+ }`))}},59469:(e,t,r)=>{r.d(t,{A9:()=>n,_Z:()=>h});var n,o,i=r(99208),a=r(40710),s=r(33079),l=r(2597),c=r(15976),d=r(63761),u=r(46263);function h(e,t){const r=e.fragment,o=t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture;if(t.pbrMode===n.Normal&&o&&e.include(i.r,t),t.pbrMode!==n.Schematic)if(t.pbrMode!==n.Disabled){if(t.pbrMode===n.Normal){r.code.add(l.H`vec3 mrr;
803
+ vec3 emission;
804
+ float occlusion;`);const e=t.pbrTextureBindType;t.hasMetallicRoughnessTexture&&(r.uniforms.add(e===u.c.Pass?new d.N("texMetallicRoughness",(e=>e.textureMetallicRoughness)):new c.o("texMetallicRoughness",(e=>e.textureMetallicRoughness))),r.code.add(l.H`void applyMetallnessAndRoughness(vec2 uv) {
805
+ vec3 metallicRoughness = textureLookup(texMetallicRoughness, uv).rgb;
806
+ mrr[0] *= metallicRoughness.b;
807
+ mrr[1] *= metallicRoughness.g;
808
+ }`)),t.hasEmissionTexture&&(r.uniforms.add(e===u.c.Pass?new d.N("texEmission",(e=>e.textureEmissive)):new c.o("texEmission",(e=>e.textureEmissive))),r.code.add(l.H`void applyEmission(vec2 uv) {
809
+ emission *= textureLookup(texEmission, uv).rgb;
810
+ }`)),t.hasOcclusionTexture?(r.uniforms.add(e===u.c.Pass?new d.N("texOcclusion",(e=>e.textureOcclusion)):new c.o("texOcclusion",(e=>e.textureOcclusion))),r.code.add(l.H`void applyOcclusion(vec2 uv) {
811
+ occlusion *= textureLookup(texOcclusion, uv).r;
812
+ }
813
+ float getBakedOcclusion() {
814
+ return occlusion;
815
+ }`)):r.code.add(l.H`float getBakedOcclusion() { return 1.0; }`),e===u.c.Pass?r.uniforms.add(new s.t("emissionFactor",(e=>e.emissiveFactor)),new s.t("mrrFactors",(e=>e.mrrFactors))):r.uniforms.add(new a.W("emissionFactor",(e=>e.emissiveFactor)),new a.W("mrrFactors",(e=>e.mrrFactors))),r.code.add(l.H`
816
+ void applyPBRFactors() {
817
+ mrr = mrrFactors;
818
+ emission = emissionFactor;
819
+ occlusion = 1.0;
820
+
821
+ ${t.hasMetallicRoughnessTexture?l.H`applyMetallnessAndRoughness(${t.hasMetallicRoughnessTextureTransform?l.H`metallicRoughnessUV`:"vuv0"});`:""}
822
+
823
+ ${t.hasEmissionTexture?l.H`applyEmission(${t.hasEmissiveTextureTransform?l.H`emissiveUV`:"vuv0"});`:""}
824
+
825
+ ${t.hasOcclusionTexture?l.H`applyOcclusion(${t.hasOcclusionTextureTransform?l.H`occlusionUV`:"vuv0"});`:""}
826
+ }
827
+ `)}}else r.code.add(l.H`float getBakedOcclusion() { return 1.0; }`);else r.code.add(l.H`vec3 mrr = vec3(0.0, 0.6, 0.2);
828
+ vec3 emission = vec3(0.0);
829
+ float occlusion = 1.0;
830
+ void applyPBRFactors() {}
831
+ float getBakedOcclusion() { return 1.0; }`)}r(25634),(o=n||(n={}))[o.Disabled=0]="Disabled",o[o.Normal=1]="Normal",o[o.Schematic=2]="Schematic",o[o.Water=3]="Water",o[o.WaterOnIntegratedMesh=4]="WaterOnIntegratedMesh",o[o.Simplified=5]="Simplified",o[o.TerrainWithWater=6]="TerrainWithWater",o[o.COUNT=7]="COUNT"},89786:(e,t,r)=>{function n(e){const t=3.141592653589793,r=.3183098861837907;e.vertex.constants.add("PI","float",t),e.fragment.constants.add("PI","float",t),e.fragment.constants.add("LIGHT_NORMALIZATION","float",r),e.fragment.constants.add("INV_PI","float",r),e.fragment.constants.add("HALF_PI","float",1.570796326794897),e.fragment.constants.add("TWO_PI","float",6.28318530717958)}r.d(t,{p:()=>n})},25618:(e,t,r)=>{r.d(t,{Bz:()=>m,G:()=>h}),r(9093),r(51850);var n=r(80730),o=r(71988),i=r(93588),a=r(2597),s=r(39589),l=r(46263);class c extends s.n{constructor(e,t,r){super(e,"mat4",l.c.Draw,((r,n,o,i)=>r.setUniformMatrix4fv(e,t(n,o,i))),r)}}class d extends s.n{constructor(e,t,r){super(e,"mat4",l.c.Pass,((r,n,o)=>r.setUniformMatrix4fv(e,t(n,o))),r)}}var u=r(63761);function h(e,t){t.receiveShadows&&(e.fragment.uniforms.add(new d("shadowMapMatrix",((e,t)=>t.shadowMap.getShadowMapMatrices(e.origin)),4)),f(e))}function m(e,t){t.receiveShadows&&(e.fragment.uniforms.add(new c("shadowMapMatrix",((e,t)=>t.shadowMap.getShadowMapMatrices(e.origin)),4)),f(e))}function f(e){const t=e.fragment;t.include(n.U),t.uniforms.add(new u.N("shadowMap",((e,t)=>t.shadowMap.depthTexture)),new i.c("numCascades",((e,t)=>t.shadowMap.numCascades)),new o.E("cascadeDistances",((e,t)=>t.shadowMap.cascadeDistances))),t.code.add(a.H`int chooseCascade(float depth, out mat4 mat) {
832
+ vec4 distance = cascadeDistances;
833
+ int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3;
834
+ mat = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3];
835
+ return i;
836
+ }
837
+ vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
838
+ vec4 lv = mat * vec4(_vpos, 1.0);
839
+ lv.xy /= lv.w;
840
+ return 0.5 * lv.xyz + vec3(0.5);
841
+ }
842
+ vec2 cascadeCoordinates(int i, ivec2 textureSize, vec3 lvpos) {
843
+ float xScale = float(textureSize.y) / float(textureSize.x);
844
+ return vec2((float(i) + lvpos.x) * xScale, lvpos.y);
845
+ }
846
+ float readShadowMapDepth(ivec2 uv, sampler2D _depthTex) {
847
+ return rgba4ToFloat(texelFetch(_depthTex, uv, 0));
848
+ }
849
+ float posIsInShadow(ivec2 uv, vec3 lvpos, sampler2D _depthTex) {
850
+ return readShadowMapDepth(uv, _depthTex) < lvpos.z ? 1.0 : 0.0;
851
+ }
852
+ float filterShadow(vec2 uv, vec3 lvpos, ivec2 texSize, sampler2D _depthTex) {
853
+ vec2 st = fract(uv * vec2(texSize) + vec2(0.5));
854
+ ivec2 base = ivec2(uv * vec2(texSize) - vec2(0.5));
855
+ float s00 = posIsInShadow(ivec2(base.x, base.y), lvpos, _depthTex);
856
+ float s10 = posIsInShadow(ivec2(base.x + 1, base.y), lvpos, _depthTex);
857
+ float s11 = posIsInShadow(ivec2(base.x + 1, base.y + 1), lvpos, _depthTex);
858
+ float s01 = posIsInShadow(ivec2(base.x, base.y + 1), lvpos, _depthTex);
859
+ return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
860
+ }
861
+ float readShadowMap(const in vec3 _vpos, float _linearDepth) {
862
+ mat4 mat;
863
+ int i = chooseCascade(_linearDepth, mat);
864
+ if (i >= numCascades) { return 0.0; }
865
+ vec3 lvpos = lightSpacePosition(_vpos, mat);
866
+ if (lvpos.z >= 1.0 || lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) { return 0.0; }
867
+ ivec2 size = textureSize(shadowMap, 0);
868
+ vec2 uv = cascadeCoordinates(i, size, lvpos);
869
+ return filterShadow(uv, lvpos, size, shadowMap);
870
+ }`)}a.Y,a.Y},51406:(e,t,r)=>{r.d(t,{MU:()=>c,O1:()=>d,QM:()=>u,Sx:()=>l,q2:()=>s});var n=r(29242),o=r(53466),i=r(2597),a=r(35644);function s(e,t){t.hasColorTextureTransform?(e.varyings.add("colorUV","vec2"),e.vertex.uniforms.add(new a.k("colorTextureTransformMatrix",(e=>e.colorTextureTransformMatrix??n.zK))).code.add(i.H`void forwardColorUV(){
871
+ colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
872
+ }`)):e.vertex.code.add(i.H`void forwardColorUV(){}`)}function l(e,t){t.hasNormalTextureTransform&&t.textureCoordinateType!==o.q.None?(e.varyings.add("normalUV","vec2"),e.vertex.uniforms.add(new a.k("normalTextureTransformMatrix",(e=>e.normalTextureTransformMatrix??n.zK))).code.add(i.H`void forwardNormalUV(){
873
+ normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
874
+ }`)):e.vertex.code.add(i.H`void forwardNormalUV(){}`)}function c(e,t){t.hasEmissionTextureTransform&&t.textureCoordinateType!==o.q.None?(e.varyings.add("emissiveUV","vec2"),e.vertex.uniforms.add(new a.k("emissiveTextureTransformMatrix",(e=>e.emissiveTextureTransformMatrix??n.zK))).code.add(i.H`void forwardEmissiveUV(){
875
+ emissiveUV = (emissiveTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
876
+ }`)):e.vertex.code.add(i.H`void forwardEmissiveUV(){}`)}function d(e,t){t.hasOcclusionTextureTransform&&t.textureCoordinateType!==o.q.None?(e.varyings.add("occlusionUV","vec2"),e.vertex.uniforms.add(new a.k("occlusionTextureTransformMatrix",(e=>e.occlusionTextureTransformMatrix??n.zK))).code.add(i.H`void forwardOcclusionUV(){
877
+ occlusionUV = (occlusionTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
878
+ }`)):e.vertex.code.add(i.H`void forwardOcclusionUV(){}`)}function u(e,t){t.hasMetallicRoughnessTextureTransform&&t.textureCoordinateType!==o.q.None?(e.varyings.add("metallicRoughnessUV","vec2"),e.vertex.uniforms.add(new a.k("metallicRoughnessTextureTransformMatrix",(e=>e.metallicRoughnessTextureTransformMatrix??n.zK))).code.add(i.H`void forwardMetallicRoughnessUV(){
879
+ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
880
+ }`)):e.vertex.code.add(i.H`void forwardMetallicRoughnessUV(){}`)}},986:(e,t,r)=>{r.d(t,{A:()=>y});var n=r(33079),o=r(39589),i=r(46263);class a extends o.n{constructor(e,t,r){super(e,"vec4",i.c.Pass,((r,n,o)=>r.setUniform4fv(e,t(n,o))),r)}}class s extends o.n{constructor(e,t,r){super(e,"float",i.c.Pass,((r,n,o)=>r.setUniform1fv(e,t(n,o))),r)}}var l=r(2597),c=r(35644),d=r(46540),u=(r(44208),r(34727),r(77690),r(29242),r(58083),r(9093)),h=(r(38954),r(51850)),m=(r(31756),r(90237)),f=r(69622),p=r(10107),v=(r(53966),r(87811),r(40608));let g=class extends f.A{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.TESTS_DISABLE_OPTIMIZATIONS=!1,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1}};var _,x,T;(0,m._)([(0,p.MZ)()],g.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"DECONFLICTOR_SHOW_GRID",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"LABELS_SHOW_BORDER",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"TEXT_SHOW_BASELINE",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"TEXT_SHOW_BORDER",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"OVERLAY_SHOW_CENTER",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"SHOW_POI",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"TESTS_DISABLE_OPTIMIZATIONS",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"I3S_TREE_SHOW_TILES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"I3S_SHOW_MODIFICATIONS",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),(0,m._)([(0,p.MZ)()],g.prototype,"LINE_WIREFRAMES",void 0),g=(0,m._)([(0,v.$)("esri.views.3d.support.debugFlags")],g),new g,(T=_||(_={}))[T.Undefined=0]="Undefined",T[T.DefinedSize=1]="DefinedSize",T[T.DefinedScale=2]="DefinedScale",function(e){e[e.Undefined=0]="Undefined",e[e.DefinedAngle=1]="DefinedAngle"}(x||(x={})),l.Y,(0,u.vt)(),(0,h.vt)(),(0,u.vt)(),r(14903);const b=8;function y(e,t){const{vertex:r,attributes:o}=e;t.hasVvInstancing&&(t.vvSize||t.vvColor)&&o.add(d.r.INSTANCEFEATUREATTRIBUTE,"vec4"),t.vvSize?(r.uniforms.add(new n.t("vvSizeMinSize",(e=>e.vvSize.minSize))),r.uniforms.add(new n.t("vvSizeMaxSize",(e=>e.vvSize.maxSize))),r.uniforms.add(new n.t("vvSizeOffset",(e=>e.vvSize.offset))),r.uniforms.add(new n.t("vvSizeFactor",(e=>e.vvSize.factor))),r.uniforms.add(new c.k("vvSymbolRotationMatrix",(e=>e.vvSymbolRotationMatrix))),r.uniforms.add(new n.t("vvSymbolAnchor",(e=>e.vvSymbolAnchor))),r.code.add(l.H`vec3 vvScale(vec4 _featureAttribute) {
881
+ return clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize);
882
+ }
883
+ vec4 vvTransformPosition(vec3 position, vec4 _featureAttribute) {
884
+ return vec4(vvSymbolRotationMatrix * ( vvScale(_featureAttribute) * (position + vvSymbolAnchor)), 1.0);
885
+ }`),r.code.add(l.H`
886
+ const float eps = 1.192092896e-07;
887
+ vec4 vvTransformNormal(vec3 _normal, vec4 _featureAttribute) {
888
+ vec3 vvScale = clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize + eps, vvSizeMaxSize);
889
+ return vec4(vvSymbolRotationMatrix * _normal / vvScale, 1.0);
890
+ }
891
+
892
+ ${t.hasVvInstancing?l.H`
893
+ vec4 vvLocalNormal(vec3 _normal) {
894
+ return vvTransformNormal(_normal, instanceFeatureAttribute);
895
+ }
896
+
897
+ vec4 localPosition() {
898
+ return vvTransformPosition(position, instanceFeatureAttribute);
899
+ }`:""}
900
+ `)):r.code.add(l.H`vec4 localPosition() { return vec4(position, 1.0); }
901
+ vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),t.vvColor?(r.constants.add("vvColorNumber","int",b),r.uniforms.add(new s("vvColorValues",(e=>e.vvColor.values),b),new a("vvColorColors",(e=>e.vvColor.colors),b)),r.code.add(l.H`
902
+ vec4 interpolateVVColor(float value) {
903
+ if (value <= vvColorValues[0]) {
904
+ return vvColorColors[0];
905
+ }
906
+
907
+ for (int i = 1; i < vvColorNumber; ++i) {
908
+ if (vvColorValues[i] >= value) {
909
+ float f = (value - vvColorValues[i-1]) / (vvColorValues[i] - vvColorValues[i-1]);
910
+ return mix(vvColorColors[i-1], vvColorColors[i], f);
911
+ }
912
+ }
913
+ return vvColorColors[vvColorNumber - 1];
914
+ }
915
+
916
+ vec4 vvGetColor(vec4 featureAttribute) {
917
+ return interpolateVVColor(featureAttribute.y);
918
+ }
919
+
920
+ ${t.hasVvInstancing?l.H`
921
+ vec4 vvColor() {
922
+ return vvGetColor(instanceFeatureAttribute);
923
+ }`:"vec4 vvColor() { return vec4(1.0); }"}
924
+ `)):r.code.add(l.H`vec4 vvColor() { return vec4(1.0); }`)}},35093:(e,t,r)=>{r.d(t,{Q:()=>n});const n=1/256},34845:(e,t,r)=>{r.d(t,{Ir:()=>d});var n=r(37585),o=r(48163),i=r(87317),a=r(91829),s=r(47286),l=r(71988),c=r(2597);function d(e){e.fragment.uniforms.add(new l.E("projInfo",((e,t)=>function(e){const t=e.projectionMatrix;return 0===t[11]?(0,i.s)(u,2/(e.fullWidth*t[0]),2/(e.fullHeight*t[5]),(1+t[12])/t[0],(1+t[13])/t[5]):(0,i.s)(u,-2/(e.fullWidth*t[0]),-2/(e.fullHeight*t[5]),(1-t[8])/t[0],(1-t[9])/t[5])}(t.camera)))),e.fragment.uniforms.add(new s.G("zScale",((e,t)=>function(e){return 0===e.projectionMatrix[11]?(0,n.hZ)(h,0,1):(0,n.hZ)(h,1,0)}(t.camera)))),e.fragment.code.add(c.H`vec3 reconstructPosition(vec2 fragCoord, float depth) {
925
+ return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth);
926
+ }`)}const u=(0,a.vt)(),h=(0,o.vt)()},63365:(e,t,r)=>{r.d(t,{a:()=>o});var n=r(2597);function o(e){e.code.add(n.H`vec4 premultiplyAlpha(vec4 v) {
927
+ return vec4(v.rgb * v.a, v.a);
928
+ }
929
+ vec3 rgb2hsv(vec3 c) {
930
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
931
+ vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
932
+ vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
933
+ float d = q.x - min(q.w, q.y);
934
+ float e = 1.0e-10;
935
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);
936
+ }
937
+ vec3 hsv2rgb(vec3 c) {
938
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
939
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
940
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
941
+ }
942
+ float rgb2v(vec3 c) {
943
+ return max(c.x, max(c.y, c.z));
944
+ }`)}},11955:(e,t,r)=>{r.d(t,{S:()=>l});var n=r(35093),o=r(39589);r(46263),o.n;var i=r(20304),a=r(2597),s=r(89192);function l(e,t){!function(e,t,r){const o=e.fragment;switch(t.alphaDiscardMode){case s.sf.Blend:e.fragment.code.add(a.H`
945
+ #define discardOrAdjustAlpha(color) { if (color.a < ${a.H.float(n.Q)}) { discard; } }
946
+ `);break;case s.sf.Opaque:o.code.add(a.H`void discardOrAdjustAlpha(inout vec4 color) {
947
+ color.a = 1.0;
948
+ }`);break;case s.sf.Mask:o.uniforms.add(r).code.add(a.H`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`);break;case s.sf.MaskBlend:o.uniforms.add(r).code.add(a.H`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`)}}(e,t,new i.m("textureAlphaCutoff",(e=>e.textureAlphaCutoff)))}},26425:(e,t,r)=>{r.d(t,{u:()=>o});var n=r(2597);function o({code:e},t){t.doublePrecisionRequiresObfuscation?e.add(n.H`vec3 dpPlusFrc(vec3 a, vec3 b) {
949
+ return mix(a, a + b, vec3(notEqual(b, vec3(0))));
950
+ }
951
+ vec3 dpMinusFrc(vec3 a, vec3 b) {
952
+ return mix(vec3(0), a - b, vec3(notEqual(a, b)));
953
+ }
954
+ vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
955
+ vec3 t1 = dpPlusFrc(hiA, hiB);
956
+ vec3 e = dpMinusFrc(t1, hiA);
957
+ vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;
958
+ return t1 + t2;
959
+ }`):e.add(n.H`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
960
+ vec3 t1 = hiA + hiB;
961
+ vec3 e = t1 - hiA;
962
+ vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;
963
+ return t1 + t2;
964
+ }`)}},27950:(e,t,r)=>{r.d(t,{N:()=>a});var n=r(66104),o=r(63365),i=r(2597);function a(e){e.include(o.a),e.code.add(i.H`
965
+ vec3 mixExternalColor(vec3 internalColor, vec3 textureColor, vec3 externalColor, int mode) {
966
+ // workaround for artifacts in OSX using Intel Iris Pro
967
+ // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
968
+ vec3 internalMixed = internalColor * textureColor;
969
+ vec3 allMixed = internalMixed * externalColor;
970
+
971
+ if (mode == ${i.H.int(n.k5.Multiply)}) {
972
+ return allMixed;
973
+ }
974
+ if (mode == ${i.H.int(n.k5.Ignore)}) {
975
+ return internalMixed;
976
+ }
977
+ if (mode == ${i.H.int(n.k5.Replace)}) {
978
+ return externalColor;
979
+ }
980
+
981
+ // tint (or something invalid)
982
+ float vIn = rgb2v(internalMixed);
983
+ vec3 hsvTint = rgb2hsv(externalColor);
984
+ vec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z);
985
+ return hsv2rgb(hsvOut);
986
+ }
987
+
988
+ float mixExternalOpacity(float internalOpacity, float textureOpacity, float externalOpacity, int mode) {
989
+ // workaround for artifacts in OSX using Intel Iris Pro
990
+ // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
991
+ float internalMixed = internalOpacity * textureOpacity;
992
+ float allMixed = internalMixed * externalOpacity;
993
+
994
+ if (mode == ${i.H.int(n.k5.Ignore)}) {
995
+ return internalMixed;
996
+ }
997
+ if (mode == ${i.H.int(n.k5.Replace)}) {
998
+ return externalOpacity;
999
+ }
1000
+
1001
+ // multiply or tint (or something invalid)
1002
+ return allMixed;
1003
+ }
1004
+ `)}},80730:(e,t,r)=>{r.d(t,{U:()=>o});var n=r(2597);function o(e){e.code.add(n.H`const float MAX_RGBA4_FLOAT =
1005
+ 15.0 / 16.0 +
1006
+ 15.0 / 16.0 / 16.0 +
1007
+ 15.0 / 16.0 / 16.0 / 16.0 +
1008
+ 15.0 / 16.0 / 16.0 / 16.0 / 16.0;
1009
+ const vec4 FIXED_POINT_FACTORS_RGBA4 = vec4(1.0, 16.0, 16.0 * 16.0, 16.0 * 16.0 * 16.0);
1010
+ vec4 floatToRgba4(const float value) {
1011
+ float valueInValidDomain = clamp(value, 0.0, MAX_RGBA4_FLOAT);
1012
+ vec4 fixedPointU4 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS_RGBA4) * 16.0);
1013
+ const float toU4AsFloat = 1.0 / 15.0;
1014
+ return fixedPointU4 * toU4AsFloat;
1015
+ }
1016
+ const vec4 RGBA4_2_FLOAT_FACTORS = vec4(
1017
+ 15.0 / (16.0),
1018
+ 15.0 / (16.0 * 16.0),
1019
+ 15.0 / (16.0 * 16.0 * 16.0),
1020
+ 15.0 / (16.0 * 16.0 * 16.0 * 16.0)
1021
+ );
1022
+ float rgba4ToFloat(vec4 rgba) {
1023
+ return dot(rgba, RGBA4_2_FLOAT_FACTORS);
1024
+ }`)}},26835:(e,t,r)=>{r(2597)},20693:(e,t,r)=>{r.d(t,{yu:()=>m,NB:()=>f,S7:()=>g});var n=r(58083),o=r(9093),i=r(38954),a=r(51850),s=r(40710),l=r(33079),c=(r(20304),r(39589)),d=r(46263);class u extends c.n{constructor(e,t){super(e,"mat4",d.c.Draw,((r,n,o)=>r.setUniformMatrix4fv(e,t(n,o))))}}var h=r(40095);function m(e,t){t.instancedDoublePrecision?e.constants.add("cameraPosition","vec3",a.uY):e.uniforms.add(new s.W("cameraPosition",((e,t)=>(0,i.s)(v,t.camera.viewInverseTransposeMatrix[3]-e.origin[0],t.camera.viewInverseTransposeMatrix[7]-e.origin[1],t.camera.viewInverseTransposeMatrix[11]-e.origin[2]))))}function f(e,t){if(!t.instancedDoublePrecision)return void e.uniforms.add(new h.X("proj",((e,t)=>t.camera.projectionMatrix)),new u("view",((e,t)=>(0,n.Tl)(p,t.camera.viewMatrix,e.origin))),new s.W("localOrigin",(e=>e.origin)));const r=e=>(0,i.s)(v,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]);e.uniforms.add(new h.X("proj",((e,t)=>t.camera.projectionMatrix)),new h.X("view",((e,t)=>(0,n.Tl)(p,t.camera.viewMatrix,r(t)))),new l.t("localOrigin",((e,t)=>r(t))))}const p=(0,o.vt)(),v=(0,a.vt)();function g(e){e.uniforms.add(new h.X("viewNormal",((e,t)=>t.camera.viewInverseTransposeMatrix)))}},68259:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"vec2",o.c.Draw,((r,n,o,i)=>r.setUniform2fv(e,t(n,o,i))))}}},47286:(e,t,r)=>{r.d(t,{G:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"vec2",o.c.Pass,((r,n,o)=>r.setUniform2fv(e,t(n,o))))}}},40710:(e,t,r)=>{r.d(t,{W:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"vec3",o.c.Draw,((r,n,o,i)=>r.setUniform3fv(e,t(n,o,i))))}}},33079:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"vec3",o.c.Pass,((r,n,o)=>r.setUniform3fv(e,t(n,o))))}}},71988:(e,t,r)=>{r.d(t,{E:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"vec4",o.c.Pass,((r,n,o)=>r.setUniform4fv(e,t(n,o))))}}},20304:(e,t,r)=>{r.d(t,{m:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"float",o.c.Pass,((r,n,o)=>r.setUniform1f(e,t(n,o))))}}},93588:(e,t,r)=>{r.d(t,{c:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"int",o.c.Pass,((r,n,o)=>r.setUniform1i(e,t(n,o))))}}},98353:(e,t,r)=>{r.d(t,{h:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"mat3",o.c.Draw,((r,n,o)=>r.setUniformMatrix3fv(e,t(n,o))))}}},35644:(e,t,r)=>{r.d(t,{k:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"mat3",o.c.Pass,((r,n,o)=>r.setUniformMatrix3fv(e,t(n,o))))}}},40095:(e,t,r)=>{r.d(t,{X:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"mat4",o.c.Pass,((r,n,o)=>r.setUniformMatrix4fv(e,t(n,o))))}}},85977:(e,t,r)=>{r.d(t,{N5:()=>l});var n=r(49186),o=(r(44208),r(53966)),i=r(46263),a=r(620);class s{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class l extends s{constructor(){super(...arguments),this.vertex=new h,this.fragment=new h,this.attributes=new m,this.varyings=new f,this.extensions=new p,this.constants=new g,this.outputs=new v}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){const t=this.extensions.generateSource(e),r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),o="vertex"===e?this.vertex:this.fragment,i=o.uniforms.generateSource(),a=o.code.generateSource(),s=o.main.generateSource(),l="vertex"===e?x:_,c=this.constants.generateSource().concat(o.constants.generateSource()),d=this.outputs.generateSource(e);return`#version 300 es\n${t.join("\n")}\n\n${l}\n\n${c.join("\n")}\n\n${i.join("\n")}\n\n${r.join("\n")}\n\n${n.join("\n")}\n\n${d.join("\n")}\n\n${a.join("\n")}\n\n${s.join("\n")}`}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const r=e.bind[i.c.Pass];r&&t.set(e.name,r)})),this.fragment.uniforms.entries.forEach((e=>{const r=e.bind[i.c.Pass];r&&t.set(e.name,r)}));const r=Array.from(t.values()),n=r.length;return(t,o)=>{for(let i=0;i<n;++i)r[i](e,t,o)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const r=e.bind[i.c.Draw];r&&t.set(e.name,r)})),this.fragment.uniforms.entries.forEach((e=>{const r=e.bind[i.c.Draw];r&&t.set(e.name,r)}));const r=Array.from(t.values()),n=r.length;return(t,o,i)=>{for(let a=0;a<n;++a)r[a](e,i,t,o)}}}class c{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(e){if(null!=e){if(this._entries.has(e.name)&&!this._entries.get(e.name).equals(e))throw new n.A(`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else o.A.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder").error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((e=>null!=e.arraySize?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`))}get entries(){return Array.from(this._entries.values())}}class d{constructor(e){this._stage=e,this._entry=null}add(e){return this._entry={header:{out:"void"},body:e},this._stage}addWithHeader(e,t){return this._entry={header:e,body:t},this._stage}generateSource(){return this._entry?[`void main() {\n ${this._entry.body||""} \n}`]:[]}}class u{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class h extends s{constructor(){super(...arguments),this.uniforms=new c(this),this.main=new d(this),this.code=new u(this),this.constants=new g}get builder(){return this}}class m{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class f{constructor(){this._entries=new Map}add(e,t){this._entries.has(e)&&(0,a.vA)(this._entries.get(e)===t),this._entries.set(e,t)}generateSource(e){const t=new Array;return this._entries.forEach(((r,n)=>t.push("vertex"===e?`out ${r} ${n};`:`in ${r} ${n};`))),t}}class p{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?p.ALLOWLIST_VERTEX:p.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>t.includes(e))).map((e=>`#extension ${e} : enable`))}}p.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],p.ALLOWLIST_VERTEX=[];class v{constructor(){this._entries=new Map}add(e,t,r=0){const n=this._entries.get(r);n?(0,a.vA)(n.name===e&&n.type===t,`Fragment shader output location ${r} occupied`):this._entries.set(r,{name:e,type:t})}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:v.DEFAULT_NAME,type:v.DEFAULT_TYPE});const t=new Array;return this._entries.forEach(((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`))),t}}v.DEFAULT_TYPE="vec4",v.DEFAULT_NAME="fragColor";class g{constructor(){this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=g._numberToFloatStr(r);break;case"int":n=g._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])}, ${g._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])}, ${g._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,(e=>g._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const _="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump sampler2D;\n#endif",x="precision highp float;\nprecision highp sampler2D;"},15976:(e,t,r)=>{r.d(t,{o:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"sampler2D",o.c.Draw,((r,n,o)=>r.bindTexture(e,t(n,o))))}}},63761:(e,t,r)=>{r.d(t,{N:()=>i});var n=r(39589),o=r(46263);class i extends n.n{constructor(e,t){super(e,"sampler2D",o.c.Pass,((r,n,o)=>r.bindTexture(e,t(n,o))))}}},39589:(e,t,r)=>{r.d(t,{n:()=>o});var n=r(46263);class o{constructor(e,t,r,o,i=null){if(this.name=e,this.type=t,this.arraySize=i,this.bind={[n.c.Pass]:null,[n.c.Draw]:null},o)switch(r){case n.c.Pass:this.bind[n.c.Pass]=o;break;case n.c.Draw:this.bind[n.c.Draw]=o}}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}}},2597:(e,t,r)=>{r.d(t,{H:()=>o,Y:()=>n});const n=class{};function o(e,...t){let r="";for(let n=0;n<t.length;n++)r+=e[n]+t[n];return r+=e[e.length-1],r}var i;(i=o||(o={})).int=function(e){return Math.round(e).toString()},i.float=function(e){return e.toPrecision(8)}},97220:(e,t,r)=>{r.d(t,{$:()=>n});class n{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}},84867:(e,t,r)=>{r.d(t,{w:()=>i});var n=r(97768),o=r(63907);class i{constructor(e,t,r){this.release=r,this.initializeConfiguration(e,t),this._configuration=t.snapshot(),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e)}destroy(){this._program=(0,n.WD)(this._program),this._pipeline=this._configuration=null}reload(e){(0,n.WD)(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e)}get program(){return this._program}get compiled(){return this.program.compiled}get key(){return this._configuration.key}get configuration(){return this._configuration}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return o.WR.TRIANGLES}getPipeline(e,t,r){return this._pipeline}initializeConfiguration(e,t){}}},99769:(e,t,r)=>{r.d(t,{K:()=>i,W:()=>a});var n=r(49186),o=r(2597);class i extends o.Y{constructor(){super(),this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map((()=>0)):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,t={key:this.key};for(const r of e)t[r]=this[r];return t}}function a(e={}){return(t,r)=>{if(t._parameterNames=t._parameterNames??[],t._parameterNames.push(r),null!=e.constValue)Object.defineProperty(t,r,{get:()=>e.constValue});else{const o=t._parameterNames.length-1,i=e.count||2,a=Math.ceil(Math.log2(i)),s=t._parameterBits??[0];let l=0;for(;s[l]+a>16;)l++,l>=s.length&&s.push(0);t._parameterBits=s;const c=s[l],d=(1<<a)-1<<c;s[l]+=a,Object.defineProperty(t,r,{get(){return this[o]},set(t){if(this[o]!==t)if(this[o]=t,this._keyDirty=!0,this._parameterBits[l]=this._parameterBits[l]&~d|+t<<c&d,"number"==typeof t){if(null==e.count)throw new n.A(`Configuration value for ${r} must provide a count option`)}else if("boolean"!=typeof t)throw new n.A(`Configuration value for ${r} must be boolean or number, got ${typeof t}`)}})}}}},69720:(e,t,r)=>{r.d(t,{J:()=>o});var n=r(24326);class o{constructor(){this.id=(0,n.c)()}}},96672:(e,t,r)=>{var n;r.d(t,{X:()=>n}),function(e){e[e.Layer=0]="Layer",e[e.Object=1]="Object",e[e.Mesh=2]="Mesh",e[e.Line=3]="Line",e[e.Point=4]="Point",e[e.Material=5]="Material",e[e.Texture=6]="Texture",e[e.COUNT=7]="COUNT"}(n||(n={}))},39341:(e,t,r)=>{r.d(t,{D:()=>o});var n=r(46540);const o=new Map([[n.r.POSITION,0],[n.r.NORMAL,1],[n.r.NORMALCOMPRESSED,1],[n.r.UV0,2],[n.r.COLOR,3],[n.r.COLORFEATUREATTRIBUTE,3],[n.r.SIZE,4],[n.r.TANGENT,4],[n.r.CENTEROFFSETANDDISTANCE,5],[n.r.SYMBOLCOLOR,5],[n.r.FEATUREATTRIBUTE,6],[n.r.INSTANCEFEATUREATTRIBUTE,6],[n.r.INSTANCECOLOR,7],[n.r.OBJECTANDLAYERIDCOLOR,7],[n.r.INSTANCEOBJECTANDLAYERIDCOLOR,7],[n.r.INSTANCEMODEL,8],[n.r.INSTANCEMODELNORMAL,12],[n.r.INSTANCEMODELORIGINHI,11],[n.r.INSTANCEMODELORIGINLO,15]])},25634:(e,t,r)=>{r.d(t,{m:()=>l});var n=r(97768),o=r(74887),i=r(2597),a=r(89192);class s{constructor(e){this._material=e.material,this._techniques=e.techniques,this._output=e.output}dispose(){this._techniques.release(this._technique)}get technique(){return this._technique}get _stippleTextures(){return this._techniques.constructionContext.stippleTextures}get _markerTextures(){return this._techniques.constructionContext.markerTextures}ensureTechnique(e,t){return this._technique=this._techniques.releaseAndAcquire(e,this._material.getConfiguration(this._output,t),this._technique),this._technique}ensureResources(e){return a.Am.LOADED}}class l extends s{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this._textureId=e.textureId,this._acquire(e.textureId,(e=>this._texture=e)),this._acquire(e.normalTextureId,(e=>this._textureNormal=e)),this._acquire(e.emissiveTextureId,(e=>this._textureEmissive=e)),this._acquire(e.occlusionTextureId,(e=>this._textureOcclusion=e)),this._acquire(e.metallicRoughnessTextureId,(e=>this._textureMetallicRoughness=e))}dispose(){this._texture=(0,n.Gz)(this._texture),this._textureNormal=(0,n.Gz)(this._textureNormal),this._textureEmissive=(0,n.Gz)(this._textureEmissive),this._textureOcclusion=(0,n.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,n.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?a.Am.LOADED:a.Am.LOADING}get textureBindParameters(){return new c(null!=this._texture?this._texture.glTexture:null,null!=this._textureNormal?this._textureNormal.glTexture:null,null!=this._textureEmissive?this._textureEmissive.glTexture:null,null!=this._textureOcclusion?this._textureOcclusion.glTexture:null,null!=this._textureMetallicRoughness?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,n.Gz)(this._texture),this._textureId=e,this._acquire(this._textureId,(e=>this._texture=e)))}_acquire(e,t){if(null==e)return void t(null);const r=this._textures.acquire(e);if((0,o.$X)(r))return++this._numLoading,void r.then((e=>{if(this._disposed)return(0,n.Gz)(e),void t(null);t(e)})).finally((()=>--this._numLoading));t(r)}}class c extends i.Y{constructor(e=null,t=null,r=null,n=null,o=null,i,a){super(),this.texture=e,this.textureNormal=t,this.textureEmissive=r,this.textureOcclusion=n,this.textureMetallicRoughness=o,this.scale=i,this.normalTextureTransformMatrix=a}}},14903:(e,t,r)=>{r.d(t,{im:()=>h,m$:()=>n});var n,o,i=r(51850),a=r(2597),s=r(89192),l=r(69720),c=r(96672),d=r(39341),u=r(13752);class h extends l.J{constructor(e,t){super(),this.type=c.X.Material,this.supportsEdges=!1,this._renderPriority=0,this._vertexAttributeLocations=d.D,this._pp0=(0,i.fA)(0,0,1),this._pp1=(0,i.fA)(0,0,0),this._parameters=new t,(0,u.MB)(this._parameters,e),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,u.MB)(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this.parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bindParameters.decorations===s.ID.ON)&&!!(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}parametersChanged(){this.repository?.materialChanged(this)}queryRenderOccludedState(e){return this.visible&&this.parameters.renderOccluded===e}intersectDraped(e,t,r,n,o,i){return this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this.intersect(e,t,r,this._pp0,this._pp1,o)}}(o=n||(n={}))[o.None=0]="None",o[o.Occlude=1]="Occlude",o[o.Transparent=2]="Transparent",o[o.OccludeAndTransparent=4]="OccludeAndTransparent",o[o.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",o[o.Opaque=16]="Opaque",a.Y},34886:(e,t,r)=>{r.d(t,{B:()=>i});var n=r(3694),o=r(94656);class i{constructor(e,t,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new n.A({deallocator:null}),this._glProgram=e.programCache.acquire(t.generate("vertex"),t.generate("fragment"),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=t.generateBindPass(this),this.bindDraw=t.generateBindDraw(this),this._fragmentUniforms=(0,o.en)()?t.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(e,t){this._glProgram.setUniform1i(e,t?1:0)}setUniform1i(e,t){this._glProgram.setUniform1i(e,t)}setUniform1f(e,t){this._glProgram.setUniform1f(e,t)}setUniform2fv(e,t){this._glProgram.setUniform2fv(e,t)}setUniform3fv(e,t){this._glProgram.setUniform3fv(e,t)}setUniform4fv(e,t){this._glProgram.setUniform4fv(e,t)}setUniformMatrix3fv(e,t){this._glProgram.setUniformMatrix3fv(e,t)}setUniformMatrix4fv(e,t){this._glProgram.setUniformMatrix4fv(e,t)}setUniform1fv(e,t){this._glProgram.setUniform1fv(e,t)}setUniform1iv(e,t){this._glProgram.setUniform1iv(e,t)}setUniform2iv(e,t){this._glProgram.setUniform2iv(e,t)}setUniform3iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform4iv(e,t){this._glProgram.setUniform4iv(e,t)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if(null==t?.glName){const t=this._textures.get(e);return t&&(this._context.bindTexture(null,t.unit),this._freeTextureUnit(t),this._textures.delete(e)),null}let r=this._textures.get(e);return null==r?(r=this._allocTextureUnit(t),this._textures.set(e,r)):r.texture=t,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(t,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)})),this._fragmentUniforms?.forEach((e=>{"sampler2D"!==e.type&&"samplerCube"!==e.type||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)}))}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}},14327:(e,t,r)=>{var n;r.d(t,{y:()=>n}),function(e){e[e.ColorAlpha=0]="ColorAlpha",e[e.FrontFace=1]="FrontFace",e[e.NONE=2]="NONE",e[e.COUNT=3]="COUNT"}(n||(n={}))},89192:(e,t,r)=>{var n,o,i,a,s,l,c,d,u;r.d(t,{Am:()=>a,C7:()=>i,ID:()=>d,JS:()=>u,Mg:()=>l,dd:()=>s,it:()=>o,s2:()=>n,sf:()=>c}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(n||(n={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(o||(o={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(i||(i={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(a||(a={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(s||(s={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee",e[e.COUNT=2]="COUNT"}(l||(l={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(c||(c={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON"}(d||(d={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(u||(u={}))},61765:(e,t,r)=>{r.d(t,{T:()=>n});const n=2.1},13752:(e,t,r)=>{r.d(t,{Um:()=>X,MB:()=>Y,kE:()=>$});var n=r(4576),o=r(34727),i=(r(44208),r(53966)),a=r(4341),s=r(58083),l=r(9093),c=r(38954),d=r(51850),u=r(19419),h=r(88582),m=r(11964),f=r(240),p=r(71351),v=r(44280),g=r(32114);const _=()=>i.A.getLogger("esri.views.3d.support.geometryUtils.boundedPlane");function x(e=B){return{plane:(0,f.vt)(e.plane),origin:(0,d.o8)(e.origin),basis1:(0,d.o8)(e.basis1),basis2:(0,d.o8)(e.basis2)}}function T(e,t=x()){return b(e.origin,e.basis1,e.basis2,t)}function b(e,t,r,n=x()){return(0,c.c)(n.origin,e),(0,c.c)(n.basis1,t),(0,c.c)(n.basis2,r),y(n),function(e,t){Math.abs((0,c.m)(e.basis1,e.basis2)/((0,c.l)(e.basis1)*(0,c.l)(e.basis2)))>1e-6&&_().warn(t,"Provided basis vectors are not perpendicular"),Math.abs((0,c.m)(e.basis1,N(e)))>1e-6&&_().warn(t,"Basis vectors and plane normal are not perpendicular"),Math.abs(-(0,c.m)(N(e),e.origin)-e.plane[3])>1e-6&&_().warn(t,"Plane offset is not consistent with plane origin")}(n,"fromValues()"),n}function y(e){(0,f.mR)(e.basis2,e.basis1,e.origin,e.plane)}function A(e,t,r){e!==r&&T(e,r);const n=(0,c.j)(g.rq.get(),N(e),t);return(0,c.g)(r.origin,r.origin,n),r.plane[3]-=t,r}function E(e,t=x()){const r=(e[2]-e[0])/2,n=(e[3]-e[1])/2;return(0,c.s)(t.origin,e[0]+r,e[1]+n,0),(0,c.s)(t.basis1,r,0,0),(0,c.s)(t.basis2,0,n,0),(0,f.fA)(0,0,1,0,t.plane),t}function S(e,t,r){return!!(0,f.Ui)(e.plane,t,r)&&P(e,r)}function M(e,t,r){const n=F.get();D(e,t,n,F.get());let i=Number.POSITIVE_INFINITY;for(const a of U){const s=H(e,a,z.get()),l=g.rq.get();if((0,f.T7)(n,s,l)){const e=(0,c.E)(g.rq.get(),t.origin,l),n=Math.abs((0,o.XM)((0,c.m)(t.direction,e)));n<i&&(i=n,(0,c.c)(r,l))}}return i===Number.POSITIVE_INFINITY?w(e,t,r):r}function w(e,t,r){if(S(e,t,r))return r;const n=F.get(),o=F.get();D(e,t,n,o);let i=Number.POSITIVE_INFINITY;for(const a of U){const s=H(e,a,z.get()),l=g.rq.get();if((0,f.gv)(n,s,l)){const e=(0,p.kb)(t,l);if(!(0,f.Tj)(o,l))continue;e<i&&(i=e,(0,c.c)(r,l))}}return R(e,t.origin)<i&&C(e,t.origin,r),r}function C(e,t,r){const n=(0,f._I)(e.plane,t,g.rq.get()),o=(0,m.H6)(L(e,e.basis1),n,-1,1,g.rq.get()),i=(0,m.H6)(L(e,e.basis2),n,-1,1,g.rq.get());return(0,c.f)(r,(0,c.g)(g.rq.get(),o,i),e.origin),r}function O(e,t,r){const{origin:n,basis1:o,basis2:i}=e,a=(0,c.f)(g.rq.get(),t,n),s=(0,v.gr)(o,a),l=(0,v.gr)(i,a),d=(0,v.gr)(N(e),a);return(0,c.s)(r,s,l,d)}function R(e,t){const r=O(e,t,g.rq.get()),{basis1:n,basis2:o}=e,i=(0,c.l)(n),a=(0,c.l)(o),s=Math.max(Math.abs(r[0])-i,0),l=Math.max(Math.abs(r[1])-a,0),d=r[2];return s*s+l*l+d*d}function I(e,t){const r=-e.plane[3];return(0,v.gr)(N(e),t)-r}function N(e){return(0,f.Qj)(e.plane)}function P(e,t){const r=(0,c.f)(g.rq.get(),t,e.origin),n=(0,c.q)(e.basis1),o=(0,c.q)(e.basis2),i=(0,c.m)(e.basis1,r),a=(0,c.m)(e.basis2,r);return-i-n<0&&i-n<0&&-a-o<0&&a-o<0}function L(e,t){const r=z.get();return(0,c.c)(r.origin,e.origin),(0,c.c)(r.vector,t),r}function H(e,t,r){const{basis1:n,basis2:o,origin:i}=e,a=(0,c.j)(g.rq.get(),n,t.origin[0]),s=(0,c.j)(g.rq.get(),o,t.origin[1]);(0,c.g)(r.origin,a,s),(0,c.g)(r.origin,r.origin,i);const l=(0,c.j)(g.rq.get(),n,t.direction[0]),d=(0,c.j)(g.rq.get(),o,t.direction[1]);return(0,c.j)(r.vector,(0,c.g)(l,l,d),2),r}function D(e,t,r,n){const o=N(e);(0,f.mR)(o,t.direction,t.origin,r),(0,f.mR)((0,f.Qj)(r),o,t.origin,n)}const B={plane:(0,f.vt)(),origin:(0,d.fA)(0,0,0),basis1:(0,d.fA)(1,0,0),basis2:(0,d.fA)(0,1,0)},F=new a.I(f.vt),z=new a.I(m.vt),V=(0,d.vt)(),G=new a.I((()=>x())),U=[{origin:[-1,-1],direction:[1,0]},{origin:[1,-1],direction:[0,1]},{origin:[1,1],direction:[-1,0]},{origin:[-1,1],direction:[0,-1]}],W=(0,l.vt)(),j=(0,l.vt)();Object.freeze(Object.defineProperty({__proto__:null,BoundedPlaneClass:class{constructor(){this.plane=(0,f.vt)(),this.origin=(0,d.vt)(),this.basis1=(0,d.vt)(),this.basis2=(0,d.vt)()}},altitudeAt:I,axisAt:function(e,t,r,n){return function(e,t,r){switch(t){case h._.X:(0,c.c)(r,e.basis1),(0,c.n)(r,r);break;case h._.Y:(0,c.c)(r,e.basis2),(0,c.n)(r,r);break;case h._.Z:(0,c.c)(r,N(e))}return r}(e,r,n)},cameraFrustumCoverage:function(e,t){return(t-e)/t},closestPoint:w,closestPointOnSilhouette:M,copy:T,copyWithoutVerify:function(e,t){(0,c.c)(t.origin,e.origin),(0,c.c)(t.basis1,e.basis1),(0,c.c)(t.basis2,e.basis2),(0,f.C)(t.plane,e.plane)},create:x,distance:function(e,t){return Math.sqrt(R(e,t))},distance2:R,distanceToSilhouette:function(e,t){let r=Number.NEGATIVE_INFINITY;for(const n of U){const o=H(e,n,z.get()),i=(0,m.kb)(o,t);i>r&&(r=i)}return Math.sqrt(r)},elevate:A,equals:function(e,t){return(0,c.e)(e.basis1,t.basis1)&&(0,c.e)(e.basis2,t.basis2)&&(0,c.e)(e.origin,t.origin)},extrusionContainsPoint:function(e,t){return(0,f.Tj)(e.plane,t)&&P(e,t)},fromAABoundingRect:E,fromValues:b,getExtent:function(e,t){const r=e.basis1[0],n=e.basis2[1],[o,i]=e.origin;return(0,u.fA)(o-r,i-n,o+n,i+n,t)},intersectRay:S,intersectRayClosestSilhouette:function(e,t,r){if(S(e,t,r))return r;const n=M(e,t,g.rq.get());return(0,c.g)(r,t.origin,(0,c.j)(g.rq.get(),t.direction,(0,c.p)(t.origin,n)/(0,c.l)(t.direction))),r},normal:N,projectPoint:C,projectPointLocal:O,rotate:function(e,t,r,n){return e!==n&&T(e,n),(0,s.$0)(j,t,r),(0,c.h)(n.basis1,e.basis1,j),(0,c.h)(n.basis2,e.basis2,j),y(n),n},setAltitudeAt:function(e,t,r,n){const o=I(e,t),i=(0,c.j)(V,N(e),r-o);return(0,c.g)(n,t,i),n},setExtent:function(e,t,r){return E(t,r),A(r,I(e,e.origin),r),r},transform:function(e,t,r){return e!==r&&T(e,r),(0,s.B8)(W,t),(0,s.mg)(W,W),(0,c.h)(r.basis1,e.basis1,W),(0,c.h)(r.basis2,e.basis2,W),(0,c.h)((0,f.Qj)(r.plane),(0,f.Qj)(e.plane),W),(0,c.h)(r.origin,e.origin,t),(0,f.mP)(r.plane,r.plane,r.origin),r},up:B,updateUnboundedPlane:y,wrap:function(e,t,r){const n=G.get();return n.origin=e,n.basis1=t,n.basis2=r,n.plane=(0,f.LV)(0,0,0,0),y(n),n}},Symbol.toStringTag,{value:"Module"}));var q=r(76412);r(24151),(0,o.kU)(10),(0,o.kU)(12),(0,o.kU)(70),(0,o.kU)(40);const k={scale:0,factor:0,minScaleFactor:0};function $(e,t,r,n,i){let a=(r.screenLength||0)*e.pixelRatio;null!=i&&(a=function(e,t,r,n){return function(e,t){return(0,o.Cc)(e*Math.max(t.scale,t.minScaleFactor),e,t.factor)}(e,function(e,t,r){const n=r.parameters;return k.scale=Math.min(n.divisor/(t-n.offset),1),k.factor=function(e){return Math.abs(e*e*e)}(e),k}(t,r,n))}(a,n,t,i));const s=a*Math.tan(.5*e.fovY)/(.5*e.fullHeight);return(0,o.qE)(s*t,r.minWorldLength||0,null!=r.maxWorldLength?r.maxWorldLength:1/0)}function Y(e,t){let r=!1;for(const o in t){const i=t[o];void 0!==i&&(Array.isArray(i)?Array.isArray(e[o])&&(0,n.aI)(i,e[o])||(e[o]=i.slice(),r=!0):e[o]!==i&&(r=!0,e[o]=i))}return r}(0,q.c)();const X={multiply:1,ignore:2,replace:3,tint:4}},60517:(e,t,r)=>{r.d(t,{z:()=>c});var n=r(49255),o=r(76662),i=r(35093),a=r(63365),s=r(2597),l=r(14327);function c(e,t){e.include(o.Q,t),e.fragment.include(a.a);const r=t.output===n.V.Highlight,c=t.output===n.V.ObjectAndLayerIdColor,d=t.output===n.V.Color&&t.transparencyPassType===l.y.ColorAlpha,u=t.discardTransparentFragments;d&&(e.outputs.add("fragColor","vec4",0),e.outputs.add("fragAlpha","float",1)),e.fragment.code.add(s.H`
1025
+ void outputColorHighlightOID(vec4 finalColor, const in vec3 vWorldPosition) {
1026
+ ${c?s.H`finalColor.a = 1.0;`:""}
1027
+
1028
+ ${u?s.H`
1029
+ if (finalColor.a < ${s.H.float(i.Q)}){
1030
+ discard;
1031
+ return;
1032
+ }`:""}
1033
+
1034
+ finalColor = highlightSlice(finalColor, vWorldPosition);
1035
+ ${d?s.H`
1036
+ fragColor = premultiplyAlpha(finalColor);
1037
+ fragAlpha = finalColor.a;
1038
+ `:s.H`fragColor = finalColor;`}
1039
+ ${r?s.H`outputHighlight();`:""};
1040
+ ${c?s.H`outputObjectAndLayerIdColor();`:""}
1041
+ }
1042
+ `)}},28449:(e,t,r)=>{function n(e,t){const r=e.length;for(let n=0;n<r;++n)i[0]=e[n],t[n]=i[0];return t}function o(e,t){const r=e.length;for(let n=0;n<r;++n)i[0]=e[n],i[1]=e[n]-i[0],t[n]=i[1];return t}r.d(t,{Zo:()=>n,jA:()=>o});const i=new Float32Array(2)},90644:(e,t,r)=>{r.d(t,{Ey:()=>T,Xt:()=>l,kn:()=>c,p3:()=>i,wE:()=>d});var n=r(89192),o=r(63907);function i(e,t,r,n,i=o.Tb.ADD,a=o.Tb.ADD,s=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:n,opRgb:i,opAlpha:a,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}const a={face:o.Y7.BACK,mode:o.Ac.CCW},s={face:o.Y7.FRONT,mode:o.Ac.CCW},l=e=>e===n.s2.Back?a:e===n.s2.Front?s:null,c={zNear:0,zFar:1},d={r:!0,g:!0,b:!0,a:!0};function u(e){return A.intern(e)}function h(e){return S.intern(e)}function m(e){return w.intern(e)}function f(e){return O.intern(e)}function p(e){return I.intern(e)}function v(e){return P.intern(e)}function g(e){return H.intern(e)}function _(e){return B.intern(e)}function x(e){return z.intern(e)}function T(e){return G.intern(e)}class b{constructor(e,t){this._makeKey=e,this._makeRef=t,this._interns=new Map}intern(e){if(!e)return null;const t=this._makeKey(e),r=this._interns;return r.has(t)||r.set(t,this._makeRef(e)),r.get(t)??null}}function y(e){return"["+e.join(",")+"]"}const A=new b(E,(e=>({__tag:"Blending",...e})));function E(e){return e?y([e.srcRgb,e.srcAlpha,e.dstRgb,e.dstAlpha,e.opRgb,e.opAlpha,e.color.r,e.color.g,e.color.b,e.color.a]):null}const S=new b(M,(e=>({__tag:"Culling",...e})));function M(e){return e?y([e.face,e.mode]):null}const w=new b(C,(e=>({__tag:"PolygonOffset",...e})));function C(e){return e?y([e.factor,e.units]):null}const O=new b(R,(e=>({__tag:"DepthTest",...e})));function R(e){return e?y([e.func]):null}const I=new b(N,(e=>({__tag:"StencilTest",...e})));function N(e){return e?y([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const P=new b(L,(e=>({__tag:"DepthWrite",...e})));function L(e){return e?y([e.zNear,e.zFar]):null}const H=new b(D,(e=>({__tag:"ColorWrite",...e})));function D(e){return e?y([e.r,e.g,e.b,e.a]):null}const B=new b(F,(e=>({__tag:"StencilWrite",...e})));function F(e){return e?y([e.mask]):null}const z=new b(V,(e=>({__tag:"DrawBuffers",...e})));function V(e){return e?y(e.buffers):null}const G=new b((function(e){return e?y([E(e.blending),M(e.culling),C(e.polygonOffset),R(e.depthTest),N(e.stencilTest),L(e.depthWrite),D(e.colorWrite),F(e.stencilWrite),V(e.drawBuffers)]):null}),(e=>({blending:u(e.blending),culling:h(e.culling),polygonOffset:m(e.polygonOffset),depthTest:f(e.depthTest),stencilTest:p(e.stencilTest),depthWrite:v(e.depthWrite),colorWrite:g(e.colorWrite),stencilWrite:_(e.stencilWrite),drawBuffers:x(e.drawBuffers)})))}}]);