@arcgis/core 5.0.0-next.37 → 5.0.0-next.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/Color.js +1 -1
  2. package/analysis/DimensionSimpleStyle.js +1 -1
  3. package/analysis/ElevationProfileAnalysis.js +1 -1
  4. package/applications/Components/testUtils.d.ts +4 -0
  5. package/applications/Components/testUtils.js +5 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/02a65563779b4c64b2cf.js +1 -0
  8. package/assets/esri/core/workers/chunks/{328106e181e5957ceaa5.js → 09ac2bbc7327e6e6b5a2.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +1 -0
  10. package/assets/esri/core/workers/chunks/{b96af22ec1470905e4fb.js → 1c857191e5898aba50fe.js} +1 -1
  11. package/assets/esri/core/workers/chunks/2795e491f803654413d2.js +1 -0
  12. package/assets/esri/core/workers/chunks/{3904f8732c9953cb177d.js → 28b235b56a83c498d73f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/36d15c35fbbd4dedd5cb.js +1 -0
  14. package/assets/esri/core/workers/chunks/48f805929fe6241952f5.js +1 -0
  15. package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +1 -0
  16. package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +1 -0
  17. package/assets/esri/core/workers/chunks/613cbac9cb925cd20b48.js +1 -0
  18. package/assets/esri/core/workers/chunks/{febce0d80f019dc2a427.js → 646f58b69d2354f1ef27.js} +1 -1
  19. package/assets/esri/core/workers/chunks/7eab0bb42f9f062522ef.js +1 -0
  20. package/assets/esri/core/workers/chunks/{5e34a183420e7007a989.js → 8e8d5422f57269d8c8d2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/9100330ed4b4437c819d.js +1 -0
  22. package/assets/esri/core/workers/chunks/95cb062cae4c31c07124.js +1 -0
  23. package/assets/esri/core/workers/chunks/{ce8fc1ca229d53a4b68d.js → 96f798ee286b59396131.js} +50 -50
  24. package/assets/esri/core/workers/chunks/{e9bc3c6482ba778c9349.js → 9d95f38da21f97214f83.js} +1 -1
  25. package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +1 -0
  26. package/assets/esri/core/workers/chunks/{a8a017d7969562d21d2e.js → b48aceaeefa07214e430.js} +1 -1
  27. package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +1 -0
  28. package/assets/esri/core/workers/chunks/{d2a6f035022a3f060ffa.js → c320a29df40e85fb4a8e.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{52c8687b473c9953c2f2.js → d9958654c6438f28237b.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{27ec791318e81285c222.js → dca6a61fd239cf1ff90c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/e66bcdfd75e0113d1cec.js +1 -0
  32. package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +1 -0
  33. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +1 -0
  34. package/chunks/ChapmanAtmosphere.glsl.js +20 -20
  35. package/chunks/GaussianSplat.glsl.js +2 -2
  36. package/chunks/HUDMaterial.glsl.js +38 -38
  37. package/chunks/Haze.glsl.js +23 -23
  38. package/config.js +1 -1
  39. package/core/Collection.js +1 -1
  40. package/core/CollectionFlattener.js +1 -1
  41. package/core/arrayUtils.js +1 -1
  42. package/geometry/support/buffer/BufferView.js +1 -1
  43. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  44. package/interfaces.d.ts +74 -0
  45. package/kernel.js +1 -1
  46. package/layers/ImageryTileLayer.js +1 -1
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/support/FeatureReductionCluster.js +1 -1
  49. package/layers/support/LabelClass.js +1 -1
  50. package/package.json +3 -3
  51. package/renderers/FlowRenderer.js +1 -1
  52. package/renderers/HeatmapRenderer.js +1 -1
  53. package/renderers/PieChartRenderer.js +1 -1
  54. package/rest/route/utils.js +1 -1
  55. package/rest/support/PointBarrier.js +1 -1
  56. package/rest/support/Stop.js +1 -1
  57. package/support/revision.js +1 -1
  58. package/support/tests/meshUtils.js +5 -0
  59. package/support/tests/serviceMockDependencies.js +5 -0
  60. package/support/tests/setupServiceMocksMesh.js +5 -0
  61. package/symbols/Font.js +1 -1
  62. package/symbols/IconSymbol3DLayer.js +1 -1
  63. package/symbols/LineSymbol.js +1 -1
  64. package/symbols/LineSymbol3DLayer.js +1 -1
  65. package/symbols/MarkerSymbol.js +1 -1
  66. package/symbols/PictureFillSymbol.js +1 -1
  67. package/symbols/PictureMarkerSymbol.js +1 -1
  68. package/symbols/TextSymbol.js +1 -1
  69. package/symbols/TextSymbol3DLayer.js +1 -1
  70. package/symbols/callouts/LineCallout3D.js +1 -1
  71. package/symbols/edges/Edges3D.js +1 -1
  72. package/symbols/support/Symbol3DIconOutline.js +1 -1
  73. package/symbols/support/Symbol3DOutline.js +1 -1
  74. package/symbols/support/Symbol3DVerticalOffset.js +1 -1
  75. package/views/2d/layers/RouteLayerView2D.js +1 -1
  76. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  77. package/views/2d/layers/support/util.js +1 -1
  78. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  79. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  80. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  81. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  82. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  83. package/views/3d/camera/intersectionUtils.js +1 -1
  84. package/views/3d/environment/ChapmanApproximation.glsl.js +8 -8
  85. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  86. package/views/3d/environment/ChapmanRaymarching.glsl.js +16 -15
  87. package/views/3d/layers/FlowSubView3D.js +1 -1
  88. package/views/3d/layers/PointCloudWorker.js +1 -1
  89. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  90. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  91. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  92. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  93. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  95. package/views/3d/state/NearFarHeuristic.js +1 -1
  96. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  97. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  98. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  99. package/views/3d/terrain/OverlayRenderer.js +1 -1
  100. package/views/3d/terrain/TerrainSurface.js +1 -1
  101. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +4 -4
  102. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +1 -1
  103. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +12 -12
  104. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +8 -8
  105. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  106. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  107. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  108. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  109. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +5 -0
  110. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  111. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  112. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayoutField.js +5 -0
  113. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +5 -0
  114. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +5 -0
  115. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +5 -0
  116. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  117. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  118. package/views/BreakpointsOwner.js +1 -1
  119. package/views/ToolViewManager.js +1 -1
  120. package/views/View.js +1 -1
  121. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  122. package/views/draw/support/Reshape.js +1 -1
  123. package/views/interactive/InteractiveToolBase.js +1 -1
  124. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  125. package/views/layers/GroupLayerView.js +1 -1
  126. package/views/support/Scheduler.js +1 -1
  127. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  128. package/widgets/ScaleRangeSlider.js +1 -1
  129. package/widgets/Slider.js +1 -1
  130. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  131. package/assets/esri/core/workers/chunks/1d877c3c96c40eab906c.js +0 -1
  132. package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +0 -1
  133. package/assets/esri/core/workers/chunks/42f3e83826b3a3dedaaa.js +0 -1
  134. package/assets/esri/core/workers/chunks/44471962c30344dfafdf.js +0 -1
  135. package/assets/esri/core/workers/chunks/8ca83a9af9d24b192128.js +0 -1
  136. package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +0 -1
  137. package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +0 -1
  138. package/assets/esri/core/workers/chunks/ad3a4d139613b4c0e0b4.js +0 -1
  139. package/assets/esri/core/workers/chunks/c1c77a00f639eaee9c0d.js +0 -1
  140. package/assets/esri/core/workers/chunks/c5967133f3ba34a883f8.js +0 -1
  141. package/assets/esri/core/workers/chunks/c8d2cce4a426c72ab173.js +0 -1
  142. package/assets/esri/core/workers/chunks/e0a74250d22fa1d7dc18.js +0 -1
  143. package/assets/esri/core/workers/chunks/e3be67c762af672ec602.js +0 -1
  144. package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +0 -1
  145. package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +0 -1
  146. package/assets/esri/core/workers/chunks/f919f0db9f9ec0c649b9.js +0 -1
  147. package/views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js +0 -26
@@ -2,6 +2,6 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ZEROS as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as n}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{EvaluateSceneLighting as a,addAmbientBoostFactor as i,addLightingGlobalFactor as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{NormalUtils as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{terrainDepthTest as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ComputeCovariance as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/ComputeCovariance.glsl.js";import{FastApproximateTrigonometry as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js";import{GaussianSplatUnpacking as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import{QuaternionToRotationMatrix as d}from"../views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import{Float2BindUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float2PassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float3BindUniform as p}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{Float3PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as f,If as h}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{IntegerBindUniform as x}from"../views/3d/webgl-engine/core/shaderModules/IntegerBindUniform.js";import{IntegerPassUniform as w}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{Matrix4BindUniform as y}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintPassUniform as b}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{getGaussianSplatAlphaCutoffValue as P}from"../views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";import{NoParameters as D}from"../views/webgl/NoParameters.js";import{ShaderBuilder as C}from"../views/webgl/ShaderBuilder.js";class S extends D{constructor(){super(...arguments),this.totalGaussians=-1,this.focalLength=-1,this.minSplatRadius=-1,this.tanFov=e,this.cameraDelta=n,this.cameraPos8k=n}}function F(e){const n=new C;n.varyings.add("vColor","vec4"),n.varyings.add("conicOpacity","vec4"),n.varyings.add("depth","float"),n.varyings.add("gaussianCenterScreenPos","vec2"),n.varyings.add("fragScreenPos","vec2"),n.varyings.add("offsetFromCenter","vec2"),n.outputs.add("fragColor","vec4",0),n.vertex.uniforms.add(new b("splatOrderTexture",e=>e.splatOrder),new b("splatFadingTexture",e=>e.splatFading),new b("splatAtlasTexture",e=>e.splatAtlas),new w("numSplats",e=>e.totalGaussians),new m("focalLength",e=>e.focalLength),new m("minSplatRadius",e=>e.minSplatRadius),new g("tanFov",e=>e.tanFov),new v("cameraDelta",e=>e.cameraDelta),new v("cameraPos8k",e=>e.cameraPos8k),new x("fullWidth",({camera:e})=>e.viewport[2]),new x("fullHeight",({camera:e})=>e.viewport[3]),new y("proj",e=>e.camera.projectionMatrix),new y("view",e=>e.camera.viewMatrix),new u("nearFar",e=>e.camera.nearFar),new p("cameraPosition",e=>e.camera.eye)),n.vertex.include(l),n.vertex.include(d),n.vertex.include(s),n.vertex.include(c),n.vertex.include(a,e),n.include(o,e),i(n.vertex),t(n.vertex),n.include(r,e);const D=e.depthPass,S=P(e.alphaCutoff),F=Math.log(S),T=-2*F;return n.vertex.code.add(f`float ndcToPixel(float ndcCoord, float screenSize) {
5
+ import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{EvaluateSceneLighting as a,addAmbientBoostFactor as i,addLightingGlobalFactor as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{NormalUtils as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{terrainDepthTest as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ComputeCovariance as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/ComputeCovariance.glsl.js";import{GaussianSplatUnpackingPassParameters as c,GaussianSplatUnpacking as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import{QuaternionToRotationMatrix as d}from"../views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import{Float2BindUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float2PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float3BindUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{FloatPassUniform as p}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as m,If as h}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{IntegerPassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{Matrix4BindUniform as x}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintPassUniform as w}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{getGaussianSplatAlphaCutoffValue as y}from"../views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";import{ShaderBuilder as b}from"../views/webgl/ShaderBuilder.js";class P extends c{constructor(){super(...arguments),this.totalGaussians=-1,this.focalLength=-1,this.minSplatRadius=-1,this.tanFov=n()}}function D(n){const c=new b;c.varyings.add("vColor","vec4"),c.varyings.add("conicOpacity","vec4"),c.varyings.add("depth","float"),c.varyings.add("gaussianCenterScreenPos","vec2"),c.varyings.add("fragScreenPos","vec2"),c.varyings.add("offsetFromCenter","vec2"),c.outputs.add("fragColor","vec4",0),c.vertex.uniforms.add(new w("splatOrderTexture",e=>e.splatOrder),new w("splatFadingTexture",e=>e.splatFading),new w("splatAtlasTexture",e=>e.splatAtlas),new f("numSplats",e=>e.totalGaussians),new p("focalLength",e=>e.focalLength),new p("minSplatRadius",e=>e.minSplatRadius),new v("tanFov",e=>e.tanFov),new u("screenSize",({camera:n})=>e(C,n.fullWidth,n.fullHeight)),new x("proj",e=>e.camera.projectionMatrix),new x("view",e=>e.camera.viewMatrix),new u("nearFar",e=>e.camera.nearFar),new g("cameraPosition",e=>e.camera.eye)),c.vertex.include(l),c.vertex.include(d),c.vertex.include(s),c.vertex.include(a,n),c.include(r,n),i(c.vertex),t(c.vertex),c.include(o,n);const P=n.depthPass,D=y(n.alphaCutoff),S=Math.log(D),F=-2*S;return c.vertex.code.add(m`vec2 ndcToPixel(vec2 ndcCoord, vec2 screenSize) {
6
6
  return ((ndcCoord + 1.0) * screenSize - 1.0) * 0.5;
7
- }`),n.vertex.main.add(`\n uint instanceID = uint(gl_InstanceID);\n\n // Transform the instanceID into 2D coordinates\n uint orderTextureWidth = uint(textureSize(splatOrderTexture, 0).x);\n uint x = instanceID % orderTextureWidth;\n uint y = instanceID / orderTextureWidth;\n\n // Fetch the index of the remaining frontmost Gaussian\n uint gaussianIndex = texelFetch(splatOrderTexture, ivec2(x, y), 0).r;\n\n uint splatAtlasWidth = uint(textureSize(splatAtlasTexture, 0).x);\n\n // Fetch the packed Gaussian according to the index\n uint gaussianIndexX = gaussianIndex % splatAtlasWidth;\n uint gaussianIndexY = gaussianIndex / splatAtlasWidth;\n uvec4 packedGaussian = texelFetch(splatAtlasTexture, ivec2(gaussianIndexX, gaussianIndexY), 0);\n\n // Fetch the header associated with the packed Gaussian (contains tile origin and number of fractional bits)\n uint pageNum = gaussianIndex / 1024u;\n uint headerIndex = (pageNum + 1u) * 1024u - 1u;\n uint headerIndexX = headerIndex % splatAtlasWidth;\n uint headerIndexY = headerIndex / splatAtlasWidth;\n uvec4 packedHeader = texelFetch(splatAtlasTexture, ivec2(headerIndexX, headerIndexY), 0);\n\n // Unpack the Gaussian\n vColor = unpackColor(packedGaussian);\n\n // Handle fading\n ${h(e.fadingEnabled,"\n uint fadingTextureWidth = uint(textureSize(splatFadingTexture, 0).x);\n uint fadeX = pageNum % fadingTextureWidth;\n uint fadeY = pageNum / fadingTextureWidth;\n uint opacityModifierByte = texelFetch(splatFadingTexture, ivec2(fadeX , fadeY), 0).r;\n float opacityModifier = float(opacityModifierByte) / 255.0;\n vColor.a *= opacityModifier;\n ")}\n\n if(vColor.a < ${S}) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n vec3 scale = unpackScale(packedGaussian);\n vec4 quaternion = unpackQuaternion(packedGaussian);\n mat3 rotation = quaternionToRotationMatrix(quaternion);\n vec3 tileOriginRelativePosition = unpackTileOriginRelativePosition(packedGaussian);\n\n vec3 cameraRelativePosition = unpackCameraRelativeGaussianPosition(packedHeader, tileOriginRelativePosition, cameraPosition, cameraPos8k, cameraDelta);\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1);\n\n // Handle environment (scene lighting)\n ${h(!D,`\n vec3 groundNormal = ${e.spherical?f`normalize(cameraRelativePosition + cameraPosition)`:f`vec3(0.0, 0.0, 1.0)`};\n\n float groundLightAlignment = dot(groundNormal, mainLightDirection);\n float additionalAmbientScale = additionalDirectedAmbientLight(groundLightAlignment);\n vec3 additionalLight = mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;\n \n vColor.rgb = evaluateSceneLighting(groundNormal, vColor.rgb, 0.0, 0.0, mainLightIntensity);\n `)};\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n forwardViewPosDepth(viewPos.xyz);\n\n vec3 covarianceA;\n vec3 covarianceB;\n computeCovariance3D(rotation, scale.xyz, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec3 covariance2D = computeCovariance2D(viewPos.xyz, focalLength, tanFov, covariance3D, view);\n\n // Invert covariance (EWA algorithm)\n float determinant = (covariance2D.x * covariance2D.z - covariance2D.y * covariance2D.y);\n if (determinant == 0.) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n float invDeterminant = 1. / determinant;\n\n\n vec4 projPos = proj * viewPos;\n float invW = 1. / (projPos.w + 1e-7);\n vec3 ndcPos = projPos.xyz * invW;\n\n // Compute extent in screen space (by finding the eigenvalues of the 2D covariance matrix).\n // Use the extent to compute the bounding rectangle of the Gaussian in screen space.\n float mid = 0.5 * (covariance2D.x + covariance2D.z);\n float delta = sqrt(max(0.1, mid * mid - determinant));\n float lambda1 = mid + delta;\n float lambda2 = mid - delta;\n \n // Compute principal radii (a and b)\n float a = sqrt(${T} * lambda1); // Semi-major axis\n float b = sqrt(${T} * lambda2); // Semi-minor axis\n\n // Compute rotation angle phi from covariance\n float delta_angle = covariance2D.x - covariance2D.z;\n float phi = 0.5 * fastAtan2(2.0 * covariance2D.y, delta_angle);\n\n // Compute projected axis-aligned extents\n float cos_phi = fastCos(phi);\n float sin_phi = fastSin(phi);\n\n float a2 = a * a;\n float b2 = b * b;\n float cos2 = cos_phi * cos_phi;\n float sin2 = sin_phi * sin_phi;\n\n float radius_x = ceil(sqrt(a2 * cos2 + b2 * sin2));\n float radius_y = ceil(sqrt(a2 * sin2 + b2 * cos2));\n gaussianCenterScreenPos = vec2(ndcToPixel(ndcPos.x, float(fullWidth)), ndcToPixel(ndcPos.y, float(fullHeight)));\n\n float maxRadius = max(radius_x, radius_y);\n\n // Ignore gaussians with very small contribution, with tolerance based on the quality profile\n if(minSplatRadius > 0.0) {\n float effectiveSize = maxRadius * vColor.a;\n if(effectiveSize < minSplatRadius) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n }\n\n // Screen space frustum culling\n vec2 radiusNDC = vec2(\n maxRadius * 2.0 / float(fullWidth),\n maxRadius * 2.0 / float(fullHeight)\n );\n\n if (any(greaterThan(abs(ndcPos.xy) - radiusNDC, vec2(1.0)))) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n // This maps vertex IDs 0, 1, 2, 3 to (-1,-1), (1,-1), (-1,1), (1,1)\n vec2 corner = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2) - 1.0;\n\n // Vertex (corner) position in screen space\n fragScreenPos = gaussianCenterScreenPos + vec2(radius_x * corner.x, radius_y * corner.y);\n\n // We use a conic function to derive the opacity\n vec3 conic = vec3(covariance2D.z, -covariance2D.y, covariance2D.x) * invDeterminant;\n conicOpacity = vec4(conic, vColor.a);\n\n depth = ndcPos.z;\n\n // Convert from screen-space to clip-space\n vec2 clipPos = fragScreenPos / vec2(fullWidth, fullHeight) * 2. - 1.;\n\n offsetFromCenter = gaussianCenterScreenPos - fragScreenPos;\n\n gl_Position = vec4(clipPos, depth, 1.0);\n\n `),n.fragment.main.add(`\n discardByTerrainDepth();\n\n // Evaluate the 2D elliptical Gaussian exponent using the general conic form: Ax^2+2Bxy+Cy^2\n float x = offsetFromCenter.x;\n float y = offsetFromCenter.y;\n float conic = dot(conicOpacity.xyz, vec3(x * x, 2.0 * x * y, y * y));\n float gaussianExponent = -0.5 * conic;\n\n // A positive exponent indicates alpha > 1, this should not happen\n // We also early check the alphaCutoff (i.e., ln(alphaCutoff)), to avoid unnecessary exp()\n if (gaussianExponent > 0.0 || gaussianExponent < ${F}) {\n discard;\n }\n\n float gaussianFalloff = exp(gaussianExponent);\n\n // cap at 0.99 to avoid blending issues, such as seams between overlapping Gaussians\n float alpha = min(.99f, conicOpacity.w * gaussianFalloff);\n\n // We cannot write color and depth in the same pass, as they require different blend modes.\n // Regular depth writing based on first hit is not precise enough due to the inherently\n // transparent nature of Gaussian Splats (especially at the borders of the Splat).\n // We thus use a blended depth that computes a non-linear average using\n // the splat order and opacity with geometric decay.\n // This means the depth is averaged based on the order and opacity of the Gaussians,\n // with the frontmost Gaussians contributing the most.\n ${h(D,"fragColor = vec4(depth, 0, 0, alpha);","fragColor = vec4(vColor.rgb * alpha, alpha);")}\n `),n}const T=Object.freeze(Object.defineProperty({__proto__:null,GaussianSplatPassParameters:S,build:F},Symbol.toStringTag,{value:"Module"}));export{S as G,T as a,F as b};
7
+ }`),c.vertex.main.add(`\n uint instanceID = uint(gl_InstanceID);\n\n // Transform the instanceID into 2D coordinates\n uint orderTextureWidth = uint(textureSize(splatOrderTexture, 0).x);\n uint x = instanceID % orderTextureWidth;\n uint y = instanceID / orderTextureWidth;\n\n // Fetch the index of the remaining frontmost Gaussian\n uint gaussianIndex = texelFetch(splatOrderTexture, ivec2(x, y), 0).r;\n\n uint splatAtlasWidth = uint(textureSize(splatAtlasTexture, 0).x);\n\n // Fetch the packed Gaussian according to the index\n uint gaussianIndexX = gaussianIndex % splatAtlasWidth;\n uint gaussianIndexY = gaussianIndex / splatAtlasWidth;\n uvec4 packedGaussian = texelFetch(splatAtlasTexture, ivec2(gaussianIndexX, gaussianIndexY), 0);\n\n // Fetch the header associated with the packed Gaussian (contains tile origin and number of fractional bits)\n uint pageNum = gaussianIndex / 1024u;\n uint headerIndex = (pageNum + 1u) * 1024u - 1u;\n uint headerIndexX = headerIndex % splatAtlasWidth;\n uint headerIndexY = headerIndex / splatAtlasWidth;\n uvec4 packedHeader = texelFetch(splatAtlasTexture, ivec2(headerIndexX, headerIndexY), 0);\n\n // Unpack the Gaussian\n vColor = unpackColor(packedGaussian);\n\n // Handle fading\n ${h(n.fadingEnabled,"\n uint fadingTextureWidth = uint(textureSize(splatFadingTexture, 0).x);\n uint fadeX = pageNum % fadingTextureWidth;\n uint fadeY = pageNum / fadingTextureWidth;\n uint opacityModifierByte = texelFetch(splatFadingTexture, ivec2(fadeX , fadeY), 0).r;\n float opacityModifier = float(opacityModifierByte) / 255.0;\n vColor.a *= opacityModifier;\n ")}\n\n if(vColor.a < ${D}) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n vec3 scale = unpackScale(packedGaussian);\n vec4 quaternion = unpackQuaternion(packedGaussian);\n mat3 rotation = quaternionToRotationMatrix(quaternion);\n vec3 tileOriginRelativePosition = unpackTileOriginRelativePosition(packedGaussian);\n\n vec3 cameraRelativePosition = unpackCameraRelativeGaussianPosition(packedHeader, tileOriginRelativePosition);\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1);\n\n // Handle environment (scene lighting)\n ${h(!P,`\n vec3 groundNormal = ${n.spherical?m`normalize(cameraRelativePosition + cameraPosition)`:m`vec3(0.0, 0.0, 1.0)`};\n\n float groundLightAlignment = dot(groundNormal, mainLightDirection);\n float additionalAmbientScale = additionalDirectedAmbientLight(groundLightAlignment);\n vec3 additionalLight = mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;\n\n vColor.rgb = evaluateSceneLighting(groundNormal, vColor.rgb, 0.0, 0.0, mainLightIntensity);\n `)};\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n forwardViewPosDepth(viewPos.xyz);\n\n vec3 covarianceA;\n vec3 covarianceB;\n computeCovariance3D(rotation, scale.xyz, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec3 covariance2D = computeCovariance2D(viewPos.xyz, focalLength, tanFov, covariance3D, view);\n\n // Invert covariance (EWA algorithm)\n float determinant = (covariance2D.x * covariance2D.z - covariance2D.y * covariance2D.y);\n if (determinant <= 0.) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n float invDeterminant = 1. / determinant;\n\n vec4 projPos = proj * viewPos;\n float invW = 1. / (projPos.w + 1e-7);\n vec3 ndcPos = projPos.xyz * invW;\n\n // Compute the Gaussians extent in screen space by finding the eigenvalues lambda1 and lambda2\n // of the 2D covariance matrix\n float mid = 0.5 * (covariance2D.x + covariance2D.z);\n float radius = length(vec2((covariance2D.x - covariance2D.z) * 0.5, covariance2D.y));\n float lambda1 = mid + radius;\n float lambda2 = mid - radius;\n\n // Compute the extents along the principal axes\n float l1 = ceil(sqrt(lambda1 * ${F}));\n float l2 = ceil(sqrt(lambda2 * ${F}));\n\n float maxRadius = max(l1, l2);\n\n // Ignore gaussians with very small contribution, with tolerance based on the quality profile\n if(minSplatRadius > 0.0) {\n float effectiveSize = maxRadius * vColor.a;\n if(effectiveSize < minSplatRadius) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n }\n\n // Screen space frustum culling\n vec2 radiusNDC = maxRadius * 2.0 / screenSize;\n\n if (any(greaterThan(abs(ndcPos.xy) - radiusNDC, vec2(1.0)))) {\n gl_Position = vec4(1e038, 1e038, 1e038, 1.0);\n return;\n }\n\n // Compute the principal diagonal direction (eigenvector for lambda1)\n vec2 diagonalVector = normalize(vec2(covariance2D.y, lambda1 - covariance2D.x));\n\n vec2 majorAxis = l1 * diagonalVector;\n vec2 minorAxis = l2 * vec2(diagonalVector.y, -diagonalVector.x);\n\n gaussianCenterScreenPos = ndcToPixel(ndcPos.xy, screenSize);\n\n // This maps vertex IDs 0, 1, 2, 3 to (-1,-1), (1,-1), (-1,1), (1,1)\n vec2 corner = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2) - 1.0;\n fragScreenPos = gaussianCenterScreenPos + corner.x * majorAxis + corner.y * minorAxis;\n\n // We use a conic function to derive the opacity\n vec3 conic = vec3(covariance2D.z, -covariance2D.y, covariance2D.x) * invDeterminant;\n conicOpacity = vec4(conic, vColor.a);\n\n depth = ndcPos.z;\n\n // Convert from screen-space to clip-space\n vec2 clipPos = fragScreenPos / screenSize * 2. - 1.;\n\n offsetFromCenter = gaussianCenterScreenPos - fragScreenPos;\n\n gl_Position = vec4(clipPos, depth, 1.0);\n\n `),c.fragment.main.add(`\n discardByTerrainDepth();\n\n // Evaluate the 2D elliptical Gaussian exponent using the general conic form: Ax^2+2Bxy+Cy^2\n float x = offsetFromCenter.x;\n float y = offsetFromCenter.y;\n float conic = dot(conicOpacity.xyz, vec3(x * x, 2.0 * x * y, y * y));\n float gaussianExponent = -0.5 * conic;\n\n // A positive exponent indicates alpha > 1, this should not happen\n // We also early check the alphaCutoff (i.e., ln(alphaCutoff)), to avoid unnecessary exp()\n if (gaussianExponent > 0.0 || gaussianExponent < ${S}) {\n discard;\n }\n\n float gaussianFalloff = exp(gaussianExponent);\n\n // cap at 0.99 to avoid blending issues, such as seams between overlapping Gaussians\n float alpha = min(.99f, conicOpacity.w * gaussianFalloff);\n\n // We cannot write color and depth in the same pass, as they require different blend modes.\n // Regular depth writing based on first hit is not precise enough due to the inherently\n // transparent nature of Gaussian Splats (especially at the borders of the Splat).\n // We thus use a blended depth that computes a non-linear average using\n // the splat order and opacity with geometric decay.\n // This means the depth is averaged based on the order and opacity of the Gaussians,\n // with the frontmost Gaussians contributing the most.\n ${h(P,"fragColor = vec4(depth, 0, 0, alpha);","fragColor = vec4(vColor.rgb * alpha, alpha);")}\n `),c}const C=n(),S=Object.freeze(Object.defineProperty({__proto__:null,GaussianSplatPassParameters:P,build:D},Symbol.toStringTag,{value:"Module"}));export{P as G,S as a,D as b};
@@ -2,7 +2,7 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{copy as e,set as o}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as r,fromValues as t}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as l}from"../geometry/support/Ellipsoid.js";import{RejectBySlice as a}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as n}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as d}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{HUDVisibility as u}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js";import{OutputHighlight as f}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{ScreenSizePerspective as g,addScreenSizePerspective as v,addScreenSizePerspectiveAlignment as b}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4BindUniform as w}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4DrawUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js";import{Float4PassUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as P}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as j,If as y}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as A}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as $}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{ShaderBuilder as O}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as D}from"../webscene/support/AlphaCutoff.js";function F(e){const i=new O,{signedDistanceFieldEnabled:F,occlusionTestEnabled:M,horizonCullingEnabled:U,pixelSnappingEnabled:E,hasEmission:H,hasScreenSizePerspective:_,debugDrawLabelBorder:q,hasVVSize:R,hasVVColor:k,hasRotation:I,occludedFragmentFade:G,sampleSignedDistanceFieldTexelCenter:J}=e;i.include(c,e),i.vertex.include(a,e);const{occlusionPass:K,output:N,oitPass:Q}=e;if(K)return i.include(d,e),i;const{vertex:W,fragment:X}=i;i.include(g),i.include(p,e),i.include(s,e),M&&i.include(u),X.include(m),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2");const Y=8===N,Z=Y&&M;Z&&i.varyings.add("voccluded","float"),W.uniforms.add(new w("viewport",e=>e.camera.fullViewport),new h("screenOffset",(e,i)=>o(L,2*e.screenOffset[0]*i.camera.pixelRatio,2*e.screenOffset[1]*i.camera.pixelRatio)),new h("anchorPosition",e=>B(e)),new z("materialColor",e=>e.color),new S("materialRotation",e=>e.rotation),new $("tex",e=>e.texture)),x(W),F&&(W.uniforms.add(new z("outlineColor",e=>e.outlineColor)),X.uniforms.add(new z("outlineColor",e=>T(e)?e.outlineColor:r),new S("outlineSize",e=>T(e)?e.outlineSize:0))),U&&W.uniforms.add(new C("pointDistanceSphere",(e,o)=>{const i=o.camera.eye,r=e.origin;return t(r[0]-i[0],r[1]-i[1],r[2]-i[2],l.radius)})),E&&W.include(n),_&&(v(W),b(W)),q&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add("uv0","vec2"),i.attributes.add("uvi","vec4"),i.attributes.add("color","vec4"),i.attributes.add("size","vec2"),i.attributes.add("rotation","float"),(R||k)&&i.attributes.add("featureAttribute","vec4"),W.code.add(U?j`bool behindHorizon(vec3 posModel) {
5
+ import{copy as e,set as o}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as r,fromValues as t}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as l}from"../geometry/support/Ellipsoid.js";import{RejectBySlice as a}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as n}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as d}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{HUDVisibility as u}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js";import{OutputHighlight as f}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{ScreenSizePerspective as g,addScreenSizePerspective as v,addScreenSizePerspectiveAlignment as b}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4BindUniform as w}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4DrawUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js";import{Float4PassUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as P}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as j,If as y}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as A}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as $}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{ShaderBuilder as O}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as D}from"../webscene/support/AlphaCutoff.js";function F(e){const i=new O;if(i.include(c,e),i.vertex.include(a,e),e.occlusionPass)return i.include(d,e),i;const{output:F,oitPass:M,signedDistanceFieldEnabled:U,occlusionTestEnabled:E,horizonCullingEnabled:H,pixelSnappingEnabled:_,hasEmission:q,hasScreenSizePerspective:R,debugDrawLabelBorder:k,hasVVSize:I,hasVVColor:G,hasRotation:J,occludedFragmentFade:K,sampleSignedDistanceFieldTexelCenter:N}=e;i.include(g),i.include(p,e),i.include(s,e),E&&i.include(u);const{vertex:Q,fragment:W}=i;W.include(m),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2");const X=8===F,Y=X&&E;Y&&i.varyings.add("voccluded","float"),Q.uniforms.add(new w("viewport",e=>e.camera.fullViewport),new h("screenOffset",(e,i)=>o(L,2*e.screenOffset[0]*i.camera.pixelRatio,2*e.screenOffset[1]*i.camera.pixelRatio)),new h("anchorPosition",e=>B(e)),new z("materialColor",e=>e.color),new S("materialRotation",e=>e.rotation),new $("tex",e=>e.texture)),x(Q),U&&(Q.uniforms.add(new z("outlineColor",e=>e.outlineColor)),W.uniforms.add(new z("outlineColor",e=>T(e)?e.outlineColor:r),new S("outlineSize",e=>T(e)?e.outlineSize:0))),H&&Q.uniforms.add(new C("pointDistanceSphere",(e,o)=>{const i=o.camera.eye,r=e.origin;return t(r[0]-i[0],r[1]-i[1],r[2]-i[2],l.radius)})),_&&Q.include(n),R&&(v(Q),b(Q)),k&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add("uv0","vec2"),i.attributes.add("uvi","vec4"),i.attributes.add("color","vec4"),i.attributes.add("size","vec2"),i.attributes.add("rotation","float"),(I||G)&&i.attributes.add("featureAttribute","vec4"),Q.code.add(H?j`bool behindHorizon(vec3 posModel) {
6
6
  vec3 camToEarthCenter = pointDistanceSphere.xyz - localOrigin;
7
7
  vec3 camToPos = pointDistanceSphere.xyz + posModel;
8
8
  float earthRadius = pointDistanceSphere.w;
@@ -10,7 +10,7 @@ float a = dot(camToPos, camToPos);
10
10
  float b = dot(camToPos, camToEarthCenter);
11
11
  float c = dot(camToEarthCenter, camToEarthCenter) - earthRadius * earthRadius;
12
12
  return b > 0.0 && b < a && b * b > a * c;
13
- }`:j`bool behindHorizon(vec3 posModel) { return false; }`),W.main.add(j`
13
+ }`:j`bool behindHorizon(vec3 posModel) { return false; }`),Q.main.add(j`
14
14
  ProjectHUDAux projectAux;
