@arcgis/core 5.1.0-next.57 → 5.1.0-next.58

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 (46) hide show
  1. package/applications/Components/SelectionOperation.d.ts +2 -2
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{278eecd729bed2832702.js → 45b7266580f9ce4fab6c.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{992e74570b76f3f9e52e.js → 666e1e79fcb309b0b9b1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{4afddb66242438b38df0.js → 6c571008bee8376ea50a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{ea068f75397c3b3337ec.js → 92fb6519b01d110ee947.js} +136 -129
  7. package/chunks/ScreenSpaceShadowHighlight.glsl.js +6 -0
  8. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  9. package/chunks/ShadowHighlight.glsl.js +15 -8
  10. package/config.js +1 -1
  11. package/kernel.js +1 -1
  12. package/networks/support/jsonTypes.d.ts +6 -0
  13. package/package.json +1 -1
  14. package/rest/networks/support/FunctionResult.d.ts +6 -0
  15. package/rest/networks/support/FunctionResult.js +1 -1
  16. package/support/revision.js +1 -1
  17. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  18. package/views/3d/terrain/TerrainRenderer.js +1 -1
  19. package/views/3d/terrain/TerrainSurface.js +1 -1
  20. package/views/3d/webgl/RenderNode.js +1 -1
  21. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  22. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  23. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +28 -50
  24. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +46 -22
  25. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +18 -13
  26. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlight.glsl.js +2 -0
  27. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightRenderNode.js +2 -0
  28. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightTechnique.js +2 -0
  29. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  30. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  31. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  32. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  33. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  34. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  35. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  36. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  37. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  38. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  39. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  40. package/views/3d/webgl-engine/shaders/ReceiveShadowsConfiguration.js +1 -1
  41. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  42. package/views/3d/webgl.js +1 -1
  43. package/views/selection/types.d.ts +9 -0
  44. package/widgets/support/Selector2D/SelectionOperation.d.ts +191 -0
  45. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  46. package/widgets/support/Selector2D/types.d.ts +139 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1202,3354,9397],{28491(e,t,r){r.d(t,{D:()=>V,b:()=>G});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),c=r(72722),l=r(43519),u=r(96336),h=r(71955),d=r(53466),f=r(92700),m=r(72824),p=r(54154),g=r(9169),v=r(77695),_=r(43730),x=r(25961),y=r(98619),w=r(62602),b=r(22393),T=r(59469),M=r(32482),S=r(96598),C=r(51406),E=r(91899),A=r(58614),R=r(27950),I=r(20693),O=r(33079),F=r(71988),N=r(20304),D=r(31821),P=r(63761),B=r(27832),H=r(19245),L=r(3190),z=r(14113),U=r(49788);function G(e){const t=new z.N5,{attributes:r,vertex:G,fragment:V,varyings:j}=t,{output:k,normalType:W,offsetBackfaces:$,spherical:Z,snowCover:q,pbrMode:Y,textureAlphaPremultiplied:X,instancedDoublePrecision:J,hasVertexColors:K,hasVertexTangents:Q,hasColorTexture:ee,hasNormalTexture:te,hasNormalTextureTransform:re,hasColorTextureTransform:ie}=e;if((0,I.NB)(G,e),r.add("position","vec3"),j.add("vpos","vec3",{invariant:!0}),t.include(E.A,e),t.include(c.B,e),t.include(p.Ge,e),t.include(C.q2,e),!(0,n._o)(k))return t.include(g.E,e),t;t.include(C.Sx,e),t.include(C.MU,e),t.include(C.O1,e),t.include(C.QM,e),(0,I.yu)(G,e),t.include(u.Y,e),t.include(s.d);const ne=0===W||1===W;return ne&&$&&t.include(i.M),t.include(v.J,e),t.include(m.Mh,e),t.include(a.v,e),j.add("vPositionLocal","vec3"),t.include(d.U,e),t.include(h.K,e),t.include(f.c,e),G.uniforms.add(new F.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),j.add("vcolorExt","vec4"),t.include(S.Z,e),G.include(l.WD),G.include(l.oF),t.include(J?M.G:M.Bz,e),G.main.add(D.H`
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[765,3354,9397],{28491(e,t,r){r.d(t,{D:()=>V,b:()=>G});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),c=r(72722),l=r(43519),u=r(96336),h=r(71955),d=r(53466),f=r(92700),p=r(72824),m=r(54154),g=r(9169),v=r(77695),_=r(43730),x=r(70161),w=r(98619),y=r(62602),b=r(22393),T=r(59469),M=r(32482),S=r(96598),C=r(51406),E=r(91899),A=r(58614),R=r(27950),I=r(20693),O=r(33079),F=r(71988),D=r(20304),P=r(31821),N=r(63761),B=r(27832),H=r(19245),L=r(3190),z=r(14113),U=r(49788);function G(e){const t=new z.N5,{attributes:r,vertex:G,fragment:V,varyings:j}=t,{output:k,normalType:W,offsetBackfaces:$,spherical:Z,snowCover:q,pbrMode:Y,textureAlphaPremultiplied:X,instancedDoublePrecision:K,hasVertexColors:J,hasVertexTangents:Q,hasColorTexture:ee,hasNormalTexture:te,hasNormalTextureTransform:re,hasColorTextureTransform:ie}=e;if((0,I.NB)(G,e),r.add("position","vec3"),j.add("vpos","vec3",{invariant:!0}),t.include(E.A,e),t.include(c.B,e),t.include(m.Ge,e),t.include(C.q2,e),!(0,n._o)(k))return t.include(g.E,e),t;t.include(C.Sx,e),t.include(C.MU,e),t.include(C.O1,e),t.include(C.QM,e),(0,I.yu)(G,e),t.include(u.Y,e),t.include(s.d);const ne=0===W||1===W;return ne&&$&&t.include(i.M),t.include(v.J,e),t.include(p.Mh,e),t.include(a.v,e),j.add("vPositionLocal","vec3"),t.include(d.U,e),t.include(h.K,e),t.include(f.c,e),G.uniforms.add(new F.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),j.add("vcolorExt","vec4"),t.include(S.Z,e),G.include(l.WD),G.include(l.oF),t.include(K?M.G:M.Bz,e),G.main.add(P.H`
2
2
  forwardVertexColor();
3
3
 
4
4
  MaskedColor maskedColor =
@@ -10,11 +10,11 @@
10
10
  vpos = getVertexInLocalOriginSpace();
11
11
  vPositionLocal = vpos - view[3].xyz;
12
12
  vpos = subtractOrigin(vpos);
13
- ${(0,D.If)(ne,"vNormalWorld = dpNormal(vvLocalNormal(normalModel()));")}
13
+ ${(0,P.If)(ne,"vNormalWorld = dpNormal(vvLocalNormal(normalModel()));")}
14
14
  vpos = addVerticalOffset(vpos, localOrigin);
15
- ${(0,D.If)(Q,"vTangent = dpTransformVertexTangent(tangent);")}
15
+ ${(0,P.If)(Q,"vTangent = dpTransformVertexTangent(tangent);")}
16
16
  gl_Position = transformPosition(proj, view, vpos);
17
- ${(0,D.If)(ne&&$,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
17
+ ${(0,P.If)(ne&&$,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
18
18
 
19
19
  forwardViewPosDepth((view * vec4(vpos, 1.0)).xyz);
20
20
  forwardTextureCoordinates();
@@ -24,19 +24,19 @@
24
24
  forwardOcclusionUV();
25
25
  forwardMetallicRoughnessUV();
26
26
 
27
- if (opacityMixMode != ${D.H.int(H.Um.ignore)} && vcolorExt.a < ${D.H.float(U.Q)}) {
27
+ if (opacityMixMode != ${P.H.int(H.Um.ignore)} && vcolorExt.a < ${P.H.float(U.Q)}) {
28
28
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
29
29
  }
30
30
  forwardLinearDepthToReadShadowMap();
31
- `),V.include(x.kA,e),V.include(_.n,e),t.include(A.S,e),V.include(o.HQ,e),t.include(L.D,e),(0,I.yu)(V,e),V.uniforms.add(G.uniforms.get("localOrigin"),new O.t("ambient",e=>e.ambient),new O.t("diffuse",e=>e.diffuse),new N.m("opacity",e=>e.opacity),new N.m("layerOpacity",e=>e.layerOpacity)),ee&&V.uniforms.add(new P.N("tex",e=>e.texture)),t.include(T._,e),V.include(b.c,e),V.include(R.N),t.include(w.r,e),V.include(B.b,e),(0,x.a8)(V),(0,x.eU)(V),(0,y.O4)(V),V.main.add(D.H`
31
+ `),V.include(x.kA,e),V.include(_.n,e),t.include(A.S,e),V.include(o.HQ,e),t.include(L.D,e),(0,I.yu)(V,e),V.uniforms.add(G.uniforms.get("localOrigin"),new O.t("ambient",e=>e.ambient),new O.t("diffuse",e=>e.diffuse),new D.m("opacity",e=>e.opacity),new D.m("layerOpacity",e=>e.layerOpacity)),ee&&V.uniforms.add(new N.N("tex",e=>e.texture)),t.include(T._,e),V.include(b.c,e),V.include(R.N),t.include(y.r,e),V.include(B.b,e),(0,x.a8)(V),(0,x.eU)(V),(0,w.O4)(V),V.main.add(P.H`
32
32
  discardBySlice(vpos);
33
33
  discardByTerrainDepth();
34
- ${ee?D.H`
34
+ ${ee?P.H`
35
35
  vec4 texColor = texture(tex, ${ie?"colorUV":"vuv0"});
36
- ${(0,D.If)(X,"texColor.rgb /= texColor.a;")}
37
- discardOrAdjustAlpha(texColor);`:D.H`vec4 texColor = vec4(1.0);`}
36
+ ${(0,P.If)(X,"texColor.rgb /= texColor.a;")}
37
+ discardOrAdjustAlpha(texColor);`:P.H`vec4 texColor = vec4(1.0);`}
38
38
  shadingParams.viewDirection = normalize(vpos - cameraPosition);
39
- ${2===W?D.H`vec3 normal = screenDerivativeNormal(vPositionLocal);`:D.H`shadingParams.normalView = vNormalWorld;
39
+ ${2===W?P.H`vec3 normal = screenDerivativeNormal(vPositionLocal);`:P.H`shadingParams.normalView = vNormalWorld;
40
40
  vec3 normal = shadingNormal(shadingParams);`}
41
41
  applyPBRFactors();
42
42
  float ssao = evaluateAmbientOcclusionInverse() * getBakedOcclusion();
@@ -47,13 +47,13 @@
47
47
  float shadow = readShadow(additionalAmbientScale, vpos);
48
48
 
49
49
  vec3 matColor = max(ambient, diffuse);
50
- vec3 albedo = mixExternalColor(${(0,D.If)(K,"vColor.rgb *")} matColor, texColor.rgb, vcolorExt.rgb, colorMixMode);
51
- float opacity_ = layerOpacity * mixExternalOpacity(${(0,D.If)(K,"vColor.a * ")} opacity, texColor.a, vcolorExt.a, opacityMixMode);
50
+ vec3 albedo = mixExternalColor(${(0,P.If)(J,"vColor.rgb *")} matColor, texColor.rgb, vcolorExt.rgb, colorMixMode);
51
+ float opacity_ = layerOpacity * mixExternalOpacity(${(0,P.If)(J,"vColor.a * ")} opacity, texColor.a, vcolorExt.a, opacityMixMode);
52
52
 
53
53
  ${te?`mat3 tangentSpace = computeTangentSpace(${Q?"normal":"normal, vpos, vuv0"});\n vec3 shadingNormal = computeTextureNormal(tangentSpace, ${re?"normalUV":"vuv0"});`:"vec3 shadingNormal = normal;"}
54
54
  vec3 normalGround = ${Z?"normalize(posWorld);":"vec3(0.0, 0.0, 1.0);"}
55
55
 
56
- ${(0,D.If)(q,D.H`
56
+ ${(0,P.If)(q,P.H`
57
57
  float snow = getSnow(normal, normalGround);
58
58
  albedo = mix(albedo, vec3(1), snow);
59
59
  shadingNormal = mix(shadingNormal, normal, snow);
@@ -61,13 +61,13 @@
61
61
 
62
62
  vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
63
63
 
64
- ${1===Y||2===Y?D.H`
64
+ ${1===Y||2===Y?P.H`
65
65
  float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
66
- ${(0,D.If)(q,"mrr = applySnowToMRR(mrr, snow);")}
67
- vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);`:D.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
66
+ ${(0,P.If)(q,"mrr = applySnowToMRR(mrr, snow);")}
67
+ vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);`:P.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
68
68
  vec4 finalColor = vec4(shadedColor, opacity_);
69
- outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,D.If)(q,", snow")});
70
- `),t}const V=Object.freeze(Object.defineProperty({__proto__:null,build:G},Symbol.toStringTag,{value:"Module"}))},57323(e,t,r){r.d(t,{R:()=>L,b:()=>H});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),c=r(72722),l=r(43519),u=r(96336),h=r(71955),d=r(53466),f=r(92700),m=r(54154),p=r(9169),g=r(43730),v=r(25961),_=r(98619),x=r(22393),y=r(59469),w=r(32482),b=r(96598),T=r(91899),M=r(58614),S=r(27950),C=r(20693),E=r(33079),A=r(71988),R=r(20304),I=r(31821),O=r(63761),F=r(27832),N=r(19245),D=r(26934),P=r(3190),B=r(14113);function H(e){const t=new B.N5,{attributes:r,vertex:H,fragment:L,varyings:z}=t,{output:U,offsetBackfaces:G,pbrMode:V,snowCover:j,spherical:k}=e,W=1===V||2===V;if((0,C.NB)(H,e),r.add("position","vec3"),z.add("vpos","vec3",{invariant:!0}),t.include(T.A,e),t.include(c.B,e),t.include(m.Ge,e),t.include(b.Z,e),!(0,n._o)(U))return t.include(p.E,e),t;(0,C.yu)(t.vertex,e),t.include(u.Y,e),t.include(s.d),G&&t.include(i.M),z.add("vNormalWorld","vec3"),z.add("localvpos","vec3",{invariant:!0}),t.include(d.U,e),t.include(h.K,e),t.include(a.v,e),t.include(f.c,e),H.include(l.WD),H.include(l.oF),H.uniforms.add(new A.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),z.add("vcolorExt","vec4"),t.include(e.instancedDoublePrecision?w.G:w.Bz,e),H.include(D.Q),H.main.add(I.H`
69
+ outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,P.If)(q,", snow")});
70
+ `),t}const V=Object.freeze(Object.defineProperty({__proto__:null,build:G},Symbol.toStringTag,{value:"Module"}))},57323(e,t,r){r.d(t,{R:()=>L,b:()=>H});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),c=r(72722),l=r(43519),u=r(96336),h=r(71955),d=r(53466),f=r(92700),p=r(54154),m=r(9169),g=r(43730),v=r(70161),_=r(98619),x=r(22393),w=r(59469),y=r(32482),b=r(96598),T=r(91899),M=r(58614),S=r(27950),C=r(20693),E=r(33079),A=r(71988),R=r(20304),I=r(31821),O=r(63761),F=r(27832),D=r(19245),P=r(26934),N=r(3190),B=r(14113);function H(e){const t=new B.N5,{attributes:r,vertex:H,fragment:L,varyings:z}=t,{output:U,offsetBackfaces:G,pbrMode:V,snowCover:j,spherical:k}=e,W=1===V||2===V;if((0,C.NB)(H,e),r.add("position","vec3"),z.add("vpos","vec3",{invariant:!0}),t.include(T.A,e),t.include(c.B,e),t.include(p.Ge,e),t.include(b.Z,e),!(0,n._o)(U))return t.include(m.E,e),t;(0,C.yu)(t.vertex,e),t.include(u.Y,e),t.include(s.d),G&&t.include(i.M),z.add("vNormalWorld","vec3"),z.add("localvpos","vec3",{invariant:!0}),t.include(d.U,e),t.include(h.K,e),t.include(a.v,e),t.include(f.c,e),H.include(l.WD),H.include(l.oF),H.uniforms.add(new A.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),z.add("vcolorExt","vec4"),t.include(e.instancedDoublePrecision?y.G:y.Bz,e),H.include(P.Q),H.main.add(I.H`
71
71
  forwardVertexColor();
72
72
 
73
73
  MaskedColor maskedColorExt =
@@ -76,7 +76,7 @@
76
76
  vcolorExt = maskedColorExt.color;
77
77
  forwardColorMixMode(maskedColorExt.mask);
78
78
 
79
- bool alphaCut = opacityMixMode != ${I.H.int(N.Um.ignore)} && vcolorExt.a < alphaCutoff;
79
+ bool alphaCut = opacityMixMode != ${I.H.int(D.Um.ignore)} && vcolorExt.a < alphaCutoff;
80
80
  vpos = getVertexInLocalOriginSpace();
81
81
 
82
82
  localvpos = vpos - view[3].xyz;
@@ -90,7 +90,7 @@
90
90
  forwardLinearDepthToReadShadowMap();
91
91
  gl_Position = alphaCut ? vec4(1e38, 1e38, 1e38, 1.0) :
92
92
  ${(0,I.If)(G,"offsetBackfacingClipPosition(basePosition, vpos, vNormalWorld, cameraPosition);","basePosition;")}
93
- `);const{hasColorTexture:$,hasColorTextureTransform:Z}=e;return L.include(v.kA,e),L.include(g.n,e),t.include(M.S,e),L.include(o.HQ,e),t.include(P.D,e),(0,C.yu)(L,e),(0,_.Gc)(L),(0,v.a8)(L),(0,v.eU)(L),L.uniforms.add(H.uniforms.get("localOrigin"),H.uniforms.get("view"),new E.t("ambient",e=>e.ambient),new E.t("diffuse",e=>e.diffuse),new R.m("opacity",e=>e.opacity),new R.m("layerOpacity",e=>e.layerOpacity)),$&&L.uniforms.add(new O.N("tex",e=>e.texture)),t.include(y._,e),L.include(x.c,e),L.include(S.N),L.include(F.b,e),(0,_.O4)(L),L.main.add(I.H`
93
+ `);const{hasColorTexture:$,hasColorTextureTransform:Z}=e;return L.include(v.kA,e),L.include(g.n,e),t.include(M.S,e),L.include(o.HQ,e),t.include(N.D,e),(0,C.yu)(L,e),(0,_.Gc)(L),(0,v.a8)(L),(0,v.eU)(L),L.uniforms.add(H.uniforms.get("localOrigin"),H.uniforms.get("view"),new E.t("ambient",e=>e.ambient),new E.t("diffuse",e=>e.diffuse),new R.m("opacity",e=>e.opacity),new R.m("layerOpacity",e=>e.layerOpacity)),$&&L.uniforms.add(new O.N("tex",e=>e.texture)),t.include(w._,e),L.include(x.c,e),L.include(S.N),L.include(F.b,e),(0,_.O4)(L),L.main.add(I.H`
94
94
  discardBySlice(vpos);
95
95
  discardByTerrainDepth();
96
96
  vec4 texColor = ${$?`texture(tex, ${Z?"colorUV":"vuv0"})`:" vec4(1.0)"};
@@ -125,7 +125,7 @@
125
125
  ${(0,I.If)(j,"mrr = applySnowToMRR(mrr, snow);")}
126
126
  vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, groundNormal, mrr, additionalAmbientIrradiance);`:I.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
127
127
  vec4 finalColor = vec4(shadedColor, opacity_);
128
- outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,I.If)(j,", 1.0")});`),t}const L=Object.freeze(Object.defineProperty({__proto__:null,build:H},Symbol.toStringTag,{value:"Module"}))},15581(e,t,r){r.d(t,{S:()=>x,b:()=>g,g:()=>v});var i=r(37585),n=r(48163),o=r(82048),s=r(52540),a=r(65261),c=r(34845),l=r(77108),u=r(47286),h=r(33094),d=r(20304),f=r(31821),m=r(63761),p=r(14113);function g(){const e=new p.N5,t=e.fragment;return e.include(o.c),e.include(c.Ir),t.include(s.E),t.include(a.C),t.uniforms.add(new h.U("radius",e=>v(e.camera))).code.add(f.H`vec3 sphere[16] = vec3[16](
128
+ outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,I.If)(j,", 1.0")});`),t}const L=Object.freeze(Object.defineProperty({__proto__:null,build:H},Symbol.toStringTag,{value:"Module"}))},15581(e,t,r){r.d(t,{S:()=>x,b:()=>g,g:()=>v});var i=r(37585),n=r(48163),o=r(82048),s=r(52540),a=r(65261),c=r(34845),l=r(77108),u=r(47286),h=r(33094),d=r(20304),f=r(31821),p=r(63761),m=r(14113);function g(){const e=new m.N5,t=e.fragment;return e.include(o.c),e.include(c.Ir),t.include(s.E),t.include(a.C),t.uniforms.add(new h.U("radius",e=>v(e.camera))).code.add(f.H`vec3 sphere[16] = vec3[16](
129
129
  vec3(0.186937, 0.0, 0.0),
130
130
  vec3(0.700542, 0.0, 0.0),
131
131
  vec3(-0.864858, -0.481795, -0.111713),
@@ -151,7 +151,7 @@ vec3 v = Q - C;
151
151
  float vv = dot(v, v);
152
152
  float vn = dot(normalize(v), n_C);
153
153
  return fallOffFunction(vv, vn, 0.1);
154
- }`),e.outputs.add("fragOcclusion","float"),t.uniforms.add(new m.N("normalMap",e=>e.normalTexture),new m.N("depthMap",e=>e.depthTexture),new d.m("projScale",e=>e.projScale),new m.N("rnm",e=>e.noiseTexture),new u.G("rnmScale",(e,t)=>(0,i.hZ)(_,t.camera.fullWidth/e.noiseTexture.descriptor.width,t.camera.fullHeight/e.noiseTexture.descriptor.height)),new d.m("intensity",e=>e.intensity),new l.E("screenSize",e=>(0,i.hZ)(_,e.camera.fullWidth,e.camera.fullHeight))).main.add(f.H`
154
+ }`),e.outputs.add("fragOcclusion","float"),t.uniforms.add(new p.N("normalMap",e=>e.normalTexture),new p.N("depthMap",e=>e.depthTexture),new d.m("projScale",e=>e.projScale),new p.N("rnm",e=>e.noiseTexture),new u.G("rnmScale",(e,t)=>(0,i.hZ)(_,t.camera.fullWidth/e.noiseTexture.descriptor.width,t.camera.fullHeight/e.noiseTexture.descriptor.height)),new d.m("intensity",e=>e.intensity),new l.E("screenSize",e=>(0,i.hZ)(_,e.camera.fullWidth,e.camera.fullHeight))).main.add(f.H`
155
155
  float depth = depthFromTexture(depthMap, uv);
156
156
 
157
157
  // Early out if depth is out of range, such as in the sky
@@ -230,7 +230,7 @@ return fallOffFunction(vv, vn, 0.1);
230
230
  vec2 uvOffset = uv + rf * blurSize;
231
231
  blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
232
232
  }
233
- fragBlur = b / w_total;`),e}const d=Object.freeze(Object.defineProperty({__proto__:null,build:h},Symbol.toStringTag,{value:"Module"}))},43609(e,t,r){r.d(t,{a:()=>o,f:()=>s,n:()=>n});var i=r(34275);function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=2,n=r){const o=t.length/2;let s=0,a=0;if(!(0,i.iu)(t)||(0,i.dk)(t)){for(let i=0;i<o;++i)e[s]=t[a],e[s+1]=t[a+1],s+=r,a+=n;return}const c=(0,i.a3)(t);if((0,i.JI)(t))for(let i=0;i<o;++i)e[s]=Math.max(t[a]/c,-1),e[s+1]=Math.max(t[a+1]/c,-1),s+=r,a+=n;else for(let i=0;i<o;++i)e[s]=t[a]/c,e[s+1]=t[a+1]/c,s+=r,a+=n}function s(e,t,r,i){const n=e.typedBuffer,o=e.typedBufferStride,s=i?.count??e.count;let a=(i?.dstIndex??0)*o;for(let e=0;e<s;++e)n[a]=t,n[a+1]=r,a+=o}Object.freeze(Object.defineProperty({__proto__:null,fill:s,normalizeIntegerBuffer:o,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},73354(e,t,r){r.d(t,{a:()=>d,b:()=>c,c:()=>a,d:()=>o,e:()=>f,f:()=>h,l:()=>u,n:()=>m,t:()=>s});var i=r(40876),n=(r(44208),r(72727));function o(e,t,r){s(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a),l=r[0],u=r[1],h=r[2],d=r[4],f=r[5],m=r[6],p=r[8],g=r[9],v=r[10],_=r[12],x=r[13],y=r[14];let w=0,b=0;for(let r=0;r<c;r++){const r=t[w],n=t[w+1],s=t[w+2];e[b]=l*r+d*n+p*s+_,e[b+1]=u*r+f*n+g*s+x,e[b+2]=h*r+m*n+v*s+y,w+=o,b+=i}return e}function a(e,t,r){c(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function c(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a),l=r[0],u=r[1],h=r[2],d=r[3],f=r[4],m=r[5],p=r[6],g=r[7],v=r[8];let _=0,x=0;for(let r=0;r<c;r++){const r=t[_],n=t[_+1],s=t[_+2];e[x]=l*r+d*n+p*s,e[x+1]=u*r+f*n+g*s,e[x+2]=h*r+m*n+v*s,_+=o,x+=i}}function l(e,t,r,i=3,n=i){const o=Math.min(e.length/i,t.length/n);let s=0,a=0;for(let c=0;c<o;c++)e[a]=r*t[s],e[a+1]=r*t[s+1],e[a+2]=r*t[s+2],s+=n,a+=i;return e}function u(e,t,r,i){h(e.typedBuffer,t.typedBuffer,r,i,e.typedBufferStride,t.typedBufferStride)}function h(e,t,r,n,o=3,s=o){const a=Math.min(e.length/o,t.length/s);let c=0,l=0;const u=1/i.Tf;for(let i=0;i<a;i++)e[l]=n*(r*t[c])**u,e[l+1]=n*(r*t[c+1])**u,e[l+2]=n*(r*t[c+2])**u,c+=s,l+=o}function d(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a);let l=0,u=0;for(let n=0;n<c;n++)e[u]=t[l]+r[0],e[u+1]=t[l+1]+r[1],e[u+2]=t[l+2]+r[2],l+=o,u+=i;return e}function f(e,t){m(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function m(e,t,r=3,i=r){const n=Math.min(e.length/r,t.length/i);let o=0,s=0;for(let a=0;a<n;a++){const n=t[o],a=t[o+1],c=t[o+2],l=n*n+a*a+c*c;if(l>0){const t=1/Math.sqrt(l);e[s]=t*n,e[s+1]=t*a,e[s+2]=t*c}o+=i,s+=r}}Object.freeze(Object.defineProperty({__proto__:null,linearToSRGB:h,linearToSRGBView:u,normalize:m,normalizeView:f,scale:l,scaleView:function(e,t,r){l(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)},shiftRight:function(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,s=t.typedBuffer,a=t.typedBufferStride;let c=0,l=0;for(let e=0;e<i;e++)n[l]=s[c]>>r,n[l+1]=s[c+1]>>r,n[l+2]=s[c+2]>>r,c+=a,l+=o},transformMat3:c,transformMat3View:a,transformMat4:s,transformMat4View:o,translate:d},Symbol.toStringTag,{value:"Module"}))},69052(e,t,r){r.d(t,{hr:()=>n,ie:()=>c,uC:()=>a});var i=r(34727);class n{constructor(e,t){this.min=e,this.max=t,this.range=t-e}normalize(e,t=0,r=!1){return o(this.range,this.min,this.max,e,t,r)}clamp(e,t=0){return(0,i.qE)(e-t,this.min,this.max)+t}monotonic(e,t,r){return e<t?t:t+s(this.range,e-t,r)}minimalMonotonic(e,t,r){return o(this.range,e,e+this.range,t,r)}center(e,t,r){return t=this.monotonic(e,t,r),this.normalize((e+t)/2,r)}diff(e,t,r){return this.monotonic(e,t,r)-e}shortestSignedDiff(e,t){e=this.normalize(e);const r=(t=this.normalize(t))-e,i=t<e?this.minimalMonotonic(e,t)-e:t-this.minimalMonotonic(t,e);return Math.abs(r)<Math.abs(i)?r:i}contains(e,t,r){return t=this.minimalMonotonic(e,t),(r=this.minimalMonotonic(e,r))>e&&r<t}}function o(e,t,r,i,n=0,o=!1){return(i-=n)<t?i+=s(e,t-i):i>r&&(i-=s(e,i-r)),o&&i===r&&(i=t),i+n}function s(e,t,r=0){return Math.ceil((t-r)/e)*e+r}const a=new n(0,2*Math.PI),c=(new n(-Math.PI,Math.PI),new n(0,360))},4341(e,t,r){r.d(t,{I:()=>n});var i=r(26390);class n{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.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*o);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,o));e++)this._items.push(this._allocator())}}const o=1024},46140(e,t,r){r.d(t,{A:()=>n});var i=r(49186);class n{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}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new n(this.major,this.minor,this._context)}static parse(e,t=""){const[r,o]=e.split("."),s=/^\s*\d+\s*$/;if(!r?.match||!s.test(r))throw new i.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!o?.match||!s.test(o))throw new i.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),c=parseInt(o,10);return new n(a,c,t)}}},61473(e,t,r){function i(e){return e=e||globalThis.location.hostname,l.some(t=>null!=e?.match(t))}function n(e,t){return e?(t=t||globalThis.location.hostname)?null!=t.match(o)||null!=t.match(a)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(s)||null!=t.match(c)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e:null}r.d(t,{EM:()=>n,b5:()=>i});const o=/^devext\.arcgis\.com$/,s=/^qaext\.arcgis\.com$/,a=/^[\w-]*\.mapsdevext\.arcgis\.com$/,c=/^[\w-]*\.mapsqa\.arcgis\.com$/,l=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local\.esri\.com$/,o,s,/^jsapps\.esri\.com$/,a,c]},88340(e,t,r){function i(){return new Float32Array(2)}function n(e,t){const r=new Float32Array(2);return r[0]=e,r[1]=t,r}function o(){return i()}function s(){return n(1,1)}function a(){return n(1,0)}function c(){return n(0,1)}r.d(t,{Un:()=>u,fA:()=>n,uY:()=>l,vt:()=>i});const l=o(),u=s(),h=a(),d=c();Object.freeze(Object.defineProperty({__proto__:null,ONES:u,UNIT_X:h,UNIT_Y:d,ZEROS:l,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:i,fromValues:n,ones:s,unitX:a,unitY:c,zeros:o},Symbol.toStringTag,{value:"Module"}))},69397(e,t,r){r.d(t,{Qf:()=>c,Qh:()=>s,RS:()=>n,Ul:()=>f,i5:()=>d,lM:()=>o,qK:()=>u});var i=r(34275);const n=16;function o(e){if(!e)return 0;let t=u;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return c(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return l(e,8);let r=h;for(let i=0;i<t;i++)r+=a(e[i]);return r}(e);let t=u;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r]));return t}function a(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return n;case"boolean":return 4;default:return 8}}function c(...e){return e.reduce((e,t)=>e+(t?(0,i.iu)(t)?t.byteLength+d:Array.isArray(t)?l(t,n):0:0),0)}function l(e,t){return h+e.length*t}const u=32,h=16,d=145,f=64},65806(e,t,r){r.d(t,{g:()=>s});var i=r(51850),n=r(91218),o=r(9762);function s(e,t,r,i){if((0,n.canProjectWithoutEngine)(e.spatialReference,r))return a[0]=e.x,a[1]=e.y,a[2]=e.z??0,(0,o.projectBuffer)(a,e.spatialReference,0,t,r,0);const s=(0,n.tryProject)(e,r,i);return!!s&&(t[0]=s.x,t[1]=s.y,t[2]=s.z??0,!0)}const a=(0,i.vt)()},27993(e,t,r){r.d(t,{F:()=>a});var i=r(91218),n=r(16930),o=r(9762),s=r(65806);function a(e,t,r,n){return!(null==t||null==n||e.length<2)&&((0,i.canProjectWithoutEngine)(t,n)?(0,o.projectBuffer)(e,t,0,r,n,0,1):(c.x=e[0],c.y=e[1],c.z=e[2],c.spatialReference=t,(0,s.g)(c,r,n)))}const c={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:n.A.WGS84,type:"point"}},97146(e,t,r){r.d(t,{Dg:()=>o,my:()=>s,tM:()=>u,uW:()=>n});var i=r(34275);function n(e){return o(e,!0)}function o(e,t){if(Array.isArray(e)){if(e.length<i.y9)return e}else if(e.length<i.y9)return Array.from(e);let r=!0,n=!0;return e.some((e,t)=>(r=r&&0===e,n=n&&e===t,!r&&!n)),r?function(e){if(1===e)return c;if(e<i.y9)return new Array(e).fill(0);if(e>d.length){const t=Math.max(2*d.length,e);d=new Uint8Array(t)}return new Uint8Array(d.buffer,0,e)}(e.length):n?u(e.length):(0,i.iu)(e)&&e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT?e:function(e,t){for(const r of e){if(r>=65536)return(0,i.iu)(e)?e:new Uint32Array(e);r>=256&&(t=!1)}return t?new Uint8Array(e):new Uint16Array(e)}(e,!t)}function s(e){return e<=i.y9?new Array(e):e<=65536?new Uint16Array(e):new Uint32Array(e)}let a=h(131072);const c=[0],l=(()=>{const e=new Uint16Array(65536);for(let t=0;t<e.length;++t)e[t]=t;return e})();function u(e){return 1===e?c:e<i.y9?Array.from(new Uint16Array(l.buffer,0,e)):e<l.length?new Uint16Array(l.buffer,0,e):(e>a.length&&(a=h(Math.max(2*a.length,e))),new Uint32Array(a.buffer,0,e))}function h(e){const t=new Uint32Array(e);for(let e=0;e<t.length;e++)t[e]=e;return t}let d=new Uint8Array(65536)},72727(e,t,r){function i(e,t,r){if(t<=0)return 0;const i=e-r;return i<0?0:Math.floor(i/t)+1}r.d(t,{k:()=>i}),r(53966)},90239(e,t,r){function i(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":case"f16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}r.d(t,{GJ:()=>i})},82919(e,t,r){r.d(t,{DV:()=>v,C:()=>p,vt:()=>f,Qy:()=>m,ui:()=>g,ST:()=>y,bU:()=>w,pw:()=>x,m7:()=>_,c8:()=>T});var i=r(4341),n=r(58083),o=r(35522),s=r(51850),a=r(78955),c=r(91829),l=r(71351);function u(e){return e?{ray:(0,l.vt)(e.ray),c0:e.c0,c1:e.c1}:{ray:(0,l.vt)(),c0:0,c1:Number.MAX_VALUE}}new i.I(()=>u());var h=r(27921),d=r(32114);function f(e){return e?[(0,h.vt)(e[0]),(0,h.vt)(e[1]),(0,h.vt)(e[2]),(0,h.vt)(e[3]),(0,h.vt)(e[4]),(0,h.vt)(e[5])]:[(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)()]}function m(){return[(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)()]}function p(e,t){for(let r=0;r<M;r++)(0,h.C)(e[r],t[r]);return e}function g(e,t,r,i=A){const s=(0,n.lw)(d.Rc.get(),t,e);(0,n.B8)(s,s);for(let e=0;e<S;++e){const t=(0,a.Z0)(d.Km.get(),C[e],s);(0,o.hZ)(i[e],t[0]/t[3],t[1]/t[3],t[2]/t[3])}v(r,i)}function v(e,t){(0,h.Cr)(t[4],t[0],t[3],e[0]),(0,h.Cr)(t[1],t[5],t[6],e[1]),(0,h.Cr)(t[4],t[5],t[1],e[2]),(0,h.Cr)(t[3],t[2],t[6],e[3]),(0,h.Cr)(t[0],t[1],t[2],e[4]),(0,h.Cr)(t[5],t[4],t[7],e[5])}function _(e,t){for(let r=0;r<M;r++){const i=e[r];if(i[0]*t.center[0]+i[1]*t.center[1]+i[2]*t.center[2]+i[3]>=t.radius)return!1}return!0}function x(e,t){return b(e,function(e,t=u()){return(0,l.C)(e,t.ray),t.c0=0,t.c1=Number.MAX_VALUE,t}(t,E.get()))}function y(e,t,r){return b(e,function(e,t,r=u()){const i=(0,o.Bw)(e.vector);return(0,l.fA)(e.origin,t,r.ray),r.c0=0,r.c1=i,r}(t,r,E.get()))}function w(e,t){for(let r=0;r<M;r++)if((0,h.mN)(e[r],t)>0)return!1;return!0}function b(e,t){for(let r=0;r<M;r++)if(!(0,h.$Q)(e[r],t))return!1;return!0}const T={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},M=6,S=8,C=[(0,c.fA)(-1,-1,-1,1),(0,c.fA)(1,-1,-1,1),(0,c.fA)(1,1,-1,1),(0,c.fA)(-1,1,-1,1),(0,c.fA)(-1,-1,1,1),(0,c.fA)(1,-1,1,1),(0,c.fA)(1,1,1,1),(0,c.fA)(-1,1,1,1)],E=new i.I(u),A=m()},11964(e,t,r){r.d(t,{Cr:()=>u,LV:()=>l,_I:()=>h,vt:()=>c});var i=r(34727),n=r(4341),o=r(35522),s=r(51850),a=r(32114);function c(e){return e?{origin:(0,s.o8)(e.origin),vector:(0,s.o8)(e.vector)}:{origin:(0,s.vt)(),vector:(0,s.vt)()}}function l(e,t){const r=d.get();return r.origin=e,r.vector=t,r}function u(e,t,r=c()){return(0,o.C)(r.origin,e),(0,o.Re)(r.vector,t,e),r}function h(e,t,r){return function(e,t,r,n,s){const{vector:c,origin:l}=e,u=(0,o.Re)(a.rq.get(),t,l),h=(0,o.Om)(c,u)/(0,o.m3)(c);return(0,o.hs)(s,c,(0,i.qE)(h,0,1)),(0,o.WQ)(s,s,e.origin)}(e,t,0,0,r)}(0,s.vt)(),(0,s.vt)();const d=new n.I(()=>c())},17136(e,t,r){r.d(t,{Y_:()=>A,O7:()=>C,el:()=>S});var i=r(92602),n=r(69052),o=r(49186),s=r(53966),a=r(39829),c=r(82799),l=r(16930),u=r(80754),h=r(21325),d=r(28735),f=r(11254),m=r(60408),p=r(65864),g=r(2272),v=r(84952),_=r(92300);const x=()=>s.A.getLogger("esri.geometry.support.normalizeUtils");function y(e){return"polygon"===e[0].type}function w(e){return"polyline"===e[0].type}function b(e,t,r){if(t){const t=function(e,t){if(!(e instanceof c.A||e instanceof a.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw x().error(e),new o.A("internal:geometry",e)}const r=(0,u.r8)(e),i=[];for(const e of r){const r=[];i.push(r),r.push([e[0][0],e[0][1]]);for(let i=0;i<e.length-1;i++){const n=e[i][0],o=e[i][1],s=e[i+1][0],a=e[i+1][1],c=Math.sqrt((s-n)*(s-n)+(a-o)*(a-o)),l=(a-o)/c,u=(s-n)/c,h=c/t;if(h>1){for(let e=1;e<=h-1;e++){const i=e*t,s=u*i+n,a=l*i+o;r.push([s,a])}const e=(c+Math.floor(h-1)*t)/2,i=u*e+n,s=l*e+o;r.push([i,s])}r.push([s,a])}}return function(e){return"polygon"===e.type}(e)?new a.A({rings:i,spatialReference:e.spatialReference}):new c.A({paths:i,spatialReference:e.spatialReference})}(e,1e6);e=(0,d.ci)(t,!0)}return r&&(e=(0,u.kS)(e,r)),e}function T(e,t,r){if(Array.isArray(e)){const i=e[0];if(i>t){const r=(0,u.kd)(i,t);e[0]=i+r*(-2*t)}else if(i<r){const t=(0,u.kd)(i,r);e[0]=i+t*(-2*r)}}else{const i=e.x;if(i>t){const r=(0,u.kd)(i,t);e=e.clone().offset(r*(-2*t),0)}else if(i<r){const t=(0,u.kd)(i,r);e=e.clone().offset(t*(-2*r),0)}}return e}function M(e,t){let r=-1;for(let i=0;i<t.cutIndexes.length;i++){const n=t.cutIndexes[i],o=t.geometries[i],s=(0,u.r8)(o);for(let e=0;e<s.length;e++){const t=s[e];t.some(r=>{if(r[0]<180)return!0;{let r=0;for(let e=0;e<t.length;e++){const i=t[e][0];r=i>r?i:r}r=Number(r.toFixed(9));const i=-360*(0,u.kd)(r,180);for(let r=0;r<t.length;r++){const t=o.getPoint(e,r);o.setPoint(e,r,t.clone().offset(i,0))}return!0}})}if(n===r){if(y(e))for(const t of(0,u.r8)(o))e[n]=e[n].addRing(t);else if(w(e))for(const t of(0,u.r8)(o))e[n]=e[n].addPath(t)}else r=n,e[n]=o}return e}async function S(e,t,r){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&x().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??i.A.geometryServiceUrl;let o,s,l,y,w,C,E,A,R=0;const I=[],O=[];for(const t of e)if(null!=t)if(o||(o=t.spatialReference,s=(0,h.Vp)(o),l=o.isWebMercator,C=l?102100:4326,y=u.j7[C].maxX,w=u.j7[C].minX,E=u.j7[C].plus180Line,A=u.j7[C].minus180Line),s)if("mesh"===t.type)O.push(t);else if("point"===t.type)O.push(T(t.clone(),y,w));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>T(e,y,w)),O.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,s);O.push(e.rings?new a.A(e):e)}else if(t.extent){const e=t.extent,r=(0,u.kd)(e.xmin,w)*(2*y);let i=0===r?t.clone():(0,u.kS)(t.clone(),r);e.offset(r,0);let{xmin:n,xmax:o}=e;n=Number(n.toFixed(9)),o=Number(o.toFixed(9)),e.intersects(E)&&o!==y?(R=o>R?o:R,i=b(i,l),I.push(i),O.push("cut")):e.intersects(A)&&n!==w?(R=o*(2*y)>R?o*(2*y):R,i=b(i,l,360),I.push(i),O.push("cut")):O.push(i)}else O.push(t.clone());else O.push(t);else O.push(t);let F=(0,u.kd)(R,y),N=-90;const D=F,P=new c.A;for(;F>0;){const e=360*F-180;P.addPath([[e,N],[e,-1*N]]),N*=-1,F--}if(I.length>0&&D>0){const t=M(I,await async function(e,t,r,i){const n=(0,g.Dl)(e),o=t[0].spatialReference,s={...i,responseType:"json",query:{...n.query,f:"json",sr:(0,h.YX)(o),target:JSON.stringify({geometryType:(0,m.$B)(t[0]),geometries:t}),cutter:JSON.stringify(r)}},a=await(0,f.A)(n.path+"/cut",s),{cutIndexes:c,geometries:l=[]}=a.data;return{cutIndexes:c,geometries:l.map(e=>{const t=(0,p.rS)(e);return t.spatialReference=o,t})}}(n,I,P,r)),i=[],o=[];for(let r=0;r<O.length;r++){const n=O[r];if("cut"!==n)o.push(n);else{const n=t.shift(),s=e[r];null!=s&&"polygon"===s.type&&s.rings&&s.rings.length>1&&n.rings.length>=s.rings.length?(i.push(n),o.push("simplify")):o.push(l?(0,d.Gh)(n):n)}}if(!i.length)return o;const s=await async function(e,t,r){const i="string"==typeof e?(0,v.An)(e):e,n=t[0].spatialReference,o=(0,m.$B)(t[0]),s={...r,query:{...i.query,f:"json",sr:(0,h.YX)(n),geometries:JSON.stringify((0,_.X)(t))}},{data:a}=await(0,f.A)(i.path+"/simplify",s);return(0,_.V)(a.geometries,o,n)}(n,i,r),a=[];for(let e=0;e<o.length;e++){const t=o[e];"simplify"!==t?a.push(t):a.push(l?(0,d.Gh)(s.shift()):s.shift())}return a}const B=[];for(let e=0;e<O.length;e++){const t=O[e];if("cut"!==t)B.push(t);else{const e=I.shift();B.push(!0===l?(0,d.Gh)(e):e)}}return B}function C(e,t,r){const i=(0,h.Vp)(r);if(null==i)return e;const[n,o]=i.valid,s=2*o;let a=0,c=0;t>o?a=Math.ceil(Math.abs(t-o)/s):t<n&&(a=-Math.ceil(Math.abs(t-n)/s)),e>o?c=Math.ceil(Math.abs(e-o)/s):e<n&&(c=-Math.ceil(Math.abs(e-n)/s));let l=e+(a-c)*s;const u=l-t;return u>o?l-=s:u<n&&(l+=s),l}function E(e){const t=(0,h.Vp)(e);if(null==t)return null;const[r,i]=t.valid;return new n.hr(r,i)}const A=E(l.A.WGS84);E(l.A.WebMercator)},80754(e,t,r){r.d(t,{j7:()=>s,kS:()=>c,kd:()=>a,r8:()=>l});var i=r(82799),n=r(16930),o=r(60408);const s={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new i.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator}),minus180Line:new i.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new i.A({paths:[[[180,-180],[180,180]]],spatialReference:n.A.WGS84}),minus180Line:new i.A({paths:[[[-180,-180],[-180,180]]],spatialReference:n.A.WGS84})}};function a(e,t){return Math.ceil((e-t)/(2*t))}function c(e,t){const r=l(e);for(const e of r)for(const r of e)r[0]+=t;return e}function l(e){return(0,o.Bi)(e)?e.rings:e.paths}},71351(e,t,r){r.d(t,{C:()=>u,Cr:()=>h,LV:()=>l,fA:()=>d,oC:()=>f,vt:()=>a}),r(4576);var i=r(4341),n=(r(77690),r(29242)),o=r(35522),s=r(51850);function a(e){return e?c((0,s.o8)(e.origin),(0,s.o8)(e.direction)):c((0,s.vt)(),(0,s.vt)())}function c(e,t){return{origin:e,direction:t}}function l(e,t){const r=m.get();return r.origin=e,r.direction=t,r}function u(e,t=a()){return d(e.origin,e.direction,t)}function h(e,t,r=a()){return(0,o.C)(r.origin,e),(0,o.Re)(r.direction,t,e),r}function d(e,t,r=a()){return(0,o.C)(r.origin,e),(0,o.C)(r.direction,t),r}function f(e,t,r){const i=(0,o.Om)(e.direction,(0,o.Re)(r,t,e.origin));return(0,o.WQ)(r,e.origin,(0,o.hs)(r,e.direction,i)),r}r(32114);const m=new i.I(()=>a());(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,n.vt)()},94008(e,t,r){r.d(t,{iy:()=>f}),r(44208),r(53966);var i=r(34727),n=r(34304),o=r(58083),s=r(35522),a=r(51850),c=r(91829),l=r(34275);var u=r(71351),h=r(44280),d=r(32114);class f{constructor(e=0,t=0,r=0,i=0){this.radius=i,"number"==typeof e?this._center=(0,a.fA)(e,t,r):function(e){return t=e,(0,l.vZ)(t)&&t.length>=3||function(e){return((0,l.aI)(e)||Array.isArray(e))&&e.length>=3}(e);var t}(e)||function(e){return(t=e)instanceof Float32Array&&t.length>=4||function(e){return Array.isArray(e)&&e.length>=4}(e);var t}(e)?(this._center=(0,a.ci)(e),this.radius=4===e.length?e[3]:t):(this._center=(0,a.o8)(e.center),this.radius=e.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(e){(0,s.C)(this.center,e)}exactEquals(e){return(0,s.aI)(this._center,e.center)&&this.radius===e.radius}copyFrom(e){return e!==this&&((0,s.C)(this._center,e.center),this.radius=e.radius),this}clone(){return new f(this.center,this.radius)}toVec4(){return(0,c.fA)(this.center[0],this.center[1],this.center[2],this.radius)}contains(e){return(0,s.hG)(this.center,e)<=this.radius**2}intersectRay(e,t){if(null==e)return!1;if(!this._intersect(e,m))return!1;let{t0:r,t1:i}=m;if((r<0||i<r&&i>0)&&(r=i),r<0)return!1;if(t){const{origin:i,direction:n}=e;t[0]=i[0]+n[0]*r,t[1]=i[1]+n[1]*r,t[2]=i[2]+n[2]*r}return!0}intersectLine(e,t){const r=(0,u.Cr)(e,t);if(!this._intersect(r,m))return[];const{origin:i,direction:o}=r,{t0:c,t1:l}=m,h=e=>{const t=(0,a.vt)();return(0,s.Ln)(t,i,o,e),this.projectPoint(t,t)};return Math.abs(c-l)<(0,n.FD)()?[h(c)]:[h(c),h(l)]}_intersect(e,t){const{origin:r,direction:i}=e,n=p;n[0]=r[0]-this.center[0],n[1]=r[1]-this.center[1],n[2]=r[2]-this.center[2];const o=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(0===o)return!1;const s=2*(i[0]*n[0]+i[1]*n[1]+i[2]*n[2]),a=s*s-4*o*(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]-this.radius**2);if(a<0)return!1;const c=Math.sqrt(a);return t.t0=(-s-c)/(2*o),t.t1=(-s+c)/(2*o),!0}projectPoint(e,t){const r=(0,s.Re)(d.rq.get(),e,this.center),i=(0,s.hs)(d.rq.get(),r,this.radius/(0,s.Bw)(r));return(0,s.WQ)(t,i,this.center)}closestPointOnSilhouette(e,t){const r=d.rq.get(),i=d.Rc.get();(0,s.$A)(r,e.origin,e.direction),(0,s.$A)(t,r,e.origin),(0,s.hs)(t,t,1/(0,s.Bw)(t)*this.radius);const n=this._angleToSilhouette(e.origin),a=(0,h.g7)(e.origin,t);return(0,o.$0)(i,a+n,r),(0,s.Z0)(t,t,i),t}frustumCoverage(e,t,r){const i=this.radius,n=i*i,o=e+.5*Math.PI,s=t*t+n-2*Math.cos(o)*t*i,a=Math.sqrt(s),c=s-n;if(c<=0)return.5;const l=Math.sqrt(c),u=Math.acos(l/a)-Math.asin(i/(a/Math.sin(o)));return Math.min(1,(u+.5*r)/r)}_angleToSilhouette(e){const t=(0,s.Re)(d.rq.get(),e,this.center),r=(0,s.Bw)(t),n=this.radius,o=n+Math.abs(n-r);return(0,i.XM)(n/o)}union(e){const t=(0,s.Io)(this._center,e.center),r=this.radius,i=e.radius;return t+i<r?this:t+r<i?(this.copyFrom(e),this):((0,s.Cc)(this._center,this._center,e.center,(t+i-r)/(2*t)),this.radius=(t+r+i)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}signedDistanceToPlane(e){const{center:t,radius:r}=this,i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3];return i<0?Math.min(i+r,0):Math.max(i-r,0)}}new f;const m={t0:0,t1:0},p=(0,a.vt)();(0,a.vt)(),(0,a.vt)()},38969(e,t,r){r.d(t,{i:()=>n});var i=r(37955);function n(e,t){return new Promise((r,n)=>{e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?r():(t((0,i.Oo)(e,"canplay",r)),t((0,i.Oo)(e,"error",n)))})}},92300(e,t,r){r.d(t,{V:()=>s,X:()=>o});var i=r(60408),n=r(65864);function o(e){return{geometryType:(0,i.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function s(e,t,r){const i=(0,n.xD)(t);return e.map(e=>{const t=i.fromJSON(e);return t.spatialReference=r,t})}},21015(e,t,r){r.d(t,{R:()=>c});var i=r(11254),n=r(60999),o=r(49186),s=r(17676),a=r(84952);class c{constructor(e=e=>e){this._resolveURI=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,a.DB)(e)?((0,s.Te)(t),(0,a.lJ)(e)):this._load("array-buffer",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,r){t=this._resolveURI(t);const a=await(0,n.Ke)((0,i.A)(t,{responseType:e,...r}));if(a.ok)return a.value.data;throw(0,s.QP)(a.error),new o.A("gltf-loader-request-error",`Request for resource failed: ${a.error}`)}}},84498(e,t,r){r.d(t,{x:()=>s});var i=r(34275),n=r(97146),o=r(63907);function s(e,t){switch(t){case o.WR.TRIANGLES:return function(e){return"number"==typeof e?(0,n.tM)(e):(0,i.mg)(e)?new Uint16Array(e):e}(e);case o.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const r=t-2,i=(0,n.my)(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;t+=1)t%2==0?(i[e++]=t,i[e++]=t+1,i[e++]=t+2):(i[e++]=t+1,i[e++]=t,i[e++]=t+2)}else{let t=0;for(let n=0;n<r;n+=1)n%2==0?(i[t++]=e[n],i[t++]=e[n+1],i[t++]=e[n+2]):(i[t++]=e[n+1],i[t++]=e[n],i[t++]=e[n+2])}return i}(e);case o.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,i=r<=65536?new Uint16Array(3*r):new Uint32Array(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;++t)i[e++]=0,i[e++]=t+1,i[e++]=t+2;return i}const n=e[0];let o=e[1],s=0;for(let t=0;t<r;++t){const r=e[t+2];i[s++]=n,i[s++]=o,i[s++]=r,o=r}return i}(e)}}},51530(e,t,r){r.d(t,{KB:()=>s,Xi:()=>n,pn:()=>a,x3:()=>o});var i=r(44208);class n{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding="image/ktx2"}}function o(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 a(e,t){if("image/ktx2"===t)return new n(e);const r=new Blob([e],{type:t});let o=URL.createObjectURL(r);switch(t){case"image/jpeg":o+="#.jpg";break;case"image/png":o+="#.png"}const s=new Image;if((0,i.A)("esri-iPhone"))return new Promise((e,t)=>{const r=()=>{n(),e(s)},i=e=>{n(),t(e)},n=()=>{URL.revokeObjectURL(o),s.removeEventListener("load",r),s.removeEventListener("error",i)};s.addEventListener("load",r),s.addEventListener("error",i),s.src=o});try{s.src=o,await s.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(o),s}},91202(e,t,r){r.d(t,{fetch:()=>Er});var i=r(40876),n=r(61473),o=r(34727),s=r(77690),a=r(29242),c=r(58083),l=r(9093),u=r(48163),h=r(35522),d=r(51850),f=r(70328),m=r(34275);function p(e,t=!1){return e<=m.y9?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var g=r(13030),v=r(73354),_=r(50867),x=r(43609),y=r(21015),w=r(84498),b=r(51530),T=r(88340);function M(e){if(null==e)return null;const t=null!=e.offset?e.offset:T.uY,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:T.Un,n=(0,a.fA)(1,0,0,0,1,0,t[0],t[1],1),o=(0,a.fA)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),c=(0,a.fA)(i[0],0,0,0,i[1],0,0,0,1),l=(0,a.vt)();return(0,s.lw)(l,o,c),(0,s.lw)(l,n,l),l}class S{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new S,this.numberOfVertices=0}}var E=r(11254),A=r(60999),R=r(49186),I=r(53966),O=r(69397);class F{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get outerSize(){return this._outer.size}get size(){let e=0;for(const t of this._outer.values())e+=t.size;return e}get(e,t){return this._outer.get(e)?.get(t)}getInner(e){return this._outer.get(e)}set(e,t,r){const i=this._outer.get(e);i?i.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))}pop(e,t){const r=this.get(e,t);return this.delete(e,t),r}*outerMap(){for(const e of this._outer)yield e}*values(){for(const e of this._outer.values())yield*e.values()}*[Symbol.iterator](){for(const[e,t]of this._outer)for(const[r,i]of t)yield[e,r,i]}forEach(e){this._outer.forEach((t,r)=>e(t,r))}forAll(e){this._outer.forEach((t,r)=>t.forEach((t,i)=>e(t,r,i)))}copy(){const e=new F;return this.forAll((t,r,i)=>e.set(r,i,t)),e}}var N=r(17676),D=r(46140),P=r(97146);async function B(e,t){return(await(0,E.A)(e,{responseType:"image",...t})).data}var H=r(46610),L=r(20498);function z(e){if(e.length<m.y9)return Array.from(e);if(Array.isArray(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,m.LW)(e)?(0,L.pX)().from(e):(0,m.jq)(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var U=r(15142),G=r(620);class V{get center(){return(0,d.fA)(this._data[0],this._data[1],this._data[2])}get radius(){return this._data[3]}get bbMin(){return(0,d.fA)(this._data[4],this._data[5],this._data[6])}get bbMax(){return(0,d.fA)(this._data[7],this._data[8],this._data[9])}constructor(e,t,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.position=r,this._data=[.1,0,0,0,0,0,0,0,0,0],this._children=void 0,(0,G.vA)(e.length>=1),(0,G.vA)(3===r.size||4===r.size);const{data:i,size:n,indices:o}=r;(0,G.vA)(o.length%this._numIndexPerPrimitive===0),(0,G.vA)(o.length>=e.length*this._numIndexPerPrimitive);const s=e.length;let a=n*o[this._numIndexPerPrimitive*e[0]];j.clear(),j.push(a);const c=(0,d.fA)(i[a],i[a+1],i[a+2]),l=(0,d.o8)(c);for(let t=0;t<s;++t){const r=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){a=n*o[r+e],j.push(a);let t=i[a];c[0]=Math.min(t,c[0]),l[0]=Math.max(t,l[0]),t=i[a+1],c[1]=Math.min(t,c[1]),l[1]=Math.max(t,l[1]),t=i[a+2],c[2]=Math.min(t,c[2]),l[2]=Math.max(t,l[2])}}for(let e=0;e<3;++e)this._data[4+e]=c[e],this._data[7+e]=l[e];const u=(0,h.Cc)((0,d.vt)(),this.bbMin,this.bbMax,.5);let f=.5*Math.max(Math.max(l[0]-c[0],l[1]-c[1]),l[2]-c[2]),m=f*f;for(let e=0;e<j.length;++e){a=j.at(e);const t=i[a]-u[0],r=i[a+1]-u[1],n=i[a+2]-u[2],o=t*t+r*r+n*n;if(o<=m)continue;const s=Math.sqrt(o),c=.5*(s-f);f+=c,m=f*f;const l=c/s;u[0]+=t*l,u[1]+=r*l,u[2]+=n*l}this._data[3]=f;for(let e=0;e<3;++e)this._data[0+e]=u[e];j.clear()}getChildren(){if(this._children||(0,h.hG)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,h.Cc)((0,d.vt)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o,indices:s}=this.position;for(let a=0;a<t;++a){let t=0;const c=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=o*s[c],u=n[l],h=n[l+1],d=n[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=o*s[c+e];const t=n[l],r=n[l+1],i=n[l+2];t<u&&(u=t),r<h&&(h=r),i<d&&(d=i)}u<e[0]&&(t|=1),h<e[1]&&(t|=2),d<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const c=new Array(8);for(let e=0;e<8;++e)c[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];c[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array;for(let e=0;e<8;++e)void 0!==c[e]&&this._children.push(new V(c[e],this._numIndexPerPrimitive,this.position));return this._children}static prune(){j.prune()}}const j=new U.A({deallocator:null});var k=r(24326);class W{constructor(e){this.id=(0,k.c)(),this._attributes=new Map;for(const[t,r]of e)this._attributes.set(t,{...r,indices:(0,P.Dg)(r.indices)})}get attributes(){return this._attributes}}var $=r(4341),Z=r(11964);function q(e,t,r){return(0,h.Re)(Y,t,e),(0,h.Re)(X,r,e),.5*(0,h.Bw)((0,h.$A)(Y,Y,X))}r(32114),new $.I(Z.vt),new $.I(()=>{return e?{p0:(0,d.o8)(e.p0),p1:(0,d.o8)(e.p1),p2:(0,d.o8)(e.p2)}:{p0:(0,d.vt)(),p1:(0,d.vt)(),p2:(0,d.vt)()};var e});const Y=(0,d.vt)(),X=(0,d.vt)(),J=(0,d.vt)(),K=(0,d.vt)(),Q=(0,d.vt)(),ee=(0,d.vt)();class te{constructor(){this.uid=(0,k.c)()}}class re extends te{constructor(e){super(),this.highlightName=e,this.channel=0}}var ie=r(94656);class ne extends W{constructor(e,t,r=null,i=0,n=null,o=-1,s,a){super(t),this.material=e,this.mapPositions=r,this.type=i,this.olidColor=n,this.edgeIndicesLength=o,this.baseGeometry=s,this.drawIndices=a,this._vertexPositionIndicesCache=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.visible=!0,this._boundingInfo=null,(0,G.vA)((e?.useIndexing??!1)===(null!=a),"Material index requirement and Geometry must match");const c=this.positionAttribute;null!=c&&this.edgeIndicesLength<0&&(this.edgeIndicesLength=c.indices.length)}instantiate(e={}){const t=new ne(e.material||this.material,[],this.mapPositions,this.type,this.olidColor,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);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}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:z(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}):(0,ie.en)()&&console.warn(`Setting undefined attribute ${e} data`)}get primitivePositionIndices(){if(void 0!==this._vertexPositionIndicesCache)return this._vertexPositionIndicesCache;const{drawIndices:e}=this,t=this.positionAttribute;if(null!=e&&null!=t){const r=new Array;for(const i of e)r.push(t.indices[i]);this._vertexPositionIndicesCache=r}else this._vertexPositionIndicesCache=t?.indices??null;return this._vertexPositionIndicesCache}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const e=this.drawIndices??this.positionAttribute?.indices;return e?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(e){return!!(0===this.type?this._computeAttachmentOriginTriangles(e):2===this.type?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(null!=this._transformation&&(0,h.Z0)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){return function(e,t,r=t?.indices){if(!t||!r)return!1;const{size:i,data:n}=t;(0,h.hZ)(e,0,0,0),(0,h.hZ)(ee,0,0,0);let o=0,s=0;for(let t=0;t<r.length-2;t+=3){const a=r[t]*i,c=r[t+1]*i,l=r[t+2]*i;(0,h.hZ)(J,n[a],n[a+1],n[a+2]),(0,h.hZ)(K,n[c],n[c+1],n[c+2]),(0,h.hZ)(Q,n[l],n[l+1],n[l+2]);const u=q(J,K,Q);u?((0,h.WQ)(J,J,K),(0,h.WQ)(J,J,Q),(0,h.hs)(J,J,1/3*u),(0,h.WQ)(e,e,J),o+=u):((0,h.WQ)(ee,ee,J),(0,h.WQ)(ee,ee,K),(0,h.WQ)(ee,ee,Q),s+=3)}return!(0===s&&0===o||(0!==o?((0,h.hs)(e,e,1/o),0):0===s||((0,h.hs)(e,ee,1/s),0)))}(e,this.positionAttribute,this.primitivePositionIndices)}_computeAttachmentOriginLines(e){const t=this.positionAttribute,r=this.primitivePositionIndices;return function(e,t,r,i=t?.indices){if(!t||!i)return!1;(0,h.hZ)(e,0,0,0),(0,h.hZ)(ee,0,0,0);let n=0,o=0;const{size:s,data:a}=t,c=i.length-1,l=c+(r?2:0);for(let t=0;t<l;t+=2){const r=t<c?t+1:0,l=i[t<c?t:c]*s,u=i[r]*s;J[0]=a[l],J[1]=a[l+1],J[2]=a[l+2],K[0]=a[u],K[1]=a[u+1],K[2]=a[u+2],(0,h.hs)(J,(0,h.WQ)(J,J,K),.5);const d=(0,h.xg)(J,K);d>0?((0,h.WQ)(e,e,(0,h.hs)(J,J,d)),n+=d):0===n&&((0,h.WQ)(ee,ee,J),o++)}return 0!==n?((0,h.hs)(e,e,1/n),!0):0!==o&&((0,h.hs)(e,ee,1/o),!0)}(e,t,function(e,t){return!(!("isClosed"in e)||!e.isClosed)&&t.indices.length>2}(this.material.parameters,t),r)}_computeAttachmentOriginPoints(e){return function(e,t,r=t?.indices){if(!t||!r)return!1;const{size:i,data:n}=t;(0,h.hZ)(e,0,0,0);let o=-1,s=0;for(let t=0;t<r.length;t++){const a=r[t]*i;o!==a&&(e[0]+=n[a],e[1]+=n[a+1],e[2]+=n[a+2],s++),o=a}return s>1&&(0,h.hs)(e,e,1/s),s>0}(e,this.positionAttribute,this.primitivePositionIndices)}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){const e=this.positionAttribute,t=this.primitivePositionIndices;if(!e||!t||0===t.length)return null;const r=t===e.indices?e:new H.n(e.data,t,e.size,!1,e.stride),i=0===this.type?3:1;(0,G.vA)(t.length%i===0,"Indexing error: "+t.length+" not divisible by "+i);const n=(0,P.tM)(t.length/i);return new V(n,i,r)}get transformation(){return this._transformation??l.zK}set transformation(e){this._transformation=e&&e!==l.zK?(0,l.o8)(e):null}get highlights(){return this._highlights||oe}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(e){this._highlightOptionsCounts?.forEach((t,r)=>e(r))}allocateIdAndHighlight(e){const t=new re(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);const{highlightName:t}=e,r=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,r),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){const{highlightName:t}=e,r=this._highlightOptionsCounts?.get(t)??0;r<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,r-1)}}}const oe=new Set;var se=r(65529),ae=r(97768),ce=r(84952),le=r(38969),ue=r(95117),he=r(2741);let de;var fe=r(63907),me=r(76284),pe=r(42293);let ge=null,ve=null;async function _e(){return null==ve&&(de??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,he.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),ve=de,ge=await ve),ve}function xe(e,t,r,i,n){const o=(0,pe.MW)(t?fe.CQ.COMPRESSED_RGBA8_ETC2_EAC:fe.CQ.COMPRESSED_RGB8_ETC2),s=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*s)}function ye(e){return e.getNumImages()>=1&&!e.isUASTC()}function we(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}function be(e,t,r,i,n,o,s,a){const{compressedTextureETC:c,compressedTextureS3TC:l}=e.capabilities,[u,h]=c?i?[1,fe.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,fe.CQ.COMPRESSED_RGB8_ETC2]:l?i?[3,fe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,fe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],d=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<d;e++)f.push(new Uint8Array(s(e,u))),a(e,u,f[e]);return t.internalFormat=h,t.hasMipmap=f.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new me.A(e,t,{type:"compressed",levels:f})}const Te=()=>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 Se=Me("DXT1"),Ce=Me("DXT3"),Ee=Me("DXT5");function Ae(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function Re(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const s=Math.min(Math.sqrt(r/o),i/n);return[Ae(Math.round(e*s),i),Ae(Math.round(t*s),i)]}(e,t);return e.width===r&&e.height===i?e:Ie(e,r,i)}function Ie(e,t,r){if(e instanceof ImageData)return Ie(function(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("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);const i=document.createElement("canvas");return i.width=t,i.height=r,i.getContext("2d").drawImage(e,0,0,i.width,i.height),i}var Oe=r(67171);class Fe{constructor(e,t){this._data=e,this.id=(0,k.c)(),this.events=new se.bk,this._parameters={...De,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(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",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,le.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_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 Oe.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||function(e,t){if(null==e)return 0;if((0,m.mw)(e)||(0,m.mg)(e))return"image/ktx2"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.KTX2File(new Uint8Array(e)),i=we(r)?xe(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):"image/x.basis"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.BasisFile(new Uint8Array(e)),i=ye(r)?xe(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Ne(e):t,n=t.pixelFormat??6408,o=(0,pe.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const t=this._data;return null==t?(this._texture=new me.A(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,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,m.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,m.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,m.mw)(t)||(0,m.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,m.mw)(t)||(0,m.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,m.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,m.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return Te().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Te().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case Se:n=8,o=fe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ce:n=16,o=fe.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ee:n=16,o=fe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Te().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let s=1,a=r[4],c=r[3];(3&a||3&c)&&(Te().warn("Rounding up compressed texture size to nearest multiple of 4."),a=a+3&-4,c=c+3&-4);const l=a,u=c;let h,d;131072&r[2]&&!1!==t&&(s=Math.max(1,r[7]));let f=e.byteOffset+r[1]+4;const m=[];for(let t=0;t<s;++t)d=(a+3>>2)*(c+3>>2)*n,h=new Uint8Array(e.buffer,f,d),m.push(h),f+=d,a=Math.max(1,a>>1),c=Math.max(1,c>>1);return{textureData:{type:"compressed",levels:m},internalFormat:o,width:l,height:u}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:s,height:a}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=s,t.height=a,new me.A(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.KTX2File(new Uint8Array(r));if(!we(i))return null;i.startTranscoding();const n=be(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.BasisFile(new Uint8Array(r));if(!ye(i))return null;i.startTranscoding();const n=be(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,G.vA)(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new me.A(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await B(t,{signal:r});return(0,N.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,ue.y)(t,t.src,!1,r);return(0,N.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((i,n)=>{const o=()=>{t.removeEventListener("loadeddata",s),t.removeEventListener("error",a),(0,ae.xt)(c)},s=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(o(),i(this._loadFromImage(e,t)))},a=e=>{o(),n(e||new R.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",s),t.addEventListener("error",a);const c=(0,N.u7)(r,()=>a((0,N.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=Re(r,e.parameters));const i=Ne(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._texture=new me.A(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,ae.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function Ne(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const De={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};var Pe=r(49255);class Be{constructor(e){this._material=e.material,this._techniques=e.techniques}dispose(){}get _stippleTextures(){return this._techniques.context?.stippleTextures}get _markerTextures(){return this._techniques.context?.markerTextures}getTechnique(e,t){return this._techniques.get(e,this._material.getConfiguration(t))}ensureResources(e){return 2}}var He=r(65786);class Le extends Be{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this.updateTexture(e.textureId),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(){super.dispose(),this._texture=(0,ae.Gz)(this._texture),this._textureNormal=(0,ae.Gz)(this._textureNormal),this._textureEmissive=(0,ae.Gz)(this._textureEmissive),this._textureOcclusion=(0,ae.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,ae.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}get textureBindParameters(){return new Ue(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,ae.Gz)(this._texture),this._acquire(e,e=>this._texture=e))}_acquire(e,t){if(null==e)return void t(null);const r=this._textures.acquire(e);if((0,N.$X)(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return(0,ae.Gz)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(r)}}class ze extends He.Y{constructor(e=null){super(),this.textureEmissive=e}}class Ue extends ze{constructor(e,t,r,i,n,o,s){super(r),this.texture=e,this.textureNormal=t,this.textureOcclusion=i,this.textureMetallicRoughness=n,this.scale=o,this.normalTextureTransformMatrix=s}}var Ge=r(19245);class Ve{constructor(e,t){this.id=(0,k.c)(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,(0,Ge.MB)(this._parameters,e),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,Ge.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.bind.decorations)&&0!==(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())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(e){return this.updateConfiguration(e),this._configuration}updateConfiguration(e){this._configuration.output=e.output,this._configuration.hasEmission=e.hasEmission&&(0,Pe._o)(e.output),this._configuration.hasHighlightMixTexture=10===e.output&&null!=e.highlightMixTexture,this._configuration.useFloatBlend=e.useFloatBlend.value}}He.Y;class je{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const ke=(0,f.vt)();function We(e,t,r,i,n,o){if(!e.visible)return;const s=(0,h.jb)(nt,i,r),{tolerance:a}=t,c=new je(a,!1,t.options.normalRequired);if(e.boundingInfo)(0,G.vA)(0===e.type),Ze(e.boundingInfo,r,s,a,n,c,o);else{const t=e.positionAttribute,i=e.primitivePositionIndices;!function(e,t,r,i,n,o,s,a,c,l){const u=t,d=ot,f=Math.abs(u[0]),m=Math.abs(u[1]),p=Math.abs(u[2]),g=f>=m?f>=p?0:2:m>=p?1:2,v=g,_=u[v]<0?2:1,x=(g+_)%3,y=(g+(3-_))%3,w=u[x]/u[v],b=u[y]/u[v],T=1/u[v],M=Ye,S=Xe,C=Je,{normalRequired:E}=c;for(let t=r;t<i;++t){const r=3*t,i=s*n[r];(0,h.hZ)(d[0],o[i+0],o[i+1],o[i+2]);const c=s*n[r+1];(0,h.hZ)(d[1],o[c+0],o[c+1],o[c+2]);const u=s*n[r+2];(0,h.hZ)(d[2],o[u+0],o[u+1],o[u+2]),a&&((0,h.C)(d[0],a.applyToVertex(d[0][0],d[0][1],d[0][2],t)),(0,h.C)(d[1],a.applyToVertex(d[1][0],d[1][1],d[1][2],t)),(0,h.C)(d[2],a.applyToVertex(d[2][0],d[2][1],d[2][2],t))),(0,h.jb)(M,d[0],e),(0,h.jb)(S,d[1],e),(0,h.jb)(C,d[2],e);const f=M[x]-w*M[v],m=M[y]-b*M[v],p=S[x]-w*S[v],g=S[y]-b*S[v],_=C[x]-w*C[v],A=C[y]-b*C[v],R=_*g-A*p,I=f*A-m*_,O=p*m-g*f;if((R<0||I<0||O<0)&&(R>0||I>0||O>0))continue;const F=R+I+O;if(0===F)continue;const N=R*(T*M[v])+I*(T*S[v])+O*(T*C[v]);if(N*Math.sign(F)<0)continue;const D=N/F;D>=0&&l(D,E?Qe(d):null,t)}}(r,s,0,i.length/3,i,t.data,t.stride,n,c,o)}}const $e=(0,d.vt)();function Ze(e,t,r,i,n,o,s){if(null==e)return;const a=function(e,t){return(0,h.hZ)(t,1/e[0],1/e[1],1/e[2])}(r,$e);if((0,f.Ne)(ke,e.bbMin),(0,f.vI)(ke,e.bbMax),null!=n&&n.applyToAabb(ke),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let s=Math.min(n,o),a=Math.max(n,o);const c=(e[1]-i-t[1])*r[1],l=(e[4]+i-t[1])*r[1];if(a=Math.min(a,Math.max(c,l)),a<0)return!1;if(s=Math.max(s,Math.min(c,l)),s>a)return!1;const u=(e[2]-i-t[2])*r[2],h=(e[5]+i-t[2])*r[2];return a=Math.min(a,Math.max(u,h)),!(a<0)&&(s=Math.max(s,Math.min(u,h)),!(s>a)&&s<1/0)}(e,t,r,i)}(ke,t,a,i)){const{primitiveIndices:a,position:c}=e,l=a?a.length:c.indices.length/3;if(l>rt){const a=e.getChildren();if(void 0!==a){for(const e of a)Ze(e,t,r,i,n,o,s);return}}!function(e,t,r,i,n,o,s,a,c,l,u){const h=e[0],d=e[1],f=e[2],m=t[0],p=t[1],g=t[2],{normalRequired:v}=l;for(let e=0;e<i;++e){const t=a[e],r=3*t,i=s*n[r];let l=o[i],_=o[i+1],x=o[i+2];const y=s*n[r+1];let w=o[y],b=o[y+1],T=o[y+2];const M=s*n[r+2];let S=o[M],C=o[M+1],E=o[M+2];null!=c&&([l,_,x]=c.applyToVertex(l,_,x,e),[w,b,T]=c.applyToVertex(w,b,T,e),[S,C,E]=c.applyToVertex(S,C,E,e));const A=w-l,R=b-_,I=T-x,O=S-l,F=C-_,N=E-x,D=p*N-F*g,P=g*O-N*m,B=m*F-O*p,H=A*D+R*P+I*B;if(Math.abs(H)<=it)continue;const L=h-l,z=d-_,U=f-x,G=L*D+z*P+U*B;if(H>0){if(G<0||G>H)continue}else if(G>0||G<H)continue;const V=z*I-R*U,j=U*A-I*L,k=L*R-A*z,W=m*V+p*j+g*k;if(H>0){if(W<0||G+W>H)continue}else if(W>0||G+W<H)continue;const $=(O*V+F*j+N*k)/H;$>=0&&u($,v?Ke(A,R,I,O,F,N,qe):null,t)}}(t,r,0,l,c.indices,c.data,c.stride,a,n,o,s)}}const qe=(0,d.vt)();const Ye=(0,d.vt)(),Xe=(0,d.vt)(),Je=(0,d.vt)();function Ke(e,t,r,i,n,o,s){return(0,h.hZ)(et,e,t,r),(0,h.hZ)(tt,i,n,o),(0,h.$A)(s,et,tt),(0,h.S8)(s,s),s}function Qe(e){return(0,h.jb)(et,e[1],e[0]),(0,h.jb)(tt,e[2],e[0]),(0,h.$A)(qe,et,tt),(0,h.S8)(qe,qe),qe}const et=(0,d.vt)(),tt=(0,d.vt)(),rt=1e3,it=1e-7,nt=(0,d.vt)(),ot=[(0,d.vt)(),(0,d.vt)(),(0,d.vt)()];var st=r(16396);function at(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length;r*=s;for(let e=0;e<a;++e){const t=2*n[e];o[r]=i[t],o[r+1]=i[t+1],r+=s}}function ct(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,c=o.length;if(r*=a,1===i)for(let e=0;e<c;++e){const t=3*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}else for(let e=0;e<c;++e){const t=3*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}}function lt(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,c=o.length;if(r*=a,1===i)for(let e=0;e<c;++e){const t=4*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}else for(let e=0;e<c;++e){const t=4*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}}function ut(e,t,r,i,n=1){const o=t.typedBuffer,s=t.typedBufferStride;if(i*=s,1===n)for(let t=0;t<r;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s;else for(let t=0;t<r;++t)for(let t=0;t<n;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s}function ht(e,t,r,i,n,o){switch(e){case"position":{(0,G.vA)(3===t.size);const i=n.getField(e,g.xs);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ct(e,r,i,n);const{data:o,indices:s}=e,a=r.typedBuffer,l=r.typedBufferStride,u=s.length,h=t[0],d=t[1],f=t[2],m=t[4],p=t[5],g=t[6],v=t[8],_=t[9],x=t[10],y=t[12],w=t[13],b=t[14];i*=l;let T=0,M=0,S=0;const C=(0,c.tZ)(t)?e=>{T=o[e]+y,M=o[e+1]+w,S=o[e+2]+b}:e=>{const t=o[e],r=o[e+1],i=o[e+2];T=h*t+m*r+v*i+y,M=d*t+p*r+_*i+w,S=f*t+g*r+x*i+b};if(1===n)for(let e=0;e<u;++e)C(3*s[e]),a[i]=T,a[i+1]=M,a[i+2]=S,i+=l;else for(let e=0;e<u;++e){C(3*s[e]);for(let e=0;e<n;++e)a[i]=T,a[i+1]=M,a[i+2]=S,i+=l}}(t,r,i,o);break}case"normal":{(0,G.vA)(3===t.size);const r=n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ct(e,r,i,n);const{data:o,indices:s}=e,a=t,l=r.typedBuffer,u=r.typedBufferStride,h=s.length,d=a[0],f=a[1],m=a[2],p=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,c.ut)(a),b=1e-6,T=1-b;i*=u;let M=0,S=0,C=0;const E=(0,c.tZ)(a)?e=>{M=o[e],S=o[e+1],C=o[e+2]}:e=>{const t=o[e],r=o[e+1],i=o[e+2];M=d*t+p*r+_*i,S=f*t+g*r+x*i,C=m*t+v*r+y*i};if(1===n)if(w)for(let e=0;e<h;++e){E(3*s[e]);const t=M*M+S*S+C*C;if(t<T&&t>b){const e=1/Math.sqrt(t);l[i]=M*e,l[i+1]=S*e,l[i+2]=C*e}else l[i]=M,l[i+1]=S,l[i+2]=C;i+=u}else for(let e=0;e<h;++e)E(3*s[e]),l[i]=M,l[i+1]=S,l[i+2]=C,i+=u;else for(let e=0;e<h;++e){if(E(3*s[e]),w){const e=M*M+S*S+C*C;if(e<T&&e>b){const t=1/Math.sqrt(e);M*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[i]=M,l[i+1]=S,l[i+2]=C,i+=u}}(t,i,r,o);break}case"normalCompressed":case"profileRight":case"profileUp":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"uv0":{(0,G.vA)(2===t.size);const r=n.getField(e,g.ZD)??n.getField(e,g.gH);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"uvi":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"color":case"symbolColor":{const r=n.getField(e,g.XP);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(3===t.size||4===t.size),function(e,t,r,i,n=1){const{data:o,indices:s}=e,a=r.typedBuffer,c=r.typedBufferStride,l=s.length;if(i*=c,t===o.length&&4===t){a[i]=o[0],a[i+1]=o[1],a[i+2]=o[2],a[i+3]=o[3];const e=new Uint32Array(r.typedBuffer.buffer,r.start),t=c/4,s=e[i/=4];i+=t;const u=l*n;for(let r=1;r<u;++r)e[i]=s,i+=t;return}if(1!==n)if(4!==t)for(let e=0;e<l;++e){const t=3*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=c}else for(let e=0;e<l;++e){const t=4*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=c}return}for(let e=0;e<l;++e){const t=3*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=c}}}(t,t.size,r,o);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const r=n.getField(e,g.Y$)??n.getField(e,g.Y$);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(1===t.size),function(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length,c=i[0];r*=s;for(let e=0;e<a;++e)o[r]=c,r+=s}(t,r,o);break}case"tangent":{(0,G.vA)(4===t.size);const i=n.getField(e,g.Eq);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void lt(e,r,i,n);const{data:o,indices:s}=e,a=t,l=r.typedBuffer,u=r.typedBufferStride,h=s.length,d=a[0],f=a[1],m=a[2],p=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,c.ut)(a),b=1e-6,T=1-b;if(i*=u,1===n)for(let e=0;e<h;++e){const t=4*s[e],r=o[t],n=o[t+1],a=o[t+2],c=o[t+3];let h=d*r+p*n+_*a,M=f*r+g*n+x*a,S=m*r+v*n+y*a;if(w){const e=h*h+M*M+S*S;if(e<T&&e>b){const t=1/Math.sqrt(e);h*=t,M*=t,S*=t}}l[i]=h,l[i+1]=M,l[i+2]=S,l[i+3]=c,i+=u}else for(let e=0;e<h;++e){const t=4*s[e],r=o[t],a=o[t+1],c=o[t+2],h=o[t+3];let M=d*r+p*a+_*c,S=f*r+g*a+x*c,C=m*r+v*a+y*c;if(w){const e=M*M+S*S+C*C;if(e<T&&e>b){const t=1/Math.sqrt(e);M*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[i]=M,l[i+1]=S,l[i+2]=C,l[i+3]=h,i+=u}}(t,r,i,o);break}case"profileVertexAndNormal":{(0,G.vA)(4===t.size);const r=n.getField(e,g.jz)??n.getField(e,g.Eq);(0,G.vA)(!!r,`No buffer view for ${e}`),lt(t,r,o);break}case"profileAuxData":{(0,G.vA)(3===t.size);const r=n.getField(e,g.EC)??n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),ct(t,r,o);break}}}(0,d.vt)();class dt{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return function(e,t,r,i,n,o,s){let a={numItems:0,numVerticesPerItem:0};for(const c of r.fields.keys()){const r=e.get(c),l=r?.indices;if(r&&l)"position"===c&&(a={numItems:1,numVerticesPerItem:l.length}),ht(c,r,i,n,o,s);else if("olidColor"===c&&null!=t){const r=e.get("position")?.indices;if(r){const e=r.length;ut(t,o.getField(c,g.XP),e,s)}}}return a}(r,i,this.layout,e,t,n,o)}}const ft={factor:1,units:1},mt={factor:-1,units:-2},pt=new Array;pt[0]=null,pt[1]=ft,pt[2]={factor:-5,units:-5},pt[3]={factor:0,units:-4},pt[4]={factor:1,units:2};const gt=pt.map(e=>function(e,t){return t?{factor:e.factor+t.factor,units:e.units+t.units}:e}(mt,e));function vt({output:e,enableOITOffset:t,polygonOffset:r}){return(0,Pe.Sp)(e)&&t?gt[r]:pt[r]}pt[1]=ft;const _t=(0,d.vt)();var xt=r(5482),yt=r(91429),wt=r(91829),bt=r(4431),Tt=r(1843),Mt=r(72824),St=r(13840),Ct=r(42958),Et=r(16943),At=r(90644);const Rt=(0,At.p3)(1,0,1,771);function It(e,t=!1){switch(e){case 0:return t?At.RC:At.T8;case 1:return Rt;default:return null}}function Ot(e){if(e.draped)return null;switch(e.output){case 0:case 2:default:return e.writeDepth?At.Uy:null;case 1:return null}}function Ft(e,t=513){return{func:(0,Pe.Sp)(e)?515:t}}const Nt={mask:255},Dt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Pt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Bt=r(4576);r(66289);var Ht=r(69622),Lt=r(32728);class zt{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",g.Eq),this.color=e.getField("instanceColor",g.XP),this.olidColor=e.getField("instanceOlidColor",g.XP),this.state=e.getField("state",g.SL),this.lodLevel=e.getField("lodLevel",g.SL)}}let Ut=class extends Ht.A{constructor(e,t){super(e),this.events=new se.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return Vt(Gt.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=Zt,this._buffer=this._layout.createBuffer(this._capacity),this._view=new zt(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=jt,i=kt;t.localTransform.getMat(e,Wt),t.globalTransform.getMat(e,$t);const n=(0,c.lw)($t,$t,Wt);(0,h.hZ)(r,n[12],n[13],n[14]),t.modelOrigin.setVec(e,r),(0,s.z0)(i,n),t.model.setMat(e,i);const o=(0,Lt.wp)(jt,n);o.sort(),t.modelScaleFactors.set(e,0,o[1]),t.modelScaleFactors.set(e,1,o[2]),(0,s.B8)(i,i),(0,s.mg)(i,i),t.modelNormal.setMat(e,i),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,kt),r.modelOrigin.getVec(e,jt),t[0]=kt[0],t[1]=kt[1],t[2]=kt[2],t[3]=0,t[4]=kt[3],t[5]=kt[4],t[6]=kt[5],t[7]=0,t[8]=kt[6],t[9]=kt[7],t[10]=kt[8],t[11]=0,t[12]=jt[0],t[13]=jt[1],t[14]=jt[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=Math.max(jt[0],jt[1],jt[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(jt[0],jt[1],jt[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(Zt,Math.floor(this._capacity*Bt.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new zt(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,xt.Cg)([(0,yt.MZ)({constructOnly:!0})],Ut.prototype,"shaderTransformation",void 0),(0,xt.Cg)([(0,yt.MZ)()],Ut.prototype,"_size",void 0),(0,xt.Cg)([(0,yt.MZ)({readOnly:!0})],Ut.prototype,"size",null),Ut=(0,xt.Cg)([(0,yt.$K)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],Ut);const Gt=(0,Tt.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function Vt(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,Et.E)()&&e.vec4u8("instanceOlidColor"),e}const jt=(0,d.vt)(),kt=(0,a.vt)(),Wt=(0,l.vt)(),$t=(0,l.vt)(),Zt=64,qt=(0,Tt.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var Yt=r(74810),Xt=r(28491),Jt=r(49788);class Kt extends Mt.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=Yt.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=d.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,d.CN)(.2,.2,.2),this.diffuse=(0,d.CN)(.8,.8,.8),this.externalColor=(0,wt.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,d.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=Jt.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}Mt.gy;let Qt=class extends Ct.w{constructor(e,t){let i=(0,bt.U)(rr(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat((0,bt.U)(function(e){return Vt(qt.clone(),e)}(t)))),super(e,t,i),this.shader=new St.r(Xt.D,()=>r.e(5141).then(r.bind(r,5141))),this.ignoreUnused=!0}_makePipeline(e,t){const{output:r,transparent:i,cullFace:n,customDepthTest:o,hasOccludees:s}=e;return(0,At.Ey)({blending:i?It(r):null,culling:tr(e)?(0,At.Xt)(n):null,depthTest:Ft(r,er(o)),depthWrite:Ot(e),colorWrite:At.kn,stencilWrite:s?Nt:null,stencilTest:s?t?Pt:Dt:null,polygonOffset:vt(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};function er(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function tr(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function rr(e){const t=(0,Tt.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,Et.E)()&&t.vec4u8("olidColor"),t}Qt=(0,xt.Cg)([(0,yt.$K)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],Qt);var ir=r(51976),nr=r(68317);class or extends nr.Hz{constructor(){super(...arguments),this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1}}(0,xt.Cg)([(0,ir.W)()],or.prototype,"hasHighlightMixTexture",void 0);class sr extends or{constructor(){super(...arguments),this.polygonOffset=0,this.transparent=!1,this.enableOITOffset=!0}}(0,xt.Cg)([(0,ir.W)({count:5})],sr.prototype,"polygonOffset",void 0),(0,xt.Cg)([(0,ir.W)()],sr.prototype,"transparent",void 0),(0,xt.Cg)([(0,ir.W)()],sr.prototype,"enableOITOffset",void 0);class ar extends sr{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}(0,xt.Cg)([(0,ir.W)({count:4})],ar.prototype,"alphaDiscardMode",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"doubleSidedMode",void 0),(0,xt.Cg)([(0,ir.W)({count:7})],ar.prototype,"pbrMode",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"cullFace",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"normalType",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"customDepthTest",void 0),(0,xt.Cg)([(0,ir.W)({count:8})],ar.prototype,"emissionSource",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVertexColors",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasSymbolColors",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVerticalOffset",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasColorTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasMetallicRoughnessTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOcclusionTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasNormalTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasScreenSizePerspective",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVertexTangents",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOccludees",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instanced",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedDoublePrecision",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasModelTransformation",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"offsetBackfaces",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVVSize",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVVColor",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"receiveShadows",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"receiveAmbientOcclusion",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"textureAlphaPremultiplied",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedFeatureAttribute",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedColor",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"writeDepth",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"terrainDepthTest",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"cullAboveTerrain",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"snowCover",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasColorTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasEmissionTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasNormalTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOcclusionTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasMetallicRoughnessTextureTransform",void 0);var cr=r(57323);let lr=class extends Qt{constructor(){super(...arguments),this.shader=new St.r(cr.R,()=>r.e(2314).then(r.bind(r,39933)))}};lr=(0,xt.Cg)([(0,yt.$K)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],lr);class ur extends Ve{constructor(e,t){super(e,dr),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(0,Pe.uw)(e)&&!this.transparent],[4,e=>(0,Pe.uw)(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>(0,Pe.uw)(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=rr(this.parameters),this._configuration=new ar(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=Jt.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,h.t2)(this.parameters.emissiveBaseColor,d.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:i,doubleSided:n,doubleSidedType:o}=t;r.hasVertexTangents=!i&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=i?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!i&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=i?2:n&&"normal"===o?1:n&&"winding-order"===o?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,(0,Pe._o)(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,t,r,i,n,o){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,h.hZ)(_r,t[12],t[13],t[14]);let o=null;switch(r.viewingMode){case 1:o=(0,h.S8)(gr,_r);break;case 2:o=(0,h.C)(gr,pr)}const s=(0,h.Re)(xr,_r,e.eye),a=(0,h.Bw)(s),c=(0,h.hs)(s,s,1/a);let l=null;this.parameters.screenSizePerspective&&(l=(0,h.Om)(o,c));const u=(0,Ge.kE)(e,a,this.parameters.verticalOffset,l??0,this.parameters.screenSizePerspective,null);(0,h.hs)(o,o,u),(0,h.ei)(vr,o,r.transform.inverseRotation),i=(0,h.Re)(fr,i,vr),n=(0,h.Re)(mr,n,vr)}o=function(e,t,r,i){const n=vt(t);if(!n)return e;const o=5e-6*n.units,s=(0,h.S8)(_t,(0,h.jb)(_t,i,r));return(t,r,i)=>{const a=(r?1-Math.abs((0,h.Om)(s,r)):0)*n.factor*5e-5+o;return e(t+a,r,i)}}(o,this._configuration,i,n),We(e,r,i,n,(0,st.ou)(r.verticalOffset),o)}createGLMaterial(e){return new hr(e)}createBufferWriter(){return new dt(this._layout)}get transparent(){return function(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:s,textureAlphaMode:a,colorMixMode:c}=e,l=i[3];return t||r<1&&"replace"!==c||l<1&&"ignore"!==c||n<1||(null!=o||null!=s)&&1!==a&&2!==a&&"replace"!==c}(this.parameters)}}class hr extends Le{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,h.hZ)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?lr:Qt,e)}}class dr extends Kt{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const fr=(0,d.vt)(),mr=(0,d.vt)(),pr=(0,d.fA)(0,0,1),gr=(0,d.vt)(),vr=(0,d.vt)(),_r=(0,d.vt)(),xr=(0,d.vt)(),yr=()=>I.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class wr{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}function br(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(yr().warn("Geometry must specify vertex attributes"),i=!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&&(yr().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(yr().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(yr().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else yr().warn("Indexed geometries must specify faces"),i=!1;break}default:yr().warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(yr().warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(yr().warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Tr(e){const t=(0,f.Ie)();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&((0,f.iT)(t,r.bbMin),(0,f.iT)(t,r.bbMax))}),t}function Mr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function Sr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Cr=new D.A(1,2,"wosr");async function Er(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=await(0,A.Ke)((0,E.A)(e,t));if(r.ok)return r.value.data;(0,N.QP)(r.error),function(e){throw new R.A("",`Request for object resource failed: ${e}`)}(r.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const n=e[i],o=n.images[0].data;if(!o){yr().warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+o,a="/textureDefinitions/"+i,c="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",l={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==Mr(c)},u=t?.disableTextures?Promise.resolve(null):B(s,t);r.push(u.then(e=>({refId:a,image:e,parameters:l,alphaChannelUsage:c})))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}(r.textureDefinitions??{},t);let n=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];n+=t?.image?t.image.width*t.image.height*4:0}return new wr(r,i,n+(0,O.Qh)(r))}(a.url,t)),{engineResources:r,referenceBoundingBox:i}=function(e,t){const r=new Array,i=new Array,n=new Array,o=new F,s=e.resource,a=D.A.parse(s.version||"1.0","wosr");Cr.validate(a);const c=s.model.name,l=s.model.geometries,u=s.materialDefinitions??{},h=e.textures;let f=0;const m=new Map;for(let e=0;e<l.length;e++){const s=l[e];if(!br(s))continue;const a=Sr(s),c=s.params.vertexAttributes,p=[],g=e=>{if("PerAttributeArray"===s.params.topology)return null;const t=s.params.faces;for(const r in t)if(r===e)return t[r].values;return null},v=c.position,_=v.values.length/v.valuesPerElement;for(const e in c){const t=c[e],r=t.values,i=g(e)??(0,P.tM)(_);p.push([e,new H.n(r,i,t.valuesPerElement,!0)])}const x=a.texture,y=h&&h[x];if(y&&!m.has(x)){const{image:e,parameters:t}=y,r=new Fe(e,t);i.push(r),m.set(x,r)}const w=m.get(x),b=w?w.id:void 0,T=a.material;let M=o.get(T,x);if(null==M){const e=u[T.slice(T.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=y?Mr(y.alphaChannelUsage):void 0,i={ambient:(0,d.ci)(e.diffuse),diffuse:(0,d.ci)(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:b,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:y?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(i,t.materialParameters),M=new ur(i,t),o.set(T,x,M)}n.push(M);const S=new ne(M,p);f+=p.find(e=>"position"===e[0])?.[1]?.indices.length??0,r.push(S)}return{engineResources:[{name:c,stageResources:{textures:i,materials:n,geometries:r},pivotOffset:s.model.pivotOffset,numberOfVertices:f,lodThreshold:null}],referenceBoundingBox:Tr(r)}}(e,t);return{lods:r,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let m;if(t.cache)m=await t.cache.loadGLTF(a.url,t,!!t.usePBR,!!t.useEmissive);else{const{loadGLTF:e}=await r.e(1698).then(r.bind(r,51698));m=await e(new y.R,a.url,t,t.usePBR,t.useEmissive)}const{engineResources:T,referenceBoundingBox:S}=function(e,t,r){const n=e.model,a=e.meta,m=n.meta?.ESRI_proxyEllipsoid,y=a.isEsriSymbolResource&&null!=m&&"EsriRealisticTreesStyle"===a.ESRI_webstyle;y&&!e.customMeta.esriTreeRendering&&(e.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 s=o.attributes.position,a=s.count,u=(0,d.vt)(),f=(0,d.vt)(),m=(0,d.vt)(),p=new Float32Array(4*a),v=new Float32Array(3*a),_=(0,c.B8)((0,l.vt)(),o.transform);let x=0,y=0;for(let c=0;c<a;c++){s.getVec(c,f),n.getVec(c,u),(0,h.Z0)(f,f,o.transform),(0,h.Re)(m,f,t.center),(0,h.Qr)(m,m,t.radius);const a=m[2],l=(0,h.Bw)(m),d=Math.min(.45+.55*l*l,1)**i.Tf;(0,h.Qr)(m,m,t.radius),null!==_&&(0,h.Z0)(m,m,_),(0,h.S8)(m,m),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,h.Cc)(m,m,u,a>-1?.2:Math.min(-4*a-3.8,1)),v[x]=m[0],v[x+1]=m[1],v[x+2]=m[2],x+=3,p[y]=d,p[y+1]=d,p[y+2]=d,p[y+3]=1,y+=4}o.attributes.normal=new g.xs(v.buffer),o.attributes.color=new g.Eq(p.buffer)}}}(e,m));const T=!!t.usePBR,S=a.isEsriSymbolResource?{usePBR:T,isSchematic:!1,treeRendering:y,mrrFactors:Yt.SY}:{usePBR:T,isSchematic:!1,treeRendering:!1,mrrFactors:Yt.mb},E={...t.materialParameters,treeRendering:y},A=new Array,R=new Map,I=new Map,O=n.lods.length,F=(0,f.Ie)();return n.lods.forEach((e,a)=>{const c=!0===t.skipHighLods&&(O>1&&0===a||O>3&&1===a)||!1===t.skipHighLods&&null!=r&&a!==r;if(c&&0!==a)return;const l=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const r=c?new ur({},t):function(e,t,r,n,o,s,a,c,l){const h=e.materials.get(t.material);if(null==h)return null;const{normal:d,color:f,texCoord0:m,tangent:p}=t.attributes,g=t.material+(d?"_normal":"")+(f?"_color":"")+(m?"_texCoord0":"")+(p?"_tangent":""),v=null!=t.attributes.texCoord0,_=null!=t.attributes.normal,x=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(h.alphaMode);if(!s.has(g)){if(v){const t=(t,r=!1,i=!1)=>{if(null!=t&&!a.has(t)){const n=e.textures.get(t);if(n){const e=n.data,o=r&&!(0,b.x3)(e)?c.compressionOptions:void 0;a.set(t,new Fe((0,b.x3)(e)?e.data:e,{...n.parameters,preMultiplyAlpha:!(0,b.x3)(e)&&i,encoding:(0,b.x3)(e)?e.encoding:void 0,compressionOptions:o}))}}},r=1!==x&&!l;t(h.colorTexture,r,1!==x),t(h.normalTexture),t(h.occlusionTexture,!0),t(h.emissiveTexture),t(h.metallicRoughnessTexture,!0)}const r=(0,i.xV)(h.color[0]),d=(0,i.xV)(h.color[1]),f=(0,i.xV)(h.color[2]),m=null!=h.colorTexture&&v?a.get(h.colorTexture):null,p=(0,Yt.Jr)(h),y=null!=h.normalTextureTransform?.scale?h.normalTextureTransform?.scale:u.Un;s.set(g,new ur({...n,customDepthTest:1,textureAlphaMode:x,textureAlphaCutoff:h.alphaCutoff,diffuse:[r,d,f],ambient:[r,d,f],opacity:"OPAQUE"===h.alphaMode?1:h.opacity,doubleSided:h.doubleSided,doubleSidedType:"winding-order",cullFace:h.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:_?0:2,castShadows:!0,receiveShadows:h.receiveShadows,receiveAmbientOcclusion:h.receiveAmbientOcclusion,textureId:null!=m?m.id:void 0,colorMixMode:h.colorMixMode,normalTextureId:null!=h.normalTexture&&v?a.get(h.normalTexture).id:void 0,textureAlphaPremultiplied:null!=m&&!!m.parameters.preMultiplyAlpha,occlusionTextureId:null!=h.occlusionTexture&&v?a.get(h.occlusionTexture).id:void 0,emissiveTextureId:null!=h.emissiveTexture&&v?a.get(h.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=h.metallicRoughnessTexture&&v?a.get(h.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[h.emissiveFactor[0],h.emissiveFactor[1],h.emissiveFactor[2]],emissiveStrengthKHR:null!=h.emissiveStrengthKHR?h.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=o.emissiveStrengthFromSymbol?o.emissiveStrengthFromSymbol:void 0,mrrFactors:p?Yt.Bt:[h.metallicFactor,h.roughnessFactor,n.mrrFactors[2]],isSchematic:p,colorTextureTransformMatrix:M(h.colorTextureTransform),normalTextureTransformMatrix:M(h.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:M(h.occlusionTextureTransform),emissiveTextureTransformMatrix:M(h.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:M(h.metallicRoughnessTextureTransform),...o},c))}const y=s.get(g);if(r.stageResources.materials.push(y),v){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(h.colorTexture),e(h.normalTexture),e(h.occlusionTexture),e(h.emissiveTexture),e(h.metallicRoughnessTexture)}return y}(n,e,l,S,E,R,I,t,y),{geometry:h,vertexCount:d}=function(e,t){const r=e.attributes.position.count,i=(0,w.x)(e.indices||r,e.primitiveType),n=p(3*r),{typedBuffer:a,typedBufferStride:c}=e.attributes.position;(0,v.t)(n,a,e.transform,3,c);const l=[["position",new H.n(n,i,3,!0)]];if(null!=e.attributes.normal){const t=p(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,s.Ge)(Ar,e.transform),(0,v.b)(t,n,Ar,3,a),(0,o.or)(Ar)&&(0,v.n)(t,t),l.push(["normal",new H.n(t,i,3,!0)])}if(null!=e.attributes.tangent){const t=p(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,s.z0)(Ar,e.transform),(0,_.t)(t,n,Ar,4,a),(0,o.or)(Ar)&&(0,v.n)(t,t,4),l.push(["tangent",new H.n(t,i,4,!0)])}if(null!=e.attributes.texCoord0){const t=p(2*r),{typedBuffer:n,typedBufferStride:o}=e.attributes.texCoord0;(0,x.a)(t,n,2,o),l.push(["uv0",new H.n(t,i,2,!0)])}const u=e.attributes.color;if(null!=u){const t=new Uint8Array(4*r);4===u.elementCount?u instanceof g.Eq?(0,_.b)(t,u,1,255):(u instanceof g.XP||u instanceof g.Uz)&&(0,_.b)(t,u,1/255,255):(t.fill(255),u instanceof g.xs?(0,v.f)(t,u.typedBuffer,1,255,4,u.typedBufferStride):(e.attributes.color instanceof g.eI||e.attributes.color instanceof g.nS)&&(0,v.f)(t,u.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),l.push(["color",new H.n(t,i,4,!0)])}return{geometry:new ne(t,l),vertexCount:r}}(e,r??new ur({},t)),m=h.boundingInfo;null!=m&&0===a&&((0,f.iT)(F,m.bbMin),(0,f.iT)(F,m.bbMax)),null!=r&&(l.stageResources.geometries.push(h),l.numberOfVertices+=d)}),c||A.push(l)}),{engineResources:A,referenceBoundingBox:F}}(m,t,a.specifiedLodIndex);return{lods:T,referenceBoundingBox:S,isEsriSymbolResource:m.meta.isEsriSymbolResource,isWosr:!1}}const Ar=(0,a.vt)()},1843(e,t,r){r.d(t,{BP:()=>h,l5:()=>d});var i=r(20498),n=r(13030),o=r(90239),s=r(4431),a=r(620),c=r(85079);class l{constructor(e,t,r=0){this.layout=e,this.byteOffset=r,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fields.keys()){const i=e.fields.get(t);this[t]=new i.constructor(this.buffer,r+i.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new l(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,r=0,i=e.count){const n=this.stride;if(n%4==0){const o=new Uint32Array(e.buffer,t*n,i*n/4);new Uint32Array(this.buffer,r*n,i*n/4).set(o)}else{const o=new Uint8Array(e.buffer,t*n,i*n);new Uint8Array(this.buffer,r*n,i*n).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}}class u{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:p(e[1].constructor)})))}freeze(){return this}get locations(){return(0,c.Xk)((0,s.U)(this))}vec2f16(e,t){return this._appendField(e,i.SX?n.ZD:n.gH,t),this}vec2f(e,t){return this._appendField(e,n.gH,t),this}vec2f64(e,t){return this._appendField(e,n.si,t),this}vec3f16(e,t){return this._appendField(e,i.SX?n.EC:n.xs,t),this}vec3f(e,t){return this._appendField(e,n.xs,t),this}vec3f64(e,t){return this._appendField(e,n.Xm,t),this}vec4f16(e,t){return this._appendField(e,i.SX?n.jz:n.Eq,t),this}vec4f(e,t){return this._appendField(e,n.Eq,t),this}vec4f64(e,t){return this._appendField(e,n.Aj,t),this}mat3f(e,t){return this._appendField(e,n.jZ,t),this}mat3f64(e,t){return this._appendField(e,n.j0,t),this}mat4f(e,t){return this._appendField(e,n.Sx,t),this}mat4f64(e,t){return this._appendField(e,n.E$,t),this}vec4u8(e,t){return this._appendField(e,n.XP,t),this}f16(e,t){return this._appendField(e,i.SX?n.XW:n.Y$,t),this}f32(e,t){return this._appendField(e,n.Y$,t),this}f64(e,t){return this._appendField(e,n.qB,t),this}u8(e,t){return this._appendField(e,n.SL,t),this}u16(e,t){return this._appendField(e,n.h,t),this}i8(e,t){return this._appendField(e,n.bf,t),this}vec2i8(e,t){return this._appendField(e,n.D6,t),this}vec2i16(e,t){return this._appendField(e,n.mJ,t),this}vec2u8(e,t){return this._appendField(e,n.LC,t),this}vec2u16(e,t){return this._appendField(e,n.Yi,t),this}vec4u16(e,t){return this._appendField(e,n.Uz,t),this}vec4i16(e,t){return this._appendField(e,n.E7,t),this}u32(e,t){return this._appendField(e,n.P,t),this}_appendField(e,t,r){this._fields.has(e)&&(0,a.vA)(!1,`${e} already added to vertex buffer layout`);const i=t.ElementCount*(0,o.GJ)(t.ElementType),n=this._stride;this._fields.set(e,{constructor:t,size:i,offset:n,optional:r}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(r=>{const i=(0,o.GJ)(r.constructor.ElementType);e=Math.floor((e+i-1)/i)*i,r.offset=e,e+=r.size,t=Math.max(t,i)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new l(this,e)}createView(e,t){return new l(this,e,t)}clone(){const e=new u;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,r)=>e._fields.set(r,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function h(){return new u}class d{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const r={...e,constructor:m(e.constructor)};this.fields.push([t,r])}),this.stride=e.stride}}const f=[n.Y$,n.gH,n.xs,n.Eq,n.jZ,n.Sx,n.qB,n.si,n.Xm,n.Aj,n.j0,n.E$,n.SL,n.LC,n.eI,n.XP,n.h,n.Yi,n.nS,n.Uz,n.P,n.An,n.H$,n.ml,n.bf,n.D6,n.m8,n.TX,n.Qt,n.mJ,n.Vp,n.E7,n.My,n.UL,n.zD,n.Y4];function m(e){return`${e.ElementType}_${e.ElementCount}`}function p(e){return g.get(e)}const g=new Map;f.forEach(e=>g.set(m(e),e))},4431(e,t,r){r.d(t,{U:()=>o});var i=r(63907),n=r(74038);function o(e,t=0){const r=e.stride;return Array.from(e.fields.keys()).map(o=>{const s=e.fields.get(o),a=s.constructor.ElementCount,c=function(e){switch(e){case"u8":return i.pe.UNSIGNED_BYTE;case"u16":return i.pe.UNSIGNED_SHORT;case"u32":return i.pe.UNSIGNED_INT;case"i8":return i.pe.BYTE;case"i16":return i.pe.SHORT;case"i32":return i.pe.INT;case"f16":return i.pe.HALF_FLOAT;case"f32":return i.pe.FLOAT;default:throw new Error("BufferType not supported in WebGL")}}(s.constructor.ElementType),l=s.offset,u=s.optional?.glNormalized??!1,h=s.optional?.integer??!1;return new n._(o,a,c,l,r,u,t,h)})}},26857(e,t,r){r.d(t,{b:()=>a});var i=r(5482),n=r(69622),o=r(91429);let s=class extends n.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.OCCLUSION_QUERY_DEBUG_PIXEL=!1,this.ENABLE_OPTIMIZATIONS=!0,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,this.FLOW_GLOBAL_SCALE_THRESHOLD=null}};(0,i.Cg)([(0,o.MZ)()],s.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_GRID",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LABELS_SHOW_BORDER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TEXT_SHOW_BASELINE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TEXT_SHOW_BORDER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OVERLAY_SHOW_CENTER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"SHOW_POI",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OCCLUSION_QUERY_DEBUG_PIXEL",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"ENABLE_OPTIMIZATIONS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"I3S_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"I3S_SHOW_MODIFICATIONS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LINE_WIREFRAMES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FLOW_GLOBAL_SCALE_THRESHOLD",void 0),s=(0,i.Cg)([(0,o.$K)("esri.views.3d.support.debugFlags")],s);const a=new s},46686(e,t,r){r.d(t,{o:()=>n});var i=r(31821);function n(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(i.H`
233
+ fragBlur = b / w_total;`),e}const d=Object.freeze(Object.defineProperty({__proto__:null,build:h},Symbol.toStringTag,{value:"Module"}))},43609(e,t,r){r.d(t,{a:()=>o,f:()=>s,n:()=>n});var i=r(34275);function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=2,n=r){const o=t.length/2;let s=0,a=0;if(!(0,i.iu)(t)||(0,i.dk)(t)){for(let i=0;i<o;++i)e[s]=t[a],e[s+1]=t[a+1],s+=r,a+=n;return}const c=(0,i.a3)(t);if((0,i.JI)(t))for(let i=0;i<o;++i)e[s]=Math.max(t[a]/c,-1),e[s+1]=Math.max(t[a+1]/c,-1),s+=r,a+=n;else for(let i=0;i<o;++i)e[s]=t[a]/c,e[s+1]=t[a+1]/c,s+=r,a+=n}function s(e,t,r,i){const n=e.typedBuffer,o=e.typedBufferStride,s=i?.count??e.count;let a=(i?.dstIndex??0)*o;for(let e=0;e<s;++e)n[a]=t,n[a+1]=r,a+=o}Object.freeze(Object.defineProperty({__proto__:null,fill:s,normalizeIntegerBuffer:o,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},73354(e,t,r){r.d(t,{a:()=>d,b:()=>c,c:()=>a,d:()=>o,e:()=>f,f:()=>h,l:()=>u,n:()=>p,t:()=>s});var i=r(40876),n=(r(44208),r(72727));function o(e,t,r){s(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a),l=r[0],u=r[1],h=r[2],d=r[4],f=r[5],p=r[6],m=r[8],g=r[9],v=r[10],_=r[12],x=r[13],w=r[14];let y=0,b=0;for(let r=0;r<c;r++){const r=t[y],n=t[y+1],s=t[y+2];e[b]=l*r+d*n+m*s+_,e[b+1]=u*r+f*n+g*s+x,e[b+2]=h*r+p*n+v*s+w,y+=o,b+=i}return e}function a(e,t,r){c(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function c(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a),l=r[0],u=r[1],h=r[2],d=r[3],f=r[4],p=r[5],m=r[6],g=r[7],v=r[8];let _=0,x=0;for(let r=0;r<c;r++){const r=t[_],n=t[_+1],s=t[_+2];e[x]=l*r+d*n+m*s,e[x+1]=u*r+f*n+g*s,e[x+2]=h*r+p*n+v*s,_+=o,x+=i}}function l(e,t,r,i=3,n=i){const o=Math.min(e.length/i,t.length/n);let s=0,a=0;for(let c=0;c<o;c++)e[a]=r*t[s],e[a+1]=r*t[s+1],e[a+2]=r*t[s+2],s+=n,a+=i;return e}function u(e,t,r,i){h(e.typedBuffer,t.typedBuffer,r,i,e.typedBufferStride,t.typedBufferStride)}function h(e,t,r,n,o=3,s=o){const a=Math.min(e.length/o,t.length/s);let c=0,l=0;const u=1/i.Tf;for(let i=0;i<a;i++)e[l]=n*(r*t[c])**u,e[l+1]=n*(r*t[c+1])**u,e[l+2]=n*(r*t[c+2])**u,c+=s,l+=o}function d(e,t,r,i=3,o=i){const s=(0,n.k)(e.length,i,3),a=(0,n.k)(t.length,o,3),c=Math.min(s,a);let l=0,u=0;for(let n=0;n<c;n++)e[u]=t[l]+r[0],e[u+1]=t[l+1]+r[1],e[u+2]=t[l+2]+r[2],l+=o,u+=i;return e}function f(e,t){p(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function p(e,t,r=3,i=r){const n=Math.min(e.length/r,t.length/i);let o=0,s=0;for(let a=0;a<n;a++){const n=t[o],a=t[o+1],c=t[o+2],l=n*n+a*a+c*c;if(l>0){const t=1/Math.sqrt(l);e[s]=t*n,e[s+1]=t*a,e[s+2]=t*c}o+=i,s+=r}}Object.freeze(Object.defineProperty({__proto__:null,linearToSRGB:h,linearToSRGBView:u,normalize:p,normalizeView:f,scale:l,scaleView:function(e,t,r){l(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)},shiftRight:function(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,s=t.typedBuffer,a=t.typedBufferStride;let c=0,l=0;for(let e=0;e<i;e++)n[l]=s[c]>>r,n[l+1]=s[c+1]>>r,n[l+2]=s[c+2]>>r,c+=a,l+=o},transformMat3:c,transformMat3View:a,transformMat4:s,transformMat4View:o,translate:d},Symbol.toStringTag,{value:"Module"}))},69052(e,t,r){r.d(t,{hr:()=>n,ie:()=>c,uC:()=>a});var i=r(34727);class n{constructor(e,t){this.min=e,this.max=t,this.range=t-e}normalize(e,t=0,r=!1){return o(this.range,this.min,this.max,e,t,r)}clamp(e,t=0){return(0,i.qE)(e-t,this.min,this.max)+t}monotonic(e,t,r){return e<t?t:t+s(this.range,e-t,r)}minimalMonotonic(e,t,r){return o(this.range,e,e+this.range,t,r)}center(e,t,r){return t=this.monotonic(e,t,r),this.normalize((e+t)/2,r)}diff(e,t,r){return this.monotonic(e,t,r)-e}shortestSignedDiff(e,t){e=this.normalize(e);const r=(t=this.normalize(t))-e,i=t<e?this.minimalMonotonic(e,t)-e:t-this.minimalMonotonic(t,e);return Math.abs(r)<Math.abs(i)?r:i}contains(e,t,r){return t=this.minimalMonotonic(e,t),(r=this.minimalMonotonic(e,r))>e&&r<t}}function o(e,t,r,i,n=0,o=!1){return(i-=n)<t?i+=s(e,t-i):i>r&&(i-=s(e,i-r)),o&&i===r&&(i=t),i+n}function s(e,t,r=0){return Math.ceil((t-r)/e)*e+r}const a=new n(0,2*Math.PI),c=(new n(-Math.PI,Math.PI),new n(0,360))},4341(e,t,r){r.d(t,{I:()=>n});var i=r(26390);class n{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.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*o);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,o));e++)this._items.push(this._allocator())}}const o=1024},46140(e,t,r){r.d(t,{A:()=>n});var i=r(49186);class n{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}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new n(this.major,this.minor,this._context)}static parse(e,t=""){const[r,o]=e.split("."),s=/^\s*\d+\s*$/;if(!r?.match||!s.test(r))throw new i.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!o?.match||!s.test(o))throw new i.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),c=parseInt(o,10);return new n(a,c,t)}}},61473(e,t,r){function i(e){return e=e||globalThis.location.hostname,l.some(t=>null!=e?.match(t))}function n(e,t){return e?(t=t||globalThis.location.hostname)?null!=t.match(o)||null!=t.match(a)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(s)||null!=t.match(c)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e:null}r.d(t,{EM:()=>n,b5:()=>i});const o=/^devext\.arcgis\.com$/,s=/^qaext\.arcgis\.com$/,a=/^[\w-]*\.mapsdevext\.arcgis\.com$/,c=/^[\w-]*\.mapsqa\.arcgis\.com$/,l=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local\.esri\.com$/,o,s,/^jsapps\.esri\.com$/,a,c]},88340(e,t,r){function i(){return new Float32Array(2)}function n(e,t){const r=new Float32Array(2);return r[0]=e,r[1]=t,r}function o(){return i()}function s(){return n(1,1)}function a(){return n(1,0)}function c(){return n(0,1)}r.d(t,{Un:()=>u,fA:()=>n,uY:()=>l,vt:()=>i});const l=o(),u=s(),h=a(),d=c();Object.freeze(Object.defineProperty({__proto__:null,ONES:u,UNIT_X:h,UNIT_Y:d,ZEROS:l,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:i,fromValues:n,ones:s,unitX:a,unitY:c,zeros:o},Symbol.toStringTag,{value:"Module"}))},69397(e,t,r){r.d(t,{Qf:()=>c,Qh:()=>s,RS:()=>n,Ul:()=>f,i5:()=>d,lM:()=>o,qK:()=>u});var i=r(34275);const n=16;function o(e){if(!e)return 0;let t=u;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return c(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return l(e,8);let r=h;for(let i=0;i<t;i++)r+=a(e[i]);return r}(e);let t=u;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r]));return t}function a(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return n;case"boolean":return 4;default:return 8}}function c(...e){return e.reduce((e,t)=>e+(t?(0,i.iu)(t)?t.byteLength+d:Array.isArray(t)?l(t,n):0:0),0)}function l(e,t){return h+e.length*t}const u=32,h=16,d=145,f=64},65806(e,t,r){r.d(t,{g:()=>s});var i=r(51850),n=r(91218),o=r(9762);function s(e,t,r,i){if((0,n.canProjectWithoutEngine)(e.spatialReference,r))return a[0]=e.x,a[1]=e.y,a[2]=e.z??0,(0,o.projectBuffer)(a,e.spatialReference,0,t,r,0);const s=(0,n.tryProject)(e,r,i);return!!s&&(t[0]=s.x,t[1]=s.y,t[2]=s.z??0,!0)}const a=(0,i.vt)()},27993(e,t,r){r.d(t,{F:()=>a});var i=r(91218),n=r(16930),o=r(9762),s=r(65806);function a(e,t,r,n){return!(null==t||null==n||e.length<2)&&((0,i.canProjectWithoutEngine)(t,n)?(0,o.projectBuffer)(e,t,0,r,n,0,1):(c.x=e[0],c.y=e[1],c.z=e[2],c.spatialReference=t,(0,s.g)(c,r,n)))}const c={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:n.A.WGS84,type:"point"}},97146(e,t,r){r.d(t,{Dg:()=>o,my:()=>s,tM:()=>u,uW:()=>n});var i=r(34275);function n(e){return o(e,!0)}function o(e,t){if(Array.isArray(e)){if(e.length<i.y9)return e}else if(e.length<i.y9)return Array.from(e);let r=!0,n=!0;return e.some((e,t)=>(r=r&&0===e,n=n&&e===t,!r&&!n)),r?function(e){if(1===e)return c;if(e<i.y9)return new Array(e).fill(0);if(e>d.length){const t=Math.max(2*d.length,e);d=new Uint8Array(t)}return new Uint8Array(d.buffer,0,e)}(e.length):n?u(e.length):(0,i.iu)(e)&&e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT?e:function(e,t){for(const r of e){if(r>=65536)return(0,i.iu)(e)?e:new Uint32Array(e);r>=256&&(t=!1)}return t?new Uint8Array(e):new Uint16Array(e)}(e,!t)}function s(e){return e<=i.y9?new Array(e):e<=65536?new Uint16Array(e):new Uint32Array(e)}let a=h(131072);const c=[0],l=(()=>{const e=new Uint16Array(65536);for(let t=0;t<e.length;++t)e[t]=t;return e})();function u(e){return 1===e?c:e<i.y9?Array.from(new Uint16Array(l.buffer,0,e)):e<l.length?new Uint16Array(l.buffer,0,e):(e>a.length&&(a=h(Math.max(2*a.length,e))),new Uint32Array(a.buffer,0,e))}function h(e){const t=new Uint32Array(e);for(let e=0;e<t.length;e++)t[e]=e;return t}let d=new Uint8Array(65536)},72727(e,t,r){function i(e,t,r){if(t<=0)return 0;const i=e-r;return i<0?0:Math.floor(i/t)+1}r.d(t,{k:()=>i}),r(53966)},90239(e,t,r){function i(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":case"f16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}r.d(t,{GJ:()=>i})},82919(e,t,r){r.d(t,{DV:()=>v,C:()=>m,vt:()=>f,Qy:()=>p,ui:()=>g,ST:()=>w,bU:()=>y,pw:()=>x,m7:()=>_,c8:()=>T});var i=r(4341),n=r(58083),o=r(35522),s=r(51850),a=r(78955),c=r(91829),l=r(71351);function u(e){return e?{ray:(0,l.vt)(e.ray),c0:e.c0,c1:e.c1}:{ray:(0,l.vt)(),c0:0,c1:Number.MAX_VALUE}}new i.I(()=>u());var h=r(27921),d=r(32114);function f(e){return e?[(0,h.vt)(e[0]),(0,h.vt)(e[1]),(0,h.vt)(e[2]),(0,h.vt)(e[3]),(0,h.vt)(e[4]),(0,h.vt)(e[5])]:[(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)(),(0,h.vt)()]}function p(){return[(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,s.vt)()]}function m(e,t){for(let r=0;r<M;r++)(0,h.C)(e[r],t[r]);return e}function g(e,t,r,i=A){const s=(0,n.lw)(d.Rc.get(),t,e);(0,n.B8)(s,s);for(let e=0;e<S;++e){const t=(0,a.Z0)(d.Km.get(),C[e],s);(0,o.hZ)(i[e],t[0]/t[3],t[1]/t[3],t[2]/t[3])}v(r,i)}function v(e,t){(0,h.Cr)(t[4],t[0],t[3],e[0]),(0,h.Cr)(t[1],t[5],t[6],e[1]),(0,h.Cr)(t[4],t[5],t[1],e[2]),(0,h.Cr)(t[3],t[2],t[6],e[3]),(0,h.Cr)(t[0],t[1],t[2],e[4]),(0,h.Cr)(t[5],t[4],t[7],e[5])}function _(e,t){for(let r=0;r<M;r++){const i=e[r];if(i[0]*t.center[0]+i[1]*t.center[1]+i[2]*t.center[2]+i[3]>=t.radius)return!1}return!0}function x(e,t){return b(e,function(e,t=u()){return(0,l.C)(e,t.ray),t.c0=0,t.c1=Number.MAX_VALUE,t}(t,E.get()))}function w(e,t,r){return b(e,function(e,t,r=u()){const i=(0,o.Bw)(e.vector);return(0,l.fA)(e.origin,t,r.ray),r.c0=0,r.c1=i,r}(t,r,E.get()))}function y(e,t){for(let r=0;r<M;r++)if((0,h.mN)(e[r],t)>0)return!1;return!0}function b(e,t){for(let r=0;r<M;r++)if(!(0,h.$Q)(e[r],t))return!1;return!0}const T={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},M=6,S=8,C=[(0,c.fA)(-1,-1,-1,1),(0,c.fA)(1,-1,-1,1),(0,c.fA)(1,1,-1,1),(0,c.fA)(-1,1,-1,1),(0,c.fA)(-1,-1,1,1),(0,c.fA)(1,-1,1,1),(0,c.fA)(1,1,1,1),(0,c.fA)(-1,1,1,1)],E=new i.I(u),A=p()},11964(e,t,r){r.d(t,{Cr:()=>u,LV:()=>l,_I:()=>h,vt:()=>c});var i=r(34727),n=r(4341),o=r(35522),s=r(51850),a=r(32114);function c(e){return e?{origin:(0,s.o8)(e.origin),vector:(0,s.o8)(e.vector)}:{origin:(0,s.vt)(),vector:(0,s.vt)()}}function l(e,t){const r=d.get();return r.origin=e,r.vector=t,r}function u(e,t,r=c()){return(0,o.C)(r.origin,e),(0,o.Re)(r.vector,t,e),r}function h(e,t,r){return function(e,t,r,n,s){const{vector:c,origin:l}=e,u=(0,o.Re)(a.rq.get(),t,l),h=(0,o.Om)(c,u)/(0,o.m3)(c);return(0,o.hs)(s,c,(0,i.qE)(h,0,1)),(0,o.WQ)(s,s,e.origin)}(e,t,0,0,r)}(0,s.vt)(),(0,s.vt)();const d=new n.I(()=>c())},17136(e,t,r){r.d(t,{Y_:()=>A,O7:()=>C,el:()=>S});var i=r(92602),n=r(69052),o=r(49186),s=r(53966),a=r(39829),c=r(82799),l=r(16930),u=r(80754),h=r(21325),d=r(28735),f=r(11254),p=r(60408),m=r(65864),g=r(2272),v=r(84952),_=r(92300);const x=()=>s.A.getLogger("esri.geometry.support.normalizeUtils");function w(e){return"polygon"===e[0].type}function y(e){return"polyline"===e[0].type}function b(e,t,r){if(t){const t=function(e,t){if(!(e instanceof c.A||e instanceof a.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw x().error(e),new o.A("internal:geometry",e)}const r=(0,u.r8)(e),i=[];for(const e of r){const r=[];i.push(r),r.push([e[0][0],e[0][1]]);for(let i=0;i<e.length-1;i++){const n=e[i][0],o=e[i][1],s=e[i+1][0],a=e[i+1][1],c=Math.sqrt((s-n)*(s-n)+(a-o)*(a-o)),l=(a-o)/c,u=(s-n)/c,h=c/t;if(h>1){for(let e=1;e<=h-1;e++){const i=e*t,s=u*i+n,a=l*i+o;r.push([s,a])}const e=(c+Math.floor(h-1)*t)/2,i=u*e+n,s=l*e+o;r.push([i,s])}r.push([s,a])}}return function(e){return"polygon"===e.type}(e)?new a.A({rings:i,spatialReference:e.spatialReference}):new c.A({paths:i,spatialReference:e.spatialReference})}(e,1e6);e=(0,d.ci)(t,!0)}return r&&(e=(0,u.kS)(e,r)),e}function T(e,t,r){if(Array.isArray(e)){const i=e[0];if(i>t){const r=(0,u.kd)(i,t);e[0]=i+r*(-2*t)}else if(i<r){const t=(0,u.kd)(i,r);e[0]=i+t*(-2*r)}}else{const i=e.x;if(i>t){const r=(0,u.kd)(i,t);e=e.clone().offset(r*(-2*t),0)}else if(i<r){const t=(0,u.kd)(i,r);e=e.clone().offset(t*(-2*r),0)}}return e}function M(e,t){let r=-1;for(let i=0;i<t.cutIndexes.length;i++){const n=t.cutIndexes[i],o=t.geometries[i],s=(0,u.r8)(o);for(let e=0;e<s.length;e++){const t=s[e];t.some(r=>{if(r[0]<180)return!0;{let r=0;for(let e=0;e<t.length;e++){const i=t[e][0];r=i>r?i:r}r=Number(r.toFixed(9));const i=-360*(0,u.kd)(r,180);for(let r=0;r<t.length;r++){const t=o.getPoint(e,r);o.setPoint(e,r,t.clone().offset(i,0))}return!0}})}if(n===r){if(w(e))for(const t of(0,u.r8)(o))e[n]=e[n].addRing(t);else if(y(e))for(const t of(0,u.r8)(o))e[n]=e[n].addPath(t)}else r=n,e[n]=o}return e}async function S(e,t,r){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&x().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??i.A.geometryServiceUrl;let o,s,l,w,y,C,E,A,R=0;const I=[],O=[];for(const t of e)if(null!=t)if(o||(o=t.spatialReference,s=(0,h.Vp)(o),l=o.isWebMercator,C=l?102100:4326,w=u.j7[C].maxX,y=u.j7[C].minX,E=u.j7[C].plus180Line,A=u.j7[C].minus180Line),s)if("mesh"===t.type)O.push(t);else if("point"===t.type)O.push(T(t.clone(),w,y));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>T(e,w,y)),O.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,s);O.push(e.rings?new a.A(e):e)}else if(t.extent){const e=t.extent,r=(0,u.kd)(e.xmin,y)*(2*w);let i=0===r?t.clone():(0,u.kS)(t.clone(),r);e.offset(r,0);let{xmin:n,xmax:o}=e;n=Number(n.toFixed(9)),o=Number(o.toFixed(9)),e.intersects(E)&&o!==w?(R=o>R?o:R,i=b(i,l),I.push(i),O.push("cut")):e.intersects(A)&&n!==y?(R=o*(2*w)>R?o*(2*w):R,i=b(i,l,360),I.push(i),O.push("cut")):O.push(i)}else O.push(t.clone());else O.push(t);else O.push(t);let F=(0,u.kd)(R,w),D=-90;const P=F,N=new c.A;for(;F>0;){const e=360*F-180;N.addPath([[e,D],[e,-1*D]]),D*=-1,F--}if(I.length>0&&P>0){const t=M(I,await async function(e,t,r,i){const n=(0,g.Dl)(e),o=t[0].spatialReference,s={...i,responseType:"json",query:{...n.query,f:"json",sr:(0,h.YX)(o),target:JSON.stringify({geometryType:(0,p.$B)(t[0]),geometries:t}),cutter:JSON.stringify(r)}},a=await(0,f.A)(n.path+"/cut",s),{cutIndexes:c,geometries:l=[]}=a.data;return{cutIndexes:c,geometries:l.map(e=>{const t=(0,m.rS)(e);return t.spatialReference=o,t})}}(n,I,N,r)),i=[],o=[];for(let r=0;r<O.length;r++){const n=O[r];if("cut"!==n)o.push(n);else{const n=t.shift(),s=e[r];null!=s&&"polygon"===s.type&&s.rings&&s.rings.length>1&&n.rings.length>=s.rings.length?(i.push(n),o.push("simplify")):o.push(l?(0,d.Gh)(n):n)}}if(!i.length)return o;const s=await async function(e,t,r){const i="string"==typeof e?(0,v.An)(e):e,n=t[0].spatialReference,o=(0,p.$B)(t[0]),s={...r,query:{...i.query,f:"json",sr:(0,h.YX)(n),geometries:JSON.stringify((0,_.X)(t))}},{data:a}=await(0,f.A)(i.path+"/simplify",s);return(0,_.V)(a.geometries,o,n)}(n,i,r),a=[];for(let e=0;e<o.length;e++){const t=o[e];"simplify"!==t?a.push(t):a.push(l?(0,d.Gh)(s.shift()):s.shift())}return a}const B=[];for(let e=0;e<O.length;e++){const t=O[e];if("cut"!==t)B.push(t);else{const e=I.shift();B.push(!0===l?(0,d.Gh)(e):e)}}return B}function C(e,t,r){const i=(0,h.Vp)(r);if(null==i)return e;const[n,o]=i.valid,s=2*o;let a=0,c=0;t>o?a=Math.ceil(Math.abs(t-o)/s):t<n&&(a=-Math.ceil(Math.abs(t-n)/s)),e>o?c=Math.ceil(Math.abs(e-o)/s):e<n&&(c=-Math.ceil(Math.abs(e-n)/s));let l=e+(a-c)*s;const u=l-t;return u>o?l-=s:u<n&&(l+=s),l}function E(e){const t=(0,h.Vp)(e);if(null==t)return null;const[r,i]=t.valid;return new n.hr(r,i)}const A=E(l.A.WGS84);E(l.A.WebMercator)},80754(e,t,r){r.d(t,{j7:()=>s,kS:()=>c,kd:()=>a,r8:()=>l});var i=r(82799),n=r(16930),o=r(60408);const s={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new i.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator}),minus180Line:new i.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new i.A({paths:[[[180,-180],[180,180]]],spatialReference:n.A.WGS84}),minus180Line:new i.A({paths:[[[-180,-180],[-180,180]]],spatialReference:n.A.WGS84})}};function a(e,t){return Math.ceil((e-t)/(2*t))}function c(e,t){const r=l(e);for(const e of r)for(const r of e)r[0]+=t;return e}function l(e){return(0,o.Bi)(e)?e.rings:e.paths}},71351(e,t,r){r.d(t,{C:()=>u,Cr:()=>h,LV:()=>l,fA:()=>d,oC:()=>f,vt:()=>a}),r(4576);var i=r(4341),n=(r(77690),r(29242)),o=r(35522),s=r(51850);function a(e){return e?c((0,s.o8)(e.origin),(0,s.o8)(e.direction)):c((0,s.vt)(),(0,s.vt)())}function c(e,t){return{origin:e,direction:t}}function l(e,t){const r=p.get();return r.origin=e,r.direction=t,r}function u(e,t=a()){return d(e.origin,e.direction,t)}function h(e,t,r=a()){return(0,o.C)(r.origin,e),(0,o.Re)(r.direction,t,e),r}function d(e,t,r=a()){return(0,o.C)(r.origin,e),(0,o.C)(r.direction,t),r}function f(e,t,r){const i=(0,o.Om)(e.direction,(0,o.Re)(r,t,e.origin));return(0,o.WQ)(r,e.origin,(0,o.hs)(r,e.direction,i)),r}r(32114);const p=new i.I(()=>a());(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,n.vt)()},94008(e,t,r){r.d(t,{iy:()=>f}),r(44208),r(53966);var i=r(34727),n=r(34304),o=r(58083),s=r(35522),a=r(51850),c=r(91829),l=r(34275);var u=r(71351),h=r(44280),d=r(32114);class f{constructor(e=0,t=0,r=0,i=0){this.radius=i,"number"==typeof e?this._center=(0,a.fA)(e,t,r):function(e){return t=e,(0,l.vZ)(t)&&t.length>=3||function(e){return((0,l.aI)(e)||Array.isArray(e))&&e.length>=3}(e);var t}(e)||function(e){return(t=e)instanceof Float32Array&&t.length>=4||function(e){return Array.isArray(e)&&e.length>=4}(e);var t}(e)?(this._center=(0,a.ci)(e),this.radius=4===e.length?e[3]:t):(this._center=(0,a.o8)(e.center),this.radius=e.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(e){(0,s.C)(this.center,e)}exactEquals(e){return(0,s.aI)(this._center,e.center)&&this.radius===e.radius}copyFrom(e){return e!==this&&((0,s.C)(this._center,e.center),this.radius=e.radius),this}clone(){return new f(this.center,this.radius)}toVec4(){return(0,c.fA)(this.center[0],this.center[1],this.center[2],this.radius)}contains(e){return(0,s.hG)(this.center,e)<=this.radius**2}intersectRay(e,t){if(null==e)return!1;if(!this._intersect(e,p))return!1;let{t0:r,t1:i}=p;if((r<0||i<r&&i>0)&&(r=i),r<0)return!1;if(t){const{origin:i,direction:n}=e;t[0]=i[0]+n[0]*r,t[1]=i[1]+n[1]*r,t[2]=i[2]+n[2]*r}return!0}intersectLine(e,t){const r=(0,u.Cr)(e,t);if(!this._intersect(r,p))return[];const{origin:i,direction:o}=r,{t0:c,t1:l}=p,h=e=>{const t=(0,a.vt)();return(0,s.Ln)(t,i,o,e),this.projectPoint(t,t)};return Math.abs(c-l)<(0,n.FD)()?[h(c)]:[h(c),h(l)]}_intersect(e,t){const{origin:r,direction:i}=e,n=m;n[0]=r[0]-this.center[0],n[1]=r[1]-this.center[1],n[2]=r[2]-this.center[2];const o=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(0===o)return!1;const s=2*(i[0]*n[0]+i[1]*n[1]+i[2]*n[2]),a=s*s-4*o*(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]-this.radius**2);if(a<0)return!1;const c=Math.sqrt(a);return t.t0=(-s-c)/(2*o),t.t1=(-s+c)/(2*o),!0}projectPoint(e,t){const r=(0,s.Re)(d.rq.get(),e,this.center),i=(0,s.hs)(d.rq.get(),r,this.radius/(0,s.Bw)(r));return(0,s.WQ)(t,i,this.center)}closestPointOnSilhouette(e,t){const r=d.rq.get(),i=d.Rc.get();(0,s.$A)(r,e.origin,e.direction),(0,s.$A)(t,r,e.origin),(0,s.hs)(t,t,1/(0,s.Bw)(t)*this.radius);const n=this._angleToSilhouette(e.origin),a=(0,h.g7)(e.origin,t);return(0,o.$0)(i,a+n,r),(0,s.Z0)(t,t,i),t}frustumCoverage(e,t,r){const i=this.radius,n=i*i,o=e+.5*Math.PI,s=t*t+n-2*Math.cos(o)*t*i,a=Math.sqrt(s),c=s-n;if(c<=0)return.5;const l=Math.sqrt(c),u=Math.acos(l/a)-Math.asin(i/(a/Math.sin(o)));return Math.min(1,(u+.5*r)/r)}_angleToSilhouette(e){const t=(0,s.Re)(d.rq.get(),e,this.center),r=(0,s.Bw)(t),n=this.radius,o=n+Math.abs(n-r);return(0,i.XM)(n/o)}union(e){const t=(0,s.Io)(this._center,e.center),r=this.radius,i=e.radius;return t+i<r?this:t+r<i?(this.copyFrom(e),this):((0,s.Cc)(this._center,this._center,e.center,(t+i-r)/(2*t)),this.radius=(t+r+i)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}signedDistanceToPlane(e){const{center:t,radius:r}=this,i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3];return i<0?Math.min(i+r,0):Math.max(i-r,0)}}new f;const p={t0:0,t1:0},m=(0,a.vt)();(0,a.vt)(),(0,a.vt)()},38969(e,t,r){r.d(t,{i:()=>n});var i=r(37955);function n(e,t){return new Promise((r,n)=>{e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?r():(t((0,i.Oo)(e,"canplay",r)),t((0,i.Oo)(e,"error",n)))})}},92300(e,t,r){r.d(t,{V:()=>s,X:()=>o});var i=r(60408),n=r(65864);function o(e){return{geometryType:(0,i.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function s(e,t,r){const i=(0,n.xD)(t);return e.map(e=>{const t=i.fromJSON(e);return t.spatialReference=r,t})}},21015(e,t,r){r.d(t,{R:()=>c});var i=r(11254),n=r(60999),o=r(49186),s=r(17676),a=r(84952);class c{constructor(e=e=>e){this._resolveURI=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,a.DB)(e)?((0,s.Te)(t),(0,a.lJ)(e)):this._load("array-buffer",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,r){t=this._resolveURI(t);const a=await(0,n.Ke)((0,i.A)(t,{responseType:e,...r}));if(a.ok)return a.value.data;throw(0,s.QP)(a.error),new o.A("gltf-loader-request-error",`Request for resource failed: ${a.error}`)}}},84498(e,t,r){r.d(t,{x:()=>s});var i=r(34275),n=r(97146),o=r(63907);function s(e,t){switch(t){case o.WR.TRIANGLES:return function(e){return"number"==typeof e?(0,n.tM)(e):(0,i.mg)(e)?new Uint16Array(e):e}(e);case o.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const r=t-2,i=(0,n.my)(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;t+=1)t%2==0?(i[e++]=t,i[e++]=t+1,i[e++]=t+2):(i[e++]=t+1,i[e++]=t,i[e++]=t+2)}else{let t=0;for(let n=0;n<r;n+=1)n%2==0?(i[t++]=e[n],i[t++]=e[n+1],i[t++]=e[n+2]):(i[t++]=e[n+1],i[t++]=e[n],i[t++]=e[n+2])}return i}(e);case o.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,i=r<=65536?new Uint16Array(3*r):new Uint32Array(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;++t)i[e++]=0,i[e++]=t+1,i[e++]=t+2;return i}const n=e[0];let o=e[1],s=0;for(let t=0;t<r;++t){const r=e[t+2];i[s++]=n,i[s++]=o,i[s++]=r,o=r}return i}(e)}}},51530(e,t,r){r.d(t,{KB:()=>s,Xi:()=>n,pn:()=>a,x3:()=>o});var i=r(44208);class n{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding="image/ktx2"}}function o(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 a(e,t){if("image/ktx2"===t)return new n(e);const r=new Blob([e],{type:t});let o=URL.createObjectURL(r);switch(t){case"image/jpeg":o+="#.jpg";break;case"image/png":o+="#.png"}const s=new Image;if((0,i.A)("esri-iPhone"))return new Promise((e,t)=>{const r=()=>{n(),e(s)},i=e=>{n(),t(e)},n=()=>{URL.revokeObjectURL(o),s.removeEventListener("load",r),s.removeEventListener("error",i)};s.addEventListener("load",r),s.addEventListener("error",i),s.src=o});try{s.src=o,await s.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(o),s}},10765(e,t,r){r.d(t,{fetch:()=>Ar});var i=r(40876),n=r(61473),o=r(34727),s=r(77690),a=r(29242),c=r(58083),l=r(9093),u=r(48163),h=r(35522),d=r(51850),f=r(70328),p=r(34275);function m(e,t=!1){return e<=p.y9?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var g=r(13030),v=r(73354),_=r(50867),x=r(43609),w=r(21015),y=r(84498),b=r(51530),T=r(88340);function M(e){if(null==e)return null;const t=null!=e.offset?e.offset:T.uY,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:T.Un,n=(0,a.fA)(1,0,0,0,1,0,t[0],t[1],1),o=(0,a.fA)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),c=(0,a.fA)(i[0],0,0,0,i[1],0,0,0,1),l=(0,a.vt)();return(0,s.lw)(l,o,c),(0,s.lw)(l,n,l),l}class S{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new S,this.numberOfVertices=0}}var E=r(11254),A=r(60999),R=r(49186),I=r(53966),O=r(69397);class F{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get outerSize(){return this._outer.size}get size(){let e=0;for(const t of this._outer.values())e+=t.size;return e}get(e,t){return this._outer.get(e)?.get(t)}getInner(e){return this._outer.get(e)}set(e,t,r){const i=this._outer.get(e);i?i.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))}pop(e,t){const r=this.get(e,t);return this.delete(e,t),r}*outerMap(){for(const e of this._outer)yield e}*values(){for(const e of this._outer.values())yield*e.values()}*[Symbol.iterator](){for(const[e,t]of this._outer)for(const[r,i]of t)yield[e,r,i]}forEach(e){this._outer.forEach((t,r)=>e(t,r))}forAll(e){this._outer.forEach((t,r)=>t.forEach((t,i)=>e(t,r,i)))}copy(){const e=new F;return this.forAll((t,r,i)=>e.set(r,i,t)),e}}var D=r(17676),P=r(46140),N=r(97146);async function B(e,t){return(await(0,E.A)(e,{responseType:"image",...t})).data}var H=r(46610),L=r(20498);function z(e){if(e.length<p.y9)return Array.from(e);if(Array.isArray(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,p.LW)(e)?(0,L.pX)().from(e):(0,p.jq)(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var U=r(15142),G=r(620);class V{get center(){return(0,d.fA)(this._data[0],this._data[1],this._data[2])}get radius(){return this._data[3]}get bbMin(){return(0,d.fA)(this._data[4],this._data[5],this._data[6])}get bbMax(){return(0,d.fA)(this._data[7],this._data[8],this._data[9])}constructor(e,t,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.position=r,this._data=[.1,0,0,0,0,0,0,0,0,0],this._children=void 0,(0,G.vA)(e.length>=1),(0,G.vA)(3===r.size||4===r.size);const{data:i,size:n,indices:o}=r;(0,G.vA)(o.length%this._numIndexPerPrimitive===0),(0,G.vA)(o.length>=e.length*this._numIndexPerPrimitive);const s=e.length;let a=n*o[this._numIndexPerPrimitive*e[0]];j.clear(),j.push(a);const c=(0,d.fA)(i[a],i[a+1],i[a+2]),l=(0,d.o8)(c);for(let t=0;t<s;++t){const r=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){a=n*o[r+e],j.push(a);let t=i[a];c[0]=Math.min(t,c[0]),l[0]=Math.max(t,l[0]),t=i[a+1],c[1]=Math.min(t,c[1]),l[1]=Math.max(t,l[1]),t=i[a+2],c[2]=Math.min(t,c[2]),l[2]=Math.max(t,l[2])}}for(let e=0;e<3;++e)this._data[4+e]=c[e],this._data[7+e]=l[e];const u=(0,h.Cc)((0,d.vt)(),this.bbMin,this.bbMax,.5);let f=.5*Math.max(Math.max(l[0]-c[0],l[1]-c[1]),l[2]-c[2]),p=f*f;for(let e=0;e<j.length;++e){a=j.at(e);const t=i[a]-u[0],r=i[a+1]-u[1],n=i[a+2]-u[2],o=t*t+r*r+n*n;if(o<=p)continue;const s=Math.sqrt(o),c=.5*(s-f);f+=c,p=f*f;const l=c/s;u[0]+=t*l,u[1]+=r*l,u[2]+=n*l}this._data[3]=f;for(let e=0;e<3;++e)this._data[0+e]=u[e];j.clear()}getChildren(){if(this._children||(0,h.hG)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,h.Cc)((0,d.vt)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o,indices:s}=this.position;for(let a=0;a<t;++a){let t=0;const c=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=o*s[c],u=n[l],h=n[l+1],d=n[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=o*s[c+e];const t=n[l],r=n[l+1],i=n[l+2];t<u&&(u=t),r<h&&(h=r),i<d&&(d=i)}u<e[0]&&(t|=1),h<e[1]&&(t|=2),d<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const c=new Array(8);for(let e=0;e<8;++e)c[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];c[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array;for(let e=0;e<8;++e)void 0!==c[e]&&this._children.push(new V(c[e],this._numIndexPerPrimitive,this.position));return this._children}static prune(){j.prune()}}const j=new U.A({deallocator:null});var k=r(24326);class W{constructor(e){this.id=(0,k.c)(),this._attributes=new Map;for(const[t,r]of e)this._attributes.set(t,{...r,indices:(0,N.Dg)(r.indices)})}get attributes(){return this._attributes}}var $=r(4341),Z=r(11964);function q(e,t,r){return(0,h.Re)(Y,t,e),(0,h.Re)(X,r,e),.5*(0,h.Bw)((0,h.$A)(Y,Y,X))}r(32114),new $.I(Z.vt),new $.I(()=>{return e?{p0:(0,d.o8)(e.p0),p1:(0,d.o8)(e.p1),p2:(0,d.o8)(e.p2)}:{p0:(0,d.vt)(),p1:(0,d.vt)(),p2:(0,d.vt)()};var e});const Y=(0,d.vt)(),X=(0,d.vt)(),K=(0,d.vt)(),J=(0,d.vt)(),Q=(0,d.vt)(),ee=(0,d.vt)();class te{constructor(){this.uid=(0,k.c)()}}class re extends te{constructor(e){super(),this.highlightName=e,this.channel=0}}var ie=r(94656);class ne extends W{constructor(e,t,r=null,i=0,n=null,o=-1,s,a){super(t),this.material=e,this.mapPositions=r,this.type=i,this.olidColor=n,this.edgeIndicesLength=o,this.baseGeometry=s,this.drawIndices=a,this._vertexPositionIndicesCache=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.visible=!0,this._boundingInfo=null,(0,G.vA)((e?.useIndexing??!1)===(null!=a),"Material index requirement and Geometry must match");const c=this.positionAttribute;null!=c&&this.edgeIndicesLength<0&&(this.edgeIndicesLength=c.indices.length)}instantiate(e={}){const t=new ne(e.material||this.material,[],this.mapPositions,this.type,this.olidColor,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);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}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:z(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}):(0,ie.en)()&&console.warn(`Setting undefined attribute ${e} data`)}get primitivePositionIndices(){if(void 0!==this._vertexPositionIndicesCache)return this._vertexPositionIndicesCache;const{drawIndices:e}=this,t=this.positionAttribute;if(null!=e&&null!=t){const r=new Array;for(const i of e)r.push(t.indices[i]);this._vertexPositionIndicesCache=r}else this._vertexPositionIndicesCache=t?.indices??null;return this._vertexPositionIndicesCache}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const e=this.drawIndices??this.positionAttribute?.indices;return e?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(e){return!!(0===this.type?this._computeAttachmentOriginTriangles(e):2===this.type?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(null!=this._transformation&&(0,h.Z0)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){return function(e,t,r=t?.indices){if(!t||!r)return!1;const{size:i,data:n}=t;(0,h.hZ)(e,0,0,0),(0,h.hZ)(ee,0,0,0);let o=0,s=0;for(let t=0;t<r.length-2;t+=3){const a=r[t]*i,c=r[t+1]*i,l=r[t+2]*i;(0,h.hZ)(K,n[a],n[a+1],n[a+2]),(0,h.hZ)(J,n[c],n[c+1],n[c+2]),(0,h.hZ)(Q,n[l],n[l+1],n[l+2]);const u=q(K,J,Q);u?((0,h.WQ)(K,K,J),(0,h.WQ)(K,K,Q),(0,h.hs)(K,K,1/3*u),(0,h.WQ)(e,e,K),o+=u):((0,h.WQ)(ee,ee,K),(0,h.WQ)(ee,ee,J),(0,h.WQ)(ee,ee,Q),s+=3)}return!(0===s&&0===o||(0!==o?((0,h.hs)(e,e,1/o),0):0===s||((0,h.hs)(e,ee,1/s),0)))}(e,this.positionAttribute,this.primitivePositionIndices)}_computeAttachmentOriginLines(e){const t=this.positionAttribute,r=this.primitivePositionIndices;return function(e,t,r,i=t?.indices){if(!t||!i)return!1;(0,h.hZ)(e,0,0,0),(0,h.hZ)(ee,0,0,0);let n=0,o=0;const{size:s,data:a}=t,c=i.length-1,l=c+(r?2:0);for(let t=0;t<l;t+=2){const r=t<c?t+1:0,l=i[t<c?t:c]*s,u=i[r]*s;K[0]=a[l],K[1]=a[l+1],K[2]=a[l+2],J[0]=a[u],J[1]=a[u+1],J[2]=a[u+2],(0,h.hs)(K,(0,h.WQ)(K,K,J),.5);const d=(0,h.xg)(K,J);d>0?((0,h.WQ)(e,e,(0,h.hs)(K,K,d)),n+=d):0===n&&((0,h.WQ)(ee,ee,K),o++)}return 0!==n?((0,h.hs)(e,e,1/n),!0):0!==o&&((0,h.hs)(e,ee,1/o),!0)}(e,t,function(e,t){return!(!("isClosed"in e)||!e.isClosed)&&t.indices.length>2}(this.material.parameters,t),r)}_computeAttachmentOriginPoints(e){return function(e,t,r=t?.indices){if(!t||!r)return!1;const{size:i,data:n}=t;(0,h.hZ)(e,0,0,0);let o=-1,s=0;for(let t=0;t<r.length;t++){const a=r[t]*i;o!==a&&(e[0]+=n[a],e[1]+=n[a+1],e[2]+=n[a+2],s++),o=a}return s>1&&(0,h.hs)(e,e,1/s),s>0}(e,this.positionAttribute,this.primitivePositionIndices)}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){const e=this.positionAttribute,t=this.primitivePositionIndices;if(!e||!t||0===t.length)return null;const r=t===e.indices?e:new H.n(e.data,t,e.size,!1,e.stride),i=0===this.type?3:1;(0,G.vA)(t.length%i===0,"Indexing error: "+t.length+" not divisible by "+i);const n=(0,N.tM)(t.length/i);return new V(n,i,r)}get transformation(){return this._transformation??l.zK}set transformation(e){this._transformation=e&&e!==l.zK?(0,l.o8)(e):null}get highlights(){return this._highlights||oe}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(e){this._highlightOptionsCounts?.forEach((t,r)=>e(r))}allocateIdAndHighlight(e){const t=new re(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);const{highlightName:t}=e,r=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,r),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){const{highlightName:t}=e,r=this._highlightOptionsCounts?.get(t)??0;r<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,r-1)}}}const oe=new Set;var se=r(65529),ae=r(97768),ce=r(84952),le=r(38969),ue=r(95117),he=r(2741);let de;var fe=r(63907),pe=r(76284),me=r(42293);let ge=null,ve=null;async function _e(){return null==ve&&(de??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,he.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),ve=de,ge=await ve),ve}function xe(e,t,r,i,n){const o=(0,me.MW)(t?fe.CQ.COMPRESSED_RGBA8_ETC2_EAC:fe.CQ.COMPRESSED_RGB8_ETC2),s=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*s)}function we(e){return e.getNumImages()>=1&&!e.isUASTC()}function ye(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}function be(e,t,r,i,n,o,s,a){const{compressedTextureETC:c,compressedTextureS3TC:l}=e.capabilities,[u,h]=c?i?[1,fe.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,fe.CQ.COMPRESSED_RGB8_ETC2]:l?i?[3,fe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,fe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],d=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<d;e++)f.push(new Uint8Array(s(e,u))),a(e,u,f[e]);return t.internalFormat=h,t.hasMipmap=f.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new pe.A(e,t,{type:"compressed",levels:f})}const Te=()=>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 Se=Me("DXT1"),Ce=Me("DXT3"),Ee=Me("DXT5");function Ae(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function Re(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const s=Math.min(Math.sqrt(r/o),i/n);return[Ae(Math.round(e*s),i),Ae(Math.round(t*s),i)]}(e,t);return e.width===r&&e.height===i?e:Ie(e,r,i)}function Ie(e,t,r){if(e instanceof ImageData)return Ie(function(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("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);const i=document.createElement("canvas");return i.width=t,i.height=r,i.getContext("2d").drawImage(e,0,0,i.width,i.height),i}var Oe=r(67171);class Fe{constructor(e,t){this._data=e,this.id=(0,k.c)(),this.events=new se.bk,this._parameters={...Pe,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(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",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,le.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_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 Oe.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||function(e,t){if(null==e)return 0;if((0,p.mw)(e)||(0,p.mg)(e))return"image/ktx2"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.KTX2File(new Uint8Array(e)),i=ye(r)?xe(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):"image/x.basis"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.BasisFile(new Uint8Array(e)),i=we(r)?xe(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?De(e):t,n=t.pixelFormat??6408,o=(0,me.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const t=this._data;return null==t?(this._texture=new pe.A(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,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,p.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,p.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,p.mw)(t)||(0,p.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,p.mw)(t)||(0,p.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,p.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,p.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return Te().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Te().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case Se:n=8,o=fe.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ce:n=16,o=fe.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ee:n=16,o=fe.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Te().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let s=1,a=r[4],c=r[3];(3&a||3&c)&&(Te().warn("Rounding up compressed texture size to nearest multiple of 4."),a=a+3&-4,c=c+3&-4);const l=a,u=c;let h,d;131072&r[2]&&!1!==t&&(s=Math.max(1,r[7]));let f=e.byteOffset+r[1]+4;const p=[];for(let t=0;t<s;++t)d=(a+3>>2)*(c+3>>2)*n,h=new Uint8Array(e.buffer,f,d),p.push(h),f+=d,a=Math.max(1,a>>1),c=Math.max(1,c>>1);return{textureData:{type:"compressed",levels:p},internalFormat:o,width:l,height:u}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:s,height:a}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=s,t.height=a,new pe.A(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.KTX2File(new Uint8Array(r));if(!ye(i))return null;i.startTranscoding();const n=be(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.BasisFile(new Uint8Array(r));if(!we(i))return null;i.startTranscoding();const n=be(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,G.vA)(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new pe.A(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await B(t,{signal:r});return(0,D.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,ue.y)(t,t.src,!1,r);return(0,D.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((i,n)=>{const o=()=>{t.removeEventListener("loadeddata",s),t.removeEventListener("error",a),(0,ae.xt)(c)},s=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(o(),i(this._loadFromImage(e,t)))},a=e=>{o(),n(e||new R.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",s),t.addEventListener("error",a);const c=(0,D.u7)(r,()=>a((0,D.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=Re(r,e.parameters));const i=De(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._texture=new pe.A(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,ae.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function De(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const Pe={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};var Ne=r(49255);class Be{constructor(e){this._material=e.material,this._techniques=e.techniques}dispose(){}get _stippleTextures(){return this._techniques.context?.stippleTextures}get _markerTextures(){return this._techniques.context?.markerTextures}getTechnique(e,t){return this._techniques.get(e,this._material.getConfiguration(t))}ensureResources(e){return 2}}var He=r(65786);class Le extends Be{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this.updateTexture(e.textureId),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(){super.dispose(),this._texture=(0,ae.Gz)(this._texture),this._textureNormal=(0,ae.Gz)(this._textureNormal),this._textureEmissive=(0,ae.Gz)(this._textureEmissive),this._textureOcclusion=(0,ae.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,ae.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}get textureBindParameters(){return new Ue(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,ae.Gz)(this._texture),this._acquire(e,e=>this._texture=e))}_acquire(e,t){if(null==e)return void t(null);const r=this._textures.acquire(e);if((0,D.$X)(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return(0,ae.Gz)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(r)}}class ze extends He.Y{constructor(e=null){super(),this.textureEmissive=e}}class Ue extends ze{constructor(e,t,r,i,n,o,s){super(r),this.texture=e,this.textureNormal=t,this.textureOcclusion=i,this.textureMetallicRoughness=n,this.scale=o,this.normalTextureTransformMatrix=s}}var Ge=r(19245);class Ve{constructor(e,t){this.id=(0,k.c)(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,(0,Ge.MB)(this._parameters,e),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,Ge.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.bind.decorations)&&0!==(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())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(e){return this.updateConfiguration(e),this._configuration}updateConfiguration(e){this._configuration.output=e.output,this._configuration.hasEmission=e.hasEmission&&(0,Ne._o)(e.output),this._configuration.hasHighlightMixTexture=10===e.output&&null!=e.highlightMixTexture,this._configuration.useFloatBlend=e.useFloatBlend.value}}He.Y;class je{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const ke=(0,f.vt)();function We(e,t,r,i,n,o){if(!e.visible)return;const s=(0,h.jb)(nt,i,r),{tolerance:a}=t,c=new je(a,!1,t.options.normalRequired);if(e.boundingInfo)(0,G.vA)(0===e.type),Ze(e.boundingInfo,r,s,a,n,c,o);else{const t=e.positionAttribute,i=e.primitivePositionIndices;!function(e,t,r,i,n,o,s,a,c,l){const u=t,d=ot,f=Math.abs(u[0]),p=Math.abs(u[1]),m=Math.abs(u[2]),g=f>=p?f>=m?0:2:p>=m?1:2,v=g,_=u[v]<0?2:1,x=(g+_)%3,w=(g+(3-_))%3,y=u[x]/u[v],b=u[w]/u[v],T=1/u[v],M=Ye,S=Xe,C=Ke,{normalRequired:E}=c;for(let t=r;t<i;++t){const r=3*t,i=s*n[r];(0,h.hZ)(d[0],o[i+0],o[i+1],o[i+2]);const c=s*n[r+1];(0,h.hZ)(d[1],o[c+0],o[c+1],o[c+2]);const u=s*n[r+2];(0,h.hZ)(d[2],o[u+0],o[u+1],o[u+2]),a&&((0,h.C)(d[0],a.applyToVertex(d[0][0],d[0][1],d[0][2],t)),(0,h.C)(d[1],a.applyToVertex(d[1][0],d[1][1],d[1][2],t)),(0,h.C)(d[2],a.applyToVertex(d[2][0],d[2][1],d[2][2],t))),(0,h.jb)(M,d[0],e),(0,h.jb)(S,d[1],e),(0,h.jb)(C,d[2],e);const f=M[x]-y*M[v],p=M[w]-b*M[v],m=S[x]-y*S[v],g=S[w]-b*S[v],_=C[x]-y*C[v],A=C[w]-b*C[v],R=_*g-A*m,I=f*A-p*_,O=m*p-g*f;if((R<0||I<0||O<0)&&(R>0||I>0||O>0))continue;const F=R+I+O;if(0===F)continue;const D=R*(T*M[v])+I*(T*S[v])+O*(T*C[v]);if(D*Math.sign(F)<0)continue;const P=D/F;P>=0&&l(P,E?Qe(d):null,t)}}(r,s,0,i.length/3,i,t.data,t.stride,n,c,o)}}const $e=(0,d.vt)();function Ze(e,t,r,i,n,o,s){if(null==e)return;const a=function(e,t){return(0,h.hZ)(t,1/e[0],1/e[1],1/e[2])}(r,$e);if((0,f.Ne)(ke,e.bbMin),(0,f.vI)(ke,e.bbMax),null!=n&&n.applyToAabb(ke),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let s=Math.min(n,o),a=Math.max(n,o);const c=(e[1]-i-t[1])*r[1],l=(e[4]+i-t[1])*r[1];if(a=Math.min(a,Math.max(c,l)),a<0)return!1;if(s=Math.max(s,Math.min(c,l)),s>a)return!1;const u=(e[2]-i-t[2])*r[2],h=(e[5]+i-t[2])*r[2];return a=Math.min(a,Math.max(u,h)),!(a<0)&&(s=Math.max(s,Math.min(u,h)),!(s>a)&&s<1/0)}(e,t,r,i)}(ke,t,a,i)){const{primitiveIndices:a,position:c}=e,l=a?a.length:c.indices.length/3;if(l>rt){const a=e.getChildren();if(void 0!==a){for(const e of a)Ze(e,t,r,i,n,o,s);return}}!function(e,t,r,i,n,o,s,a,c,l,u){const h=e[0],d=e[1],f=e[2],p=t[0],m=t[1],g=t[2],{normalRequired:v}=l;for(let e=0;e<i;++e){const t=a[e],r=3*t,i=s*n[r];let l=o[i],_=o[i+1],x=o[i+2];const w=s*n[r+1];let y=o[w],b=o[w+1],T=o[w+2];const M=s*n[r+2];let S=o[M],C=o[M+1],E=o[M+2];null!=c&&([l,_,x]=c.applyToVertex(l,_,x,e),[y,b,T]=c.applyToVertex(y,b,T,e),[S,C,E]=c.applyToVertex(S,C,E,e));const A=y-l,R=b-_,I=T-x,O=S-l,F=C-_,D=E-x,P=m*D-F*g,N=g*O-D*p,B=p*F-O*m,H=A*P+R*N+I*B;if(Math.abs(H)<=it)continue;const L=h-l,z=d-_,U=f-x,G=L*P+z*N+U*B;if(H>0){if(G<0||G>H)continue}else if(G>0||G<H)continue;const V=z*I-R*U,j=U*A-I*L,k=L*R-A*z,W=p*V+m*j+g*k;if(H>0){if(W<0||G+W>H)continue}else if(W>0||G+W<H)continue;const $=(O*V+F*j+D*k)/H;$>=0&&u($,v?Je(A,R,I,O,F,D,qe):null,t)}}(t,r,0,l,c.indices,c.data,c.stride,a,n,o,s)}}const qe=(0,d.vt)();const Ye=(0,d.vt)(),Xe=(0,d.vt)(),Ke=(0,d.vt)();function Je(e,t,r,i,n,o,s){return(0,h.hZ)(et,e,t,r),(0,h.hZ)(tt,i,n,o),(0,h.$A)(s,et,tt),(0,h.S8)(s,s),s}function Qe(e){return(0,h.jb)(et,e[1],e[0]),(0,h.jb)(tt,e[2],e[0]),(0,h.$A)(qe,et,tt),(0,h.S8)(qe,qe),qe}const et=(0,d.vt)(),tt=(0,d.vt)(),rt=1e3,it=1e-7,nt=(0,d.vt)(),ot=[(0,d.vt)(),(0,d.vt)(),(0,d.vt)()];var st=r(16396);function at(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length;r*=s;for(let e=0;e<a;++e){const t=2*n[e];o[r]=i[t],o[r+1]=i[t+1],r+=s}}function ct(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,c=o.length;if(r*=a,1===i)for(let e=0;e<c;++e){const t=3*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}else for(let e=0;e<c;++e){const t=3*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}}function lt(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,c=o.length;if(r*=a,1===i)for(let e=0;e<c;++e){const t=4*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}else for(let e=0;e<c;++e){const t=4*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}}function ut(e,t,r,i,n=1){const o=t.typedBuffer,s=t.typedBufferStride;if(i*=s,1===n)for(let t=0;t<r;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s;else for(let t=0;t<r;++t)for(let t=0;t<n;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s}function ht(e,t,r,i,n,o){switch(e){case"position":{(0,G.vA)(3===t.size);const i=n.getField(e,g.xs);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ct(e,r,i,n);const{data:o,indices:s}=e,a=r.typedBuffer,l=r.typedBufferStride,u=s.length,h=t[0],d=t[1],f=t[2],p=t[4],m=t[5],g=t[6],v=t[8],_=t[9],x=t[10],w=t[12],y=t[13],b=t[14];i*=l;let T=0,M=0,S=0;const C=(0,c.tZ)(t)?e=>{T=o[e]+w,M=o[e+1]+y,S=o[e+2]+b}:e=>{const t=o[e],r=o[e+1],i=o[e+2];T=h*t+p*r+v*i+w,M=d*t+m*r+_*i+y,S=f*t+g*r+x*i+b};if(1===n)for(let e=0;e<u;++e)C(3*s[e]),a[i]=T,a[i+1]=M,a[i+2]=S,i+=l;else for(let e=0;e<u;++e){C(3*s[e]);for(let e=0;e<n;++e)a[i]=T,a[i+1]=M,a[i+2]=S,i+=l}}(t,r,i,o);break}case"normal":{(0,G.vA)(3===t.size);const r=n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ct(e,r,i,n);const{data:o,indices:s}=e,a=t,l=r.typedBuffer,u=r.typedBufferStride,h=s.length,d=a[0],f=a[1],p=a[2],m=a[4],g=a[5],v=a[6],_=a[8],x=a[9],w=a[10],y=!(0,c.ut)(a),b=1e-6,T=1-b;i*=u;let M=0,S=0,C=0;const E=(0,c.tZ)(a)?e=>{M=o[e],S=o[e+1],C=o[e+2]}:e=>{const t=o[e],r=o[e+1],i=o[e+2];M=d*t+m*r+_*i,S=f*t+g*r+x*i,C=p*t+v*r+w*i};if(1===n)if(y)for(let e=0;e<h;++e){E(3*s[e]);const t=M*M+S*S+C*C;if(t<T&&t>b){const e=1/Math.sqrt(t);l[i]=M*e,l[i+1]=S*e,l[i+2]=C*e}else l[i]=M,l[i+1]=S,l[i+2]=C;i+=u}else for(let e=0;e<h;++e)E(3*s[e]),l[i]=M,l[i+1]=S,l[i+2]=C,i+=u;else for(let e=0;e<h;++e){if(E(3*s[e]),y){const e=M*M+S*S+C*C;if(e<T&&e>b){const t=1/Math.sqrt(e);M*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[i]=M,l[i+1]=S,l[i+2]=C,i+=u}}(t,i,r,o);break}case"normalCompressed":case"profileRight":case"profileUp":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"uv0":{(0,G.vA)(2===t.size);const r=n.getField(e,g.ZD)??n.getField(e,g.gH);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"uvi":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),at(t,r,o);break}case"color":case"symbolColor":{const r=n.getField(e,g.XP);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(3===t.size||4===t.size),function(e,t,r,i,n=1){const{data:o,indices:s}=e,a=r.typedBuffer,c=r.typedBufferStride,l=s.length;if(i*=c,t===o.length&&4===t){a[i]=o[0],a[i+1]=o[1],a[i+2]=o[2],a[i+3]=o[3];const e=new Uint32Array(r.typedBuffer.buffer,r.start),t=c/4,s=e[i/=4];i+=t;const u=l*n;for(let r=1;r<u;++r)e[i]=s,i+=t;return}if(1!==n)if(4!==t)for(let e=0;e<l;++e){const t=3*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=c}else for(let e=0;e<l;++e){const t=4*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=c}return}for(let e=0;e<l;++e){const t=3*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=c}}}(t,t.size,r,o);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const r=n.getField(e,g.Y$)??n.getField(e,g.Y$);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(1===t.size),function(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length,c=i[0];r*=s;for(let e=0;e<a;++e)o[r]=c,r+=s}(t,r,o);break}case"tangent":{(0,G.vA)(4===t.size);const i=n.getField(e,g.Eq);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void lt(e,r,i,n);const{data:o,indices:s}=e,a=t,l=r.typedBuffer,u=r.typedBufferStride,h=s.length,d=a[0],f=a[1],p=a[2],m=a[4],g=a[5],v=a[6],_=a[8],x=a[9],w=a[10],y=!(0,c.ut)(a),b=1e-6,T=1-b;if(i*=u,1===n)for(let e=0;e<h;++e){const t=4*s[e],r=o[t],n=o[t+1],a=o[t+2],c=o[t+3];let h=d*r+m*n+_*a,M=f*r+g*n+x*a,S=p*r+v*n+w*a;if(y){const e=h*h+M*M+S*S;if(e<T&&e>b){const t=1/Math.sqrt(e);h*=t,M*=t,S*=t}}l[i]=h,l[i+1]=M,l[i+2]=S,l[i+3]=c,i+=u}else for(let e=0;e<h;++e){const t=4*s[e],r=o[t],a=o[t+1],c=o[t+2],h=o[t+3];let M=d*r+m*a+_*c,S=f*r+g*a+x*c,C=p*r+v*a+w*c;if(y){const e=M*M+S*S+C*C;if(e<T&&e>b){const t=1/Math.sqrt(e);M*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[i]=M,l[i+1]=S,l[i+2]=C,l[i+3]=h,i+=u}}(t,r,i,o);break}case"profileVertexAndNormal":{(0,G.vA)(4===t.size);const r=n.getField(e,g.jz)??n.getField(e,g.Eq);(0,G.vA)(!!r,`No buffer view for ${e}`),lt(t,r,o);break}case"profileAuxData":{(0,G.vA)(3===t.size);const r=n.getField(e,g.EC)??n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),ct(t,r,o);break}}}(0,d.vt)();class dt{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return function(e,t,r,i,n,o,s){let a={numItems:0,numVerticesPerItem:0};for(const c of r.fields.keys()){const r=e.get(c),l=r?.indices;if(r&&l)"position"===c&&(a={numItems:1,numVerticesPerItem:l.length}),ht(c,r,i,n,o,s);else if("olidColor"===c&&null!=t){const r=e.get("position")?.indices;if(r){const e=r.length;ut(t,o.getField(c,g.XP),e,s)}}}return a}(r,i,this.layout,e,t,n,o)}}const ft={factor:1,units:1},pt={factor:-1,units:-2},mt=new Array;mt[0]=null,mt[1]=ft,mt[2]={factor:-5,units:-5},mt[3]={factor:0,units:-4},mt[4]={factor:1,units:2};const gt=mt.map(e=>function(e,t){return t?{factor:e.factor+t.factor,units:e.units+t.units}:e}(pt,e));function vt({output:e,enableOITOffset:t,polygonOffset:r}){return(0,Ne.Sp)(e)&&t?gt[r]:mt[r]}mt[1]=ft;const _t=(0,d.vt)();var xt=r(5482),wt=r(91429),yt=r(91829),bt=r(4431),Tt=r(1843),Mt=r(72824),St=r(13840),Ct=r(42958),Et=r(16943),At=r(90644);const Rt=(0,At.p3)(1,0,1,771);function It(e,t=!1){switch(e){case 0:return t?At.RC:At.T8;case 1:return Rt;default:return null}}function Ot(e){if(e.draped)return null;switch(e.output){case 0:case 2:default:return e.writeDepth?At.Uy:null;case 1:return null}}function Ft(e,t=513){return{func:(0,Ne.Sp)(e)?515:t}}const Dt={mask:255},Pt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Nt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Bt=r(4576);r(66289);var Ht=r(69622),Lt=r(32728);class zt{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",g.Eq),this.color=e.getField("instanceColor",g.XP),this.olidColor=e.getField("instanceOlidColor",g.XP),this.state=e.getField("state",g.SL),this.lodLevel=e.getField("lodLevel",g.SL)}}let Ut=class extends Ht.A{constructor(e,t){super(e),this.events=new se.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return Vt(Gt.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=Zt,this._buffer=this._layout.createBuffer(this._capacity),this._view=new zt(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=jt,i=kt;t.localTransform.getMat(e,Wt),t.globalTransform.getMat(e,$t);const n=(0,c.lw)($t,$t,Wt);(0,h.hZ)(r,n[12],n[13],n[14]),t.modelOrigin.setVec(e,r),(0,s.z0)(i,n),t.model.setMat(e,i);const o=(0,Lt.wp)(jt,n);o.sort(),t.modelScaleFactors.set(e,0,o[1]),t.modelScaleFactors.set(e,1,o[2]),(0,s.B8)(i,i),(0,s.mg)(i,i),t.modelNormal.setMat(e,i),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,kt),r.modelOrigin.getVec(e,jt),t[0]=kt[0],t[1]=kt[1],t[2]=kt[2],t[3]=0,t[4]=kt[3],t[5]=kt[4],t[6]=kt[5],t[7]=0,t[8]=kt[6],t[9]=kt[7],t[10]=kt[8],t[11]=0,t[12]=jt[0],t[13]=jt[1],t[14]=jt[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=Math.max(jt[0],jt[1],jt[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(jt[0],jt[1],jt[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(Zt,Math.floor(this._capacity*Bt.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new zt(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,xt.Cg)([(0,wt.MZ)({constructOnly:!0})],Ut.prototype,"shaderTransformation",void 0),(0,xt.Cg)([(0,wt.MZ)()],Ut.prototype,"_size",void 0),(0,xt.Cg)([(0,wt.MZ)({readOnly:!0})],Ut.prototype,"size",null),Ut=(0,xt.Cg)([(0,wt.$K)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],Ut);const Gt=(0,Tt.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function Vt(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,Et.E)()&&e.vec4u8("instanceOlidColor"),e}const jt=(0,d.vt)(),kt=(0,a.vt)(),Wt=(0,l.vt)(),$t=(0,l.vt)(),Zt=64,qt=(0,Tt.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var Yt=r(74810),Xt=r(28491),Kt=r(49788);class Jt extends Mt.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=Yt.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=d.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,d.CN)(.2,.2,.2),this.diffuse=(0,d.CN)(.8,.8,.8),this.externalColor=(0,yt.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,d.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=Kt.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}Mt.gy;let Qt=class extends Ct.w{constructor(e,t){let i=(0,bt.U)(rr(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat((0,bt.U)(function(e){return Vt(qt.clone(),e)}(t)))),super(e,t,i),this.shader=new St.r(Xt.D,()=>r.e(5141).then(r.bind(r,5141))),this.ignoreUnused=!0}_makePipeline(e,t){const{output:r,transparent:i,cullFace:n,customDepthTest:o,hasOccludees:s}=e;return(0,At.Ey)({blending:i?It(r):null,culling:tr(e)?(0,At.Xt)(n):null,depthTest:Ft(r,er(o)),depthWrite:Ot(e),colorWrite:At.kn,stencilWrite:s?Dt:null,stencilTest:s?t?Nt:Pt:null,polygonOffset:vt(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};function er(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function tr(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function rr(e){const t=(0,Tt.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,Et.E)()&&t.vec4u8("olidColor"),t}Qt=(0,xt.Cg)([(0,wt.$K)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],Qt);var ir=r(51976),nr=r(68317);class or extends nr.Hz{constructor(){super(...arguments),this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1}}(0,xt.Cg)([(0,ir.W)()],or.prototype,"hasHighlightMixTexture",void 0);class sr extends or{constructor(){super(...arguments),this.polygonOffset=0,this.transparent=!1,this.enableOITOffset=!0}}(0,xt.Cg)([(0,ir.W)({count:5})],sr.prototype,"polygonOffset",void 0),(0,xt.Cg)([(0,ir.W)()],sr.prototype,"transparent",void 0),(0,xt.Cg)([(0,ir.W)()],sr.prototype,"enableOITOffset",void 0);class ar extends sr{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}(0,xt.Cg)([(0,ir.W)({count:4})],ar.prototype,"alphaDiscardMode",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"doubleSidedMode",void 0),(0,xt.Cg)([(0,ir.W)({count:7})],ar.prototype,"pbrMode",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"cullFace",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"normalType",void 0),(0,xt.Cg)([(0,ir.W)({count:3})],ar.prototype,"customDepthTest",void 0),(0,xt.Cg)([(0,ir.W)({count:8})],ar.prototype,"emissionSource",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVertexColors",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasSymbolColors",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVerticalOffset",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasColorTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasMetallicRoughnessTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOcclusionTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasNormalTexture",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasScreenSizePerspective",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVertexTangents",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOccludees",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instanced",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedDoublePrecision",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasModelTransformation",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"offsetBackfaces",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVVSize",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasVVColor",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"receiveShadows",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasShadowHighlights",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"receiveAmbientOcclusion",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"textureAlphaPremultiplied",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedFeatureAttribute",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"instancedColor",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"writeDepth",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"terrainDepthTest",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"cullAboveTerrain",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"snowCover",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasColorTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasEmissionTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasNormalTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasOcclusionTextureTransform",void 0),(0,xt.Cg)([(0,ir.W)()],ar.prototype,"hasMetallicRoughnessTextureTransform",void 0);var cr=r(57323);let lr=class extends Qt{constructor(){super(...arguments),this.shader=new St.r(cr.R,()=>r.e(2314).then(r.bind(r,39933)))}};lr=(0,xt.Cg)([(0,wt.$K)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],lr);class ur extends ir.K{constructor(){super(...arguments),this.receiveShadows=!0}}(0,xt.Cg)([(0,ir.W)()],ur.prototype,"receiveShadows",void 0);class hr extends Ve{constructor(e,t){super(e,fr),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(0,Ne.uw)(e)&&!this.transparent],[4,e=>(0,Ne.uw)(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>(0,Ne.uw)(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=rr(this.parameters),this._configuration=new ar(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=Kt.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,h.t2)(this.parameters.emissiveBaseColor,d.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:i,doubleSided:n,doubleSidedType:o}=t;r.hasVertexTangents=!i&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=i?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!i&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=i?2:n&&"normal"===o?1:n&&"winding-order"===o?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,(0,Ne._o)(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=function(e,t){return e.receiveShadows&&null!=t.screenSpaceShadowHighlightFbo?.getTexture()}(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,t,r,i,n,o){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,h.hZ)(xr,t[12],t[13],t[14]);let o=null;switch(r.viewingMode){case 1:o=(0,h.S8)(vr,xr);break;case 2:o=(0,h.C)(vr,gr)}const s=(0,h.Re)(wr,xr,e.eye),a=(0,h.Bw)(s),c=(0,h.hs)(s,s,1/a);let l=null;this.parameters.screenSizePerspective&&(l=(0,h.Om)(o,c));const u=(0,Ge.kE)(e,a,this.parameters.verticalOffset,l??0,this.parameters.screenSizePerspective,null);(0,h.hs)(o,o,u),(0,h.ei)(_r,o,r.transform.inverseRotation),i=(0,h.Re)(pr,i,_r),n=(0,h.Re)(mr,n,_r)}o=function(e,t,r,i){const n=vt(t);if(!n)return e;const o=5e-6*n.units,s=(0,h.S8)(_t,(0,h.jb)(_t,i,r));return(t,r,i)=>{const a=(r?1-Math.abs((0,h.Om)(s,r)):0)*n.factor*5e-5+o;return e(t+a,r,i)}}(o,this._configuration,i,n),We(e,r,i,n,(0,st.ou)(r.verticalOffset),o)}createGLMaterial(e){return new dr(e)}createBufferWriter(){return new dt(this._layout)}get transparent(){return function(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:s,textureAlphaMode:a,colorMixMode:c}=e,l=i[3];return t||r<1&&"replace"!==c||l<1&&"ignore"!==c||n<1||(null!=o||null!=s)&&1!==a&&2!==a&&"replace"!==c}(this.parameters)}}class dr extends Le{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,h.hZ)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?lr:Qt,e)}}class fr extends Jt{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const pr=(0,d.vt)(),mr=(0,d.vt)(),gr=(0,d.fA)(0,0,1),vr=(0,d.vt)(),_r=(0,d.vt)(),xr=(0,d.vt)(),wr=(0,d.vt)(),yr=()=>I.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class br{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}function Tr(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(yr().warn("Geometry must specify vertex attributes"),i=!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&&(yr().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(yr().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(yr().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else yr().warn("Indexed geometries must specify faces"),i=!1;break}default:yr().warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(yr().warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(yr().warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Mr(e){const t=(0,f.Ie)();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&((0,f.iT)(t,r.bbMin),(0,f.iT)(t,r.bbMax))}),t}function Sr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function Cr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Er=new P.A(1,2,"wosr");async function Ar(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=await(0,A.Ke)((0,E.A)(e,t));if(r.ok)return r.value.data;(0,D.QP)(r.error),function(e){throw new R.A("",`Request for object resource failed: ${e}`)}(r.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const n=e[i],o=n.images[0].data;if(!o){yr().warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+o,a="/textureDefinitions/"+i,c="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",l={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==Sr(c)},u=t?.disableTextures?Promise.resolve(null):B(s,t);r.push(u.then(e=>({refId:a,image:e,parameters:l,alphaChannelUsage:c})))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}(r.textureDefinitions??{},t);let n=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];n+=t?.image?t.image.width*t.image.height*4:0}return new br(r,i,n+(0,O.Qh)(r))}(a.url,t)),{engineResources:r,referenceBoundingBox:i}=function(e,t){const r=new Array,i=new Array,n=new Array,o=new F,s=e.resource,a=P.A.parse(s.version||"1.0","wosr");Er.validate(a);const c=s.model.name,l=s.model.geometries,u=s.materialDefinitions??{},h=e.textures;let f=0;const p=new Map;for(let e=0;e<l.length;e++){const s=l[e];if(!Tr(s))continue;const a=Cr(s),c=s.params.vertexAttributes,m=[],g=e=>{if("PerAttributeArray"===s.params.topology)return null;const t=s.params.faces;for(const r in t)if(r===e)return t[r].values;return null},v=c.position,_=v.values.length/v.valuesPerElement;for(const e in c){const t=c[e],r=t.values,i=g(e)??(0,N.tM)(_);m.push([e,new H.n(r,i,t.valuesPerElement,!0)])}const x=a.texture,w=h&&h[x];if(w&&!p.has(x)){const{image:e,parameters:t}=w,r=new Fe(e,t);i.push(r),p.set(x,r)}const y=p.get(x),b=y?y.id:void 0,T=a.material;let M=o.get(T,x);if(null==M){const e=u[T.slice(T.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=w?Sr(w.alphaChannelUsage):void 0,i={ambient:(0,d.ci)(e.diffuse),diffuse:(0,d.ci)(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:b,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:w?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(i,t.materialParameters),M=new hr(i,t),o.set(T,x,M)}n.push(M);const S=new ne(M,m);f+=m.find(e=>"position"===e[0])?.[1]?.indices.length??0,r.push(S)}return{engineResources:[{name:c,stageResources:{textures:i,materials:n,geometries:r},pivotOffset:s.model.pivotOffset,numberOfVertices:f,lodThreshold:null}],referenceBoundingBox:Mr(r)}}(e,t);return{lods:r,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let p;if(t.cache)p=await t.cache.loadGLTF(a.url,t,!!t.usePBR,!!t.useEmissive);else{const{loadGLTF:e}=await r.e(1698).then(r.bind(r,51698));p=await e(new w.R,a.url,t,t.usePBR,t.useEmissive)}const{engineResources:T,referenceBoundingBox:S}=function(e,t,r){const n=e.model,a=e.meta,p=n.meta?.ESRI_proxyEllipsoid,w=a.isEsriSymbolResource&&null!=p&&"EsriRealisticTreesStyle"===a.ESRI_webstyle;w&&!e.customMeta.esriTreeRendering&&(e.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 s=o.attributes.position,a=s.count,u=(0,d.vt)(),f=(0,d.vt)(),p=(0,d.vt)(),m=new Float32Array(4*a),v=new Float32Array(3*a),_=(0,c.B8)((0,l.vt)(),o.transform);let x=0,w=0;for(let c=0;c<a;c++){s.getVec(c,f),n.getVec(c,u),(0,h.Z0)(f,f,o.transform),(0,h.Re)(p,f,t.center),(0,h.Qr)(p,p,t.radius);const a=p[2],l=(0,h.Bw)(p),d=Math.min(.45+.55*l*l,1)**i.Tf;(0,h.Qr)(p,p,t.radius),null!==_&&(0,h.Z0)(p,p,_),(0,h.S8)(p,p),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,h.Cc)(p,p,u,a>-1?.2:Math.min(-4*a-3.8,1)),v[x]=p[0],v[x+1]=p[1],v[x+2]=p[2],x+=3,m[w]=d,m[w+1]=d,m[w+2]=d,m[w+3]=1,w+=4}o.attributes.normal=new g.xs(v.buffer),o.attributes.color=new g.Eq(m.buffer)}}}(e,p));const T=!!t.usePBR,S=a.isEsriSymbolResource?{usePBR:T,isSchematic:!1,treeRendering:w,mrrFactors:Yt.SY}:{usePBR:T,isSchematic:!1,treeRendering:!1,mrrFactors:Yt.mb},E={...t.materialParameters,treeRendering:w},A=new Array,R=new Map,I=new Map,O=n.lods.length,F=(0,f.Ie)();return n.lods.forEach((e,a)=>{const c=!0===t.skipHighLods&&(O>1&&0===a||O>3&&1===a)||!1===t.skipHighLods&&null!=r&&a!==r;if(c&&0!==a)return;const l=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const r=c?new hr({},t):function(e,t,r,n,o,s,a,c,l){const h=e.materials.get(t.material);if(null==h)return null;const{normal:d,color:f,texCoord0:p,tangent:m}=t.attributes,g=t.material+(d?"_normal":"")+(f?"_color":"")+(p?"_texCoord0":"")+(m?"_tangent":""),v=null!=t.attributes.texCoord0,_=null!=t.attributes.normal,x=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(h.alphaMode);if(!s.has(g)){if(v){const t=(t,r=!1,i=!1)=>{if(null!=t&&!a.has(t)){const n=e.textures.get(t);if(n){const e=n.data,o=r&&!(0,b.x3)(e)?c.compressionOptions:void 0;a.set(t,new Fe((0,b.x3)(e)?e.data:e,{...n.parameters,preMultiplyAlpha:!(0,b.x3)(e)&&i,encoding:(0,b.x3)(e)?e.encoding:void 0,compressionOptions:o}))}}},r=1!==x&&!l;t(h.colorTexture,r,1!==x),t(h.normalTexture),t(h.occlusionTexture,!0),t(h.emissiveTexture),t(h.metallicRoughnessTexture,!0)}const r=(0,i.xV)(h.color[0]),d=(0,i.xV)(h.color[1]),f=(0,i.xV)(h.color[2]),p=null!=h.colorTexture&&v?a.get(h.colorTexture):null,m=(0,Yt.Jr)(h),w=null!=h.normalTextureTransform?.scale?h.normalTextureTransform?.scale:u.Un;s.set(g,new hr({...n,customDepthTest:1,textureAlphaMode:x,textureAlphaCutoff:h.alphaCutoff,diffuse:[r,d,f],ambient:[r,d,f],opacity:"OPAQUE"===h.alphaMode?1:h.opacity,doubleSided:h.doubleSided,doubleSidedType:"winding-order",cullFace:h.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:_?0:2,castShadows:!0,receiveShadows:h.receiveShadows,receiveAmbientOcclusion:h.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:h.colorMixMode,normalTextureId:null!=h.normalTexture&&v?a.get(h.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=h.occlusionTexture&&v?a.get(h.occlusionTexture).id:void 0,emissiveTextureId:null!=h.emissiveTexture&&v?a.get(h.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=h.metallicRoughnessTexture&&v?a.get(h.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[h.emissiveFactor[0],h.emissiveFactor[1],h.emissiveFactor[2]],emissiveStrengthKHR:null!=h.emissiveStrengthKHR?h.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=o.emissiveStrengthFromSymbol?o.emissiveStrengthFromSymbol:void 0,mrrFactors:m?Yt.Bt:[h.metallicFactor,h.roughnessFactor,n.mrrFactors[2]],isSchematic:m,colorTextureTransformMatrix:M(h.colorTextureTransform),normalTextureTransformMatrix:M(h.normalTextureTransform),scale:[w[0],w[1]],occlusionTextureTransformMatrix:M(h.occlusionTextureTransform),emissiveTextureTransformMatrix:M(h.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:M(h.metallicRoughnessTextureTransform),...o},c))}const w=s.get(g);if(r.stageResources.materials.push(w),v){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(h.colorTexture),e(h.normalTexture),e(h.occlusionTexture),e(h.emissiveTexture),e(h.metallicRoughnessTexture)}return w}(n,e,l,S,E,R,I,t,w),{geometry:h,vertexCount:d}=function(e,t){const r=e.attributes.position.count,i=(0,y.x)(e.indices||r,e.primitiveType),n=m(3*r),{typedBuffer:a,typedBufferStride:c}=e.attributes.position;(0,v.t)(n,a,e.transform,3,c);const l=[["position",new H.n(n,i,3,!0)]];if(null!=e.attributes.normal){const t=m(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,s.Ge)(Rr,e.transform),(0,v.b)(t,n,Rr,3,a),(0,o.or)(Rr)&&(0,v.n)(t,t),l.push(["normal",new H.n(t,i,3,!0)])}if(null!=e.attributes.tangent){const t=m(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,s.z0)(Rr,e.transform),(0,_.t)(t,n,Rr,4,a),(0,o.or)(Rr)&&(0,v.n)(t,t,4),l.push(["tangent",new H.n(t,i,4,!0)])}if(null!=e.attributes.texCoord0){const t=m(2*r),{typedBuffer:n,typedBufferStride:o}=e.attributes.texCoord0;(0,x.a)(t,n,2,o),l.push(["uv0",new H.n(t,i,2,!0)])}const u=e.attributes.color;if(null!=u){const t=new Uint8Array(4*r);4===u.elementCount?u instanceof g.Eq?(0,_.b)(t,u,1,255):(u instanceof g.XP||u instanceof g.Uz)&&(0,_.b)(t,u,1/255,255):(t.fill(255),u instanceof g.xs?(0,v.f)(t,u.typedBuffer,1,255,4,u.typedBufferStride):(e.attributes.color instanceof g.eI||e.attributes.color instanceof g.nS)&&(0,v.f)(t,u.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),l.push(["color",new H.n(t,i,4,!0)])}return{geometry:new ne(t,l),vertexCount:r}}(e,r??new hr({},t)),p=h.boundingInfo;null!=p&&0===a&&((0,f.iT)(F,p.bbMin),(0,f.iT)(F,p.bbMax)),null!=r&&(l.stageResources.geometries.push(h),l.numberOfVertices+=d)}),c||A.push(l)}),{engineResources:A,referenceBoundingBox:F}}(p,t,a.specifiedLodIndex);return{lods:T,referenceBoundingBox:S,isEsriSymbolResource:p.meta.isEsriSymbolResource,isWosr:!1}}const Rr=(0,a.vt)()},1843(e,t,r){r.d(t,{BP:()=>h,l5:()=>d});var i=r(20498),n=r(13030),o=r(90239),s=r(4431),a=r(620),c=r(85079);class l{constructor(e,t,r=0){this.layout=e,this.byteOffset=r,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fields.keys()){const i=e.fields.get(t);this[t]=new i.constructor(this.buffer,r+i.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new l(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,r=0,i=e.count){const n=this.stride;if(n%4==0){const o=new Uint32Array(e.buffer,t*n,i*n/4);new Uint32Array(this.buffer,r*n,i*n/4).set(o)}else{const o=new Uint8Array(e.buffer,t*n,i*n);new Uint8Array(this.buffer,r*n,i*n).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}}class u{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:m(e[1].constructor)})))}freeze(){return this}get locations(){return(0,c.Xk)((0,s.U)(this))}vec2f16(e,t){return this._appendField(e,i.SX?n.ZD:n.gH,t),this}vec2f(e,t){return this._appendField(e,n.gH,t),this}vec2f64(e,t){return this._appendField(e,n.si,t),this}vec3f16(e,t){return this._appendField(e,i.SX?n.EC:n.xs,t),this}vec3f(e,t){return this._appendField(e,n.xs,t),this}vec3f64(e,t){return this._appendField(e,n.Xm,t),this}vec4f16(e,t){return this._appendField(e,i.SX?n.jz:n.Eq,t),this}vec4f(e,t){return this._appendField(e,n.Eq,t),this}vec4f64(e,t){return this._appendField(e,n.Aj,t),this}mat3f(e,t){return this._appendField(e,n.jZ,t),this}mat3f64(e,t){return this._appendField(e,n.j0,t),this}mat4f(e,t){return this._appendField(e,n.Sx,t),this}mat4f64(e,t){return this._appendField(e,n.E$,t),this}vec4u8(e,t){return this._appendField(e,n.XP,t),this}f16(e,t){return this._appendField(e,i.SX?n.XW:n.Y$,t),this}f32(e,t){return this._appendField(e,n.Y$,t),this}f64(e,t){return this._appendField(e,n.qB,t),this}u8(e,t){return this._appendField(e,n.SL,t),this}u16(e,t){return this._appendField(e,n.h,t),this}i8(e,t){return this._appendField(e,n.bf,t),this}vec2i8(e,t){return this._appendField(e,n.D6,t),this}vec2i16(e,t){return this._appendField(e,n.mJ,t),this}vec2u8(e,t){return this._appendField(e,n.LC,t),this}vec2u16(e,t){return this._appendField(e,n.Yi,t),this}vec4u16(e,t){return this._appendField(e,n.Uz,t),this}vec4i16(e,t){return this._appendField(e,n.E7,t),this}u32(e,t){return this._appendField(e,n.P,t),this}_appendField(e,t,r){this._fields.has(e)&&(0,a.vA)(!1,`${e} already added to vertex buffer layout`);const i=t.ElementCount*(0,o.GJ)(t.ElementType),n=this._stride;this._fields.set(e,{constructor:t,size:i,offset:n,optional:r}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(r=>{const i=(0,o.GJ)(r.constructor.ElementType);e=Math.floor((e+i-1)/i)*i,r.offset=e,e+=r.size,t=Math.max(t,i)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new l(this,e)}createView(e,t){return new l(this,e,t)}clone(){const e=new u;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,r)=>e._fields.set(r,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function h(){return new u}class d{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const r={...e,constructor:p(e.constructor)};this.fields.push([t,r])}),this.stride=e.stride}}const f=[n.Y$,n.gH,n.xs,n.Eq,n.jZ,n.Sx,n.qB,n.si,n.Xm,n.Aj,n.j0,n.E$,n.SL,n.LC,n.eI,n.XP,n.h,n.Yi,n.nS,n.Uz,n.P,n.An,n.H$,n.ml,n.bf,n.D6,n.m8,n.TX,n.Qt,n.mJ,n.Vp,n.E7,n.My,n.UL,n.zD,n.Y4];function p(e){return`${e.ElementType}_${e.ElementCount}`}function m(e){return g.get(e)}const g=new Map;f.forEach(e=>g.set(p(e),e))},4431(e,t,r){r.d(t,{U:()=>o});var i=r(63907),n=r(74038);function o(e,t=0){const r=e.stride;return Array.from(e.fields.keys()).map(o=>{const s=e.fields.get(o),a=s.constructor.ElementCount,c=function(e){switch(e){case"u8":return i.pe.UNSIGNED_BYTE;case"u16":return i.pe.UNSIGNED_SHORT;case"u32":return i.pe.UNSIGNED_INT;case"i8":return i.pe.BYTE;case"i16":return i.pe.SHORT;case"i32":return i.pe.INT;case"f16":return i.pe.HALF_FLOAT;case"f32":return i.pe.FLOAT;default:throw new Error("BufferType not supported in WebGL")}}(s.constructor.ElementType),l=s.offset,u=s.optional?.glNormalized??!1,h=s.optional?.integer??!1;return new n._(o,a,c,l,r,u,t,h)})}},26857(e,t,r){r.d(t,{b:()=>a});var i=r(5482),n=r(69622),o=r(91429);let s=class extends n.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.OCCLUSION_QUERY_DEBUG_PIXEL=!1,this.ENABLE_OPTIMIZATIONS=!0,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,this.FLOW_GLOBAL_SCALE_THRESHOLD=null}};(0,i.Cg)([(0,o.MZ)()],s.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DECONFLICTOR_SHOW_GRID",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LABELS_SHOW_BORDER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TEXT_SHOW_BASELINE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TEXT_SHOW_BORDER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OVERLAY_SHOW_CENTER",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"SHOW_POI",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"OCCLUSION_QUERY_DEBUG_PIXEL",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"ENABLE_OPTIMIZATIONS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"I3S_TREE_SHOW_TILES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"I3S_SHOW_MODIFICATIONS",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"LINE_WIREFRAMES",void 0),(0,i.Cg)([(0,o.MZ)()],s.prototype,"FLOW_GLOBAL_SCALE_THRESHOLD",void 0),s=(0,i.Cg)([(0,o.$K)("esri.views.3d.support.debugFlags")],s);const a=new s},46686(e,t,r){r.d(t,{o:()=>n});var i=r(31821);function n(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(i.H`
234
234
  void forwardLinearDepth(float _linearDepth) { ${(0,i.If)(t,"linearDepth = _linearDepth;")} }
235
235
  `)}},33120(e,t,r){r.d(t,{i$:()=>s,xJ:()=>o}),r(46686),r(62308);var i=r(77108),n=r(31821);function o(e){e.vertex.uniforms.add(new i.E("nearFar",e=>e.camera.nearFar))}function s(e){e.vertex.code.add(n.H`float calculateLinearDepth(vec2 nearFar,float z) {
236
236
  return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
@@ -244,8 +244,8 @@ return posClip;
244
244
  }`)}},82048(e,t,r){r.d(t,{c:()=>n});var i=r(31821);function n(e,t=!0){e.attributes.add("position","vec2"),t&&e.varyings.add("uv","vec2"),e.vertex.main.add(i.H`
245
245
  gl_Position = vec4(position, 0.0, 1.0);
246
246
  ${t?i.H`uv = position * 0.5 + vec2(0.5);`:""}
247
- `)}},49255(e,t,r){function i(e){return function(e){return function(e){return function(e){return s(e)||function(e){return 10===e||11===e}(e)}(e)||function(e){return 3===e}(e)}(e)||4===e}(e)||function(e){return 5===(t=e)||6===t||7===t||8===e||9===e;var t}(e)}function n(e){return 1===e}function o(e){return 2===e}function s(e){return 0===e||function(e){return n(e)||o(e)}(e)}r.d(t,{Rb:()=>o,Sp:()=>n,_o:()=>s,uw:()=>i})},68317(e,t,r){r.d(t,{Hz:()=>m,HQ:()=>p});var i=r(5482),n=r(58083),o=r(9093),s=r(35522),a=r(51850),c=r(51976);class l extends c.K{constructor(){super(...arguments),this.output=0,this.hasEmission=!1,this.useFloatBlend=!0}}(0,i.Cg)([(0,c.W)({count:12})],l.prototype,"output",void 0),(0,i.Cg)([(0,c.W)()],l.prototype,"hasEmission",void 0),(0,i.Cg)([(0,c.W)()],l.prototype,"useFloatBlend",void 0);class u extends l{constructor(){super(...arguments),this.instancedDoublePrecision=!1,this.hasModelTransformation=!1}}var h=r(40710),d=(r(33079),r(31821)),f=r(65786);class m extends u{constructor(){super(...arguments),this.hasSlicePlane=!1,this.hasSliceTranslatedView=!1}}function p(e,t){!function(e,t,...r){e.constants.add("groundSliceOpacity","float",.2),function(e,t,...r){t.hasSlicePlane?(e.uniforms.add(...r),e.code.add(g)):e.code.add("bool rejectBySlice(vec3 pos) { return false; }")}(e,t,...r),t.hasSlicePlane?e.code.add("\n void discardBySlice(vec3 pos) {\n if (rejectBySlice(pos)) {\n discard;\n }\n }\n\n vec4 applySliceOutline(vec4 color, vec3 pos) {\n SliceFactors factors = calculateSliceFactors(pos);\n\n factors.front /= 2.0 * fwidth(factors.front);\n factors.side0 /= 2.0 * fwidth(factors.side0);\n factors.side1 /= 2.0 * fwidth(factors.side1);\n factors.side2 /= 2.0 * fwidth(factors.side2);\n factors.side3 /= 2.0 * fwidth(factors.side3);\n\n // return after calling fwidth, to avoid aliasing caused by discontinuities in the input to fwidth\n if (sliceByFactors(factors)) {\n return color;\n }\n\n float outlineFactor = (1.0 - step(0.5, factors.front))\n * (1.0 - step(0.5, factors.side0))\n * (1.0 - step(0.5, factors.side1))\n * (1.0 - step(0.5, factors.side2))\n * (1.0 - step(0.5, factors.side3));\n\n return mix(color, vec4(vec3(0.0), color.a), outlineFactor * 0.3);\n }\n\n vec4 applySlice(vec4 color, vec3 pos) {\n return sliceEnabled() ? applySliceOutline(color, pos) : color;\n }\n "):e.code.add(d.H`void discardBySlice(vec3 pos) { }
248
- vec4 applySlice(vec4 color, vec3 pos) { return color; }`)}(e,t,...function(e){return[new h.W("slicePlaneOrigin",(t,r)=>function(e,t,r){if(null==r.slicePlane)return a.uY;const i=v(e,t,r),n=_(i,r.slicePlane),o=x(e,i,r);return null!=o?(0,s.Z0)(b,n,o):n}(e,t,r)),new h.W("slicePlaneBasis1",(t,r)=>y(e,t,r,r.slicePlane?.basis1)),new h.W("slicePlaneBasis2",(t,r)=>y(e,t,r,r.slicePlane?.basis2))]}(t))}(0,i.Cg)([(0,c.W)()],m.prototype,"hasSlicePlane",void 0),f.Y;const g=d.H`struct SliceFactors {
247
+ `)}},49255(e,t,r){function i(e){return function(e){return function(e){return function(e){return s(e)||function(e){return 10===e||11===e}(e)}(e)||function(e){return 3===e}(e)}(e)||4===e}(e)||function(e){return 5===(t=e)||6===t||7===t||8===e||9===e;var t}(e)}function n(e){return 1===e}function o(e){return 2===e}function s(e){return 0===e||function(e){return n(e)||o(e)}(e)}r.d(t,{Rb:()=>o,Sp:()=>n,_o:()=>s,uw:()=>i})},68317(e,t,r){r.d(t,{Hz:()=>p,HQ:()=>m});var i=r(5482),n=r(58083),o=r(9093),s=r(35522),a=r(51850),c=r(51976);class l extends c.K{constructor(){super(...arguments),this.output=0,this.hasEmission=!1,this.useFloatBlend=!0}}(0,i.Cg)([(0,c.W)({count:12})],l.prototype,"output",void 0),(0,i.Cg)([(0,c.W)()],l.prototype,"hasEmission",void 0),(0,i.Cg)([(0,c.W)()],l.prototype,"useFloatBlend",void 0);class u extends l{constructor(){super(...arguments),this.instancedDoublePrecision=!1,this.hasModelTransformation=!1}}var h=r(40710),d=(r(33079),r(31821)),f=r(65786);class p extends u{constructor(){super(...arguments),this.hasSlicePlane=!1,this.hasSliceTranslatedView=!1}}function m(e,t){!function(e,t,...r){e.constants.add("groundSliceOpacity","float",.2),function(e,t,...r){t.hasSlicePlane?(e.uniforms.add(...r),e.code.add(g)):e.code.add("bool rejectBySlice(vec3 pos) { return false; }")}(e,t,...r),t.hasSlicePlane?e.code.add("\n void discardBySlice(vec3 pos) {\n if (rejectBySlice(pos)) {\n discard;\n }\n }\n\n vec4 applySliceOutline(vec4 color, vec3 pos) {\n SliceFactors factors = calculateSliceFactors(pos);\n\n factors.front /= 2.0 * fwidth(factors.front);\n factors.side0 /= 2.0 * fwidth(factors.side0);\n factors.side1 /= 2.0 * fwidth(factors.side1);\n factors.side2 /= 2.0 * fwidth(factors.side2);\n factors.side3 /= 2.0 * fwidth(factors.side3);\n\n // return after calling fwidth, to avoid aliasing caused by discontinuities in the input to fwidth\n if (sliceByFactors(factors)) {\n return color;\n }\n\n float outlineFactor = (1.0 - step(0.5, factors.front))\n * (1.0 - step(0.5, factors.side0))\n * (1.0 - step(0.5, factors.side1))\n * (1.0 - step(0.5, factors.side2))\n * (1.0 - step(0.5, factors.side3));\n\n return mix(color, vec4(vec3(0.0), color.a), outlineFactor * 0.3);\n }\n\n vec4 applySlice(vec4 color, vec3 pos) {\n return sliceEnabled() ? applySliceOutline(color, pos) : color;\n }\n "):e.code.add(d.H`void discardBySlice(vec3 pos) { }
248
+ vec4 applySlice(vec4 color, vec3 pos) { return color; }`)}(e,t,...function(e){return[new h.W("slicePlaneOrigin",(t,r)=>function(e,t,r){if(null==r.slicePlane)return a.uY;const i=v(e,t,r),n=_(i,r.slicePlane),o=x(e,i,r);return null!=o?(0,s.Z0)(b,n,o):n}(e,t,r)),new h.W("slicePlaneBasis1",(t,r)=>w(e,t,r,r.slicePlane?.basis1)),new h.W("slicePlaneBasis2",(t,r)=>w(e,t,r,r.slicePlane?.basis2))]}(t))}(0,i.Cg)([(0,c.W)()],p.prototype,"hasSlicePlane",void 0),f.Y;const g=d.H`struct SliceFactors {
249
249
  float front;
250
250
  float side0;
251
251
  float side1;
@@ -280,7 +280,7 @@ return dot(slicePlaneBasis1, slicePlaneBasis1) != 0.0;
280
280
  }
281
281
  bool rejectBySlice(vec3 pos) {
282
282
  return sliceEnabled() && sliceByFactors(calculateSliceFactors(pos));
283
- }`;function v(e,t,r){return e.instancedDoublePrecision?(0,s.hZ)(w,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]):t.slicePlaneLocalOrigin}function _(e,t){return null!=e?(0,s.Re)(b,t.origin,e):t.origin}function x(e,t,r){return e.hasSliceTranslatedView?null!=t?(0,n.Tl)(M,r.camera.viewMatrix,t):r.camera.viewMatrix:null}function y(e,t,r,i){if(null==i||null==r.slicePlane)return a.uY;const n=v(e,t,r),o=_(n,r.slicePlane),c=x(e,n,r);return null!=c?((0,s.WQ)(T,i,o),(0,s.Z0)(b,o,c),(0,s.Z0)(T,T,c),(0,s.Re)(T,T,b)):i}const w=(0,a.vt)(),b=(0,a.vt)(),T=(0,a.vt)(),M=(0,o.vt)()},76597(e,t,r){r.d(t,{d:()=>o});var i=r(33120),n=r(31821);function o(e){(0,i.i$)(e),e.vertex.code.add(n.H`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
283
+ }`;function v(e,t,r){return e.instancedDoublePrecision?(0,s.hZ)(y,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]):t.slicePlaneLocalOrigin}function _(e,t){return null!=e?(0,s.Re)(b,t.origin,e):t.origin}function x(e,t,r){return e.hasSliceTranslatedView?null!=t?(0,n.Tl)(M,r.camera.viewMatrix,t):r.camera.viewMatrix:null}function w(e,t,r,i){if(null==i||null==r.slicePlane)return a.uY;const n=v(e,t,r),o=_(n,r.slicePlane),c=x(e,n,r);return null!=c?((0,s.WQ)(T,i,o),(0,s.Z0)(b,o,c),(0,s.Z0)(T,T,c),(0,s.Re)(T,T,b)):i}const y=(0,a.vt)(),b=(0,a.vt)(),T=(0,a.vt)(),M=(0,o.vt)()},76597(e,t,r){r.d(t,{d:()=>o});var i=r(33120),n=r(31821);function o(e){(0,i.i$)(e),e.vertex.code.add(n.H`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
284
284
  vec4 eye = view * vec4(pos, 1.0);
285
285
  depth = calculateLinearDepth(nearFar,eye.z);
286
286
  return proj * eye;
@@ -292,7 +292,7 @@ return proj * (view * vec4(pos, 1.0));
292
292
  }
293
293
  `)):e.vertex.code.add(n.H`MaskedColor applyInstanceColor(MaskedColor color) {
294
294
  return color;
295
- }`)}},72722(e,t,r){r.d(t,{B:()=>x});var i=r(77690),n=r(29242),o=r(9093),s=r(35522),a=r(51850),c=r(26425),l=r(20693),u=r(23205),h=r(31821),d=r(35644),f=r(74333);class m extends f.n{constructor(e,t,r){super(e,"mat4",1,(i,n,o)=>i.setUniformMatrix4fv(e,t(n,o),r))}}function p(e,t){const r=e.length;for(let i=0;i<r;++i)v[0]=e[i],t[i]=v[0];return t}function g(e,t){const r=e.length;for(let i=0;i<r;++i)v[0]=e[i],v[1]=e[i]-v[0],t[i]=v[1];return t}const v=new Float32Array(2);r(65786).Y;const _=(0,n.vt)();function x(e,t){const{hasModelTransformation:r,instancedDoublePrecision:n,instanced:a,output:f,hasVertexTangents:v}=t;r&&(e.vertex.uniforms.add(new m("model",e=>e.modelTransformation??o.zK)),e.vertex.uniforms.add(new d.k("normalLocalOriginFromModel",e=>((0,i.Ge)(_,e.modelTransformation??o.zK),_)))),a&&n&&(e.attributes.add("instanceModelOriginHi","vec3"),e.attributes.add("instanceModelOriginLo","vec3"),e.attributes.add("instanceModel","mat3"),e.attributes.add("instanceModelNormal","mat3"));const x=e.vertex;n&&(x.include(c.u),x.uniforms.add(new u.d("viewOriginHi",e=>p((0,s.hZ)(y,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),y)),new u.d("viewOriginLo",e=>g((0,s.hZ)(y,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),y)))),x.code.add(h.H`
295
+ }`)}},72722(e,t,r){r.d(t,{B:()=>x});var i=r(77690),n=r(29242),o=r(9093),s=r(35522),a=r(51850),c=r(26425),l=r(20693),u=r(23205),h=r(31821),d=r(35644),f=r(74333);class p extends f.n{constructor(e,t,r){super(e,"mat4",1,(i,n,o)=>i.setUniformMatrix4fv(e,t(n,o),r))}}function m(e,t){const r=e.length;for(let i=0;i<r;++i)v[0]=e[i],t[i]=v[0];return t}function g(e,t){const r=e.length;for(let i=0;i<r;++i)v[0]=e[i],v[1]=e[i]-v[0],t[i]=v[1];return t}const v=new Float32Array(2);r(65786).Y;const _=(0,n.vt)();function x(e,t){const{hasModelTransformation:r,instancedDoublePrecision:n,instanced:a,output:f,hasVertexTangents:v}=t;r&&(e.vertex.uniforms.add(new p("model",e=>e.modelTransformation??o.zK)),e.vertex.uniforms.add(new d.k("normalLocalOriginFromModel",e=>((0,i.Ge)(_,e.modelTransformation??o.zK),_)))),a&&n&&(e.attributes.add("instanceModelOriginHi","vec3"),e.attributes.add("instanceModelOriginLo","vec3"),e.attributes.add("instanceModel","mat3"),e.attributes.add("instanceModelNormal","mat3"));const x=e.vertex;n&&(x.include(c.u),x.uniforms.add(new u.d("viewOriginHi",e=>m((0,s.hZ)(w,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),w)),new u.d("viewOriginLo",e=>g((0,s.hZ)(w,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),w)))),x.code.add(h.H`
296
296
  vec3 getVertexInLocalOriginSpace() {
297
297
  return ${r?n?"(model * vec4(instanceModel * localPosition().xyz, 1.0)).xyz":"(model * localPosition()).xyz":n?"instanceModel * localPosition().xyz":"localPosition().xyz"};
298
298
  }
@@ -314,7 +314,7 @@ return color;
314
314
  `)),v&&x.code.add(h.H`
315
315
  vec4 dpTransformVertexTangent(vec4 _tangent) {
316
316
  ${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;"}
317
- }`)}const y=(0,a.vt)()},43519(e,t,r){r.d(t,{ML:()=>s,WD:()=>n,Y1:()=>o,oF:()=>a});var i=r(31821);function n(e){e.code.add(i.H`struct MaskedColor {
317
+ }`)}const w=(0,a.vt)()},43519(e,t,r){r.d(t,{ML:()=>s,WD:()=>n,Y1:()=>o,oF:()=>a});var i=r(31821);function n(e){e.code.add(i.H`struct MaskedColor {
318
318
  vec4 color;
319
319
  bvec4 mask;
320
320
  };`)}function o(e){e.include(n),e.code.add(i.H`
@@ -400,7 +400,7 @@ screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params)
400
400
  return size * clamp(mix(factor.x, 1.0, factor.y), factor.z, 1.0);
401
401
  }`),e.vertex.code.add(c.H`vec2 screenSizePerspectiveScaleVec2(vec2 size, float absCosAngle, float distanceToCamera, vec3 params) {
402
402
  return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params));
403
- }`)}const u=(0,s.vt)();var h=r(20693),d=r(71988);function f(e,t){const r=e.vertex;t.hasVerticalOffset?(function(e){e.uniforms.add(new d.E("verticalOffset",(e,t)=>{const{minWorldLength:r,maxWorldLength:n,screenLength:o}=e.verticalOffset,s=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),a=t.camera.pixelRatio||1;return(0,i.hZ)(m,o*a,s,r,n)}))}(r),t.hasScreenSizePerspective&&(e.include(l),function(e){e.uniforms.add(new a.t("screenSizePerspectiveAlignment",e=>function(e,t){const r=null!=t&&null!=e?Math.min(e.minPixelSize/t,1):0;return e?(0,o.hZ)(u,e.divisor,e.offset,r):(0,o.hZ)(u,0,0,0)}(e.screenSizePerspectiveAlignment||e.screenSizePerspective,e.screenSizePerspectiveAlignment?null:e.screenSizePerspectiveMinPixelReferenceSize)))}(r),(0,h.yu)(e.vertex,t)),r.code.add(c.H`
403
+ }`)}const u=(0,s.vt)();var h=r(20693),d=r(71988);function f(e,t){const r=e.vertex;t.hasVerticalOffset?(function(e){e.uniforms.add(new d.E("verticalOffset",(e,t)=>{const{minWorldLength:r,maxWorldLength:n,screenLength:o}=e.verticalOffset,s=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),a=t.camera.pixelRatio||1;return(0,i.hZ)(p,o*a,s,r,n)}))}(r),t.hasScreenSizePerspective&&(e.include(l),function(e){e.uniforms.add(new a.t("screenSizePerspectiveAlignment",e=>function(e,t){const r=null!=t&&null!=e?Math.min(e.minPixelSize/t,1):0;return e?(0,o.hZ)(u,e.divisor,e.offset,r):(0,o.hZ)(u,0,0,0)}(e.screenSizePerspectiveAlignment||e.screenSizePerspective,e.screenSizePerspectiveAlignment?null:e.screenSizePerspectiveMinPixelReferenceSize)))}(r),(0,h.yu)(e.vertex,t)),r.code.add(c.H`
404
404
  vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
405
405
  float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
406
406
  ${t.spherical?c.H`vec3 worldNormal = normalize(worldPos + localOrigin);`:c.H`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
@@ -416,7 +416,7 @@ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScal
416
416
  vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
417
417
  return worldPos + calculateVerticalOffset(worldPos, localOrigin);
418
418
  }
419
- `)):r.code.add(c.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const m=(0,n.vt)()},9169(e,t,r){r.d(t,{E:()=>v});var i=r(33120),n=r(68317),o=r(76597),s=r(96336),a=r(31821);function c(e,t){if(11!==t.output)return e.vertex.code.add(a.H`void forwardObjectAndLayerIdColor() {}`),void e.fragment.code.add(a.H`void outputObjectAndLayerIdColor() {}`);const r=t.instanced;e.varyings.add("objectAndLayerIdColorVarying","vec4");const i=r?"instanceOlidColor":"olidColor";e.attributes.add(i,"vec4"),e.vertex.code.add(a.H`
419
+ `)):r.code.add(c.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const p=(0,n.vt)()},9169(e,t,r){r.d(t,{E:()=>v});var i=r(33120),n=r(68317),o=r(76597),s=r(96336),a=r(31821);function c(e,t){if(11!==t.output)return e.vertex.code.add(a.H`void forwardObjectAndLayerIdColor() {}`),void e.fragment.code.add(a.H`void outputObjectAndLayerIdColor() {}`);const r=t.instanced;e.varyings.add("objectAndLayerIdColorVarying","vec4");const i=r?"instanceOlidColor":"olidColor";e.attributes.add(i,"vec4"),e.vertex.code.add(a.H`
420
420
  void forwardObjectAndLayerIdColor() {
421
421
  objectAndLayerIdColorVarying = ${i} * 0.003921568627451;
422
422
  }`),e.fragment.code.add(a.H`void outputObjectAndLayerIdColor() {
@@ -432,50 +432,50 @@ float fragDepth = _calculateFragDepth(_linearDepth);
432
432
  gl_FragDepth = fragDepth;
433
433
  }`);break;case 9:e.fragment.code.add(a.H`void outputDepth(float _linearDepth){
434
434
  gl_FragDepth = _linearDepth;
435
- }`)}}var d=r(42593),f=r(91899),m=r(58614),p=r(20693),g=r(63761);function v(e,t){const{vertex:r,fragment:v,varyings:_}=e,{hasColorTexture:x,alphaDiscardMode:y}=t,w=x&&1!==y,{output:b,normalType:T,hasColorTextureTransform:M}=t;switch(b){case 3:(0,p.NB)(r,t),e.include(o.d),v.include(n.HQ,t),e.include(l.U,t),w&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
435
+ }`)}}var d=r(42593),f=r(91899),p=r(58614),m=r(20693),g=r(63761);function v(e,t){const{vertex:r,fragment:v,varyings:_}=e,{hasColorTexture:x,alphaDiscardMode:w}=t,y=x&&1!==w,{output:b,normalType:T,hasColorTextureTransform:M}=t;switch(b){case 3:(0,m.NB)(r,t),e.include(o.d),v.include(n.HQ,t),e.include(l.U,t),y&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
436
436
  vpos = subtractOrigin(vpos);
437
437
  vpos = addVerticalOffset(vpos, localOrigin);
438
438
  gl_Position = transformPosition(proj, view, vpos);
439
- forwardTextureCoordinates();`),e.include(m.S,t),v.main.add(a.H`
439
+ forwardTextureCoordinates();`),e.include(p.S,t),v.main.add(a.H`
440
440
  discardBySlice(vpos);
441
- ${(0,a.If)(w,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
442
- discardOrAdjustAlpha(texColor);`)}`);break;case 5:case 6:case 7:case 8:case 11:(0,p.NB)(r,t),e.include(o.d),e.include(l.U,t),e.include(f.A,t),e.include(h,t),v.include(n.HQ,t),e.include(c,t),(0,i.xJ)(e),_.add("depth","float",{invariant:!0}),w&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
441
+ ${(0,a.If)(y,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
442
+ discardOrAdjustAlpha(texColor);`)}`);break;case 5:case 6:case 7:case 8:case 11:(0,m.NB)(r,t),e.include(o.d),e.include(l.U,t),e.include(f.A,t),e.include(h,t),v.include(n.HQ,t),e.include(c,t),(0,i.xJ)(e),_.add("depth","float",{invariant:!0}),y&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
443
443
  vpos = subtractOrigin(vpos);
444
444
  vpos = addVerticalOffset(vpos, localOrigin);
445
445
  gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);
446
446
  forwardTextureCoordinates();
447
- forwardObjectAndLayerIdColor();`),e.include(m.S,t),v.main.add(a.H`
447
+ forwardObjectAndLayerIdColor();`),e.include(p.S,t),v.main.add(a.H`
448
448
  discardBySlice(vpos);
449
- ${(0,a.If)(w,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
449
+ ${(0,a.If)(y,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
450
450
  discardOrAdjustAlpha(texColor);`)}
451
- ${11===b?a.H`outputObjectAndLayerIdColor();`:a.H`outputDepth(depth);`}`);break;case 4:{(0,p.NB)(r,t),e.include(o.d),e.include(s.Y,t),e.include(u.Mh,t),e.include(l.U,t),e.include(f.A,t),w&&v.uniforms.add(new g.N("tex",e=>e.texture)),2===T&&_.add("vPositionView","vec3",{invariant:!0});const i=0===T||1===T;r.main.add(a.H`
451
+ ${11===b?a.H`outputObjectAndLayerIdColor();`:a.H`outputDepth(depth);`}`);break;case 4:{(0,m.NB)(r,t),e.include(o.d),e.include(s.Y,t),e.include(u.Mh,t),e.include(l.U,t),e.include(f.A,t),y&&v.uniforms.add(new g.N("tex",e=>e.texture)),2===T&&_.add("vPositionView","vec3",{invariant:!0});const i=0===T||1===T;r.main.add(a.H`
452
452
  vpos = getVertexInLocalOriginSpace();
453
453
  ${i?a.H`vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:a.H`vPositionView = (view * vec4(vpos, 1.0)).xyz;`}
454
454
  vpos = subtractOrigin(vpos);
455
455
  vpos = addVerticalOffset(vpos, localOrigin);
456
456
  gl_Position = transformPosition(proj, view, vpos);
457
- forwardTextureCoordinates();`),v.include(n.HQ,t),e.include(m.S,t),v.main.add(a.H`
457
+ forwardTextureCoordinates();`),v.include(n.HQ,t),e.include(p.S,t),v.main.add(a.H`
458
458
  discardBySlice(vpos);
459
- ${(0,a.If)(w,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
459
+ ${(0,a.If)(y,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
460
460
  discardOrAdjustAlpha(texColor);`)}
461
461
 
462
462
  ${2===T?a.H`vec3 normal = screenDerivativeNormal(vPositionView);`:a.H`vec3 normal = normalize(vNormalWorld);
463
463
  if (gl_FrontFacing == false){
464
464
  normal = -normal;
465
465
  }`}
466
- fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case 10:(0,p.NB)(r,t),e.include(o.d),e.include(l.U,t),e.include(f.A,t),w&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
466
+ fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case 10:(0,m.NB)(r,t),e.include(o.d),e.include(l.U,t),e.include(f.A,t),y&&v.uniforms.add(new g.N("tex",e=>e.texture)),r.main.add(a.H`vpos = getVertexInLocalOriginSpace();
467
467
  vpos = subtractOrigin(vpos);
468
468
  vpos = addVerticalOffset(vpos, localOrigin);
469
469
  gl_Position = transformPosition(proj, view, vpos);
470
- forwardTextureCoordinates();`),v.include(n.HQ,t),e.include(m.S,t),e.include(d.Q,t),v.main.add(a.H`
470
+ forwardTextureCoordinates();`),v.include(n.HQ,t),e.include(p.S,t),e.include(d.Q,t),v.main.add(a.H`
471
471
  discardBySlice(vpos);
472
- ${(0,a.If)(w,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
472
+ ${(0,a.If)(y,a.H`vec4 texColor = texture(tex, ${M?"colorUV":"vuv0"});
473
473
  discardOrAdjustAlpha(texColor);`)}
474
- calculateOcclusionAndOutputHighlight();`)}}},22911(e,t,r){r.d(t,{NL:()=>p});var i=r(34727),n=r(49255),o=r(99208),s=r(65261),a=r(40710),c=r(33079),l=r(28421),u=r(20304),h=r(31821),d=r(15976),f=r(63761),m=r(66211);function p(e,t){if(!(0,n._o)(t.output))return;e.fragment.include(s.C);const{emissionSource:r,hasEmissiveTextureTransform:p,bindType:g,useFloatBlend:v}=t,_=3===r||4===r||5===r;_&&(e.include(o.r,t),e.fragment.uniforms.add(1===g?new f.N("texEmission",e=>e.textureEmissive):new d.o("texEmission",e=>e.textureEmissive)));const x=2===r||_;x&&e.fragment.uniforms.add(1===g?new c.t("emissiveBaseColor",e=>e.emissiveBaseColor):new a.W("emissiveBaseColor",e=>e.emissiveBaseColor));const y=0!==r;if(y&&7!==r&&6!==r&&4!==r&&5!==r){const t=e=>null!=e?v?e:(0,i.qE)(e,0,m.m):0;e.fragment.uniforms.add(1===g?new u.m("emissiveStrength",e=>t(e.emissiveStrength)):new l.J("emissiveStrength",e=>t(e.emissiveStrength)))}const w=7===r,b=5===r,T=1===r||6===r||w;e.fragment.code.add(h.H`
474
+ calculateOcclusionAndOutputHighlight();`)}}},22911(e,t,r){r.d(t,{NL:()=>m});var i=r(34727),n=r(49255),o=r(99208),s=r(65261),a=r(40710),c=r(33079),l=r(28421),u=r(20304),h=r(31821),d=r(15976),f=r(63761),p=r(66211);function m(e,t){if(!(0,n._o)(t.output))return;e.fragment.include(s.C);const{emissionSource:r,hasEmissiveTextureTransform:m,bindType:g,useFloatBlend:v}=t,_=3===r||4===r||5===r;_&&(e.include(o.r,t),e.fragment.uniforms.add(1===g?new f.N("texEmission",e=>e.textureEmissive):new d.o("texEmission",e=>e.textureEmissive)));const x=2===r||_;x&&e.fragment.uniforms.add(1===g?new c.t("emissiveBaseColor",e=>e.emissiveBaseColor):new a.W("emissiveBaseColor",e=>e.emissiveBaseColor));const w=0!==r;if(w&&7!==r&&6!==r&&4!==r&&5!==r){const t=e=>null!=e?v?e:(0,i.qE)(e,0,p.m):0;e.fragment.uniforms.add(1===g?new u.m("emissiveStrength",e=>t(e.emissiveStrength)):new l.J("emissiveStrength",e=>t(e.emissiveStrength)))}const y=7===r,b=5===r,T=1===r||6===r||y;e.fragment.code.add(h.H`
475
475
  vec4 getEmissions(vec3 symbolColor) {
476
- vec4 emissions = ${x?b?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":T?w?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
477
- ${(0,h.If)(_,`${(0,h.If)(b,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)}
478
- ${(0,h.If)(y,`emissions.rgb *= emissiveStrength * ${h.H.float(1)};`)}
476
+ vec4 emissions = ${x?b?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":T?y?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
477
+ ${(0,h.If)(_,`${(0,h.If)(b,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${m?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${m?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)}
478
+ ${(0,h.If)(w,`emissions.rgb *= emissiveStrength * ${h.H.float(1)};`)}
479
479
  return emissions;
480
480
  }
481
481
  `)}},42593(e,t,r){r.d(t,{Q:()=>u});var i=r(31821);function n(e){const{fragment:t}=e;t.code.add(i.H`uint readChannelBits(uint channel, int highlightLevel) {
@@ -534,7 +534,7 @@ ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
534
534
  return texelFetch(depthTexture, iuv, 0).r;
535
535
  }`),e.code.add(s.H`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
536
536
  return linearizeDepth(depthFromTexture(depthTexture, uv));
537
- }`)}const c=(0,n.vt)()},77695(e,t,r){r.d(t,{J:()=>d});var i=r(29242),n=r(48163),o=r(99208),s=r(68259),a=r(47286),c=r(31821),l=r(35644),u=r(15976),h=r(63761);function d(e,t){return function(e,t){const r=e.fragment,{hasVertexTangents:d,doubleSidedMode:f,hasNormalTexture:m,textureCoordinateType:p,bindType:g,hasNormalTextureTransform:v}=t;d?(e.attributes.add("tangent","vec4"),e.varyings.add("vTangent","vec4"),2===f?r.code.add(c.H`mat3 computeTangentSpace(vec3 normal) {
537
+ }`)}const c=(0,n.vt)()},77695(e,t,r){r.d(t,{J:()=>d});var i=r(29242),n=r(48163),o=r(99208),s=r(68259),a=r(47286),c=r(31821),l=r(35644),u=r(15976),h=r(63761);function d(e,t){return function(e,t){const r=e.fragment,{hasVertexTangents:d,doubleSidedMode:f,hasNormalTexture:p,textureCoordinateType:m,bindType:g,hasNormalTextureTransform:v}=t;d?(e.attributes.add("tangent","vec4"),e.varyings.add("vTangent","vec4"),2===f?r.code.add(c.H`mat3 computeTangentSpace(vec3 normal) {
538
538
  float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
539
539
  vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
540
540
  vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
@@ -555,19 +555,19 @@ T = T - normal * dot(normal, T);
555
555
  T *= inversesqrt(max(dot(T,T), 1.e-10));
556
556
  vec3 B = sign(det) * cross(normal, T);
557
557
  return mat3(T, B, normal);
558
- }`),m&&0!==p&&(e.include(o.r,t),r.uniforms.add(1===g?new h.N("normalTexture",e=>e.textureNormal):new u.o("normalTexture",e=>e.textureNormal)),v&&(r.uniforms.add(1===g?new a.G("scale",e=>e.scale??n.Un):new s.t("scale",e=>e.scale??n.Un)),r.uniforms.add(new l.k("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix??i.zK))),r.code.add(c.H`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
558
+ }`),p&&0!==m&&(e.include(o.r,t),r.uniforms.add(1===g?new h.N("normalTexture",e=>e.textureNormal):new u.o("normalTexture",e=>e.textureNormal)),v&&(r.uniforms.add(1===g?new a.G("scale",e=>e.scale??n.Un):new s.t("scale",e=>e.scale??n.Un)),r.uniforms.add(new l.k("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix??i.zK))),r.code.add(c.H`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
559
559
  vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),v&&r.code.add(c.H`mat3 normalRotation = mat3(normalTextureTransformMatrix[0][0]/scale[0], normalTextureTransformMatrix[0][1]/scale[1], 0.0,
560
560
  normalTextureTransformMatrix[1][0]/scale[0], normalTextureTransformMatrix[1][1]/scale[1], 0.0,
561
561
  0.0, 0.0, 0.0 );
562
562
  rawNormal.xy = (normalRotation * vec3(rawNormal.x, rawNormal.y, 1.0)).xy;`),r.code.add(c.H`return tangentSpace * rawNormal;
563
- }`))}(e,t)}},43730(e,t,r){r.d(t,{n:()=>Ht});var i=r(31821),n=r(12791),o=r(5482),s=r(34727),a=r(97768),c=r(36708),l=r(78659),u=r(91429),h=r(37585),d=r(69540);let f=class extends d.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"columns",void 0),f=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],f);const m=f;var p=r(69052),g=r(25482),v=r(56507),_=r(86738),x=r(43937),y=r(36005);let w=class extends((0,d.OU)(g.o)){constructor(...e){super(...e),this.position=new _.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new m}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){const n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){const n=e.clone();n.x=(0,v.GB)(e.x||0),n.y=(0,v.GB)(e.y||0),n.z=e.hasZ?(0,v.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){const r=new _.A;return r.read(e,t),r.x=(0,v.GB)(r.x||0),r.y=(0,v.GB)(r.y||0),r.z=r.hasZ?(0,v.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:_.A,json:{write:{isRequired:!0}}})],w.prototype,"position",void 0),(0,o.Cg)([(0,x.K)("position")],w.prototype,"writePosition",null),(0,o.Cg)([(0,y.w)("position")],w.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>p.ie.normalize((0,v.GB)(e)))],w.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e),-180,180))],w.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e,55),1,170))],w.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:m,nonNullable:!0,json:{read:!1,write:!1}})],w.prototype,"layout",void 0),w=(0,o.Cg)([(0,u.$K)("esri.Camera")],w);var b=r(9093),T=r(35522),M=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),E=r(27993),A=r(73941),R=(r(19419),r(71351)),I=r(69622),O=r(53966),F=r(90629),N=r(58083),D=r(48163),P=r(78955),B=r(91829),H=r(82919),L=r(44280);function z(e,t,r){e.worldUpAtPosition(t,U),(0,T.Re)(G,r,t);const i=(0,T.Bw)(G);return 0===i?0:(0,s.XM)((0,T.Om)(G,U)/i)}const U=(0,M.vt)(),G=(0,M.vt)();var V;let j=V=class extends I.A{constructor(e){super(e),this._ray=(0,R.vt)(),this._viewport=(0,B.fA)(0,0,1,1),this._padding=(0,B.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,D.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,b.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,b.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,b.vt)(),this._frustumDirty=!0,this._frustum=(0,H.vt)(),this._fullViewport=(0,B.vt)(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,M.vt)(),this._up=(0,M.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin)}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,T.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,N.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const e=(0,P.hs)((0,B.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,P.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;const e=(0,P.hs)((0,B.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,P.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,P.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,P.C)(this._padding,e),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&((0,N.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,N.B8)((0,b.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,b.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,T.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,N.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,N.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){const{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,s=-i/2+this.column*o,a=s+o,c=-r/2+this.row*n,l=c+n,u=(0,N.$h)((0,b.vt)(),s*(1+2*this._padding[3]/e),a*(1+2*this._padding[1]/e),c*(1+2*this._padding[2]/t),l*(1+2*this._padding[0]/t),this.near,this.far),h=this._get("projectionMatrix");return h&&(0,N.aI)(h,u)?h:u}copyFrom(e){(0,T.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,P.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,P.C)(this._padding,e.padding),this.notifyChange("_padding"),(0,h.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;const t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,N.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||((0,H.C)(this._frustum,e.frustum),this._frustumDirty=!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,N.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),(0,P.C)(this._fullViewport,e.fullViewport),this.pixelRatio=e.pixelRatio,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new V).copyFrom(this)}equals(e){return(0,T.t2)(this.eye,e.eye)&&(0,T.t2)(this.center,e.center)&&(0,T.t2)(this.up,e.up)&&(0,P.t2)(this._viewport,e.viewport)&&(0,P.t2)(this._padding,e.padding)&&(0,h.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}almostEquals(e){const t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,P.hG)(e.screenPadding,this.screenPadding)>=t||(0,P.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,T.jb)($,e.eye,e.center),(0,T.jb)(Z,this.eye,this.center);const r=(0,T.Om)($,Z),i=(0,T.uE)($),n=(0,T.uE)(Z),o=5e-4;return r*r>=(1-1e-10)*i*n&&(0,T.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDist(e){return e*this.perRenderPixelRatio}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,L.gr)(this.viewForward,(0,T.Re)($,e,this.eye)))}computeScreenPixelSizeAtDist(e){return e*this.perScreenPixelRatio}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){const t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==k&&(0,T.C)(k,e),k[3]=1,(0,P.Z0)(k,k,this.projectionMatrix);const r=Math.abs(k[3]);(0,T.hs)(k,k,1/r);const i=this.fullViewport;t[0]=(0,s.Cc)(0,i[0]+i[2],.5+.5*k[0]),t[1]=(0,s.Cc)(0,i[1]+i[3],.5+.5*k[1]),t[2]=.5*(k[2]+1),t[3]=r}unapplyProjection(e,t){const r=this.fullViewport;k[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],k[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],k[2]=(2*e[2]-1)*e[3],k[3]=e[3],null!=this.inverseProjectionMatrix&&((0,P.Z0)(k,k,this.inverseProjectionMatrix),t[0]=k[0],t[1]=k[1],t[2]=k[2])}projectToScreen(e,t){return this.projectToRenderScreen(e,q),this.renderToScreen(q,t),t}projectToRenderScreen(e,t){if(k[0]=e[0],k[1]=e[1],k[2]=e[2],k[3]=1,(0,P.Z0)(k,k,this.viewProjectionMatrix),0===k[3])return null;const r=k;(0,T.hs)(r,r,1/Math.abs(k[3]));const i=this.fullViewport,n=(0,s.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,s.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,q),t)}unprojectFromRenderScreen(e,t){if((0,N.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,N.B8)(W,W))return null;const r=this.fullViewport;return k[0]=2*(e[0]-r[0])/r[2]-1,k[1]=2*(e[1]-r[1])/r[3]-1,k[2]=2*e[2]-1,k[3]=1,(0,P.Z0)(k,k,W),0===k[3]?null:(t[0]=k[0]/k[3],t[1]=k[1]/k[3],t[2]=k[2]/k[3],t)}constrainWindowSize(e,t,r,i){const n=e*this.pixelRatio,o=t*this.pixelRatio,s=Math.max(n-r/2,0),a=Math.max(this.fullHeight-o-i/2,0),c=-Math.min(n-r/2,0),l=-Math.min(this.fullHeight-o-i/2,0),u=r-c- -Math.min(this.fullWidth-n-r/2,0),h=i-l- -Math.min(o-i/2,0);return[Math.round(s),Math.round(a),Math.round(u),Math.round(h)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){const r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){const r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){const{center:r,eye:i,distance:n,fovY:o}=this,s=Math.abs(Math.PI/2-z(t,r,i));return e.frustumCoverage(s,n,o)}_computeUpGlobal(){(0,T.Re)($,this.center,this.eye);const e=(0,T.Bw)(this.center);e<1?(0,T.t2)(this._up,M.Cb)&&((0,T.C)(this._up,M.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,T.Om)($,this.center))>.9999*(0,T.Bw)($)*e||((0,T.$A)(Z,$,this.center),(0,T.$A)(Z,Z,$),(0,T.S8)(Z,Z),(0,T.t2)(this._up,Z)||((0,T.C)(this._up,Z),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,T.oW)($,this.eye,this.center),Math.abs($[2])<=.9999&&((0,T.hs)($,$,$[2]),(0,T.hZ)($,-$[0],-$[1],1-$[2]),(0,T.S8)($,$),(0,T.t2)(this._up,$)||((0,T.C)(this._up,$),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r=""){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,T.t2)(e,t)||((0,T.C)(t,e),this._markViewDirty(),r.length&&this.notifyChange(r)):O.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&((0,H.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&((0,N.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"relativeElevation",void 0),j=V=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],j);const k=(0,B.vt)(),W=(0,b.vt)(),$=(0,M.vt)(),Z=(0,M.vt)(),q=(0,F.r_)();r(49718),r(6867),r(16396),(0,M.vt)(),(0,M.vt)(),(0,M.vt)();var Y=r(5443),X=r(39829),J=r(95108);function K(e,t,r,i){const n=function(e,t){const r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=0===r?1:0;return(e,t,s)=>{if(t[r]<i&&s[r]<i)return 1===n?0:1;if(t[r]>i&&s[r]>i)return 1===n?1:0;const a=(s[o]-t[o])/(s[r]-t[r]),c=t[o]+a*(i-t[r]);return e[r]=i,e[o]=c,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(ee,t[0],t[0])&&Q(e,t[0]);for(let r=0;r<t.length;r++){const i=t[r===t.length-1?0:r+1];switch(n(ee,t[r],i)){case 1:Q(e,i);break;case 3:Q(e,(0,D.o8)(ee));break;case 2:Q(e,(0,D.o8)(ee)),Q(e,i)}}}}function Q(e,t){0!==e.length&&(0,h.aI)(e.at(-1),t)||e.push(t)}const ee=(0,D.vt)();var te=r(11964),re=r(27921);const ie=(0,M.vt)(),ne=(0,M.vt)();function oe(){return{direction:(0,M.vt)(),up:(0,M.vt)()}}function se(e,t,r,i,n){let o=(0,T.S8)(ie,e),a=(0,T.Om)(o,i);const c=a>0;a=Math.abs(a),a>.99&&(a=Math.abs((0,T.Om)(t,i)),a<.99?((0,T.C)(o,t),c&&(0,T.hs)(o,o,-1)):o=null);let l=0;if(o){(0,T.hs)(ne,i,(0,T.Om)(i,o)),(0,T.Re)(o,o,ne);const e=(0,T.Om)(o,n)/((0,T.Bw)(o)*(0,T.Bw)(n));(0,T.$A)(ne,o,n),l=((0,T.Om)(ne,i)>0?1:-1)*(0,s.KJ)((0,s.XM)(e))}const u=(0,s.KJ)((0,s.XM)(-(0,T.Om)(i,e)/(0,T.Bw)(e)));return r?(r.heading=l,r.tilt=u,r):{heading:l,tilt:u}}function ae(e,t,r,i){(0,T.Re)(ce,r,t),(0,re.T7)(i,(0,te.LV)(t,ce),e)||e===r||(0,T.C)(e,r)}const ce=(0,M.vt)(),le=(0,M.fA)(0,1,0),ue=(0,M.fA)(0,0,1),he=(0,b.vt)(),de=(0,M.vt)(),fe=(0,M.vt)();function me(e,t,r,i=oe()){const{direction:n,up:o}=i;return(0,N.N9)(he,-(0,s.kU)(t)),(0,N.eL)(he,he,(0,s.kU)(r)),(0,T.Z0)(n,ue,he),(0,T.hs)(n,n,-1),(0,T.Z0)(o,le,he),i}function pe(e,t,r,i,n){const o=t.lines[11].direction,s=(n-r.getAltitude(i))/o[2];(0,T.Ln)(e,i,o,s)}const ge=(0,M.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return se(t,r,i,ue,le)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n=me(0,r,i),o=(0,M.vt)();return(0,T.hs)(o,n.direction,-t),(0,T.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,s.kU)(e)},headingTiltToDirectionUp:me,lookAtTiltToEyeTilt:function(e){return(0,s.KJ)(e)},toArea:function(e,t){const r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,s=e.state.camera.eye,a=[],c=r.planes[5];for(let e=0;e<4;e++){const t=r.lines[e];i.intersectInfiniteManifold((0,R.LV)(t.origin,t.direction),n,ge)||pe(ge,r,i,t.endpoint,n),ae(ge,s,ge,c),a.push((0,D.fA)(ge[0],ge[1]))}return function(e,t,r){const i=e.map(e=>((0,T.hZ)(ge,e[0],e[1],0),t.fromRenderCoords(ge,ge,r),[ge[0],ge[1]]));return i.length<=2?new X.A({spatialReference:r}):(i.push(i[0].slice()),(0,J.$3)(i)||i.reverse(),new X.A({rings:[i],spatialReference:r}))}(function(e,t){const r=[],i=[];return K(r,e,t,0),K(i,r,t,1),K(r,i,t,2),K(i,r,t,3),i}(a,i.extent),i,o)},toExtent:function(e,t,r,i,n){const o=e.renderSpatialReference,s=e.spatialReference??t.spatialReference;return(0,C.g)(t,de,o),(0,C.g)(t,fe,o),de[0]-=r/2,fe[0]+=r/2,de[1]-=i/2,fe[1]+=i/2,(0,E.F)(de,o,de,s),(0,E.F)(fe,o,fe,s),n?(n.xmin=de[0],n.ymin=de[1],n.xmax=fe[0],n.ymax=fe[1],n.spatialReference=s):n=new Y.A(de[0],de[1],fe[0],fe[1],s),n}},Symbol.toStringTag,{value:"Module"}));var ve=r(34304),_e=r(17136),xe=r(94008),ye=r(28735);class we{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,H.vt)(),this._points=(0,H.Qy)(),this.lines=new Array(12),this._origin=(0,M.vt)(),this._direction=(0,M.vt)(),this._boundingSphere=new xe.iy,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,M.vt)(),endpoint:null}}update(e){(0,H.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,T.C)(this._origin,e.eye),(0,T.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(e){for(let t=0;t<this._points.length;t++)(0,T.C)(this._points[t],e[t]);(0,H.DV)(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(e){return(0,H.m7)(this.frustum,e)}intersectsRay(e){return(0,H.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,H.ST)(this.frustum,e,t)}intersectsPoint(e){return(0,H.bU)(this.frustum,e)}_updateLines(){const e=this._points;for(let t=0;t<4;t++){const r=t+4;be(this.lines[t],e[t],e[r]),be(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),be(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){const{origin:e}=this,t=Me;(0,T.S8)(t,this.direction);const r=Te;(0,T.jb)(r,this.points[4],e);const i=.5*(0,T.Om)(r,r)/(0,T.Om)(t,r),n=this._boundingSphere,o=(0,T.Ln)(Se,e,t,i);n.center=o,n.radius=i}static{this.planePointIndices=H.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function be(e,t,r){e.origin=t,e.endpoint=r,(0,T.oW)(e.direction,t,r)}const Te=(0,M.vt)(),Me=(0,M.vt)(),Se=(0,M.vt)();r(86211);const Ce=(0,M.fA)(5802e-9,13558e-9,331e-7),Ee=(0,M.fA)(65e-8*3,5643e-9,255e-9);(0,M.fA)(Ce[0]+Ee[0],Ce[1]+Ee[1],Ce[2]+Ee[2]);class Ae{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ae(0,0)}static{this.Infinite=new Ae}}(0,M.vt)(),(0,M.vt)(),new xe.iy,(0,R.vt)(),new Y.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Re=r(32728);const Ie=(0,M.fA)(0,0,1),Oe=(0,T.S8)((0,M.vt)(),(0,M.fA)(1,1,1)),Fe=(0,b.vt)(),Ne=(0,M.vt)(),De=(0,M.vt)();function Pe(e,t,r,i=oe()){(0,T.$A)(Ne,e,Ie),0===(0,T.Om)(Ne,Ne)&&(0,T.$A)(Ne,e,Oe),(0,N.$0)(Fe,-(0,s.kU)(t),e),(0,N.e$)(Fe,Fe,-(0,s.kU)(r),Ne);const{up:n,direction:o}=i;return(0,T.$A)(n,Ne,e),(0,T.S8)(n,n),(0,T.Z0)(n,n,Fe),(0,T.S8)(o,e),(0,T.ze)(o,o),(0,T.Z0)(o,o,Fe),i}function Be(e){const t=e[1];e[1]=-e[2],e[2]=t}function He(e,t){const r=Pe(t,e.heading,e.tilt);return e.up=r.up,e}function Le(e,t){const r=[],i=[],n=(0,ve.FD)();for(let o=0;o<e.length;o++){const s=e[o],a=o===e.length-1?e[0]:e[o+1],c=(0,te.Cr)(s,a,$e),l=(0,re.vE)(t,c.origin,c.vector,0,ke);switch(l){case 2:r.push(s);break;case 3:i.push(s);break;case 0:case 1:{const[e,o,a]=0===l?[1,r,i]:[-1,i,r],c=(0,re.Qj)(t),u=(0,T.Ln)((0,M.vt)(),ke,c,e*n),h=(0,T.Ln)((0,M.vt)(),ke,c,e*-n);o.push(s),o.push(u),a.push(h)}}}const o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const ze={minCurvature:(0,s.kU)(5),maxCurvature:(0,s.kU)(50),minSamples:1,maxSamples:6},Ue=(0,M.fA)(1,0,0),Ge=(0,M.fA)(0,1,0),Ve=(0,M.vt)(),je=(0,M.vt)(),ke=(0,M.vt)(),We=new xe.iy,$e=(0,te.vt)(),Ze=(0,B.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){const n=Ne,o=De;return(0,T.S8)(n,e),(0,T.$A)(De,n,Ie),0===(0,T.Om)(De,De)&&(0,T.$A)(De,n,Oe),(0,T.$A)(o,De,n),se(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n={eye:(0,M.vt)(),up:null,tilt:i,heading:r},o=Ne;o[0]=e[0],o[1]=e[2],o[2]=-e[1];const a=t,c=(0,s.kU)(r),l=(0,s.kU)(i),u=Math.sin(c),h=Math.cos(c),d=Math.sin(l),f=Math.cos(l),m=(0,T.Bw)(o);let p;if(Math.abs(l)<1e-8)p=a+m;else{const e=m/d,t=(0,s.YN)(a/e),r=Math.PI-l-t;p=e*Math.sin(r)}const g=f*a,v=a*a*(d*d),_=h*h*v,x=p-g,y=x*x,w=_*(_+y-o[1]*o[1]);if(w<0)return(0,T.hs)(n.eye,o,p/m),n.tilt=0,He(n,e);const b=Math.sqrt(w),S=o[1]*x,C=_+y;let E;if(E=h>0?-b+S:b+S,Math.abs(C)<1e-8)return m<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=a):(0,T.hs)(n.eye,o,p/m),n.tilt=0,Be(n.eye),He(n,e);n.eye[1]=E/C;const A=u*u*v,R=d*a,I=h*R*n.eye[1],O=n.eye[1]*n.eye[1],F=1-O,N=Math.sqrt(F),D=_*O+A-2*I*N*x+F*y;return Math.abs(D)<1e-8?((0,T.hs)(n.eye,o,p/m),n.tilt=0,Be(n.eye),He(n,e)):(n.eye[0]=(F*(p*o[0]-g*o[0])-R*N*(o[0]*n.eye[1]*h+o[2]*u))/D,n.eye[2]=(F*(p*o[2]-g*o[2])-R*N*(o[2]*n.eye[1]*h-o[0]*u))/D,(0,T.hs)(n.eye,n.eye,p),Be(n.eye),He(n,e))},eyeTiltToLookAtTilt:function(e,t,r){const i=(0,s.kU)(e),n=(0,T.Bw)(t);return(0,s.YN)(r/(n/Math.sin(i)))+i},headingTiltToDirectionUp:Pe,lookAtTiltToEyeTilt:function(e,t,r){const i=(0,T.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,s.YN)(r/(n/Math.sin(e)));return(0,s.KJ)(e-o)},toArea:function(e,t){const{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new we(r);i.near=2,n.update(i);const o=r.getAltitude(t),a=e.spatialReference,c=r.referenceEllipsoid.radius,l=i.eye,u=1+(0,T.Io)(l,t)/(c+o),h=Math.sqrt(u*u-1),{minCurvature:d,maxCurvature:f,minSamples:m,maxSamples:p}=ze,g=function(e){const{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return We.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(We,t)}(e),v=(0,s.qE)((h-d)/(f-d),0,1),_=Math.round((0,s.Cc)(m,p,v)),x=i.aboveGround,y=n.planes[5],w=[],b=(0,re.O_)(M.uY,Ue,(0,re.vt)()),S=(0,re.O_)(M.uY,Ge,(0,re.vt)());(0,P.hZ)(Ze,0,0,0,0);const C=e=>{};for(let e=0;e<4;e++){const t=1===e&&!x||3===e&&x?1-g:0,i=1===e&&x||3===e&&!x?g:1,a=n.lines[e],c=n.lines[3===e?0:e+1];for(let n=0;n<_;n++){const u=n/_,h=0===n?0:(0,s.Cc)(t,i,1===e?1-(1-u)**2:3===e?u**2:u),d=(0,T.Cc)(je,a.origin,c.origin,h),f=(0,Re.nu)(a.direction,c.direction,h,Ve);r.intersectManifoldClosestSilhouette((0,R.LV)(d,f),o,ke),ae(ke,l,ke,y),w.push((0,M.o8)(ke)),0!==w.length&&C((0,T.lo)(w.at(-1),ke));const m=((0,re.Tj)(b,ke)?1:0)|((0,re.Tj)(S,ke)?2:0);Ze[m]=1}}w.length>2&&(0,T.lo)(w[0],w.at(-1));const E=function(e,t,r){const i=2*(0,ve.FD)();return e.map(e=>{const n=[];let o=!1;for(const s of e)t.fromRenderCoords(s,ke,r),Math.abs(s[0])<i&&Math.abs(s[1])<i?(n.push([null,ke[1]]),n.push([null,ke[1]]),o=!0):n.push([ke[0],ke[1]]);if(o)for(let e=0;e<n.length;e++){const t=n[e];if(null!=t[0])continue;const r=n[e+1],i=n.at(0===e?-1:e-1);t[0]=i[0],e++;const o=n.at(e===n.length-1?0:e+1);r[0]=o[0]}return n.push(n[0]),(0,J.$3)(n)||n.reverse(),n})}((0,P.m3)(Ze)>1?function(e,t){const r=[];for(const i of e)r.push(...Le(i,t));return r}(Le(w,b),S):[w],r,a);return new X.A({rings:E,spatialReference:a})},toExtent:function(e,t,r,i,n){let o,a,c,l;const u=t.latitude,h=(0,A.tO)(e.spatialReference).radius,d=t.longitude,f=function(e,t,r){const i=t/r,n=(0,s.kU)(e),o=Math.sin(i/2),a=Math.cos(n),c=2*(0,s.YN)(Math.sqrt(o*o/(a*a)));return(0,s.KJ)(c)}(u,r,h)/2;o=d-f,a=d+f;const m=(0,s.kU)(u),g=(1+Math.sin(m))/(1-Math.sin(m)),v=(g+1)*Math.tan(i/h/2),_=v*v;function x(e){const t=Math.PI/2;return(e=p.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(c=1.5*Math.PI-2*Math.atan(.5*(v+Math.sqrt(4*g+_))),l=c+i/h,c=x(c),l=x(l),l<c){const e=l;l=c,c=e}if(c=Math.max((0,s.KJ)(c),-90),l=Math.min((0,s.KJ)(l),90),a=_e.Y_.monotonic(o,a),a-o>180){const e=(a-o-180)/2;o+=e,a-=e}const y=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=c,n.xmax=a,n.ymax=l,n.spatialReference=y):n=new Y.A(o,c,a,l,y),e.spatialReference&&e.spatialReference.isWebMercator&&(0,ye.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const qe="composite-color",Ye=["final-color",qe,"opaque-color","transparent-color"],Xe={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GROUND_DEPTH:"ground-depth",PRE_TRANSPARENT:"pre-transparent",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",TRANSPARENT_ENVIRONMENT:"transparent-environment",VIEWSHED:"viewshed"};Array.from(Object.values(Xe)).concat(Ye),(0,M.vt)();var Je=r(49186),Ke=r(10107),Qe=r(64108),et=r(44208),tt=(r(17676),r(94656)),rt=r(63907);r(93637),r(4576),new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]),new Map,(0,et.A)("esri-tests-disable-gpu-memory-measurements"),(0,tt.en)();(0,tt.en)();var it=r(90644),nt=r(76284),ot=r(48852),st=r(42293);const at=!!(0,et.A)("esri-tests-disable-gpu-memory-measurements");class ct{constructor(e,t){this._context=e,this._descriptor=t,this.type=2,this._context.instanceCounter.increment(rt.vt.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:i,height:n,internalFormat:o,multisampled:s}=t;s?r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n):r.renderbufferStorage(r.RENDERBUFFER,o,i,n),this._context.bindRenderbuffer(null)}get descriptor(){return this._descriptor}get samples(){const e=this._descriptor.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}get usedMemory(){return at?0:(e=this._descriptor).width<=0||e.height<=0||null==e.internalFormat?0:e.width*e.height*(0,st.MW)(e.internalFormat);var e}resize(e,t){const r=this._descriptor;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height),this._context.bindRenderbuffer(null)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(rt.vt.Renderbuffer,this),this._context=null)}}class lt{constructor(e,t,r){if(this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(rt.vt.FramebufferObject,this),null!=t){const r=function(e,t){return ut(t)||ht(t)?t:dt(t)?new nt.A(e,t):function(e){return 3===ft(e)||null!=e&&"samples"in e}(t)?new ct(e,t):null}(e,t);null!=r&&(this._colorAttachments.set(rt.r6,r),ut(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(rt.r6)}if(null!=r)if(function(e){return ut(e)||dt(e)}(r))this._depthStencilTexture=ut(r)?r:new nt.A(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=ht(r)?r:new ct(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}dispose(){const{_colorAttachments:e,_glName:t}=this;if(0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const{_context:r}=this,i=r.getBoundFramebufferObject(),n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(t),this._glName=null,r.bindFramebuffer(i===this?null:i),r.instanceCounter.decrement(rt.vt.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(rt.r6);return ut(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(rt.r6)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(rt.r6)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&ut(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=rt.r6){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=rt.r6){const t=this._colorAttachments.get(e);if(!t)return;const r=ut(t);return this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._initialized){const t=this._context.gl;this._context.temporaryBindFramebufferObject(this,()=>{e.forEach(e=>{ut(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=rt.r6,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,0,r):this._framebufferTexture2D(i.glName,t,e,36160,0))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===rt.ld.UNSIGNED_INT_24_8?6402!==r||i===rt.ld.UNSIGNED_INT||i===rt.ld.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,gt(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,gt(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){const{_context:t}=this,r=t.getBoundFramebufferObject();t.bindFramebuffer(this);const{gl:i}=t,n=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,n,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,n,o,s){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const a=s.descriptor;3553!==s.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==a?.width||null==a?.height||e+r>this.width||t+i>this.height||n+r>a.width||o+i>a.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,l=c.bindTexture(s,nt.A.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(nt.A.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,n,o,e,t,r,i),c.bindTexture(l,nt.A.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,s){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),s||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,s)}async readPixelsAsync(e,t,r,i,n,o,s){const{gl:a}=this._context,c=ot.g.createPixelPack(this._context,35041,s.byteLength);this._context.bindBuffer(c);const l=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),a.readPixels(e,t,r,i,n,o,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(l),await c.getSubDataAsync(s),c.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(mt(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(mt(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),(0,tt.en)())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=t.createFramebuffer();if(t.bindFramebuffer(e,r),this._colorAttachments.forEach((t,r)=>{if(ut(t)){const i=pt(t);35866===i?this._framebufferTextureLayer(t.glName,r,e,0,0):this._framebufferTexture2D(t.glName,r,i,e)}else if(ht(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=gt(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,pt(this._depthStencilTexture),e)}(0,tt.en)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=r,this._initialized=!0}_framebufferTexture2D(e,t=rt.r6,r=3553,i=36160,n=0){this._context.gl.framebufferTexture2D(i,t,r,e,n)}_framebufferTextureLayer(e,t=rt.r6,r=36160,i=0,n=0){this._context.gl.framebufferTextureLayer(r,t,e,i,n)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=(0,a.WD)(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,gt(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=(0,a.WD)(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),mt(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){mt(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case rt.SB.DEPTH_COMPONENT16:case rt.SB.DEPTH_COMPONENT24:case rt.SB.DEPTH_COMPONENT32F:return rt.xL;case rt.iE.DEPTH24_STENCIL8:case rt.iE.DEPTH32F_STENCIL8:return rt.nI;case 36168:return rt.uH;default:return rt.r6}}_validateColorAttachmentPoint(e){if(-1===lt._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;lt._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const t=e-rt.r6;t+1>lt._MAX_COLOR_ATTACHMENTS&&O.A.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${lt._MAX_COLOR_ATTACHMENTS} color attachments`)}}function ut(e){return 1===ft(e)}function ht(e){return 2===ft(e)}function dt(e){return 0===ft(e)}function ft(e){return null!=e&&"type"in e?e.type:null}function mt(e,t){const r=Math.max(e.width,e.height);if(r>t){O.A.getLogger("esri.views.webgl.FramebufferObject").warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function pt(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function gt(e){return 6402===e?rt.xL:rt.nI}var vt=r(67171),_t=(r(21818),r(69397),r(85079)),xt=r(74038);const yt=[new xt._("position",2,rt.pe.UNSIGNED_SHORT,0,4)];new xt._("a_pos",2,rt.pe.BYTE,0,2),new xt._("a_pos",2,rt.pe.BYTE,0,4),new xt._("a_tex",2,rt.pe.BYTE,2,4),(0,_t.Xk)(yt),r(66289);const wt=new Image;wt.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",wt.width=5,wt.height=5,wt.decode();let bt=class extends I.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=qe,this.requireGeometryDepth=!1,this._dirty=!0}initialize(){this.addHandles([(0,c.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},c.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Je.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}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(t),t}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){var t;e.initializeAndBind(),this.gl.drawBuffers((t=e)?t.colorAttachments.length>0?t.colorAttachments:[rt.$0]:[rt.C5])}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0: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.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}};(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],bt.prototype,"view",void 0),(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],bt.prototype,"consumes",void 0),(0,o.Cg)([(0,Ke.MZ)()],bt.prototype,"produces",void 0),(0,o.Cg)([(0,Ke.MZ)({readOnly:!0})],bt.prototype,"techniques",null),bt=(0,o.Cg)([(0,Qe.$)("esri.views.3d.webgl.RenderNode")],bt);const Tt=bt;var Mt=r(15581),St=r(13840),Ct=r(42958),Et=r(95774);let At=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Et.S,()=>r.e(1285).then(r.bind(r,91285)))}initializePipeline(){return(0,it.Ey)({colorWrite:it.kn})}};At=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],At);var Rt=r(65786);class It extends Rt.Y{constructor(){super(...arguments),this.projScale=1}}class Ot extends It{constructor(){super(...arguments),this.intensity=1}}class Ft extends Rt.Y{}class Nt extends Ft{constructor(){super(...arguments),this.blurSize=(0,D.vt)()}}let Dt=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Mt.S,()=>r.e(6122).then(r.bind(r,86122)))}initializePipeline(){return(0,it.Ey)({colorWrite:it.kn})}};Dt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],Dt);let Pt=class extends Tt{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=Xe.AMBIENT_ILLUMINATION,this.isEnabled=()=>!1,this._enableTime=(0,l.l5)(0),this._passParameters=new Ot,this._drawParameters=new Nt}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 vt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new nt.A(this.renderingContext,t,e),this.addHandles((0,c.wB)(()=>this.isEnabled(),()=>this._enableTime=(0,l.l5)(0)))}destroy(){this._passParameters.noiseTexture=(0,a.WD)(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(Dt),this.techniques.precompile(At)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(rt.nI);if(!r||!i)return;const n=this.techniques.getCompiled(Dt),o=this.techniques.getCompiled(At);if(!n||!o)return this._enableTime=(0,l.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,l.l5)(performance.now()));const a=this.renderingContext,c=this.view.qualitySettings.fadeDuration,u=this.bindParameters,d=u.camera,f=d.relativeElevation,m=(0,s.qE)((5e5-f)/2e5,0,1),p=c>0?Math.min(c,performance.now()-this._enableTime)/c:1,g=p*m;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*Bt/(0,Mt.g)(d)**6*g;const v=d.fullViewport[2],_=d.fullViewport[3],x=this.fboCache.acquire(v,_,"ssao input",2);a.bindFramebuffer(x.fbo),a.setViewport(0,0,v,_),a.bindTechnique(n,u,this._passParameters,this._drawParameters),a.screen.draw();const y=Math.round(v/2),w=Math.round(_/2),b=this.fboCache.acquire(y,w,"ssao blur",0);a.bindFramebuffer(b.fbo),this._drawParameters.colorTexture=x.getTexture(),(0,h.hZ)(this._drawParameters.blurSize,0,2/_),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),x.release();const T=this.fboCache.acquire(y,w,Xe.AMBIENT_ILLUMINATION,0);return a.bindFramebuffer(T.fbo),a.setViewport(0,0,v,_),a.setClearColor(1,1,1,0),a.clear(16384),this._drawParameters.colorTexture=b.getTexture(),(0,h.hZ)(this._drawParameters.blurSize,2/v,0),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),a.setViewport4fv(d.fullViewport),b.release(),p<1&&this.requestRender(2),T}};(0,o.Cg)([(0,u.MZ)()],Pt.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],Pt.prototype,"produces",void 0),(0,o.Cg)([(0,u.MZ)({constructOnly:!0})],Pt.prototype,"isEnabled",void 0),Pt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],Pt);const Bt=.5;function Ht(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
563
+ }`))}(e,t)}},43730(e,t,r){r.d(t,{n:()=>Ht});var i=r(31821),n=r(12791),o=r(5482),s=r(34727),a=r(97768),c=r(36708),l=r(78659),u=r(91429),h=r(37585),d=r(69540);let f=class extends d.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"columns",void 0),f=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],f);const p=f;var m=r(69052),g=r(25482),v=r(56507),_=r(86738),x=r(43937),w=r(36005);let y=class extends((0,d.OU)(g.o)){constructor(...e){super(...e),this.position=new _.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new p}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){const n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){const n=e.clone();n.x=(0,v.GB)(e.x||0),n.y=(0,v.GB)(e.y||0),n.z=e.hasZ?(0,v.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){const r=new _.A;return r.read(e,t),r.x=(0,v.GB)(r.x||0),r.y=(0,v.GB)(r.y||0),r.z=r.hasZ?(0,v.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:_.A,json:{write:{isRequired:!0}}})],y.prototype,"position",void 0),(0,o.Cg)([(0,x.K)("position")],y.prototype,"writePosition",null),(0,o.Cg)([(0,w.w)("position")],y.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>m.ie.normalize((0,v.GB)(e)))],y.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e),-180,180))],y.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e,55),1,170))],y.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:p,nonNullable:!0,json:{read:!1,write:!1}})],y.prototype,"layout",void 0),y=(0,o.Cg)([(0,u.$K)("esri.Camera")],y);var b=r(9093),T=r(35522),M=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),E=r(27993),A=r(73941),R=(r(19419),r(71351)),I=r(69622),O=r(53966),F=r(90629),D=r(58083),P=r(48163),N=r(78955),B=r(91829),H=r(82919),L=r(44280);function z(e,t,r){e.worldUpAtPosition(t,U),(0,T.Re)(G,r,t);const i=(0,T.Bw)(G);return 0===i?0:(0,s.XM)((0,T.Om)(G,U)/i)}const U=(0,M.vt)(),G=(0,M.vt)();var V;let j=V=class extends I.A{constructor(e){super(e),this._ray=(0,R.vt)(),this._viewport=(0,B.fA)(0,0,1,1),this._padding=(0,B.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,P.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,b.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,b.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,b.vt)(),this._frustumDirty=!0,this._frustum=(0,H.vt)(),this._fullViewport=(0,B.vt)(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,M.vt)(),this._up=(0,M.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin)}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,T.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,D.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,T.hZ)((0,M.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const e=(0,N.hs)((0,B.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,N.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;const e=(0,N.hs)((0,B.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,N.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,N.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,N.C)(this._padding,e),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&((0,D.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,D.B8)((0,b.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,b.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,T.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,D.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,D.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){const{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,s=-i/2+this.column*o,a=s+o,c=-r/2+this.row*n,l=c+n,u=(0,D.$h)((0,b.vt)(),s*(1+2*this._padding[3]/e),a*(1+2*this._padding[1]/e),c*(1+2*this._padding[2]/t),l*(1+2*this._padding[0]/t),this.near,this.far),h=this._get("projectionMatrix");return h&&(0,D.aI)(h,u)?h:u}copyFrom(e){(0,T.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,N.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,N.C)(this._padding,e.padding),this.notifyChange("_padding"),(0,h.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;const t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,D.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||((0,H.C)(this._frustum,e.frustum),this._frustumDirty=!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,D.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),(0,N.C)(this._fullViewport,e.fullViewport),this.pixelRatio=e.pixelRatio,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new V).copyFrom(this)}equals(e){return(0,T.t2)(this.eye,e.eye)&&(0,T.t2)(this.center,e.center)&&(0,T.t2)(this.up,e.up)&&(0,N.t2)(this._viewport,e.viewport)&&(0,N.t2)(this._padding,e.padding)&&(0,h.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}almostEquals(e){const t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,N.hG)(e.screenPadding,this.screenPadding)>=t||(0,N.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,T.jb)($,e.eye,e.center),(0,T.jb)(Z,this.eye,this.center);const r=(0,T.Om)($,Z),i=(0,T.uE)($),n=(0,T.uE)(Z),o=5e-4;return r*r>=(1-1e-10)*i*n&&(0,T.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDist(e){return e*this.perRenderPixelRatio}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,L.gr)(this.viewForward,(0,T.Re)($,e,this.eye)))}computeScreenPixelSizeAtDist(e){return e*this.perScreenPixelRatio}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){const t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==k&&(0,T.C)(k,e),k[3]=1,(0,N.Z0)(k,k,this.projectionMatrix);const r=Math.abs(k[3]);(0,T.hs)(k,k,1/r);const i=this.fullViewport;t[0]=(0,s.Cc)(0,i[0]+i[2],.5+.5*k[0]),t[1]=(0,s.Cc)(0,i[1]+i[3],.5+.5*k[1]),t[2]=.5*(k[2]+1),t[3]=r}unapplyProjection(e,t){const r=this.fullViewport;k[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],k[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],k[2]=(2*e[2]-1)*e[3],k[3]=e[3],null!=this.inverseProjectionMatrix&&((0,N.Z0)(k,k,this.inverseProjectionMatrix),t[0]=k[0],t[1]=k[1],t[2]=k[2])}projectToScreen(e,t){return this.projectToRenderScreen(e,q),this.renderToScreen(q,t),t}projectToRenderScreen(e,t){if(k[0]=e[0],k[1]=e[1],k[2]=e[2],k[3]=1,(0,N.Z0)(k,k,this.viewProjectionMatrix),0===k[3])return null;const r=k;(0,T.hs)(r,r,1/Math.abs(k[3]));const i=this.fullViewport,n=(0,s.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,s.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,q),t)}unprojectFromRenderScreen(e,t){if((0,D.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,D.B8)(W,W))return null;const r=this.fullViewport;return k[0]=2*(e[0]-r[0])/r[2]-1,k[1]=2*(e[1]-r[1])/r[3]-1,k[2]=2*e[2]-1,k[3]=1,(0,N.Z0)(k,k,W),0===k[3]?null:(t[0]=k[0]/k[3],t[1]=k[1]/k[3],t[2]=k[2]/k[3],t)}constrainWindowSize(e,t,r,i){const n=e*this.pixelRatio,o=t*this.pixelRatio,s=Math.max(n-r/2,0),a=Math.max(this.fullHeight-o-i/2,0),c=-Math.min(n-r/2,0),l=-Math.min(this.fullHeight-o-i/2,0),u=r-c- -Math.min(this.fullWidth-n-r/2,0),h=i-l- -Math.min(o-i/2,0);return[Math.round(s),Math.round(a),Math.round(u),Math.round(h)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){const r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){const r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){const{center:r,eye:i,distance:n,fovY:o}=this,s=Math.abs(Math.PI/2-z(t,r,i));return e.frustumCoverage(s,n,o)}_computeUpGlobal(){(0,T.Re)($,this.center,this.eye);const e=(0,T.Bw)(this.center);e<1?(0,T.t2)(this._up,M.Cb)&&((0,T.C)(this._up,M.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,T.Om)($,this.center))>.9999*(0,T.Bw)($)*e||((0,T.$A)(Z,$,this.center),(0,T.$A)(Z,Z,$),(0,T.S8)(Z,Z),(0,T.t2)(this._up,Z)||((0,T.C)(this._up,Z),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,T.oW)($,this.eye,this.center),Math.abs($[2])<=.9999&&((0,T.hs)($,$,$[2]),(0,T.hZ)($,-$[0],-$[1],1-$[2]),(0,T.S8)($,$),(0,T.t2)(this._up,$)||((0,T.C)(this._up,$),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r=""){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,T.t2)(e,t)||((0,T.C)(t,e),this._markViewDirty(),r.length&&this.notifyChange(r)):O.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&((0,H.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&((0,D.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],j.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],j.prototype,"relativeElevation",void 0),j=V=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],j);const k=(0,B.vt)(),W=(0,b.vt)(),$=(0,M.vt)(),Z=(0,M.vt)(),q=(0,F.r_)();r(49718),r(6867),r(16396),(0,M.vt)(),(0,M.vt)(),(0,M.vt)();var Y=r(5443),X=r(39829),K=r(95108);function J(e,t,r,i){const n=function(e,t){const r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=0===r?1:0;return(e,t,s)=>{if(t[r]<i&&s[r]<i)return 1===n?0:1;if(t[r]>i&&s[r]>i)return 1===n?1:0;const a=(s[o]-t[o])/(s[r]-t[r]),c=t[o]+a*(i-t[r]);return e[r]=i,e[o]=c,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(ee,t[0],t[0])&&Q(e,t[0]);for(let r=0;r<t.length;r++){const i=t[r===t.length-1?0:r+1];switch(n(ee,t[r],i)){case 1:Q(e,i);break;case 3:Q(e,(0,P.o8)(ee));break;case 2:Q(e,(0,P.o8)(ee)),Q(e,i)}}}}function Q(e,t){0!==e.length&&(0,h.aI)(e.at(-1),t)||e.push(t)}const ee=(0,P.vt)();var te=r(11964),re=r(27921);const ie=(0,M.vt)(),ne=(0,M.vt)();function oe(){return{direction:(0,M.vt)(),up:(0,M.vt)()}}function se(e,t,r,i,n){let o=(0,T.S8)(ie,e),a=(0,T.Om)(o,i);const c=a>0;a=Math.abs(a),a>.99&&(a=Math.abs((0,T.Om)(t,i)),a<.99?((0,T.C)(o,t),c&&(0,T.hs)(o,o,-1)):o=null);let l=0;if(o){(0,T.hs)(ne,i,(0,T.Om)(i,o)),(0,T.Re)(o,o,ne);const e=(0,T.Om)(o,n)/((0,T.Bw)(o)*(0,T.Bw)(n));(0,T.$A)(ne,o,n),l=((0,T.Om)(ne,i)>0?1:-1)*(0,s.KJ)((0,s.XM)(e))}const u=(0,s.KJ)((0,s.XM)(-(0,T.Om)(i,e)/(0,T.Bw)(e)));return r?(r.heading=l,r.tilt=u,r):{heading:l,tilt:u}}function ae(e,t,r,i){(0,T.Re)(ce,r,t),(0,re.T7)(i,(0,te.LV)(t,ce),e)||e===r||(0,T.C)(e,r)}const ce=(0,M.vt)(),le=(0,M.fA)(0,1,0),ue=(0,M.fA)(0,0,1),he=(0,b.vt)(),de=(0,M.vt)(),fe=(0,M.vt)();function pe(e,t,r,i=oe()){const{direction:n,up:o}=i;return(0,D.N9)(he,-(0,s.kU)(t)),(0,D.eL)(he,he,(0,s.kU)(r)),(0,T.Z0)(n,ue,he),(0,T.hs)(n,n,-1),(0,T.Z0)(o,le,he),i}function me(e,t,r,i,n){const o=t.lines[11].direction,s=(n-r.getAltitude(i))/o[2];(0,T.Ln)(e,i,o,s)}const ge=(0,M.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return se(t,r,i,ue,le)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n=pe(0,r,i),o=(0,M.vt)();return(0,T.hs)(o,n.direction,-t),(0,T.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,s.kU)(e)},headingTiltToDirectionUp:pe,lookAtTiltToEyeTilt:function(e){return(0,s.KJ)(e)},toArea:function(e,t){const r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,s=e.state.camera.eye,a=[],c=r.planes[5];for(let e=0;e<4;e++){const t=r.lines[e];i.intersectInfiniteManifold((0,R.LV)(t.origin,t.direction),n,ge)||me(ge,r,i,t.endpoint,n),ae(ge,s,ge,c),a.push((0,P.fA)(ge[0],ge[1]))}return function(e,t,r){const i=e.map(e=>((0,T.hZ)(ge,e[0],e[1],0),t.fromRenderCoords(ge,ge,r),[ge[0],ge[1]]));return i.length<=2?new X.A({spatialReference:r}):(i.push(i[0].slice()),(0,K.$3)(i)||i.reverse(),new X.A({rings:[i],spatialReference:r}))}(function(e,t){const r=[],i=[];return J(r,e,t,0),J(i,r,t,1),J(r,i,t,2),J(i,r,t,3),i}(a,i.extent),i,o)},toExtent:function(e,t,r,i,n){const o=e.renderSpatialReference,s=e.spatialReference??t.spatialReference;return(0,C.g)(t,de,o),(0,C.g)(t,fe,o),de[0]-=r/2,fe[0]+=r/2,de[1]-=i/2,fe[1]+=i/2,(0,E.F)(de,o,de,s),(0,E.F)(fe,o,fe,s),n?(n.xmin=de[0],n.ymin=de[1],n.xmax=fe[0],n.ymax=fe[1],n.spatialReference=s):n=new Y.A(de[0],de[1],fe[0],fe[1],s),n}},Symbol.toStringTag,{value:"Module"}));var ve=r(34304),_e=r(17136),xe=r(94008),we=r(28735);class ye{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,H.vt)(),this._points=(0,H.Qy)(),this.lines=new Array(12),this._origin=(0,M.vt)(),this._direction=(0,M.vt)(),this._boundingSphere=new xe.iy,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,M.vt)(),endpoint:null}}update(e){(0,H.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,T.C)(this._origin,e.eye),(0,T.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(e){for(let t=0;t<this._points.length;t++)(0,T.C)(this._points[t],e[t]);(0,H.DV)(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(e){return(0,H.m7)(this.frustum,e)}intersectsRay(e){return(0,H.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,H.ST)(this.frustum,e,t)}intersectsPoint(e){return(0,H.bU)(this.frustum,e)}_updateLines(){const e=this._points;for(let t=0;t<4;t++){const r=t+4;be(this.lines[t],e[t],e[r]),be(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),be(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){const{origin:e}=this,t=Me;(0,T.S8)(t,this.direction);const r=Te;(0,T.jb)(r,this.points[4],e);const i=.5*(0,T.Om)(r,r)/(0,T.Om)(t,r),n=this._boundingSphere,o=(0,T.Ln)(Se,e,t,i);n.center=o,n.radius=i}static{this.planePointIndices=H.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function be(e,t,r){e.origin=t,e.endpoint=r,(0,T.oW)(e.direction,t,r)}const Te=(0,M.vt)(),Me=(0,M.vt)(),Se=(0,M.vt)();r(86211);const Ce=(0,M.fA)(5802e-9,13558e-9,331e-7),Ee=(0,M.fA)(65e-8*3,5643e-9,255e-9);(0,M.fA)(Ce[0]+Ee[0],Ce[1]+Ee[1],Ce[2]+Ee[2]);class Ae{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ae(0,0)}static{this.Infinite=new Ae}}(0,M.vt)(),(0,M.vt)(),new xe.iy,(0,R.vt)(),new Y.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Re=r(32728);const Ie=(0,M.fA)(0,0,1),Oe=(0,T.S8)((0,M.vt)(),(0,M.fA)(1,1,1)),Fe=(0,b.vt)(),De=(0,M.vt)(),Pe=(0,M.vt)();function Ne(e,t,r,i=oe()){(0,T.$A)(De,e,Ie),0===(0,T.Om)(De,De)&&(0,T.$A)(De,e,Oe),(0,D.$0)(Fe,-(0,s.kU)(t),e),(0,D.e$)(Fe,Fe,-(0,s.kU)(r),De);const{up:n,direction:o}=i;return(0,T.$A)(n,De,e),(0,T.S8)(n,n),(0,T.Z0)(n,n,Fe),(0,T.S8)(o,e),(0,T.ze)(o,o),(0,T.Z0)(o,o,Fe),i}function Be(e){const t=e[1];e[1]=-e[2],e[2]=t}function He(e,t){const r=Ne(t,e.heading,e.tilt);return e.up=r.up,e}function Le(e,t){const r=[],i=[],n=(0,ve.FD)();for(let o=0;o<e.length;o++){const s=e[o],a=o===e.length-1?e[0]:e[o+1],c=(0,te.Cr)(s,a,$e),l=(0,re.vE)(t,c.origin,c.vector,0,ke);switch(l){case 2:r.push(s);break;case 3:i.push(s);break;case 0:case 1:{const[e,o,a]=0===l?[1,r,i]:[-1,i,r],c=(0,re.Qj)(t),u=(0,T.Ln)((0,M.vt)(),ke,c,e*n),h=(0,T.Ln)((0,M.vt)(),ke,c,e*-n);o.push(s),o.push(u),a.push(h)}}}const o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const ze={minCurvature:(0,s.kU)(5),maxCurvature:(0,s.kU)(50),minSamples:1,maxSamples:6},Ue=(0,M.fA)(1,0,0),Ge=(0,M.fA)(0,1,0),Ve=(0,M.vt)(),je=(0,M.vt)(),ke=(0,M.vt)(),We=new xe.iy,$e=(0,te.vt)(),Ze=(0,B.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){const n=De,o=Pe;return(0,T.S8)(n,e),(0,T.$A)(Pe,n,Ie),0===(0,T.Om)(Pe,Pe)&&(0,T.$A)(Pe,n,Oe),(0,T.$A)(o,Pe,n),se(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n={eye:(0,M.vt)(),up:null,tilt:i,heading:r},o=De;o[0]=e[0],o[1]=e[2],o[2]=-e[1];const a=t,c=(0,s.kU)(r),l=(0,s.kU)(i),u=Math.sin(c),h=Math.cos(c),d=Math.sin(l),f=Math.cos(l),p=(0,T.Bw)(o);let m;if(Math.abs(l)<1e-8)m=a+p;else{const e=p/d,t=(0,s.YN)(a/e),r=Math.PI-l-t;m=e*Math.sin(r)}const g=f*a,v=a*a*(d*d),_=h*h*v,x=m-g,w=x*x,y=_*(_+w-o[1]*o[1]);if(y<0)return(0,T.hs)(n.eye,o,m/p),n.tilt=0,He(n,e);const b=Math.sqrt(y),S=o[1]*x,C=_+w;let E;if(E=h>0?-b+S:b+S,Math.abs(C)<1e-8)return p<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=a):(0,T.hs)(n.eye,o,m/p),n.tilt=0,Be(n.eye),He(n,e);n.eye[1]=E/C;const A=u*u*v,R=d*a,I=h*R*n.eye[1],O=n.eye[1]*n.eye[1],F=1-O,D=Math.sqrt(F),P=_*O+A-2*I*D*x+F*w;return Math.abs(P)<1e-8?((0,T.hs)(n.eye,o,m/p),n.tilt=0,Be(n.eye),He(n,e)):(n.eye[0]=(F*(m*o[0]-g*o[0])-R*D*(o[0]*n.eye[1]*h+o[2]*u))/P,n.eye[2]=(F*(m*o[2]-g*o[2])-R*D*(o[2]*n.eye[1]*h-o[0]*u))/P,(0,T.hs)(n.eye,n.eye,m),Be(n.eye),He(n,e))},eyeTiltToLookAtTilt:function(e,t,r){const i=(0,s.kU)(e),n=(0,T.Bw)(t);return(0,s.YN)(r/(n/Math.sin(i)))+i},headingTiltToDirectionUp:Ne,lookAtTiltToEyeTilt:function(e,t,r){const i=(0,T.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,s.YN)(r/(n/Math.sin(e)));return(0,s.KJ)(e-o)},toArea:function(e,t){const{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new ye(r);i.near=2,n.update(i);const o=r.getAltitude(t),a=e.spatialReference,c=r.referenceEllipsoid.radius,l=i.eye,u=1+(0,T.Io)(l,t)/(c+o),h=Math.sqrt(u*u-1),{minCurvature:d,maxCurvature:f,minSamples:p,maxSamples:m}=ze,g=function(e){const{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return We.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(We,t)}(e),v=(0,s.qE)((h-d)/(f-d),0,1),_=Math.round((0,s.Cc)(p,m,v)),x=i.aboveGround,w=n.planes[5],y=[],b=(0,re.O_)(M.uY,Ue,(0,re.vt)()),S=(0,re.O_)(M.uY,Ge,(0,re.vt)());(0,N.hZ)(Ze,0,0,0,0);const C=e=>{};for(let e=0;e<4;e++){const t=1===e&&!x||3===e&&x?1-g:0,i=1===e&&x||3===e&&!x?g:1,a=n.lines[e],c=n.lines[3===e?0:e+1];for(let n=0;n<_;n++){const u=n/_,h=0===n?0:(0,s.Cc)(t,i,1===e?1-(1-u)**2:3===e?u**2:u),d=(0,T.Cc)(je,a.origin,c.origin,h),f=(0,Re.nu)(a.direction,c.direction,h,Ve);r.intersectManifoldClosestSilhouette((0,R.LV)(d,f),o,ke),ae(ke,l,ke,w),y.push((0,M.o8)(ke)),0!==y.length&&C((0,T.lo)(y.at(-1),ke));const p=((0,re.Tj)(b,ke)?1:0)|((0,re.Tj)(S,ke)?2:0);Ze[p]=1}}y.length>2&&(0,T.lo)(y[0],y.at(-1));const E=function(e,t,r){const i=2*(0,ve.FD)();return e.map(e=>{const n=[];let o=!1;for(const s of e)t.fromRenderCoords(s,ke,r),Math.abs(s[0])<i&&Math.abs(s[1])<i?(n.push([null,ke[1]]),n.push([null,ke[1]]),o=!0):n.push([ke[0],ke[1]]);if(o)for(let e=0;e<n.length;e++){const t=n[e];if(null!=t[0])continue;const r=n[e+1],i=n.at(0===e?-1:e-1);t[0]=i[0],e++;const o=n.at(e===n.length-1?0:e+1);r[0]=o[0]}return n.push(n[0]),(0,K.$3)(n)||n.reverse(),n})}((0,N.m3)(Ze)>1?function(e,t){const r=[];for(const i of e)r.push(...Le(i,t));return r}(Le(y,b),S):[y],r,a);return new X.A({rings:E,spatialReference:a})},toExtent:function(e,t,r,i,n){let o,a,c,l;const u=t.latitude,h=(0,A.tO)(e.spatialReference).radius,d=t.longitude,f=function(e,t,r){const i=t/r,n=(0,s.kU)(e),o=Math.sin(i/2),a=Math.cos(n),c=2*(0,s.YN)(Math.sqrt(o*o/(a*a)));return(0,s.KJ)(c)}(u,r,h)/2;o=d-f,a=d+f;const p=(0,s.kU)(u),g=(1+Math.sin(p))/(1-Math.sin(p)),v=(g+1)*Math.tan(i/h/2),_=v*v;function x(e){const t=Math.PI/2;return(e=m.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(c=1.5*Math.PI-2*Math.atan(.5*(v+Math.sqrt(4*g+_))),l=c+i/h,c=x(c),l=x(l),l<c){const e=l;l=c,c=e}if(c=Math.max((0,s.KJ)(c),-90),l=Math.min((0,s.KJ)(l),90),a=_e.Y_.monotonic(o,a),a-o>180){const e=(a-o-180)/2;o+=e,a-=e}const w=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=c,n.xmax=a,n.ymax=l,n.spatialReference=w):n=new Y.A(o,c,a,l,w),e.spatialReference&&e.spatialReference.isWebMercator&&(0,we.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const qe="composite-color",Ye=["final-color",qe,"opaque-color","transparent-color"],Xe={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GROUND_DEPTH:"ground-depth",PRE_TRANSPARENT:"pre-transparent",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SCREEN_SPACE_SHADOW_HIGHLIGHT:"screen-space-shadow-highlight",TRANSPARENT_ENVIRONMENT:"transparent-environment",VIEWSHED:"viewshed"};Array.from(Object.values(Xe)).concat(Ye),(0,M.vt)();var Ke=r(49186),Je=r(10107),Qe=r(64108),et=r(44208),tt=(r(17676),r(94656)),rt=r(63907);r(93637),r(4576),new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]),new Map,(0,et.A)("esri-tests-disable-gpu-memory-measurements"),(0,tt.en)();(0,tt.en)();var it=r(90644),nt=r(76284),ot=r(48852),st=r(42293);const at=!!(0,et.A)("esri-tests-disable-gpu-memory-measurements");class ct{constructor(e,t){this._context=e,this._descriptor=t,this.type=2,this._context.instanceCounter.increment(rt.vt.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:i,height:n,internalFormat:o,multisampled:s}=t;s?r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n):r.renderbufferStorage(r.RENDERBUFFER,o,i,n),this._context.bindRenderbuffer(null)}get descriptor(){return this._descriptor}get samples(){const e=this._descriptor.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}get usedMemory(){return at?0:(e=this._descriptor).width<=0||e.height<=0||null==e.internalFormat?0:e.width*e.height*(0,st.MW)(e.internalFormat);var e}resize(e,t){const r=this._descriptor;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height),this._context.bindRenderbuffer(null)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(rt.vt.Renderbuffer,this),this._context=null)}}class lt{constructor(e,t,r){if(this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(rt.vt.FramebufferObject,this),null!=t){const r=function(e,t){return ut(t)||ht(t)?t:dt(t)?new nt.A(e,t):function(e){return 3===ft(e)||null!=e&&"samples"in e}(t)?new ct(e,t):null}(e,t);null!=r&&(this._colorAttachments.set(rt.r6,r),ut(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(rt.r6)}if(null!=r)if(function(e){return ut(e)||dt(e)}(r))this._depthStencilTexture=ut(r)?r:new nt.A(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=ht(r)?r:new ct(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}dispose(){const{_colorAttachments:e,_glName:t}=this;if(0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const{_context:r}=this,i=r.getBoundFramebufferObject(),n=Array.from(e.values());this.detachColorTextures(...e.keys()),n.forEach(e=>e.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(t),this._glName=null,r.bindFramebuffer(i===this?null:i),r.instanceCounter.decrement(rt.vt.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(rt.r6);return ut(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(rt.r6)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(rt.r6)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&ut(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=rt.r6){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=rt.r6){const t=this._colorAttachments.get(e);if(!t)return;const r=ut(t);return this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._initialized){const t=this._context.gl;this._context.temporaryBindFramebufferObject(this,()=>{e.forEach(e=>{ut(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=rt.r6,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,0,r):this._framebufferTexture2D(i.glName,t,e,36160,0))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===rt.ld.UNSIGNED_INT_24_8?6402!==r||i===rt.ld.UNSIGNED_INT||i===rt.ld.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,gt(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,gt(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){const{_context:t}=this,r=t.getBoundFramebufferObject();t.bindFramebuffer(this);const{gl:i}=t,n=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,n,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,n,o,s){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const a=s.descriptor;3553!==s.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==a?.width||null==a?.height||e+r>this.width||t+i>this.height||n+r>a.width||o+i>a.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,l=c.bindTexture(s,nt.A.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(nt.A.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,n,o,e,t,r,i),c.bindTexture(l,nt.A.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,s){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),s||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,s)}async readPixelsAsync(e,t,r,i,n,o,s){const{gl:a}=this._context,c=ot.g.createPixelPack(this._context,35041,s.byteLength);this._context.bindBuffer(c);const l=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),a.readPixels(e,t,r,i,n,o,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(l),await c.getSubDataAsync(s),c.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(pt(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(pt(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),(0,tt.en)())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=t.createFramebuffer();if(t.bindFramebuffer(e,r),this._colorAttachments.forEach((t,r)=>{if(ut(t)){const i=mt(t);35866===i?this._framebufferTextureLayer(t.glName,r,e,0,0):this._framebufferTexture2D(t.glName,r,i,e)}else if(ht(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=gt(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,mt(this._depthStencilTexture),e)}(0,tt.en)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=r,this._initialized=!0}_framebufferTexture2D(e,t=rt.r6,r=3553,i=36160,n=0){this._context.gl.framebufferTexture2D(i,t,r,e,n)}_framebufferTextureLayer(e,t=rt.r6,r=36160,i=0,n=0){this._context.gl.framebufferTextureLayer(r,t,e,i,n)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=(0,a.WD)(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,gt(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=(0,a.WD)(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),pt(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){pt(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case rt.SB.DEPTH_COMPONENT16:case rt.SB.DEPTH_COMPONENT24:case rt.SB.DEPTH_COMPONENT32F:return rt.xL;case rt.iE.DEPTH24_STENCIL8:case rt.iE.DEPTH32F_STENCIL8:return rt.nI;case 36168:return rt.uH;default:return rt.r6}}_validateColorAttachmentPoint(e){if(-1===lt._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;lt._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const t=e-rt.r6;t+1>lt._MAX_COLOR_ATTACHMENTS&&O.A.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${lt._MAX_COLOR_ATTACHMENTS} color attachments`)}}function ut(e){return 1===ft(e)}function ht(e){return 2===ft(e)}function dt(e){return 0===ft(e)}function ft(e){return null!=e&&"type"in e?e.type:null}function pt(e,t){const r=Math.max(e.width,e.height);if(r>t){O.A.getLogger("esri.views.webgl.FramebufferObject").warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function mt(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function gt(e){return 6402===e?rt.xL:rt.nI}var vt=r(67171),_t=(r(21818),r(69397),r(85079)),xt=r(74038);const wt=[new xt._("position",2,rt.pe.UNSIGNED_SHORT,0,4)];new xt._("a_pos",2,rt.pe.BYTE,0,2),new xt._("a_pos",2,rt.pe.BYTE,0,4),new xt._("a_tex",2,rt.pe.BYTE,2,4),(0,_t.Xk)(wt),r(66289);const yt=new Image;yt.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",yt.width=5,yt.height=5,yt.decode();let bt=class extends I.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=qe,this._dirty=!0}initialize(){this.addHandles([(0,c.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},c.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Ke.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}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(t),t}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){var t;e.initializeAndBind(),this.gl.drawBuffers((t=e)?t.colorAttachments.length>0?t.colorAttachments:[rt.$0]:[rt.C5])}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0: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.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}get requireGeometryDepth(){return!1}};(0,o.Cg)([(0,Je.MZ)({constructOnly:!0})],bt.prototype,"view",void 0),(0,o.Cg)([(0,Je.MZ)({constructOnly:!0})],bt.prototype,"consumes",void 0),(0,o.Cg)([(0,Je.MZ)()],bt.prototype,"produces",void 0),(0,o.Cg)([(0,Je.MZ)({readOnly:!0})],bt.prototype,"techniques",null),bt=(0,o.Cg)([(0,Qe.$)("esri.views.3d.webgl.RenderNode")],bt);const Tt=bt;var Mt=r(15581),St=r(13840),Ct=r(42958),Et=r(95774);let At=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Et.S,()=>r.e(1285).then(r.bind(r,91285)))}initializePipeline(){return(0,it.Ey)({colorWrite:it.kn})}};At=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],At);var Rt=r(65786);class It extends Rt.Y{constructor(){super(...arguments),this.projScale=1}}class Ot extends It{constructor(){super(...arguments),this.intensity=1}}class Ft extends Rt.Y{}class Dt extends Ft{constructor(){super(...arguments),this.blurSize=(0,P.vt)()}}let Pt=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Mt.S,()=>r.e(6122).then(r.bind(r,86122)))}initializePipeline(){return(0,it.Ey)({colorWrite:it.kn})}};Pt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],Pt);let Nt=class extends Tt{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=Xe.AMBIENT_ILLUMINATION,this.isEnabled=()=>!1,this._enableTime=(0,l.l5)(0),this._passParameters=new Ot,this._drawParameters=new Dt}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 vt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new nt.A(this.renderingContext,t,e),this.addHandles((0,c.wB)(()=>this.isEnabled(),()=>this._enableTime=(0,l.l5)(0)))}destroy(){this._passParameters.noiseTexture=(0,a.WD)(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(Pt),this.techniques.precompile(At)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(rt.nI);if(!r||!i)return;const n=this.techniques.getCompiled(Pt),o=this.techniques.getCompiled(At);if(!n||!o)return this._enableTime=(0,l.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,l.l5)(performance.now()));const a=this.renderingContext,c=this.view.qualitySettings.fadeDuration,u=this.bindParameters,d=u.camera,f=d.relativeElevation,p=(0,s.qE)((5e5-f)/2e5,0,1),m=c>0?Math.min(c,performance.now()-this._enableTime)/c:1,g=m*p;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*Bt/(0,Mt.g)(d)**6*g;const v=d.fullViewport[2],_=d.fullViewport[3],x=this.fboCache.acquire(v,_,"ssao input",2);a.bindFramebuffer(x.fbo),a.setViewport(0,0,v,_),a.bindTechnique(n,u,this._passParameters,this._drawParameters),a.screen.draw();const w=Math.round(v/2),y=Math.round(_/2),b=this.fboCache.acquire(w,y,"ssao blur",0);a.bindFramebuffer(b.fbo),this._drawParameters.colorTexture=x.getTexture(),(0,h.hZ)(this._drawParameters.blurSize,0,2/_),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,w,y),a.screen.draw(),x.release();const T=this.fboCache.acquire(w,y,Xe.AMBIENT_ILLUMINATION,0);return a.bindFramebuffer(T.fbo),a.setViewport(0,0,v,_),a.setClearColor(1,1,1,0),a.clear(16384),this._drawParameters.colorTexture=b.getTexture(),(0,h.hZ)(this._drawParameters.blurSize,2/v,0),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,w,y),a.screen.draw(),a.setViewport4fv(d.fullViewport),b.release(),m<1&&this.requestRender(2),T}};(0,o.Cg)([(0,u.MZ)()],Nt.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],Nt.prototype,"produces",void 0),(0,o.Cg)([(0,u.MZ)({constructOnly:!0})],Nt.prototype,"isEnabled",void 0),Nt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],Nt);const Bt=.5;function Ht(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
564
564
  vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0));
565
565
  return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r;
566
566
  }
567
567
  float evaluateAmbientOcclusion() {
568
568
  return 1.0 - evaluateAmbientOcclusionInverse();
569
569
  }`)):e.code.add(i.H`float evaluateAmbientOcclusionInverse() { return 1.0; }
570
- float evaluateAmbientOcclusion() { return 0.0; }`)}},25961(e,t,r){r.d(t,{kA:()=>y,a8:()=>_,eU:()=>x});var i=r(74333);class n extends i.n{constructor(e,t,r,i){super(e,"float",0,(t,n)=>t.setUniform1fv(e,r(n),i),t)}}var o=r(31821);function s(e,t){e.uniforms.add(new n("shR",9,({lighting:e})=>e.sh.r),new n("shG",9,({lighting:e})=>e.sh.g),new n("shB",9,({lighting:e})=>e.sh.b)),e.code.add(o.H`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
570
+ float evaluateAmbientOcclusion() { return 0.0; }`)}},70161(e,t,r){r.d(t,{kA:()=>w,a8:()=>_,eU:()=>x});var i=r(74333);class n extends i.n{constructor(e,t,r,i){super(e,"float",0,(t,n)=>t.setUniform1fv(e,r(n),i),t)}}var o=r(31821);function s(e,t){e.uniforms.add(new n("shR",9,({lighting:e})=>e.sh.r),new n("shG",9,({lighting:e})=>e.sh.g),new n("shB",9,({lighting:e})=>e.sh.b)),e.code.add(o.H`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
571
571
  vec3 ambientLight = 0.282095 * vec3(shR[0], shG[0], shB[0]);
572
572
  vec4 sh1 = vec4(
573
573
  0.488603 * normal.x,
@@ -603,7 +603,7 @@ vec3 calculateAmbientRadiance(float ambientOcclusion)
603
603
  {
604
604
  vec3 ambientLight = 1.2 * (0.282095 * vec3(shR[0], shG[0], shB[0])) - 0.2;
605
605
  return ambientLight *= (1.0 - ambientOcclusion) * skyTransmittance;
606
- }`)}var a=r(43730),c=r(65261),l=r(98619),u=r(22393),h=r(89786),d=r(32976),f=r(33094),m=(r(34727),r(35522),r(51850));const p={create:()=>[0,0,0,0,0,0,0,0,0],copy(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8]}};function g(e){e.code.add(o.H`float mapChannel(float x, vec2 p) {
606
+ }`)}var a=r(43730),c=r(65261),l=r(98619),u=r(22393),h=r(89786);class d extends i.n{constructor(e,t){super(e,"bool",0,(r,i)=>r.setUniform1b(e,t(i)))}}var f=r(33094),p=(r(34727),r(35522),r(51850));const m={create:()=>[0,0,0,0,0,0,0,0,0],copy(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8]}};function g(e){e.code.add(o.H`float mapChannel(float x, vec2 p) {
607
607
  return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
608
608
  }`),e.code.add(o.H`vec3 blackLevelSoftCompression(vec3 color, float averageAmbientRadiance) {
609
609
  vec2 p = vec2(0.02, 0.0075) * averageAmbientRadiance;
@@ -626,7 +626,7 @@ float newPeak = 1.0 - d * d / ( peak + d - startCompression );
626
626
  color *= newPeak / peak;
627
627
  float g = 1.0 - 1.0 / ( desaturation * ( peak - newPeak ) + 1.0 );
628
628
  return mix( color, vec3( newPeak ), g );
629
- }`)}function _(e){e.constants.add("ambientBoostFactor","float",.4)}function x(e){e.uniforms.add(new f.U("lightingGlobalFactor",e=>e.lighting.globalFactor))}function y(e,t){const{pbrMode:r,spherical:i,hasColorTexture:n}=t;e.include(a.n,t),0!==r&&e.include(u.c,t),e.include(s,t),e.include(h.p),e.include(v,t),e.include(c.C);const m=!(2===r&&!n);switch(m&&e.include(g),e.code.add(o.H`
629
+ }`)}function _(e){e.constants.add("ambientBoostFactor","float",.4)}function x(e){e.uniforms.add(new f.U("lightingGlobalFactor",e=>e.lighting.globalFactor))}function w(e,t){const{pbrMode:r,spherical:i,hasColorTexture:n}=t;e.include(a.n,t),0!==r&&e.include(u.c,t),e.include(s,t),e.include(h.p),e.include(v,t),e.include(c.C);const p=!(2===r&&!n);switch(p&&e.include(g),e.code.add(o.H`
630
630
  ${(0,o.If)(0!==r,"const float GROUND_REFLECTANCE = 0.2;")}
631
631
  `),_(e),x(e),(0,l.Gc)(e),e.code.add(o.H`
632
632
  float additionalDirectedAmbientLight(float lightAlignment) {
@@ -652,71 +652,49 @@ return delinearizeGamma(outColor);
652
652
  const float horizonLightDiffusion = 0.4;
653
653
  const float additionalAmbientIrradianceFactor = 0.02;
654
654
  vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
655
- vec3 viewDir, vec3 groundNormal, vec3 mrr, float additionalAmbientIrradiance) {
656
- vec3 viewDirection = -viewDir;
657
- vec3 h = normalize(viewDirection + mainLightDirection);
655
+ vec3 viewDirection, vec3 upDirection, vec3 mrr, float additionalAmbientIrradiance) {
658
656
  PBRShadingInfo inputs;
659
- inputs.NdotV = clamp(abs(dot(normal, viewDirection)), 0.001, 1.0);
660
- inputs.NdotNG = clamp(dot(normal, groundNormal), -1.0, 1.0);
661
- vec3 reflectedView = normalize(reflect(viewDirection, normal));
662
- inputs.RdotNG = clamp(dot(reflectedView, groundNormal), -1.0, 1.0);
663
- inputs.albedoLinear = linearizeGamma(albedo);
664
- inputs.ssao = ssao;
665
- inputs.metalness = mrr[0];
666
- inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),e.code.add(o.H`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
667
- inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
668
- inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),t.useFillLights?e.uniforms.add(new d.o("hasFillLights",e=>e.enableFillLights)):e.constants.add("hasFillLights","bool",!1),e.code.add(o.H`vec3 ambientDir = vec3(5.0 * groundNormal[1] - groundNormal[0] * groundNormal[2], - 5.0 * groundNormal[0] - groundNormal[2] * groundNormal[1], groundNormal[1] * groundNormal[1] + groundNormal[0] * groundNormal[0]);
657
+ calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo, mrr);`),t.useFillLights?e.uniforms.add(new d("hasFillLights",e=>e.enableFillLights)):e.constants.add("hasFillLights","bool",!1),e.code.add(o.H`vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
669
658
  ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
670
659
  inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
671
- float NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
672
- vec3 mainLightIrradianceComponent = NdotL * (1.0 - shadow) * mainLightIntensity;
660
+ vec3 mainLightIrradianceComponent = inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
673
661
  vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
674
662
  vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
675
663
  inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
676
- inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),e.uniforms.add(new f.U("lightingSpecularStrength",e=>e.lighting.mainLight.specularStrength),new f.U("lightingEnvironmentStrength",e=>e.lighting.mainLight.environmentStrength)).code.add(o.H`vec3 horizonRingDir = inputs.RdotNG * groundNormal - reflectedView;
677
- vec3 horizonRingH = normalize(viewDirection + horizonRingDir);
664
+ inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),e.uniforms.add(new f.U("lightingSpecularStrength",e=>e.lighting.mainLight.specularStrength),new f.U("lightingEnvironmentStrength",e=>e.lighting.mainLight.environmentStrength)).code.add(o.H`vec3 horizonRingDir = inputs.RdotUP * upDirection - inputs.reflectedView;
665
+ vec3 horizonRingH = normalize(horizonRingDir - viewDirection);
678
666
  inputs.NdotH_Horizon = dot(normal, horizonRingH);
679
- float NdotH = clamp(dot(normal, h), 0.0, 1.0);
680
- vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
667
+ vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(inputs.NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
681
668
  vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
682
669
  vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance(ssao) + additionalLight;
683
- 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));
670
+ float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotUP + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
684
671
  inputs.skyRadianceToSurface = (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
685
672
  inputs.groundRadianceToSurface = 0.5 * GROUND_REFLECTANCE * (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
686
673
  inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE);`),e.code.add(o.H`
687
674
  vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
688
675
  vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
689
676
  vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent;
690
- ${m?o.H`vec3 outColor = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:o.H`vec3 outColor = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
677
+ ${p?o.H`vec3 outColor = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:o.H`vec3 outColor = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
691
678
  return delinearizeGamma(outColor);
692
679
  }
693
680
  `);break;case 5:case 6:(0,l.Gc)(e),(0,l.O4)(e),e.code.add(o.H`const float roughnessTerrain = 0.5;
694
681
  const float specularityTerrain = 0.5;
695
- const vec3 fresnelReflectionTerrain = vec3(0.04);
696
- vec3 evaluatePBRSimplifiedLighting(vec3 n, vec3 c, float shadow, float ssao, vec3 al, vec3 vd, vec3 nup) {
697
- vec3 viewDirection = -vd;
698
- vec3 h = normalize(viewDirection + mainLightDirection);
699
- float NdotL = clamp(dot(n, mainLightDirection), 0.001, 1.0);
700
- float NdotV = clamp(abs(dot(n, viewDirection)), 0.001, 1.0);
701
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
702
- float NdotNG = clamp(dot(n, nup), -1.0, 1.0);
703
- vec3 albedoLinear = linearizeGamma(c);
704
- float lightness = 0.3 * albedoLinear[0] + 0.5 * albedoLinear[1] + 0.2 * albedoLinear[2];
705
- vec3 f0 = (0.85 * lightness + 0.15) * fresnelReflectionTerrain;
706
- vec3 f90 = vec3(clamp(dot(f0, vec3(50.0 * 0.33)), 0.0, 1.0));
707
- vec3 mainLightIrradianceComponent = (1. - shadow) * NdotL * mainLightIntensity;
708
- vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(n, ssao) + al;
682
+ vec3 evaluatePBRSimplifiedLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDirection, vec3 upDirection) {
683
+ PBRShadingInfo inputs;
684
+ calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
685
+ vec3 mainLightIrradianceComponent = (1. - shadow) * inputs.NdotL * mainLightIntensity;
686
+ vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
709
687
  vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
710
- vec3 indirectDiffuse = ((1.0 - NdotNG) * mainLightIrradianceComponent + (1.0 + NdotNG ) * ambientSky) * 0.5;
711
- vec3 outDiffColor = albedoLinear * (1.0 - f0) * indirectDiffuse / PI;
712
- vec3 mainLightRadianceComponent = normalDistribution(NdotH, roughnessTerrain) * mainLightIntensity;
713
- vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, NdotV);
714
- vec3 specularColor = f0 * dfg.x + f90 * dfg.y;
688
+ vec3 indirectDiffuse = ((1.0 - inputs.NdotUP) * mainLightIrradianceComponent + (1.0 + inputs.NdotUP ) * ambientSky) * 0.5;
689
+ vec3 outDiffColor = inputs.albedoLinear * (1.0 - inputs.f0) * indirectDiffuse / PI;
690
+ vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, roughnessTerrain) * mainLightIntensity;
691
+ vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, inputs.NdotV);
692
+ vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
715
693
  vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceComponent;
716
694
  vec3 outColorLinear = outDiffColor + specularComponent;
717
695
  vec3 outColor = delinearizeGamma(outColorLinear);
718
696
  return outColor;
719
- }`)}}p.create(),p.create(),(0,m.vt)(),(0,m.vt)()},65261(e,t,r){r.d(t,{C:()=>o});var i=r(40876),n=r(31821);function o(e){e.constants.add("GAMMA","float",i.Tf).constants.add("INV_GAMMA","float",1/i.Tf).code.add(n.H`vec3 delinearizeGamma(vec3 color) {
697
+ }`)}}m.create(),m.create(),(0,p.vt)(),(0,p.vt)()},65261(e,t,r){r.d(t,{C:()=>o});var i=r(40876),n=r(31821);function o(e){e.constants.add("GAMMA","float",i.Tf).constants.add("INV_GAMMA","float",1/i.Tf).code.add(n.H`vec3 delinearizeGamma(vec3 color) {
720
698
  return pow(color, vec3(INV_GAMMA));
721
699
  }
722
700
  vec4 delinearizeGamma(vec4 color) {
@@ -736,7 +714,7 @@ return normalize(params.normalView);
736
714
  return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
737
715
  }`);break;case 2:r.code.add(i.H`vec3 shadingNormal(ShadingNormalParameters params) {
738
716
  return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
739
- }`);break;default:t.doubleSidedMode;case 3:}}},22393(e,t,r){r.d(t,{c:()=>s});var i=r(31821);function n(e){e.code.add(i.H`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) {
717
+ }`);break;default:t.doubleSidedMode;case 3:}}},22393(e,t,r){r.d(t,{c:()=>a});var i=r(31821);function n(e){e.code.add(i.H`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) {
740
718
  return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5;
741
719
  }`),e.code.add(i.H`float integratedRadiance(float cosTheta2, float roughness) {
742
720
  return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0);
@@ -746,7 +724,7 @@ float intRadTheta = integratedRadiance(cosTheta2, roughness);
746
724
  float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta;
747
725
  float sky = 2.0 - ground;
748
726
  return (ground * ambientGround + sky * ambientSky) * 0.5;
749
- }`)}var o=r(89786);function s(e,t){e.include(o.p),1!==t.pbrMode&&2!==t.pbrMode&&5!==t.pbrMode&&6!==t.pbrMode||(e.code.add(i.H`float normalDistribution(float NdotH, float roughness)
727
+ }`)}var o=r(65261),s=r(89786);function a(e,t){e.include(o.C),e.include(s.p),1!==t.pbrMode&&2!==t.pbrMode&&5!==t.pbrMode&&6!==t.pbrMode||(e.code.add(i.H`float normalDistribution(float NdotH, float roughness)
750
728
  {
751
729
  float a = NdotH * roughness;
752
730
  float b = roughness / (1.0 - NdotH * NdotH + a * a);
@@ -758,40 +736,64 @@ vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
758
736
  vec4 r = roughness * c0 + c1;
759
737
  float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
760
738
  return c2 * a004 + r.zw;
761
- }`)),1!==t.pbrMode&&2!==t.pbrMode||(e.include(n),e.code.add(i.H`struct PBRShadingInfo
739
+ }`),e.code.add(i.H`struct PBRShadingInfo
762
740
  {
763
741
  float NdotV;
742
+ float NdotL;
764
743
  float LdotH;
765
- float NdotNG;
766
- float RdotNG;
744
+ float NdotUP;
745
+ float RdotUP;
767
746
  float NdotAmbDir;
768
747
  float NdotH_Horizon;
748
+ float NdotH;
769
749
  vec3 skyRadianceToSurface;
770
750
  vec3 groundRadianceToSurface;
771
751
  vec3 skyIrradianceToSurface;
772
752
  vec3 groundIrradianceToSurface;
753
+ vec3 reflectedView;
773
754
  float averageAmbientRadiance;
774
- float ssao;
775
755
  vec3 albedoLinear;
776
756
  vec3 f0;
777
757
  vec3 f90;
778
758
  vec3 diffuseColor;
779
759
  float metalness;
780
760
  float roughness;
781
- };`),e.code.add(i.H`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
782
- vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotNG);
783
- vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotNG, inputs.roughness);
761
+ };`),e.code.add(i.H`void calculateCommonInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
762
+ vec3 h = normalize(mainLightDirection - viewDirection);
763
+ inputs.NdotV = clamp(abs(dot(normal, -viewDirection)), 0.001, 1.0);
764
+ inputs.NdotUP = clamp(dot(normal, upDirection), -1.0, 1.0);
765
+ inputs.reflectedView = normalize(reflect(-viewDirection, normal));
766
+ inputs.RdotUP = clamp(dot(inputs.reflectedView, upDirection), -1.0, 1.0);
767
+ inputs.albedoLinear = linearizeGamma(albedo);
768
+ inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
769
+ inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
770
+ }`)),1!==t.pbrMode&&2!==t.pbrMode||(e.include(n),e.code.add(i.H`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
771
+ vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotUP);
772
+ vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotUP, inputs.roughness);
784
773
  vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
785
774
  vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
786
775
  vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
787
776
  vec3 specularComponent = specularColor * indirectSpecular;
788
777
  return (diffuseComponent + specularComponent);
789
- }`))}},59469(e,t,r){r.d(t,{_:()=>l});var i=r(99208),n=r(40710),o=r(33079),s=r(31821),a=r(15976),c=r(63761);function l(e,t){const r=t.pbrMode,l=e.fragment;if(2!==r&&0!==r&&1!==r)return void l.code.add(s.H`void applyPBRFactors() {}`);if(0===r)return void l.code.add(s.H`void applyPBRFactors() {}
778
+ }`),e.code.add(i.H`void calculatePBRInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo, vec3 mrr) {
779
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
780
+ inputs.metalness = mrr[0];
781
+ inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);
782
+ inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
783
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
784
+ inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);
785
+ }`)),5!==t.pbrMode&&6!==t.pbrMode||e.code.add(i.H`const vec3 fresnelReflectionSimplified = vec3(0.04);
786
+ void calculateSimplifiedInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
787
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
788
+ float lightness = 0.3 * inputs.albedoLinear[0] + 0.5 * inputs.albedoLinear[1] + 0.2 * inputs.albedoLinear[2];
789
+ inputs.f0 = (0.85 * lightness + 0.15) * fresnelReflectionSimplified;
790
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
791
+ }`)}},59469(e,t,r){r.d(t,{_:()=>l});var i=r(99208),n=r(40710),o=r(33079),s=r(31821),a=r(15976),c=r(63761);function l(e,t){const r=t.pbrMode,l=e.fragment;if(2!==r&&0!==r&&1!==r)return void l.code.add(s.H`void applyPBRFactors() {}`);if(0===r)return void l.code.add(s.H`void applyPBRFactors() {}
790
792
  float getBakedOcclusion() { return 1.0; }`);if(2===r)return void l.code.add(s.H`vec3 mrr = vec3(0.0, 0.6, 0.2);
791
793
  float occlusion = 1.0;
792
794
  void applyPBRFactors() {}
793
- float getBakedOcclusion() { return 1.0; }`);const{hasMetallicRoughnessTexture:u,hasMetallicRoughnessTextureTransform:h,hasOcclusionTexture:d,hasOcclusionTextureTransform:f,bindType:m}=t;(u||d)&&e.include(i.r,t),l.code.add(s.H`vec3 mrr;
794
- float occlusion;`),u&&l.uniforms.add(1===m?new c.N("texMetallicRoughness",e=>e.textureMetallicRoughness):new a.o("texMetallicRoughness",e=>e.textureMetallicRoughness)),d&&l.uniforms.add(1===m?new c.N("texOcclusion",e=>e.textureOcclusion):new a.o("texOcclusion",e=>e.textureOcclusion)),l.uniforms.add(1===m?new o.t("mrrFactors",e=>e.mrrFactors):new n.W("mrrFactors",e=>e.mrrFactors)),l.code.add(s.H`
795
+ float getBakedOcclusion() { return 1.0; }`);const{hasMetallicRoughnessTexture:u,hasMetallicRoughnessTextureTransform:h,hasOcclusionTexture:d,hasOcclusionTextureTransform:f,bindType:p}=t;(u||d)&&e.include(i.r,t),l.code.add(s.H`vec3 mrr;
796
+ float occlusion;`),u&&l.uniforms.add(1===p?new c.N("texMetallicRoughness",e=>e.textureMetallicRoughness):new a.o("texMetallicRoughness",e=>e.textureMetallicRoughness)),d&&l.uniforms.add(1===p?new c.N("texOcclusion",e=>e.textureOcclusion):new a.o("texOcclusion",e=>e.textureOcclusion)),l.uniforms.add(1===p?new o.t("mrrFactors",e=>e.mrrFactors):new n.W("mrrFactors",e=>e.mrrFactors)),l.code.add(s.H`
795
797
  ${(0,s.If)(u,s.H`void applyMetallicRoughness(vec2 uv) {
796
798
  vec3 metallicRoughness = textureLookup(texMetallicRoughness, uv).rgb;
797
799
  mrr[0] *= metallicRoughness.b;
@@ -811,9 +813,9 @@ float occlusion;`),u&&l.uniforms.add(1===m?new c.N("texMetallicRoughness",e=>e.t
811
813
  ${(0,s.If)(u,`applyMetallicRoughness(${h?"metallicRoughnessUV":"vuv0"});`)}
812
814
  ${(0,s.If)(d,`applyOcclusion(${f?"occlusionUV":"vuv0"});`)}
813
815
  }
814
- `)}(r(74810),r(65786)).Y},89786(e,t,r){function i(e){const t=.3183098861837907;e.constants.add("PI","float",3.141592653589793),e.constants.add("LIGHT_NORMALIZATION","float",t),e.constants.add("INV_PI","float",t),e.constants.add("ONE_QUATER_PI","float",.78539816339745),e.constants.add("HALF_PI","float",1.570796326794897),e.constants.add("THREE_QUATER_PI","float",2.35619449019234),e.constants.add("TWO_PI","float",6.28318530717958),e.constants.add("PI_SQUARED","float",9.86960440108936)}r.d(t,{p:()=>i})},32482(e,t,r){r.d(t,{Bz:()=>w,G:()=>y}),r(51850);var i=r(46686),n=r(49255),o=r(31821);function s(e,t){const r=(0,n._o)(t.output)&&t.receiveShadows;r&&(0,i.o)(e,!0),e.vertex.code.add(o.H`
816
+ `)}(r(74810),r(65786)).Y},89786(e,t,r){function i(e){const t=.3183098861837907;e.constants.add("PI","float",3.141592653589793),e.constants.add("LIGHT_NORMALIZATION","float",t),e.constants.add("INV_PI","float",t),e.constants.add("ONE_QUATER_PI","float",.78539816339745),e.constants.add("HALF_PI","float",1.570796326794897),e.constants.add("THREE_QUATER_PI","float",2.35619449019234),e.constants.add("TWO_PI","float",6.28318530717958),e.constants.add("PI_SQUARED","float",9.86960440108936)}r.d(t,{p:()=>i})},32482(e,t,r){r.d(t,{Bz:()=>y,G:()=>w}),r(51850);var i=r(46686),n=r(49255),o=r(31821);function s(e,t){const r=(0,n._o)(t.output)&&t.receiveShadows;r&&(0,i.o)(e,!0),e.vertex.code.add(o.H`
815
817
  void forwardLinearDepthToReadShadowMap() { ${(0,o.If)(r,"forwardLinearDepth(gl_Position.w);")} }
816
- `)}var a=r(14314),c=r(35818),l=r(74333);class u extends l.n{constructor(e,t,r,i){super(e,"mat4",2,(r,n,o,s)=>r.setUniformMatrices4fv(e,t(n,o,s),i),r)}}class h extends l.n{constructor(e,t,r,i){super(e,"mat4",1,(r,n,o)=>r.setUniformMatrices4fv(e,t(n,o),i),r)}}var d=r(65786);function f(e){e.fragment.uniforms.add(new h("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),p(e)}function m(e){e.fragment.uniforms.add(new u("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),p(e)}function p(e){const{fragment:t}=e;t.uniforms.add(new a.I("cascadeDistances",e=>e.shadowMap.cascadeDistances),new c.W("numCascades",e=>e.shadowMap.numCascades)),t.code.add(o.H`const vec3 invalidShadowmapUVZ = vec3(0.0, 0.0, -1.0);
818
+ `)}var a=r(14314),c=r(35818),l=r(74333);class u extends l.n{constructor(e,t,r,i){super(e,"mat4",2,(r,n,o,s)=>r.setUniformMatrices4fv(e,t(n,o,s),i),r)}}class h extends l.n{constructor(e,t,r,i){super(e,"mat4",1,(r,n,o)=>r.setUniformMatrices4fv(e,t(n,o),i),r)}}var d=r(65786);function f(e){e.fragment.uniforms.add(new h("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),m(e)}function p(e){e.fragment.uniforms.add(new u("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),m(e)}function m(e){const{fragment:t}=e;t.uniforms.add(new a.I("cascadeDistances",e=>e.shadowMap.cascadeDistances),new c.W("numCascades",e=>e.shadowMap.numCascades)),t.code.add(o.H`const vec3 invalidShadowmapUVZ = vec3(0.0, 0.0, -1.0);
817
819
  vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
818
820
  vec4 lv = mat * vec4(_vpos, 1.0);
819
821
  lv.xy /= lv.w;
@@ -837,23 +839,28 @@ vec2 uvShadow = cascadeCoordinates(i, shadowMapSize, lvpos);
837
839
  return vec3(uvShadow, lvpos.z);
838
840
  }`)}function g(e){e.fragment.code.add(o.H`float readShadowMapUVZ(vec3 uvzShadow, sampler2DShadow _shadowMap) {
839
841
  return texture(_shadowMap, uvzShadow);
840
- }`)}d.Y;var v=r(32976),_=r(33094);class x extends l.n{constructor(e,t){super(e,"sampler2DShadow",0,(r,i)=>r.bindTexture(e,t(i)))}}function y(e,t){t.receiveShadows&&e.include(f),b(e,t)}function w(e,t){t.receiveShadows&&e.include(m),b(e,t)}function b(e,t){e.fragment.uniforms.add(new _.U("lightingGlobalFactor",e=>e.lighting.globalFactor));const{receiveShadows:r,spherical:i}=t;e.include(s,t),r&&T(e),e.fragment.code.add(o.H`
841
- float readShadow(float additionalAmbientScale, vec3 vpos) {
842
- return ${r?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":(0,o.If)(i,"lightingGlobalFactor * (1.0 - additionalAmbientScale)","0.0")};
842
+ }`)}d.Y;var v=r(33094),_=r(12791);class x extends l.n{constructor(e,t){super(e,"sampler2DShadow",0,(r,i)=>r.bindTexture(e,t(i)))}}function w(e,t){t.receiveShadows&&e.include(f),b(e,t)}function y(e,t){t.receiveShadows&&e.include(p),b(e,t)}function b(e,t){e.fragment.uniforms.add(new v.U("lightingGlobalFactor",e=>e.lighting.globalFactor));const{hasShadowHighlights:r,receiveShadows:i,spherical:n}=t;e.include(s,t),i&&function(e,t){e.include(g),function(e,t){e.include(g),e.fragment.uniforms.add(new x("shadowMap",({shadowMap:e})=>e.getOutput(5)??e.getOutput(7))),t&&e.fragment.uniforms.add(new _.x("screenSpaceShadowHighlight",({screenSpaceShadowHighlightFbo:e})=>e?.getTexture())),e.fragment.code.add(o.H`
843
+ float readShadowMaps(const in vec3 uvzShadow) {
844
+ if (uvzShadow.z < 0.0) {
845
+ return 0.0;
846
+ }
847
+
848
+ float shadow1 = readShadowMapUVZ(uvzShadow, shadowMap);
849
+ // screenSpaceShadowHighlight is generated in camera screen space and assumes a
850
+ ${(0,o.If)(t,o.H`
851
+ // matching full-resolution receiver viewport when this helper is used.
852
+ float shadow2 = texelFetch(screenSpaceShadowHighlight, ivec2(gl_FragCoord.xy), 0).r;
853
+ return shadow1 > shadow2 ? shadow1 : shadow2;
854
+ `,o.H`return shadow1;`)}
843
855
  }
844
- `)}function T(e){e.include(g),function(e){e.include(g),e.fragment.uniforms.add(new v.o("singleShadowMap",({shadowMap:e})=>!!e.getOutput(5)),new x("shadowMap",({shadowMap:e})=>e.getOutput(5)??e.getOutput(7)),new x("shadowMapHighlight",({shadowMap:e})=>e.getOutput(5)??e.getOutput(6))).code.add(o.H`float readShadowMaps(const in vec3 uvzShadow) {
845
- if (uvzShadow.z < 0.0) {
846
- return 0.0;
847
- }
848
- float shadow1 = readShadowMapUVZ(uvzShadow, shadowMap);
849
- if (singleShadowMap)
850
- return shadow1;
851
- float shadow2 = readShadowMapUVZ(uvzShadow, shadowMapHighlight);
852
- return shadow1 > shadow2 ? shadow1 : shadow2;
853
- }`)}(e),e.fragment.code.add(o.H`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
856
+ `)}(e,t),e.fragment.code.add(o.H`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
854
857
  vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap, 0));
855
858
  return readShadowMaps(uvzShadow);
856
- }`)}d.Y},96598(e,t,r){r.d(t,{Z:()=>s});var i=r(52540),n=r(31821),o=r(12791);function s(e,{terrainDepthTest:t,cullAboveTerrain:r}){const{vertex:s,fragment:a,varyings:c}=e;if(!t)return s.code.add("void forwardViewPosDepth(vec3 pos) {}"),void a.code.add("void discardByTerrainDepth() {}");c.add("viewPosDepth","float",{invariant:!0}),s.code.add("void forwardViewPosDepth(vec3 pos) {\n viewPosDepth = pos.z;\n }"),a.include(i.E),a.uniforms.add(new o.x("terrainDepthTexture",e=>e.terrainDepth?.attachment)).code.add(n.H`
859
+ }`)}(e,r),e.fragment.code.add(o.H`
860
+ float readShadow(float additionalAmbientScale, vec3 vpos) {
861
+ return ${i?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":(0,o.If)(n,"lightingGlobalFactor * (1.0 - additionalAmbientScale)","0.0")};
862
+ }
863
+ `)}d.Y},96598(e,t,r){r.d(t,{Z:()=>s});var i=r(52540),n=r(31821),o=r(12791);function s(e,{terrainDepthTest:t,cullAboveTerrain:r}){const{vertex:s,fragment:a,varyings:c}=e;if(!t)return s.code.add("void forwardViewPosDepth(vec3 pos) {}"),void a.code.add("void discardByTerrainDepth() {}");c.add("viewPosDepth","float",{invariant:!0}),s.code.add("void forwardViewPosDepth(vec3 pos) {\n viewPosDepth = pos.z;\n }"),a.include(i.E),a.uniforms.add(new o.x("terrainDepthTexture",e=>e.terrainDepth?.attachment)).code.add(n.H`
857
864
  void discardByTerrainDepth() {
858
865
  float depth = texelFetch(terrainDepthTexture, ivec2(gl_FragCoord.xy), 0).r;
859
866
  float linearDepth = linearizeDepth(depth);
@@ -1006,7 +1013,7 @@ return dpDummy * hiD + loD;
1006
1013
  // multiply or tint (or something invalid)
1007
1014
  return allMixed;
1008
1015
  }
1009
- `)}},20693(e,t,r){r.d(t,{yu:()=>d,NB:()=>f,S7:()=>g});var i=r(58083),n=r(9093),o=r(35522),s=r(51850),a=r(23205),c=r(40710),l=(r(33094),r(58029)),u=r(74333);class h extends u.n{constructor(e,t,r){super(e,"mat4",2,(i,n,o)=>i.setUniformMatrix4fv(e,t(n,o),r))}}function d(e,t){t.instancedDoublePrecision?e.constants.add("cameraPosition","vec3",s.uY):e.uniforms.add(new c.W("cameraPosition",(e,t)=>(0,o.hZ)(p,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 l.F("proj",e=>e.camera.projectionMatrix),new h("view",(e,t)=>(0,i.Tl)(m,t.camera.viewMatrix,e.origin)),new c.W("localOrigin",e=>e.origin));const r=({camera:e})=>(0,o.hZ)(p,e.viewInverseTransposeMatrix[3],e.viewInverseTransposeMatrix[7],e.viewInverseTransposeMatrix[11]);e.uniforms.add(new l.F("proj",e=>e.camera.projectionMatrix),new l.F("view",e=>(0,i.Tl)(m,e.camera.viewMatrix,r(e))),new a.d("localOrigin",e=>r(e)))}const m=(0,n.vt)(),p=(0,s.vt)();function g(e){e.uniforms.add(new l.F("viewNormal",e=>e.camera.viewInverseTransposeMatrix))}},32976(e,t,r){r.d(t,{o:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"bool",0,(r,i)=>r.setUniform1b(e,t(i)))}}},77108(e,t,r){r.d(t,{E:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",0,(i,n)=>i.setUniform2fv(e,t(n),r))}}},68259(e,t,r){r.d(t,{t:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",2,(i,n,o,s)=>i.setUniform2fv(e,t(n,o,s),r))}}},47286(e,t,r){r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},23205(e,t,r){r.d(t,{d:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",0,(i,n)=>i.setUniform3fv(e,t(n),r))}}},40710(e,t,r){r.d(t,{W:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",2,(i,n,o,s)=>i.setUniform3fv(e,t(n,o,s),r))}}},33079(e,t,r){r.d(t,{t:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",1,(i,n,o)=>i.setUniform3fv(e,t(n,o),r))}}},14314(e,t,r){r.d(t,{I:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",0,(i,n)=>i.setUniform4fv(e,t(n),r))}}},71988(e,t,r){r.d(t,{E:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",1,(i,n,o)=>i.setUniform4fv(e,t(n,o),r))}}},33094(e,t,r){r.d(t,{U:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",0,(i,n)=>i.setUniform1f(e,t(n),r))}}},28421(e,t,r){r.d(t,{J:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",2,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},20304(e,t,r){r.d(t,{m:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",1,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},35818(e,t,r){r.d(t,{W:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"int",0,(r,i)=>r.setUniform1i(e,t(i)))}}},98353(e,t,r){r.d(t,{h:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat3",2,(i,n,o)=>i.setUniformMatrix3fv(e,t(n,o),r))}}},35644(e,t,r){r.d(t,{k:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat3",1,(i,n,o)=>i.setUniformMatrix3fv(e,t(n,o),r))}}},58029(e,t,r){r.d(t,{F:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat4",0,(i,n)=>i.setUniformMatrix4fv(e,t(n),r))}}},12791(e,t,r){r.d(t,{x:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",0,(r,i)=>r.bindTexture(e,t(i)))}}},15976(e,t,r){r.d(t,{o:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"sampler2D",2,(i,n,o)=>i.bindTexture(e,t(n,o),r?.(n,o)))}}},63761(e,t,r){r.d(t,{N:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",1,(r,i,n)=>r.bindTexture(e,t(i,n)))}}},31821(e,t,r){r.d(t,{H:()=>i,If:()=>n});const i=(e,...t)=>{let r="";for(let i=0;i<t.length;i++)r+=e[i]+t[i];return r+=e[e.length-1],r};function n(e,t,r=""){return e?t:r}i.int=e=>e.toFixed(),i.uint=e=>`${Math.max(0,e).toFixed()}u`,i.hexuint=e=>`0x${Math.round(Math.max(0,e)).toString(16)}u`,i.float=e=>e.toPrecision(8)},13840(e,t,r){r.d(t,{r:()=>i});class i{constructor(e,t){this._module=e,this._load=t}get(){return this._module}async reload(){return this._module=await this._load(),this._module}}},42958(e,t,r){r.d(t,{w:()=>p});var i=r(5482),n=r(69622),o=r(53966),s=r(91429),a=r(63907),c=r(85079),l=r(74038);new l._("position",3,a.pe.FLOAT,0,12);const u=[new l._("position",2,a.pe.FLOAT,0,8)];(0,c.Xk)(u),new l._("position",2,a.pe.FLOAT,0,12),new l._("uv0",2,a.pe.HALF_FLOAT,8,12),new l._("position",2,a.pe.FLOAT,0,16),new l._("uv0",2,a.pe.FLOAT,8,16),r(44208);var h=r(26857),d=r(94656);class f{constructor(e,t,r){this._context=e,this.locations=r,this._textures=new Map,this.source=(0,d.en)()?t:null,t.attributeNames.forEach(e=>{r.has(e)||o.A.getLogger("esri.views.3d.webgl-engine.lib.Program").error(`Missing VertexAttributeLocation for ${e} used in shader`)}),this._glProgram=e.programCache.get(t.generate("vertex",!0),t.generate("fragment",!0),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=t.generateBind(this),this.bindPass=t.generateBindPass(this),this.bindDraw=t.generateBindDraw(this)}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,r){this._glProgram.setUniform1f(e,t,r)}setUniform2fv(e,t,r){this._glProgram.setUniform2fv(e,t,r)}setUniform3fv(e,t,r){this._glProgram.setUniform3fv(e,t,r)}setUniform4fv(e,t,r){this._glProgram.setUniform4fv(e,t,r)}setUniformMatrix3fv(e,t,r){this._glProgram.setUniformMatrix3fv(e,t,!1,r)}setUniformMatrix4fv(e,t,r){this._glProgram.setUniformMatrix4fv(e,t,!1,r)}setUniformMatrices4fv(e,t,r){this._glProgram.setUniformMatrices4fv(e,t,!1,r)}setUniform1fv(e,t,r){this._glProgram.setUniform1fv(e,t,r)}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,t){if(h.b.ENABLE_OPTIMIZATIONS)return;let r=e.locations;if(t){const e=new Map(r);t.forEach((t,i)=>e.set(i,r.size+t)),r=e}r.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${r}, ${this.locations}`),this.locations.forEach((e,t)=>{r.get(t)!==e&&console.error(`VertexAttributeLocations are incompatible: Program has ${t} at position ${e}, VAO has it at position ${r.get(t)}.`)})}stop(){this._textures.clear()}bindTexture(e,t,r){if(!t?.glName){const r=`Texture sampler ${e} in ${this._context.debugBoundTechnique} has no given Texture in ${(new Error).stack}`;(0,d.en)()&&console.error(r),t=this._context.emptyTexture}const i=this._ensureTextureUnit(e,t);this._context.useProgram(this);const n=i.unit;this.setUniform1i(e,n),this._context.bindTexture(t,n,!1,r)}_ensureTextureUnit(e,t){let r=this._textures.get(e);return null==r?(r={texture:t,unit:this._textures.size},this._textures.set(e,r)):r.texture=t,r}}var m=r(90644);let p=class extends n.A{constructor(e,t,r){super({}),this._context=e,this._configuration=t,this.primitiveType=a.WR.TRIANGLES,this._unused=!0,this.ignoreUnused=!1,this.key=t.key,this.locations=(0,c.Xk)(r??u),this._pipeline=this.initializePipeline(t),this.reload=async r=>{if(r&&await this.shader.reload(),!this.key.equals(t.key))return void o.A.getLogger("esri.views.3d.webgl.ShaderTechnique").warn(`Configuration was changed after construction, cannot reload shader for ${this.declaredClass}.`);const i=this.shader.get().build(t);i.debugName=this.declaredClass,this._program=new f(e.rctx,i,this.locations),this._pipeline=this.initializePipeline(t)}}initialize(){const e=this.shader.get().build(this._configuration);e.debugName=this.declaredClass,this._program=new f(this._context.rctx,e,this.locations)}get program(){return this._unused=!1,this._program}get compiled(){return this._unused=!1,this.program.compiled}get unused(){return this._unused}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}getPipeline(e,t){return this._pipeline}initializePipeline(e){return(0,m.Ey)({blending:m.RC,colorWrite:m.kn})}};p=(0,i.Cg)([(0,s.$K)("esri.views.3d.webgl-engine.core.shaderTechnique.ShaderTechnique")],p)},51976(e,t,r){r.d(t,{K:()=>a,W:()=>c});var i=r(49186),n=r(4576);class o{constructor(e){this._bits=[...e]}equals(e){return(0,n.aI)(this._bits,e.bits)}get code(){return this._code??=String.fromCharCode(...this._bits),this._code}get bits(){return this._bits}}var s=r(65786);class a extends s.Y{constructor(){super(),this._parameterBits=this._parameterBits?.map(()=>0)??[],this._parameterNames??=[]}get key(){return this._key??=new o(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map(e=>` ${e}: ${this[e]}`).join("\n");return this._parameterBits=t,r}}function c(e={}){return(t,r)=>{t.hasOwnProperty("_parameterNames")||Object.defineProperty(t,"_parameterNames",{value:t._parameterNames?.slice()??[],configurable:!0,writable:!0}),t.hasOwnProperty("_parameterBits")||Object.defineProperty(t,"_parameterBits",{value:t._parameterBits?.slice()??[0],configurable:!0,writable:!0}),t._parameterNames.push(r);const n=e.count||2,o=Math.ceil(Math.log2(n)),s=t._parameterBits;let a=0;for(;s[a]+o>16;)a++,a>=s.length&&s.push(0);const c=s[a],l=(1<<o)-1<<c;s[a]+=o,e.count?Object.defineProperty(t,r,{get(){return(this._parameterBits[a]&l)>>c},set(t){const n=this._parameterBits[a];if((n&l)>>c!==t){if(this._key=null,this._parameterBits[a]=n&~l|+t<<c&l,"number"!=typeof t)throw new i.A("internal:invalid-shader-configuration",`Configuration value for ${r} must be a number, got ${typeof t}`);if(null==e.count)throw new i.A("internal:invalid-shader-configuration",`Configuration value for ${r} must provide a count option`)}}}):Object.defineProperty(t,r,{get(){return!!((this._parameterBits[a]&l)>>c)},set(e){const t=this._parameterBits[a];if(!!((t&l)>>c)!==e&&(this._key=null,this._parameterBits[a]=t&~l|+e<<c,"boolean"!=typeof e))throw new i.A("internal:invalid-shader-configurationx",`Configuration value for ${r} must be boolean, got ${typeof e}`)}})}}},16943(e,t,r){r.d(t,{E:()=>n});var i=r(44208);function n(){return!!(0,i.A)("enable-feature:objectAndLayerId-rendering")}},27832(e,t,r){r.d(t,{b:()=>o});var i=r(33094),n=r(31821);function o(e,t){t.snowCover&&(e.uniforms.add(new i.U("snowCover",e=>e.snowCover)).code.add(n.H`float getSnow(vec3 normal, vec3 groundNormal) {
1016
+ `)}},20693(e,t,r){r.d(t,{yu:()=>d,NB:()=>f,S7:()=>g});var i=r(58083),n=r(9093),o=r(35522),s=r(51850),a=r(23205),c=r(40710),l=(r(33094),r(58029)),u=r(74333);class h extends u.n{constructor(e,t,r){super(e,"mat4",2,(i,n,o)=>i.setUniformMatrix4fv(e,t(n,o),r))}}function d(e,t){t.instancedDoublePrecision?e.constants.add("cameraPosition","vec3",s.uY):e.uniforms.add(new c.W("cameraPosition",(e,t)=>(0,o.hZ)(m,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 l.F("proj",e=>e.camera.projectionMatrix),new h("view",(e,t)=>(0,i.Tl)(p,t.camera.viewMatrix,e.origin)),new c.W("localOrigin",e=>e.origin));const r=({camera:e})=>(0,o.hZ)(m,e.viewInverseTransposeMatrix[3],e.viewInverseTransposeMatrix[7],e.viewInverseTransposeMatrix[11]);e.uniforms.add(new l.F("proj",e=>e.camera.projectionMatrix),new l.F("view",e=>(0,i.Tl)(p,e.camera.viewMatrix,r(e))),new a.d("localOrigin",e=>r(e)))}const p=(0,n.vt)(),m=(0,s.vt)();function g(e){e.uniforms.add(new l.F("viewNormal",e=>e.camera.viewInverseTransposeMatrix))}},77108(e,t,r){r.d(t,{E:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",0,(i,n)=>i.setUniform2fv(e,t(n),r))}}},68259(e,t,r){r.d(t,{t:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",2,(i,n,o,s)=>i.setUniform2fv(e,t(n,o,s),r))}}},47286(e,t,r){r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},23205(e,t,r){r.d(t,{d:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",0,(i,n)=>i.setUniform3fv(e,t(n),r))}}},40710(e,t,r){r.d(t,{W:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",2,(i,n,o,s)=>i.setUniform3fv(e,t(n,o,s),r))}}},33079(e,t,r){r.d(t,{t:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec3",1,(i,n,o)=>i.setUniform3fv(e,t(n,o),r))}}},14314(e,t,r){r.d(t,{I:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",0,(i,n)=>i.setUniform4fv(e,t(n),r))}}},71988(e,t,r){r.d(t,{E:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",1,(i,n,o)=>i.setUniform4fv(e,t(n,o),r))}}},33094(e,t,r){r.d(t,{U:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",0,(i,n)=>i.setUniform1f(e,t(n),r))}}},28421(e,t,r){r.d(t,{J:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",2,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},20304(e,t,r){r.d(t,{m:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",1,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},35818(e,t,r){r.d(t,{W:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"int",0,(r,i)=>r.setUniform1i(e,t(i)))}}},98353(e,t,r){r.d(t,{h:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat3",2,(i,n,o)=>i.setUniformMatrix3fv(e,t(n,o),r))}}},35644(e,t,r){r.d(t,{k:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat3",1,(i,n,o)=>i.setUniformMatrix3fv(e,t(n,o),r))}}},58029(e,t,r){r.d(t,{F:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"mat4",0,(i,n)=>i.setUniformMatrix4fv(e,t(n),r))}}},12791(e,t,r){r.d(t,{x:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",0,(r,i)=>r.bindTexture(e,t(i)))}}},15976(e,t,r){r.d(t,{o:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"sampler2D",2,(i,n,o)=>i.bindTexture(e,t(n,o),r?.(n,o)))}}},63761(e,t,r){r.d(t,{N:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",1,(r,i,n)=>r.bindTexture(e,t(i,n)))}}},31821(e,t,r){r.d(t,{H:()=>i,If:()=>n});const i=(e,...t)=>{let r="";for(let i=0;i<t.length;i++)r+=e[i]+t[i];return r+=e[e.length-1],r};function n(e,t,r=""){return e?t:r}i.int=e=>e.toFixed(),i.uint=e=>`${Math.max(0,e).toFixed()}u`,i.hexuint=e=>`0x${Math.round(Math.max(0,e)).toString(16)}u`,i.float=e=>e.toPrecision(8)},13840(e,t,r){r.d(t,{r:()=>i});class i{constructor(e,t){this._module=e,this._load=t}get(){return this._module}async reload(){return this._module=await this._load(),this._module}}},42958(e,t,r){r.d(t,{w:()=>m});var i=r(5482),n=r(69622),o=r(53966),s=r(91429),a=r(63907),c=r(85079),l=r(74038);new l._("position",3,a.pe.FLOAT,0,12);const u=[new l._("position",2,a.pe.FLOAT,0,8)];(0,c.Xk)(u),new l._("position",2,a.pe.FLOAT,0,12),new l._("uv0",2,a.pe.HALF_FLOAT,8,12),new l._("position",2,a.pe.FLOAT,0,16),new l._("uv0",2,a.pe.FLOAT,8,16),r(44208);var h=r(26857),d=r(94656);class f{constructor(e,t,r){this._context=e,this.locations=r,this._textures=new Map,this.source=(0,d.en)()?t:null,t.attributeNames.forEach(e=>{r.has(e)||o.A.getLogger("esri.views.3d.webgl-engine.lib.Program").error(`Missing VertexAttributeLocation for ${e} used in shader`)}),this._glProgram=e.programCache.get(t.generate("vertex",!0),t.generate("fragment",!0),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=t.generateBind(this),this.bindPass=t.generateBindPass(this),this.bindDraw=t.generateBindDraw(this)}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,r){this._glProgram.setUniform1f(e,t,r)}setUniform2fv(e,t,r){this._glProgram.setUniform2fv(e,t,r)}setUniform3fv(e,t,r){this._glProgram.setUniform3fv(e,t,r)}setUniform4fv(e,t,r){this._glProgram.setUniform4fv(e,t,r)}setUniformMatrix3fv(e,t,r){this._glProgram.setUniformMatrix3fv(e,t,!1,r)}setUniformMatrix4fv(e,t,r){this._glProgram.setUniformMatrix4fv(e,t,!1,r)}setUniformMatrices4fv(e,t,r){this._glProgram.setUniformMatrices4fv(e,t,!1,r)}setUniform1fv(e,t,r){this._glProgram.setUniform1fv(e,t,r)}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,t){if(h.b.ENABLE_OPTIMIZATIONS)return;let r=e.locations;if(t){const e=new Map(r);t.forEach((t,i)=>e.set(i,r.size+t)),r=e}r.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${r}, ${this.locations}`),this.locations.forEach((e,t)=>{r.get(t)!==e&&console.error(`VertexAttributeLocations are incompatible: Program has ${t} at position ${e}, VAO has it at position ${r.get(t)}.`)})}stop(){this._textures.clear()}bindTexture(e,t,r){if(!t?.glName){const r=`Texture sampler ${e} in ${this._context.debugBoundTechnique} has no given Texture in ${(new Error).stack}`;(0,d.en)()&&console.error(r),t=this._context.emptyTexture}const i=this._ensureTextureUnit(e,t);this._context.useProgram(this);const n=i.unit;this.setUniform1i(e,n),this._context.bindTexture(t,n,!1,r)}_ensureTextureUnit(e,t){let r=this._textures.get(e);return null==r?(r={texture:t,unit:this._textures.size},this._textures.set(e,r)):r.texture=t,r}}var p=r(90644);let m=class extends n.A{constructor(e,t,r){super({}),this._context=e,this._configuration=t,this.primitiveType=a.WR.TRIANGLES,this._unused=!0,this.ignoreUnused=!1,this.key=t.key,this.locations=(0,c.Xk)(r??u),this._pipeline=this.initializePipeline(t),this.reload=async r=>{if(r&&await this.shader.reload(),!this.key.equals(t.key))return void o.A.getLogger("esri.views.3d.webgl.ShaderTechnique").warn(`Configuration was changed after construction, cannot reload shader for ${this.declaredClass}.`);const i=this.shader.get().build(t);i.debugName=this.declaredClass,this._program=new f(e.rctx,i,this.locations),this._pipeline=this.initializePipeline(t)}}initialize(){const e=this.shader.get().build(this._configuration);e.debugName=this.declaredClass,this._program=new f(this._context.rctx,e,this.locations)}get program(){return this._unused=!1,this._program}get compiled(){return this._unused=!1,this.program.compiled}get unused(){return this._unused}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}getPipeline(e,t){return this._pipeline}initializePipeline(e){return(0,p.Ey)({blending:p.RC,colorWrite:p.kn})}};m=(0,i.Cg)([(0,s.$K)("esri.views.3d.webgl-engine.core.shaderTechnique.ShaderTechnique")],m)},51976(e,t,r){r.d(t,{K:()=>a,W:()=>c});var i=r(49186),n=r(4576);class o{constructor(e){this._bits=[...e]}equals(e){return(0,n.aI)(this._bits,e.bits)}get code(){return this._code??=String.fromCharCode(...this._bits),this._code}get bits(){return this._bits}}var s=r(65786);class a extends s.Y{constructor(){super(),this._parameterBits=this._parameterBits?.map(()=>0)??[],this._parameterNames??=[]}get key(){return this._key??=new o(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map(e=>` ${e}: ${this[e]}`).join("\n");return this._parameterBits=t,r}}function c(e={}){return(t,r)=>{t.hasOwnProperty("_parameterNames")||Object.defineProperty(t,"_parameterNames",{value:t._parameterNames?.slice()??[],configurable:!0,writable:!0}),t.hasOwnProperty("_parameterBits")||Object.defineProperty(t,"_parameterBits",{value:t._parameterBits?.slice()??[0],configurable:!0,writable:!0}),t._parameterNames.push(r);const n=e.count||2,o=Math.ceil(Math.log2(n)),s=t._parameterBits;let a=0;for(;s[a]+o>16;)a++,a>=s.length&&s.push(0);const c=s[a],l=(1<<o)-1<<c;s[a]+=o,e.count?Object.defineProperty(t,r,{get(){return(this._parameterBits[a]&l)>>c},set(t){const n=this._parameterBits[a];if((n&l)>>c!==t){if(this._key=null,this._parameterBits[a]=n&~l|+t<<c&l,"number"!=typeof t)throw new i.A("internal:invalid-shader-configuration",`Configuration value for ${r} must be a number, got ${typeof t}`);if(null==e.count)throw new i.A("internal:invalid-shader-configuration",`Configuration value for ${r} must provide a count option`)}}}):Object.defineProperty(t,r,{get(){return!!((this._parameterBits[a]&l)>>c)},set(e){const t=this._parameterBits[a];if(!!((t&l)>>c)!==e&&(this._key=null,this._parameterBits[a]=t&~l|+e<<c,"boolean"!=typeof e))throw new i.A("internal:invalid-shader-configurationx",`Configuration value for ${r} must be boolean, got ${typeof e}`)}})}}},16943(e,t,r){r.d(t,{E:()=>n});var i=r(44208);function n(){return!!(0,i.A)("enable-feature:objectAndLayerId-rendering")}},27832(e,t,r){r.d(t,{b:()=>o});var i=r(33094),n=r(31821);function o(e,t){t.snowCover&&(e.uniforms.add(new i.U("snowCover",e=>e.snowCover)).code.add(n.H`float getSnow(vec3 normal, vec3 groundNormal) {
1010
1017
  return smoothstep(0.5, 0.55, dot(normal, groundNormal)) * snowCover;
1011
1018
  }
1012
1019
  float getRealisticTreeSnow(vec3 faceNormal, vec3 shadingNormal, vec3 groundNormal) {
@@ -1016,19 +1023,19 @@ smoothstep(0.0, 0.1, dot(shadingNormal, groundNormal)));
1016
1023
  return snow * snowCover;
1017
1024
  }`),e.code.add(n.H`vec3 applySnowToMRR(vec3 mrr, float snow) {
1018
1025
  return mix(mrr, vec3(0.0, 1.0, 0.04), snow);
1019
- }`))}},49718(e,t,r){r(51850),r(6867).i},6867(e,t,r){r.d(t,{i:()=>u});var i=r(58083),n=r(9093),o=r(35522),s=r(51850),a=r(78955),c=r(91829),l=r(71351);class u{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:((0,o.hs)(d,this.ray.direction,this.distance),(0,o.Bw)(d))}withinDistance(e){return!!h(this)&&this.distanceInRenderSpace<=e}getIntersectionPoint(e){return!!h(this)&&((0,o.hs)(d,this.ray.direction,this.distance),(0,o.WQ)(e,this.ray.origin,d),!0)}getTransformedNormal(e){return(0,o.C)(f,this.normal),f[3]=0,(0,a.Z0)(f,f,this.transformation),(0,o.C)(e,f),(0,o.S8)(e,e)}constructor(e){this.intersector=4,this.normal=(0,s.vt)(),this.transformation=(0,n.vt)(),this._ray=(0,l.vt)(),this.init(e)}init(e){this.distance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4,(0,l.C)(e,this._ray)}set(e,t,r,a,c,l,u){this.intersector=e,this.distance=r,(0,o.C)(this.normal,a??s.Cb),(0,i.C)(this.transformation,c??n.zK),this.target=t,this.drapedLayerOrder=l,this.renderPriority=u}copy(e){(0,l.C)(e.ray,this._ray),this.intersector=e.intersector,this.distance=e.distance,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.renderPriority=e.renderPriority,(0,o.C)(this.normal,e.normal),(0,i.C)(this.transformation,e.transformation)}}function h(e){return null!=e?.distance}const d=(0,s.vt)(),f=(0,c.vt)()},16396(e,t,r){r.d(t,{ou:()=>c}),r(77690),r(29242),r(58083),r(9093);var i=r(35522),n=r(51850),o=r(94008),s=r(57005);const a=new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,n.vt)(),this._tmpSphere=new o.iy}applyToVertex(e,t,r){const n=this.objectTransform.transform,o=(0,i.hZ)(l,e,t,r),s=(0,i.Z0)(o,o,n),a=this.offset/(0,i.Bw)(s);(0,i.Ln)(s,s,s,a);const c=this.objectTransform.inverse;return(0,i.Z0)(this.tmpVertex,s,c),this.tmpVertex}applyToMinMax(e,t){const r=this.offset/(0,i.Bw)(e);(0,i.Ln)(e,e,e,r);const n=this.offset/(0,i.Bw)(t);(0,i.Ln)(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=e.center,r=(0,i.Bw)(t),n=this.offset/r;return(0,i.Ln)(this._tmpSphere.center,t,t,n),this._tmpSphere.radius=e.radius+e.radius*this.offset/r,this._tmpSphere}};function c(e){return null!=e?(a.offset=e,a):null}new class{constructor(e=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpVertex=(0,n.vt)(),this._tmpMbs=new o.iy,this._tmpObb=new s.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,i.Bw)(e)}applyToVertex(e,t,r){const n=(0,i.hZ)(l,e,t,r),o=(0,i.hZ)(u,e,t,r+this.componentLocalOriginLength),s=this._totalOffset/(0,i.Bw)(o);return(0,i.Ln)(this._tmpVertex,n,o,s),this._tmpVertex}applyToAabb(e){const t=this.componentLocalOriginLength,r=e[0],i=e[1],n=e[2]+t,o=e[3],s=e[4],a=e[5]+t,c=Math.abs(r),l=Math.abs(i),u=Math.abs(n),h=Math.abs(o),d=Math.abs(s),f=Math.abs(a),m=.5*(1+Math.sign(r*o))*Math.min(c,h),p=.5*(1+Math.sign(i*s))*Math.min(l,d),g=.5*(1+Math.sign(n*a))*Math.min(u,f),v=Math.max(c,h),_=Math.max(l,d),x=Math.max(u,f),y=Math.sqrt(m*m+p*p+g*g),w=Math.sign(c+r),b=Math.sign(l+i),T=Math.sign(u+n),M=Math.sign(h+o),S=Math.sign(d+s),C=Math.sign(f+a),E=this._totalOffset;if(y<E)return e[0]-=(1-w)*E,e[1]-=(1-b)*E,e[2]-=(1-T)*E,e[3]+=M*E,e[4]+=S*E,e[5]+=C*E,e;const A=E/Math.sqrt(v*v+_*_+x*x),R=E/y,I=R-A,O=-I;return e[0]+=r*(w*O+R),e[1]+=i*(b*O+R),e[2]+=n*(T*O+R),e[3]+=o*(M*I+A),e[4]+=s*(S*I+A),e[5]+=a*(C*I+A),e}applyToMbs(e){const t=e.center,r=(0,i.Bw)(t),n=this._totalOffset/r;return(0,i.Ln)(this._tmpMbs.center,t,t,n),this._tmpMbs.radius=e.radius+e.radius*this._totalOffset/r,this._tmpMbs}applyToObb(e){return(0,s.gm)(e,this._totalOffset,this._totalOffset,1,this._tmpObb),this._tmpObb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,n.vt)()}applyToVertex(e,t,r){const n=(0,i.hZ)(l,e,t,r),o=(0,i.WQ)(u,n,this.localOrigin),s=this.offset/(0,i.Bw)(o);return(0,i.Ln)(this.tmpVertex,n,o,s),this.tmpVertex}applyToAabb(e){const t=h,r=d,i=f;for(let n=0;n<3;++n)t[n]=e[0+n]+this.localOrigin[n],r[n]=e[3+n]+this.localOrigin[n],i[n]=t[n];const n=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=n[t],e[t+3]=n[t];const o=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 n=0;n<3;++n)i[n]=e&1<<n?r[n]:t[n];o(i)}let s=0;for(let e=0;e<3;++e)t[e]*r[e]<0&&(s|=1<<e);if(0!==s&&7!==s)for(let e=0;e<8;++e)if(0===(s&e)){for(let n=0;n<3;++n)i[n]=s&1<<n?0:e&1<<n?t[n]:r[n];o(i)}for(let t=0;t<3;++t)e[t]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const l=(0,n.vt)(),u=(0,n.vt)(),h=(0,n.vt)(),d=(0,n.vt)(),f=(0,n.vt)()},19245(e,t,r){r.d(t,{Um:()=>c,MB:()=>a,kE:()=>o});var i=r(4576),n=r(34727);r(44208);function o(e,t,r,i,o,s){let a=r.screenLength*e.pixelRatio;null!=o&&(l.update(i,t,o,s),a=l.apply(a));const c=a*Math.tan(.5*e.fovY)/(.5*e.fullHeight);return(0,n.qE)(c*t,r.minWorldLength,r.maxWorldLength)}const s=(0,i.VO)();function a(e,t){let r=!1;for(const i in t){const n=t[i];void 0!==n&&(Array.isArray(n)?Array.isArray(e[i])&&s(n,e[i])||(e[i]=n.slice(),r=!0):e[i]!==n&&(r=!0,e[i]=n))}return r}const c={multiply:1,ignore:2,replace:3,tint:4},l=new class{constructor(){this._scale=0,this._angleFactor=0,this._minScale=0}update(e,t,r,i){r?(this._scale=Math.min(r.divisor/(t-r.offset),1),this._angleFactor=function(e){return Math.abs(e)**3}(e),this._minScale=null!=i?Math.min(r.minPixelSize/i,1):0):(this._scale=1,this._minScale=1,this._angleFactor=1)}apply(e){const{_scale:t,_angleFactor:r,_minScale:i}=this;return e*(0,n.qE)((0,n.Cc)(t,1,r),i,1)}applyVec2(e,t){e[0]=this.apply(t[0]),e[1]=this.apply(t[1])}}},74810(e,t,r){r.d(t,{Bt:()=>a,Jr:()=>o,SY:()=>c,mb:()=>s});var i=r(35522),n=r(51850);function o({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:o,emissiveTexture:s,emissiveFactor:a,occlusionTexture:c}){return null==e&&null==t&&null==s&&(null==a||(0,i.t2)(a,n.uY))&&null==c&&(null==o||1===o)&&(null==r||1===r)}const s=(0,n.CN)(1,1,.5),a=(0,n.CN)(0,.6,.2),c=(0,n.CN)(0,1,.2)},3190(e,t,r){r.d(t,{D:()=>h});var i=r(49255),n=r(22911),o=r(42593),s=r(63365),a=r(31821),c=r(26934);function l(e,t){t.useFloatBlend?e.code.add(a.H`float ditherNoise() { return 0.0; }`):e.code.add(a.H`float ditherNoise() {
1026
+ }`))}},49718(e,t,r){r(51850),r(6867).i},6867(e,t,r){r.d(t,{i:()=>u});var i=r(58083),n=r(9093),o=r(35522),s=r(51850),a=r(78955),c=r(91829),l=r(71351);class u{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:((0,o.hs)(d,this.ray.direction,this.distance),(0,o.Bw)(d))}withinDistance(e){return!!h(this)&&this.distanceInRenderSpace<=e}getIntersectionPoint(e){return!!h(this)&&((0,o.hs)(d,this.ray.direction,this.distance),(0,o.WQ)(e,this.ray.origin,d),!0)}getTransformedNormal(e){return(0,o.C)(f,this.normal),f[3]=0,(0,a.Z0)(f,f,this.transformation),(0,o.C)(e,f),(0,o.S8)(e,e)}constructor(e){this.intersector=4,this.normal=(0,s.vt)(),this.transformation=(0,n.vt)(),this._ray=(0,l.vt)(),this.init(e)}init(e){this.distance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4,(0,l.C)(e,this._ray)}set(e,t,r,a,c,l,u){this.intersector=e,this.distance=r,(0,o.C)(this.normal,a??s.Cb),(0,i.C)(this.transformation,c??n.zK),this.target=t,this.drapedLayerOrder=l,this.renderPriority=u}copy(e){(0,l.C)(e.ray,this._ray),this.intersector=e.intersector,this.distance=e.distance,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.renderPriority=e.renderPriority,(0,o.C)(this.normal,e.normal),(0,i.C)(this.transformation,e.transformation)}}function h(e){return null!=e?.distance}const d=(0,s.vt)(),f=(0,c.vt)()},16396(e,t,r){r.d(t,{ou:()=>c}),r(77690),r(29242),r(58083),r(9093);var i=r(35522),n=r(51850),o=r(94008),s=r(57005);const a=new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,n.vt)(),this._tmpSphere=new o.iy}applyToVertex(e,t,r){const n=this.objectTransform.transform,o=(0,i.hZ)(l,e,t,r),s=(0,i.Z0)(o,o,n),a=this.offset/(0,i.Bw)(s);(0,i.Ln)(s,s,s,a);const c=this.objectTransform.inverse;return(0,i.Z0)(this.tmpVertex,s,c),this.tmpVertex}applyToMinMax(e,t){const r=this.offset/(0,i.Bw)(e);(0,i.Ln)(e,e,e,r);const n=this.offset/(0,i.Bw)(t);(0,i.Ln)(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=e.center,r=(0,i.Bw)(t),n=this.offset/r;return(0,i.Ln)(this._tmpSphere.center,t,t,n),this._tmpSphere.radius=e.radius+e.radius*this.offset/r,this._tmpSphere}};function c(e){return null!=e?(a.offset=e,a):null}new class{constructor(e=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpVertex=(0,n.vt)(),this._tmpMbs=new o.iy,this._tmpObb=new s.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,i.Bw)(e)}applyToVertex(e,t,r){const n=(0,i.hZ)(l,e,t,r),o=(0,i.hZ)(u,e,t,r+this.componentLocalOriginLength),s=this._totalOffset/(0,i.Bw)(o);return(0,i.Ln)(this._tmpVertex,n,o,s),this._tmpVertex}applyToAabb(e){const t=this.componentLocalOriginLength,r=e[0],i=e[1],n=e[2]+t,o=e[3],s=e[4],a=e[5]+t,c=Math.abs(r),l=Math.abs(i),u=Math.abs(n),h=Math.abs(o),d=Math.abs(s),f=Math.abs(a),p=.5*(1+Math.sign(r*o))*Math.min(c,h),m=.5*(1+Math.sign(i*s))*Math.min(l,d),g=.5*(1+Math.sign(n*a))*Math.min(u,f),v=Math.max(c,h),_=Math.max(l,d),x=Math.max(u,f),w=Math.sqrt(p*p+m*m+g*g),y=Math.sign(c+r),b=Math.sign(l+i),T=Math.sign(u+n),M=Math.sign(h+o),S=Math.sign(d+s),C=Math.sign(f+a),E=this._totalOffset;if(w<E)return e[0]-=(1-y)*E,e[1]-=(1-b)*E,e[2]-=(1-T)*E,e[3]+=M*E,e[4]+=S*E,e[5]+=C*E,e;const A=E/Math.sqrt(v*v+_*_+x*x),R=E/w,I=R-A,O=-I;return e[0]+=r*(y*O+R),e[1]+=i*(b*O+R),e[2]+=n*(T*O+R),e[3]+=o*(M*I+A),e[4]+=s*(S*I+A),e[5]+=a*(C*I+A),e}applyToMbs(e){const t=e.center,r=(0,i.Bw)(t),n=this._totalOffset/r;return(0,i.Ln)(this._tmpMbs.center,t,t,n),this._tmpMbs.radius=e.radius+e.radius*this._totalOffset/r,this._tmpMbs}applyToObb(e){return(0,s.gm)(e,this._totalOffset,this._totalOffset,1,this._tmpObb),this._tmpObb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,n.vt)()}applyToVertex(e,t,r){const n=(0,i.hZ)(l,e,t,r),o=(0,i.WQ)(u,n,this.localOrigin),s=this.offset/(0,i.Bw)(o);return(0,i.Ln)(this.tmpVertex,n,o,s),this.tmpVertex}applyToAabb(e){const t=h,r=d,i=f;for(let n=0;n<3;++n)t[n]=e[0+n]+this.localOrigin[n],r[n]=e[3+n]+this.localOrigin[n],i[n]=t[n];const n=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=n[t],e[t+3]=n[t];const o=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 n=0;n<3;++n)i[n]=e&1<<n?r[n]:t[n];o(i)}let s=0;for(let e=0;e<3;++e)t[e]*r[e]<0&&(s|=1<<e);if(0!==s&&7!==s)for(let e=0;e<8;++e)if(0===(s&e)){for(let n=0;n<3;++n)i[n]=s&1<<n?0:e&1<<n?t[n]:r[n];o(i)}for(let t=0;t<3;++t)e[t]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const l=(0,n.vt)(),u=(0,n.vt)(),h=(0,n.vt)(),d=(0,n.vt)(),f=(0,n.vt)()},19245(e,t,r){r.d(t,{Um:()=>c,MB:()=>a,kE:()=>o});var i=r(4576),n=r(34727);r(44208);function o(e,t,r,i,o,s){let a=r.screenLength*e.pixelRatio;null!=o&&(l.update(i,t,o,s),a=l.apply(a));const c=a*Math.tan(.5*e.fovY)/(.5*e.fullHeight);return(0,n.qE)(c*t,r.minWorldLength,r.maxWorldLength)}const s=(0,i.VO)();function a(e,t){let r=!1;for(const i in t){const n=t[i];void 0!==n&&(Array.isArray(n)?Array.isArray(e[i])&&s(n,e[i])||(e[i]=n.slice(),r=!0):e[i]!==n&&(r=!0,e[i]=n))}return r}const c={multiply:1,ignore:2,replace:3,tint:4},l=new class{constructor(){this._scale=0,this._angleFactor=0,this._minScale=0}update(e,t,r,i){r?(this._scale=Math.min(r.divisor/(t-r.offset),1),this._angleFactor=function(e){return Math.abs(e)**3}(e),this._minScale=null!=i?Math.min(r.minPixelSize/i,1):0):(this._scale=1,this._minScale=1,this._angleFactor=1)}apply(e){const{_scale:t,_angleFactor:r,_minScale:i}=this;return e*(0,n.qE)((0,n.Cc)(t,1,r),i,1)}applyVec2(e,t){e[0]=this.apply(t[0]),e[1]=this.apply(t[1])}}},74810(e,t,r){r.d(t,{Bt:()=>a,Jr:()=>o,SY:()=>c,mb:()=>s});var i=r(35522),n=r(51850);function o({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:o,emissiveTexture:s,emissiveFactor:a,occlusionTexture:c}){return null==e&&null==t&&null==s&&(null==a||(0,i.t2)(a,n.uY))&&null==c&&(null==o||1===o)&&(null==r||1===r)}const s=(0,n.CN)(1,1,.5),a=(0,n.CN)(0,.6,.2),c=(0,n.CN)(0,1,.2)},3190(e,t,r){r.d(t,{D:()=>h});var i=r(49255),n=r(22911),o=r(42593),s=r(63365),a=r(31821),c=r(26934);function l(e,t){t.useFloatBlend?e.code.add(a.H`float ditherNoise() { return 0.0; }`):e.code.add(a.H`float ditherNoise() {
1020
1027
  return (1.0 / 255.0) * (fract(52.9829189 * fract(dot(gl_FragCoord.xy + gl_FragCoord.z, vec2(0.06711056, 0.00583715)))) - 0.5);
1021
- }`)}var u=r(66211);function h(e,t){e.include(o.Q,t),e.include(n.NL,t);const{fragment:r,outputs:h}=e;r.include(s.a);const{output:d,hasEmission:f,discardInvisibleFragments:m,oitPremultipliedAlpha:p,snowCover:g}=t,v=11===d,_=(0,i.Sp)(d),x=(0,i.Rb)(d),y=(0,i._o)(d)&&!_;let w=0;(y||_)&&h.add("fragColor","vec4",w++),f&&h.add("fragEmission","vec4",w++),_&&h.add("fragAlpha","float",w++),r.include(c.Q),r.include(u.H,t),r.include(l,t),r.code.add(a.H`
1028
+ }`)}var u=r(66211);function h(e,t){e.include(o.Q,t),e.include(n.NL,t);const{fragment:r,outputs:h}=e;r.include(s.a);const{output:d,hasEmission:f,discardInvisibleFragments:p,oitPremultipliedAlpha:m,snowCover:g}=t,v=11===d,_=(0,i.Sp)(d),x=(0,i.Rb)(d),w=(0,i._o)(d)&&!_;let y=0;(w||_)&&h.add("fragColor","vec4",y++),f&&h.add("fragEmission","vec4",y++),_&&h.add("fragAlpha","float",y++),r.include(c.Q),r.include(u.H,t),r.include(l,t),r.code.add(a.H`
1022
1029
  void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${(0,a.If)(g,", float snow")}) {
1023
1030
  ${(0,a.If)(v,"finalColor.a = 1.0;")}
1024
- ${(0,a.If)(m,"if (finalColor.a < alphaCutoff) { discard; }")}
1031
+ ${(0,a.If)(p,"if (finalColor.a < alphaCutoff) { discard; }")}
1025
1032
  ${(0,a.If)(_||f,"float noise = ditherNoise();")}
1026
1033
 
1027
- ${(0,a.If)(_,`fragColor = ${(0,a.If)(p,"finalColor","premultiplyAlpha(finalColor)")};\n fragColor = vec4(fragColor.rgb * floatBlendOutputScale + noise, fragColor.a);\n fragAlpha = finalColor.a * floatBlendOutputScale + noise;`)}
1028
- ${(0,a.If)(x&&p&&m,"finalColor.rgb /= finalColor.a;")}
1029
- ${(0,a.If)(y,"fragColor = finalColor;")}
1034
+ ${(0,a.If)(_,`fragColor = ${(0,a.If)(m,"finalColor","premultiplyAlpha(finalColor)")};\n fragColor = vec4(fragColor.rgb * floatBlendOutputScale + noise, fragColor.a);\n fragAlpha = finalColor.a * floatBlendOutputScale + noise;`)}
1035
+ ${(0,a.If)(x&&m&&p,"finalColor.rgb /= finalColor.a;")}
1036
+ ${(0,a.If)(w,"fragColor = finalColor;")}
1030
1037
  ${(0,a.If)(f,`fragEmission = ${(0,a.If)(g,"mix(finalColor.a * getEmissions(emissiveSymbolColor), vec4(0.0), snow);","finalColor.a * getEmissions(emissiveSymbolColor);")}\n fragEmission = vec4(fragEmission.rgb * floatBlendOutputScale + noise, fragEmission.a);`)}
1031
1038
  calculateOcclusionAndOutputHighlight();
1032
1039
  ${(0,a.If)(v,"outputObjectAndLayerIdColor();")}
1033
1040
  }
1034
- `)}},26934(e,t,r){r.d(t,{Q:()=>n});var i=r(49788);function n(e){e.constants.add("alphaCutoff","float",i.Q)}},66211(e,t,r){function i(e,t){t.useFloatBlend?(e.constants.add("floatBlendOutputScale","float",1),e.constants.add("floatBlendInputScale","float",1)):(e.constants.add("floatBlendOutputScale","float",1/n),e.constants.add("floatBlendInputScale","float",n))}r.d(t,{H:()=>i,m:()=>n});const n=16},48852(e,t,r){r.d(t,{g:()=>h});var i=r(4576),n=r(44208),o=r(53966),s=r(34275),a=r(94656),c=r(63907);const l=()=>o.A.getLogger("esri.views.webgl.BufferObject"),u=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements");class h{static createIndex(e,t,r){return new h(e,34963,t,r)}static createUniform(e,t,r){return new h(e,35345,t,r)}static createPixelPack(e,t=35041,r){const i=new h(e,35051,t);return r&&i.setSize(r),i}static createPixelUnpack(e,t=35040,r){return new h(e,35052,t,r)}static createTransformFeedback(e,t=35044,r){const i=new h(e,35982,t);return i.setSize(r),i}constructor(e,t,r,i){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._sizeBytes=-1,this._indexType=void 0,e.instanceCounter.increment(c.vt.BufferObject,this),this._glName=this._context.gl.createBuffer(),(0,a.Y2)(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){if(34963===this.bufferType)switch(this._indexType){case c.pe.UNSIGNED_INT:return this._sizeBytes/4;case c.pe.UNSIGNED_SHORT:return this._sizeBytes/2;case c.pe.UNSIGNED_BYTE:case void 0:case null:break;default:this._indexType}return this._sizeBytes}get indexType(){return this._indexType}get sizeBytes(){return this._sizeBytes}get usedMemory(){return u?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){this._context?.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(c.vt.BufferObject,this),this._context=null):this._glName&&l().warn("Leaked WebGL buffer object")}setSize(e,t=null){if(34963===this.bufferType&&null!=t)switch(this._indexType=t,t){case c.pe.UNSIGNED_SHORT:e*=2;break;case c.pe.UNSIGNED_INT:e*=4;case c.pe.UNSIGNED_BYTE:}this._setBufferData(e)}setData(e){if(!e)return;const t=e.byteLength;34963===this.bufferType&&((0,s.mg)(e)?this._indexType=c.pe.UNSIGNED_BYTE:(0,s.jq)(e)?this._indexType=c.pe.UNSIGNED_SHORT:(0,s.XJ)(e)&&(this._indexType=c.pe.UNSIGNED_INT)),this._setBufferData(t,e)}setIndexType(e){34963===this.bufferType&&(this._indexType=e)}_setBufferData(e,t=null){this._sizeBytes=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=t?i.bufferData(this.bufferType,t,this.usage):i.bufferData(this.bufferType,e,this.usage),(0,a.Y2)(i),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,t,r,i){if(!e)return;const n=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:o}=this._context;o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,e,r,i-r),(0,a.Y2)(o),this._isVAOAware&&this._context.bindVAO(n)}getSubData(e,t=0,r,n){if(r<0||n<0)return;const o=function(e){return(0,i.Xj)(e)}(e)?e.BYTES_PER_ELEMENT:1;if(o*((r??0)+(n??0))>e.byteLength)return;t+o*(n??0)>this.usedMemory&&l().warn("Potential problem getting subdata: requested data exceeds buffer size!");const s=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),s.getBufferSubData(35982,t,e,r,n),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),s.getBufferSubData(36662,t,e,r,n),this._context.unbindBuffer(36662))}async getSubDataAsync(e,t=0,r,i){await this._context.clientWaitAsync(),this.getSubData(e,t,r,i)}}},65786(e,t,r){r.d(t,{Y:()=>i});const i=class{};new i},14113(e,t,r){r.d(t,{N5:()=>a});var i=r(49186),n=(r(44208),r(53966));const o=()=>n.A.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");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 a extends s{constructor(){super(...arguments),this.vertex=new h,this.fragment=new h,this.attributes=new d,this.varyings=new f,this.outputs=new m}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),i=this.varyings.generateSource(e),n="vertex"===e?this.vertex:this.fragment,o=n.uniforms.generateSource(),s=n.code.generateSource(),a=n.main.generateSource(t),c=this.debugName?`// ${this.debugName}\n`:"",l="vertex"===e?v:g,u=n.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${c}\n${l}\n${u.join("\n")}\n${o.join("\n")}\n${r.join("\n")}\n${i.join("\n")}\n${h.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return t=>{for(let n=0;n<i;++n)r[n](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n)=>{for(let o=0;o<i;++o)r[o](e,t,n)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n,o)=>{for(let s=0;s<i;++s)r[s](e,o,t,n)}}}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 i.A("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else o().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class l{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(e){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(e)throw new i.A("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}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 l(this),this.code=new u(this),this.constants=new p(this)}get builder(){return this}}class d{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]};`)}get names(){return this._entries.map(([e])=>e)}}class f{constructor(){this._entries=new Map}add(e,t,r){this._entries.has(e)?o().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:r?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,i)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${i};`)),t}}class m{constructor(){this._entries=new Map}add(e,t,r=0){const i=this._entries.get(r);i?.name!==e||i?.type!==t?this._entries.set(r,{name:e,type:t}):o().warn(`Fragment shader output location ${r} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:m.DEFAULT_NAME,type:m.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class p{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let i="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":i=p._numberToFloatStr(r);break;case"int":i=p._numberToIntStr(r);break;case"uint":i=p._numberToUintStr(r);break;case"bool":i=r.toString();break;case"vec2":i=`vec2(${p._numberToFloatStr(r[0])}, ${p._numberToFloatStr(r[1])})`;break;case"vec3":i=`vec3(${p._numberToFloatStr(r[0])}, ${p._numberToFloatStr(r[1])}, ${p._numberToFloatStr(r[2])})`;break;case"vec4":i=`vec4(${p._numberToFloatStr(r[0])}, ${p._numberToFloatStr(r[1])}, ${p._numberToFloatStr(r[2])}, ${p._numberToFloatStr(r[3])})`;break;case"ivec2":i=`ivec2(${p._numberToIntStr(r[0])}, ${p._numberToIntStr(r[1])})`;break;case"ivec3":i=`ivec3(${p._numberToIntStr(r[0])}, ${p._numberToIntStr(r[1])}, ${p._numberToIntStr(r[2])})`;break;case"ivec4":i=`ivec4(${p._numberToIntStr(r[0])}, ${p._numberToIntStr(r[1])}, ${p._numberToIntStr(r[2])}, ${p._numberToIntStr(r[3])})`;break;case"uvec2":i=`uvec2(${p._numberToUintStr(r[0])}, ${p._numberToUintStr(r[1])})`;break;case"uvec3":i=`uvec3(${p._numberToUintStr(r[0])}, ${p._numberToUintStr(r[1])}, ${p._numberToUintStr(r[2])})`;break;case"uvec4":i=`uvec4(${p._numberToUintStr(r[0])}, ${p._numberToUintStr(r[1])}, ${p._numberToUintStr(r[2])}, ${p._numberToUintStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":i=`${t}(${Array.prototype.map.call(r,e=>p._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${i};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToUintStr(e){return`${e.toFixed(0)}u`}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const g="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",v="precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n "},76284(e,t,r){r.d(t,{A:()=>M});var i=r(49186),n=r(44208),o=r(53966),s=r(97768),a=r(93637),c=r(17676),l=r(94656),u=r(63907),h=r(67171);const d=()=>o.A.getLogger("esri/views/webgl/textureUtils");function f(e){const{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&d().error("Negative dimension parameters are not allowed!");const{internalFormat:n}=e;if(n&&(m(n)||p(n))){const{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:n}=e;n&&d().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&d().error("Depth textures cannot sample mipmaps"):(9728!==i&&d().error("Depth textures without filtering must use NEAREST filtering"),r&&d().error("Depth textures without filtering cannot use compare function"))}}function m(e){return(0,a.a4)(u.SB,e)}function p(e){return(0,a.a4)(u.iE,e)}function g(e){return null!=e&&"type"in e&&"compressed"===e.type}function v(e){return null!=e&&!g(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function x(e,t,r,i=1){let n=Math.max(t,r);return 32879===e&&(n=Math.max(n,i)),Math.floor(Math.log2(n))+1}function y(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case u.ld.FLOAT:switch(e.pixelFormat){case 6408:return u.H0.RGBA32F;case 6407:return u.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case u.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return u.H0.RGBA8;case 6407:return u.H0.RGB8}}const{pixelFormat:t}=e;return e.internalFormat=34041===t?u.iE.DEPTH24_STENCIL8:6402===t?u.SB.DEPTH_COMPONENT24:t,e.internalFormat}class w extends h.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case u.H0.R16F:case u.H0.R32F:case u.H0.R8_SNORM:case u.H0.R8:this.pixelFormat=6403;break;case u.H0.R8I:case u.H0.R8UI:case u.H0.R16I:case u.H0.R16UI:case u.H0.R32I:case u.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new w(e,t)}}const b=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements"),T=()=>o.A.getLogger("esri/views/webgl/Texture");class M{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,t=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=t;else{const r=w.validate(e,t);if(!r)throw new i.A("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:(0,h.e)(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(u.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){const r=this._descriptor;if(r.width!==e||r.height!==t){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=t,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!g(e)&&this._descriptor.internalFormat&&(0,a.a4)(u.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!g(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(e,t,r,n,o,s,a=0){s||T().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||T().error("An attempt to update uninitialized texture!");const c=this._descriptor;c.internalFormat=y(c);const{context:l,pixelFormat:u,dataType:h,target:d,isImmutable:f}=c;if(f&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");const m=l.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES,!0);(t<0||r<0||t+n>c.width||r+o>c.height)&&T().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:p}=l;a&&(n&&o||T().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),p.pixelStorei(p.UNPACK_SKIP_ROWS,a)),v(s)?p.texSubImage2D(d,e,t,r,n,o,u,h,s):g(s)?p.compressedTexSubImage2D(d,e,t,r,n,o,c.internalFormat,s.levels[e]):p.texSubImage2D(d,e,t,r,n,o,u,h,s),a&&p.pixelStorei(p.UNPACK_SKIP_ROWS,0),l.bindTexture(m,M.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,t,r,n,o,s,a,c){c||T().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||T().error("An attempt to update an uninitialized texture!");const l=this._descriptor;l.internalFormat=y(l);const{context:u,pixelFormat:h,dataType:d,isImmutable:f,target:m}=l;if(f&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");_(m)||T().warn("Attempting to set 3D texture data on a non-3D texture");const p=u.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);u.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),(t<0||r<0||n<0||t+o>l.width||r+s>l.height||n+a>l.depth)&&T().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:v}=u;if(g(c))c=c.levels[e],v.compressedTexSubImage3D(m,e,t,r,n,o,s,a,l.internalFormat,c);else{const i=c;v.texSubImage3D(m,e,t,r,n,o,s,a,h,d,i)}u.bindTexture(p,M.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,f(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const t=this._descriptor.context.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(t,M.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,f(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,f(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),f(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=(0,s.DC)(this._compressionAbortController)}_setData(e,t){const r=this._descriptor,n=r.context?.gl;if(!n)return;(0,l.Y2)(n),this.hasWebGLTextureObject||(this._glName=n.createTexture(),r.context.instanceCounter.increment(u.vt.Texture,this)),f(r);const o=r.context.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,l.Y2)(n);const s=t??r.target,c=_(s);if(v(e))this._setDataFromTexImageSource(e,s);else{const{width:t,height:o,depth:h}=r;if(null==t||null==o)throw new i.A("texture:missing-size","Width and height must be specified!");if(c&&null==h)throw new i.A("texture:missing-depth","Depth must be specified!");if(r.internalFormat=y(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,r.internalFormat,r.hasMipmap,t,o,h),g(e)){if(!function(e){return null!=e&&(0,a.a4)(u.CQ,e)}(r.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,s)}else this._texImage(s,0,r.internalFormat,t,o,h,e),(0,l.Y2)(n),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,l.Y2)(n),r.context.bindTexture(o,M.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){const e=this._descriptor.context.gl,{unpackAlignment:t,flipped:r,preMultiplyAlpha:i}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i?1:0)}_setDataFromTexImageSource(e,t){const{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=y(i);const n=_(t),{width:o,height:s,depth:a}=function(e){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),{width:t,height:r,depth:1}}(e);i.width&&i.height,i.width||(i.width=o),i.height||(i.height=s),n&&i.depth,n&&(i.depth=a),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,o,s,a),this._texImage(t,0,i.internalFormat,o,s,a,e),(0,l.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,l.Y2)(r))}_setDataFromCompressedSource(e,t,r){const i=this._descriptor,{width:n,height:o,depth:s}=i,a=e.levels,c=x(r,n,o,s),l=Math.min(c,a.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,l),this._forEachMipmapLevel((e,i,n,o)=>{const s=a[Math.min(e,a.length-1)];this._compressedTexImage(r,e,t,i,n,o,s)},l)}_texStorage(e,t,r,n,o,s){const{gl:a}=this._descriptor.context;if(!function(e){return u.XN.includes(e)}(t)&&!m(t)&&!p(t))throw new i.A("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const c=r?x(e,n,o,s):1;if(_(e)){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");a.texStorage3D(e,c,t,n,o,s)}else a.texStorage2D(e,c,t,n,o);this._wasImmutablyAllocated=!0}_texImage(e,t,r,n,o,s,a){const c=this._descriptor.context.gl,l=_(e),{isImmutable:u,pixelFormat:h,dataType:d}=this._descriptor;if(u){if(null!=a){const r=a;if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.texSubImage3D(e,t,0,0,0,n,o,s,h,d,r)}else c.texSubImage2D(e,t,0,0,n,o,h,d,r)}}else{const u=a;if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.texImage3D(e,t,r,n,o,s,0,h,d,u)}else c.texImage2D(e,t,r,n,o,0,h,d,u)}}_compressedTexImage(e,t,r,n,o,s,a){const c=this._descriptor.context.gl,l=_(e);if(this._descriptor.isImmutable){if(null!=a)if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.compressedTexSubImage3D(e,t,0,0,0,n,o,s,r,a)}else c.compressedTexSubImage2D(e,t,0,0,n,o,r,a)}else if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.compressedTexImage3D(e,t,r,n,o,s,0,a)}else c.compressedTexImage2D(e,t,r,n,o,0,a)}async _compressOnWorker(e){const{width:t,height:r,context:i,flipped:n,preMultiplyAlpha:o,hasMipmap:s}=this._descriptor,a=this._descriptor.compress?.compressionTracker,l=this._descriptor.compress?.compressionCallback,{compressedTextureETC:u,compressedTextureS3TC:h}=i.capabilities;if(!M.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!u&&!h)return;this.abortCompression();const d=new AbortController;let f;this._compressionAbortController=d,a?.increment();try{e instanceof Uint8Array?f=e.buffer:(f=await createImageBitmap(e,{imageOrientation:n?"flipY":"none"}),(0,c.Te)(d));const i={data:f,width:t,height:r,needsFlip:e instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:o,hasMipmap:s,hasETC:!!u,hasS3TC:!!h},a=await M.compressionWorkerHandle.invoke(i,d.signal,1);if((0,c.Te)(d),a.compressedTexture&&this.hasWebGLTextureObject){const e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),l?.(e-this.usedMemory)}}catch(e){(0,c.zf)(e)||T().error("Texture compression failed!")}finally{a?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),f instanceof ImageBitmap&&f.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:n,depth:o,hasMipmap:s,target:a}=this._descriptor;const c=32879===a;if(null==r||null==n||c&&null==o)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,n,o),s&&(1!==r||1!==n||c&&1!==o)&&!(i>=t);++i)r=Math.max(1,r>>1),n=Math.max(1,n>>1),c&&(o=Math.max(1,o>>1))}_applySamplingMode(){const e=this._descriptor,t=e.context?.gl;let r=e.samplingMode,i=e.samplingMode;9985===r||9987===r?(r=9729,e.hasMipmap||(i=9729)):9984!==r&&9986!==r||(r=9728,e.hasMipmap||(i=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,r),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,i)}_applyWrapMode(){const e=this._descriptor,t=e.context?.gl;"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){const e=this._descriptor,t=e.context?.gl,r=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,r),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),(0,l.Y2)(t)}_applyAnisotropicFilteringParameters(){const e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},67171(e,t,r){r.d(t,{R:()=>o,e:()=>s});var i=r(63907),n=r(42293);class o{constructor(e=0,t=e){this.width=e,this.height=t,this.type=0,this.target=3553,this.pixelFormat=6408,this.dataType=i.ld.UNSIGNED_BYTE,this.samplingMode=9729,this.wrapMode=10497,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.compareEnabled=!1,this.linearFilterDepth=!1,this.depth=1,this.isImmutable=!1}}function s(e){return e.width<=0||e.height<=0||e.depth<=0?0:Math.round(e.width*e.height*e.depth*(e.hasMipmap?4/3:1)*(null==e.internalFormat?4:(0,n.MW)(e.internalFormat))*(34067===e.target?6:1))}},74333(e,t,r){r.d(t,{n:()=>i});class i{constructor(e,t,r,i,n=null){if(this.name=e,this.type=t,this.arraySize=n,this.bind={0:null,1:null,2:null},i)switch(r){case void 0:break;case 0:this.bind[0]=i;break;case 1:this.bind[1]=i;break;case 2:this.bind[2]=i}}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}}},42293(e,t,r){r.d(t,{MW:()=>c,wH:()=>a,yu:()=>s});var i=r(94656),n=r(63907);const o=new Set([n.pe.BYTE,n.pe.SHORT,n.pe.INT,n.pe.UNSIGNED_BYTE,n.pe.UNSIGNED_SHORT,n.pe.UNSIGNED_INT]);function s(e,t,r,n=0){const s=e.gl;e.bindBuffer(r);for(const a of r.layout){const r=t.get(a.name);if(null==r){console.warn(`There is no location for vertex attribute '${a.name}' defined.`);continue}const c=n*a.stride;if(a.count<=4)a.integer&&o.has(a.type)?s.vertexAttribIPointer(r,a.count,a.type,a.stride,a.offset+c):s.vertexAttribPointer(r,a.count,a.type,a.normalized,a.stride,a.offset+c),s.enableVertexAttribArray(r),a.divisor>0&&s.vertexAttribDivisor(r,a.divisor);else if(9===a.count)for(let e=0;e<3;e++)s.vertexAttribPointer(r+e,3,a.type,a.normalized,a.stride,a.offset+12*e+c),s.enableVertexAttribArray(r+e),a.divisor>0&&s.vertexAttribDivisor(r+e,a.divisor);else if(16===a.count)for(let e=0;e<4;e++)s.vertexAttribPointer(r+e,4,a.type,a.normalized,a.stride,a.offset+16*e+c),s.enableVertexAttribArray(r+e),a.divisor>0&&s.vertexAttribDivisor(r+e,a.divisor);else console.error("Unsupported vertex attribute element count: "+a.count);if((0,i.en)()){const t=(0,i.u1)(e.gl);t&&console.error(`Unable to bind vertex attribute "${a.name}" with baseInstanceOffset ${c}:`,t,a)}}}function a(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function c(e){switch(e){case 6406:case 6409:case 6403:case 36244:case n.H0.R8:case n.H0.R8I:case n.H0.R8UI:case n.H0.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case n.H0.RGBA4:case n.H0.R16F:case n.H0.R16I:case n.H0.R16UI:case n.H0.RG8:case n.H0.RG8I:case n.H0.RG8UI:case n.H0.RG8_SNORM:case n.H0.RGB565:case n.H0.RGB5_A1:case n.SB.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case n.H0.RGB8:case n.H0.RGB8I:case n.H0.RGB8UI:case n.H0.RGB8_SNORM:case n.H0.SRGB8:case n.SB.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case n.H0.RGBA8:case n.H0.R32F:case n.H0.R11F_G11F_B10F:case n.H0.RG16F:case n.H0.R32I:case n.H0.R32UI:case n.H0.RG16I:case n.H0.RG16UI:case n.H0.RGBA8I:case n.H0.RGBA8UI:case n.H0.RGBA8_SNORM:case n.H0.SRGB8_ALPHA8:case n.H0.RGB9_E5:case n.H0.RGB10_A2UI:case n.H0.RGB10_A2:case n.SB.DEPTH_COMPONENT32F:case n.iE.DEPTH24_STENCIL8:return 4;case n.iE.DEPTH32F_STENCIL8:return 5;case n.H0.RGB16F:case n.H0.RGB16I:case n.H0.RGB16UI:return 6;case n.H0.RG32F:case n.H0.RG32I:case n.H0.RG32UI:case n.H0.RGBA16F:case n.H0.RGBA16I:case n.H0.RGBA16UI:return 8;case n.H0.RGB32F:case n.H0.RGB32I:case n.H0.RGB32UI:return 12;case n.H0.RGBA32F:case n.H0.RGBA32I:case n.H0.RGBA32UI:return 16;case n.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT:case n.CQ.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case n.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT:case n.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case n.CQ.COMPRESSED_R11_EAC:case n.CQ.COMPRESSED_SIGNED_R11_EAC:case n.CQ.COMPRESSED_RGB8_ETC2:case n.CQ.COMPRESSED_SRGB8_ETC2:case n.CQ.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case n.CQ.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case n.CQ.COMPRESSED_RG11_EAC:case n.CQ.COMPRESSED_SIGNED_RG11_EAC:case n.CQ.COMPRESSED_RGBA8_ETC2_EAC:case n.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}},85079(e,t,r){r.d(t,{Sk:()=>s,Xk:()=>n,_u:()=>o});var i=r(21818);function n(e){let t=0;return(0,i.z)(new Map(e.map(({name:e,count:r})=>{const i=[e,t];return 16===r?t+=4:9===r?t+=3:++t,i})))}function o(e){const t=new Map;let r=0;return e.forEach(e=>e.forEach(({name:e,count:i})=>{t.set(e,r),16===i?r+=4:9===i?r+=3:++r})),t}function s(e){return o(Array.from(e.values()).map(({layout:e})=>e))}},66289(e,t,r){r.d(t,{R:()=>n});var i=r(48852);class n extends i.g{constructor(e,t,r,i=35044){super(e,34962,i,r),this.layout=t}}},74038(e,t,r){r.d(t,{_:()=>i});class i{constructor(e,t,r,i,n,o=!1,s=0,a=!1){this.name=e,this.count=t,this.type=r,this.offset=i,this.stride=n,this.normalized=o,this.divisor=s,this.integer=a}}},94656(e,t,r){r.d(t,{Y2:()=>l,en:()=>c,u1:()=>s});var i=r(49186),n=r(44208),o=r(53966);function s(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const a=!!(0,n.A)("enable-feature:webgl-debug");function c(){return a}function l(e,t=c()){if(t){const t=s(e);if(t){const e=(new Error).stack;o.A.getLogger("esri.views.webgl.checkWebGLError").error(new i.A("webgl-error","WebGL error occurred",{message:t,stack:e}))}}}},63907(e,t,r){r.d(t,{$0:()=>d,C5:()=>h,CQ:()=>v,H0:()=>o,SB:()=>c,WR:()=>i,XN:()=>s,iE:()=>a,ld:()=>l,nI:()=>m,pe:()=>n,r6:()=>f,uH:()=>g,vt:()=>u,xL:()=>p});const i={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},o={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},s=Object.values(o),a={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},c={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},l={FLOAT:n.FLOAT,UNSIGNED_BYTE:n.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:n.BYTE,UNSIGNED_SHORT:n.UNSIGNED_SHORT,SHORT:n.SHORT,UNSIGNED_INT:n.UNSIGNED_INT,INT:n.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},u={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},h=1029,d=0,f=36064,m=33306,p=36096,g=36128,v={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497}},90644(e,t,r){function i(e,t,r=32774,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}function n(e,t,r,i,n=32774,o=32774,s=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:i,opRgb:n,opAlpha:o,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}r.d(t,{Ey:()=>w,RC:()=>s,T8:()=>a,Uy:()=>h,Xt:()=>u,iD:()=>o,kn:()=>d,p3:()=>n}),r(4718);const o=i(0,771),s=(i(1,0),i(1,1),i(1,771)),a=n(770,1,771,771),c=(n(0,0,768,1),{face:1029,mode:2305}),l={face:1028,mode:2305},u=e=>2===e?c:1===e?l:null,h={zNear:0,zFar:1},d={r:!0,g:!0,b:!0,a:!0};function f(e){return M.intern(e)}function m(e){return C.intern(e)}function p(e){return A.intern(e)}function g(e){return I.intern(e)}function v(e){return F.intern(e)}function _(e){return D.intern(e)}function x(e){return B.intern(e)}function y(e){return L.intern(e)}function w(e){return U.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 T(e){return"["+e.join(",")+"]"}const M=new b(S,e=>({__tag:"Blending",...e}));function S(e){return e?T([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 C=new b(E,e=>({__tag:"Culling",...e}));function E(e){return e?T([e.face,e.mode]):null}const A=new b(R,e=>({__tag:"PolygonOffset",...e}));function R(e){return e?T([e.factor,e.units]):null}const I=new b(O,e=>({__tag:"DepthTest",...e}));function O(e){return e?T([e.func]):null}const F=new b(N,e=>({__tag:"StencilTest",...e}));function N(e){return e?T([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const D=new b(P,e=>({__tag:"DepthWrite",...e}));function P(e){return e?T([e.zNear,e.zFar]):null}const B=new b(H,e=>({__tag:"ColorWrite",...e}));function H(e){return e?T([e.r,e.g,e.b,e.a]):null}const L=new b(z,e=>({__tag:"StencilWrite",...e}));function z(e){return e?T([e.mask]):null}const U=new b(function(e){return e?T([S(e.blending),E(e.culling),R(e.polygonOffset),O(e.depthTest),N(e.stencilTest),P(e.depthWrite),H(e.colorWrite),z(e.stencilWrite)]):null},e=>({blending:f(e.blending),culling:m(e.culling),polygonOffset:p(e.polygonOffset),depthTest:g(e.depthTest),stencilTest:v(e.stencilTest),depthWrite:_(e.depthWrite),colorWrite:x(e.colorWrite),stencilWrite:y(e.stencilWrite)}))},49788(e,t,r){r.d(t,{Q:()=>i});const i=1/255.5}}]);
1041
+ `)}},26934(e,t,r){r.d(t,{Q:()=>n});var i=r(49788);function n(e){e.constants.add("alphaCutoff","float",i.Q)}},66211(e,t,r){function i(e,t){t.useFloatBlend?(e.constants.add("floatBlendOutputScale","float",1),e.constants.add("floatBlendInputScale","float",1)):(e.constants.add("floatBlendOutputScale","float",1/n),e.constants.add("floatBlendInputScale","float",n))}r.d(t,{H:()=>i,m:()=>n});const n=16},48852(e,t,r){r.d(t,{g:()=>h});var i=r(4576),n=r(44208),o=r(53966),s=r(34275),a=r(94656),c=r(63907);const l=()=>o.A.getLogger("esri.views.webgl.BufferObject"),u=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements");class h{static createIndex(e,t,r){return new h(e,34963,t,r)}static createUniform(e,t,r){return new h(e,35345,t,r)}static createPixelPack(e,t=35041,r){const i=new h(e,35051,t);return r&&i.setSize(r),i}static createPixelUnpack(e,t=35040,r){return new h(e,35052,t,r)}static createTransformFeedback(e,t=35044,r){const i=new h(e,35982,t);return i.setSize(r),i}constructor(e,t,r,i){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._sizeBytes=-1,this._indexType=void 0,e.instanceCounter.increment(c.vt.BufferObject,this),this._glName=this._context.gl.createBuffer(),(0,a.Y2)(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){if(34963===this.bufferType)switch(this._indexType){case c.pe.UNSIGNED_INT:return this._sizeBytes/4;case c.pe.UNSIGNED_SHORT:return this._sizeBytes/2;case c.pe.UNSIGNED_BYTE:case void 0:case null:break;default:this._indexType}return this._sizeBytes}get indexType(){return this._indexType}get sizeBytes(){return this._sizeBytes}get usedMemory(){return u?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){this._context?.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(c.vt.BufferObject,this),this._context=null):this._glName&&l().warn("Leaked WebGL buffer object")}setSize(e,t=null){if(34963===this.bufferType&&null!=t)switch(this._indexType=t,t){case c.pe.UNSIGNED_SHORT:e*=2;break;case c.pe.UNSIGNED_INT:e*=4;case c.pe.UNSIGNED_BYTE:}this._setBufferData(e)}setData(e){if(!e)return;const t=e.byteLength;34963===this.bufferType&&((0,s.mg)(e)?this._indexType=c.pe.UNSIGNED_BYTE:(0,s.jq)(e)?this._indexType=c.pe.UNSIGNED_SHORT:(0,s.XJ)(e)&&(this._indexType=c.pe.UNSIGNED_INT)),this._setBufferData(t,e)}setIndexType(e){34963===this.bufferType&&(this._indexType=e)}_setBufferData(e,t=null){this._sizeBytes=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=t?i.bufferData(this.bufferType,t,this.usage):i.bufferData(this.bufferType,e,this.usage),(0,a.Y2)(i),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,t,r,i){if(!e)return;const n=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:o}=this._context;o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,e,r,i-r),(0,a.Y2)(o),this._isVAOAware&&this._context.bindVAO(n)}getSubData(e,t=0,r,n){if(r<0||n<0)return;const o=function(e){return(0,i.Xj)(e)}(e)?e.BYTES_PER_ELEMENT:1;if(o*((r??0)+(n??0))>e.byteLength)return;t+o*(n??0)>this.usedMemory&&l().warn("Potential problem getting subdata: requested data exceeds buffer size!");const s=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),s.getBufferSubData(35982,t,e,r,n),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),s.getBufferSubData(36662,t,e,r,n),this._context.unbindBuffer(36662))}async getSubDataAsync(e,t=0,r,i){await this._context.clientWaitAsync(),this.getSubData(e,t,r,i)}}},65786(e,t,r){r.d(t,{Y:()=>i});const i=class{};new i},14113(e,t,r){r.d(t,{N5:()=>a});var i=r(49186),n=(r(44208),r(53966));const o=()=>n.A.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");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 a extends s{constructor(){super(...arguments),this.vertex=new h,this.fragment=new h,this.attributes=new d,this.varyings=new f,this.outputs=new p}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),i=this.varyings.generateSource(e),n="vertex"===e?this.vertex:this.fragment,o=n.uniforms.generateSource(),s=n.code.generateSource(),a=n.main.generateSource(t),c=this.debugName?`// ${this.debugName}\n`:"",l="vertex"===e?v:g,u=n.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${c}\n${l}\n${u.join("\n")}\n${o.join("\n")}\n${r.join("\n")}\n${i.join("\n")}\n${h.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return t=>{for(let n=0;n<i;++n)r[n](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n)=>{for(let o=0;o<i;++o)r[o](e,t,n)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n,o)=>{for(let s=0;s<i;++s)r[s](e,o,t,n)}}}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 i.A("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else o().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class l{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(e){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(e)throw new i.A("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}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 l(this),this.code=new u(this),this.constants=new m(this)}get builder(){return this}}class d{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]};`)}get names(){return this._entries.map(([e])=>e)}}class f{constructor(){this._entries=new Map}add(e,t,r){this._entries.has(e)?o().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:r?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,i)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${i};`)),t}}class p{constructor(){this._entries=new Map}add(e,t,r=0){const i=this._entries.get(r);i?.name!==e||i?.type!==t?this._entries.set(r,{name:e,type:t}):o().warn(`Fragment shader output location ${r} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:p.DEFAULT_NAME,type:p.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class m{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let i="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":i=m._numberToFloatStr(r);break;case"int":i=m._numberToIntStr(r);break;case"uint":i=m._numberToUintStr(r);break;case"bool":i=r.toString();break;case"vec2":i=`vec2(${m._numberToFloatStr(r[0])}, ${m._numberToFloatStr(r[1])})`;break;case"vec3":i=`vec3(${m._numberToFloatStr(r[0])}, ${m._numberToFloatStr(r[1])}, ${m._numberToFloatStr(r[2])})`;break;case"vec4":i=`vec4(${m._numberToFloatStr(r[0])}, ${m._numberToFloatStr(r[1])}, ${m._numberToFloatStr(r[2])}, ${m._numberToFloatStr(r[3])})`;break;case"ivec2":i=`ivec2(${m._numberToIntStr(r[0])}, ${m._numberToIntStr(r[1])})`;break;case"ivec3":i=`ivec3(${m._numberToIntStr(r[0])}, ${m._numberToIntStr(r[1])}, ${m._numberToIntStr(r[2])})`;break;case"ivec4":i=`ivec4(${m._numberToIntStr(r[0])}, ${m._numberToIntStr(r[1])}, ${m._numberToIntStr(r[2])}, ${m._numberToIntStr(r[3])})`;break;case"uvec2":i=`uvec2(${m._numberToUintStr(r[0])}, ${m._numberToUintStr(r[1])})`;break;case"uvec3":i=`uvec3(${m._numberToUintStr(r[0])}, ${m._numberToUintStr(r[1])}, ${m._numberToUintStr(r[2])})`;break;case"uvec4":i=`uvec4(${m._numberToUintStr(r[0])}, ${m._numberToUintStr(r[1])}, ${m._numberToUintStr(r[2])}, ${m._numberToUintStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":i=`${t}(${Array.prototype.map.call(r,e=>m._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${i};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToUintStr(e){return`${e.toFixed(0)}u`}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const g="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",v="precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n "},76284(e,t,r){r.d(t,{A:()=>M});var i=r(49186),n=r(44208),o=r(53966),s=r(97768),a=r(93637),c=r(17676),l=r(94656),u=r(63907),h=r(67171);const d=()=>o.A.getLogger("esri/views/webgl/textureUtils");function f(e){const{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&d().error("Negative dimension parameters are not allowed!");const{internalFormat:n}=e;if(n&&(p(n)||m(n))){const{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:n}=e;n&&d().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&d().error("Depth textures cannot sample mipmaps"):(9728!==i&&d().error("Depth textures without filtering must use NEAREST filtering"),r&&d().error("Depth textures without filtering cannot use compare function"))}}function p(e){return(0,a.a4)(u.SB,e)}function m(e){return(0,a.a4)(u.iE,e)}function g(e){return null!=e&&"type"in e&&"compressed"===e.type}function v(e){return null!=e&&!g(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function x(e,t,r,i=1){let n=Math.max(t,r);return 32879===e&&(n=Math.max(n,i)),Math.floor(Math.log2(n))+1}function w(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case u.ld.FLOAT:switch(e.pixelFormat){case 6408:return u.H0.RGBA32F;case 6407:return u.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case u.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return u.H0.RGBA8;case 6407:return u.H0.RGB8}}const{pixelFormat:t}=e;return e.internalFormat=34041===t?u.iE.DEPTH24_STENCIL8:6402===t?u.SB.DEPTH_COMPONENT24:t,e.internalFormat}class y extends h.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case u.H0.R16F:case u.H0.R32F:case u.H0.R8_SNORM:case u.H0.R8:this.pixelFormat=6403;break;case u.H0.R8I:case u.H0.R8UI:case u.H0.R16I:case u.H0.R16UI:case u.H0.R32I:case u.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new y(e,t)}}const b=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements"),T=()=>o.A.getLogger("esri/views/webgl/Texture");class M{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,t=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=t;else{const r=y.validate(e,t);if(!r)throw new i.A("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:(0,h.e)(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(u.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){const r=this._descriptor;if(r.width!==e||r.height!==t){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=t,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!g(e)&&this._descriptor.internalFormat&&(0,a.a4)(u.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!g(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(e,t,r,n,o,s,a=0){s||T().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||T().error("An attempt to update uninitialized texture!");const c=this._descriptor;c.internalFormat=w(c);const{context:l,pixelFormat:u,dataType:h,target:d,isImmutable:f}=c;if(f&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");const p=l.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES,!0);(t<0||r<0||t+n>c.width||r+o>c.height)&&T().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:m}=l;a&&(n&&o||T().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),m.pixelStorei(m.UNPACK_SKIP_ROWS,a)),v(s)?m.texSubImage2D(d,e,t,r,n,o,u,h,s):g(s)?m.compressedTexSubImage2D(d,e,t,r,n,o,c.internalFormat,s.levels[e]):m.texSubImage2D(d,e,t,r,n,o,u,h,s),a&&m.pixelStorei(m.UNPACK_SKIP_ROWS,0),l.bindTexture(p,M.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,t,r,n,o,s,a,c){c||T().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||T().error("An attempt to update an uninitialized texture!");const l=this._descriptor;l.internalFormat=w(l);const{context:u,pixelFormat:h,dataType:d,isImmutable:f,target:p}=l;if(f&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");_(p)||T().warn("Attempting to set 3D texture data on a non-3D texture");const m=u.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);u.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),(t<0||r<0||n<0||t+o>l.width||r+s>l.height||n+a>l.depth)&&T().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:v}=u;if(g(c))c=c.levels[e],v.compressedTexSubImage3D(p,e,t,r,n,o,s,a,l.internalFormat,c);else{const i=c;v.texSubImage3D(p,e,t,r,n,o,s,a,h,d,i)}u.bindTexture(m,M.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,f(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const t=this._descriptor.context.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(t,M.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,f(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,f(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),f(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=(0,s.DC)(this._compressionAbortController)}_setData(e,t){const r=this._descriptor,n=r.context?.gl;if(!n)return;(0,l.Y2)(n),this.hasWebGLTextureObject||(this._glName=n.createTexture(),r.context.instanceCounter.increment(u.vt.Texture,this)),f(r);const o=r.context.bindTexture(this,M.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(M.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,l.Y2)(n);const s=t??r.target,c=_(s);if(v(e))this._setDataFromTexImageSource(e,s);else{const{width:t,height:o,depth:h}=r;if(null==t||null==o)throw new i.A("texture:missing-size","Width and height must be specified!");if(c&&null==h)throw new i.A("texture:missing-depth","Depth must be specified!");if(r.internalFormat=w(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,r.internalFormat,r.hasMipmap,t,o,h),g(e)){if(!function(e){return null!=e&&(0,a.a4)(u.CQ,e)}(r.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,s)}else this._texImage(s,0,r.internalFormat,t,o,h,e),(0,l.Y2)(n),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,l.Y2)(n),r.context.bindTexture(o,M.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){const e=this._descriptor.context.gl,{unpackAlignment:t,flipped:r,preMultiplyAlpha:i}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i?1:0)}_setDataFromTexImageSource(e,t){const{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=w(i);const n=_(t),{width:o,height:s,depth:a}=function(e){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),{width:t,height:r,depth:1}}(e);i.width&&i.height,i.width||(i.width=o),i.height||(i.height=s),n&&i.depth,n&&(i.depth=a),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,o,s,a),this._texImage(t,0,i.internalFormat,o,s,a,e),(0,l.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,l.Y2)(r))}_setDataFromCompressedSource(e,t,r){const i=this._descriptor,{width:n,height:o,depth:s}=i,a=e.levels,c=x(r,n,o,s),l=Math.min(c,a.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,l),this._forEachMipmapLevel((e,i,n,o)=>{const s=a[Math.min(e,a.length-1)];this._compressedTexImage(r,e,t,i,n,o,s)},l)}_texStorage(e,t,r,n,o,s){const{gl:a}=this._descriptor.context;if(!function(e){return u.XN.includes(e)}(t)&&!p(t)&&!m(t))throw new i.A("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const c=r?x(e,n,o,s):1;if(_(e)){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");a.texStorage3D(e,c,t,n,o,s)}else a.texStorage2D(e,c,t,n,o);this._wasImmutablyAllocated=!0}_texImage(e,t,r,n,o,s,a){const c=this._descriptor.context.gl,l=_(e),{isImmutable:u,pixelFormat:h,dataType:d}=this._descriptor;if(u){if(null!=a){const r=a;if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.texSubImage3D(e,t,0,0,0,n,o,s,h,d,r)}else c.texSubImage2D(e,t,0,0,n,o,h,d,r)}}else{const u=a;if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.texImage3D(e,t,r,n,o,s,0,h,d,u)}else c.texImage2D(e,t,r,n,o,0,h,d,u)}}_compressedTexImage(e,t,r,n,o,s,a){const c=this._descriptor.context.gl,l=_(e);if(this._descriptor.isImmutable){if(null!=a)if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.compressedTexSubImage3D(e,t,0,0,0,n,o,s,r,a)}else c.compressedTexSubImage2D(e,t,0,0,n,o,r,a)}else if(l){if(null==s)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");c.compressedTexImage3D(e,t,r,n,o,s,0,a)}else c.compressedTexImage2D(e,t,r,n,o,0,a)}async _compressOnWorker(e){const{width:t,height:r,context:i,flipped:n,preMultiplyAlpha:o,hasMipmap:s}=this._descriptor,a=this._descriptor.compress?.compressionTracker,l=this._descriptor.compress?.compressionCallback,{compressedTextureETC:u,compressedTextureS3TC:h}=i.capabilities;if(!M.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!u&&!h)return;this.abortCompression();const d=new AbortController;let f;this._compressionAbortController=d,a?.increment();try{e instanceof Uint8Array?f=e.buffer:(f=await createImageBitmap(e,{imageOrientation:n?"flipY":"none"}),(0,c.Te)(d));const i={data:f,width:t,height:r,needsFlip:e instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:o,hasMipmap:s,hasETC:!!u,hasS3TC:!!h},a=await M.compressionWorkerHandle.invoke(i,d.signal,1);if((0,c.Te)(d),a.compressedTexture&&this.hasWebGLTextureObject){const e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),l?.(e-this.usedMemory)}}catch(e){(0,c.zf)(e)||T().error("Texture compression failed!")}finally{a?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),f instanceof ImageBitmap&&f.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:n,depth:o,hasMipmap:s,target:a}=this._descriptor;const c=32879===a;if(null==r||null==n||c&&null==o)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,n,o),s&&(1!==r||1!==n||c&&1!==o)&&!(i>=t);++i)r=Math.max(1,r>>1),n=Math.max(1,n>>1),c&&(o=Math.max(1,o>>1))}_applySamplingMode(){const e=this._descriptor,t=e.context?.gl;let r=e.samplingMode,i=e.samplingMode;9985===r||9987===r?(r=9729,e.hasMipmap||(i=9729)):9984!==r&&9986!==r||(r=9728,e.hasMipmap||(i=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,r),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,i)}_applyWrapMode(){const e=this._descriptor,t=e.context?.gl;"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){const e=this._descriptor,t=e.context?.gl,r=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,r),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),(0,l.Y2)(t)}_applyAnisotropicFilteringParameters(){const e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},67171(e,t,r){r.d(t,{R:()=>o,e:()=>s});var i=r(63907),n=r(42293);class o{constructor(e=0,t=e){this.width=e,this.height=t,this.type=0,this.target=3553,this.pixelFormat=6408,this.dataType=i.ld.UNSIGNED_BYTE,this.samplingMode=9729,this.wrapMode=10497,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.compareEnabled=!1,this.linearFilterDepth=!1,this.depth=1,this.isImmutable=!1}}function s(e){return e.width<=0||e.height<=0||e.depth<=0?0:Math.round(e.width*e.height*e.depth*(e.hasMipmap?4/3:1)*(null==e.internalFormat?4:(0,n.MW)(e.internalFormat))*(34067===e.target?6:1))}},74333(e,t,r){r.d(t,{n:()=>i});class i{constructor(e,t,r,i,n=null){if(this.name=e,this.type=t,this.arraySize=n,this.bind={0:null,1:null,2:null},i)switch(r){case void 0:break;case 0:this.bind[0]=i;break;case 1:this.bind[1]=i;break;case 2:this.bind[2]=i}}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}}},42293(e,t,r){r.d(t,{MW:()=>c,wH:()=>a,yu:()=>s});var i=r(94656),n=r(63907);const o=new Set([n.pe.BYTE,n.pe.SHORT,n.pe.INT,n.pe.UNSIGNED_BYTE,n.pe.UNSIGNED_SHORT,n.pe.UNSIGNED_INT]);function s(e,t,r,n=0){const s=e.gl;e.bindBuffer(r);for(const a of r.layout){const r=t.get(a.name);if(null==r){console.warn(`There is no location for vertex attribute '${a.name}' defined.`);continue}const c=n*a.stride;if(a.count<=4)a.integer&&o.has(a.type)?s.vertexAttribIPointer(r,a.count,a.type,a.stride,a.offset+c):s.vertexAttribPointer(r,a.count,a.type,a.normalized,a.stride,a.offset+c),s.enableVertexAttribArray(r),a.divisor>0&&s.vertexAttribDivisor(r,a.divisor);else if(9===a.count)for(let e=0;e<3;e++)s.vertexAttribPointer(r+e,3,a.type,a.normalized,a.stride,a.offset+12*e+c),s.enableVertexAttribArray(r+e),a.divisor>0&&s.vertexAttribDivisor(r+e,a.divisor);else if(16===a.count)for(let e=0;e<4;e++)s.vertexAttribPointer(r+e,4,a.type,a.normalized,a.stride,a.offset+16*e+c),s.enableVertexAttribArray(r+e),a.divisor>0&&s.vertexAttribDivisor(r+e,a.divisor);else console.error("Unsupported vertex attribute element count: "+a.count);if((0,i.en)()){const t=(0,i.u1)(e.gl);t&&console.error(`Unable to bind vertex attribute "${a.name}" with baseInstanceOffset ${c}:`,t,a)}}}function a(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function c(e){switch(e){case 6406:case 6409:case 6403:case 36244:case n.H0.R8:case n.H0.R8I:case n.H0.R8UI:case n.H0.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case n.H0.RGBA4:case n.H0.R16F:case n.H0.R16I:case n.H0.R16UI:case n.H0.RG8:case n.H0.RG8I:case n.H0.RG8UI:case n.H0.RG8_SNORM:case n.H0.RGB565:case n.H0.RGB5_A1:case n.SB.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case n.H0.RGB8:case n.H0.RGB8I:case n.H0.RGB8UI:case n.H0.RGB8_SNORM:case n.H0.SRGB8:case n.SB.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case n.H0.RGBA8:case n.H0.R32F:case n.H0.R11F_G11F_B10F:case n.H0.RG16F:case n.H0.R32I:case n.H0.R32UI:case n.H0.RG16I:case n.H0.RG16UI:case n.H0.RGBA8I:case n.H0.RGBA8UI:case n.H0.RGBA8_SNORM:case n.H0.SRGB8_ALPHA8:case n.H0.RGB9_E5:case n.H0.RGB10_A2UI:case n.H0.RGB10_A2:case n.SB.DEPTH_COMPONENT32F:case n.iE.DEPTH24_STENCIL8:return 4;case n.iE.DEPTH32F_STENCIL8:return 5;case n.H0.RGB16F:case n.H0.RGB16I:case n.H0.RGB16UI:return 6;case n.H0.RG32F:case n.H0.RG32I:case n.H0.RG32UI:case n.H0.RGBA16F:case n.H0.RGBA16I:case n.H0.RGBA16UI:return 8;case n.H0.RGB32F:case n.H0.RGB32I:case n.H0.RGB32UI:return 12;case n.H0.RGBA32F:case n.H0.RGBA32I:case n.H0.RGBA32UI:return 16;case n.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT:case n.CQ.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case n.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT:case n.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case n.CQ.COMPRESSED_R11_EAC:case n.CQ.COMPRESSED_SIGNED_R11_EAC:case n.CQ.COMPRESSED_RGB8_ETC2:case n.CQ.COMPRESSED_SRGB8_ETC2:case n.CQ.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case n.CQ.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case n.CQ.COMPRESSED_RG11_EAC:case n.CQ.COMPRESSED_SIGNED_RG11_EAC:case n.CQ.COMPRESSED_RGBA8_ETC2_EAC:case n.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}},85079(e,t,r){r.d(t,{Sk:()=>s,Xk:()=>n,_u:()=>o});var i=r(21818);function n(e){let t=0;return(0,i.z)(new Map(e.map(({name:e,count:r})=>{const i=[e,t];return 16===r?t+=4:9===r?t+=3:++t,i})))}function o(e){const t=new Map;let r=0;return e.forEach(e=>e.forEach(({name:e,count:i})=>{t.set(e,r),16===i?r+=4:9===i?r+=3:++r})),t}function s(e){return o(Array.from(e.values()).map(({layout:e})=>e))}},66289(e,t,r){r.d(t,{R:()=>n});var i=r(48852);class n extends i.g{constructor(e,t,r,i=35044){super(e,34962,i,r),this.layout=t}}},74038(e,t,r){r.d(t,{_:()=>i});class i{constructor(e,t,r,i,n,o=!1,s=0,a=!1){this.name=e,this.count=t,this.type=r,this.offset=i,this.stride=n,this.normalized=o,this.divisor=s,this.integer=a}}},94656(e,t,r){r.d(t,{Y2:()=>l,en:()=>c,u1:()=>s});var i=r(49186),n=r(44208),o=r(53966);function s(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const a=!!(0,n.A)("enable-feature:webgl-debug");function c(){return a}function l(e,t=c()){if(t){const t=s(e);if(t){const e=(new Error).stack;o.A.getLogger("esri.views.webgl.checkWebGLError").error(new i.A("webgl-error","WebGL error occurred",{message:t,stack:e}))}}}},63907(e,t,r){r.d(t,{$0:()=>d,C5:()=>h,CQ:()=>v,H0:()=>o,SB:()=>c,WR:()=>i,XN:()=>s,iE:()=>a,ld:()=>l,nI:()=>p,pe:()=>n,r6:()=>f,uH:()=>g,vt:()=>u,xL:()=>m});const i={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},n={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},o={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},s=Object.values(o),a={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},c={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},l={FLOAT:n.FLOAT,UNSIGNED_BYTE:n.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:n.BYTE,UNSIGNED_SHORT:n.UNSIGNED_SHORT,SHORT:n.SHORT,UNSIGNED_INT:n.UNSIGNED_INT,INT:n.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},u={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},h=1029,d=0,f=36064,p=33306,m=36096,g=36128,v={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497}},90644(e,t,r){function i(e,t,r=32774,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}function n(e,t,r,i,n=32774,o=32774,s=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:i,opRgb:n,opAlpha:o,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}r.d(t,{Ey:()=>y,RC:()=>s,T8:()=>a,Uy:()=>h,Xt:()=>u,iD:()=>o,kn:()=>d,p3:()=>n}),r(4718);const o=i(0,771),s=(i(1,0),i(1,1),i(1,771)),a=n(770,1,771,771),c=(n(0,0,768,1),{face:1029,mode:2305}),l={face:1028,mode:2305},u=e=>2===e?c:1===e?l:null,h={zNear:0,zFar:1},d={r:!0,g:!0,b:!0,a:!0};function f(e){return M.intern(e)}function p(e){return C.intern(e)}function m(e){return A.intern(e)}function g(e){return I.intern(e)}function v(e){return F.intern(e)}function _(e){return P.intern(e)}function x(e){return B.intern(e)}function w(e){return L.intern(e)}function y(e){return U.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 T(e){return"["+e.join(",")+"]"}const M=new b(S,e=>({__tag:"Blending",...e}));function S(e){return e?T([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 C=new b(E,e=>({__tag:"Culling",...e}));function E(e){return e?T([e.face,e.mode]):null}const A=new b(R,e=>({__tag:"PolygonOffset",...e}));function R(e){return e?T([e.factor,e.units]):null}const I=new b(O,e=>({__tag:"DepthTest",...e}));function O(e){return e?T([e.func]):null}const F=new b(D,e=>({__tag:"StencilTest",...e}));function D(e){return e?T([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const P=new b(N,e=>({__tag:"DepthWrite",...e}));function N(e){return e?T([e.zNear,e.zFar]):null}const B=new b(H,e=>({__tag:"ColorWrite",...e}));function H(e){return e?T([e.r,e.g,e.b,e.a]):null}const L=new b(z,e=>({__tag:"StencilWrite",...e}));function z(e){return e?T([e.mask]):null}const U=new b(function(e){return e?T([S(e.blending),E(e.culling),R(e.polygonOffset),O(e.depthTest),D(e.stencilTest),N(e.depthWrite),H(e.colorWrite),z(e.stencilWrite)]):null},e=>({blending:f(e.blending),culling:p(e.culling),polygonOffset:m(e.polygonOffset),depthTest:g(e.depthTest),stencilTest:v(e.stencilTest),depthWrite:_(e.depthWrite),colorWrite:x(e.colorWrite),stencilWrite:w(e.stencilWrite)}))},49788(e,t,r){r.d(t,{Q:()=>i});const i=1/255.5}}]);