@arcgis/core 4.34.0-next.15 → 4.34.0-next.17

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 (216) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/DimensionSimpleStyle.js +1 -1
  5. package/analysis/DirectLineMeasurementAnalysis.js +1 -1
  6. package/analysis/LengthDimension.js +1 -1
  7. package/analysis/LineOfSightAnalysis.js +1 -1
  8. package/analysis/SliceAnalysis.js +1 -1
  9. package/analysis/SlicePlane.js +1 -1
  10. package/analysis/ViewshedAnalysis.js +1 -1
  11. package/applications/Components/sanitizerUtils.d.ts +3 -0
  12. package/applications/Components/sanitizerUtils.js +5 -0
  13. package/applications/MapViewer/layerUtils.d.ts +3 -0
  14. package/applications/MapViewer/layerUtils.js +5 -0
  15. package/applications/SceneViewer/layerUtils.d.ts +2 -2
  16. package/arcade.js +1 -1
  17. package/assets/esri/core/workers/RemoteClient.js +1 -1
  18. package/assets/esri/core/workers/chunks/{a08ce98672ab94d19613.js → 04e558a970c6a77f243e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/0d99579d8cdeddc0fc9c.js +1 -0
  20. package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +1 -0
  21. package/assets/esri/core/workers/chunks/1a7570bd2b79194ff94b.js +42 -0
  22. package/assets/esri/core/workers/chunks/{0ed4ec00ef16aa58a33d.js → 254c4f7e277ae9915dce.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2d51d0a24cdc89bafa1c.js +1 -0
  24. package/assets/esri/core/workers/chunks/2d89e354eeadadca4f7f.js +1 -0
  25. package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +1 -0
  26. package/assets/esri/core/workers/chunks/{2254989ca3ff3960f2fe.js → 400a4c9fa62964f8fa1d.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{58f403f956b7b3467344.js → 42da01bd3f401a017c0f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/445ddf57d2f503a0b98b.js +1 -0
  29. package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +1 -0
  30. package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e980a81c4d1e05f07141.js → 53e43798d08ad2075c1f.js} +1 -1
  32. package/assets/esri/core/workers/chunks/55ce214a10fb6fc2e901.js +1 -0
  33. package/assets/esri/core/workers/chunks/{a6bcae413e62cd879b46.js → 5859e425c9bca96b6c80.js} +1 -1
  34. package/assets/esri/core/workers/chunks/5bfccd5dffda74740aa4.js +1 -0
  35. package/assets/esri/core/workers/chunks/66c8816e91e3f9e214d4.js +346 -0
  36. package/assets/esri/core/workers/chunks/{948c5454881e661c3bdc.js → 78a57f5aeb277b84b3da.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +1 -0
  38. package/assets/esri/core/workers/chunks/{7f14d6cb754c7e94748c.js → 827919fe23e06e40a330.js} +139 -115
  39. package/assets/esri/core/workers/chunks/8599df135928d73da4a3.js +1 -0
  40. package/assets/esri/core/workers/chunks/87986f31061c426e761b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{7ae88c141a5d85e5bb88.js → 87a743df7d8556d5e253.js} +1 -1
  42. package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +1 -0
  43. package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +1 -0
  44. package/assets/esri/core/workers/chunks/93e66d9c49eaeb503bff.js +1 -0
  45. package/assets/esri/core/workers/chunks/974c6b0e3a1f1dd523fa.js +1 -0
  46. package/assets/esri/core/workers/chunks/aeabe203da7bcdd580cf.js +1 -0
  47. package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +1 -0
  48. package/assets/esri/core/workers/chunks/c1a72e1dbd1ba7b41965.js +1 -0
  49. package/assets/esri/core/workers/chunks/c4065934637b820cad5b.js +1 -0
  50. package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +1 -0
  51. package/assets/esri/core/workers/chunks/{05f2133f05f86266d8c7.js → d2139307f62ea8bf999a.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{3f58da371633967a61ca.js → ddb66fe6fcd0764daa7a.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{70e5848aa372475fc8fa.js → eac7af86166c09c6a9be.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{243eb8a317333ec2715b.js → f3e179b48bca50c94538.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{7317346ed8d7c5bb859d.js → f537a02dc2fc9e6435a2.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7e1906d35a764f7f10b0.js → fe1129f03476825a7344.js} +1 -1
  57. package/chunks/DefaultMaterial.glsl.js +30 -28
  58. package/chunks/RealisticTree.glsl.js +25 -22
  59. package/chunks/aiServices.js +1 -1
  60. package/config.js +1 -1
  61. package/core/LRUCache.js +1 -1
  62. package/core/MemCache.js +1 -1
  63. package/core/arrayUtils.js +1 -1
  64. package/core/urlUtils.js +1 -1
  65. package/core/workers/RemoteClient.js +1 -1
  66. package/core/workers/WorkerHandle.js +1 -1
  67. package/interfaces.d.ts +69 -25
  68. package/kernel.js +1 -1
  69. package/layers/VideoLayer.js +1 -1
  70. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  71. package/layers/mixins/FeatureLayerBase.js +1 -1
  72. package/layers/support/arcgisLayers.js +1 -1
  73. package/layers/support/fetchService.js +1 -1
  74. package/layers/support/layerUtils.js +1 -1
  75. package/package.json +1 -1
  76. package/portal/support/layersLoader.js +1 -1
  77. package/portal/support/loadUtils.js +1 -1
  78. package/portal/support/portalLayers.js +1 -1
  79. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  80. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
  81. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelFactories.js +1 -1
  82. package/rest/support/TranslateParameters.js +1 -1
  83. package/support/revision.js +1 -1
  84. package/symbols/WaterSymbol3DLayer.js +1 -1
  85. package/symbols/support/jsonUtils.js +1 -1
  86. package/symbols/support/symbolUtils.js +1 -1
  87. package/symbols/support/utils.js +1 -1
  88. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
  90. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  91. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  92. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  93. package/views/3d/FocusAreasView.js +1 -1
  94. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  95. package/views/3d/analysis/Slice/SliceController.js +1 -1
  96. package/views/3d/layers/I3SMeshView3D.js +1 -1
  97. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  98. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  99. package/views/3d/layers/RouteLayerView3D.js +1 -1
  100. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  101. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  102. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  103. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  104. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  108. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  110. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  111. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  112. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  113. package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
  114. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  115. package/views/3d/layers/support/makeScheduleFunction.js +1 -1
  116. package/views/3d/layers/support/symbolColorUtils.js +1 -1
  117. package/views/3d/state/controllers/FovController.js +1 -1
  118. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  119. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  120. package/views/3d/state/controllers/RotateController.js +1 -1
  121. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  122. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  123. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  124. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  125. package/views/3d/state/utils/navigationUtils.js +1 -1
  126. package/views/3d/support/StreamDataLoader.js +1 -1
  127. package/views/3d/terrain/OverlayRenderer.js +1 -1
  128. package/views/3d/terrain/TerrainRenderer.js +1 -1
  129. package/views/3d/terrain/TerrainSurface.js +1 -1
  130. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  131. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  132. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  133. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstanceColor.glsl.js +11 -0
  134. package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +18 -0
  135. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +40 -26
  136. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +35 -24
  137. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +12 -8
  138. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +3 -1
  139. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +26 -8
  140. package/views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js +1 -1
  141. package/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js +1 -1
  142. package/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js +1 -1
  143. package/views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js +1 -1
  144. package/views/3d/webgl-engine/core/shaderModules/Float3DrawUniform.js +1 -1
  145. package/views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js +1 -1
  146. package/views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js +1 -1
  147. package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +1 -1
  148. package/views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js +1 -1
  149. package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
  150. package/views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js +1 -1
  151. package/views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js +1 -1
  152. package/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js +1 -1
  153. package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
  154. package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +1 -1
  156. package/views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js +1 -1
  157. package/views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js +1 -1
  158. package/views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js +1 -1
  159. package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
  160. package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
  161. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  162. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  163. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  164. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  165. package/views/3d/webgl-engine/lib/Program.js +1 -1
  166. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  167. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  168. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  169. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  170. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  171. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  172. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  173. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  174. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  175. package/views/analysis/analysisViewUtils.js +1 -1
  176. package/views/webgl/Program.js +1 -1
  177. package/views/webgl/ShaderBuilder.js +1 -1
  178. package/webscene/Slide.js +1 -1
  179. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  180. package/widgets/BatchAttributeForm.js +1 -1
  181. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  182. package/widgets/FeatureTemplates.js +1 -1
  183. package/widgets/LineOfSight/LineOfSightTarget.js +1 -1
  184. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  185. package/widgets/Search/SearchViewModel.js +1 -1
  186. package/widgets/Search/support/layerSearchUtils.js +1 -1
  187. package/widgets/support/ItemList.js +1 -1
  188. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  189. package/widgets/support/SelectionList/LayerItem.js +1 -1
  190. package/widgets/support/SelectionList.js +1 -1
  191. package/widgets/support/dateUtils.js +1 -1
  192. package/widgets/support/symbolPreviewUtils.js +1 -1
  193. package/assets/esri/core/workers/chunks/0dbb350ce651bc236ec8.js +0 -1
  194. package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +0 -1
  195. package/assets/esri/core/workers/chunks/1f559f1e7f0bc0f4bf20.js +0 -346
  196. package/assets/esri/core/workers/chunks/462cc6966d060be59c7c.js +0 -1
  197. package/assets/esri/core/workers/chunks/4a805e7a57d25c4b595f.js +0 -66
  198. package/assets/esri/core/workers/chunks/58f92100b1b2343111c6.js +0 -1
  199. package/assets/esri/core/workers/chunks/5dcc8fa321f0a7c49f36.js +0 -1
  200. package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +0 -1
  201. package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +0 -1
  202. package/assets/esri/core/workers/chunks/622c0552ca3cd674d46c.js +0 -1
  203. package/assets/esri/core/workers/chunks/632d1a1287dde980479e.js +0 -1
  204. package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +0 -1
  205. package/assets/esri/core/workers/chunks/658e82c9b722852e02d0.js +0 -1
  206. package/assets/esri/core/workers/chunks/679d7baea233faf3fdbc.js +0 -1
  207. package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +0 -1
  208. package/assets/esri/core/workers/chunks/8b93cd4132934b0d7d39.js +0 -1
  209. package/assets/esri/core/workers/chunks/95507ff0a243e451b99e.js +0 -1
  210. package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +0 -1
  211. package/assets/esri/core/workers/chunks/a250a5c6e055e33bd25c.js +0 -1
  212. package/assets/esri/core/workers/chunks/b4273381dc069f4e1fa2.js +0 -1
  213. package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +0 -1
  214. package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +0 -1
  215. package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +0 -1
  216. package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{filterInPlace as r}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{equalsShallow as o}from"../../../core/lang.js";import{floatEqualUlp as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as l}from"../../../core/accessorSupport/diffUtils.js";import{projectBuffer as h}from"../../../geometry/projection/projectBuffer.js";import{fromBuffer as d,create as u}from"../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as m}from"../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../layers/graphics/dehydratedPoint.js";import{RenderingInfo as g}from"../../../renderers/support/RenderingInfo.js";import y from"../../../symbols/PointSymbol3D.js";import{Graphics3DCore as b}from"./graphics/Graphics3DCore.js";import{Graphics3DScaleVisibility as I}from"./graphics/Graphics3DScaleVisibility.js";import{boundingBoxCornersPointsStride as _,boundingBoxCornerPoints as v}from"./i3s/I3SGeometryUtil.js";import{LimitGraphicsMap as M}from"../support/LimitGraphicsMap.js";import{UpdatePolicy as E}from"../webgl-engine/lib/UpdatePolicy.js";import{hasLayerBasedScaleVisibility as j}from"../../support/layerViewUtils.js";class w{constructor(e,t){this.meta=e,this.index=t}}class G{constructor(e,t){this.graphic=e,this.geometry=t,this.components=[],this.overridesDirty=!1}}let D=class extends t{get updating(){return this._graphicsCore?.updating??!1}constructor(e){super(e),this.loadedGraphics=new M(5e4),this.slicePlaneEnabled=!1,this._renderingInfo=new g(null,new y),this._featuresMap=new Map}initialize(){const e=this.view.basemapTerrain;this._graphicsCore=new b({owner:this,layer:this.layer,preferredUpdatePolicy:E.ASYNC,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:e=>this.view.deconflictor.addGraphicsOwner(e),labeler:(e,t)=>this.view.labeler.addGraphicsOwner(e,t,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:j()?null:(t,r)=>new I({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:t,basemapTerrain:e,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then((()=>this._graphicsCore.startCreateGraphics())).catch((()=>{})),this.addHandles(a((()=>this.layer.labelingInfo),((e,t)=>{l(e,t)&&this._graphicsCore.updateLabelingInfo()})))}destroy(){this._graphicsCore=s(this._graphicsCore),this.loadedGraphics=s(this.loadedGraphics),this.view=null}addNodeMeta(e,t){let r=0;const o=e.filteredIds,i=this.view.spatialReference,s=[];for(let a=0;a<e.featureIds.length;a++){const p=e.featureIds[a];let c=null==o;if(o&&r<o.length&&p===o[r]&&(c=!0,r++),!this._enabledForFeatureInNode(e,a))continue;const l=this._featuresMap.get(p);if(l){l.components.push(new w(e,a)),this._updateLabelPosition(p);continue}const h=t(a,e),d=f(0,0,0,i),u={objectId:p,uid:n(),attributes:h,visible:c,geometry:d},m=new G(u,d);m.components.push(new w(e,a)),this._featuresMap.set(p,m),this._updateLabelGeometry(p),s.push(u)}this.loadedGraphics.addMany(s)}updateLabelPositions(e){const t=this.view.renderCoordsHelper;this._forEachGraphic(e,((r,o,i)=>{const s=this._graphicsCore.getGraphics3DGraphicById(o.uid);null!=s&&this._updateLabelGeometry(e.featureIds[r])&&s.alignWithAbsoluteElevation(i.z??0,t,!1)}))}setNodeMetaAttributes(e,t){const r=new Array;this._forEachGraphic(e,((i,s)=>{const a=t(i,e);o(s.attributes,a)||(s.attributes=a,r.push(s.uid))})),this._graphicsCore.updateLabelingInfo(r)}applyFilterChange(e){this._forEachFeature(e,((t,r,o)=>{if(!this._enabledForFeatureInNode(e,t)){const o=e.featureIds[t];switch(this._removeFeature(r,e,t)){case F.REMOVED:this.loadedGraphics.removeManyByObjectId([o]);break;case F.MODIFIED:this._updateLabelPosition(o)}return}const i=r.graphic,s=i.visible;s!==o&&(i.visible=o,C.graphic=i,C.property="visible",C.oldValue=s,C.newValue=o,this._graphicsCore.graphicUpdateHandler(C))}))}removeNodeMeta(e){const t=[];this._forEachGraphic(e,(r=>{const o=e.featureIds[r],i=this._featuresMap.get(o);if(!i)return;switch(this._removeFeature(i,e,r)){case F.MODIFIED:this._updateLabelPosition(o);break;case F.REMOVED:t.push(o)}})),this.loadedGraphics.removeManyByObjectId(t)}_removeFeature(e,t,o){const i=e.components.length;return r(e.components,(e=>!(e.meta===t&&e.index===o))),0===e.components.length?(this._featuresMap.delete(t.featureIds[o]),F.REMOVED):i!==e.components.length?F.MODIFIED:F.UNMODIFIED}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(e){const t=this._featuresMap.get(e);t&&this._updateLabelGeometry(e)&&(this.loadedGraphics.removeManyByObjectId([e]),this.loadedGraphics.addMany([t.graphic]))}_updateLabelGeometry(e){const t=this._featuresMap.get(e);if(!t)return!1;const r=t.geometry,o=this.view.spatialReference,s=this.view.renderCoordsHelper,a=r.x,n=r.y,p=r.z??0,c=t.components.length,l=m(c*_);let u=0;for(const{meta:i,index:h}of t.components)v(h,this.collection,i.objectHandle,l,u),u+=_;return h(l,s.spatialReference,0,l,o,0),d(l,O),r.x=(O[0]+O[3])/2,r.y=(O[1]+O[4])/2,r.z=O[5],!i(r.x,a)||!i(r.y,n)||!i(r.z,p)}_forEachGraphic(e,t){this._forEachFeature(e,((r,{graphic:o,geometry:i},s)=>{this._enabledForFeatureInNode(e,r)&&t(r,o,i,s)}))}_forEachFeature(e,t){let r=0;for(let o=0;o<e.featureIds.length;o++){const i=this._featuresMap.get(e.featureIds[o]);let s=null==e.filteredIds;e.filteredIds&&e.filteredIds[r]===e.featureIds[o]&&(s=!0,r++),i&&t(o,i,s)}}_enabledForFeatureInNode(e,t){return e.node.index<0||!this.overrides?.featureHasGeometryChanges(e.featureIds[t])}get updatePolicy(){return this._graphicsCore.effectiveUpdatePolicy}get usedMemory(){return this._graphicsCore.usedMemory}get unloadedMemoryEstimate(){return this._graphicsCore.unprocessedMemoryEstimate}get test(){}};e([p()],D.prototype,"view",void 0),e([p()],D.prototype,"layer",void 0),e([p()],D.prototype,"collection",void 0),e([p()],D.prototype,"loadedGraphics",void 0),e([p()],D.prototype,"overrides",void 0),e([p()],D.prototype,"layerViewUid",void 0),e([p()],D.prototype,"updating",null),e([p()],D.prototype,"slicePlaneEnabled",void 0),e([p()],D.prototype,"_graphicsCore",void 0),D=e([c("esri.views.3d.layers.I3SMeshViewLabeler")],D);const C={graphic:null,property:null,oldValue:null,newValue:null};var F;!function(e){e[e.UNMODIFIED=0]="UNMODIFIED",e[e.MODIFIED=1]="MODIFIED",e[e.REMOVED=2]="REMOVED"}(F||(F={}));const O=u();export{D as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{filterInPlace as r}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{equalsShallow as o}from"../../../core/lang.js";import{floatEqualUlp as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as l}from"../../../core/accessorSupport/diffUtils.js";import{projectBuffer as h}from"../../../geometry/projection/projectBuffer.js";import{fromBuffer as d,create as u}from"../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as m}from"../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../layers/graphics/dehydratedPoint.js";import{RenderingInfo as g}from"../../../renderers/support/RenderingInfo.js";import y from"../../../symbols/PointSymbol3D.js";import{Graphics3DCore as b}from"./graphics/Graphics3DCore.js";import{Graphics3DScaleVisibility as I}from"./graphics/Graphics3DScaleVisibility.js";import{boundingBoxCornersPointsStride as _,boundingBoxCornerPoints as v}from"./i3s/I3SGeometryUtil.js";import{LimitGraphicsMap as M}from"../support/LimitGraphicsMap.js";import{UpdatePolicy as E}from"../webgl-engine/lib/UpdatePolicy.js";import{hasLayerBasedScaleVisibility as j}from"../../support/layerViewUtils.js";class w{constructor(e,t){this.meta=e,this.index=t}}class G{constructor(e,t){this.graphic=e,this.geometry=t,this.components=[],this.overridesDirty=!1}}let D=class extends t{get updating(){return this._graphicsCore?.updating??!1}constructor(e){super(e),this.loadedGraphics=new M(5e4),this.slicePlaneEnabled=!1,this._renderingInfo=new g(null,new y),this._featuresMap=new Map}initialize(){const e=this.view.basemapTerrain;this._graphicsCore=new b({owner:this,layer:this.layer,preferredUpdatePolicy:E.ASYNC,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:e=>this.view.deconflictor.addGraphicsOwner(e),labeler:(e,t)=>this.view.labeler.addGraphicsOwner(e,t,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:j()?null:(t,r)=>new I({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:t,basemapTerrain:e,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then((()=>this._graphicsCore.startCreateGraphics())).catch((()=>{})),this.addHandles(a((()=>this.layer.labelingInfo),((e,t)=>{l(e,t)&&this._graphicsCore.updateLabelingInfo()})))}destroy(){this._graphicsCore=s(this._graphicsCore),this.loadedGraphics=s(this.loadedGraphics),this.view=null}addNodeMeta(e,t){let r=0;const o=e.filteredIds,i=this.view.spatialReference,s=[];for(let a=0;a<e.featureIds.length;a++){const p=e.featureIds[a];let c=null==o;if(o&&r<o.length&&p===o[r]&&(c=!0,r++),!this._enabledForFeatureInNode(e,a))continue;const l=this._featuresMap.get(p);if(l){l.components.push(new w(e,a)),this._updateLabelPosition(p);continue}const h=t(a,e),d=f(0,0,0,i),u={objectId:p,uid:n(),attributes:h,visible:c,geometry:d},m=new G(u,d);m.components.push(new w(e,a)),this._featuresMap.set(p,m),this._updateLabelGeometry(p),s.push(u)}this.loadedGraphics.addMany(s)}updateLabelPositions(e){const t=this.view.renderCoordsHelper;this._forEachGraphic(e,((r,o,i)=>{const s=this._graphicsCore.getGraphics3DGraphicById(o.uid);null!=s&&this._updateLabelGeometry(e.featureIds[r])&&s.alignWithAbsoluteElevation(i.z??0,t,!1)}))}setNodeMetaAttributes(e,t){const r=new Array;this._forEachGraphic(e,((i,s)=>{const a=t(i,e);o(s.attributes,a)||(s.attributes=a,r.push(s.uid))})),this._graphicsCore.updateLabelingInfo(r)}applyFilterChange(e){this._forEachFeature(e,((t,r,o)=>{if(!this._enabledForFeatureInNode(e,t)){const o=e.featureIds[t];switch(this._removeFeature(r,e,t)){case F.REMOVED:this.loadedGraphics.removeManyByObjectId([o]);break;case F.MODIFIED:this._updateLabelPosition(o)}return}const i=r.graphic,s=i.visible;s!==o&&(i.visible=o,C.graphic=i,C.property="visible",C.oldValue=s,C.newValue=o,this._graphicsCore.graphicUpdateHandler(C),C.graphic=null)}))}removeNodeMeta(e){const t=[];this._forEachGraphic(e,(r=>{const o=e.featureIds[r],i=this._featuresMap.get(o);if(!i)return;switch(this._removeFeature(i,e,r)){case F.MODIFIED:this._updateLabelPosition(o);break;case F.REMOVED:t.push(o)}})),this.loadedGraphics.removeManyByObjectId(t)}_removeFeature(e,t,o){const i=e.components.length;return r(e.components,(e=>!(e.meta===t&&e.index===o))),0===e.components.length?(this._featuresMap.delete(t.featureIds[o]),F.REMOVED):i!==e.components.length?F.MODIFIED:F.UNMODIFIED}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(e){const t=this._featuresMap.get(e);t&&this._updateLabelGeometry(e)&&(this.loadedGraphics.removeManyByObjectId([e]),this.loadedGraphics.addMany([t.graphic]))}_updateLabelGeometry(e){const t=this._featuresMap.get(e);if(!t)return!1;const r=t.geometry,o=this.view.spatialReference,s=this.view.renderCoordsHelper,a=r.x,n=r.y,p=r.z??0,c=t.components.length,l=m(c*_);let u=0;for(const{meta:i,index:h}of t.components)v(h,this.collection,i.objectHandle,l,u),u+=_;return h(l,s.spatialReference,0,l,o,0),d(l,O),r.x=(O[0]+O[3])/2,r.y=(O[1]+O[4])/2,r.z=O[5],!i(r.x,a)||!i(r.y,n)||!i(r.z,p)}_forEachGraphic(e,t){this._forEachFeature(e,((r,{graphic:o,geometry:i},s)=>{this._enabledForFeatureInNode(e,r)&&t(r,o,i,s)}))}_forEachFeature(e,t){let r=0;for(let o=0;o<e.featureIds.length;o++){const i=this._featuresMap.get(e.featureIds[o]);let s=null==e.filteredIds;e.filteredIds&&e.filteredIds[r]===e.featureIds[o]&&(s=!0,r++),i&&t(o,i,s)}}_enabledForFeatureInNode(e,t){return e.node.index<0||!this.overrides?.featureHasGeometryChanges(e.featureIds[t])}get updatePolicy(){return this._graphicsCore.effectiveUpdatePolicy}get usedMemory(){return this._graphicsCore.usedMemory}get unloadedMemoryEstimate(){return this._graphicsCore.unprocessedMemoryEstimate}get test(){}};e([p()],D.prototype,"view",void 0),e([p()],D.prototype,"layer",void 0),e([p()],D.prototype,"collection",void 0),e([p()],D.prototype,"loadedGraphics",void 0),e([p()],D.prototype,"overrides",void 0),e([p()],D.prototype,"layerViewUid",void 0),e([p()],D.prototype,"updating",null),e([p()],D.prototype,"slicePlaneEnabled",void 0),e([p()],D.prototype,"_graphicsCore",void 0),D=e([c("esri.views.3d.layers.I3SMeshViewLabeler")],D);const C={graphic:null,property:null,oldValue:null,newValue:null};var F;!function(e){e[e.UNMODIFIED=0]="UNMODIFIED",e[e.MODIFIED=1]="MODIFIED",e[e.REMOVED=2]="REMOVED"}(F||(F={}));const O=u();export{D 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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import s from"../../../core/Logger.js";import e from"../../../core/PooledArray.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as i}from"../../../geometry/projection/projectVectorToVector.js";import{ModificationType as h}from"../../../libs/i3s/enums.js";class n{constructor(s,e,t,o,r,i){this.layout=s,this.interleavedVertexData=e,this.indices=t,this.hasColors=o,this.hasModifications=r,this.positionData=i}}class p{constructor(s,e,t,o,r,i,h){this.componentOffsets=s,this.featureIds=e,this.anchorIds=t,this.anchors=o,this.transformedGeometry=r,this.globalTrafo=i,this.obb=h}}class a extends o{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0})}setModifications(s,e,t,o){const r={context:s,modifications:f(e,t,o),isGeodetic:o.isGeographic};this.broadcast(r,"setModifications")}setLegacySchema(s,e){const t=JSON.stringify(e);return this.broadcast({context:s,jsonSchema:t},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}project(s,e){return this.invokeMethod("project",s,e)}transformNormals(s,e){return this.invokeMethod("transformNormals",s,e)}}const u=new e({deallocator:null}),c=t();function f(e,t,o){u.clear();let n=1/0,p=1/0,a=-1/0,f=-1/0,l=!1;for(const d of t){const e="clip"===d.type?h.Inside:"mask"===d.type?h.Outside:h.Replace,t=d.geometry;let m=s=>s;if(t.spatialReference){if(!r(t.spatialReference,o)){s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}m=s=>(i(s,t.spatialReference,c,o),c)}else t.hasZ||(c[2]=0,m=s=>(c[0]=s[0],c[1]=s[1],c));l=l||e===h.Outside,u.push(e),u.push(t.rings.length);for(const s of t.rings){u.push(s.length);for(const e of s){const s=m(e);u.push(s[0]),u.push(s[1]),u.push(s[2]),n=Math.min(n,s[0]),p=Math.min(p,s[1]),a=Math.max(a,s[0]),f=Math.max(f,s[1])}}}if(null!=e)if(l){const s=1e-4;u.push(h.Inside),u.push(2),u.push(4),u.push(n-s),u.push(p-s),u.push(0),u.push(a+s),u.push(p-s),u.push(0),u.push(a+s),u.push(f+s),u.push(0),u.push(n-s),u.push(f+s),u.push(0),u.push(4),u.push(e[0]),u.push(e[1]),u.push(0),u.push(e[2]),u.push(e[1]),u.push(0),u.push(e[2]),u.push(e[3]),u.push(0),u.push(e[0]),u.push(e[3]),u.push(0)}else u.push(h.Outside),u.push(1),u.push(4),u.push(e[0]),u.push(e[1]),u.push(0),u.push(e[2]),u.push(e[1]),u.push(0),u.push(e[2]),u.push(e[3]),u.push(0),u.push(e[0]),u.push(e[3]),u.push(0);u.push(h.Finished);const m=new Float64Array(u.length);for(let s=0;s<u.length;++s)m[s]=u.at(s);return m}export{a as I3SMeshWorkerHandle,p as TransformedData,n as TransformedGeometry,f as toWasmModification};
5
+ import s from"../../../core/Logger.js";import t from"../../../core/PooledArray.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as i}from"../../../geometry/projection/projectVectorToVector.js";import{ModificationType as h}from"../../../libs/i3s/enums.js";class n{constructor(s,t,e,o,r,i){this.layout=s,this.interleavedVertexData=t,this.indices=e,this.hasColors=o,this.hasModifications=r,this.positionData=i}}class p{constructor(s,t,e,o,r,i,h){this.componentOffsets=s,this.featureIds=t,this.anchorIds=e,this.anchors=o,this.transformedGeometry=r,this.globalTrafo=i,this.obb=h}}class a extends o{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0})}setModifications(s,t,e,o){const r={context:s,modifications:f(t,e,o),isGeodetic:o.isGeographic};this.broadcast(r,"setModifications")}setLegacySchema(s,t){const e=JSON.stringify(t);return this.broadcast({context:s,jsonSchema:e},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}async destroyContextAndSelf(s){await this.destroyContext(s),this.destroy()}project(s,t){return this.invokeMethod("project",s,t)}transformNormals(s,t){return this.invokeMethod("transformNormals",s,t)}}const u=new t({deallocator:null}),c=e();function f(t,e,o){u.clear();let n=1/0,p=1/0,a=-1/0,f=-1/0,l=!1;for(const d of e){const t="clip"===d.type?h.Inside:"mask"===d.type?h.Outside:h.Replace,e=d.geometry;let m=s=>s;if(e.spatialReference){if(!r(e.spatialReference,o)){s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}m=s=>(i(s,e.spatialReference,c,o),c)}else e.hasZ||(c[2]=0,m=s=>(c[0]=s[0],c[1]=s[1],c));l=l||t===h.Outside,u.push(t),u.push(e.rings.length);for(const s of e.rings){u.push(s.length);for(const t of s){const s=m(t);u.push(s[0]),u.push(s[1]),u.push(s[2]),n=Math.min(n,s[0]),p=Math.min(p,s[1]),a=Math.max(a,s[0]),f=Math.max(f,s[1])}}}if(null!=t)if(l){const s=1e-4;u.push(h.Inside),u.push(2),u.push(4),u.push(n-s),u.push(p-s),u.push(0),u.push(a+s),u.push(p-s),u.push(0),u.push(a+s),u.push(f+s),u.push(0),u.push(n-s),u.push(f+s),u.push(0),u.push(4),u.push(t[0]),u.push(t[1]),u.push(0),u.push(t[2]),u.push(t[1]),u.push(0),u.push(t[2]),u.push(t[3]),u.push(0),u.push(t[0]),u.push(t[3]),u.push(0)}else u.push(h.Outside),u.push(1),u.push(4),u.push(t[0]),u.push(t[1]),u.push(0),u.push(t[2]),u.push(t[1]),u.push(0),u.push(t[2]),u.push(t[3]),u.push(0),u.push(t[0]),u.push(t[3]),u.push(0);u.push(h.Finished);const m=new Float64Array(u.length);for(let s=0;s<u.length;++s)m[s]=u.at(s);return m}export{a as I3SMeshWorkerHandle,p as TransformedData,n as TransformedGeometry,f as toWasmModification};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/CollectionFlattener.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{initial as o,when as i,watch as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../rest/support/DirectionLine.js";import c from"../../../rest/support/DirectionPoint.js";import h from"../../../rest/support/PointBarrier.js";import d from"../../../rest/support/PolygonBarrier.js";import u from"../../../rest/support/PolylineBarrier.js";import m from"../../../rest/support/RouteInfo.js";import y from"../../../rest/support/Stop.js";import{LayerView3D as f}from"./LayerView3D.js";import{GraphicsProcessor as g}from"./graphics/GraphicsProcessor.js";import{LayerViewPerformanceInfo as b}from"./support/LayerViewPerformanceInfo.js";import{EventedSet as j}from"../support/EventedSet.js";import{UpdatePolicy as w}from"../webgl-engine/lib/UpdatePolicy.js";import v from"../../layers/LayerView.js";import{defaultHighlightName as I}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as _,hasLayerBasedScaleVisibility as S}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as C}from"../../support/projectionUtils.js";function V(e){return e instanceof l||e instanceof c||e instanceof h||e instanceof d||e instanceof u||e instanceof m||e instanceof y}let G=class extends(f(v)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new j,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new g({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),o),"local"===this.view.viewingMode&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await C(this.layer.fullExtent,this.view.spatialReference))()),this.addHandles(i((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._set("processor",s(this.processor)),this._get("_routeItems")?.destroy()}get _routeItems(){return new t({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,null!=this.layer.routeInfo?new r([this.layer.routeInfo]):null]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map((e=>{const r=this._byObjectID.get(e);return this._byObjectID.delete(e),r})));for(const r of e.removed)this.removeHandles(r)}if(e.added.length){this.loadedGraphics.addMany(e.added.map((e=>{const r=e.toGraphic();return this._byObjectID.set(e,r),r})));for(const r of e.added)this.addHandles([n((()=>r.geometry),((e,t)=>{this._updateGraphic(r,"geometry",e,t)})),n((()=>r.symbol),((e,t)=>{this._updateGraphic(r,"symbol",e,t)}))],r)}}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return S()?_(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){return this.processor?.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}async queryGraphics(){return new r(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,r){return V(e)&&(e=this._byObjectID.get(e)),this.processor.highlight(e,r?.name??I)}notifyContentGeometryUpdate(){this.emit("visible-geometry-changed")}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||w.SYNC}isUpdating(){return!(!this.processor?.updating&&this.view?.basemapTerrain?.ready)}get performanceInfo(){return new b(this.processor?.graphicsCore.usedMemory??0,this.loadedGraphics.length,-1,-1,0,this.processor?.graphicsCore.performanceInfo??null)}_updateGraphic(e,r,t,s){const o=this._byObjectID.get(e);o[r]=t,O.graphic=o,O.property=r,O.oldValue=s,O.newValue=t,this.processor?.graphicsCore.graphicUpdateHandler(O)}};e([a()],G.prototype,"_routeItems",null),e([a()],G.prototype,"loadedGraphics",void 0),e([a({readOnly:!0})],G.prototype,"legendEnabled",null),e([a({readOnly:!0})],G.prototype,"visibleAtCurrentScale",null),e([a()],G.prototype,"layer",void 0),e([a({readOnly:!0})],G.prototype,"processor",void 0),e([a({type:Boolean})],G.prototype,"slicePlaneEnabled",void 0),G=e([p("esri.views.3d.layers.RouteLayerView3D")],G);const O={graphic:null,property:null,oldValue:null,newValue:null},P=G;export{P as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/CollectionFlattener.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{initial as o,when as i,watch as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../rest/support/DirectionLine.js";import c from"../../../rest/support/DirectionPoint.js";import h from"../../../rest/support/PointBarrier.js";import d from"../../../rest/support/PolygonBarrier.js";import u from"../../../rest/support/PolylineBarrier.js";import m from"../../../rest/support/RouteInfo.js";import y from"../../../rest/support/Stop.js";import{LayerView3D as f}from"./LayerView3D.js";import{GraphicsProcessor as g}from"./graphics/GraphicsProcessor.js";import{LayerViewPerformanceInfo as b}from"./support/LayerViewPerformanceInfo.js";import{EventedSet as j}from"../support/EventedSet.js";import{UpdatePolicy as w}from"../webgl-engine/lib/UpdatePolicy.js";import v from"../../layers/LayerView.js";import{defaultHighlightName as I}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as _,hasLayerBasedScaleVisibility as S}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as C}from"../../support/projectionUtils.js";function V(e){return e instanceof l||e instanceof c||e instanceof h||e instanceof d||e instanceof u||e instanceof m||e instanceof y}let G=class extends(f(v)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new j,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new g({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),o),"local"===this.view.viewingMode&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await C(this.layer.fullExtent,this.view.spatialReference))()),this.addHandles(i((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._set("processor",s(this.processor)),this._get("_routeItems")?.destroy()}get _routeItems(){return new t({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,null!=this.layer.routeInfo?new r([this.layer.routeInfo]):null]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map((e=>{const r=this._byObjectID.get(e);return this._byObjectID.delete(e),r})));for(const r of e.removed)this.removeHandles(r)}if(e.added.length){this.loadedGraphics.addMany(e.added.map((e=>{const r=e.toGraphic();return this._byObjectID.set(e,r),r})));for(const r of e.added)this.addHandles([n((()=>r.geometry),((e,t)=>{this._updateGraphic(r,"geometry",e,t)})),n((()=>r.symbol),((e,t)=>{this._updateGraphic(r,"symbol",e,t)}))],r)}}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return S()?_(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){return this.processor?.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}async queryGraphics(){return new r(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,r){return V(e)&&(e=this._byObjectID.get(e)),this.processor.highlight(e,r?.name??I)}notifyContentGeometryUpdate(){this.emit("visible-geometry-changed")}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||w.SYNC}isUpdating(){return!(!this.processor?.updating&&this.view?.basemapTerrain?.ready)}get performanceInfo(){return new b(this.processor?.graphicsCore.usedMemory??0,this.loadedGraphics.length,-1,-1,0,this.processor?.graphicsCore.performanceInfo??null)}_updateGraphic(e,r,t,s){const o=this._byObjectID.get(e);o[r]=t,O.graphic=o,O.property=r,O.oldValue=s,O.newValue=t,this.processor?.graphicsCore.graphicUpdateHandler(O),O.graphic=null}};e([a()],G.prototype,"_routeItems",null),e([a()],G.prototype,"loadedGraphics",void 0),e([a({readOnly:!0})],G.prototype,"legendEnabled",null),e([a({readOnly:!0})],G.prototype,"visibleAtCurrentScale",null),e([a()],G.prototype,"layer",void 0),e([a({readOnly:!0})],G.prototype,"processor",void 0),e([a({type:Boolean})],G.prototype,"slicePlaneEnabled",void 0),G=e([p("esri.views.3d.layers.RouteLayerView3D")],G);const O={graphic:null,property:null,oldValue:null,newValue:null},P=G;export{P 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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../../chunks/vec32.js";import{create as h,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as y}from"../../../geometry/support/contains.js";import{newDoubleArray as f,doubleArrayFrom as _}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as b}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as v}from"../../../layers/LayerConstants.js";import{estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as I}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as E}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as C}from"../../../support/basemapUtils.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as S}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as F}from"./graphics/QueryEngine.js";import{QueryEngineContext as G}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as A,normalizeEditResultsEvent as V,processAttributeEdits as P}from"./i3s/featureEditing.js";import{getCachedAttributeValue as L}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as R}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as M}from"./i3s/I3SOverrides.js";import{checkRecyclable as H,checkSpatialReferences as Q,containsDraco as U,whenGraphicAttributes as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as T}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{LayerViewPerformanceInfo as k}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as z}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as W}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as K}from"./support/TemporalSceneLayerView.js";import{debugFlags as Z}from"../support/debugFlags.js";import{compute as Y}from"../support/orientedBoundingBox.js";import{updatingProgress as $}from"../support/updatingProperties.js";import{Vertices as J}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as X}from"../webgl-engine/lib/UpdatePolicy.js";import ee from"../../layers/SceneLayerView.js";import{hasPopupTemplate as te}from"../../layers/support/popupUtils.js";import{defaultHighlightName as re}from"../../support/HighlightDefaults.js";import{hasLayerBasedScaleVisibility as ie,isInEffectiveScaleRange as se}from"../../support/layerViewUtils.js";import{TaskPriority as oe}from"../../support/Scheduler.js";const ae=B();class ne{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get cachedMemory(){return this.graphics.reduce(((e,t)=>x(t)+e),i(this.featureIds)+1024)}}let le=class extends(K(T(z(D(ee))))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new R(((e,t,r)=>pe(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then((()=>{s(t),H(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:e,memoryController:i}),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:this.layer,memoryController:e}),Q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new W({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),o),this._updatingHandles.add((()=>this.layer.renderer),((e,t)=>this._rendererChange(e,t))),this._updatingHandles.add((()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds]),(()=>this._filterChange())),this._set("processor",new S({owner:this,preferredUpdatePolicy:X.ASYNC,scaleVisibilityEnabled:!ie(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t))),this.supportsHeightUnitConversion&&(this._verticalScale=b("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new w({layerView:this}),U(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.immediate.schedule(e)))),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles([this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})),a((()=>Z.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Z.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Z.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),o)]),this.when((()=>{this._setupQueryEngine(),this._updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),o),this._updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._worker=r(this._worker),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get i3slayer(){return this.layer}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return ie()?se(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return q(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=E(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t?.attributes?.[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){return this.processor.highlight(e,this.layer.objectIdField,t?.name??re)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return A(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new O((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!he(r)&&!ue(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?me(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=he(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;c(a,l,0,a,d,0,o.length);const u=he(r)?e.level:0,h=this._createGraphics(o,a,e.index,u),p=new ne(h,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),ce(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const m=this.view.stage.renderView.olidRenderHelper;if(m){const e=C(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];m.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&te(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0),e.serviceObbInIndexSR=Y(new J(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.center,s,ye,i),e.serviceObbInIndexSR.center=ye)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=f(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.center:p,d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?_(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=f(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ge[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;u(ye,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?g(s,ye):y(s,ye))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||o.push(ye[0],ye[1],ye[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<s;h++){const s=e[h],p={};null!=s&&(p[a]=s);const c=s??n(),m=h*o,g=isNaN(t[m+2])?void 0:t[m+2],y=I(t[m],t[m+1],g,u),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(fe.property="geometry",fe.graphic=f,fe.oldValue=f.geometry,fe.newValue=y,f.geometry=y,f.level=i,l.graphicUpdateHandler(fe)),d.push(f);else{const e=n();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),ce(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){ce(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach((e=>e.nodeIndex===t&&i.push(e.uid))),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||v}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&t.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(fe.graphic=s,fe.property="visible",fe.oldValue=e,fe.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(fe))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new G(s,e,o,(()=>this.processor.featureStore),i,r);this._queryEngine=new F({context:a,priority:oe.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await V(t,e);P(t,r)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new k(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],le.prototype,"processor",void 0),e([l({type:j})],le.prototype,"filter",void 0),e([l()],le.prototype,"loadedGraphics",void 0),e([l()],le.prototype,"i3slayer",null),e([l()],le.prototype,"layerViewUid",null),e([l()],le.prototype,"_controller",void 0),e([l()],le.prototype,"updating",void 0),e([l()],le.prototype,"suspended",void 0),e([l($)],le.prototype,"updatingProgress",void 0),e([l()],le.prototype,"updatingProgressValue",null),e([l({readOnly:!0})],le.prototype,"visibleAtCurrentScale",null),e([l(ae.requiredFields)],le.prototype,"requiredFields",null),e([l(ae.availableFields)],le.prototype,"availableFields",void 0),e([l()],le.prototype,"_fieldsHelper",void 0),e([l({type:Number})],le.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],le.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],le.prototype,"_excludeObjectIds",null),e([l({readOnly:!0})],le.prototype,"lodFactor",null),e([l({readOnly:!0})],le.prototype,"hasM",null),e([l({readOnly:!0})],le.prototype,"hasZ",null),e([l()],le.prototype,"contentVisible",null),e([l({readOnly:!0})],le.prototype,"legendEnabled",null),le=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],le);const de=le;function ue(e){return"pointData"in e}function he(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function pe(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=L(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function ce(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=L(t.attributeData[e],i))}}}function me(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ge={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},ye=h(),fe={graphic:null,property:null,oldValue:null,newValue:null};export{de as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../../chunks/vec32.js";import{create as h,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as y}from"../../../geometry/support/contains.js";import{newDoubleArray as f,doubleArrayFrom as _}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as b}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as v}from"../../../layers/LayerConstants.js";import{estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as I}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as E}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as C}from"../../../support/basemapUtils.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as S}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as F}from"./graphics/QueryEngine.js";import{QueryEngineContext as G}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as A,normalizeEditResultsEvent as V,processAttributeEdits as P}from"./i3s/featureEditing.js";import{getCachedAttributeValue as L}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as R}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as M}from"./i3s/I3SOverrides.js";import{checkRecyclable as H,checkSpatialReferences as Q,containsDraco as U,whenGraphicAttributes as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as T}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{LayerViewPerformanceInfo as k}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as z}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as W}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as K}from"./support/TemporalSceneLayerView.js";import{debugFlags as Z}from"../support/debugFlags.js";import{compute as Y}from"../support/orientedBoundingBox.js";import{updatingProgress as $}from"../support/updatingProperties.js";import{Vertices as J}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as X}from"../webgl-engine/lib/UpdatePolicy.js";import ee from"../../layers/SceneLayerView.js";import{hasPopupTemplate as te}from"../../layers/support/popupUtils.js";import{defaultHighlightName as re}from"../../support/HighlightDefaults.js";import{hasLayerBasedScaleVisibility as ie,isInEffectiveScaleRange as se}from"../../support/layerViewUtils.js";import{TaskPriority as oe}from"../../support/Scheduler.js";const ae=B();class ne{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get cachedMemory(){return this.graphics.reduce(((e,t)=>x(t)+e),i(this.featureIds)+1024)}}let le=class extends(K(T(z(D(ee))))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new R(((e,t,r)=>pe(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then((()=>{s(t),H(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:e,memoryController:i}),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:this.layer,memoryController:e}),Q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new W({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),o),this._updatingHandles.add((()=>this.layer.renderer),((e,t)=>this._rendererChange(e,t))),this._updatingHandles.add((()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds]),(()=>this._filterChange())),this._set("processor",new S({owner:this,preferredUpdatePolicy:X.ASYNC,scaleVisibilityEnabled:!ie(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t))),this.supportsHeightUnitConversion&&(this._verticalScale=b("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new w({layerView:this}),U(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.immediate.schedule(e)))),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles([this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})),a((()=>Z.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Z.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Z.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),o)]),this.when((()=>{this._setupQueryEngine(),this._updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),o),this._updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._worker=r(this._worker),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get i3slayer(){return this.layer}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return ie()?se(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return q(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=E(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t?.attributes?.[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){return this.processor.highlight(e,this.layer.objectIdField,t?.name??re)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return A(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new O((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!he(r)&&!ue(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?me(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=he(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;c(a,l,0,a,d,0,o.length);const u=he(r)?e.level:0,h=this._createGraphics(o,a,e.index,u),p=new ne(h,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),ce(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const m=this.view.stage.renderView.olidRenderHelper;if(m){const e=C(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];m.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&te(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0),e.serviceObbInIndexSR=Y(new J(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.center,s,ye,i),e.serviceObbInIndexSR.center=ye)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=f(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.center:p,d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?_(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=f(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ge[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;u(ye,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?g(s,ye):y(s,ye))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||o.push(ye[0],ye[1],ye[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<s;h++){const s=e[h],p={};null!=s&&(p[a]=s);const c=s??n(),m=h*o,g=isNaN(t[m+2])?void 0:t[m+2],y=I(t[m],t[m+1],g,u),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(fe.property="geometry",fe.graphic=f,fe.oldValue=f.geometry,fe.newValue=y,f.geometry=y,f.level=i,l.graphicUpdateHandler(fe),_e()),d.push(f);else{const e=n();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),ce(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){ce(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach((e=>e.nodeIndex===t&&i.push(e.uid))),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||v}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&t.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(fe.graphic=s,fe.property="visible",fe.oldValue=e,fe.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(fe),_e())}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new G(s,e,o,(()=>this.processor.featureStore),i,r);this._queryEngine=new F({context:a,priority:oe.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await V(t,e);P(t,r)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new k(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],le.prototype,"processor",void 0),e([l({type:j})],le.prototype,"filter",void 0),e([l()],le.prototype,"loadedGraphics",void 0),e([l()],le.prototype,"i3slayer",null),e([l()],le.prototype,"layerViewUid",null),e([l()],le.prototype,"_controller",void 0),e([l()],le.prototype,"updating",void 0),e([l()],le.prototype,"suspended",void 0),e([l($)],le.prototype,"updatingProgress",void 0),e([l()],le.prototype,"updatingProgressValue",null),e([l({readOnly:!0})],le.prototype,"visibleAtCurrentScale",null),e([l(ae.requiredFields)],le.prototype,"requiredFields",null),e([l(ae.availableFields)],le.prototype,"availableFields",void 0),e([l()],le.prototype,"_fieldsHelper",void 0),e([l({type:Number})],le.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],le.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],le.prototype,"_excludeObjectIds",null),e([l({readOnly:!0})],le.prototype,"lodFactor",null),e([l({readOnly:!0})],le.prototype,"hasM",null),e([l({readOnly:!0})],le.prototype,"hasZ",null),e([l()],le.prototype,"contentVisible",null),e([l({readOnly:!0})],le.prototype,"legendEnabled",null),le=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],le);const de=le;function ue(e){return"pointData"in e}function he(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function pe(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=L(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function ce(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=L(t.attributeData[e],i))}}}function me(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ge={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},ye=h(),fe={graphic:null,property:null,oldValue:null,newValue:null};function _e(){fe.graphic=null,fe.property=null,fe.oldValue=null,fe.newValue=null}export{de 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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import a from"../../../../core/Logger.js";import{findInMap as n}from"../../../../core/MapUtils.js";import{abortMaybe as o,removeMaybe as l,destroyMaybe as h,disposeMaybe as d}from"../../../../core/maybe.js";import{MinPriority as p}from"../../../../core/MemCache.js";import c from"../../../../core/PooledArray.js";import{throwIfAborted as y,ignoreAbortErrors as g,createResolver as u,isAbortError as m}from"../../../../core/promiseUtils.js";import{when as b,watch as _,on as f,syncAndInitial as v,whenOnce as C}from"../../../../core/reactiveUtils.js";import{schedule as S}from"../../../../core/scheduling.js";import{property as G}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as x,isEmpty as P}from"../../../../core/accessorSupport/diffUtils.js";import{i as R,f as D,g as E}from"../../../../chunks/vec32.js";import{create as U}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import I from"../../../../geometry/Extent.js";import A from"../../../../geometry/Point.js";import{canProjectWithoutEngine as L}from"../../../../geometry/projectionUtils.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as O}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as V}from"../../../../geometry/projection/projectXYZToVector.js";import{center as F,create as T,fromRect as M,equals as k}from"../../../../geometry/support/aaBoundingBox.js";import{create as z}from"../../../../geometry/support/aaBoundingRect.js";import{equals as W}from"../../../../geometry/support/spatialReferenceUtils.js";import H from"../../../../layers/Layer.js";import{getObjectId as N,computeAABB as B,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{PromiseQueue as Q}from"../../../../layers/support/PromiseQueue.js";import $ from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as Z,validateTo3D as J}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as X}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as K}from"../../../../support/basemapUtils.js";import{loadArcade as ee}from"../../../../support/loadArcade.js";import te from"../../../../symbols/LabelSymbol3D.js";import ie from"../../../../symbols/TextSymbol.js";import re from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as se}from"../../../../symbols/support/defaults3D.js";import{to3D as ae}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ne,defaultSymbolComplexity as oe}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as le}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as he}from"./ElevationQuery.js";import{VisibilityGroup as de,VisibilityFlag as pe}from"./enums.js";import{extractExpressionInfo as ce,createContext as ye}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as ge}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ue}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as me}from"./Graphics3DSymbolCreationContext.js";import{make as be}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as _e}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as fe}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as ve}from"./GraphicStateTracking.js";import{computeCentroid as Ce}from"./graphicUtils.js";import{FastUpdateStatus as Se,ApplyRendererDiffResult as Ge}from"./interfaces.js";import{LoadStatus as we}from"./Loadable.js";import{SpatialIndex2D as xe}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as Pe}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Re}from"../../support/extentUtils.js";import{GridLocalOriginFactory as De}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as Ee}from"../../webgl-engine/lib/UpdatePolicy.js";import{affectsGeometry as Ue}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Ie}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Ae}from"../../../layers/support/popupUtils.js";import{PropertiesPool as Le}from"../../../support/PropertiesPool.js";import{ImmediateTask as je,noBudget as Oe,TaskPriority as Ve}from"../../../support/Scheduler.js";import{TextureCompressionTracker as Fe}from"../../../support/TextureCompressionTracker.js";import{Yield as Te}from"../../../support/Yield.js";import{alphaCutoff as Me}from"../../../../webscene/support/AlphaCutoff.js";var ke;const ze=U(),We=T();let He=class extends t{static{ke=this}static{this.tmpVec=U()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new xe({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?Ee.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.running)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.running||this._updateQueue.running}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new le(s,h,a)}get averageSymbolComplexity(){const e=ne(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=this._symbolMaterials.reduce(((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=ae(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),s=r.symbol||null;return null==s&&r.error&&a.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,s),s}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?oe(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Le({computedExtent:I},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=je,this._dataUpdateQueue=new Q,this._updateQueue=new Q,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new c({allocator:e=>e||new Be,deallocator:e=>(e.clear(),e)}),this.compressionTracker=new Fe,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new c,this.preferredUpdatePolicy=Ee.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",(e=>e.destroy())),this.symbolCreationContext=new me(e.owner.view.resourceController.scheduler,((e,t)=>this._updateQueue.push(e,t)),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new ge({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(de.GRAPHIC,pe.FILTER,e(N(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(de.GRAPHIC,pe.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(de.GRAPHIC,pe.FILTER,!0)))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(b((()=>this.owner.view.state.highlights),(()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach((t=>t.updateHighlights(e)))}))),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new he(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new De(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=ce(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ye(r,this._viewSpatialReference,e,a.getLogger(this)),y(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this.addHandles(s((()=>t.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this.addHandles([_((()=>this.suspendedOrOutsideOfView),(()=>this._updateQueue.unshift((()=>this._updateLayerVisibility()),null).catch(g))),_((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),_((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),_((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),_((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),_((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),_((()=>this.owner.view.focusAreasView?.polygons),(()=>this._updateFocusedLabels())),_((()=>this.owner.view.map?.focusAreas.style),(()=>this.recreateAllGraphicsAndSymbols())),b((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([f(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),_((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===Ee.ASYNC,e===Ee.SYNC&&this.runTask(Oe)}),v)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ve.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(_((()=>this.layer.featureReduction),(()=>this._deconflictor?.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=o(this._initializeAbortController)}_updateFocusedLabels(){this.forEachGraphics3DSymbol(((e,t)=>{t&&e.updateFocus((({graphic:e})=>this.recreateGraphics([e])),t)}))}destroy(){this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=o(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=je,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=l(this._deconflictor),this._labeler=l(this._labeler),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=l(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=l(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=h(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=h(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(h),this._symbols.clear(),this._symbolMaterials=null,this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Ie(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("shaderTransformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("geometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("geometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("attributesChanged",(e=>Ue(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*qe,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Me);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return N(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case Se.Loading:return"unknown";case Se.Fast:this._graphicsBySymbol.has(i)&&(t=!0);break;case Se.Slow:this._graphicsBySymbol.has(i)&&(e=!0);break;case Se.Mixed:this._graphicsBySymbol.has(i)&&(t=e=!0);case Se.Undefined:}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Te}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return n(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(de.GRAPHIC,pe.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=u();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>j(e,r,t,e,i,t,s),n=(e,t,r)=>j(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){F(h,ze);const t=e.getElevation(ze[0],ze[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await C((()=>this.owner?.loadedGraphics));const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;R(Ye,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Qe,t))return null;D(Ye,Ye,Qe),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(R(Qe,e,i,a),!O(Qe,this._viewElevationProvider.spatialReference,Qe,t))return null;D(Ye,Ye,Qe),s++}return s>1&&E(Ye,Ye,1/s),new A({x:Ye[0],y:Ye[1],z:Ye[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>!(null==t.newValue||null==e||!e.graphics3DSymbol.updateGeometry(e,t.newValue)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),!0)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===we.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=x(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!P(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===Ee.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=We,i=e.spatialReference;B(e,t);const r=this._viewSpatialReference,s=ke.tmpVec;if(W(i,r)||V(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],V(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=ce(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ye(t,this._viewSpatialReference,e.signal,a.getLogger(this)),y(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=d(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Pe({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=d(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this._symbolMaterials=null,h(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===Ee.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):a.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===Ee.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return Ee.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),Ee.SYNC);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==Ne.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){this.effectiveUpdatePolicy===Ee.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===Ne.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&a.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===Ne.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==Ne.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=Ee.SYNC),i.add)switch(i.state){case Ne.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case Ne.REJECTED:i.add=null,this._pendingAdds--;case Ne.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Ne.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=Ne.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,m(t)?e.state=Ne.NEW:e.state=Ne.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=Ne.READY);e.state=Ne.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(m(i)?e.state=Ne.NEW:e.state=Ne.REJECTED)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=Ne.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!q(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=K(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,!!this.layer.popupEnabled&&!t&&Ae(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ue(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(m(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,i===Ee.ASYNC?a.load((()=>this._dataUpdateQueue.push(d,null).catch(g)),(e=>this._dataUpdateQueue.push((()=>p(e)),null).catch(g))):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof te||e instanceof ie){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof te&&!this._hasLabelingContext(e))||(a.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?Y(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||se(r.geometry);s=new X(null,e)}return null==s?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,a.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=ae(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=be(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof re?new _e(e,(e=>this._dataUpdateQueue.push(e,null)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new ve(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=Ce(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(de.GRAPHIC,pe.FILTER,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=o(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Z(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();y(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),y(t)),this.effectiveUpdatePolicy===Ee.ASYNC?await this._updateQueue.push((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===Ee.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await ee(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=x(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(Y(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some((e=>o.some((t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))))return!1;const l=a?a.added.map((e=>e.symbol)).filter(i):[],h=a?a.removed.map((e=>e.symbol)).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof $&&i instanceof $&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case Ge.RecreateSymbol:this._recreateSymbol(r);break;case Ge.RecreateGraphics:this._recreateGraphicsForSymbol(r);case Ge.FastUpdate:}}return!0}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t)))}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=S((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=z();return Re(e,r,t)?this.symbolCreationContext.clippingExtent=M(T(),r):this.symbolCreationContext.clippingExtent=null,!k(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||$e,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(de.GRAPHIC,pe.USER,!1)))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=J(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>a.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;a.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,p),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new fe(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce(((e,t)=>e+(t.isVisible()?1:0)),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};var Ne;e([G({readOnly:!0})],He.prototype,"computedExtent",void 0),e([G()],He.prototype,"currentRenderer",void 0),e([G()],He.prototype,"rendererHasGeometryOperations",void 0),e([G()],He.prototype,"_frameTaskHandle",void 0),e([G()],He.prototype,"_dataUpdateQueue",void 0),e([G()],He.prototype,"_updateQueue",void 0),e([G({readOnly:!0})],He.prototype,"_viewSpatialReference",null),e([G()],He.prototype,"_rendererChangeAbortController",void 0),e([G()],He.prototype,"_elevationInfoChangeAbortController",void 0),e([G()],He.prototype,"_initializeAbortController",void 0),e([G()],He.prototype,"_elevationAlignment",void 0),e([G()],He.prototype,"_scaleVisibility",void 0),e([G()],He.prototype,"_filterVisibility",void 0),e([G()],He.prototype,"_initializePromise",void 0),e([G()],He.prototype,"_spatialIndex",void 0),e([G({readOnly:!0})],He.prototype,"extentPadding",void 0),e([G()],He.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([G()],He.prototype,"_featureStore",void 0),e([G()],He.prototype,"_objectStates",void 0),e([G()],He.prototype,"_loadingSymbols",void 0),e([G({constructOnly:!0})],He.prototype,"compressionTracker",void 0),e([G()],He.prototype,"preferredUpdatePolicy",void 0),e([G()],He.prototype,"_forcedUpdatePolicy",void 0),e([G({readOnly:!0})],He.prototype,"effectiveUpdatePolicy",null),e([G({constructOnly:!0})],He.prototype,"elevationFeatureExpressionEnabled",void 0),e([G({constructOnly:!0})],He.prototype,"owner",void 0),e([G({constructOnly:!0})],He.prototype,"layer",void 0),e([G({constructOnly:!0})],He.prototype,"graphicSymbolSupported",void 0),e([G({constructOnly:!0})],He.prototype,"getRenderingInfoWithoutRenderer",void 0),e([G({constructOnly:!0})],He.prototype,"componentFactories",void 0),e([G({constructOnly:!0})],He.prototype,"setUidToIdOnAdd",void 0),e([G()],He.prototype,"featureStore",null),e([G()],He.prototype,"initializePromise",null),e([G()],He.prototype,"scaleVisibility",null),e([G()],He.prototype,"elevationAlignment",null),e([G()],He.prototype,"objectStates",null),e([G()],He.prototype,"filterVisibility",null),e([G({readOnly:!0})],He.prototype,"updating",null),e([G({readOnly:!0})],He.prototype,"dataUpdating",null),e([G({readOnly:!0})],He.prototype,"running",null),e([G({readOnly:!0})],He.prototype,"suspendedOrOutsideOfView",null),e([G({readOnly:!0,dependsOn:[]})],He.prototype,"updatingRemaining",null),e([G({readOnly:!0})],He.prototype,"displayFeatureLimit",null),e([G({readOnly:!0,dependsOn:[]})],He.prototype,"averageSymbolComplexity",null),e([G({constructOnly:!0})],He.prototype,"hasZ",void 0),e([G({constructOnly:!0})],He.prototype,"hasM",void 0),e([G()],He.prototype,"_objectIdField",null),He=ke=e([w("esri.views.3d.layers.graphics.Graphics3DCore")],He),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Ne||(Ne={}));class Be{constructor(){this.add=null,this.renderingInfo=null,this.state=Ne.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Ne.NEW,this.abortController=null,this.remove=null}}const qe=10,Ye=U(),Qe=U(),$e=new Map;export{He as Graphics3DCore};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as n,removeMaybe as o,destroyMaybe as l,disposeMaybe as h}from"../../../../core/maybe.js";import{MinPriority as d}from"../../../../core/MemCache.js";import p from"../../../../core/PooledArray.js";import{throwIfAborted as c,ignoreAbortErrors as y,createResolver as g,isAbortError as u}from"../../../../core/promiseUtils.js";import{when as m,watch as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as G}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as w,isEmpty as x}from"../../../../core/accessorSupport/diffUtils.js";import{i as P,f as R,g as D}from"../../../../chunks/vec32.js";import{create as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import U from"../../../../geometry/Extent.js";import I from"../../../../geometry/Point.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projectionUtils.js";import{projectBuffer as L}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as O}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as V}from"../../../../geometry/projection/projectXYZToVector.js";import{center as j,create as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as k}from"../../../../geometry/support/aaBoundingRect.js";import{equals as z}from"../../../../geometry/support/spatialReferenceUtils.js";import W from"../../../../layers/Layer.js";import{getObjectId as H,computeAABB as N,hasGeometry as B}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as q}from"../../../../layers/graphics/hydratedFeatures.js";import{PromiseQueue as Y}from"../../../../layers/support/PromiseQueue.js";import Q from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as J}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as X}from"../../../../support/basemapUtils.js";import{loadArcade as K}from"../../../../support/loadArcade.js";import ee from"../../../../symbols/LabelSymbol3D.js";import te from"../../../../symbols/TextSymbol.js";import ie from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as re}from"../../../../symbols/support/defaults3D.js";import{to3D as se}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ae,defaultSymbolComplexity as ne}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as oe}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as le}from"./ElevationQuery.js";import{VisibilityGroup as he,VisibilityFlag as de}from"./enums.js";import{extractExpressionInfo as pe,createContext as ce}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as ye}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ge}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ue}from"./Graphics3DSymbolCreationContext.js";import{make as me}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as be}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as _e}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as fe}from"./GraphicStateTracking.js";import{computeCentroid as ve}from"./graphicUtils.js";import{FastUpdateStatus as Ce,ApplyRendererDiffResult as Se}from"./interfaces.js";import{LoadStatus as Ge}from"./Loadable.js";import{SpatialIndex2D as we}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as xe}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Pe}from"../../support/extentUtils.js";import{GridLocalOriginFactory as Re}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as De}from"../../webgl-engine/lib/UpdatePolicy.js";import{affectsGeometry as Ee}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Ue}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Ie}from"../../../layers/support/popupUtils.js";import{PropertiesPool as Ae}from"../../../support/PropertiesPool.js";import{ImmediateTask as Le,noBudget as Oe,TaskPriority as Ve}from"../../../support/Scheduler.js";import{TextureCompressionTracker as je}from"../../../support/TextureCompressionTracker.js";import{Yield as Fe}from"../../../support/Yield.js";import{alphaCutoff as Te}from"../../../../webscene/support/AlphaCutoff.js";var Me;const ke=E(),ze=F();let We=class extends t{static{Me=this}static{this.tmpVec=E()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new we({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?De.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.running)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.running||this._updateQueue.running}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new oe(s,h,a)}get averageSymbolComplexity(){const e=ae(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=this._symbolMaterials.reduce(((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=se(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return null==a&&r.error&&s.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?ne(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ae({computedExtent:U},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=Le,this._dataUpdateQueue=new Y,this._updateQueue=new Y,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new p({allocator:e=>e||new Ne,deallocator:e=>(e.clear(),e)}),this.compressionTracker=new je,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new p,this.preferredUpdatePolicy=De.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",(e=>e.destroy())),this.symbolCreationContext=new ue(e.owner.view.resourceController.scheduler,((e,t)=>this._updateQueue.push(e,t)),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new ye({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(he.GRAPHIC,de.FILTER,e(H(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(he.GRAPHIC,de.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(he.GRAPHIC,de.FILTER,!0)))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(m((()=>this.owner.view.state.highlights),(()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach((t=>t.updateHighlights(e)))}))),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new le(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Re(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=pe(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ce(r,this._viewSpatialReference,e,s.getLogger(this)),c(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([b((()=>this.suspendedOrOutsideOfView),(()=>this._updateQueue.unshift((()=>this._updateLayerVisibility()),null).catch(y))),b((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),b((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),b((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),b((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),b((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),b((()=>this.owner.view.focusAreasView?.polygons),(()=>this._updateFocusedLabels())),b((()=>this.owner.view.map?.focusAreas.style),(()=>this.recreateAllGraphicsAndSymbols())),m((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),b((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===De.ASYNC,e===De.SYNC&&this.runTask(Oe)}),f)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ve.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(b((()=>this.layer.featureReduction),(()=>this._deconflictor?.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=n(this._initializeAbortController)}_updateFocusedLabels(){this.forEachGraphics3DSymbol(((e,t)=>{t&&e.updateFocus((({graphic:e})=>this.recreateGraphics([e])),t)}))}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=n(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=Le,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=o(this._deconflictor),this._labeler=o(this._labeler),this._elevationAlignment=l(this._elevationAlignment),this._scaleVisibility=l(this._scaleVisibility),this._filterVisibility=l(this._filterVisibility),this._objectStates=l(this._objectStates),this.clear(),"drapeSourceType"in this.owner){const{owner:e}=this;this.stage.view.basemapTerrain.overlayManager.unregisterDrapeSource(e)}this._featureStore=l(this._featureStore),this._updatingPendingLoadedGraphicsChange=o(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=l(this._graphicStateTracking),this.stage&&(this.stageLayer=l(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=o(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=l(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=l(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(l),this._symbols.clear(),this._symbolMaterials&&(this._symbolMaterials.length=0,this._symbolMaterials=null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Ue(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("shaderTransformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("geometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("geometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("attributesChanged",(e=>Ee(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*Be,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Te);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return H(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case Ce.Loading:return"unknown";case Ce.Fast:this._graphicsBySymbol.has(i)&&(t=!0);break;case Ce.Slow:this._graphicsBySymbol.has(i)&&(e=!0);break;case Ce.Mixed:this._graphicsBySymbol.has(i)&&(t=e=!0);case Ce.Undefined:}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Fe}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(he.GRAPHIC,de.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=g();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>L(e,r,t,e,i,t,s),n=(e,t,r)=>L(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){j(h,ke);const t=e.getElevation(ke[0],ke[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v((()=>this.owner?.loadedGraphics));const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(qe,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Ye,t))return null;R(qe,qe,Ye),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Ye,e,i,a),!O(Ye,this._viewElevationProvider.spatialReference,Ye,t))return null;R(qe,qe,Ye),s++}return s>1&&D(qe,qe,1/s),new I({x:qe[0],y:qe[1],z:qe[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>!(null==t.newValue||null==e||!e.graphics3DSymbol.updateGeometry(e,t.newValue)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),!0)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===Ge.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=w(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!x(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===De.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=ze,i=e.spatialReference;N(e,t);const r=this._viewSpatialReference,s=Me.tmpVec;if(z(i,r)||V(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],V(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=pe(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ce(t,this._viewSpatialReference,e.signal,s.getLogger(this)),c(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=h(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new xe({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=h(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);l(r),this._symbols.delete(e),this._symbolMaterials=null,l(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===De.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):s.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===De.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return De.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),De.SYNC);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==He.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){this.effectiveUpdatePolicy===De.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===He.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&s.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===He.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==He.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=De.SYNC),i.add)switch(i.state){case He.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case He.REJECTED:i.add=null,this._pendingAdds--;case He.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=He.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=He.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,u(t)?e.state=He.NEW:e.state=He.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=He.READY);e.state=He.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(u(i)?e.state=He.NEW:e.state=He.REJECTED)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=He.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!B(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=X(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,!!this.layer.popupEnabled&&!t&&Ie(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ge(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(u(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,i===De.ASYNC?a.load((()=>this._dataUpdateQueue.push(d,null).catch(y)),(e=>this._dataUpdateQueue.push((()=>p(e)),null).catch(y))):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof ee||e instanceof te){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof ee&&!this._hasLabelingContext(e))||(s.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!A(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;let a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||re(r.geometry);a=new J(null,e)}return null==a?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?q(e,this.layer):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=se(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=me(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof ie?new be(e,(e=>this._dataUpdateQueue.push(e,null)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new fe(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=ve(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(he.GRAPHIC,de.FILTER,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=n(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),$(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();c(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),c(t)),this.effectiveUpdatePolicy===De.ASYNC?await this._updateQueue.push((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===De.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=w(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof W?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(q(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some((e=>o.some((t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))))return!1;const l=a?a.added.map((e=>e.symbol)).filter(i):[],h=a?a.removed.map((e=>e.symbol)).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof Q&&i instanceof Q&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case Se.RecreateSymbol:this._recreateSymbol(r);break;case Se.RecreateGraphics:this._recreateGraphicsForSymbol(r);case Se.FastUpdate:}}return!0}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t)))}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=k();return Pe(e,r,t)?this.symbolCreationContext.clippingExtent=T(F(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||Qe,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(he.GRAPHIC,de.USER,!1)))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=Z(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>s.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;s.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,d),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new _e(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce(((e,t)=>e+(t.isVisible()?1:0)),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};var He;e([S({readOnly:!0})],We.prototype,"computedExtent",void 0),e([S()],We.prototype,"currentRenderer",void 0),e([S()],We.prototype,"rendererHasGeometryOperations",void 0),e([S()],We.prototype,"_frameTaskHandle",void 0),e([S()],We.prototype,"_dataUpdateQueue",void 0),e([S()],We.prototype,"_updateQueue",void 0),e([S({readOnly:!0})],We.prototype,"_viewSpatialReference",null),e([S()],We.prototype,"_rendererChangeAbortController",void 0),e([S()],We.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],We.prototype,"_initializeAbortController",void 0),e([S()],We.prototype,"_elevationAlignment",void 0),e([S()],We.prototype,"_scaleVisibility",void 0),e([S()],We.prototype,"_filterVisibility",void 0),e([S()],We.prototype,"_initializePromise",void 0),e([S()],We.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],We.prototype,"extentPadding",void 0),e([S()],We.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],We.prototype,"_featureStore",void 0),e([S()],We.prototype,"_objectStates",void 0),e([S()],We.prototype,"_loadingSymbols",void 0),e([S({constructOnly:!0})],We.prototype,"compressionTracker",void 0),e([S()],We.prototype,"preferredUpdatePolicy",void 0),e([S()],We.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],We.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],We.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],We.prototype,"owner",void 0),e([S({constructOnly:!0})],We.prototype,"layer",void 0),e([S({constructOnly:!0})],We.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],We.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],We.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],We.prototype,"setUidToIdOnAdd",void 0),e([S()],We.prototype,"featureStore",null),e([S()],We.prototype,"initializePromise",null),e([S()],We.prototype,"scaleVisibility",null),e([S()],We.prototype,"elevationAlignment",null),e([S()],We.prototype,"objectStates",null),e([S()],We.prototype,"filterVisibility",null),e([S({readOnly:!0})],We.prototype,"updating",null),e([S({readOnly:!0})],We.prototype,"dataUpdating",null),e([S({readOnly:!0})],We.prototype,"running",null),e([S({readOnly:!0})],We.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],We.prototype,"updatingRemaining",null),e([S({readOnly:!0})],We.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],We.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],We.prototype,"hasZ",void 0),e([S({constructOnly:!0})],We.prototype,"hasM",void 0),e([S()],We.prototype,"_objectIdField",null),We=Me=e([G("esri.views.3d.layers.graphics.Graphics3DCore")],We),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(He||(He={}));class Ne{constructor(){this.add=null,this.renderingInfo=null,this.state=He.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=He.NEW,this.abortController=null,this.remove=null}}const Be=10,qe=E(),Ye=E(),Qe=new Map;export{We as Graphics3DCore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../Color.js";import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as r}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{e as s}from"../../../../chunks/earcut.js";import{normalFromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as a,invertOrIdentity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as m,t as p,a as h,h as g,n as d,c as u,d as f}from"../../../../chunks/vec32.js";import{fromArray as y,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as S,fromBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as w}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as O,getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{t as E}from"../../../../chunks/vec3.js";import{makeVertexCandidate as v,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as A}from"../../../../renderers/support/renderingInfoUtils.js";import{EmissiveSourceMode as M}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as L}from"../../../ViewingMode.js";import{needsElevationUpdates3D as B,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as R,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G,computeCentroid as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{geometryAsPolygon as N}from"./polygonUtils.js";import{createMaterial as F}from"../support/edgeUtils.js";import{debugFlags as k}from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as W}from"../../support/renderInfoUtils/polygon.js";import{NormalType as q}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as Z}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as J}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as K}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as Q}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as X,compressNormal as Y}from"../../webgl-engine/lib/Normals.js";import{Object3D as $}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as tt}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as et}from"../../webgl-engine/materials/DefaultMaterial.js";import{GeometryType as rt}from"../../webgl-engine/lib/IntersectableGeometry.js";const ot=["polygon","extent"];class st extends D{constructor(t,e,r,o){super(t,e,r,o,xt(e)),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=G(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer,r=t?.material,o=r?.color,s=this._getCombinedOpacityAndColor(o),i=y(s),n=s[3],a=this.needsDrivenTransparentPass,l=r?.emissive,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:i,ambient:i,opacity:n,drivenOpacity:a,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrength:l?.strength??0,emissiveSource:M.Color,offsetTransparentBackfaces:!0,normalType:q.Compressed},m=new et(c,this._context);m.setParameters({cullFace:m.transparent?J.None:J.Back});const p=new et({...c,cullFace:J.Back},this._context);this._materials[Mt.Main]=m,this._materials[Mt.Bottom]=p}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,ot,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(t.renderingInfo,this._getFallbackOpacityAndColor(),255),o=this.setGraphicElevationContext(e);return this._createAs3DShape(e,t.renderingInfo,r,o,e.uid)}layerOpacityChanged(t,e){const r=this.symbolLayer?.material?.color,o=this._getCombinedOpacity(r);this._materials[Mt.Main]?.setParameters({opacity:o}),this._materials[Mt.Bottom]?.setParameters({opacity:o});const s=this._getLayerOpacity();t?.forEach((t=>e(t)?.layerOpacityChanged(s,this._context.isAsync)))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,B)}slicePlaneEnabledChanged(t,e){return this._materials[Mt.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[Mt.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach((t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[Mt.Main]?.setParameters(t),this._materials[Mt.Bottom]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?A(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?T.RecreateSymbol:T.RecreateGraphics}async queryForSnapping(t,e,s,i){const n=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/o(e),{objectId:a,target:l}=t,c=r(l);switch(c.z=(c.z??0)+n,t.type){case"edge":{const{start:e,end:o}=t,s=r(e),i=r(o);return s.z=(s.z??0)+n,i.z=(i.z??0)+n,[I(a,c,1/0,s,i)]}case"vertex":return[v(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,r,o,l){const m=N(t.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const p=W(m,this._context.elevationProvider,this._context.renderCoordsHelper,o);this._logGeometryCreationWarnings(p,m.rings,"rings","ExtrudeSymbol3DLayer");const h=V(m);if(null==h)return null;const g=new Array,d=new Array,u=S(),f=c(),y=b(),_=this._context.renderCoordsHelper.viewingMode===L.Global;_||this._context.renderCoordsHelper.worldUpAtPosition(null,y),x(m.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const C=c();a(C,f);const v=n();i(v,C);const{polygons:I,mapPositions:A,position:M}=p,z=new Map,D=this._materials[Mt.Main];for(const i of I){const t=i.count;if(this._context.clippingExtent&&(j(i.mapPositions,u),!P(u,this._context.clippingExtent)))continue;const o=s(i.mapPositions,i.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,c=O(a+n),m=O(n),p=w(3*a),h=w(3*a),b=w(3*a),x=w(a);nt(M,A,o,i,p,b,h,x,c,m,this._getExtrusionSize(e),y,_),E(p,p,C);const S=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),v=new Lt(p,b,X(h),x),I=it(D,c,c.length-m.length,v,r,S),L=t,B=t,R=2*i.count,U=new Bt(L,B,R,n/3);_t(I,U,f),z.set(I,U),g.push(I,it(this._materials[Mt.Bottom],m,0,v,r,S)),d.push(v.heights)}if(0===g.length)return null;const G=new $({geometries:g,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});G.transformation=f;const T=F(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=T?new R(this._materials[Mt.Main],T,this._context.slicePlaneEnabled):null,H=new U(this,G,null,((t,e,r,o,s)=>bt(t,e,r,o,s,d,z)),o,k);return H.alignedSampledElevation=p.sampledElevation,H.needsElevationUpdates=B(o.mode),H}_getFallbackOpacityAndColor(){const e=this.symbolLayer?.material?.color;return t.toUnitRGBA(e)??_}}function it(t,e,r,o,s,i){const n=C(e.length),a=[[tt.POSITION,new Z(o.positions,e,3,!0)],[tt.NORMALCOMPRESSED,new Z(o.normals,e,2,!0)],[tt.COLOR,new Z(s,n,4,!0)]];return new K(t,a,o.elevation,rt.Mesh,i,r)}function nt(t,e,r,o,s,i,n,a,l,c,m,p,h){const g=r.length/3;let d=2*o.count;at(t,e,o.index,o.count,r,0,g,s,i,n,a,l,c,d,m,p,h);let u=0,f=2*o.count;d=0;const y=o.pathLengths[0];mt(s,i,a,n,u,y,o.count,f,l,d,m),f+=4*y,d+=2*y,u+=y;for(let b=1;b<o.pathLengths.length;++b){const t=o.pathLengths[b];mt(s,i,a,n,u,t,o.count,f,l,d,m),f+=4*t,d+=2*t,u+=t}}function at(t,e,r,o,s,i,n,a,l,c,m,p,h,g,f,y,b){u(jt,y),l??=[],c??=[],m??=[];const _=f>0?1:-1;let x=3*r,S=0,j=3*S,P=o,w=3*P;for(let u=0;u<o;++u){const r=t[x],o=t[x+1],s=t[x+2];b&&(jt[0]=r,jt[1]=o,jt[2]=s,d(jt,jt)),a[j+0]=r,a[j+1]=o,a[j+2]=s;const i=e[x+0],n=e[x+1],p=e[x+2];l[j+0]=i,l[j+1]=n,l[j+2]=p,c[j+0]=-_*jt[0],c[j+1]=-_*jt[1],c[j+2]=-_*jt[2],m[S]=0,a[w+0]=r+f*jt[0],a[w+1]=o+f*jt[1],a[w+2]=s+f*jt[2],l[w+0]=i,l[w+1]=n,l[w+2]=p,m[P]=f,j+=3,w+=3,x+=3,S+=1,P+=1}x=3*i,j=0,w=3*g;const O=f<0?Ot:wt,C=f<0?wt:Ot;for(let d=0;d<n;++d)h[j]=s[x+O[0]],h[j+1]=s[x+O[1]],h[j+2]=s[x+O[2]],p[w]=s[x+C[0]]+o,p[w+1]=s[x+C[1]]+o,p[w+2]=s[x+C[2]]+o,j+=3,w+=3,x+=3}function lt(t,e,r,o,s,i,n){o[i]=o[n],n*=3,t[i*=3]=t[n],t[i+1]=t[n+1],t[i+2]=t[n+2],e[i]=e[n],e[i+1]=e[n+1],e[i+2]=e[n+2],r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2]}const ct=b();function mt(t,e,r,o,s,i,n,a,l,c,m){e??=[],r??=[],o??=[];let p=s,h=s+1,g=s+n,d=s+n+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(p=s+n+1,d=s);let _=3*c;for(let x=0;x<i;++x)x===i-1&&(h=s,m>0?d=s+n:p=s+n),ft(t,p,h,g,ct),lt(t,e,o,r,ct,u,p),lt(t,e,o,r,ct,f,h),lt(t,e,o,r,ct,y,g),lt(t,e,o,r,ct,b,d),l[_]=u,l[_+1]=y,l[_+2]=b,l[_+3]=u,l[_+4]=b,l[_+5]=f,_+=6,p++,h++,g++,d++,u+=2,f+=2,y+=2,b+=2}const pt=b(),ht=b(),gt=b(),dt=b(),ut=b();function ft(t,e,r,o,s){e*=3,r*=3,o*=3,m(pt,t[e++],t[e++],t[e++]),m(ht,t[r++],t[r++],t[r++]),m(gt,t[o++],t[o++],t[o++]),f(dt,ht,pt),f(ut,gt,pt),g(s,ut,dt),d(s,s)}const yt=b();function bt(t,e,r,o,s,i,n){const a=t.stageObject,h=a.geometries,g=h.length,d="absolute-height"!==e.mode;let u=0;const f=a.transformation,y=l(c(),f);for(let l=0;l<g;l+=2){const t=h[l];if(!Q(t))continue;const e=t.getMutableAttribute(tt.POSITION).data,c=i[l/2],g=new H(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let i=0;i<b;i++){yt[0]=e[t],yt[1]=e[t+1],yt[2]=e[t+2],o(g,Pt),d&&(x+=Pt.sampledElevation),k.TESTS_DISABLE_OPTIMIZATIONS?(m(St,g.array[g.offset],g.array[g.offset+1],Pt.z+c[t/3]),null!=r&&s.toRenderCoords(St,r,St),p(St,St,y)):(m(St,e[t],e[t+1],e[t+2]),p(St,St,f),s.setAltitude(St,Pt.z+c[t/3]),p(St,St,y)),e[t]=St[0],e[t+1]=St[1],e[t+2]=St[2];const i=Ct/s.unitInMeters;(Math.abs(yt[0]-e[t])>=i||Math.abs(yt[1]-e[t+1])>=i||Math.abs(yt[2]-e[t+2])>=i)&&(_=!0),g.offset+=3,t+=3}}if(_){const e=n.get(t);e&&_t(t,e,f),a.geometryVertexAttributeUpdated(h[l],tt.NORMALCOMPRESSED),t.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(h[l],tt.POSITION),h[l+1].invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(h[l+1],tt.POSITION)}u+=x/b}return u/g}function _t(t,e,r){const o=t.getMutableAttribute(tt.POSITION),s=t.getMutableAttribute(tt.NORMALCOMPRESSED).data,{topVertexStart:i,topVertexCount:n,topFaceStart:a,topFaceCount:l}=e,c=o.data,u=n,f=t.attributes.get(tt.POSITION).indices,y=a+l,b=i+n,_=w(3*u);for(let m=0;m<u;++m){const t=3*m;_[t+0]=0,_[t+1]=0,_[t+2]=0}const x=Et,S=vt,j=It,P=At,O=jt;for(let w=a;w<y;++w){const t=3*w;for(let e=0;e<3;++e){const o=f[t+e];P[e]=o;const s=3*o;m(St,c[s+0],c[s+1],c[s+2]),p(x[e],St,r)}h(S,x[1],x[0]),h(j,x[2],x[0]),g(O,S,j),d(O,O);for(let e=0;e<3;++e){const t=3*(P[e]-i);_[t+0]+=O[0],_[t+1]+=O[1],_[t+2]+=O[2]}}for(let m=i;m<b;++m){const t=3*(m-i),e=_[t+0],r=_[t+1],o=_[t+2],n=Math.sqrt(e*e+r*r+o*o);Y(s,m,e/n,r/n,o/n)}}function xt(t){return 1===(t.material?.color?.a??1)}const St=b(),jt=b(),Pt=new z,wt=[0,2,1],Ot=[0,1,2],Ct=.01,Et=[b(),b(),b()],vt=b(),It=b(),At=[0,0,0];var Mt;!function(t){t[t.Main=0]="Main",t[t.Bottom=1]="Bottom"}(Mt||(Mt={}));class Lt{constructor(t,e,r,o){this.positions=t,this.elevation=e,this.normals=r,this.heights=o}}class Bt{constructor(t,e,r,o){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=o}}export{st as Graphics3DExtrudeSymbolLayer,nt as extrudePolygon};
5
+ import"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as s}from"../../../../chunks/earcut.js";import{normalFromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as c,t as m,a as p,h,n as u,c as g,d}from"../../../../chunks/vec32.js";import{ONES as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as j}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as P,getZeroIndexArray as w}from"../../../../geometry/support/Indices.js";import{t as O}from"../../../../chunks/vec3.js";import{makeVertexCandidate as E,makeEdgeCandidate as M}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as v}from"../../../../renderers/support/renderingInfoUtils.js";import{EmissiveSourceMode as C}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as I}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as L}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as D,Graphics3DObject3DGraphicLayer as B}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as U}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,computeCentroid as R}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{geometryAsPolygon as G}from"./polygonUtils.js";import{createMaterial as N}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as F}from"../../support/debugFlags.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as H}from"../../support/renderInfoUtils/polygon.js";import{NormalType as W}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as q}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as Y}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as Z}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as J}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as K,compressNormal as Q}from"../../webgl-engine/lib/Normals.js";import{Object3D as X}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as $}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as tt}from"../../webgl-engine/materials/DefaultMaterial.js";import{GeometryType as et}from"../../webgl-engine/lib/IntersectableGeometry.js";const rt=["polygon","extent"];class st extends U{constructor(t,e,r,s){super(t,e,r,s,_t(e)),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=z(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=this.symbolLayer,r=e?.material,s=this.symbolLayer.material?.color?.a,o=this.needsDrivenTransparentPass||null!=s&&1!==s,i=r?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==s||0===s),a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:o,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrength:i?.strength??0,emissiveSource:C.Color,offsetTransparentBackfaces:!0,normalType:W.Compressed},l=new tt(a,this._context),c=new tt({...a,cullFace:Y.Back},this._context);this._materials[It.Main]=l,this._materials[It.Bottom]=c,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,rt,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);V(r,r);const s=this.setGraphicElevationContext(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[It.Main]?.setParameters({layerOpacity:r}),this._materials[It.Bottom]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach((t=>e(t)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._materials[It.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[It.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach((t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[It.Main]?.setParameters(t),this._materials[It.Bottom]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?v(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?T.RecreateSymbol:T.RecreateGraphics}async queryForSnapping(t,s,o,i){const n=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+n,t.type){case"edge":{const{start:r,end:s}=t,o=e(r),i=e(s);return o.z=(o.z??0)+n,i.z=(i.z??0)+n,[M(a,c,1/0,o,i)]}case"vertex":return[E(a,c,1/0),M(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,r,a,c){const m=G(t.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const p=H(m,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(p,m.rings,"rings","ExtrudeSymbol3DLayer");const h=R(m);if(null==h)return null;const u=new Array,g=new Array,d=_(),f=l(),w=y(),E=this._context.renderCoordsHelper.viewingMode===I.Global;E||this._context.renderCoordsHelper.worldUpAtPosition(null,w),b(m.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const M=l();n(M,f);const v=i();o(v,M);const{polygons:C,mapPositions:L,position:U}=p,z=new Map,T=this._materials[It.Main];for(const o of C){const t=o.count;if(this._context.clippingExtent&&(x(o.mapPositions,d),!S(d,this._context.clippingExtent)))continue;const i=s(o.mapPositions,o.holeIndices,3);if(0===i.length)continue;const n=i.length,a=6*t,l=P(a+n),m=P(n),p=j(3*a),h=j(3*a),y=j(3*a),b=j(a);it(U,L,i,o,p,y,h,b,l,m,this._getExtrusionSize(e),w,E),O(p,p,M);const _=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),v=new At(p,y,K(h),b),C=ot(T,l,l.length-m.length,v,r,_),I=t,A=t,D=2*o.count,B=new Lt(I,A,D,n/3);bt(C,B,f),z.set(C,B),u.push(C,ot(this._materials[It.Bottom],m,0,v,r,_)),g.push(v.heights)}if(0===u.length)return null;const V=new X({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});V.transformation=f;const F=N(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=F?new D(this._materials[It.Main],F,this._context.slicePlaneEnabled):null,W=new B(this,V,null,((t,e,r,s,o)=>yt(t,e,r,s,o,g,z)),a,k);return W.alignedSampledElevation=p.sampledElevation,W.needsElevationUpdates=A(a.mode),W}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[It.Main];t&&t.setParameters({cullFace:t.transparent?Y.None:Y.Back})}}function ot(t,e,r,s,o,i){const n=w(e.length),a=[[$.POSITION,new q(s.positions,e,3,!0)],[$.NORMALCOMPRESSED,new q(s.normals,e,2,!0)],[$.SYMBOLCOLOR,new q(o,n,4,!0)]];return new Z(t,a,s.elevation,et.Mesh,i,r)}function it(t,e,r,s,o,i,n,a,l,c,m,p,h){const u=r.length/3;let g=2*s.count;nt(t,e,s.index,s.count,r,0,u,o,i,n,a,l,c,g,m,p,h);let d=0,f=2*s.count;g=0;const y=s.pathLengths[0];ct(o,i,a,n,d,y,s.count,f,l,g,m),f+=4*y,g+=2*y,d+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];ct(o,i,a,n,d,t,s.count,f,l,g,m),f+=4*t,g+=2*t,d+=t}}function nt(t,e,r,s,o,i,n,a,l,c,m,p,h,d,f,y,b){g(St,y),l??=[],c??=[],m??=[];const _=f>0?1:-1;let x=3*r,S=0,j=3*S,P=s,w=3*P;for(let g=0;g<s;++g){const r=t[x],s=t[x+1],o=t[x+2];b&&(St[0]=r,St[1]=s,St[2]=o,u(St,St)),a[j+0]=r,a[j+1]=s,a[j+2]=o;const i=e[x+0],n=e[x+1],p=e[x+2];l[j+0]=i,l[j+1]=n,l[j+2]=p,c[j+0]=-_*St[0],c[j+1]=-_*St[1],c[j+2]=-_*St[2],m[S]=0,a[w+0]=r+f*St[0],a[w+1]=s+f*St[1],a[w+2]=o+f*St[2],l[w+0]=i,l[w+1]=n,l[w+2]=p,m[P]=f,j+=3,w+=3,x+=3,S+=1,P+=1}x=3*i,j=0,w=3*d;const O=f<0?wt:Pt,E=f<0?Pt:wt;for(let u=0;u<n;++u)h[j]=o[x+O[0]],h[j+1]=o[x+O[1]],h[j+2]=o[x+O[2]],p[w]=o[x+E[0]]+s,p[w+1]=o[x+E[1]]+s,p[w+2]=o[x+E[2]]+s,j+=3,w+=3,x+=3}function at(t,e,r,s,o,i,n){s[i]=s[n],n*=3,t[i*=3]=t[n],t[i+1]=t[n+1],t[i+2]=t[n+2],e[i]=e[n],e[i+1]=e[n+1],e[i+2]=e[n+2],r[i]=o[0],r[i+1]=o[1],r[i+2]=o[2]}const lt=y();function ct(t,e,r,s,o,i,n,a,l,c,m){e??=[],r??=[],s??=[];let p=o,h=o+1,u=o+n,g=o+n+1,d=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(p=o+n+1,g=o);let _=3*c;for(let x=0;x<i;++x)x===i-1&&(h=o,m>0?g=o+n:p=o+n),dt(t,p,h,u,lt),at(t,e,s,r,lt,d,p),at(t,e,s,r,lt,f,h),at(t,e,s,r,lt,y,u),at(t,e,s,r,lt,b,g),l[_]=d,l[_+1]=y,l[_+2]=b,l[_+3]=d,l[_+4]=b,l[_+5]=f,_+=6,p++,h++,u++,g++,d+=2,f+=2,y+=2,b+=2}const mt=y(),pt=y(),ht=y(),ut=y(),gt=y();function dt(t,e,r,s,o){e*=3,r*=3,s*=3,c(mt,t[e++],t[e++],t[e++]),c(pt,t[r++],t[r++],t[r++]),c(ht,t[s++],t[s++],t[s++]),d(ut,pt,mt),d(gt,ht,mt),h(o,gt,ut),u(o,o)}const ft=y();function yt(t,e,r,s,o,i,n){const p=t.stageObject,h=p.geometries,u=h.length,g="absolute-height"!==e.mode;let d=0;const f=p.transformation,y=a(l(),f);for(let a=0;a<u;a+=2){const t=h[a];if(!J(t))continue;const e=t.getMutableAttribute($.POSITION).data,l=i[a/2],u=new k(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let i=0;i<b;i++){ft[0]=e[t],ft[1]=e[t+1],ft[2]=e[t+2],s(u,jt),g&&(x+=jt.sampledElevation),F.TESTS_DISABLE_OPTIMIZATIONS?(c(xt,u.array[u.offset],u.array[u.offset+1],jt.z+l[t/3]),null!=r&&o.toRenderCoords(xt,r,xt),m(xt,xt,y)):(c(xt,e[t],e[t+1],e[t+2]),m(xt,xt,f),o.setAltitude(xt,jt.z+l[t/3]),m(xt,xt,y)),e[t]=xt[0],e[t+1]=xt[1],e[t+2]=xt[2];const i=Ot/o.unitInMeters;(Math.abs(ft[0]-e[t])>=i||Math.abs(ft[1]-e[t+1])>=i||Math.abs(ft[2]-e[t+2])>=i)&&(_=!0),u.offset+=3,t+=3}}if(_){const e=n.get(t);e&&bt(t,e,f),p.geometryVertexAttributeUpdated(h[a],$.NORMALCOMPRESSED),t.invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(h[a],$.POSITION),h[a+1].invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(h[a+1],$.POSITION)}d+=x/b}return d/u}function bt(t,e,r){const s=t.getMutableAttribute($.POSITION),o=t.getMutableAttribute($.NORMALCOMPRESSED).data,{topVertexStart:i,topVertexCount:n,topFaceStart:a,topFaceCount:l}=e,g=s.data,d=n,f=t.attributes.get($.POSITION).indices,y=a+l,b=i+n,_=j(3*d);for(let c=0;c<d;++c){const t=3*c;_[t+0]=0,_[t+1]=0,_[t+2]=0}const x=Et,S=Mt,P=vt,w=Ct,O=St;for(let j=a;j<y;++j){const t=3*j;for(let e=0;e<3;++e){const s=f[t+e];w[e]=s;const o=3*s;c(xt,g[o+0],g[o+1],g[o+2]),m(x[e],xt,r)}p(S,x[1],x[0]),p(P,x[2],x[0]),h(O,S,P),u(O,O);for(let e=0;e<3;++e){const t=3*(w[e]-i);_[t+0]+=O[0],_[t+1]+=O[1],_[t+2]+=O[2]}}for(let c=i;c<b;++c){const t=3*(c-i),e=_[t+0],r=_[t+1],s=_[t+2],n=Math.sqrt(e*e+r*r+s*s);Q(o,c,e/n,r/n,s/n)}}function _t(t){return 1===(t.material?.color?.a??0)}const xt=y(),St=y(),jt=new L,Pt=[0,2,1],wt=[0,1,2],Ot=.01,Et=[y(),y(),y()],Mt=y(),vt=y(),Ct=[0,0,0];var It;!function(t){t[t.Main=0]="Main",t[t.Bottom=1]="Bottom"}(It||(It={}));class At{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class Lt{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{st as Graphics3DExtrudeSymbolLayer,it as extrudePolygon};