@arcgis/core 5.1.0-next.91 → 5.1.0-next.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -6
- package/analysis/ShadowCast/MinDurationOptions.d.ts +17 -9
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +10 -6
- package/analysis/ShadowCastAnalysis.d.ts +23 -17
- package/assets/components/assets/combobox/t9n/messages.fr.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{adfa5c136c72c1e65770.js → 12f41c1c66fb446b6286.js} +22 -16
- package/assets/esri/core/workers/chunks/1523883460874c352e36.js +1 -0
- package/assets/esri/core/workers/chunks/{5409369d0d637cb30257.js → 172228d1a392ca7a5b21.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2c11f54255fd506655e.js → 19a0cb2d335d97ad9488.js} +1 -1
- package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js → 2647c739cda29361a463.js} +2 -2
- package/assets/esri/core/workers/chunks/34f7450769826e8b7069.js +636 -0
- package/assets/esri/core/workers/chunks/{4b9b9e6136c11d5d7901.js → 412745bfacef23e3b702.js} +1 -1
- package/assets/esri/core/workers/chunks/4df19e670b6ed76c1dea.js +2 -0
- package/assets/esri/core/workers/chunks/{ceff78c9e31e3572a082.js → 5eff240a0e41a4f80e61.js} +1 -1
- package/assets/esri/core/workers/chunks/{2dcfc4d7e76c922bcbf9.js → 6aed2e42e65ac80f1fab.js} +1 -1
- package/assets/esri/core/workers/chunks/77c2d8d0ce1c1ab469e9.js +1 -0
- package/assets/esri/core/workers/chunks/8a370cc1a99ddc7ce70b.js +1 -0
- package/assets/esri/core/workers/chunks/8a7a99533d02eb9cb058.js +2 -0
- package/assets/esri/core/workers/chunks/{90a8dfb03a437fe8a6e7.js → be47e42c6c8c0820efd8.js} +1 -1
- package/assets/esri/core/workers/chunks/c7ee05f46b26b17f9414.js +1 -0
- package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js → d1ba118ddd0390c07f35.js} +2 -2
- package/assets/esri/core/workers/chunks/e6f1ed5e56f1d9862821.js +1 -0
- package/assets/esri/core/workers/chunks/{27f67a3828b78d4c1413.js → e81afc8a058a8ecc9b24.js} +1 -1
- package/assets/esri/core/workers/chunks/f49c7bb5d134bcb22155.js +1 -0
- package/assets/esri/core/workers/chunks/{aa6808146c76b2d49b64.js → f68c12e0c1eda7f73a17.js} +1 -1
- package/assets/esri/core/workers/chunks/f706bfea34d22539b46a.js +2 -0
- package/assets/esri/core/workers/chunks/{bb8d596f15fd3a0d783a.js → f8072a4cf1b25d8b93f9.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +24 -18
- package/chunks/GlowBlur.glsl.js +11 -11
- package/chunks/RibbonLine.glsl.js +91 -51
- package/chunks/ShadowCastVisualize.glsl.js +18 -15
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/networks/support/UNTraceConfiguration.d.ts +19 -2
- package/networks/support/UNTraceConfiguration.js +1 -1
- package/networks/support/jsonTypes.d.ts +9 -1
- package/package.json +4 -4
- package/popup/Feature.d.ts +4 -4
- package/popup/Feature.js +1 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.d.ts +13 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.d.ts +9 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/NetworkElement.d.ts +13 -1
- package/rest/networks/support/NetworkElement.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +6 -5
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/assets/esri/core/workers/chunks/0840e7dd62643c56ae9e.js +0 -1
- package/assets/esri/core/workers/chunks/0cc4b3100a7a453bd058.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e7111d43f01c149b3.js +0 -1
- package/assets/esri/core/workers/chunks/73af4c947e8151d411c1.js +0 -2
- package/assets/esri/core/workers/chunks/752f4e0e2961fc315dca.js +0 -1
- package/assets/esri/core/workers/chunks/a508104179e08f0f268c.js +0 -2
- package/assets/esri/core/workers/chunks/bb5f909a2f26fc6a21b0.js +0 -2
- package/assets/esri/core/workers/chunks/bea2fd831d7a864e5995.js +0 -596
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +0 -1
- package/assets/esri/core/workers/chunks/f971dcfd04af1fd652b4.js +0 -1
- /package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js.LICENSE.txt → 2647c739cda29361a463.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bb5f909a2f26fc6a21b0.js.LICENSE.txt → 4df19e670b6ed76c1dea.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{a508104179e08f0f268c.js.LICENSE.txt → 8a7a99533d02eb9cb058.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{73af4c947e8151d411c1.js.LICENSE.txt → d1ba118ddd0390c07f35.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js.LICENSE.txt → f706bfea34d22539b46a.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7925],{72091(e,t,i){i.d(t,{H:()=>g,b:()=>p});var r=i(6733),n=i(29236),s=i(68259),o=i(20304),a=i(31821),l=i(93588),c=i(63761),h=i(9273),u=i(34053),d=i(14113);function p(){const e=new d.N5;e.include(r.Q);const{fragment:t}=e;return t.uniforms.add(new c.N("blurInput",e=>e.highlightBlurTexture),new s.t("blurSize",e=>e.blurSize),new h.R("highlightTexture",e=>e.highlightTexture),new c.N("highlightOptionsTexture",e=>e.highlightOptionsTexture),new l.c("highlightLevel",e=>e.highlightLevel),new o.m("occludedIntensityFactor",e=>e.occludedFactor)),t.constants.add("inner","float",1-(u.o-u.b)/u.o),e.include(n.y),t.main.add(a.H`vec2 highlightTextureSize = vec2(textureSize(highlightTexture,0));
|
|
2
|
+
vec2 uv = sUV;
|
|
3
|
+
vec2 center = texture(blurInput, uv).rg;
|
|
4
|
+
vec2 blurredHighlightValue = (vOutlinePossible == 0.0)
|
|
5
|
+
? center
|
|
6
|
+
: center * 0.204164
|
|
7
|
+
+ texture(blurInput, uv + blurSize * 1.407333).rg * 0.304005
|
|
8
|
+
+ texture(blurInput, uv - blurSize * 1.407333).rg * 0.304005
|
|
9
|
+
+ texture(blurInput, uv + blurSize * 3.294215).rg * 0.093913
|
|
10
|
+
+ texture(blurInput, uv - blurSize * 3.294215).rg * 0.093913;
|
|
11
|
+
float highlightIntensity = blurredHighlightValue.r;
|
|
12
|
+
float occlusionWeight = blurredHighlightValue.g;
|
|
13
|
+
if (highlightIntensity <= 0.01) {
|
|
14
|
+
discard;
|
|
15
|
+
}
|
|
16
|
+
vec4 fillColor = texelFetch(highlightOptionsTexture, ivec2(highlightLevel, 0), 0);
|
|
17
|
+
vec4 outlineColor = texelFetch(highlightOptionsTexture, ivec2(highlightLevel, 1), 0);
|
|
18
|
+
uvec2 centerTexel = texelFetch(highlightTexture, ivec2(uv * highlightTextureSize), 0).rg;
|
|
19
|
+
uint centerBits = readLevelBits(centerTexel, highlightLevel);
|
|
20
|
+
bool centerFilled = (centerBits & 1u) == 1u;
|
|
21
|
+
bool centerOccluded = (centerBits & 3u) == 3u;
|
|
22
|
+
bool occluded = centerOccluded || (0.5 * highlightIntensity < occlusionWeight);
|
|
23
|
+
float occlusionFactor = occluded ? occludedIntensityFactor : 1.0;
|
|
24
|
+
float outlineFactor = centerFilled ? 1.0 : smoothstep(0.0, inner, highlightIntensity);
|
|
25
|
+
float fillFactor = centerFilled ? 1.0 : 0.0;
|
|
26
|
+
vec4 baseColor = mix(outlineColor, fillColor, fillFactor);
|
|
27
|
+
float intensity = baseColor.a * occlusionFactor * outlineFactor;
|
|
28
|
+
fragColor = vec4(baseColor.rgb, intensity);`),e}const g=Object.freeze(Object.defineProperty({__proto__:null,build:p},Symbol.toStringTag,{value:"Module"}))},28476(e,t,i){i.d(t,{H:()=>h,a:()=>d,b:()=>u});var r=i(48163),n=i(6733),s=i(68259),o=i(31821),a=i(15976),l=i(65786),c=i(14113);class h extends l.Y{constructor(){super(...arguments),this.blurSize=(0,r.vt)()}}function u(){const e=new c.N5;return e.include(n.Q),e.outputs.add("fragHighlight","vec2",0),e.fragment.uniforms.add(new s.t("blurSize",e=>e.blurSize),new a.o("blurInput",e=>e.blurInput)).main.add(o.H`vec2 highlightTextureSize = vec2(textureSize(blurInput,0));
|
|
29
|
+
vec2 center = texture(blurInput, sUV).rg;
|
|
30
|
+
if (vOutlinePossible == 0.0) {
|
|
31
|
+
fragHighlight = center;
|
|
32
|
+
} else {
|
|
33
|
+
vec2 sum = center * 0.204164;
|
|
34
|
+
sum += texture(blurInput, sUV + blurSize * 1.407333).rg * 0.304005;
|
|
35
|
+
sum += texture(blurInput, sUV - blurSize * 1.407333).rg * 0.304005;
|
|
36
|
+
sum += texture(blurInput, sUV + blurSize * 3.294215).rg * 0.093913;
|
|
37
|
+
sum += texture(blurInput, sUV - blurSize * 3.294215).rg * 0.093913;
|
|
38
|
+
fragHighlight = sum;
|
|
39
|
+
}`),e}const d=Object.freeze(Object.defineProperty({__proto__:null,HighlightBlurDrawParameters:h,build:u},Symbol.toStringTag,{value:"Module"}))},34053(e,t,i){i.d(t,{H:()=>l,a:()=>p,b:()=>d,c:()=>c,g:()=>h,o:()=>u});var r=i(82048),n=i(31821),s=i(9273),o=i(65786),a=i(14113);class l extends o.Y{}function c(){const e=new a.N5,{outputs:t,fragment:i}=e;return e.include(r.c),i.uniforms.add(new s.R("highlightTexture",e=>e.highlightTexture)),i.constants.add("outlineWidth","int",Math.ceil(u)),i.constants.add("cellSize","int",h),t.add("fragGrid","uvec2"),i.main.add(n.H`ivec2 inputTextureSize = textureSize(highlightTexture, 0);
|
|
40
|
+
ivec2 cellBottomLeftCornerInput = ivec2(ivec2(floor(gl_FragCoord.xy) * vec2(cellSize)));
|
|
41
|
+
ivec2 coordMid = cellBottomLeftCornerInput + ivec2(cellSize >> 1);
|
|
42
|
+
uvec2 centreTexel = texelFetch(highlightTexture, coordMid, 0).rg & uvec2(0x55u);
|
|
43
|
+
float marginSquare = float(outlineWidth*outlineWidth);
|
|
44
|
+
uvec2 outputValue = centreTexel & uvec2(0x55u);
|
|
45
|
+
for(int y = -outlineWidth; y <= cellSize + outlineWidth; y+=2) {
|
|
46
|
+
int dy = y < 0 ? -y : y > cellSize ? y-cellSize : 0;
|
|
47
|
+
int xMargin = dy > 0 ? int(ceil(sqrt(marginSquare - float(dy*dy)))) : outlineWidth;
|
|
48
|
+
for(int x = -xMargin; x <= cellSize + xMargin; x+=2) {
|
|
49
|
+
ivec2 coord = cellBottomLeftCornerInput + ivec2(x, y);
|
|
50
|
+
uvec2[4] texels = uvec2[4] (
|
|
51
|
+
texelFetch(highlightTexture,coord+ivec2(0,0),0).rg & uvec2(0x55u),
|
|
52
|
+
texelFetch(highlightTexture,coord+ivec2(1,0),0).rg & uvec2(0x55u),
|
|
53
|
+
texelFetch(highlightTexture,coord+ivec2(0,1),0).rg & uvec2(0x55u),
|
|
54
|
+
texelFetch(highlightTexture,coord+ivec2(1,1),0).rg & uvec2(0x55u)
|
|
55
|
+
);
|
|
56
|
+
if (texels[0] == texels[1] && texels[1] == texels[2] && texels[2] == texels[3] && texels[3] == centreTexel) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
for (int i=0; i<4; ++i){
|
|
60
|
+
outputValue |= ((texels[i] ^ centreTexel) << 1);
|
|
61
|
+
outputValue |= texels[i];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
fragGrid = outputValue;`),e}const h=32,u=9,d=.4,p=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:l,blurSize:d,build:c,gridCellPixelSize:h,outlineSize:u},Symbol.toStringTag,{value:"Module"}))},16824(e,t,i){i.d(t,{H:()=>h,b:()=>c});var r=i(6733),n=i(29236),s=i(31821),o=i(93588),a=i(9273),l=i(14113);function c(){const e=new l.N5;e.include(r.Q),e.include(n.y);const{fragment:t}=e;return e.outputs.add("fragSingleHighlight","vec2",0),t.uniforms.add(new a.R("highlightTexture",e=>e.highlightTexture),new o.c("highlightLevel",e=>e.highlightLevel)),t.main.add(s.H`ivec2 iuv = ivec2(gl_FragCoord.xy);
|
|
66
|
+
uvec2 inputTexel = texelFetch(highlightTexture, iuv, 0).rg;
|
|
67
|
+
uint bits = readLevelBits(inputTexel, highlightLevel);
|
|
68
|
+
bool hasHighlight = (bits & 1u) == 1u;
|
|
69
|
+
bool hasOccluded = (bits & 2u) == 2u;
|
|
70
|
+
fragSingleHighlight = vec2(hasHighlight ? 1.0 : 0.0, hasOccluded ? 1.0 : 0.0);`),e}const h=Object.freeze(Object.defineProperty({__proto__:null,build:c},Symbol.toStringTag,{value:"Module"}))},80583(e,t,i){i.d(t,{O:()=>h,a:()=>d,b:()=>u});var r=i(82048),n=i(20304),s=i(31821),o=i(93588),a=i(63761),l=i(65786),c=i(14113);class h extends l.Y{constructor(){super(...arguments),this.overlayIndex=0,this.opacity=1}}function u(){const e=new c.N5;return e.include(r.c),e.fragment.uniforms.add(new a.N("tex",e=>e.texture)),e.fragment.uniforms.add(new o.c("overlayIdx",e=>e.overlayIndex)),e.fragment.uniforms.add(new n.m("opacity",e=>e.opacity)),e.fragment.main.add(s.H`vec2 overlayUV = overlayIdx == 0 ? vec2(uv.x * 0.5, uv.y) : vec2(uv.x * 0.5 + 0.5, uv.y);
|
|
71
|
+
fragColor = texture(tex, overlayUV) * opacity;`),e}const d=Object.freeze(Object.defineProperty({__proto__:null,OverlayCompositingPassParameters:h,build:u},Symbol.toStringTag,{value:"Module"}))},32565(e,t,i){i.d(t,{R:()=>A,b:()=>T,r:()=>C});var r=i(68317),n=i(36782),s=i(84652),o=i(2923),a=i(28974),l=i(89786),c=i(82094),h=i(63365),u=i(66269),d=i(77949),p=i(77108),g=i(14314),f=i(71988),m=i(33094),v=i(20304),y=i(31821),x=i(58029),_=i(26934),b=i(54073),S=i(26292),w=i(14113);const C=1;function T(e){const t=new w.N5,{attributes:i,varyings:C,vertex:T,fragment:A}=t,{applyMarkerOffset:R,draped:E,output:O,capType:M,stippleEnabled:L,falloffEnabled:P,roundJoins:D,wireframe:I,innerColorEnabled:F,hasAnimation:z,hasScreenSizePerspective:N,worldSizedImagePattern:W}=e;T.inputs.add("position",()=>"position"),A.include(l.p),t.include(s.s,e),t.include(o.q,e),t.include(n.g,e),t.include(b.Q,e);const V=R&&!E;V&&(T.uniforms.add(new v.m("markerScale",e=>e.markerScale)),t.include(a.r,{space:2,hasScreenSizePerspective:N})),(0,d.NB)(T,e),T.uniforms.add(new x.F("inverseProjectionMatrix",e=>e.camera.inverseProjectionMatrix),new p.E("nearFar",e=>e.camera.nearFar),new v.m("miterLimit",e=>"miter"!==e.join?0:e.miterLimit),new g.I("viewport",e=>e.camera.fullViewport)),T.constants.add("LARGE_HALF_FLOAT","float",65500),T.constants.add("EPS","float",.001),T.constants.add("NUM_JOIN_SUBDIVISIONS","float",e.numJoinSubdivisions),i.add("position","vec3"),i.add("previousDelta","vec4"),i.add("nextDelta","vec4"),i.add("lineParameters","vec2"),i.add("u0","float"),C.add("vColor","vec4"),C.add("vpos","vec3",{invariant:!0}),C.add("vLineDistance","float"),C.add("vLineWidth","float"),L||(C.add("vIsInsideJoin","float"),C.add("vStretchFactor","float"),C.add("vJoinCenterLineSDF","float"));const j=L;j&&C.add("vLineSizeInv","float");const H=2===M,U=L&&H,B=P||U;B&&C.add("vLineDistanceNorm","float"),H&&(C.add("vSegmentSDF","float"),C.add("vReverseSegmentSDF","float")),T.code.add(y.H`vec3 perpendicular(vec3 v) {
|
|
72
|
+
return vec3(v.y, -v.x, 0.0);
|
|
73
|
+
}
|
|
74
|
+
float interp(float ncp, vec4 a, vec4 b) {
|
|
75
|
+
return (-ncp - a.z) / (b.z - a.z);
|
|
76
|
+
}
|
|
77
|
+
vec3 rotateZ(vec3 v, float a) {
|
|
78
|
+
float s = sin(a);
|
|
79
|
+
float c = cos(a);
|
|
80
|
+
mat2 m = mat2(c, -s, s, c);
|
|
81
|
+
return vec3(m * v.xy, v.z);
|
|
82
|
+
}`),T.code.add(y.H`vec4 projectAndScale(vec4 pos) {
|
|
83
|
+
vec4 posNdc = proj * pos;
|
|
84
|
+
posNdc.xy *= viewport.zw / posNdc.w;
|
|
85
|
+
posNdc.z /= posNdc.w;
|
|
86
|
+
return posNdc;
|
|
87
|
+
}`),T.code.add(y.H`void clip(
|
|
88
|
+
inout vec4 pos,
|
|
89
|
+
inout vec4 prev,
|
|
90
|
+
inout vec4 next,
|
|
91
|
+
bool isStartVertex
|
|
92
|
+
) {
|
|
93
|
+
float vnp = nearFar[0] * 0.99;
|
|
94
|
+
if (pos.z > -nearFar[0]) {
|
|
95
|
+
if (!isStartVertex) {
|
|
96
|
+
if (prev.z < -nearFar[0]) {
|
|
97
|
+
pos = mix(prev, pos, interp(vnp, prev, pos));
|
|
98
|
+
next = pos;
|
|
99
|
+
} else {
|
|
100
|
+
pos = vec4(0.0, 0.0, 0.0, 1.0);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (next.z < -nearFar[0]) {
|
|
104
|
+
pos = mix(pos, next, interp(vnp, pos, next));
|
|
105
|
+
prev = pos;
|
|
106
|
+
} else {
|
|
107
|
+
pos = vec4(0.0, 0.0, 0.0, 1.0);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
if (prev.z > -nearFar[0]) {
|
|
112
|
+
prev = mix(pos, prev, interp(vnp, pos, prev));
|
|
113
|
+
}
|
|
114
|
+
if (next.z > -nearFar[0]) {
|
|
115
|
+
next = mix(next, pos, interp(vnp, next, pos));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}`),(0,d.Nz)(T),T.constants.add("aaWidth","float",L?0:1).main.add(y.H`
|
|
119
|
+
// unpack values from vertex type
|
|
120
|
+
bool isStartVertex = abs(abs(lineParameters.y) - 3.0) == 1.0;
|
|
121
|
+
vec3 prevPosition = position + previousDelta.xyz * previousDelta.w;
|
|
122
|
+
vec3 nextPosition = position + nextDelta.xyz * nextDelta.w;
|
|
123
|
+
|
|
124
|
+
float coverage = 1.0;
|
|
125
|
+
|
|
126
|
+
// Check for special value of lineParameters.y which is used by the Renderer when graphics are removed before the
|
|
127
|
+
// VBO is recompacted. If this is the case, then we just project outside of clip space.
|
|
128
|
+
if (lineParameters.y == 0.0) {
|
|
129
|
+
gl_Position = ${c.Z};
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
vec4 pos = view * vec4(position, 1.0);
|
|
133
|
+
vec4 prev = view * vec4(prevPosition, 1.0);
|
|
134
|
+
vec4 next = view * vec4(nextPosition, 1.0);
|
|
135
|
+
|
|
136
|
+
bool isJoin = abs(lineParameters.y) < 3.0;
|
|
137
|
+
`),V&&T.main.add(y.H`vec4 other = isStartVertex ? next : prev;
|
|
138
|
+
bool markersHidden = areWorldMarkersHidden(pos.xyz, other.xyz);
|
|
139
|
+
if (!isJoin && !markersHidden) {
|
|
140
|
+
pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
|
|
141
|
+
}`),t.include(u.F),T.main.add(y.H`
|
|
142
|
+
clip(pos, prev, next, isStartVertex);
|
|
143
|
+
|
|
144
|
+
vec3 clippedPos = pos.xyz;
|
|
145
|
+
vec3 clippedCenter = mix(pos.xyz, isStartVertex ? next.xyz : prev.xyz, 0.5);
|
|
146
|
+
|
|
147
|
+
pos = projectAndScale(pos);
|
|
148
|
+
next = projectAndScale(next);
|
|
149
|
+
prev = projectAndScale(prev);
|
|
150
|
+
|
|
151
|
+
vec3 left = (pos.xyz - prev.xyz);
|
|
152
|
+
vec3 right = (next.xyz - pos.xyz);
|
|
153
|
+
|
|
154
|
+
float leftLen = length(left);
|
|
155
|
+
float rightLen = length(right);
|
|
156
|
+
|
|
157
|
+
float lineSize = getSize(${(0,y.If)(N,"clippedPos")});
|
|
158
|
+
${(0,y.If)(L&&N,"float patternLineSize = getSize(clippedCenter);")}
|
|
159
|
+
${(0,y.If)(L&&!N,"float patternLineSize = lineSize;")}
|
|
160
|
+
|
|
161
|
+
${(0,y.If)(W,y.H`
|
|
162
|
+
lineSize += aaWidth;
|
|
163
|
+
float lineWidth = lineSize * pixelRatio * worldToScreenRatio;
|
|
164
|
+
if (lineWidth < 1.0) {
|
|
165
|
+
coverage = lineWidth;
|
|
166
|
+
lineWidth = 1.0;
|
|
167
|
+
}
|
|
168
|
+
`,y.H`
|
|
169
|
+
if (lineSize < 1.0) {
|
|
170
|
+
coverage = lineSize; // convert sub-pixel coverage to alpha
|
|
171
|
+
lineSize = 1.0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
lineSize += aaWidth;
|
|
175
|
+
float lineWidth = lineSize * pixelRatio;
|
|
176
|
+
`)}
|
|
177
|
+
|
|
178
|
+
vLineWidth = noPerspectiveWrite(lineWidth, pos.w);
|
|
179
|
+
${j?y.H`vLineSizeInv = noPerspectiveWrite(1.0 / lineSize, pos.w);`:""}
|
|
180
|
+
`),(L||H)&&T.main.add(y.H`
|
|
181
|
+
float isEndVertex = float(!isStartVertex);
|
|
182
|
+
vec3 segmentOrigin = mix(pos.xyz, prev.xyz, isEndVertex);
|
|
183
|
+
vec3 segment = mix(right, left, isEndVertex);
|
|
184
|
+
${H?y.H`vec3 segmentEnd = mix(next.xyz, pos.xyz, isEndVertex);`:""}
|
|
185
|
+
`),T.main.add(y.H`left = (leftLen > EPS) ? left/leftLen : vec3(0.0, 0.0, 0.0);
|
|
186
|
+
right = (rightLen > EPS) ? right/rightLen : vec3(0.0, 0.0, 0.0);
|
|
187
|
+
vec3 segmentDirection = isStartVertex ? right : left;
|
|
188
|
+
vec3 capDisplacementDir = vec3(0.0, 0.0, 0.0);
|
|
189
|
+
vec3 joinDisplacementDir = vec3(0.0, 0.0, 0.0);
|
|
190
|
+
float displacementLen = lineWidth;
|
|
191
|
+
float miterDisplacementLen = lineWidth;
|
|
192
|
+
float innerDisplacementLen = lineWidth;`),L||T.main.add(y.H`vIsInsideJoin = 0.0;
|
|
193
|
+
vStretchFactor = 1.0;
|
|
194
|
+
vJoinCenterLineSDF = LARGE_HALF_FLOAT;`),T.main.add(y.H`float subdivisionFactor = 0.0;
|
|
195
|
+
bool isOutside = false;
|
|
196
|
+
if (isJoin) {
|
|
197
|
+
isOutside = (left.x * right.y - left.y * right.x) * lineParameters.y > 0.0;
|
|
198
|
+
vec3 joinDirection = normalize(left + right);
|
|
199
|
+
joinDisplacementDir = perpendicular(joinDirection);
|
|
200
|
+
if (leftLen > EPS && rightLen > EPS) {
|
|
201
|
+
float nDotSeg = dot(joinDisplacementDir, left);
|
|
202
|
+
displacementLen /= length(nDotSeg * left - joinDisplacementDir);
|
|
203
|
+
miterDisplacementLen = displacementLen;
|
|
204
|
+
innerDisplacementLen = min(displacementLen, min(leftLen, rightLen)/abs(nDotSeg));
|
|
205
|
+
if (!isOutside) {
|
|
206
|
+
displacementLen = innerDisplacementLen;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
subdivisionFactor = lineParameters.x;`),L||T.main.add(y.H`vIsInsideJoin = subdivisionFactor > 0.0 && subdivisionFactor < 1.0 ? 1.0: 0.0;
|
|
210
|
+
if (miterDisplacementLen > miterLimit * lineWidth) {
|
|
211
|
+
vec2 leftScreenDir = left.xy;
|
|
212
|
+
vec2 rightScreenDir = right.xy;
|
|
213
|
+
float leftScreenLen = length(leftScreenDir);
|
|
214
|
+
float rightScreenLen = length(rightScreenDir);
|
|
215
|
+
if (leftScreenLen > EPS && rightScreenLen > EPS) {
|
|
216
|
+
leftScreenDir /= leftScreenLen;
|
|
217
|
+
rightScreenDir /= rightScreenLen;
|
|
218
|
+
float roundJoinAngle = acos(clamp(dot(leftScreenDir, rightScreenDir), -1.0, 1.0));
|
|
219
|
+
float triangleHeight = (innerDisplacementLen + lineWidth) * cos(roundJoinAngle / (2.0 + 2.0 * NUM_JOIN_SUBDIVISIONS));
|
|
220
|
+
vStretchFactor = noPerspectiveWrite(max(triangleHeight / (2.0 * lineWidth), 1.0), pos.w);
|
|
221
|
+
}
|
|
222
|
+
}`),T.main.add(y.H`if (isOutside && (displacementLen > miterLimit * lineWidth)) {`),D?T.main.add(y.H`
|
|
223
|
+
vec3 startDir = leftLen < EPS ? right : left;
|
|
224
|
+
startDir = perpendicular(startDir);
|
|
225
|
+
|
|
226
|
+
vec3 endDir = rightLen < EPS ? left : right;
|
|
227
|
+
endDir = perpendicular(endDir);
|
|
228
|
+
|
|
229
|
+
float factor = ${L?y.H`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:y.H`subdivisionFactor`};
|
|
230
|
+
|
|
231
|
+
float rotationAngle = acos(clamp(dot(startDir.xy, endDir.xy), -1.0, 1.0));
|
|
232
|
+
joinDisplacementDir = rotateZ(startDir, -sign(lineParameters.y) * factor * rotationAngle);
|
|
233
|
+
`):T.main.add(y.H`if (leftLen < EPS) {
|
|
234
|
+
joinDisplacementDir = right;
|
|
235
|
+
}
|
|
236
|
+
else if (rightLen < EPS) {
|
|
237
|
+
joinDisplacementDir = left;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? right : left;
|
|
241
|
+
}
|
|
242
|
+
joinDisplacementDir = perpendicular(joinDisplacementDir);`);const Z=0!==M;return T.main.add(y.H`
|
|
243
|
+
displacementLen = lineWidth;
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
// CAP handling ---------------------------------------------------
|
|
247
|
+
joinDisplacementDir = isStartVertex ? right : left;
|
|
248
|
+
joinDisplacementDir = perpendicular(joinDisplacementDir);
|
|
249
|
+
|
|
250
|
+
${Z?y.H`capDisplacementDir = vec3((isStartVertex ? -right : left).xy, 0.0);`:""}
|
|
251
|
+
}
|
|
252
|
+
`),T.main.add(y.H`
|
|
253
|
+
// Displacement (in pixels) caused by join/or cap
|
|
254
|
+
vec2 dposXY = (joinDisplacementDir.xy * sign(lineParameters.y) + capDisplacementDir.xy) * displacementLen;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* To prevent z-fighting between layers, we also adjust the z value.
|
|
258
|
+
* We want to ensure that the orientation of the final triangles is the same, regardless of the line width.
|
|
259
|
+
* To do so, the below formula projects the xy displacement onto the original segment direction
|
|
260
|
+
* to find the z-offset necessary so the triangle orientation is independent of the width.
|
|
261
|
+
*/
|
|
262
|
+
float dposZ = dot(dposXY, segmentDirection.xy) / dot(segmentDirection.xy, segmentDirection.xy) * segmentDirection.z;
|
|
263
|
+
vec3 dpos = vec3(dposXY, dposZ);
|
|
264
|
+
|
|
265
|
+
float lineDistNorm = noPerspectiveWrite(sign(lineParameters.y), pos.w);
|
|
266
|
+
|
|
267
|
+
vLineDistance = lineWidth * lineDistNorm;
|
|
268
|
+
${B?y.H`vLineDistanceNorm = lineDistNorm;`:""}
|
|
269
|
+
|
|
270
|
+
pos.xyz += dpos;
|
|
271
|
+
`),L||T.main.add(y.H`if (isJoin) {
|
|
272
|
+
vec2 joinCenterToVertex = dposXY;
|
|
273
|
+
vec2 leftCenterlineDir = left.xy;
|
|
274
|
+
vec2 rightCenterlineDir = right.xy;
|
|
275
|
+
float leftCenterlineLen = length(leftCenterlineDir);
|
|
276
|
+
float rightCenterlineLen = length(rightCenterlineDir);
|
|
277
|
+
leftCenterlineDir = leftCenterlineLen > EPS ? leftCenterlineDir / leftCenterlineLen : vec2(1.0, 0.0);
|
|
278
|
+
rightCenterlineDir = rightCenterlineLen > EPS ? rightCenterlineDir / rightCenterlineLen : leftCenterlineDir;
|
|
279
|
+
float leftCenterLineSDF = dot(vec2(leftCenterlineDir.y, -leftCenterlineDir.x), joinCenterToVertex);
|
|
280
|
+
float rightCenterLineSDF = dot(vec2(rightCenterlineDir.y, -rightCenterlineDir.x), joinCenterToVertex);
|
|
281
|
+
vJoinCenterLineSDF = noPerspectiveWrite(
|
|
282
|
+
mix(leftCenterLineSDF, rightCenterLineSDF, step(0.5, subdivisionFactor)),
|
|
283
|
+
pos.w
|
|
284
|
+
);
|
|
285
|
+
}`),H&&T.main.add(y.H`vec2 segmentDir = normalize(segment.xy);
|
|
286
|
+
vSegmentSDF = noPerspectiveWrite((isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin.xy, segmentDir)), pos.w);
|
|
287
|
+
vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),L&&(E?T.uniforms.add(new m.U("worldToScreenRatio",e=>1/e.screenToPCSRatio)):T.main.add(y.H`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
|
|
288
|
+
float worldToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),T.main.add(y.H`float segmentLengthScreenDouble = length(segment.xy);
|
|
289
|
+
float segmentLengthScreen = segmentLengthScreenDouble * 0.5;
|
|
290
|
+
float discreteWorldToScreenRatio = discretizeWorldToScreenRatio(worldToScreenRatio);
|
|
291
|
+
float segmentLengthRender = length(mix(nextPosition - position, position - prevPosition, isEndVertex));
|
|
292
|
+
vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),E?T.main.add(y.H`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteWorldToScreenRatio / worldToScreenRatio;
|
|
293
|
+
float startPseudoScreen = u0 * discreteWorldToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):T.main.add(y.H`float startPseudoScreen = mix(u0, u0 - segmentLengthRender, isEndVertex) * discreteWorldToScreenRatio;
|
|
294
|
+
float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),T.uniforms.add(new v.m("stipplePatternPixelSize",e=>(0,o.h)(e))),T.main.add(y.H`
|
|
295
|
+
float patternLength = patternLineSize * stipplePatternPixelSize;
|
|
296
|
+
|
|
297
|
+
${(0,y.If)(W,y.H`
|
|
298
|
+
float uu = mix(u0, u0 - segmentLengthRender, isEndVertex);
|
|
299
|
+
vStippleDistanceLimits = vec2(uu, uu + segmentLengthRender);
|
|
300
|
+
vStipplePatternStretch = 1.0;
|
|
301
|
+
|
|
302
|
+
// The v-coordinate used in case of an image pattern.
|
|
303
|
+
bool isLeft = sign(lineParameters.y) < 0.0;
|
|
304
|
+
vStippleV = isLeft ? 0.0 : 1.0;
|
|
305
|
+
`,y.H`
|
|
306
|
+
// Compute the coordinates at both start and end of the line segment, because we need both to clamp to in the
|
|
307
|
+
// fragment shader
|
|
308
|
+
vStippleDistanceLimits = computeStippleDistanceLimits(startPseudoScreen, segmentLengthPseudoScreen, segmentLengthScreen, patternLength);
|
|
309
|
+
`)}
|
|
310
|
+
|
|
311
|
+
vStippleDistance = mix(vStippleDistanceLimits.x, vStippleDistanceLimits.y, isEndVertex);
|
|
312
|
+
|
|
313
|
+
// Adjust the coordinate to the displaced position (the pattern is shortened/overextended on the in/outside of
|
|
314
|
+
// joins)
|
|
315
|
+
if (segmentLengthScreenDouble >= EPS) {
|
|
316
|
+
// Project the actual vertex position onto the line segment. Note that the resulting factor is within [0..1]
|
|
317
|
+
// at the original vertex positions, and slightly outside of that range at the displaced positions
|
|
318
|
+
vec3 stippleDisplacement = pos.xyz - segmentOrigin;
|
|
319
|
+
float stippleDisplacementFactor = dot(segment.xy, stippleDisplacement.xy) / (segmentLengthScreenDouble * segmentLengthScreenDouble);
|
|
320
|
+
|
|
321
|
+
// Apply this offset to the actual vertex coordinate (can be screen or pseudo-screen space)
|
|
322
|
+
vStippleDistance += (stippleDisplacementFactor - isEndVertex) * (vStippleDistanceLimits.y - vStippleDistanceLimits.x);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Cancel out perspective correct interpolation because we want this length the really represent the screen
|
|
326
|
+
// distance
|
|
327
|
+
vStippleDistanceLimits = noPerspectiveWrite(vStippleDistanceLimits, pos.w);
|
|
328
|
+
vStippleDistance = noPerspectiveWrite(vStippleDistance, pos.w);
|
|
329
|
+
|
|
330
|
+
// Disable stipple distance limits on caps
|
|
331
|
+
vStippleDistanceLimits = isJoin ?
|
|
332
|
+
vStippleDistanceLimits :
|
|
333
|
+
isStartVertex ?
|
|
334
|
+
vec2(-1e34, vStippleDistanceLimits.y) :
|
|
335
|
+
vec2(vStippleDistanceLimits.x, 1e34);
|
|
336
|
+
`)),T.main.add(y.H`
|
|
337
|
+
// Convert back into NDC
|
|
338
|
+
pos.xy = (pos.xy / viewport.zw) * pos.w;
|
|
339
|
+
pos.z = pos.z * pos.w;
|
|
340
|
+
|
|
341
|
+
vColor = getColor();
|
|
342
|
+
vColor.a = noPerspectiveWrite(vColor.a * coverage, pos.w);
|
|
343
|
+
|
|
344
|
+
${I&&!E?"pos.z -= EPS * pos.w;":""}
|
|
345
|
+
|
|
346
|
+
// transform final position to camera space for slicing
|
|
347
|
+
vpos = (inverseProjectionMatrix * pos).xyz;
|
|
348
|
+
gl_Position = pos;
|
|
349
|
+
forwardObjectAndLayerIdColor();
|
|
350
|
+
}`),t.fragment.include(r.HQ,e),t.include(S.D,e),A.include(h.a),A.main.add(y.H`discardBySlice(vpos);`),t.include(u.m),A.include(_.Q),A.main.add(y.H`
|
|
351
|
+
float lineWidth = noPerspectiveRead(vLineWidth);
|
|
352
|
+
float lineDistance = noPerspectiveRead(vLineDistance);
|
|
353
|
+
${(0,y.If)(B,y.H`float lineDistanceNorm = noPerspectiveRead(vLineDistanceNorm);`)}
|
|
354
|
+
`),I?A.main.add(y.H`vec4 finalColor = vec4(1.0, 0.0, 1.0, 1.0);`):(H&&A.main.add(y.H`float sdf = noPerspectiveRead(min(vSegmentSDF, vReverseSegmentSDF));
|
|
355
|
+
vec2 fragmentPosition = vec2(min(sdf, 0.0), lineDistance);
|
|
356
|
+
float fragmentRadius = length(fragmentPosition);
|
|
357
|
+
float fragmentCapSDF = (fragmentRadius - lineWidth) * 0.5;
|
|
358
|
+
float capCoverage = clamp(0.5 - fragmentCapSDF, 0.0, 1.0);
|
|
359
|
+
if (capCoverage < alphaCutoff) {
|
|
360
|
+
discard;
|
|
361
|
+
}`),U?A.main.add(y.H`vec2 stipplePosition = vec2(
|
|
362
|
+
min(getStippleSDF() * 2.0 - 1.0, 0.0),
|
|
363
|
+
lineDistanceNorm
|
|
364
|
+
);
|
|
365
|
+
float stippleRadius = length(stipplePosition * lineWidth);
|
|
366
|
+
float stippleCapSDF = (stippleRadius - lineWidth) * 0.5;
|
|
367
|
+
float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0);
|
|
368
|
+
float stippleAlpha = step(alphaCutoff, stippleCoverage);`):A.main.add(y.H`float stippleAlpha = getStippleAlpha(lineWidth);`),11!==O&&A.main.add(y.H`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),t.include(u.m),A.uniforms.add(new f.E("intrinsicColor",e=>e.color)).main.add(y.H`vec4 color = intrinsicColor * vColor;
|
|
369
|
+
color.a = noPerspectiveRead(color.a);`),F&&A.uniforms.add(new f.E("innerColor",e=>e.innerColor??e.color),new v.m("innerWidth",(e,t)=>e.innerWidth*t.camera.pixelRatio)).main.add(y.H`float distToInner = abs(lineDistance) - innerWidth;
|
|
370
|
+
float innerAA = clamp(0.5 - distToInner, 0.0, 1.0);
|
|
371
|
+
float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
|
|
372
|
+
color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`),A.main.add(y.H`vec4 finalColor = blendStipple(color, stippleAlpha);`),P&&(A.uniforms.add(new v.m("falloff",e=>e.falloff)),A.main.add(y.H`finalColor.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),L||A.main.add(y.H`float stretchFactor = vIsInsideJoin > 0.0 ? noPerspectiveRead(vStretchFactor) : 1.0;
|
|
373
|
+
float featherWidth = 2.0;
|
|
374
|
+
float featherStartDistance = max(lineWidth - featherWidth / stretchFactor, 0.0);
|
|
375
|
+
float straightFeatherStartDistance = max(lineWidth - featherWidth, 0.0);
|
|
376
|
+
float value = abs(lineDistance);
|
|
377
|
+
float feather = (value - featherStartDistance) / (lineWidth - featherStartDistance);
|
|
378
|
+
float joinCenterLineDistance = abs(noPerspectiveRead(vJoinCenterLineSDF));
|
|
379
|
+
float straightFeather = (joinCenterLineDistance - straightFeatherStartDistance) / (lineWidth - straightFeatherStartDistance);
|
|
380
|
+
feather = vIsInsideJoin > 0.0 ? max(feather, straightFeather) : feather;
|
|
381
|
+
finalColor.a *= 1.0 - clamp(feather, 0.0, 1.0);`),z&&A.main.add(y.H`
|
|
382
|
+
finalColor = animate(finalColor);
|
|
383
|
+
|
|
384
|
+
${(0,y.If)(11!==O,y.H`
|
|
385
|
+
if (finalColor.a <= alphaCutoff) {
|
|
386
|
+
discard;
|
|
387
|
+
}`)}
|
|
388
|
+
`)),A.main.add(y.H`outputColorHighlightOLID(applySlice(finalColor, vpos), finalColor.rgb);`),t}const A=Object.freeze(Object.defineProperty({__proto__:null,build:T,ribbonlineNumRoundJoinSubdivisions:C},Symbol.toStringTag,{value:"Module"}))},92942(e,t,i){i.d(t,{T:()=>h,a:()=>d,b:()=>u});var r=i(51850),n=i(82048),s=i(33079),o=i(31821),a=i(63761),l=i(65786),c=i(14113);class h extends l.Y{constructor(){super(...arguments),this.color=(0,r.fA)(1,1,1)}}function u(){const e=new c.N5;return e.include(n.c),e.fragment.uniforms.add(new a.N("tex",e=>e.texture),new s.t("uColor",e=>e.color)).main.add(o.H`vec4 texColor = texture(tex, uv);
|
|
389
|
+
fragColor = texColor * vec4(uColor, 1.0);`),e}const d=Object.freeze(Object.defineProperty({__proto__:null,TexturePassParameters:h,build:u},Symbol.toStringTag,{value:"Module"}))},83349(e,t,i){function r(e,t,i){i=i||2;var r,s,a,l,c,h,d,p=t&&t.length,g=p?t[0]*i:e.length,f=n(e,0,g,i,!0),m=[];if(!f||f.next===f.prev)return m;if(p&&(f=u(e,t,f,i)),e.length>80*i){r=a=e[0],s=l=e[1];for(var v=i;v<g;v+=i)(c=e[v])<r&&(r=c),(h=e[v+1])<s&&(s=h),c>a&&(a=c),h>l&&(l=h);d=0!==(d=Math.max(a-r,l-s))?1/d:0}return o(f,m,i,r,s,d),m}function n(e,t,i,r,n){var s,o;if(n===L(e,t,i,r)>0)for(s=t;s<i;s+=r)o=E(s,e[s],e[s+1],o);else for(s=i-r;s>=t;s-=r)o=E(s,e[s],e[s+1],o);if(o&&S(o,o.next)){var a=o.next;O(o),o=a}return o}function s(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!S(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{var n=r.prev;if(O(r),(r=t=n)===r.next)break;i=!0}}while(i||r!==t);return t}function o(e,t,i,r,n,u,d){if(e){!d&&u&&m(e,r,n,u);for(var p,g,f=e;e.prev!==e.next;)if(p=e.prev,g=e.next,u?l(e,r,n,u):a(e))t.push(p.i/i),t.push(e.i/i),t.push(g.i/i),O(e),e=g.next,f=g.next;else if((e=g)===f){d?1===d?o(e=c(s(e),t,i),t,i,r,n,u,2):2===d&&h(e,t,i,r,n,u):o(s(e),t,i,r,n,u,1);break}}}function a(e){var t=e.prev,i=e,r=e.next;if(b(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(x(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&b(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function l(e,t,i,r){var n=e.prev,s=e,o=e.next;if(b(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,h=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,u=v(a,l,t,i,r),d=v(c,h,t,i,r),p=e.prevZ,g=e.nextZ;p&&p.z>=u&&g&&g.z<=d;){if(p!==e.prev&&p!==e.next&&x(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,g!==e.prev&&g!==e.next&&x(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&x(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;g&&g.z<=d;){if(g!==e.prev&&g!==e.next&&x(n.x,n.y,s.x,s.y,o.x,o.y,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function c(e,t,i){var r=e;do{var n=r.prev,o=r.next.next;!S(n,o)&&w(n,r,r.next,o)&&A(n,o)&&A(o,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(o.i/i),O(r),O(r.next),r=e=o),r=r.next}while(r!==e);return s(r)}function h(e,t,i,r,n,a){var l=e;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&_(l,c)){var h=R(l,c);return l=s(l,l.next),h=s(h,h.next),o(l,t,i,r,n,a),void o(h,t,i,r,n,a)}c=c.next}l=l.next}while(l!==e)}function u(e,t,i,r){var o,a,l,c=[];for(o=0,a=t.length;o<a;o++)(l=n(e,t[o]*r,o<a-1?t[o+1]*r:e.length,r,!1))===l.next&&(l.steiner=!0),c.push(y(l));for(c.sort(d),o=0;o<c.length;o++)i=s(i=g(c[o],i),i.next);return i}function d(e,t){return e.x-t.x}function p(e){if(e.next.prev===e)return e;let t=e;for(;;){const i=t.next;if(i.prev===t||i===t||i===e)break;t=i}return t}function g(e,t){var i=function(e,t){var i,r=t,n=e.x,s=e.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>o){if(o=a,a===n){if(s===r.y)return r;if(s===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!i)return null;if(n===o)return i;var l,c=i,h=i.x,u=i.y,d=1/0;r=i;do{n>=r.x&&r.x>=h&&n!==r.x&&x(s<u?n:o,s,h,u,s<u?o:n,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(n-r.x),A(r,e)&&(l<d||l===d&&(r.x>i.x||r.x===i.x&&f(i,r)))&&(i=r,d=l)),r=r.next}while(r!==c);return i}(e,t);if(!i)return t;var r=R(i,e),n=s(i,i.next);let o=p(r);return s(o,o.next),n=p(n),p(t===i?n:t)}function f(e,t){return b(e.prev,e,t.prev)<0&&b(t.next,e,e.next)<0}function m(e,t,i,r){var n=e;do{null===n.z&&(n.z=v(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,s,o,a,l,c=1;do{for(i=e,e=null,s=null,o=0;i;){for(o++,r=i,a=0,t=0;t<c&&(a++,r=r.nextZ);t++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=r}s.nextZ=null,c*=2}while(o>1)}(n)}function v(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function y(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function x(e,t,i,r,n,s,o,a){return(n-o)*(t-a)-(e-o)*(s-a)>=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(s-a)-(n-o)*(r-a)>=0}function _(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&w(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(A(e,t)&&A(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(b(e.prev,e,t.prev)||b(e,t.prev,t))||S(e,t)&&b(e.prev,e,e.next)>0&&b(t.prev,t,t.next)>0)}function b(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function S(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,i,r){var n=T(b(e,t,i)),s=T(b(e,t,r)),o=T(b(i,r,e)),a=T(b(i,r,t));return n!==s&&o!==a||!(0!==n||!C(e,i,t))||!(0!==s||!C(e,r,t))||!(0!==o||!C(i,e,r))||!(0!==a||!C(i,t,r))}function C(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function T(e){return e>0?1:e<0?-1:0}function A(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function R(e,t){var i=new M(e.i,e.x,e.y),r=new M(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function E(e,t,i,r){var n=new M(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function O(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function M(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function L(e,t,i,r){for(var n=0,s=t,o=i-r;s<i;s+=r)n+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return n}i.d(t,{e:()=>r}),r.deviation=function(e,t,i,r){var n=t&&t.length,s=n?t[0]*i:e.length,o=Math.abs(L(e,0,s,i));if(n)for(var a=0,l=t.length;a<l;a++){var c=t[a]*i,h=a<l-1?t[a+1]*i:e.length;o-=Math.abs(L(e,c,h,i))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*i,p=r[a+1]*i,g=r[a+2]*i;u+=Math.abs((e[d]-e[g])*(e[p+1]-e[d+1])-(e[d]-e[p])*(e[g+1]-e[d+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},r.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var s=0;s<e[n].length;s++)for(var o=0;o<t;o++)i.vertices.push(e[n][s][o]);n>0&&(r+=e[n-1].length,i.holes.push(r))}return i}},21287(e,t,i){i.d(t,{M5:()=>u,eV:()=>h});var r=i(11254),n=i(49186),s=i(17676),o=i(84952),a=i(26306);let l=null,c=!0;function h(e,t,i,r){if(!t||!i)throw new Error("Cannot construct image data without dimensions");if(c)try{return new ImageData(e,t,i)}catch(e){c=!1}const n=function(e,t,i){return i||(l||(l=document.createElement("canvas"),l.width=1,l.height=1),i=l),i.getContext("2d").createImageData(e,t)}(t,i,r);return n.data.set(e,0),n}async function u(e,t){const{arrayBuffer:l,mediaType:c}=await async function(e,t){const i=(0,o.r$)(e);if(i?.isBase64)return{arrayBuffer:(0,a.M)(i.data),mediaType:i.mediaType};const n=await(0,r.A)(e,{responseType:"array-buffer",...t});return{arrayBuffer:n.data,mediaType:n.getHeader?.("Content-Type")??""}}(e,t),h="image/png"===c;if("image/gif"===c){const{isAnimatedGIF:e,parseGif:r}=await i.e(820).then(i.bind(i,10820));if(e(l))return r(l,t)}if(h){const{isAnimatedPNG:e,parseApng:r}=await i.e(2390).then(i.bind(i,22390));if(e(l))return r(l,t)}return async function(e,t){const i=window.URL.createObjectURL(e);try{const{data:e}=await(0,r.A)(i,{...t,responseType:"image"});return e}catch(e){if(!(0,s.zf)(e))throw new n.A("invalid-image",`Could not fetch requested image at ${i}`);throw e}finally{window.URL.revokeObjectURL(i)}}(new Blob([l],{type:c}),t)}},44794(e,t,i){i.d(t,{v:()=>a});var r=i(4718),n=i(62788),s=i(95488);class o{constructor(e,t){this._observable=new s.I,this._value=e,this._equalityFunction=t}get value(){return(0,n.gc)(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}}function a(e,t=r.gh){return new o(e,t)}},27925(e,t,i){i.r(t),i.d(t,{default:()=>as});var r=i(5482),n=i(69540),s=i(49186),o=i(92474),a=i(53966),l=i(61893),c=i(17676),h=i(36708),u=i(91429),d=i(51850),p=i(91075),g=i(86738),f=i(39829),m=i(70328),v=i(24770),y=i(16939);const x="Expected location to be a Point instance";class _ extends s.A{constructor(){super("invalid-input:location",x)}}var b=i(95696),S=i(18251),w=i(73836),C=i(1193),T=i(27615),A=i(35522),R=i(65806);function E(e,t){switch(e.type){case"georeferenced":return t.isGeographic;case"local":return t.isGeographic||t.isWebMercator}}var O=i(22141),M=i(72258);const L=()=>a.A.getLogger("esri.geometry.support.meshUtils.centerAt");const P=(0,d.vt)(),D=(0,d.vt)(),I=(0,d.vt)();var F=i(9093),z=i(5443),N=i(91218),W=i(98764),V=i(48353),j=i(9762),H=i(4197),U=i(73354);const B=(0,F.vt)(),Z=(0,H.jh)(24);var k=i(84952);function G(e){const t=(0,k.nM)(e.url);return i=>{const r=(0,k.V1)(i,t,t),n=r?r.replace(/^ *\.\//,""):null;return(n?e.files.get(n):null)??i}}async function q(e,t){switch(e.type){case"client":return Array.isArray(e.files)?function(e){if(!e.length)throw new s.A("mesh-load-external:missing-assets","There must be at least one file to load");return ee(e.map(e=>({name:e.name,mimeType:e.type,source:$(e)})))}(e.files):$(e.files);case"service":return async function(e,t){if(!e.length)throw new s.A("mesh-load-external:missing-assets","There must be at least one file to load");const i=await(0,c.nA)(e.map(async e=>{const i=await async function(e,t){const{parts:i,assetMimeType:r,assetName:n}=e;if(1===i.length)return new te(i[0].partUrl);const s=await e.toBlob(t);return(0,c.Te)(t),te.fromBlob(s,ie(n,r))}(e);return(0,c.Te)(t),{name:e.assetName,mimeType:e.assetMimeType,source:i}}));if((0,c.G4)(t))throw i.forEach(e=>e.source.dispose()),(0,c.NK)();return ee(i)}(e.assets,t);default:throw new s.A("mesh-load-external:invalid-source","Invalid source type")}}function $(e){return te.fromBlob(e,ie(e.name,e.type))}const Y=/^model\/gltf\+json$/,Q=/^model\/gltf-binary$/,K=/\.gltf$/i,X=/\.glb$/i;function J({mimeType:e,source:t,name:i}){return Y.test(e)||K.test(i)?{url:t.url,type:"gltf"}:Q.test(e)||X.test(i)?{url:t.url,type:"glb"}:null}function ee(e){const t=new Map;let i=null,r=null;for(const n of e){const{source:e,name:s}=n;i??=J(n),"ESRI3DO_NORM.glb"===s&&(r=J(n)),t.set(s,e.url),e.files.forEach((e,i)=>t.set(i,e))}const n=r??i;if(null==n)throw new s.A("mesh-load-external:missing-files","Missing files to load external mesh source");return new te(n.url,()=>e.forEach(({source:e})=>e.dispose()),t,n.type)}class te{constructor(e,t=()=>{},i=new Map,r){this.url=e,this.dispose=t,this.files=i,this.type=r}static fromBlob(e,t){const i=URL.createObjectURL(e);return new te(i,()=>URL.revokeObjectURL(i),void 0,t)}}function ie(e,t){return Y.test(t)||K.test(e)?"gltf":Q.test(t)||K.test(e)?"glb":void 0}var re=i(66895),ne=i(7762),se=i(63579);let oe=class extends n.Pw{constructor(e){super(e),this.externalSources=new ne.A,this._explicitDisplaySource=null,this.addHandles((0,h.on)(()=>this.externalSources,"after-remove",({item:e})=>{e===this._explicitDisplaySource&&(this._explicitDisplaySource=null)},{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(e){if(null!=e&&!(0,se.yr)(e))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=e,e&&this.externalSources.every(t=>!(0,se.in)(t,e))&&this.externalSources.add(e)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(e){return this.externalSources.items.filter(t=>(0,se.eN)(t,e))}get _implicitDisplaySource(){return this.externalSources.find(se.yr)}};(0,r.Cg)([(0,u.MZ)()],oe.prototype,"externalSources",void 0),(0,r.Cg)([(0,u.MZ)()],oe.prototype,"displaySource",null),(0,r.Cg)([(0,u.MZ)()],oe.prototype,"_implicitDisplaySource",null),(0,r.Cg)([(0,u.MZ)()],oe.prototype,"_explicitDisplaySource",void 0),oe=(0,r.Cg)([(0,u.$K)("esri.geometry.support.meshUtils.Metadata")],oe);var ae=i(29242);const le={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[3,1,2],west:[-3,-1,2],north:[-1,3,2],south:[1,-3,2],up:[1,2,3],down:[1,-2,-3]}};function ce(e,t,i){e.isPlane||function(e){for(let t=0;t<e.position.length;t+=3)e.position[t+2]+=.5}(e),function(e,t){if(null!=t){pe[0]=t[0],pe[4]=t[1],pe[8]=t[2];for(let t=0;t<e.position.length;t+=3){for(let i=0;i<3;i++)de[i]=e.position[t+i];(0,A.ei)(de,de,pe);for(let i=0;i<3;i++)e.position[t+i]=de[i]}if(t[0]!==t[1]||t[1]!==t[2]){pe[0]=1/t[0],pe[4]=1/t[1],pe[8]=1/t[2];for(let t=0;t<e.normal.length;t+=3){for(let i=0;i<3;i++)de[i]=e.normal[t+i];(0,A.ei)(de,de,pe),(0,A.S8)(de,de);for(let i=0;i<3;i++)e.normal[t+i]=de[i]}}}}(e,function(e,t,i){const r=(0,M.xK)(t,i);if(null==e&&1===r)return null;if(null==e)return[r,r,r];if("number"==typeof e){const t=e*r;return[t,t,t]}return[null!=e.width?e.width*r:r,null!=e.depth?e.depth*r:r,null!=e.height?e.height*r:r]}(i?.size,i?.unit,t.spatialReference));const r=(0,T.TE)(t,i),n=t.spatialReference.isGeographic?(0,T.TE)(t):r,s=(0,M.UR)({vertexAttributes:e,vertexSpace:n,spatialReference:t.spatialReference},r,{allowBufferReuse:!0});return{vertexAttributes:new C.default({...s,uv:e.uv}),vertexSpace:r,components:[new y.default({faces:e.faces,material:i?.material||null})],spatialReference:t.spatialReference}}const he={faceDescriptions:[{axis:[0,-1,0],uvOrigin:[0,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[1,0,0],uvOrigin:[.25,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,1,0],uvOrigin:[.5,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[-1,0,0],uvOrigin:[.75,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[0,0,1],uvOrigin:[0,.375],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,0,-1],uvOrigin:[0,.875],corners:[[-1,1],[1,1],[1,-1],[-1,-1]]}],uvScales:[[0,0],[1,0],[1,1],[0,1]],faceVertexOffsets:[0,1,2,0,2,3]},ue={south:0,east:1,north:2,west:3,up:4,down:5},de=(0,d.vt)(),pe=(0,ae.vt)();var ge=i(77690),fe=i(58083),me=i(67026),ve=i(82534);const ye=()=>a.A.getLogger("esri.geometry.support.meshUtils.rotate");function xe(e,t,i,r=d.uY){if(null!=e){(0,fe.$0)(we,(0,v.$I)(t),(0,v.yo)(t));for(let t=0;t<e.length;t+=i){for(let i=0;i<3;i++)_e[i]=e[t+i]-r[i];(0,A.Z0)(_e,_e,we);for(let i=0;i<3;i++)e[t+i]=_e[i]+r[i]}}}const _e=(0,d.vt)(),be=(0,F.vt)(),Se=(0,v.vt)(),we=(0,F.vt)(),Ce=(0,ae.vt)(),Te=(0,d.vt)(),Ae=(0,ve.vt)(),Re=()=>a.A.getLogger("esri.geometry.support.meshUtils.scale");function Ee(e,t,i=d.uY){if(e)for(let r=0;r<e.length;r+=3){for(let t=0;t<3;t++)Oe[t]=e[r+t]-i[t];(0,A.hs)(Oe,Oe,t);for(let t=0;t<3;t++)e[r+t]=Oe[t]+i[t]}}const Oe=(0,d.vt)(),Me=(0,d.vt)(),Le=(0,F.vt)(),Pe=(0,d.vt)();(0,F.vt)(),new class{constructor(){this.verticalDistanceToGround=0,this.sampledElevation=0,this.z=0}},(0,d.vt)();var De=i(44208),Ie=i(62788),Fe=i(95488),ze=i(83349),Ne=i(15585),We=i(95108),Ve=i(97146),je=i(34727),He=i(86211),Ue=i(27921);const Be=(0,Ue.vt)();function Ze(e,t,i){if(!t)return 2;const r=e.map(e=>{const r=Ke(e,t);return r<3?2:function(e,t,i){const r=function(e,t,i,r){const n=(e=>!Array.isArray(e[0]))(t)?(e,i)=>t[3*e+i]:(e,i)=>t[e][i],s=(0,He.GA)(r)/(0,He.G9)(r);return(0,Ue.lU)(e,(e,t)=>(0,A.hZ)(e,n(t,0)*s,n(t,1)*s,n(t,2)),i)}(Be,e,t,i)?(0,Ue.Qj)(Be):[0,0,1];return Math.abs(r[2])>Math.cos((0,je.kU)(80))?2:Math.abs(r[1])>Math.abs(r[0])?1:0}(e,r,i)}),n=r[0];return r.every(e=>e===n)?n:2}function ke(e,t,i){if(!t)return!(0,We.$3)(e);if(e.length<3)return!1;switch(i){case 0:return!(0,We.$3)(e,1,2);case 1:return!(0,We.$3)(e,0,2);case 2:return!(0,We.$3)(e,0,1)}}const Ge=new Fe.I;function qe(e,t){if(!(0,Ne.O9)())return Xe("libtess-not-loaded");const i=null!=t.outlines,{positions:r,mergedPathLengths:n}=function(e){const t=function(e){const t=e.reduce((e,t)=>e+t.pathLengths.length,0),i=new Array(t);let r=0;for(let t=0;t<e.length;t++){const n=e[t].pathLengths;for(let e=0;e<n.length;e++)i[r++]=n[e]}return i}(e.polygons),i=3*e.polygonVertexCount;return i===e.positions.length?{positions:e.positions,mergedPathLengths:t}:{positions:(0,H.l5)(e.positions,0,i),mergedPathLengths:t}}(e),{vertices:s,indices:o,outlineIndices:a,outlineRingLengths:l}=(0,Ne.O5)(r,n,3,i);return s.length%3!=0?Xe("positions-not-multiple-of-3"):{succeeded:!0,positions:s,indices:o,outlineIndexBuffer:i?a:void 0,outlineRingLengths:i?l:void 0,vertexCount:s.length/3,method:"libtess"}}function $e(e,t,i){for(let r=0;r<e.length;r+=3){const n=e[r+t];e[r+t]=e[r+i],e[r+i]=n}}function Ye(e,{index:t,count:i}){return(0,H.l5)(e,3*t,3*i)}function Qe(e,t,i,r,n,s){let o=s?e.length-1:0;const a=s?-1:1;i*=3;for(let s=0;s<r;++s){const r=e[o];t[i++]=r[0],t[i++]=r[1],t[i++]=n&&null!=r[2]?r[2]:0,o+=a}return i/3}function Ke(e,t){return function(e,t){const i=e.length;if(i<2)return!1;const r=e[0],n=e[i-1];return r[0]===n[0]&&r[1]===n[1]&&(!t||r[2]===n[2])}(e,t)?e.length-1:e.length}function Xe(e){return{succeeded:!1,message:e}}var Je=i(4576),et=i(65529),tt=i(91869),it=i(97768),rt=i(15142),nt=i(3483),st=i(26857),ot=i(78955),at=i(19419);class lt{constructor(e,t){this.vec3=e,this.id=t}}function ct(e,t,i,r){return new lt((0,d.fA)(e,t,i),r)}class ht{constructor(){this._extent=(0,at.vt)(),this.resolution=0,this.renderLocalOrigin=ct(0,0,0,"O"),this.pixelRatio=1,this.mapUnitsPerPixel=1,this.canvasGeometries=new ut}get extent(){return this._extent}setExtent(e){(0,ot.C)(this._extent,e)}setupGeometryViews(e){if(this._setupGeometryView(),!e)return;const t=.001*e.range;if(this._extent[0]-t<=e.min){const t=this.canvasGeometries.extents[this.canvasGeometries.numViews++];(0,at.cY)(this._extent,e.range,0,t)}if(this._extent[2]+t>=e.max){const t=this.canvasGeometries.extents[this.canvasGeometries.numViews++];(0,at.cY)(this._extent,-e.range,0,t)}}_setupGeometryView(){this.canvasGeometries.numViews=1,(0,at.C)(this.canvasGeometries.extents[0],this._extent)}hasSomeSizedView(){for(let e=0;e<this.canvasGeometries.numViews;e++){const t=this.canvasGeometries.extents[e];if(t[0]!==t[2]&&t[1]!==t[3])return!0}return!1}}class ut{constructor(){this.extents=[(0,at.vt)(),(0,at.vt)(),(0,at.vt)()],this.numViews=0}}class dt{constructor(e,t,i){this._fbos=e,this._format=t,this._name=i}get valid(){return null!=this._handle?.getTexture()}dispose(){this._handle=(0,it.Gz)(this._handle)}get texture(){return this._handle?.getTexture()}ensureFramebuffer(e,t){this._handle&&this._handle.fbo?.width===e&&this._handle.fbo?.height===t||(this._handle?.release(),this._handle=this._fbos.acquire(e,t,this._name,this._format))}bind(e){e.bindFramebuffer(this._handle?.fbo)}generateMipMap(){this._handle?.getTexture()?.descriptor?.hasMipmap&&this._handle?.getTexture()?.generateMipmap()}}var pt=i(16943);class gt{constructor(e,t,i,r,n=1,s=6){this.output=i,this.content=r,this.redrawOnRequest=n,this.fbo=new dt(e,s,t)}handleRenderRequest(e){return 1===e||e===this.redrawOnRequest}get valid(){return this.fbo.valid}}class ft{constructor(e){const t=[new gt(e,"overlay color",0,0),new gt(e,"overlay IM color",0,1),new gt(e,"overlay highlight",10,2,1,3),new gt(e,"overlay water",4,3,0),new gt(e,"overlay occluded",0,4)];(0,pt.E)()&&t.push(new gt(e,"overlay olid",11,5,1,5)),this.targets=t}getTexture(e){return this.targets[e]?.fbo.texture}dispose(e){if(0!==e)for(const e of this.targets)e.fbo.dispose();else this.targets[3].fbo.dispose()}computeValidity(){return this.targets.reduce((e,t,i)=>t.valid?e|=1<<i:e,0)}}var mt=i(91712),vt=i(69622);class yt extends vt.A{precompile(e){return!!this.acquireTechniques(e)}get usedMemory(){return 0}get renderOccludedFlags(){return 1}get testsTransparentRenderOrder(){return 0}get isDecoration(){return!1}get readyToRun(){return!1}get numGeometries(){return 0}get hasOccludees(){return!1}get hasEmissions(){return 0}forEachGeometry(e){}}class xt extends yt{}var _t=i(37585),bt=i(2016),St=i(48375),wt=i(13840),Ct=i(98958),Tt=i(72091),At=i(41976),Rt=i(90644);let Et=class extends Ct.w{constructor(e,t){super(e,t,At.wR),this.shader=new wt.r(Tt.H,()=>i.e(785).then(i.bind(i,13166)))}initializePipeline(){return(0,Rt.Ey)({blending:Rt.T8,colorWrite:Rt.kn})}};Et=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.highlight.HighlightApplyTechnique")],Et);var Ot=i(28476);let Mt=class extends Ct.w{constructor(e,t){super(e,t,At.wR),this.shader=new wt.r(Ot.a,()=>i.e(6027).then(i.bind(i,76027)))}initializePipeline(){return(0,Rt.Ey)({colorWrite:Rt.kn})}};Mt=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.highlight.HighlightBlurTechnique")],Mt);var Lt=i(34053);let Pt=class extends Ct.w{constructor(){super(...arguments),this.shader=new wt.r(Lt.a,()=>i.e(9438).then(i.bind(i,29438)))}initializePipeline(){return(0,Rt.Ey)({colorWrite:Rt.kn})}};Pt=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.highlight.HighlightDownsampleTechnique")],Pt);var Dt=i(68197);new Dt.A("cyan"),new Dt.A("black"),new Dt.A("yellow");var It=i(65786);class Ft extends It.Y{constructor(){super(...arguments),this.occludedFactor=.25,this.verticalCellCount=0,this.horizontalCellCount=0,this.highlightLevel=0,this.pixelRatio=1}}var zt=i(16824);let Nt=class extends Ct.w{constructor(e,t){super(e,t,At.wR),this.shader=new wt.r(zt.H,()=>i.e(1011).then(i.bind(i,51011)))}initializePipeline(){return(0,Rt.Ey)({colorWrite:Rt.kn})}};Nt=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.highlight.HighlightToSingleTechnique")],Nt);var Wt=i(79785);class Vt extends Wt.Z{}var jt=i(48852),Ht=i(63907),Ut=i(21231),Bt=i(67171),Zt=i(66289);let kt=class extends St.A{constructor(){super(...arguments),this.produces=bt.OG.HIGHLIGHT_COLOR,this.consumes={required:[bt.OG.HIGHLIGHT_COLOR,"highlights"]},this._downsampleDrawParameters=new Lt.H,this._passParameters=new Ft,this._highlightBlurDrawParameters=new Ot.H,this._grid=new Gt}initialize(){this.addHandles([(0,h.wB)(()=>this._updateOptionsTexture(),()=>{},h.Vh)])}destroy(){this._grid.coverage=(0,it.Gz)(this._grid.coverage),this._grid.vao=(0,it.WD)(this._grid.vao),this._passParameters.highlightOptionsTexture=(0,it.Gz)(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new Bt.R(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new Ut.A(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(function(e){const t=new Uint8Array(128);let i=0;for(const r of e){const e=4*i,n=4*i+64;++i;const{color:s}=r,o=r.haloColor??s;t[e+0]=s.r,t[e+1]=s.g,t[e+2]=s.b,t[e+3]=r.fillOpacity*s.a*255,t[n+0]=o.r,t[n+1]=o.g,t[n+2]=o.b,t[n+3]=r.haloOpacity*o.a*255}return t}(this.view.state.highlights)),this.requestRender(1)}precompile(){this.bindParameters.decorations&&(this.techniques.precompile(Pt),this.techniques.precompile(Nt),this.techniques.precompile(Mt),this.techniques.precompile(Et))}render(e){const t=e.find(({name:e})=>e===bt.OG.HIGHLIGHT_COLOR),{techniques:i,bindParameters:r,fboCache:n,_passParameters:s,renderingContext:o}=this;if(!r.decorations)return t;const a=i.getCompiled(Pt),l=i.getCompiled(Nt),c=i.getCompiled(Mt),h=i.getCompiled(Et);if(!(a&&h&&c&&l))return this.requestRender(1),t;const u=e.find(({name:e})=>"highlights"===e).getTexture();s.highlightTexture=u;const d=this._prepareAndDownSample(u),{width:p,height:g}=u.descriptor;s.highlightTexture=u;const{camera:f}=r,{fullWidth:m,fullHeight:v,pixelRatio:y,fullViewport:x}=f,_=Math.ceil(m/y),b=Math.ceil(v/y),{_highlightBlurDrawParameters:S}=this,w=this.view.stage.renderView.renderer,{highlights:C}=r;for(let e=0;e<C.length;++e){const{name:i}=C[e];if(!w.hasHighlight(i))continue;s.highlightLevel=e,o.setClearColor(0,0,0,0);const a=n.acquire(p,g,"single highlight",2);o.bindFramebuffer(a.fbo),o.setViewport(0,0,p,g),o.clear(16384),o.bindTechnique(l,r,s),this._renderGrid(d),S.blurInput=a.getTexture(),(0,_t.hZ)(S.blurSize,1/_,0);const u=n.acquire(_,b,"single highlight blur",2);o.unbindTexture(u.fbo?.colorTexture),o.bindFramebuffer(u.fbo),o.setViewport(0,0,_,b),o.clear(16384),o.bindTechnique(c,r,s,S),this._renderGrid(d),a.release(),(0,_t.hZ)(S.blurSize,0,1/b),s.highlightBlurTexture=u.getTexture(),o.bindFramebuffer(t.fbo),o.setDrawBuffers([Ht.r6]),o.setViewport4fv(x),o.bindTechnique(h,r,s,S),this._renderGrid(d),u.release()}return s.coverageTexture=s.highlightTexture=null,t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(Pt),i=this._gridComputeCoverage(t,e),{horizontalCellCount:r,verticalCellCount:n}=i,s=this._passParameters;return s.horizontalCellCount=r,s.verticalCellCount=n,s.coverageTexture=i.coverage?.getTexture(),i}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(Ht.WR.TRIANGLES,6,Ht.pe.UNSIGNED_BYTE,0,t)}_gridUpdateResources(e){const t=this._grid,{width:i,height:r}=e.descriptor;if(t.horizontalCellCount=Math.ceil(i/Lt.g),t.verticalCellCount=Math.ceil(r/Lt.g),t.vao)return;const n=this.renderingContext,s=jt.g.createIndex(n,35044,$t);t.vao=new Vt(n,new Zt.R(n,At.wR),s)}_gridComputeCoverage(e,t){const i=this.renderingContext,r=this._grid,n=t.descriptor,s=Math.ceil(n.width/Lt.g),o=Math.ceil(n.height/Lt.g);this._downsampleDrawParameters.input=t;const{highlights:a}=this.bindParameters;r.coverage?.release();const l=this.fboCache.acquire(s,o,"highlight coverage",a.length>Yt?3:1);return r.coverage=l,i.bindFramebuffer(l.fbo),i.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,s,o),i.screen.draw(),r}get test(){}};(0,r.Cg)([(0,u.MZ)()],kt.prototype,"produces",void 0),(0,r.Cg)([(0,u.MZ)()],kt.prototype,"consumes",void 0),kt=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.highlight.Highlight")],kt);class Gt{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}let qt=0;const $t=new Uint8Array([0,1,2,2,1,3]),Yt=4;class Qt{constructor(e,t,i){this.material=e,this.techniques=t,this.textures=i}}var Kt=i(620);class Xt{constructor(e,t,i,r){this._textures=e,this._techniques=t,this.materialChanged=i,this.requestRender=r,this._id2glMaterialRef=new Map}dispose(){this._textures.destroy()}acquire(e,t,i){this._ownMaterial(e);const r=e.produces.get(t);if(!r?.(i))return null;let n=this._id2glMaterialRef.get(e.id);if(null==n){const t=e.createGLMaterial(new Qt(e,this._techniques,this._textures));n=new Jt(t),this._id2glMaterialRef.set(e.id,n)}return n.ref(),n.glMaterial}release(e){const t=this._id2glMaterialRef.get(e.id);null!=t&&(t.unref(),t.referenced||((0,it.WD)(t.glMaterial),this._id2glMaterialRef.delete(e.id)))}_ownMaterial(e){e.repository&&e.repository!==this&&a.A.getLogger("esri.views.3d.webgl-engine.lib.GLMaterialRepository").error("Material is already owned by a different material repository"),e.repository=this}}class Jt{constructor(e){this.glMaterial=e,this._refCnt=0}ref(){++this._refCnt}unref(){--this._refCnt,(0,Kt.vA)(this._refCnt>=0)}get referenced(){return this._refCnt>0}}var ei=i(24326),ti=i(91829),ii=i(46610),ri=i(63500),ni=i(94008),si=i(32728),oi=i(17478);function ai(e,t){return null==e&&(e=[]),e.push(t),e}function li(e,t){if(null==e)return null;const i=e.filter(e=>e!==t);return 0===i.length?null:i}i(28449),(0,d.vt)(),new Float32Array(6);class ci{constructor(e={}){this.id=(0,ei.c)(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=e.castShadow??!0,this.usesVerticalDistanceToGround=e.usesVerticalDistanceToGround??!1,this.graphicUid=e.graphicUid,this.layerViewUid=e.layerViewUid,e.isElevationSource&&(this.lastValidElevationBB=new hi),this._geometries=e.geometries?Array.from(e.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(e){(0,Kt.vA)(null==this._layer||null==e,"Object3D can only be added to a single Layer"),this._layer=e}addGeometry(e){e.visible=this._visible,this._geometries.push(e);for(const t of this._highlightIds)e.addHighlight(t);this._emit("geometryAdded",{object:this,geometry:e}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(e){const t=this._geometries.splice(e,1)[0];if(t){for(const e of this._highlightIds)t.removeHighlight(e);this._emit("geometryRemoved",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(e,t,i=!1){this._emit("attributesChanged",{object:this,geometry:e,attribute:t,sync:i}),function(e){return"position"===e}(t)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(const e of this._geometries)e.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const e=new oi.p;for(const t of this._geometries)t.occludees=ai(t.occludees,e);return this._emit("occlusionChanged",this),e}removeOcclude(e){for(const t of this._geometries)t.occludees=li(t.occludees,e);this._emit("occlusionChanged",this)}highlight(e){const t=new oi.h(e);for(const e of this._geometries)e.addHighlight(t);return this._emit("highlightChanged",this),this._highlightIds.add(t),t}removeHighlight(e){this._highlightIds.delete(e);for(const t of this._geometries)t.removeHighlight(e);this._emit("highlightChanged",this)}removeStateID(e){0===e.channel?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,t){return(0,fe.lw)(t,this.transformation,e.transformation)}getCombinedShaderTransformation(e,t=(0,F.vt)()){return(0,fe.lw)(t,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new ui,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new ui,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(e,t){const i=1===t;for(const t of this._geometries){const r=t.boundingInfo;r&&di(r,e,i?t.transformation:this.getCombinedShaderTransformation(t))}(0,A.Cc)(e.bounds.center,e.min,e.max,.5);for(const t of this._geometries){const r=t.boundingInfo;if(null==r)continue;const n=i?t.transformation:this.getCombinedShaderTransformation(t),s=(0,si.hG)(n);(0,A.Z0)(mi,r.center,n);const o=(0,A.Io)(mi,e.bounds.center),a=r.radius*s;e.bounds.radius=Math.max(e.bounds.radius,o+a)}}_invalidateBoundingVolume(){const e=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}_emit(e,t){this.layer?.events.emit(e,t)}get geometries(){return this._geometries}get transformation(){return this._transformation??F.zK}set transformation(e){this._transformation=(0,fe.C)(this._transformation??(0,F.vt)(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?(0,fe.C)(this._shaderTransformation??(0,F.vt)(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class hi{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return(0,d.fA)(this._data[0],this._data[1],this._data[2])}get max(){return(0,d.fA)(this._data[3],this._data[4],this._data[5])}minWith(e){const{_data:t}=this;t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2])}maxWith(e){const{_data:t}=this;t[3]=Math.max(t[3],e[0]),t[4]=Math.max(t[4],e[1]),t[5]=Math.max(t[5],e[2])}assignMinMax(e,t){for(let i=0;i<3;++i)this._data[0+i]=e[i],this._data[3+i]=t[i]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class ui extends hi{constructor(){super(...arguments),this.bounds=new ni.iy}}function di(e,t,i){const r=e.bbMin,n=e.bbMax;if((0,fe.tZ)(i)){const e=(0,A.hZ)(pi,i[12],i[13],i[14]);return(0,A.WQ)(gi,r,e),(0,A.WQ)(fi,n,e),t.minWith(gi),void t.maxWith(fi)}if((0,A.Z0)(gi,r,i),(0,A.t2)(r,n))return t.minWith(gi),void t.maxWith(gi);(0,A.Z0)(fi,n,i),t.minWith(gi),t.minWith(fi),t.maxWith(gi),t.maxWith(fi);for(let e=0;e<3;++e)(0,A.C)(gi,r),(0,A.C)(fi,n),gi[e]=n[e],fi[e]=r[e],(0,A.Z0)(gi,gi,i),(0,A.Z0)(fi,fi,i),t.minWith(gi),t.minWith(fi),t.maxWith(gi),t.maxWith(fi)}const pi=(0,d.vt)(),gi=(0,d.vt)(),fi=(0,d.vt)(),mi=(0,d.vt)();var vi=i(21818),yi=i(71511);const xi=["layerObjectAdded","layerObjectRemoved","layerObjectsAdded","layerObjectsRemoved","transformationChanged","shaderTransformationChanged","visibilityChanged","occlusionChanged","highlightChanged","geometryAdded","geometryRemoved","attributesChanged"];var _i=i(78230);class bi{constructor(e,t,i=""){this.stage=e,this.apiLayerViewUid=i,this.id=(0,ei.c)(),this.events=new et.bk,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new yi.A,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??0,e.addLayer(this);for(const t of xi)this._handles.add(this.events.on(t,i=>e.handleEvent(t,i)))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.removeLayer(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return(0,vi.z)(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(e){this._objects.delete(e.id)&&(this.events.emit("layerObjectRemoved",e),e.layer=null,null!=this._octree&&((0,Je.Xy)(this._objectsAdded,e)||this._octree.remove([e])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(e){const t=new Array;for(const i of e)this._objects.delete(i.id)&&t.push(i);if(0!==t.length&&(this.events.emit("layerObjectsRemoved",t),t.forEach(e=>e.layer=null),null!=this._octree)){for(let e=0;e<t.length;)(0,Je.Xy)(this._objectsAdded,t[e])?(t[e]=t[t.length-1],t.length-=1):++e;this._octree.remove(t)}}commit(){this.stage.commitLayer(this)}sync(){1!==this.updatePolicy&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new _i.x(e=>e.boundingVolumeWorldSpace.bounds),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=(0,it.pR)(this._octree),this._objectsAdded.length=0}get test(){}}var Si=i(90629),wi=i(78659),Ci=i(20498),Ti=i(11964),Ai=i(49255),Ri=i(92130),Ei=i(11725),Oi=i(77194),Mi=i(96095),Li=i(35622),Pi=i(59907),Di=i(32565),Ii=i(1843);function Fi(e){const t=(0,Ii.BP)().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),(0,pt.E)()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}var zi=i(4431),Ni=i(33524),Wi=i(56133),Vi=i(33442);let ji=class extends Ct.w{constructor(e,t){super(e,t,(0,zi.U)(Fi(t))),this.shader=new wt.r(Di.R,()=>i.e(2059).then(i.bind(i,92059))),this.ignoreUnused=!0,this.primitiveType=t.wireframe?Ht.WR.LINES:Ht.WR.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r}=e;return(0,Rt.Ey)({blending:(0,Ni.Yf)(i,!1,e.emissionDimmingPass),depthTest:(0,Ni.mt)(i),depthWrite:(0,Ni.z5)(e),colorWrite:Rt.kn,stencilWrite:r?Wi.v0:null,stencilTest:r?t?Wi.Ax:Wi.cP:null,polygonOffset:(0,Vi.Tk)(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:t}=e;this._occluderPipelineTransparent=(0,Rt.Ey)({blending:Rt.T8,polygonOffset:(0,Vi.Tk)(e),depthTest:Wi.sf,depthWrite:null,colorWrite:Rt.kn,stencilWrite:null,stencilTest:t?Wi.Q0:null}),this._occluderPipelineOpaque=(0,Rt.Ey)({blending:Rt.T8,polygonOffset:(0,Vi.Tk)(e),depthTest:t?Wi.sf:Wi.m,depthWrite:null,colorWrite:Rt.kn,stencilWrite:t?Wi.r8:null,stencilTest:t?Wi.iB:null}),this._occluderPipelineMaskWrite=(0,Rt.Ey)({blending:null,polygonOffset:(0,Vi.Tk)(e),depthTest:Wi.m,depthWrite:null,colorWrite:null,stencilWrite:t?Wi.v0:null,stencilTest:t?Wi.Ax:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 11:return this._occluderPipelineTransparent??super.getPipeline(e);case 10:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};ji=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],ji);var Hi=i(51976),Ui=i(47724);class Bi extends Ui.L{constructor(e){super(),this.spherical=e,this.capType=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.numJoinSubdivisions=1,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}(0,r.Cg)([(0,Hi.W)({count:3})],Bi.prototype,"capType",void 0),(0,r.Cg)([(0,Hi.W)({count:8})],Bi.prototype,"emissionSource",void 0),(0,r.Cg)([(0,Hi.W)({count:4})],Bi.prototype,"animation",void 0),(0,r.Cg)([(0,Hi.W)({count:16})],Bi.prototype,"polygonOffsetIndex",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"writeDepth",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"draped",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"stippleEnabled",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"stippleOffColorEnabled",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"stipplePreferContinuous",void 0),(0,r.Cg)([(0,Hi.W)({count:8})],Bi.prototype,"numJoinSubdivisions",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"roundJoins",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"applyMarkerOffset",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"hasVVSize",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"hasVVColor",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"hasVVOpacity",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"falloffEnabled",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"innerColorEnabled",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"hasOccludees",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"occluder",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"wireframe",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"discardInvisibleFragments",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"hasScreenSizePerspective",void 0),(0,r.Cg)([(0,Hi.W)()],Bi.prototype,"worldSizedImagePattern",void 0);var Zi=i(49788);class ki extends Ei.i{constructor(e,t){super(e,qi),this.produces=new Map([[2,e=>(0,Ai.Ex)(e)||(0,Ai._o)(e)&&8===this.parameters.renderOccluded],[3,e=>(0,Ai.eh)(e)],[10,e=>(0,Ai.gr)(e)&&8===this.parameters.renderOccluded],[11,e=>(0,Ai.gr)(e)&&8===this.parameters.renderOccluded],[4,e=>(0,Ai._o)(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>(0,Ai._o)(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>(0,Ai.i3)(e)]]),this._configuration=new Bi(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Ki(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&function(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=Zi.Q||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Zi.Q}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:t},i,r,n,s){if(!i.options.selectionMode)return;const o=e.get("size");let a=this.parameters.width;if(this.parameters.vvSize){const t=e.get("sizeFeatureAttribute").data[0];Number.isNaN(t)?a*=this.parameters.vvSize.fallback[0]:a*=(0,je.qE)(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(a*=o.data[0]);const l=r[0],c=r[1],h=(a/2+4)*t;let u=Number.MAX_VALUE,d=0;const p=e.get("position").data,g=Qi(this.parameters,e)?p.length-2:p.length-5;for(let e=0;e<g;e+=3){const t=p[e],i=p[e+1],r=(e+3)%p.length,n=l-t,s=c-i,o=p[r]-t,a=p[r+1]-i,h=(0,je.qE)((o*n+a*s)/(o*o+a*a),0,1),g=o*h-n,f=a*h-s,m=g*g+f*f;m<u&&(u=m,d=e/3)}u<h*h&&n(s.distance,s.normal,d)}intersect(e,t,i,r,n,s){const{options:o,camera:l,rayBegin:c,rayEnd:h}=i;if(!o.selectionMode||!e.visible||!l)return;if(!(0,Kt.zH)(t))return void a.A.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const u=e.attributes,d=u.get("position").data;let p=this.parameters.width;if(this.parameters.vvSize){const e=u.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(p*=(0,je.qE)(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else u.has("size")&&(p*=u.get("size").data[0]);const g=or;(0,_t.C)(g,i.point);const f=p*l.pixelRatio,m=4*l.pixelRatio,v=f/2+m;(0,A.hZ)(vr[0],g[0]-v,g[1]+v,0),(0,A.hZ)(vr[1],g[0]+v,g[1]+v,0),(0,A.hZ)(vr[2],g[0]+v,g[1]-v,0),(0,A.hZ)(vr[3],g[0]-v,g[1]-v,0);for(let e=0;e<4;e++)if(!l.unprojectFromRenderScreen(vr[e],yr[e]))return;(0,Ue.Cr)(l.eye,yr[0],yr[1],xr),(0,Ue.Cr)(l.eye,yr[1],yr[2],_r),(0,Ue.Cr)(l.eye,yr[2],yr[3],br),(0,Ue.Cr)(l.eye,yr[3],yr[0],Sr);let y=Number.MAX_VALUE,x=0;const _=Qi(this.parameters,u)?d.length-2:d.length-5;for(let e=0;e<_;e+=3){Ji[0]=d[e]+t[12],Ji[1]=d[e+1]+t[13],Ji[2]=d[e+2]+t[14];const i=(e+3)%d.length;if(er[0]=d[i]+t[12],er[1]=d[i+1]+t[13],er[2]=d[i+2]+t[14],(0,Ue.mN)(xr,Ji)<0&&(0,Ue.mN)(xr,er)<0||(0,Ue.mN)(_r,Ji)<0&&(0,Ue.mN)(_r,er)<0||(0,Ue.mN)(br,Ji)<0&&(0,Ue.mN)(br,er)<0||(0,Ue.mN)(Sr,Ji)<0&&(0,Ue.mN)(Sr,er)<0)continue;const r=l.projectToRenderScreen(Ji,ar),n=l.projectToRenderScreen(er,lr);if(null==r||null==n)continue;if(r[2]<0&&n[2]>0){(0,A.Re)(nr,Ji,er);const e=l.frustum,t=-(0,Ue.mN)(e[4],Ji)/(0,A.Om)(nr,(0,Ue.Qj)(e[4]));if((0,A.hs)(nr,nr,t),(0,A.WQ)(Ji,Ji,nr),!l.projectToRenderScreen(Ji,r))continue}else if(r[2]>0&&n[2]<0){(0,A.Re)(nr,er,Ji);const e=l.frustum,t=-(0,Ue.mN)(e[4],er)/(0,A.Om)(nr,(0,Ue.Qj)(e[4]));if((0,A.hs)(nr,nr,t),(0,A.WQ)(er,er,nr),!l.projectToRenderScreen(er,n))continue}else if(r[2]<0&&n[2]<0)continue;r[2]=0,n[2]=0;const s=(0,Ti.Cr)(r,n,ur),o=(0,Ti.kb)(s,g);if(!(o>=y)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(s,Ji,er,g,l,p,m);if(o>=e*e)continue}y=o,(0,A.C)(cr,Ji),(0,A.C)(hr,er),x=e/3}}if(y<v*v){let e=Number.MAX_VALUE;if((0,Ti.ld)((0,Ti.Cr)(cr,hr,ur),(0,Ti.Cr)(c,h,dr),sr)){(0,A.Re)(sr,sr,c);const t=(0,A.Bw)(sr);(0,A.hs)(sr,sr,1/t),e=t/(0,A.Io)(c,h)}s(e,sr,x)}}createBufferWriter(){return new $i(Fi(this.parameters),this.parameters)}createGLMaterial(e){return new Gi(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:(0,wi.y)(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,n,s,o){const a=(0,Ti.G1)(e,r);(0,A.Cc)(tr,t,i,a),(0,A.Z0)(ir,tr,n.viewMatrix);const l=(0,A.Bw)(ir),c=this.computeCameraAbsCosAngle(tr,n,this._configuration.spherical);return Xi.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Xi.apply(s)*n.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,i){return i?(0,A.S8)(sr,e):(0,A.hZ)(sr,0,0,1),(0,A.Re)(rr,e,t.eye),(0,A.S8)(rr,rr),Math.abs((0,A.Om)(sr,rr))}}class Gi extends Ri.A{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ji,e)}}class qi extends Li.S{constructor(){super(...arguments),this._width=0,this.color=ti.Un,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=(0,wi.Kp)(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=(0,wi.Kp)(0),this.endTime=(0,wi.Kp)(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return(0,Mi.sL)(this.stipplePattern)&&null!=this.stippleTexture}}class $i{constructor(e,t){this.layout=e,this._parameters=t,this.numJoinSubdivisions=Ki(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return Qi(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=e.get("position").indices.length/2+1,i=this._isClosed(e);let r=i?2:4;return r+=((i?t:t-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),r+=2,this._parameters.wireframe&&(r=2+4*(r-2)),r}write(e,t,i,r,n,s){const{buffer:o,offset:a}=n,l=this.layout,c=i.get("position"),h=c.indices,u=c.data.length/3,d=i.get("distanceToStart")?.data;h&&h.length!==2*(u-1)&&console.warn("RibbonLineMaterial does not support indices");const p=l.fields.has("sizeFeatureAttribute");let g=1,f=null;if(p){const e=i.get("sizeFeatureAttribute");1===e.data.length?g=e.data[0]:f=e.data}else g=i.get("size")?.data[0]??1;let m=[1,1,1,1],v=0,y=null;const x=l.fields.has("colorFeatureAttribute");if(x){const e=i.get("colorFeatureAttribute");1===e.data.length?v=e.data[0]:y=e.data}else m=i.get("color")?.data??m;const _=i.get("timeStamps")?.data,b=_&&l.fields.has("timeStamps"),S=l.fields.has("opacityFeatureAttribute");let w=0,C=null;if(S){const e=i.get("opacityFeatureAttribute");1===e.data.length?w=e.data[0]:C=e.data}const T=new Float32Array(o.buffer),R=(0,Ci.Bg)(o.buffer),E=new Uint8Array(o.buffer),O=l.stride/4;let M=a*O;const L=M;let P=0;const D=d?(e,t,i)=>P=d[i]:(e,t,i)=>P+=(0,A.Io)(e,t),I=T.BYTES_PER_ELEMENT/R.BYTES_PER_ELEMENT,F=4/I,z=(0,pt.E)(),N=(e,t,i,n,s,o,a,l)=>{T[M++]=t[0],T[M++]=t[1],T[M++]=t[2],(0,Pi.Wu)(e,t,R,M*I),M+=F,(0,Pi.Wu)(i,t,R,M*I),M+=F,T[M++]=l;let c=M*I;if(R[c++]=s,R[c++]=o,M=Math.ceil(c/I),x)T[M]=y?.[a]??v;else{const e=Math.min(4*a,m.length-4),t=4*M;E[t]=255*m[e],E[t+1]=255*m[e+1],E[t+2]=255*m[e+2],E[t+3]=255*m[e+3]}if(M++,T[M++]=f?.[a]??g,S&&(T[M++]=C?.[a]??w),z){let e=4*M;r?(E[e++]=r[0],E[e++]=r[1],E[e++]=r[2],E[e++]=r[3]):(E[e++]=0,E[e++]=0,E[e++]=0,E[e++]=0),M=Math.ceil(.25*e)}b&&(c=M*I,R[c++]=n[0],R[c++]=n[1],R[c++]=n[2],R[c++]=n[3],M=Math.ceil(c/I))};M+=O,(0,A.hZ)(gr,c.data[0],c.data[1],c.data[2]),b&&(0,ot.hZ)(mr,_[0],_[1],_[2],_[3]),e&&(0,A.Z0)(gr,gr,e);const W=this._isClosed(i);if(W){const t=c.data.length-3;(0,A.hZ)(pr,c.data[t],c.data[t+1],c.data[t+2]),e&&(0,A.Z0)(pr,pr,e)}else(0,A.hZ)(fr,c.data[3],c.data[4],c.data[5]),e&&(0,A.Z0)(fr,fr,e),N(gr,gr,fr,mr,1,-4,0,0),N(gr,gr,fr,mr,1,4,0,0),(0,A.C)(pr,gr),(0,A.C)(gr,fr),b&&(0,ot.hZ)(mr,_[4],_[5],_[6],_[7]);const V=W?0:1,j=W?u:u-1;for(let t=V;t<j;t++){const i=(t+1)%u*3;(0,A.hZ)(fr,c.data[i],c.data[i+1],c.data[i+2]),e&&(0,A.Z0)(fr,fr,e),D(pr,gr,t),N(pr,gr,fr,mr,0,-1,t,P),N(pr,gr,fr,mr,0,1,t,P);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const i=(e+1)/(r+1);N(pr,gr,fr,mr,i,-1,t,P),N(pr,gr,fr,mr,i,1,t,P)}if(N(pr,gr,fr,mr,1,-2,t,P),N(pr,gr,fr,mr,1,2,t,P),(0,A.C)(pr,gr),(0,A.C)(gr,fr),b){const e=(t+1)%u*4;(0,ot.hZ)(mr,_[e],_[e+1],_[e+2],_[e+3])}}W?((0,A.hZ)(fr,c.data[3],c.data[4],c.data[5]),e&&(0,A.Z0)(fr,fr,e),P=D(pr,gr,j),N(pr,gr,fr,mr,0,-1,V,P),N(pr,gr,fr,mr,0,1,V,P)):(P=D(pr,gr,j),N(pr,gr,gr,mr,0,-5,j,P),N(pr,gr,gr,mr,0,5,j,P)),Yi(T,L+O,T,L,O),M=Yi(T,M-O,T,M,O),this._parameters.wireframe&&this._addWireframeVertices(o,L,M,O)}_addWireframeVertices(e,t,i,r){const n=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let o=0;const a=e=>o=Yi(s,e,n,o,r);for(let e=0;e<s.length-1;e+=2*r)a(e),a(e+2*r),a(e+1*r),a(e+2*r),a(e+1*r),a(e+3*r)}}function Yi(e,t,i,r,n){for(let s=0;s<n;s++)i[r++]=e[t++];return r}function Qi(e,t){return!!e.isClosed&&t.get("position").indices.length>2}function Ki(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return Di.r+i}}const Xi=new Oi.PS,Ji=(0,d.vt)(),er=(0,d.vt)(),tr=(0,d.vt)(),ir=(0,d.vt)(),rr=(0,d.vt)(),nr=(0,d.vt)(),sr=(0,d.vt)(),or=(0,d.vt)(),ar=(0,Si.r_)(),lr=(0,Si.r_)(),cr=(0,d.vt)(),hr=(0,d.vt)(),ur=(0,Ti.vt)(),dr=(0,Ti.vt)(),pr=(0,d.vt)(),gr=(0,d.vt)(),fr=(0,d.vt)(),mr=(0,ti.vt)(),vr=[(0,Si.r_)(),(0,Si.r_)(),(0,Si.r_)(),(0,Si.r_)()],yr=[(0,d.vt)(),(0,d.vt)(),(0,d.vt)(),(0,d.vt)()],xr=(0,Ue.vt)(),_r=(0,Ue.vt)(),br=(0,Ue.vt)(),Sr=(0,Ue.vt)();class wr{constructor(e){this._originSR=e,this._rootOriginId="root/"+(0,ei.c)(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=(0,He.GA)(this._originSR)),this._baselineDistance=.5*this._gridSize;const t=this._baselineDistance*Tr;this._baselineObjectSize=t/Ar}getOrigin(e){const t=this._origins.get(this._rootOriginId);if(null==t){const t=null;if(null!=t)return this._origins.set(this._rootOriginId,ct(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(e);const i=ct(e[0]+Math.random()-.5,e[1]+Math.random()-.5,e[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,i),i}const i=this._gridSize,r=Math.round(e[0]/i),n=Math.round(e[1]/i),s=Math.round(e[2]/i),o=`${r}/${n}/${s}`;let a=this._origins.get(o);const l=.5*i;if((0,A.Re)(Cr,e,t.vec3),Cr[0]=Math.abs(Cr[0]),Cr[1]=Math.abs(Cr[1]),Cr[2]=Math.abs(Cr[2]),Cr[0]<l&&Cr[1]<l&&Cr[2]<l){if(a){const t=Math.max(...Cr);if((0,A.Re)(Cr,e,a.vec3),Cr[0]=Math.abs(Cr[0]),Cr[1]=Math.abs(Cr[1]),Cr[2]=Math.abs(Cr[2]),Math.max(...Cr)<t)return a}return t}return a||(a=ct(r*i,n*i,s*i,o),this._origins.set(o,a)),a}needsOriginUpdate(e,t,i){const r=(0,A.Io)(e.vec3,t),n=Math.max(1,i/this._baselineObjectSize);return r>this._baselineDistance*n}_drawOriginBox(e,t=(0,ti.fA)(1,1,0,1)){const i=window.view,r=i.stage,n=t.toString();if(!this._objects.has(n)){this._material=new ki({width:2,color:t},!1);const e=new bi(r,{pickable:!1}),i=new ci({castShadow:!1});e.add(i),this._objects.set(n,i)}const s=this._objects.get(n),o=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],a=o.length,l=new Array(3*a),c=new Array,h=.5*this._gridSize;for(let t=0;t<a;t++)l[3*t]=e[0]+(1&o[t]?h:-h),l[3*t+1]=e[1]+(2&o[t]?h:-h),l[3*t+2]=e[2]+(4&o[t]?h:-h),t>0&&c.push(t-1,t);(0,j.projectBuffer)(l,this._originSR,0,l,i.renderSpatialReference,0,a);const u=new ri.V(this._material,[["position",new ii.n(l,c,3,!0)]],null,2);s.addGeometry(u)}get test(){}}const Cr=(0,d.vt)(),Tr=2**-23,Ar=.05;var Rr,Er=i(44794),Or=i(48163),Mr=i(79258),Lr=i(25482),Pr=i(93223);let Dr=Rr=class extends Lr.o{constructor(e){super(e),this.type="cloudy",this.cloudCover=.5,this.fogOpacity=0}clone(){return new Rr({cloudCover:this.cloudCover})}};(0,r.Cg)([(0,Pr.e)({cloudy:"cloudy"}),(0,u.MZ)({json:{write:{isRequired:!0}}})],Dr.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Dr.prototype,"cloudCover",void 0),Dr=Rr=(0,r.Cg)([(0,u.$K)("esri.views.3d.environment.CloudyWeather")],Dr);const Ir=Dr;var Fr;let zr=Fr=class extends Lr.o{constructor(e){super(e),this.type="foggy",this.fogStrength=.5}clone(){return new Fr({fogStrength:this.fogStrength})}get fogOpacity(){return(0,je.Cc)(3e-5,.005,this.fogStrength**3)}};(0,r.Cg)([(0,Pr.e)({foggy:"foggy"}),(0,u.MZ)({json:{write:{isRequired:!0}}})],zr.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],zr.prototype,"fogStrength",void 0),zr=Fr=(0,r.Cg)([(0,u.$K)("esri.views.3d.environment.FoggyWeather")],zr);const Nr=zr;var Wr;let Vr=Wr=class extends Lr.o{constructor(e){super(e),this.type="rainy",this.cloudCover=.5,this.precipitation=.5}clone(){return new Wr({cloudCover:this.cloudCover,precipitation:this.precipitation})}get fogOpacity(){return(0,je.Cc)(4e-6,2e-4,this.precipitation**3)}};(0,r.Cg)([(0,Pr.e)({rainy:"rainy"}),(0,u.MZ)({json:{write:{isRequired:!0}}})],Vr.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Vr.prototype,"cloudCover",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Vr.prototype,"precipitation",void 0),Vr=Wr=(0,r.Cg)([(0,u.$K)("esri.views.3d.environment.RainyWeather")],Vr);const jr=Vr;var Hr;let Ur=Hr=class extends Lr.o{constructor(e){super(e),this.type="snowy",this.cloudCover=.5,this.precipitation=.5,this.snowCover="disabled"}clone(){return new Hr({cloudCover:this.cloudCover,precipitation:this.precipitation,snowCover:this.snowCover})}get fogOpacity(){return(0,je.Cc)(4e-6,2e-4,this.precipitation**3)}};(0,r.Cg)([(0,Pr.e)({snowy:"snowy"}),(0,u.MZ)({json:{write:{isRequired:!0}}})],Ur.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Ur.prototype,"cloudCover",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Ur.prototype,"precipitation",void 0),(0,r.Cg)([(0,u.MZ)({type:["enabled","disabled"],nonNullable:!0,json:{write:!0}})],Ur.prototype,"snowCover",void 0),Ur=Hr=(0,r.Cg)([(0,u.$K)("esri.views.3d.environment.SnowyWeather")],Ur);const Br=Ur;var Zr;let kr=Zr=class extends Lr.o{constructor(e){super(e),this.type="sunny",this.cloudCover=.5,this.fogOpacity=0}clone(){return new Zr({cloudCover:this.cloudCover})}};(0,r.Cg)([(0,Pr.e)({sunny:"sunny"}),(0,u.MZ)({json:{write:{isRequired:!0}}})],kr.prototype,"type",void 0),(0,r.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],kr.prototype,"cloudCover",void 0),kr=Zr=(0,r.Cg)([(0,u.$K)("esri.views.3d.environment.SunnyWeather")],kr);const Gr={key:"type",base:kr,typeMap:{sunny:kr,cloudy:Ir,rainy:jr,snowy:Br,foggy:Nr}};Object.keys(Gr.typeMap);class qr{constructor(){this.startTime=0,this._data=(0,Er.v)(null),this.coverage=0,this.absorption=0,this._readChannels=0,this.parallax=new $r,this.parallaxNew=new $r,this._anchorPoint=(0,d.vt)(),this._fadeState=(0,Er.v)(0),this._fadeFactor=(0,Er.v)(1)}get data(){return this._data.value}set data(e){this._data.value=e}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case 0:return 0;case 4:return 1-this.fadeFactor;case 1:return this.fadeFactor;case 2:case 3:return 1}}fade(e,t,i){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=i?(0,je.qE)((t-this.startTime)/(Xr*i),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(e,t),this._updateParallax(e)}_evaluateState(e,t){const i=e.relativeElevation,r=this._updateAnchorPoint(e);(Math.abs(i)>17e3||r>en)&&this.opacity>0?this._startFade(0,t):this.isFading||(Math.abs(i)>1e4||r>Jr*en?this.opacity>0&&this._startFade(4,t):function(e){return null!=e&&!e.readyToRun}(this.data)&&(0===this.opacity?this._startFade(1,t):2===this.data.state&&(2===this.fadeState?this._startFade(3,t):this._startFade(2,t))))}_updateParallax(e){const t=(0,A.m3)(e.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-Mr.$O.radius*Mr.$O.radius,0))/Math.sqrt(t),(0,v.Cr)(Yr,this.parallax.anchorPoint,Qr),(0,fe.e$)(this.parallax.transform,F.zK,Qr[3],(0,v.yo)(Qr)),(0,v.Cr)(Yr,this.parallaxNew.anchorPoint,Qr),(0,fe.e$)(this.parallaxNew.transform,F.zK,Qr[3],(0,v.yo)(Qr))}_updateAnchorPoint(e){return(0,A.S8)(this._anchorPoint,e.eye),(0,A.hs)(this._anchorPoint,this._anchorPoint,Mr.$O.radius),0===this.fadeState&&2===this.data?.state?((0,A.C)(this.parallax.anchorPoint,this._anchorPoint),0):(0,A.Bw)((0,A.Re)(Kr,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(e,t){switch(this._fadeState.value=e,this.startTime=t,e){case 3:this.requestFade(),this._switchReadChannels(),(0,A.C)(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:this.requestFade(),this._switchReadChannels(),(0,A.C)(this.parallax.anchorPoint,this._anchorPoint),(0,A.C)(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 4:this.requestFade();break;case 2:this._switchReadChannels(),(0,A.C)(this.parallax.anchorPoint,this._anchorPoint),(0,A.C)(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case 0:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&2!==this.data.state&&(this.data.state=0),this.fadeState){case 3:(0,A.C)(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=2;break;case 1:this._fadeState.value=2;break;case 4:this._fadeState.value=0;break;case 2:case 0:break;default:this.fadeState}}_switchReadChannels(){2===this.data?.state&&(this._readChannels=1-this._readChannels,this.data.state=3)}get isFading(){return 4===this.fadeState||1===this.fadeState||3===this.fadeState}}class $r{constructor(){this.anchorPoint=(0,d.vt)(),this.radiusCurvatureCorrection=0,this.transform=(0,F.vt)()}}const Yr=(0,d.fA)(0,0,1),Qr=(0,v.vt)(),Kr=(0,d.vt)(),Xr=1.25,Jr=.5,en=2e5;class tn{constructor(){this.lastFrameCamera=new mt.A,this.matrix=(0,F.vt)(),this.viewMatrix=(0,F.vt)()}}class rn{constructor(){this.enabled=!1,this.fadeFactor=1}}var nn=i(57226);class sn{constructor(e,t){this._rctx=e,this.shadowMap=t,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.emissions=0,this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=(0,Er.v)(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new mt.A,this._inverseViewport=(0,Or.vt)(),this._oldLighting=new nn.TA,this._newLighting=new nn.TA,this._fadedLighting=new nn.TA,this._lighting=this._newLighting,this.screenSpaceReflections=new rn,this.reprojection=new tn,this.highlights=new Array,this.highlightMixOrigin=(0,Or.vt)(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new qr,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=(0,it.Gz)(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(e){this._output!==e&&(this._output=e,this._rctx.resetDrawBuffers(e))}get hasEmission(){return 0!==this.emissions}get hasOpaqueEmissions(){return 1===this.emissions||3===this.emissions}get camera(){return this._camera}set camera(e){this._camera=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<5e5}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(e,t,i,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=i,this._newLighting.set(e),this._oldLighting.updateLegacy(),1===r&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return(0,Ai._o)(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name="geometry depth"),this._depth=e}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}class on{constructor(e,t,i){this.rctx=e,this.techniques=i,this.renderOccludedMask=an,this.time=(0,wi.l5)(0),this.bind=new sn(e,t),this.bind.alignPixelEnabled=!0}destroy(){this.bind.destroy()}get output(){return this.bind.output}}const an=13;let ln=class extends mt.A{constructor(){super(...arguments),this._projectionMatrix=(0,F.vt)()}get projectionMatrix(){return this._projectionMatrix}};(0,r.Cg)([(0,u.MZ)()],ln.prototype,"_projectionMatrix",void 0),(0,r.Cg)([(0,u.MZ)({readOnly:!0})],ln.prototype,"projectionMatrix",null),ln=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.lib.CascadeCamera")],ln);var cn=i(78988);class hn{constructor(){this.camera=new ln,this.lightMat=(0,F.vt)()}}class un{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class dn{constructor(e,t){this._fbos=e,this._viewingMode=t,this._enabled=!1,this._outputs=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new un,this._projectionView=(0,F.vt)(),this._projectionViewInverse=(0,F.vt)(),this._modelViewLight=(0,F.vt)(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=(0,ti.vt)(),this._cascades=[new hn,new hn,new hn,new hn],this._lastOrigin=null,this._maxTextureWidth=Math.min((0,De.A)("esri-mobile")?4096:16384,e.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1}disposeOutputs(){this._handle=(0,it.Gz)(this._handle),this._outputs.forEach(e=>e?.release()),this._outputs.length=0}disposeOutput(e){this._outputs[e]=(0,it.Gz)(this._outputs[e])}set maxCascades(e){this.settings.maxNumCascadesHighQuality=(0,je.qE)(Math.floor(e),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(e){this._enabled=e,e||this.disposeOutputs()}get enabled(){return this._enabled}get ready(){return!!this.getOutput(5)||!!this.getOutput(7)}get cascades(){for(let e=0;e<this._numCascades;++e)Sn[e]=this._cascades[e];return Sn.length=this._numCascades,Sn}start(e,t,i,r,n){(0,Kt.vA)(this.enabled);const{near:s,far:o}=function(e){let{near:t,far:i}=e;return t<2&&(t=2),i<2&&(i=2),t>=i&&(t=2,i=4),{near:t,far:i}}(i);this._computeCascadeDistances(s,o,r),this._textureHeight=this._computeTextureHeight(e,n,r),this._setupMatrices(e,t);const{viewMatrix:a,projectionMatrix:l}=e;for(let e=0;e<this._numCascades;++e)this._constructCascade(e,l,a,t);this._lastOrigin=null,this.clear()}getShadowMapMatrices(e){if(!this._lastOrigin||!(0,A.t2)(e,this._lastOrigin)){this._lastOrigin=this._lastOrigin||(0,d.vt)(),(0,A.C)(this._lastOrigin,e);for(let t=0;t<this._numCascades;++t){(0,fe.Tl)(wn,this._cascades[t].lightMat,e);for(let e=0;e<16;++e)Cn[16*t+e]=wn[e]}}return Cn}finish(e){(0,Kt.vA)(this.enabled),this._outputs[e]?.release(),this._outputs[e]=this._handle,this._handle?.setName(6===e?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}getOutput(e){return this.enabled?this._outputs[e]?.getTexture(Ht.nI):null}clear(){this._ensureFbo(),this.bindFramebuffer(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:e,fullWidth:t,fullHeight:i},r,n){const s=Math.min(window.devicePixelRatio,r)/e,o=n?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return(0,cn.Mv)(Math.max(t,i)*s*o,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",13),this._handle.getTexture(Ht.nI)?.setShadowFiltering(!0))}bindFramebuffer(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(e,t,i,r){const n=this._cascades[e],s=-this._cascadeDistances[e],o=-this._cascadeDistances[e+1],a=(t[10]*s+t[14])/Math.abs(t[11]*s+t[15]),l=(t[10]*o+t[14])/Math.abs(t[11]*o+t[15]);(0,Kt.vA)(a<l);for(let e=0;e<8;++e){(0,ot.hZ)(gn,e%4==0||e%4==3?-1:1,e%4==0||e%4==1?-1:1,e<4?a:l,1);const t=fn[e];(0,ot.Z0)(t,gn,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}(0,A.ze)(bn,fn[0]),n.camera.viewMatrix=(0,fe.Tl)(pn,this._modelViewLight,bn);for(let e=0;e<8;++e)(0,A.Z0)(fn[e],fn[e],n.camera.viewMatrix);let c=fn[0][2],h=fn[0][2];for(let e=1;e<8;++e)c=Math.min(c,fn[e][2]),h=Math.max(h,fn[e][2]);c-=200,h+=200,n.camera.near=-h,n.camera.far=-c,function(e,t,i,r,n){const s=1/fn[0][3],o=1/fn[4][3];(0,Kt.vA)(s<o);let a=s+Math.sqrt(s*o);const l=Math.sin((0,je.XM)(e[2]*t[0]+e[6]*t[1]+e[10]*t[2]));a/=l,function(e,t,i,r,n,s,o,a){(0,_t.hZ)(Tn,0,0);for(let t=0;t<4;++t)(0,_t.WQ)(Tn,Tn,e[t]);(0,_t.hs)(Tn,Tn,.25),(0,_t.hZ)(An,0,0);for(let t=4;t<8;++t)(0,_t.WQ)(An,An,e[t]);(0,_t.hs)(An,An,.25),(0,_t.Cc)(Rn[0],e[4],e[5],.5),(0,_t.Cc)(Rn[1],e[5],e[6],.5),(0,_t.Cc)(Rn[2],e[6],e[7],.5),(0,_t.Cc)(Rn[3],e[7],e[4],.5);let l=0,c=(0,_t.hG)(Rn[0],Tn);for(let e=1;e<4;++e){const t=(0,_t.hG)(Rn[e],Tn);t<c&&(c=t,l=e)}(0,_t.Re)(En,Rn[l],e[l+4]);const h=En[0];let u,d;En[0]=-En[1],En[1]=h,(0,_t.Re)(On,An,Tn),(0,_t.Om)(On,En)<0&&(0,_t.ze)(En,En),(0,_t.Cc)(En,En,On,i),(0,_t.S8)(En,En),u=d=(0,_t.Om)((0,_t.Re)(Mn,e[0],Tn),En);for(let t=1;t<8;++t){const i=(0,_t.Om)((0,_t.Re)(Mn,e[t],Tn),En);i<u?u=i:i>d&&(d=i)}(0,_t.C)(r,Tn),(0,_t.hs)(Mn,En,u-t),(0,_t.WQ)(r,r,Mn);let p=-1,g=1,f=0,m=0;for(let t=0;t<8;++t){(0,_t.Re)(Ln,e[t],r),(0,_t.S8)(Ln,Ln);const i=En[0]*Ln[1]-En[1]*Ln[0];i>0?i>p&&(p=i,f=t):i<g&&(g=i,m=t)}(0,Kt.MX)(p>0,"leftArea"),(0,Kt.MX)(g<0,"rightArea"),(0,_t.hs)(Pn,En,u),(0,_t.WQ)(Pn,Pn,Tn),(0,_t.hs)(Dn,En,d),(0,_t.WQ)(Dn,Dn,Tn),In[0]=-En[1],In[1]=En[0];const v=(0,Kt.L)(r,e[m],Dn,(0,_t.WQ)(Mn,Dn,In),1,n),y=(0,Kt.L)(r,e[f],Dn,Mn,1,s),x=(0,Kt.L)(r,e[f],Pn,(0,_t.WQ)(Mn,Pn,In),1,o),_=(0,Kt.L)(r,e[m],Pn,Mn,1,a);(0,Kt.MX)(v,"rayRay"),(0,Kt.MX)(y,"rayRay"),(0,Kt.MX)(x,"rayRay"),(0,Kt.MX)(_,"rayRay")}(fn,a,l,mn,vn,yn,xn,_n),function(e,t,i,r,n){(0,_t.Re)(Wn,i,r),(0,_t.hs)(Wn,Wn,.5),Vn[0]=Wn[0],Vn[1]=Wn[1],Vn[2]=0,Vn[3]=Wn[1],Vn[4]=-Wn[0],Vn[5]=0,Vn[6]=Wn[0]*Wn[0]+Wn[1]*Wn[1],Vn[7]=Wn[0]*Wn[1]-Wn[1]*Wn[0],Vn[8]=1,Vn[Fn(0,2)]=-(0,_t.Om)(Nn(Vn,0),e),Vn[Fn(1,2)]=-(0,_t.Om)(Nn(Vn,1),e);let s=(0,_t.Om)(Nn(Vn,0),i)+Vn[Fn(0,2)],o=(0,_t.Om)(Nn(Vn,1),i)+Vn[Fn(1,2)],a=(0,_t.Om)(Nn(Vn,0),r)+Vn[Fn(0,2)],l=(0,_t.Om)(Nn(Vn,1),r)+Vn[Fn(1,2)];s=-(s+a)/(o+l),Vn[Fn(0,0)]+=Vn[Fn(1,0)]*s,Vn[Fn(0,1)]+=Vn[Fn(1,1)]*s,Vn[Fn(0,2)]+=Vn[Fn(1,2)]*s,s=1/((0,_t.Om)(Nn(Vn,0),i)+Vn[Fn(0,2)]),o=1/((0,_t.Om)(Nn(Vn,1),i)+Vn[Fn(1,2)]),Vn[Fn(0,0)]*=s,Vn[Fn(0,1)]*=s,Vn[Fn(0,2)]*=s,Vn[Fn(1,0)]*=o,Vn[Fn(1,1)]*=o,Vn[Fn(1,2)]*=o,Vn[Fn(2,0)]=Vn[Fn(1,0)],Vn[Fn(2,1)]=Vn[Fn(1,1)],Vn[Fn(2,2)]=Vn[Fn(1,2)],Vn[Fn(1,2)]+=1,s=(0,_t.Om)(Nn(Vn,1),t)+Vn[Fn(1,2)],o=(0,_t.Om)(Nn(Vn,2),t)+Vn[Fn(2,2)],a=(0,_t.Om)(Nn(Vn,1),i)+Vn[Fn(1,2)],l=(0,_t.Om)(Nn(Vn,2),i)+Vn[Fn(2,2)],s=-.5*(s/o+a/l),Vn[Fn(1,0)]+=Vn[Fn(2,0)]*s,Vn[Fn(1,1)]+=Vn[Fn(2,1)]*s,Vn[Fn(1,2)]+=Vn[Fn(2,2)]*s,s=(0,_t.Om)(Nn(Vn,1),t)+Vn[Fn(1,2)],o=(0,_t.Om)(Nn(Vn,2),t)+Vn[Fn(2,2)],a=-o/s,Vn[Fn(1,0)]*=a,Vn[Fn(1,1)]*=a,Vn[Fn(1,2)]*=a,n[0]=Vn[0],n[1]=Vn[1],n[2]=0,n[3]=Vn[2],n[4]=Vn[3],n[5]=Vn[4],n[6]=0,n[7]=Vn[5],n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=Vn[6],n[13]=Vn[7],n[14]=0,n[15]=Vn[8]}(mn,vn,xn,_n,n.projectionMatrix),n.projectionMatrix[10]=2/(i-r),n.projectionMatrix[14]=-(i+r)/(i-r)}(i,r,c,h,n.camera),(0,fe.lw)(n.lightMat,n.camera.projectionMatrix,n.camera.viewMatrix);const u=this._textureHeight;n.camera.viewport=[e*u,0,u,u]}_setupMatrices(e,t){(0,fe.lw)(this._projectionView,e.projectionMatrix,e.viewMatrix),(0,fe.B8)(this._projectionViewInverse,this._projectionView);const i=1===this._viewingMode?e.eye:(0,A.hZ)(bn,0,0,1);(0,fe.t5)(this._modelViewLight,[0,0,0],[-t[0],-t[1],-t[2]],i)}_computeCascadeDistances(e,t,i){const r=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor((0,Kt.kL)(t/e,4)),r);const n=(t-e)/this._numCascades,s=(t/e)**(1/this._numCascades);let o=e,a=e;for(let e=0;e<this._numCascades+1;++e)this._cascadeDistances[e]=(0,je.Cc)(o,a,this.settings.splitSchemeLambda),o*=s,a+=n}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return(0,ot.hZ)(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}get test(){}}const pn=(0,F.vt)(),gn=(0,ti.vt)(),fn=[];for(let e=0;e<8;++e)fn.push((0,ti.vt)());const mn=(0,Or.vt)(),vn=(0,Or.vt)(),yn=(0,Or.vt)(),xn=(0,Or.vt)(),_n=(0,Or.vt)(),bn=(0,d.vt)(),Sn=[],wn=(0,F.vt)(),Cn=F.zK.concat(F.zK,F.zK,F.zK),Tn=(0,Or.vt)(),An=(0,Or.vt)(),Rn=[(0,Or.vt)(),(0,Or.vt)(),(0,Or.vt)(),(0,Or.vt)()],En=(0,Or.vt)(),On=(0,Or.vt)(),Mn=(0,Or.vt)(),Ln=(0,Or.vt)(),Pn=(0,Or.vt)(),Dn=(0,Or.vt)(),In=(0,Or.vt)();function Fn(e,t){return 3*t+e}const zn=(0,Or.vt)();function Nn(e,t){return(0,_t.hZ)(zn,e[t],e[t+3]),zn}const Wn=(0,Or.vt)(),Vn=(0,ae.vt)();var jn=i(92942);let Hn=class extends Ct.w{constructor(){super(...arguments),this.shader=new wt.r(jn.a,()=>i.e(959).then(i.bind(i,959)))}initializePipeline(e){return e.hasAlpha?(0,Rt.Ey)({blending:Rt.T8,colorWrite:Rt.kn}):(0,Rt.Ey)({colorWrite:Rt.kn})}};Hn=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.lib.TextureTechnique")],Hn);class Un extends Hi.K{constructor(){super(...arguments),this.hasAlpha=!1}}(0,r.Cg)([(0,Hi.W)()],Un.prototype,"hasAlpha",void 0);var Bn=i(75497),Zn=i(80583);let kn=class extends Ct.w{constructor(){super(...arguments),this.shader=new wt.r(Zn.a,()=>i.e(4849).then(i.bind(i,64849))),this.ignoreUnused=!0}};kn=(0,r.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.shaders.OverlayCompositingTechnique")],kn);var Gn=i(92359);let qn=class extends xt{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new Zn.O,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new rt.A,this._passParameters=new jn.T,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new mt.A,this.events=new et.bk,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:t,stage:i}=e.parent.view,r=i.renderer.fboCache,n=i.renderView.renderingContext,s=i.renderView.techniques;this._renderContext=new on(n,new dn(r,t.viewingMode),s)}initialize(){const e=this._view,t=e.stage.renderView.waterTextures;this.addHandles([(0,h.wB)(()=>t.updating,()=>this.events.emit("content-changed"),h.pc),(0,h.wB)(()=>this._spatialReference,e=>this._localOriginFactory=new wr(e),h.pc),(0,h.on)(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),(0,h.wB)(()=>function(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:n,haloColor:s,haloOpacity:o}=i;t+=r.r+r.g+r.b+r.a+n,t+=s?s.r+s.g+s.b+s.a+o:0}const i=e.at(0);if(i){const{shadowOpacity:e,shadowDifference:r,shadowColor:n}=i;t+=e+r+n.r+n.g+n.b+n.a}return qt+++(t>=0?0:1)}(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,h.Vh),(0,h.wB)(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},h.Vh),e.resourceController.scheduler.registerTask(Gn.W6.OVERLAY_RENDERER,this)]);const i=this._camera;i.near=1,i.far=1e4,i.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=i,this._bindParameters.updateLighting(new Bn.$p((0,d.S)()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=(0,it.WD)(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const t=new Xt(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:t},this._techniques.precompile(kn)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||(0,tt.Bs)(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const t of this._renderers.values()){const i=t.getMaterialRenderer(e);if(i)return i}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),(0,Je.Am)(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,t){const i=this._renderers.get(e);null!=i&&i.destroy(),this._renderers.set(e,t),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles((0,h.wB)(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const t=this._renderers.get(e);null!=t&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),t.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&(0,nt.bw)(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=(0,nt.bw)(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=(0,nt.bw)(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=(0,nt.bw)(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,t,i=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new ft(this._stage.renderer.fboCache),this._overlays=[new ht,new ht]),this.ensureDrapeTargets(e),this.ensureDrapeSources(t),this._bindParameters.overlayStretch=i}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const t=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(t?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=(0,tt.Bs)(this._renderers,e=>e.hasOccluders)?Qn:1}_processDrapeSources(e,t){let i=!1;for(const[r,n]of this._renderers){if(t?.done)break;(r.destroyed||e(r))&&n.commitChanges()&&(i=!0,t?.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,i=!0,this._updateSortedDrapeSourceRenderers(),t?.madeProgress()),t&&this.compact(t),i&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=(0,tt.Bs)(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let t=!1;for(const i of this._renderers.values()){if(e.done)break;t=i.compact(e)||t}return t&&this.notifyChange("updating"),t}hasHighlight(e){return(0,tt.Bs)(this._renderers,t=>t.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!st.b.OVERLAY_DRAW_DEBUG_TEXTURE&&(0,tt.mt)(this._renderers,e=>e.isEmpty)}get hasWater(){const e=(0,tt.Bs)(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(st.b.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const t=this._overlays[0];for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);if(!t.hasSomeSizedView())return!1;const i=this._setOutput(this._renderTargets?.targets.find(t=>t.content===e)?.output??0);++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(i),r}_setOutput(e){const t=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,t}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let t=!1;return this._renderers.forEach(i=>t=i.updateAnimation(e)||t),t&&this.parent.requestRender(0),t}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const t=this._bindParameters;t.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const e of this._renderTargets.targets){if(1===e.content&&!this._needsColorWithoutRasterImage)continue;const{output:i}=e;this._setOutput(i),10===i&&(t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null);const r=this._renderContext.renderOccludedMask;4===e.content&&(this._renderContext.renderOccludedMask=Qn),this._sortedRenderers.forAll(({drapeSource:t,renderer:i})=>{1===e.content&&0===t.drapeSourceType||4===e.content&&i.hasOnlyOccluders||i.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=r,t.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,t){if(!this._overlays||!this._renderTargets)return;for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const i=this.allSourcesOccluders;for(const e of this._renderTargets.targets){if((0!==e.content||!this._hasDrapedFlowSource)&&!e.handleRenderRequest(t)||1===e.content&&!this._needsColorWithoutRasterImage||4===e.content&&i)continue;const r=this._drawTarget(0,e),n=this._drawTarget(1,e);(r||n)&&e.fbo.generateMipMap()}}_drawTarget(e,t){const i=this._overlays[e],r=i.canvasGeometries;if(0===r.numViews)return!1;const n=this._view.state.contentPixelRatio;this._screenToWorldRatio=n*i.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:s,content:o}=t;if(this.isEmpty||4===s&&!this.hasWater||!i.hasSomeSizedView())return!1;const{_rctx:a,_camera:l,_renderContext:c,_bindParameters:h}=this;if(l.pixelRatio=i.pixelRatio*n,this._setOutput(s),h.screenToWorldRatio=this._screenToWorldRatio,h.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(c.renderOccludedMask=Qn),!this.renders(o))return c.renderOccludedMask=an,!1;const{resolution:u}=i,d=0===e,p=d?0:u;if(a.setViewport(p,0,u,u),this._bindTargetFBO(t),d&&(10===s?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384))),st.b.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(Hn,Kn);const t=this._techniques.get(Hn,Kn);for(let n=0;n<r.numViews;n++)this._setViewParameters(r.extents[n],i),this._ensureDebugPatternResources(i.resolution,Yn[e]),a.bindTechnique(t,h,this._passParameters),a.screen.draw()}if(10===s){const{fboCache:i}=this._stage.renderer,r=this._resolution;this._bindTargetFBO(t),function(e,t,i,r,n,s,o=0){const{highlights:a}=n,l=a.length>1?t.acquire(i,r,"highlight mix",a.length>Yt?3:1):null,{gl:c}=e;if(l){const t=e.boundFramebuffer;e.bindFramebuffer(l.fbo),c.clearBufferuiv(c.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const h=l?.getTexture();n.highlightMixTexture=h,(0,_t.hZ)(n.highlightMixOrigin,o,0),a.forEach((t,a)=>{if(a>0){const t=Ut.A.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(h,t),e.setActiveTexture(t),c.copyTexSubImage2D(3553,0,0,0,o,0,i,r),e.bindTexture(null,t)}e.clear(256),n.highlightLevel=a,s()}),n.highlightLevel=null,n.highlightMixTexture=null,l?.release()}(a,i,r,r,h,()=>this._renderAllGeometry(e,t),p)}else this._renderAllGeometry(e,t);return a.bindFramebuffer(null),c.renderOccludedMask=an,!0}get allSourcesOccluders(){return(0,tt.mt)(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,t){const i=this._overlays[e],r=i.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:n,renderer:s})=>{if(1===t.content&&0===n.drapeSourceType)return;const{fullOpacity:o}=n,a=null!=o&&o<1&&0===t.output&&this._bindTemporaryFBO();for(let e=0;e<r.numViews;e++)this._setViewParameters(r.extents[e],i),s.render(this._renderContext);if(a){this._bindTargetFBO(t),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const i=this._techniques.get(kn);this._rctx.bindTechnique(i,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const t=this._resolution,i=2*t;e.fbo.ensureFramebuffer(i,t),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,t=2*e,i=this._stage.renderer.fboCache,r=i.acquire(t,e,"overlay tmp");return i.rctx.bindFramebuffer(r.fbo),i.rctx.clear(16384),r}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,t,i,r){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let n=0;for(const{renderer:s}of this._sortedRenderers)n=s.intersect?.(e,t,i,r,n)??n}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),t=e.length;this._renderers.forEach((i,r)=>{const n=e.indexOf(r.layer?.uid),s=n>=0,o=r.renderGroup??(s?0:1),a=r.drapeSourcePriorityOffset??0,l=t*o+(s?n:0)+a;this._sortedRenderers.push(new $n(r,i,l))}),this._sortedRenderers.sort((e,t)=>e.index-t.index)}_setViewParameters(e,t){const i=this._camera;i.viewport=[0,0,t.resolution,t.resolution],(0,fe.v3)(i.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],i.near,i.far),(0,fe.kN)(i.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,t){if((0,A.hZ)(this._passParameters.color,t[0],t[1],t[2]),this._passParameters.texture)return;const i=new Uint8Array(e*e*4);let r=0;for(let t=0;t<e;t++)for(let n=0;n<e;n++){const s=Math.floor(n/10),o=Math.floor(t/10);s<2||o<2||10*s>e-20||10*o>e-20?(i[r++]=255,i[r++]=255,i[r++]=255,i[r++]=255):(i[r++]=255,i[r++]=255,i[r++]=255,i[r++]=1&s&&1&o?1&n^1&t?0:255:1&s^1&o?0:128)}const n=new Bt.R(e);n.samplingMode=9728,this._passParameters.texture=new Ut.A(this._rctx,n,i)}get test(){}};(0,r.Cg)([(0,u.MZ)()],qn.prototype,"hasHighlights",void 0),(0,r.Cg)([(0,u.MZ)()],qn.prototype,"renderOccludedFlags",void 0),(0,r.Cg)([(0,u.MZ)()],qn.prototype,"_sortedDrapeSourceRenderersDirty",void 0),(0,r.Cg)([(0,u.MZ)({constructOnly:!0})],qn.prototype,"parent",void 0),(0,r.Cg)([(0,u.MZ)({readOnly:!0})],qn.prototype,"_techniques",null),(0,r.Cg)([(0,u.MZ)({type:Boolean,readOnly:!0})],qn.prototype,"updating",null),(0,r.Cg)([(0,u.MZ)()],qn.prototype,"isEmpty",null),qn=(0,r.Cg)([(0,u.$K)("esri.views.3d.terrain.OverlayRenderer")],qn);class $n{constructor(e,t,i){this.drapeSource=e,this.renderer=t,this.index=i}}const Yn=[[1,.5,.5],[.5,.5,1]],Qn=4,Kn=new Un;var Xn;Kn.hasAlpha=!0;class Jn{constructor(e,t,i,r){this.positions=e,this.polygonIndices=t,this.outline=i,this.projectionSuccess=r,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let i=0;i<e.outlineIndices.length;i++)t+=rs(e.outlineIndices[i]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let i=0;i<e.outlineIndices.length;i++){const r=rs(e.outlineIndices[i]);r>1&&(t+=r)}return t}}class es extends Jn{}function ts(e,t){const{projectIfNearlyVertical:i=!1,outlineOutput:r="none",method:n}=t??{},s="tessellated-indices"===r,o=Ze(e.rings,!!e.hasZ,e.spatialReference),a=function(e,t){const{hasZ:i,ccwRingsAsHoles:r,spatialReference:n}=t,s=t.axis??Ze(e,i,n),o=e.length,a=[],l=[],c=[],h=[],u=e.reduce((e,t)=>e+t.length,0);let d=0;const p=(0,H.jh)(3*u);let g=0;const f=r&&e[0]&&ke(e[0],i,s);for(let t=o-1;t>=0;t--){const n=e[t],o=Ke(n,i);if(o<3){o>1&&h.push(n);continue}const u=!!r&&ke(n,i,s);if(f?!u:u)a[d++]=n;else{let e=n.length;for(let t=0;t<d;++t)e+=a[t].length;const t={index:g,pathLengths:new Array(d+1),count:e,holeIndices:new Array(d)};t.pathLengths[0]=n.length,n.length>0&&c.push({index:g,count:n.length}),g=Qe(n,p,g,n.length,i,f);for(let e=0;e<d;++e){const r=a[e];t.holeIndices[e]=g,t.pathLengths[e+1]=r.length,r.length>0&&c.push({index:g,count:r.length}),g=Qe(r,p,g,r.length,i,f)}d=0,t.count>0&&l.push(t)}}const m=g;for(const e of h)c.push({index:g,count:e.length}),g=Qe(e,p,g,e.length,i,f);return{positions:3*g===p.length?p:(0,H.l5)(p,0,3*g),polygonVertexCount:m,polygons:l,outlines:c}}(e.rings,{hasZ:!!e.hasZ,ccwRingsAsHoles:!0,spatialReference:e.spatialReference,axis:o}),l=function(e,t){const i=function(e,t){const i={method:t?.method??"auto",projectionAxis:t?.projectionAxis??void 0,outlines:t?.outlines??void 0},{projectionAxis:r}=i,n=null!=r&&2!==r;n&&$e(e.positions,r,2);const s=function(e,t){if("libtess"===t.method)return qe(e,t);const i=Array();let r=0;for(const n of e.polygons){const s=Ye(e.positions,n),o=(n.holeIndices??[]).map(e=>e-n.index),a=o.length>0?o:null,l=(0,ze.e)(s,a,3),c=ze.e.deviation(s,o,3,l);if("auto"===t.method&&c>1e-5)return qe(e,t);for(let e=0;e<l.length;e++)i.push(l[e]+n.index);r=Math.max(r,c)}const{outlineIndexBuffer:n,outlineRingLengths:s}=null!=t.outlines?function(e,t){const i=(0,Ve.my)(e.length);let r=0;for(let n=0;n<e.length;n++){const s=e[n],o=s.count;if(o<=0){i[n]=0;continue}const a=3*s.index,l=3*(s.index+o-1),c=o>1&&t[a]===t[l]&&t[a+1]===t[l+1]&&t[a+2]===t[l+2]?o-1:o,h=c>0?c+1:0;i[n]=h,r+=h}const n=(0,Ve.my)(r);let s=0;for(let t=0;t<e.length;t++){const r=i[t];if(0===r)continue;const o=e[t].index,a=r-1;for(let e=0;e<a;e++)n[s++]=o+e;n[s++]=o}return{outlineIndexBuffer:n,outlineRingLengths:i}}(t.outlines,e.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:e.positions,indices:(0,Ve.uW)(i),outlineIndexBuffer:n,outlineRingLengths:s,vertexCount:e.positions.length/3,method:"earcut",deviation:r}}(e,i);if(n){const t=s.succeeded?s.positions:null;null!=t&&t!==e.positions&&$e(t,2,r),$e(e.positions,2,r)}return s}(e,t);return i.succeeded?i:"libtess-not-loaded"===i.message?((0,Ie.gc)(Ge),async function(){try{await(0,Ne.l3)(),Ge.notify()}catch(e){throw e}}()):i}(a,{projectionAxis:i?o:void 0,outlines:s?a.outlines:void 0,method:n});if((0,c.$X)(l))return l;if(!l.succeeded)return null;let h={output:"none"};if("vertex-data"===r){const e=l.positions!==a.positions?a.positions:a.positions.slice();h={output:"vertex-data",outlines:is(a.outlines,e)}}else"tessellated-indices"===r&&(h=function(e){const{outlineIndexBuffer:t,outlineRingLengths:i}=e;if(null==t||null==i)return{output:"none"};const r=new Array(i.length);let n=0;for(let e=0;e<i.length;e++){const s=i[e],o=t.slice(n,n+s);r[e]=o,n+=s}return{output:"tessellated-indices",outlineIndices:r}}(l));return new es(l.positions,l.indices,h,!0)}function is(e,t,i=null){return e.filter(({count:e})=>e>1).map(({index:e,count:r})=>{const n=3*e,s=3*r;return null!=i?new ss(e,r,(0,H.l5)(t,n,s),(0,H.l5)(i,n,s)):new ns(e,r,(0,H.l5)(t,n,s))})}function rs(e,t=0,i=e.length){return i>1&&e[t]===e[t+i-1]?i-1:i}class ns{constructor(e,t,i){this.index=e,this.count=t,this.position=i}}class ss extends ns{constructor(e,t,i,r){super(e,t,i),this.mapPositions=r}}const os={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:b.A,local:S.default}};let as=Xn=class extends((0,n.OU)((0,o.WV)((0,l.g)(p.A)))){constructor(e){super(e),this.components=null,this.vertexSpace=new b.A,this.transform=null,this.metadata=new oe,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new C.default,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when(()=>{this.addHandles((0,h.wB)(()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map(e=>e.clone())}),()=>this._clearSources(),{once:!0,sync:!0}))})}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{spatialReference:e,vertexSpace:t}=this,i=this;return function(e){const{spatialReference:t,vertexSpace:i,untransformedBounds:r}=e,n=(0,m.gE)(r,Z);if((0,T.Hq)(i)&&e.transform&&(0,U.t)(n,n,e.transform.localMatrix),"georeferenced"===i.type){const e=i.origin;return e&&(0,U.a)(n,n,e),(0,m.w1)((0,m.vY)(n),t)}const s=(0,W.lO)(t),o=i.origin;if(!(0,N.canProjectWithoutEngine)(s,t)){const[e,i,r]=o;return new z.A({xmin:e,ymin:i,zmin:r,xmax:e,ymax:i,zmax:r,spatialReference:t})}return(0,V.l)(t,o,B,s),(0,U.t)(n,n,B),(0,j.projectBuffer)(n,s,0,n,t,0),(0,m.w1)((0,m.vY)(n),t)}({get transform(){return i.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){const{vertexAttributes:{position:e},components:t}=this;return 0===e.length||0===t?.length?(0,m.vt)(m.v_):(0,m.vY)(e)}get origin(){const e=(0,T.MW)(this.vertexSpace,this.spatialReference);if(null!=e)return e;const{center:t,zmin:i}=this._transformedExtent;return new g.A({x:t.x,y:t.y,z:i,spatialReference:this.spatialReference})}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(y.default.from(e)),this.notifyChange("components"))}removeComponent(e){if(this._checkIfLoaded("removeComponent()")){if(this.components){const t=this.components.indexOf(e);if(-1!==t)return this.components.splice(t,1),void this.notifyChange("components")}a.A.getLogger(this).error("removeComponent()","Provided component is not part of the list of components")}}rotate(e,t,i,r){return(0,v.AU)(e,t,i,ls),function(e,t,i){if(!e.vertexAttributes?.position||0===t[3])return;const{spatialReference:r,vertexSpace:n}=e,s=i?.origin??e.origin;(0,T.CK)(e)?function(e,t,i){e.transform??=new w.A;const{vertexSpace:r,transform:n,spatialReference:s}=e,[o,a,l]=r.origin,c=new g.A({x:o,y:a,z:l,spatialReference:s}),h=_e;if(c.equals(i))(0,A.hZ)(h,0,0,0);else if(!(0,M.p5)(h,i,e))return void(0,O.CN)(ye(),i.spatialReference,s,O.JP);(0,me.x8)(Ae,(0,v.yo)(t),(0,v.$I)(t));const u=(0,fe.O7)(be,Ae,d.uY,d.Un,h),{localMatrix:p}=n,f=(0,fe.lw)(be,u,p);n.scale=(0,fe.X_)((0,d.vt)(),f),(0,fe.hs)(f,f,(0,A.DI)(_e,n.scale));const m=n.rotationAxis;n.rotation=(0,v.ui)(f),0===n.rotationAngle&&(n.rotationAxis=m),n.translation=(0,fe.sC)((0,d.vt)(),f)}(e,t,s):E(n,r)?function(e,t,i){const r=e.spatialReference,n=(0,W.lO)(r),s=Te;if(!(0,R.g)(i,s,n)&&((0,O.CN)(ye(),i.spatialReference,n,"Falling back to mesh origin"),!(0,R.g)(e.origin,s,n)))return void(0,O.CN)(ye(),e.origin.spatialReference,n);const o=e.vertexAttributes.position,a=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,c=new Float64Array(o.length),h=null!=a?new Float32Array(a.length):null,u=null!=l?new Float32Array(l.length):null;(0,V.l)(n,s,we,n),(0,ge.z0)(Ce,we);const d=Se;(0,A.ei)((0,v.yo)(Se),(0,v.yo)(t),Ce),d[3]=t[3],!(0,O.gr)(o,r,c,n)||null!=a&&null!=h&&!(0,O.X4)(a,o,r,c,n,h)||null!=l&&null!=u&&!(0,O.xA)(l,o,r,c,n,u)?(0,O.CN)(ye(),r,n):(xe(c,d,3,s),!(0,O.$5)(c,n,o,r)||null!=a&&null!=h&&(xe(h,d,3),!(0,O.si)(h,o,r,c,n,a))||null!=l&&null!=u&&(xe(u,d,4),!(0,O.Mv)(u,o,r,c,n,l))?(0,O.CN)(ye(),n,r):e.vertexAttributesChanged())}(e,t,s):function(e,t,i){const r=Te;if(!(0,R.g)(i,r,e.spatialReference)){const t=e.origin;return r[0]=t.x,r[1]=t.y,r[2]=t.z,void(0,O.CN)(ye(),i.spatialReference,e.spatialReference,O.JP)}xe(e.vertexAttributes.position,t,3,r),xe(e.vertexAttributes.normal,t,3),xe(e.vertexAttributes.tangent,t,4),e.vertexAttributesChanged()}(e,t,s)}(this,ls,r),this}offset(e,t,i){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:r,vertexAttributes:n}=this,s=n?.position;if(!s)return this;if((0,T.Hq)(r)){const[n,s,o]=r.origin;r.origin=(0,d.fA)(n+e,s+t,o+i)}else{for(let r=0;r<s.length;r+=3)s[r]+=e,s[r+1]+=t,s[r+2]+=i;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded("scale()")?(function(e,t,i){if(!e.vertexAttributes?.position)return;const{vertexSpace:r,spatialReference:n}=e,s=i?.origin??e.origin;(0,T.CK)(e)?function(e,t,i){e.transform??=new w.A;const{vertexSpace:r,transform:n,spatialReference:s}=e,[o,a,l]=r.origin,c=new g.A({x:o,y:a,z:l,spatialReference:s}),h=Oe;if(c.equals(i))(0,A.hZ)(h,0,0,0);else if(!(0,M.p5)(h,i,e))return void(0,O.CN)(Re(),i.spatialReference,s,O.JP);const u=(0,A.hZ)(Me,t,t,t),p=(0,fe.O7)(Le,ve.zK,d.uY,u,h),{localMatrix:f}=n,m=(0,fe.lw)(Le,p,f);n.scale=(0,fe.X_)((0,d.vt)(),m),(0,fe.hs)(m,m,(0,A.DI)(Oe,n.scale));const y=n.rotationAxis;n.rotation=(0,v.ui)(m),0===n.rotationAngle&&(n.rotationAxis=y),n.translation=(0,fe.sC)((0,d.vt)(),m)}(e,t,s):E(r,n)?function(e,t,i){const r=e.spatialReference,n=(0,W.lO)(r),s=Pe;if(!(0,R.g)(i,s,n)&&((0,O.CN)(Re(),i.spatialReference,n,"Falling back to mesh origin"),!(0,R.g)(e.origin,s,n)))return void(0,O.CN)(Re(),e.origin.spatialReference,n);const o=e.vertexAttributes.position,a=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,c=new Float64Array(o.length),h=null!=a?new Float32Array(a.length):null,u=null!=l?new Float32Array(l.length):null;!(0,O.gr)(o,r,c,n)||null!=a&&null!=h&&!(0,O.X4)(a,o,r,c,n,h)||null!=l&&null!=u&&!(0,O.xA)(l,o,r,c,n,u)?(0,O.CN)(Re(),r,n):(Ee(c,t,s),!(0,O.$5)(c,n,o,r)||null!=a&&null!=h&&!(0,O.si)(h,o,r,c,n,a)||null!=l&&null!=u&&!(0,O.Mv)(u,o,r,c,n,l)?(0,O.CN)(Re(),n,r):e.vertexAttributesChanged())}(e,t,s):function(e,t,i){const r=Pe;if(!(0,R.g)(i,r,e.spatialReference)){const t=e.origin;return r[0]=t.x,r[1]=t.y,r[2]=t.z,void(0,O.CN)(Re(),i.spatialReference,e.spatialReference,O.JP)}Ee(e.vertexAttributes.position,t,r),e.vertexAttributesChanged()}(e,t,s)}(this,e,t),this):this}centerAt(e,t){return this._checkIfLoaded("centerAt()")?(function(e,t,i){if(!e.vertexAttributes?.position)return;const{vertexSpace:r}=e,n=i?.origin??e.origin;(0,T.Hq)(r)?function(e,t,i){const{vertexSpace:r}=e;if(!(0,T.Hq)(r))return;const n=D,s=P;if(!(0,R.g)(t,s,e.spatialReference))return void(0,O.CN)(L(),t.spatialReference,e.spatialReference,O.JP);if(!(0,R.g)(i,n,e.spatialReference))return void(0,O.CN)(L(),i.spatialReference,e.spatialReference,O.JP);const o=(0,A.Re)(I,s,n);r.origin=(0,A.WQ)((0,d.vt)(),r.origin,o)}(e,t,n):E(r,n.spatialReference)?function(e,t,i){const r=(0,d.fA)(i.x,i.y,i.z??0),n=(0,M.UR)(e,new S.default({origin:r}));if(!n)return;const s=(0,d.fA)(t.x,t.y,t.z??0),o=(0,M.UR)({vertexAttributes:n,spatialReference:e.spatialReference,vertexSpace:new S.default({origin:s})},b.A.absolute);if(!o)return;const{position:a,normal:l,tangent:c}=o;e.vertexAttributes.position=a,e.vertexAttributes.normal=l,e.vertexAttributes.tangent=c,e.vertexAttributesChanged()}(e,t,n):function(e,t,i){const r=D,n=P;if((0,R.g)(t,n,e.spatialReference)){if(!(0,R.g)(i,r,e.spatialReference)){const t=e.origin;return r[0]=t.x,r[1]=t.y,r[2]=t.z,void(0,O.CN)(L(),i.spatialReference,e.spatialReference,O.JP)}(function(e,t,i){if(e)for(let r=0;r<e.length;r+=3)for(let n=0;n<3;n++)e[r+n]+=t[n]-i[n]})(e.vertexAttributes.position,n,r),e.vertexAttributesChanged()}else(0,O.CN)(L(),t.spatialReference,e.spatialReference,O.JP)}(e,t,n)}(this,e,t),this):this}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(async function(e,t,r){switch(t.source.type){case"client":case"service":return async function(e,t,r){const{source:n}=t,{loadGLTFMesh:o}=await(0,c.qr)(i.e(5841).then(i.bind(i,35841)),r),a=await q(n,r);(0,c.Te)(r);const l=o(new g.A({x:0,y:0,z:0,spatialReference:e.spatialReference}),a.url,{resolveFile:G(a),signal:r?.signal,expectedType:a.type,unitConversionDisabled:t.unitConversionDisabled});l.then(()=>a.dispose(),()=>a.dispose());const{mesh:{vertexAttributes:h,components:u},meta:{isDracoDecompressed:d}}=await l;if(d)throw new s.A("mesh-load-external:draco-not-supported","The provided mesh uses Draco compression which is not supported.");e.vertexAttributes=h,e.components=u}(e,t,r);case"loadable":return t.source.load(e,r);default:t.source}}(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(e){return super.clone((0,re.WO)((0,re.QN)(e)))}cloneShallow(){return new Xn({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const[{toBinaryGLTF:t}]=await Promise.all([i.e(4038).then(i.bind(i,84038)),this.load(e)]);return(0,c.Te)(e),await t(this,e)}get usedMemory(){return this.components?this.components.reduce((e,t)=>e+t.memoryUsage,this.vertexAttributes.usedMemory):this.vertexAttributes.usedMemory}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return!!this.loaded||(a.A.getLogger(this).error(e,"Mesh must be loaded before applying operations"),!1)}static createBox(e,t){if(!(e instanceof g.A))return a.A.getLogger(this.prototype).error(".createBox()",x),null;const i=new Xn(ce(function(){const{faceDescriptions:e,faceVertexOffsets:t,uvScales:i}=he,r=4*e.length,n=new Float64Array(3*r),s=new Float32Array(3*r),o=new Float32Array(2*r),a=new Uint32Array(2*e.length*3);let l=0,c=0,h=0,u=0;for(let r=0;r<e.length;r++){const d=e[r],p=l/3;for(const e of t)a[u++]=p+e;const g=d.corners;for(let e=0;e<4;e++){const t=g[e];let r=0;o[h++]=.25*i[e][0]+d.uvOrigin[0],o[h++]=d.uvOrigin[1]-.25*i[e][1];for(let e=0;e<3;e++)0!==d.axis[e]?(n[l++]=.5*d.axis[e],s[c++]=d.axis[e]):(n[l++]=.5*t[r++],s[c++]=0)}}return{position:n,normal:s,uv:o,faces:a}}(),e,t));return t?.imageFace&&"all"!==t.imageFace?function(e,t){const i=e.components[0],r=i.faces,n=ue[t],s=6*n,o=new Array(6),a=new Array(r.length-6);let l=0,c=0;for(let e=0;e<r.length;e++)e>=s&&e<s+6?o[l++]=r[e]:a[c++]=r[e];if(null!=e.vertexAttributes.uv){const t=new Float32Array(e.vertexAttributes.uv),i=4*n*2,r=[0,1,1,1,1,0,0,0];for(let e=0;e<r.length;e++)t[i+e]=r[e];e.vertexAttributes.uv=t}return e.components=[new y.default({faces:o,material:i.material}),new y.default({faces:a})],e}(i,t.imageFace):i}static createSphere(e,t){return e instanceof g.A?new Xn(ce(function(e=0){const t=Math.round(8*2**e),i=2*t,r=(t-1)*(i+1)+2*i,n=new Float64Array(3*r),s=new Float32Array(3*r),o=new Float32Array(2*r),a=new Uint32Array((t-1)*i*2*3);let l=0,c=0,h=0,u=0;for(let e=0;e<=t;e++){const r=e/t*Math.PI+.5*Math.PI,d=Math.cos(r),p=Math.sin(r);de[2]=p;const g=0===e||e===t,f=g?i-1:i;for(let r=0;r<=f;r++){const p=r/f*2*Math.PI;de[0]=-Math.sin(p)*d,de[1]=Math.cos(p)*d;for(let e=0;e<3;e++)n[l]=.5*de[e],s[l]=de[e],++l;o[c++]=(r+(g?.5:0))/i,o[c++]=e/t,0!==e&&r!==i&&(e!==t&&(a[h++]=u,a[h++]=u+1,a[h++]=u-i),1!==e&&(a[h++]=u,a[h++]=u-i,a[h++]=u-i-1)),u++}}return{position:n,normal:s,uv:o,faces:a}}(t?.densificationFactor||0),e,t)):(a.A.getLogger(this.prototype).error(".createSphere()",x),null)}static createCylinder(e,t){return e instanceof g.A?new Xn(ce(function(e=0){const t=Math.round(16*2**e),i=4*(t+1)+2*t,r=new Float64Array(3*i),n=new Float32Array(3*i),s=new Float32Array(2*i),o=new Uint32Array(4*t*3);let a=0,l=0,c=0,h=0,u=0;for(let e=0;e<=5;e++){const i=0===e||5===e,d=e<=1||e>=4,p=2===e||4===e,g=i?t-1:t;for(let f=0;f<=g;f++){const m=f/g*2*Math.PI,v=i?0:.5;de[0]=v*Math.sin(m),de[1]=v*-Math.cos(m),de[2]=e<=2?.5:-.5;for(let t=0;t<3;t++)r[a++]=de[t],n[l++]=d?2===t?e<=1?1:-1:0:2===t?0:de[t]/v;s[c++]=(f+(i?.5:0))/t,s[c++]=e<=1?1*e/3:e<=3?1*(e-2)/3+1/3:1*(e-4)/3+2/3,p||0===e||f===t||(5!==e&&(o[h++]=u,o[h++]=u+1,o[h++]=u-t),1!==e&&(o[h++]=u,o[h++]=u-t,o[h++]=u-t-1)),u++}}return{position:r,normal:n,uv:s,faces:o}}(t?.densificationFactor||0),e,t)):(a.A.getLogger(this.prototype).error(".createCylinder()",x),null)}static createPlane(e,t){if(!(e instanceof g.A))return a.A.getLogger(this.prototype).error(".createPlane()",x),null;const i=t?.facing??"up",r=function(e,t){const i="number"==typeof t?t:null!=t?t.width:1,r="number"==typeof t?t:null!=t?t.height:1;switch(e){case"up":case"down":return{width:i,depth:r};case"north":case"south":return{width:i,height:r};case"east":case"west":return{depth:i,height:r}}}(i,t?.size);return new Xn(ce(function(e){const t=le.facingAxisOrderSwap[e],i=le.position,r=le.normal,n=new Float64Array(i.length),s=new Float32Array(r.length);let o=0;for(let e=0;e<4;e++){const e=o;for(let a=0;a<3;a++){const l=t[a],c=Math.abs(l)-1,h=l>=0?1:-1;n[o]=i[e+c]*h,s[o]=r[e+c]*h,o++}}return{position:n,normal:s,uv:new Float32Array(le.uv),faces:new Uint32Array(le.faces),isPlane:!0}}(i),e,{...t,size:r}))}static createFromPolygon(e,t){if(!(e instanceof f.A))return a.A.getLogger(this.prototype).error(".createFromPolygon()","Expected polygon to be a Polygon instance"),null;const i=ts(e,{method:"earcut"}),r=(0,c.$X)(i)?null:i,n=r?.positions??[],s=r?.polygonIndices??[];return new Xn({vertexAttributes:new C.default({position:n}),components:[new y.default({faces:s,shading:"flat",material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new b.A})}static async createFromGLTF(e,t,r){if(!(e instanceof g.A)){const e=new _;throw a.A.getLogger(this.prototype).error(".createfromGLTF()",e.message),e}const{loadGLTFMesh:n}=await(0,c.qr)(i.e(5841).then(i.bind(i,35841)),r);return new Xn((await n(e,t,r)).mesh)}static createWithExternalSource(e,t,i){const r=i?.extent??null,{spatialReference:n}=e,s=i?.transform?.clone()??new w.A,o=(0,T.TE)(e,i),a=i?.unitConversionDisabled,l={source:t,extent:r,unitConversionDisabled:a},c=new oe;return c.externalSources.push(l),new Xn({metadata:c,transform:s,vertexSpace:o,spatialReference:n})}static createIncomplete(e,t){const{spatialReference:i}=e,r=t?.transform?.clone()??new w.A,n=(0,T.TE)(e,t),o=new Xn({transform:r,vertexSpace:n,spatialReference:i});return o.addResolvingPromise(Promise.reject(new s.A("mesh-incomplete","Mesh resources are not complete"))),o}};(0,r.Cg)([(0,u.MZ)({type:[y.default],json:{write:!0}})],as.prototype,"components",void 0),(0,r.Cg)([(0,u.MZ)({nonNullable:!0,types:os,constructOnly:!0,json:{write:!0},clonable:(e,t)=>(0,re.o2)(t)?.vertexSpace??e.clone(t)})],as.prototype,"vertexSpace",void 0),(0,r.Cg)([(0,u.MZ)({type:w.A,clonable:(e,t)=>{const i=(0,re.o2)(t);return i&&"transform"in i?i.transform:e?.clone()??e},json:{write:!0}})],as.prototype,"transform",void 0),(0,r.Cg)([(0,u.MZ)({constructOnly:!0,type:oe,clonable:(e,t)=>(0,re.o2)(t)?.metadata??e.clone()})],as.prototype,"metadata",void 0),(0,r.Cg)([(0,u.MZ)()],as.prototype,"hasExtent",null),(0,r.Cg)([(0,u.MZ)()],as.prototype,"_transformedExtent",null),(0,r.Cg)([(0,u.MZ)()],as.prototype,"_untransformedBounds",null),(0,r.Cg)([(0,u.MZ)()],as.prototype,"origin",null),(0,r.Cg)([(0,u.MZ)({readOnly:!0,json:{read:!1}})],as.prototype,"extent",null),(0,r.Cg)([(0,u.MZ)({readOnly:!0,json:{read:!1,write:!0,default:!0}})],as.prototype,"hasZ",void 0),(0,r.Cg)([(0,u.MZ)({readOnly:!0,json:{read:!1,write:!0,default:!1}})],as.prototype,"hasM",void 0),(0,r.Cg)([(0,u.MZ)({type:C.default,nonNullable:!0,json:{write:!0},clonable:(e,t)=>(0,re.o2)(t)?.vertexAttributes??e.clone(t)})],as.prototype,"vertexAttributes",void 0),as=Xn=(0,r.Cg)([(0,u.$K)("esri.geometry.Mesh")],as);const ls=(0,v.vt)()},15585(e,t,i){i.d(t,{If:()=>p,O5:()=>v,O9:()=>f,QT:()=>m,l3:()=>g});var r=i(5482),n=i(2741),s=i(49186),o=i(44208),a=i(34727);let l=null,c=null,h=null,u=null;const d=(new Float32Array(0),new Uint32Array(0),new Uint32Array(0),new Uint32Array(0),{vertices:new Float64Array(0),indices:new Uint32Array(0),outlineIndices:new Uint32Array(0),outlineRingLengths:new Uint32Array(0),vertexCount:0,indexCount:0,outlineIndexCount:0,outlineRingCount:0});async function p(){return l??=async function(){const e=await i.e(2997).then(i.bind(i,42997)),t=await e.default({locateFile:e=>(0,n.s)(`esri/core/libs/libtess/${e}`)});h=t}(),l}async function g(){return c??=async function(){const e=await i.e(9134).then(i.bind(i,99134)),t=await e.default({locateFile:e=>(0,n.s)(`esri/core/libs/libtess/${e}`)});u=t}(),c}function f(){return null!==u}function m(e,t,i=2){const n={stack:[],error:void 0,hasError:!1};try{const a=h;if(!a)throw new s.A("libtess:not-loaded","libtessF32 not loaded");const l=(0,r.mS)(n,b.from(a,e),!1),c=(0,r.mS)(n,w.from(a,t),!1),u=e.length/i*4,d=(0,r.mS)(n,new b(a,u*i),!1),p=a.triangulate(l.ptr,c.ptr,c.size,i,d.ptr,u);if((0,o.A)("esri-tessellation-debug")){const e=a.getError();0!==e&&console.warn("libtess:triangulation",C(e))}return{buffer:d.slice(0,p*i),vertexCount:p}}catch(e){n.error=e,n.hasError=!0}finally{(0,r.hk)(n)}}function v(e,t,i=2,n=!0){const l={stack:[],error:void 0,hasError:!1};try{const c=u;if(!c)throw new s.A("libtess:not-loaded","libtessF64 not loaded");const h=(0,r.mS)(l,S.from(c,e),!1),p=(0,r.mS)(l,w.from(c,t),!1),g=(0,r.mS)(l,new w(c,1),!1),f=(0,r.mS)(l,new w(c,1),!1),m=(0,r.mS)(l,new w(c,1),!1),v=(0,r.mS)(l,new w(c,1),!1),{maxVertexCount:y,maxIndexCount:x,maxOutlineIndexCount:b,maxOutlineRingCount:T}=function(e,t){const i=e.reduce((e,t)=>e+t,0),r=e.length,n=Math.max(0,e.length-1),s=Math.max(0,i+2*n-2),o=Math.max(0,Math.ceil(2*i)),l=Math.max(0,Math.ceil(3*s*2)),c=(0,a.mP)(l,3),h=i>0?Math.max(2,Math.ceil(.25*i)):0,u=i>0?Math.max(1,Math.ceil(h/3)):0;return{maxVertexCount:o,maxIndexCount:c,maxOutlineIndexCount:t?Math.max(0,i+r+h):0,maxOutlineRingCount:t?Math.max(0,r+u):0}}(t,n);let A=0,R=0,E=0,O=0,M=0;{const e={stack:[],error:void 0,hasError:!1};try{const t=(0,r.mS)(e,new S(c,y*i),!1),s=(0,r.mS)(e,new w(c,x),!1),o=(0,r.mS)(e,n?new w(c,b):null,!1),a=(0,r.mS)(e,n?new w(c,T):null,!1);if(c.triangulateIndexed(h.ptr,p.ptr,p.size,i,t.ptr,y,i,s.ptr,x,g.ptr,f.ptr,o?.ptr??0,b,a?.ptr??0,T,m.ptr,v.ptr),M=c.getError(),A=_(c)[g.ptr/Int32Array.BYTES_PER_ELEMENT],R=_(c)[f.ptr/Int32Array.BYTES_PER_ELEMENT],E=_(c)[m.ptr/Int32Array.BYTES_PER_ELEMENT],O=_(c)[v.ptr/Int32Array.BYTES_PER_ELEMENT],0===M){const e=t.slice(0,A*i);return{vertices:e,indices:s.slice(0,R),outlineIndices:n&&o?o.slice(0,E):d.outlineIndices,outlineRingLengths:n&&a?a.slice(0,O):d.outlineRingLengths,vertexCount:A,indexCount:R,outlineIndexCount:n?E:0,outlineRingCount:n?O:0}}}catch(t){e.error=t,e.hasError=!0}finally{(0,r.hk)(e)}}if(100903!==M)return(0,o.A)("esri-tessellation-debug")&&console.warn("libtess:triangulation",C(M)),d;const L=(0,r.mS)(l,new S(c,A*i),!1),P=(0,r.mS)(l,new w(c,R),!1),D=(0,r.mS)(l,n?new w(c,E):null,!1),I=(0,r.mS)(l,n?new w(c,O):null,!1);if(c.triangulateIndexed(h.ptr,p.ptr,p.size,i,L.ptr,A,i,P.ptr,R,g.ptr,f.ptr,D?.ptr??0,n?E:0,I?.ptr??0,n?O:0,m.ptr,v.ptr),M=c.getError(),0!==M)return(0,o.A)("esri-tessellation-debug")&&console.warn("libtess:triangulation",C(M)),d;const F=_(c)[g.ptr/Int32Array.BYTES_PER_ELEMENT],z=_(c)[f.ptr/Int32Array.BYTES_PER_ELEMENT],N=_(c)[m.ptr/Int32Array.BYTES_PER_ELEMENT],W=_(c)[v.ptr/Int32Array.BYTES_PER_ELEMENT],V=L.slice(0,F*i);return{vertices:V,indices:P.slice(0,z),outlineIndices:n&&D?D.slice(0,N):d.outlineIndices,outlineRingLengths:n&&I?I.slice(0,W):d.outlineRingLengths,vertexCount:F,indexCount:z,outlineIndexCount:n?N:0,outlineRingCount:n?W:0}}catch(e){l.error=e,l.hasError=!0}finally{(0,r.hk)(l)}}function y(e){return e.HEAPF64}function x(e){return e.HEAPF32}function _(e){return e.HEAP32}class b{static from(e,t){const i=new b(e,t.length);return i.set(t),i}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateCoordinateArray(t)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float32Array.BYTES_PER_ELEMENT}set(e){x(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const i=this.ptr/this.bytesPerCoordinate;return x(this._libtess).slice(i+e,i+t)}}class S{static from(e,t){const i=new S(e,t.length);return i.set(t),i}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateCoordinateArray(t)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float64Array.BYTES_PER_ELEMENT}set(e){y(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const i=this.ptr/this.bytesPerCoordinate;return y(this._libtess).slice(i+e,i+t)}}class w{static from(e,t){const i=new w(e,t.length);return i.set(t),i}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateLengthsArray(t)}destroy(){this._libtess.destroyLengthsArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Int32Array.BYTES_PER_ELEMENT}set(e){_(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const i=this.ptr/this.bytesPerCoordinate;return function(e){const t=_(e);return new Uint32Array(t.buffer,t.byteOffset,t.length)}(this._libtess).slice(i+e,i+t)}}function C(e){switch(e){case 100903:return"Insufficient output buffer";case 100902:return"Out of memory";case 100151:return"Missing begin polygon";case 100152:return"Missing begin contour";case 100153:return"Missing end polygon";case 100154:return"Missing end countour";case 100155:return"Coordinates too large";case 100156:return"Missing combine callback";default:return`Unknown: ${e}`}}},16939(e,t,i){i.r(t),i.d(t,{default:()=>p});var r,n=i(5482),s=i(69540),o=i(25482),a=i(53966),l=i(91429),c=i(56507),h=i(19211),u=i(80882),d=i(31199);let p=r=class extends((0,s.OU)(o.o)){static from(e){return(0,c.PZ)(r,e)}constructor(e){super(e),this.material=null,this.name=void 0,this.shading="source",this.trustSourceNormals=!1}get faces(){return this._get("faces")??null}set faces(e){this._set("faces",(0,d.b)(e,Uint32Array,[Uint16Array],{loggerTag:".faces=",stride:3},a.A.getLogger(this)))}castMaterial(e){return(0,c.PZ)(e&&"object"==typeof e&&("metallic"in e||"roughness"in e||"metallicRoughnessTexture"in e)?u.A:h.default,e)}get memoryUsage(){let e=0;return null!=this.faces&&(e+=this.faces.byteLength),null!=this.material&&(e+=this.material.memoryUsage),e}};(0,n.Cg)([(0,l.MZ)({json:{write:d.B}})],p.prototype,"faces",null),(0,n.Cg)([(0,l.MZ)({type:h.default,json:{write:!0}})],p.prototype,"material",void 0),(0,n.Cg)([(0,l.wg)("material")],p.prototype,"castMaterial",null),(0,n.Cg)([(0,l.MZ)({json:{write:!0}})],p.prototype,"name",void 0),(0,n.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],p.prototype,"shading",void 0),(0,n.Cg)([(0,l.MZ)({type:Boolean})],p.prototype,"trustSourceNormals",void 0),p=r=(0,n.Cg)([(0,l.$K)("esri.geometry.support.MeshComponent")],p)},95696(e,t,i){i.d(t,{A:()=>c});var r,n=i(5482),s=i(69540),o=i(25482),a=i(91429),l=i(93223);let c=class extends((0,s.OU)(o.o)){static{r=this}constructor(e){super(e),this.type="georeferenced",this.origin=null}static{this.absolute=new r}};(0,n.Cg)([(0,l.e)({georeferenced:"georeferenced"},{readOnly:!0})],c.prototype,"type",void 0),(0,n.Cg)([(0,a.MZ)({type:[Number],nonNullable:!1,json:{write:!0}})],c.prototype,"origin",void 0),c=r=(0,n.Cg)([(0,a.$K)("esri.geometry.support.MeshGeoreferencedVertexSpace")],c)},18251(e,t,i){i.r(t),i.d(t,{default:()=>c});var r=i(5482),n=i(69540),s=i(25482),o=i(91429),a=i(51850),l=i(93223);let c=class extends((0,n.OU)(s.o)){constructor(e){super(e),this.type="local",this.origin=(0,a.vt)()}};(0,r.Cg)([(0,l.e)({local:"local"},{readOnly:!0})],c.prototype,"type",void 0),(0,r.Cg)([(0,o.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],c.prototype,"origin",void 0),c=(0,r.Cg)([(0,o.$K)("esri.geometry.support.MeshLocalVertexSpace")],c)},19211(e,t,i){i.r(t),i.d(t,{default:()=>u});var r=i(5482),n=i(68197),s=i(69540),o=i(25482),a=i(91429),l=i(35063),c=i(51147),h=i(66895);let u=class extends((0,s.OU)(o.o)){constructor(e){super(e),this.color=null,this.colorTextureTransform=null,this.normalTextureTransform=void 0,this.alphaMode="auto",this.alphaCutoff=.5,this.doubleSided=!0}get colorTexture(){return this._get("colorTexture")}set colorTexture(e){this._set("colorTexture",null==e?null:l.default.from(e))}get normalTexture(){return this._get("normalTexture")}set normalTexture(e){this._set("normalTexture",null==e?null:l.default.from(e))}clone(e){const t=(0,h.hz)(e),i=t?.materialMap?.get(this);if(i)return i;const r=super.clone((0,h.QN)(e));return t?.materialMap?.set(this,r),r}get memoryUsage(){return this.getMemoryUsage()}getMemoryUsage(){let e=0;return e+=null!=this.color?16:0,null!=this.colorTexture&&(e+=this.colorTexture.memoryUsage),e+=null!=this.colorTextureTransform?20:0,null!=this.normalTexture&&(e+=this.normalTexture.memoryUsage),e+=null!=this.normalTextureTransform?20:0,e}};(0,r.Cg)([(0,a.MZ)({type:n.A,json:{write:!0}})],u.prototype,"color",void 0),(0,r.Cg)([(0,a.MZ)({type:l.default,json:{write:!0},value:null})],u.prototype,"colorTexture",null),(0,r.Cg)([(0,a.MZ)({type:c.A,json:{write:!0}})],u.prototype,"colorTextureTransform",void 0),(0,r.Cg)([(0,a.MZ)({type:l.default,json:{write:!0},value:null})],u.prototype,"normalTexture",null),(0,r.Cg)([(0,a.MZ)({type:c.A,json:{write:!0}})],u.prototype,"normalTextureTransform",void 0),(0,r.Cg)([(0,a.MZ)({nonNullable:!0,json:{write:!0}})],u.prototype,"alphaMode",void 0),(0,r.Cg)([(0,a.MZ)({nonNullable:!0,json:{write:!0}})],u.prototype,"alphaCutoff",void 0),(0,r.Cg)([(0,a.MZ)({nonNullable:!0,json:{write:!0}})],u.prototype,"doubleSided",void 0),u=(0,r.Cg)([(0,a.$K)("esri.geometry.support.MeshMaterial")],u)},80882(e,t,i){i.d(t,{A:()=>c});var r=i(5482),n=i(68197),s=i(91429),o=i(19211),a=i(35063),l=i(51147);let c=class extends o.default{constructor(e){super(e),this.emissiveColor=null,this.emissiveStrength=null,this.emissiveTextureTransform=void 0,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTextureTransform=void 0}get emissiveTexture(){return this._get("emissiveTexture")}set emissiveTexture(e){this._set("emissiveTexture",null==e?null:a.default.from(e))}get occlusionTexture(){return this._get("occlusionTexture")}set occlusionTexture(e){this._set("occlusionTexture",null==e?null:a.default.from(e))}get metallicRoughnessTexture(){return this._get("metallicRoughnessTexture")}set metallicRoughnessTexture(e){this._set("metallicRoughnessTexture",null==e?null:a.default.from(e))}getMemoryUsage(){let e=super.getMemoryUsage();return e+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(e+=this.emissiveTexture.memoryUsage),e+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(e+=this.occlusionTexture.memoryUsage),e+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=null!=this.metallicRoughnessTextureTransform?20:0,e}};(0,r.Cg)([(0,s.MZ)({type:n.A,json:{write:!0}})],c.prototype,"emissiveColor",void 0),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],c.prototype,"emissiveStrength",void 0),(0,r.Cg)([(0,s.MZ)({type:a.default,json:{write:!0},value:null})],c.prototype,"emissiveTexture",null),(0,r.Cg)([(0,s.MZ)({type:l.A,json:{write:!0}})],c.prototype,"emissiveTextureTransform",void 0),(0,r.Cg)([(0,s.MZ)({type:a.default,json:{write:!0},value:null})],c.prototype,"occlusionTexture",null),(0,r.Cg)([(0,s.MZ)({type:l.A,json:{write:!0}})],c.prototype,"occlusionTextureTransform",void 0),(0,r.Cg)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],c.prototype,"metallic",void 0),(0,r.Cg)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],c.prototype,"roughness",void 0),(0,r.Cg)([(0,s.MZ)({type:a.default,json:{write:!0},value:null})],c.prototype,"metallicRoughnessTexture",null),(0,r.Cg)([(0,s.MZ)({type:l.A,json:{write:!0}})],c.prototype,"metallicRoughnessTextureTransform",void 0),c=(0,r.Cg)([(0,s.$K)("esri.geometry.support.MeshMaterialMetallicRoughness")],c)},35063(e,t,i){i.r(t),i.d(t,{default:()=>m});var r,n=i(5482),s=i(69540),o=i(21287),a=i(25482),l=i(91429),c=i(56507),h=i(66895),u=i(97159),d=i(43937),p=i(36005);const g=new WeakMap;let f=0,m=class extends((0,s.OU)(a.o)){static{r=this}constructor(e){super(e),this.wrap="repeat"}get url(){return this._get("url")||null}set url(e){this._set("url",e),e&&this._set("data",null)}get data(){return this._get("data")||null}set data(e){this._set("data",e),e&&this._set("url",null)}writeData(e,t,i,r){if(e instanceof HTMLImageElement){const n={type:"image-element",src:(0,u.t)(e.src,r),crossOrigin:e.crossOrigin};t[i]=n}else if(e instanceof HTMLCanvasElement){const r={type:"canvas-element",imageData:v(e.getContext("2d").getImageData(0,0,e.width,e.height))};t[i]=r}else if(e instanceof HTMLVideoElement){const n={type:"video-element",src:(0,u.t)(e.src,r),autoplay:e.autoplay,loop:e.loop,muted:e.muted,crossOrigin:e.crossOrigin,preload:e.preload};t[i]=n}else if(e instanceof ImageData){const r={type:"image-data",imageData:v(e)};t[i]=r}}readData(e){switch(e.type){case"image-element":{const t=new Image;return t.src=e.src,t.crossOrigin=e.crossOrigin,t}case"canvas-element":{const t=y(e.imageData),i=document.createElement("canvas");return i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(t,0,0),i}case"image-data":return y(e.imageData);case"video-element":{const t=document.createElement("video");return t.src=e.src,t.crossOrigin=e.crossOrigin,t.autoplay=e.autoplay,t.loop=e.loop,t.muted=e.muted,t.preload=e.preload,t}default:return}}get transparent(){const{data:e,url:t}=this,i=e=>e?.toLowerCase().endsWith(".png")||e?.toLocaleLowerCase().startsWith("data:image/png;");return e instanceof HTMLCanvasElement?x(e.getContext("2d").getImageData(0,0,e.width,e.height)):e instanceof ImageData?x(e):!(!t||!i(t))||!!(e instanceof HTMLImageElement&&i(e.src))}set transparent(e){this._overrideIfSome("transparent",e)}get contentHash(){const e="string"==typeof this.wrap?this.wrap:"object"==typeof this.wrap?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",t=(t="")=>`d:${t},t:${this.transparent},w:${e}`;return null!=this.url?t(this.url):null!=this.data?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?t(this.data.src):(g.has(this.data)||g.set(this.data,++f),t(g.get(this.data))):t()}get memoryUsage(){let e=0;if(e+=null!=this.url?this.url.length:0,null!=this.data){const t=this.data;"data"in t?e+=t.data.byteLength:t instanceof HTMLImageElement?e+=t.naturalWidth*t.naturalHeight*3:t instanceof HTMLCanvasElement&&(e+=t.width*t.height*3)}return e}clone(e){const t=(0,h.$N)(e),i=t?.textureMap?.get(this);if(i)return i;const r=super.clone(e);return t?.textureMap?.set(this,r),r}static from(e){return"string"==typeof e?new r({url:e}):e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageData||e instanceof HTMLVideoElement?new r({data:e}):(0,c.PZ)(r,e)}};function v(e){let t="";for(let i=0;i<e.data.length;i++)t+=String.fromCharCode(e.data[i]);return{data:btoa(t),width:e.width,height:e.height}}function y(e){const t=atob(e.data),i=new Uint8ClampedArray(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return(0,o.eV)(i,e.width,e.height)}function x(e){for(let t=3;t<e.data.length;t+=4)if(255!==e.data[t])return!0;return!1}(0,n.Cg)([(0,l.MZ)({type:String,json:{write:u.w}})],m.prototype,"url",null),(0,n.Cg)([(0,l.MZ)({clonable:"reference",json:{write:{overridePolicy(){return{enabled:!this.url}}}}})],m.prototype,"data",null),(0,n.Cg)([(0,d.K)("data")],m.prototype,"writeData",null),(0,n.Cg)([(0,p.w)("data")],m.prototype,"readData",null),(0,n.Cg)([(0,l.MZ)({type:Boolean,json:{write:{overridePolicy(){return{enabled:this._isOverridden("transparent")}}}}})],m.prototype,"transparent",null),(0,n.Cg)([(0,l.MZ)({json:{write:!0}})],m.prototype,"wrap",void 0),(0,n.Cg)([(0,l.MZ)({readOnly:!0})],m.prototype,"contentHash",null),m=r=(0,n.Cg)([(0,l.$K)("esri.geometry.support.MeshTexture")],m)},51147(e,t,i){i.d(t,{A:()=>a});var r=i(5482),n=i(69540),s=i(25482),o=i(91429);let a=class extends((0,n.OU)(s.o)){constructor(e){super(e),this.offset=[0,0],this.rotation=0,this.scale=[1,1]}};(0,r.Cg)([(0,o.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],a.prototype,"offset",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],a.prototype,"rotation",void 0),(0,r.Cg)([(0,o.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],a.prototype,"scale",void 0),a=(0,r.Cg)([(0,o.$K)("esri.geometry.support.MeshTextureTransform")],a)},1193(e,t,i){i.r(t),i.d(t,{default:()=>u});var r,n=i(5482),s=i(69540),o=i(25482),a=i(4718),l=i(53966),c=i(91429),h=i(31199);let u=r=class extends((0,s.OU)(o.o)){constructor(e){super(e),this.color=null,this.position=new Float64Array(0),this.uv=null,this.normal=null,this.tangent=null}castColor(e){return(0,h.b)(e,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},l.A.getLogger(this))}castPosition(e){return e&&e instanceof Float32Array&&l.A.getLogger(this).warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array"),(0,h.b)(e,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},l.A.getLogger(this))}castUv(e){return(0,h.b)(e,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},l.A.getLogger(this))}castNormal(e){return(0,h.b)(e,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},l.A.getLogger(this))}castTangent(e){return(0,h.b)(e,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},l.A.getLogger(this))}clonePositional(){const e={position:(0,a.o8)(this.position),normal:(0,a.o8)(this.normal),tangent:(0,a.o8)(this.tangent),uv:this.uv,color:this.color};return new r(e)}get usedMemory(){return this.position.byteLength+(this.uv?.byteLength??0)+(this.normal?.byteLength??0)+(this.tangent?.byteLength??0)+(this.color?.byteLength??0)}};(0,n.Cg)([(0,c.MZ)({json:{write:h.B}})],u.prototype,"color",void 0),(0,n.Cg)([(0,c.wg)("color")],u.prototype,"castColor",null),(0,n.Cg)([(0,c.MZ)({nonNullable:!0,json:{write:h.B}})],u.prototype,"position",void 0),(0,n.Cg)([(0,c.wg)("position")],u.prototype,"castPosition",null),(0,n.Cg)([(0,c.MZ)({json:{write:h.B}})],u.prototype,"uv",void 0),(0,n.Cg)([(0,c.wg)("uv")],u.prototype,"castUv",null),(0,n.Cg)([(0,c.MZ)({json:{write:h.B}})],u.prototype,"normal",void 0),(0,n.Cg)([(0,c.wg)("normal")],u.prototype,"castNormal",null),(0,n.Cg)([(0,c.MZ)({json:{write:h.B}})],u.prototype,"tangent",void 0),(0,n.Cg)([(0,c.wg)("tangent")],u.prototype,"castTangent",null),u=r=(0,n.Cg)([(0,c.$K)("esri.geometry.support.MeshVertexAttributes")],u)},31199(e,t,i){function r(e,t,i,r){const{loggerTag:n,stride:s}=t;return e.length%s!==0?(r.error(n,`Invalid array length, expected a multiple of ${s}`),new i([])):e}function n(e,t,i,n,s){if(!e)return e;if(e instanceof t)return r(e,n,t,s);for(const o of i)if(e instanceof o)return r(new t(e),n,t,s);if(Array.isArray(e))return r(new t(e),n,t,s);{const r=i.map(e=>`'${e.name}'`);return s.error(`Failed to set property, expected one of ${r}, but got ${e.constructor.name}`),new t([])}}function s(e,t,i){t[i]=function(e){const t=new Array(e.length);for(let i=0;i<e.length;i++)t[i]=e[i];return t}(e)}i.d(t,{B:()=>s,b:()=>n})},63579(e,t,i){i.d(t,{Bq:()=>l,Qp:()=>a,WN:()=>m,dK:()=>v,eN:()=>p,fH:()=>f,in:()=>g,yr:()=>c});var r=i(11254),n=i(4576),s=i(17676),o=i(20557);class a{constructor(e,t,i){this.assetName=e,this.assetMimeType=t,this.parts=i}equals(e){return this===e||this.assetName===e.assetName&&this.assetMimeType===e.assetMimeType&&(0,n.aI)(this.parts,e.parts,(e,t)=>e.equals(t))}isOnService(e){return this.parts.every(t=>t.isOnService(e))}makeHash(){let e="";for(const t of this.parts)e+=t.partHash;return e}async toBlob(e){const{parts:t}=this;if(1===t.length)return t[0].toBlob(e);const i=await Promise.all(t.map(t=>t.toBlob(e)));return(0,s.Te)(e),new Blob(i)}}class l{constructor(e,t){this.partUrl=e,this.partHash=t}equals(e){return this===e||this.partUrl===e.partUrl&&this.partHash===e.partHash}isOnService(e){return this.partUrl.startsWith(`${e.path}/assets/`)}async toBlob(e){const{data:t}=await(0,r.A)(this.partUrl,{responseType:"blob"});return(0,s.Te)(e),t}}function c(e){return function(e){switch(e?.type){case"client":return Array.isArray(e.files)?e.files.some(d):d(e.files);case"service":return e.assets.some(d);case"loadable":return!0;default:return!1}}(e?.source)}const h=/^(model\/gltf\+json)|(model\/gltf-binary)$/,u=/\.(gltf|glb)/i;function d(e){if(e instanceof File){const{type:t,name:i}=e;return h.test(t)||u.test(i)}return h.test(e.assetMimeType)||u.test(e.assetName)}function p(e,t){if(!e)return!1;const{source:i}=e;return function(e,t){return"service"===e.type&&e.assets.every(e=>e.isOnService(t))}(i,t)}function g(e,t){if(e===t)return!0;const{source:i}=e,{source:r}=t;if(i===r)return!0;if("service"===i.type&&"service"===r.type){if(i.assets.length!==r.assets.length)return!1;const e=(e,t)=>e.assetName<t.assetName?-1:e.assetName>t.assetName?1:0,t=[...i.assets].sort(e),n=[...r.assets].sort(e);for(let e=0;e<t.length;++e)if(!t[e].equals(n[e]))return!1;return!0}return!1}function f(e,t){return e instanceof File?(0,o.rq)(e,t):(0,o.z$)(e.assetMimeType,e.assetName,t)}function m(e){switch(e.type){case"client":return Array.isArray(e.files)?e.files:[e.files];case"service":return e.assets;case"loadable":return}}function v(e){return!!e.original}},66895(e,t,i){i.d(t,{$N:()=>h,Lz:()=>s,QN:()=>u,WO:()=>l,hz:()=>a,o2:()=>n});const r=Symbol("meshContext");function n(e){return e&&"object"==typeof e&&r in e?e[r]:void 0}function s(e,t){const i=n(e);return{...e,[r]:{...i,...t}}}const o=Symbol("meshMaterialContext");function a(e){return e&&"object"==typeof e&&o in e?e[o]:void 0}function l(e){const t=a(e);if(t?.materialMap)return e;const i={materialMap:new Map};return{...e,[o]:i}}const c=Symbol("meshTextureContext");function h(e){return e&&"object"==typeof e&&c in e?e[c]:void 0}function u(e){const t=h(e);if(t?.textureMap)return e;const i={textureMap:new Map};return{...e,[c]:i}}},22141(e,t,i){i.d(t,{$5:()=>w,CN:()=>x,JP:()=>y,KM:()=>T,Mv:()=>R,X4:()=>_,gr:()=>S,qs:()=>C,si:()=>b,xA:()=>A});var r=i(34727),n=i(77690),s=i(29242),o=i(58083),a=i(9093),l=i(35522),c=i(51850),h=i(73941),u=i(48353),d=i(9762),p=(i(79258),i(21325)),g=i(28735),f=i(13030),m=i(73354),v=i(50867);const y="Projection may be possible after calling projection.load().";function x(e,t,i,r){e.error(`Failed to project from (wkid:${t.wkid}) to (wkid:${i.wkid}).${r?" ":""}${r}`)}function _(e,t,i,r,n,s){return O(0,f.xs.fromTypedArray(e),0,f.Xm.fromTypedArray(t),i,f.Xm.fromTypedArray(r),n,f.xs.fromTypedArray(s))?s:null}function b(e,t,i,r,n,s){return O(1,f.xs.fromTypedArray(e),0,f.Xm.fromTypedArray(t),i,f.Xm.fromTypedArray(r),n,f.xs.fromTypedArray(s))?s:null}function S(e,t,i,r){return(0,d.projectBuffer)(e,t,0,i,r,0)?i:null}function w(e,t,i,r){return(0,d.projectBuffer)(e,t,0,i,r,0)?i:null}function C(e,t,i){return(0,n.Ge)(D,i),(0,m.b)(t,e,D),(0,r.or)(D)&&(0,m.n)(t,t),t}function T(e,t,i){return(0,n.z0)(D,i),(0,v.t)(t,e,D),(0,r.or)(D)&&(0,m.n)(t,t,4),t}function A(e,t,i,r,n,s){if(!O(0,f.xs.fromTypedArray(e,4*Float32Array.BYTES_PER_ELEMENT),1,f.Xm.fromTypedArray(t),i,f.Xm.fromTypedArray(r),n,f.xs.fromTypedArray(s,4*Float32Array.BYTES_PER_ELEMENT)))return null;for(let t=3;t<e.length;t+=4)s[t]=e[t];return s}function R(e,t,i,r,n,s){if(!O(1,f.xs.fromTypedArray(e,16),1,f.Xm.fromTypedArray(t),i,f.Xm.fromTypedArray(r),n,f.xs.fromTypedArray(s,16)))return null;for(let t=3;t<e.length;t+=4)s[t]=e[t];return s}function E(e,t,i,r,s){switch((0,u.l)(r,i,P,r),1===e&&(0,o.B8)(P,P),t){case 0:return(0,n.Ge)(s,P);case 1:return(0,n.z0)(s,P)}}function O(e,t,i,r,n,s,o,a){if(!t)return;const c=r.count;if(function(e){return e.isWGS84||(0,p.x1)(e)||(0,h.q8)(e)||(0,h.KQ)(e)}(n))for(let r=0;r<c;r++)s.getVec(r,M),t.getVec(r,L),(0,l.ei)(L,L,E(e,i,M,o,D)),a.setVec(r,L);else for(let n=0;n<c;n++){s.getVec(n,M),t.getVec(n,L);const c=(0,g.jg)(r.get(n,1));let h=Math.cos(c);1===i!=(0===e)&&(h=1/h),E(e,i,M,o,D),0===e?(D[0]*=h,D[1]*=h,D[2]*=h,D[3]*=h,D[4]*=h,D[5]*=h):(D[0]*=h,D[3]*=h,D[6]*=h,D[1]*=h,D[4]*=h,D[7]*=h),(0,l.ei)(L,L,D),(0,l.S8)(L,L),a.setVec(n,L)}return a}const M=(0,c.vt)(),L=(0,c.vt)(),P=(0,a.vt)(),D=(0,s.vt)()},72258(e,t,i){i.d(t,{UR:()=>b,p5:()=>_,xK:()=>R});var r=i(53966),n=i(34727),s=i(86211),o=i(77690),a=i(29242),l=i(58083),c=i(9093),h=i(35522),u=i(51850),d=i(73941),p=i(98764),g=i(48353),f=i(65806),m=i(27615),v=i(73354),y=i(22141);const x=()=>r.A.getLogger("esri.geometry.support.meshUtils.vertexSpaceConversion");function _(e,t,{vertexSpace:i,spatialReference:r}){if("georeferenced"===i.type){const n=e;if(!(0,f.g)(t,n,r))return!1;const{origin:s}=i;return(0,h.Re)(e,n,s),!0}const n=(0,p.lO)(r),s=e;if(!(0,f.g)(t,s,n))return!1;const{origin:o}=i,a=P;if(!(0,g.l)(r,o,a,n))return!1;const c=(0,l.B8)(P,a);return null!=c&&((0,h.Z0)(e,s,c),!0)}function b(e,t,i){const{vertexSpace:r,transform:n,vertexAttributes:s}=e,a=(0,m.Hq)(r)?n:null,u=T(e.spatialReference,i,3);if((0,m.yJ)(r,t)&&(!a||(0,l.t2)(a.localMatrix,c.zK))&&A(u)){const{position:e,normal:t,tangent:r}=s,n=i?.allowBufferReuse;return{position:n?e:e.slice(),normal:n?t:t?.slice(),tangent:n?r:r?.slice()}}switch(e.vertexSpace.type){case"local":return"local"===t.type?function({vertexAttributes:e,spatialReference:t,transform:i},{origin:r},n,s){const o=S(t,s);if(!(0,g.l)(t,r,E,o))return(0,y.CN)(x(),t,o),null;if(i&&(0,l.lw)(E,E,i.localMatrix),!(0,g.l)(t,n,O,o))return(0,y.CN)(x(),o,t),null;(0,l.B8)(O,O);const a=(0,l.lw)(E,O,E);return C(a,t,s,3),w(e,a)}(e,e.vertexSpace,t.origin,i):function({spatialReference:e,vertexAttributes:t,transform:i},{origin:r},n,s){const o=S(e,s);if(!(0,g.l)(e,r,E,o))return(0,y.CN)(x(),e,o),null;i&&(0,l.lw)(E,E,i.localMatrix),C(E,e,s,1);const a=new Float64Array(t.position.length),c=function(e,t,i,r,n){(0,v.t)(r,e,t);const s=new Float64Array(e.length);return(0,y.$5)(r,n,s,i)?s:((0,y.CN)(x(),n,i),null)}(t.position,E,e,a,o);if(!c)return null;const u=function(e,t,i,r,n,s){if(null==n)return null;const o=new Float32Array(n.length);return(0,y.qs)(n,o,s),(0,y.si)(o,e,t,i,r,o)?o:((0,y.CN)(x(),r,t),null)}(c,e,a,o,t.normal,E);if(t.normal&&!u)return null;const d=function(e,t,i,r,n,s){if(null==n)return null;const o=new Float32Array(n.length);return(0,y.KM)(n,o,s),(0,y.Mv)(o,e,t,i,r,o)?o:((0,y.CN)(x(),r,t),null)}(c,e,a,o,t.tangent,E);if(t.tangent&&!d)return null;if(n){const e=(0,h.ze)(L,n);(0,v.a)(c,c,e)}return{position:c,normal:u,tangent:d}}(e,e.vertexSpace,t.origin,i);case"georeferenced":return"local"===t.type?function({vertexAttributes:e,spatialReference:t,transform:i},{origin:r},n,s){const a=S(t,s);if(!(0,g.l)(t,n,E,a))return(0,y.CN)(x(),t,a),null;const c=1/T(t,s,2);(0,l.hs)(E,E,[c,c,c]);const h=(0,l.B8)(O,E),{position:u,normal:d,tangent:p}=function(e,t,i){if(!t)return e;if(!i){const{position:i,normal:r,tangent:n}=e;return{position:(0,v.a)(new Float64Array(i.length),i,t),tangent:n,normal:r}}const r=w(e,i.localMatrix);return(0,v.a)(r.position,r.position,t),r}(e,r,i),f=new Float64Array(u.length),m=function(e,t,i,r,n){const s=(0,y.gr)(e,t,r,n);if(!s)return(0,y.CN)(x(),t,n),null;const o=new Float64Array(s.length);return(0,v.t)(o,s,i),o}(u,t,h,f,a);if(!m)return null;const _=(0,o.Ge)(M,h),b=function(e,t,i,r,n,s,o){if(null==e)return null;const a=o??new Float32Array(e.length);return(0,y.X4)(e,t,i,r,n,a)?((0,v.b)(a,a,s),a):((0,y.CN)(x(),i,n),null)}(d,u,t,f,a,_,d!==e.normal?d:void 0);if(!b&&d)return null;const C=function(e,t,i,r,n,s,o){if(null==e)return null;const a=o??new Float32Array(e.length);return(0,y.xA)(e,t,i,r,n,a)?((0,v.b)(a,a,s,4),a):((0,y.CN)(x(),i,n),null)}(p,u,t,f,a,_,p!==e.tangent?p:void 0);return!C&&p?null:{position:m,normal:b,tangent:C}}(e,e.vertexSpace,t.origin,i):function({vertexAttributes:e,transform:t,spatialReference:i},{origin:r},n,s){const o=T(i,s,3),a=r||!A(o)?(0,l.C)(E,t?.localMatrix??c.zK):null;a&&C(a,i,s,3);const{position:u,normal:d,tangent:p}=a?w(e,a):e,g=s?.allowBufferReuse,f=g?u:new Float64Array(u.length);let m=u;if(r&&(m=(0,v.a)(f,m,r)),n){const e=(0,h.ze)(L,n);m=(0,v.a)(f,m,e)}return{position:m!==e.position||g?m:m.slice(),normal:d!==e.normal||g?d:d?.slice(),tangent:p!==e.tangent||g?p:p?.slice()}}(e,e.vertexSpace,t.origin,i)}}function S(e,t){return t?.useEllipsoid&&(0,d.B3)(e)?p.Y0:(0,p.lO)(e)}function w(e,t){const i=new Float64Array(e.position.length);(0,v.t)(i,e.position,t);const r=e.normal?new Float32Array(e.normal.length):null,n=e.tangent?new Float32Array(e.tangent.length):null;return r&&e.normal&&(0,y.qs)(e.normal,r,t),n&&e.tangent&&(0,y.KM)(e.tangent,n,t),{position:i,normal:r,tangent:n}}function C(e,t,i,r){const n=T(t,i,r);A(n)||(0,l.hs)(e,e,[n,n,n])}function T(e,t,i){const r=!!(1&i),n=!!(2&i),s=t?.sourceUnit,o=t?.targetUnit;if(!s&&!o)return 1;let a=R(s,e);r||!s||A(a)||(x().warn("source unit conversion not supported"),a=1);let l=1/R(o,e);return n||!o||A(l)||(x().warn("target unit conversion not supported"),l=1),a*l}function A(e){return(0,n.Io)(e,1)}function R(e,t){if(null==e)return 1;const i=(0,s.KX)(t);return 1/(0,s.oU)(i,"meters",e)}const E=(0,c.vt)(),O=(0,c.vt)(),M=(0,a.vt)(),L=(0,u.vt)(),P=(0,c.vt)()},27615(e,t,i){i.d(t,{CK:()=>l,Hq:()=>a,MW:()=>c,TE:()=>h,yJ:()=>u});var r=i(35522),n=i(86738),s=i(95696),o=i(18251);function a(e){return null!=e.origin}function l(e){return a(e.vertexSpace)}function c(e,t){if(!a(e))return null;const[i,r,s]=e.origin;return new n.A({x:i,y:r,z:s,spatialReference:t})}function h(e,t){const{x:i,y:r,z:n,spatialReference:a}=e,l=[i,r,n??0];return"local"===(t?.vertexSpace??function(e){return e.isGeographic||e.isWebMercator?"local":"georeferenced"}(a))?new o.default({origin:l}):new s.A({origin:l})}function u(e,t){return e.type===t.type&&(e.origin===t.origin||null!=e.origin&&null!=t.origin&&(0,r.t2)(e.origin,t.origin))}},6733(e,t,i){i.d(t,{Q:()=>u});var r=i(37585),n=i(48163),s=i(31821),o=i(74333);class a extends o.n{constructor(e,t){super(e,"ivec2",1,(i,r,n)=>i.setUniform2iv(e,t(r,n)))}}var l=i(93588),c=i(9273),h=i(34053);function u(e){const{vertex:t}=e;t.uniforms.add(new c.R("coverageTexture",e=>e.coverageTexture),new a("highlightRenderCellCount",e=>(0,r.hZ)(d,e.horizontalCellCount,e.verticalCellCount)),new a("highlightTextureResolution",({highlightTexture:e})=>(0,r.hZ)(d,e.descriptor.width,e.descriptor.height)),new l.c("highlightLevel",e=>e.highlightLevel)).constants.add("cellSize","int",h.g),e.varyings.add("sUV","vec2"),e.varyings.add("vOutlinePossible","float"),t.code.add(s.H`const ivec2 cellVertices[4] = ivec2[4](ivec2(0,0), ivec2(1,0), ivec2(0,1), ivec2(1,1));`),t.main.add(s.H`int cellIndex = gl_InstanceID;
|
|
390
|
+
int cellX = cellIndex % highlightRenderCellCount[0];
|
|
391
|
+
int cellY = (cellIndex - cellX) / highlightRenderCellCount[0];
|
|
392
|
+
ivec2 cellPos = ivec2(cellX, cellY);
|
|
393
|
+
uvec2 covTexel = texelFetch(coverageTexture, cellPos, 0).rg;
|
|
394
|
+
int channelIndex = (highlightLevel >> 2) & 3;
|
|
395
|
+
uint channelValue = covTexel[channelIndex];
|
|
396
|
+
int highlightIndex = (highlightLevel & 3) << 1;
|
|
397
|
+
bool covered = ((channelValue >> highlightIndex) & 1u) == 1u;
|
|
398
|
+
if (!covered) {
|
|
399
|
+
gl_Position = vec4(0.0);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
vOutlinePossible = (((channelValue >> highlightIndex) & 2u) == 2u) ? 1.0 : 0.0;
|
|
403
|
+
ivec2 iPosInCell = cellVertices[gl_VertexID];
|
|
404
|
+
vec2 sPos = vec2(cellPos * cellSize + iPosInCell * (cellSize));
|
|
405
|
+
vec2 vPos = sPos / vec2(highlightTextureResolution);
|
|
406
|
+
sUV = vPos;
|
|
407
|
+
gl_Position = vec4(2.0 * vPos - vec2(1.0), 0.0, 1.0);`)}const d=(0,n.vt)()},84652(e,t,i){i.d(t,{s:()=>p});var r=i(58083),n=i(9093),s=i(43259),o=i(52587),a=i(77949),l=i(33079),c=i(20304),h=i(44887),u=i(31821),d=i(97102);function p(e,t){const{vertex:i,attributes:n}=e;i.uniforms.add(new c.m("intrinsicWidth",e=>e.width));const{hasScreenSizePerspective:p,spherical:f}=t;p?(e.include(o.Y6,t),(0,o.pM)(i),(0,a.yu)(i,t),i.uniforms.add(new d.S("inverseViewMatrix",(e,t)=>(0,r.B8)(g,(0,r.Tl)(g,t.camera.viewMatrix,e.origin)))),i.code.add(u.H`
|
|
408
|
+
float applyLineSizeScreenSizePerspective(float size, vec3 pos) {
|
|
409
|
+
vec3 worldPos = (inverseViewMatrix * vec4(pos, 1)).xyz;
|
|
410
|
+
vec3 groundUp = ${f?u.H`normalize(worldPos + localOrigin)`:u.H`vec3(0.0, 0.0, 1.0)`};
|
|
411
|
+
float absCosAngle = abs(dot(groundUp, normalize(worldPos - cameraPosition)));
|
|
412
|
+
|
|
413
|
+
return screenSizePerspectiveScaleFloat(size, absCosAngle, length(pos), screenSizePerspective);
|
|
414
|
+
}
|
|
415
|
+
`)):i.code.add(u.H`float applyLineSizeScreenSizePerspective(float size, vec3 pos) {
|
|
416
|
+
return size;
|
|
417
|
+
}`),t.hasVVSize?(n.add("sizeFeatureAttribute","float"),i.uniforms.add(new l.t("vvSizeMinSize",e=>e.vvSize.minSize),new l.t("vvSizeMaxSize",e=>e.vvSize.maxSize),new l.t("vvSizeOffset",e=>e.vvSize.offset),new l.t("vvSizeFactor",e=>e.vvSize.factor),new l.t("vvSizeFallback",e=>e.vvSize.fallback)),i.code.add(u.H`
|
|
418
|
+
float getSize(${(0,u.If)(p,"vec3 pos")}) {
|
|
419
|
+
float size = isnan(sizeFeatureAttribute)
|
|
420
|
+
? vvSizeFallback.x
|
|
421
|
+
: intrinsicWidth * clamp(vvSizeOffset + sizeFeatureAttribute * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).x;
|
|
422
|
+
|
|
423
|
+
return ${(0,u.If)(p,"applyLineSizeScreenSizePerspective(size, pos)","size")};
|
|
424
|
+
}
|
|
425
|
+
`)):(n.add("size","float"),i.code.add(u.H`
|
|
426
|
+
float getSize(${(0,u.If)(p,"vec3 pos")}) {
|
|
427
|
+
float fullSize = intrinsicWidth * size;
|
|
428
|
+
return ${(0,u.If)(p,"applyLineSizeScreenSizePerspective(fullSize, pos)","fullSize")};
|
|
429
|
+
}
|
|
430
|
+
`)),t.hasVVOpacity?(n.add("opacityFeatureAttribute","float"),i.constants.add("vvOpacityNumber","int",8),i.uniforms.add(new h.x("vvOpacityValues",8,e=>e.vvOpacity.values),new h.x("vvOpacityOpacities",8,e=>e.vvOpacity.opacityValues),new c.m("vvOpacityFallback",e=>e.vvOpacity.fallback,{supportsNaN:!0})),i.code.add(u.H`
|
|
431
|
+
float interpolateOpacity(float value) {
|
|
432
|
+
if (value <= vvOpacityValues[0]) {
|
|
433
|
+
return vvOpacityOpacities[0];
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
for (int i = 1; i < vvOpacityNumber; ++i) {
|
|
437
|
+
if (vvOpacityValues[i] >= value) {
|
|
438
|
+
float f = (value - vvOpacityValues[i-1]) / (vvOpacityValues[i] - vvOpacityValues[i-1]);
|
|
439
|
+
return mix(vvOpacityOpacities[i-1], vvOpacityOpacities[i], f);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return vvOpacityOpacities[vvOpacityNumber - 1];
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
vec4 applyOpacity(vec4 color) {
|
|
447
|
+
if (isnan(opacityFeatureAttribute)) {
|
|
448
|
+
// If there is a color vv then it will already have taken care of applying the fallback
|
|
449
|
+
return ${(0,u.If)(t.hasVVColor,"color","vec4(color.rgb, vvOpacityFallback)")};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return vec4(color.rgb, interpolateOpacity(opacityFeatureAttribute));
|
|
453
|
+
}
|
|
454
|
+
`)):i.code.add(u.H`vec4 applyOpacity(vec4 color) {
|
|
455
|
+
return color;
|
|
456
|
+
}`),t.hasVVColor?(e.include(s.A,t),n.add("colorFeatureAttribute","float"),i.code.add(u.H`vec4 getColor() {
|
|
457
|
+
vec4 color = interpolateVVColor(colorFeatureAttribute);
|
|
458
|
+
if (isnan(color.r)) {
|
|
459
|
+
return vec4(0);
|
|
460
|
+
}
|
|
461
|
+
return applyOpacity(color);
|
|
462
|
+
}`)):(n.add("color","vec4"),i.code.add(u.H`vec4 getColor() {
|
|
463
|
+
return applyOpacity(color);
|
|
464
|
+
}`))}const g=(0,n.vt)()},2923(e,t,i){i.d(t,{q:()=>m,h:()=>v});var r=i(27950),n=i(66269),s=i(77949),o=i(71988),a=i(33094),l=i(20304),c=i(31821),h=i(63761),u=i(96095);function d(e){if(null==e)return 1;const t=function(e){return e.pattern.map(t=>Math.round(t*e.pixelRatio))}(e);return Math.floor(t.reduce((e,t)=>e+t))}i(63907),i(21231),i(67171);var p=i(78955),g=i(91829);const f=(0,g.vt)();function m(e,t){if(!t.stippleEnabled)return void e.fragment.code.add(c.H`float getStippleAlpha(float lineWidth) { return 1.0; }
|
|
465
|
+
void discardByStippleAlpha(float stippleAlpha, float threshold) {}
|
|
466
|
+
vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);const i=!(t.draped&&t.stipplePreferContinuous),{vertex:u,fragment:d}=e;t.draped||((0,s.yu)(u,t),u.uniforms.add(new a.U("worldToScreenPerDistanceRatio",({camera:e})=>1/e.perScreenPixelRatio)).code.add(c.H`float computeWorldToScreenRatio(vec3 segmentCenter) {
|
|
467
|
+
float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
|
|
468
|
+
return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
469
|
+
}`)),e.varyings.add("vStippleDistance","float"),e.varyings.add("vStippleDistanceLimits","vec2"),e.varyings.add("vStipplePatternStretch","float"),u.code.add(c.H`
|
|
470
|
+
float discretizeWorldToScreenRatio(float worldToScreenRatio) {
|
|
471
|
+
float step = ${c.H.float(y)};
|
|
472
|
+
|
|
473
|
+
float discreteWorldToScreenRatio = log(worldToScreenRatio);
|
|
474
|
+
discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step;
|
|
475
|
+
discreteWorldToScreenRatio = exp(discreteWorldToScreenRatio);
|
|
476
|
+
return discreteWorldToScreenRatio;
|
|
477
|
+
}
|
|
478
|
+
`),(0,s.Nz)(u),u.code.add(c.H`
|
|
479
|
+
vec2 computeStippleDistanceLimits(float startPseudoScreen, float segmentLengthPseudoScreen, float segmentLengthScreen, float patternLength) {
|
|
480
|
+
|
|
481
|
+
// First check if the segment is long enough to support fully screen space patterns.
|
|
482
|
+
// Force sparse mode for segments that are very large in screen space even if it is not allowed,
|
|
483
|
+
// to avoid imprecision from calculating with large floats.
|
|
484
|
+
if (segmentLengthPseudoScreen >= ${i?"patternLength":"1e4"}) {
|
|
485
|
+
// Round the screen length to get an integer number of pattern repetitions (minimum 1).
|
|
486
|
+
float repetitions = segmentLengthScreen / (patternLength * pixelRatio);
|
|
487
|
+
float flooredRepetitions = max(1.0, floor(repetitions + 0.5));
|
|
488
|
+
float segmentLengthScreenRounded = flooredRepetitions * patternLength;
|
|
489
|
+
|
|
490
|
+
float stretch = repetitions / flooredRepetitions;
|
|
491
|
+
|
|
492
|
+
// We need to impose a lower bound on the stretch factor to prevent the dots from merging together when there is only 1 repetition.
|
|
493
|
+
// 0.75 is the lowest possible stretch value for flooredRepetitions > 1, so it makes sense as lower bound.
|
|
494
|
+
vStipplePatternStretch = max(0.75, stretch);
|
|
495
|
+
|
|
496
|
+
return vec2(0.0, segmentLengthScreenRounded);
|
|
497
|
+
}
|
|
498
|
+
return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
|
|
499
|
+
}
|
|
500
|
+
`),d.uniforms.add(new h.N("stipplePatternTexture",e=>e.stippleTexture),new l.m("stipplePatternPixelSizeInv",e=>1/v(e))),t.stippleOffColorEnabled&&d.uniforms.add(new o.E("stippleOffColor",e=>{return null==(t=e.stippleOffColor)?g.uY:4===t.length?t:(0,p.hZ)(f,t[0],t[1],t[2],1);var t})),e.include(n.m),t.worldSizedImagePattern?(e.varyings.add("vStippleV","float"),e.fragment.include(r.N),d.code.add(c.H`vec4 getStippleColor(out bool isClamped) {
|
|
501
|
+
vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
502
|
+
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
|
|
503
|
+
float u = vStippleDistance * stipplePatternPixelSizeInv;
|
|
504
|
+
float v = vStippleV == -1.0 ? 0.5 : vStippleV;
|
|
505
|
+
return texture(stipplePatternTexture, vec2(u, v));
|
|
506
|
+
}
|
|
507
|
+
vec4 getStippleColor() {
|
|
508
|
+
bool ignored;
|
|
509
|
+
return getStippleColor(ignored);
|
|
510
|
+
}
|
|
511
|
+
float getStippleSDF() {
|
|
512
|
+
vec4 color = getStippleColor();
|
|
513
|
+
return color.a == 0.0 ? -0.5 : 0.5;
|
|
514
|
+
}
|
|
515
|
+
float getStippleAlpha(float lineWidth) {
|
|
516
|
+
return getStippleColor().a;
|
|
517
|
+
}
|
|
518
|
+
vec4 blendStipple(vec4 color, float stippleAlpha) {
|
|
519
|
+
vec4 stippleColor = getStippleColor();
|
|
520
|
+
int mixMode = 1;
|
|
521
|
+
vec3 col = mixExternalColor(color.rgb, vec3(1.0), stippleColor.rgb, mixMode);
|
|
522
|
+
float opacity = mixExternalOpacity(color.a, 1.0, stippleColor.a, mixMode);
|
|
523
|
+
return vec4(col, opacity);
|
|
524
|
+
}`)):d.code.add(c.H`
|
|
525
|
+
float getStippleSDF(out bool isClamped) {
|
|
526
|
+
float stippleDistanceClamped = noPerspectiveRead(clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y));
|
|
527
|
+
float lineSizeInv = noPerspectiveRead(vLineSizeInv);
|
|
528
|
+
|
|
529
|
+
vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
530
|
+
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
|
|
531
|
+
|
|
532
|
+
float u = stippleDistanceClamped * stipplePatternPixelSizeInv * lineSizeInv;
|
|
533
|
+
u = fract(u);
|
|
534
|
+
|
|
535
|
+
float sdf = texture(stipplePatternTexture, vec2(u, 0.5)).r;
|
|
536
|
+
|
|
537
|
+
return (sdf - 0.5) * vStipplePatternStretch + 0.5;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
float getStippleSDF() {
|
|
541
|
+
bool ignored;
|
|
542
|
+
return getStippleSDF(ignored);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
float getStippleAlpha(float lineWidth) {
|
|
546
|
+
bool isClamped;
|
|
547
|
+
float stippleSDF = getStippleSDF(isClamped);
|
|
548
|
+
float antiAliasedResult = clamp(stippleSDF * lineWidth + 0.5, 0.0, 1.0);
|
|
549
|
+
return isClamped ? floor(antiAliasedResult + 0.5) : antiAliasedResult;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
vec4 blendStipple(vec4 color, float stippleAlpha) {
|
|
553
|
+
return ${t.stippleOffColorEnabled?"mix(color, stippleOffColor, stippleAlpha)":"vec4(color.rgb, color.a * stippleAlpha)"};
|
|
554
|
+
}
|
|
555
|
+
`),d.code.add(c.H`
|
|
556
|
+
void discardByStippleAlpha(float stippleAlpha, float threshold) {
|
|
557
|
+
${(0,c.If)(!t.stippleOffColorEnabled,"if (stippleAlpha < threshold) { discard; }")}
|
|
558
|
+
}
|
|
559
|
+
`)}function v(e){const t=e.stipplePattern;return(0,u.sL)(t)?t.length:t?d(t)/t.pixelRatio:1}const y=.4},28974(e,t,i){i.d(t,{r:()=>a});var r=i(91829);i(18845),i(63907);(0,r.CN)(.25,.25,.75,.75),i(21231),i(67171);var n=i(77949),s=i(33094),o=i(31821);function a(e,t){const i=e.vertex,r=t.hasScreenSizePerspective;(0,n.Nz)(i),null==i.uniforms.get("markerScale")&&i.constants.add("markerScale","float",1),i.constants.add("markerSizePerLineWidth","float",10).code.add(o.H`
|
|
560
|
+
float getLineWidth(${(0,o.If)(r,"vec3 pos")}) {
|
|
561
|
+
return max(getSize(${(0,o.If)(r,"pos")}), 1.0) * pixelRatio;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
float getScreenMarkerSize(float lineWidth) {
|
|
565
|
+
return markerScale * markerSizePerLineWidth * lineWidth;
|
|
566
|
+
}
|
|
567
|
+
`),2===t.space&&(i.constants.add("maxSegmentLengthFraction","float",.45),i.uniforms.add(new s.U("perRenderPixelRatio",e=>e.camera.perRenderPixelRatio)),i.code.add(o.H`
|
|
568
|
+
bool areWorldMarkersHidden(vec3 pos, vec3 other) {
|
|
569
|
+
vec3 midPoint = mix(pos, other, 0.5);
|
|
570
|
+
float distanceToCamera = length(midPoint);
|
|
571
|
+
float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5;
|
|
572
|
+
float worldMarkerSize = getScreenMarkerSize(getLineWidth(${(0,o.If)(r,"pos")})) * screenToWorldRatio;
|
|
573
|
+
float segmentLen = length(pos - other);
|
|
574
|
+
return worldMarkerSize > maxSegmentLengthFraction * segmentLen;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
float getWorldMarkerSize(vec3 pos) {
|
|
578
|
+
float distanceToCamera = length(pos);
|
|
579
|
+
float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5;
|
|
580
|
+
return getScreenMarkerSize(getLineWidth(${(0,o.If)(r,"pos")})) * screenToWorldRatio;
|
|
581
|
+
}
|
|
582
|
+
`))}},82094(e,t,i){i.d(t,{Z:()=>r});const r=i(31821).H`vec4(0.0, 0.0, 2.0, 1.0)`},66269(e,t,i){function r(e){e.vertex.code.add("#define noPerspectiveWrite(x, w) (x * w)")}function n(e){e.fragment.code.add("#define noPerspectiveRead(x) (x * gl_FragCoord.w)")}i.d(t,{F:()=>r,m:()=>n})},9273(e,t,i){i.d(t,{R:()=>n});var r=i(74333);class n extends r.n{constructor(e,t){super(e,"usampler2D",1,(i,r,n)=>i.bindTexture(e,t(r,n)))}}},78230(e,t,i){i.d(t,{x:()=>u});var r=i(93687),n=i(15142),s=i(35522),o=i(51850),a=i(82919),l=i(71351),c=i(94008),h=i(620);class u{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(e,t){this.objectToBoundingSphere=e,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new d,this._objectCount=0,t&&(void 0!==t.maximumObjectsPerNode&&(this._maximumObjectsPerNode=t.maximumObjectsPerNode),void 0!==t.maximumDepth&&(this._maximumDepth=t.maximumDepth))}destroy(){this._degenerateObjects.clear(),d.clearPool(),E[0]=null,D.prune(),W.prune()}add(e){const t=Array.from(e);this._grow(t);const i=d.acquire();for(const e of t)++this._objectCount,this._isDegenerate(e)?this._degenerateObjects.add(e):(i.init(this._root),this._add(e,i));d.release(i)}remove(e,t=null){this._objectCount-=e.length;const i=d.acquire();for(const r of e){const e=t??this.objectToBoundingSphere(r);C(e.radius)?(i.init(this._root),f(r,e,i)):this._degenerateObjects.delete(r)}d.release(i),this._shrink()}update(e,t){if(!C(t.radius)&&this._isDegenerate(e))return;const i=function(e){return E[0]=e,E}(e);this.remove(i,t),this.add(i)}forEachAlongRay(e,t,i){const r=(0,l.LV)(e,t);p(this._root,e=>{if(!function(e,t){return _(t.bounds.center,2*-t.halfSize,L),_(t.bounds.center,2*t.halfSize,P),(0,h.O_)(e.origin,e.direction,L,P)}(r,e))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObject(r,e)&&i(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObject(r,e)&&i(e)}),!0})}forEachAlongRayWithVerticalOffset(e,t,i,r){const n=(0,l.LV)(e,t);p(this._root,e=>{if(!function(e,t,i){return _(t.bounds.center,2*-t.halfSize,L),_(t.bounds.center,2*t.halfSize,P),i.applyToMinMax(L,P),(0,h.O_)(e.origin,e.direction,L,P)}(n,e,r))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObjectWithOffset(n,e,r)&&i(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObjectWithOffset(n,e,r)&&i(e)}),!0})}forEach(e){p(this._root,t=>{const i=t.node;return i.terminals.forAll(e),null!==i.residents&&i.residents.forAll(e),!0}),this._degenerateObjects.forEach(e)}forEachDegenerateObject(e){this._degenerateObjects.forEach(e)}findClosest(e,t,i,r=()=>!0,n=1/0){let o=1/0,l=1/0,c=null;const h=S(e,t),u=s=>{if(--n,!r(s))return;const h=this.objectToBoundingSphere(s);if(!(0,a.m7)(i,h))return;const u=w(e,t,h.center),d=u-h.radius,p=u+h.radius;d<o&&(o=d,l=p,c=s)};return g(this._root,r=>{if(n<=0||!(0,a.m7)(i,r.bounds))return!1;if((0,s.hs)(M,h,r.halfSize),(0,s.WQ)(M,M,r.bounds.center),w(e,t,M)>l)return!1;const o=r.node;return o.terminals.forAll(e=>u(e)),null!==o.residents&&o.residents.forAll(e=>u(e)),!0},e,t),c}forEachInDepthRange(e,t,i,r,n,o,l){let c=-1/0,h=1/0;const u={setRange:e=>{1===i?(c=Math.max(c,e.near),h=Math.min(h,e.far)):(c=Math.max(c,-e.far),h=Math.min(h,-e.near))}};u.setRange(r);const d=w(t,i,e),p=S(t,i),f=S(t,-i),m=e=>{if(!l(e))return;const r=this.objectToBoundingSphere(e),s=w(t,i,r.center)-d,p=s-r.radius,g=s+r.radius;p>h||g<c||!(0,a.m7)(o,r)||n(e,u)};g(this._root,e=>{if(!(0,a.m7)(o,e.bounds))return!1;if((0,s.hs)(M,p,e.halfSize),(0,s.WQ)(M,M,e.bounds.center),w(t,i,M)-d>h)return!1;if((0,s.hs)(M,f,e.halfSize),(0,s.WQ)(M,M,e.bounds.center),w(t,i,M)-d<c)return!1;const r=e.node;return r.terminals.forAll(e=>m(e)),null!==r.residents&&r.residents.forAll(e=>m(e)),!0},t,i)}forEachNode(e){p(this._root,t=>e(t.node,t.bounds,t.halfSize,t.depth))}forEachNeighbor(e,t){const i=t.radius,r=t.center,n=t=>{const n=this.objectToBoundingSphere(t),o=n.radius,a=i+o;return!((0,s.hG)(n.center,r)-a*a<=0)||e(t)};let o=!0;const a=e=>{o&&(o=n(e))};p(this._root,e=>{const t=e.bounds.radius,n=i+t;if((0,s.hG)(e.bounds.center,r)-n*n>0)return!1;const l=e.node;return l.terminals.forAll(a),o&&null!==l.residents&&l.residents.forAll(a),o}),o&&this.forEachDegenerateObject(a)}_intersectsObject(e,t){const i=this.objectToBoundingSphere(t);return!(i.radius>0)||i.intersectRay(e)}_intersectsObjectWithOffset(e,t,i){const r=this.objectToBoundingSphere(t);return!(r.radius>0)||i.applyToBoundingSphere(r).intersectRay(e)}_add(e,t){t.advanceTo(this.objectToBoundingSphere(e))?t.node.terminals.push(e):(t.node.residents.push(e),t.node.residents.length>this._maximumObjectsPerNode&&t.depth<this._maximumDepth&&this._split(t))}_split(e){const t=e.node.residents;e.node.residents=null;for(let i=0;i<t.length;i++){const r=d.acquire().init(e);this._add(t.at(i),r),d.release(r)}}_grow(e){if(b(e,e=>this.objectToBoundingSphere(e),I),C(I.radius)&&!this._fitsInsideTree(I))if(v(this._root.node))this._root.bounds.copyFrom(I),this._root.halfSize=1.25*this._root.bounds.radius,this._root.updateBoundsRadiusFromHalfSize();else{const e=this._rootBoundsForRootAsSubNode(I);this._placingRootViolatesMaxDepth(e)?this._rebuildTree(I,e):this._growRootAsSubNode(e),d.release(e)}}_rebuildTree(e,t){F.center=t.bounds.center,F.radius=t.halfSize,b([e,F],e=>e,z);const i=d.acquire().init(this._root);this._root.initFrom(null,z,z.radius),this._root.increaseHalfSize(1.25),p(i,e=>(this.add(e.node.terminals.data),null!==e.node.residents&&this.add(e.node.residents.data),!0)),d.release(i)}_placingRootViolatesMaxDepth(e){const t=Math.log(e.halfSize/this._root.halfSize)*Math.LOG2E;let i=0;return p(this._root,e=>(i=Math.max(i,e.depth),i+t<=this._maximumDepth)),i+t>this._maximumDepth}_rootBoundsForRootAsSubNode(e){const t=e.radius,i=e.center;let r=-1/0;const n=this._root.bounds.center,s=this._root.halfSize;for(let e=0;e<3;e++){const o=n[e]-s-(i[e]-t),a=i[e]+t-(n[e]+s),l=Math.max(0,Math.ceil(o/(2*s))),c=Math.max(0,Math.ceil(a/(2*s)))+1,h=2**Math.ceil(Math.log(l+c)*Math.LOG2E);r=Math.max(r,h),N[e].min=l,N[e].max=c}for(let e=0;e<3;e++){let t=N[e].min,i=N[e].max;const o=(r-(t+i))/2;t+=Math.ceil(o),i+=Math.floor(o);const a=n[e]-s-t*s*2;O.center[e]=a+(i+t)*s}const o=r*s;return O.radius=o*R,d.acquire().initFrom(null,O,o,0)}_growRootAsSubNode(e){const t=this._root.node;I.center=this._root.bounds.center,I.radius=this._root.halfSize,this._root.init(e),e.advanceTo(I,null,!0),e.node.children=t.children,e.node.residents=t.residents,e.node.terminals=t.terminals}_shrink(){for(;;){const e=this._findShrinkIndex();if(-1===e)break;this._root.advance(e),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let e=null;const t=this._root.node.children;let i=0,r=0;for(;r<t.length&&null==e;)i=r++,e=t[i];for(;r<t.length;)if(t[r++])return-1;return i}_isDegenerate(e){return!C(this.objectToBoundingSphere(e).radius)}_fitsInsideTree(e){const t=this._root.bounds,i=this._root.halfSize;return e.radius<=i&&e.center[0]>=t.center[0]-i&&e.center[0]<=t.center[0]+i&&e.center[1]>=t.center[1]-i&&e.center[1]<=t.center[1]+i&&e.center[2]>=t.center[2]-i&&e.center[2]<=t.center[2]+i}_nodeToJSON(e){const t=e.children.map(e=>e?this._nodeToJSON(e):null),i=e.residents?.map(e=>this.objectToBoundingSphere(e)),r=e.terminals?.map(e=>this.objectToBoundingSphere(e));return{children:t,residents:i,terminals:r}}}class d{constructor(){this.bounds=new c.iy,this.halfSize=0,this.initFrom(null,null,0,0)}init(e){return this.initFrom(e.node,e.bounds,e.halfSize,e.depth)}initFrom(e,t,i,r=this.depth){return this.node=null!=e?e:d.createEmptyNode(),t&&this.bounds.copyFrom(t),this.halfSize=i,this.depth=r,this}increaseHalfSize(e){this.halfSize*=e,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds.radius=this.halfSize*R}advance(e){let t=this.node.children[e];t||(t=d.createEmptyNode(),this.node.children[e]=t),this.node=t,this.halfSize/=2,this.depth++;const i=T[e];return this.bounds.center[0]+=i[0]*this.halfSize,this.bounds.center[1]+=i[1]*this.halfSize,this.bounds.center[2]+=i[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(e,t,i=!1){for(;;){if(this.isTerminalFor(e))return t?.(this,-1),!0;if(this.isLeaf()){if(!i)return t?.(this,-1),!1;this.node.residents=null}const r=this._childIndex(e);t?.(this,r),this.advance(r)}}isLeaf(){return null!=this.node.residents}isTerminalFor(e){return e.radius>this.halfSize/2}_childIndex(e){const t=this.bounds.center;return(t[0]<e.center[0]?1:0)+(t[1]<e.center[1]?2:0)+(t[2]<e.center[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new n.A({shrink:!0}),residents:new n.A({shrink:!0})}}static{this._pool=new r.A(()=>new d)}static acquire(){return d._pool.acquire()}static release(e){d._pool.release(e)}static clearPool(){d._pool.prune()}}function p(e,t){let i=d.acquire().init(e);const r=[i];for(;0!==r.length;){if(i=r.pop(),t(i)&&!i.isLeaf())for(let e=0;e<i.node.children.length;e++)i.node.children[e]&&r.push(d.acquire().init(i).advance(e));d.release(i)}}function g(e,t,i,r=1){let n=d.acquire().init(e);const s=[n];for(function(e,t,i){if(!W.length)for(let e=0;e<8;++e)W.push({index:0,distance:0});for(let i=0;i<8;++i){const r=T[i];W.data[i].index=i,W.data[i].distance=w(e,t,r)}W.sort((e,t)=>e.distance-t.distance);for(let e=0;e<8;++e)i[e]=W.data[e].index}(i,r,V);0!==s.length;){if(n=s.pop(),t(n)&&!n.isLeaf())for(let e=7;e>=0;--e){const t=V[e];n.node.children[t]&&s.push(d.acquire().init(n).advance(t))}d.release(n)}}function f(e,t,i){D.clear();const r=i.advanceTo(t,(e,t)=>{D.push(e.node),D.push(t)})?i.node.terminals:i.node.residents;if(r.removeUnordered(e),0===r.length)for(let e=D.length-2;e>=0&&m(D.data[e],D.data[e+1]);e-=2);}function m(e,t){return t>=0&&(e.children[t]=null),!!v(e)&&(null===e.residents&&(e.residents=new n.A({shrink:!0})),!0)}function v(e){if(0!==e.terminals.length)return!1;if(null!==e.residents)return 0===e.residents.length;for(let t=0;t<e.children.length;t++)if(e.children[t])return!1;return!0}function y(e,t){e[0]=Math.min(e[0],t.center[0]-t.radius),e[1]=Math.min(e[1],t.center[1]-t.radius),e[2]=Math.min(e[2],t.center[2]-t.radius)}function x(e,t){e[0]=Math.max(e[0],t.center[0]+t.radius),e[1]=Math.max(e[1],t.center[1]+t.radius),e[2]=Math.max(e[2],t.center[2]+t.radius)}function _(e,t,i){i[0]=e[0]+t,i[1]=e[1]+t,i[2]=e[2]+t}function b(e,t,i){L[0]=1/0,L[1]=1/0,L[2]=1/0,P[0]=-1/0,P[1]=-1/0,P[2]=-1/0;for(const i of e){const e=t(i);C(e.radius)&&(y(L,e),x(P,e))}(0,s.Cc)(i.center,L,P,.5),i.radius=Math.max(P[0]-L[0],P[1]-L[1],P[2]-L[2])/2}function S(e,t){let i,r=1/0;for(let n=0;n<8;++n){const s=w(e,t,A[n]);s<r&&(r=s,i=A[n])}return i}function w(e,t,i){return t*(e[0]*i[0]+e[1]*i[1]+e[2]*i[2])}function C(e){return!isNaN(e)&&e!==-1/0&&e!==1/0&&e>0}const T=[(0,o.fA)(-1,-1,-1),(0,o.fA)(1,-1,-1),(0,o.fA)(-1,1,-1),(0,o.fA)(1,1,-1),(0,o.fA)(-1,-1,1),(0,o.fA)(1,-1,1),(0,o.fA)(-1,1,1),(0,o.fA)(1,1,1)],A=[(0,o.fA)(-1,-1,-1),(0,o.fA)(-1,-1,1),(0,o.fA)(-1,1,-1),(0,o.fA)(-1,1,1),(0,o.fA)(1,-1,-1),(0,o.fA)(1,-1,1),(0,o.fA)(1,1,-1),(0,o.fA)(1,1,1)],R=Math.sqrt(3),E=[null],O=new c.iy,M=(0,o.vt)(),L=(0,o.vt)(),P=(0,o.vt)(),D=new n.A,I=new c.iy,F=new c.iy,z=new c.iy,N=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],W=new n.A,V=[0,0,0,0,0,0,0,0]},96095(e,t,i){i.d(t,{sL:()=>r}),i(13069);function r(e){return null!=e&&"image"in e}},54073(e,t,i){i.d(t,{Q:()=>u});var r=i(37585),n=i(48163),s=i(78659);const o=(0,s.Kp)(1),a=(0,s.Kp)(1);var l=i(47286),c=i(20304),h=i(31821);function u(e,t){const{hasAnimation:i,animation:n}=t;if(!i)return;const{attributes:s,varyings:u,vertex:p,fragment:g}=e;s.add("timeStamps","vec4"),u.add("vTimeStamp","float"),u.add("vFirstTime","float"),u.add("vLastTime","float"),u.add("vTransitionType","float"),p.main.add(h.H`vTimeStamp = timeStamps.x;
|
|
583
|
+
vFirstTime = timeStamps.y;
|
|
584
|
+
vLastTime = timeStamps.z;
|
|
585
|
+
vTransitionType = timeStamps.w;`),3===n&&g.constants.add("decayRate","float",2.3),g.code.add(h.H`
|
|
586
|
+
float getTrailOpacity(float x) {
|
|
587
|
+
if (x < 0.0) {
|
|
588
|
+
return 0.0;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
${function(e){switch(e){case 2:return"return x >= 0.0 && x <= 1.0 ? 1.0 : 0.0;";case 3:return"float cutOff = exp(-decayRate);\n return (exp(-decayRate * x) - cutOff) / (1.0 - cutOff);";default:return"return 1.0;"}}(n)}
|
|
592
|
+
}`),g.uniforms.add(new c.m("timeElapsed",e=>e.timeElapsed),new c.m("trailLength",e=>e.trailLength),new c.m("speed",e=>e.animationSpeed),new l.G("startEndTime",e=>(0,r.hZ)(d,e.startTime,e.endTime))),g.constants.add("fadeInTime","float",a),g.constants.add("fadeOutTime","float",o),g.constants.add("incomingTransition","int",0),g.constants.add("outgoingTransition","int",2),g.code.add(h.H`float fadeIn(float x) {
|
|
593
|
+
return smoothstep(0.0, fadeInTime, x);
|
|
594
|
+
}
|
|
595
|
+
float fadeOut(float x) {
|
|
596
|
+
return isinf(fadeOutTime) ? 1.0 : smoothstep(fadeOutTime, 0.0, x);
|
|
597
|
+
}
|
|
598
|
+
void updateAlphaIf(inout float alpha, bool condition, float newAlpha) {
|
|
599
|
+
alpha = condition ? min(alpha, newAlpha) : alpha;
|
|
600
|
+
}
|
|
601
|
+
vec4 animate(vec4 color) {
|
|
602
|
+
float startTime = startEndTime[0];
|
|
603
|
+
float endTime = startEndTime[1];
|
|
604
|
+
float totalTime = vLastTime - vFirstTime;
|
|
605
|
+
float actualFadeOutTime = min(fadeOutTime * speed, trailLength);
|
|
606
|
+
float longStreamlineThreshold = (fadeInTime + 1.0) * speed + actualFadeOutTime;
|
|
607
|
+
bool longStreamline = totalTime > longStreamlineThreshold;
|
|
608
|
+
float totalTimeWithFadeOut = longStreamline && actualFadeOutTime != trailLength ? totalTime : totalTime + actualFadeOutTime;
|
|
609
|
+
float fadeOutStartTime = longStreamline ? totalTime - actualFadeOutTime : totalTime;
|
|
610
|
+
float originTime = -vFirstTime;
|
|
611
|
+
float actualEndTime = int(vTransitionType) == outgoingTransition ? min(endTime, startTime + vLastTime / speed) : endTime;
|
|
612
|
+
vec4 animatedColor = color;
|
|
613
|
+
if (speed == 0.0) {
|
|
614
|
+
float alpha = getTrailOpacity((totalTimeWithFadeOut - (vTimeStamp - vFirstTime)) / trailLength);
|
|
615
|
+
updateAlphaIf(alpha, !isinf(actualEndTime), fadeOut(timeElapsed - actualEndTime));
|
|
616
|
+
updateAlphaIf(alpha, true, fadeIn(timeElapsed - startTime));
|
|
617
|
+
animatedColor.a *= alpha;
|
|
618
|
+
return animatedColor;
|
|
619
|
+
}
|
|
620
|
+
float relativeStartTime = mod(startTime, totalTimeWithFadeOut);
|
|
621
|
+
float shiftedTimeElapsed = timeElapsed - relativeStartTime + originTime;
|
|
622
|
+
float headRelativeToFirst = mod(shiftedTimeElapsed * speed, totalTimeWithFadeOut);
|
|
623
|
+
float vRelativeToHead = headRelativeToFirst - originTime - vTimeStamp;
|
|
624
|
+
float vAbsoluteTime = timeElapsed - vRelativeToHead / speed;
|
|
625
|
+
if (startTime > timeElapsed) {
|
|
626
|
+
return vec4(0.0);
|
|
627
|
+
}
|
|
628
|
+
float alpha = getTrailOpacity(vRelativeToHead / trailLength);
|
|
629
|
+
updateAlphaIf(alpha, true, fadeIn(timeElapsed - startTime));
|
|
630
|
+
updateAlphaIf(alpha, !isinf(actualEndTime), fadeOut(timeElapsed - actualEndTime));
|
|
631
|
+
updateAlphaIf(alpha, int(vTransitionType) != incomingTransition, step(startTime, vAbsoluteTime));
|
|
632
|
+
updateAlphaIf(alpha, headRelativeToFirst > fadeOutStartTime, fadeOut((headRelativeToFirst - fadeOutStartTime) / speed));
|
|
633
|
+
alpha *= fadeIn(vTimeStamp - vFirstTime);
|
|
634
|
+
animatedColor.a *= alpha;
|
|
635
|
+
return animatedColor;
|
|
636
|
+
}`)}const d=(0,n.vt)()},92359(e,t,i){i.d(t,{nu:()=>u,W6:()=>c}),i(4576),i(71511),i(44208),i(53966);var r=i(17676),n=(i(36708),i(44794),i(78659)),s=i(5482),o=i(69622),a=i(91429);let l=class extends o.A{constructor(){super(...arguments),this.SCHEDULER_LOG_SLOW_TASKS=!1,this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES=!1}};(0,s.Cg)([(0,a.MZ)()],l.prototype,"SCHEDULER_LOG_SLOW_TASKS",void 0),(0,s.Cg)([(0,a.MZ)()],l.prototype,"FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES",void 0),l=(0,s.Cg)([(0,a.$K)("esri.views.support.debugFlags")],l),new l,i(49186),Symbol("Yield");const c={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S:"I3S",LYR3D:"Lyr3D",TILES3D:"3DTiles",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OCCLUSION_QUERY:"occlusion query",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",VOLUME_MEASUREMENT:"volume measurement",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",GAUSSIAN_SPLAT_SORTING:"gaussian splat sorting",GAUSSIAN_SPLAT_TEXTURE_ATLAS:"gaussian splat texture atlas",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1};new Map([[c.RESOURCE_CONTROLLER_IMMEDIATE,0],[c.RESOURCE_CONTROLLER,4],[c.SLIDE,0],[c.STREAM_DATA_LOADER,0],[c.ELEVATION_QUERY,0],[c.TERRAIN_SURFACE,1],[c.SURFACE_GEOMETRY_UPDATES,1],[c.LOD_RENDERER,2],[c.GRAPHICS_CORE,2],[c.I3S,2],[c.LYR3D,2],[c.TILES3D,3],[c.POINT_CLOUD_LAYER,2],[c.FEATURE_TILE_FETCHER,2],[c.STREAM_CONTROLLER,2],[c.CLOUDS_GENERATOR,2],[c.OCCLUSION_QUERY,2],[c.OVERLAY,4],[c.OVERLAY_RENDERER,4],[c.STAGE,4],[c.GRAPHICS_DECONFLICTOR,4],[c.FILTER_VISIBILITY,4],[c.SCALE_VISIBILITY,4],[c.FRUSTUM_VISIBILITY,4],[c.POINT_OF_INTEREST_FREQUENT,6],[c.POINT_OF_INTEREST_INFREQUENT,30],[c.LABELER,8],[c.FEATURE_QUERY_ENGINE,8],[c.FEATURE_TILE_TREE,16],[c.FEATURE_TILE_TREE_ACTIVE,0],[c.ELEVATION_ALIGNMENT,12],[c.ELEVATION_ALIGNMENT_SCENE,14],[c.TEXT_TEXTURE_ATLAS,12],[c.TEXTURE_UNLOAD,12],[c.LINE_OF_SIGHT_TOOL,16],[c.LINE_OF_SIGHT_TOOL_INTERACTIVE,0],[c.VOLUME_MEASUREMENT,4],[c.SNAPPING,0],[c.SHADOW_ACCUMULATOR,30],[c.FLOW_GENERATOR,12],[c.GAUSSIAN_SPLAT_SORTING,2],[c.GAUSSIAN_SPLAT_TEXTURE_ATLAS,12],[c.MAPVIEW_FETCH_QUEUE,0],[c.MAPVIEW_LAYERVIEW_UPDATE,2],[c.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,0]]),(0,n.l5)(6.5),(0,n.l5)(1),(0,n.l5)(30),(0,n.l5)(1e3/30),(0,n.l5)(100);const h=new class{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}};h.enabled=!1;const u=new class{remove(){}processQueue(){}schedule(e,t,i){try{if((0,r.G4)(t)){const e=(0,r.NK)();return i?Promise.resolve(i(e)):Promise.reject(e)}return(0,r.z7)(e(h))}catch(e){return Promise.reject(e)}}reschedule(e,t,i){return this.schedule(e,t,i)}async scheduleGenerator(e,t,i){if((0,r.G4)(t)){const e=(0,r.NK)();if(i)return i(e);throw e}const n=e(h);for(;;){const e=n.next(h),s=(0,r.$X)(e)?await e:e;if((0,r.G4)(t)){const e=(0,r.NK)();if(i){const t=i(e),s=n.return(null);return(0,r.$X)(s)&&await(0,r.QZ)(s),t}const t=n.throw(e);throw(0,r.$X)(t)&&await(0,r.QZ)(t),e}if(s.done)return s.value}}}}}]);
|