15
15
  vec4 posProj = projectPositionHUD(projectAux);
16
16
  forwardObjectAndLayerIdColor();
@@ -28,31 +28,31 @@ return b > 0.0 && b < a && b * b > a * c;
28
28
  }
29
29
 
30
30
  vec2 inputSize;
31
- ${y(_,j`
31
+ ${y(R,j`
32
32
  inputSize = screenSizePerspectiveScaleVec2(size, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspective);
33
33
  vec2 screenOffsetScaled = screenSizePerspectiveScaleVec2(screenOffset, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspectiveAlignment);`,j`
34
34
  inputSize = size;
35
35
  vec2 screenOffsetScaled = screenOffset;`)}
36
- ${y(R,j`inputSize *= vvScale(featureAttribute).xx;`)}
36
+ ${y(I,j`inputSize *= vvScale(featureAttribute).xx;`)}
37
37
 
38
38
  vec2 combinedSize = inputSize * pixelRatio;
39
39
  vec4 quadOffset = vec4(0.0);
40
40
 
41
- ${y(M,j`
41
+ ${y(E,j`
42
42
  bool visible = testHUDVisibility(posProj);
43
43
  if (!visible) {
44
44
  vtc = vec2(0.0);
45
- ${y(q,"debugBorderCoords = vec4(0.5, 0.5, 1.5 / combinedSize);")}
45
+ ${y(k,"debugBorderCoords = vec4(0.5, 0.5, 1.5 / combinedSize);")}
46
46
  return;
47
47
  }`)}
48
- ${y(Z,j`voccluded = visible ? 0.0 : 1.0;`)}
49
- `);const ee=j`
48
+ ${y(Y,j`voccluded = visible ? 0.0 : 1.0;`)}
49
+ `);const Z=j`
50
50
  vec2 uv = mix(uvi.xy, uvi.zw, bvec2(uv0));
51
51
  vec2 texSize = vec2(textureSize(tex, 0));
52
52
  uv = mix(vec2(1.0), uv / texSize, lessThan(uv, vec2(${V})));
53
53
  quadOffset.xy = (uv0 - anchorPosition) * 2.0 * combinedSize;
54
54
 
55
- ${y(I,j`
55
+ ${y(J,j`
56
56
  float angle = radians(materialRotation + rotation);
57
57
  float cosAngle = cos(angle);
58
58
  float sinAngle = sin(angle);
@@ -62,36 +62,36 @@ return b > 0.0 && b < a && b * b > a * c;
62
62
  `)}
63
63
 
64
64
  quadOffset.xy = (quadOffset.xy + screenOffsetScaled) / viewport.zw * posProj.w;
65
- `,oe=E?F?j`posProj = alignToPixelOrigin(posProj, viewport.zw) + quadOffset;`:j`posProj += quadOffset;
65
+ `,ee=_?U?j`posProj = alignToPixelOrigin(posProj, viewport.zw) + quadOffset;`:j`posProj += quadOffset;
66
66
  if (inputSize.x == size.x) {
67
67
  posProj = alignToPixelOrigin(posProj, viewport.zw);
68
- }`:j`posProj += quadOffset;`;W.main.add(j`
69
- ${ee}
70
- ${k?"vcolor = interpolateVVColor(featureAttribute.y) * materialColor;":"vcolor = color / 255.0 * materialColor;"}
68
+ }`:j`posProj += quadOffset;`;Q.main.add(j`
69
+ ${Z}
70
+ ${G?"vcolor = interpolateVVColor(featureAttribute.y) * materialColor;":"vcolor = color / 255.0 * materialColor;"}
71
71
 
72
- ${y(9===N,j`vcolor.a = 1.0;`)}
72
+ ${y(9===F,j`vcolor.a = 1.0;`)}
73
73
 
74
74
  bool alphaDiscard = vcolor.a < ${j.float(D)};
75
- ${y(F,`alphaDiscard = alphaDiscard && outlineColor.a < ${j.float(D)};`)}
75
+ ${y(U,`alphaDiscard = alphaDiscard && outlineColor.a < ${j.float(D)};`)}
76
76
  if (alphaDiscard) {
77
77
  // "early discard" if both symbol color (= fill) and outline color (if applicable) are transparent
78
78
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
79
79
  return;
80
80
  } else {
81
- ${oe}
81
+ ${ee}
82
82
  gl_Position = posProj;
83
83
  }
84
84
 
85
85
  vtc = uv;
86
86
 
87
- ${y(q,j`debugBorderCoords = vec4(uv01, 1.5 / combinedSize);`)}
87
+ ${y(k,j`debugBorderCoords = vec4(uv01, 1.5 / combinedSize);`)}
88
88
  vsize = inputSize;
89
- `),X.uniforms.add(new $("tex",e=>e.texture)),G&&!Y&&X.uniforms.add(new A("depthMap",e=>e.mainDepth),new P("occludedOpacity",e=>e.hudOccludedFragmentOpacity));const ie=q?j`(isBorder > 0.0 ? 0.0 : ${j.float(D)})`:j.float(D),re=j`
90
- ${y(q,j`float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`)}
89
+ `),W.uniforms.add(new $("tex",e=>e.texture)),K&&!X&&W.uniforms.add(new A("depthMap",e=>e.mainDepth),new P("occludedOpacity",e=>e.hudOccludedFragmentOpacity));const oe=k?j`(isBorder > 0.0 ? 0.0 : ${j.float(D)})`:j.float(D),ie=j`
90
+ ${y(k,j`float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`)}
91
91
 
92
92
  vec2 samplePos = vtc;
93
93
 
94
- ${y(J,j`
94
+ ${y(N,j`
95
95
  float txSize = float(textureSize(tex, 0).x);
96
96
  float texelSize = 1.0 / txSize;
97
97
 
@@ -99,7 +99,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
99
99
  vec2 scaleFactor = (vsize - txSize) * texelSize;
100
100
  samplePos += (vec2(1.0, -1.0) * texelSize) * scaleFactor;`)}
101
101
 
102
- ${F?j`
102
+ ${U?j`
103
103
  vec4 fillPixelColor = vcolor;
104
104
 
105
105
  // Get distance in output units (i.e. pixels)
@@ -120,7 +120,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
120
120
  outlinePixelColor.a *= outlineAlphaFactor;
121
121
 
122
122
  if (
123
- outlineAlphaFactor + fillAlphaFactor < ${ie} ||
123
+ outlineAlphaFactor + fillAlphaFactor < ${oe} ||
124
124
  fillPixelColor.a + outlinePixelColor.a < ${j.float(D)}
125
125
  ) {
126
126
  discard;
@@ -131,39 +131,39 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
131
131
  vec3 compositeColor = vec3(outlinePixelColor) * outlinePixelColor.a +
132
132
  vec3(fillPixelColor) * fillPixelColor.a * (1.0 - outlinePixelColor.a);
133
133
 
134
- ${y(!Y,j`fragColor = vec4(compositeColor, compositeAlpha);`)}
134
+ ${y(!X,j`fragColor = vec4(compositeColor, compositeAlpha);`)}
135
135
  } else {
136
- if (fillAlphaFactor < ${ie}) {
136
+ if (fillAlphaFactor < ${oe}) {
137
137
  discard;
138
138
  }
139
139
 
140
- ${y(!Y,j`fragColor = premultiplyAlpha(fillPixelColor);`)}
140
+ ${y(!X,j`fragColor = premultiplyAlpha(fillPixelColor);`)}
141
141
  }
142
142
 
143
143
  // visualize SDF:
144
144
  // fragColor = vec4(clamp(-pixelDistance/vsize.x*2.0, 0.0, 1.0), clamp(pixelDistance/vsize.x*2.0, 0.0, 1.0), 0.0, 1.0);
145
145
  `:j`
146
146
  vec4 texColor = texture(tex, samplePos, -0.5);
147
- if (texColor.a < ${ie}) {
147
+ if (texColor.a < ${oe}) {
148
148
  discard;
149
149
  }
150
- ${y(!Y,j`fragColor = texColor * premultiplyAlpha(vcolor);`)}
150
+ ${y(!X,j`fragColor = texColor * premultiplyAlpha(vcolor);`)}
151
151
  `}
152
152
 
153
- ${y(G&&!Y,j`
153
+ ${y(K&&!X,j`
154
154
  float zSample = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;
155
155
  if (zSample < gl_FragCoord.z) {
156
156
  fragColor *= occludedOpacity;
157
157
  }
158
158
  `)}
159
159
 
160
- ${y(!Y&&q,j`fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), isBorder * 0.5);`)}
161
- `;switch(N){case 0:i.outputs.add("fragColor","vec4",0),H&&i.outputs.add("fragEmission","vec4",1),1===Q&&i.outputs.add("fragAlpha","float",H?2:1),X.main.add(j`
162
- ${re}
163
- ${y(2===Q,j`fragColor.rgb /= fragColor.a;`)}
164
- ${y(H,j`fragEmission = vec4(0.0);`)}
165
- ${y(1===Q,j`fragAlpha = fragColor.a;`)}`);break;case 9:X.main.add(j`
166
- ${re}
167
- outputObjectAndLayerIdColor();`);break;case 8:i.include(f,e),X.main.add(j`
168
- ${re}
169
- outputHighlight(${y(Z,j`voccluded == 1.0`,j`false`)});`)}return i}function T(e){return e.outlineColor[3]>0&&e.outlineSize>0}function B(o){return o.textureIsSignedDistanceField?M(o.anchorPosition,o.distanceFieldBoundingBox,L):e(L,o.anchorPosition),L}function M(e,i,r){o(r,e[0]*(i[2]-i[0])+i[0],e[1]*(i[3]-i[1])+i[1])}const L=i(),U=32e3,V=j.float(U),E=Object.freeze(Object.defineProperty({__proto__:null,build:F,calculateAnchorPosition:B,fullUV:U},Symbol.toStringTag,{value:"Module"}));export{E as H,F as b,B as c,U as f};
160
+ ${y(!X&&k,j`fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), isBorder * 0.5);`)}
161
+ `;switch(F){case 0:i.outputs.add("fragColor","vec4",0),q&&i.outputs.add("fragEmission","vec4",1),1===M&&i.outputs.add("fragAlpha","float",q?2:1),W.main.add(j`
162
+ ${ie}
163
+ ${y(2===M,j`fragColor.rgb /= fragColor.a;`)}
164
+ ${y(q,j`fragEmission = vec4(0.0);`)}
165
+ ${y(1===M,j`fragAlpha = fragColor.a;`)}`);break;case 9:W.main.add(j`
166
+ ${ie}
167
+ outputObjectAndLayerIdColor();`);break;case 8:i.include(f,e),W.main.add(j`
168
+ ${ie}
169
+ outputHighlight(${y(Y,j`voccluded == 1.0`,j`false`)});`)}return i}function T(e){return e.outlineColor[3]>0&&e.outlineSize>0}function B(o){return o.textureIsSignedDistanceField?M(o.anchorPosition,o.distanceFieldBoundingBox,L):e(L,o.anchorPosition),L}function M(e,i,r){o(r,e[0]*(i[2]-i[0])+i[0],e[1]*(i[3]-i[1])+i[1])}const L=i(),U=32e3,V=j.float(U),E=Object.freeze(Object.defineProperty({__proto__:null,build:F,calculateAnchorPosition:B,fullUV:U},Symbol.toStringTag,{value:"Module"}));export{E as H,F as b,B as c,U as f};
@@ -2,7 +2,7 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ChapmanRaymarching as e}from"../views/3d/environment/ChapmanRaymarching.glsl.js";import{ReadDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{FloatPassUniform as i}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n,If as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{ScreenSpacePassAtmosphere as d}from"../views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import{SphereIntersect as s}from"../views/3d/webgl-engine/shaders/SphereIntersect.glsl.js";import{ToneMapping as p}from"../views/3d/webgl-engine/shaders/ToneMapping.glsl.js";import{ShaderBuilder as c}from"../views/webgl/ShaderBuilder.js";function h(h){const m=new c,{fragment:g}=m;m.include(d),a(g),g.include(t),g.include(r),g.include(s),g.include(p),g.include(e,!0),g.uniforms.add(new l("depthTexture",e=>e.mainDepth),new i("hazeStrength",e=>e.hazeStrength));const{reduced:u}=h;return u&&g.code.add(n`float getDepth(vec2 uv){
5
+ import{ChapmanRaymarching as e}from"../views/3d/environment/ChapmanRaymarching.glsl.js";import{ReadDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{FloatPassUniform as i}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n,If as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{ScreenSpacePassAtmosphere as d}from"../views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import{SphereIntersect as s}from"../views/3d/webgl-engine/shaders/SphereIntersect.glsl.js";import{ToneMapping as p}from"../views/3d/webgl-engine/shaders/ToneMapping.glsl.js";import{ShaderBuilder as h}from"../views/webgl/ShaderBuilder.js";function c(c){const m=new h,{fragment:g}=m;m.include(d),a(g),g.include(t),g.include(r),g.include(s),g.include(p),g.include(e,!0),g.uniforms.add(new l("depthTexture",e=>e.mainDepth));const{reduced:u}=c;return u&&g.code.add(n`float getDepth(vec2 uv){
6
6
  return linearDepthFromTexture(depthTexture, uv);
7
7
  }
8
8
  float textureBilinear(vec2 uv) {
@@ -16,29 +16,29 @@ float d1 = getDepth(snapUV + vec2(texelSize.x, 0.0));
16
16
  float d2 = getDepth(snapUV + vec2(0.0, texelSize.y));
17
17
  float d3 = getDepth(snapUV + texelSize);
18
18
  return mix(mix(d0, d1, f.x), mix(d2, d3, f.x), f.y);
19
- }`),g.main.add(n`
20
- vec3 rayDir = normalize(worldRay);
21
- float terrainDepth = -1.0;
19
+ }`),g.uniforms.add(new i("hazeStrength",e=>e.hazeStrength)).main.add(n`
20
+ vec3 rayDir = normalize(worldRay);
21
+ float terrainDepth = -1.0;
22
22
 
23
- float depthSample = texture(depthTexture, uv).r;
24
- if (depthSample != 1.0) {
25
- vec3 cameraSpaceRay = normalize(eyeDir);
26
- cameraSpaceRay /= cameraSpaceRay.z;
23
+ float depthSample = texture(depthTexture, uv).r;
24
+ if (depthSample != 1.0) {
25
+ vec3 cameraSpaceRay = normalize(eyeDir);
26
+ cameraSpaceRay /= cameraSpaceRay.z;
27
27
 
28
- cameraSpaceRay *= ${o(u,"-textureBilinear(uv)","-linearDepthFromTexture(depthTexture, uv)")};
29
- terrainDepth = max(0.0, length(cameraSpaceRay));
30
- } else {
31
- discard;
32
- }
28
+ cameraSpaceRay *= ${o(u,"-textureBilinear(uv)","-linearDepthFromTexture(depthTexture, uv)")};
29
+ terrainDepth = max(0.0, length(cameraSpaceRay));
30
+ } else {
31
+ discard;
32
+ }
33
33
 
34
- // Alpha is ignored for haze blending
35
- vec3 col = vec3(0);
36
- float fadeOut = smoothstep(-10000.0, -15000.0, heightParameters[0] - radii[0]);
37
- if(depthSample != 1.0){
38
- col = (1.0 - fadeOut) * hazeStrength * raymarchAtmosphere(cameraPosition, rayDir, mainLightDirection, terrainDepth);
39
- }
40
- float alpha = 1.0;
34
+ // Alpha is ignored for haze blending
35
+ vec3 col = vec3(0);
36
+ float fadeOut = smoothstep(-10000.0, -15000.0, heightParameters[0] - radii[0]);
37
+ if(depthSample != 1.0){
38
+ col = (1.0 - fadeOut) * hazeStrength * raymarchAtmosphere(rayDir, mainLightDirection, terrainDepth);
39
+ }
40
+ float alpha = 1.0;
41
41
 
42
- col = tonemapACES(col);
43
- fragColor = delinearizeGamma(vec4(col, alpha));
44
- `),m}const m=Object.freeze(Object.defineProperty({__proto__:null,build:h},Symbol.toStringTag,{value:"Module"}));export{m as H,h as b};
42
+ col = tonemapACES(col);
43
+ fragColor = delinearizeGamma(vec4(col, alpha));
44
+ `),m}const m=Object.freeze(Object.defineProperty({__proto__:null,build:c},Symbol.toStringTag,{value:"Module"}));export{m as H,c as b};
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.0.0-next.37";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.0.0-next.39";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"./ArrayPool.js";import{EventedAccessor as s}from"./Evented.js";import{makeHandle as i}from"./handleUtils.js";import{clone as r}from"./lang.js";import n from"./ObjectPool.js";import{schedule as h}from"./scheduling.js";import{ensureType as o,ensureOneOfType as l}from"./accessorSupport/ensureType.js";import{trackAccess as a}from"./accessorSupport/tracking.js";import{property as c}from"./accessorSupport/decorators/property.js";import{shared as f}from"./accessorSupport/decorators/shared.js";import{subclass as u}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as _}from"./accessorSupport/tracking/SimpleObservable.js";import{isSerializable as m}from"./support/jsonUtils.js";var g;class d{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class p{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const b=new n(()=>new d,void 0,e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1});function v(e){e&&"object"==typeof e&&"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}function y(e){return e?e instanceof B?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function C(e){if(e?.length)return e[0]}function A(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function x(e,t,s,i){t&&t.forEach((t,r,n)=>{e.push(t),x(e,s.call(i,t,r,n),s,i)})}const E=new Set,j=new Set,w=new Set,S=new Map;let L=0,B=g=class extends s{static ofType(t){if(!t)return g;if(S.has(t))return S.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends g{};return e([f({Type:t,ensureType:"function"==typeof t?o(t):l(t)})],i.prototype,"itemType",void 0),i=e([u(`esri.core.Collection<${s}>`)],i),S.set(t,i),i}static isCollection(e){return null!=e&&e instanceof g}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._updating=!1,this._timer=null,this._observable=new _,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:L++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof g?{items:e}:e:{}}destroy(){this._removeAllRaw(),this._timer&&this._timer.remove(),super.destroy(),this._notifications=null}*[Symbol.iterator](){yield*this.items}get items(){return a(this._observable),this._items}set items(e){this._emitBeforeChanges(1)||(this._splice(0,this.length,y(e)),this._emitAfterChanges(1))}hasEventListener(e){return!this.destroyed&&("change"===e?this._chgListeners.length>0:super.hasEventListener(e))}on(e,t){if(this.destroyed)return i();if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),i(()=>{s.removed=!0,e.splice(e.indexOf(s),1)})}return super.on(e,t)}once(e,t){const s="deref"in t?()=>t.deref():()=>t,i=this.on(e,e=>{s()?.call(null,e),i.remove()});return i}add(e,t){if(a(this._observable),this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(1),this}addMany(e,t=this._items.length){if(a(this._observable),!e?.length)return this;if(this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t);return this._splice(s,0,y(e)),this._emitAfterChanges(1),this}at(e){if(a(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(a(this._observable),!this.length||this._emitBeforeChanges(2))return[];const e=this._removeAllRaw();return this._emitAfterChanges(2),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return a(this._observable),this._createNewInstance({items:this._items.map(r)})}concat(...e){a(this._observable);const t=e.map(y);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(a(this._observable),!this.length||this._emitBeforeChanges(2))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(2)}destroyAll(){this.drain(v)}destroyMany(e){const t=this.removeMany(e);return t.forEach(v),t}every(e,t){return a(this._observable),this._items.every(e,t)}filter(e,t){a(this._observable);const s=2===arguments.length?this._items.filter(e,t):this._items.filter(e);return this._createNewInstance({items:s})}find(e,t){return a(this._observable),this._items.find(e,t)}findIndex(e,t){return a(this._observable),this._items.findIndex(e,t)}flatten(e,t){a(this._observable);const s=[];return x(s,this,e,t),new g(s)}forEach(e,t){return a(this._observable),this._items.forEach(e,t)}getItemAt(e){return a(this._observable),this._items[e]}getNextIndex(e){a(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return a(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return a(this._observable),this._items.indexOf(e,t)}join(e=","){return a(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return a(this._observable),this._items.lastIndexOf(e,t)}map(e,t){a(this._observable);const s=this._items.map(e,t);return new g({items:s})}reorder(e,t=this.length-1){a(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(4))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(4)}return e}}pop(){if(a(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=C(this._splice(this.length-1,1));return this._emitAfterChanges(2),e}push(...e){return a(this._observable),this._emitBeforeChanges(1)||(this._splice(this.length,0,e),this._emitAfterChanges(1)),this.length}reduce(e,t){a(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){a(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return a(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(a(this._observable),e<0||e>=this.length||this._emitBeforeChanges(2))return;const t=C(this._splice(e,1));return this._emitAfterChanges(2),t}removeMany(e){if(a(this._observable),!e?.length||this._emitBeforeChanges(2))return[];const t=e instanceof g?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+A(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(2),i}reverse(){if(a(this._observable),this._emitBeforeChanges(4))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(4),this}shift(){if(a(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=C(this._splice(0,1));return this._emitAfterChanges(2),e}slice(e=0,t=this.length){return a(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return a(this._observable),this._items.some(e,t)}sort(e){if(a(this._observable),!this.length||this._emitBeforeChanges(4)||!this._requiresSort(e))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(4),this}_requiresSort(e=(e,t)=>e===t?0:e<t?-1:1){const t=this.length-1;for(let s=0;s<t;s++){if(e(this.items[s],this.items[s+1])>0)return!0}return!1}splice(e,t,...s){a(this._observable),1===arguments.length&&(t=this.length),t??=0;const i=(t?2:0)|(s.length?1:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return a(this._observable),this._items.slice()}toJSON(e){a(this._observable);return this.toArray().map(t=>m(t)?t.toJSON(e):t)}toLocaleString(){return a(this._observable),this._items.toLocaleString()}toString(){return a(this._observable),this._items.toString()}unshift(...e){return a(this._observable),!e.length||this._emitBeforeChanges(1)||(this._splice(0,0,e),this._emitAfterChanges(1)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,o;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._updating=!0,this._timer=h(()=>this._dispatchChange())),e<0&&(e+=this.length),t){if(o=i.splice(e,t),this.hasEventListener("before-remove")){const t=b.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=o.length;s<r;s++)n=o[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(o.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);b.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=b.acquire();e.target=this,e.cancellable=!1;const t=o.length;for(let s=0;s<t;s++)e.reset(o[s]),this.emit("after-remove",e);b.release(e)}}if(s?.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=b.acquire();r.target=this,r.cancellable=!0;const o=b.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),o.reset(l),this.emit("after-add",o));b.release(o),b.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._set("length",i.length)}}if((s?.length||o?.length)&&this._notifyChangeEvent(s,o),this.hasEventListener("after-splice")){const i=new p(this,s,o,e,t);this.emit("after-splice",i)}return o}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=b.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,b.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=b.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),b.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}get updating(){return this._updating}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),this._updating=!1,!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;E.clear(),j.clear(),w.clear();for(const{added:t,removed:s}of e){if(t)if(0===w.size&&0===j.size)for(const e of t)E.add(e);else for(const e of t)j.has(e)?(w.add(e),j.delete(e)):w.has(e)||E.add(e);if(s)if(0===w.size&&0===E.size)for(const e of s)j.add(e);else for(const e of s)E.has(e)?E.delete(e):(w.delete(e),j.add(e))}const i=t.acquire();E.forEach(e=>{i.push(e)});const r=t.acquire();j.forEach(e=>{r.push(e)});const n=this._items,h=s.items,o=t.acquire();if(w.forEach(e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)}),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}E.clear(),j.clear(),w.clear()}};e([c()],B.prototype,"_updating",void 0),e([c()],B.prototype,"length",void 0),e([c()],B.prototype,"items",null),e([c({readOnly:!0})],B.prototype,"updating",null),B=g=e([u("esri.core.Collection")],B);const O=B;export{O as default};
5
+ import{__decorate as e}from"tslib";import t from"./ArrayPool.js";import{isArrayWithReadonly as s}from"./arrayUtils.js";import{EventedAccessor as i}from"./Evented.js";import{makeHandle as r}from"./handleUtils.js";import{clone as n}from"./lang.js";import h from"./Logger.js";import o from"./ObjectPool.js";import{schedule as l}from"./scheduling.js";import{ensureType as a,ensureOneOfType as c}from"./accessorSupport/ensureType.js";import{trackAccess as f}from"./accessorSupport/tracking.js";import{property as _}from"./accessorSupport/decorators/property.js";import{shared as u}from"./accessorSupport/decorators/shared.js";import{subclass as g}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as m}from"./accessorSupport/tracking/SimpleObservable.js";import{isSerializable as p}from"./support/jsonUtils.js";var d;class b{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class v{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const y=new o(()=>new b,void 0,e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1});function C(e){e&&"object"==typeof e&&"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}function A(e){return e?e instanceof I?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function x(e){if(e?.length)return e[0]}function j(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function E(e,t,s,i){t&&t.forEach((t,r,n)=>{e.push(t),E(e,s.call(i,t,r,n),s,i)})}const w=new Set,L=new Set,S=new Set,B=new Map;let O=0,I=d=class extends i{static ofType(t){if(!t)return d;if(B.has(t))return B.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends d{};return e([u({Type:t,ensureType:"function"==typeof t?a(t):c(t)})],i.prototype,"itemType",void 0),i=e([g(`esri.core.Collection<${s}>`)],i),B.set(t,i),i}static isCollection(e){return null!=e&&e instanceof d}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._updating=!1,this._timer=null,this._observable=new m,this._length=0,this._items=[],Object.defineProperty(this,"uid",{value:O++})}normalizeCtorArgs(e){return e?s(e)||e instanceof d?{items:e}:e:{}}destroy(){this._removeAllRaw(),this._timer&&this._timer.remove(),super.destroy(),this._notifications=null}*[Symbol.iterator](){yield*this.items}get length(){return this._length}set length(e){e>this._length?h.getLogger(this).error("#length=","Cannot increase the length of the collection by assigning to the length property."):this.splice(e,Math.max(0,this._length-e))}get items(){return f(this._observable),this._items}set items(e){this._emitBeforeChanges(1)||(this._splice(0,this.length,A(e)),this._emitAfterChanges(1))}hasEventListener(e){return!this.destroyed&&("change"===e?this._chgListeners.length>0:super.hasEventListener(e))}on(e,t){if(this.destroyed)return r();if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),r(()=>{s.removed=!0,e.splice(e.indexOf(s),1)})}return super.on(e,t)}once(e,t){const s="deref"in t?()=>t.deref():()=>t,i=this.on(e,e=>{s()?.call(null,e),i.remove()});return i}add(e,t){if(f(this._observable),this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(1),this}addMany(e,t=this._items.length){if(f(this._observable),!e?.length)return this;if(this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t);return this._splice(s,0,A(e)),this._emitAfterChanges(1),this}at(e){if(f(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return[];const e=this._removeAllRaw();return this._emitAfterChanges(2),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return f(this._observable),this._createNewInstance({items:this._items.map(n)})}concat(...e){f(this._observable);const t=e.map(A);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(2)}destroyAll(){this.drain(C)}destroyMany(e){const t=this.removeMany(e);return t.forEach(C),t}every(e,t){return f(this._observable),this._items.every(e,t)}filter(e,t){f(this._observable);const s=2===arguments.length?this._items.filter(e,t):this._items.filter(e);return this._createNewInstance({items:s})}find(e,t){return f(this._observable),this._items.find(e,t)}findIndex(e,t){return f(this._observable),this._items.findIndex(e,t)}flatten(e,t){f(this._observable);const s=[];return E(s,this,e,t),new d(s)}forEach(e,t){return f(this._observable),this._items.forEach(e,t)}getItemAt(e){return f(this._observable),this._items[e]}getNextIndex(e){f(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return f(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return f(this._observable),this._items.indexOf(e,t)}join(e=","){return f(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return f(this._observable),this._items.lastIndexOf(e,t)}map(e,t){f(this._observable);const s=this._items.map(e,t);return new d({items:s})}reorder(e,t=this.length-1){f(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(4))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(4)}return e}}pop(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(this.length-1,1));return this._emitAfterChanges(2),e}push(...e){return f(this._observable),this._emitBeforeChanges(1)||(this._splice(this.length,0,e),this._emitAfterChanges(1)),this.length}reduce(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return f(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(f(this._observable),e<0||e>=this.length||this._emitBeforeChanges(2))return;const t=x(this._splice(e,1));return this._emitAfterChanges(2),t}removeMany(e){if(f(this._observable),!e?.length||this._emitBeforeChanges(2))return[];const t=e instanceof d?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+j(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(2),i}reverse(){if(f(this._observable),this._emitBeforeChanges(4))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(4),this}shift(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(0,1));return this._emitAfterChanges(2),e}slice(e=0,t=this.length){return f(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return f(this._observable),this._items.some(e,t)}sort(e){if(f(this._observable),!this.length||this._emitBeforeChanges(4)||!this._requiresSort(e))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(4),this}_requiresSort(e=(e,t)=>e===t?0:e<t?-1:1){const t=this.length-1;for(let s=0;s<t;s++){if(e(this.items[s],this.items[s+1])>0)return!0}return!1}splice(e,t,...s){f(this._observable),1===arguments.length&&(t=this.length),t??=0;const i=(t?2:0)|(s.length?1:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return f(this._observable),this._items.slice()}toJSON(e){f(this._observable);return this.toArray().map(t=>p(t)?t.toJSON(e):t)}toLocaleString(){return f(this._observable),this._items.toLocaleString()}toString(){return f(this._observable),this._items.toString()}unshift(...e){return f(this._observable),!e.length||this._emitBeforeChanges(1)||(this._splice(0,0,e),this._emitAfterChanges(1)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._updating=!0,this._timer=l(()=>this._dispatchChange())),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=y.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);y.release(t)}if(this._length=this._items.length,this.hasEventListener("after-remove")){const e=y.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);y.release(e)}}if(s?.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=y.acquire();r.target=this,r.cancellable=!0;const o=y.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._length=i.length,n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._length=i.length,o.reset(l),this.emit("after-add",o));y.release(o),y.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._length=i.length}}if((s?.length||h?.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new v(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=y.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,y.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=y.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),y.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}get updating(){return this._updating}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),this._updating=!1,!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;w.clear(),L.clear(),S.clear();for(const{added:t,removed:s}of e){if(t)if(0===S.size&&0===L.size)for(const e of t)w.add(e);else for(const e of t)L.has(e)?(S.add(e),L.delete(e)):S.has(e)||w.add(e);if(s)if(0===S.size&&0===w.size)for(const e of s)L.add(e);else for(const e of s)w.has(e)?w.delete(e):(S.delete(e),L.add(e))}const i=t.acquire();w.forEach(e=>{i.push(e)});const r=t.acquire();L.forEach(e=>{r.push(e)});const n=this._items,h=s.items,o=t.acquire();if(S.forEach(e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)}),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}w.clear(),L.clear(),S.clear()}};e([_()],I.prototype,"_updating",void 0),e([_()],I.prototype,"_length",void 0),e([_()],I.prototype,"length",null),e([_()],I.prototype,"items",null),e([_({readOnly:!0})],I.prototype,"updating",null),I=d=e([g("esri.core.Collection")],I);const q=I;export{q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import o from"./Collection.js";import{sync as e}from"./reactiveUtils.js";import{property as r}from"./accessorSupport/decorators/property.js";import{subclass as s}from"./accessorSupport/decorators/subclass.js";import{autorun as i}from"./accessorSupport/trackingUtils.js";let l=class extends o{constructor(t){super(t),this.getCollections=null}initialize(){this.addHandles(i(()=>this._refresh(),e))}destroy(){this.getCollections=null}_refresh(){const t=this.getCollections?.();if(null==t)return void this.removeAll();let o=0;for(const e of t)null!=e&&(o=this._processCollection(o,e));this.splice(o)}_createNewInstance(t){return new o(t)}_processCollection(t,o){if(!o)return t;const e=this.itemFilterFunction??(t=>!!t);for(const r of o)if(r){if(e(r)){const o=this.indexOf(r,t);o>=0?o!==t&&this.reorder(r,t):this.add(r,t),++t}if(this.getChildrenFunction){const o=this.getChildrenFunction(r);if(Array.isArray(o))for(const e of o)t=this._processCollection(t,e);else t=this._processCollection(t,o)}}return t}};t([r()],l.prototype,"getCollections",void 0),t([r()],l.prototype,"getChildrenFunction",void 0),t([r()],l.prototype,"itemFilterFunction",void 0),l=t([s("esri.core.CollectionFlattener")],l);export{l as default};
5
+ import{__decorate as t}from"tslib";import o from"./Collection.js";import{sync as e}from"./reactiveUtils.js";import{property as r}from"./accessorSupport/decorators/property.js";import{subclass as s}from"./accessorSupport/decorators/subclass.js";import{autorun as i}from"./accessorSupport/trackingUtils.js";let n=class extends o{constructor(t){super(t),this.getCollections=null}initialize(){this.addHandles(i(()=>this._refresh(),e))}destroy(){this.getCollections=null}_refresh(){const t=this.getCollections?.();if(null==t)return void this.removeAll();let o=0;for(const e of t)null!=e&&(o=this._processCollection(o,e));this.splice(o)}_createNewInstance(t){return new o(t)}_processCollection(t,o){if(!o)return t;const e=this.itemFilterFunction??(t=>!!t);for(const r of o)if(r){if(e(r)){const o=this.indexOf(r,t);o>=0?o!==t&&this.reorder(r,t):this.add(r,t),++t}if(this.getChildrenFunction){const o=this.getChildrenFunction(r);if(Array.isArray(o))for(const e of o)t=this._processCollection(t,e);else t=this._processCollection(t,o)}}return t}};t([r()],n.prototype,"getCollections",void 0),t([r()],n.prototype,"getChildrenFunction",void 0),t([r()],n.prototype,"itemFilterFunction",void 0),n=t([s("esri.core.CollectionFlattener")],n);const l=n;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function o(n,t){if(!t)return n;for(const e of t)n.push(e);return n}function u(n){return n}function f(n,t=u){if(!n||0===n.length)return;let e=n[0],r=t(e);for(let l=1;l<n.length;++l){const o=n[l],u=Number(t(o));u>r&&(r=u,e=o)}return e}function i(n,t=u){return f(n,n=>-t(n))}function c(n,t){return t?n.filter((n,e,r)=>r.findIndex(t.bind(null,n))===e):Array.from(new Set(n))}function s(n,t,e,r,l,o,u){if(null==n&&null==r)return!0;t=Math.max(0,t),l=Math.max(0,l),e=Math.max(0,e<0?(n?.length??0)+e:e),o=Math.max(0,o<0?(r?.length??0)+o:o);const f=e-t;if(null==n||null==r||f!==o-l)return!1;if(u){for(let i=0;i<f;i++)if(!u(n[t+i],r[l+i]))return!1}else for(let i=0;i<f;i++)if(n[t+i]!==r[l+i])return!1;return!0}function h(n,t,e){return s(n,0,n?.length??0,t,0,t?.length??0,e)}function a(){return(n,t)=>{if(null==n&&null==t)return!0;if(null==n||null==t||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}}function g(n,t){let e=n.length!==t.length;e&&(n.length=t.length);for(let r=0;r<t.length;++r)n[r]!==t[r]&&(n[r]=t[r],e=!0);return e}function d(n,t,e){let r,l;return e?(r=t.filter(t=>!n.some(n=>e(n,t))),l=n.filter(n=>!t.some(t=>e(t,n)))):(r=t.filter(t=>!n.includes(t)),l=n.filter(n=>!t.includes(n))),{added:r,removed:l}}function m(n,t,e){return n&&t?e?n.filter(n=>t.findIndex(t=>e(n,t))>-1):n.filter(n=>t.includes(n)):[]}function p(n){return n&&"number"==typeof n.length}function M(n,t){const e=n.length;if(0===e)return[];const r=[];for(let l=0;l<e;l+=t)r.push(n.slice(l,l+t));return r}function x(n,t){void 0===t&&(t=n,n=0);const e=new Array(t-n);for(let r=n;r<t;r++)e[r-n]=r;return e}function w(n,t,e){const r=n.length;let l=0,o=r-1;for(;l<o;){const e=l+Math.floor((o-l)/2);t>n[e]?l=e+1:o=e}const u=n[l];return e?t>=n[r-1]?-1:u===t?l:l-1:u===t?l:-1}class b{constructor(){this.last=0}}const y=new b;function S(n,t,e,r){r=r||y;const l=Math.max(0,r.last-10);for(let u=l;u<e;++u)if(n[u]===t)return r.last=u,u;const o=Math.min(l,e);for(let u=0;u<o;++u)if(n[u]===t)return r.last=u,u;return-1}function j(t,e,r,l){const o=r??t.length,u=S(t,n(e),o,l);if(-1!==u)return t[u]=t[o-1],null==r&&t.pop(),e}const v=new Set;function z(n,t,e=n.length,r=t.length,l,o){if(0===r||0===e)return e;v.clear();for(let f=0;f<r;++f)v.add(t[f]);l=l||y;const u=Math.max(0,l.last-10);for(let f=u;f<e;++f)if(v.has(n[f])&&(o?.push(n[f]),v.delete(n[f]),n[f]=n[e-1],--e,--f,0===v.size||0===e))return v.clear(),e;for(let f=0;f<u;++f)if(v.has(n[f])&&(o?.push(n[f]),v.delete(n[f]),n[f]=n[e-1],--e,--f,0===v.size||0===e))return v.clear(),e;return v.clear(),e}function A(n,t){let e=0;for(let r=0;r<n.length;++r){const l=n[r];t(l,r)&&(n[e]=l,e++)}return n.length=e,n}function I(n,t,e){const r=n.length;if(t>=r)return n.slice();const l=C(e),o=new Set,u=[];for(;u.length<t;){const t=Math.floor(l()*r);o.has(t)||(o.add(t),u.push(n[t]))}return u}function C(n){return n?(F.seed=n,()=>F.getFloat()):Math.random}const F=new t;function G(n,t){if(!n)return n;const e=C(t);for(let r=n.length-1;r>0;r--){const t=Math.floor(e()*(r+1)),l=n[r];n[r]=n[t],n[t]=l}return n}function L(n,t){const e=n.indexOf(t);return-1!==e?(n.splice(e,1),t):null}function N(n,t){return null!=n}function O(n,...t){for(const e of t)null!=e&&n.push(e);return n.length}function R(n,t){return n.reduce((n,e)=>t(e)?n+1:n,0)}const U=[];export{b as PositionHint,o as addMany,w as binaryIndexOf,R as countIf,d as difference,U as emptyArray,h as equals,A as filterInPlace,C as getRandomNumberGenerator,S as indexOf,m as intersect,p as isArrayLike,N as isSome,a as makeArrayEquals,f as max,i as min,I as pickRandom,O as pushIfSome,x as range,e as reallocGrowthFactor,r as reallocShrinkFactor,l as reallocShrinkThreshold,L as remove,j as removeUnordered,z as removeUnorderedMany,G as shuffle,s as sliceEquals,M as splitIntoChunks,c as unique,g as update};
5
+ import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function u(n,t){if(!t)return n;for(const e of t)n.push(e);return n}function o(n){return n}function f(n,t=o){if(!n||0===n.length)return;let e=n[0],r=t(e);for(let l=1;l<n.length;++l){const u=n[l],o=Number(t(u));o>r&&(r=o,e=u)}return e}function i(n,t=o){return f(n,n=>-t(n))}function c(n,t){return t?n.filter((n,e,r)=>r.findIndex(t.bind(null,n))===e):Array.from(new Set(n))}function s(n,t,e,r,l,u,o){if(null==n&&null==r)return!0;t=Math.max(0,t),l=Math.max(0,l),e=Math.max(0,e<0?(n?.length??0)+e:e),u=Math.max(0,u<0?(r?.length??0)+u:u);const f=e-t;if(null==n||null==r||f!==u-l)return!1;if(o){for(let i=0;i<f;i++)if(!o(n[t+i],r[l+i]))return!1}else for(let i=0;i<f;i++)if(n[t+i]!==r[l+i])return!1;return!0}function h(n,t,e){return s(n,0,n?.length??0,t,0,t?.length??0,e)}function a(){return(n,t)=>{if(null==n&&null==t)return!0;if(null==n||null==t||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}}function g(n,t){let e=n.length!==t.length;e&&(n.length=t.length);for(let r=0;r<t.length;++r)n[r]!==t[r]&&(n[r]=t[r],e=!0);return e}function d(n,t,e){let r,l;return e?(r=t.filter(t=>!n.some(n=>e(n,t))),l=n.filter(n=>!t.some(t=>e(t,n)))):(r=t.filter(t=>!n.includes(t)),l=n.filter(n=>!t.includes(n))),{added:r,removed:l}}function m(n,t,e){return n&&t?e?n.filter(n=>t.findIndex(t=>e(n,t))>-1):n.filter(n=>t.includes(n)):[]}function p(n){return n&&"number"==typeof n.length}function M(n,t){const e=n.length;if(0===e)return[];const r=[];for(let l=0;l<e;l+=t)r.push(n.slice(l,l+t));return r}function x(n,t){void 0===t&&(t=n,n=0);const e=new Array(t-n);for(let r=n;r<t;r++)e[r-n]=r;return e}function w(n,t,e){const r=n.length;let l=0,u=r-1;for(;l<u;){const e=l+Math.floor((u-l)/2);t>n[e]?l=e+1:u=e}const o=n[l];return e?t>=n[r-1]?-1:o===t?l:l-1:o===t?l:-1}class y{constructor(){this.last=0}}const A=new y;function b(n,t,e,r){r=r||A;const l=Math.max(0,r.last-10);for(let o=l;o<e;++o)if(n[o]===t)return r.last=o,o;const u=Math.min(l,e);for(let o=0;o<u;++o)if(n[o]===t)return r.last=o,o;return-1}function S(t,e,r,l){const u=r??t.length,o=b(t,n(e),u,l);if(-1!==o)return t[o]=t[u-1],null==r&&t.pop(),e}const j=new Set;function v(n,t,e=n.length,r=t.length,l,u){if(0===r||0===e)return e;j.clear();for(let f=0;f<r;++f)j.add(t[f]);l=l||A;const o=Math.max(0,l.last-10);for(let f=o;f<e;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;for(let f=0;f<o;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;return j.clear(),e}function z(n,t){let e=0;for(let r=0;r<n.length;++r){const l=n[r];t(l,r)&&(n[e]=l,e++)}return n.length=e,n}function I(n,t,e){const r=n.length;if(t>=r)return n.slice();const l=C(e),u=new Set,o=[];for(;o.length<t;){const t=Math.floor(l()*r);u.has(t)||(u.add(t),o.push(n[t]))}return o}function C(n){return n?(F.seed=n,()=>F.getFloat()):Math.random}const F=new t;function G(n,t){if(!n)return n;const e=C(t);for(let r=n.length-1;r>0;r--){const t=Math.floor(e()*(r+1)),l=n[r];n[r]=n[t],n[t]=l}return n}function L(n,t){const e=n.indexOf(t);return-1!==e?(n.splice(e,1),t):null}function N(n,t){return null!=n}function O(n,...t){for(const e of t)null!=e&&n.push(e);return n.length}function R(n,t){return n.reduce((n,e)=>t(e)?n+1:n,0)}function U(n){return Array.isArray(n)}const k=[];export{y as PositionHint,u as addMany,w as binaryIndexOf,R as countIf,d as difference,k as emptyArray,h as equals,z as filterInPlace,C as getRandomNumberGenerator,b as indexOf,m as intersect,p as isArrayLike,U as isArrayWithReadonly,N as isSome,a as makeArrayEquals,f as max,i as min,I as pickRandom,O as pushIfSome,x as range,e as reallocGrowthFactor,r as reallocShrinkFactor,l as reallocShrinkThreshold,L as remove,S as removeUnordered,v as removeUnorderedMany,G as shuffle,s as sliceEquals,M as splitIntoChunks,c as unique,g as update};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../core/mathUtils.js";import{s as t,m as s,b as r,r as i,c}from"../../../chunks/vec42.js";import{ONES as n,ZEROS as l,create as u}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getFloat16ArrayConstructor as a,hasNativeFloat16Array as f}from"../float16.js";import{BufferViewMat3Impl as p}from"./internals/Mat3.js";import{BufferViewMat4Impl as y}from"./internals/Mat4.js";import{BufferViewScalarImpl as h}from"./internals/Scalar.js";import{BufferViewVec2Impl as o}from"./internals/Vec2.js";import{BufferViewVec3Impl as m}from"./internals/Vec3.js";import{BufferViewVec4Impl as T}from"./internals/Vec4.js";import{assert as d}from"../../../views/3d/webgl-engine/lib/Util.js";class x extends h{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}static{this.ElementType="f16"}}class B extends h{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}static{this.ElementType="f32"}}class E extends o{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(E,e,t)}static{this.ElementType="f16"}}class A extends o{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(A,e,t)}static{this.ElementType="f32"}}class b extends m{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(b,e,t)}static{this.ElementType="f16"}}class U extends m{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(U,e,t)}static fromTypedArray(e,t){return new U(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class F extends T{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(F,e,t)}static{this.ElementType="f16"}}class I extends T{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(I,e,t)}static{this.ElementType="f32"}}class g extends p{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(g,e,t)}static{this.ElementType="f32"}}class j extends p{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(j,e,t)}static{this.ElementType="f64"}}class V extends y{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(V,e,t)}static{this.ElementType="f32"}}class O extends y{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(O,e,t)}static{this.ElementType="f64"}}class w extends h{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(w,e,t)}static{this.ElementType="f64"}}class M extends o{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(M,e,t)}static{this.ElementType="f64"}}class v extends m{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(v,e,t)}static fromTypedArray(e,t){return new v(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class L extends T{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(L,e,t)}static{this.ElementType="f64"}}class S extends h{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(S,e,t)}static{this.ElementType="u8"}}class k extends o{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(k,e,t)}static{this.ElementType="u8"}}class q extends m{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(q,e,t)}static fromTypedArray(e,t){return new q(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class z extends T{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(z,e,t)}static{this.ElementType="u8"}}class C extends h{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(C,e,t)}static{this.ElementType="u16"}}class D extends o{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(D,e,t)}static{this.ElementType="u16"}}class G extends m{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(G,e,t)}static{this.ElementType="u16"}}class H extends T{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(H,e,t)}static{this.ElementType="u16"}}class J extends h{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(J,e,t)}static{this.ElementType="u32"}}class K extends o{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(K,e,t)}static{this.ElementType="u32"}}class N extends m{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(N,e,t)}static{this.ElementType="u32"}}class P extends T{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(P,e,t)}static{this.ElementType="u32"}}class Q extends h{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(Q,e,t)}static{this.ElementType="i8"}}class R extends o{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(R,e,t)}static{this.ElementType="i8"}}class W extends m{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(W,e,t)}static{this.ElementType="i8"}}class X extends T{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(X,e,t)}static{this.ElementType="i8"}}class Y extends h{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(Y,e,t)}static{this.ElementType="i16"}}class Z extends o{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(Z,e,t)}static{this.ElementType="i16"}}class $ extends m{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer($,e,t)}static{this.ElementType="i16"}}class _ extends T{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(_,e,t)}static{this.ElementType="i16"}}class ee extends h{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(ee,e,t)}static{this.ElementType="i32"}}class te extends o{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(te,e,t)}static{this.ElementType="i32"}}class se extends m{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(se,e,t)}static{this.ElementType="i32"}}class re extends T{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(re,e,t)}static{this.ElementType="i32"}}class ie extends S{constructor(e,t=0,s,r){super(e,t,s,r)}get(e){return this.typedBuffer[e*this.typedBufferStride]/255}set(t,s){this.typedBuffer[t*this.typedBufferStride]=Math.round(255*e(s,0,1))}slice(e,t){return this.sliceBuffer(ie,e,t)}}class ce extends z{constructor(e,t=0,s,r){super(e,t,s,r)}getVec(e,s){return t(s,super.getVec(e,s),1/255)}setVec(e,c){s(ne,r(ne,c,l),n),t(ne,ne,255),i(ne,ne),super.setVec(e,ne)}get(e,t){return super.get(e,t)/255}set(t,s,r){super.set(t,s,Math.round(255*e(r,0,1)))}setValues(e,t,s,r,i){c(ne,t,s,r,i),this.setVec(e,ne)}slice(e,t){return this.sliceBuffer(ce,e,t)}}const ne=u();export{B as BufferViewFloat,x as BufferViewFloat16,w as BufferViewFloat64,Y as BufferViewInt16,ee as BufferViewInt32,Q as BufferViewInt8,g as BufferViewMat3f,j as BufferViewMat3f64,V as BufferViewMat4f,O as BufferViewMat4f64,C as BufferViewUint16,J as BufferViewUint32,S as BufferViewUint8,ie as BufferViewUnorm8,A as BufferViewVec2f,E as BufferViewVec2f16,M as BufferViewVec2f64,Z as BufferViewVec2i16,te as BufferViewVec2i32,R as BufferViewVec2i8,D as BufferViewVec2u16,K as BufferViewVec2u32,k as BufferViewVec2u8,U as BufferViewVec3f,b as BufferViewVec3f16,v as BufferViewVec3f64,$ as BufferViewVec3i16,se as BufferViewVec3i32,W as BufferViewVec3i8,G as BufferViewVec3u16,N as BufferViewVec3u32,q as BufferViewVec3u8,ce as BufferViewVec4Unorm8,I as BufferViewVec4f,F as BufferViewVec4f16,L as BufferViewVec4f64,_ as BufferViewVec4i16,re as BufferViewVec4i32,X as BufferViewVec4i8,H as BufferViewVec4u16,P as BufferViewVec4u32,z as BufferViewVec4u8};
5
+ import{clamp as e}from"../../../core/mathUtils.js";import{s as t,m as s,b as r,r as i,c}from"../../../chunks/vec42.js";import{create as n,ONES as l,ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getFloat16ArrayConstructor as a,hasNativeFloat16Array as f}from"../float16.js";import{BufferViewMat3Impl as p}from"./internals/Mat3.js";import{BufferViewMat4Impl as y}from"./internals/Mat4.js";import{BufferViewScalarImpl as h}from"./internals/Scalar.js";import{BufferViewVec2Impl as o}from"./internals/Vec2.js";import{BufferViewVec3Impl as m}from"./internals/Vec3.js";import{BufferViewVec4Impl as T}from"./internals/Vec4.js";import{assert as d}from"../../../views/3d/webgl-engine/lib/Util.js";class x extends h{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}static{this.ElementType="f16"}}class B extends h{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}static{this.ElementType="f32"}}class E extends o{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(E,e,t)}static{this.ElementType="f16"}}class A extends o{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(A,e,t)}static{this.ElementType="f32"}}class b extends m{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(b,e,t)}static{this.ElementType="f16"}}class U extends m{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(U,e,t)}static fromTypedArray(e,t){return new U(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class F extends T{constructor(e,t=0,s,r){d(f),super(a(),e,t,s,r),this.elementType="f16"}slice(e,t){return this.sliceBuffer(F,e,t)}static{this.ElementType="f16"}}class I extends T{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(I,e,t)}static{this.ElementType="f32"}}class g extends p{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(g,e,t)}static{this.ElementType="f32"}}class j extends p{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(j,e,t)}static{this.ElementType="f64"}}class V extends y{constructor(e,t=0,s,r){super(Float32Array,e,t,s,r),this.elementType="f32"}slice(e,t){return this.sliceBuffer(V,e,t)}static{this.ElementType="f32"}}class O extends y{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(O,e,t)}static{this.ElementType="f64"}}class w extends h{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(w,e,t)}static{this.ElementType="f64"}}class M extends o{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(M,e,t)}static{this.ElementType="f64"}}class v extends m{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(v,e,t)}static fromTypedArray(e,t){return new v(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class L extends T{constructor(e,t=0,s,r){super(Float64Array,e,t,s,r),this.elementType="f64"}slice(e,t){return this.sliceBuffer(L,e,t)}static{this.ElementType="f64"}}class S extends h{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(S,e,t)}static{this.ElementType="u8"}}class k extends o{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(k,e,t)}static{this.ElementType="u8"}}class q extends m{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(q,e,t)}static fromTypedArray(e,t){return new q(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class z extends T{constructor(e,t=0,s,r){super(Uint8Array,e,t,s,r),this.elementType="u8"}slice(e,t){return this.sliceBuffer(z,e,t)}static{this.ElementType="u8"}}class C extends h{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(C,e,t)}static{this.ElementType="u16"}}class D extends o{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(D,e,t)}static{this.ElementType="u16"}}class G extends m{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(G,e,t)}static{this.ElementType="u16"}}class H extends T{constructor(e,t=0,s,r){super(Uint16Array,e,t,s,r),this.elementType="u16"}slice(e,t){return this.sliceBuffer(H,e,t)}static{this.ElementType="u16"}}class J extends h{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(J,e,t)}static{this.ElementType="u32"}}class K extends o{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(K,e,t)}static{this.ElementType="u32"}}class N extends m{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(N,e,t)}static{this.ElementType="u32"}}class P extends T{constructor(e,t=0,s,r){super(Uint32Array,e,t,s,r),this.elementType="u32"}slice(e,t){return this.sliceBuffer(P,e,t)}static{this.ElementType="u32"}}class Q extends h{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(Q,e,t)}static{this.ElementType="i8"}}class R extends o{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(R,e,t)}static{this.ElementType="i8"}}class W extends m{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(W,e,t)}static{this.ElementType="i8"}}class X extends T{constructor(e,t=0,s,r){super(Int8Array,e,t,s,r),this.elementType="i8"}slice(e,t){return this.sliceBuffer(X,e,t)}static{this.ElementType="i8"}}class Y extends h{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(Y,e,t)}static{this.ElementType="i16"}}class Z extends o{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(Z,e,t)}static{this.ElementType="i16"}}class $ extends m{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer($,e,t)}static{this.ElementType="i16"}}class _ extends T{constructor(e,t=0,s,r){super(Int16Array,e,t,s,r),this.elementType="i16"}slice(e,t){return this.sliceBuffer(_,e,t)}static{this.ElementType="i16"}}class ee extends h{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(ee,e,t)}static{this.ElementType="i32"}}class te extends o{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(te,e,t)}static{this.ElementType="i32"}}class se extends m{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(se,e,t)}static{this.ElementType="i32"}}class re extends T{constructor(e,t=0,s,r){super(Int32Array,e,t,s,r),this.elementType="i32"}slice(e,t){return this.sliceBuffer(re,e,t)}static{this.ElementType="i32"}}class ie extends S{constructor(e,t=0,s,r){super(e,t,s,r)}get(e){return this.typedBuffer[e*this.typedBufferStride]/255}set(t,s){this.typedBuffer[t*this.typedBufferStride]=Math.round(255*e(s,0,1))}slice(e,t){return this.sliceBuffer(ie,e,t)}}class ce extends z{constructor(e,t=0,s,r){super(e,t,s,r)}getVec(e,s){return t(s,super.getVec(e,s),1/255)}setVec(e,c){s(ne,r(ne,c,u),l),t(ne,ne,255),i(ne,ne),super.setVec(e,ne)}get(e,t){return super.get(e,t)/255}set(t,s,r){super.set(t,s,Math.round(255*e(r,0,1)))}setValues(e,t,s,r,i){c(ne,t,s,r,i),this.setVec(e,ne)}slice(e,t){return this.sliceBuffer(ce,e,t)}}const ne=n();export{B as BufferViewFloat,x as BufferViewFloat16,w as BufferViewFloat64,Y as BufferViewInt16,ee as BufferViewInt32,Q as BufferViewInt8,g as BufferViewMat3f,j as BufferViewMat3f64,V as BufferViewMat4f,O as BufferViewMat4f64,C as BufferViewUint16,J as BufferViewUint32,S as BufferViewUint8,ie as BufferViewUnorm8,A as BufferViewVec2f,E as BufferViewVec2f16,M as BufferViewVec2f64,Z as BufferViewVec2i16,te as BufferViewVec2i32,R as BufferViewVec2i8,D as BufferViewVec2u16,K as BufferViewVec2u32,k as BufferViewVec2u8,U as BufferViewVec3f,b as BufferViewVec3f16,v as BufferViewVec3f64,$ as BufferViewVec3i16,se as BufferViewVec3i32,W as BufferViewVec3i8,G as BufferViewVec3u16,N as BufferViewVec3u32,q as BufferViewVec3u8,ce as BufferViewVec4Unorm8,I as BufferViewVec4f,F as BufferViewVec4f16,L as BufferViewVec4f64,_ as BufferViewVec4i16,re as BufferViewVec4i32,X as BufferViewVec4i8,H as BufferViewVec4u16,P as BufferViewVec4u32,z as BufferViewVec4u8};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{interpolateCubicBezier as t}from"./bezierCurveUtils.js";import{deriveCircleFromCircularArc as s}from"./circularArcUtils.js";import{isCurvedGeometry as i,getCurves as n,getEndpoint as e,isCoordinate as r,isBezierCurve as a,isCircularArc as h,isEllipticArc4 as c,isEllipticArc7 as o,cloneCurve as u}from"./curveUtils.js";import{deriveCircleFromEllipticArc4 as p}from"./ellipticArc4Utils.js";import{deriveEllipse as l,interpolateEllipse as d}from"./ellipticArc7Utils.js";import{interpolateSegment as m,pointToSegmentDistance2 as S,distance2 as E}from"./mathUtils.js";const v={maxSegmentLength:1/0,maxDeviation:1/0,maxSegmentsPerCurve:12e3,minSegmentsPerCurve:1},f=1e-6,g=[0,0];function M(t){return{maxSegmentLength:t.maxSegmentLength??v.maxSegmentLength,maxDeviation:t.maxDeviation??v.maxDeviation,maxSegmentsPerCurve:t.maxSegmentsPerCurve??v.maxSegmentsPerCurve,minSegmentsPerCurve:Math.max(t.minSegmentsPerCurve??v.minSegmentsPerCurve,1)}}class P{constructor(t,s){this.curveStart=t,this.curveEnd=s,this.tStart=0,this.tEnd=0,this.tEndStack=[],this.arcEndStack=[]}get stackSize(){return this.tEndStack.length}initialize(t,s){this.tStart=0,this.arcStart=t,this.tEndStack.push(1),this.arcEndStack.push(s)}splitAt(t){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(t),this.arcEndStack.push(this.interpolate(t))}splitInHalf(){return this.splitAt((this.tStart+this.tEnd)/2)}pop(){this.tEnd=this.tEndStack.pop(),this.arcEnd=this.arcEndStack.pop()}next(){this.tStart=this.tEnd,this.arcStart=this.arcEnd}densify(t,{maxDeviation:s,maxSegmentLength:i,maxSegmentsPerCurve:n,minSegmentsPerCurve:e}){const r=i*i,a=s*s,h=1/n,c=this.interpolate(0),o=this.interpolate(1);E(this.curveStart,c)>f&&t.push(c),this.initialize(c,o);const u=1/e;for(let p=e-1;p>0;p--){const t=p*u;this.pop(),this.splitAt(t)}for(;this.stackSize>0;)this.pop(),this.tStart===this.tEnd||this.tEnd-this.tStart<h||(0===r||!isFinite(r)||E(this.arcStart,this.arcEnd)<r)&&(0===a||!isFinite(a)||this.getDeviation2()<a)?(t.push(this.arcEnd),this.next()):this.splitInHalf();return E(this.curveEnd,o)>f&&t.push([...this.curveEnd]),t}}class x extends P{constructor(t,s){const[i,n,e]=s.b;super(t,i),this._controlPointsStack=[],this._curveControlPoints=[n,e],this._arcControlPoints=[n,e],this._controlPointsStack.push(this._arcControlPoints)}splitAt(t){const{arcStart:s,arcEnd:i,tStart:n,tEnd:e}=this,[r,a]=this._arcControlPoints,h=(t-n)/(e-n),c=m([],s,r,h),o=m(g,r,a,h),u=m([],a,i,h),p=m([],c,o,h),l=m([],o,u,h),d=m([],p,l,h);this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this._controlPointsStack.push([l,u]),this.tEndStack.push(t),this.arcEndStack.push(d),this._arcControlPoints[0]=c,this._arcControlPoints[1]=p,this._controlPointsStack.push(this._arcControlPoints)}pop(){super.pop(),this._arcControlPoints=this._controlPointsStack.pop()}interpolate(s){const{curveStart:i,curveEnd:n}=this,[e,r]=this._curveControlPoints;return t(i,e,r,n,s)}getDeviation2(){const{arcStart:t,arcEnd:s}=this,[i,n]=this._arcControlPoints;return Math.max(S(i,t,s),S(n,t,s))}}class k extends P{constructor(t,s){const[i]=s.a;super(t,i),this._derivedEllipse=l(t,s)}pop(){super.pop(),this._tMid=(this.tStart+this.tEnd)/2,this._arcMid=this.interpolate(this._tMid)}splitInHalf(){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(this._tMid),this.arcEndStack.push(this._arcMid)}interpolate(t){return d(this._derivedEllipse,t)}getDeviation2(){return S(this._arcMid,this.arcStart,this.arcEnd)}}function C(t,s,i,{cx:n,cy:e,radius:r,thetaStart:a,thetaEnd:h,isInvalid:c},{maxDeviation:o,maxSegmentLength:u,maxSegmentsPerCurve:p,minSegmentsPerCurve:l}){if(c)return t.push([...i]),t;const d=2*r,m=[n+r*Math.cos(a),e+r*Math.sin(a)],S=[n+r*Math.cos(h),e+r*Math.sin(h)];E(s,m)>f&&t.push(m);const v=Math.abs(h-a),g=u<d?2*Math.asin(u/d):v,M=o<=r?2*Math.acos(1-o/r):v,P=Math.min(g,M),x=Math.min(p,Math.max(l,Math.ceil(Math.abs(v/P)))),k=1/x;for(let E=1;E<x;E++){const s=E*k,i=a*(1-s)+h*s;t.push([n+r*Math.cos(i),e+r*Math.sin(i)])}return t.push(S),E(i,S)>f&&t.push([...i]),t}function _(t,s,i,n){return new x(s,i).densify(t,n)}function Z(t,i,n,e){const r=s(i,n),[a]=n.c;return C(t,i,a,r,e)}function A(t,s,i,n){const e=p(s,i),[r]=i.a;return C(t,s,r,e,n)}function D(t,s,i,n){const[e,r,a,h,c,o,u]=i.a;return 0===o||0===u?(t.push([...e]),t):new k(s,i).densify(t,n)}function R(t,s,i,n){return r(i)?(t.push([...i]),t):a(i)?_(t,s,i,n):h(i)?Z(t,s,i,n):c(i)?A(t,s,i,n):D(t,s,i,n)}function y(t,s){if(!i(t))return t;const r=M(s),a=n(t),h=[];for(const i of a){const t=[];for(let s=0;s<i.length-1;s++){const n=s+1,a=[...e(i[s])];0===s&&t.push(a);R(t,a,i[n],r)}h.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},paths:h,spatialReference:t.spatialReference}:{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},rings:h,spatialReference:t.spatialReference}}function j(t,s,p){if(!i(t))return t;const l=new Set(s),d=M(p),m=n(t),S=[];let E=!1;for(const i of m){const t=[];for(let s=0;s<i.length-1;s++){const n=s+1,p=[...e(i[s])];0===s&&t.push(p);const m=i[n];r(m)?t.push([...m]):a(m)&&!l.has("esriGeometryBezier3Curve")?_(t,p,m,d):h(m)&&!l.has("esriGeometryCircularArc")?Z(t,p,m,d):c(m)&&!l.has("esriGeometryEllipticArc")?A(t,p,m,d):o(m)&&!l.has("esriGeometryEllipticArc")?D(t,p,m,d):(t.push(u(m)),E=!0)}S.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},spatialReference:t.spatialReference,...E?{curvePaths:S}:{paths:S}}:{hasZ:t.hasZ,hasM:t.hasM,spatialReference:t.spatialReference,...E?{curveRings:S}:{rings:S}}}export{y as densifyCurvedGeometry,j as selectiveDensifyCurvedGeometry};
5
+ import{interpolateCubicBezier as t}from"./bezierCurveUtils.js";import{deriveCircleFromCircularArc as s}from"./circularArcUtils.js";import{isCurvedGeometry as i,getCurves as n,getEndpoint as e,isCoordinate as r,isBezierCurve as a,isCircularArc as h,isEllipticArc4 as c,isEllipticArc7 as o,cloneCurve as u}from"./curveUtils.js";import{deriveCircleFromEllipticArc4 as p}from"./ellipticArc4Utils.js";import{deriveEllipse as l,interpolateEllipse as d}from"./ellipticArc7Utils.js";import{interpolateSegment as m,pointToSegmentDistance2 as S,distance2 as E}from"./mathUtils.js";const v={maxSegmentLength:1/0,maxDeviation:1/0,maxSegmentsPerCurve:12e3,minSegmentsPerCurve:1},f=1e-6,g=[0,0];function M(t){return{maxSegmentLength:t.maxSegmentLength??v.maxSegmentLength,maxDeviation:t.maxDeviation??v.maxDeviation,maxSegmentsPerCurve:t.maxSegmentsPerCurve??v.maxSegmentsPerCurve,minSegmentsPerCurve:Math.max(t.minSegmentsPerCurve??v.minSegmentsPerCurve,1)}}class P{constructor(t,s){this.curveStart=t,this.curveEnd=s,this.tStart=0,this.tEnd=0,this.tEndStack=[],this.arcEndStack=[]}get stackSize(){return this.tEndStack.length}initialize(t,s){this.tStart=0,this.arcStart=t,this.tEndStack.push(1),this.arcEndStack.push(s)}splitAt(t){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(t),this.arcEndStack.push(this.interpolate(t))}splitInHalf(){return this.splitAt((this.tStart+this.tEnd)/2)}pop(){this.tEnd=this.tEndStack.pop(),this.arcEnd=this.arcEndStack.pop()}next(){this.tStart=this.tEnd,this.arcStart=this.arcEnd}densify(t,{maxDeviation:s,maxSegmentLength:i,maxSegmentsPerCurve:n,minSegmentsPerCurve:e}){const r=i*i,a=s*s,h=1/n,c=this.interpolate(0),o=this.interpolate(1);E(this.curveStart,c)>f&&t.push(c),this.initialize(c,o);const u=1/e;for(let p=e-1;p>0;p--){const t=p*u;this.pop(),this.splitAt(t)}for(;this.stackSize>0;)this.pop(),this.tStart===this.tEnd||this.tEnd-this.tStart<h||(0===r||!isFinite(r)||E(this.arcStart,this.arcEnd)<r)&&(0===a||!isFinite(a)||this.getDeviation2()<a)?(t.push(this.arcEnd),this.next()):this.splitInHalf();return E(this.curveEnd,o)>f&&t.push([...this.curveEnd]),t}}class x extends P{constructor(t,s){const[i,n,e]=s.b;super(t,i),this._controlPointsStack=[],this._curveControlPoints=[n,e],this._arcControlPoints=[n,e],this._controlPointsStack.push(this._arcControlPoints)}splitAt(t){const{arcStart:s,arcEnd:i,tStart:n,tEnd:e}=this,[r,a]=this._arcControlPoints,h=(t-n)/(e-n),c=m([],s,r,h),o=m(g,r,a,h),u=m([],a,i,h),p=m([],c,o,h),l=m([],o,u,h),d=m([],p,l,h);this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this._controlPointsStack.push([l,u]),this.tEndStack.push(t),this.arcEndStack.push(d),this._arcControlPoints[0]=c,this._arcControlPoints[1]=p,this._controlPointsStack.push(this._arcControlPoints)}pop(){super.pop(),this._arcControlPoints=this._controlPointsStack.pop()}interpolate(s){const{curveStart:i,curveEnd:n}=this,[e,r]=this._curveControlPoints;return t(i,e,r,n,s)}getDeviation2(){const{arcStart:t,arcEnd:s}=this,[i,n]=this._arcControlPoints;return Math.max(S(i,t,s),S(n,t,s))}}class k extends P{constructor(t,s){const[i]=s.a;super(t,i),this._derivedEllipse=l(t,s)}pop(){super.pop(),this._tMid=(this.tStart+this.tEnd)/2,this._arcMid=this.interpolate(this._tMid)}splitInHalf(){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(this._tMid),this.arcEndStack.push(this._arcMid)}interpolate(t){return d(this._derivedEllipse,t)}getDeviation2(){return S(this._arcMid,this.arcStart,this.arcEnd)}}function C(t,s,i,{cx:n,cy:e,radius:r,thetaStart:a,thetaEnd:h,isInvalid:c},{maxDeviation:o,maxSegmentLength:u,maxSegmentsPerCurve:p,minSegmentsPerCurve:l}){if(c)return t.push([...i]),t;const d=2*r,m=[n+r*Math.cos(a),e+r*Math.sin(a)],S=[n+r*Math.cos(h),e+r*Math.sin(h)];E(s,m)>f&&t.push(m);const v=Math.abs(h-a),g=u<d?2*Math.asin(u/d):v,M=o<=r?2*Math.acos(1-o/r):v,P=Math.min(g,M),x=Math.min(p,Math.max(l,Math.ceil(Math.abs(v/P)))),k=1/x;for(let E=1;E<x;E++){const s=E*k,i=a*(1-s)+h*s;t.push([n+r*Math.cos(i),e+r*Math.sin(i)])}return t.push(S),E(i,S)>f&&t.push([...i]),t}function _(t,s,i,n){return new x(s,i).densify(t,n)}function Z(t,i,n,e){const r=s(i,n),[a]=n.c;return C(t,i,a,r,e)}function A(t,s,i,n){const e=p(s,i),[r]=i.a;return C(t,s,r,e,n)}function D(t,s,i,n){const[e,r,a,h,c,o,u]=i.a;return 0===o||0===u?(t.push([...e]),t):new k(s,i).densify(t,n)}function R(t,s,i,n){return r(i)?(t.push([...i]),t):a(i)?_(t,s,i,n):h(i)?Z(t,s,i,n):c(i)?A(t,s,i,n):D(t,s,i,n)}function y(t,s={}){if(!i(t))return t;const r=M(s),a=n(t),h=[];for(const i of a){const t=[];for(let s=0;s<i.length-1;s++){const n=s+1,a=[...e(i[s])];0===s&&t.push(a);R(t,a,i[n],r)}h.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},paths:h,spatialReference:t.spatialReference}:{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},rings:h,spatialReference:t.spatialReference}}function j(t,s,p){if(!i(t))return t;const l=new Set(s),d=M(p),m=n(t),S=[];let E=!1;for(const i of m){const t=[];for(let s=0;s<i.length-1;s++){const n=s+1,p=[...e(i[s])];0===s&&t.push(p);const m=i[n];r(m)?t.push([...m]):a(m)&&!l.has("esriGeometryBezier3Curve")?_(t,p,m,d):h(m)&&!l.has("esriGeometryCircularArc")?Z(t,p,m,d):c(m)&&!l.has("esriGeometryEllipticArc")?A(t,p,m,d):o(m)&&!l.has("esriGeometryEllipticArc")?D(t,p,m,d):(t.push(u(m)),E=!0)}S.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},spatialReference:t.spatialReference,...E?{curvePaths:S}:{paths:S}}:{hasZ:t.hasZ,hasM:t.hasM,spatialReference:t.spatialReference,...E?{curveRings:S}:{rings:S}}}export{y as densifyCurvedGeometry,j as selectiveDensifyCurvedGeometry};