PageSourceSearch

https://www.citynaturechallenge.org/_next/static/chunks/6252.b05baee56f1dcdd9.js

js citynaturechallenge.org collected 2026-10-02 03:16:38 UTC 193,742 bytes, 1,178 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6252],{45584:function(e,t,r){r.d(t,{D:function(){return k},b:function(){return W}});var i=r(61681),o=r(39100),n=r(95650),a=r(57218),s=r(35031),l=r(5885),c=r(4731),u=r(99163),d=r(27125),h=r(91636),f=r(45658),m=r(82082),p=r(6502),v=r(78549),g=r(78183),x=r(34091),_=r(3417),T=r(69828),b=r(21640),S=r(58749),A=r(73393),C=r(2833),w=r(74839),y=r(3864),O=r(29262),M=r(30228),P=r(27641),E=r(44391),R=r(41330),I=r(42727),N=r(5614),L=r(43036),H=r(63371),D=r(24603),F=r(23410),z=r(87621),B=r(3961),V=r(15176),U=r(42842),G=r(21414);function W(e){let t=new B.kG,{vertex:r,fragment:W,varyings:k}=t;return(0,N.Sv)(r,e),t.include(h.f),k.add("vpos","vec3"),t.include(P.k,e),t.include(u.f,e),t.include(g.L,e),e.hasColorTextureTransform&&t.include(M.av),e.output!==s.H.Color&&e.output!==s.H.Alpha||(e.hasNormalTextureTransform&&t.include(M.NI),e.hasEmissionTextureTransform&&t.include(M.R5),e.hasOcclusionTextureTransform&&t.include(M.jF),e.hasMetallicRoughnessTextureTransform&&t.include(M.DT),(0,N.hY)(r,e),t.include(d.O,e),t.include(c.w,e),e.normalType===d.h.Attribute&&e.offsetBackfaces&&t.include(a.w),t.include(_.Q,e),t.include(v.Bb,e),e.instancedColor&&t.attributes.add(G.T.INSTANCECOLOR,"vec4"),k.add("localvpos","vec3"),t.include(m.D,e),t.include(n.qj,e),t.include(f.R,e),t.include(p.c,e),r.uniforms.add(new H.N("externalColor",e=>e.externalColor)),k.add("vcolorExt","vec4"),e.hasMultipassTerrain&&k.add("depth","float"),e.hasModelTransformation&&r.uniforms.add(new z.g("model",e=>(0,i.pC)(e.modelTransformation)?e.modelTransformation:o.I)),r.code.add((0,F.H)`
2      void main(void) {
3        forwardNormalizedVertexColor();
4        vcolorExt = externalColor;
5        ${e.instancedColor?"vcolorExt *= instanceColor;":""}
6        vcolorExt *= vvColor();
7        vcolorExt *= getSymbolColor();
8        forwardColorMixMode();
9
10        if (vcolorExt.a < ${F.H.float(E.b)}) {
11          gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
12        } else {
13          vpos = calculateVPos();
14          localvpos = vpos - view[3].xyz;
15          vpos = subtractOrigin(vpos);
16          ${e.normalType===d.h.Attribute?(0,F.H)`vNormalWorld = dpNormal(vvLocalNormal(normalModel()));`:""}
17          vpos = addVerticalOffset(vpos, localOrigin);
18          ${e.hasVertexTangents?"vTangent = dpTransformVertexTangent(tangent);":""}
19          gl_Position = transformPosition(proj, view, ${e.hasModelTransformation?"model,":""} vpos);
20          ${e.normalType===d.h.Attribute&&e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
21        }
22
23        ${e.hasMultipassTerrain?"depth = (view * vec4(vpos, 1.0)).z;":""}
24        forwardLinearDepth();
25        forwardTextureCoordinates();
26        ${e.hasColorTextureTransform?(0,F.H)`forwardColorUV();`:""}
27        ${e.hasNormalTextureTransform?(0,F.H)`forwardNormalUV();`:""}
28        ${e.hasEmissionTextureTransform?(0,F.H)`forwardEmissiveUV();`:""}
29        ${e.hasOcclusionTextureTransform?(0,F.H)`forwardOcclusionUV();`:""}
30        ${e.hasMetallicRoughnessTextureTransform?(0,F.H)`forwardMetallicRoughnessUV();`:""}
31      }
32    `)),e.output===s.H.Alpha&&(t.include(l.f5,e),t.include(R.z,e),t.include(A.l,e),W.uniforms.add([new D.p("opacity",e=>e.opacity),new D.p("layerOpacity",e=>e.layerOpacity)]),e.hasColorTexture&&W.uniforms.add(new V.A("tex",e=>e.texture)),W.include(I.y),W.code.add((0,F.H)`
33      void main() {
34        discardBySlice(vpos);
35        ${e.hasMultipassTerrain?"terrainDepthTest(gl_FragCoord, depth);":""}
36        ${e.hasColorTexture?(0,F.H)`
37                vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?(0,F.H)`colorUV`:(0,F.H)`vuv0`});
38                ${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
39                discardOrAdjustAlpha(texColor);`:(0,F.H)`vec4 texColor = vec4(1.0);`}
40        ${e.hasVertexColors?(0,F.H)`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:(0,F.H)`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
41        gl_FragColor = vec4(opacity_);
42      }
43    `)),e.output===s.H.Color&&(t.include(l.f5,e),t.include(b.XP,e),t.include(T.K,e),t.include(R.z,e),t.include(e.instancedDoublePrecision?O.hb:O.XE,e),t.include(A.l,e),(0,N.hY)(W,e),W.uniforms.add([r.uniforms.get("localOrigin"),new L.J("ambient",e=>e.ambient),new L.J("diffuse",e=>e.diffuse),new D.p("opacity",e=>e.opacity),new D.p("layerOpacity",e=>e.layerOpacity)]),e.hasColorTexture&&W.uniforms.add(new V.A("tex",e=>e.texture)),t.include(y.jV,e),t.include(w.T,e),W.include(I.y),t.include(C.k,e),(0,b.PN)(W),(0,b.sC)(W),(0,S.F1)(W),W.code.add((0,F.H)`
44      void main() {
45        discardBySlice(vpos);
46        ${e.hasMultipassTerrain?"terrainDepthTest(gl_FragCoord, depth);":""}
47        ${e.hasColorTexture?(0,F.H)`
48                vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?(0,F.H)`colorUV`:(0,F.H)`vuv0`});
49                ${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
50                discardOrAdjustAlpha(texColor);`:(0,F.H)`vec4 texColor = vec4(1.0);`}
51        shadingParams.viewDirection = normalize(vpos - cameraPosition);
52        ${e.normalType===d.h.ScreenDerivative?(0,F.H)`
53                vec3 normal = screenDerivativeNormal(localvpos);`:(0,F.H)`
54                shadingParams.normalView = vNormalWorld;
55                vec3 normal = shadingNormal(shadingParams);`}
56        ${e.pbrMode===y.f7.Normal?"applyPBRFactors();":""}
57        float ssao = evaluateAmbientOcclusionInverse();
58        ssao *= getBakedOcclusion();
59
60        vec3 posWorld = vpos + localOrigin;
61
62        float additionalAmbientScale = additionalDirectedAmbientLight(posWorld);
63        float shadow = ${e.receiveShadows?"readShadowMap(vpos, linearDepth)":e.spherical?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
64
65        vec3 matColor = max(ambient, diffuse);
66        ${e.hasVertexColors?(0,F.H)`
67                vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
68                float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:(0,F.H)`
69                vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
70                float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
71        ${e.hasNormalTexture?(0,F.H)`
72                mat3 tangentSpace = ${e.hasVertexTangents?"computeTangentSpace(normal);":"computeTangentSpace(normal, vpos, vuv0);"}
73                vec3 shadingNormal = computeTextureNormal(tangentSpace, vuv0);`:(0,F.H)`vec3 shadingNormal = normal;`}
74        vec3 normalGround = ${e.spherical?(0,F.H)`normalize(posWorld);`:(0,F.H)`vec3(0.0, 0.0, 1.0);`}
75
76        ${e.snowCover?(0,F.H)`
77                float snow = smoothstep(0.5, 0.55, dot(normal, normalGround));
78                albedo = mix(albedo, vec3(1), snow);
79                shadingNormal = mix(shadingNormal, normal, snow);
80                ssao = mix(ssao, 1.0, snow);`:""}
81
82        vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
83
84        ${e.pbrMode===y.f7.Normal||e.pbrMode===y.f7.Schematic?(0,F.H)`
85                float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
86                ${e.snowCover?(0,F.H)`
87                        mrr = mix(mrr, vec3(0.0, 1.0, 0.04), snow);
88                        emission = mix(emission, vec3(0.0), snow);`:""}
89
90                vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:(0,F.H)`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
91        gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
92        ${e.transparencyPassType===U.A.Color?(0,F.H)`gl_FragColor = premultiplyAlpha(gl_FragColor);`:""}
93      }
94    `)),t.include(x.s,e),t}let k=Object.freeze(Object.defineProperty({__proto__:null,build:W},Symbol.toStringTag,{value:"Module"}))},60926:function(e,t,r){r.d(t,{R:function(){return F},b:function(){return D}});var i=r(95650),o=r(57218),n=r(35031),a=r(5885),s=r(4731),l=r(99163),c=r(27125),u=r(91636),d=r(45658),h=r(82082),f=r(6502),m=r(78183),p=r(34091),v=r(69828),g=r(21640),x=r(58749),_=r(73393),T=r(74839),b=r(3864),S=r(29262),A=r(27641),
94C=r(44391),w=r(41330),y=r(42727),O=r(5614),M=r(43036),P=r(63371),E=r(24603),R=r(23410),I=r(3961),N=r(15176),L=r(42842),H=r(21414);function D(e){let t=new I.kG,{vertex:r,fragment:D,varyings:F}=t;return(0,O.Sv)(r,e),t.include(u.f),F.add("vpos","vec3"),t.include(A.k,e),t.include(l.f,e),t.include(m.L,e),e.output!==n.H.Color&&e.output!==n.H.Alpha||((0,O.hY)(t.vertex,e),t.include(c.O,e),t.include(s.w,e),e.offsetBackfaces&&t.include(o.w),e.instancedColor&&t.attributes.add(H.T.INSTANCECOLOR,"vec4"),F.add("vNormalWorld","vec3"),F.add("localvpos","vec3"),e.hasMultipassTerrain&&F.add("depth","float"),t.include(h.D,e),t.include(i.qj,e),t.include(d.R,e),t.include(f.c,e),r.uniforms.add(new P.N("externalColor",e=>e.externalColor)),F.add("vcolorExt","vec4"),r.code.add((0,R.H)`
95        void main(void) {
96          forwardNormalizedVertexColor();
97          vcolorExt = externalColor;
98          ${e.instancedColor?"vcolorExt *= instanceColor;":""}
99          vcolorExt *= vvColor();
100          vcolorExt *= getSymbolColor();
101          forwardColorMixMode();
102
103          if (vcolorExt.a < ${R.H.float(C.b)}) {
104            gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
105          } else {
106            vpos = calculateVPos();
107            localvpos = vpos - view[3].xyz;
108            vpos = subtractOrigin(vpos);
109            vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
110            vpos = addVerticalOffset(vpos, localOrigin);
111            gl_Position = transformPosition(proj, view, vpos);
112            ${e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
113          }
114          ${e.hasMultipassTerrain?(0,R.H)`depth = (view * vec4(vpos, 1.0)).z;`:""}
115          forwardLinearDepth();
116          forwardTextureCoordinates();
117        }
118      `)),e.output===n.H.Alpha&&(t.include(a.f5,e),t.include(w.z,e),t.include(_.l,e),D.uniforms.add([new E.p("opacity",e=>e.opacity),new E.p("layerOpacity",e=>e.layerOpacity)]),e.hasColorTexture&&D.uniforms.add(new N.A("tex",e=>e.texture)),D.include(y.y),D.code.add((0,R.H)`
119      void main() {
120        discardBySlice(vpos);
121        ${e.hasMultipassTerrain?(0,R.H)`terrainDepthTest(gl_FragCoord, depth);`:""}
122        ${e.hasColorTexture?(0,R.H)`
123                vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?(0,R.H)`colorUV`:(0,R.H)`vuv0`});
124                ${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
125                discardOrAdjustAlpha(texColor);`:(0,R.H)`vec4 texColor = vec4(1.0);`}
126        ${e.hasVertexColors?(0,R.H)`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:(0,R.H)`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
127
128        gl_FragColor = vec4(opacity_);
129      }
130    `)),e.output===n.H.Color&&(t.include(a.f5,e),t.include(g.XP,e),t.include(v.K,e),t.include(w.z,e),t.include(e.instancedDoublePrecision?S.hb:S.XE,e),t.include(_.l,e),(0,O.hY)(t.fragment,e),(0,x.Pe)(D),(0,g.PN)(D),(0,g.sC)(D),D.uniforms.add([r.uniforms.get("localOrigin"),r.uniforms.get("view"),new M.J("ambient",e=>e.ambient),new M.J("diffuse",e=>e.diffuse),new E.p("opacity",e=>e.opacity),new E.p("layerOpacity",e=>e.layerOpacity)]),e.hasColorTexture&&D.uniforms.add(new N.A("tex",e=>e.texture)),t.include(b.jV,e),t.include(T.T,e),D.include(y.y),t.extensions.add("GL_OES_standard_derivatives"),(0,x.F1)(D),D.code.add((0,R.H)`
131      void main() {
132        discardBySlice(vpos);
133        ${e.hasMultipassTerrain?(0,R.H)`terrainDepthTest(gl_FragCoord, depth);`:""}
134        ${e.hasColorTexture?(0,R.H)`
135                vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?(0,R.H)`colorUV`:(0,R.H)`vuv0`});
136                ${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
137                discardOrAdjustAlpha(texColor);`:(0,R.H)`vec4 texColor = vec4(1.0);`}
138        vec3 viewDirection = normalize(vpos - cameraPosition);
139        ${e.pbrMode===b.f7.Normal?"applyPBRFactors();":""}
140        float ssao = evaluateAmbientOcclusionInverse();
141        ssao *= getBakedOcclusion();
142
143        float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
144        vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
145        ${e.receiveShadows?"float shadow = readShadowMap(vpos, linearDepth);":e.spherical?"float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);":"float shadow = 0.0;"}
146        vec3 matColor = max(ambient, diffuse);
147        ${e.hasVertexColors?(0,R.H)`
148                vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
149                float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:(0,R.H)`
150                vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
151                float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
152        ${e.snowCover?(0,R.H)`albedo = mix(albedo, vec3(1), 0.9);`:(0,R.H)``}
153        ${(0,R.H)`
154            vec3 shadingNormal = normalize(vNormalWorld);
155            albedo *= 1.2;
156            vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
157            float alignmentLightView = clamp(dot(viewForward, -mainLightDirection), 0.0, 1.0);
158            float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
159            float treeRadialFalloff = vColor.r;
160            float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
161            additionalLight += backLightFactor * mainLightIntensity;`}
162        ${e.pbrMode===b.f7.Normal||e.pbrMode===b.f7.Schematic?e.spherical?(0,R.H)`vec3 normalGround = normalize(vpos + localOrigin);`:(0,R.H)`vec3 normalGround = vec3(0.0, 0.0, 1.0);`:(0,R.H)``}
163        ${e.pbrMode===b.f7.Normal||e.pbrMode===b.f7.Schematic?(0,R.H)`
164                float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
165                ${e.snowCover?(0,R.H)`
166                        mrr = vec3(0.0, 1.0, 0.04);
167                        emission = vec3(0.0);`:""}
168
169                vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:(0,R.H)`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
170        gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
171        ${e.transparencyPassType===L.A.Color?(0,R.H)`gl_FragColor = premultiplyAlpha(gl_FragColor);`:(0,R.H)``}
172      }
173    `)),t.include(p.s,e),t}let F=Object.freeze(Object.defineProperty({__proto__:null,build:D},Symbol.toStringTag,{value:"Module"}))},91800:function(e,t,r){r.d(t,{S:function(){return g},b:function(){return m}});var i=r(61681),o=r(55709),n=r(69666),a=r(41383),s=r(6665),l=r(77334),c=r(93072),u=r(24603),d=r(23410),h=r(3961),f=r(15176);function m(){let e=new h.kG,t=e.fragment;return e.include(a.k),t.include(s.S),e.include(l.G),t.uniforms.add(new u.p("radius",(e,t)=>p(t))),t.code.add((0,d.H)`vec3 sphere[16];
174void fillSphere() {
175sphere[0] = vec3(0.186937, 0.0, 0.0);
176sphere[1] = vec3(0.700542, 0.0, 0.0);
177sphere[2] = vec3(-0.864858, -0.481795, -0.111713);
178sphere[3] = vec3(-0.624773, 0.102853, -0.730153);
179sphere[4] = vec3(-0.387172, 0.260319, 0.007229);
180sphere[5] = vec3(-0.222367, -0.642631, -0.707697);
181sphere[6] = vec3(-0.01336, -0.014956, 0.169662);
182sphere[7] = vec3(0.122575, 0.1544, -0.456944);
183sphere[8] = vec3(-0.177141, 0.85997, -0.42346);
184sphere[9] = vec3(-0.131631, 0.814545, 0.524355);
185sphere[10] = vec3(-0.779469, 0.007991, 0.624833);
186sphere[11] = vec3(0.308092, 0.209288,0.35969);
187sphere[12] = vec3(0.359331, -0.184533, -0.377458);
188sphere[13] = vec3(0.192633, -0.482999, -0.065284);
189sphere[14] = vec3(0.233538, 0.293706, -0.055139);
190sphere[15] = vec3(0.417709, -0.386701, 0.442449);
191}
192float fallOffFunction(float vv, float vn, float bias) {
193float f = max(radius * radius - vv, 0.0);
194return f * f * f * max(vn-bias, 0.0);
195}`),t.code.add((0,d.H)`float aoValueFromPositionsAndNormal(vec3 C, vec3 n_C, vec3 Q) {
196vec3 v = Q - C;
197float vv = dot(v, v);
198float vn = dot(normalize(v), n_C);
199return fallOffFunction(vv, vn, 0.1);
200}`),t.uniforms.add([new c.A("nearFar",(e,t)=>t.camera.nearFar),new f.A("normalMap",e=>e.normalTexture),new f.A("depthMap",e=>e.depthTexture),new c.A("zScale",(e,t)=>(0,l.R)(t)),new u.p("projScale",e=>e.projScale),new f.A("rnm",e=>e.noiseTexture),new c.A("rnmScale",(e,t)=>(0,o.s)(v,t.camera.fullWidth/(0,i.Wg)(e.noiseTexture).descriptor.width,t.camera.fullHeight/(0,i.Wg)(e.noiseTexture).descriptor.height)),new u.p("intensity",(e,t)=>2/p(t)**6),new c.A("screenSize",(e,t)=>(0,o.s)(v,t.camera.fullWidth,t.camera.fullHeight))]),t.code.add((0,d.H)`
201    void main(void) {
202      fillSphere();
203      vec3 fres = normalize((texture2D(rnm, uv * rnmScale).xyz * 2.0) - vec3(1.0));
204      float currentPixelDepth = linearDepthFromTexture(depthMap, uv, nearFar);
205
206      if (-currentPixelDepth>nearFar.y || -currentPixelDepth<nearFar.x) {
207        gl_FragColor = vec4(0.0);
208        return;
209      }
210
211      vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy,currentPixelDepth);
212
213      // get the normal of current fragment
214      vec4 norm4 = texture2D(normalMap, uv);
215      vec3 norm = vec3(-1.0) + 2.0 * norm4.xyz;
216      bool isTerrain = norm4.w<0.5;
217
218      float sum = .0;
219      vec3 tapPixelPos;
220
221      // note: the factor 2.0 should not be necessary, but makes ssao much nicer.
222      // bug or deviation from CE somewhere else?
223      float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y);
224
225      for(int i = 0; i < ${d.H.int(16)}; ++i) {
226        vec2 unitOffset = reflect(sphere[i], fres).xy;
227        vec2 offset = vec2(-unitOffset * radius * ps);
228
229        //don't use current or very nearby samples
230        if ( abs(offset.x)<2.0 || abs(offset.y)<2.0) continue;
231
232        vec2 tc = vec2(gl_FragCoord.xy + offset);
233        if (tc.x < 0.0 || tc.y < 0.0 || tc.x > screenSize.x || tc.y > screenSize.y) continue;
234        vec2 tcTap = tc / screenSize;
235        float occluderFragmentDepth = linearDepthFromTexture(depthMap, tcTap, nearFar);
236
237        if (isTerrain) {
238          bool isTerrainTap = texture2D(normalMap, tcTap).w<0.5;
239          if (isTerrainTap) {
240            continue;
241          }
242        }
243
244        tapPixelPos = reconstructPosition(tc, occluderFragmentDepth);
245
246        sum+= aoValueFromPositionsAndNormal(currentPixelPos, norm, tapPixelPos);
247      }
248
249      // output the result
250      float A = max(1.0 - sum * intensity / float(${d.H.int(16)}),0.0);
251
252      // Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4)/2.2
253      A = (pow(A, 0.2) + 1.2 * A*A*A*A) / 2.2;
254      gl_FragColor = vec4(A);
255    }
256  `),e}function p(e){return Math.max(10,20*e.camera.computeRenderPixelSizeAtDist(Math.abs(4*e.camera.relativeElevation)))}let v=(0,n.a)(),g=Object.freeze(Object.defineProperty({__proto__:null,build:m},Symbol.toStringTag,{value:"Module"}))},24756:function(e,t,r){r.d(t,{S:function(){return m},b:function(){return f}});var i=r(6766),o=r(41383),n=r(6665),a=r(26482),s=r(93072),l=r(24603),c=r(23410),u=r(3961),d=r(37649),h=r(15176);function f(){let e=new u.kG,t=e.fragment;return e.include(o.k),t.include(n.S),t.uniforms.add([new h.A("depthMap",e=>e.depthTexture),new d.R("tex",e=>e.colorTexture),new a.q("blurSize",e=>e.blurSize),new l.p("projScale",(e,t)=>{let r=(0,i.i)(t.camera.eye,t.camera.center);return r>5e4?Math.max(0,e.projScale-(r-5e4)):e.projScale}),new s.A("nearFar",(e,t)=>t.camera.nearFar)]),t.code.add((0,c.H)`
257    void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
258      float c = texture2D(tex, uv).r;
259      float d = linearDepthFromTexture(depthMap, uv, nearFar);
260
261      float ddiff = d - center_d;
262
263      float w = exp(-r * r * ${c.H.float(.08)} - ddiff * ddiff * sharpness);
264      wTotal += w;
265      bTotal += w * c;
266    }
267  `),t.code.add((0,c.H)`
268    void main(void) {
269      float b = 0.0;
270      float w_total = 0.0;
271
272      float center_d = linearDepthFromTexture(depthMap, uv, nearFar);
273
274      float sharpness = -0.05 * projScale / center_d;
275      for (int r = -${c.H.int(4)}; r <= ${c.H.int(4)}; ++r) {
276        float rf = float(r);
277        vec2 uvOffset = uv + rf * blurSize;
278        blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
279      }
280
281      gl_FragColor = vec4(b / w_total);
282    }
283  `),e}let m=Object.freeze(Object.defineProperty({__proto__:null,build:f},Symbol.toStringTag,{value:"Module"}))},42116:function(e,t,r){r.d(t,{a:function(){return x},c:function(){return v},f:function(){return T},g:function(){return _},h:function(){return g},j:function(){return A},m:function(){return E}}),r(39994);
283var i,o,n=r(13802),a=r(19431),s=r(61681),l=r(24455),c=r(6766),u=r(8909),d=r(88589),h=r(1983);(i=o||(o={}))[i.X=0]="X",i[i.Y=1]="Y",i[i.Z=2]="Z";var f=r(97537),m=r(5700),p=r(28888);function v(){return(0,h.c)()}function g(e,t=v()){return(0,d.c)(t,e)}function x(e){return e[3]}function _(e){return e}function T(e,t,r,i){return(0,h.f)(e,t,r,i)}function b(e,t,r){if((0,s.Wi)(t))return!1;let{origin:i,direction:o}=t;S[0]=i[0]-e[0],S[1]=i[1]-e[1],S[2]=i[2]-e[2];let n=o[0]*o[0]+o[1]*o[1]+o[2]*o[2];if(0===n)return!1;let a=2*(o[0]*S[0]+o[1]*S[1]+o[2]*S[2]),l=a*a-4*n*(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]-e[3]*e[3]);if(l<0)return!1;let c=Math.sqrt(l),u=(-a-c)/(2*n),d=(-a+c)/(2*n);return(u<0||d<u&&d>0)&&(u=d),!(u<0)&&(r&&(r[0]=i[0]+o[0]*u,r[1]=i[1]+o[1]*u,r[2]=i[2]+o[2]*u),!0)}let S=(0,u.c)();function A(e,t){return b(e,t,null)}function C(e,t,r){let i=p.WM.get(),o=p.MP.get();(0,c.f)(i,t.origin,t.direction);let n=x(e);(0,c.f)(r,i,t.origin),(0,c.g)(r,r,1/(0,c.l)(r)*n);let a=y(e,t.origin),s=(0,m.EU)(t.origin,r);return(0,l.d)(o,s+a,i),(0,c.m)(r,r,o),r}function w(e,t,r){let i=(0,c.b)(p.WM.get(),t,_(e)),o=(0,c.g)(p.WM.get(),i,e[3]/(0,c.l)(i));return(0,c.a)(r,o,_(e))}function y(e,t){let r=(0,c.b)(p.WM.get(),t,_(e)),i=(0,c.l)(r),o=x(e);return(0,a.ZF)(o/(o+Math.abs(o-i)))}let O=(0,u.c)();function M(e,t,r,i){let n=(0,c.b)(O,t,_(e));switch(r){case o.X:{let e=(0,a.jE)(n,O)[2];return(0,c.s)(i,-Math.sin(e),Math.cos(e),0)}case o.Y:{let e=(0,a.jE)(n,O),t=e[1],r=e[2],o=Math.sin(t);return(0,c.s)(i,-o*Math.cos(r),-o*Math.sin(r),Math.cos(t))}case o.Z:return(0,c.n)(i,n);default:return}}function P(e,t){let r=(0,c.b)(R,t,_(e));return(0,c.l)(r)-e[3]}function E(e,t){let r=(0,c.d)(_(e),t),i=x(e);return r<=i*i}let R=(0,u.c)(),I=v();Object.freeze(Object.defineProperty({__proto__:null,create:v,copy:g,fromCenterAndRadius:function(e,t){return(0,h.f)(e[0],e[1],e[2],t)},wrap:function(e){return e},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},fromRadius:function(e,t){return e[0]=e[1]=e[2]=0,e[3]=t,e},getRadius:x,getCenter:_,fromValues:T,elevate:function(e,t,r){return e!==r&&(0,c.c)(r,e),r[3]=e[3]+t,r},setExtent:function(e,t,r){return n.Z.getLogger("esri.geometry.support.sphere").error("sphere.setExtent is not yet supported"),e===r?r:g(e,r)},intersectRay:b,intersectsRay:A,intersectRayClosestSilhouette:function(e,t,r){if(b(e,t,r))return r;let i=C(e,t,p.WM.get());return(0,c.a)(r,t.origin,(0,c.g)(p.WM.get(),t.direction,(0,c.i)(t.origin,i)/(0,c.l)(t.direction))),r},closestPointOnSilhouette:C,closestPoint:function(e,t,r){return b(e,t,r)?r:((0,f.JI)(t,_(e),r),w(e,r,r))},projectPoint:w,distanceToSilhouette:function(e,t){let r=(0,c.b)(p.WM.get(),t,_(e));return Math.sqrt(Math.abs((0,c.p)(r)-e[3]*e[3]))},angleToSilhouette:y,axisAt:M,altitudeAt:P,setAltitudeAt:function(e,t,r,i){let n=P(e,t),a=M(e,t,o.Z,R),s=(0,c.g)(R,a,r-n);return(0,c.a)(i,t,s)},containsPoint:E,tmpSphere:I},Symbol.toStringTag,{value:"Module"}))},79912:function(e,t,r){function i(){return new Float32Array(3)}function o(e){let t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function n(e,t,r){let i=new Float32Array(3);return i[0]=e,i[1]=t,i[2]=r,i}function a(){return i()}function s(){return n(1,1,1)}function l(){return n(1,0,0)}function c(){return n(0,1,0)}function u(){return n(0,0,1)}r.d(t,{b:function(){return o},c:function(){return i},f:function(){return n}});let d=a(),h=s(),f=l(),m=c(),p=u();Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:o,fromValues:n,createView:function(e,t){return new Float32Array(e,t,3)},zeros:a,ones:s,unitX:l,unitY:c,unitZ:u,ZEROS:d,ONES:h,UNIT_X:f,UNIT_Y:m,UNIT_Z:p},Symbol.toStringTag,{value:"Module"}))},19480:function(e,t,r){r.d(t,{x:function(){return o}});var i=r(66581);class o{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.Y)(()=>this._reset()),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){let e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*n);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,n));e++)this._items.push(this._allocator())}}let n=1024},57989:function(e,t,r){function i(e){return e=e||globalThis.location.hostname,c.some(t=>null!=e?.match(t))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{XO:function(){return i},pJ:function(){return o}});let n=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,n,a,/^jsapps.esri.com$/,s,l]},56215:function(e,t,r){r.d(t,{Ue:function(){return l},nF:function(){return u},zk:function(){return c}});var i=r(19431),o=r(19480),n=r(6766),a=r(8909),s=r(28888);function l(e){return e?{origin:(0,a.a)(e.origin),vector:(0,a.a)(e.vector)}:{origin:(0,a.c)(),vector:(0,a.c)()}}function c(e,t,r=l()){return(0,n.c)(r.origin,e),(0,n.b)(r.vector,t,e),r}function u(e,t,r){return function(e,t,r,o,a){let{vector:l,origin:c}=e,u=(0,n.b)(s.WM.get(),t,c),d=(0,n.e)(l,u)/(0,n.p)(l);return(0,n.g)(a,l,(0,i.uZ)(d,0,1)),(0,n.a)(a,a,e.origin)}(e,t,0,0,r)}(0,a.c)(),(0,a.c)(),new o.x(()=>l())},97537:function(e,t,r){r.d(t,{JI:function(){return c},Ue:function(){return a},re:function(){return l}}),r(7753);var i=r(19480),o=r(6766),n=r(8909);function a(e){return e?s((0,n.a)(e.origin),(0,n.a)(e.direction)):s((0,n.c)(),(0,n.c)())}function s(e,t){return{origin:e,direction:t}}function l(e,t){let r=u.get();return r.origin=e,r.direction=t,r}function c(e,t,r){let i=(0,o.e)(e.direction,(0,o.b)(r,t,e.origin));return(0,o.a)(r,e.origin,(0,o.g)(r,e.direction,i)),r}r(28888);let u=new i.x(()=>a())},5700:function(e,t,r){r.d(t,{EU:function(){return a}});var i=r(19431),o=r(6766),n=r(8909);function a(e,t){let r=(0,o.e)(e,t)/((0,o.l)(e)*(0,o.l)(t));return-(0,i.ZF)(r)}(0,n.c)(),(0,n.c)()},28888:function(e,t,r){r.d(t,{MP:function(){return m},WM:function(){return f}});var i=r(4745),o=r(66581),n=r(34344),a=r(39100),s=r(61044),l=r(69666),c=r(8909),u=r(1983);class d{constructor(e,t,r){this._itemByteSize=e,this._itemCreate=t,this._buffers=[],this._items=[],this._itemsPtr=0,this._itemsPerBuffer=Math.ceil(r/this._itemByteSize)}get(){0===this._itemsPtr&&(0,o.Y)(()=>this._reset());let e=Math.floor(this._itemsPtr/this._itemsPerBuffer);for(;this._buffers.length<=e;){let e=new ArrayBuffer(this._itemsPerBuffer*this._itemByteSize);for(let t=0;t<this._itemsPerBuffer;++t)this._items.push(this._itemCreate(e,t*this._itemByteSize));this._buffers.push(e)}return this._items[this._itemsPtr++]}_reset(){let e=2*(Math.floor(this._itemsPtr/this._itemsPerBuffer)+1);for(;this._buffers.length>e;)this._buffers.pop(),this._items.length=this._buffers.length*this._itemsPerBuffer;this._itemsPtr=0}static createVec2f64(e=h){return new d(16,l.c,e)}static createVec3f64(e=h){return new d(24,c.b,e)}static createVec4f64(e=h){return new d(32,u.a,e)}static createMat3f64(e=h){return new d(72,n.a,e)}static createMat4f64(e=h){return new d(128,a.a,e)}static createQuatf64(e=h){return new d(32,s.c,e)}get test(){return{size:this._buffers.length*this._itemsPerBuffer*this._itemByteSize}}}let h=4*i.Y8.KILOBYTES;d.createVec2f64();let f=d.createVec3f64(),m=(d.createVec4f64(),d.createMat3f64(),d.createMat4f64());d.createQuatf64()},44883:function(e,t,r){r.d(t,{t:function(){return o}});var i=r(66341);async function o(e,t){let{data:r}=await (0,i.default)(e,{responseType:"image",...t});return r}},56252:function(e,t,r){let i;r.r(t),r.d(t,{fetch:function(){return tq},gltfToEngineResources:function(){return tX},parseUrl:function(){return tJ}});var o,n,a,s,l,c,u=r(57989),d=r(61681),h=r(1662),f=r(34344),m=r(24455),p=r(39100),v=r(6766),g=r(8909),x=r(37116),_=r(63338),T=r(86717),b=r(56999),S=r(64122),A=r(91420),C=r(64987),w=r(1731),y=r(19710),O=r(55542);function M(e){if((0,d.Wi)(e))return null;let t=(0,d.pC)(e.offset)?e.offset:O.Z,r=(0,d.pC)(e.rotation)?e.rotation:0,i=(0,d.pC)(e.scale)?e.scale:O.O,o=(0,y.f)(1,0,0,0,1,0,t[0],t[1],1),n=(0,y.f)(Math.cos(r),-
283Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),a=(0,y.f)(i[0],0,0,0,i[1],0,0,0,1),s=(0,y.c)();return(0,h.m)(s,n,a),(0,h.m)(s,o,s),s}class P{constructor(e,t,r,i,o){this.name=e,this.stageResources=t,this.lodThreshold=r,this.pivotOffset=i,this.numberOfVertices=o}}var E=r(66341),R=r(67979),I=r(4745),N=r(70375),L=r(13802),H=r(78668),D=r(26139),F=r(44883),z=r(70984),B=r(17993),V=r(15095);class U{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this.center=(0,g.c)(),this._children=void 0,(0,V.hu)(e.length>=1),(0,V.hu)(r.length%this._numIndexPerPrimitive==0),(0,V.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,V.hu)(3===i.size||4===i.size);let{data:o,size:n}=i,a=e.length,s=n*r[this._numIndexPerPrimitive*e[0]];G.clear(),G.push(s),this.bbMin=(0,g.f)(o[s],o[s+1],o[s+2]),this.bbMax=(0,g.a)(this.bbMin);for(let t=0;t<a;++t){let i=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=n*r[i+e],G.push(s);let t=o[s];this.bbMin[0]=Math.min(t,this.bbMin[0]),this.bbMax[0]=Math.max(t,this.bbMax[0]),t=o[s+1],this.bbMin[1]=Math.min(t,this.bbMin[1]),this.bbMax[1]=Math.max(t,this.bbMax[1]),t=o[s+2],this.bbMin[2]=Math.min(t,this.bbMin[2]),this.bbMax[2]=Math.max(t,this.bbMax[2])}}(0,v.h)(this.center,this.bbMin,this.bbMax,.5),this.radius=.5*Math.max(Math.max(this.bbMax[0]-this.bbMin[0],this.bbMax[1]-this.bbMin[1]),this.bbMax[2]-this.bbMin[2]);let l=this.radius*this.radius;for(let e=0;e<G.length;++e){let t=o[s=G.getItemAt(e)]-this.center[0],r=o[s+1]-this.center[1],i=o[s+2]-this.center[2],n=t*t+r*r+i*i;if(n<=l)continue;let a=Math.sqrt(n),c=.5*(a-this.radius);this.radius=this.radius+c,l=this.radius*this.radius;let u=c/a;this.center[0]+=t*u,this.center[1]+=r*u,this.center[2]+=i*u}G.clear()}getCenter(){return this.center}getBSRadius(){return this.radius}getBBMin(){return this.bbMin}getBBMax(){return this.bbMax}getChildren(){if(this._children)return this._children;if((0,v.d)(this.bbMin,this.bbMax)>1){let e=(0,v.h)((0,g.c)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=Array(8);for(let e=0;e<8;++e)i[e]=0;let{data:o,size:n}=this.position;for(let a=0;a<t;++a){let t=0,s=this._numIndexPerPrimitive*this.primitiveIndices[a],l=n*this.indices[s],c=o[l],u=o[l+1],d=o[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){let t=o[l=n*this.indices[s+e]],r=o[l+1],i=o[l+2];t<c&&(c=t),r<u&&(u=r),i<d&&(d=i)}c<e[0]&&(t|=1),u<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;let s=Array(8);for(let e=0;e<8;++e)s[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){let t=r[e];s[t][i[t]++]=this.primitiveIndices[e]}this._children=Array(8);for(let e=0;e<8;++e)void 0!==s[e]&&(this._children[e]=new U(s[e],this._numIndexPerPrimitive,this.indices,this.position))}return this._children}static prune(){G.prune()}}let G=new B.Z({deallocator:null});var W=r(10107),k=r(95399),$=r(19480),j=r(56215);r(28888),new $.x(j.Ue),new $.x(()=>({p0:(0,g.c)(),p1:(0,g.c)(),p2:(0,g.c)()}));let q=(0,g.c)(),J=(0,g.c)(),X=(0,g.c)(),K=(0,g.c)(),Y=(0,g.c)(),Z=(0,g.c)();var Q=r(71454),ee=r(21414);class et extends W.c{constructor(e,t=[],r=z.MX.Triangle,i=null,o=-1){for(let[t,n]of(super(),this._primitiveType=r,this.objectAndLayerIdColor=i,this.edgeIndicesLength=o,this.type=k.U.Geometry,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null,e))n&&this._vertexAttributes.set(t,{...n});if(null==t||0===t.length){let e=function(e){let t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,Q.p)(e);for(let r of(this.edgeIndicesLength=this.edgeIndicesLength<0?e:this.edgeIndicesLength,this._vertexAttributes.keys()))this._indices.set(r,t)}else for(let[e,r]of t)r&&(this._indices.set(e,(0,Q.mi)(r)),e===ee.T.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}cloneShallow(){let e=new et([],void 0,this._primitiveType,this.objectAndLayerIdColor,void 0),{_vertexAttributes:t,_indices:r}=e;
283return this._vertexAttributes.forEach((e,r)=>t.set(r,e)),this._indices.forEach((e,t)=>r.set(t,e)),e.screenToWorldRatio=this.screenToWorldRatio,e._boundingInfo=this._boundingInfo,e}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){let t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t.data=Array.from(t.data),t.exclusive=!0),t}get indices(){return this._indices}get indexCount(){let e=this._indices.values().next().value;return e?e.length:0}get primitiveType(){return this._primitiveType}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,d.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return this.primitiveType===z.MX.Triangle?this._computeAttachmentOriginTriangles(e):this._computeAttachmentOriginPoints(e)}_computeAttachmentOriginTriangles(e){let t=this.indices.get(ee.T.POSITION);return function(e,t,r){if(!e||!t)return!1;let{size:i,data:o}=e;(0,v.s)(r,0,0,0),(0,v.s)(Z,0,0,0);let n=0,a=0;for(let e=0;e<t.length-2;e+=3){let s=t[e+0]*i,l=t[e+1]*i,c=t[e+2]*i;(0,v.s)(X,o[s+0],o[s+1],o[s+2]),(0,v.s)(K,o[l+0],o[l+1],o[l+2]),(0,v.s)(Y,o[c+0],o[c+1],o[c+2]);let u=((0,v.b)(q,K,X),(0,v.b)(J,Y,X),(0,v.l)((0,v.f)(q,q,J))/2);u?((0,v.a)(X,X,K),(0,v.a)(X,X,Y),(0,v.g)(X,X,1/3*u),(0,v.a)(r,r,X),n+=u):((0,v.a)(Z,Z,X),(0,v.a)(Z,Z,K),(0,v.a)(Z,Z,Y),a+=3)}return(0!==a||0!==n)&&(0!==n?((0,v.g)(r,r,1/n),!0):0!==a&&((0,v.g)(r,Z,1/a),!0))}(this.vertexAttributes.get(ee.T.POSITION),t,e)}_computeAttachmentOriginPoints(e){let t=this.indices.get(ee.T.POSITION);return function(e,t,r){if(!e||!t)return!1;let{size:i,data:o}=e;(0,v.s)(r,0,0,0);let n=-1,a=0;for(let e=0;e<t.length;e++){let s=t[e]*i;n!==s&&(r[0]+=o[s+0],r[1]+=o[s+1],r[2]+=o[s+2],a++),n=s}return a>1&&(0,v.g)(r,r,1/a),a>0}(this.vertexAttributes.get(ee.T.POSITION),t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){let e=this.indices.get(ee.T.POSITION);if(!e||0===e.length)return null;let t=this.primitiveType===z.MX.Triangle?3:1;(0,V.hu)(e.length%t==0,"Indexing error: "+e.length+" not divisible by "+t);let r=(0,Q.p)(e.length/t),i=this.vertexAttributes.get(ee.T.POSITION);return i?new U(r,t,e,i):null}}var er=r(27755),ei=r(31355),eo=r(19431),en=r(86098),ea=r(3466),es=r(73401),el=r(1983),ec=r(41383),eu=r(63371),ed=r(23410),eh=r(3961),ef=r(15176);class em extends ed.K{constructor(){super(...arguments),this.color=(0,el.f)(1,1,1,1)}}Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:em,build:function(){let e=new eh.kG;return e.include(ec.k),e.fragment.uniforms.add([new ef.A("tex",e=>e.texture),new eu.N("uColor",e=>e.color)]),e.fragment.code.add((0,ed.H)`void main() {
284vec4 texColor = texture2D(tex, uv);
285gl_FragColor = texColor * uColor;
286}`),e}},Symbol.toStringTag,{value:"Module"}));var ep=r(36567);(o=s||(s={}))[o.ETC1_RGB=0]="ETC1_RGB",o[o.ETC2_RGBA=1]="ETC2_RGBA",o[o.BC1_RGB=2]="BC1_RGB",o[o.BC3_RGBA=3]="BC3_RGBA",o[o.BC4_R=4]="BC4_R",o[o.BC5_RG=5]="BC5_RG",o[o.BC7_M6_RGB=6]="BC7_M6_RGB",o[o.BC7_M5_RGBA=7]="BC7_M5_RGBA",o[o.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",o[o.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",o[o.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",o[o.ATC_RGB=11]="ATC_RGB",o[o.ATC_RGBA=12]="ATC_RGBA",o[o.FXT1_RGB=17]="FXT1_RGB",o[o.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",o[o.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",o[o.ETC2_EAC_R11=20]="ETC2_EAC_R11",o[o.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",o[o.RGBA32=13]="RGBA32",o[o.RGB565=14]="RGB565",o[o.BGR565=15]="BGR565",o[o.RGBA4444=16]="RGBA4444";var ev=r(91907),eg=r(43487),ex=r(62486);let e_=null,eT=null;async function eb(){return(0,d.Wi)(eT)&&(eT=function(){if((0,d.Wi)(i)){let e=e=>(0,ep.V)(`esri/libs/basisu/${e}`);i=r.e(1681).then(r.bind(r,21681)).then(e=>e.b).then(({default:t})=>t({locateFile:e}).then(e=>(e.initializeBasis(),delete e.then,e)))}return i}(),e_=await eT),eT}function eS(e,t,r,i,o){return Math.ceil(r*i*(0,ex.RG)(t?ev.q_.COMPRESSED_RGBA8_ETC2_EAC:ev.q_.COMPRESSED_RGB8_ETC2)*(o&&e>1?(4**e-1)/(3*4**(e-1)):1))}function eA(e){return e.getNumImages()>=1&&!e.isUASTC()}function eC(e){return e.getFaces()>=1&&e.isETC1S()}async function ew(e,t,r){(0,d.Wi)(e_)&&(e_=await eb());
286let i=new e_.BasisFile(new Uint8Array(r));if(!eA(i))return null;i.startTranscoding();let o=eO(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(),o}async function ey(e,t,r){(0,d.Wi)(e_)&&(e_=await eb());let i=new e_.KTX2File(new Uint8Array(r));if(!eC(i))return null;i.startTranscoding();let o=eO(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(),o}function eO(e,t,r,i,o,n,a,l){let{compressedTextureETC:c,compressedTextureS3TC:u}=e.capabilities,[d,h]=c?i?[s.ETC2_RGBA,ev.q_.COMPRESSED_RGBA8_ETC2_EAC]:[s.ETC1_RGB,ev.q_.COMPRESSED_RGB8_ETC2]:u?i?[s.BC3_RGBA,ev.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[s.BC1_RGB,ev.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[s.RGBA32,ev.VI.RGBA],f=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<f;e++)m.push(new Uint8Array(a(e,d))),l(e,d,m[e]);let p=m.length>1,v=p?ev.cw.LINEAR_MIPMAP_LINEAR:ev.cw.LINEAR,g={...t,samplingMode:v,hasMipmap:p,internalFormat:h,width:o,height:n};return new eg.x(e,g,{type:"compressed",levels:m})}let eM=L.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function eP(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}let eE=eP("DXT1"),eR=eP("DXT3"),eI=eP("DXT5");var eN=r(66521),eL=r(18567),eH=r(79193);class eD extends W.c{constructor(e,t){super(),this._data=e,this.type=k.U.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new ei.Z,this._passParameters=new em,this.params=t||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:ev.e8.REPEAT,t:ev.e8.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||z.CE.STRETCH,this.estimatedTexMemRequired=eD._estimateTexMemRequired(this._data,this.params),this._startPreload()}_startPreload(){let e=this._data;(0,d.Wi)(e)||(e instanceof HTMLVideoElement?this._startPreloadVideoElement(e):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,ea.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";let t=!e.paused;if(e.src=e.src,t&&e.autoplay){let t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,ea.HK)(e.src)||(0,ea.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}static _getDataDimensions(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}static _estimateTexMemRequired(e,t){if((0,d.Wi)(e))return 0;if((0,en.eP)(e)||(0,en.lq)(e))return t.encoding===eD.KTX2_ENCODING?function(e,t){if((0,d.Wi)(e_))return e.byteLength;let r=new e_.KTX2File(new Uint8Array(e)),i=eC(r)?eS(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,t.mipmap):t.encoding===eD.BASIS_ENCODING?function(e,t){if((0,d.Wi)(e_))return e.byteLength;let r=new e_.BasisFile(new Uint8Array(e)),i=eA(r)?eS(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;let{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?eD._getDataDimensions(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}dispose(){this._data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(e){return{target:ev.No.TEXTURE_2D,pixelFormat:ev.VI.RGBA,dataType:ev.Br.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?ev.cw.LINEAR_MIPMAP_LINEAR:ev.cw.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(this.params.mipmap?e.parameters.maxMaxAnisotropy:1)}}get glTexture(){return this._glTexture}load(e,t){if((0,d.pC)(this._glTexture))return this._glTexture;if((0,d.pC)(this._loadingPromise))return this._loadingPromise;let r=this._data;return(0,d.Wi)(r)?(this._glTexture=new eg.x(e,this._createDescriptor(e),null),this._glTexture):"string"==typeof r?this._loadFromURL(e,t,r):r instanceof Image?this._loadFromImageElement(e,t,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(e,t,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(e,r,t):((0,en.eP)(r)||(0,en.lq)(r))&&this.params.encoding===eD.DDS_
286ENCODING?(this._data=void 0,this._loadFromDDSData(e,r)):((0,en.eP)(r)||(0,en.lq)(r))&&this.params.encoding===eD.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(e,r)):((0,en.eP)(r)||(0,en.lq)(r))&&this.params.encoding===eD.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(e,r)):(0,en.lq)(r)?this._loadFromPixelData(e,r):(0,en.eP)(r)?this._loadFromPixelData(e,new Uint8Array(r)):null}get requiresFrameUpdates(){return this._data instanceof HTMLVideoElement}frameUpdate(e,t,r){if(!(this._data instanceof HTMLVideoElement)||(0,d.Wi)(this._glTexture)||this._data.readyState<l.HAVE_CURRENT_DATA||r===this._data.currentTime)return r;if((0,d.pC)(this._powerOfTwoStretchInfo)){let{framebuffer:r,vao:i,sourceTexture:o}=this._powerOfTwoStretchInfo;o.setData(this._data),this._drawStretchedTexture(e,t,r,i,o,this._glTexture)}else{let{videoWidth:e,videoHeight:t}=this._data,{width:r,height:i}=this._glTexture.descriptor;e!==r||t!==i?this._glTexture.updateData(0,0,0,Math.min(e,r),Math.min(t,i),this._data):this._glTexture.setData(this._data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.params.updateCallback&&this.params.updateCallback(),this._data.currentTime}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){let{textureData:i,internalFormat:o,width:n,height:a}=(0,d.s3)(function(e,t){let r,i,o;let n=new Int32Array(e,0,31);if(542327876!==n[0])return eM.error("Invalid magic number in DDS header"),null;if(!(4&n[20]))return eM.error("Unsupported format, must contain a FourCC code"),null;let a=n[21];switch(a){case eE:r=8,i=ev.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case eR:r=16,i=ev.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case eI:r=16,i=ev.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return eM.error("Unsupported FourCC code:",String.fromCharCode(255&a,a>>8&255,a>>16&255,a>>24&255)),null}let s=1,l=n[4],c=n[3];0==(3&l)&&0==(3&c)||(eM.warn("Rounding up compressed texture size to nearest multiple of 4."),l=l+3&-4,c=c+3&-4);let u=l,d=c;131072&n[2]&&!1!==t&&(s=Math.max(1,n[7])),1===s||(0,eo.wt)(l)&&(0,eo.wt)(c)||(eM.warn("Ignoring mipmaps of non power of two sized compressed texture."),s=1);let h=n[1]+4,f=[];for(let t=0;t<s;++t)f.push(new Uint8Array(e,h,o=(l+3>>2)*(c+3>>2)*r)),h+=o,l=Math.max(1,l>>1),c=Math.max(1,c>>1);return{textureData:{type:"compressed",levels:f},internalFormat:i,width:u,height:d}}(r,t.hasMipmap??!1));return t.samplingMode=i.levels.length>1?ev.cw.LINEAR_MIPMAP_LINEAR:ev.cw.LINEAR,t.hasMipmap=i.levels.length>1,t.internalFormat=o,t.width=n,t.height=a,new eg.x(e,t,i)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync(()=>ey(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>ew(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromPixelData(e,t){(0,V.hu)(this.params.width>0&&this.params.height>0);let r=this._createDescriptor(e);return r.pixelFormat=1===this.params.components?ev.VI.LUMINANCE:3===this.params.components?ev.VI.RGB:ev.VI.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new eg.x(e,r,t),this._glTexture}_loadFromURL(e,t,r){return this._loadAsync(async i=>{let o=await (0,F.t)(r,{signal:i});return(0,H.k_)(i),this._loadFromImage(e,o,t)})}_loadFromImageElement(e,t,r){return r.complete?this._loadFromImage(e,r,t):this._loadAsync(async i=>{let o=await (0,es.fY)(r,r.src,!1,i);return(0,H.k_)(i),this._loadFromImage(e,o,t)})}_loadFromVideoElement(e,t,r){return r.readyState>=l.HAVE_CURRENT_DATA?this._loadFromImage(e,r,t):this._loadFromVideoElementAsync(e,t,r)}_loadFromVideoElementAsync(e,t,r){return this._loadAsync(i=>new Promise((o,n)=>{let a=()=>{r.removeEventListener("loadeddata",s),r.removeEventListener("error",c),(0,d.hw)(u)},s=()=>{r.readyState>=l.HAVE_CURRENT_DATA&&(a(),o(this._loadFromImage(e,r,t)))},c=e=>{a(),n(e||new N.Z("Failed to load video"))};r.addEventListener("loadeddata",s),r.addEventListener("error",c);let u=(0,H.fu)(i,()=>c((0,H.zE)()))}))}_loadFromImage(e,t,r){let i=eD._getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;let o=this._createDescriptor(e);return o.pixelFormat=3===this.params.components?ev.VI.RGB:ev.VI.RGBA,!this._requiresPowerOfTwo(e,o)||(0,eo.wt)(i.width)&&(0,eo.wt)(i.height)?(o.width=i.width,o.height=i.height,this._glTexture=new eg.x(e,o,t)):this._glTexture=this._makePowerOfTwoTexture(e,t,i,o,r),this._glTexture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let r=e(t.signal);this._loadingPromise=r;let i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(e,t){let r=ev.e8.CLAMP_TO_EDGE,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return!(0,eH.Z)(e.gl)&&(t.hasMipmap||!i)}_makePowerOfTwoTexture(e,t,r,i,o){let n;let{width:a,height:s}=r,l=(0,eo.Sf)(a),c=(0,eo.Sf)(s);switch(i.width=l,i.height=c,this.params.powerOfTwoResizeMode){case z.CE.PAD:i.textureCoordinateScaleFactor=[a/l,s/c],(n=new eg.x(e,i)).updateData(0,0,0,a,s,t);break;case z.CE.STRETCH:case null:case void 0:n=this._stretchToPowerOfTwo(e,t,i,o());break;default:(0,er.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&n.generateMipmap(),n}_stretchToPowerOfTwo(e,t,r,i){let o=new eg.x(e,r),n=new eL.X(e,{colorTarget:ev.Lm.TEXTURE,depthStencilTarget:ev.OU.NONE}
286,o),a=new eg.x(e,{target:ev.No.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:ev.Br.UNSIGNED_BYTE,wrapMode:ev.e8.CLAMP_TO_EDGE,samplingMode:ev.cw.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=(0,eN.ow)(e),l=e.getBoundFramebufferObject();return this._drawStretchedTexture(e,i,n,s,a,o),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:s,sourceTexture:a,framebuffer:n}:(s.dispose(!0),a.dispose(),n.detachColorTexture(),n.dispose()),e.bindFramebuffer(l),o}_drawStretchedTexture(e,t,r,i,o,n){this._passParameters.texture=o,e.bindFramebuffer(r);let a=e.getViewport();e.setViewport(0,0,n.descriptor.width,n.descriptor.height),e.bindTechnique(t,this._passParameters,null),e.bindVAO(i),e.drawArrays(ev.MX.TRIANGLE_STRIP,0,(0,ex._V)(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height),this._passParameters.texture=null}unload(){if((0,d.pC)(this._powerOfTwoStretchInfo)){let{framebuffer:e,vao:t,sourceTexture:r}=this._powerOfTwoStretchInfo;t.dispose(!0),r.dispose(),e.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if((0,d.pC)(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),(0,d.pC)(this._loadingController)){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}eD.DDS_ENCODING="image/vnd-ms.dds",eD.KTX2_ENCODING="image/ktx2",eD.BASIS_ENCODING="image/x.basis",(n=l||(l={}))[n.HAVE_NOTHING=0]="HAVE_NOTHING",n[n.HAVE_METADATA=1]="HAVE_METADATA",n[n.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",n[n.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",n[n.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var eF=r(39994),ez=r(65684),eB=r(44685),eV=r(35031),eU=r(27125),eG=r(2833),eW=r(3864),ek=r(66865),e$=r(7358),ej=r(12045);(a=c||(c={}))[a.INTEGRATED_MESH=0]="INTEGRATED_MESH",a[a.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",a[a.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",a[a.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",a[a.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",a[a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",a[a.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",a[a.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",a[a.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",a[a.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",a[a.POSTPROCESSING_ENVIRONMENT_OPAQUE=10]="POSTPROCESSING_ENVIRONMENT_OPAQUE",a[a.POSTPROCESSING_ENVIRONMENT_TRANSPARENT=11]="POSTPROCESSING_ENVIRONMENT_TRANSPARENT",a[a.LASERLINES=12]="LASERLINES",a[a.LASERLINES_CONTRAST_CONTROL=13]="LASERLINES_CONTRAST_CONTROL",a[a.HUD_MATERIAL=14]="HUD_MATERIAL",a[a.LABEL_MATERIAL=15]="LABEL_MATERIAL",a[a.LINE_CALLOUTS=16]="LINE_CALLOUTS",a[a.LINE_CALLOUTS_HUD_DEPTH=17]="LINE_CALLOUTS_HUD_DEPTH",a[a.DRAPED_MATERIAL=18]="DRAPED_MATERIAL",a[a.DRAPED_WATER=19]="DRAPED_WATER",a[a.VOXEL=20]="VOXEL",a[a.MAX_SLOTS=21]="MAX_SLOTS";var eq=r(10663),eJ=r(61044),eX=r(79912),eK=r(42116);class eY{constructor(e=0){this.offset=e,this.tmpVertex=(0,g.c)()}applyToVertex(e,t,r){let i=e+this.localOrigin[0],o=t+this.localOrigin[1],n=r+this.localOrigin[2],a=this.offset/Math.sqrt(i*i+o*o+n*n);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+o*a,this.tmpVertex[2]=r+n*a,this.tmpVertex}applyToAabb(e){for(let t=0;t<3;++t)eZ[t]=e[0+t]+this.localOrigin[t],eQ[t]=e[3+t]+this.localOrigin[t],e0[t]=eZ[t];let t=this.applyToVertex(eZ[0],eZ[1],eZ[2]);for(let r=0;r<3;++r)e[r]=t[r],e[r+3]=t[r];let r=t=>{let r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t+0]=Math.min(e[t+0],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let t=0;t<3;++t)e0[t]=0==(e&1<<t)?eZ[t]:eQ[t];r(e0)}let i=0;for(let e=0;e<3;++e)eZ[e]*eQ[e]<0&&(i|=1<<e);if(0!==i&&7!==i){for(let e=0;e<8;++e)if(0==(i&e)){for(let t=0;t<3;++t)i[t]?e0[t]=0:e0[t]=0!=(e&1<<t)?eZ[t]:eQ[t];r(e0)}}for(let t=0;t<3;++t)e[t+0]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}}let eZ=(0,g.c)(),eQ=(0,g.c)(),e0=(0,g.c)();class e1{constructor(e=0){this.componentLocalOriginLength=0,this._tmpVertex=(0,g.c)(),this._mbs=(0,eK.c)(),this._obb={center:(0,g.c)(),halfSize:(0,eX.c)(),quaternion:null},this._totalOffset=0,this._offset=0,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}
286set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}applyToVertex(e,t,r){let i=r+this.componentLocalOriginLength,o=this._totalOffset/Math.sqrt(e*e+t*t+i*i);return this._tmpVertex[0]=e+e*o,this._tmpVertex[1]=t+t*o,this._tmpVertex[2]=r+i*o,this._tmpVertex}applyToAabb(e){let t=e[0],r=e[1],i=e[2]+this.componentLocalOriginLength,o=e[3],n=e[4],a=e[5]+this.componentLocalOriginLength,s=t*o<0?0:Math.min(Math.abs(t),Math.abs(o)),l=r*n<0?0:Math.min(Math.abs(r),Math.abs(n)),c=i*a<0?0:Math.min(Math.abs(i),Math.abs(a)),u=Math.sqrt(s*s+l*l+c*c);if(u<this._totalOffset)return e[0]-=t<0?this._totalOffset:0,e[1]-=r<0?this._totalOffset:0,e[2]-=i<0?this._totalOffset:0,e[3]+=o>0?this._totalOffset:0,e[4]+=n>0?this._totalOffset:0,e[5]+=a>0?this._totalOffset:0,e;let d=Math.max(Math.abs(t),Math.abs(o)),h=Math.max(Math.abs(r),Math.abs(n)),f=Math.max(Math.abs(i),Math.abs(a)),m=this._totalOffset/Math.sqrt(d*d+h*h+f*f),p=this._totalOffset/u;return e[0]+=t*(t>0?m:p),e[1]+=r*(r>0?m:p),e[2]+=i*(i>0?m:p),e[3]+=o*(o<0?m:p),e[4]+=n*(n<0?m:p),e[5]+=a*(a<0?m:p),e}applyToMbs(e){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this._totalOffset/t;return this._mbs[0]=e[0]+e[0]*r,this._mbs[1]=e[1]+e[1]*r,this._mbs[2]=e[2]+e[2]*r,this._mbs[3]=e[3]+e[3]*this._totalOffset/t,this._mbs}applyToObb(e){let t=e.center,r=this._totalOffset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this._obb.center[0]=t[0]+t[0]*r,this._obb.center[1]=t[1]+t[1]*r,this._obb.center[2]=t[2]+t[2]*r,(0,v.q)(this._obb.halfSize,e.halfSize,e.quaternion),(0,v.a)(this._obb.halfSize,this._obb.halfSize,e.center);let i=this._totalOffset/Math.sqrt(this._obb.halfSize[0]*this._obb.halfSize[0]+this._obb.halfSize[1]*this._obb.halfSize[1]+this._obb.halfSize[2]*this._obb.halfSize[2]);return this._obb.halfSize[0]+=this._obb.halfSize[0]*i,this._obb.halfSize[1]+=this._obb.halfSize[1]*i,this._obb.halfSize[2]+=this._obb.halfSize[2]*i,(0,v.b)(this._obb.halfSize,this._obb.halfSize,e.center),(0,eq.c)(e4,e.quaternion),(0,v.q)(this._obb.halfSize,this._obb.halfSize,e4),this._obb.halfSize[0]*=this._obb.halfSize[0]<0?-1:1,this._obb.halfSize[1]*=this._obb.halfSize[1]<0?-1:1,this._obb.halfSize[2]*=this._obb.halfSize[2]<0?-1:1,this._obb.quaternion=e.quaternion,this._obb}}class e3{constructor(e=0){this.offset=e,this.sphere=(0,eK.c)(),this.tmpVertex=(0,g.c)()}applyToVertex(e,t,r){let i=this.objectTransform.transform,o=i[0]*e+i[4]*t+i[8]*r+i[12],n=i[1]*e+i[5]*t+i[9]*r+i[13],a=i[2]*e+i[6]*t+i[10]*r+i[14],s=this.offset/Math.sqrt(o*o+n*n+a*a);o+=o*s,n+=n*s,a+=a*s;let l=this.objectTransform.inverse;return this.tmpVertex[0]=l[0]*o+l[4]*n+l[8]*a+l[12],this.tmpVertex[1]=l[1]*o+l[5]*n+l[9]*a+l[13],this.tmpVertex[2]=l[2]*o+l[6]*n+l[10]*a+l[14],this.tmpVertex}applyToMinMax(e,t){let r=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*r,e[1]+=e[1]*r,e[2]+=e[2]*r;let i=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*i,t[1]+=t[1]*i,t[2]+=t[2]*i}applyToAabb(e){let 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;let 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){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.sphere[0]=e[0]+e[0]*r,this.sphere[1]=e[1]+e[1]*r,this.sphere[2]=e[2]+e[2]*r,this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}}let e2=new e3;new e1,new eY;let e4=(0,eJ.a)();function e5(e,t,r,i,o){let n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==o||1===o)for(let r=0;r<s;++r){let o=3*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],i+=a}else for(let r=0;r<s;++r){let s=3*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],i+=a}}function e6(e,t,r,i,o,n=1){let a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(o*=s,r!==t.length||4!==r){if(1!==n){if(4!==r)for(let r=0;r<l;++r){let i=3*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}else for(let r=0;r<l;++r){let i=4*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}}else{if(4===r){for(let r=0;r<l;++r){let i=4*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}return}for(let r=0;r<l;++r){let i=3*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}}else{a[o]=t[0],a[o+1]=t[1],a[o+2]=t[2],a[o+3]=t[3];let e=new Uint32Array(i.typedBuffer.buffer,i.start),r=s/4,c=e[o/=4];o+=r;let u=l*n;for(let t=1;t<u;++t)e[o]=c,o+=r}}function e9(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[8]&&0===e[9]&&1===e[10]}var e8=r(16318),e7=r(82082),te=r(78549),tt=r(44391),tr=r(5331),ti=r(9969),to=r(52756),tn=r(5474),ta=r(95194);ev.wb.LESS,ev.wb.ALWAYS;let ts={mask:255},tl={function:{func:ev.wb.ALWAYS,ref:z.hU.OutlineVisualElementMask,mask:z.hU.OutlineVisualElementMask},operation:{fail:ev.xS.KEEP,zFail:ev.xS.KEEP,zPass:ev.xS.ZERO}},tc={function:{func:ev.wb.ALWAYS,ref:z.hU.OutlineVisualElementMask,mask:z.hU.OutlineVisualElementMask},operation:{fail:ev.xS.KEEP,zFail:ev.xS.KEEP,zPass:ev.xS.REPLACE}};ev.wb.EQUAL,z.hU.OutlineVisualElementMask,z.hU.OutlineVisualElementMask,ev.xS.KEEP,ev.xS.KEEP,ev.xS.KEEP,ev.wb.NOTEQUAL,z.hU.OutlineVisualElementMask,z.hU.OutlineVisualElementMask,ev.xS.KEEP,ev.xS.KEEP,ev.xS.KEEP;var tu=r(42842),td=r(45584),th=r(36172),tf=r(17346);class tm extends te.d4{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,g.f)(0,1,.5),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=z.Vr.Back,this.emissiveFactor=(0,g.f)(0,0,0),this.instancedDoublePrecision=!1,this.normals="default",this.receiveSSAO=!0,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,g.f)(.2,.2,.2),this.diffuse=(0,g.f)(.8,.8,.8),this.externalColor=(0,el.f)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,g.c)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSizeEnabled=!1,this.vvSizeMinSize=[1,1,1],this.vvSizeMaxSize=[100,100,100],this.vvSizeOffset=[0,0,0],this.vvSizeFactor=[1,1,1],this.vvSizeValue=[1,1,1],this.vvColorEnabled=!1,this.vvColorValues=[0,0,0,0,0,0,0,0],this.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],this.vvSymbolAnchor=[0,0,0],this.vvSymbolRotationMatrix=(0,f.c)(),this.vvOpacityEnabled=!1,this.vvOpacityValues=[],this.vvOpacityOpacities=[],this.transparent=!1,this.writeDepth=!0,this.customDepthTest=z.Gv.Less,this.textureAlphaMode=z.JJ.Blend,this.textureAlphaCutoff=tt.F,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=e$.yD.Occlude}}
286class tp extends to.A{initializeConfiguration(e,t){t.hasWebGL2Context=e.rctx.type===th.zO.WEBGL2,t.spherical=e.viewingMode===ez.JY.Global,t.doublePrecisionRequiresObfuscation=(0,tr.I)(e.rctx),t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?e7.N.Default:e7.N.None,t.objectAndLayerIdColorInstanced=t.instanced}initializeProgram(e){return this._initializeProgram(e,tp.shader)}_initializeProgram(e,t){return new ta.$(e.rctx,t.get().build(this.configuration),tn.i)}_convertDepthTestFunction(e){return e===z.Gv.Lequal?ev.wb.LEQUAL:ev.wb.LESS}_makePipeline(e,t){let r=this.configuration,i=e===tu.A.NONE,o=e===tu.A.FrontFace;return(0,tf.sm)({blending:(r.output===eV.H.Color||r.output===eV.H.Alpha)&&r.transparent?i?ej.wu:(0,ej.j7)(e):null,culling:(r.cullFace!==z.Vr.None||!r.hasSlicePlane&&!r.transparent&&!r.doubleSidedMode)&&(0,tf.zp)(r.cullFace),depthTest:{func:(0,ej.Bh)(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:i||o?r.writeDepth&&tf.LZ:null,colorWrite:tf.BK,stencilWrite:r.hasOccludees?ts:null,stencilTest:r.hasOccludees?t?tc:tl:null,polygonOffset:i||o?null:(0,ej.je)(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}tp.shader=new ti.J(td.D,()=>r.e(1180).then(r.bind(r,1180)));var tv=r(36663),tg=r(67197),tx=r(40017);class t_ extends tg.m{constructor(){super(...arguments),this.hasWebGL2Context=!1}}(0,tv._)([(0,tg.o)({constValue:!0})],t_.prototype,"hasSliceHighlight",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],t_.prototype,"hasSliceInVertexProgram",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],t_.prototype,"instancedDoublePrecision",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],t_.prototype,"useLegacyTerrainShading",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],t_.prototype,"hasModelTransformation",void 0),(0,tv._)([(0,tg.o)({constValue:tx.P.Pass})],t_.prototype,"pbrTextureBindType",void 0),(0,tv._)([(0,tg.o)()],t_.prototype,"hasWebGL2Context",void 0);class tT extends t_{constructor(){super(...arguments),this.output=eV.H.Color,this.alphaDiscardMode=z.JJ.Opaque,this.doubleSidedMode=eG.q.None,this.pbrMode=eW.f7.Disabled,this.cullFace=z.Vr.None,this.transparencyPassType=tu.A.NONE,this.normalType=eU.h.Attribute,this.textureCoordinateType=e7.N.None,this.customDepthTest=z.Gv.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.hasMultipassTerrain=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}}(0,tv._)([(0,tg.o)({count:eV.H.COUNT})],tT.prototype,"output",void 0),(0,tv._)([(0,tg.o)({count:z.JJ.COUNT})],tT.prototype,"alphaDiscardMode",void 0),(0,tv._)([(0,tg.o)({count:eG.q.COUNT})],tT.prototype,"doubleSidedMode",void 0),(0,tv._)([(0,tg.o)({count:eW.f7.COUNT})],tT.prototype,"pbrMode",void 0),(0,tv._)([(0,tg.o)({count:z.Vr.COUNT})],tT.prototype,"cullFace",void 0),(0,tv._)([(0,tg.o)({count:tu.A.COUNT})],tT.prototype,"transparencyPassType",void 0),(0,tv._)([(0,tg.o)({count:eU.h.COUNT})],tT.prototype,"normalType",void 0),(0,tv._)([(0,tg.o)({count:e7.N.
286COUNT})],tT.prototype,"textureCoordinateType",void 0),(0,tv._)([(0,tg.o)({count:z.Gv.COUNT})],tT.prototype,"customDepthTest",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"spherical",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasVertexColors",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasSymbolColors",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasVerticalOffset",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasSlicePlane",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasSliceHighlight",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasColorTexture",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasMetallicRoughnessTexture",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasEmissionTexture",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasOcclusionTexture",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasNormalTexture",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasScreenSizePerspective",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasVertexTangents",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasOccludees",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasMultipassTerrain",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasModelTransformation",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"offsetBackfaces",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"vvSize",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"vvColor",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"receiveShadows",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"receiveAmbientOcclusion",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"textureAlphaPremultiplied",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"instanced",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"instancedColor",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"objectAndLayerIdColorInstanced",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"instancedDoublePrecision",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"writeDepth",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"transparent",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"enableOffset",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"cullAboveGround",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"snowCover",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasColorTextureTransform",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasEmissionTextureTransform",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasNormalTextureTransform",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasOcclusionTextureTransform",void 0),(0,tv._)([(0,tg.o)()],tT.prototype,"hasMetallicRoughnessTextureTransform",void 0),(0,tv._)([(0,tg.o)({constValue:!0})],tT.prototype,"hasVvInstancing",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],tT.prototype,"useCustomDTRExponentForWater",void 0),(0,tv._)([(0,tg.o)({constValue:!1})],tT.prototype,"supportsTextureAtlas",void 0),(0,tv._)([(0,tg.o)({constValue:!0})],tT.prototype,"useFillLights",void 0);var tb=r(60926);class tS extends tp{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetallicRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=eU.h.Attribute,t.doubleSidedMode=eG.q.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,tS.shader)}}tS.shader=new ti.J(tb.R,()=>r.e(6353).then(r.bind(r,56353)));class tA extends e$.F5{constructor(e){var t;let r;super(e,ty),this.supportsEdges=!0,this._configuration=new tT,this._vertexBufferLayout=function(e){let t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=(0,eB.U$)().vec3f(ee.T.POSITION).vec3f(ee.T.NORMAL);return e.hasVertexTangents&&r.vec4f(ee.T.TANGENT),t&&r.vec2f(ee.T.UV0),e.hasVertexColors&&r.vec4u8(ee.T.COLOR),e.hasSymbolColors&&r.vec4u8(ee.T.SYMBOLCOLOR),(0,eF.Z)("enable-feature:objectAndLayerId-rendering")&&r.vec4u8(ee.T.OBJECTANDLAYERIDCOLOR),r}(this.parameters),this._instanceBufferLayout=e.instanced?(t=this.parameters,r=(0,eB.U$)(),r=t.instancedDoublePrecision?r.vec3f(ee.T.MODELORIGINHI).vec3f(ee.T.MODELORIGINLO).mat3f(ee.T.MODEL).mat3f(ee.T.MODELNORMAL):r.mat4f(ee.T.MODEL).mat4f(ee.T.MODELNORMAL),(0,d.pC)(t.instanced)&&t.instanced.includes("color")&&(r=r.vec4f(ee.T.INSTANCECOLOR)),(0,d.pC)(t.instanced)&&t.instanced.includes("featureAttribute")&&(r=r.vec4f(ee.T.INSTANCEFEATUREATTRIBUTE)),(0,d.pC)(t.instanced)&&t.instanced.includes("objectAndLayerIdColor")&&(r=r.vec4u8(ee.T.OBJECTANDLAYERIDCOLOR_INSTANCED)),r):null}isVisibleForOutput(e){return e!==eV.H.Shadow&&e!==eV.H.ShadowExludeHighlight&&e!==eV.H.ShadowHighlight||this.parameters.castShadows}isVisible(){let e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;let{instanced:t,hasVertexColors:r,hasSymbolColors:i,vvColorEnabled:o}=e,n=(0,d.pC)(t)&&t.includes("color"),a="replace"===e.colorMixMode,s=e.opacity>0,l=e.externalColor&&e.externalColor[3]>0;return r&&(n||o||i)?!!a||s:r?a?l:s:n||o||i?!!a||s:a?l:s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=!!this.parameters.instanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.hasVerticalOffset=(0,d.pC)(this.parameters.verticalOffset),this._configuration.hasScreenSizePerspective=(0,d.pC)(this.parameters.screenSizePerspective),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType="screenDerivative"===this.parameters.normals?eU.h.ScreenDerivative:eU.h.Attribute,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,(0,d.pC)(this.parameters.customDepthTest)&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?z.Vr.None:this.parameters.cullFace,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=(0,d.pC)(this.parameters.modelTransformation),e!==eV.H.Color&&e!==eV.H.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=eG.q.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?eG.q.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?eG.q.WindingOrder:eG.q.None,this._configuration.instancedColor=(0,d.pC)(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.ready&&this.parameters.receiveSSAO,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?eW.f7.Schematic:eW.f7.Normal:eW.f7.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<ej.ve,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return(0,d.pC)(e.weather)&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,i,o,n,a){var s;if((0,d.pC)(this.parameters.verticalOffset)){let e=i.camera;(0,v.s)(tN,r[12],r[13],r[14]);let t=null;switch(i.viewingMode){case ez.JY.Global:t=(0,v.n)(tR,tN);break;case ez.JY.Local:t=(0,v.c)(tR,tE)}let a=0,s=(0,v.b)(tL,tN,e.eye),l=(0,v.l)(s),c=(0,v.g)(s,s,1/l),u=null;this.parameters.screenSizePerspective&&(u=(0,v.e)(t,c)),a+=(0,e8.Hx)(e,l,this.parameters.verticalOffset,u,this.parameters.screenSizePerspective),(0,v.g)(t,t,a),(0,v.t)(tI,t,i.transform.inverseRotation),o=(0,v.b)(tM,o,tI),n=(0,v.b)(tP,n,tI)}(0,e8.Bw)(e,t,i,o,n,(s=i.verticalOffset,(0,d.pC)(s)?(e2.offset=s,e2):null),a)}requiresSlot(e,t){return(t===eV.H.Color||t===eV.H.Alpha||t===eV.H.Depth||t===eV.H.Normal||t===eV.H.Shadow||t===eV.H.ShadowHighlight||t===eV.H.ShadowExludeHighlight||t===eV.H.Highlight||t===eV.H.ObjectAndLayerIdColor)&&(e===(this.parameters.transparent?this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:c.OPAQUE_MATERIAL)||e===c.DRAPED_MATERIAL||t===eV.H.ObjectAndLayerIdColor)}createGLMaterial(e){return new tC(e)}createBufferWriter(){return new tO(this._vertexBufferLayout,this._instanceBufferLayout)}}class tC extends ek.F{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){let t=this._material.parameters;this.updateTexture(t.textureId);let r=e.camera.viewInverseTransposeMatrix;return(0,v.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?tS:tp,e)}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==eV.H.Color&&this._output!==eV.H.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this._updateParameters(e)}}class tw extends tm{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}
286let ty=new tw;class tO{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(ee.T.POSITION).length}write(e,t,r,i,o){!function(e,t,r,i,o,n){for(let a of t.fieldNames){let t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)switch(a){case ee.T.POSITION:{(0,V.hu)(3===t.size);let e=o.getField(a,_.ct);e&&function(e,t,r,i,o,n=1){if(!r)return void e5(e,t,i,o,n);let a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],u=r[1],d=r[2],h=r[4],f=r[5],m=r[6],p=r[8],v=r[9],g=r[10],x=r[12],_=r[13],T=r[14];o*=s;let b=0,S=0,A=0,C=e9(r)?e=>{b=t[e]+x,S=t[e+1]+_,A=t[e+2]+T}:e=>{let r=t[e],i=t[e+1],o=t[e+2];b=c*r+h*i+p*o+x,S=u*r+f*i+v*o+_,A=d*r+m*i+g*o+T};if(1===n)for(let t=0;t<l;++t)C(3*e[t]),a[o]=b,a[o+1]=S,a[o+2]=A,o+=s;else for(let t=0;t<l;++t){C(3*e[t]);for(let e=0;e<n;++e)a[o]=b,a[o+1]=S,a[o+2]=A,o+=s}}(s,t.data,r,e,n);break}case ee.T.NORMAL:{(0,V.hu)(3===t.size);let e=o.getField(a,_.ct);e&&function(e,t,r,i,o,n=1){if(!r)return void e5(e,t,i,o,n);let a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],u=r[1],d=r[2],h=r[4],f=r[5],p=r[6],v=r[8],g=r[9],x=r[10],_=!(0,m.x)(r);o*=s;let T=0,b=0,S=0,A=e9(r)?e=>{T=t[e],b=t[e+1],S=t[e+2]}:e=>{let r=t[e],i=t[e+1],o=t[e+2];T=c*r+h*i+v*o,b=u*r+f*i+g*o,S=d*r+p*i+x*o};if(1===n){if(_)for(let t=0;t<l;++t){A(3*e[t]);let r=T*T+b*b+S*S;if(r<.999999&&r>1e-6){let e=1/Math.sqrt(r);a[o]=T*e,a[o+1]=b*e,a[o+2]=S*e}else a[o]=T,a[o+1]=b,a[o+2]=S;o+=s}else for(let t=0;t<l;++t)A(3*e[t]),a[o]=T,a[o+1]=b,a[o+2]=S,o+=s}else for(let t=0;t<l;++t){if(A(3*e[t]),_){let e=T*T+b*b+S*S;if(e<.999999&&e>1e-6){let t=1/Math.sqrt(e);T*=t,b*=t,S*=t}}for(let e=0;e<n;++e)a[o]=T,a[o+1]=b,a[o+2]=S,o+=s}}(s,t.data,i,e,n);break}case ee.T.UV0:{(0,V.hu)(2===t.size);let e=o.getField(a,_.Eu);e&&function(e,t,r,i){let o=r.typedBuffer,n=r.typedBufferStride,a=e.length;i*=n;for(let r=0;r<a;++r){let a=2*e[r];o[i]=t[a],o[i+1]=t[a+1],i+=n}}(s,t.data,e,n);break}case ee.T.COLOR:{(0,V.hu)(3===t.size||4===t.size);let e=o.getField(a,_.mc);e&&e6(s,t.data,t.size,e,n);break}case ee.T.SYMBOLCOLOR:{(0,V.hu)(3===t.size||4===t.size);let e=o.getField(a,_.mc);e&&e6(s,t.data,t.size,e,n);break}case ee.T.TANGENT:{(0,V.hu)(4===t.size);let e=o.getField(a,_.ek);e&&function(e,t,r,i,o,n=1){if(!r)return void function(e,t,r,i,o=1){let n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===o)for(let r=0;r<s;++r){let o=4*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],n[i+3]=t[o+3],i+=a}else for(let r=0;r<s;++r){let s=4*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],n[i+3]=t[s+3],i+=a}}(e,t,i,o,n);let a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],u=r[1],d=r[2],h=r[4],f=r[5],p=r[6],v=r[8],g=r[9],x=r[10],_=!(0,m.x)(r);if(o*=s,1===n)for(let r=0;r<l;++r){let i=4*e[r],n=t[i],l=t[i+1],m=t[i+2],T=t[i+3],b=c*n+h*l+v*m,S=u*n+f*l+g*m,A=d*n+p*l+x*m;if(_){let e=b*b+S*S+A*A;if(e<.999999&&e>1e-6){let t=1/Math.sqrt(e);b*=t,S*=t,A*=t}}a[o]=b,a[o+1]=S,a[o+2]=A,a[o+3]=T,o+=s}else for(let r=0;r<l;++r){let i=4*e[r],l=t[i],m=t[i+1],T=t[i+2],b=t[i+3],S=c*l+h*m+v*T,A=u*l+f*m+g*T,C=d*l+p*m+x*T;if(_){let e=S*S+A*A+C*C;if(e<.999999&&e>1e-6){let t=1/Math.sqrt(e);S*=t,A*=t,C*=t}}for(let e=0;e<n;++e)a[o]=S,a[o+1]=A,a[o+2]=C,a[o+3]=b,o+=s}}(s,t.data,i,e,n)}}else if(a===ee.T.OBJECTANDLAYERIDCOLOR&&(0,d.pC)(e.objectAndLayerIdColor)&&4===e.objectAndLayerIdColor.length){let t=e.indices.get(ee.T.POSITION);if(t){let r=t.length,i=o.getField(a,_.mc);!function(e,t,r,i,o=1){let n=t.typedBuffer,a=t.typedBufferStride;if(i*=a,1===o)for(let t=0;t<r;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a;else for(let t=0;t<r;++t)for(let t=0;t<o;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a}(e.objectAndLayerIdColor,i,r,n)}}}}(r,this.vertexBufferLayout,e,t,i,o)}}let tM=(0,g.c)(),tP=(0,g.c)(),tE=(0,g.f)(0,0,1),tR=(0,g.c)(),tI=(0,g.c)(),tN=(0,g.c)(),tL=(0,g.c)(),tH=L.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");async function tD(e,t){let r=await tF(e,t),i=await tV(r.textureDefinitions,t),o=0;for(let e in i)if(i.hasOwnProperty(e)){let t=i[e];o+=t?.image?t.image.width*t.image.height*4:0}return{resource:r,textures:i,size:o+(0,I.Ul)(r)}}async function tF(e,t){let r=(0,d.pC)(t)&&t.streamDataRequester;if(r)return tz(e,r,t);let i=await (0,R.q6)((0,E.default)(e,(0,d.Wg)(t)));if(!0===i.ok)return i.value.data;(0,H.r9)(i.error),tB(i.error)}async function tz(e,t,r){let i=await (0,R.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,H.r9)(i.error),tB(i.error.details.url)}function tB(e){throw new N.Z("",`Request for object resource failed: ${e}`)}async function tV(e,t){let r=[];for(let i in e){let o=e[i],n=o.images[0].data;if(!n){tH.warn("Externally referenced texture data is not yet supported");continue}let a=o.encoding+";base64,"+n,s="/textureDefinitions/"+i,l="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:ev.e8.REPEAT,t:ev.e8.REPEAT},preMultiplyAlpha:tU(l)!==z.JJ.Opaque},u=(0,d.pC)(t)&&t.disableTextures?Promise.resolve(null):(0,F.t)(a,t);r.push(u.then(e=>({refId:s,image:e,params:c,alphaChannelUsage:l})))}let i=await Promise.all(r),o={};for(let e of i)o[e.refId]=e;return o}function tU(e){switch(e){case"mask":return z.JJ.Mask;case"maskAndTransparency":return z.JJ.MaskBlend;case"none":return z.JJ.Opaque;default:return z.JJ.Blend}}
286let tG=new D.G(1,2,"wosr");var tW=r(14634),tk=r(385),t$=r(32101),tj=r(14789);async function tq(e,t){let r=tJ((0,u.pJ)(e));if("wosr"===r.fileType){let{engineResources:e,referenceBoundingBox:i}=function(e,t){let r=[],i=[],o=[],n=[],a=e.resource,s=D.G.parse(a.version||"1.0","wosr");tG.validate(s);let l=a.model.name,c=a.model.geometries,u=a.materialDefinitions,h=e.textures,f=0,m=new Map;for(let e=0;e<c.length;e++){let a=c[e];if(!function(e){let t=e.params,r=t.topology,i=!0;switch(t.vertexAttributes||(tH.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{let e=t.faces;if(e){if(t.vertexAttributes)for(let r in t.vertexAttributes){let t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(tH.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(tH.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(tH.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else tH.warn("Indexed geometries must specify faces"),i=!1;break}default:tH.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(tH.warn("Geometry requires material"),i=!1);let o=e.params.vertexAttributes;for(let e in o)o[e].values||(tH.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}(a))continue;let s=function(e){let t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}(a),l=a.params.vertexAttributes,p=[];for(let e in l){let t=l[e],r=t.values;p.push([e,{data:r,size:t.valuesPerElement,exclusive:!0}])}let v=[];if("PerAttributeArray"!==a.params.topology){let e=a.params.faces;for(let t in e)v.push([t,e[t].values])}let x=h&&h[s.texture];if(x&&!m.has(s.texture)){let{image:e,params:t}=x,r=new eD(e,t);n.push(r),m.set(s.texture,r)}let _=m.get(s.texture),T=_?_.id:void 0,b=o[s.material]?o[s.material][s.texture]:null;if(!b){let e=u[s.material.substring(s.material.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);let r=x&&x.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,n=x?tU(x.alphaChannelUsage):void 0,a={ambient:(0,g.d)(e.diffuse),diffuse:(0,g.d)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:n,textureAlphaCutoff:.33,textureId:T,initTextureTransparent:!0,doubleSided:!0,cullFace:z.Vr.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!x&&!!x.params.preMultiplyAlpha};(0,d.pC)(t)&&t.materialParamsMixin&&Object.assign(a,t.materialParamsMixin),b=new tA(a),o[s.material]||(o[s.material]={}),o[s.material][s.texture]=b}i.push(b);let S=new et(p,v);f+=v.position?v.position.length:0,r.push(S)}return{engineResources:[{name:l,stageResources:{textures:n,materials:i,geometries:r},pivotOffset:a.model.pivotOffset,numberOfVertices:f,lodThreshold:null}],referenceBoundingBox:function(e){let t=(0,x.cS)();return e.forEach(e=>{let r=e.boundingInfo;(0,d.pC)(r)&&((0,x.pp)(t,r.getBBMin()),(0,x.pp)(t,r.getBBMax()))}),t}(r)}}(await (t.cache?t.cache.loadWOSR(r.url,t):tD(r.url,t)),t);return{lods:e,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let i=await (t.cache?t.cache.loadGLTF(r.url,t,t.usePBR):(0,C.Q)(new A.C(t.streamDataRequester),r.url,t,t.usePBR)),o=(0,d.U2)(i.model.meta,"ESRI_proxyEllipsoid"),n=i.meta.isEsriSymbolResource&&(0,d.pC)(o)&&i.meta.uri.includes("/RealisticTrees/");n&&!i.customMeta.esriTreeRendering&&(i.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r)for(let i of e.model.lods[r].parts){let o=i.attributes.normal;if((0,d.Wi)(o))return;let n=i.attributes.position,a=n.count,s=(0,g.c)(),l=(0,g.c)(),c=(0,g.c)(),u=(0,S.gS)(_.mc,a),h=(0,S.gS)(_.ct,a),f=(0,m.a)((0,p.c)(),i.transform);for(let d=0;d<a;d++){n.getVec(d,l),o.getVec(d,s),(0,v.m)(l,l,i.transform),(0,v.b)(c,l,t.center),(0,v.C)(c,c,t.radius);let a=c[2],m=(0,v.l)(c),p=Math.min(.45+.55*m*m,1);(0,v.C)(c,c,t.radius),null!==f&&(0,v.m)(c,c,f),(0,v.n)(c,c),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,v.h)(c,c,s,a>-1?.2:Math.min(-4*a-3.8,1)),h.setVec(d,c),u.set(d,0,255*p),u.set(d,1,255*p),u.set(d,2,255*p),u.set(d,3,25
2865)}i.attributes.normal=h,i.attributes.color=u}}(i,o));let a=i.meta.isEsriSymbolResource?{usePBR:t.usePBR,isSchematic:!1,treeRendering:n,mrrFactors:[0,1,.2]}:{usePBR:t.usePBR,isSchematic:!1,treeRendering:!1,mrrFactors:[0,1,.5]},{engineResources:s,referenceBoundingBox:l}=tX(i,a,{...t.materialParamsMixin,treeRendering:n},t.skipHighLods&&null==r.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:r.specifiedLodIndex});return{lods:s,referenceBoundingBox:l,isEsriSymbolResource:i.meta.isEsriSymbolResource,isWosr:!1}}function tJ(e){let 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}}function tX(e,t,r,i){let o=e.model,n=[],a=new Map,s=new Map,l=o.lods.length,c=(0,x.cS)();return o.lods.forEach((e,u)=>{let f=!0===i.skipHighLods&&(l>1&&0===u||l>3&&1===u)||!1===i.skipHighLods&&null!=i.singleLodIndex&&u!==i.singleLodIndex;if(f&&0!==u)return;let m=[],p=0;if(e.parts.forEach(e=>{let{geometry:t,vertexCount:r}=function(e){let t=function(e,t){switch(t){case ev.MX.TRIANGLES:return(0,w.nh)(e);case ev.MX.TRIANGLE_STRIP:return(0,w.DA)(e);case ev.MX.TRIANGLE_FAN:return(0,w.jX)(e)}}(e.indices||e.attributes.position.count,e.primitiveType),r=e.attributes.position.count,i=(0,S.gS)(_.ct,r);(0,T.t)(i,e.attributes.position,e.transform);let o=[[ee.T.POSITION,{data:i.typedBuffer,size:i.elementCount,exclusive:!0}]],n=[[ee.T.POSITION,t]];if((0,d.pC)(e.attributes.normal)){let i=(0,S.gS)(_.ct,r);(0,h.b)(tK,e.transform),(0,T.a)(i,e.attributes.normal,tK),o.push([ee.T.NORMAL,{data:i.typedBuffer,size:i.elementCount,exclusive:!0}]),n.push([ee.T.NORMAL,t])}if((0,d.pC)(e.attributes.tangent)){let i=(0,S.gS)(_.ek,r);(0,h.b)(tK,e.transform),(0,b.t)(i,e.attributes.tangent,tK),o.push([ee.T.TANGENT,{data:i.typedBuffer,size:i.elementCount,exclusive:!0}]),n.push([ee.T.TANGENT,t])}if((0,d.pC)(e.attributes.texCoord0)){let i=(0,S.gS)(_.Eu,r);(0,tk.n)(i,e.attributes.texCoord0),o.push([ee.T.UV0,{data:i.typedBuffer,size:i.elementCount,exclusive:!0}]),n.push([ee.T.UV0,t])}if((0,d.pC)(e.attributes.color)){let i=(0,S.gS)(_.mc,r);if(4===e.attributes.color.elementCount)e.attributes.color instanceof _.ek?(0,b.s)(i,e.attributes.color,255):e.attributes.color instanceof _.mc?(0,t$.c)(i,e.attributes.color):e.attributes.color instanceof _.v6&&(0,b.s)(i,e.attributes.color,1/256);else{(0,t$.f)(i,255,255,255,255);let t=new _.ne(i.buffer,0,4);e.attributes.color instanceof _.ct?(0,T.s)(t,e.attributes.color,255):e.attributes.color instanceof _.ne?(0,tj.c)(t,e.attributes.color):e.attributes.color instanceof _.mw&&(0,T.s)(t,e.attributes.color,1/256)}o.push([ee.T.COLOR,{data:i.typedBuffer,size:i.elementCount,exclusive:!0}]),n.push([ee.T.COLOR,t])}return{geometry:new et(o,n),vertexCount:r}}(e);m.push(t),p+=r;let i=t.boundingInfo;(0,d.pC)(i)&&0===u&&((0,x.pp)(c,i.getBBMin()),(0,x.pp)(c,i.getBBMax()))}),f)return;let v=new P(e.name,{textures:[],materials:[],geometries:m},e.lodThreshold,[0,0,0],p);n.push(v),e.parts.forEach(e=>{let i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),n=o.materials.get(e.material),l=(0,d.pC)(e.attributes.texCoord0),c=(0,d.pC)(e.attributes.normal);if((0,d.Wi)(n))return;let u=function(e){switch(e){case"BLEND":return z.JJ.Blend;case"MASK":return z.JJ.Mask;case"OPAQUE":case null:case void 0:return z.JJ.Opaque}}(n.alphaMode);
286if(!a.has(i)){if(l){let e=(e,t=!1)=>{if((0,d.pC)(e)&&!s.has(e)){let r=o.textures.get(e);(0,d.pC)(r)&&s.set(e,new eD(r.data,t?{...r.parameters,preMultiplyAlpha:t}:r.parameters))}};e(n.textureColor,u!==z.JJ.Opaque),e(n.textureNormal),e(n.textureOcclusion),e(n.textureEmissive),e(n.textureMetallicRoughness)}let h=n.color[0]**(1/tW.K),f=n.color[1]**(1/tW.K),m=n.color[2]**(1/tW.K),p=n.emissiveFactor[0]**(1/tW.K),v=n.emissiveFactor[1]**(1/tW.K),g=n.emissiveFactor[2]**(1/tW.K),x=(0,d.pC)(n.textureColor)&&l?s.get(n.textureColor):null;a.set(i,new tA({...t,transparent:u===z.JJ.Blend,customDepthTest:z.Gv.Lequal,textureAlphaMode:u,textureAlphaCutoff:n.alphaCutoff,diffuse:[h,f,m],ambient:[h,f,m],opacity:n.opacity,doubleSided:n.doubleSided,doubleSidedType:"winding-order",cullFace:n.doubleSided?z.Vr.None:z.Vr.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:c?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:(0,d.pC)(x)?x.id:void 0,colorMixMode:n.colorMixMode,normalTextureId:(0,d.pC)(n.textureNormal)&&l?s.get(n.textureNormal).id:void 0,textureAlphaPremultiplied:(0,d.pC)(x)&&!!x.params.preMultiplyAlpha,occlusionTextureId:(0,d.pC)(n.textureOcclusion)&&l?s.get(n.textureOcclusion).id:void 0,emissiveTextureId:(0,d.pC)(n.textureEmissive)&&l?s.get(n.textureEmissive).id:void 0,metallicRoughnessTextureId:(0,d.pC)(n.textureMetallicRoughness)&&l?s.get(n.textureMetallicRoughness).id:void 0,emissiveFactor:[p,v,g],mrrFactors:[n.metallicFactor,n.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,colorTextureTransformMatrix:M(n.colorTextureTransform),normalTextureTransformMatrix:M(n.normalTextureTransform),occlusionTextureTransformMatrix:M(n.occlusionTextureTransform),emissiveTextureTransformMatrix:M(n.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:M(n.metallicRoughnessTextureTransform),...r}))}if(v.stageResources.materials.push(a.get(i)),l){let e=e=>{(0,d.pC)(e)&&v.stageResources.textures.push(s.get(e))};e(n.textureColor),e(n.textureNormal),e(n.textureOcclusion),e(n.textureEmissive),e(n.textureMetallicRoughness)}})}),{engineResources:n,referenceBoundingBox:c}}let tK=(0,f.c)()},66352:function(e,t,r){var i,o;r.d(t,{a9:function(){return i}}),r(19431),(o=i||(i={}))[o.Multiply=1]="Multiply",o[o.Ignore=2]="Ignore",o[o.Replace=3]="Replace",o[o.Tint=4]="Tint"},44685:function(e,t,r){r.d(t,{U$:function(){return s}});var i=r(63338),o=r(90331);class n{constructor(e,t){for(let r of(this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t,e.fieldNames)){let t=e.fields.get(r);this[r]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){let r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new n(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,r,i){let o=this.stride;if(o%4==0){let n=new Uint32Array(e.buffer,t*o,i*o/4);new Uint32Array(this.buffer,r*o,i*o/4).set(n)}else{let n=new Uint8Array(e.buffer,t*o,i*o);new Uint8Array(this.buffer,r*o,i*o).set(n)}}}class a{constructor(){this.stride=0,this.fields=new Map,this.fieldNames=[]}vec2f(e,t){return this._appendField(e,i.Eu,t),this}vec2f64(e,t){return this._appendField(e,i.q6,t),this}vec3f(e,t){return this._appendField(e,i.ct,t),this}
286vec3f64(e,t){return this._appendField(e,i.fP,t),this}vec4f(e,t){return this._appendField(e,i.ek,t),this}vec4f64(e,t){return this._appendField(e,i.Cd,t),this}mat3f(e,t){return this._appendField(e,i.gK,t),this}mat3f64(e,t){return this._appendField(e,i.ey,t),this}mat4f(e,t){return this._appendField(e,i.bj,t),this}mat4f64(e,t){return this._appendField(e,i.O1,t),this}vec4u8(e,t){return this._appendField(e,i.mc,t),this}f32(e,t){return this._appendField(e,i.ly,t),this}f64(e,t){return this._appendField(e,i.oS,t),this}u8(e,t){return this._appendField(e,i.D_,t),this}u16(e,t){return this._appendField(e,i.av,t),this}i8(e,t){return this._appendField(e,i.Hz,t),this}vec2i8(e,t){return this._appendField(e,i.Vs,t),this}vec2i16(e,t){return this._appendField(e,i.or,t),this}vec2u8(e,t){return this._appendField(e,i.xA,t),this}vec4u16(e,t){return this._appendField(e,i.v6,t),this}u32(e,t){return this._appendField(e,i.Nu,t),this}_appendField(e,t,r){let i=t.ElementCount*(0,o.n1)(t.ElementType),n=this.stride;this.fields.set(e,{size:i,constructor:t,offset:n,optional:r}),this.stride+=i,this.fieldNames.push(e)}alignTo(e){return this.stride=Math.floor((this.stride+e-1)/e)*e,this}hasField(e){return this.fieldNames.includes(e)}createBuffer(e){return new n(this,e)}createView(e){return new n(this,e)}clone(){let e=new a;return e.stride=this.stride,e.fields=new Map,this.fields.forEach((t,r)=>e.fields.set(r,t)),e.fieldNames=this.fieldNames.slice(),e.BufferType=this.BufferType,e}}function s(){return new a}},95650:function(e,t,r){r.d(t,{Zu:function(){return l},bA:function(){return c},qj:function(){return u}});var i=r(35031),o=r(62295),n=r(93072),a=r(23410);function s(e){e.varyings.add("linearDepth","float")}function l(e){e.vertex.uniforms.add(new n.A("nearFar",(e,t)=>t.camera.nearFar))}function c(e){e.vertex.code.add((0,a.H)`float calculateLinearDepth(vec2 nearFar,float z) {
287return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
288}`)}function u(e,t){let{vertex:r}=e;switch(t.output){case i.H.Color:if(t.receiveShadows)return s(e),void r.code.add((0,a.H)`void forwardLinearDepth() { linearDepth = gl_Position.w; }`);break;case i.H.Depth:case i.H.Shadow:case i.H.ShadowHighlight:case i.H.ShadowExludeHighlight:return e.include(o.up,t),s(e),l(e),c(e),void r.code.add((0,a.H)`void forwardLinearDepth() {
289linearDepth = calculateLinearDepth(nearFar, vPosition_view.z);
290}`)}r.code.add((0,a.H)`void forwardLinearDepth() {}`)}},57218:function(e,t,r){r.d(t,{w:function(){return o}});var i=r(23410);function o(e){e.vertex.code.add((0,i.H)`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
291vec3 camToVert = posWorld - camPosWorld;
292bool isBackface = dot(camToVert, normalWorld) > 0.0;
293if (isBackface) {
294posClip.z += 0.0000003 * posClip.w;
295}
296return posClip;
297}`)}},41383:function(e,t,r){r.d(t,{k:function(){return n}});var i=r(23410),o=r(21414);function n(e,t=!0){e.attributes.add(o.T.POSITION,"vec2"),t&&e.varyings.add("uv","vec2"),e.vertex.code.add((0,i.H)`
298    void main(void) {
299      gl_Position = vec4(position, 0.0, 1.0);
300      ${t?(0,i.H)`uv = position * 0.5 + vec2(0.5);`:""}
301    }
302  `)}},35031:function(e,t,r){var i,o;r.d(t,{H:function(){return i}}),(o=i||(i={}))[o.Color=0]="Color",o[o.Depth=1]="Depth",o[o.Normal=2]="Normal",o[o.Shadow=3]="Shadow",o[o.ShadowHighlight=4]="ShadowHighlight",o[o.ShadowExludeHighlight=5]="ShadowExludeHighlight",o[o.Highlight=6]="Highlight",o[o.Alpha=7]="Alpha",o[o.ObjectAndLayerIdColor=8]="ObjectAndLayerIdColor",o[o.COUNT=9]="COUNT"},5885:function(e,t,r){r.d(t,{f5:function(){return u}});var i=r(61681),o=r(24455),n=r(39100),a=r(6766),s=r(8909),l=r(32006);r(43036);var c=r(23410);function u(e,t){!function(e,t,r){if(!t.hasSlicePlane){let r=(0,c.H)`#define rejectBySlice(_pos_) false
303#define discardBySlice(_pos_) {}
304#define highlightSlice(_color_, _pos_) (_color_)`;return t.hasSliceInVertexProgram&&e.vertex.code.add(r),void e.fragment.code.add(r)}e.extensions.add("GL_OES_standard_derivatives"),t.hasSliceInVertexProgram&&e.vertex.uniforms.add(r),e.fragment.uniforms.add(r);let i=(0,c.H)`struct SliceFactors {
305float front;
306float side0;
307float side1;
308float side2;
309float side3;
310};
311SliceFactors calculateSliceFactors(vec3 pos) {
312vec3 rel = pos - slicePlaneOrigin;
313vec3 slicePlaneNormal = -cross(slicePlaneBasis1, slicePlaneBasis2);
314float slicePlaneW = -dot(slicePlaneNormal, slicePlaneOrigin);
315float basis1Len2 = dot(slicePlaneBasis1, slicePlaneBasis1);
316float basis2Len2 = dot(slicePlaneBasis2, slicePlaneBasis2);
317float basis1Dot = dot(slicePlaneBasis1, rel);
318float basis2Dot = dot(slicePlaneBasis2, rel);
319return SliceFactors(
320dot(slicePlaneNormal, pos) + slicePlaneW,
321-basis1Dot - basis1Len2,
322basis1Dot - basis1Len2,
323-basis2Dot - basis2Len2,
324basis2Dot - basis2Len2
325);
326}
327bool sliceByFactors(SliceFactors factors) {
328return factors.front < 0.0
329&& factors.side0 < 0.0
330&& factors.side1 < 0.0
331&& factors.side2 < 0.0
332&& factors.side3 < 0.0;
333}
334bool sliceEnabled() {
335return dot(slicePlaneBasis1, slicePlaneBasis1) != 0.0;
336}
337bool sliceByPlane(vec3 pos) {
338return sliceEnabled() && sliceByFactors(calculateSliceFactors(pos));
339}
340#define rejectBySlice(_pos_) sliceByPlane(_pos_)
341#define discardBySlice(_pos_) { if (sliceByPlane(_pos_)) discard; }`,o=(0,c.H)`vec4 applySliceHighlight(vec4 color, vec3 pos) {
342SliceFactors factors = calculateSliceFactors(pos);
343const float HIGHLIGHT_WIDTH = 1.0;
344const vec4 HIGHLIGHT_COLOR = vec4(0.0, 0.0, 0.0, 0.3);
345factors.front /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.front);
346factors.side0 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side0);
347factors.side1 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side1);
348factors.side2 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side2);
349factors.side3 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side3);
350if (sliceByFactors(factors)) {
351return color;
352}
353float highlightFactor = (1.0 - step(0.5, factors.front))
354* (1.0 - step(0.5, factors.side0))
355* (1.0 - step(0.5, factors.side1))
356* (1.0 - step(0.5, factors.side2))
357* (1.0 - step(0.5, factors.side3));
358return mix(color, vec4(HIGHLIGHT_COLOR.rgb, color.a), highlightFactor * HIGHLIGHT_COLOR.a);
359}`,n=t.hasSliceHighlight?(0,c.H)`
360        ${o}
361        #define highlightSlice(_color_, _pos_) (sliceEnabled() ? applySliceHighlight(_color_, _pos_) : (_color_))
362      `:(0,c.H)`#define highlightSlice(_color_, _pos_) (_color_)`;t.hasSliceInVertexProgram&&e.vertex.code.add(i),e.fragment.code.add(i),e.fragment.code.add(n)}(e,t,[new l.B("slicePlaneOrigin",(e,r)=>
362(function(e,t,r){if((0,i.Wi)(r.slicePlane))return s.Z;let o=d(e,t,r),n=h(o,r.slicePlane),l=f(e,o,r);return(0,i.pC)(l)?(0,a.m)(v,n,l):n})(t,e,r)),new l.B("slicePlaneBasis1",(e,r)=>m(t,e,r,i.Wg(r.slicePlane)?.basis1)),new l.B("slicePlaneBasis2",(e,r)=>m(t,e,r,i.Wg(r.slicePlane)?.basis2))])}function d(e,t,r){return e.instancedDoublePrecision?(0,a.s)(p,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]):t.slicePlaneLocalOrigin}function h(e,t){return(0,i.pC)(e)?(0,a.b)(v,t.origin,e):t.origin}function f(e,t,r){return e.hasSliceTranslatedView?(0,i.pC)(t)?(0,o.v)(x,r.camera.viewMatrix,t):r.camera.viewMatrix:null}function m(e,t,r,o){if((0,i.Wi)(o)||(0,i.Wi)(r.slicePlane))return s.Z;let n=d(e,t,r),l=h(n,r.slicePlane),c=f(e,n,r);return(0,i.pC)(c)?((0,a.a)(g,o,l),(0,a.m)(v,l,c),(0,a.m)(g,g,c),(0,a.b)(g,g,v)):o}let p=(0,s.c)(),v=(0,s.c)(),g=(0,s.c)(),x=(0,n.c)()},4731:function(e,t,r){r.d(t,{w:function(){return n}});var i=r(95650),o=r(23410);function n(e,t){if((0,i.bA)(e),t.hasModelTransformation)return e.vertex.code.add((0,o.H)`vec4 transformPositionWithDepth(mat4 proj, mat4 view, mat4 model, vec3 pos, vec2 nearFar, out float depth) {
363vec4 eye = view * (model * vec4(pos, 1.0));
364depth = calculateLinearDepth(nearFar, eye.z);
365return proj * eye;
366}`),void e.vertex.code.add((0,o.H)`vec4 transformPosition(mat4 proj, mat4 view, mat4 model, vec3 pos) {
367return proj * (view * (model * vec4(pos, 1.0)));
368}`);e.vertex.code.add((0,o.H)`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
369vec4 eye = view * vec4(pos, 1.0);
370depth = calculateLinearDepth(nearFar,eye.z);
371return proj * eye;
372}`),e.vertex.code.add((0,o.H)`vec4 transformPosition(mat4 proj, mat4 view, vec3 pos) {
373return proj * (view * vec4(pos, 1.0));
374}`)}},99163:function(e,t,r){r.d(t,{f:function(){return p}});var i=r(36663),o=r(6766),n=r(8909),a=r(35031),s=r(5331),l=r(5614),c=r(32006),u=r(23410),d=r(67197),h=r(21414),f=r(30560);class m extends d.m{constructor(){super(...arguments),this.instancedDoublePrecision=!1}}function p(e,t){t.instanced&&t.instancedDoublePrecision&&(e.attributes.add(h.T.MODELORIGINHI,"vec3"),e.attributes.add(h.T.MODELORIGINLO,"vec3"),e.attributes.add(h.T.MODEL,"mat3"),e.attributes.add(h.T.MODELNORMAL,"mat3"));let r=e.vertex;t.instancedDoublePrecision&&(r.include(s.$,t),r.uniforms.add(new c.B("viewOriginHi",(e,t)=>(0,f.U8)((0,o.s)(v,t.camera.viewInverseTransposeMatrix[3],t.camera.viewInverseTransposeMatrix[7],t.camera.viewInverseTransposeMatrix[11]),v))),r.uniforms.add(new c.B("viewOriginLo",(e,t)=>(0,f.GB)((0,o.s)(v,t.camera.viewInverseTransposeMatrix[3],t.camera.viewInverseTransposeMatrix[7],t.camera.viewInverseTransposeMatrix[11]),v)))),r.code.add((0,u.H)`
375    vec3 calculateVPos() {
376      ${t.instancedDoublePrecision?"return model * localPosition().xyz;":"return localPosition().xyz;"}
377    }
378    `),r.code.add((0,u.H)`
379    vec3 subtractOrigin(vec3 _pos) {
380      ${t.instancedDoublePrecision?(0,u.H)`
381          vec3 originDelta = dpAdd(viewOriginHi, viewOriginLo, -modelOriginHi, -modelOriginLo);
382          return _pos - originDelta;`:"return vpos;"}
383    }
384    `),r.code.add((0,u.H)`
385    vec3 dpNormal(vec4 _normal) {
386      ${t.instancedDoublePrecision?"return normalize(modelNormal * _normal.xyz);":"return normalize(_normal.xyz);"}
387    }
388    `),t.output===a.H.Normal&&((0,l._8)(r),r.code.add((0,u.H)`
389    vec3 dpNormalView(vec4 _normal) {
390      ${t.instancedDoublePrecision?"return normalize((viewNormal * vec4(modelNormal * _normal.xyz, 1.0)).xyz);":"return normalize((viewNormal * _normal).xyz);"}
391    }
392    `)),t.hasVertexTangents&&r.code.add((0,u.H)`
393    vec4 dpTransformVertexTangent(vec4 _tangent) {
394      ${t.instancedDoublePrecision?"return vec4(modelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"}
395
396    }
397    `)}(0,i._)([(0,d.o)()],m.prototype,"instancedDoublePrecision",void 0);let v=(0,n.c)()},27125:function(e,t,r){r.d(t,{O:function(){return l},h:function(){return o}});var i,o,n=r(23410);function a(e){let t=(0,n.H)`vec3 decodeNormal(vec2 f) {
398float z = 1.0 - abs(f.x) - abs(f.y);
399return vec3(f + sign(f) * min(z, 0.0), z);
400}`;e.vertex.code.add(t)}var s=r(21414);function l(e,t){t.normalType===o.Attribute&&(e.attributes.add(s.T.NORMAL,"vec3"),e.vertex.code.add((0,n.H)`vec3 normalModel() {
401return normal;
402}`)),t.normalType===o.CompressedAttribute&&(e.include(a),e.attributes.add(s.T.NORMALCOMPRESSED,"vec2"),e.vertex.code.add((0,n.H)`vec3 normalModel() {
403return decodeNormal(normalCompressed);
404}`)),t.normalType===o.ScreenDerivative&&(e.extensions.add("GL_OES_standard_derivatives"),e.fragment.code.add((0,n.H)`vec3 screenDerivativeNormal(vec3 positionView) {
405return normalize(cross(dFdx(positionView), dFdy(positionView)));
406}`))}(i=o||(o={}))[i.Attribute=0]="Attribute",i[i.CompressedAttribute=1]="CompressedAttribute",i[i.Ground=2]="Ground",i[i.ScreenDerivative=3]="ScreenDerivative",i[i.COUNT=4]="COUNT"},91636:function(e,t,r){r.d(t,{f:function(){return n}});var i=r(23410),o=r(21414);function n(e){e.attributes.add(o.T.POSITION,"vec3"),e.vertex.code.add((0,i.H)`vec3 positionModel() { return position; }`)}},45658:function(e,t,r){r.d(t,{R:function(){return c}});
406var i=r(66352),o=r(23410);function n(e){e.vertex.code.add((0,o.H)`
407    vec4 decodeSymbolColor(vec4 symbolColor, out int colorMixMode) {
408      float symbolAlpha = 0.0;
409
410      const float maxTint = 85.0;
411      const float maxReplace = 170.0;
412      const float scaleAlpha = 3.0;
413
414      if (symbolColor.a > maxReplace) {
415        colorMixMode = ${o.H.int(i.a9.Multiply)};
416        symbolAlpha = scaleAlpha * (symbolColor.a - maxReplace);
417      } else if (symbolColor.a > maxTint) {
418        colorMixMode = ${o.H.int(i.a9.Replace)};
419        symbolAlpha = scaleAlpha * (symbolColor.a - maxTint);
420      } else if (symbolColor.a > 0.0) {
421        colorMixMode = ${o.H.int(i.a9.Tint)};
422        symbolAlpha = scaleAlpha * symbolColor.a;
423      } else {
424        colorMixMode = ${o.H.int(i.a9.Multiply)};
425        symbolAlpha = 0.0;
426      }
427
428      return vec4(symbolColor.r, symbolColor.g, symbolColor.b, symbolAlpha);
429    }
430  `)}var a=r(59842),s=r(21414),l=r(16318);function c(e,t){t.hasSymbolColors?(e.include(n),e.attributes.add(s.T.SYMBOLCOLOR,"vec4"),e.varyings.add("colorMixMode","mediump float"),e.vertex.code.add((0,o.H)`int symbolColorMixMode;
431vec4 getSymbolColor() {
432return decodeSymbolColor(symbolColor, symbolColorMixMode) * 0.003921568627451;
433}
434void forwardColorMixMode() {
435colorMixMode = float(symbolColorMixMode) + 0.5;
436}`)):(e.fragment.uniforms.add(new a._("colorMixMode",e=>l.FZ[e.colorMixMode])),e.vertex.code.add((0,o.H)`vec4 getSymbolColor() { return vec4(1.0); }
437void forwardColorMixMode() {}`))}},82082:function(e,t,r){r.d(t,{D:function(){return l},N:function(){return o}});var i,o,n=r(27755),a=r(23410),s=r(21414);function l(e,t){switch(t.textureCoordinateType){case o.Default:return e.attributes.add(s.T.UV0,"vec2"),e.varyings.add("vuv0","vec2"),void e.vertex.code.add((0,a.H)`void forwardTextureCoordinates() {
438vuv0 = uv0;
439}`);case o.Compressed:return e.attributes.add(s.T.UV0,"vec2"),e.varyings.add("vuv0","vec2"),void e.vertex.code.add((0,a.H)`vec2 getUV0() {
440return uv0 / 16384.0;
441}
442void forwardTextureCoordinates() {
443vuv0 = getUV0();
444}`);case o.Atlas:return e.attributes.add(s.T.UV0,"vec2"),e.varyings.add("vuv0","vec2"),e.attributes.add(s.T.UVREGION,"vec4"),e.varyings.add("vuvRegion","vec4"),void e.vertex.code.add((0,a.H)`void forwardTextureCoordinates() {
445vuv0 = uv0;
446vuvRegion = uvRegion;
447}`);default:(0,n.Bg)(t.textureCoordinateType);case o.None:return void e.vertex.code.add((0,a.H)`void forwardTextureCoordinates() {}`);case o.COUNT:return}}(i=o||(o={}))[i.None=0]="None",i[i.Default=1]="Default",i[i.Atlas=2]="Atlas",i[i.Compressed=3]="Compressed",i[i.COUNT=4]="COUNT"},6502:function(e,t,r){r.d(t,{c:function(){return n}});var i=r(23410),o=r(21414);function n(e,t){t.hasVertexColors?(e.attributes.add(o.T.COLOR,"vec4"),e.varyings.add("vColor","vec4"),e.vertex.code.add((0,i.H)`void forwardVertexColor() { vColor = color; }`),e.vertex.code.add((0,i.H)`void forwardNormalizedVertexColor() { vColor = color * 0.003921568627451; }`)):e.vertex.code.add((0,i.H)`void forwardVertexColor() {}
448void forwardNormalizedVertexColor() {}`)}},78549:function(e,t,r){r.d(t,{Bb:function(){return u},Pf:function(){return h},d4:function(){return d}});var i=r(34344),o=r(1983),n=r(27125),a=r(62295),s=r(23410),l=r(55784),c=r(11125);function u(e,t){t.normalType===n.h.Attribute||t.normalType===n.h.CompressedAttribute?(e.include(n.O,t),e.varyings.add("vNormalWorld","vec3"),e.varyings.add("vNormalView","vec3"),e.vertex.uniforms.add([new l.j("transformNormalGlobalFromModel",e=>e.transformNormalGlobalFromModel),new c.c("transformNormalViewFromGlobal",e=>e.transformNormalViewFromGlobal)]),e.vertex.code.add((0,s.H)`void forwardNormal() {
449vNormalWorld = transformNormalGlobalFromModel * normalModel();
450vNormalView = transformNormalViewFromGlobal * vNormalWorld;
451}`)):t.normalType===n.h.Ground?(e.include(a.up,t),e.varyings.add("vNormalWorld","vec3"),e.vertex.code.add((0,s.H)`
452    void forwardNormal() {
453      vNormalWorld = ${t.spherical?(0,s.H)`normalize(vPositionWorldCameraRelative);`:(0,s.H)`vec3(0.0, 0.0, 1.0);`}
454    }
455    `)):e.vertex.code.add((0,s.H)`void forwardNormal() {}`)}class d extends a.su{constructor(){super(...arguments),this.transformNormalViewFromGlobal=(0,i.c)()}}class h extends a.OU{constructor(){super(...arguments),this.transformNormalGlobalFromModel=(0,i.c)(),this.toMapSpace=(0,o.c)()}}},62295:function(e,t,r){r.d(t,{OU:function(){return g},su:function(){return v},up:function(){return p}});
455var i=r(34344),o=r(39100),n=r(79912),a=r(8909),s=r(91636),l=r(5331),c=r(32006),u=r(43036),d=r(23410),h=r(55784),f=r(11125),m=r(87621);function p(e,t){e.include(s.f);let r=e.vertex;r.include(l.$,t),e.varyings.add("vPositionWorldCameraRelative","vec3"),e.varyings.add("vPosition_view","vec3"),r.uniforms.add([new u.J("transformWorldFromViewTH",e=>e.transformWorldFromViewTH),new u.J("transformWorldFromViewTL",e=>e.transformWorldFromViewTL),new f.c("transformViewFromCameraRelativeRS",e=>e.transformViewFromCameraRelativeRS),new m.g("transformProjFromView",e=>e.transformProjFromView),new h.j("transformWorldFromModelRS",e=>e.transformWorldFromModelRS),new c.B("transformWorldFromModelTH",e=>e.transformWorldFromModelTH),new c.B("transformWorldFromModelTL",e=>e.transformWorldFromModelTL)]),r.code.add((0,d.H)`vec3 positionWorldCameraRelative() {
456vec3 rotatedModelPosition = transformWorldFromModelRS * positionModel();
457vec3 transform_CameraRelativeFromModel = dpAdd(
458transformWorldFromModelTL,
459transformWorldFromModelTH,
460-transformWorldFromViewTL,
461-transformWorldFromViewTH
462);
463return transform_CameraRelativeFromModel + rotatedModelPosition;
464}`),r.code.add((0,d.H)`
465    void forwardPosition(float fOffset) {
466      vPositionWorldCameraRelative = positionWorldCameraRelative();
467      if (fOffset != 0.0) {
468        vPositionWorldCameraRelative += fOffset * ${t.spherical?(0,d.H)`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:(0,d.H)`vec3(0.0, 0.0, 1.0)`};
469      }
470
471      vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
472      gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
473    }
474  `),e.fragment.uniforms.add(new u.J("transformWorldFromViewTL",e=>e.transformWorldFromViewTL)),r.code.add((0,d.H)`vec3 positionWorld() {
475return transformWorldFromViewTL + vPositionWorldCameraRelative;
476}`),e.fragment.code.add((0,d.H)`vec3 positionWorld() {
477return transformWorldFromViewTL + vPositionWorldCameraRelative;
478}`)}class v extends d.K{constructor(){super(...arguments),this.transformWorldFromViewTH=(0,a.c)(),this.transformWorldFromViewTL=(0,a.c)(),this.transformViewFromCameraRelativeRS=(0,i.c)(),this.transformProjFromView=(0,o.c)()}}class g extends d.K{constructor(){super(...arguments),this.transformWorldFromModelRS=(0,i.c)(),this.transformWorldFromModelTH=(0,n.c)(),this.transformWorldFromModelTL=(0,n.c)()}}},512:function(e,t,r){r.d(t,{i:function(){return s}});var i=r(27755),o=r(82082),n=r(23410);function a(e){e.extensions.add("GL_EXT_shader_texture_lod"),e.extensions.add("GL_OES_standard_derivatives"),e.fragment.code.add((0,n.H)`#ifndef GL_EXT_shader_texture_lod
479float calcMipMapLevel(const vec2 ddx, const vec2 ddy) {
480float deltaMaxSqr = max(dot(ddx, ddx), dot(ddy, ddy));
481return max(0.0, 0.5 * log2(deltaMaxSqr));
482}
483#endif
484vec4 textureAtlasLookup(sampler2D texture, vec2 textureSize, vec2 textureCoordinates, vec4 atlasRegion) {
485vec2 atlasScale = atlasRegion.zw - atlasRegion.xy;
486vec2 uvAtlas = fract(textureCoordinates) * atlasScale + atlasRegion.xy;
487float maxdUV = 0.125;
488vec2 dUVdx = clamp(dFdx(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
489vec2 dUVdy = clamp(dFdy(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
490#ifdef GL_EXT_shader_texture_lod
491return texture2DGradEXT(texture, uvAtlas, dUVdx, dUVdy);
492#else
493vec2 dUVdxAuto = dFdx(uvAtlas);
494vec2 dUVdyAuto = dFdy(uvAtlas);
495float mipMapLevel = calcMipMapLevel(dUVdx * textureSize, dUVdy * textureSize);
496float autoMipMapLevel = calcMipMapLevel(dUVdxAuto * textureSize, dUVdyAuto * textureSize);
497return texture2D(texture, uvAtlas, mipMapLevel - autoMipMapLevel);
498#endif
499}`)}function s(e,t){switch(e.include(o.D,t),e.fragment.code.add((0,n.H)`
500  struct TextureLookupParameter {
501    vec2 uv;
502    ${t.supportsTextureAtlas?"vec2 size;":""}
503  } vtc;
504  `),t.textureCoordinateType){case o.N.Default:case o.N.Compressed:return void e.fragment.code.add((0,n.H)`vec4 textureLookup(sampler2D texture, TextureLookupParameter params) {
505return texture2D(texture, params.uv);
506}`);case o.N.Atlas:return e.include(a),void e.fragment.code.add((0,n.H)`vec4 textureLookup(sampler2D texture, TextureLookupParameter params) {
507return textureAtlasLookup(texture, params.size, params.uv, vuvRegion);
508}`);default:(0,i.Bg)(t.textureCoordinateType);case o.N.None:case o.N.COUNT:return}}},78183:function(e,t,r){r.d(t,{L:function(){return u}});var i=r(88589),o=r(1983),n=r(63371),a=r(23410);function s(e){e.vertex.code.add((0,a.H)`float screenSizePerspectiveMinSize(float size, vec4 factor) {
509float nonZeroSize = 1.0 - step(size, 0.0);
510return (
511factor.z * (
5121.0 +
513nonZeroSize *
5142.0 * factor.w / (
515size + (1.0 - nonZeroSize)
516)
517)
518);
519}`),e.vertex.code.add((0,a.H)`float screenSizePerspectiveViewAngleDependentFactor(float absCosAngle) {
520return absCosAngle * absCosAngle * absCosAngle;
521}`),e.vertex.code.add((0,a.H)`vec4 screenSizePerspectiveScaleFactor(float absCosAngle, float distanceToCamera, vec4 params) {
522return vec4(
523min(params.x / (distanceToCamera - params.y), 1.0),
524screenSizePerspectiveViewAngleDependentFactor(absCosAngle),
525params.z,
526params.w
527);
528}`),e.vertex.code.add((0,a.H)`float applyScreenSizePerspectiveScaleFactorFloat(float size, vec4 factor) {
529return max(mix(size * factor.x, size, factor.y), screenSizePerspectiveMinSize(size, factor));
530}`),e.vertex.code.add((0,a.H)`float screenSizePerspectiveScaleFloat(float size, float absCosAngle, float distanceToCamera, vec4 params) {
531return applyScreenSizePerspectiveScaleFactorFloat(
532size,
533screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params)
534);
535}`),e.vertex.code.add((0,a.H)`vec2 applyScreenSizePerspectiveScaleFactorVec2(vec2 size, vec4 factor) {
536return mix(size * clamp(factor.x, screenSizePerspectiveMinSize(size.y, factor) / max(1e-5, size.y), 1.0), size, factor.y);
537}`),e.vertex.code.add((0,a.H)`vec2 screenSizePerspectiveScaleVec2(vec2 size, float absCosAngle, float distanceToCamera, vec4 params) {
538return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params));
539}`)}let l=(0,o.c)();var c=r(5614);function u(e,t){let r=e.vertex;t.hasVerticalOffset?(function(e){e.uniforms.add(new n.N("verticalOffset",(e,t)=>{let{minWorldLength:r,maxWorldLength:o,screenLength:n}=e.verticalOffset,a=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),s=t.camera.pixelRatio||1;return(0,i.s)(d,n*s,a,r,o)}))}(r),t.hasScreenSizePerspective&&(e.include(s),function(e){e.uniforms.add(new n.N("screenSizePerspectiveAlignment",e=>{var t;return t=e.screenSizePerspectiveAlignment||e.screenSizePerspective,(0,i.s)(l,t.parameters.divisor,t.parameters.offset,t.parameters.minPixelSize,t.paddingPixelsOverride)}))}(r),(0,c.hY)(e.vertex,t)),r.code.add((0,a.H)`
540      vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
541        float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
542        ${t.spherical?(0,a.H)`vec3 worldNormal = normalize(worldPos + localOrigin);`:(0,a.H)`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
543        ${t.hasScreenSizePerspective?(0,a.H)`
544            float cosAngle = dot(worldNormal, normalize(worldPos - cameraPosition));
545            float verticalOffsetScreenHeight = screenSizePerspectiveScaleFloat(verticalOffset.x, abs(cosAngle), viewDistance, screenSizePerspectiveAlignment);`:(0,a.H)`
546            float verticalOffsetScreenHeight = verticalOffset.x;`}
547        // Screen sized offset in world space, used for example for line callouts
548        float worldOffset = clamp(verticalOffsetScreenHeight * verticalOffset.y * viewDistance, verticalOffset.z, verticalOffset.w);
549        return worldNormal * worldOffset;
550      }
551
552      vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
553        return worldPos + calculateVerticalOffset(worldPos, localOrigin);
554      }
555    `)):r.code.add((0,a.H)`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}let d=(0,o.c)()},34091:function(e,t,r){r.d(t,{s:function(){return P}});var i=r(61681),o=r(39100),n=r(95650),a=r(35031),s=r(5885),l=r(4731),c=r(27125),u=r(23410),d=r(21414);function h(e,t){let r=t.output===a.H.ObjectAndLayerIdColor,i=t.objectAndLayerIdColorInstanced;r&&(e.varyings.add("objectAndLayerIdColorVarying","vec4"),i?e.attributes.add(d.T.OBJECTANDLAYERIDCOLOR_INSTANCED,"vec4"):e.attributes.add(d.T.OBJECTANDLAYERIDCOLOR,"vec4")),e.vertex.code.add((0,u.H)`
556     void forwardObjectAndLayerIdColor() {
557      ${r?i?(0,u.H)`objectAndLayerIdColorVarying = objectAndLayerIdColor_instanced * 0.003921568627451;`:(0,u.H)`objectAndLayerIdColorVarying = objectAndLayerIdColor * 0.003921568627451;`:(0,u.H)``} }`),e.fragment.code.add((0,u.H)`
558      void outputObjectAndLayerIdColor() {
559        ${r?(0,u.H)`gl_FragColor = objectAndLayerIdColorVarying;`:(0,u.H)``} }`)}var f=r(82082),m=r(78549),p=r(9794);function v(e,t){switch(e.fragment.include(p.n),t.output){case a.H.Shadow:case a.H.ShadowHighlight:case a.H.ShadowExludeHighlight:e.extensions.add("GL_OES_standard_derivatives"),e.fragment.code.add((0,u.H)`float _calculateFragDepth(const in float depth) {
560const float SLOPE_SCALE = 2.0;
561const float BIAS = 20.0 * .000015259;
562float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
563float result = depth + SLOPE_SCALE * m + BIAS;
564return clamp(result, .0, .999999);
565}
566void outputDepth(float _linearDepth) {
567gl_FragColor = float2rgba(_calculateFragDepth(_linearDepth));
568}`);break;case a.H.Depth:e.fragment.code.add((0,u.H)`void outputDepth(float _linearDepth) {
569gl_FragColor = float2rgba(_linearDepth);
570}`)}}var g=r(1983),x=r(4251),_=r(15176),T=r(89979);let b=(0,g.f)(1,1,0,1),S=(0,g.f)(1,0,1,1);function A(e,t){e.fragment.uniforms.add((0,_.J)("depthTex",(e,t)=>
570t.highlightDepthTexture,t.hasWebGL2Context?T.D.None:T.D.InvSize)),e.fragment.constants.add("occludedHighlightFlag","vec4",b).add("unoccludedHighlightFlag","vec4",S),e.fragment.code.add((0,u.H)`
571    void outputHighlight() {
572      vec3 fragCoord = gl_FragCoord.xyz;
573
574      float sceneDepth = ${(0,x.b6)(t,"depthTex","fragCoord.xy")}.x;
575      if (fragCoord.z > sceneDepth + 5e-7) {
576        gl_FragColor = occludedHighlightFlag;
577      }
578      else {
579        gl_FragColor = unoccludedHighlightFlag;
580      }
581    }
582  `)}var C=r(27641),w=r(41330),y=r(5614),O=r(87621),M=r(70984);function P(e,t){let{vertex:r,fragment:d}=e,p=t.hasModelTransformation;p&&r.uniforms.add(new O.g("model",e=>(0,i.pC)(e.modelTransformation)?e.modelTransformation:o.I));let g=t.hasColorTexture&&t.alphaDiscardMode!==M.JJ.Opaque;switch(t.output){case a.H.Depth:case a.H.Shadow:case a.H.ShadowHighlight:case a.H.ShadowExludeHighlight:case a.H.ObjectAndLayerIdColor:(0,y.Sv)(r,t),e.include(l.w,t),e.include(f.D,t),e.include(C.k,t),e.include(v,t),e.include(s.f5,t),e.include(h,t),(0,n.Zu)(e),e.varyings.add("depth","float"),g&&d.uniforms.add(new _.A("tex",e=>e.texture)),r.code.add((0,u.H)`
583          void main(void) {
584            vpos = calculateVPos();
585            vpos = subtractOrigin(vpos);
586            vpos = addVerticalOffset(vpos, localOrigin);
587            gl_Position = transformPositionWithDepth(proj, view, ${p?"model,":""} vpos, nearFar, depth);
588            forwardTextureCoordinates();
589            forwardObjectAndLayerIdColor();
590          }
591        `),e.include(w.z,t),d.code.add((0,u.H)`
592          void main(void) {
593            discardBySlice(vpos);
594            ${g?(0,u.H)`
595                    vec4 texColor = texture2D(tex, ${t.hasColorTextureTransform?(0,u.H)`colorUV`:(0,u.H)`vuv0`});
596                    discardOrAdjustAlpha(texColor);`:""}
597            ${t.output===a.H.ObjectAndLayerIdColor?(0,u.H)`outputObjectAndLayerIdColor();`:(0,u.H)`outputDepth(depth);`}
598          }
599        `);break;case a.H.Normal:(0,y.Sv)(r,t),e.include(l.w,t),e.include(c.O,t),e.include(m.Bb,t),e.include(f.D,t),e.include(C.k,t),g&&d.uniforms.add(new _.A("tex",e=>e.texture)),e.varyings.add("vPositionView","vec3"),r.code.add((0,u.H)`
600          void main(void) {
601            vpos = calculateVPos();
602            vpos = subtractOrigin(vpos);
603            ${t.normalType===c.h.Attribute?(0,u.H)`
604            vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:""}
605            vpos = addVerticalOffset(vpos, localOrigin);
606            gl_Position = transformPosition(proj, view, ${p?"model,":""} vpos);
607            forwardTextureCoordinates();
608          }
609        `),e.include(s.f5,t),e.include(w.z,t),d.code.add((0,u.H)`
610          void main() {
611            discardBySlice(vpos);
612            ${g?(0,u.H)`
613                    vec4 texColor = texture2D(tex, ${t.hasColorTextureTransform?(0,u.H)`colorUV`:(0,u.H)`vuv0`});
614                    discardOrAdjustAlpha(texColor);`:""}
615
616            ${t.normalType===c.h.ScreenDerivative?(0,u.H)`
617                vec3 normal = screenDerivativeNormal(vPositionView);`:(0,u.H)`
618                vec3 normal = normalize(vNormalWorld);
619                if (gl_FrontFacing == false) normal = -normal;`}
620            gl_FragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);
621          }
622        `);break;case a.H.Highlight:(0,y.Sv)(r,t),e.include(l.w,t),e.include(f.D,t),e.include(C.k,t),g&&d.uniforms.add(new _.A("tex",e=>e.texture)),r.code.add((0,u.H)`
623          void main(void) {
624            vpos = calculateVPos();
625            vpos = subtractOrigin(vpos);
626            vpos = addVerticalOffset(vpos, localOrigin);
627            gl_Position = transformPosition(proj, view, ${p?"model,":""} vpos);
628            forwardTextureCoordinates();
629          }
630        `),e.include(s.f5,t),e.include(w.z,t),e.include(A,t),d.code.add((0,u.H)`
631          void main() {
632            discardBySlice(vpos);
633            ${g?(0,u.H)`
634                    vec4 texColor = texture2D(tex, ${t.hasColorTextureTransform?(0,u.H)`colorUV`:(0,u.H)`vuv0`});
635                    discardOrAdjustAlpha(texColor);`:""}
636            outputHighlight();
637          }
638        `)}}},6665:function(e,t,r){r.d(t,{S:function(){return n}});var i=r(9794),o=r(23410);function n(e){e.include(i.n),e.code.add((0,o.H)`float linearDepthFromFloat(float depth, vec2 nearFar) {
639return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);
640}
641float linearDepthFromTexture(sampler2D depthTex, vec2 uv, vec2 nearFar) {
642return linearDepthFromFloat(rgba2float(texture2D(depthTex, uv)), nearFar);
643}`)}},3417:function(e,t,r){r.d(t,{Q:function(){return f}});var i=r(82082),o=r(512),n=r(2833),a=r(4251),s=r(23410),l=r(37649),c=r(15176),u=r(89979),d=r
643(40017),h=r(21414);function f(e,t){let r=e.fragment;if(t.hasVertexTangents?(e.attributes.add(h.T.TANGENT,"vec4"),e.varyings.add("vTangent","vec4"),t.doubleSidedMode===n.q.WindingOrder?r.code.add((0,s.H)`mat3 computeTangentSpace(vec3 normal) {
644float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
645vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
646vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
647return mat3(tangent, bitangent, normal);
648}`):r.code.add((0,s.H)`mat3 computeTangentSpace(vec3 normal) {
649float tangentHeadedness = vTangent.w;
650vec3 tangent = normalize(vTangent.xyz);
651vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
652return mat3(tangent, bitangent, normal);
653}`)):(e.extensions.add("GL_OES_standard_derivatives"),r.code.add((0,s.H)`mat3 computeTangentSpace(vec3 normal, vec3 pos, vec2 st) {
654vec3 Q1 = dFdx(pos);
655vec3 Q2 = dFdy(pos);
656vec2 stx = dFdx(st);
657vec2 sty = dFdy(st);
658float det = stx.t * sty.s - sty.t * stx.s;
659vec3 T = stx.t * Q2 - sty.t * Q1;
660T = T - normal * dot(normal, T);
661T *= inversesqrt(max(dot(T,T), 1.e-10));
662vec3 B = sign(det) * cross(normal, T);
663return mat3(T, B, normal);
664}`)),t.textureCoordinateType!==i.N.None){e.include(o.i,t);let i=t.supportsTextureAtlas?t.hasWebGL2Context?u.D.None:u.D.Size:u.D.None;r.uniforms.add(t.pbrTextureBindType===d.P.Pass?(0,c.J)("normalTexture",e=>e.textureNormal,i):(0,l.F)("normalTexture",e=>e.textureNormal,i)),r.code.add((0,s.H)`
665    vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
666      vtc.uv = uv;
667      ${t.supportsTextureAtlas?(0,s.H)`vtc.size = ${(0,a.w_)(t,"normalTexture")};`:""}
668      vec3 rawNormal = textureLookup(normalTexture, vtc).rgb * 2.0 - 1.0;
669      return tangentSpace * rawNormal;
670    }
671  `)}}},69828:function(e,t,r){r.d(t,{K:function(){return v}});var i=r(4251),o=r(23410),n=r(15176),a=r(89979);r(55709),r(44883),r(66521);
671var s=r(9969),l=r(52756),c=r(5474),u=r(95194),d=r(24756),h=r(17346);class f extends l.A{initializeProgram(e){return new u.$(e.rctx,f.shader.get().build(),c.i)}initializePipeline(){return(0,h.sm)({colorWrite:h.BK})}}f.shader=new s.J(d.S,()=>r.e(9018).then(r.bind(r,99018)));var m=r(91800);class p extends l.A{initializeProgram(e){return new u.$(e.rctx,p.shader.get().build(),c.i)}initializePipeline(){return(0,h.sm)({colorWrite:h.BK})}}function v(e,t){let r=e.fragment;t.receiveAmbientOcclusion?(r.uniforms.add((0,n.J)("ssaoTex",(e,t)=>t.ssaoHelper.colorTexture,t.hasWebGL2Context?a.D.None:a.D.InvSize)),r.constants.add("blurSizePixelsInverse","float",.5),r.code.add((0,o.H)`
672      float evaluateAmbientOcclusionInverse() {
673        vec2 ssaoTextureSizeInverse = ${(0,i.w_)(t,"ssaoTex",!0)};
674        return texture2D(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).a;
675      }
676
677      float evaluateAmbientOcclusion() {
678        return 1.0 - evaluateAmbientOcclusionInverse();
679      }
680    `)):r.code.add((0,o.H)`float evaluateAmbientOcclusionInverse() { return 1.0; }
681float evaluateAmbientOcclusion() { return 0.0; }`)}p.shader=new s.J(m.S,()=>r.e(4168).then(r.bind(r,4168))),r(69666),r(91907),r(18567),r(43487),r(62486)},21640:function(e,t,r){r.d(t,{XP:function(){return w},PN:function(){return A},sC:function(){return C}});var i=r(27755),o=r(6766),n=r(8909),a=r(88589),s=r(1983),l=r(3864),c=r(43036),u=r(63371),d=r(23410);function h(e,t){let r=e.fragment,i=void 0!==t.lightingSphericalHarmonicsOrder?t.lightingSphericalHarmonicsOrder:2;0===i?(r.uniforms.add(new c.J("lightingAmbientSH0",(e,t)=>(0,o.s)(f,t.lighting.sh.r[0],t.lighting.sh.g[0],t.lighting.sh.b[0]))),r.code.add((0,d.H)`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
682vec3 ambientLight = 0.282095 * lightingAmbientSH0;
683return ambientLight * (1.0 - ambientOcclusion);
684}`)):1===i?(r.uniforms.add([new u.N("lightingAmbientSH_R",(e,t)=>(0,a.s)(m,t.lighting.sh.r[0],t.lighting.sh.r[1],t.lighting.sh.r[2],t.lighting.sh.r[3])),new u.N("lightingAmbientSH_G",(e,t)=>(0,a.s)(m,t.lighting.sh.g[0],t.lighting.sh.g[1],t.lighting.sh.g[2],t.lighting.sh.g[3])),new u.N("lightingAmbientSH_B",(e,t)=>(0,a.s)(m,t.lighting.sh.b[0],t.lighting.sh.b[1],t.lighting.sh.b[2],t.lighting.sh.b[3]))]),r.code.add((0,d.H)`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
685vec4 sh0 = vec4(
6860.282095,
6870.488603 * normal.x,
6880.488603 * normal.z,
6890.488603 * normal.y
690);
691vec3 ambientLight = vec3(
692dot(lightingAmbientSH_R, sh0),
693dot(lightingAmbientSH_G, sh0),
694dot(lightingAmbientSH_B, sh0)
695);
696return ambientLight * (1.0 - ambientOcclusion);
697}`)):2===i&&(r.uniforms.add([new c.J("lightingAmbientSH0",(e,t)=>(0,o.s)(f,t.lighting.sh.r[0],t.lighting.sh.g[0],t.lighting.sh.b[0])),new u.N("lightingAmbientSH_R1",(e,t)=>(0,a.s)(m,t.lighting.sh.r[1],t.lighting.sh.r[2],t.lighting.sh.r[3],t.lighting.sh.r[4])),new u.N("lightingAmbientSH_G1",(e,t)=>(0,a.s)(m,t.lighting.sh.g[1],t.lighting.sh.g[2],t.lighting.sh.g[3],t.lighting.sh.g[4])),new u.N("lightingAmbientSH_B1",(e,t)=>(0,a.s)(m,t.lighting.sh.b[1],t.lighting.sh.b[2],t.lighting.sh.b[3],t.lighting.sh.b[4])),new u.N("lightingAmbientSH_R2",(e,t)=>(0,a.s)(m,t.lighting.sh.r[5],t.lighting.sh.r[6],t.lighting.sh.r[7],t.lighting.sh.r[8])),new u.N("lightingAmbientSH_G2",(e,t)=>(0,a.s)(m,t.lighting.sh.g[5],t.lighting.sh.g[6],t.lighting.sh.g[7],t.lighting.sh.g[8])),new u.N("lightingAmbientSH_B2",(e,t)=>(0,a.s)(m,t.lighting.sh.b[5],t.lighting.sh.b[6],t.lighting.sh.b[7],t.lighting.sh.b[8]))]),r.code.add((0,d.H)`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
698vec3 ambientLight = 0.282095 * lightingAmbientSH0;
699vec4 sh1 = vec4(
7000.488603 * normal.x,
7010.488603 * normal.z,
7020.488603 * normal.y,
7031.092548 * normal.x * normal.y
704);
705vec4 sh2 = vec4(
7061.092548 * normal.y * normal.z,
7070.315392 * (3.0 * normal.z * normal.z - 1.0),
7081.092548 * normal.x * normal.z,
7090.546274 * (normal.x * normal.x - normal.y * normal.y)
710);
711ambientLight += vec3(
712dot(lightingAmbientSH_R1, sh1),
713dot(lightingAmbientSH_G1, sh1),
714dot(lightingAmbientSH_B1, sh1)
715);
716ambientLight += vec3(
717dot(lightingAmbientSH_R2, sh2),
718dot(lightingAmbientSH_G2, sh2),
719dot(lightingAmbientSH_B2, sh2)
720);
721return ambientLight * (1.0 - ambientOcclusion);
722}`),t.pbrMode!==l.f7.Normal&&t.pbrMode!==l.f7.Schematic||r.code.add((0,d.H)`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0);
723vec3 calculateAmbientRadiance(float ambientOcclusion)
724{
725vec3 ambientLight = 1.2 * (0.282095 * lightingAmbientSH0) - 0.2;
726return ambientLight *= (1.0 - ambientOcclusion) * skyTransmittance;
727}`))}let f=(0,n.c)(),m=(0,s.c)();var p=r(69828),v=r(58749),g=r(74839),x=r(95509),_=r(91013),T=r(40017);class b extends _.x{constructor(e,t){super(e,"bool",T.P.Pass,(r,i,o)=>r.setUniform1b(e,t(i,o)))}}var S=r(24603);function A(e){e.constants.add("ambientBoostFactor","float",.4)}function C(e){e.uniforms.add(new S.p("lightingGlobalFactor",(e,t)=>t.lighting.globalFactor))}function w(e,t){let r=e.fragment;switch(e.include(p.K,t),t.pbrMode!==l.f7.Disabled&&e.include(g.T,t),e.include(h,t),e.include(x.e),r.code.add((0,d.H)`
728    const float GAMMA_SRGB = 2.1;
729    const float INV_GAMMA_SRGB = 0.4761904;
730    ${t.pbrMode===l.f7.Disabled?"":"const vec3 GROUND_REFLECTANCE = vec3(0.2);"}
731  `),A(r),C(r),(0,v.Pe)(r),r.code.add((0,d.H)`
732    float additionalDirectedAmbientLight(vec3 vPosWorld) {
733      float vndl = dot(${t.spherical?(0,d.H)`normalize(vPosWorld)`:(0,d.H)`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
734      return smoothstep(0.0, 1.0, clamp(vndl * 2.5, 0.0, 1.0));
735    }
736  `),(0,v.F1)(r),r.code.add((0,d.H)`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
737float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
738return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
739}`),t.pbrMode){case l.f7.Disabled:case l.f7.WaterOnIntegratedMesh:case l.f7.Water:e.include(v.kR,t),r.code.add((0,d.H)`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight)
740{
741vec3 mainLighting = evaluateMainLighting(normalWorld, shadow);
742vec3 ambientLighting = calculateAmbientIrradiance(normalWorld, ssao);
743vec3 albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
744vec3 totalLight = mainLighting + ambientLighting + additionalLight;
745totalLight = min(totalLight, vec3(PI));
746vec3 outColor = vec3((albedoLinear / PI) * totalLight);
747return pow(outColor, vec3(INV_GAMMA_SRGB));
748}`);break;case l.f7.Normal:case l.f7.Schematic:r.code.add((0,d.H)`const float fillLightIntensity = 0.25;
749const float horizonLightDiffusion = 0.4;
750const float additionalAmbientIrradianceFactor = 0.02;
751vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDir, vec3 normalGround, vec3 mrr, vec3 _emission, float additionalAmbientIrradiance)
752{
753vec3 viewDirection = -viewDir;
754vec3 mainLightDirection = mainLightDirection;
755vec3 h = normalize(viewDirection + mainLightDirection);
756PBRShadingInfo inputs;
757inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
758inputs.NdotV = clamp(abs(dot(normal, viewDirection)), 0.001, 1.0);
759inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
760inputs.VdotH = clamp(dot(viewDirection, h), 0.0, 1.0);
761inputs.NdotNG = clamp(dot(normal, normalGround), -1.0, 1.0);
762vec3 reflectedView = normalize(reflect(viewDirection, normal));
763inputs.RdotNG = clamp(dot(reflectedView, normalGround), -1.0, 1.0);
764inputs.albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
765inputs.ssao = ssao;
766inputs.metalness = mrr[0];
767inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),r.code.add((0,d.H)`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
768inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
769inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),t.useFillLights?r.uniforms.add(new b("hasFillLights",(e,t)=>t.enableFillLights)):r.constants.add("hasFillLights","bool",!1),r.code.add((0,d.H)`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]);
770ambientDir = ambientDir != vec3(0.0)? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
771inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
772vec3 mainLightIrradianceComponent = inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
773vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
774vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
775inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
776inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),r.uniforms.add([new S.p("lightingSpecularStrength",(e,t)=>t.lighting.mainLight.specularStrength),new S.p("lightingEnvironmentStrength",(e,t)=>t.lighting.mainLight.environmentStrength)]),r.code.add((0,d.H)`vec3 horizonRingDir = inputs.RdotNG * normalGround - reflectedView;
777vec3 horizonRingH = normalize(viewDirection + horizonRingDir);
778inputs.NdotH_Horizon = dot(normal, horizonRingH);
779vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(inputs.NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
780vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
781vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance(ssao) + additionalLight;
782inputs.skyRadianceToSurface = ambientLightRadianceComponent + mainLightRadianceComponent + horizonLightRadianceComponent;
783inputs.groundRadianceToSurface = GROUND_REFLECTANCE * (ambientLightRadianceComponent + horizonLightRadianceComponent) + mainLightRadianceComponent;
784inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE[1]);`),r.code.add((0,d.H)`
785        vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
786        vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
787        vec3 emissionComponent = pow(_emission, vec3(GAMMA_SRGB));
788        vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent + emissionComponent;
789        ${t.pbrMode===l.f7.Schematic?(0,d.H)`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`:(0,d.H)`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs), vec3(INV_GAMMA_SRGB));`}
790        return outColor;
791      }
792    `);break;default:(0,i.Bg)(t.pbrMode);case l.f7.COUNT:}}r(19431),(0,n.c)(),(0,n.c)()},58749:function(e,t,r){r.d(t,{F1:function(){return s},Pe:function(){return a},kR:function(){return l}});var i=r(43036),o=r(24603),n=r(23410);function a(e){e.uniforms.add(new i.J("mainLightDirection",(e,t)=>t.lighting.mainLight.direction))}function s(e){e.uniforms.add(new i.J("mainLightIntensity",(e,t)=>t.lighting.mainLight.intensity))}function l(e,t){let r=e.fragment;a(r),s(r),t.useLegacyTerrainShading?r.uniforms.add(new o.p("lightingFixedFactor",(e,t)=>t.lighting.noonFactor*(1-t.lighting.globalFactor))):r.constants.add("lightingFixedFactor","float",0),r.code.add((0,n.H)`vec3 evaluateMainLighting(vec3 normal_global, float shadowing) {
793float dotVal = clamp(dot(normal_global, mainLightDirection), 0.0, 1.0);
794dotVal = mix(dotVal, 1.0, lightingFixedFactor);
795return mainLightIntensity * ((1.0 - shadowing) * dotVal);
796}`)}},73393:function(e,t,r){r.d(t,{l:function(){return s}});var i=r(6665),o=r(93072),n=r(23410),a=r(15176);function s(e,t){t.hasMultipassTerrain&&(e.fragment.include(i.S),e.fragment.uniforms.add(new a.A("terrainDepthTexture",(e,t)=>t.multipassTerrain.linearDepthTexture)),e.fragment.uniforms.add(new o.A("nearFar",(e,t)=>t.camera.nearFar)),e.fragment.uniforms.add(new o.A("inverseViewport",(e,t)=>t.inverseViewport)),e.fragment.code.add((0,n.H)`
797    void terrainDepthTest(vec4 fragCoord, float fragmentDepth){
798      float terrainDepth = linearDepthFromTexture(terrainDepthTexture, fragCoord.xy * inverseViewport, nearFar);
799      if(fragmentDepth ${t.cullAboveGround?">":"<="} terrainDepth){
800        discard;
801      }
802    }
803  `))}},2833:function(e,t,r){r.d(t,{k:function(){return s},q:function(){return o}});var i,o,n=r(27755),a=r(23410);function s(e,t){let r=e.fragment;switch(r.code.add((0,a.H)`struct ShadingNormalParameters {
804vec3 normalView;
805vec3 viewDirection;
806} shadingParams;`),t.doubleSidedMode){case o.None:r.code.add((0,a.H)`vec3 shadingNormal(ShadingNormalParameters params) {
807return normalize(params.normalView);
808}`);break;case o.View:r.code.add((0,a.H)`vec3 shadingNormal(ShadingNormalParameters params) {
809return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
810}`);break;case o.WindingOrder:r.code.add((0,a.H)`vec3 shadingNormal(ShadingNormalParameters params) {
811return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
812}`);break;default:(0,n.Bg)(t.doubleSidedMode);case o.COUNT:}}(i=o||(o={}))[i.None=0]="None",i[i.View=1]="View",i[i.WindingOrder=2]="WindingOrder",i[i.COUNT=3]="COUNT"},74839:function(e,t,r){r.d(t,{T:function(){return s}});var i=r(23410);function o(e){let t=e.fragment.code;t.add((0,i.H)`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG)
813{
814return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5;
815}
815`),t.add((0,i.H)`float integratedRadiance(float cosTheta2, float roughness)
816{
817return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0);
818}`),t.add((0,i.H)`vec3 evaluateSpecularIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float RdotNG, float roughness)
819{
820float cosTheta2 = 1.0 - RdotNG * RdotNG;
821float intRadTheta = integratedRadiance(cosTheta2, roughness);
822float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta;
823float sky = 2.0 - ground;
824return (ground * ambientGround + sky * ambientSky) * 0.5;
825}`)}var n=r(3864),a=r(95509);function s(e,t){let r=e.fragment.code;e.include(a.e),t.pbrMode===n.f7.Water||t.pbrMode===n.f7.WaterOnIntegratedMesh?(r.add((0,i.H)`
826    struct PBRShadingWater
827    {
828        float NdotL;   // cos angle between normal and light direction
829        float NdotV;   // cos angle between normal and view direction
830        float NdotH;   // cos angle between normal and half vector
831        float VdotH;   // cos angle between view direction and half vector
832        float LdotH;   // cos angle between light direction and half vector
833        float VdotN;   // cos angle between view direction and normal vector
834    };
835
836    float dtrExponent = ${t.useCustomDTRExponentForWater?"2.2":"2.0"};
837    `),r.add((0,i.H)`vec3 fresnelReflection(float angle, vec3 f0, float f90) {
838return f0 + (f90 - f0) * pow(1.0 - angle, 5.0);
839}`),r.add((0,i.H)`float normalDistributionWater(float NdotH, float roughness)
840{
841float r2 = roughness * roughness;
842float NdotH2 = NdotH * NdotH;
843float denom = pow((NdotH2 * (r2 - 1.0) + 1.0), dtrExponent) * PI;
844return r2 / denom;
845}`),r.add((0,i.H)`float geometricOcclusionKelemen(float LoH)
846{
847return 0.25 / (LoH * LoH);
848}`),r.add((0,i.H)`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max)
849{
850vec3  F = fresnelReflection(props.VdotH, F0, F0Max);
851float dSun = normalDistributionWater(props.NdotH, roughness);
852float V = geometricOcclusionKelemen(props.LdotH);
853float diffusionSunHaze = mix(roughness + 0.045, roughness + 0.385, 1.0 - props.VdotH);
854float strengthSunHaze  = 1.2;
855float dSunHaze = normalDistributionWater(props.NdotH, diffusionSunHaze)*strengthSunHaze;
856return ((dSun + dSunHaze) * V) * F;
857}
858vec3 tonemapACES(const vec3 x) {
859return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
860}`)):t.pbrMode!==n.f7.Normal&&t.pbrMode!==n.f7.Schematic||(e.include(o),r.add((0,i.H)`struct PBRShadingInfo
861{
862float NdotL;
863float NdotV;
864float NdotH;
865float VdotH;
866float LdotH;
867float NdotNG;
868float RdotNG;
869float NdotAmbDir;
870float NdotH_Horizon;
871vec3 skyRadianceToSurface;
872vec3 groundRadianceToSurface;
873vec3 skyIrradianceToSurface;
874vec3 groundIrradianceToSurface;
875float averageAmbientRadiance;
876float ssao;
877vec3 albedoLinear;
878vec3 f0;
879vec3 f90;
880vec3 diffuseColor;
881float metalness;
882float roughness;
883};`),r.add((0,i.H)`float normalDistribution(float NdotH, float roughness)
884{
885float a = NdotH * roughness;
886float b = roughness / (1.0 - NdotH * NdotH + a * a);
887return b * b * INV_PI;
888}`),r.add((0,i.H)`const vec4 c0 = vec4(-1.0, -0.0275, -0.572,  0.022);
889const vec4 c1 = vec4( 1.0,  0.0425,  1.040, -0.040);
890const vec2 c2 = vec2(-1.04, 1.04);
891vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
892vec4 r = roughness * c0 + c1;
893float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
894return c2 * a004 + r.zw;
895}`),r.add((0,i.H)`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
896vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotNG);
897vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotNG, inputs.roughness);
898vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
899vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
900vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
901vec3 specularComponent = specularColor * indirectSpecular;
902return (diffuseComponent + specularComponent);
903}`),r.add((0,i.H)`float gamutMapChanel(float x, vec2 p){
904return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
905}`),r.add((0,i.H)`vec3 blackLevelSoftCompression(vec3 inColor, PBRShadingInfo inputs){
906vec3 outColor;
907vec2 p = vec2(0.02 * (inputs.averageAmbientRadiance), 0.0075 * (inputs.averageAmbientRadiance));
908outColor.x = gamutMapChanel(inColor.x, p) ;
909outColor.y = gamutMapChanel(inColor.y, p) ;
910outColor.z = gamutMapChanel(inColor.z, p) ;
911return outColor;
912}`))}},3864:function(e,t,r){r.d(t,{f7:function(){return o},jV:function(){return p}});var i,o,n=r(79912),a=r(512),s=r(4251),l=r(32006),c=r(43036),u=r(23410),d=r(37649),h=r(15176),f=r(89979),m=r(40017);function p(e,t){let r=e.fragment,i=t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture;if(t.pbrMode===o.Normal&&i&&e.include(a.i,t),t.pbrMode!==o.Schematic){if(t.pbrMode!==o.Disabled){if(t.pbrMode===o.Normal){r.code.add((0,u.H)`vec3 mrr;
913vec3 emission;
914float occlusion;`);let e=t.supportsTextureAtlas?t.hasWebGL2Context?f.D.None:f.D.Size:f.D.None,o=t.pbrTextureBindType;t.hasMetallicRoughnessTexture&&(r.uniforms.add(o===m.P.Pass?(0,h.J)("texMetallicRoughness",e=>e.textureMetallicRoughness,e):(0,d.F)("texMetallicRoughness",e=>e.textureMetallicRoughness,e)),r.code.add((0,u.H)`void applyMetallnessAndRoughness(TextureLookupParameter params) {
915vec3 metallicRoughness = textureLookup(texMetallicRoughness, params).rgb;
916mrr[0] *= metallicRoughness.b;
917mrr[1] *= metallicRoughness.g;
918}`)),t.hasEmissionTexture&&(r.uniforms.add(o===m.P.Pass?(0,h.J)("texEmission",e=>e.textureEmissive,e):(0,d.F)("texEmission",e=>e.textureEmissive,e)),r.code.add((0,u.H)`void applyEmission(TextureLookupParameter params) {
919emission *= textureLookup(texEmission, params).rgb;
920}`)),t.hasOcclusionTexture?(r.uniforms.add(o===m.P.Pass?(0,h.J)("texOcclusion",e=>e.textureOcclusion,e):(0,d.F)("texOcclusion",e=>e.textureOcclusion,e)),r.code.add((0,u.H)`void applyOcclusion(TextureLookupParameter params) {
921occlusion *= textureLookup(texOcclusion, params).r;
922}
923float getBakedOcclusion() {
924return occlusion;
925}`)):r.code.add((0,u.H)`float getBakedOcclusion() { return 1.0; }`),r.uniforms.add(o===m.P.Pass?[new c.J("emissionFactor",e=>e.emissiveFactor),new c.J("mrrFactors",e=>e.mrrFactors)]:[new l.B("emissionFactor",e=>e.emissiveFactor),new l.B("mrrFactors",e=>e.mrrFactors)]),r.code.add((0,u.H)`
926    void applyPBRFactors() {
927      mrr = mrrFactors;
928      emission = emissionFactor;
929      occlusion = 1.0;
930      ${i?(0,u.H)`vtc.uv = vuv0;`:""}
931      ${t.hasMetallicRoughnessTextureTransform?(0,u.H)`vtc.uv = metallicRoughnessUV;`:""}
932      ${t.hasMetallicRoughnessTexture?t.supportsTextureAtlas?(0,u.H)`
933                vtc.size = ${(0,s.w_)(t,"texMetallicRoughness")};
934                applyMetallnessAndRoughness(vtc);`:(0,u.H)`applyMetallnessAndRoughness(vtc);`:""}
935      ${t.hasEmissiveTextureTransform?(0,u.H)`vtc.uv = emissiveUV;`:""}
936      ${t.hasEmissionTexture?t.supportsTextureAtlas?(0,u.H)`
937                vtc.size = ${(0,s.w_)(t,"texEmission")};
938                applyEmission(vtc);`:(0,u.H)`applyEmission(vtc);`:""}
939      ${t.hasOcclusionTextureTransform?(0,u.H)`vtc.uv = occlusionUV;`:""}
940      ${t.hasOcclusionTexture?t.supportsTextureAtlas?(0,u.H)`
941                vtc.size = ${(0,s.w_)(t,"texOcclusion")};
942                applyOcclusion(vtc);`:(0,u.H)`applyOcclusion(vtc);`:""}
943    }
944  `)}}else r.code.add((0,u.H)`float getBakedOcclusion() { return 1.0; }`)}else r.code.add((0,u.H)`vec3 mrr = vec3(0.0, 0.6, 0.2);
945vec3 emission = vec3(0.0);
946float occlusion = 1.0;
947void applyPBRFactors() {}
948float getBakedOcclusion() { return 1.0; }`)}r(66865),(0,n.f)(0,.6,.2),(i=o||(o={}))[i.Disabled=0]="Disabled",i[i.Normal=1]="Normal",i[i.Schematic=2]="Schematic",i[i.Water=3]="Water",i[i.WaterOnIntegratedMesh=4]="WaterOnIntegratedMesh",i[i.COUNT=5]="COUNT"},95509:function(e,t,r){r.d(t,{e:function(){return o}});var i=r(23410);function o(e){e.vertex.code.add((0,i.H)`const float PI = 3.141592653589793;`),e.fragment.code.add((0,i.H)`const float PI = 3.141592653589793;
949const float LIGHT_NORMALIZATION = 1.0 / PI;
950const float INV_PI = 0.3183098861837907;
951const float HALF_PI = 1.570796326794897;`)}},29262:function(e,t,r){r.d(t,{XE:function(){return p},hb:function(){return m}}),r(8909);var i=r(9794),o=r(4251),n=r(63371),a=r(59842),s=r(23410),l=r(91013),c=r(40017);class u extends l.x{constructor(e,t,r){super(e,"mat4",c.P.Draw,(r,i,o)=>r.setUniformMatrix4fv(e,t(i,o)),r)}}class d extends l.x{constructor(e,t,r){super(e,"mat4",c.P.Pass,(r,i,o)=>r.setUniformMatrix4fv(e,t(i,o)),r)}}
951var h=r(15176),f=r(89979);function m(e,t){t.receiveShadows&&(e.fragment.uniforms.add(new d("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),v(e,t))}function p(e,t){t.receiveShadows&&(e.fragment.uniforms.add(new u("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),v(e,t))}function v(e,t){let r=e.fragment;r.include(i.n),r.uniforms.add([...(0,h.J)("shadowMapTex",(e,t)=>t.shadowMap.depthTexture,t.hasWebGL2Context?f.D.None:f.D.Size),new a._("numCascades",(e,t)=>t.shadowMap.numCascades),new n.N("cascadeDistances",(e,t)=>t.shadowMap.cascadeDistances)]),r.code.add((0,s.H)`
952    int chooseCascade(float depth, out mat4 mat) {
953      vec4 distance = cascadeDistances;
954
955      // choose correct cascade
956      int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3;
957
958      mat = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3];
959
960      return i;
961    }
962
963    vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
964      vec4 lv = mat * vec4(_vpos, 1.0);
965      lv.xy /= lv.w;
966      return 0.5 * lv.xyz + vec3(0.5);
967    }
968
969    vec2 cascadeCoordinates(int i, vec3 lvpos) {
970      return vec2(float(i - 2 * (i / 2)) * 0.5, float(i / 2) * 0.5) + 0.5 * lvpos.xy;
971    }
972
973    float readShadowMapDepth(vec2 uv, sampler2D _depthTex) {
974      return rgba2float(texture2D(_depthTex, uv));
975    }
976
977    float posIsInShadow(vec2 uv, vec3 lvpos, sampler2D _depthTex) {
978      return readShadowMapDepth(uv, _depthTex) < lvpos.z ? 1.0 : 0.0;
979    }
980
981    float filterShadow(vec2 uv, vec3 lvpos, float textureSize, sampler2D _depthTex) {
982      float halfPixelSize = 0.5 / textureSize;
983
984      // filter, offset by half pixels
985      vec2 st = fract((vec2(halfPixelSize) + uv) * textureSize);
986
987      float s00 = posIsInShadow(uv + vec2(-halfPixelSize, -halfPixelSize), lvpos, _depthTex);
988      float s10 = posIsInShadow(uv + vec2(halfPixelSize, -halfPixelSize), lvpos, _depthTex);
989      float s11 = posIsInShadow(uv + vec2(halfPixelSize, halfPixelSize), lvpos, _depthTex);
990      float s01 = posIsInShadow(uv + vec2(-halfPixelSize, halfPixelSize), lvpos, _depthTex);
991
992      return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
993    }
994
995    float readShadowMap(const in vec3 _vpos, float _linearDepth) {
996      mat4 mat;
997      int i = chooseCascade(_linearDepth, mat);
998
999      if (i >= numCascades) { return 0.0; }
1000
1001      vec3 lvpos = lightSpacePosition(_vpos, mat);
1002
1003      // vertex completely outside? -> no shadow
1004      if (lvpos.z >= 1.0) { return 0.0; }
1005      if (lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) { return 0.0; }
1006
1007      // calc coord in cascade texture
1008      vec2 uv = cascadeCoordinates(i, lvpos);
1009
1010      vec2 textureSize = ${(0,o.w_)(t,"shadowMapTex")};
1011
1012      return filterShadow(uv, lvpos, textureSize.x, shadowMapTex);
1013    }
1014  `)}},30228:function(e,t,r){r.d(t,{DT:function(){return d},NI:function(){return l},R5:function(){return c},av:function(){return s},jF:function(){return u}});var i=r(61681),o=r(19710),n=r(23410),a=r(11125);function s(e){e.vertex.uniforms.add(new a.c("colorTextureTransformMatrix",e=>(0,i.pC)(e.colorTextureTransformMatrix)?e.colorTextureTransformMatrix:(0,o.c)())),e.varyings.add("colorUV","vec2"),e.vertex.code.add((0,n.H)`void forwardColorUV(){
1015colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1016}`)}function l(e){e.vertex.uniforms.add(new a.c("normalTextureTransformMatrix",e=>(0,i.pC)(e.normalTextureTransformMatrix)?e.normalTextureTransformMatrix:(0,o.c)())),e.varyings.add("normalUV","vec2"),e.vertex.code.add((0,n.H)`void forwardNormalUV(){
1017normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1018}`)}function c(e){e.vertex.uniforms.add(new a.c("emissiveTextureTransformMatrix",e=>(0,i.pC)(e.emissiveTextureTransformMatrix)?e.emissiveTextureTransformMatrix:(0,o.c)())),e.varyings.add("emissiveUV","vec2"),e.vertex.code.add((0,n.H)`void forwardEmissiveUV(){
1019emissiveUV = (emissiveTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1020}`)}function u(e){e.vertex.uniforms.add(new a.c("occlusionTextureTransformMatrix",e=>(0,i.pC)(e.occlusionTextureTransformMatrix)?e.occlusionTextureTransformMatrix:(0,o.c)())),e.varyings.add("occlusionUV","vec2"),e.vertex.code.add((0,n.H)`void forwardOcclusionUV(){
1021occlusionUV = (occlusionTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1022}`)}function d(e){e.vertex.uniforms.add(new a.c("metallicRoughnessTextureTransformMatrix",e=>(0,i.pC)(e.metallicRoughnessTextureTransformMatrix)?e.metallicRoughnessTextureTransformMatrix:(0,o.c)())),e.varyings.add("metallicRoughnessUV","vec2"),e.vertex.code.add((0,n.H)`void forwardMetallicRoughnessUV(){
1023metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1024}`)}},27641:function(e,t,r){r.d(t,{k:function(){return d}});var i=r(43036),o=r(91013),n=r(40017);class a extends o.x{constructor(e,t,r){super(e,"vec4",n.P.Pass,(r,i,o)=>r.setUniform4fv(e,t(i,o)),r)}}class s extends o.x{constructor(e,t,r){super(e,"float",n.P.Pass,(r,i,o)=>r.setUniform1fv(e,t(i,o)),r)}}var l=r(23410),c=r(11125),u=r(21414);function d(e,t){t.hasVvInstancing&&(t.vvSize||t.vvColor)&&e.attributes.add(u.T.INSTANCEFEATUREATTRIBUTE,"vec4");let r=e.vertex;t.vvSize?(r.uniforms.add(new i.J("vvSizeMinSize",e=>e.vvSizeMinSize)),r.uniforms.add(new i.J("vvSizeMaxSize",e=>e.vvSizeMaxSize)),r.uniforms.add(new i.J("vvSizeOffset",e=>e.vvSizeOffset)),r.uniforms.add(new i.J("vvSizeFactor",e=>e.vvSizeFactor)),r.uniforms.add(new c.c("vvSymbolRotationMatrix",e=>e.vvSymbolRotationMatrix)),r.uniforms.add(new i.J("vvSymbolAnchor",e=>e.vvSymbolAnchor)),r.code.add((0,l.H)`vec3 vvScale(vec4 _featureAttribute) {
1025return clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize);
1026}
1027vec4 vvTransformPosition(vec3 position, vec4 _featureAttribute) {
1028return vec4(vvSymbolRotationMatrix * ( vvScale(_featureAttribute) * (position + vvSymbolAnchor)), 1.0);
1029}`),r.code.add((0,l.H)`
1030      const float eps = 1.192092896e-07;
1031      vec4 vvTransformNormal(vec3 _normal, vec4 _featureAttribute) {
1032        vec3 vvScale = clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize + eps, vvSizeMaxSize);
1033        return vec4(vvSymbolRotationMatrix * _normal / vvScale, 1.0);
1034      }
1035
1036      ${t.hasVvInstancing?(0,l.H)`
1037      vec4 vvLocalNormal(vec3 _normal) {
1038        return vvTransformNormal(_normal, instanceFeatureAttribute);
1039      }
1040
1041      vec4 localPosition() {
1042        return vvTransformPosition(position, instanceFeatureAttribute);
1043      }`:""}
1044    `)):r.code.add((0,l.H)`vec4 localPosition() { return vec4(position, 1.0
1044); }
1045vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),t.vvColor?(r.constants.add("vvColorNumber","int",8),t.hasVvInstancing&&r.uniforms.add([new s("vvColorValues",e=>e.vvColorValues,8),new a("vvColorColors",e=>e.vvColorColors,8)]),r.code.add((0,l.H)`
1046      vec4 vvGetColor(vec4 featureAttribute, float values[vvColorNumber], vec4 colors[vvColorNumber]) {
1047        float value = featureAttribute.y;
1048        if (value <= values[0]) {
1049          return colors[0];
1050        }
1051
1052        for (int i = 1; i < vvColorNumber; ++i) {
1053          if (values[i] >= value) {
1054            float f = (value - values[i-1]) / (values[i] - values[i-1]);
1055            return mix(colors[i-1], colors[i], f);
1056          }
1057        }
1058        return colors[vvColorNumber - 1];
1059      }
1060
1061      ${t.hasVvInstancing?(0,l.H)`
1062      vec4 vvColor() {
1063        return vvGetColor(instanceFeatureAttribute, vvColorValues, vvColorColors);
1064      }`:""}
1065    `)):r.code.add((0,l.H)`vec4 vvColor() { return vec4(1.0); }`)}r(34344),r(8909),r(7358)},44391:function(e,t,r){r.d(t,{F:function(){return i},b:function(){return o}});let i=.1,o=.001},41330:function(e,t,r){r.d(t,{z:function(){return l}});var i=r(44391),o=r(23410);function n(e){e.fragment.code.add((0,o.H)`
1066    #define discardOrAdjustAlpha(color) { if (color.a < ${o.H.float(i.b)}) { discard; } }
1067  `)}r(91013),r(40017);var a=r(24603),s=r(70984);function l(e,t){!function(e,t,r){let i=e.fragment;switch(t.alphaDiscardMode!==s.JJ.Mask&&t.alphaDiscardMode!==s.JJ.MaskBlend||i.uniforms.add(r),t.alphaDiscardMode){case s.JJ.Blend:return e.include(n);case s.JJ.Opaque:i.code.add((0,o.H)`void discardOrAdjustAlpha(inout vec4 color) {
1068color.a = 1.0;
1069}`);break;case s.JJ.Mask:i.code.add((0,o.H)`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`);break;case s.JJ.MaskBlend:e.fragment.code.add((0,o.H)`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`)}}(e,t,new a.p("textureAlphaCutoff",e=>e.textureAlphaCutoff))}},77334:function(e,t,r){r.d(t,{G:function(){return u},R:function(){return h}});var i=r(55709),o=r(69666),n=r(88589),a=r(1983),s=r(93072),l=r(63371),c=r(23410);function u(e){e.fragment.uniforms.add(new l.N("projInfo",(e,t)=>(function(e){let t=e.camera.projectionMatrix;return 0===t[11]?(0,n.s)(d,2/(e.camera.fullWidth*t[0]),2/(e.camera.fullHeight*t[5]),(1+t[12])/t[0],(1+t[13])/t[5]):(0,n.s)(d,-2/(e.camera.fullWidth*t[0]),-2/(e.camera.fullHeight*t[5]),(1-t[8])/t[0],(1-t[9])/t[5])})(t))),e.fragment.uniforms.add(new s.A("zScale",(e,t)=>h(t))),e.fragment.code.add((0,c.H)`vec3 reconstructPosition(vec2 fragCoord, float depth) {
1070return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth);
1071}`)}let d=(0,a.c)();function h(e){return 0===e.camera.projectionMatrix[11]?(0,i.s)(f,0,1):(0,i.s)(f,1,0)}let f=(0,o.a)()},5331:function(e,t,r){r.d(t,{$:function(){return n},I:function(){return a}});var i=r(39994),o=r(23410);function n({code:e},t){t.doublePrecisionRequiresObfuscation?e.add((0,o.H)`vec3 dpPlusFrc(vec3 a, vec3 b) {
1072return mix(a, a + b, vec3(notEqual(b, vec3(0))));
1073}
1074vec3 dpMinusFrc(vec3 a, vec3 b) {
1075return mix(vec3(0), a - b, vec3(notEqual(a, b)));
1076}
1077vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
1078vec3 t1 = dpPlusFrc(hiA, hiB);
1079vec3 e = dpMinusFrc(t1, hiA);
1080vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;
1081return t1 + t2;
1082}`):e.add((0,o.H)`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
1083vec3 t1 = hiA + hiB;
1084vec3 e = t1 - hiA;
1085vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;
1086return t1 + t2;
1087}`)}function a(e){return!!(0,i.Z)("force-double-precision-obfuscation")||e.driverTest.doublePrecisionRequiresObfuscation}},42727:function(e,t,r){r.d(t,{y:function(){return a}});var i=r(66352),o=r(23410);function n(e){e.code.add((0,o.H)`vec4 premultiplyAlpha(vec4 v) {
1088return vec4(v.rgb * v.a, v.a);
1089}
1090vec3 rgb2hsv(vec3 c) {
1091vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
1092vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
1093vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
1094float d = q.x - min(q.w, q.y);
1095float e = 1.0e-10;
1096return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0
1096), q.x);
1097}
1098vec3 hsv2rgb(vec3 c) {
1099vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
1100vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
1101return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
1102}
1103float rgb2v(vec3 c) {
1104return max(c.x, max(c.y, c.z));
1105}`)}function a(e){e.include(n),e.code.add((0,o.H)`
1106    vec3 mixExternalColor(vec3 internalColor, vec3 textureColor, vec3 externalColor, int mode) {
1107      // workaround for artifacts in OSX using Intel Iris Pro
1108      // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
1109      vec3 internalMixed = internalColor * textureColor;
1110      vec3 allMixed = internalMixed * externalColor;
1111
1112      if (mode == ${o.H.int(i.a9.Multiply)}) {
1113        return allMixed;
1114      }
1115      if (mode == ${o.H.int(i.a9.Ignore)}) {
1116        return internalMixed;
1117      }
1118      if (mode == ${o.H.int(i.a9.Replace)}) {
1119        return externalColor;
1120      }
1121
1122      // tint (or something invalid)
1123      float vIn = rgb2v(internalMixed);
1124      vec3 hsvTint = rgb2hsv(externalColor);
1125      vec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z);
1126      return hsv2rgb(hsvOut);
1127    }
1128
1129    float mixExternalOpacity(float internalOpacity, float textureOpacity, float externalOpacity, int mode) {
1130      // workaround for artifacts in OSX using Intel Iris Pro
1131      // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
1132      float internalMixed = internalOpacity * textureOpacity;
1133      float allMixed = internalMixed * externalOpacity;
1134
1135      if (mode == ${o.H.int(i.a9.Ignore)}) {
1136        return internalMixed;
1137      }
1138      if (mode == ${o.H.int(i.a9.Replace)}) {
1139        return externalOpacity;
1140      }
1141
1142      // multiply or tint (or something invalid)
1143      return allMixed;
1144    }
1145  `)}},9794:function(e,t,r){r.d(t,{n:function(){return o}});var i=r(23410);function o(e){e.code.add((0,i.H)`const float MAX_RGBA_FLOAT =
1146255.0 / 256.0 +
1147255.0 / 256.0 / 256.0 +
1148255.0 / 256.0 / 256.0 / 256.0 +
1149255.0 / 256.0 / 256.0 / 256.0 / 256.0;
1150const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);
1151vec4 float2rgba(const float value) {
1152float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);
1153vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);
1154const float toU8AsFloat = 1.0 / 255.0;
1155return fixedPointU8 * toU8AsFloat;
1156}
1157const vec4 RGBA_2_FLOAT_FACTORS = vec4(
1158255.0 / (256.0),
1159255.0 / (256.0 * 256.0),
1160255.0 / (256.0 * 256.0 * 256.0),
1161255.0 / (256.0 * 256.0 * 256.0 * 256.0)
1162);
1163float rgba2float(vec4 rgba) {
1164return dot(rgba, RGBA_2_FLOAT_FACTORS);
1165}`)}},5614:function(e,t,r){r.d(t,{hY:function(){return f},Sv:function(){return m},_8:function(){return g}});var i=r(24455),o=r(64790),n=r(6766),a=r(8909),s=r(32006),l=r(43036),c=r(91013),u=r(40017);class d extends c.x{constructor(e,t){super(e,"mat4",u.P.Draw,(r,i,o)=>r.setUniformMatrix4fv(e,t(i,o)))}}var h=r(87621);function f(e,t){t.instancedDoublePrecision?e.constants.add("cameraPosition","vec3",a.Z):e.uniforms.add(new s.B("cameraPosition",(e,t)=>(0,n.s)(v,t.camera.viewInverseTransposeMatrix[3]-e.origin[0],t.camera.viewInverseTransposeMatrix[7]-e.origin[1],t.camera.viewInverseTransposeMatrix[11]-e.origin[2])))}function m(e,t){if(!t.instancedDoublePrecision)return void e.uniforms.add([new h.g("proj",(e,t)=>t.camera.projectionMatrix),new d("view",(e,t)=>(0,i.v)(p,t.camera.viewMatrix,e.origin)),new s.B("localOrigin",e=>e.origin)]);let r=e=>(0,n.s)(v,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]);e.uniforms.add([new h.g("proj",(e,t)=>t.camera.projectionMatrix),new h.g("view",(e,t)=>(0,i.v)(p,t.camera.viewMatrix,r(t))),new l.J("localOrigin",(e,t)=>r(t))])}let p=(0,o.c)(),v=(0,a.c)();function g(e){e.uniforms.add(new h.g("viewNormal",(e,t)=>t.camera.viewInverseTransposeMatrix))}},4251:function(e,t,r){r.d(t,{aU:function(){return n},b6:function(){return s},o_:function(){return o},w_:function(){return a}});var i=r(23410);let o="Size",n="InvSize";function a(e,t,r=!1,a=0){if(e.hasWebGL2Context){let e=(0,i.H)`vec2(textureSize(${t}, ${i.H.int(a)}))`;return r?"(1.0 / "+e+")":e}return r?t+n:t+o}
1165function s(e,t,r,o=null,a=0){return e.hasWebGL2Context?(0,i.H)`texelFetch(${t}, ivec2(${r}), ${i.H.int(a)})`:(0,i.H)`texture2D(${t}, ${r} * `+(o?(0,i.H)`(${o}))`:(0,i.H)`${t+n})`)}},26482:function(e,t,r){r.d(t,{q:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"vec2",o.P.Draw,(r,i,o,n)=>r.setUniform2fv(e,t(i,o,n)))}}},93072:function(e,t,r){r.d(t,{A:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"vec2",o.P.Pass,(r,i,o)=>r.setUniform2fv(e,t(i,o)))}}},32006:function(e,t,r){r.d(t,{B:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"vec3",o.P.Draw,(r,i,o,n)=>r.setUniform3fv(e,t(i,o,n)))}}},43036:function(e,t,r){r.d(t,{J:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"vec3",o.P.Pass,(r,i,o)=>r.setUniform3fv(e,t(i,o)))}}},63371:function(e,t,r){r.d(t,{N:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"vec4",o.P.Pass,(r,i,o)=>r.setUniform4fv(e,t(i,o)))}}},24603:function(e,t,r){r.d(t,{p:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"float",o.P.Pass,(r,i,o)=>r.setUniform1f(e,t(i,o)))}}},59842:function(e,t,r){r.d(t,{_:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"int",o.P.Pass,(r,i,o)=>r.setUniform1i(e,t(i,o)))}}},55784:function(e,t,r){r.d(t,{j:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"mat3",o.P.Draw,(r,i,o)=>r.setUniformMatrix3fv(e,t(i,o)))}}},11125:function(e,t,r){r.d(t,{c:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"mat3",o.P.Pass,(r,i,o)=>r.setUniformMatrix3fv(e,t(i,o)))}}},87621:function(e,t,r){r.d(t,{g:function(){return n}});var i=r(91013),o=r(40017);class n extends i.x{constructor(e,t){super(e,"mat4",o.P.Pass,(r,i,o)=>r.setUniformMatrix4fv(e,t(i,o)))}}},3961:function(e,t,r){r.d(t,{kG:function(){return l}});var i=r(70375),o=r(13802),n=r(61681);let a=o.Z.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class s{constructor(){this._includedModules=new Map}include(e,t){if(this._includedModules.has(e)){let r=this._includedModules.get(e);if(r!==t){a.error("Trying to include shader module multiple times with different sets of options.");let t=new Set;for(let i of Object.keys(r))r[i]!==e[i]&&t.add(i);for(let i of Object.keys(e))r[i]!==e[i]&&t.add(i);t.forEach(t=>console.error(`  ${t}: current ${r[t]} new ${e[t]}`))}}else this._includedModules.set(e,t),e(this.builder,t)}}class l extends s{constructor(){super(...arguments),this.vertex=new d,this.fragment=new d,this.attributes=new h,this.varyings=new f,this.extensions=new m,this.constants=new p}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){let t=this.extensions.generateSource(e),r=this.attributes.generateSource(e),i=this.varyings.generateSource(),o="vertex"===e?this.vertex:this.fragment,n=o.uniforms.generateSource(),a=o.code.generateSource(),s="vertex"===e?g:v,l=this.constants.generateSource().concat(o.constants.generateSource());return`
1166${t.join("\n")}
1167
1168${s}
1169
1170${l.join("\n")}
1171
1172${n.join("\n")}
1173
1174${r.join("\n")}
1175
1176${i.join("\n")}
1177
1178${a.join("\n")}`}generateBind(e,t){let r=new Map;this.vertex.uniforms.entries.forEach(t=>{let i=t.bind[e];(0,n.pC)(i)&&r.set(t.name,i)}),this.fragment.uniforms.entries.forEach(t=>{let i=t.bind[e];(0,n.pC)(i)&&r.set(t.name,i)});let i=Array.from(r.values()),o=i.length;return(e,r,n)=>{for(let a=0;a<o;++a)i[a](t,e,r,n)}}}class c{constructor(){this._entries=new Map}add(e){if(!Array.isArray(e))return this._add(e);for(let t of e)this._add(t)}get(e){return this._entries.get(e)}_add(e){if((0,n.Wi)(e))a.error(`Trying to add null Uniform from ${Error().stack}.`);else{if(this._entries.has(e.name)&&!this._entries.get(e.name).equals(e))throw new i.Z(`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}}generateSource(){return Array.from(this._entries.values()).map(e=>(0,n.pC)(e.arraySize)?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`)}get entries(){return Array.from(this._entries.values())}}class u{constructor(){this._entries=[]}add(e){this._entries.push(e)}generateSource(){return this._entries}}class d extends s{constructor(){super(...arguments),this.uniforms=new c,this.code=new u,this.constants=new p}get builder(){return this}}class h{constructor(){this._entries=[]}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`attribute ${e[1]} ${e[0]};`)}}class f{constructor(){this._entries=[]}add(e,t){this._entries.push([e,t])}generateSource(){return this._entries.map(e=>`varying ${e[1]} ${e[0]};`)}}class m{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){let t="vertex"===e?m.ALLOWLIST_VERTEX:m.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter(e=>t.includes(e)).map(e=>`#extension ${e} : enable`)}}m.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],m.ALLOWLIST_VERTEX=[];class p{constructor(){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"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"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}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}let v="#ifdef GL_FRAGMENT_PRECISION_HIGH\n  precision highp float;\n  precision highp sampler2D;\n#else\n  precision mediump float;\n  precision mediump sampler2D;\n#endif",g="precision highp float;\nprecision highp sampler2D;"},37649:function(e,t,r){r.d(t,{F:function(){return h},R:function(){return d}});var i=r(61681),o=r(55709),n=r(69666),a=r(4251),s=r(26482),l=r(89979),c=r(91013),u=r(40017);class d extends c.x{constructor(e,t){super(e,"sampler2D",u.P.Draw,(r,i,o)=>r.bindTexture(e,t(i,o)))}}function h(e,t,r=l.D.None){let c=[new d(e,t)];if(r&l.D.Size){let r=e+a.o_;c.push(new s.q(r,(e,r)=>{let a=t(e,r);return(0,i.pC)(a)?(0,o.s)(f,a.descriptor.width,a.descriptor.height):n.Z}))}if(r&l.D.InvSize){let r=e+a.aU;c.push(new s.q(r,(e,r)=>{let a=t(e,r);return(0,i.pC)(a)?(0,o.s)(f,1/a.descriptor.width,1/a.descriptor.height):n.Z}))}return c}let f=(0,n.a)()},15176:function(e,t,r){r.d(t,{A:function(){return d},J:function(){return h}});var i=r(61681),o=r(55709),n=r(69666),a=r(4251),s=r(93072),l=r(89979),c=r(91013),u=r(40017);class d extends c.x{constructor(e,t){super(e,"sampler2D",u.P.Pass,(r,i,o)=>r.bindTexture(e,t(i,o)))}}function h(e,t,r=l.D.None){let c=[new d(e,t)];if(r&l.D.Size){let r=e+a.o_;c.push(new s.A(r,(e,r)=>{let a=t(e,r);return(0,i.pC)(a)?(0,o.s)(f,a.descriptor.width,a.descriptor.height):n.Z}))}if(r&l.D.InvSize){let r=e+a.aU;c.push(new s.A(r,(e,r)=>{let a=t(e,r);return(0,i.pC)(a)?(0,o.s)(f,1/a.descriptor.width,1/a.descriptor.height):n.Z}))}return c}let f=(0,n.a)()},89979:function(e,t,r){var i,o;r.d(t,{D:function(){return i}}),(o=i||(i={}))[o.None=0]="None",o[o.Size=1]="Size",o[o.InvSize=2]="InvSize"},91013:function(e,t,r){r.d(t,{x:function(){return n}});var i=r(61681),o=r(40017);
1178class n{constructor(e,t,r,n,a=null){this.name=e,this.type=t,this.arraySize=a,this.bind={[o.P.Pass]:null,[o.P.Draw]:null},(0,i.pC)(r)&&(0,i.pC)(n)&&(this.bind[r]=n)}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}}},23410:function(e,t,r){var i;r.d(t,{H:function(){return n},K:function(){return o}});class o{}function n(e,...t){let r="";for(let i=0;i<t.length;i++)r+=e[i]+t[i];return r+e[e.length-1]}(i=n||(n={})).int=function(e){return Math.round(e).toString()},i.float=function(e){return e.toPrecision(8)}},40017:function(e,t,r){var i,o;r.d(t,{P:function(){return i}}),(o=i||(i={}))[o.Pass=0]="Pass",o[o.Draw=1]="Draw"},9969:function(e,t,r){r.d(t,{J:function(){return i}});class i{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}},52756:function(e,t,r){r.d(t,{A:function(){return n}});var i=r(61681),o=r(91907);class n{constructor(e,t,r){this.release=r,this.initializeConfiguration(e,t),this._configuration=t.snapshot(),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}destroy(){this._program=(0,i.M2)(this._program),this._pipeline=this._configuration=null}reload(e){(0,i.M2)(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}get program(){return this._program}get compiled(){return this.program.isCompiled}get key(){return this._configuration.key}get configuration(){return this._configuration}bindPipelineState(e,t=null,r){e.setPipelineState(this.getPipelineState(t,r))}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return o.MX.TRIANGLES}getPipelineState(e,t){return this._pipeline}initializeConfiguration(e,t){}}},67197:function(e,t,r){r.d(t,{m:function(){return i},o:function(){return o}});class i{constructor(){this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map(()=>0):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){let e=this._parameterNames,t={key:this.key};for(let r of e)t[r]=this[r];return t}}function o(e={}){return(t,r)=>{if(t._parameterNames=t._parameterNames??[],t._parameterNames.push(r),null!=e.constValue)Object.defineProperty(t,r,{get:()=>e.constValue});else{let i=t._parameterNames.length-1,o=Math.ceil(Math.log2(e.count||2)),n=t._parameterBits??[0],a=0;for(;n[a]+o>16;)++a>=n.length&&n.push(0);t._parameterBits=n;let s=n[a],l=(1<<o)-1<<s;n[a]+=o,Object.defineProperty(t,r,{get(){return this[i]},set(e){if(this[i]!==e&&(this[i]=e,this._keyDirty=!0,this._parameterBits[a]=this._parameterBits[a]&~l|+e<<s&l,"number"!=typeof e&&"boolean"!=typeof e))throw"Configuration value for "+r+" must be boolean or number, got "+typeof e}})}}}},10107:function(e,t,r){r.d(t,{c:function(){return o}});var i=r(7958);class o{constructor(){this.id=(0,i.D)()}unload(){}}},95399:function(e,t,r){var i,o;r.d(t,{U:function(){return i}}),(o=i||(i={}))[o.Layer=0]="Layer",o[o.Object=1]="Object",o[o.Geometry=2]="Geometry",o[o.Material=3]="Material",o[o.Texture=4]="Texture",o[o.COUNT=5]="COUNT"},5474:function(e,t,r){r.d(t,{i:function(){return o}});var i=r(21414);let o=new Map([[i.T.POSITION,0],[i.T.NORMAL,1],[i.T.UV0,2],[i.T.COLOR,3],[i.T.SIZE,4],[i.T.TANGENT,4],[i.T.AUXPOS1,5],[i.T.SYMBOLCOLOR,5],[i.T.AUXPOS2,6],[i.T.FEATUREATTRIBUTE,6],[i.T.INSTANCEFEATUREATTRIBUTE,6],[i.T.INSTANCECOLOR,7],[i.T.OBJECTANDLAYERIDCOLOR,7],[i.T.OBJECTANDLAYERIDCOLOR_INSTANCED,7],[i.T.MODEL,8],[i.T.MODELNORMAL,12],[i.T.MODELORIGINHI,11],[i.T.MODELORIGINLO,15]])},66865:function(e,t,r){r.d(t,{F:function(){return l}});var i=r(61681),o=r(78668),n=r(23410),a=r(70984);class s{constructor(e){this._material=e.material,this._techniqueRepository=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRepository.release(this._technique)}get technique(){return this._technique}get _stippleTextureRepository(){return this._techniqueRepository.constructionContext.stippleTextureRepository}ensureTechnique(e,t,r=this._output){return this._technique=this._techniqueRepository.releaseAndAcquire(e,this._material.getConfiguration(r,t),this._technique),this._technique}ensureResources(e){return a.Rw.LOADED}}class l extends s{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textureRepository=e.textureRep,this._textureId=e.textureId,this._acquire(e.textureId,e=>this._texture=e),this._acquire(e.normalTextureId,e=>this._textureNormal=e),this._acquire(e.emissiveTextureId,e=>this._textureEmissive=e),this._acquire(e.occlusionTextureId,e=>this._textureOcclusion=e),this._acquire(e.metallicRoughnessTextureId,e=>this._textureMetallicRoughness=e)}dispose(){this._texture=(0,i.RY)(this._texture),this._textureNormal=(0,i.RY)(this._textureNormal),this._textureEmissive=(0,i.RY)(this._textureEmissive),this._textureOcclusion=(0,i.RY)(this._textureOcclusion),this._textureMetallicRoughness=(0,i.RY)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?a.Rw.LOADED:a.Rw.LOADING}get textureBindParameters(){return new c((0,i.pC)(this._texture)?this._texture.glTexture:null,(0,i.pC)(this._textureNormal)?this._textureNormal.glTexture:null,(0,i.pC)(this._textureEmissive)?this._textureEmissive.glTexture:null,(0,i.pC)(this._textureOcclusion)?this._textureOcclusion.glTexture:null,(0,i.pC)(this._textureMetallicRoughness)?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){((0,i.Wi)(this._texture)||e!==this._texture.id)&&
1178(this._texture=(0,i.RY)(this._texture),this._textureId=e,this._acquire(this._textureId,e=>this._texture=e))}_acquire(e,t){if((0,i.Wi)(e))return void t(null);let r=this._textureRepository.acquire(e);if((0,o.y8)(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return(0,i.RY)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(r)}}class c extends n.K{constructor(e=null,t=null,r=null,i=null,o=null){super(),this.texture=e,this.textureNormal=t,this.textureEmissive=r,this.textureOcclusion=i,this.textureMetallicRoughness=o}}},7358:function(e,t,r){r.d(t,{F5:function(){return d},Mt:function(){return h},yD:function(){return o}});var i,o,n=r(61681),a=r(23410),s=r(10107),l=r(95399),c=r(5474),u=r(16318);class d extends s.c{constructor(e,t){super(),this.type=l.U.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=c.i,this._parameters=(0,u.Uf)(e,t),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,u.LO)(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleForOutput(e.output)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){(0,n.pC)(this.repository)&&this.repository.materialChanged(this)}}(i=o||(o={}))[i.Occlude=1]="Occlude",i[i.Transparent=2]="Transparent",i[i.OccludeAndTransparent=4]="OccludeAndTransparent",i[i.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",i[i.Opaque=16]="Opaque";class h extends a.K{constructor(){super(...arguments),this.renderOccluded=o.Occlude}}},12045:function(e,t,r){r.d(t,{Bh:function(){return f},IB:function(){return l},j7:function(){return c},je:function(){return h},ve:function(){return u},wu:function(){return a}});var i=r(42842),o=r(91907),n=r(17346);let a=(0,n.wK)(o.zi.SRC_ALPHA,o.zi.ONE,o.zi.ONE_MINUS_SRC_ALPHA,o.zi.ONE_MINUS_SRC_ALPHA),s=(0,n.if)(o.zi.ONE,o.zi.ONE),l=(0,n.if)(o.zi.ZERO,o.zi.ONE_MINUS_SRC_ALPHA);function c(e){return e===i.A.FrontFace?null:e===i.A.Alpha?l:s}let u=5e5,d={factor:-1,units:-2};function h(e){return e?d:null}function f(e,t=o.wb.LESS){return e===i.A.NONE||e===i.A.FrontFace?t:o.wb.LEQUAL}},95194:function(e,t,r){r.d(t,{$:function(){return s}});var i=r(61681),o=r(17993),n=r(40017),a=r(6174);class s{constructor(e,t,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new o.Z({deallocator:null}),this._glProgram=e.programCache.acquire(t.generate("vertex"),t.generate("fragment"),r),this._glProgram.stop=()=>{throw Error("Wrapped _glProgram used directly")},this.bindPass=t.generateBind(n.P.Pass,this),this.bindDraw=t.generateBind(n.P.Draw,this),this._fragmentUniforms=(0,a.hZ)()?t.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get isCompiled(){return this._glProgram.isCompiled}setUniform1b(e,t){this._glProgram.setUniform1i(e,t?1:0)}setUniform1i(e,t){this._glProgram.setUniform1i(e,t)}setUniform1f(e,t){this._glProgram.setUniform1f(e,t)}setUniform2fv(e,t){this._glProgram.setUniform2fv(e,t)}setUniform3fv(e,t){this._glProgram.setUniform3fv(e,t)}setUniform4fv(e,t){this._glProgram.setUniform4fv(e,t)}setUniformMatrix3fv(e,t){this._glProgram.setUniformMatrix3fv(e,t)}setUniformMatrix4fv(e,t){this._glProgram.setUniformMatrix4fv(e,t)}setUniform1fv(e,t){this._glProgram.setUniform1fv(e,t)}setUniform1iv(e,t){this._glProgram.setUniform1iv(e,t)}setUniform2iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform3iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform4iv(e,t){this._glProgram.setUniform4iv(e,t)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if((0,i.Wi)(t)||null==t.glName){let t=this._textures.get(e);return t&&(this._context.bindTexture(null,t.unit),this._freeTextureUnit(t),this._textures.delete(e)),null}let r=this._textures.get(e);return null==r?(r=this._allocTextureUnit(t),this._textures.set(e,r)):r.texture=t,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(t,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEac
1178h((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)}),(0,i.pC)(this._fragmentUniforms)&&this._fragmentUniforms.forEach(e=>{"sampler2D"!==e.type&&"samplerCube"!==e.type||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)})}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}},42842:function(e,t,r){var i,o;r.d(t,{A:function(){return i}}),(o=i||(i={}))[o.Color=0]="Color",o[o.Alpha=1]="Alpha",o[o.FrontFace=2]="FrontFace",o[o.NONE=3]="NONE",o[o.COUNT=4]="COUNT"},15095:function(e,t,r){r.d(t,{hu:function(){return o},yK:function(){return n}}),r(69666),r(88589),(0,r(1983).c)();class i{constructor(e){this.message=e}toString(){return`AssertException: ${this.message}`}}function o(e,t){if(!e)throw console.log(Error(t=t||"assert").stack),new i(t)}function n(e,t,r,i){let o,n=(r[0]-e[0])/t[0],a=(i[0]-e[0])/t[0];n>a&&(o=n,n=a,a=o);let s=(r[1]-e[1])/t[1],l=(i[1]-e[1])/t[1];if(s>l&&(o=s,s=l,l=o),n>l||s>a)return!1;s>n&&(n=s),l<a&&(a=l);let c=(r[2]-e[2])/t[2],u=(i[2]-e[2])/t[2];return c>u&&(o=c,c=u,u=o),!(n>u||c>a)&&(u<a&&(a=u),!(a<0))}},21414:function(e,t,r){var i,o;r.d(t,{T:function(){return i}}),(o=i||(i={})).POSITION="position",o.NORMAL="normal",o.UV0="uv0",o.AUXPOS1="auxpos1",o.AUXPOS2="auxpos2",o.MAPPOS="mapPos",o.COLOR="color",o.SYMBOLCOLOR="symbolColor",o.SIZE="size",o.TANGENT="tangent",o.OFFSET="offset",o.SUBDIVISIONFACTOR="subdivisionFactor",o.COLORFEATUREATTRIBUTE="colorFeatureAttribute",o.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",o.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",o.DISTANCETOSTART="distanceToStart",o.UVMAPSPACE="uvMapSpace",o.BOUNDINGRECT="boundingRect",o.UVREGION="uvRegion",o.NORMALCOMPRESSED="normalCompressed",o.PROFILERIGHT="profileRight",o.PROFILEUP="profileUp",o.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",o.FEATUREVALUE="featureValue",o.MODELORIGINHI="modelOriginHi",o.MODELORIGINLO="modelOriginLo",o.MODEL="model",o.MODELNORMAL="modelNormal",o.INSTANCECOLOR="instanceColor",o.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",o.LOCALTRANSFORM="localTransform",o.GLOBALTRANSFORM="globalTransform",o.BOUNDINGSPHERE="boundingSphere",o.MODELORIGIN="modelOrigin",o.MODELSCALEFACTORS="modelScaleFactors",o.FEATUREATTRIBUTE="featureAttribute",o.STATE="state",o.LODLEVEL="lodLevel",o.POSITION0="position0",o.POSITION1="position1",o.NORMALA="normalA",o.NORMALB="normalB",o.COMPONENTINDEX="componentIndex",o.VARIANTOFFSET="variantOffset",o.VARIANTSTROKE="variantStroke",o.VARIANTEXTENSION="variantExtension",o.U8PADDING="u8padding",o.U16PADDING="u16padding",o.SIDENESS="sideness",o.START="start",o.END="end",o.UP="up",o.EXTRUDE="extrude",o.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",o.OBJECTANDLAYERIDCOLOR_INSTANCED="objectAndLayerIdColor_instanced"},70984:function(e,t,r){var i,o,n,a,s,l,c,u,d,h,f,m,p,v,g,x,_,T,b,S,A,C,w,y;r.d(t,{CE:function(){return d},Gv:function(){return o},JJ:function(){return f},MX:function(){return u},Rw:function(){return a},Vr:function(){return i},hU:function(){return s}}),(p=i||(i={}))[p.None=0]="None",p[p.Front=1]="Front",p[p.Back=2]="Back",p[p.COUNT=3]="COUNT",(v=o||(o={}))[v.Less=0]="Less",v[v.Lequal=1]="Lequal",v[v.COUNT=2]="COUNT",(g=n||(n={}))[g.BACKGROUND=0]="BACKGROUND",g[g.UPDATE=1]="UPDATE",(x=a||(a={}))[x.NOT_LOADED=0]="NOT_LOADED",x[x.LOADING=1]="LOADING",x[x.LOADED=2]="LOADED",(_=s||(s={}))[_.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",_[_.OutlineVisualElementMask=2]="OutlineVisualElementMask",(T=l||(l={}))[T.ASYNC=0]="ASYNC",T[T.SYNC=1]="SYNC",(b=c||(c={}))[b.Highlight=0]="Highlight",b[b.MaskOccludee=1]="MaskOccludee",b[b.COUNT=2]="COUNT",(S=u||(u={}))[S.Triangle=0]="Triangle",S[S.Point=1]="Point",S[S.Line=2]="Line",(A=d||(d={}))[A.STRETCH=1]="STRETCH",A[A.PAD=2]="PAD",(C=h||(h={}))[C.CHANGED=0]="CHANGED",C[C.UNCHANGED=1]="UNCHANGED",(w=f||(f={}))[w.Blend=0]="Blend",w[w.Opaque=1]="Opaque",w[w.Mask=2]="Mask",w[w.MaskBlend=3]="MaskBlend",w[w.COUNT=4]="COUNT",(y=m||(m={}))[y.OFF=0]="OFF",y[y.ON=1]="ON"},66521:function(e,t,r){r.d(t,{ow:function(){return h}});var i=r(5474),o=r(21414),n=r(91907),a=r(41163);new a.G(o.T.POSITION,3,n.g.FLOAT,0,12),new a.G(o.T.POSITION,3,n.g.FLOAT,0,20),new a.G(o.T.UV0,2,n.g.FLOAT,12,20),new a.G(o.T.POSITION,3,n.g.FLOAT,0,32),new a.G(o.T.NORMAL,3,n.g.FLOAT,12,32),new a.G(o.T.UV0,2,n.g.FLOAT,24,32),new a.G(o.T.POSITION,3,n.g.FLOAT,0,16),new a.G(o.T.COLOR,4,n.g.UNSIGNED_BYTE,12,16);let s=[new a.G(o.T.POSITION,2,n.g.FLOAT,0,8)],l=[new a.G(o.T.POSITION,2,n.g.FLOAT,0,16),new a.G(o.T.UV0,2,n.g.FLOAT,8,16)];var c=r(29620);class u extends c.U{}var d=r(78951);function h(e,t=s,r=i.i,o=-1,a=1){let c=null;return c=new Float32Array(t===l?[o,o,0,0,a,o,1,0,o,a,0,1,a,a,1,1]:[o,o,a,o,o,a,a,a]),new u(e,r,{geometry:t},{geometry:d.f.createVertex(e,n.l1.STATIC_DRAW,c)})}r(43487)},16318:function(e,t,r){r.d(t,{FZ:function(){return C},Uf:function(){return function e(t,r){let i=r?e(r):{};for(let e in t){let r=t[e];r&&r.forEach&&(r=function(e){let t=[];
1178return e.forEach(e=>t.push(e)),t}(r)),null==r&&e in i||(i[e]=r)}return i}},Bw:function(){return p},LO:function(){return A},Hx:function(){return S}});var i=r(7753),o=r(19431),n=r(61681),a=r(6766),s=r(8909),l=r(37116),c=r(70984);r(65684),(0,o.Vl)(10),(0,o.Vl)(12),(0,o.Vl)(70),(0,o.Vl)(40);let u={scale:0,factor:0,minPixelSize:0,paddingPixels:0};var d=r(15095),h=r(21414);r(24455);var f=r(39100);r(30560),new Float64Array(3),new Float32Array(6),(0,f.c)();let m=(0,l.Ue)();function p(e,t,r,i,o,s,u){if(!(0,n.pC)(t)||t.visible){if(e.boundingInfo){(0,d.hu)(e.primitiveType===c.MX.Triangle);let t=r.tolerance;!function e(t,r,i,o,s,c){if((0,n.Wi)(t))return;let u=(0,a.s)(v,1/(i[0]-r[0]),1/(i[1]-r[1]),1/(i[2]-r[2]));if((0,l.op)(m,t.getBBMin()),(0,l.Tn)(m,t.getBBMax()),(0,n.pC)(s)&&s.applyToAabb(m),function(e,t,r,i,o){let n=(e[0]-i-t[0])*r[0],a=(e[3]+i-t[0])*r[0],s=Math.min(n,a),l=Math.max(n,a),c=(e[1]-i-t[1])*r[1],u=(e[4]+i-t[1])*r[1];if((l=Math.min(l,Math.max(c,u)))<0||(s=Math.max(s,Math.min(c,u)))>l)return!1;let d=(e[2]-i-t[2])*r[2],h=(e[5]+i-t[2])*r[2];return!((l=Math.min(l,Math.max(d,h)))<0)&&!((s=Math.max(s,Math.min(d,h)))>l)&&s<o}(m,r,u,o,1/0)){let{primitiveIndices:n,indices:a,position:l}=t,u=n?n.length:a.length/3;if(u>w){let n=t.getChildren();if(void 0!==n){for(let t=0;t<8;++t)void 0!==n[t]&&e(n[t],r,i,o,s,c);return}}x(r,i,0,u,a,l,n,s,c)}}(e.boundingInfo,i,o,t,s,u)}else{let t=e.indices.get(h.T.POSITION),r=e.vertexAttributes.get(h.T.POSITION);x(i,o,0,t.length/3,t,r,void 0,s,u)}}}let v=(0,s.c)(),g=(0,s.c)();function x(e,t,r,i,o,a,s,l,c){if(s)return function(e,t,r,i,o,a,s,l,c){let u=a.data,d=a.stride||a.size,h=e[0],f=e[1],m=e[2],p=t[0]-h,v=t[1]-f,x=t[2]-m;for(let e=r;e<i;++e){let t=s[e],r=3*t,i=d*o[r++],a=u[i++],_=u[i++],T=u[i];i=d*o[r++];let S=u[i++],A=u[i++],C=u[i];i=d*o[r];let w=u[i++],y=u[i++],O=u[i];(0,n.pC)(l)&&([a,_,T]=l.applyToVertex(a,_,T,e),[S,A,C]=l.applyToVertex(S,A,C,e),[w,y,O]=l.applyToVertex(w,y,O,e));let M=S-a,P=A-_,E=C-T,R=w-a,I=y-_,N=O-T,L=v*N-I*x,H=x*R-N*p,D=p*I-R*v,F=M*L+P*H+E*D;if(Math.abs(F)<=Number.EPSILON)continue;let z=h-a,B=f-_,V=m-T,U=z*L+B*H+V*D;if(F>0){if(U<0||U>F)continue}else if(U>0||U<F)continue;let G=B*E-P*V,W=V*M-E*z,k=z*P-M*B,$=p*G+v*W+x*k;if(F>0){if($<0||U+$>F)continue}else if($>0||U+$<F)continue;let j=(R*G+I*W+N*k)/F;j>=0&&c(j,b(M,P,E,R,I,N,g),t,!1)}}(e,t,r,i,o,a,s,l,c);let u=a.data,d=a.stride||a.size,h=e[0],f=e[1],m=e[2],p=t[0]-h,v=t[1]-f,x=t[2]-m;for(let e=r,t=3*r;e<i;++e){let r=d*o[t++],i=u[r++],a=u[r++],s=u[r];r=d*o[t++];let _=u[r++],T=u[r++],S=u[r];r=d*o[t++];let A=u[r++],C=u[r++],w=u[r];(0,n.pC)(l)&&([i,a,s]=l.applyToVertex(i,a,s,e),[_,T,S]=l.applyToVertex(_,T,S,e),[A,C,w]=l.applyToVertex(A,C,w,e));let y=_-i,O=T-a,M=S-s,P=A-i,E=C-a,R=w-s,I=v*R-E*x,N=x*P-R*p,L=p*E-P*v,H=y*I+O*N+M*L;if(Math.abs(H)<=Number.EPSILON)continue;let D=h-i,F=f-a,z=m-s,B=D*I+F*N+z*L;if(H>0){if(B<0||B>H)continue}else if(B>0||B<H)continue;let V=F*M-O*z,U=z*y-M*D,G=D*O-y*F,W=p*V+v*U+x*G;if(H>0){if(W<0||B+W>H)continue}else if(W>0||B+W<H)continue;let k=(P*V+E*U+R*G)/H;k>=0&&c(k,b(y,O,M,P,E,R,g),e,!1)}}let _=(0,s.c)(),T=(0,s.c)();function b(e,t,r,i,o,n,s){return(0,a.s)(_,e,t,r),(0,a.s)(T,i,o,n),(0,a.f)(s,_,T),(0,a.n)(s,s),s}function S(e,t,r,i,a){var s,l;let c=(r.screenLength||0)*e.pixelRatio;(0,n.pC)(a)&&(s=c,l=function(e,t,r){let i=r.parameters,o=r.paddingPixelsOverride;return u.scale=Math.min(i.divisor/(t-i.offset),1),u.factor=Math.abs(e*e*e),u.minPixelSize=i.minPixelSize,u.paddingPixels=o,u}(i,t,a),c=Math.max((0,o.t7)(s*l.scale,s,l.factor),0===s?l.minPixelSize:l.minPixelSize*(1+2*l.paddingPixels/s)));let d=c*Math.tan(.5*e.fovY)/(.5*e.fullHeight);return(0,o.uZ)(d*t,r.minWorldLength||0,null!=r.maxWorldLength?r.maxWorldLength:1/0)}function A(e,t){let r=!1;for(let o in t){let n=t[o];void 0!==n&&(Array.isArray(n)?null===e[o]?(e[o]=n.slice(),r=!0):(0,i.Vx)(e[o],n)&&(r=!0):e[o]!==n&&(r=!0,e[o]=n))}return r}let C={multiply:1,ignore:2,replace:3,tint:4},w=1e3},41163:function(e,t,r){r.d(t,{G:function(){return i}});class i{constructor(e,t,r,i,o,n=!1,a=0){this.name=e,this.count=t,this.type=r,this.offset=i,this.stride=o,this.normalized=n,this.divisor=a}}},30560:function(e,t,r){function i(e,t,r){for(let i=0;i<r;++i)t[2*i]=e[i],t[2*i+1]=e[i]-t[2*i]}function o(e,t){let r=e.length;for(let i=0;i<r;++i)a[0]=e[i],t[i]=a[0];return t}function n(e,t){let r=e.length;for(let i=0;i<r;++i)a[0]=e[i],a[1]=e[i]-a[0],t[i]=a[1];return t}r.d(t,{GB:function(){return n},LF:function(){return i},U8:function(){return o}});let a=new Float32Array(2)},17346:function(e,t,r){r.d(t,{BK:function(){return d},LZ:function(){return u},if:function(){return n},jp:function(){return I},sm:function(){return h},wK:function(){return a},zp:function(){return c}});var i=r(70984),o=r(91907);function n(e,t,r=o.db.ADD,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 a(e,t,r,i,n=o.db.ADD,a=o.db.ADD,s=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:i,opRgb:n,opAlpha:a,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}let s={face:o.LR.BACK,mode:o.Wf.CCW},l={face:o.LR.FRONT,mode:o.Wf.CCW},c=e=>e===i.Vr.Back?s:e===i.Vr.Front?l:null,u={zNear:0,zFar:1},d={r:!0,g:!0,b:!0,a:!0};function h(e){return R.intern(e)}class f{constructor(e,t){this._makeKey=e,this._makeRef=t,this._interns=new Map}intern(e){if(!e)return null;let t=this._makeKey(e),r=this._interns;return r.has(t)||r.set(t,this._makeRef(e)),r.get(t)??null}}function m(e){return"["+e.join(",")+"]"}let p=new f(v,e=>({__tag:"Blending",...e}));function v(e){return e?m([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}let g=new f(x,e=>({__tag:"Culling",...e}));function x(e){return e?m([e.face,e.mode]):null}let _=new f(T,e=>({__tag:"PolygonOffset",...e}));function T(e){return e?m([e.factor,e.units]):null}let b=new f(S,e=>({__tag:"DepthTest",...e}));function S(e){return e?m([e.func]):null}let A=new f(C,e=>({__tag:"StencilTest",...e}));function C(e){return e?m([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}let w=new f(y,e=>({__tag:"DepthWrite",...e}));function y(e){return e?m([e.zNear,e.zFar]):null}let O=new f(M,e=>({__tag:"ColorWrite",...e}));function M(e){return e?m([e.r,e.g,e.b,e.a]):null}let P=new f(E,e=>({__tag:"StencilWrite",...e}));function E(e){return e?m([e.mask]):null}let R=new f(function(e){return e?m([v(e.blending),x(e.culling),T(e.polygonOffset),S(e.depthTest),C(e.stencilTest),y(e.depthWrite),M(e.colorWrite),E(e.stencilWrite)]):null},e=>{var t,r,i,o,n,a,s,l;return{blending:(t=e.blending,p.intern(t)),culling:(r=e.culling,g.intern(r)),polygonOffset:(i=e.polygonOffset,_.intern(i)),depthTest:(o=e.depthTest,b.intern(o)),stencilTest:(n=e.stencilTest,A.intern(n)),depthWrite:(a=e.depthWrite,w.intern(a)),colorWrite:(s=e.colorWrite,O.intern(s)),stencilWrite:(l=e.stencilWrite,P.intern(l))}});class I{constructor(e){this._pipelineInvalid=!0,this._blendingInvalid=!0,this._cullingInvalid=!0,this._polygonOffsetInvalid=!0,this._depthTestInvalid=!0,this._stencilTestInvalid=!0,this._depthWriteInvalid=!0,this._colorWriteInvalid=!0,this._stencilWriteInvalid=!0,this._stateSetters=e}setPipeline(e){(this._pipelineInvalid||e!==this._pipeline)&&(this._setBlending(e.blending),this._setCulling(e.culling),this._setPolygonOffset(e.polygonOffset),this._setDepthTest(e.depthTest),this._setStencilTest(e.stencilTest),this._setDepthWrite(e.depthWrite),this._setColorWrite(e.colorWrite),this._setStencilWrite(e.stencilWrite),this._pipeline=e),this._pipelineInvalid=!1}invalidateBlending(){this._blendingInvalid=!0,this._pipelineInvalid=!0}
1178invalidateCulling(){this._cullingInvalid=!0,this._pipelineInvalid=!0}invalidatePolygonOffset(){this._polygonOffsetInvalid=!0,this._pipelineInvalid=!0}invalidateDepthTest(){this._depthTestInvalid=!0,this._pipelineInvalid=!0}invalidateStencilTest(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDepthWrite(){this._depthWriteInvalid=!0,this._pipelineInvalid=!0}invalidateColorWrite(){this._colorWriteInvalid=!0,this._pipelineInvalid=!0}invalidateStencilWrite(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}_setBlending(e){this._blending=this._setSubState(e,this._blending,this._blendingInvalid,this._stateSetters.setBlending),this._blendingInvalid=!1}_setCulling(e){this._culling=this._setSubState(e,this._culling,this._cullingInvalid,this._stateSetters.setCulling),this._cullingInvalid=!1}_setPolygonOffset(e){this._polygonOffset=this._setSubState(e,this._polygonOffset,this._polygonOffsetInvalid,this._stateSetters.setPolygonOffset),this._polygonOffsetInvalid=!1}_setDepthTest(e){this._depthTest=this._setSubState(e,this._depthTest,this._depthTestInvalid,this._stateSetters.setDepthTest),this._depthTestInvalid=!1}_setStencilTest(e){this._stencilTest=this._setSubState(e,this._stencilTest,this._stencilTestInvalid,this._stateSetters.setStencilTest),this._stencilTestInvalid=!1}_setDepthWrite(e){this._depthWrite=this._setSubState(e,this._depthWrite,this._depthWriteInvalid,this._stateSetters.setDepthWrite),this._depthWriteInvalid=!1}_setColorWrite(e){this._colorWrite=this._setSubState(e,this._colorWrite,this._colorWriteInvalid,this._stateSetters.setColorWrite),this._colorWriteInvalid=!1}_setStencilWrite(e){this._stencilWrite=this._setSubState(e,this._stencilWrite,this._stencilWriteInvalid,this._stateSetters.setStencilWrite),this._stencilTestInvalid=!1}_setSubState(e,t,r,i){return(r||e!==t)&&(i(e),this._pipelineInvalid=!0),e}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.